From: | Amit Kapila <akapila(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix uninitialized index information access during apply. |
Date: | 2025-04-08 10:20:22 |
Message-ID: | E1u2646-003HGN-2Q@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix uninitialized index information access during apply.
The issue happens when building conflict information during apply of
INSERT or UPDATE operations that violate unique constraints on leaf
partitions.
The problem was introduced in commit 9ff68679b5, which removed the
redundant calls to ExecOpenIndices/ExecCloseIndices. The previous code was
relying on the redundant ExecOpenIndices call in
apply_handle_tuple_routing() to build the index information required for
unique key conflict detection.
The fix is to delay building the index information until a conflict is
detected instead of relying on ExecOpenIndices to do the same. The
additional benefit of this approach is that it avoids building index
information when there is no conflict.
Author: Hou Zhijie <houzj(dot)fnst(at)fujitsu(dot)com>
Reviewed-by:Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Discussion: https://postgr.es/m/TYAPR01MB57244ADA33DDA57119B9D26494A62@TYAPR01MB5724.jpnprd01.prod.outlook.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/12eece5fd54c2aa3dbdefb6de7f18566f5c00357
Modified Files
--------------
src/backend/executor/execIndexing.c | 5 ++---
src/backend/executor/execReplication.c | 30 ++++++++++++++++++++++++++
src/backend/replication/logical/worker.c | 4 ++--
src/test/subscription/t/035_conflicts.pl | 37 +++++++++++++++++++++++++++++++-
4 files changed, 70 insertions(+), 6 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2025-04-08 10:42:38 | pgsql: doc: Correct pg_shmem_allocations_numa.size data type |
Previous Message | Thomas Munro | 2025-04-08 10:03:21 | pgsql: Fix typo in docs. |