PostgreSQL current_database() Function
The PostgreSQL current_database() function returns the name of the current database. The current_database() function is equivalent to current_catalog.
current_database() Syntax
Here is the syntax of the PostgreSQL current_database() function:
current_database() -> name
Parameters
The PostgreSQL current_database() function does not require any parameters.
Return value
The PostgreSQL current_database() function returns a string representing the name of the current database.
current_database() Examples
To get the name of the current database, use the following SELECT statement with the current_database() function:
SELECT current_database();
current_database
------------------
testdb