Re: BUG #11638: Transaction safety fails when constraints are dropped and analyze is done
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Andres Freund <andres@2ndquadrant.com>, cg@osss.net,
pgsql-bugs@postgresql.org
Date: 2014-10-28T23:28:05Z
Lists: pgsql-bugs
Attachments
- fix-bug-11638.patch (text/x-diff) patch
I wrote: > I think that a better answer is to continue to do this update > nontransactionally, but to not let the code clear relhasindex etc > if we're inside a transaction block. It is certainly safe to put > off clearing those flags if we're not sure that we're seeing a > committed state of the table's schema. Attached is a proposed patch to do it that way. I borrowed Michael's test case. > An interesting question is whether it is ever possible for this function > to be told to *set* relhasindex when it was clear (or likewise for the > other flags). Offhand I would say that that should never happen, because > certainly neither VACUUM nor ANALYZE should be creating indexes etc. > Should we make it throw an error if that happens, or just go ahead and > apply the update, assuming that it's correcting somehow-corrupted data? After looking more closely, the existing precedent for the other similar fields is just to make sure the code only clears the flags, never sets them, so I think relhasindex should be treated the same. regards, tom lane