[postgis-devel] Upgrade PostGIS from 2.5.4 to 3.1.2

Nikhil Shetty nikhil.dba04 at gmail.com
Mon Jan 24 11:17:01 PST 2022


Hi Regina,

Thank you for sharing the steps.Yes, we are upgrading the database as well
from 11.7 to 13.4.

I saw the steps you shared and I will give it a try.

Does uninstalling postgis25_11 have any impact on a running Postgres
database that is using postgis25_11 functions?? Wanted to know which step
will cause a downtime to the application apart from the database upgrade
step.

Thanks and Regards,
Nikhil


On Tue, 25 Jan 2022 at 12:36 AM, Regina Obe <lr at pcorp.us> wrote:

> I think I ran into this issue too though I was doing a pg_upgrade from 9.6
> to 11 at the same time.
>
>
>
> The issue is since both ship and overlapping set of files, they can’t
> cleanly coexist.
>
>
>
> The below should work.
>
>
>
> Uninstall postgis25_11 package
>
>
>
> Install the postgis31_11 package
>
>
>
> Symlink the old names to the new libraries
>
>
>
> ln -s /usr/pgsql-11/lib/postgis-3.so /usr/pgsql-11/lib/postgis-2.5.so
>
> ln -s /usr/pgsql-11/lib/postgis_raster-3.so  /usr/pgsql-11/lib/
> rtpostgis-2.5.so
>
>
>
> #if you are not using these libraries, you can skip this step
>
> ln -s /usr/pgsql-11/lib/postgis_topology-3.so /usr/pgsql-11/lib/
> postgis_topology-2.5.so
>
>
>
> ln -s /usr/pgsql-11/lib/address_standardizer-3.so /usr/pgsql-11/lib/
> address_standardizer-2.5.so
>
> ln -s /usr/pgsql-11/lib/address_standardizer-3.so
> /usr/pgsql-11/lib/address_standardizer.so
>
>
>
>
>
> #On your databases
>
>
>
> SELECT postgis_full_version();
>
>
>
> Should show something to the effect you have 2.5 scripts but are running
> postgis-3
>
>
>
> ALTER EXTENSION postgis UPDATE;
>
> SELECT postgis_extensions_upgrade();
>
> SELECT postgis_extensions_update();
>
>
>
> -- if not using raster, you can do this
>
> DROP EXTENSION postgis_raster;
>
>
>
>
>
> #after you are done upgrading your dbs, you can drop the symlinks e.g.
>
> rm /usr/pgsql-11/lib/rtpostgis-2.5.so
>
> rm /usr/pgsql-11/lib/postgis-2.5.so
>
> rm /usr/pgsql-11/lib/postgis_topology-2.5.so
>
>
>
> *From:* postgis-devel [mailto:postgis-devel-bounces at lists.osgeo.org] *On
> Behalf Of *Nikhil Shetty
> *Sent:* Monday, January 24, 2022 1:48 PM
> *To:* PostGIS Development Discussion <postgis-devel at lists.osgeo.org>;
> postgis-users at lists.osgeo.org
> *Subject:* [postgis-devel] Upgrade PostGIS from 2.5.4 to 3.1.2
>
>
>
> Hi Team,
>
>
>
> I am looking for a way to upgrade postgis on postgresql 11 from 2.5.4 to
> 3.1.2
>
> I am getting below error when doing though yum
>
>
>
> Transaction check error:
>   file /usr/pgsql-11/share/extension/address_standardizer.control from
> install of postgis31_11-3.1.2-1.rhel7.x86_64 conflicts with file from
> package postgis25_11-2.5.4-1.rhel7.x86_64
>   file /usr/pgsql-11/share/extension/address_standardizer.sql from install
> of postgis31_11-3.1.2-1.rhel7.x86_64 conflicts with file from package
> postgis25_11-2.5.4-1.rhel7.x86_64
>   file /usr/pgsql-11/share/extension/address_standardizer_data_us.control
> from install of postgis31_11-3.1.2-1.rhel7.x86_64 conflicts with file from
> package postgis25_11-2.5.4-1.rhel7.x86_64
>   file /usr/pgsql-11/share/extension/postgis.control from install of
> postgis31_11-3.1.2-1.rhel7.x86_64 conflicts with file from package
> postgis25_11-2.5.4-1.rhel7.x86_64
>   file /usr/pgsql-11/share/extension/postgis_sfcgal.control from install
> of postgis31_11-3.1.2-1.rhel7.x86_64 conflicts with file from package
> postgis25_11-2.5.4-1.rhel7.x86_64
>   file /usr/pgsql-11/share/extension/postgis_tiger_geocoder.control from
> install of postgis31_11-3.1.2-1.rhel7.x86_64 conflicts with file from
> package postgis25_11-2.5.4-1.rhel7.x86_64
>   file /usr/pgsql-11/share/extension/postgis_topology.control from install
> of postgis31_11-3.1.2-1.rhel7.x86_64 conflicts with file from package
> postgis25_11-2.5.4-1.rhel7.x86_64
>   file /usr/pgsql-11/bin/pgsql2shp from install of
> postgis31_11-client-3.1.2-1.rhel7.x86_64 conflicts with file from package
> postgis25_11-client-2.5.4-1.rhel7.x86_64
>   file /usr/pgsql-11/bin/raster2pgsql from install of
> postgis31_11-client-3.1.2-1.rhel7.x86_64 conflicts with file from package
> postgis25_11-client-2.5.4-1.rhel7.x86_64
>   file /usr/pgsql-11/bin/shp2pgsql from install of
> postgis31_11-client-3.1.2-1.rhel7.x86_64 conflicts with file from package
> postgis25_11-client-2.5.4-1.rhel7.x86_64
>
>
>
> I have seen the document for 'Hard Upgrade' but that is unfortunately a
> long route to take for critical databases.
>
>
>
> Postgresql Version - 11.7
>
> OS - RHEL 7.9
>
>
>
> Full Version Details -
>
> PostgreSQL 11.7 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
> 20150623 (Red Hat 4.8.5-39), 64-bit POSTGIS="2.5.4" [EXTENSION] PGSQL="110"
> GEOS="3.8.1-CAPI-1.13.3" PROJ="Rel. 7.0.0, March 1st, 2020" GDA
>
> L="GDAL 3.0.4, released 2020/01/28" LIBXML="2.9.1" LIBJSON="0.11"
> LIBPROTOBUF="1.0.2" RASTER
>
> Thanks and Regards,
>
> Nikhil
>
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20220125/4541d836/attachment.html>


More information about the postgis-devel mailing list