[postgis-devel] getting out of extension ?

Sandro Santilli strk at keybit.net
Sat Sep 29 09:15:39 PDT 2012


On Sat, Sep 29, 2012 at 11:34:20AM -0400, Paragon Corporation wrote:
> 
> Strk,
> Okay I'm going to give away a trade secret?
> 
> This will generate the statement to drop all objects from the postgis
> extension  (change word postgis to postgis_topology to do the same for
> topology)
> ----
> 
> SELECT 'ALTER EXTENSION ' || extname || ' DROP ' || regexp_replace(
>     regexp_replace(pg_catalog.pg_describe_object(d.classid, d.objid, 0),
> E'cast from (.*) to (.*)', E'cast\(\\1 as \\2\)'),
>     E'(.*) for access method (.*)', E'\\1 using \\2') || ';' AS sqladd
> FROM pg_catalog.pg_depend AS d
> INNER JOIN pg_extension AS e ON (d.refobjid = e.oid)
> WHERE d.refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass
> AND deptype = 'e' AND e.extname = 'postgis'
> ORDER BY sqladd;

Wow!

> Once you run that, you can safely do
> 
> DROP EXTENSION postgis;
> 
> And then upgrade as usual.
> 
> Note: If you have postgis_topology installed, you'll have to first do the
> same for postgis_topology before you can drop postgis.
> 
> 
> This script is in extensions/make_unpackaged.sql
> 
> 
> It's exactly like repackaging as you can see except for packaging an
> unpackaged postgis you have the word "ADD" instead of "DROP".

Many thanks, I pushed an "opt_out.sh" script
(the hackers' right-click)

--strk; 

 http://www.cartodb.com - Map, analyze and build applications with your data

                                       ~~ http://strk.keybit.net 




More information about the postgis-devel mailing list