Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ajpOQ-0006su-Ss for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Mar 2016 14:40:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ajpOP-0006Km-Ru for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Mar 2016 14:40:45 +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 1ajpON-0006Kd-QA for pgsql-hackers@postgresql.org; Sat, 26 Mar 2016 14:40:43 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ajpOG-0008C0-OY for pgsql-hackers@postgresql.org; Sat, 26 Mar 2016 14:40:42 +0000 Received: from mfilter33-d.gandi.net (mfilter33-d.gandi.net [217.70.178.164]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id 60BF6C5A54; Sat, 26 Mar 2016 15:40:32 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter33-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter33-d.gandi.net (mfilter33-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id gaaSRGnxhpkf; Sat, 26 Mar 2016 15:40:30 +0100 (CET) X-Originating-IP: 98.122.164.227 Received: from [192.168.10.146] (unknown [98.122.164.227]) (Authenticated sender: adsend@dunslane.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id AC6EDC5A55; Sat, 26 Mar 2016 15:40:29 +0100 (CET) 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> Cc: "David G. Johnston" , Matthias Kurz , Jim Nasby , "pgsql-hackers@postgresql.org" From: Andrew Dunstan Message-ID: <56F69F5C.1060408@dunslane.net> Date: Sat, 26 Mar 2016 10:40:28 -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: <3202.1459002341@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.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 On 03/26/2016 10:25 AM, Tom Lane wrote: > Andrew Dunstan writes: >> We don't have the luxury of being able to redesign this as a green >> fields development. > I'm not actually convinced that we need to do anything. SQL already has a > perfectly good mechanism for enforcing that a column contains only values > of a mutable set defined in another table --- it's called a foreign key. > The point of inventing enums was to provide a lower-overhead solution > for cases where the allowed value set is *not* mutable. So okay, if we > can allow certain cases of changing the value set without increasing > the overhead, great. But when we can't do it without adding a whole > lot of complexity and overhead (and, no doubt, bugs), we need to just > say no. > > Maybe the docs about enums need to be a little more explicit about > pointing out this tradeoff. > > OK, but we (in fact, you and I, for the most part) have provided a way to add new values. The trouble people have is the transaction restriction on that facility, because all the other changes they make with migration tools can be nicely wrapped in a transaction. And the thing is, in my recent experience on a project using quite a few enums, none of the transactions I'd like to include these mutations of enums in does anything that would be at all dangerous. It would be nice if we could find a less broad brush approach to dealing with the issue. 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