Re: Confused comment about drop replica identity index
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>
Cc: Euler Taveira <euler@eulerto.com>, "wangw.fnst@fujitsu.com" <wangw.fnst@fujitsu.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2022-01-03T07:47:17Z
Lists: 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
Commits
-
Correct comment and some documentation about REPLICA_IDENTITY_INDEX
- 9edca4cb57d2 10.20 landed
- 1a0ef5e2cc63 11.15 landed
- 861095a40987 12.10 landed
- 28e1e5c2a91c 13.6 landed
- 420f9ac1b77c 14.2 landed
- fc95d35b9429 15.0 landed
-
Add regression tests for REPLICA IDENTITY with dropped indexes
- fe7fd4e9613f 14.0 cited