shaunc
shaunc

Reputation: 5611

Remove postgis in order to use pg_upgrade

I am trying to upgrade from postgres 9.4 to 9.6 (mac os 10.12) using pg_upgrade. At one point I used postgis in 9.4, but don't need it now. Nevertheless I installed in 9.6 on the theory that it might come in handy.

Now, I have postgis 2.1.5 installed in 9.4:

SELECT name, default_version,installed_version                                                                                                                                   FROM pg_available_extensions WHERE name LIKE 'postgis%' ;
          name          | default_version | installed_version 
------------------------+-----------------+-------------------
 postgis                | 2.3.0           | 
 postgis_tiger_geocoder | 2.3.0           | 
 postgis_topology       | 2.3.0           | 

But 2.3.0 installed in 9.6:

SELECT name, default_version,installed_version                                                                                                                                   FROM pg_available_extensions WHERE name LIKE 'postgis%' ;
          name          | default_version | installed_version 
------------------------+-----------------+-------------------
 postgis                | 2.1.5           | 
 postgis_tiger_geocoder | 2.1.5           | 
 postgis_topology       | 2.1.5           | 

I would like to simply get rid of these to proceed with the upgrade (and drop anything that depends on them). How can I do that?

Upvotes: 0

Views: 2062

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247820

Run

DROP EXTENSION postgis;

in all databases on both clusters.
If that returns an error, it is ok (then PostGIS was not installed to begin with).

After that, everything should be ok for an upgrade.

To see if the extension is installed in a database, you can run the query

SELECT oid, extnamespace FROM pg_extension WHERE extname = 'postgis';

Upvotes: 3

Related Questions