diff options
author | Vadim B. Mikheev <vadim4o@yahoo.com> | 1998-11-27 19:52:36 +0000 |
---|---|---|
committer | Vadim B. Mikheev <vadim4o@yahoo.com> | 1998-11-27 19:52:36 +0000 |
commit | 6beba218d7f6f764e946751df6dc0d0180da05fa (patch) | |
tree | 2801029d61d798d6150bb43a24561a4615aedb8b /src/backend/executor | |
parent | 2435c7d501b0a3129f6fc597a9c85863541cd596 (diff) |
New HeapTuple structure/interface.
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/execMain.c | 38 | ||||
-rw-r--r-- | src/backend/executor/execQual.c | 11 | ||||
-rw-r--r-- | src/backend/executor/execUtils.c | 4 | ||||
-rw-r--r-- | src/backend/executor/functions.c | 8 | ||||
-rw-r--r-- | src/backend/executor/nodeAgg.c | 8 | ||||
-rw-r--r-- | src/backend/executor/nodeGroup.c | 23 | ||||
-rw-r--r-- | src/backend/executor/nodeHash.c | 29 | ||||
-rw-r--r-- | src/backend/executor/nodeHashjoin.c | 14 | ||||
-rw-r--r-- | src/backend/executor/nodeIndexscan.c | 11 | ||||
-rw-r--r-- | src/backend/executor/nodeMaterial.c | 23 | ||||
-rw-r--r-- | src/backend/executor/nodeTee.c | 13 | ||||
-rw-r--r-- | src/backend/executor/nodeUnique.c | 6 | ||||
-rw-r--r-- | src/backend/executor/spi.c | 15 |
13 files changed, 103 insertions, 100 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index a7a7cb93cc8..45be159ae17 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -26,7 +26,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.58 1998/10/14 05:10:00 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.59 1998/11/27 19:51:59 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -963,16 +963,7 @@ ExecAppend(TupleTableSlot *slot, if (resultRelationDesc->rd_att->constr) { - HeapTuple newtuple; - - newtuple = ExecConstraints("ExecAppend", resultRelationDesc, tuple); - - if (newtuple != tuple) /* modified by DEFAULT */ - { - Assert(slot->ttc_shouldFree); - pfree(tuple); - slot->val = tuple = newtuple; - } + ExecConstraints("ExecAppend", resultRelationDesc, tuple); } /****************** @@ -993,7 +984,7 @@ ExecAppend(TupleTableSlot *slot, */ numIndices = resultRelationInfo->ri_NumIndices; if (numIndices > 0) - ExecInsertIndexTuples(slot, &(tuple->t_ctid), estate, false); + ExecInsertIndexTuples(slot, &(tuple->t_self), estate, false); (estate->es_processed)++; estate->es_lastoid = newId; @@ -1146,16 +1137,7 @@ ExecReplace(TupleTableSlot *slot, if (resultRelationDesc->rd_att->constr) { - HeapTuple newtuple; - - newtuple = ExecConstraints("ExecReplace", resultRelationDesc, tuple); - - if (newtuple != tuple) /* modified by DEFAULT */ - { - Assert(slot->ttc_shouldFree); - pfree(tuple); - slot->val = tuple = newtuple; - } + ExecConstraints("ExecReplace", resultRelationDesc, tuple); } /****************** @@ -1200,7 +1182,7 @@ ExecReplace(TupleTableSlot *slot, numIndices = resultRelationInfo->ri_NumIndices; if (numIndices > 0) - ExecInsertIndexTuples(slot, &(tuple->t_ctid), estate, true); + ExecInsertIndexTuples(slot, &(tuple->t_self), estate, true); /* AFTER ROW UPDATE Triggers */ if (resultRelationDesc->trigdesc && @@ -1334,18 +1316,12 @@ ExecRelCheck(Relation rel, HeapTuple tuple) } -HeapTuple +void ExecConstraints(char *caller, Relation rel, HeapTuple tuple) { - HeapTuple newtuple = tuple; Assert(rel->rd_att->constr); -#if 0 - if (rel->rd_att->constr->num_defval > 0) - newtuple = tuple = ExecAttrDefault(rel, tuple); -#endif - if (rel->rd_att->constr->has_not_null) { int attrChk; @@ -1366,5 +1342,5 @@ ExecConstraints(char *caller, Relation rel, HeapTuple tuple) elog(ERROR, "%s: rejected due to CHECK constraint %s", caller, failed); } - return newtuple; + return; } diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c index 680bf9939ed..6f9148b56d4 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.37 1998/09/25 13:38:31 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.38 1998/11/27 19:52:00 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -274,7 +274,7 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull) * the entire tuple, we give back a whole slot so that callers know * what the tuple looks like. */ - if (attnum == InvalidAttrNumber) + if (attnum == InvalidAttrNumber) { TupleTableSlot *tempSlot; TupleDesc td; @@ -287,7 +287,7 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull) tempSlot->ttc_buffer = InvalidBuffer; tempSlot->ttc_whichplan = -1; - tup = heap_copytuple(slot->val); + tup = heap_copytuple(heapTuple); td = CreateTupleDescCopy(slot->ttc_tupleDescriptor); ExecSetSlotDescriptor(tempSlot, td); @@ -549,7 +549,6 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull) { AttrNumber attrno; TupleDesc tupdesc; - HeapTuple tuple; Datum retval; int natts; int i; @@ -567,9 +566,7 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull) } tupdesc = slot->ttc_tupleDescriptor; - tuple = slot->val; - - natts = tuple->t_natts; + natts = slot->val->t_data->t_natts; attrno = InvalidAttrNumber; for (i = 0; i < tupdesc->natts; i++) diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index 3f9e82902de..1af4fcbc88a 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.39 1998/09/23 04:22:06 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.40 1998/11/27 19:52:01 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -1138,7 +1138,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot, result = index_insert(relationDescs[i], /* index relation */ datum, /* array of heaptuple Datums */ nulls, /* info on nulls */ - &(heapTuple->t_ctid), /* oid of heap tuple */ + &(heapTuple->t_self), /* tid of heap tuple */ heapRelation); /* ---------------- diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index fd095e7864a..34fe23e0baf 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.20 1998/09/01 04:28:23 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.21 1998/11/27 19:52:01 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -270,7 +270,7 @@ copy_function_result(FunctionCachePtr fcache, int i = 0; TupleDesc funcTd = funcSlot->ttc_tupleDescriptor; - while (i < oldTuple->t_natts) + while (i < oldTuple->t_data->t_natts) { funcTd->attrs[i] = (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE); @@ -341,13 +341,11 @@ postquel_execute(execution_state *es, resSlot = copy_function_result(fcache, slot); if (fTlist != NIL) { - HeapTuple tup; TargetEntry *tle = lfirst(fTlist); - tup = resSlot->val; value = ProjectAttribute(resSlot->ttc_tupleDescriptor, tle, - tup, + resSlot->val, isNull); } else diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index c7e69d1a72f..0eed756319a 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -248,16 +248,12 @@ ExecAgg(Agg *node) */ for (;;) { - HeapTuple outerTuple = NULL; TupleTableSlot *outerslot; isNull = isNull1 = isNull2 = 0; outerslot = ExecProcNode(outerPlan, (Plan *) node); - if (outerslot) - outerTuple = outerslot->val; - if (!HeapTupleIsValid(outerTuple)) + if (TupIsNull(outerslot)) { - /* * when the outerplan doesn't return a single tuple, * create a dummy heaptuple anyway because we still need @@ -666,7 +662,7 @@ aggGetAttr(TupleTableSlot *slot, tempSlot->ttc_buffer = InvalidBuffer; tempSlot->ttc_whichplan = -1; - tup = heap_copytuple(slot->val); + tup = heap_copytuple(heapTuple); td = CreateTupleDescCopy(slot->ttc_tupleDescriptor); ExecSetSlotDescriptor(tempSlot, td); diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c index 1fdf6bedc32..54cf97ca3e1 100644 --- a/src/backend/executor/nodeGroup.c +++ b/src/backend/executor/nodeGroup.c @@ -13,7 +13,7 @@ * columns. (ie. tuples from the same group are consecutive) * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.22 1998/09/01 04:28:28 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.23 1998/11/27 19:52:01 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -102,13 +102,12 @@ ExecGroupEveryTuple(Group *node) else { outerslot = ExecProcNode(outerPlan(node), (Plan *) node); - if (outerslot) - outerTuple = outerslot->val; - if (!HeapTupleIsValid(outerTuple)) + if (TupIsNull(outerslot)) { grpstate->grp_done = TRUE; return NULL; } + outerTuple = outerslot->val; firsttuple = grpstate->grp_firstTuple; /* this should occur on the first call only */ @@ -121,7 +120,7 @@ ExecGroupEveryTuple(Group *node) * Compare with first tuple and see if this tuple is of the * same group. */ - if (!sameGroup(firsttuple, outerslot->val, + if (!sameGroup(firsttuple, outerTuple, node->numCols, node->grpColIdx, ExecGetScanType(&grpstate->csstate))) { @@ -189,14 +188,13 @@ ExecGroupOneTuple(Group *node) if (firsttuple == NULL) { outerslot = ExecProcNode(outerPlan(node), (Plan *) node); - if (outerslot) - outerTuple = outerslot->val; - if (!HeapTupleIsValid(outerTuple)) + if (TupIsNull(outerslot)) { grpstate->grp_done = TRUE; return NULL; } - grpstate->grp_firstTuple = firsttuple = heap_copytuple(outerTuple); + grpstate->grp_firstTuple = firsttuple = + heap_copytuple(outerslot->val); } /* @@ -205,19 +203,20 @@ ExecGroupOneTuple(Group *node) for (;;) { outerslot = ExecProcNode(outerPlan(node), (Plan *) node); - outerTuple = (outerslot) ? outerslot->val : NULL; - if (!HeapTupleIsValid(outerTuple)) + if (TupIsNull(outerslot)) { grpstate->grp_done = TRUE; + outerTuple = NULL; break; } + outerTuple = outerslot->val; /* ---------------- * Compare with first tuple and see if this tuple is of * the same group. * ---------------- */ - if ((!sameGroup(firsttuple, outerslot->val, + if ((!sameGroup(firsttuple, outerTuple, node->numCols, node->grpColIdx, ExecGetScanType(&grpstate->csstate)))) break; diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index 634411a7c64..63a9a83bcac 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.23 1998/09/01 04:28:29 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.24 1998/11/27 19:52:02 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -489,16 +489,19 @@ ExecHashTableInsert(HashJoinTable hashtable, */ bucket = (HashBucket) (ABSADDR(hashtable->top) + bucketno * hashtable->bucketsize); - if ((char *) LONGALIGN(ABSADDR(bucket->bottom)) - - (char *) bucket + heapTuple->t_len > hashtable->bucketsize) + if ((char *) LONGALIGN(ABSADDR(bucket->bottom)) - (char *) bucket + + heapTuple->t_len + HEAPTUPLESIZE > hashtable->bucketsize) ExecHashOverflowInsert(hashtable, bucket, heapTuple); else { memmove((char *) LONGALIGN(ABSADDR(bucket->bottom)), heapTuple, + HEAPTUPLESIZE); + memmove((char *) LONGALIGN(ABSADDR(bucket->bottom)) + HEAPTUPLESIZE, + heapTuple->t_data, heapTuple->t_len); - bucket->bottom = - ((RelativeAddr) LONGALIGN(bucket->bottom) + heapTuple->t_len); + bucket->bottom = ((RelativeAddr) LONGALIGN(bucket->bottom) + + heapTuple->t_len + HEAPTUPLESIZE); } } else @@ -611,7 +614,7 @@ ExecHashOverflowInsert(HashJoinTable hashtable, * ---------------- */ newend = (RelativeAddr) LONGALIGN(hashtable->overflownext + sizeof(*otuple) - + heapTuple->t_len); + + heapTuple->t_len + HEAPTUPLESIZE); if (newend > hashtable->bottom) { #if 0 @@ -664,6 +667,9 @@ ExecHashOverflowInsert(HashJoinTable hashtable, otuple->tuple = RELADDR(LONGALIGN(((char *) otuple + sizeof(*otuple)))); memmove(ABSADDR(otuple->tuple), heapTuple, + HEAPTUPLESIZE); + memmove(ABSADDR(otuple->tuple) + HEAPTUPLESIZE, + heapTuple->t_data, heapTuple->t_len); } @@ -704,7 +710,10 @@ ExecScanHashBucket(HashJoinState *hjstate, LONGALIGN(ABSADDR(bucket->top)); else heapTuple = (HeapTuple) - LONGALIGN(((char *) curtuple + curtuple->t_len)); + LONGALIGN(((char *) curtuple + curtuple->t_len + HEAPTUPLESIZE)); + + heapTuple->t_data = (HeapTupleHeader) + ((char *) heapTuple + HEAPTUPLESIZE); while (heapTuple < (HeapTuple) ABSADDR(bucket->bottom)) { @@ -721,7 +730,9 @@ ExecScanHashBucket(HashJoinState *hjstate, return heapTuple; heapTuple = (HeapTuple) - LONGALIGN(((char *) heapTuple + heapTuple->t_len)); + LONGALIGN(((char *) heapTuple + heapTuple->t_len + HEAPTUPLESIZE)); + heapTuple->t_data = (HeapTupleHeader) + ((char *) heapTuple + HEAPTUPLESIZE); } if (firstotuple == NULL) @@ -742,6 +753,8 @@ ExecScanHashBucket(HashJoinState *hjstate, while (otuple != NULL) { heapTuple = (HeapTuple) ABSADDR(otuple->tuple); + heapTuple->t_data = (HeapTupleHeader) + ((char *) heapTuple + HEAPTUPLESIZE); inntuple = ExecStoreTuple(heapTuple, /* tuple to store */ hjstate->hj_HashTupleSlot, /* slot */ diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c index deef8895224..4673d92ce31 100644 --- a/src/backend/executor/nodeHashjoin.c +++ b/src/backend/executor/nodeHashjoin.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.13 1998/09/01 04:28:31 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.14 1998/11/27 19:52:02 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -646,7 +646,10 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate, (*position) = bufstart; } heapTuple = (HeapTuple) (*position); - (*position) = (char *) LONGALIGN(*position + heapTuple->t_len); + heapTuple->t_data = (HeapTupleHeader) + ((char *) heapTuple + HEAPTUPLESIZE); + (*position) = (char *) LONGALIGN(*position + + heapTuple->t_len + HEAPTUPLESIZE); return ExecStoreTuple(heapTuple, tupleSlot, InvalidBuffer, false); } @@ -824,7 +827,7 @@ ExecHashJoinSaveTuple(HeapTuple heapTuple, if (position == NULL) position = pagestart; - if (position + heapTuple->t_len >= pagebound) + if (position + heapTuple->t_len + HEAPTUPLESIZE >= pagebound) { cc = FileSeek(file, 0L, SEEK_END); if (cc < 0) @@ -836,8 +839,9 @@ ExecHashJoinSaveTuple(HeapTuple heapTuple, position = pagestart; *pageend = 0; } - memmove(position, heapTuple, heapTuple->t_len); - position = (char *) LONGALIGN(position + heapTuple->t_len); + memmove(position, heapTuple, HEAPTUPLESIZE); + memmove(position + HEAPTUPLESIZE, heapTuple->t_data, heapTuple->t_len); + position = (char *) LONGALIGN(position + heapTuple->t_len + HEAPTUPLESIZE); *pageend = position - buffer; return position; diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c index 7a087f44140..b4a610b7f88 100644 --- a/src/backend/executor/nodeIndexscan.c +++ b/src/backend/executor/nodeIndexscan.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.28 1998/11/22 10:48:36 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.29 1998/11/27 19:52:03 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -91,7 +91,7 @@ IndexNext(IndexScan *node) IndexScanDesc scandesc; Relation heapRelation; RetrieveIndexResult result; - HeapTuple tuple; + HeapTuple tuple; TupleTableSlot *slot; Buffer buffer = InvalidBuffer; int numIndices; @@ -109,6 +109,7 @@ IndexNext(IndexScan *node) heapRelation = scanstate->css_currentRelation; numIndices = indexstate->iss_NumIndices; slot = scanstate->css_ScanTupleSlot; + tuple = &(indexstate->iss_htup); /* ---------------- * ok, now that we have what we need, fetch an index tuple. @@ -121,11 +122,11 @@ IndexNext(IndexScan *node) scandesc = scanDescs[indexstate->iss_IndexPtr]; while ((result = index_getnext(scandesc, direction)) != NULL) { - tuple = heap_fetch(heapRelation, snapshot, - &result->heap_iptr, &buffer); + tuple->t_self = result->heap_iptr; + heap_fetch(heapRelation, snapshot, tuple, &buffer); pfree(result); - if (tuple != NULL) + if (tuple->t_data != NULL) { bool prev_matches = false; int prev_index; diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c index 95c8a6f56f3..485b962a895 100644 --- a/src/backend/executor/nodeMaterial.c +++ b/src/backend/executor/nodeMaterial.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.17 1998/09/01 04:28:34 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.18 1998/11/27 19:52:03 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -114,13 +114,22 @@ ExecMaterial(Material *node) { slot = ExecProcNode(outerNode, (Plan *) node); - heapTuple = slot->val; - if (heapTuple == NULL) + if (TupIsNull(slot)) break; - - heap_insert(tempRelation, /* relation desc */ - heapTuple); /* heap tuple to insert */ - + + /* + * heap_insert changes something... + */ + if (slot->ttc_buffer != InvalidBuffer) + heapTuple = heap_copytuple(slot->val); + else + heapTuple = slot->val; + + heap_insert(tempRelation, heapTuple); + + if (slot->ttc_buffer != InvalidBuffer) + pfree(heapTuple); + ExecClearTuple(slot); } currentRelation = tempRelation; diff --git a/src/backend/executor/nodeTee.c b/src/backend/executor/nodeTee.c index 623a43b9e0c..7b0f7f1755e 100644 --- a/src/backend/executor/nodeTee.c +++ b/src/backend/executor/nodeTee.c @@ -15,7 +15,7 @@ * ExecEndTee * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.24 1998/10/08 18:29:27 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.25 1998/11/27 19:52:03 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -342,11 +342,20 @@ ExecTee(Tee *node, Plan *parent) slot = ExecProcNode(childNode, (Plan *) node); if (!TupIsNull(slot)) { - heapTuple = slot->val; + /* + * heap_insert changes something... + */ + if (slot->ttc_buffer != InvalidBuffer) + heapTuple = heap_copytuple(slot->val); + else + heapTuple = slot->val; /* insert into temporary relation */ heap_insert(bufferRel, heapTuple); + if (slot->ttc_buffer != InvalidBuffer) + pfree(heapTuple); + /* * once there is data in the temporary relation, ensure that * the left and right scandescs are initialized diff --git a/src/backend/executor/nodeUnique.c b/src/backend/executor/nodeUnique.c index 66b11a66600..c04c44fa0d1 100644 --- a/src/backend/executor/nodeUnique.c +++ b/src/backend/executor/nodeUnique.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.17 1998/02/26 04:31:34 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.18 1998/11/27 19:52:03 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -76,7 +76,7 @@ ExecIdenticalTuples(TupleTableSlot *t1, TupleTableSlot *t2) * THE t_len FIELDS CAN BE THE SAME IN THIS CASE!! * ---------------- */ - if (h1->t_hoff != h2->t_hoff) + if (h1->t_data->t_hoff != h2->t_data->t_hoff) return false; /* ---------------- @@ -86,7 +86,7 @@ ExecIdenticalTuples(TupleTableSlot *t1, TupleTableSlot *t2) */ d1 = (char *) GETSTRUCT(h1); d2 = (char *) GETSTRUCT(h2); - len = (int) h1->t_len - (int) h1->t_hoff; + len = (int) h1->t_len - (int) h1->t_data->t_hoff; /* ---------------- * byte compare the data areas and return the result. diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index f034dd064de..0d3022dce70 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -356,11 +356,12 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum, if (i == natts) /* no errors in *attnum */ { mtuple = heap_formtuple(rel->rd_att, v, n); - infomask = mtuple->t_infomask; - memmove(&(mtuple->t_ctid), &(tuple->t_ctid), - ((char *) &(tuple->t_hoff) - (char *) &(tuple->t_ctid))); - mtuple->t_infomask = infomask; - mtuple->t_natts = numberOfAttributes; + infomask = mtuple->t_data->t_infomask; + memmove(&(mtuple->t_data->t_oid), &(tuple->t_data->t_oid), + ((char *) &(tuple->t_data->t_hoff) - + (char *) &(tuple->t_data->t_oid))); + mtuple->t_data->t_infomask = infomask; + mtuple->t_data->t_natts = numberOfAttributes; } else { @@ -413,7 +414,7 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber) Oid foutoid; SPI_result = 0; - if (tuple->t_natts < fnumber || fnumber <= 0) + if (tuple->t_data->t_natts < fnumber || fnumber <= 0) { SPI_result = SPI_ERROR_NOATTRIBUTE; return NULL; @@ -441,7 +442,7 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull) *isnull = true; SPI_result = 0; - if (tuple->t_natts < fnumber || fnumber <= 0) + if (tuple->t_data->t_natts < fnumber || fnumber <= 0) { SPI_result = SPI_ERROR_NOATTRIBUTE; return (Datum) NULL; |