1

I have an RDS instance running Postgres 11.16. I'm trying to upgrade it to 12.11 but it's giving me errors on PostGIS. If I try a "modify" I get the following error in the precheck log file:


Upgrade could not be run on Sun Sep 18 06:05:13 2022

The instance could not be upgraded from 11.16.R1 to 12.11.R1 because of following reasons. Please take appropriate action on databases that have usages incompatible with requested major engine version upgrade and try again.

  • Following usages in database 'XXXXX' need to be corrected before upgrade: -- The instance could not be upgraded because there are one or more databases with an older version of PostGIS extension or its dependent extensions (address_standardizer, address_standardizer_data_us, postgis_tiger_geocoder, postgis_topology, postgis_raster) installed. Please upgrade all installations of PostGIS and drop its dependent extensions and try again. ----------------------- END OF LOG ----------------------

First, I tried just removing postgis to upgrade then add it back again. I used: drop extension postgis cascade;. However, this generated the same error

Second, I tried running SELECT postgis_extensions_upgrade();. However, it gives me the following error:

NOTICE:  Updating extension postgis_raster from unpackaged to 3.1.5

ERROR:  function st_convexhull(raster) does not exist
CONTEXT:  SQL statement "ALTER EXTENSION postgis_raster UPDATE TO "3.1.5";"
PL/pgSQL function postgis_extensions_upgrade() line 82 at EXECUTE
SQL state: 42883

Third, I tried to do a manual snapshot and upgrade the snapshot. Same results.

One additional piece of information, I ran SELECT PostGIS_Full_Version(); and this is what it returns:

"POSTGIS=""3.1.5 c60e4e3"" [EXTENSION] PGSQL=""110"" GEOS=""3.7.3-CAPI-1.11.3 b50468f"" PROJ=""Rel. 5.2.0, September 15th, 2018"" GDAL=""GDAL 2.3.1, released 2018/06/22"" LIBXML=""2.9.1"" LIBJSON=""0.12.1"" LIBPROTOBUF=""1.3.0"" WAGYU=""0.5.0 (Internal)"" TOPOLOGY RASTER (raster lib from ""2.4.5 r16765"" need upgrade) (raster procs from ""2.4.4 r16526"" need upgrade)"

As you'll notice, the raster lib is old but I can't really figure out how to upgrade it. I think this is what is causing me problems but I don't know how to overcome it.

I appreciate any thoughts.

1 Answer 1

0

I ended up finally giving up on this after many failed attempts. I ended up solving this by:

  1. Spinning up a new instance on the desired postgres version
  2. Using pg_dump on the old version (schema and data)
  3. Using pg_restore on the new version

I'm not sure if I did something wrong with the above but I found my sequences were out of sync on a number of tables. I wrote some scripts to reset the sequence values after doing this. I had to use something like this to re-sync those sequences:

SELECT setval('the_sequence', (SELECT MAX(the_primary_key) FROM the_table)+1);

I wasted enough time and this got me past the issue. Hopefully the next upgrade doesn't give me this much trouble.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.