Re: Make relation_openrv atomic wrt DDL - Mailing list pgsql-hackers

From Noah Misch
Subject Re: Make relation_openrv atomic wrt DDL
Date
Msg-id 20110707024454.GC1840@tornado.leadboat.com
Whole thread Raw
In response to Re: Make relation_openrv atomic wrt DDL  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Make relation_openrv atomic wrt DDL
List pgsql-hackers
On Wed, Jul 06, 2011 at 08:35:55PM -0400, Robert Haas wrote:
> On Wed, Jul 6, 2011 at 6:32 PM, Noah Misch <noah@2ndquadrant.com> wrote:
> > While a mere "LOCK bar.x" is sufficient to get a clean cutover with respect to
> > parsing, it fails to invalidate plans.  To really cover all bases, you need
> > some no-op action that invalidates "bar.x".  For actual practical use, I'd
> > recommend something like:
> >
> >        BEGIN;
> >        ALTER TABLE bar.x RENAME TO x0;
> >        ALTER TABLE bar.x0 RENAME TO x;
> >        CREATE TABLE foo.x ...
> >        COMMIT;
> >
> > Probably worth making it more intuitive to DTRT here.
>
> Well, what would be really nice is if it just worked.

Yes.

> Care to submit an updated patch?

Attached.  I made the counter 64 bits wide, handled the nothing-found case per
your idea, and improved a few comments cosmetically.  I have not attempted to
improve the search_path interposition case.  We can recommend the workaround
above, and doing better looks like an excursion much larger than the one
represented by this patch.

Thanks,
nm

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: spinlock contention
Next
From: Jeff Davis
Date:
Subject: Re: Range Types, constructors, and the type system