PostgreSQL release lock on table Edit
Below is the sample query to detect lock on PostgreSQL tables.
Sample Query
select nspname, relname, l.* from pg_locks l join pg_class c on (relation = c.oid) join pg_namespace nsp on (c.relnamespace = nsp.oid) where pid in (select pid from pg_stat_activity where datname = current_database() and query != current_query());
If you run the above query you can find the PID & use the below command to terminate the backed
SELECT pg_terminate_backend(pid);