[postgis-tickets] r17979 - Fix PLPGSQL functions missing the schema qualification

Raul raul at rmr.ninja
Fri Oct 18 09:37:51 PDT 2019


Author: algunenano
Date: 2019-10-18 09:37:51 -0700 (Fri, 18 Oct 2019)
New Revision: 17979

Modified:
   branches/2.3/NEWS
   branches/2.3/postgis/postgis.sql.in
   branches/2.3/raster/rt_pg/rtpostgis.sql.in
Log:
Fix PLPGSQL functions missing the schema qualification

Closes #4546


Modified: branches/2.3/NEWS
===================================================================
--- branches/2.3/NEWS	2019-10-18 16:32:35 UTC (rev 17978)
+++ branches/2.3/NEWS	2019-10-18 16:37:51 UTC (rev 17979)
@@ -15,6 +15,7 @@
   - #4537, Fix leak in WKT collection parser (Raúl Marín)
   - #4547, Fix AddRasterConstraints handling of empty tables (Sandro Santilli)
   - #4549, Fix schema qualification of internal types (Raúl Marín)
+  - #4546, Fix PLPGSQL functions missing the schema qualification (Raúl Marín)
 
 PostGIS 2.3.10
 2019/08/11

Modified: branches/2.3/postgis/postgis.sql.in
===================================================================
--- branches/2.3/postgis/postgis.sql.in	2019-10-18 16:32:35 UTC (rev 17978)
+++ branches/2.3/postgis/postgis.sql.in	2019-10-18 16:37:51 UTC (rev 17979)
@@ -2112,7 +2112,7 @@
         IF upper(gc_old.type) = 'GEOMETRY' THEN
         -- This is an unconstrained geometry we need to do something
         -- We need to figure out what to set the type by inspecting the data
-            EXECUTE 'SELECT @extschema at .ST_srid(' || quote_ident(gcs.attname) || ') As srid, GeometryType(' || quote_ident(gcs.attname) || ') As type, @extschema at .ST_NDims(' || quote_ident(gcs.attname) || ') As dims ' ||
+            EXECUTE 'SELECT @extschema at .ST_srid(' || quote_ident(gcs.attname) || ') As srid, @extschema at .GeometryType(' || quote_ident(gcs.attname) || ') As type, @extschema at .ST_NDims(' || quote_ident(gcs.attname) || ') As dims ' ||
                      ' FROM ONLY ' || quote_ident(gcs.nspname) || '.' || quote_ident(gcs.relname) ||
                      ' WHERE ' || quote_ident(gcs.attname) || ' IS NOT NULL LIMIT 1;'
                 INTO gc;
@@ -4771,7 +4771,7 @@
 	RETURNS geometry
 	AS '
 	SELECT CASE
-	WHEN geometrytype(@extschema at .ST_GeomFromText($1, $2)) = ''GEOMETRYCOLLECTION''
+	WHEN @extschema at .geometrytype(@extschema at .ST_GeomFromText($1, $2)) = ''GEOMETRYCOLLECTION''
 	THEN @extschema at .ST_GeomFromText($1,$2)
 	ELSE NULL END
 	'
@@ -5120,8 +5120,8 @@
 DECLARE
 	geomtext alias for $1;
 	srid alias for $2;
-	mline geometry;
-	geom geometry;
+	mline @extschema at .geometry;
+	geom @extschema at .geometry;
 BEGIN
 	mline := @extschema at .ST_MultiLineStringFromText(geomtext, srid);
 
@@ -5132,7 +5132,7 @@
 
 	geom := @extschema at .ST_BuildArea(mline);
 
-	IF GeometryType(geom) != 'POLYGON'
+	IF @extschema at .GeometryType(geom) != 'POLYGON'
 	THEN
 		RAISE EXCEPTION 'Input returns more then a single polygon, try using BdMPolyFromText instead';
 	END IF;
@@ -5162,8 +5162,8 @@
 DECLARE
 	geomtext alias for $1;
 	srid alias for $2;
-	mline geometry;
-	geom geometry;
+	mline @extschema at .geometry;
+	geom @extschema at .geometry;
 BEGIN
 	mline := @extschema at .ST_MultiLineStringFromText(geomtext, srid);
 
@@ -5609,14 +5609,14 @@
   RETURNS geometry AS
 $$
 	DECLARE
-	vexhull GEOMETRY;
-	var_resultgeom geometry;
-	var_inputgeom geometry;
-	vexring GEOMETRY;
-	cavering GEOMETRY;
-	cavept geometry[];
+	vexhull @extschema at .geometry;
+	var_resultgeom @extschema at .geometry;
+	var_inputgeom @extschema at .geometry;
+	vexring @extschema at .geometry;
+	cavering @extschema at .geometry;
+	cavept @extschema at .geometry[];
 	seglength double precision;
-	var_tempgeom geometry;
+	var_tempgeom @extschema at .geometry;
 	scale_factor float := 1;
 	i integer;
 
