首页 > 数据库技术 > 详细

PostgresSQL常用函数

时间:2017-06-10 00:10:06      阅读:367      评论:0      收藏:0      [点我收藏+]

1.系统信息函数

    1.会话信息函数

edbstore=# select current_catalog;     #查询当前数据库名称
 current_database 
------------------
 edbstore
(1 row)

edbstore=# select current_database();  #查询当前数据库名称
 current_database 
------------------
 edbstore
(1 row)

edbstore=# select current_schema();   #查询当前数据库密码
 current_schema 
----------------
 edbstore
(1 row)

edbstore=# select current_user;      #查询当前连接的用户
 current_user 
--------------
 dbadmin
(1 row)

edbstore=# select inet_client_addr();   #查询当前客户端的IP地址
 inet_client_addr 
------------------
 172.16.101.66
(1 row)

edbstore=# select inet_client_port()    #查询当前客户端的端口号
edbstore-# ;
 inet_client_port 
------------------
            23047
(1 row)
edbstore=# select pg_backend_pid();     #查看与当前会话相关联的服务器进程ID
 pg_backend_pid 
----------------
          24773
(1 row)

edbstore=# select pg_conf_load_time();     #查看配置文件最后一次载入时间
       pg_conf_load_time       
-------------------------------
 2017-05-23 15:07:09.224327+08
(1 row)

edbstore=# select pg_postmaster_start_time();     #查看数据库启动时间
   pg_postmaster_start_time   
------------------------------
 2017-05-23 15:07:09.48386+08
(1 row)

edbstore=# select session_user;     
 session_user 
--------------
 dbadmin
(1 row)

 

 

    

 

PostgresSQL常用函数

原文:http://www.cnblogs.com/ilifeilong/p/6974188.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!