unresolved_type issues
What happens?
Once the query gets executed by DuckDB the actual type will be filled in by DuckDB. So, a query result will never contain a column that has duckdb.unresolved_type as its type. So, if you get errors involving this type, please report an issue.
I'm trying to get a duckdb geometry into postgres by wrapping it in ST_AsText() to return a string, but I get an error that it is always an unresolved type.
To Reproduce
Run this query in postgres:
select duckdb.install_extension('spatial');
select
r['id'],
r['primary_name'],
r['height'],
st_geomfromtext(r['geom_text']) as geom
from duckdb.query('
SELECT
id,
names.primary as primary_name,
height,
st_astext(geometry) as geom_text
FROM ''s3://overturemaps-us-west-2/release/2025-01-22.0/theme=buildings/type=building/*.parquet''
limit 10
') r;
You will get the following error:
ERROR: function st_geomfromtext(duckdb.unresolved_type) does not exist
LINE 6: st_geomfromtext(r['geom_text']) as geom
OS:
Linux on Docker on aarch64 Mac
pg_duckdb Version (if built from source use commit hash):
0.3.1
Postgres Version (if built from source use commit hash):
17
Hardware:
No response
Full Name:
Travis Webb
Affiliation:
myself
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a stable release
Did you include all relevant data sets for reproducing the issue?
Yes
Did you include all code required to reproduce the issue?
- [x] Yes, I have
Did you include all relevant configuration (e.g., CPU architecture, Linux distribution) to reproduce the issue?
- [x] Yes, I have
Apart from improving official spatial support I don't think we can really improve this. It's also related to #615 where your usecase would be option item 1 in the list in that issue:
Converting a PG-only type (e.g. from an extension), to a type that duckdb understands. e.g. taking a PG spatial type, and converting it to a text representation.
That's currently unsupported also.