En un mensaje anterior, power2themacs escribió:
> >In table two you would not create a serial instead you would create an
> >INTEGER because serial is a counter and the values in table 2 may not be
> >in table 1.
> >
> >Use a transaction like as follows
> >
> >BEGIN;
> >INSERT INTO TABLE1 VALUES (Whatever values);
> >var = SELECT CURRVAL('sequence_name');
> >INSERT INTO TABLE2 VALUES (var,whatever else);
> >COMMIT;
> >
>
> But this is the race condition I am trying to avoid. Someone can
If you are in a trasaction, the RDBMS guarantees that your statements
executes as if their where the only ones (ie, as in a serial
execution). No race condition there.
Regards.
Fernando P. Schapachnik
fschapachnik@vianetworks.com.ar