Upgrading PostGIS in a Database with Large Objects

Following the instructions for a “hard” upgrade in Chapter 2. Installation of the PostGIS manual results in large objects not being restored to the database. If you create a dump using pg_dump -Fc –oids and then use the postgis_restore.pl script, the oids will be restored but not the large objects. This is not really a PostGIS issue, it can happen when dealing with any PostgreSQL database.

To remedy this situation I found that the pg_dumplo utility has the answer. The trick is to use pg_dumplo to dump the large objects from the “old” PostgreSQL/PostGIS install and then use it to restore the objects to the “new” install after running the postgis_restore.pl script.

The pg_dumplo utility can usually be found in the contrib directory of your PostgreSQL install. For a complete example, see the README.pg_dumplo file located in the contrib/pg_dumplo directory.

Note: You only need this utility if you have created database tables containing large objects. On a “stock” PostGIS database the postgis_restore.pl script does it’s job in a most efficient way.