Remove unnecessary checks for indexes for REPLICA IDENTITY FULL tables.
authorMasahiko Sawada <msawada@postgresql.org>
Tue, 25 Jul 2023 06:09:34 +0000 (15:09 +0900)
committerMasahiko Sawada <msawada@postgresql.org>
Tue, 25 Jul 2023 06:09:34 +0000 (15:09 +0900)
commitd0ce9d0bc7f6aab6e45158bfa4f19cffdd7079a6
tree35071da2e5cc737abed1a88d33e3036317ecec1f
parent71e4cc6b8ec6a08f81973bd387fe575134cd0bdf
Remove unnecessary checks for indexes for REPLICA IDENTITY FULL tables.

Previously, when selecting an usable index for update/delete for the
REPLICA IDENTITY FULL table, in IsIndexOnlyExpression(), we used to
check if all index fields are not expressions. However, it was not
necessary, because it is enough to check if only the leftmost index
field is not an expression (and references the remote table column)
and this check has already been done by
RemoteRelContainsLeftMostColumnOnIdx().

This commit removes IsIndexOnlyExpression() and
RemoteRelContainsLeftMostColumnOnIdx() and all checks for usable
indexes for REPLICA IDENTITY FULL tables are now performed by
IsIndexUsableForReplicaIdentityFull().

Backpatch this to remain the code consistent.

Reported-by: Peter Smith
Reviewed-by: Amit Kapila, Önder Kalacı
Discussion: https://postgr.es/m/CAHut%2BPsGRE5WSsY0jcLHJEoA17MrbP9yy8FxdjC_ZOAACxbt%2BQ%40mail.gmail.com
Backpatch-through: 16
src/backend/executor/execReplication.c
src/backend/replication/logical/relation.c
src/backend/replication/logical/worker.c
src/include/replication/logicalrelation.h