| From: | Glen Parker <glenebob(at)nwlink(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Cc: | Richard Huxton <dev(at)archonet(dot)com>, Shakil Shaikh <sshaikh(at)hotmail(dot)com> |
| Subject: | Re: Locking to restrict rowcounts. |
| Date: | 2009-05-19 19:27:03 |
| Message-ID: | 4A130807.5030703@nwlink.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Shakil Shaikh | 2009-05-19 20:09:48 | Re: Locking to restrict rowcounts. |
| Previous Message | Richard Huxton | 2009-05-19 19:07:30 | Re: Locking to restrict rowcounts. |