Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1akBZv-00041E-DU for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Mar 2016 14:22:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1akBZt-0001rP-L7 for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Mar 2016 14:22:05 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1akBYX-0000Kc-CV for pgsql-hackers@postgresql.org; Sun, 27 Mar 2016 14:20:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1akBYQ-0003LF-BY for pgsql-hackers@postgresql.org; Sun, 27 Mar 2016 14:20:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u2REKRde004076; Sun, 27 Mar 2016 10:20:27 -0400 From: Tom Lane To: Andrew Dunstan cc: Christophe Pettus , "David G. Johnston" , Matthias Kurz , Jim Nasby , "pgsql-hackers@postgresql.org" Subject: Re: Alter or rename enum value In-reply-to: <56F7D8BF.5000000@dunslane.net> References: <56E049CC.8010201@dunslane.net> <25605.1457539654@sss.pgh.pa.us> <56E05635.70908@dunslane.net> <28167.1457543612@sss.pgh.pa.us> <56F49CF8.8050007@BlueTreble.com> <27476.1458876456@sss.pgh.pa.us> <56F58876.6020508@dunslane.net> <56F6827F.9040104@dunslane.net> <3202.1459002341@sss.pgh.pa.us> <56F69F5C.1060408@dunslane.net> <56F7D8BF.5000000@dunslane.net> Comments: In-reply-to Andrew Dunstan message dated "Sun, 27 Mar 2016 08:57:35 -0400" Date: Sun, 27 Mar 2016 10:20:27 -0400 Message-ID: <4075.1459088427@sss.pgh.pa.us> X-Pg-Spam-Score: -2.9 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Andrew Dunstan writes: > The more I think about this the more I bump up against the fact that > almost anything we do might want to do to ameliorate the situation is > going to be rolled back. The only approach I can think of that doesn't > suffer from this is to abort if an insert/update will affect an index on > a modified enum. i.e. we prevent the possible corruption from happening > in the first place, as we do now, but in a much more fine grained way. Perhaps, instead of forbidding ALTER ENUM ADD in a transaction, we could allow that, but not allow the new value to be *used* until it's committed? This could be checked cheaply during enum value lookup (ie, is xmin of the pg_enum row committed). What you really need is to prevent the new value from being inserted into any indexes, but checking that directly seems far more difficult, ugly, and expensive than the above. I do not know whether this would be a meaningful improvement for common use-cases, though. (It'd help if people were more specific about the use-cases they need to work.) regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers