Re: Allow deleting enum value

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Allow deleting enum value
Дата
Msg-id 2151250.1602084214@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Allow deleting enum value  (Maksim Kita <kitaetoya@gmail.com>)
Ответы Re: Allow deleting enum value  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Maksim Kita <kitaetoya@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
wantto  
> 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Patrick REED
Дата:
Сообщение: Re: Prepared Statements
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Allow deleting enum value