>Make a SELECT to check if the row exist.
>If not it make a INSERT, or if its there it make an UPDATE (or something
>totally different).
>
>Everything is swell, but when several pids are trying to insert there is a
>window of error between the SELECT and INSERT. And the test program
>triggered it frequently. What if there were a lot of insert/updated before
>and after the failing one (inside this transaction) and it would be ok if
>this row was inserted by someone else. The dba does not know about that, *I
>do* and can write my program in such a way.
>
>How do you fix that in PostgreSQL! The only way I know of is not to use
>transactions. Then if the INSERT fails you can try again with SELECT to
>check if the row has been inserted by someone else. And ofcourse you would
>need to build your own rollback function.
>
>The "all or nothing approach" ala PostgreSQL is broken!
>
>Nuff about transactions. I do not think I can convince you and you cant
>convince me about that they are not. And why do you not check how the other
>dbas has solved this. I bet they work as I describe.
Wouldn't it be smart to make the select and insert a transaction, and if it
fails, then start an update?
Rob Nelson
rdnelson@co.centre.pa.us