Strange Behavior with Serializable Transcations

Поиск
Список
Период
Сортировка
От Brad Nicholson
Тема Strange Behavior with Serializable Transcations
Дата
Msg-id 44A2CEE1.3080900@ca.afilias.info
обсуждение исходный текст
Ответы Re: Strange Behavior with Serializable Transcations  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Strange Behavior with Serializable Transcations  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-general
I'm seeing something fairly unintuitive about serializable transactions.

Taking the following test case:

CREATE TABLE foo (id integer);

t1                       t2
--                       BEGIN;
--                       SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
INSERT INTO foo (id)     --
VALUES (1);              --
--                       SELECT * from foo;

The select in t2 sees the row inserted from t1, which it shouldn't.

http://www.postgresql.org/docs/8.1/interactive/transaction-iso.html

"When a transaction is on the serializable level, a SELECT query sees
only data committed before the transaction began; it never sees either
uncommitted data or changes committed during transaction execution by
concurrent transactions."

Now, if I modify the case as such:

t1                       t2
--                       BEGIN;
--                       SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
--                       SELECT * from foo;
INSERT INTO foo (id)     --
VALUES (1);              --
--                       SELECT * from foo;

The select in t2 (the last one, obviously) does not see the insert from t1.

What's up?


--
Brad Nicholson  416-673-4106    bnichols@ca.afilias.info
Database Administrator, Afilias Canada Corp.


В списке pgsql-general по дате отправления:

Предыдущее
От: "Bill Eaton"
Дата:
Сообщение: Re: unusual "relation xxx does not exist" problem
Следующее
От: "Karen Hill"
Дата:
Сообщение: Is it possible to disable insert/update/delete triggers for one transaction and not another?