postgis_restore(1)

postgis_restore1

Restore a postgis database from an archive file created by pg_dump

Usage

postgis_restore [-v] [-L TOC] [-s schema] dumpfile

Overview

The postgis_restore command allows extracting SQL statements to re-create objects found in a custom dump of a PostGIS-enabled database while skipping the PostGIS specific objects.

This is only useful for dumps of databases in which PostGIS was enabled by loading the postgis.sql script. Dumps taken from databases in which PostGIS was enabled via CREATE EXTENSION will not have PostGIS objects in them so can safely be restored directly using pg_restore.

Note that this command only works with dumps using the custom format, which are those created with pg_dump -Fc.

Usage

Usage information is printed when the script is invoked with no arguments.

Examples

Create a custom dump from olddb:

pg_dump -Fc olddb > olddb.dump

Create a new database newdb:

createdb newdb

PostGIS-enable the new database:

psql -c 'CREATE EXTENSION postgis' newdb

Restore your data:

postgis_restore.pl olddb.dump | psql newdb

Releases

Unchanged in 2 releases since Debian 13 (Trixie).

  1. 13–Arch

Authors

Originally written by Sandro Santilli <[email protected]>.

More information is available at http://postgis.net

From postgis 3.6.4-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.