[postgis-tickets] [PostGIS] #3496: Make postgis non-relocateable and schema qualify at least core functions
PostGIS
trac at osgeo.org
Tue Mar 8 11:42:50 PST 2016
#3496: Make postgis non-relocateable and schema qualify at least core functions
---------------------+---------------------------
Reporter: robe | Owner: pramsey
Type: defect | Status: new
Priority: high | Milestone: PostGIS 2.3.0
Component: postgis | Version: trunk
Keywords: |
---------------------+---------------------------
I misunderstood the docs a bit. I blame pgAdmin for my stupidity because
it always greyed out the schema feature in extension gui if an extension
is marked non-relocatable.
I did some experiments, and it does seem that we can schema qualify our
functions, without forcing users to install postgis in postgis schema.
Though I still think that is where we want to move for the sake of other
extensions that may rely on postgis.
Sooo if we have our control file look like this:
{{{
# postgis extension
comment = 'PostGIS geometry, geography, and raster spatial types and
functions'
default_version = '2.3.0dev'
module_pathname = '$libdir/postgis-2.3'
relocatable = false
}}}
Then we can use the variable @extschema@ in lieu of the actual schema
name. This will still allow users to do:
{{{
CREATE EXTENSION postgis SCHEMA whereever_I_damn_want_you_to_be;
}}}
And if I then have ST_Intersects rewritten as:
{{{
CREATE OR REPLACE FUNCTION ST_Intersects(geom1 geometry, geom2 geometry)
RETURNS boolean
AS 'SELECT $1 && $2 AND @extschema at ._ST_Intersects($1,$2)'
LANGUAGE 'sql' IMMUTABLE;
}}}
Once installed, in the desired user location, it will then become:
{{{
CREATE OR REPLACE FUNCTION ST_Intersects(geom1 geometry, geom2 geometry)
RETURNS boolean
AS 'SELECT $1 && $2 AND
whereever_I_damn_want_you_to_be._ST_Intersects($1,$2)'
LANGUAGE 'sql' IMMUTABLE;
}}}
upon installation. The downside being, the user can't then do:
{{{
ALTER EXTENSION postgis SET schema public;
}}}
They'll get a
{{{
ERROR: extension "postgis" does not support SET SCHEMA
}}}
Now how to make this work nicely with non-extension piece.
I suppose when we are creating the scripts for regular old postgis
install.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3496>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list