pgsql: Make ExecGetInsertedCols() and friends more robust and improve c - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Make ExecGetInsertedCols() and friends more robust and improve c
Date
Msg-id E1lBYME-00006R-Il@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Make ExecGetInsertedCols() and friends more robust and improve comments.

If ExecGetInsertedCols(), ExecGetUpdatedCols() or ExecGetExtraUpdatedCols()
were called with a ResultRelInfo that's not in the range table and isn't a
partition routing target, the functions would dereference a NULL pointer,
relinfo->ri_RootResultRelInfo. Such ResultRelInfos are created when firing
RI triggers in tables that are not modified directly. None of the current
callers of these functions pass such relations, so this isn't a live bug,
but let's make them more robust.

Also update comment in ResultRelInfo; after commit 6214e2b228,
ri_RangeTableIndex is zero for ResultRelInfos created for partition tuple
routing.

Noted by Coverity. Backpatch down to v11, like commit 6214e2b228.

Reviewed-by: Tom Lane, Amit Langote

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/54e51dcde03e5c746e8de6243c69fafdc8d0ec7a

Modified Files
--------------
src/backend/executor/execUtils.c | 28 +++++++++++++++++++++-------
src/include/nodes/execnodes.h    | 15 +++++++++------
2 files changed, 30 insertions(+), 13 deletions(-)


pgsql-committers by date:

Previous
From: Fujii Masao
Date:
Subject: pgsql: Display the time when the process started waiting for the lock,
Next
From: Amit Kapila
Date:
Subject: Re: pgsql: Allow multiple xacts during table sync in logical replication.