catalog
pg_locks
Shows granted and waiting lock requests; snapshots can change and row locks are not always represented directly.
Formal Syntax & Structure
sql syntaxsql
SELECT locktype, mode, granted FROM pg_catalog.pg_locks WHERE pid = pg_backend_pid() ORDER BY locktype, mode, granted;Working Example
Example Snippetsql
-- Disposable PostgreSQL lab only; see LAB.md.SELECT locktype, mode, granted FROM pg_catalog.pg_locks WHERE pid = pg_backend_pid() ORDER BY locktype, mode, granted;