From d0ce9d0bc7f6aab6e45158bfa4f19cffdd7079a6 Mon Sep 17 00:00:00 2001 From: Masahiko Sawada Date: Tue, 25 Jul 2023 15:09:34 +0900 Subject: Remove unnecessary checks for indexes for REPLICA IDENTITY FULL tables. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/backend/executor/execReplication.c') diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c index e7765242270..81f27042bc4 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -222,16 +222,7 @@ retry: if (!isIdxSafeToSkipDuplicates) { if (eq == NULL) - { -#ifdef USE_ASSERT_CHECKING - /* apply assertions only once for the input idxoid */ - IndexInfo *indexInfo = BuildIndexInfo(idxrel); - - Assert(IsIndexUsableForReplicaIdentityFull(indexInfo)); -#endif - eq = palloc0(sizeof(*eq) * outslot->tts_tupleDescriptor->natts); - } if (!tuples_equal(outslot, searchslot, eq)) continue; -- cgit v1.2.3