List admins in Redshift

Article for: SQL Server Vertica

Query below returns list of admins in current Redshift instance.

Query

select usesysid as user_id,
       usename as username,
       usecreatedb as db_create,
       usesuper as is_superuser,
       valuntil as password_expiration
from pg_user
where is_super_user = true
order by user_id

Columns

  • user_id - id of the user
  • username - user name
  • db_create - flag indicating if user can create new databases
  • is_superuser - flag if user have superuser privileges
  • password_expiration - date of user password expiration

Rows

  • One row represents one admin in the database
  • Scope of rows: all admins in Redshift
  • Ordered by user id

Sample results

sample results

0
There are no comments. Click here to write the first comment.