Re: Allow deleting enumerated values from an existing enumerated data type
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>, Данил Столповских <danil.stolpovskikh@gmail.com>
Cc: pgsql-hackers@postgresql.org, o.tselebrovskiy@postgrespro.ru,
d.frolov@postgrespro.ru
Date: 2023-09-28T18:35:57Z
Lists: pgsql-hackers
On 2023-09-28 Th 10:28, Tom Lane wrote: > =?UTF-8?B?0JTQsNC90LjQuyDQodGC0L7Qu9C/0L7QstGB0LrQuNGF?= <danil.stolpovskikh@gmail.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
Commits
-
Add some notes about why "ALTER TYPE enum DROP VALUE" is hard.
- af3ee8a086ca 17.0 landed