Opened 9 years ago
Last modified 9 years ago
#3490 closed defect
Create perl script to add in the ALTER FUNCTION set path calls — at Initial Version
Reported by: | robe | Owned by: | pramsey |
---|---|---|---|
Priority: | blocker | Milestone: | PostGIS 2.2.2 |
Component: | postgis | Version: | 2.2.x |
Keywords: | restore, materialized views, foreign tables, raster | Cc: |
Description
As discussed in several tickets.
PostGIS functions that call postgis functions fail when the schema that postgis is installed in is not in the search_path.
The generated script will look something like this - https://trac.osgeo.org/postgis/browser/trunk/postgis/postgis_functions_search_path.sql for will have all functions
Such a scenario happens in the following cases:
- During database restore - raster constraints rely on functions that call other functions, and as a result data does not come back if your data is not in the same schema as where postgis is installed
- Restore of spatial indexes that use ST_Transform, again if your data is not in same schema as postgis.
- Materialized views restore - views that use ST_Intersects etc. may not come back. So this is fairly serious. Again if not in same schema as postgis
- Foreign Tables. The Foreign tables as I recall are set to ignore search_path so a foregin table calling ST_Intersects etc will fail if the table is not in the same schema as where PostGIS is installed.
I'm working on a perl script to set the search_path setting of all functions. I plan to distribute this as part of PostGIS 2.2 (not as part of extension install). With an FAQ in the docs that people suffering from this issue need to
1) Install postgis first 2) Run this script 3) then restore their data
For PostGIS 2.3, I'd like to just include this as part of the CREATE EXTENSION install so I don't have to explain this to anybody ever again.
At least 5 people have complained to me about this already and I have suffered from it myself. Enough is enough.