Search code examples
postgresql

Default databases in PostgreSQL


What are the default databases in PostgreSQL at the time of installation?


Solution

    • template1: the "default" database, which is copied when you perform "create database foo"
    • template0: the "minimal default" database, which serves essentially the same purpose, but typically used to create databases when restoring dumps which might already have the extra objects that are in template1, or to create a database that uses a different character encoding to the server default (template0 should only contain ASCII characters in strings)
    • postgres: an "administrative" database, which clients can assume exists to connect to merely to list which databases are available etc. Also, for example, pgAdmin will install the pg_agent schema in this database.