Re: Re: new patch of MERGE (merge_204) & a question about duplicated ctid - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Re: new patch of MERGE (merge_204) & a question about duplicated ctid
Date
Msg-id AANLkTikUAYDhRkLv3MVRYUFuXua69_m944-kXwav8QAJ@mail.gmail.com
Whole thread Raw
In response to Re: Re: new patch of MERGE (merge_204) & a question about duplicated ctid  (Florian Pflug <fgp@phlo.org>)
List pgsql-hackers
On Mon, Jan 3, 2011 at 11:36 AM, Florian Pflug <fgp@phlo.org> wrote:
> On Jan3, 2011, at 17:21 , Robert Haas wrote:
>> On Mon, Jan 3, 2011 at 11:08 AM, Heikki Linnakangas
>>> In serializable mode you get a serialization error.
>>
>> I don't think this part is true.  You can certainly do this:
>>
>> CREATE TABLE test (a int);
>> BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
>> SELECT * FROM test;
>> <in another session, insert (1) into test>
>> LOCK TABLE test IN SHARE MODE; -- or just LOCK TABLE test, if you prefer
>> SELECT * FROM test;  -- still ain't there
>> INSERT INTO test VALUES (1);
>
> In SERIALIZABLE mode, you need to take any table-level locks before obtaining
> a snapshot. There's even a warning about this in the docs somewhere IIRC...

That should be safe, if people do it that way.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Re: new patch of MERGE (merge_204) & a question about duplicated ctid
Next
From: Andrew Dunstan
Date:
Subject: back branches vs. VS 2008