Postgresql – do a backup without extension functions

backuppg-restorepostgresqlpostgresql-extensions

I use the PostGIS extension on my database. The thing is when I do a backup and then a restore, all the PostGIS functions give a warning during the restore process, because the functions already exist, as the extension is already installed.

I have to scroll through all the warning to make sure there isn't a real error.

So what is the right way to backup / restore, so I can have a clean restore process?

Best Answer

The best solution is to restore into a database that does not have PostGIS installed yet.

If PostGIS is installed in the template1 database, use template0 to create the new database.