current_database()

返回当前数据库名称的函数

current_database() 是一个返回当前数据库名称的系统函数。

current_database() 是在 PostgreSQL 7.3 中添加的。

用法

current_database () → name

current_catalog 作为 SQL 标准的等效函数提供。

变更历史

示例

current_database() 的执行

postgres=# SELECT current_database();
 current_database
------------------
 postgres
(1 row)

postgres=# \c template1
You are now connected to database "template1" as user "postgres".

template1=# SELECT current_database();
 current_database
------------------
 template1
(1 row)

分类

系统函数

另请参阅

current_catalog, current_schema(), current_user

反馈

请在此处提交有关“current_database()”的任何评论、建议或更正。