[postgis-tickets] r14771 - 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 15:18:31 PST 2016
Author: robe
Date: 2016-03-10 15:18:31 -0800 (Thu, 10 Mar 2016)
New Revision: 14771
Modified:
branches/2.2/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.2
Modified: branches/2.2/utils/postgis_proc_set_search_path.pl
===================================================================
--- branches/2.2/utils/postgis_proc_set_search_path.pl 2016-03-10 07:02:39 UTC (rev 14770)
+++ branches/2.2/utils/postgis_proc_set_search_path.pl 2016-03-10 23:18:31 UTC (rev 14771)
@@ -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