Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1al0ge-0001To-UA for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Mar 2016 20:56:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1al0ge-0004Sx-Gf for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Mar 2016 20:56:28 +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 1al0gd-0004Sq-GO for pgsql-hackers@postgresql.org; Tue, 29 Mar 2016 20:56:27 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1al0gZ-0003ko-7o for pgsql-hackers@postgresql.org; Tue, 29 Mar 2016 20:56:25 +0000 Received: from mfilter27-d.gandi.net (mfilter27-d.gandi.net [217.70.178.155]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id 5A84441C074; Tue, 29 Mar 2016 22:56:19 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter27-d.gandi.net Received: from relay5-d.mail.gandi.net ([IPv6:::ffff:217.70.183.197]) by mfilter27-d.gandi.net (mfilter27-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id NjCqvHptJCFT; Tue, 29 Mar 2016 22:56:17 +0200 (CEST) X-Originating-IP: 98.122.164.227 Received: from [192.168.10.146] (unknown [98.122.164.227]) (Authenticated sender: adsend@dunslane.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 591CC41C08A; Tue, 29 Mar 2016 22:56:16 +0200 (CEST) Subject: Re: Alter or rename enum value To: Tom Lane 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> <4075.1459088427@sss.pgh.pa.us> Cc: Christophe Pettus , "David G. Johnston" , Matthias Kurz , Jim Nasby , "pgsql-hackers@postgresql.org" From: Andrew Dunstan Message-ID: <56FAEBEF.3080406@dunslane.net> Date: Tue, 29 Mar 2016 16:56:15 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <4075.1459088427@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) 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 On 03/27/2016 10:20 AM, Tom Lane wrote: > 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.) > > I think this is a pretty promising approach, certainly well worth putting some resources into investigating. One thing I like about it is that it gives a nice cheap negative test, so we know if the xmin is committed we are safe. So we could start by rejecting anything where it's not, but later might adopt a more refined but expensive tests for cases where it isn't committed without imposing a penalty on anything else. cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers