Maksim Kita <kitaet...@gmail.com> writes: > There is a question related to TODO task with name "Allow deleting enumerated > values from an existing enumerated data type". > I made simple changes in parser and implement RemoveEnumLabel function, but > as I understand if enum value that we want to > delete is in use by some tables, we have to prevent deletion to avoid > inconsistency.
It's a lot worse than that. Even if you could ensure that the value is no longer present in any tables (which you cannot really, because of race conditions), that is not sufficient to ensure that it's not present in any indexes. For example, if a specific value has managed to work its way up into the upper levels of a btree index, it's basically never going to disappear short of a full REINDEX. So we have to keep around sufficient information to allow it to be compared correctly. That TODO item should either be removed or marked with a warning stating that it's next door to impossible. (Unfortunately, a lot of our TODO items are like that ... there's usually a good reason why they're not done already.) regards, tom lane