• Heikki Linnakangas's avatar
    Make ExecGetInsertedCols() and friends more robust and improve comments. · 54e51dcd
    Heikki Linnakangas authored
    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 6214e2b2,
    ri_RangeTableIndex is zero for ResultRelInfos created for partition tuple
    routing.
    
    Noted by Coverity. Backpatch down to v11, like commit 6214e2b2.
    
    Reviewed-by: Tom Lane, Amit Langote
    54e51dcd
execUtils.c 35.9 KB