microsoft / microsoft/vscode-pgsql

Unhandled exception while executing query: 'list' object has no attribute 'encode'

Open
#281 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
No language data
Stars
395
Forks
33
Avg merge
1h 46m
Merged PRs (30d)
3

Description

Describe the bug

When querying pgrowlocks() provided by the pgrowlocks extension, we get this error.

Example, in one session:

create table demo as select 1;
begin;
delete from demo;

Then in vscode:

create extension pgrowlocks;
select * from pgrowlocks('demo');

11:16:02 AM
Started executing query at Line 55
Unhandled exception while executing query: 'list' object has no attribute 'encode'
Total execution time: 00:00:00.108

When casting "xids" to text it works:

select locked_row, locker, multi,  xids::text[], modes, pids from pgrowlocks('demo');

To Reproduce

No need to install the extension to test it:

drop function if exists myfunction();
create or replace function myfunction()
returns table (
    xids xid[]
)
language sql
as $$
select
    array['123'::xid]
$$;

select xids from myfunction();

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the SQL reproduction in the issue, including the pgrowlocks query and the myfunction() query returning xid[]. Trace how the extension handles the returned array value and add or update a regression test for this case; done means selecting the xid[] result no longer raises the encode exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.