PostgreSQL current_catalog
PostgreSQL current_catalog 返回当前数据库的名称。
在 SQL 标准中,数据库被称作 “catalogs”,因此 current_catalog 是标准的写法。
current_catalog 等同于 current_database() 函数。
current_catalog 语法
这里是 PostgreSQL current_catalog 的语法:
current_catalog -> name
参数
PostgreSQL current_catalog 无需任何参数。
返回值
PostgreSQL current_catalog 返回一个代表当前数据库的名称的字符串。
current_catalog 示例
要获取当前数据库的名字,请使用下面带有 current_catalog 的 SELECT 语句:
SELECT current_catalog;
current_catalog
-----------------
testdb