duckdb_spatial icon indicating copy to clipboard operation
duckdb_spatial copied to clipboard

Not implemented Error: Unsupported type for OGR: DECIMAL(#,#)

Open rory-orennia opened this issue 1 year ago • 3 comments

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

rory-orennia avatar Jan 14 '25 20:01 rory-orennia

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.

jakoblo avatar Feb 21 '25 08:02 jakoblo

Same issue with decimal(#), which is an alias for decimal(#, 0). Casting to integer fixes the problem.

frafra avatar Feb 24 '25 15:02 frafra

Im rewriting the GDAL integration code for DuckDB v1.5, so this will be fixed then.

Maxxen avatar Oct 31 '25 12:10 Maxxen