[postgis-users] upgrade process and conflicting version info

547 views
Skip to first unread message

Hugh Kelley

unread,
Aug 10, 2022, 11:59:40 AM8/10/22
to postgi...@lists.osgeo.org
Hi all,

wondering about the upgrade process I'm using, whether there's a better way, and a possible minor bug.

I have a server running postgres 12 databases that currently use psotgis 3.0.0 and i'm looking to update postgis.

I have used the following commands to do so:

>>sudo apt update
>>sudo apt -y upgrade
>>sudo reboot
>>sudo apt -y install gnupg2
>>wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
>>echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee  /etc/apt/sources.list.d/pgdg.list
>>sudo apt update
>>sudo apt install postgis postgresql-12-postgis-3

once I've run these, I still need to run the following query in each database to complete the upgrade

ALTER EXTENSION postgis UPDATE;

Before I run this query, the results of

SELECT PostGIS_Version(); are 3.2.2, the upgraded version,

The results of SELECT PostGIS_Full_Version(); is an error
ERROR: A stored procedure tried to use deprecated C function 'postgis_svn_version'

The results of SELECT * FROM pg_extension; are postgis 3.0.0.

Testing functions like st_hexagongrid(), which is available in 3.2 and not in 3.0 returns an error, indicating the database is still using 3.0.

once I run the postgis UPDATE query, all of this is resolved and the results are 3.2 for all checks.

My questions are,

is there a way to automatically upgrade all databases on the server? I suppose I could put together a shell script but wondering if there is a standard way for doing this.

and, is it possible that the difference in version results between postgis_version() and pg_extention prior to updating should be considered a bug? Looking at packages installed on the server, it looks like my update commands replaced 3.0 with 3.2 instead of installing it side by side.

Is working on a database that hasn't been updated to 3.2 on a server that has been updated likely to cause any problems if I expect it to work according to the 3.0 codebase as it has historically?

Thanks for any thoughts or suggestions!

Hugh

    

Regina Obe

unread,
Aug 10, 2022, 5:49:16 PM8/10/22
to PostGIS Users Discussion

You should run

 

ALTER EXTENSION postgis UPDATE;

 

And then

 

SELECT postgis_extensions_upgrade();

 

I think what is confusing is that there are two versions that are reported.

 

One is the lib_version (which is what postgis_version returns), which looks at the library file.  That will read 3.2.2 after you did the apt install.

 

Once you do the above two steps,

 

SELECT postgis_full_version();

 

Should work and output 3.2.2 for both parts

Reply all
Reply to author
Forward
0 new messages