postgis_restore(1)
π postgis_restore(1) π
okay bestie, so this is postgis_restore, and it lives in the PostGIS manual, section 1. it's a lil script that pulls your data back out of a dump file, and it's about to become your whole personality. no cap.
β¨ NAME β¨
postgis_restore β restore a PostGIS database from an archive file created by pg_dump
πΈ SYNTAX πΈ
postgis_restore [-v] [-L TOC] [-s schema] dumpfile
like. that's the whole vibe. you give it a dumpfile and it does the thing π«Ά
π¦ DESCRIPTION π¦
so the postgis_restore command lets you extract SQL statements that re-create all the objects hanging out in a custom dump of a PostGIS-enabled databaseβ¦ while skipping the PostGIS specific objects. it's giving "here's your stuff, minus the PostGIS internals." π
this is only useful for dumps of databases where PostGIS got enabled by loading the postgis.sql script. iykyk.
β οΈ if your dump came from a database where PostGIS was enabled viaCREATE EXTENSION, that dump will not have PostGIS objects in it at all β so it's totally safe to restore it directly usingpg_restore. no detour needed, bestie.
also, heads up fr fr: this command only works with dumps using the custom format, which are the ones you make with pg_dump -Fc. any other format? not it. π
π USAGE π
run the script with no arguments and it'll print usage information for you. it's polite like that. β¨
π₯ EXAMPLES π₯
step 1 β create a custom dump from olddb:
pg_dump -Fc olddb > olddb.dump
step 2 β create a new database newdb:
createdb newdb
step 3 β PostGIS-enable the new database:
psql -c 'CREATE EXTENSION postgis' newdb
step 4 β restore your data (the main character moment):
postgis_restore.pl olddb.dump | psql newdb
ate. no crumbs. π
π AUTHORS π
originally written by Sandro Santilli <strk@kbt.io>. absolute icon behavior.
more information is available at http://postgis.net π
so yeah β that's the whole page, straight from the PostGIS manual, section 1, and the page you just read is literally titled postgis_restore(1). mwah. go restore something. πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- alpine 3.24: postgis-doc 3.6.3-r0 Β· GPL-2.0-or-later
- arch rolling: postgis 3.6.4-1 Β· GPL-2.0-or-later
- centos-stream 10: postgis-client 3.5.3-4.el10 Β· GPL-2.0-or-later
- centos-stream 10: postgresql18-postgis-client 3.5.3-2.el10 Β· GPL-2.0-or-later
- centos-stream 9: postgis-client 3.6.1-1.module_el9+1300+1c4aa8df Β· GPL-2.0-or-later
- debian trixie: postgis 3.5.2+dfsg-1 Β· GPL-2.0-or-later
- fedora 43: postgis-client 3.6.0-1.fc43 Β· GPL-2.0-or-later
- fedora 43: postgis-client 3.6.4-5.fc43 Β· GPL-2.0-or-later
- fedora 43: postgresql16-postgis-client 3.6.4-5.fc43 Β· GPL-2.0-or-later
- fedora 43: postgresql17-postgis-client 3.6.4-5.fc43 Β· GPL-2.0-or-later
- fedora 44: postgis-client 3.6.2-1.fc44 Β· GPL-2.0-or-later
- fedora 44: postgis-client 3.6.4-5.fc44 Β· GPL-2.0-or-later
- fedora 44: postgresql16-postgis-client 3.6.2-1.fc44 Β· GPL-2.0-or-later
- fedora 44: postgresql16-postgis-client 3.6.4-5.fc44 Β· GPL-2.0-or-later
- fedora 44: postgresql17-postgis-client 3.6.2-1.fc44 Β· GPL-2.0-or-later
- fedora 44: postgresql17-postgis-client 3.6.4-5.fc44 Β· GPL-2.0-or-later
- nixos 26.05: postgis 3.6.4
- nixpkgs unstable: postgis 3.6.4
- ubuntu questing: postgis 3.5.3+dfsg-2build1
- ubuntu resolute: postgis 3.6.2+dfsg-1 Β· GPL-2.0-or-later
- ubuntu stonking: postgis 3.6.4+dfsg-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms