Ticket #3502 (new defect)
[PATCH] Spatialite: work around crash when creating a spatialindex on a layer without SRS
|Reported by:||rouault||Owned by:||warmerdam|
spatialite-2.3.1 and recent trunk crashes when calling SELECT CreateSpatialIndex?('layer_name', 'GEOMETRY') where layer_name is a layer created without any SRS. Thus the current code doesn't fill the srid column in the geometry_columns table. But the CreateSpatialIndex?() function in spatialite code supposes the content is not NULL and crashes. I reported this to Alessandro Furieri but haven't received any answer back.
Anyway, the workaround is simple. Just insert srid=-1 when no srid is available. But I'm still reluctant to commit the patch as the srid in geometry_columns should match a srid in spatial_ref_sys (foreign key). The triggers to check the condition during the insertion is not created by spatialite, so this actually works