Re: Summary table trigger example race condition - Mailing list pgsql-patches

From Mark Kirkwood
Subject Re: Summary table trigger example race condition
Date
Msg-id 43C46B09.8080300@paradise.net.nz
Whole thread Raw
In response to Re: Summary table trigger example race condition  (Mark Kirkwood <markir@paradise.net.nz>)
List pgsql-patches
Mark Kirkwood wrote:
> Jim C. Nasby wrote:
>
>> On Sun, Jan 08, 2006 at 04:13:01PM +1300, Mark Kirkwood wrote:
>>
>>
>>
>> What happens if someone deletes the row between the failed insert and
>> the second update? :)
>>
>
> In this example the rows in the summary table never get deleted by
> DELETE operations on that main one - the trigger just decrements the
> various amounts - i.e DELETE becomes UPDATE, so no problem there.
>

Sorry Jim, I just realized you probably meant someone directly deleting
rows in the summary table itself. Well yes, that would certainly fox it!

I guess I was implicitly considering a use case where the only direct
DML on the summary table would be some sort of ETL process, which would
probably lock out other changes (and re-create the summary table data
afterwards in all likelihood).

Cheers

Mark

pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: TODO-item: Add sleep() function, remove from regress.c
Next
From: Tom Lane
Date:
Subject: Re: TODO-item: Add sleep() function, remove from regress.c