diff --git a/src/common/backend/catalog/heap.cpp b/src/common/backend/catalog/heap.cpp index 2348d253d..b592a3048 100644 --- a/src/common/backend/catalog/heap.cpp +++ b/src/common/backend/catalog/heap.cpp @@ -7508,7 +7508,7 @@ Oid getPartitionIdFromTuple(Relation rel, void *tuple, EState* estate, TupleTabl targetOid = heapTupleGetPartitionId(rel, tuple, partitionno, isDDL, canIgnore); } else { PartKeyExprResult partKeyExprResult = ComputePartKeyExprTuple(rel, estate, slot, NULL, partExprKeyStr); - targetOid = heapTupleGetPartitionOid(rel, (void*)(&partKeyExprResult), partitionno, isDDL, canIgnore, false); + targetOid = heapTupleGetPartitionId(rel, (void*)(&partKeyExprResult), partitionno, isDDL, canIgnore, false); } pfree_ext(partExprKeyStr); return targetOid; diff --git a/src/gausskernel/optimizer/commands/prepare.cpp b/src/gausskernel/optimizer/commands/prepare.cpp index 1cf4fcc05..0ccb5a8a4 100755 --- a/src/gausskernel/optimizer/commands/prepare.cpp +++ b/src/gausskernel/optimizer/commands/prepare.cpp @@ -828,6 +828,8 @@ void StorePreparedStatement(const char* stmt_name, CachedPlanSource* plansource, StorePreparedStatementCNGPC(stmt_name, plansource, from_sql, false); return; } + PreparedStatement* entry = NULL; + TimestampTz cur_ts = GetCurrentStatementStartTimestamp(); bool found = false; /* Initialize the hash table, if necessary */ diff --git a/src/gausskernel/runtime/executor/nodeModifyTable.cpp b/src/gausskernel/runtime/executor/nodeModifyTable.cpp index aef47b612..3f497746e 100644 --- a/src/gausskernel/runtime/executor/nodeModifyTable.cpp +++ b/src/gausskernel/runtime/executor/nodeModifyTable.cpp @@ -1372,7 +1372,7 @@ TupleTableSlot* ExecInsertT(ModifyTableState* state, TupleTableSlot* slot, Tuple if (partExprKeyStr) { PartKeyExprResult partKeyExprTuple = ComputePartKeyExprTuple(result_relation_desc, estate, slot, NULL, partExprKeyStr); - partition_id = heapTupleGetPartitionOid(result_relation_desc, (void *) (&partKeyExprTuple), + partition_id = heapTupleGetPartitionId(result_relation_desc, (void *) (&partKeyExprTuple), &partitionno, false, estate->es_plannedstmt->hasIgnore, false); } else { @@ -1440,7 +1440,7 @@ TupleTableSlot* ExecInsertT(ModifyTableState* state, TupleTableSlot* slot, Tuple if (partExprKeyStr) { PartKeyExprResult partKeyExprTuple = ComputePartKeyExprTuple(result_relation_desc, estate, slot, NULL, partExprKeyStr); - partitionId = heapTupleGetPartitionOid(result_relation_desc, (void *) (&partKeyExprTuple), + partitionId = heapTupleGetPartitionId(result_relation_desc, (void *) (&partKeyExprTuple), &partitionno, false, estate->es_plannedstmt->hasIgnore, false); } else { @@ -1468,7 +1468,7 @@ TupleTableSlot* ExecInsertT(ModifyTableState* state, TupleTableSlot* slot, Tuple bool subpartExprKeyIsNull = PartExprKeyIsNull(partRel, NULL, &subpartExprKeyStr); if (!subpartExprKeyIsNull) { PartKeyExprResult partKeyExprTuple = ComputePartKeyExprTuple(result_relation_desc, estate, slot, partRel, subpartExprKeyStr); - subPartitionId = heapTupleGetPartitionOid(partRel, (void *)(&partKeyExprTuple), &subpartitionno, false, + subPartitionId = heapTupleGetPartitionId(partRel, (void *)(&partKeyExprTuple), &subpartitionno, false, estate->es_plannedstmt->hasIgnore, false); } else { subPartitionId = heapTupleGetPartitionId(partRel, tuple, &subpartitionno, false, diff --git a/src/include/utils/partitionmap_gs.h b/src/include/utils/partitionmap_gs.h index a76fb4156..bc5c19c3b 100755 --- a/src/include/utils/partitionmap_gs.h +++ b/src/include/utils/partitionmap_gs.h @@ -164,9 +164,8 @@ typedef struct HashPartitionMap { values[i] = \ transformDatum2Const((rel)->rd_att, partkey_column->values[i], column_raw, isnull, &consts[i]); \ } else { \ - column_raw = Datum(tuple); \ values[i] = \ - transformDatum2ConstForPartKeyExpr((rel)->partMap, column_raw, isnull, &consts[i]); \ + transformDatum2ConstForPartKeyExpr((rel)->partMap, (PartKeyExprResult*)tuple, &consts[i]); \ } \ } \ if (PartitionMapIsInterval((rel)->partMap) && values[0]->constisnull) { \