CURRENT_CATALOG
CURRENT_CATALOG is a SQL system function that returns the name of the current database. Its return type is varchar.
Example
SELECT CURRENT_CATALOG;
Output
'postgres'
Explanation
The CURRENT_CATALOG
command, when run, returns the name of the current database. In the example above, the command returned ‘postgres’, which is the default database used by PostgreSQL.
Example
SELECT CURRENT_CATALOG AS 'Current Database';
Output
Current Database----------------database_name
Explanation
The CURRENT_CATALOG function in SQL Server returns the name of the current database. The SELECT CURRENT_CATALOG AS 'Current Database'
statement retrieves the name of the current database and displays it under the column named ‘Current Database’.