You can use the information_schema.catalogs view to get information about catalogs (databases in SQL terminology). You can use a SELECT query to return information about each database as shown in the example below.

In order to view catalog information, you must have catalog privileges or have ownership of the catalog object.

SELECT
  *
FROM
  information_schema.catalogs;

Columns in information_schema.catalogs

Each row has the following columns with information about the database.

Column NameData TypeDescription
catalog_nameTEXTName of the database.
default_collationTEXTAlways ‘POSIX’.
default_character_setTEXTAlways ‘UTF-8’.
descriptionTEXTThe description of the database.
createdTIMESTAMPTZThe time the database was created.
ddlTEXTThe text of the SQL statement that created the database.
catalog_ownerTEXTThe owner of the database, NULL if there is none.
last_alteredTIMESTAMPTZTime the database was last altered.
last_altered_byTEXTName of the last user to alter the database.