From: Tom Lane <tgl@sss.pgh.pa.us>
To: Maksim Kita <kitaetoya@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Allow deleting enum value
Date: Wed, 07 Oct 2020 11:23:34 -0400
Message-ID: <2151250.1602084214@sss.pgh.pa.us> (raw)
In-Reply-To: <20201007142656.GA181015@yetti>
References: <20201007142656.GA181015@yetti>
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 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, kitaetoya@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Allow deleting enum value
In-Reply-To: <2151250.1602084214@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox