The list of all the queries

All database privileges

Query goal: Find the privileges to use the database. c - CONNECT; C - CREATE; T - TEMPORARY.
Query type: General (Overview of some aspect of the database.)
Query license: MIT License
Data source: system catalog only
SQL query: Click on query to copy it

WITH db_privs AS (SELECT unnest(datacl)::text AS priv  
FROM pg_database
WHERE datname=current_database()), 
privs_extracted AS (SELECT 
left(priv, (position('=' IN priv)-1)) AS grantee,
substring(priv, position('=' IN priv)+1, position('/' IN priv)-position('=' IN priv)-1) AS privileges
FROM db_privs)
SELECT CASE WHEN grantee='' THEN 'PUBLIC' ELSE grantee END AS grantee, 
usesuper AS is_grantee_superuser, privileges
FROM privs_extracted LEFT JOIN pg_user ON privs_extracted.grantee=pg_user.usename
ORDER BY grantee;

Collections where the query belongs to

Collection nameCollection description
Find problems by overviewQueries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not .

Categories where the query belongs to

Category nameCategory description
SecurityQueries of this category provide information about the security measures.

The list of all the queries