Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlw1y-004vgP-N7 for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Sep 2023 18:46:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qlw1x-00FUbV-7C for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Sep 2023 18:46:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlw1w-00FUbM-Sn for pgsql-hackers@lists.postgresql.org; Thu, 28 Sep 2023 18:46:32 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlw1r-0088io-DE for pgsql-hackers@postgresql.org; Thu, 28 Sep 2023 18:46:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 38SIkMt01081743; Thu, 28 Sep 2023 14:46:22 -0400 From: Tom Lane To: Andrew Dunstan cc: =?UTF-8?B?0JTQsNC90LjQuyDQodGC0L7Qu9C/0L7QstGB0LrQuNGF?= , pgsql-hackers@postgresql.org, o.tselebrovskiy@postgrespro.ru, d.frolov@postgrespro.ru Subject: Re: Allow deleting enumerated values from an existing enumerated data type In-reply-to: <4755493c-a25c-1332-d2c1-900bd02fb125@dunslane.net> References: <953107.1695911339@sss.pgh.pa.us> <4755493c-a25c-1332-d2c1-900bd02fb125@dunslane.net> Comments: In-reply-to Andrew Dunstan message dated "Thu, 28 Sep 2023 14:35:57 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1081741.1695926782.1@sss.pgh.pa.us> Date: Thu, 28 Sep 2023 14:46:22 -0400 Message-ID: <1081742.1695926782@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrew Dunstan writes: > I wonder if we could have a boolean flag in pg_enum, indicating that > setting an enum to that value was forbidden. Yeah, but that still offers no coherent solution to the problem of what happens if there's a table that already contains such a value. It doesn't seem terribly useful to forbid new entries if you can't get rid of old ones. Admittedly, a DISABLE flag would at least offer a chance at a race-condition-free scan to verify that no such values remain in tables. But as somebody already mentioned upthread, that wouldn't guarantee that the value doesn't appear in non-leaf index pages. So basically you could never get rid of the pg_enum row, short of a full dump and restore. We went through all these points years ago when the enum feature was first developed, as I recall. Nobody thought that the ability to remove an enum value was worth the amount of complexity it'd entail. regards, tom lane