We have dumped a database that uses the postgis extension using pg_dump. After manually creating the database on a different machine an attempt to load the dump into it using psql failed. It turned out the dump did not contain the necessary statement
CREATE EXTENSION postgis;
The postgis extension was installed in the target instance of Postgres but only after manual execution of the CREATE EXTENSION
loading of the dump succeeded. This doesn't seem like a big deal, but the question is: is it possible to force pg_dump
to write all required CREATE EXTENSION foo;
statements into the dump so I don't have to do it manually? I don't see any option for that in pg_dump
online documentation.