postgres database

A database created by default

postgres is a database created by default by initdb.

postgres was implemented in PostgreSQL 8.1.


When initializing a database cluster with initdb, the following databases are always created:

  • template0
  • template1
  • postgres

The purpose of the postgres database is to provide a default target database for connections. In PostgreSQL 8.1 and earlier, the default target database was template1, however as CREATE DATABASE will fail if any other users are connected to it, a third generic database was added.

It is theoretically possible to drop the postgres database, however there is no particular reason to do that.

Change history


Database connections