PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References
PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References

PostgreSQL CURRENT_DATABASE() Function



The PostgreSQL CURRENT_DATABASE() function returns the name of the current (default) database.

Syntax

CURRENT_DATABASE()

Parameters

No parameter is required.

Return Value

Returns the name of the current (default) database.

Example:

The example below shows the usage of CURRENT_DATABASE() function.

SELECT CURRENT_DATABASE();

The above query will return name of the current (default) database. If the current (default) database is SQLExample, the above query will return the string 'SQLExample'.

SELECT CURRENT_DATABASE();
Result: 'SQLExample'

❮ PostgreSQL Functions