[postgis-tickets] r14763 - exclude addgeometry*, addraster*, addoverview* from seach_path function setting.

Regina Obe lr at pcorp.us
Tue Mar 8 11:54:38 PST 2016


Author: robe
Date: 2016-03-08 11:54:38 -0800 (Tue, 08 Mar 2016)
New Revision: 14763

Modified:
   branches/2.2/utils/postgis_proc_set_search_path.pl
Log:
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.
Closes #3495 for 2.2 

Modified: branches/2.2/utils/postgis_proc_set_search_path.pl
===================================================================
--- branches/2.2/utils/postgis_proc_set_search_path.pl	2016-03-08 19:15:17 UTC (rev 14762)
+++ branches/2.2/utils/postgis_proc_set_search_path.pl	2016-03-08 19:54:38 UTC (rev 14763)
@@ -95,15 +95,22 @@
 
 	if ( /^create or replace function([^\)]+)([\)]{0,1})/i )
 	{
-		my $funchead = $1; #contains function header except the end )
+		my $funchead = $1; # contains function header except the end )
 		my $endhead = 0;
 		my $endfunchead = $2;
-		my $search_path_safe = 0; # we can put a search path on it without disrupting spatial index use
+		my $search_path_safe = -1; # we can put a search path on it without disrupting spatial index use
+		
 		if ($2 eq ')') ## reached end of header
 		{
 			$endhead = 1;
 		}
 		
+		if ( /add(geometry|overview|raster)/i){
+			# can't put search_path on addgeometrycolumn or addrasterconstraints 
+			# since table names are sometimes passed in non-qualified
+			$search_path_safe = 0; 
+		}
+		
 		#raster folks decided to break their func head in multiple lines 
 		# so we need to do this crazy thing
 		if ($endhead != 1)
@@ -137,7 +144,7 @@
 		while(<INPUT>)
 		{
 			$endfunc = 1 if /^\s*(\$\$\s*)?LANGUAGE /i;
-			if ( $endfunc == 1 ){
+			if ( $endfunc == 1 && $search_path_safe == -1 ){
 				$search_path_safe = 1 if /LANGUAGE\s+[\']*(c|plpgsql)/i;
 				$search_path_safe = 1 if /STRICT/i;
 			}



More information about the postgis-tickets mailing list