@@ -5681,18 +5681,18 @@
 CREATE OR REPLACE FUNCTION ST_ConcaveHull(param_geom geometry, param_pctconvex float, param_allow_holes boolean DEFAULT false) RETURNS geometry AS
 $$
 	DECLARE
-		var_convhull geometry := @extschema at .ST_ConvexHull(param_geom);
-		var_param_geom geometry := param_geom;
+		var_convhull @extschema at .geometry := @extschema at .ST_ConvexHull(param_geom);
+		var_param_geom @extschema at .geometry := param_geom;
 		var_initarea float := @extschema at .ST_Area(var_convhull);
 		var_newarea float := var_initarea;
 		var_div integer := 6; /** this is the 1/var_div is the percent increase we will allow per triangle to keep speed decent **/
-		var_tempgeom geometry;
-		var_tempgeom2 geometry;
-		var_cent geometry;
-		var_geoms geometry[4]; /** We will cut the current geometry into 4 triangular quadrants along the centroid/extent **/
-		var_enline geometry;
-		var_resultgeom geometry;
-		var_atempgeoms geometry[];
+		var_tempgeom @extschema at .geometry;
+		var_tempgeom2 @extschema at .geometry;
+		var_cent @extschema at .geometry;
+		var_geoms @extschema at .geometry[4]; /** We will cut the current geometry into 4 triangular quadrants along the centroid/extent **/
+		var_enline @extschema at .geometry;
+		var_resultgeom @extschema at .geometry;
+		var_atempgeoms @extschema at .geometry[];
 		var_buf float := 1; /**tolerance so that geometries that are right on the extent don't get accidentally clipped off **/
 	BEGIN
 		-- We start with convex hull as our base

Modified: branches/2.3/raster/rt_pg/rtpostgis.sql.in
===================================================================
--- branches/2.3/raster/rt_pg/rtpostgis.sql.in	2019-10-18 16:32:35 UTC (rev 17978)
+++ branches/2.3/raster/rt_pg/rtpostgis.sql.in	2019-10-18 16:37:51 UTC (rev 17979)
@@ -2024,7 +2024,7 @@
 	RETURNS bytea
 	AS $$
 	DECLARE
-		rast2 raster;
+		rast2 @extschema at .raster;
 		num_bands int;
 		i int;
 	BEGIN
@@ -2102,7 +2102,7 @@
 	RETURNS bytea
 	AS $$
 	DECLARE
-		rast2 raster;
+		rast2 @extschema at .raster;
 		num_bands int;
 		i int;
 		pt text;
@@ -2316,7 +2316,7 @@
 	RETURNS raster
 	AS $$
 	DECLARE
-		g geometry;
+		g @extschema at .geometry;
 		g_srid integer;
 
 		ul_x double precision;
@@ -3834,7 +3834,7 @@
 	RETURNS raster
 	AS $$
 	DECLARE
-		_rast raster;
+		_rast @extschema at .raster;
 		_nband integer;
 		_pixtype text;
 		_pixwidth double precision;
@@ -3841,7 +3841,7 @@
 		_pixheight double precision;
 		_width integer;
 		_height integer;
-		_customextent raster;
+		_customextent @extschema at .raster;
 		_extenttype text;
 	BEGIN
 		_customextent := customextent;
@@ -3891,7 +3891,7 @@
 	scale double precision DEFAULT 1.0,	interpolate_nodata boolean DEFAULT FALSE
 )
 	RETURNS raster
-	AS $$ SELECT @extschema at .ST_slope($1, $2, NULL::raster, $3, $4, $5, $6) $$
+	AS $$ SELECT @extschema at .ST_slope($1, $2, NULL::@extschema at .raster, $3, $4, $5, $6) $$
 	LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4017,12 +4017,12 @@
 	RETURNS raster
 	AS $$
 	DECLARE
-		_rast raster;
+		_rast @extschema at .raster;
 		_nband integer;
 		_pixtype text;
 		_width integer;
 		_height integer;
-		_customextent raster;
+		_customextent @extschema at .raster;
 		_extenttype text;
 	BEGIN
 		_customextent := customextent;
@@ -4069,7 +4069,7 @@
 	interpolate_nodata boolean DEFAULT FALSE
 )
 	RETURNS raster
-	AS $$ SELECT @extschema at .ST_aspect($1, $2, NULL::raster, $3, $4, $5) $$
+	AS $$ SELECT @extschema at .ST_aspect($1, $2, NULL::@extschema at .raster, $3, $4, $5) $$
 	LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4223,7 +4223,7 @@
 	RETURNS RASTER
 	AS $$
 	DECLARE
-		_rast raster;
+		_rast @extschema at .raster;
 		_nband integer;
 		_pixtype text;
 		_pixwidth double precision;
@@ -4230,7 +4230,7 @@
 		_pixheight double precision;
 		_width integer;
 		_height integer;
-		_customextent raster;
+		_customextent @extschema at .raster;
 		_extenttype text;
 	BEGIN
 		_customextent := customextent;
