Re: ISOLATION LEVEL SERIALIZABLE - Mailing list pgsql-general

From Fernando Schapachnik
Subject Re: ISOLATION LEVEL SERIALIZABLE
Date
Msg-id 20020326170626.J47521@ns1.via-net-works.net.ar
Whole thread Raw
In response to Re: ISOLATION LEVEL SERIALIZABLE  (power2themacs <power2themacs@yahoo.com>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Altering a CHAR(4) column CHAR(5) changing pg_attribute
Next
From: Stephan Szabo
Date:
Subject: Re: ISOLATION LEVEL SERIALIZABLE