Re: Confused comment about drop replica identity index
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, "wangw.fnst@fujitsu.com" <wangw.fnst@fujitsu.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2021-12-16T18:08:46Z
Lists: pgsql-hackers
On 2021-Dec-15, Michael Paquier wrote:
> On Tue, Dec 14, 2021 at 07:10:49PM +0530, Ashutosh Bapat wrote:
> > This code in RelationGetIndexList() is not according to that comment.
> >
> > if (replident == REPLICA_IDENTITY_DEFAULT && OidIsValid(pkeyIndex))
> > relation->rd_replidindex = pkeyIndex;
> > else if (replident == REPLICA_IDENTITY_INDEX && OidIsValid(candidateIndex))
> > relation->rd_replidindex = candidateIndex;
> > else
> > relation->rd_replidindex = InvalidOid;
>
> Yeah, the comment is wrong. If the index of a REPLICA_IDENTITY_INDEX
> is dropped, I recall that the behavior is the same as
> REPLICA_IDENTITY_NOTHING.
Hmm, so if a table has REPLICA IDENTITY INDEX and there is a publication
with an explicit column list, then we need to forbid the DROP INDEX for
that index.
I wonder why don't we just forbid DROP INDEX of an index that's been
defined as replica identity. It seems quite silly an operation to
allow.
--
Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/
"Ed is the standard text editor."
http://groups.google.com/group/alt.religion.emacs/msg/8d94ddab6a9b0ad3
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