From: Regina Obe Date: Fri, 11 Mar 2016 01:34:04 +0000 (+0000) Subject: Exclude all c functions from schema qual except ST_Transform we know calls spatial_re... X-Git-Tag: 2.3.0beta1~175 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=937418a71f7210b26f1c3d66b6242bd3c8e582ab;p=postgis Exclude all c functions from schema qual except ST_Transform we know calls spatial_ref_sys and is an issue in materialized views and spatial indexes. References #3490 for 2.3 (also added pg_catalog since dumps have it - in theory it gets automatically added, but just in case) git-svn-id: http://svn.osgeo.org/postgis/trunk@14772 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/utils/postgis_proc_set_search_path.pl b/utils/postgis_proc_set_search_path.pl index 9c96373de..8425787b6 100644 --- a/utils/postgis_proc_set_search_path.pl +++ b/utils/postgis_proc_set_search_path.pl @@ -112,6 +112,14 @@ while() $search_path_safe = 0; } + if ( /st_transform/i){ + # st_transform functions query spatial_ref_sys + # so could fail in materialized views and spatial indexes, + # though often all done in C + $search_path_safe = 1; + } + + #raster folks decided to break their func head in multiple lines # so we need to do this crazy thing if ($endhead != 1) @@ -146,8 +154,12 @@ while() { $endfunc = 1 if /^\s*(\$\$\s*)?LANGUAGE /i; if ( $endfunc == 1 && $search_path_safe == -1 ){ - $search_path_safe = 1 if /LANGUAGE\s+[\']*(c|plpgsql)/i; + $search_path_safe = 1 if /LANGUAGE\s+[\']*(plpgsql)/i; $search_path_safe = 1 if /STRICT/i; + #exclude C functions unless we've include, + # in most cases except ST_Transform + # c functions don't call dependent functions or tables + $search_path_safe = 0 if /LANGUAGE\s+[\']*(c)/i; } last if ( $endfunc && /\;/ ); } @@ -155,7 +167,7 @@ while() if ($search_path_safe == 1) { - print "EXECUTE 'ALTER FUNCTION $funchead $endfunchead SET search_path=' || quote_ident(param_postgis_schema) || ';';\n"; + print "EXECUTE 'ALTER FUNCTION $funchead $endfunchead SET search_path=' || quote_ident(param_postgis_schema) || ',pg_catalog;';\n"; } }