[postgis-devel] PSC Vote: set schema search_path for select functions

Paragon Corporation lr at pcorp.us
Tue Mar 17 14:37:38 PDT 2015


>> Building the search_path in the function definition, takes care of the 
>> hijacking issue I think you were concerned about for the most part and 
>> is less invasive than what you are proposing

> That's also good for me, but I don't really see much difference beside
being maybe simpler to implement. After all we still want/need a variable
that's expanded at compile time and 

> we still need to modify each and every function definition.
The main difference is that we can automate the fix so WE DON'T need to
modify every function since it doesn't affect the body -- just the signature
of the function.  WITH ALTER we could even have it as a separate generation
script generated by your perl voodoo :)

> One thing to test about definition-level search_path is functions that use
"current_schema()" internally. Would that always return the associated
search_path or would it still work in returning the user preference ?

I'll test this out you mean the ones that use current user's search path?
We may need to exclude these ones is my guess.  For starter's I'm planning
to only change the functions that call other PostGIS functions and see how
that goes.


I was also thinking about if we go the route of not allowing postgis not to
be relocatable (main case for this is other extensions like pgrouting,
postgis_topology, postgis_tiger_geocoder can rely on postgis being in a
certain schema),  like say for consideration in  PostGIS 2.3, for people
using CREATE EXTENSION, the change should be minimal.  The only difference I
think for the upgrade for them is

1) They'd have to do 

ALTER EXTENSION postgis SET SCHEMA postgis;

2) Then do upgrade as normal.

The story for non-Extension installs is not good since switching to another
schema without extension support is not easy.

Of course this brought up another issue I hadn't thought of originally.
That is I don't think the @extschema@ thing  will be picked up during ALTER
EXTENSION .. SET SCHEMA which means if we simply rely on that
And someone does

CREATE EXTENSION postgis;

ALTER EXTENSION postgis SET SCHEMA postgis;

The path settings may not be right since they would start off in public and
point to postgis.  Which means I may still need to hard-code postgis as a
schema in addition to the @extschema@


Anyway all side effect cases I need to experiment with and probably bring up
on pghackers to make sure I didn't miss anything.


Thanks,
Regina







More information about the postgis-devel mailing list