1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-22 17:42:17 +03:00

Some changes to prepare for LONG attributes.

Jan
This commit is contained in:
Jan Wieck
1999-12-16 22:20:03 +00:00
parent 5ca971a18a
commit 397e9b32a3
43 changed files with 235 additions and 115 deletions

View File

@@ -6,7 +6,7 @@
* 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 $
*
*-------------------------------------------------------------------------
*/
@@ -247,7 +247,7 @@ Async_Listen(char *relname, int pid)
tupDesc = lRel->rd_att;
newtup = heap_formtuple(tupDesc, values, nulls);
heap_insert(lRel, newtup);
pfree(newtup);
heap_freetuple(newtup);
heap_close(lRel, AccessExclusiveLock);

View File

@@ -14,7 +14,7 @@
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
@@ -328,6 +328,8 @@ rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
{
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);

View File

@@ -7,7 +7,7 @@
*
*
* 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
@@ -481,7 +481,7 @@ PerformAddAttribute(char *relationName,
CatalogIndexInsert(ridescs, Num_pg_class_indices, rel, reltup);
CatalogCloseIndices(Num_pg_class_indices, ridescs);
pfree(reltup);
heap_freetuple(reltup);
heap_close(rel, RowExclusiveLock);
}

View File

@@ -190,7 +190,7 @@ void CreateComments(Oid oid, char *comment) {
desctuple);
CatalogCloseIndices(Num_pg_description_indices, idescs);
}
pfree(desctuple);
heap_freetuple(desctuple);
}

View File

@@ -6,7 +6,7 @@
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
@@ -837,7 +837,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim, char *null
skip_tuple = true;
else if (newtuple != tuple) /* modified by Trigger(s) */
{
pfree(tuple);
heap_freetuple(tuple);
tuple = newtuple;
}
}
@@ -905,7 +905,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim, char *null
nulls[i] = ' ';
}
pfree(tuple);
heap_freetuple(tuple);
tuples_read++;
if (!reading_to_eof && ntuples == tuples_read)

View File

@@ -7,7 +7,7 @@
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
@@ -505,7 +505,7 @@ StoreCatalogInheritance(Oid relationId, List *supers)
CatalogCloseIndices(Num_pg_inherits_indices, idescs);
}
pfree(tuple);
heap_freetuple(tuple);
seqNumber += 1;
}
@@ -620,7 +620,7 @@ again:
tuple = heap_formtuple(desc, datum, nullarr);
heap_insert(relation, tuple);
pfree(tuple);
heap_freetuple(tuple);
seqNumber += 1;
}

View File

@@ -7,7 +7,7 @@
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
@@ -518,7 +518,7 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
attribute->class);
}
*classOidP++ = tuple->t_data->t_oid;
pfree(atttuple);
heap_freetuple(atttuple);
}
}

View File

@@ -183,6 +183,6 @@ DropProceduralLanguage(DropPLangStmt *stmt)
heap_delete(rel, &langTup->t_self, NULL);
pfree(langTup);
heap_freetuple(langTup);
heap_close(rel, RowExclusiveLock);
}

View File

@@ -7,7 +7,7 @@
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
@@ -125,7 +125,7 @@ RemoveOperator(char *operatorName, /* operator name */
typeName2);
}
}
pfree(tup);
heap_freetuple(tup);
heap_close(relation, RowExclusiveLock);
}

View File

@@ -7,7 +7,7 @@
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
@@ -147,7 +147,7 @@ renameatt(char *relname,
/* should not already exist */
if (HeapTupleIsValid(newatttup))
{
pfree(oldatttup);
heap_freetuple(oldatttup);
elog(ERROR, "renameatt: attribute \"%s\" exists", newattname);
}
@@ -164,7 +164,7 @@ renameatt(char *relname,
CatalogCloseIndices(Num_pg_attr_indices, irelations);
}
pfree(oldatttup);
heap_freetuple(oldatttup);
heap_close(attrelation, RowExclusiveLock);
}

View File

@@ -235,7 +235,7 @@ CreateTrigger(CreateTrigStmt *stmt)
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]));
@@ -255,7 +255,7 @@ CreateTrigger(CreateTrigStmt *stmt)
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();
@@ -334,7 +334,7 @@ DropTrigger(DropTrigStmt *stmt)
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();
@@ -690,7 +690,7 @@ ExecBRInsertTriggers(Relation rel, HeapTuple trigtuple)
if (newtuple == NULL)
break;
else if (oldtuple != newtuple && oldtuple != trigtuple)
pfree(oldtuple);
heap_freetuple(oldtuple);
}
CurrentTriggerData = NULL;
pfree(SaveTriggerData);
@@ -735,11 +735,11 @@ ExecBRDeleteTriggers(EState *estate, ItemPointer tupleid)
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;
}
@@ -793,11 +793,11 @@ ExecBRUpdateTriggers(EState *estate, ItemPointer tupleid, HeapTuple newtuple)
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;
}
@@ -886,6 +886,7 @@ ltrmark:;
Assert(ItemIdIsUsed(lp));
tuple.t_datamcxt = NULL;
tuple.t_data = (HeapTupleHeader) PageGetItem((Page) dp, lp);
tuple.t_len = ItemIdGetLength(lp);
tuple.t_self = *tid;
@@ -1150,7 +1151,7 @@ deferredTriggerExecute(DeferredTriggerEvent event, int itemno)
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.

View File

@@ -7,7 +7,7 @@
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
@@ -710,6 +710,7 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
continue;
}
tuple.t_datamcxt = NULL;
tuple.t_data = (HeapTupleHeader) PageGetItem(page, itemid);
tuple.t_len = ItemIdGetLength(itemid);
ItemPointerSet(&(tuple.t_self), blkno, offnum);
@@ -1153,6 +1154,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
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);
@@ -1264,6 +1266,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
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);
@@ -1360,6 +1363,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
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)));
@@ -1409,6 +1413,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
continue;
}
#endif
tp.t_datamcxt = Ptp.t_datamcxt;
tp.t_data = Ptp.t_data;
tlen = tp.t_len = ItemIdGetLength(Pitemid);
if (freeCbuf)
@@ -1437,6 +1442,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
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 */
@@ -1468,6 +1474,7 @@ moving chain: failed to add item with len = %u to page %u",
}
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);
@@ -1599,6 +1606,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
}
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;
@@ -1652,6 +1660,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
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;
@@ -1756,6 +1765,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
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))
{
@@ -1827,6 +1837,7 @@ Elapsed %u/%u sec.",
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))
@@ -2332,7 +2343,7 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex,
/* 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);
@@ -2521,7 +2532,7 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex,
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);
}
}
}