postgresqlubuntu-18.04restore

Accidentally restored a another database to the 'postgres' database how to correct


I accidentally restored another database as the default postgres database, how do I correct this? postgres v10 on ubuntu.


Solution

  • To be specific. Log into a database other then postgres.

    Then:

    DROP DATABASE postgres;
    CREATE DATABASE postgres; --You don't need to specify template1 it is the default.
    

    Then do your restore. If you are using pg_restore make sure you use -C to have the database CREATEd properly.