[postgis-tickets] [PostGIS] #3892: Review safety and behavior of CREATE EXTENSION from UNPACKAGED

PostGIS trac at osgeo.org
Mon Oct 9 12:59:29 PDT 2017


#3892: Review safety and behavior of CREATE EXTENSION from UNPACKAGED
----------------------+---------------------------
  Reporter:  strk     |      Owner:  pramsey
      Type:  task     |     Status:  new
  Priority:  high     |  Milestone:  PostGIS 2.4.1
 Component:  postgis  |    Version:  2.4.x
Resolution:           |   Keywords:
----------------------+---------------------------

Comment (by robe):

 strk,


 I did a test and though it's unorthodox, you can move a function from one
 extension to another with a unpackaged.

 So I created a blackhole extension:

 -- blackhole.control looks like this
 {{{
 comment = 'Black Hole'
 default_version = '1.0'
 relocatable = true

 }}}

 -- blackhole--unpackaged--1.0.sql
 {{{
 CREATE OR REPLACE FUNCTION do_something() RETURNS text AS
 $$
 SELECT 'test';
 $$ language sql;

 ALTER EXTENSION postgis DROP FUNCTION _add_raster_constraint_blocksize(
     rastschema name,
     rasttable name,
     rastcolumn name,
     axis text);

 ALTER EXTENSION blackhole ADD FUNCTION  _add_raster_constraint_blocksize(
     rastschema name,
     rasttable name,
     rastcolumn name,
     axis text);
 }}}


 Then I did


 {{{
 CREATE EXTENSION postgis;
 CREATE EXTENSION blackhole FROM unpackaged;
 DROP EXTENSION postgis;
 }}}

 And all that was left was the function I moved into the black hole and the
 do_something function defined in the black hole.

 So I guess as long as you stuff the raster upgrade script in the
 unpackaged script you can do it.

 So the instruction would be, if you use raster and want to keep it, first
 run


 {{{
 CREATE EXTENSION postgis_raster FROM unpackaged;
 ALTER EXTENSION postgis UPDATE;
 }}}

 The ALTER EXTENSION postgis would remove all raster functions/type (both
 drop the function and remove from postgis).  It will gracefully fail if
 the user has raster and your warning would be, to fix

 Do the above.

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3892#comment:1>
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