Use case: you have a database backup file, and need to import it to a running Postgres.
Debian automatically saves backups of all databases in /var/backup/postgres, let's restore them in a fresh instance of Postgres. This guide can thus be used when restoring service after a crash, migrating to another version of postgres or another server.
Setup the environment
Create the user
- a password is prompted
- the user must be superuser to replay backups created as a tar file
Create the Database
The user's password (entered just previously) needs to be entered again.