[postgis-tickets] r14772 - 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.
Regina Obe
lr at pcorp.us
Thu Mar 10 17:34:04 PST 2016
Author: robe
Date: 2016-03-10 17:34:04 -0800 (Thu, 10 Mar 2016)
New Revision: 14772
Modified:
trunk/utils/postgis_proc_set_search_path.pl
Log:
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)
Modified: trunk/utils/postgis_proc_set_search_path.pl
===================================================================
--- trunk/utils/postgis_proc_set_search_path.pl 2016-03-10 23:18:31 UTC (rev 14771)
+++ trunk/utils/postgis_proc_set_search_path.pl 2016-03-11 01:34:04 UTC (rev 14772)
@@ -112,6 +112,14 @@
$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 @@
{
$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 @@
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";
}
}
More information about the postgis-tickets
mailing list