Re: Make relation_openrv atomic wrt DDL
Noah Misch <noah@2ndquadrant.com>
From: Noah Misch <noah@2ndQuadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Greg Stark <stark@mit.edu>, Simon Riggs <simon@2ndquadrant.com>, pgsql-hackers@postgresql.org, heikki.linnakangas@enterprisedb.com
Date: 2011-07-07T02:44:55Z
Lists: pgsql-hackers
Attachments
- atomic-openrv-v4.patch (text/plain)
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