current_catalog

A function returning the name of the current database

current_catalog is a system function returning the name of the current database.

current_catalog was added in PostgreSQL 8.4.

Usage

current_catalog → name

current_catalog is provided as an SQL-standard equivalent to current_database().

Change history

Examples

Execution of current_catalog:

postgres=# SELECT current_catalog;
 current_catalog
-----------------
 postgres
(1 row)

postgres=# \c template1
You are now connected to database "template1" as user "postgres".

template1=# SELECT current_catalog;
 current_catalog
-----------------
 template1
(1 row)

Categories

System function

See also

current_database(), current_schema