When trying to create a RTREE spatial index with a geometry field that has a CRS, I get an error that I can only do this on plain GEOMETRY columns. Here's a reproduction (view example csv)
INSTALL spatial;
LOAD spatial;
.print '=== DuckDB version (need v1.5.0 or newer) ==='
SELECT version() AS duckdb_version;
.print '=== 1. Control: plain GEOMETRY + RTREE ==='
CREATE OR REPLACE TABLE lighthouses_plain AS
SELECT
name,
country,
longitude,
latitude,
height_m,
year_built,
ST_Point(longitude, latitude)::GEOMETRY AS geom
FROM read_csv_auto('lighthouses.csv');
CREATE INDEX IF NOT EXISTS lighthouses_plain_geom_idx
ON lighthouses_plain USING RTREE (geom);
.print '=== 2. Bug repro: GEOMETRY(''OGC:CRS84'') + RTREE ==='
CREATE OR REPLACE TABLE lighthouses_crs AS
SELECT
name,
country,
longitude,
latitude,
height_m,
year_built,
ST_Point(longitude, latitude)::GEOMETRY('OGC:CRS84') AS geom
FROM read_csv_auto('lighthouses.csv');
-- Binder Error: RTree indexes can only be created over GEOMETRY columns.
CREATE INDEX IF NOT EXISTS lighthouses_crs_geom_idx
ON lighthouses_crs USING RTREE (geom);
When trying to create a RTREE spatial index with a geometry field that has a CRS, I get an error that I can only do this on plain
GEOMETRYcolumns. Here's a reproduction (view example csv)