SELECT
    locktype,
    relation::regclass,
    mode,
    transactionid AS tid,
    virtualtransaction AS vtid,
    pid,
    granted,
    application_name
FROM
    pg_catalog.pg_locks l
    LEFT JOIN pg_catalog.pg_database db ON db.oid = l.database
    LEFT JOIN pg_stat_activity a USING (pid)
WHERE (db.datname = 'dawndb'
    OR db.datname IS NULL)
AND NOT pid = pg_backend_pid();
