[postgis-tickets] r15938 - Forbid creating raster support objects in a schema != PostGIS one

Sandro Santilli strk at kbt.io
Mon Oct 9 08:45:50 PDT 2017


Author: strk
Date: 2017-10-09 08:45:49 -0700 (Mon, 09 Oct 2017)
New Revision: 15938

Modified:
   trunk/NEWS
   trunk/raster/rt_pg/rtpostgis.sql.in
Log:
Forbid creating raster support objects in a schema != PostGIS one

Fixes #3893

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2017-10-08 20:38:06 UTC (rev 15937)
+++ trunk/NEWS	2017-10-09 15:45:49 UTC (rev 15938)
@@ -6,6 +6,8 @@
 
 * Breaking Changes *
   - #3885, version number removed from address_standardize lib file
+  - #3893, raster support functions can only be loaded in the same schema
+           with core PostGIS functions.
 
 PostGIS 2.4.0
 2017/09/30

Modified: trunk/raster/rt_pg/rtpostgis.sql.in
===================================================================
--- trunk/raster/rt_pg/rtpostgis.sql.in	2017-10-08 20:38:06 UTC (rev 15937)
+++ trunk/raster/rt_pg/rtpostgis.sql.in	2017-10-09 15:45:49 UTC (rev 15938)
@@ -56,7 +56,26 @@
 END
 $$ LANGUAGE 'plpgsql';
 
+-- Check that postgis raster is being installed in the same
+-- schema as PostGIS
+DO $$
+DECLARE
+  nsp TEXT;
+BEGIN
+  SELECT n.nspname
+	INTO nsp FROM pg_proc p, pg_namespace n
+  WHERE p.proname = 'postgis_lib_version'
+  AND p.pronamespace = n.oid;
 
+	IF nsp != current_schema() THEN
+    RAISE EXCEPTION
+			'PostGIS Raster must be in the same schema as PostGIS (%)',
+			nsp;
+	END IF;
+END
+$$ LANGUAGE 'plpgsql';
+
+
 ------------------------------------------------------------------------------
 -- RASTER Type
 ------------------------------------------------------------------------------



More information about the postgis-tickets mailing list