diff --git a/src/gausskernel/runtime/executor/execQual.cpp b/src/gausskernel/runtime/executor/execQual.cpp index 1ffb16fd5..413c1d44e 100644 --- a/src/gausskernel/runtime/executor/execQual.cpp +++ b/src/gausskernel/runtime/executor/execQual.cpp @@ -5446,21 +5446,40 @@ static Datum ExecEvalFieldStore(FieldStoreState* fstate, ExprContext* econtext, * heap_deform_tuple needs a HeapTuple not a bare HeapTupleHeader. We * set all the fields in the struct just in case. */ - HeapTupleHeader tuphdr; - HeapTupleData tmptup; + if (GetTableAmType(tupDesc->td_tam_ops) == TAM_USTORE) { + UHeapDiskTuple tuphdr; + UHeapTupleData tmptup; - tuphdr = DatumGetHeapTupleHeader(tupDatum); - tmptup.t_len = HeapTupleHeaderGetDatumLength(tuphdr); - ItemPointerSetInvalid(&(tmptup.t_self)); - tmptup.t_tableOid = InvalidOid; - tmptup.t_bucketId = InvalidBktId; + /* UHeapDiskTuple and HeapTupleHeader have the same layout */ + tuphdr = (UHeapDiskTuple) DatumGetHeapTupleHeader(tupDatum); + tmptup.disk_tuple_size = HeapTupleHeaderGetDatumLength(tuphdr); + ItemPointerSetInvalid(&(tmptup.ctid)); + tmptup.table_oid = InvalidOid; + tmptup.t_bucketId = InvalidBktId; #ifdef PGXC - tmptup.t_xc_node_id = 0; + tmptup.xc_node_id = 0; #endif - HeapTupleSetZeroBase(&tmptup); - tmptup.t_data = tuphdr; + HeapTupleSetZeroBase(&tmptup); + tmptup.disk_tuple = tuphdr; - tableam_tops_deform_tuple(&tmptup, tupDesc, values, isnull); + tableam_tops_deform_tuple(&tmptup, tupDesc, values, isnull); + } else { + HeapTupleHeader tuphdr; + HeapTupleData tmptup; + + tuphdr = DatumGetHeapTupleHeader(tupDatum); + tmptup.t_len = HeapTupleHeaderGetDatumLength(tuphdr); + ItemPointerSetInvalid(&(tmptup.t_self)); + tmptup.t_tableOid = InvalidOid; + tmptup.t_bucketId = InvalidBktId; +#ifdef PGXC + tmptup.t_xc_node_id = 0; +#endif + HeapTupleSetZeroBase(&tmptup); + tmptup.t_data = tuphdr; + + tableam_tops_deform_tuple(&tmptup, tupDesc, values, isnull); + } } else { /* Convert null input tuple into an all-nulls row */ rc = memset_s(isnull, tupDesc->natts * sizeof(bool), true, tupDesc->natts * sizeof(bool)); diff --git a/src/test/regress/pg_regress.cpp b/src/test/regress/pg_regress.cpp index df07ac5fd..61312b8f6 100644 --- a/src/test/regress/pg_regress.cpp +++ b/src/test/regress/pg_regress.cpp @@ -5517,7 +5517,7 @@ static void check_global_variables() } } -#define BASE_PGXC_LIKE_MACRO_NUM 1395 +#define BASE_PGXC_LIKE_MACRO_NUM 1396 static void check_pgxc_like_macros() { #ifdef BUILD_BY_CMAKE