Not implemented Error: Unsupported type for OGR: DECIMAL(#,#)
Similar to https://github.com/duckdb/duckdb-spatial/issues/468 it seems like Decimals aren't being converted to be sent to the GDAL driver. Here's a minimal reproduction:
install spatial;
load spatial;
COPY (
SELECT
ST_Point(50, 50) AS "geometry",
CAST(50 AS DECIMAL(9,6)) AS "longitude",
CAST(50 AS DECIMAL(9,6)) AS "latitude",
) TO 'test.geojson' WITH (FORMAT GDAL, DRIVER 'GeoJSON', LAYER_NAME 'Testing Decimals')
Workaround: Casting it to a FLOAT works
I have the same problem when trying to write a shapefile with precision Decimal(8,2). "Not implemented Error: Unsupported type for OGR: DECIMAL(8,2)". Not sure how hard this is to fix but would be nice to have this working correctly. The alias for decimal (numeric) is supported in ogr2ogr as much as i know, but duckdb is converting it back to decimal. Casting it to float is not enough for me. I need shapefile precision.
Same issue with decimal(#), which is an alias for decimal(#, 0). Casting to integer fixes the problem.
Im rewriting the GDAL integration code for DuckDB v1.5, so this will be fixed then.