*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.58 1999/07/19 07:07:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.59 1999/12/16 22:19:34 wieck Exp $
*
* NOTES
* The old interface functions have been converted to macros
newTuple = (HeapTuple) palloc(HEAPTUPLESIZE + tuple->t_len);
newTuple->t_len = tuple->t_len;
newTuple->t_self = tuple->t_self;
+ newTuple->t_datamcxt = CurrentMemoryContext;
newTuple->t_data = (HeapTupleHeader) ((char *) newTuple + HEAPTUPLESIZE);
memmove((char *) newTuple->t_data,
(char *) tuple->t_data, (int) tuple->t_len);
dest->t_len = src->t_len;
dest->t_self = src->t_self;
+ dest->t_datamcxt = CurrentMemoryContext;
dest->t_data = (HeapTupleHeader) palloc(src->t_len);
memmove((char *) dest->t_data,
(char *) src->t_data, (int) src->t_len);
len += ComputeDataSize(tupleDescriptor, value, nulls);
tuple = (HeapTuple) palloc(HEAPTUPLESIZE + len);
+ tuple->t_datamcxt = CurrentMemoryContext;
td = tuple->t_data = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
MemSet((char *) td, 0, (int) len);
return newTuple;
}
+
+/* ----------------
+ * heap_freetuple
+ * ----------------
+ */
+void
+heap_freetuple(HeapTuple htup)
+{
+ extern int getpid();
+
+ if (htup->t_data != NULL)
+ if (htup->t_datamcxt != NULL && (char *)(htup->t_data) !=
+ ((char *) htup + HEAPTUPLESIZE))
+ {
+ elog(NOTICE, "TELL Jan Wieck: heap_freetuple() found separate t_data");
+ }
+
+ pfree(htup);
+}
+
+
/* ----------------------------------------------------------------
* other misc functions
* ----------------------------------------------------------------
hoff = len = MAXALIGN(len); /* be conservative */
len += structlen;
tuple = (HeapTuple) palloc(HEAPTUPLESIZE + len);
+ tuple->t_datamcxt = CurrentMemoryContext;
td = tuple->t_data = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
MemSet((char *) td, 0, (int) len);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.60 1999/11/24 00:44:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.61 1999/12/16 22:19:36 wieck Exp $
*
*
* INTERFACE ROUTINES
* relation is empty
* ----------------
*/
+ scan->rs_ntup.t_datamcxt = scan->rs_ctup.t_datamcxt =
+ scan->rs_ptup.t_datamcxt = NULL;
scan->rs_ntup.t_data = scan->rs_ctup.t_data =
scan->rs_ptup.t_data = NULL;
scan->rs_nbuf = scan->rs_cbuf = scan->rs_pbuf = InvalidBuffer;
* reverse scan
* ----------------
*/
+ scan->rs_ntup.t_datamcxt = scan->rs_ctup.t_datamcxt = NULL;
scan->rs_ntup.t_data = scan->rs_ctup.t_data = NULL;
scan->rs_nbuf = scan->rs_cbuf = InvalidBuffer;
+ scan->rs_ptup.t_datamcxt = NULL;
scan->rs_ptup.t_data = NULL;
scan->rs_pbuf = UnknownBuffer;
}
* forward scan
* ----------------
*/
+ scan->rs_ctup.t_datamcxt = scan->rs_ptup.t_datamcxt = NULL;
scan->rs_ctup.t_data = scan->rs_ptup.t_data = NULL;
scan->rs_cbuf = scan->rs_pbuf = InvalidBuffer;
+ scan->rs_ntup.t_datamcxt = NULL;
scan->rs_ntup.t_data = NULL;
scan->rs_nbuf = UnknownBuffer;
} /* invalid too */
*/
if (!(pages = relation->rd_nblocks))
{
+ tuple->t_datamcxt = NULL;
tuple->t_data = NULL;
return;
}
if (ItemPointerIsValid(tid) == false)
{
*buffer = InvalidBuffer;
+ tuple->t_datamcxt = NULL;
tuple->t_data = NULL;
return;
}
lineoff = ItemPointerGetOffsetNumber(tid);
lpp = PageGetItemId(dp, lineoff);
+ tuple->t_datamcxt = NULL;
tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lpp);
tuple->t_len = ItemIdGetLength(lpp);
LockBuffer(*buffer, BUFFER_LOCK_UNLOCK);
if (page >= pages)
{
*buffer = InvalidBuffer;
+ tuple->t_datamcxt = NULL;
tuple->t_data = NULL;
return;
}
{
if (ItemIdIsUsed(lpp))
{
+ tuple->t_datamcxt = NULL;
tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lpp);
tuple->t_len = ItemIdGetLength(lpp);
ItemPointerSet(&(tuple->t_self), page, lineoff);
if (BufferIsValid(*buffer))
ReleaseBuffer(*buffer);
*buffer = InvalidBuffer;
+ tuple->t_datamcxt = NULL;
tuple->t_data = NULL;
return;
}
{
if (BufferIsValid(scan->rs_nbuf))
ReleaseBuffer(scan->rs_nbuf);
+ scan->rs_ntup.t_datamcxt = NULL;
scan->rs_ntup.t_data = NULL;
scan->rs_nbuf = UnknownBuffer;
return NULL;
{
if (BufferIsValid(scan->rs_pbuf))
ReleaseBuffer(scan->rs_pbuf);
+ scan->rs_ptup.t_datamcxt = NULL;
scan->rs_ptup.t_data = NULL;
scan->rs_pbuf = InvalidBuffer;
if (BufferIsValid(scan->rs_nbuf))
ReleaseBuffer(scan->rs_nbuf);
+ scan->rs_ntup.t_datamcxt = NULL;
scan->rs_ntup.t_data = NULL;
scan->rs_nbuf = InvalidBuffer;
return NULL;
if (BufferIsValid(scan->rs_pbuf))
ReleaseBuffer(scan->rs_pbuf);
+ scan->rs_ptup.t_datamcxt = NULL;
scan->rs_ptup.t_data = NULL;
scan->rs_pbuf = UnknownBuffer;
{
if (BufferIsValid(scan->rs_pbuf))
ReleaseBuffer(scan->rs_pbuf);
+ scan->rs_ptup.t_datamcxt = NULL;
scan->rs_ptup.t_data = NULL;
scan->rs_pbuf = UnknownBuffer;
HEAPDEBUG_3; /* heap_getnext returns NULL at end */
{
if (BufferIsValid(scan->rs_nbuf))
ReleaseBuffer(scan->rs_nbuf);
+ scan->rs_ntup.t_datamcxt = NULL;
scan->rs_ntup.t_data = NULL;
scan->rs_nbuf = InvalidBuffer;
if (BufferIsValid(scan->rs_pbuf))
ReleaseBuffer(scan->rs_pbuf);
+ scan->rs_ptup.t_datamcxt = NULL;
scan->rs_ptup.t_data = NULL;
scan->rs_pbuf = InvalidBuffer;
HEAPDEBUG_6; /* heap_getnext returning EOS */
if (BufferIsValid(scan->rs_nbuf))
ReleaseBuffer(scan->rs_nbuf);
+ scan->rs_ntup.t_datamcxt = NULL;
scan->rs_ntup.t_data = NULL;
scan->rs_nbuf = UnknownBuffer;
}
{
ReleaseBuffer(buffer);
*userbuf = InvalidBuffer;
+ tuple->t_datamcxt = NULL;
tuple->t_data = NULL;
return;
}
+ tuple->t_datamcxt = NULL;
tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
tuple->t_len = ItemIdGetLength(lp);
* ----------------
*/
+ tp.t_datamcxt = NULL;
t_data = tp.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
tp.t_len = ItemIdGetLength(lp);
tp.t_self = *tid;
dp = (PageHeader) BufferGetPage(buffer);
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(tid));
+ tp.t_datamcxt = NULL;
tp.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
tp.t_len = ItemIdGetLength(lp);
tp.t_self = *tid;
dp = (PageHeader) BufferGetPage(buffer);
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(otid));
+ oldtup.t_datamcxt = NULL;
oldtup.t_data = (HeapTupleHeader) PageGetItem(dp, lp);
oldtup.t_len = ItemIdGetLength(lp);
oldtup.t_self = *otid;
dp = (PageHeader) BufferGetPage(*buffer);
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(tid));
+ tuple->t_datamcxt = NULL;
tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
tuple->t_len = ItemIdGetLength(lp);
scan->rs_nbuf = InvalidBuffer;
if (!ItemPointerIsValid(&scan->rs_mptid))
+ {
+ scan->rs_ptup.t_datamcxt = NULL;
scan->rs_ptup.t_data = NULL;
+ }
else
{
scan->rs_ptup.t_self = scan->rs_mptid;
+ scan->rs_ptup.t_datamcxt = NULL;
scan->rs_ptup.t_data = (HeapTupleHeader) 0x1; /* for heapgettup */
heapgettup(scan->rs_rd,
&(scan->rs_ptup),
}
if (!ItemPointerIsValid(&scan->rs_mctid))
+ {
+ scan->rs_ctup.t_datamcxt = NULL;
scan->rs_ctup.t_data = NULL;
+ }
else
{
scan->rs_ctup.t_self = scan->rs_mctid;
+ scan->rs_ctup.t_datamcxt = NULL;
scan->rs_ctup.t_data = (HeapTupleHeader) 0x1; /* for heapgettup */
heapgettup(scan->rs_rd,
&(scan->rs_ctup),
}
if (!ItemPointerIsValid(&scan->rs_mntid))
+ {
+ scan->rs_ntup.t_datamcxt = NULL;
scan->rs_ntup.t_data = NULL;
+ }
else
{
+ scan->rs_ntup.t_datamcxt = NULL;
scan->rs_ntup.t_self = scan->rs_mntid;
scan->rs_ntup.t_data = (HeapTupleHeader) 0x1; /* for heapgettup */
heapgettup(scan->rs_rd,
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.72 1999/11/24 00:58:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.73 1999/12/16 22:19:37 wieck Exp $
*
*-------------------------------------------------------------------------
*/
if (objectid != (Oid) 0)
tuple->t_data->t_oid = objectid;
heap_insert(reldesc, tuple);
- pfree(tuple);
+ heap_freetuple(tuple);
if (DebugMode)
{
printf("End InsertOneTuple, objectid=%u\n", objectid);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.112 1999/12/10 03:55:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.113 1999/12/16 22:19:38 wieck Exp $
*
*
* INTERFACE ROUTINES
if (hasindex)
CatalogIndexInsert(idescs, Num_pg_attr_indices, rel, tup);
- pfree(tup);
+ heap_freetuple(tup);
dpp++;
}
if (hasindex)
CatalogIndexInsert(idescs, Num_pg_attr_indices, rel, tup);
- pfree(tup);
+ heap_freetuple(tup);
dpp++;
}
CatalogCloseIndices(Num_pg_class_indices, idescs);
}
- pfree(tup);
+ heap_freetuple(tup);
}
* ----------------
*/
heap_delete(pg_class_desc, &tup->t_self, NULL);
- pfree(tup);
+ heap_freetuple(tup);
heap_close(pg_class_desc, RowExclusiveLock);
}
DeleteComments(tup->t_data->t_oid);
heap_delete(pg_attribute_desc, &tup->t_self, NULL);
- pfree(tup);
+ heap_freetuple(tup);
}
}
pfree(DatumGetPointer(values[Anum_pg_attrdef_adbin - 1]));
pfree(DatumGetPointer(values[Anum_pg_attrdef_adsrc - 1]));
- pfree(tuple);
+ heap_freetuple(tuple);
pfree(adsrc);
if (! updatePgAttribute)
CatalogCloseIndices(Num_pg_attr_indices, attridescs);
}
heap_close(attrrel, RowExclusiveLock);
- pfree(atttup);
+ heap_freetuple(atttup);
}
/*
pfree(DatumGetPointer(values[Anum_pg_relcheck_rcname - 1]));
pfree(DatumGetPointer(values[Anum_pg_relcheck_rcbin - 1]));
pfree(DatumGetPointer(values[Anum_pg_relcheck_rcsrc - 1]));
- pfree(tuple);
+ heap_freetuple(tuple);
pfree(ccsrc);
}
CatalogCloseIndices(Num_pg_class_indices, relidescs);
heap_close(relrel, RowExclusiveLock);
- pfree(reltup);
+ heap_freetuple(reltup);
/*
* Force rebuild of our own relcache entry, otherwise subsequent commands
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.99 1999/12/10 03:55:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.100 1999/12/16 22:19:39 wieck Exp $
*
*
* INTERFACE ROUTINES
}
tupleOid = tuple->t_data->t_oid;
- pfree(tuple);
+ heap_freetuple(tuple);
heap_close(pg_class, RowExclusiveLock);
return tupleOid;
value,
nullv,
replace);
- pfree(init_tuple);
+ heap_freetuple(init_tuple);
heap_insert(pg_attribute, cur_tuple);
if (hasind)
value,
nullv,
replace);
- pfree(cur_tuple);
+ heap_freetuple(cur_tuple);
heap_insert(pg_attribute, new_tuple);
if (hasind)
}
if (cur_tuple)
- pfree(cur_tuple);
+ heap_freetuple(cur_tuple);
heap_close(pg_attribute, RowExclusiveLock);
if (hasind)
CatalogCloseIndices(Num_pg_attr_indices, idescs);
heap_close(pg_index, RowExclusiveLock);
pfree(predText);
pfree(indexForm);
- pfree(tuple);
+ heap_freetuple(tuple);
}
/* ----------------------------------------------------------------
heap_update(pg_index, &newtup->t_self, newtup, NULL);
- pfree(newtup);
+ heap_freetuple(newtup);
heap_close(pg_index, RowExclusiveLock);
pfree(predText);
}
Assert(HeapTupleIsValid(tuple));
heap_delete(relationRelation, &tuple->t_self, NULL);
- pfree(tuple);
+ heap_freetuple(tuple);
heap_close(relationRelation, RowExclusiveLock);
/* ----------------
0, 0)))
{
heap_delete(attributeRelation, &tuple->t_self, NULL);
- pfree(tuple);
+ heap_freetuple(tuple);
attnum++;
}
heap_close(attributeRelation, RowExclusiveLock);
Assert(HeapTupleIsValid(tuple));
heap_delete(indexRelation, &tuple->t_self, NULL);
- pfree(tuple);
+ heap_freetuple(tuple);
heap_close(indexRelation, RowExclusiveLock);
/*
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, idescs);
CatalogIndexInsert(idescs, Num_pg_class_indices, pg_class, newtup);
CatalogCloseIndices(Num_pg_class_indices, idescs);
- pfree(newtup);
+ heap_freetuple(newtup);
}
if (!IsBootstrapProcessingMode())
- pfree(tuple);
+ heap_freetuple(tuple);
else
heap_endscan(pg_class_scan);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.53 1999/11/25 00:15:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.54 1999/12/16 22:19:39 wieck Exp $
*
*-------------------------------------------------------------------------
*/
if (indexRes)
pfree(indexRes);
- pfree(index_tup);
+ heap_freetuple(index_tup);
}
}
Buffer buffer;
sd = index_beginscan(idesc, false, num_keys, skey);
+ tuple.t_datamcxt = CurrentMemoryContext;
tuple.t_data = NULL;
while ((indexRes = index_getnext(sd, ForwardScanDirection)))
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.44 1999/11/24 00:44:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.45 1999/12/16 22:19:39 wieck Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
* free the tuple and return the operator oid
* ----------------
*/
- pfree(tup);
+ heap_freetuple(tup);
return operatorObjectId;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.43 1999/11/24 00:44:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.44 1999/12/16 22:19:39 wieck Exp $
*
*-------------------------------------------------------------------------
*/
* free the tuple and return the type-oid
* ----------------
*/
- pfree(tup);
+ heap_freetuple(tup);
return typoid;
}
0, 0, 0);
if (HeapTupleIsValid(newtup))
{
- pfree(oldtup);
+ heap_freetuple(oldtup);
heap_close(pg_type_desc, RowExclusiveLock);
elog(ERROR, "TypeRename: type %s already defined", newTypeName);
}
CatalogIndexInsert(idescs, Num_pg_type_indices, pg_type_desc, oldtup);
CatalogCloseIndices(Num_pg_type_indices, idescs);
- pfree(oldtup);
+ heap_freetuple(oldtup);
heap_close(pg_type_desc, RowExclusiveLock);
}
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.56 1999/11/24 00:44:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.57 1999/12/16 22:19:41 wieck Exp $
*
*-------------------------------------------------------------------------
*/
tupDesc = lRel->rd_att;
newtup = heap_formtuple(tupDesc, values, nulls);
heap_insert(lRel, newtup);
- pfree(newtup);
+ heap_freetuple(newtup);
heap_close(lRel, AccessExclusiveLock);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.48 1999/12/10 03:55:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.49 1999/12/16 22:19:41 wieck Exp $
*
*-------------------------------------------------------------------------
*/
{
LocalHeapTuple.t_self = ScanResult->heap_iptr;
+ LocalHeapTuple.t_datamcxt = NULL;
+ LocalHeapTuple.t_data = NULL;
heap_fetch(LocalOldHeap, SnapshotNow, &LocalHeapTuple, &LocalBuffer);
OIDNewHeapInsert = heap_insert(LocalNewHeap, &LocalHeapTuple);
pfree(ScanResult);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.60 1999/12/14 03:35:20 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.61 1999/12/16 22:19:41 wieck Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
CatalogIndexInsert(ridescs, Num_pg_class_indices, rel, reltup);
CatalogCloseIndices(Num_pg_class_indices, ridescs);
- pfree(reltup);
+ heap_freetuple(reltup);
heap_close(rel, RowExclusiveLock);
}
desctuple);
CatalogCloseIndices(Num_pg_description_indices, idescs);
}
- pfree(desctuple);
+ heap_freetuple(desctuple);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.93 1999/12/14 00:08:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.94 1999/12/16 22:19:41 wieck Exp $
*
*-------------------------------------------------------------------------
*/
skip_tuple = true;
else if (newtuple != tuple) /* modified by Trigger(s) */
{
- pfree(tuple);
+ heap_freetuple(tuple);
tuple = newtuple;
}
}
nulls[i] = ' ';
}
- pfree(tuple);
+ heap_freetuple(tuple);
tuples_read++;
if (!reading_to_eof && ntuples == tuples_read)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.53 1999/12/10 03:55:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.54 1999/12/16 22:19:41 wieck Exp $
*
*-------------------------------------------------------------------------
*/
CatalogCloseIndices(Num_pg_inherits_indices, idescs);
}
- pfree(tuple);
+ heap_freetuple(tuple);
seqNumber += 1;
}
tuple = heap_formtuple(desc, datum, nullarr);
heap_insert(relation, tuple);
- pfree(tuple);
+ heap_freetuple(tuple);
seqNumber += 1;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.15 1999/12/10 03:55:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.16 1999/12/16 22:19:41 wieck Exp $
*
*-------------------------------------------------------------------------
*/
attribute->class);
}
*classOidP++ = tuple->t_data->t_oid;
- pfree(atttuple);
+ heap_freetuple(atttuple);
}
}
heap_delete(rel, &langTup->t_self, NULL);
- pfree(langTup);
+ heap_freetuple(langTup);
heap_close(rel, RowExclusiveLock);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.41 1999/12/10 03:55:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.42 1999/12/16 22:19:41 wieck Exp $
*
*-------------------------------------------------------------------------
*/
typeName2);
}
}
- pfree(tup);
+ heap_freetuple(tup);
heap_close(relation, RowExclusiveLock);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.38 1999/12/14 03:35:20 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.39 1999/12/16 22:19:42 wieck Exp $
*
*-------------------------------------------------------------------------
*/
/* should not already exist */
if (HeapTupleIsValid(newatttup))
{
- pfree(oldatttup);
+ heap_freetuple(oldatttup);
elog(ERROR, "renameatt: attribute \"%s\" exists", newattname);
}
CatalogCloseIndices(Num_pg_attr_indices, irelations);
}
- pfree(oldatttup);
+ heap_freetuple(oldatttup);
heap_close(attrelation, RowExclusiveLock);
}
CatalogOpenIndices(Num_pg_trigger_indices, Name_pg_trigger_indices, idescs);
CatalogIndexInsert(idescs, Num_pg_trigger_indices, tgrel, tuple);
CatalogCloseIndices(Num_pg_trigger_indices, idescs);
- pfree(tuple);
+ heap_freetuple(tuple);
heap_close(tgrel, RowExclusiveLock);
pfree(DatumGetPointer(values[Anum_pg_trigger_tgname - 1]));
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs);
CatalogIndexInsert(ridescs, Num_pg_class_indices, pgrel, tuple);
CatalogCloseIndices(Num_pg_class_indices, ridescs);
- pfree(tuple);
+ heap_freetuple(tuple);
heap_close(pgrel, RowExclusiveLock);
CommandCounterIncrement();
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, ridescs);
CatalogIndexInsert(ridescs, Num_pg_class_indices, pgrel, tuple);
CatalogCloseIndices(Num_pg_class_indices, ridescs);
- pfree(tuple);
+ heap_freetuple(tuple);
heap_close(pgrel, RowExclusiveLock);
CommandCounterIncrement();
if (newtuple == NULL)
break;
else if (oldtuple != newtuple && oldtuple != trigtuple)
- pfree(oldtuple);
+ heap_freetuple(oldtuple);
}
CurrentTriggerData = NULL;
pfree(SaveTriggerData);
if (newtuple == NULL)
break;
if (newtuple != trigtuple)
- pfree(newtuple);
+ heap_freetuple(newtuple);
}
CurrentTriggerData = NULL;
pfree(SaveTriggerData);
- pfree(trigtuple);
+ heap_freetuple(trigtuple);
return (newtuple == NULL) ? false : true;
}
if (newtuple == NULL)
break;
else if (oldtuple != newtuple && oldtuple != intuple)
- pfree(oldtuple);
+ heap_freetuple(oldtuple);
}
CurrentTriggerData = NULL;
pfree(SaveTriggerData);
- pfree(trigtuple);
+ heap_freetuple(trigtuple);
return newtuple;
}
Assert(ItemIdIsUsed(lp));
+ tuple.t_datamcxt = NULL;
tuple.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
tuple.t_len = ItemIdGetLength(lp);
tuple.t_self = *tid;
rettuple = ExecCallTriggerFunc(SaveTriggerData.tg_trigger);
CurrentTriggerData = NULL;
if (rettuple != NULL && rettuple != &oldtuple && rettuple != &newtuple)
- pfree(rettuple);
+ heap_freetuple(rettuple);
/* ----------
* Might have been a referential integrity constraint trigger.
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.130 1999/12/10 03:55:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.131 1999/12/16 22:19:42 wieck Exp $
*
*-------------------------------------------------------------------------
*/
continue;
}
+ tuple.t_datamcxt = NULL;
tuple.t_data = (HeapTupleHeader) PageGetItem(page, itemid);
tuple.t_len = ItemIdGetLength(itemid);
ItemPointerSet(&(tuple.t_self), blkno, offnum);
if (!ItemIdIsUsed(itemid))
continue;
+ tuple.t_datamcxt = NULL;
tuple.t_data = (HeapTupleHeader) PageGetItem(page, itemid);
tuple_len = tuple.t_len = ItemIdGetLength(itemid);
ItemPointerSet(&(tuple.t_self), blkno, offnum);
elog(NOTICE, "Child itemid in update-chain marked as unused - can't continue vc_rpfheap");
break;
}
+ tp.t_datamcxt = NULL;
tp.t_data = (HeapTupleHeader) PageGetItem(Cpage, Citemid);
tp.t_self = Ctid;
tlen = tp.t_len = ItemIdGetLength(Citemid);
ItemPointerGetOffsetNumber(&(tp.t_self)));
if (!ItemIdIsUsed(Pitemid))
elog(ERROR, "Parent itemid marked as unused");
+ Ptp.t_datamcxt = NULL;
Ptp.t_data = (HeapTupleHeader) PageGetItem(Ppage, Pitemid);
Assert(ItemPointerEquals(&(vtld.new_tid),
&(Ptp.t_data->t_ctid)));
continue;
}
#endif
+ tp.t_datamcxt = Ptp.t_datamcxt;
tp.t_data = Ptp.t_data;
tlen = tp.t_len = ItemIdGetLength(Pitemid);
if (freeCbuf)
Cpage = BufferGetPage(Cbuf);
Citemid = PageGetItemId(Cpage,
ItemPointerGetOffsetNumber(&(tuple.t_self)));
+ tuple.t_datamcxt = NULL;
tuple.t_data = (HeapTupleHeader) PageGetItem(Cpage, Citemid);
tuple_len = tuple.t_len = ItemIdGetLength(Citemid);
/* Get page to move in */
}
newitemid = PageGetItemId(ToPage, newoff);
pfree(newtup.t_data);
+ newtup.t_datamcxt = NULL;
newtup.t_data = (HeapTupleHeader) PageGetItem(ToPage, newitemid);
ItemPointerSet(&(newtup.t_self), vtmove[ti].vpd->vpd_blkno, newoff);
}
newitemid = PageGetItemId(ToPage, newoff);
pfree(newtup.t_data);
+ newtup.t_datamcxt = NULL;
newtup.t_data = (HeapTupleHeader) PageGetItem(ToPage, newitemid);
ItemPointerSet(&(newtup.t_data->t_ctid), cur_page->vpd_blkno, newoff);
newtup.t_self = newtup.t_data->t_ctid;
itemid = PageGetItemId(page, off);
if (!ItemIdIsUsed(itemid))
continue;
+ tuple.t_datamcxt = NULL;
tuple.t_data = (HeapTupleHeader) PageGetItem(page, itemid);
if (tuple.t_data->t_infomask & HEAP_XMIN_COMMITTED)
continue;
itemid = PageGetItemId(page, newoff);
if (!ItemIdIsUsed(itemid))
continue;
+ tuple.t_datamcxt = NULL;
tuple.t_data = (HeapTupleHeader) PageGetItem(page, itemid);
if (!(tuple.t_data->t_infomask & HEAP_XMIN_COMMITTED))
{
itemid = PageGetItemId(page, offnum);
if (!ItemIdIsUsed(itemid))
continue;
+ tuple.t_datamcxt = NULL;
tuple.t_data = (HeapTupleHeader) PageGetItem(page, itemid);
if (!(tuple.t_data->t_infomask & HEAP_XMIN_COMMITTED))
/* get the buffer cache tuple */
rtup.t_self = ctup->t_self;
heap_fetch(rd, SnapshotNow, &rtup, &buffer);
- pfree(ctup);
+ heap_freetuple(ctup);
/* overwrite the existing statistics in the tuple */
pgcform = (Form_pg_class) GETSTRUCT(&rtup);
pfree(DatumGetPointer(values[Anum_pg_statistic_stacommonval-1]));
pfree(DatumGetPointer(values[Anum_pg_statistic_staloval-1]));
pfree(DatumGetPointer(values[Anum_pg_statistic_stahival-1]));
- pfree(stup);
+ heap_freetuple(stup);
}
}
}
* 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 $
*
*-------------------------------------------------------------------------
*/
heap_insert(bufferRel, heapTuple);
if (slot->ttc_buffer != InvalidBuffer)
- pfree(heapTuple);
+ heap_freetuple(heapTuple);
/*
* once there is data in the temporary relation, ensure that
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (newtuple != tuple) /* modified by Trigger(s) */
{
Assert(slot->ttc_shouldFree);
- pfree(tuple);
+ heap_freetuple(tuple);
slot->val = tuple = newtuple;
}
}
if (newtuple != tuple) /* modified by Trigger(s) */
{
Assert(slot->ttc_shouldFree);
- pfree(tuple);
+ heap_freetuple(tuple);
slot->val = tuple = newtuple;
}
}
newtuple = heap_modifytuple(tuple, rel, replValue, replNull, repl);
pfree(repl);
- pfree(tuple);
+ heap_freetuple(tuple);
pfree(replNull);
pfree(replValue);
/* 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;
/* 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;
}
* 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;
{
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;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#undef ExecStoreTuple
#include "catalog/pg_type.h"
+#include "access/heapam.h"
static TupleTableSlot *NodeGetResultTupleSlot(Plan *node);
* ----------------
*/
if (slot->ttc_shouldFree && oldtuple != NULL)
- pfree(oldtuple);
+ heap_freetuple(oldtuple);
slot->val = (HeapTuple) NULL;
* 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 $
*
*-------------------------------------------------------------------------
*/
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 */
/* save outerTuple if we are not done yet */
if (!grpstate->grp_done)
{
- pfree(firsttuple);
+ heap_freetuple(firsttuple);
grpstate->grp_firstTuple = heap_copytuple(outerTuple);
}
ExecClearTuple(grpstate->csstate.css_ScanTupleSlot);
if (grpstate->grp_firstTuple != NULL)
{
- pfree(grpstate->grp_firstTuple);
+ heap_freetuple(grpstate->grp_firstTuple);
grpstate->grp_firstTuple = NULL;
}
}
grpstate->grp_done = FALSE;
if (grpstate->grp_firstTuple != NULL)
{
- pfree(grpstate->grp_firstTuple);
+ heap_freetuple(grpstate->grp_firstTuple);
grpstate->grp_firstTuple = NULL;
}
* 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 $
*
*-------------------------------------------------------------------------
*/
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,
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
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 */
*/
tup = heap_copytuple(tup);
if (node->curTuple)
- pfree(node->curTuple);
+ heap_freetuple(node->curTuple);
node->curTuple = tup;
foreach(lst, node->setParam)
}
if (node->curTuple)
{
- pfree(node->curTuple);
+ heap_freetuple(node->curTuple);
node->curTuple = NULL;
}
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
bool slot_is_valid = false;
itemptr = tidList[tidstate->tss_TidPtr];
+ tuple->t_datamcxt = NULL;
tuple->t_data = NULL;
if (itemptr)
{
* 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 $
*
*-------------------------------------------------------------------------
*/
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 =================== */
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.28 1999/11/23 20:06:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.29 1999/12/16 22:19:47 wieck Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-
#include "optimizer/planmain.h"
+#include "access/heapam.h"
/* ****************************************************************
* plannodes.h free functions
freeObject(node->sublink);
if (node->curTuple)
- pfree(node->curTuple);
+ heap_freetuple(node->curTuple);
pfree(node);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.64 1999/12/10 07:37:35 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.65 1999/12/16 22:19:48 wieck Exp $
*
*-------------------------------------------------------------------------
*/
{
Buffer buffer;
+ tuple.t_datamcxt = NULL;
+ tuple.t_data = NULL;
tuple.t_self = indexRes->heap_iptr;
heap_fetch(heapRelation, SnapshotNow, &tuple, &buffer);
pfree(indexRes);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.33 1999/11/22 17:56:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.34 1999/12/16 22:19:49 wieck Exp $
*
*-------------------------------------------------------------------------
*/
if (isNull)
{
/* XXX strange!!! */
- pfree(tuple);
+ heap_freetuple(tuple);
elog(ERROR, "RemoveRewriteRule: internal error; null event target relation!");
}
eventRelationOid = DatumGetObjectId(eventRelationOidDatum);
*/
heap_delete(RewriteRelation, &tuple->t_self, NULL);
- pfree(tuple);
+ heap_freetuple(tuple);
heap_close(RewriteRelation, RowExclusiveLock);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.39 1999/11/24 00:44:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.40 1999/12/16 22:19:50 wieck Exp $
*
*-------------------------------------------------------------------------
*/
CatalogIndexInsert(idescs, Num_pg_class_indices, relationRelation, tuple);
CatalogCloseIndices(Num_pg_class_indices, idescs);
- pfree(tuple);
+ heap_freetuple(tuple);
heap_close(relationRelation, RowExclusiveLock);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.62 1999/12/10 03:55:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.63 1999/12/16 22:19:51 wieck Exp $
*
*-------------------------------------------------------------------------
*/
if (res == (RetrieveIndexResult) NULL)
{
ItemPointerSetInvalid(&(obj_desc->htid));
+ tuple->t_datamcxt = NULL;
tuple->t_data = NULL;
return;
}
ntup = inv_newtuple(obj_desc, buffer, page, buf, nwritten);
inv_indextup(obj_desc, ntup);
- pfree(ntup);
+ heap_freetuple(ntup);
/* new tuple is inserted */
WriteBuffer(buffer);
/* index the new tuple */
inv_indextup(obj_desc, ntup);
- pfree(ntup);
+ heap_freetuple(ntup);
/*
* move the scandesc forward so we don't reread the newly inserted
ph->pd_lower = lower;
ph->pd_upper = upper;
+ ntup->t_datamcxt = NULL;
ntup->t_data = (HeapTupleHeader) ((char *) page + upper);
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.45 1999/11/22 17:56:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.46 1999/12/16 22:19:52 wieck Exp $
*
*-------------------------------------------------------------------------
*/
sd = index_beginscan(idesc, false, 1, skey);
while ((indexRes = index_getnext(sd, ForwardScanDirection)))
{
+ tuple.t_datamcxt = NULL;
+ tuple.t_data = NULL;
tuple.t_self = indexRes->heap_iptr;
heap_fetch(hdesc, SnapshotNow,
&tuple,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.54 1999/11/22 17:56:31 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.55 1999/12/16 22:19:54 wieck Exp $
*
*-------------------------------------------------------------------------
*/
elog(ERROR, "SearchSelfReferences: %s not found in %s",
IndexRelidIndex, RelationRelationName);
indexSelfOid = ntp->t_data->t_oid;
- pfree(ntp);
+ heap_freetuple(ntp);
heap_close(rel, AccessShareLock);
}
/* Looking for something other than pg_index_indexrelid_index? */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.81 1999/11/22 17:56:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.82 1999/12/16 22:19:54 wieck Exp $
*
*-------------------------------------------------------------------------
*/
* and for lock data pointed to by pg_class_tuple
* -------------------
*/
- pfree(pg_class_tuple);
+ heap_freetuple(pg_class_tuple);
MemoryContextSwitchTo(oldcxt);
adrel = heap_openr(AttrDefaultRelationName, AccessShareLock);
irel = index_openr(AttrDefaultIndex);
sd = index_beginscan(irel, false, 1, &skey);
+ tuple.t_datamcxt = NULL;
tuple.t_data = NULL;
for (found = 0;;)
rcrel = heap_openr(RelCheckRelationName, AccessShareLock);
irel = index_openr(RelCheckIndex);
sd = index_beginscan(irel, false, 1, &skey);
+ tuple.t_datamcxt = NULL;
tuple.t_data = NULL;
for (found = 0;;)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.32 1999/11/07 23:08:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.33 1999/12/16 22:19:55 wieck Exp $
*
*-------------------------------------------------------------------------
*/
/* get a pointer to the tuple itself */
offset = (int) ph->pd_linp[i].lp_off;
+ tup.t_datamcxt = NULL;
tup.t_data = (HeapTupleHeader) (((char *) pg) + offset);
/*
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.3 1999/12/13 01:27:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.4 1999/12/16 22:19:56 wieck Exp $
*
*-------------------------------------------------------------------------
*/
(void*) &tuplen, sizeof(tuplen));
FREEMEM(state, HEAPTUPLESIZE + tuple->t_len);
- pfree(tuple);
+ heap_freetuple(tuple);
}
static void *
/* reconstruct the HeapTupleData portion */
tuple->t_len = len - sizeof(unsigned int);
ItemPointerSetInvalid(&(tuple->t_self));
+ tuple->t_datamcxt = CurrentMemoryContext;
tuple->t_data = (HeapTupleHeader) (((char *) tuple) + HEAPTUPLESIZE);
/* read in the tuple proper */
if (LogicalTapeRead(state->tapeset, tapenum, (void *) tuple->t_data,
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: heapam.h,v 1.48 1999/11/24 00:44:37 momjian Exp $
+ * $Id: heapam.h,v 1.49 1999/12/16 22:19:58 wieck Exp $
*
*-------------------------------------------------------------------------
*/
Datum *value, char *nulls);
extern HeapTuple heap_modifytuple(HeapTuple tuple,
Relation relation, Datum *replValue, char *replNull, char *repl);
+extern void heap_freetuple(HeapTuple tuple);
HeapTuple heap_addheader(uint32 natts, int structlen, char *structure);
/* in common/heap/stats.c */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: htup.h,v 1.25 1999/07/19 07:07:28 momjian Exp $
+ * $Id: htup.h,v 1.26 1999/12/16 22:19:58 wieck Exp $
*
*-------------------------------------------------------------------------
*/
* updated version of tuple (required by MVCC);
* 3. someday someone let tuple to cross block boundaries -
* he have to add something below...
+ *
+ * Change for 7.0:
+ * Up to now t_data could be NULL, the memory location directly following
+ * HeapTupleData or pointing into a buffer. Now, it could also point to
+ * a separate allocation that was done in the t_datamcxt memory context.
*/
typedef struct HeapTupleData
{
uint32 t_len; /* length of *t_data */
ItemPointerData t_self; /* SelfItemPointer */
+ MemoryContext t_datamcxt; /* */
HeapTupleHeader t_data; /* */
} HeapTupleData;
extern void *SPI_palloc(Size size);
extern void *SPI_repalloc(void *pointer, Size size);
extern void SPI_pfree(void *pointer);
+extern void SPI_freetuple(HeapTuple pointer);
#endif /* SPI_H */
/*
- * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.34 1999/10/22 02:08:37 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.35 1999/12/16 22:20:03 wieck Exp $
*/
#include <float.h> /* faked on sunos */
tmptuple = SPI_copytuple(trigtuple);
rettuple = SPI_modifytuple(rel, tmptuple, 1, &(attnum[1]), &newoff, NULL);
- SPI_pfree(tmptuple);
+ SPI_freetuple(tmptuple);
}
else
/* DELETE */