Re: Confused comment about drop replica identity index

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Confused comment about drop replica identity index
Дата
Msg-id YdKqBchHjcj1e2vH@paquier.xyz
обсуждение исходный текст
Ответ на RE: Confused comment about drop replica identity index  ("houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>)
Список pgsql-hackers
On Thu, Dec 30, 2021 at 06:45:30AM +0000, houzj.fnst@fujitsu.com wrote:
> I think forbids DROP INDEX might not completely solve this problem. Because
> user could still use other command to delete the index, for example: ALTER
> TABLE DROP COLUMN. After dropping the column, the index on it will also be
> dropped.
>
> Besides, user can also ALTER REPLICA IDENTITY USING INDEX "primary key", and in
> this case, when they ALTER TABLE DROP CONSTR "PRIMARY KEY", the replica
> identity index will also be dropped.

Indexes related to any other object type, like constraints, are
dropped as part of index_drop() as per the handling of dependencies.
So, by putting a restriction there, any commands would take this code
path, and fail when trying to drop an index used as a replica
identity.  Why would that be logically a problem?  We may want errors
with more context for such cases, though, as complaining about an
object not directly known by the user when triggering a different
command, like a constraint index, could be confusing.
--
Michael

Вложения

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

Предыдущее
От: "Andrey V. Lepikhov"
Дата:
Сообщение: Clarify planner_hook calling convention
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pg_receivewal fail to streams when the partial file to write is not fully initialized present in the wal receiver directory