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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Данил Столповских <danil(dot)stolpovskikh(at)gmail(dot)com>
Cc: 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-28 18:35:57
Message-ID: 4755493c-a25c-1332-d2c1-900bd02fb125@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2023-09-28 Th 10:28, Tom Lane wrote:
> =?UTF-8?B?0JTQsNC90LjQuyDQodGC0L7Qu9C/0L7QstGB0LrQuNGF?= <danil(dot)stolpovskikh(at)gmail(dot)com> writes:
>> I would like to offer my patch on the problem of removing values from enums
>> It adds support for expression ALTER TYPE <enum_name> DROP VALUE
>> <value_name>
> This does not fix any of the hard problems that caused us not to
> have such a feature to begin with. Notably, what happens to
> stored data of the enum type if it is a now-deleted value?
>
>

I wonder if we could have a boolean flag in pg_enum, indicating that
setting an enum to that value was forbidden. That wouldn't delete the
value but it wouldn't show up in enum_range and friends. We'd have to
teach pg_dump and pg_upgrade to deal with it, but that shouldn't be too
hard.

Perhaps the command could be something like

ALTER TYPE enum_name DISABLE value;

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-09-28 18:46:22 Re: Allow deleting enumerated values from an existing enumerated data type
Previous Message Justin Pryzby 2023-09-28 18:29:21 Re: [HACKERS] pg_upgrade failed with error - ERROR: column "a" in child table must be marked NOT NULL