pg_database

The pg_database catalog provides information about available databases.

Column name Data type Description
oid oid A row identifier.
datname name The database name.
datdba oid (references pg_authid.oid) The OID of database owner.
encoding int4 The character encoding of the database. Use pg_encoding_to_char() to translate the number to the encoding name.
datlocprovider char The locale provider of the database.
The possible values are:
  • b – Built-in.
  • c – libc.
  • i – ICU.
datistemplate bool Specifies whether the database can be cloned by users with CREATEDB privileges (TRUE) or not (FALSE).
datallowconn bool Specifies whether connections are allowed to the database (TRUE) or not (FALSE).
dathasloginevt bool Specifies whether login event triggers are defined for the database (TRUE) or not (FALSE). Note: This is used internally by PostgreSQL and should not be manually altered or monitored.
datconnlimit int4 The maximum number of concurrent connections allowed for the database.
The possible values are:
  • -1 – No limit.
  • -2 – An invalid database.
datfrozenxid xid The oldest transaction ID that has been replaced with a permanent (“frozen”) XID in the database. It is used to prevent transaction ID wraparound and is the minimum of the per-table pg_class.relfrozenxid values.
datminmxid xid The oldest multixact ID that has been replaced by a transaction ID in this database. It is used to prevent multixact wraparound and is the minimum of the per-table pg_class.relminmxid values.
dattablespace oid (references pg_tablespace.oid) The default tablespace for the database. Tables with pg_class.reltablespace = 0 are stored here; non-shared system catalogs are included.
datcollate text The LC_COLLATE setting for the database.
datctype text The LC_CTYPE setting for the database.
datlocale text The collation provider locale for this database.
NULL – For the libc provider. In this case, datcollate and datctype are used instead.
daticurules text The ICU collation rules for the database.
datcollversion text The provider-specific version of the collation, recorded at database creation and verified during use to detect any changes that could lead to data corruption.
datacl aclitem[] Access privileges for the database.