PostgreSQL current_catalog

PostgreSQL current_catalog returns the name of the current database.

In the SQL standard, databases are referred to as “catalogs”.

The current_catalog is equivalent to the current_database() function.

current_catalog Syntax

Here is the syntax of the PostgreSQL current_catalog function:

current_catalog -> name

Parameters

PostgreSQL current_catalog does not require any parameters.

Return value

PostgreSQL current_catalog returns a string representing the name of the current database.

current_catalog Examples

To get the name of the current database, use the SELECT statement with current_catalog:

SELECT current_catalog;
 current_catalog
-----------------
 testdb