Re: using DROP in a transaction
| От | Tom Lane |
|---|---|
| Тема | Re: using DROP in a transaction |
| Дата | |
| Msg-id | 18877.1202429210@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | using DROP in a transaction ("Willy-Bas Loos" <willybas@gmail.com>) |
| Ответы |
Re: using DROP in a transaction
|
| Список | pgsql-general |
"Willy-Bas Loos" <willybas@gmail.com> writes:
> then in TTY2, run
> begin;
> drop table test;
> create table test (id int4 primary key);
> insert into test (id) values (2);
> then, in TTY1:
> select * from test;
> Actually, i thought of a longer test, but it stops here - there is no
> response, no prompt anaymore, until i cancel the query.
DROP TABLE takes an exclusive lock. The SELECT is waiting for that
lock to be released.
You could shorten the length of the exclusive lock by creating and
filling the replacement table under a new name, then DROP, then
rename the new table into place and immediately commit. But you
aren't going to be able to eliminate it entirely.
regards, tom lane
В списке pgsql-general по дате отправления: