Re: Locking to restrict rowcounts.

Поиск
Список
Период
Сортировка
От Glen Parker
Тема Re: Locking to restrict rowcounts.
Дата
Msg-id 4A130807.5030703@nwlink.com
обсуждение исходный текст
Ответ на Re: Locking to restrict rowcounts.  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
Richard Huxton wrote:
> Glen Parker wrote:
>> Richard Huxton wrote:
>>
>> #3 won't work unless the other transactions have all committed by the
>> time you do the check.  It is guaranteed to fail at some point.
>
> If it's in an AFTER INSERT/UPDATE trigger then whatever transaction
> takes you beyond 10 rows you will always get a failure. If you get a lot
> of insert/delete pairings then you could spend a lot of time counting
> rows, but that's all.


I still don't think it will work.  Two concurrent transactions could
still screw the data up.

Before: 9 rows.
Tx 1: See 9 rows, issue insert, see 10 rows.
Tx 2: See 9 rows, issue insert, see 10 rows.
After: 11 rows.

-Glen


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

Предыдущее
От: Glen Parker
Дата:
Сообщение: Re: Locking to restrict rowcounts.
Следующее
От: Andy Colson
Дата:
Сообщение: Re: origins/destinations