changeset 2378:c1a29f63c714

List roles.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Mon, 16 Sep 2019 22:40:00 +0300
parents 5b148ee677de
children a38f029fcf84
files postgres.rst
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/postgres.rst	Mon Sep 16 22:33:19 2019 +0300
+++ b/postgres.rst	Mon Sep 16 22:40:00 2019 +0300
@@ -130,6 +130,9 @@
 
   SELECT * FROM pg_roles;
 
+  SELECT oid, rolname FROM pg_roles
+  WHERE pg_has_role('xuser', oid, 'member');
+
 Revoke privileges::
 
   REVOKE ALL PRIVILEGES ON DATABASE mydb FROM xuser;
@@ -176,6 +179,12 @@
 
 Monitor connections
 ===================
+
+Current user::
+
+  SELECT current_user;
+  SELECT session_user;
+
 ::
 
    select * from pg_stat_activity;