[postgis-tickets] r17956 - Fix schema qualification of internal types
Raul
raul at rmr.ninja
Fri Oct 18 05:21:25 PDT 2019
Author: algunenano
Date: 2019-10-18 05:21:24 -0700 (Fri, 18 Oct 2019)
New Revision: 17956
Modified:
branches/3.0/postgis/lwgeom_dump.c
branches/3.0/postgis/lwgeom_geos.c
branches/3.0/regress/core/dump.sql
branches/3.0/regress/core/dump_expected
branches/3.0/regress/core/isvaliddetail.sql
branches/3.0/regress/core/isvaliddetail_expected
branches/3.0/regress/run_test.pl
Log:
Fix schema qualification of internal types
References #4549
Modified: branches/3.0/postgis/lwgeom_dump.c
===================================================================
--- branches/3.0/postgis/lwgeom_dump.c 2019-10-18 12:18:06 UTC (rev 17955)
+++ branches/3.0/postgis/lwgeom_dump.c 2019-10-18 12:21:24 UTC (rev 17956)
@@ -117,7 +117,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
@@ -255,7 +256,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/3.0/postgis/lwgeom_geos.c
===================================================================
--- branches/3.0/postgis/lwgeom_geos.c 2019-10-18 12:18:06 UTC (rev 17955)
+++ branches/3.0/postgis/lwgeom_geos.c 2019-10-18 12:21:24 UTC (rev 17956)
@@ -1530,12 +1530,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/3.0/regress/core/dump.sql
===================================================================
--- branches/3.0/regress/core/dump.sql 2019-10-18 12:18:06 UTC (rev 17955)
+++ branches/3.0/regress/core/dump.sql 2019-10-18 12:21:24 UTC (rev 17956)
@@ -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/3.0/regress/core/dump_expected
===================================================================
--- branches/3.0/regress/core/dump_expected 2019-10-18 12:18:06 UTC (rev 17955)
+++ branches/3.0/regress/core/dump_expected 2019-10-18 12:21:24 UTC (rev 17956)
@@ -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/3.0/regress/core/isvaliddetail.sql
===================================================================
--- branches/3.0/regress/core/isvaliddetail.sql 2019-10-18 12:18:06 UTC (rev 17955)
+++ branches/3.0/regress/core/isvaliddetail.sql 2019-10-18 12:21:24 UTC (rev 17956)
@@ -48,3 +48,13 @@
select '5r', ST_IsValidReason(
'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/3.0/regress/core/isvaliddetail_expected
===================================================================
--- branches/3.0/regress/core/isvaliddetail_expected 2019-10-18 12:18:06 UTC (rev 17955)
+++ branches/3.0/regress/core/isvaliddetail_expected 2019-10-18 12:21:24 UTC (rev 17956)
@@ -8,3 +8,4 @@
6|t||
6s|t
5r|Valid Geometry
+7|f|Self-intersection|POINT(70 400)
Modified: branches/3.0/regress/run_test.pl
===================================================================
--- branches/3.0/regress/run_test.pl 2019-10-18 12:18:06 UTC (rev 17955)
+++ branches/3.0/regress/run_test.pl 2019-10-18 12:21:24 UTC (rev 17956)
@@ -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 )
@@ -768,6 +770,7 @@
. " -v \"tmpfile='$tmpfile'\""
. " -v \"scriptdir=$scriptdir\""
. " -v \"regdir=$REGDIR\""
+ . " -v \"schema=$OPT_SCHEMA.\""
. " -tXAq $DB < $sql > $outfile 2>&1";
my $rv = system($cmd);
More information about the postgis-tickets
mailing list