Re: Table lock while adding a column and clients are logged in

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: Table lock while adding a column and clients are logged in
Дата
Msg-id in9t6d$ne2$2@dough.gmane.org
обсуждение исходный текст
Ответ на Re: Table lock while adding a column and clients are logged in  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
Ответы Re: Table lock while adding a column and clients are logged in  ("Sven Haag" <sven-haag@gmx.de>)
Список pgsql-general
Alban Hertroys wrote on 03.04.2011 11:17:
> On 2 Apr 2011, at 12:44, Thomas Kellerer wrote:
>
>> Even after a plain SELECT you should issue a COMMIT (or ROLLBACK)
>> to end the transaction that was implicitely started with the
>> SELECT.
>
> Sorry, but you're wrong about that. A statement that implicitly
> starts a transaction also implicitly COMMITs it. Otherwise single
> UPDATE and INSERT statements outside of transaction blocks would not
> COMMIT, and they do.

AFAIK this is only true if you are running in auto commit mode.

If you have auto commit turned off, a SELECT statement will leave the current transaction as "IDLE in transaction" not
"IDLE"which means it *will* hold a lock on the tables involved that will prevent an ALTER TABLE. 

Regards
Thomas



В списке pgsql-general по дате отправления:

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: Table lock while adding a column and clients are logged in
Следующее
От: "Sven Haag"
Дата:
Сообщение: Re: Table lock while adding a column and clients are logged in