@@ -4283,7 +4283,7 @@
 	interpolate_nodata boolean DEFAULT FALSE
 )
 	RETURNS RASTER
-	AS $$ SELECT @extschema at .ST_hillshade($1, $2, NULL::raster, $3, $4, $5, $6, $7, $8) $$
+	AS $$ SELECT @extschema at .ST_hillshade($1, $2, NULL::@extschema at .raster, $3, $4, $5, $6, $7, $8) $$
 	LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4383,7 +4383,7 @@
 	RETURNS raster
 	AS $$
 	DECLARE
-		_rast raster;
+		_rast @extschema at .raster;
 		_nband integer;
 		_pixtype text;
 		_pixwidth double precision;
@@ -4390,7 +4390,7 @@
 		_pixheight double precision;
 		_width integer;
 		_height integer;
-		_customextent raster;
+		_customextent @extschema at .raster;
 		_extenttype text;
 	BEGIN
 		_customextent := customextent;
@@ -4435,7 +4435,7 @@
 	pixeltype text DEFAULT '32BF', interpolate_nodata boolean DEFAULT FALSE
 )
 	RETURNS RASTER
-	AS $$ SELECT @extschema at .ST_tpi($1, $2, NULL::raster, $3, $4) $$
+	AS $$ SELECT @extschema at .ST_tpi($1, $2, NULL::@extschema at .raster, $3, $4) $$
 	LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4519,7 +4519,7 @@
 	RETURNS raster
 	AS $$
 	DECLARE
-		_rast raster;
+		_rast @extschema at .raster;
 		_nband integer;
 		_pixtype text;
 		_pixwidth double precision;
@@ -4526,7 +4526,7 @@
 		_pixheight double precision;
 		_width integer;
 		_height integer;
-		_customextent raster;
+		_customextent @extschema at .raster;
 		_extenttype text;
 	BEGIN
 		_customextent := customextent;
@@ -4566,7 +4566,7 @@
 	pixeltype text DEFAULT '32BF', interpolate_nodata boolean DEFAULT FALSE
 )
 	RETURNS RASTER
-	AS $$ SELECT @extschema at .ST_roughness($1, $2, NULL::raster, $3, $4) $$
+	AS $$ SELECT @extschema at .ST_roughness($1, $2, NULL::@extschema at .raster, $3, $4) $$
 	LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4665,7 +4665,7 @@
 	RETURNS raster
 	AS $$
 	DECLARE
-		_rast raster;
+		_rast @extschema at .raster;
 		_nband integer;
 		_pixtype text;
 		_pixwidth double precision;
@@ -4672,7 +4672,7 @@
 		_pixheight double precision;
 		_width integer;
 		_height integer;
-		_customextent raster;
+		_customextent @extschema at .raster;
 		_extenttype text;
 	BEGIN
 		_customextent := customextent;
@@ -4717,7 +4717,7 @@
 	pixeltype text DEFAULT '32BF', interpolate_nodata boolean DEFAULT FALSE
 )
 	RETURNS RASTER
-	AS $$ SELECT @extschema at .ST_tri($1, $2, NULL::raster, $3, $4) $$
+	AS $$ SELECT @extschema at .ST_tri($1, $2, NULL::@extschema at .raster, $3, $4) $$
 	LANGUAGE 'sql' IMMUTABLE _PARALLEL;
 
 -----------------------------------------------------------------------
@@ -4993,7 +4993,7 @@
     $$
     DECLARE
         params text[];
-        rastout raster;
+        rastout @extschema at .raster;
     BEGIN
         IF rast IS NULL THEN
             RAISE WARNING 'Cannot set georeferencing on a null raster in st_setgeoreference.';
@@ -6450,7 +6450,7 @@
 	RETURNS raster
 	AS $$
 	DECLARE
-		rtn raster;
+		rtn @extschema at .raster;
 		_returnband text;
 		newnodata1 float8;
 		newnodata2 float8;
@@ -7351,8 +7351,8 @@
 		_tileheight integer;
 		_alignment boolean;
 
-		_covextent geometry;
-		_covrast raster;
+		_covextent @extschema at .geometry;
+		_covrast @extschema at .raster;
 	BEGIN
 		fqtn := '';
 		IF length($1) > 0 THEN
@@ -8640,7 +8640,7 @@
 		sql := 'UPDATE ' || fqtn ||
 			' SET ' || quote_ident($3) ||
 			' =  @extschema at .ST_SetSRID(' || quote_ident($3) ||
-			'::raster, ' || srid || ')';
+			'::@extschema at .raster, ' || srid || ')';
 		RAISE NOTICE 'sql = %', sql;
 		EXECUTE sql;
 
@@ -8692,7 +8692,7 @@
   ipy FLOAT8;
   tx int;
   ty int;
-  te GEOMETRY; -- tile extent
+  te @extschema at .GEOMETRY; -- tile extent
   ncols int;
   nlins int;
   srid int;



More information about the postgis-tickets mailing list