- 查询是否锁表
select oid from pg_class where relname='可能被锁的表';
select pid from pg_locks where relation='上面查出的oid' order by pid asc;
- 如果查询到了结果,表示该表被锁 则需要释放锁定
select pg_cancel_backend(上面查到的第一个pid);
- 以上SQL语句表示杀死进程,pid为****
select oid from pg_class where relname='可能被锁的表';
select pid from pg_locks where relation='上面查出的oid' order by pid asc;
select pg_cancel_backend(上面查到的第一个pid);