Re: Allow deleting enumerated values from an existing enumerated data type

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Данил Столповских <danil(dot)stolpovskikh(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, o(dot)tselebrovskiy(at)postgrespro(dot)ru, d(dot)frolov(at)postgrespro(dot)ru
Subject: Re: Allow deleting enumerated values from an existing enumerated data type
Date: 2023-09-29 00:36:53
Message-ID: 9fffd149-da0f-0c9c-6745-731fb688642a@postgresfriends.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9/28/23 20:46, Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> 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.

This issue comes up regularly (although far from often). Do we want to
put some comments right where would-be implementors would be sure to see it?

Attached is an example of what I mean. Documentation is intentionally
omitted.
--
Vik Fearing

Attachment Content-Type Size
dropenum.diff text/x-patch 2.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kenichiro Tanaka 2023-09-29 00:40:00 Re: Try adding type cast with tablespace
Previous Message Michael Paquier 2023-09-29 00:33:59 Re: pg_upgrade and logical replication