]> granicus.if.org Git - postgis/commitdiff
Preliminary script to add search path to functions fix restore issues
authorRegina Obe <lr@pcorp.us>
Wed, 24 Feb 2016 17:13:36 +0000 (17:13 +0000)
committerRegina Obe <lr@pcorp.us>
Wed, 24 Feb 2016 17:13:36 +0000 (17:13 +0000)
References #2485

git-svn-id: http://svn.osgeo.org/postgis/trunk@14688 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/postgis_functions_search_path.sql [new file with mode: 0644]

diff --git a/postgis/postgis_functions_search_path.sql b/postgis/postgis_functions_search_path.sql
new file mode 100644 (file)
index 0000000..915913c
--- /dev/null
@@ -0,0 +1,43 @@
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r
+--\r
+--\r
+-- PostGIS - Spatial Types for PostgreSQL\r
+-- http://postgis.net\r
+-- Copyright 2016 Regina Obe\r
+--\r
+-- This is free software; you can redistribute and/or modify it under\r
+-- the terms of the GNU General Public Licence. See the COPYING file.\r
+--\r
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \r
+-- This routine adds search_path to functions known to have issues\r
+-- during restore.  Functions that call other postgis functions \r
+-- or spatial_ref_sys should be in here\r
+-- These are functions that are called by restore process for purposes of\r
+-- creating indexes, creating constraints, and creating materialized views\r
+-- Also functions that are used in foreign tables \r
+-- that call other postgis functions.  Eventually all functions should be here\r
+-- At that point we decide to add to all functions, \r
+-- this script should be autogenerated\r
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r
+\r
+\r
+\r
+DO language plpgsql\r
+$$\r
+DECLARE param_postgis_schema text;\r
+BEGIN\r
+-- check if PostGIS is already installed\r
+param_postgis_schema = (SELECT n.nspname from pg_extension e join pg_namespace n on e.extnamespace = n.oid WHERE extname = 'postgis');\r
+\r
+-- if in middle install, it will be the current_schema or what was there already\r
+param_postgis_schema = COALESCE(param_postgis_schema, current_schema());\r
+EXECUTE 'set search_path TO ' || quote_ident(param_postgis_schema);\r
+\r
+-- PostGIS geometry funcs\r
+EXECUTE 'ALTER FUNCTION st_transform(geometry, integer) SET search_path=' || quote_ident(param_postgis_schema) || ';';\r
+\r
+-- PostGIS raster funcs\r
+EXECUTE 'ALTER FUNCTION _raster_constraint_pixel_types(raster) SET search_path=' || quote_ident(param_postgis_schema) || ';';\r
+EXECUTE 'ALTER FUNCTION _raster_constraint_info_regular_blocking(name,name,name) SET search_path=' || quote_ident(param_postgis_schema) || ';';\r
+END;\r
+$$
\ No newline at end of file