Skip to content

PostgreSQL current_database() 函数 ​

PostgreSQL current_database() 函数返回当前数据库的名称。current_database() 函数等同于 current_catalog。

current_database() 语法 ​

这里是 PostgreSQL current_database() 函数的语法:

sql
current_database() -> name

参数 ​

PostgreSQL current_database() 函数无需任何参数。

返回值 ​

PostgreSQL current_database() 函数返回一个代表当前数据库的名称的字符串。

current_database() 示例 ​

要获取当前数据库的名字,请使用下面带有 current_database() 函数的 SELECT 语句:

sql
SELECT current_database();
bash
 current_database
------------------
 testdb