GEOMETRY column not recognized 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
Start by reproducing the PostgreSQL GEOMETRY and ST_GeometryFromText cases through postgres_query() in the CLI, then inspect how postgres_query() converts PostgreSQL result types. Compare that path with the import behavior shown in the issue. Done means GEOMETRY results are recognized consistently instead of being returned as varchar, with coverage for both reproduction queries.
Written by the indexing model from the issue text.
Description
What happens?
I have a table in PostgreSQL with a GEOMETRY column. Since DuckDB 1.5, this GEOMETRY column is recognized during import:
select objectid, shape from nupla_uept limit 5;
┌──────────┬─────────────────────────────────┐
│ objectid │ shape │
│ int32 │ geometry │
├──────────┼─────────────────────────────────┤
│ 116927 │ POINT (2604833.296 1208390.399) │
│ 116928 │ POINT (2605120.181 1208221.813) │
│ 116929 │ POINT (2604777.003 1207929.125) │
│ 98169 │ POINT (2610375.849 1189134.644) │
│ 98170 │ POINT (2610409.164 1189117.758) │
└──────────┴─────────────────────────────────┘
However, if I make the query with postgres_query(), the column is not recognized:
select * from postgres_query('vek1', 'SELECT objectid, shape from geodb.nupla_uept') LIMIT 5;
┌──────────┬────────────────────────────────────────────────────┐
│ objectid │ shape │
│ int32 │ varchar │
├──────────┼────────────────────────────────────────────────────┤
│ 116927 │ 010100002008080000F853E3A590DF43412FDD246646703241 │
│ 116928 │ 0101000020080800000C022B1720E043419CC420D09D6F3241 │
│ 116929 │ 010100002008080000D34D628074DF434100000020796E3241 │
│ 98169 │ 0101000020080800003108ACEC63EA43411B2FDDA40E253241 │
│ 98170 │ 010100002008080000B6F3FD9474EA4341BA490CC2FD243241 │
└──────────┴────────────────────────────────────────────────────┘
It does not work with this generic statement either:
select * from postgres_query('vek1', 'select st_geometryfromtext(''POINT(2600000 1200000)'', 2056);');
┌────────────────────────────────────────────────────┐
│ st_geometryfromtext │
│ varchar │
├────────────────────────────────────────────────────┤
│ 0101000020080800000000000020D6434100000000804F3241 │
Is there a reason for this different behavior?
To Reproduce
- Attach a PostgreSQL Database with the PostGIS Extension installed
- Execute
select * from postgres_query('vek1', 'select st_geometryfromtext(''POINT(2600000 1200000)'', 2056);');
OS:
Windows 11
PostgreSQL Version:
15.14
DuckDB Version:
1.5
DuckDB Client:
CLI
Full Name:
Peter Schär
Affiliation:
Office for Geoinformation, Canton Bern, Switzerland
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
-
agent:Windows bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
? - Needs Triage bot_watch bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
NVIDIA/cudf-spark-jni#5267 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
(S1 - Need confirmation)
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
CleverRaven/Cataclysm-DDA#88974 ·
Maintainers usually reply within 1 day