Re: locks in CREATE TRIGGER, ADD FK - Mailing list pgsql-hackers

From Tom Lane
Subject Re: locks in CREATE TRIGGER, ADD FK
Date
Msg-id 1707.1111552949@sss.pgh.pa.us
Whole thread Raw
In response to Re: locks in CREATE TRIGGER, ADD FK  (Neil Conway <neilc@samurai.com>)
Responses Re: locks in CREATE TRIGGER, ADD FK
List pgsql-hackers
Neil Conway <neilc@samurai.com> writes:
> How can we drop the file at commit, given that a serializable 
> transaction's snapshot should still be able to see old relfilenode's 
> content?

It isn't 100% MVCC, I agree.  But it works because system catalog
lookups are SnapshotNow, and so when another session comes and wants to
look at the table it will see the committed new version of the pg_class
row pointing at the new relfilenode file.  What you have to prevent is
somebody accessing the table *while* the changeover happens ... and
that's why your lock has to be AccessExclusive.

If you want to complain about MVCC violations in CLUSTER, think about
the fact that it scans the table with SnapshotNow, and therefore loses
rows that are committed-dead but might still be visible to somebody.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: swapping relfilenodes (was: Re: locks in CREATE TRIGGER,
Next
From: Tom Lane
Date:
Subject: Re: swapping relfilenodes (was: Re: locks in CREATE TRIGGER,