Updated on 2025-08-25 GMT+08:00

PG_DATABASE

PG_DATABASE stores information about available databases.

Table 1 PG_DATABASE columns

Column

Type

Description

datname

name

Database name.

datdba

oid

Owner of the database, typically its creator.

encoding

integer

Character encoding for the database.

pg_encoding_to_char() can convert this number into an encoding name.

datcollate

name

Collation order used by a database.

datctype

name

Character classification used by the database.

datistemplate

Boolean

Whether the database can be used as a template database.

datallowconn

Boolean

If the value is false, no users can connect to this database. This column protects the template0 database from modifications.

datconnlimit

integer

Maximum number of concurrent connections allowed on this database. The value –1 indicates no limit.

datlastsysoid

oid

Last system OID in the database.

datfrozenxid

xid32

Tracks whether the database requires cleanup to prevent transaction ID wraparound.

For forward compatibility, this column is retained, and datfrozenxid64 is added to record this information.

dattablespace

oid

Default tablespace of the database.

datcompatibility

name

Compatibility mode of the database. Options:

  • ORA: compatible with the Oracle database.
  • TD: compatible with the Teradata database.
  • MySQL: compatible with the MySQL database.

datacl

aclitem[]

Access permissions.

datfrozenxid64

xid

Tracks whether the database requires cleanup to prevent transaction ID wraparound.