> 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
> 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
> 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