Re: AW: AW: Issue NOTICE for attempt to raise lock level? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: AW: AW: Issue NOTICE for attempt to raise lock level?
Date
Msg-id 14845.973625745@sss.pgh.pa.us
Whole thread Raw
In response to Re: AW: AW: Issue NOTICE for attempt to raise lock level?  (Hannu Krosing <hannu@tm.ee>)
List pgsql-hackers
Hannu Krosing <hannu@tm.ee> writes:
> Tom Lane wrote:
>> I do not believe it is safe to drop read locks intra-transaction, and
>> I am unwilling to take a chance on it being safe so close to 7.1 beta.

> Will we still have readers-dont-block-writers behaviour?

Sure.  The only thing this really affects is VACUUM and schema-altering
commands, which will now have to wait until reader transactions commit.
In other words
Session 1            Session 2
BEGIN;SELECT * FROM foo;
                ALTER TABLE foo ...
...
COMMIT;

Session 2 will have to wait for session 1 to commit; before it didn't.
An example of why this is a good idea is
Session 1            Session 2
BEGIN;DECLARE c CURSOR FOR    SELECT * FROM foo;
                ALTER TABLE foo ...
FETCH FROM c;
COMMIT;

Without a held read lock on foo, session 1 is in deep trouble,
because its cursor is no longer correctly planned.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: AW: AW: Issue NOTICE for attempt to raise lock level?
Next
From: "Kevin O'Gorman"
Date:
Subject: Need a debugging tip or two