Re: ISOLATION LEVEL SERIALIZABLE

From: Fernando Schapachnik <fschapachnik(at)vianetworks(dot)com(dot)ar>
To: power2themacs <power2themacs(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ISOLATION LEVEL SERIALIZABLE
Date: 2002-03-26 20:06:26
Message-ID: 20020326170626.J47521@ns1.via-net-works.net.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)vianetworks(dot)com(dot)ar

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-03-26 20:09:41 Re: ISOLATION LEVEL SERIALIZABLE
Previous Message Doug McNaught 2002-03-26 19:58:47 Re: ISOLATION LEVEL SERIALIZABLE