Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgres list all roles

# psql command 
du
Comment

postgresql list users

postgres=# du
Comment

postgres list users and roles

SELECT r.rolname, r.rolsuper, r.rolinherit,
  r.rolcreaterole, r.rolcreatedb, r.rolcanlogin,
  r.rolconnlimit, r.rolvaliduntil,
  ARRAY(SELECT b.rolname
        FROM pg_catalog.pg_auth_members m
        JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)
        WHERE m.member = r.oid) as memberof
, r.rolreplication
, r.rolbypassrls
FROM pg_catalog.pg_roles r
WHERE r.rolname !~ '^pg_'
ORDER BY 1;
Comment

postgres list users

SELECT usename AS role_name,
       CASE
           WHEN usesuper AND usecreatedb THEN
               cast('superuser, create database' AS pg_catalog.text)
           WHEN usesuper THEN
               cast('superuser' AS pg_catalog.text)
           WHEN usecreatedb THEN
               cast('create database' AS pg_catalog.text)
           ELSE
               cast('' AS pg_catalog.text)
       END     AS role_attributes
FROM pg_catalog.pg_user
ORDER BY role_name DESC;
Comment

PREVIOUS NEXT
Code Example
Sql :: drop primary key oracle 
Sql :: postgresql connection string c# 
Sql :: add primary key with auto increment to existing table column mysql 
Sql :: how to select unique element in sql 
Sql :: mysql change default collation 
Sql :: current timestamp in milliseconds mysql 
Sql :: restroe pg_dump example 
Sql :: mysql two column combination unique 
Sql :: sql drop procedure 
Sql :: CONVERT time string into 12 hours in sql 
Sql :: sp in sql server 
Sql :: how to enable extension in postgreSQL 
Sql :: sql counter column 
Sql :: mysql kill 
Sql :: output table plsql 
Sql :: sql email Regex 
Sql :: sql row number in result set 
Sql :: sql get inserted primary key 
Sql :: count in sql and diff 
Sql :: postgresql get date from datetime 
Sql :: sql server previous month 
Sql :: reindexing all tables sql server 
Sql :: opening xampp mysql in cmd ubuntu 
Sql :: create tablespace oracle multiple datafiles 
Sql :: how to delete data from sql database in android 
Sql :: setting default value for Boolean data type in SQL 
Sql :: mysql count characters in string 
Sql :: datepart sql server 
Sql :: change column name mysql 
Sql :: move table to a different schema 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =