mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Some changes to prepare for LONG attributes.
Jan
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
* ExecInitTee
|
||||
* ExecEndTee
|
||||
*
|
||||
* $Id: nodeTee.c,v 1.6 1999/12/10 03:55:52 momjian Exp $
|
||||
* $Id: nodeTee.c,v 1.7 1999/12/16 22:19:45 wieck Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -350,7 +350,7 @@ ExecTee(Tee * node, Plan *parent)
|
||||
heap_insert(bufferRel, heapTuple);
|
||||
|
||||
if (slot->ttc_buffer != InvalidBuffer)
|
||||
pfree(heapTuple);
|
||||
heap_freetuple(heapTuple);
|
||||
|
||||
/*
|
||||
* once there is data in the temporary relation, ensure that
|
||||
|
@ -26,7 +26,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.102 1999/12/10 03:55:51 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.103 1999/12/16 22:19:44 wieck Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1147,7 +1147,7 @@ ExecAppend(TupleTableSlot *slot,
|
||||
if (newtuple != tuple) /* modified by Trigger(s) */
|
||||
{
|
||||
Assert(slot->ttc_shouldFree);
|
||||
pfree(tuple);
|
||||
heap_freetuple(tuple);
|
||||
slot->val = tuple = newtuple;
|
||||
}
|
||||
}
|
||||
@ -1334,7 +1334,7 @@ ExecReplace(TupleTableSlot *slot,
|
||||
if (newtuple != tuple) /* modified by Trigger(s) */
|
||||
{
|
||||
Assert(slot->ttc_shouldFree);
|
||||
pfree(tuple);
|
||||
heap_freetuple(tuple);
|
||||
slot->val = tuple = newtuple;
|
||||
}
|
||||
}
|
||||
@ -1472,7 +1472,7 @@ ExecAttrDefault(Relation rel, HeapTuple tuple)
|
||||
newtuple = heap_modifytuple(tuple, rel, replValue, replNull, repl);
|
||||
|
||||
pfree(repl);
|
||||
pfree(tuple);
|
||||
heap_freetuple(tuple);
|
||||
pfree(replNull);
|
||||
pfree(replValue);
|
||||
|
||||
@ -1614,7 +1614,7 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
|
||||
/* stop execution */
|
||||
ExecEndNode(epq->plan, epq->plan);
|
||||
epqstate->es_tupleTable->next = 0;
|
||||
pfree(epqstate->es_evTuple[epq->rti - 1]);
|
||||
heap_freetuple(epqstate->es_evTuple[epq->rti - 1]);
|
||||
epqstate->es_evTuple[epq->rti - 1] = NULL;
|
||||
/* push current PQ to freePQ stack */
|
||||
oldepq->free = epq;
|
||||
@ -1689,7 +1689,7 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
|
||||
/* free old RTE' tuple */
|
||||
if (epqstate->es_evTuple[epq->rti - 1] != NULL)
|
||||
{
|
||||
pfree(epqstate->es_evTuple[epq->rti - 1]);
|
||||
heap_freetuple(epqstate->es_evTuple[epq->rti - 1]);
|
||||
epqstate->es_evTuple[epq->rti - 1] = NULL;
|
||||
}
|
||||
|
||||
@ -1738,7 +1738,7 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
|
||||
* Nice! We got tuple - now copy it.
|
||||
*/
|
||||
if (epqstate->es_evTuple[epq->rti - 1] != NULL)
|
||||
pfree(epqstate->es_evTuple[epq->rti - 1]);
|
||||
heap_freetuple(epqstate->es_evTuple[epq->rti - 1]);
|
||||
epqstate->es_evTuple[epq->rti - 1] = heap_copytuple(&tuple);
|
||||
ReleaseBuffer(buffer);
|
||||
break;
|
||||
@ -1815,7 +1815,7 @@ lpqnext:;
|
||||
{
|
||||
ExecEndNode(epq->plan, epq->plan);
|
||||
epqstate->es_tupleTable->next = 0;
|
||||
pfree(epqstate->es_evTuple[epq->rti - 1]);
|
||||
heap_freetuple(epqstate->es_evTuple[epq->rti - 1]);
|
||||
epqstate->es_evTuple[epq->rti - 1] = NULL;
|
||||
/* pop old PQ from the stack */
|
||||
oldepq = (evalPlanQual *) epqstate->es_evalPlanQual;
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.33 1999/12/10 03:55:51 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.34 1999/12/16 22:19:44 wieck Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -120,6 +120,7 @@
|
||||
#undef ExecStoreTuple
|
||||
|
||||
#include "catalog/pg_type.h"
|
||||
#include "access/heapam.h"
|
||||
|
||||
static TupleTableSlot *NodeGetResultTupleSlot(Plan *node);
|
||||
|
||||
@ -420,7 +421,7 @@ ExecClearTuple(TupleTableSlot *slot) /* slot in which to store tuple */
|
||||
* ----------------
|
||||
*/
|
||||
if (slot->ttc_shouldFree && oldtuple != NULL)
|
||||
pfree(oldtuple);
|
||||
heap_freetuple(oldtuple);
|
||||
|
||||
slot->val = (HeapTuple) NULL;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* columns. (ie. tuples from the same group are consecutive)
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.30 1999/09/24 00:24:23 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.31 1999/12/16 22:19:44 wieck Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -124,7 +124,7 @@ ExecGroupEveryTuple(Group *node)
|
||||
ExecGetScanType(&grpstate->csstate)))
|
||||
{
|
||||
grpstate->grp_useFirstTuple = TRUE;
|
||||
pfree(firsttuple);
|
||||
heap_freetuple(firsttuple);
|
||||
grpstate->grp_firstTuple = heap_copytuple(outerTuple);
|
||||
|
||||
return NULL; /* signifies the end of the group */
|
||||
@ -242,7 +242,7 @@ ExecGroupOneTuple(Group *node)
|
||||
/* save outerTuple if we are not done yet */
|
||||
if (!grpstate->grp_done)
|
||||
{
|
||||
pfree(firsttuple);
|
||||
heap_freetuple(firsttuple);
|
||||
grpstate->grp_firstTuple = heap_copytuple(outerTuple);
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ ExecEndGroup(Group *node)
|
||||
ExecClearTuple(grpstate->csstate.css_ScanTupleSlot);
|
||||
if (grpstate->grp_firstTuple != NULL)
|
||||
{
|
||||
pfree(grpstate->grp_firstTuple);
|
||||
heap_freetuple(grpstate->grp_firstTuple);
|
||||
grpstate->grp_firstTuple = NULL;
|
||||
}
|
||||
}
|
||||
@ -429,7 +429,7 @@ ExecReScanGroup(Group *node, ExprContext *exprCtxt, Plan *parent)
|
||||
grpstate->grp_done = FALSE;
|
||||
if (grpstate->grp_firstTuple != NULL)
|
||||
{
|
||||
pfree(grpstate->grp_firstTuple);
|
||||
heap_freetuple(grpstate->grp_firstTuple);
|
||||
grpstate->grp_firstTuple = NULL;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* $Id: nodeHash.c,v 1.40 1999/12/10 03:55:51 momjian Exp $
|
||||
* $Id: nodeHash.c,v 1.41 1999/12/16 22:19:44 wieck Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -482,6 +482,7 @@ ExecHashTableInsert(HashJoinTable hashtable,
|
||||
memcpy((char *) &hashTuple->htup,
|
||||
(char *) heapTuple,
|
||||
sizeof(hashTuple->htup));
|
||||
hashTuple->htup.t_datamcxt = hashtable->batchCxt;
|
||||
hashTuple->htup.t_data = (HeapTupleHeader)
|
||||
(((char *) hashTuple) + MAXALIGN(sizeof(*hashTuple)));
|
||||
memcpy((char *) hashTuple->htup.t_data,
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.27 1999/10/13 15:02:25 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.28 1999/12/16 22:19:44 wieck Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -485,6 +485,7 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
|
||||
elog(ERROR, "Read from hashjoin temp file failed");
|
||||
heapTuple = palloc(HEAPTUPLESIZE + htup.t_len);
|
||||
memcpy((char *) heapTuple, (char *) &htup, sizeof(HeapTupleData));
|
||||
heapTuple->t_datamcxt = CurrentMemoryContext;
|
||||
heapTuple->t_data = (HeapTupleHeader)
|
||||
((char *) heapTuple + HEAPTUPLESIZE);
|
||||
nread = BufFileRead(file, (void *) heapTuple->t_data, htup.t_len);
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.17 1999/11/15 03:28:05 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.18 1999/12/16 22:19:44 wieck Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -117,7 +117,7 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull)
|
||||
*/
|
||||
tup = heap_copytuple(tup);
|
||||
if (node->curTuple)
|
||||
pfree(node->curTuple);
|
||||
heap_freetuple(node->curTuple);
|
||||
node->curTuple = tup;
|
||||
result = heap_getattr(tup, col, tdesc, isNull);
|
||||
/* keep scanning subplan to make sure there's only one tuple */
|
||||
@ -351,7 +351,7 @@ ExecSetParamPlan(SubPlan *node)
|
||||
*/
|
||||
tup = heap_copytuple(tup);
|
||||
if (node->curTuple)
|
||||
pfree(node->curTuple);
|
||||
heap_freetuple(node->curTuple);
|
||||
node->curTuple = tup;
|
||||
|
||||
foreach(lst, node->setParam)
|
||||
@ -408,7 +408,7 @@ ExecEndSubPlan(SubPlan *node)
|
||||
}
|
||||
if (node->curTuple)
|
||||
{
|
||||
pfree(node->curTuple);
|
||||
heap_freetuple(node->curTuple);
|
||||
node->curTuple = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.1 1999/11/23 20:06:51 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.2 1999/12/16 22:19:44 wieck Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -148,6 +148,7 @@ TidNext(TidScan *node)
|
||||
bool slot_is_valid = false;
|
||||
|
||||
itemptr = tidList[tidstate->tss_TidPtr];
|
||||
tuple->t_datamcxt = NULL;
|
||||
tuple->t_data = NULL;
|
||||
if (itemptr)
|
||||
{
|
||||
|
@ -3,7 +3,7 @@
|
||||
* spi.c
|
||||
* Server Programming Interface
|
||||
*
|
||||
* $Id: spi.c,v 1.43 1999/12/10 03:55:51 momjian Exp $
|
||||
* $Id: spi.c,v 1.44 1999/12/16 22:19:44 wieck Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -543,6 +543,26 @@ SPI_pfree(void *pointer)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
SPI_freetuple(HeapTuple tuple)
|
||||
{
|
||||
MemoryContext oldcxt = NULL;
|
||||
|
||||
if (_SPI_curid + 1 == _SPI_connected) /* connected */
|
||||
{
|
||||
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
|
||||
elog(FATAL, "SPI: stack corrupted");
|
||||
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
|
||||
}
|
||||
|
||||
heap_freetuple(tuple);
|
||||
|
||||
if (oldcxt)
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* =================== private functions =================== */
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user