diff --git a/src/gausskernel/runtime/executor/nodeModifyTable.cpp b/src/gausskernel/runtime/executor/nodeModifyTable.cpp index 55205125c..246e58473 100644 --- a/src/gausskernel/runtime/executor/nodeModifyTable.cpp +++ b/src/gausskernel/runtime/executor/nodeModifyTable.cpp @@ -477,6 +477,10 @@ bool ExecComputeStoredUpdateExpr(ResultRelInfo *resultRelInfo, EState *estate, T int attnum; uint32 updated_colnum_resno; Bitmapset* updatedCols = GetUpdatedColumns(node->resultRelInfo, node->ps.state); + + HeapTuple oldtup = GetTupleForTrigger(estate, NULL, resultRelInfo, oldPartitionOid, bucketid, otid, LockTupleShared, NULL); + RecoredUpdateExpr(resultRelInfo, estate, cmdtype); + /* * If no generated columns have been affected by this change, then skip * the rest. @@ -484,10 +488,6 @@ bool ExecComputeStoredUpdateExpr(ResultRelInfo *resultRelInfo, EState *estate, T if (resultRelInfo->ri_NumUpdatedNeeded == 0) return true; - HeapTuple oldtup = GetTupleForTrigger(estate, NULL, resultRelInfo, oldPartitionOid, bucketid, otid, LockTupleShared, NULL); - - RecoredUpdateExpr(resultRelInfo, estate, cmdtype); - /* compare update operator whether the newtuple is equal to the oldtuple, * if equal, so update don't fix the default column value */ Datum* oldvalues = (Datum*)palloc(natts * sizeof(Datum));