好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

PostgreSQL查看当前用户

 

 select  *  from   current_user ;

 

eg:  

kerrydb=>  select  *  from   current_user ;
  current_user  
------------ -- 
  test 
(1  row )

 

方法 2 :

 

select user;

 

eg :

kerrydb=>  select   user ;
  user  
---- -- 
  test 
(1  row )
 
kerrydb=> 

 

 

方法 3 :

 

\c

 

eg :

kerrydb=> \c
You  are  now connected  to   database  "kerrydb"  as   user  "test".

 

此方法只使用与 psql 命令。

 

方法 4 :

 

\conninfo

 

eg :

postgres=# \conninfo
You  are  connected  to   database  "postgres"  as   user  "postgres"  on   host  "127.0.0.1"  at  port "5432".

 

方法 5 :

 

 

current_user 是 the current user identifier

session_user 是 the current session user identifier 。

 

postgres=#  SELECT   session_user ,  current_user ;
  session_user  |  current_user  
--------------+------------ -- 
  postgres     | postgres 
(1  row )

PostgreSQL查看当前用户

标签:row   man   time   connect   from   family   theme   pad   wrapper   

查看更多关于PostgreSQL查看当前用户的详细内容...

  阅读:43次