Re: Alter table never finishes - Mailing list pgsql-general

From bricklen
Subject Re: Alter table never finishes
Date
Msg-id CAGrpgQ_MEFEOALfeLmDXjtA2VuoCndKowGgd_LuZJxuLgAT43g@mail.gmail.com
Whole thread Raw
In response to Alter table never finishes  (Leonardo M. Ramé <l.rame@griensu.com>)
List pgsql-general

On Tue, Jul 30, 2013 at 7:50 AM, Leonardo M. Ramé <l.rame@griensu.com> wrote:
Hi, I need to do an alter table on a small table (~300 records), but it
never ends. It may be because there are clients using that table.

How can I force disconnect all clients to let me alter that table?.

If you are using PostgreSQL 9.2+, you can use this:
select pg_cancel_backend(pid) from pg_stat_activity where pid <> pg_backend_pid();

If you are using earlier version, replace "pid" with "procpid".

That query will cancel all queries other than the session issuing the pg_cancel_backend() calls.

pgsql-general by date:

Previous
From: bricklen
Date:
Subject: Re: Fwd: corrupted files
Next
From: Klaus Ita
Date:
Subject: Re: Fwd: corrupted files