[postgis-tickets] r17959 - Fix schema qualification of internal types

Raul raul at rmr.ninja
Fri Oct 18 05:25:15 PDT 2019


Author: algunenano
Date: 2019-10-18 05:25:15 -0700 (Fri, 18 Oct 2019)
New Revision: 17959

Modified:
   branches/2.4/NEWS
   branches/2.4/postgis/lwgeom_dump.c
   branches/2.4/postgis/lwgeom_geos.c
   branches/2.4/regress/dump.sql
   branches/2.4/regress/dump_expected
   branches/2.4/regress/isvaliddetail.sql
   branches/2.4/regress/isvaliddetail_expected
   branches/2.4/regress/run_test.pl
Log:
Fix schema qualification of internal types

References #4549



Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS	2019-10-18 12:23:44 UTC (rev 17958)
+++ branches/2.4/NEWS	2019-10-18 12:25:15 UTC (rev 17959)
@@ -18,6 +18,7 @@
   - #4537, Fix leak in WKT collection parser (Raúl Marín)
   - #4546, Fix ST_ConcaveHull under FDW (Raúl Marín)
   - #4547, Fix AddRasterConstraints handling of empty tables (Sandro Santilli)
+  - #4549, Fix schema qualification of internal types (Raúl Marín)
 
 
 PostGIS 2.4.8

Modified: branches/2.4/postgis/lwgeom_dump.c
===================================================================
--- branches/2.4/postgis/lwgeom_dump.c	2019-10-18 12:23:44 UTC (rev 17958)
+++ branches/2.4/postgis/lwgeom_dump.c	2019-10-18 12:25:15 UTC (rev 17959)
@@ -118,7 +118,8 @@
 		 * Build a tuple description for an
 		 * geometry_dump tuple
 		 */
-		tupdesc = RelationNameGetTupleDesc("geometry_dump");
+		get_call_result_type(fcinfo, 0, &tupdesc);
+		BlessTupleDesc(tupdesc);
 
 		/*
 		 * generate attribute metadata needed later to produce
@@ -256,7 +257,8 @@
 		 * Build a tuple description for an
 		 * geometry_dump tuple
 		 */
-		tupdesc = RelationNameGetTupleDesc("geometry_dump");
+		get_call_result_type(fcinfo, 0, &tupdesc);
+		BlessTupleDesc(tupdesc);
 
 		/*
 		 * generate attribute metadata needed later to produce

Modified: branches/2.4/postgis/lwgeom_geos.c
===================================================================
--- branches/2.4/postgis/lwgeom_geos.c	2019-10-18 12:23:44 UTC (rev 17958)
+++ branches/2.4/postgis/lwgeom_geos.c	2019-10-18 12:25:15 UTC (rev 17959)
@@ -1646,12 +1646,8 @@
 	 * Build a tuple description for a
 	 * valid_detail tuple
 	 */
-	tupdesc = RelationNameGetTupleDesc("valid_detail");
-	if ( ! tupdesc )
-	{
-		lwpgerror("TYPE valid_detail not found");
-		PG_RETURN_NULL();
-	}
+	get_call_result_type(fcinfo, 0, &tupdesc);
+	BlessTupleDesc(tupdesc);
 
 	/*
 	 * generate attribute metadata needed later to produce

Modified: branches/2.4/regress/dump.sql
===================================================================
--- branches/2.4/regress/dump.sql	2019-10-18 12:23:44 UTC (rev 17958)
+++ branches/2.4/regress/dump.sql	2019-10-18 12:25:15 UTC (rev 17959)
@@ -178,3 +178,15 @@
 	)
 )
 ');
+
+-- Check that it works without the extension schema being available
+BEGIN;
+SET search_path TO pg_catalog;
+WITH data AS
+(
+    SELECT 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))':: :schema geometry as geom
+)
+SELECT	't12',
+	:schema ST_AsText((public.ST_Dump(geom)).geom),
+	:schema ST_AsText((public.ST_DumpRings(geom)).geom) FROM data;
+ROLLBACK;

Modified: branches/2.4/regress/dump_expected
===================================================================
--- branches/2.4/regress/dump_expected	2019-10-18 12:23:44 UTC (rev 17958)
+++ branches/2.4/regress/dump_expected	2019-10-18 12:25:15 UTC (rev 17959)
@@ -16,3 +16,4 @@
 t9|{5,1}|POLYGON((0 0,0 9,9 9,9 0,0 0),(5 5,5 6,6 6,5 5))
 t10|0
 t11|0
+t12|POLYGON((0 0,0 1,1 1,1 0,0 0))|POLYGON((0 0,0 1,1 1,1 0,0 0))

Modified: branches/2.4/regress/isvaliddetail.sql
===================================================================
--- branches/2.4/regress/isvaliddetail.sql	2019-10-18 12:23:44 UTC (rev 17958)
+++ branches/2.4/regress/isvaliddetail.sql	2019-10-18 12:25:15 UTC (rev 17959)
@@ -49,3 +49,13 @@
 'POLYGON ((70 250, 40 500, 100 400, 70 250, 80 350, 60 350, 70 250))' , 1);
 
 
+-- Check that it works without the extension schema being available
+BEGIN;
+SET search_path TO pg_catalog;
+select 7, valid, reason, :schema st_astext(location) FROM (
+  SELECT (:schema ST_IsValidDetail(
+    'POLYGON ((70 250, 70 500, 80 400, 40 400, 70 250))':: :schema geometry
+  )).*
+) foo;
+ROLLBACK;
+

Modified: branches/2.4/regress/isvaliddetail_expected
===================================================================
--- branches/2.4/regress/isvaliddetail_expected	2019-10-18 12:23:44 UTC (rev 17958)
+++ branches/2.4/regress/isvaliddetail_expected	2019-10-18 12:25:15 UTC (rev 17959)
@@ -8,3 +8,4 @@
 6|t||
 6s|t
 5r|Valid Geometry
+7|f|Self-intersection|POINT(70 400)

Modified: branches/2.4/regress/run_test.pl
===================================================================
--- branches/2.4/regress/run_test.pl	2019-10-18 12:23:44 UTC (rev 17958)
+++ branches/2.4/regress/run_test.pl	2019-10-18 12:25:15 UTC (rev 17959)
@@ -70,6 +70,7 @@
 our $OPT_UPGRADE_FROM = '';
 my $OPT_UPGRADE_TO = '';
 my $VERBOSE = 0;
+my $OPT_SCHEMA = 'public';
 
 GetOptions (
 	'verbose' => \$VERBOSE,
@@ -83,7 +84,8 @@
 	'raster' => \$OPT_WITH_RASTER,
 	'sfcgal' => \$OPT_WITH_SFCGAL,
 	'expect' => \$OPT_EXPECT,
-	'extensions' => \$OPT_EXTENSIONS
+	'extensions' => \$OPT_EXTENSIONS,
+	'schema=s' => \$OPT_SCHEMA
 	);
 
 if ( @ARGV < 1 )
@@ -725,7 +727,8 @@
           . " -v \"tmpfile='$tmpfile'\""
           . " -v \"scriptdir=$scriptdir\""
           . " -v \"regdir=$REGDIR\""
-          . " -tXA $DB < $sql > $outfile 2>&1";
+          . " -v \"schema=$OPT_SCHEMA.\""
+          . " -tXAq $DB < $sql > $outfile 2>&1";
 	my $rv = system($cmd);
 
 	# Check for ERROR lines



More information about the postgis-tickets mailing list