Re: Confused comment about drop replica identity index

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: Euler Taveira <euler(at)eulerto(dot)com>, "wangw(dot)fnst(at)fujitsu(dot)com" <wangw(dot)fnst(at)fujitsu(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Confused comment about drop replica identity index
Date: 2022-01-03 07:47:17
Message-ID: YdKqBchHjcj1e2vH@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 30, 2021 at 06:45:30AM +0000, houzj(dot)fnst(at)fujitsu(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-01-03 07:56:39 Re: pg_receivewal fail to streams when the partial file to write is not fully initialized present in the wal receiver directory
Previous Message Andrey V. Lepikhov 2022-01-03 07:33:13 Clarify planner_hook calling convention