]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Make ExecGetInsertedCols() and friends more robust and improve comments.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 15 Feb 2021 07:28:08 +0000 (09:28 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 15 Feb 2021 07:29:39 +0000 (09:29 +0200)
commit18cacf89b9fe5523941b57fbd01d408585e70737
tree88af82b3ec4734e2d6c1365c48de8c02d7dc93c9
parent6c23e5ae9ee12ff1f5183573885bfaa4eb97b243
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
src/backend/executor/execUtils.c
src/include/nodes/execnodes.h