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