$search_path_safe = 0; \r
}\r
\r
+ if ( /st_transform/i){\r
+ # st_transform functions query spatial_ref_sys\r
+ # so could fail in materialized views and spatial indexes,\r
+ # though often all done in C\r
+ $search_path_safe = 1; \r
+ }\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
{\r
$endfunc = 1 if /^\s*(\$\$\s*)?LANGUAGE /i;\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 /LANGUAGE\s+[\']*(plpgsql)/i;\r
$search_path_safe = 1 if /STRICT/i;\r
+ #exclude C functions unless we've include, \r
+ # in most cases except ST_Transform\r
+ # c functions don't call dependent functions or tables\r
+ $search_path_safe = 0 if /LANGUAGE\s+[\']*(c)/i;\r
}\r
last if ( $endfunc && /\;/ );\r
}\r
\r
if ($search_path_safe == 1)\r
{\r
- print "EXECUTE 'ALTER FUNCTION $funchead $endfunchead SET search_path=' || quote_ident(param_postgis_schema) || ';';\n";\r
+ print "EXECUTE 'ALTER FUNCTION $funchead $endfunchead SET search_path=' || quote_ident(param_postgis_schema) || ',pg_catalog;';\n";\r
}\r
}\r
\r