Can't create table with GEOMETRY type using CTAS
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Start by reproducing the CTAS statement from the issue in the DuckDB CLI with PostgreSQL 14 and compare it with the explicit GEOMETRY table plus INSERT path. Trace how ST_Point's geometry type is handled during CTAS and insertion; done means the CTAS statement succeeds and the resulting geom column retains the expected geometry value.
Written by the indexing model from the issue text.
Description
What happens?
Original issue reported on discord.
This doesn't work.
CREATE TABLE postgres_db.my_schema.my_table AS
SELECT ST_Point (.22, 1.22) AS geom
-- Failed to copy data: ERROR: Unknown WKB type (0)! Full WKB type number was (0)
But this does
CREATE TABLE postgres_db.my_schema.my_table (geom GEOMETRY);
INSERT INTO postgres_db.my_schema.my_table VALUES (ST_Point (.22, 1.22))
My guess is that during inserts we map the Postgres geometry type to WKB_BLOB, which spatial then auto-casts to from GEOMETRY. But this doesn't work during CTAS because no implicit cast get inserted.
To Reproduce
CREATE TABLE postgres_db.my_schema.my_table AS
SELECT ST_Point (.22, 1.22) AS geom
OS:
MacOS
PostgreSQL Version:
14
DuckDB Version:
1.2.0
DuckDB Client:
CLI
Full Name:
Max Gabrielsson
Affiliation:
DuckDB Labs
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