Re: ISOLATION LEVEL SERIALIZABLE

Поиск
Список
Период
Сортировка
От Fernando Schapachnik
Тема Re: ISOLATION LEVEL SERIALIZABLE
Дата
Msg-id 20020326170626.J47521@ns1.via-net-works.net.ar
обсуждение исходный текст
Ответ на Re: ISOLATION LEVEL SERIALIZABLE  (power2themacs <power2themacs@yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От: Jan Wieck
Дата:
Сообщение: Re: Altering a CHAR(4) column CHAR(5) changing pg_attribute
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: ISOLATION LEVEL SERIALIZABLE