Re: Lock table, Select for update and Serialization error

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: Lock table, Select for update and Serialization error
Дата
Msg-id AFCCBB403D7E7A4581E48F20AF3E5DB202CF7E68@EXADV1.host.magwien.gv.at
обсуждение исходный текст
Ответ на Lock table, Select for update and Serialization error  (sudhir <sudhirj@cse.iitb.ac.in>)
Список pgsql-general
One last comment:

sudhir wrote:
> T1# BEGIN -- snapshot taken
> T1# Set transaction isolation level serializable;
> T2# BEGIN -- snapshot taken
> T2# Set transaction isolation level serializable;
> T1# Update account set bal=bal-100 where accno=129;

The 'snapshot taken' are misplaced.

The snapshots are actually taken when the first 'real'
statement in the transaction is executed.

In the case of T1, this would be at
  Update account set bal=bal-100 where accno=129;

This is, as Tom Lane has pointed out, the reason why
locking the table as first statement in a transaction
will prevent serialization errors.

Tom said, 'the first DML statement', but as far as I know
a SELECT statement will also cause the snapshot to be taken.

Yours,
Laurenz Albe

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

Предыдущее
От: PFC
Дата:
Сообщение: Re: Using a trigger with an object-relational manager
Следующее
От: Hannes Dorbath
Дата:
Сообщение: Re: partial word matching