Sample Header Ad - 728x90

How to migrate a PostgreSQL database with the postgis schema?

0 votes
1 answer
48 views
I've been tasked to migrate a bunch of postgres databases from version 10.5 to 16. Most contain the PostGIS extension (ver. 2.4.4), I've successfully migrated a few via the postgis_restore.pl script. However, I am having difficulties when a database has the postgis schema present. I don't understand why these "gis" databases have the postgis schema and some do not. I don't know the history of these databases perhaps they moved from an even older version of postgres/postgis, hence the presence of the postgis schema. I'm getting the classic error during migration: > ERROR: type "postgis.geometry" does not exist So far the only solution has been for me to create the table structures and tinker with the the_geom column before migrating with postgis_restore.pl. This is OK when there are only a few objects that need created. But this becomes burdensome when I have to create dozens of objects due to this issue. Is there an easier way to handle this? I thought about pg_dump the postgis schema with all the tables, operators, functions, but should I be doing that?
Asked by Eric Swiggum (694 rep)
May 8, 2025, 05:07 PM
Last activity: May 8, 2025, 06:20 PM