[postgis-devel] Turning spatial_ref_sys into a view to separate system vs. user entries

Sandro Santilli strk at kbt.io
Wed Feb 2 08:24:20 PST 2022


On Wed, Feb 02, 2022 at 02:57:21PM +0100, Even Rouault wrote:

> > Insert/delete/update operations on spatial_ref_sys view will be
> > proxied to the spatial_ref_sys_user table, for backward compatibility.
> 
> What happens if a user tries to delete from spatial_ref_sys an entry that
> comes from spatial_ref_sys_postgis ?

At the moment it does something like this:

    ERROR:  System SRID (4326) cannot be deleted

See
https://git.osgeo.org/gitea/postgis/postgis/src/branch/spatial-ref-sys-view/regress/core/spatial_ref_sys.sql
https://git.osgeo.org/gitea/postgis/postgis/src/branch/spatial-ref-sys-view/regress/core/spatial_ref_sys_expected

> I'm asking since GDAL autotest suite
> basically does "DELETE FROM spatial_ref_sys" + "INSERT INTO spatial_ref_sys
> blabla" for one of its PostGIS tests (I guess we could avoid such radical
> wiping out)

My initial implementation actually supported the above,
silently ignoring deletion of system rows and turning
inserts into upserts to user table. Then I changed it
thinking "the new way" would be more "checky" but thanks
for raising this, we could actually go back to the initial
implementation (maybe just printing a NOTICE or a WARNING)

--strk;


More information about the postgis-devel mailing list