]> granicus.if.org Git - postgis/commitdiff
Cleanup addition of search_path for upgrade scripts
authorRegina Obe <lr@pcorp.us>
Tue, 8 Mar 2016 19:15:17 +0000 (19:15 +0000)
committerRegina Obe <lr@pcorp.us>
Tue, 8 Mar 2016 19:15:17 +0000 (19:15 +0000)
exclude addgeometry*, addraster*, addoverview* from seach_path function setting.
These in calls that don't take schema use the current search_path to find table.
References #3495 for 2.3 (trunk)

git-svn-id: http://svn.osgeo.org/postgis/trunk@14762 b70326c6-7e19-0410-871a-916f4a2858ee

extensions/postgis/Makefile.in
utils/postgis_proc_set_search_path.pl

index 53cb09c8d7daa967ea01d5e5a757db926fa317a3..490892f6301e07fcb7e2cbcc3630e4693129f6ac 100644 (file)
@@ -84,10 +84,10 @@ sql_bits/rtpostgis.sql: ../../raster/rt_pg/rtpostgis.sql
 sql_bits/spatial_ref_sys_config_dump.sql: ../../spatial_ref_sys.sql ../../utils/create_spatial_ref_sys_config_dump.pl
        ../../utils/create_spatial_ref_sys_config_dump.pl $< > $@
 
-sql_bits/rtpostgis_upgrade.sql: ../../raster/rt_pg/rtpostgis_upgrade.sql sql_bits/rtpostgis_proc_set_search_path.sql 
+sql_bits/rtpostgis_upgrade.sql: ../../raster/rt_pg/rtpostgis_upgrade.sql 
        $(PERL) -pe "s/BEGIN\;//g ; s/COMMIT\;//g; s/^(DROP .*)\;/SELECT postgis_extension_drop_if_exists('$(EXTENSION)', '\1');\n\1\;/" $< > $@
 
-sql_bits/postgis_upgrade.sql: ../../postgis/postgis_upgrade.sql sql_bits/postgis_proc_set_search_path.sql 
+sql_bits/postgis_upgrade.sql: ../../postgis/postgis_upgrade.sql
        $(PERL) -pe "s/BEGIN\;//g ; s/COMMIT\;//g; s/^(DROP .*)\;/SELECT postgis_extension_drop_if_exists('$(EXTENSION)', '\1');\n\1\;/" $< > $@
 
 
@@ -98,7 +98,7 @@ sql_bits/raster_comments.sql: ../../doc/raster_comments.sql
        cp $< $@
 
 #postgis_extension_upgrade_minor.sql is the one that contains both postgis AND raster
-sql_bits/postgis_extension_upgrade_minor.sql: ../postgis_extension_helper.sql sql_bits/postgis_upgrade.sql sql_bits/rtpostgis_upgrade.sql ../../doc/raster_comments.sql ../../doc/postgis_comments.sql ../postgis_extension_helper_uninstall.sql
+sql_bits/postgis_extension_upgrade_minor.sql: ../postgis_extension_helper.sql sql_bits/postgis_upgrade.sql sql_bits/postgis_proc_set_search_path.sql sql_bits/rtpostgis_upgrade.sql sql_bits/rtpostgis_proc_set_search_path.sql ../../doc/raster_comments.sql ../../doc/postgis_comments.sql ../postgis_extension_helper_uninstall.sql
        echo '\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \quit' > $@
        cat $^ >> $@
 
index 206d3927bb5b1923fcf09636c13b7bfa9a7c6b72..d1bcaacd6538ed6f980f8a760e233e3e1f2d0b74 100644 (file)
@@ -95,15 +95,22 @@ while(<INPUT>)
 \r
        if ( /^create or replace function([^\)]+)([\)]{0,1})/i )\r
        {\r
-               my $funchead = $1; #contains function header except the end )\r
+               my $funchead = $1; # contains function header except the end )\r
                my $endhead = 0;\r
                my $endfunchead = $2;\r
-               my $search_path_safe = 0; # we can put a search path on it without disrupting spatial index use\r
+               my $search_path_safe = -1; # we can put a search path on it without disrupting spatial index use\r
+               \r
                if ($2 eq ')') ## reached end of header\r
                {\r
                        $endhead = 1;\r
                }\r
                \r
+               if ( /add(geometry|overview|raster)/i){\r
+                       # can't put search_path on addgeometrycolumn or addrasterconstraints \r
+                       # since table names are sometimes passed in non-qualified\r
+                       $search_path_safe = 0; \r
+               }\r
+               \r
                #raster folks decided to break their func head in multiple lines \r
                # so we need to do this crazy thing\r
                if ($endhead != 1)\r
@@ -137,7 +144,7 @@ while(<INPUT>)
                while(<INPUT>)\r
                {\r
                        $endfunc = 1 if /^\s*(\$\$\s*)?LANGUAGE /i;\r
-                       if ( $endfunc == 1 ){\r
+                       if ( $endfunc == 1 && $search_path_safe == -1 ){\r
                                $search_path_safe = 1 if /LANGUAGE\s+[\']*(c|plpgsql)/i;\r
                                $search_path_safe = 1 if /STRICT/i;\r
                        }\r