SELECT pid FROM PG_LOCKS WHERE relation in (
SELECT relnamespace, reltype, oid FROM PG_CLASS WHERE RELNAME LIKE '%tablename%');
然后,将pid数组
select pg_cancel_backend(pid[0]);
select pg_cancel_backend(pid[1]);
select pg_cancel_backend(pid[i]);
SELECT pid FROM PG_LOCKS WHERE relation in (
SELECT relnamespace, reltype, oid FROM PG_CLASS WHERE RELNAME LIKE '%tablename%');
然后,将pid数组
select pg_cancel_backend(pid[0]);
select pg_cancel_backend(pid[1]);
select pg_cancel_backend(pid[i]);