On Friday 01 Nov 2002 2:56 pm, Chris Gamache wrote:
> I'm having a race condition with a FIFO queue program that I've created...
> I have a program that claims a row for itself
[code sample]
> The problem occurrs when two of the processes grab the exact same row at
> the exact same instant. It happens roughly 1 out of 1000 times. I'm not
> sure if setting the transactions to serializable would fix the problem
> since it occurrs between different postmasters.
>
> My experience with Views and Triggers is minimal. Would they even help?
> Could someone suggest a better FIFO queue method?
Check out SELECT FOR UPDATE - this locks the row and should do what you want.
This means that 1 time in 1000 your query will fail and need to be retried.
HTH
-- Richard Huxton