Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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 :: Insert from table tsql 
Sql :: clear a table in mysql 
Sql :: create database hive 
Sql :: clone table structure mysql 
Sql :: oracle tables with column name 
Sql :: linebreak sql 
Sql :: how to know the username of postgresql 
Sql :: sql limit decimal places 
Sql :: query saurce oracle 
Sql :: list all the tables in sql 
Sql :: current year sql 
Sql :: mysql backup query 
Sql :: sql add column after another column 
Sql :: check if record exists mysql 
Sql :: sql offset 
Sql :: get name of day in sql 
Sql :: sql view where tables have same column name combine results 
Sql :: Write a query to create an empty table from an existing table? 
Sql :: brew install mysql 8 
Sql :: update mongodb version ubuntu 
Sql :: sql in array query 
Sql :: postgres cast as currency format 
Sql :: oracle desc table primary key 
Sql :: postgresql export database 
Sql :: How to drop a foreign key constraint in mysql ? 
Sql :: create_engine sqlalchemy with parsed url sql server 
Sql :: select last row in sql 
Sql :: get number of table colums in sql query 
Sql :: create view in sql 
Sql :: mysql select into new table 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =