Composite Type converted to string when using postgres_query
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Reproduce the issue from the Python client with the composite type and postgres_query on PostgreSQL 17.5 and DuckDB 1.3.2, then compare its result metadata and values with a direct select. Trace the composite-result type handling and consider the work complete when postgres_query returns dict values instead of a string representation.
Written by the indexing model from the issue text.
Description
What happens?
I try to query a composite type defined as this:
CREATE TYPE dim.tree_info_type AS
(
id bigint,
ordered_nr bigint,
children_to_nr bigint,
level integer,
parent_ids bigint[]
);
using postgres_query:
conn.execute(
""" select * from postgres_query('az_postgres', 'select tree_info from dim.article_group_tree limit 10')"""
)
print(conn.description)
print(conn.fetchall())
which gives me:
[('tree_info', 'STRING', None, None, None, None, None)]
[('(1,1,233,0,{})',), ('(2,234,672,0,{})',), ('(3,673,1045,0,{})',), ('(4,1046,1081,0,{})',), ('(5,1082,1125,0,{})',), ('(6,1126,1145,0,{})',), ('(7,1146,1216,0,{})',), ('(8,1217,1231,0,{})',), ('(9,1232,1248,0,{})',), ('(10,1249,1252,0,{})',)]
It should be a dict, which works if I do the select directly
[('tree_info', 'dict', None, None, None, None, None)]
[({'id': 1, 'ordered_nr': 1, 'children_to_nr': 233, 'level': 0, 'parent_ids': []},), ({'id': 2, 'ordered_nr': 234, 'children_to_nr': 672, 'level': 0, 'parent_ids': []},), ({'id': 3, 'ordered_nr': 673, 'children_to_nr': 1045, 'level': 0, 'parent_ids': []},), ({'id': 4, 'ordered_nr': 1046, 'children_to_nr': 1081, 'level': 0, 'parent_ids': []},), ({'id': 5, 'ordered_nr': 1082, 'children_to_nr': 1125, 'level': 0, 'parent_ids': []},), ({'id': 6, 'ordered_nr': 1126, 'children_to_nr': 1145, 'level': 0, 'parent_ids': []},), ({'id': 7, 'ordered_nr': 1146, 'children_to_nr': 1216, 'level': 0, 'parent_ids': []},), ({'id': 8, 'ordered_nr': 1217, 'children_to_nr': 1231, 'level': 0, 'parent_ids': []},), ({'id': 9, 'ordered_nr': 1232, 'children_to_nr': 1248, 'level': 0, 'parent_ids': []},), ({'id': 10, 'ordered_nr': 1249, 'children_to_nr': 1252, 'level': 0, 'parent_ids': []},)
To Reproduce
- Create the type as described
- Create a sample table
- insert some data
- Query it using postgres_query
OS:
Windows
PostgreSQL Version:
17.5
DuckDB Version:
1.3.2
DuckDB Client:
Python
Full Name:
Adrian Ehrsam
Affiliation:
Building Material Suisse
Have you tried this on the latest main branch?
- I agree
Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
- I agree
- Dominant language
- C++
- Stars
- 372
- Forks
- 107
- Avg merge
- 13h 55m
- Merged PRs (30d)
- 13
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from duckdb/duckdb-postgres
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
duckdb/duckdb-postgres#575 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
duckdb/duckdb-postgres#564 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
duckdb/duckdb-postgres#491 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
duckdb/duckdb-postgres#487 · 1 comment ·
Maintainers usually reply within 1 day
-
After `COPY DATABASE FROM <pg>`, the types from pg are improperly formatted in `EXPORT` commandsOpen
Difficulty 4/5 3-5 days Newbie friendliness 48/100
duckdb/duckdb-postgres#429 ·
Maintainers usually reply within 1 day
All issues in duckdb/duckdb-postgres
Similar issues
-
Status: Awaiting triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
espressif/arduino-esp32#12984 ·
Maintainers usually reply within 1 day
-
torch_ops/logprob.cu does not compile with the serving container's nvcc (13.3.73); check_torch_ops.py cannot run as shippedPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 Under an hour Newbie friendliness 72/100
ashhart/TensorFold#535 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 Under an hour Newbie friendliness 78/100
sudoevolve/EUI-NEO#95 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day