[GENERAL] Re: race conditions in my sequences

2001-08-16 Thread Gregory Wood
> Any suggestions would be more then appreciate as always. Is there a > better way to do what I'm trying to do? I would recommend using only one sequence for the master table. Then just reference that sequence value for the two foreign keys. For example: BEGIN; INSERT INTO Bugs (bug_date) VALUE

[GENERAL] Re: race conditions

2000-09-09 Thread Tim Kientzle
> SELECT ID FROM ITEM WHERE URL='X' FOR UPDATE > IF (ROW RETURNED) { > $ID = ITEM.ID > } ELSE { ... do insert ... > } In this situation, I would try to somehow incorporate a constraint into the database table definition. E.g., CREATE TABLE item ( ... url VARCHAR(80), UNIQUE(url), ... ); With

[GENERAL] Re: Race conditions...

2000-09-09 Thread K Parker
> Whenever I do inserts like yours, I do it in > this kind of manner (I tried > to use your pseudocode style): > SELECT ID FROM ITEM WHERE URL='X' FOR UPDATE > IF (ROW RETURNED) { > $ID = ITEM.ID > } ELSE { > INSERT INTO ITEM ... > GET THE OID [via PQoidStatus or your > environment's equiva