From f0aa7f7bd1b301eb99240e1729ea2aaaa5bb7063 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ra=C3=BAl=20Mar=C3=ADn=20Rodr=C3=ADguez?= Date: Fri, 18 Oct 2019 12:06:31 +0000 Subject: [PATCH] Add tests for schema qualified functions References #4549 git-svn-id: http://svn.osgeo.org/postgis/trunk@17954 b70326c6-7e19-0410-871a-916f4a2858ee --- regress/core/dump.sql | 11 +++++++++++ regress/core/dump_expected | 1 + regress/core/isvaliddetail.sql | 9 +++++++++ regress/core/isvaliddetail_expected | 1 + regress/run_test.pl | 5 ++++- 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/regress/core/dump.sql b/regress/core/dump.sql index a32fb6950..14cbcfd74 100644 --- a/regress/core/dump.sql +++ b/regress/core/dump.sql @@ -178,3 +178,14 @@ GEOMETRYCOLLECTION ( ) ) '); + +-- Check that it works without the extension schema being available +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; +RESET search_path; diff --git a/regress/core/dump_expected b/regress/core/dump_expected index 97aba4af4..3a5f574f5 100644 --- a/regress/core/dump_expected +++ b/regress/core/dump_expected @@ -16,3 +16,4 @@ t9|{4}|POLYGON((0 0,0 9,9 9,9 0,0 0),(5 5,5 6,6 6,5 5)) 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)) diff --git a/regress/core/isvaliddetail.sql b/regress/core/isvaliddetail.sql index 41729c7ef..3e13f0b03 100644 --- a/regress/core/isvaliddetail.sql +++ b/regress/core/isvaliddetail.sql @@ -48,3 +48,12 @@ select '6s', ST_IsValid( 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 +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; +RESET search_path; + diff --git a/regress/core/isvaliddetail_expected b/regress/core/isvaliddetail_expected index 1ae00d1b6..9b941b2ef 100644 --- a/regress/core/isvaliddetail_expected +++ b/regress/core/isvaliddetail_expected @@ -8,3 +8,4 @@ 6|t|| 6s|t 5r|Valid Geometry +7|f|Self-intersection|POINT(70 400) diff --git a/regress/run_test.pl b/regress/run_test.pl index f6c9f92d4..0b5fe2982 100755 --- a/regress/run_test.pl +++ b/regress/run_test.pl @@ -70,6 +70,7 @@ my $OPT_UPGRADE_PATH = ''; our $OPT_UPGRADE_FROM = ''; my $OPT_UPGRADE_TO = ''; my $VERBOSE = 0; +my $OPT_SCHEMA = 'public'; GetOptions ( 'verbose' => \$VERBOSE, @@ -83,7 +84,8 @@ GetOptions ( 'raster' => \$OPT_WITH_RASTER, 'sfcgal' => \$OPT_WITH_SFCGAL, 'expect' => \$OPT_EXPECT, - 'extensions' => \$OPT_EXTENSIONS + 'extensions' => \$OPT_EXTENSIONS, + 'schema=s' => \$OPT_SCHEMA ); if ( @ARGV < 1 ) @@ -770,6 +772,7 @@ sub run_simple_test . " -v \"tmpfile='$tmpfile'\"" . " -v \"scriptdir=$scriptdir\"" . " -v \"regdir=$REGDIR\"" + . " -v \"schema=$OPT_SCHEMA.\"" . " -tXAq $DB < $sql > $outfile 2>&1"; my $rv = system($cmd); -- 2.40.0