Commit c7a165ad authored by Tom Lane's avatar Tom Lane

Code review for HeapTupleHeader changes. Add version number to page headers

(overlaying low byte of page size) and add HEAP_HASOID bit to t_infomask,
per earlier discussion.  Simplify scheme for overlaying fields in tuple
header (no need for cmax to live in more than one place).  Don't try to
clear infomask status bits in tqual.c --- not safe to do it there.  Don't
try to force output table of a SELECT INTO to have OIDs, either.  Get rid
of unnecessarily complex three-state scheme for TupleDesc.tdhasoids, which
has already caused one recent failure.  Improve documentation.
parent fcd34f9f
......@@ -190,7 +190,7 @@ fti(PG_FUNCTION_ARGS)
tupdesc = rel->rd_att; /* what the tuple looks like (?) */
/* get oid of current tuple, needed by all, so place here */
oid = rel->rd_rel->relhasoids ? HeapTupleGetOid(rettuple) : InvalidOid;
oid = HeapTupleGetOid(rettuple);
if (!OidIsValid(oid))
elog(ERROR, "Full Text Indexing: Oid of current tuple is invalid");
......
......@@ -102,10 +102,7 @@ _rserv_log_()
if (keynum == ObjectIdAttributeNumber)
{
snprintf(oidbuf, "%u", 64,
rel->rd_rel->relhasoids
? HeapTupleGetOid(tuple)
: InvalidOid);
snprintf(oidbuf, "%u", sizeof(oidbuf), HeapTupleGetOid(tuple));
key = oidbuf;
}
else
......
......@@ -614,7 +614,7 @@ make_crosstab_tupledesc(TupleDesc spi_tupdesc, int num_catagories)
* spi result input column.
*/
natts = num_catagories + 1;
tupdesc = CreateTemplateTupleDesc(natts, WITHOUTOID);
tupdesc = CreateTemplateTupleDesc(natts, false);
/* first the rowname column */
attnum = 1;
......
This diff is collapsed.
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.80 2002/08/25 17:20:00 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.81 2002/09/02 01:05:03 tgl Exp $
*
* NOTES
* The old interface functions have been converted to macros
......@@ -80,7 +80,7 @@ DataFill(char *data,
bitmask = CSIGNBIT;
}
*infomask &= HEAP_XACT_MASK;
*infomask &= ~(HEAP_HASNULL | HEAP_HASVARWIDTH | HEAP_HASEXTENDED);
for (i = 0; i < numberOfAttributes; i++)
{
......@@ -584,8 +584,6 @@ heap_formtuple(TupleDesc tupleDescriptor,
elog(ERROR, "heap_formtuple: numberOfAttributes %d exceeds limit %d",
numberOfAttributes, MaxTupleAttributeNumber);
AssertTupleDescHasOidIsValid(tupleDescriptor);
for (i = 0; i < numberOfAttributes; i++)
{
if (nulls[i] != ' ')
......@@ -600,7 +598,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
if (hasnull)
len += BITMAPLEN(numberOfAttributes);
if (tupleDescriptor->tdhasoid == WITHOID)
if (tupleDescriptor->tdhasoid)
len += sizeof(Oid);
hoff = len = MAXALIGN(len); /* align user data safely */
......@@ -626,6 +624,9 @@ heap_formtuple(TupleDesc tupleDescriptor,
&td->t_infomask,
(hasnull ? td->t_bits : NULL));
if (tupleDescriptor->tdhasoid)
td->t_infomask |= HEAP_HASOID;
td->t_infomask |= HEAP_XMAX_INVALID;
return tuple;
......@@ -651,7 +652,6 @@ heap_modifytuple(HeapTuple tuple,
char *nulls;
bool isNull;
HeapTuple newTuple;
uint8 infomask;
/*
* sanity checks
......@@ -702,18 +702,10 @@ heap_modifytuple(HeapTuple tuple,
nulls);
/*
* copy the header except for t_len, t_natts, t_hoff, t_bits,
* t_infomask
* copy the identification info of the old tuple: t_ctid, t_self,
* and OID (if any)
*/
infomask = newTuple->t_data->t_infomask;
/*
* copy t_xmin, t_cid, t_xmax, t_ctid, t_natts, t_infomask
*/
memmove((char *) newTuple->t_data, /* XXX */
(char *) tuple->t_data,
offsetof(HeapTupleHeaderData, t_hoff)); /* XXX */
newTuple->t_data->t_infomask = infomask;
newTuple->t_data->t_natts = numberOfAttributes;
newTuple->t_data->t_ctid = tuple->t_data->t_ctid;
newTuple->t_self = tuple->t_self;
newTuple->t_tableOid = tuple->t_tableOid;
if (relation->rd_rel->relhasoids)
......@@ -776,11 +768,11 @@ heap_addheader(int natts, /* max domain index */
tuple->t_datamcxt = CurrentMemoryContext;
tuple->t_data = td = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
MemSet((char *) td, 0, len);
MemSet((char *) td, 0, hoff);
td->t_hoff = hoff;
td->t_natts = natts;
td->t_infomask = HEAP_XMAX_INVALID; /* XXX sufficient? */
td->t_infomask = withoid ? (HEAP_XMAX_INVALID | HEAP_HASOID) : HEAP_XMAX_INVALID;
memcpy((char *) td + hoff, structure, structlen);
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.87 2002/08/30 19:23:18 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.88 2002/09/02 01:05:03 tgl Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
......@@ -37,7 +37,7 @@
* ----------------------------------------------------------------
*/
TupleDesc
CreateTemplateTupleDesc(int natts, hasoid_t withoid)
CreateTemplateTupleDesc(int natts, bool hasoid)
{
uint32 size;
TupleDesc desc;
......@@ -59,7 +59,7 @@ CreateTemplateTupleDesc(int natts, hasoid_t withoid)
MemSet(desc->attrs, 0, size);
desc->natts = natts;
desc->tdhasoid = withoid;
desc->tdhasoid = hasoid;
return desc;
}
......@@ -67,11 +67,12 @@ CreateTemplateTupleDesc(int natts, hasoid_t withoid)
/* ----------------------------------------------------------------
* CreateTupleDesc
*
* This function allocates a new TupleDesc from Form_pg_attribute array
* This function allocates a new TupleDesc pointing to a given
* Form_pg_attribute array
* ----------------------------------------------------------------
*/
TupleDesc
CreateTupleDesc(int natts, Form_pg_attribute *attrs)
CreateTupleDesc(int natts, bool hasoid, Form_pg_attribute *attrs)
{
TupleDesc desc;
......@@ -84,7 +85,7 @@ CreateTupleDesc(int natts, Form_pg_attribute *attrs)
desc->attrs = attrs;
desc->natts = natts;
desc->constr = NULL;
desc->tdhasoid = UNDEFOID;
desc->tdhasoid = hasoid;
return desc;
}
......@@ -129,7 +130,6 @@ CreateTupleDescCopy(TupleDesc tupdesc)
*
* This function creates a new TupleDesc by copying from an existing
* TupleDesc (with Constraints)
*
* ----------------------------------------------------------------
*/
TupleDesc
......@@ -477,6 +477,9 @@ TupleDescInitEntry(TupleDesc desc,
* BuildDescForRelation
*
* Given a relation schema (list of ColumnDef nodes), build a TupleDesc.
*
* Note: the default assumption is no OIDs; caller may modify the returned
* TupleDesc if it wants OIDs.
*/
TupleDesc
BuildDescForRelation(List *schema)
......@@ -497,7 +500,7 @@ BuildDescForRelation(List *schema)
* allocate a new tuple descriptor
*/
natts = length(schema);
desc = CreateTemplateTupleDesc(natts, UNDEFOID);
desc = CreateTemplateTupleDesc(natts, false);
constr->has_not_null = false;
attnum = 0;
......@@ -667,7 +670,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
/* OK, get the column alias */
attname = strVal(lfirst(colaliases));
tupdesc = CreateTemplateTupleDesc(1, WITHOUTOID);
tupdesc = CreateTemplateTupleDesc(1, false);
TupleDescInitEntry(tupdesc,
(AttrNumber) 1,
attname,
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.146 2002/08/29 00:17:02 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.147 2002/09/02 01:05:03 tgl Exp $
*
*
* INTERFACE ROUTINES
......@@ -1116,6 +1116,10 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid)
if (relation->rd_rel->relhasoids)
{
#ifdef NOT_USED
/* this is redundant with an Assert in HeapTupleSetOid */
Assert(tup->t_data->t_infomask & HEAP_HASOID);
#endif
/*
* If the object id of this tuple has already been assigned, trust
* the caller. There are a couple of ways this can happen. At
......@@ -1125,22 +1129,21 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid)
* to support a persistent object store (objects need to contain
* pointers to one another).
*/
AssertTupleDescHasOid(relation->rd_att);
if (!OidIsValid(HeapTupleGetOid(tup)))
HeapTupleSetOid(tup, newoid());
else
CheckMaxObjectId(HeapTupleGetOid(tup));
}
else
{
/* check there is not space for an OID */
Assert(!(tup->t_data->t_infomask & HEAP_HASOID));
}
tup->t_data->t_infomask &= ~(HEAP_XACT_MASK);
tup->t_data->t_infomask |= HEAP_XMAX_INVALID;
HeapTupleHeaderSetXmin(tup->t_data, GetCurrentTransactionId());
HeapTupleHeaderSetCmin(tup->t_data, cid);
HeapTupleHeaderSetXmaxInvalid(tup->t_data);
/*
* Do *not* set Cmax! This would overwrite Cmin.
*/
/* HeapTupleHeaderSetCmax(tup->t_data, FirstCommandId); */
tup->t_data->t_infomask |= HEAP_XMAX_INVALID;
tup->t_tableOid = relation->rd_id;
#ifdef TUPLE_TOASTER_ACTIVE
......@@ -1181,13 +1184,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid)
rdata[0].len = SizeOfHeapInsert;
rdata[0].next = &(rdata[1]);
if (relation->rd_rel->relhasoids)
{
AssertTupleDescHasOid(relation->rd_att);
xlhdr.t_oid = HeapTupleGetOid(tup);
}
else
xlhdr.t_oid = InvalidOid;
xlhdr.t_natts = tup->t_data->t_natts;
xlhdr.t_hoff = tup->t_data->t_hoff;
xlhdr.mask = tup->t_data->t_infomask;
......@@ -1234,10 +1231,6 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid)
*/
CacheInvalidateHeapTuple(relation, tup);
if (!relation->rd_rel->relhasoids)
return InvalidOid;
AssertTupleDescHasOid(relation->rd_att);
return HeapTupleGetOid(tup);
}
......@@ -1343,7 +1336,9 @@ l1:
/* store transaction information of xact deleting the tuple */
tp.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
HEAP_XMAX_INVALID |
HEAP_MARKED_FOR_UPDATE |
HEAP_MOVED);
HeapTupleHeaderSetXmax(tp.t_data, GetCurrentTransactionId());
HeapTupleHeaderSetCmax(tp.t_data, cid);
/* Make sure there is no forward chain link in t_ctid */
......@@ -1543,14 +1538,22 @@ l2:
/* Fill in OID and transaction status data for newtup */
if (relation->rd_rel->relhasoids)
{
AssertTupleDescHasOid(relation->rd_att);
#ifdef NOT_USED
/* this is redundant with an Assert in HeapTupleSetOid */
Assert(newtup->t_data->t_infomask & HEAP_HASOID);
#endif
HeapTupleSetOid(newtup, HeapTupleGetOid(&oldtup));
}
else
{
/* check there is not space for an OID */
Assert(!(newtup->t_data->t_infomask & HEAP_HASOID));
}
newtup->t_data->t_infomask &= ~(HEAP_XACT_MASK);
newtup->t_data->t_infomask |= (HEAP_XMAX_INVALID | HEAP_UPDATED);
HeapTupleHeaderSetXmin(newtup->t_data, GetCurrentTransactionId());
HeapTupleHeaderSetCmin(newtup->t_data, cid);
HeapTupleHeaderSetXmaxInvalid(newtup->t_data);
/*
* If the toaster needs to be activated, OR if the new tuple will not
......@@ -1586,7 +1589,8 @@ l2:
oldtup.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID |
HEAP_MARKED_FOR_UPDATE);
HEAP_MARKED_FOR_UPDATE |
HEAP_MOVED);
oldtup.t_data->t_infomask |= HEAP_XMAX_UNLOGGED;
HeapTupleHeaderSetXmax(oldtup.t_data, GetCurrentTransactionId());
HeapTupleHeaderSetCmax(oldtup.t_data, cid);
......@@ -1677,7 +1681,8 @@ l2:
{
oldtup.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID |
HEAP_MARKED_FOR_UPDATE);
HEAP_MARKED_FOR_UPDATE |
HEAP_MOVED);
HeapTupleHeaderSetXmax(oldtup.t_data, GetCurrentTransactionId());
HeapTupleHeaderSetCmax(oldtup.t_data, cid);
}
......@@ -1852,7 +1857,9 @@ l3:
((PageHeader) BufferGetPage(*buffer))->pd_sui = ThisStartUpID;
/* store transaction information of xact marking the tuple */
tuple->t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID);
tuple->t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID |
HEAP_MOVED);
tuple->t_data->t_infomask |= HEAP_MARKED_FOR_UPDATE;
HeapTupleHeaderSetXmax(tuple->t_data, GetCurrentTransactionId());
HeapTupleHeaderSetCmax(tuple->t_data, cid);
......@@ -2032,13 +2039,7 @@ log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from,
rdata[1].len = 0;
rdata[1].next = &(rdata[2]);
if (reln->rd_rel->relhasoids)
{
AssertTupleDescHasOid(reln->rd_att);
xlhdr.hdr.t_oid = HeapTupleGetOid(newtup);
}
else
xlhdr.hdr.t_oid = InvalidOid;
xlhdr.hdr.t_natts = newtup->t_data->t_natts;
xlhdr.hdr.t_hoff = newtup->t_data->t_hoff;
xlhdr.hdr.mask = newtup->t_data->t_infomask;
......@@ -2197,12 +2198,10 @@ heap_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
if (redo)
{
/*
* On redo from WAL we cannot rely on a tqual-routine
* to have reset HEAP_MOVED.
*/
htup->t_infomask &= ~(HEAP_MOVED | HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
htup->t_infomask &= ~(HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID |
HEAP_MARKED_FOR_UPDATE |
HEAP_MOVED);
HeapTupleHeaderSetXmax(htup, record->xl_xid);
HeapTupleHeaderSetCmax(htup, FirstCommandId);
/* Make sure there is no forward chain link in t_ctid */
......@@ -2284,14 +2283,9 @@ heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
htup->t_infomask = HEAP_XMAX_INVALID | xlhdr.mask;
HeapTupleHeaderSetXmin(htup, record->xl_xid);
HeapTupleHeaderSetCmin(htup, FirstCommandId);
HeapTupleHeaderSetXmaxInvalid(htup);
HeapTupleHeaderSetCmax(htup, FirstCommandId);
htup->t_ctid = xlrec->target.tid;
if (reln->rd_rel->relhasoids)
{
AssertTupleDescHasOid(reln->rd_att);
HeapTupleHeaderSetOid(htup, xlhdr.t_oid);
}
offnum = PageAddItem(page, (Item) htup, newlen, offnum,
LP_USED | OverwritePageMode);
......@@ -2372,8 +2366,9 @@ heap_xlog_update(bool redo, XLogRecPtr lsn, XLogRecord *record, bool move)
{
if (move)
{
htup->t_infomask &=
~(HEAP_XMIN_COMMITTED | HEAP_XMIN_INVALID | HEAP_MOVED_IN);
htup->t_infomask &= ~(HEAP_XMIN_COMMITTED |
HEAP_XMIN_INVALID |
HEAP_MOVED_IN);
htup->t_infomask |= HEAP_MOVED_OFF;
HeapTupleHeaderSetXvac(htup, record->xl_xid);
/* Make sure there is no forward chain link in t_ctid */
......@@ -2381,12 +2376,10 @@ heap_xlog_update(bool redo, XLogRecPtr lsn, XLogRecord *record, bool move)
}
else
{
/*
* On redo from WAL we cannot rely on a tqual-routine
* to have reset HEAP_MOVED.
*/
htup->t_infomask &= ~(HEAP_MOVED | HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
htup->t_infomask &= ~(HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID |
HEAP_MARKED_FOR_UPDATE |
HEAP_MOVED);
HeapTupleHeaderSetXmax(htup, record->xl_xid);
HeapTupleHeaderSetCmax(htup, FirstCommandId);
/* Set forward chain link in t_ctid */
......@@ -2466,10 +2459,8 @@ newsame:;
htup->t_natts = xlhdr.t_natts;
htup->t_hoff = xlhdr.t_hoff;
if (reln->rd_rel->relhasoids)
{
AssertTupleDescHasOid(reln->rd_att);
HeapTupleHeaderSetOid(htup, xlhdr.t_oid);
}
if (move)
{
TransactionId xid[2]; /* xmax, xmin */
......@@ -2479,7 +2470,8 @@ newsame:;
(char *) xlrec + hsize, 2 * sizeof(TransactionId));
htup->t_infomask = xlhdr.mask;
htup->t_infomask &= ~(HEAP_XMIN_COMMITTED |
HEAP_XMIN_INVALID | HEAP_MOVED_OFF);
HEAP_XMIN_INVALID |
HEAP_MOVED_OFF);
htup->t_infomask |= HEAP_MOVED_IN;
HeapTupleHeaderSetXmin(htup, xid[1]);
HeapTupleHeaderSetXmax(htup, xid[0]);
......@@ -2490,8 +2482,6 @@ newsame:;
htup->t_infomask = HEAP_XMAX_INVALID | xlhdr.mask;
HeapTupleHeaderSetXmin(htup, record->xl_xid);
HeapTupleHeaderSetCmin(htup, FirstCommandId);
HeapTupleHeaderSetXmaxInvalid(htup);
HeapTupleHeaderSetCmax(htup, FirstCommandId);
}
/* Make sure there is no forward chain link in t_ctid */
htup->t_ctid = xlrec->newtid;
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.34 2002/08/06 02:36:33 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.35 2002/09/02 01:05:03 tgl Exp $
*
*
* INTERFACE ROUTINES
......@@ -726,7 +726,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup)
new_len = offsetof(HeapTupleHeaderData, t_bits);
if (has_nulls)
new_len += BITMAPLEN(numAttrs);
if (rel->rd_rel->relhasoids)
if (olddata->t_infomask & HEAP_HASOID)
new_len += sizeof(Oid);
new_len = MAXALIGN(new_len);
Assert(new_len == olddata->t_hoff);
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.51 2002/08/30 22:18:05 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.52 2002/09/02 01:05:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -166,20 +166,20 @@ Boot_CreateStmt:
}
RPAREN
{
TupleDesc tupdesc;
do_start();
tupdesc = CreateTupleDesc(numattr, !($4), attrtypes);
if ($2)
{
TupleDesc tupdesc;
if (boot_reldesc)
{
elog(DEBUG3, "create bootstrap: warning, open relation exists, closing first");
closerel(NULL);
}
tupdesc = CreateTupleDesc(numattr, attrtypes);
tupdesc->tdhasoid = BoolToHasOid(! ($4));
boot_reldesc = heap_create(LexIDStr($5),
PG_CATALOG_NAMESPACE,
tupdesc,
......@@ -191,15 +191,12 @@ Boot_CreateStmt:
else
{
Oid id;
TupleDesc tupdesc;
tupdesc = CreateTupleDesc(numattr,attrtypes);
id = heap_create_with_catalog(LexIDStr($5),
PG_CATALOG_NAMESPACE,
tupdesc,
RELKIND_RELATION,
$3,
! ($4),
true);
elog(DEBUG3, "relation created with oid %u", id);
}
......
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.139 2002/08/30 22:18:05 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.140 2002/09/02 01:05:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -493,7 +493,6 @@ boot_openrel(char *relname)
app = Typ;
while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
AssertTupleDescHasOid(rel->rd_att);
(*app)->am_oid = HeapTupleGetOid(tup);
memcpy((char *) &(*app)->am_typ,
(char *) GETSTRUCT(tup),
......@@ -677,16 +676,14 @@ InsertOneTuple(Oid objectid)
elog(DEBUG3, "inserting row oid %u, %d columns", objectid, numattr);
tupDesc = CreateTupleDesc(numattr, attrtypes);
tupDesc->tdhasoid = BoolToHasOid(RelationGetForm(boot_reldesc)->relhasoids);
tupDesc = CreateTupleDesc(numattr,
RelationGetForm(boot_reldesc)->relhasoids,
attrtypes);
tuple = heap_formtuple(tupDesc, values, Blanks);
if (objectid != (Oid) 0)
{
AssertTupleDescHasOid(tupDesc);
HeapTupleSetOid(tuple, objectid);
}
pfree(tupDesc); /* just free's tupDesc, not the attrtypes */
simple_heap_insert(boot_reldesc, tuple);
heap_freetuple(tuple);
elog(DEBUG3, "row inserted");
......@@ -878,7 +875,6 @@ gettype(char *type)
app = Typ;
while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
AssertTupleDescHasOid(rel->rd_att);
(*app)->am_oid = HeapTupleGetOid(tup);
memmove((char *) &(*app++)->am_typ,
(char *) GETSTRUCT(tup),
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.75 2002/08/22 00:01:41 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.76 2002/09/02 01:05:03 tgl Exp $
*
* NOTES
* See acl.h.
......@@ -565,7 +565,6 @@ ExecuteGrantStmt_Namespace(GrantStmt *stmt)
elog(ERROR, "namespace \"%s\" not found", nspname);
pg_namespace_tuple = (Form_pg_namespace) GETSTRUCT(tuple);
AssertTupleDescHasOid(relation->rd_att);
if (!pg_namespace_ownercheck(HeapTupleGetOid(tuple), GetUserId()))
aclcheck_error(ACLCHECK_NOT_OWNER, nspname);
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.223 2002/08/29 04:38:04 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.224 2002/09/02 01:05:03 tgl Exp $
*
*
* INTERFACE ROUTINES
......@@ -349,7 +349,7 @@ heap_storage_create(Relation rel)
* --------------------------------
*/
static void
CheckAttributeNames(TupleDesc tupdesc, bool relhasoids, char relkind)
CheckAttributeNames(TupleDesc tupdesc, char relkind)
{
int i;
int j;
......@@ -366,7 +366,7 @@ CheckAttributeNames(TupleDesc tupdesc, bool relhasoids, char relkind)
for (i = 0; i < natts; i++)
{
if (SystemAttributeByName(NameStr(tupdesc->attrs[i]->attname),
relhasoids) != NULL)
tupdesc->tdhasoid) != NULL)
elog(ERROR, "name of column \"%s\" conflicts with an existing system column",
NameStr(tupdesc->attrs[i]->attname));
}
......@@ -419,7 +419,6 @@ CheckAttributeNames(TupleDesc tupdesc, bool relhasoids, char relkind)
static void
AddNewAttributeTuples(Oid new_rel_oid,
TupleDesc tupdesc,
bool relhasoids,
char relkind)
{
Form_pg_attribute *dpp;
......@@ -483,7 +482,8 @@ AddNewAttributeTuples(Oid new_rel_oid,
dpp = SysAtt;
for (i = 0; i < -1 - FirstLowInvalidHeapAttributeNumber; i++)
{
if (relhasoids || (*dpp)->attnum != ObjectIdAttributeNumber)
if (tupdesc->tdhasoid ||
(*dpp)->attnum != ObjectIdAttributeNumber)
{
Form_pg_attribute attStruct;
......@@ -595,7 +595,6 @@ AddNewRelationTuple(Relation pg_class_desc,
(void *) new_rel_reltup);
/* force tuple to have the desired OID */
AssertTupleDescHasOid(pg_class_desc->rd_att);
HeapTupleSetOid(tup, new_rel_oid);
/*
......@@ -671,7 +670,6 @@ heap_create_with_catalog(const char *relname,
TupleDesc tupdesc,
char relkind,
bool shared_relation,
bool relhasoids,
bool allow_system_table_mods)
{
Relation pg_class_desc;
......@@ -687,13 +685,11 @@ heap_create_with_catalog(const char *relname,
elog(ERROR, "Number of columns is out of range (1 to %d)",
MaxHeapAttributeNumber);
CheckAttributeNames(tupdesc, relhasoids, relkind);
CheckAttributeNames(tupdesc, relkind);
if (get_relname_relid(relname, relnamespace))
elog(ERROR, "Relation '%s' already exists", relname);
tupdesc->tdhasoid = BoolToHasOid(relhasoids);
/*
* Create the relcache entry (mostly dummy at this point) and the
* physical disk file. (If we fail further down, it's the smgr's
......@@ -747,8 +743,7 @@ heap_create_with_catalog(const char *relname,
* now add tuples to pg_attribute for the attributes in our new
* relation.
*/
AddNewAttributeTuples(new_rel_oid, new_rel_desc->rd_att,
relhasoids, relkind);
AddNewAttributeTuples(new_rel_oid, new_rel_desc->rd_att, relkind);
/*
* make a dependency link to force the relation to be deleted if
......@@ -987,7 +982,6 @@ RemoveAttrDefault(Oid relid, AttrNumber attnum,
scan = systable_beginscan(attrdef_rel, AttrDefaultIndex, true,
SnapshotNow, 2, scankeys);
AssertTupleDescHasOid(attrdef_rel->rd_att);
/* There should be at most one matching tuple, but we loop anyway */
while (HeapTupleIsValid(tuple = systable_getnext(scan)))
{
......@@ -1774,7 +1768,6 @@ RemoveRelConstraints(Relation rel, const char *constrName,
conscan = systable_beginscan(conrel, ConstraintRelidIndex, true,
SnapshotNow, 1, key);
AssertTupleDescHasOid(conrel->rd_att);
/*
* Scan over the result set, removing any matching entries.
*/
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.192 2002/08/30 19:23:18 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.193 2002/09/02 01:05:04 tgl Exp $
*
*
* INTERFACE ROUTINES
......@@ -111,7 +111,7 @@ BuildFuncTupleDesc(Oid funcOid,
/*
* Allocate and zero a tuple descriptor for a one-column tuple.
*/
funcTupDesc = CreateTemplateTupleDesc(1, UNDEFOID);
funcTupDesc = CreateTemplateTupleDesc(1, false);
funcTupDesc->attrs[0] = (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
MemSet(funcTupDesc->attrs[0], 0, ATTRIBUTE_TUPLE_SIZE);
......@@ -199,7 +199,7 @@ ConstructTupleDescriptor(Relation heapRelation,
* allocate the new tuple descriptor
*/
indexTupDesc = CreateTemplateTupleDesc(numatts, WITHOUTOID);
indexTupDesc = CreateTemplateTupleDesc(numatts, false);
/* ----------------
* for each attribute we are indexing, obtain its attribute
......@@ -328,7 +328,6 @@ UpdateRelationRelation(Relation indexRelation)
* the new tuple must have the oid already chosen for the index.
* sure would be embarrassing to do this sort of thing in polite company.
*/
AssertTupleDescHasOid(pg_class->rd_att);
HeapTupleSetOid(tuple, RelationGetRelid(indexRelation));
simple_heap_insert(pg_class, tuple);
......@@ -577,7 +576,7 @@ index_create(Oid heapRelationId,
indexInfo->ii_KeyAttrNumbers,
classObjectId);
indexTupDesc->tdhasoid = WITHOUTOID;
indexTupDesc->tdhasoid = false;
/*
* create the index relation's relcache entry and physical disk file.
* (If we fail further down, it's the smgr's responsibility to remove
......@@ -609,7 +608,7 @@ index_create(Oid heapRelationId,
indexRelation->rd_rel->relowner = GetUserId();
indexRelation->rd_rel->relam = accessMethodObjectId;
indexRelation->rd_rel->relkind = RELKIND_INDEX;
indexRelation->rd_rel->relhasoids = false; /* WITHOUTOID! */
indexRelation->rd_rel->relhasoids = false;
/*
* store index's pg_class entry
......
......@@ -13,7 +13,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.33 2002/08/30 22:18:05 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.34 2002/09/02 01:05:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -1585,7 +1585,6 @@ RemoveTempRelations(Oid tempNamespaceId)
case RELKIND_RELATION:
case RELKIND_SEQUENCE:
case RELKIND_VIEW:
AssertTupleDescHasOid(pgclass->rd_att);
object.classId = RelOid_pg_class;
object.objectId = HeapTupleGetOid(tuple);
object.objectSubId = 0;
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.91 2002/08/29 00:17:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.92 2002/09/02 01:05:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -230,7 +230,6 @@ ProcedureCreate(const char *procedureName,
/* start out with empty permissions */
nulls[Anum_pg_proc_proacl-1] = 'n';
AssertTupleDescHasOid(tupDesc);
tup = heap_formtuple(tupDesc, values, nulls);
simple_heap_insert(rel, tup);
is_update = false;
......@@ -239,7 +238,6 @@ ProcedureCreate(const char *procedureName,
/* Need to update indexes for either the insert or update case */
CatalogUpdateIndexes(rel, tup);
AssertTupleDescHasOid(tupDesc);
retval = HeapTupleGetOid(tup);
/*
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.80 2002/08/29 00:17:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.81 2002/09/02 01:05:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -267,7 +267,6 @@ TypeCreate(const char *typeName,
simple_heap_update(pg_type_desc, &tup->t_self, tup);
AssertTupleDescHasOid(pg_type_desc->rd_att);
typeObjectId = HeapTupleGetOid(tup);
}
else
......@@ -279,7 +278,6 @@ TypeCreate(const char *typeName,
nulls);
/* preassign tuple Oid, if one was given */
AssertTupleDescHasOid(tupDesc);
HeapTupleSetOid(tup, assignedTypeOid);
typeObjectId = simple_heap_insert(pg_type_desc, tup);
......
......@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.87 2002/08/27 03:38:27 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.88 2002/09/02 01:05:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -199,7 +199,6 @@ make_new_heap(Oid OIDOldHeap, const char *NewName)
tupdesc,
OldHeap->rd_rel->relkind,
OldHeap->rd_rel->relisshared,
OldHeap->rd_rel->relhasoids,
allowSystemTableMods);
/*
......
......@@ -7,7 +7,7 @@
* Copyright (c) 1996-2001, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.58 2002/08/29 00:17:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.59 2002/09/02 01:05:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -516,7 +516,6 @@ CommentRule(List *qualname, char *comment)
if (HeapTupleIsValid(tuple))
{
reloid = ((Form_pg_rewrite) GETSTRUCT(tuple))->ev_class;
AssertTupleDescHasOid(RewriteRelation->rd_att);
ruleoid = HeapTupleGetOid(tuple);
}
else
......@@ -557,7 +556,6 @@ CommentRule(List *qualname, char *comment)
if (!HeapTupleIsValid(tuple))
elog(ERROR, "rule \"%s\" does not exist", rulename);
Assert(reloid == ((Form_pg_rewrite) GETSTRUCT(tuple))->ev_class);
AssertTupleDescHasOid(relation->rd_att);
ruleoid = HeapTupleGetOid(tuple);
ReleaseSysCache(tuple);
}
......@@ -769,7 +767,6 @@ CommentTrigger(List *qualname, char *comment)
elog(ERROR, "trigger \"%s\" for relation \"%s\" does not exist",
trigname, RelationGetRelationName(relation));
AssertTupleDescHasOid(pg_trigger->rd_att);
oid = HeapTupleGetOid(triggertuple);
systable_endscan(scan);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.169 2002/08/29 07:22:21 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.170 2002/09/02 01:05:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -597,10 +597,8 @@ CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
/* Send OID if wanted --- note fld_count doesn't include it */
if (oids)
{
Oid oid;
Oid oid = HeapTupleGetOid(tuple);
AssertTupleDescHasOid(tupDesc);
oid = HeapTupleGetOid(tuple);
fld_size = sizeof(Oid);
CopySendData(&fld_size, sizeof(int16), fp);
CopySendData(&oid, sizeof(Oid), fp);
......@@ -611,7 +609,6 @@ CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
/* Text format has no per-tuple header, but send OID if wanted */
if (oids)
{
AssertTupleDescHasOid(tupDesc);
string = DatumGetCString(DirectFunctionCall1(oidout,
ObjectIdGetDatum(HeapTupleGetOid(tuple))));
CopySendString(string, fp);
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.100 2002/08/29 07:22:21 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.101 2002/09/02 01:05:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -335,7 +335,6 @@ createdb(const CreatedbStmt *stmt)
tuple = heap_formtuple(pg_database_dsc, new_record, new_record_nulls);
AssertTupleDescHasOid(pg_database_dsc);
HeapTupleSetOid(tuple, dboid); /* override heap_insert's OID
* selection */
......@@ -589,10 +588,7 @@ get_db_info(const char *name, Oid *dbIdP, int4 *ownerIdP,
/* oid of the database */
if (dbIdP)
{
AssertTupleDescHasOid(relation->rd_att);
*dbIdP = HeapTupleGetOid(tuple);
}
/* sysid of the owner */
if (ownerIdP)
*ownerIdP = dbform->datdba;
......
......@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.85 2002/08/29 00:17:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.86 2002/09/02 01:05:04 tgl Exp $
*
*/
......@@ -69,7 +69,7 @@ ExplainQuery(ExplainStmt *stmt, CommandDest dest)
List *l;
/* need a tuple descriptor representing a single TEXT column */
tupdesc = CreateTemplateTupleDesc(1, WITHOUTOID);
tupdesc = CreateTemplateTupleDesc(1, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "QUERY PLAN",
TEXTOID, -1, 0, false);
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.37 2002/08/30 19:23:19 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.38 2002/09/02 01:05:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -150,7 +150,8 @@ DefineRelation(CreateStmt *stmt, char relkind)
* have to copy inherited constraints here.)
*/
descriptor = BuildDescForRelation(schema);
descriptor->tdhasoid = BoolToHasOid(stmt->hasoids || parentHasOids);
descriptor->tdhasoid = (stmt->hasoids || parentHasOids);
if (old_constraints != NIL)
{
......@@ -212,7 +213,6 @@ DefineRelation(CreateStmt *stmt, char relkind)
descriptor,
relkind,
false,
stmt->hasoids || parentHasOids,
allowSystemTableMods);
StoreCatalogInheritance(relationId, inheritOids);
......@@ -1733,7 +1733,6 @@ AlterTableAddColumn(Oid myrelid,
ReleaseSysCache(typeTuple);
AssertTupleDescHasNoOid(attrdesc->rd_att);
simple_heap_insert(attrdesc, attributeTuple);
/* Update indexes on pg_attribute */
......@@ -1747,7 +1746,7 @@ AlterTableAddColumn(Oid myrelid,
newreltup = heap_copytuple(reltup);
((Form_pg_class) GETSTRUCT(newreltup))->relnatts = maxatts;
AssertTupleDescHasOid(pgclass->rd_att);
simple_heap_update(pgclass, &newreltup->t_self, newreltup);
/* keep catalog indexes current */
......@@ -3430,7 +3429,7 @@ AlterTableCreateToastTable(Oid relOid, bool silent)
snprintf(toast_idxname, NAMEDATALEN, "pg_toast_%u_index", relOid);
/* this is pretty painful... need a tuple descriptor */
tupdesc = CreateTemplateTupleDesc(3, WITHOUTOID);
tupdesc = CreateTemplateTupleDesc(3, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1,
"chunk_id",
OIDOID,
......@@ -3464,7 +3463,6 @@ AlterTableCreateToastTable(Oid relOid, bool silent)
tupdesc,
RELKIND_TOASTVALUE,
shared_relation,
false,
true);
/* make the toast relation visible, else index creation will fail */
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.129 2002/08/25 17:20:00 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.130 2002/09/02 01:05:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -301,7 +301,6 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
tuple = heap_formtuple(tgrel->rd_att, values, nulls);
/* force tuple to have the desired OID */
AssertTupleDescHasOid(tgrel->rd_att);
HeapTupleSetOid(tuple, trigoid);
/*
......@@ -421,7 +420,6 @@ DropTrigger(Oid relid, const char *trigname, DropBehavior behavior)
if (!pg_class_ownercheck(relid, GetUserId()))
aclcheck_error(ACLCHECK_NOT_OWNER, get_rel_name(relid));
AssertTupleDescHasOid(tgrel->rd_att);
object.classId = RelationGetRelid(tgrel);
object.objectId = HeapTupleGetOid(tup);
object.objectSubId = 0;
......@@ -683,7 +681,6 @@ RelationBuildTriggers(Relation relation)
RelationGetRelationName(relation));
build = &(triggers[found]);
AssertTupleDescHasOid(tgrel->rd_att);
build->tgoid = HeapTupleGetOid(htup);
build->tgname = MemoryContextStrdup(CacheMemoryContext,
DatumGetCString(DirectFunctionCall1(nameout,
......@@ -1923,7 +1920,6 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
elog(ERROR, "Constraint '%s' is not deferrable",
cname);
AssertTupleDescHasOid(tgrel->rd_att);
constr_oid = HeapTupleGetOid(htup);
loid = lappendi(loid, constr_oid);
found = true;
......
......@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.235 2002/08/30 22:18:05 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.236 2002/09/02 01:05:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -396,7 +396,6 @@ getrels(const RangeVar *vacrel, const char *stmttype)
{
/* Make a relation list entry for this guy */
oldcontext = MemoryContextSwitchTo(vac_context);
AssertTupleDescHasOid(pgclass->rd_att);
vrl = lappendi(vrl, HeapTupleGetOid(tuple));
MemoryContextSwitchTo(oldcontext);
}
......@@ -1861,8 +1860,9 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
/* NO ELOG(ERROR) TILL CHANGES ARE LOGGED */
START_CRIT_SECTION();
tuple.t_data->t_infomask &=
~(HEAP_XMIN_COMMITTED | HEAP_XMIN_INVALID | HEAP_MOVED_IN);
tuple.t_data->t_infomask &= ~(HEAP_XMIN_COMMITTED |
HEAP_XMIN_INVALID |
HEAP_MOVED_IN);
tuple.t_data->t_infomask |= HEAP_MOVED_OFF;
HeapTupleHeaderSetXvac(tuple.t_data, myXID);
......@@ -1901,12 +1901,16 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
* Update the state of the copied tuple, and store it
* on the destination page.
*/
newtup.t_data->t_infomask &=
~(HEAP_XMIN_COMMITTED | HEAP_XMIN_INVALID | HEAP_MOVED_OFF);
newtup.t_data->t_infomask &= ~(HEAP_XMIN_COMMITTED |
HEAP_XMIN_INVALID |
HEAP_MOVED_OFF);
newtup.t_data->t_infomask |= HEAP_MOVED_IN;
HeapTupleHeaderSetXvac(newtup.t_data, myXID);
newoff = PageAddItem(ToPage, (Item) newtup.t_data, tuple_len,
InvalidOffsetNumber, LP_USED);
newoff = PageAddItem(ToPage,
(Item) newtup.t_data,
tuple_len,
InvalidOffsetNumber,
LP_USED);
if (newoff == InvalidOffsetNumber)
{
elog(PANIC, "moving chain: failed to add item with len = %lu to page %u",
......@@ -2038,11 +2042,11 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
START_CRIT_SECTION();
/*
* Mark new tuple as moved_in by vacuum and store vacuum XID
* in t_cid !!!
* Mark new tuple as MOVED_IN by me.
*/
newtup.t_data->t_infomask &=
~(HEAP_XMIN_COMMITTED | HEAP_XMIN_INVALID | HEAP_MOVED_OFF);
newtup.t_data->t_infomask &= ~(HEAP_XMIN_COMMITTED |
HEAP_XMIN_INVALID |
HEAP_MOVED_OFF);
newtup.t_data->t_infomask |= HEAP_MOVED_IN;
HeapTupleHeaderSetXvac(newtup.t_data, myXID);
......@@ -2064,11 +2068,11 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
newtup.t_self = newtup.t_data->t_ctid;
/*
* Mark old tuple as moved_off by vacuum and store vacuum XID
* in t_cid !!!
* Mark old tuple as MOVED_OFF by me.
*/
tuple.t_data->t_infomask &=
~(HEAP_XMIN_COMMITTED | HEAP_XMIN_INVALID | HEAP_MOVED_IN);
tuple.t_data->t_infomask &= ~(HEAP_XMIN_COMMITTED |
HEAP_XMIN_INVALID |
HEAP_MOVED_IN);
tuple.t_data->t_infomask |= HEAP_MOVED_OFF;
HeapTupleHeaderSetXvac(tuple.t_data, myXID);
......
......@@ -27,7 +27,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.176 2002/08/29 00:17:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.177 2002/09/02 01:05:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -712,22 +712,25 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
aclcheck_error(aclresult,
get_namespace_name(namespaceId));
/*
* new "INTO" table is created WITH OIDS
*/
tupType->tdhasoid = WITHOID;
/*
* have to copy tupType to get rid of constraints
*/
tupdesc = CreateTupleDescCopy(tupType);
/*
* Formerly we forced the output table to have OIDs, but
* as of 7.3 it will not have OIDs, because it's too late
* here to change the tupdescs of the already-initialized
* plan tree. (Perhaps we could recurse and change them
* all, but it's not really worth the trouble IMHO...)
*/
intoRelationId =
heap_create_with_catalog(intoName,
namespaceId,
tupdesc,
RELKIND_RELATION,
false,
true,
allowSystemTableMods);
FreeTupleDesc(tupdesc);
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.106 2002/08/31 22:10:43 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.107 2002/09/02 01:05:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -997,7 +997,7 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
/*
* Scalar type, so make a single-column descriptor
*/
tupdesc = CreateTemplateTupleDesc(1, WITHOUTOID);
tupdesc = CreateTemplateTupleDesc(1, false);
TupleDescInitEntry(tupdesc,
(AttrNumber) 1,
"column",
......@@ -2006,10 +2006,7 @@ ExecTargetList(List *targetlist,
* natts = 0 to deal with it.
*/
if (targettype == NULL)
{
targettype = &NullTupleDesc;
targettype->tdhasoid = WITHOUTOID;
}
/*
* allocate an array of char's to hold the "null" information only if
......
......@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.57 2002/08/29 00:17:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.58 2002/09/02 01:05:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -541,7 +541,6 @@ ExecInitNullTupleSlot(EState *estate, TupleDesc tupType)
ExecSetSlotDescriptor(slot, tupType, false);
NullTupleDesc.tdhasoid = WITHOUTOID;
nullTuple = heap_formtuple(&NullTupleDesc, values, nulls);
return ExecStoreTuple(nullTuple, slot, InvalidBuffer, true);
......@@ -559,7 +558,7 @@ ExecInitNullTupleSlot(EState *estate, TupleDesc tupType)
* ----------------------------------------------------------------
*/
TupleDesc
ExecTypeFromTL(List *targetList, hasoid_t withoid)
ExecTypeFromTL(List *targetList, bool hasoid)
{
List *tlitem;
TupleDesc typeInfo;
......@@ -578,7 +577,7 @@ ExecTypeFromTL(List *targetList, hasoid_t withoid)
/*
* allocate a new typeInfo
*/
typeInfo = CreateTemplateTupleDesc(len, withoid);
typeInfo = CreateTemplateTupleDesc(len, hasoid);
/*
* scan list, generate type info for each entry
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.88 2002/08/06 02:36:34 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.89 2002/09/02 01:05:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -291,22 +291,36 @@ void
ExecAssignResultTypeFromTL(Plan *node, CommonState *commonstate)
{
ResultRelInfo *ri;
Relation rel;
hasoid_t withoid;
bool hasoid = false;
TupleDesc tupDesc;
/*
* This is pretty grotty: we need to ensure that result tuples have
* space for an OID iff they are going to be stored into a relation
* that has OIDs. We assume that estate->es_result_relation_info
* is already set up to describe the target relation. One reason
* this is ugly is that all plan nodes in the plan tree will emit
* tuples with space for an OID, though we really only need the topmost
* plan to do so.
*
* It would be better to have InitPlan adjust the topmost plan node's
* output descriptor after plan tree initialization. However, that
* doesn't quite work because in an UPDATE that spans an inheritance
* tree, some of the target relations may have OIDs and some not.
* We have to make the decision on a per-relation basis as we initialize
* each of the child plans of the topmost Append plan. So, this is ugly
* but it works, for now ...
*/
ri = node->state->es_result_relation_info;
if (ri != NULL)
rel = ri->ri_RelationDesc;
else
rel = node->state->es_into_relation_descriptor;
{
Relation rel = ri->ri_RelationDesc;
if (rel != NULL)
withoid = BoolToHasOid(rel->rd_rel->relhasoids);
else
withoid = WITHOUTOID;
hasoid = rel->rd_rel->relhasoids;
}
tupDesc = ExecTypeFromTL(node->targetlist, withoid);
tupDesc = ExecTypeFromTL(node->targetlist, hasoid);
ExecAssignResultType(commonstate, tupDesc, true);
}
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.45 2002/06/20 20:29:28 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.46 2002/09/02 01:05:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -217,7 +217,9 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent)
/*
* call ExecInitNode on each of the plans to be executed and save the
* results into the array "initialized"
* results into the array "initialized". Note we *must* set
* estate->es_result_relation_info correctly while we initialize each
* sub-plan; ExecAssignResultTypeFromTL depends on that!
*/
for (i = appendstate->as_firstplan; i <= appendstate->as_lastplan; i++)
{
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.10 2002/08/31 19:09:27 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.11 2002/09/02 01:05:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -209,7 +209,7 @@ ExecInitFunctionScan(FunctionScan *node, EState *estate, Plan *parent)
*/
char *attname = strVal(lfirst(rte->eref->colnames));
tupdesc = CreateTemplateTupleDesc(1, WITHOUTOID);
tupdesc = CreateTemplateTupleDesc(1, false);
TupleDescInitEntry(tupdesc,
(AttrNumber) 1,
attname,
......@@ -223,10 +223,7 @@ ExecInitFunctionScan(FunctionScan *node, EState *estate, Plan *parent)
/*
* Must be a pseudo type, i.e. record
*/
List *coldeflist = rte->coldeflist;
tupdesc = BuildDescForRelation(coldeflist);
tupdesc->tdhasoid = WITHOUTOID;
tupdesc = BuildDescForRelation(rte->coldeflist);
}
else
elog(ERROR, "Unknown kind of return type specified for function");
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.72 2002/07/20 05:16:58 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.73 2002/09/02 01:05:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -392,7 +392,6 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
MemoryContext oldcxt = NULL;
HeapTuple mtuple;
int numberOfAttributes;
uint8 infomask;
Datum *v;
char *n;
bool isnull;
......@@ -434,14 +433,13 @@ 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_data->t_infomask;
/*
* copy t_xmin, t_cid, t_xmax, t_ctid, t_natts, t_infomask
* copy the identification info of the old tuple: t_ctid, t_self,
* and OID (if any)
*/
memmove((char *)mtuple->t_data, (char *)tuple->t_data,
offsetof(HeapTupleHeaderData, t_hoff));
mtuple->t_data->t_infomask = infomask;
mtuple->t_data->t_natts = numberOfAttributes;
mtuple->t_data->t_ctid = tuple->t_data->t_ctid;
mtuple->t_self = tuple->t_self;
mtuple->t_tableOid = tuple->t_tableOid;
if (rel->rd_rel->relhasoids)
HeapTupleSetOid(mtuple, HeapTupleGetOid(tuple));
}
......
......@@ -16,7 +16,7 @@
*
* Copyright (c) 2001, PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.24 2002/08/29 07:22:23 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.25 2002/09/02 01:05:05 tgl Exp $
* ----------
*/
#include "postgres.h"
......@@ -620,7 +620,6 @@ pgstat_vacuum_tabstat(void)
dbidlist = (Oid *) repalloc((char *) dbidlist,
sizeof(Oid) * dbidalloc);
}
AssertTupleDescHasOid(dbrel->rd_att);
dbidlist[dbidused++] = HeapTupleGetOid(dbtup);
}
heap_endscan(dbscan);
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.47 2002/08/06 19:41:23 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.48 2002/09/02 01:05:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -45,7 +45,7 @@ PageInit(Page page, Size pageSize, Size specialSize)
p->pd_lower = SizeOfPageHeaderData;
p->pd_upper = pageSize - specialSize;
p->pd_special = pageSize - specialSize;
PageSetPageSize(page, pageSize);
PageSetPageSizeAndVersion(page, pageSize, PG_PAGE_LAYOUT_VERSION);
}
......
......@@ -6,7 +6,7 @@
* Copyright (c) 2002, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/lockfuncs.c,v 1.5 2002/08/31 17:14:28 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/lockfuncs.c,v 1.6 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -50,7 +50,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
/* build tupdesc for result tuples */
/* this had better match pg_locks view in initdb.sh */
tupdesc = CreateTemplateTupleDesc(6, WITHOUTOID);
tupdesc = CreateTemplateTupleDesc(6, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "relation",
OIDOID, -1, 0, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "database",
......
......@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.73 2002/08/22 00:01:43 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.74 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -110,7 +110,6 @@ regprocin(PG_FUNCTION_ARGS)
while (HeapTupleIsValid(tuple = systable_getnext(sysscan)))
{
AssertTupleDescHasOid(hdesc->rd_att);
result = (RegProcedure) HeapTupleGetOid(tuple);
if (++matches > 1)
break;
......@@ -425,7 +424,6 @@ regoperin(PG_FUNCTION_ARGS)
while (HeapTupleIsValid(tuple = systable_getnext(sysscan)))
{
AssertTupleDescHasOid(hdesc->rd_att);
result = HeapTupleGetOid(tuple);
if (++matches > 1)
break;
......@@ -756,10 +754,7 @@ regclassin(PG_FUNCTION_ARGS)
SnapshotNow, 1, skey);
if (HeapTupleIsValid(tuple = systable_getnext(sysscan)))
{
AssertTupleDescHasOid(hdesc->rd_att);
result = HeapTupleGetOid(tuple);
}
else
elog(ERROR, "No class with name %s", class_name_or_oid);
......@@ -912,10 +907,7 @@ regtypein(PG_FUNCTION_ARGS)
SnapshotNow, 1, skey);
if (HeapTupleIsValid(tuple = systable_getnext(sysscan)))
{
AssertTupleDescHasOid(hdesc->rd_att);
result = HeapTupleGetOid(tuple);
}
else
elog(ERROR, "No type with name %s", typ_name_or_oid);
......
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.52 2002/08/27 03:56:35 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.53 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -116,7 +116,6 @@ SetDefine(char *querystr, Oid elemType)
simple_heap_update(procrel, &newtup->t_self, newtup);
AssertTupleDescHasOid(procrel->rd_att);
setoid = HeapTupleGetOid(newtup);
CatalogUpdateIndexes(procrel, newtup);
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.97 2002/07/20 05:16:58 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.98 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -907,7 +907,6 @@ CatalogCacheInitializeCache(CatCache *cache)
* copy the relcache's tuple descriptor to permanent cache storage
*/
tupdesc = CreateTupleDescCopyConstr(RelationGetDescr(relation));
AssertTupleDescHasOidIsValid(tupdesc);
/*
* get the relation's OID and relisshared flag, too
......@@ -1687,10 +1686,7 @@ build_dummy_tuple(CatCache *cache, int nkeys, ScanKey skeys)
ntp = heap_formtuple(tupDesc, values, nulls);
if (tupOid != InvalidOid)
{
AssertTupleDescHasOid(tupDesc);
HeapTupleSetOid(ntp, tupOid);
}
pfree(values);
pfree(nulls);
......
......@@ -74,7 +74,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.53 2002/07/20 05:16:58 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.54 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -525,10 +525,7 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple,
tupleRelId = RelationGetRelid(relation);
if (tupleRelId == RelOid_pg_class)
{
AssertTupleDescHasOid(relation->rd_att);
relationId = HeapTupleGetOid(tuple);
}
else if (tupleRelId == RelOid_pg_attribute)
relationId = ((Form_pg_attribute) GETSTRUCT(tuple))->attrelid;
else
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.172 2002/08/11 21:17:35 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.173 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -434,7 +434,8 @@ AllocateRelationDesc(Relation relation, Form_pg_class relp)
relation->rd_rel = relationForm;
/* and allocate attribute tuple form storage */
relation->rd_att = CreateTemplateTupleDesc(relationForm->relnatts, BoolToHasOid(relationForm->relhasoids));
relation->rd_att = CreateTemplateTupleDesc(relationForm->relnatts,
relationForm->relhasoids);
MemoryContextSwitchTo(oldcxt);
......@@ -460,6 +461,8 @@ RelationBuildTupleDesc(RelationBuildDescInfo buildinfo,
AttrDefault *attrdef = NULL;
int ndef = 0;
relation->rd_att->tdhasoid = RelationGetForm(relation)->relhasoids;
constr = (TupleConstr *) MemoryContextAlloc(CacheMemoryContext,
sizeof(TupleConstr));
constr->has_not_null = false;
......@@ -695,7 +698,6 @@ RelationBuildRuleLock(Relation relation)
rule = (RewriteRule *) MemoryContextAlloc(rulescxt,
sizeof(RewriteRule));
AssertTupleDescHasOid(rewrite_tupdesc);
rule->ruleId = HeapTupleGetOid(rewrite_tuple);
rule->event = rewrite_form->ev_type - '0';
......@@ -871,7 +873,6 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
* initialize the tuple descriptor (relation->rd_att).
*/
RelationBuildTupleDesc(buildinfo, relation);
RelationGetDescr(relation)->tdhasoid = BoolToHasOid(RelationGetForm(relation)->relhasoids);
/*
* Fetch rules and triggers that affect this relation
......@@ -1405,7 +1406,8 @@ formrdesc(const char *relationName,
* right because it will never be replaced. The input values must be
* correctly defined by macros in src/include/catalog/ headers.
*/
relation->rd_att = CreateTemplateTupleDesc(natts, BoolToHasOid(relation->rd_rel->relhasoids));
relation->rd_att = CreateTemplateTupleDesc(natts,
relation->rd_rel->relhasoids);
/*
* initialize tuple desc info
......@@ -2101,7 +2103,7 @@ RelationBuildLocalRelation(const char *relname,
rel->rd_rel->relnamespace = relnamespace;
rel->rd_rel->relkind = RELKIND_UNCATALOGED;
rel->rd_rel->relhasoids = (rel->rd_att->tdhasoid == WITHOID);
rel->rd_rel->relhasoids = rel->rd_att->tdhasoid;
rel->rd_rel->relnatts = natts;
rel->rd_rel->reltype = InvalidOid;
......@@ -2304,7 +2306,7 @@ RelationCacheInitializePhase2(void)
*/
Assert(relation->rd_rel != NULL);
memcpy((char *) relation->rd_rel, (char *) relp, CLASS_TUPLE_SIZE);
relation->rd_att->tdhasoid = BoolToHasOid(relp->relhasoids);
relation->rd_att->tdhasoid = relp->relhasoids;
ReleaseSysCache(htup);
}
......@@ -2766,7 +2768,8 @@ load_relcache_init_file(void)
rel->rd_rel = relform;
/* initialize attribute tuple forms */
rel->rd_att = CreateTemplateTupleDesc(relform->relnatts, BoolToHasOid(relform->relhasoids));
rel->rd_att = CreateTemplateTupleDesc(relform->relnatts,
relform->relhasoids);
/* next read all the attribute tuple form data entries */
for (i = 0; i < relform->relnatts; i++)
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.112 2002/08/30 22:18:06 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.113 2002/09/02 01:05:06 tgl Exp $
*
*
*-------------------------------------------------------------------------
......@@ -98,7 +98,6 @@ ReverifyMyDatabase(const char *name)
pgdbscan = heap_beginscan(pgdbrel, SnapshotNow, 1, &key);
tup = heap_getnext(pgdbscan, ForwardScanDirection);
AssertTupleDescHasOid(pgdbrel->rd_att);
if (!HeapTupleIsValid(tup) ||
HeapTupleGetOid(tup) != MyDatabaseId)
{
......
......@@ -5,7 +5,7 @@
* command, configuration file, and command line options.
* See src/backend/utils/misc/README for more information.
*
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.90 2002/09/01 23:26:06 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.91 2002/09/02 01:05:06 tgl Exp $
*
* Copyright 2000 by PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
......@@ -2288,7 +2288,7 @@ ShowGUCConfigOption(const char *name)
value = GetConfigOptionByName(name, &varname);
/* need a tuple descriptor representing a single TEXT column */
tupdesc = CreateTemplateTupleDesc(1, WITHOUTOID);
tupdesc = CreateTemplateTupleDesc(1, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, (char *) varname,
TEXTOID, -1, 0, false);
......@@ -2314,7 +2314,7 @@ ShowAllGUCConfig(void)
char *values[2];
/* need a tuple descriptor representing two TEXT columns */
tupdesc = CreateTemplateTupleDesc(2, WITHOUTOID);
tupdesc = CreateTemplateTupleDesc(2, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
TEXTOID, -1, 0, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting",
......@@ -2445,7 +2445,7 @@ show_all_settings(PG_FUNCTION_ARGS)
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
/* need a tuple descriptor representing two TEXT columns */
tupdesc = CreateTemplateTupleDesc(2, WITHOUTOID);
tupdesc = CreateTemplateTupleDesc(2, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
TEXTOID, -1, 0, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "setting",
......
......@@ -16,7 +16,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.58 2002/07/30 16:08:33 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.59 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -83,7 +83,6 @@ HeapTupleSatisfiesItself(HeapTupleHeader tuple)
return false;
}
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
}
else if (tuple->t_infomask & HEAP_MOVED_IN)
......@@ -93,10 +92,7 @@ HeapTupleSatisfiesItself(HeapTupleHeader tuple)
if (TransactionIdIsInProgress(HeapTupleHeaderGetXvac(tuple)))
return false;
if (TransactionIdDidCommit(HeapTupleHeaderGetXvac(tuple)))
{
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
else
{
tuple->t_infomask |= HEAP_XMIN_INVALID;
......@@ -223,7 +219,6 @@ HeapTupleSatisfiesNow(HeapTupleHeader tuple)
return false;
}
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
}
else if (tuple->t_infomask & HEAP_MOVED_IN)
......@@ -233,10 +228,7 @@ HeapTupleSatisfiesNow(HeapTupleHeader tuple)
if (TransactionIdIsInProgress(HeapTupleHeaderGetXvac(tuple)))
return false;
if (TransactionIdDidCommit(HeapTupleHeaderGetXvac(tuple)))
{
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
else
{
tuple->t_infomask |= HEAP_XMIN_INVALID;
......@@ -344,7 +336,6 @@ HeapTupleSatisfiesToast(HeapTupleHeader tuple)
return false;
}
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
}
else if (tuple->t_infomask & HEAP_MOVED_IN)
......@@ -354,10 +345,7 @@ HeapTupleSatisfiesToast(HeapTupleHeader tuple)
if (TransactionIdIsInProgress(HeapTupleHeaderGetXvac(tuple)))
return false;
if (TransactionIdDidCommit(HeapTupleHeaderGetXvac(tuple)))
{
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
else
{
tuple->t_infomask |= HEAP_XMIN_INVALID;
......@@ -401,7 +389,6 @@ HeapTupleSatisfiesUpdate(HeapTuple htuple, CommandId curcid)
return HeapTupleInvisible;
}
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
}
else if (tuple->t_infomask & HEAP_MOVED_IN)
......@@ -411,10 +398,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htuple, CommandId curcid)
if (TransactionIdIsInProgress(HeapTupleHeaderGetXvac(tuple)))
return HeapTupleInvisible;
if (TransactionIdDidCommit(HeapTupleHeaderGetXvac(tuple)))
{
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
else
{
tuple->t_infomask |= HEAP_XMIN_INVALID;
......@@ -536,7 +520,6 @@ HeapTupleSatisfiesDirty(HeapTupleHeader tuple)
return false;
}
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
}
else if (tuple->t_infomask & HEAP_MOVED_IN)
......@@ -546,10 +529,7 @@ HeapTupleSatisfiesDirty(HeapTupleHeader tuple)
if (TransactionIdIsInProgress(HeapTupleHeaderGetXvac(tuple)))
return false;
if (TransactionIdDidCommit(HeapTupleHeaderGetXvac(tuple)))
{
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
else
{
tuple->t_infomask |= HEAP_XMIN_INVALID;
......@@ -671,7 +651,6 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot)
return false;
}
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
}
else if (tuple->t_infomask & HEAP_MOVED_IN)
......@@ -681,10 +660,7 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot)
if (TransactionIdIsInProgress(HeapTupleHeaderGetXvac(tuple)))
return false;
if (TransactionIdDidCommit(HeapTupleHeaderGetXvac(tuple)))
{
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
else
{
tuple->t_infomask |= HEAP_XMIN_INVALID;
......@@ -833,7 +809,6 @@ HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin)
return HEAPTUPLE_DEAD;
}
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
else if (tuple->t_infomask & HEAP_MOVED_IN)
{
......@@ -842,10 +817,7 @@ HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin)
if (TransactionIdIsInProgress(HeapTupleHeaderGetXvac(tuple)))
return HEAPTUPLE_INSERT_IN_PROGRESS;
if (TransactionIdDidCommit(HeapTupleHeaderGetXvac(tuple)))
{
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
tuple->t_infomask &= ~HEAP_MOVED;
}
else
{
tuple->t_infomask |= HEAP_XMIN_INVALID;
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: tupdesc.h,v 1.37 2002/07/20 05:16:59 momjian Exp $
* $Id: tupdesc.h,v 1.38 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -41,14 +41,9 @@ typedef struct tupleConstr
bool has_not_null;
} TupleConstr;
typedef char hasoid_t;
#define WITHOID 'C'
#define WITHOUTOID 'S'
#define UNDEFOID '?'
#define BoolToHasOid(b) ((b) ? WITHOID : WITHOUTOID)
/*
* This structure contains all information (i.e. from Classes
* pg_attribute, pg_attrdef, pg_constraint) for a tuple.
* pg_attribute, pg_attrdef, pg_constraint) for the structure of a tuple.
*/
typedef struct tupleDesc
{
......@@ -56,29 +51,14 @@ typedef struct tupleDesc
Form_pg_attribute *attrs;
/* attrs[N] is a pointer to the description of Attribute Number N+1. */
TupleConstr *constr;
hasoid_t tdhasoid; /* Tuple has an oid attribute in its header */
bool tdhasoid; /* Tuple has oid attribute in its header */
} *TupleDesc;
#ifdef DEBUG_TUPLE_ACCESS
#define AssertTupleDescHasOidIsValid(td) \
Assert(((td)->tdhasoid == WITHOID) || ((td)->tdhasoid == WITHOUTOID))
#define AssertTupleDescHasOid(td) \
Assert((td)->tdhasoid == WITHOID)
#define AssertTupleDescHasNoOid(td) \
Assert((td)->tdhasoid == WITHOUTOID)
extern TupleDesc CreateTemplateTupleDesc(int natts, bool hasoid);
#else
#define AssertTupleDescHasOidIsValid(td)
#define AssertTupleDescHasOid(td)
#define AssertTupleDescHasNoOid(td)
#endif
extern TupleDesc CreateTemplateTupleDesc(int natts, hasoid_t withoid);
extern TupleDesc CreateTupleDesc(int natts, Form_pg_attribute *attrs);
extern TupleDesc CreateTupleDesc(int natts, bool hasoid,
Form_pg_attribute *attrs);
extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc);
......
......@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: catversion.h,v 1.156 2002/08/31 17:14:28 tgl Exp $
* $Id: catversion.h,v 1.157 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 200208311
#define CATALOG_VERSION_NO 200209011
#endif
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: heap.h,v 1.55 2002/08/02 18:15:09 tgl Exp $
* $Id: heap.h,v 1.56 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -41,7 +41,6 @@ extern Oid heap_create_with_catalog(const char *relname,
TupleDesc tupdesc,
char relkind,
bool shared_relation,
bool relhasoids,
bool allow_system_table_mods);
extern void heap_drop_with_catalog(Oid rid);
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: executor.h,v 1.76 2002/08/30 23:59:46 tgl Exp $
* $Id: executor.h,v 1.77 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -122,7 +122,7 @@ extern void ExecInitScanTupleSlot(EState *estate,
extern TupleTableSlot *ExecInitExtraTupleSlot(EState *estate);
extern TupleTableSlot *ExecInitNullTupleSlot(EState *estate,
TupleDesc tupType);
extern TupleDesc ExecTypeFromTL(List *targetList, hasoid_t withoid);
extern TupleDesc ExecTypeFromTL(List *targetList, bool hasoid);
extern void SetChangedParamList(Plan *node, List *newchg);
typedef struct TupOutputState
......
......@@ -8,7 +8,7 @@
* or in pg_config.h afterwards. Of course, if you edit pg_config.h, then your
* changes will be overwritten the next time you run configure.
*
* $Id: pg_config.h.in,v 1.29 2002/08/29 08:03:22 ishii Exp $
* $Id: pg_config.h.in,v 1.30 2002/09/02 01:05:06 tgl Exp $
*/
#ifndef PG_CONFIG_H
......@@ -298,12 +298,6 @@
/* #define ACLDEBUG */
/* #define RTDEBUG */
/* #define GISTDEBUG */
/*
* DEBUG_TUPLE_ACCESS enables paranoid assertions during
* elimination of oids from the fixed sized part of HeapTupleHeader.
* This is expected to be undef'd after v7.3 release at the latest.
*/
#define DEBUG_TUPLE_ACCESS
/*
* defining unsafe floats will make float4 and float8 ops faster
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: bufpage.h,v 1.51 2002/08/06 19:37:10 tgl Exp $
* $Id: bufpage.h,v 1.52 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -97,12 +97,20 @@ typedef uint16 LocationIndex;
* pd_lower - offset to start of free space.
* pd_upper - offset to end of free space.
* pd_special - offset to start of special space.
* pd_pagesize - size in bytes.
* Minimum possible page size is perhaps 64B to fit
* page header, opaque space and a minimal tuple;
* of course, in reality you want it much bigger.
* On the high end, we can only support pages up
* to 32KB because lp_off/lp_len are 15 bits.
* pd_pagesize_version - size in bytes and page layout version number.
*
* The page version number and page size are packed together into a single
* uint16 field. This is for historical reasons: before PostgreSQL 7.3,
* there was no concept of a page version number, and doing it this way
* lets us pretend that pre-7.3 databases have page version number zero.
* We constrain page sizes to be multiples of 256, leaving the low eight
* bytes available for a version number.
*
* Minimum possible page size is perhaps 64B to fit page header, opaque space
* and a minimal tuple; of course, in reality you want it much bigger, so
* the constraint on pagesize mod 256 is not an important restriction.
* On the high end, we can only support pages up to 32KB because lp_off/lp_len
* are 15 bits.
*/
typedef struct PageHeaderData
{
......@@ -116,12 +124,18 @@ typedef struct PageHeaderData
LocationIndex pd_lower; /* offset to start of free space */
LocationIndex pd_upper; /* offset to end of free space */
LocationIndex pd_special; /* offset to start of special space */
uint16 pd_pagesize;
uint16 pd_pagesize_version;
ItemIdData pd_linp[1]; /* beginning of line pointer array */
} PageHeaderData;
typedef PageHeaderData *PageHeader;
/*
* Page layout version number 0 is for pre-7.3 Postgres releases. The
* current version number is 1, denoting a new HeapTupleHeader layout.
*/
#define PG_PAGE_LAYOUT_VERSION 1
/* ----------------------------------------------------------------
* page support macros
......@@ -178,7 +192,7 @@ typedef PageHeaderData *PageHeader;
((char *) (&((PageHeader) (page))->pd_linp[0]))
/* ----------------
* macros to access opaque space
* macros to access page size info
* ----------------
*/
......@@ -203,14 +217,32 @@ typedef PageHeaderData *PageHeader;
* however, it can be called on a page for which there is no buffer.
*/
#define PageGetPageSize(page) \
((Size) ((PageHeader) (page))->pd_pagesize)
((Size) (((PageHeader) (page))->pd_pagesize_version & (uint16) 0xFF00))
/*
* PageSetPageSize
* Sets the page size of a page.
* PageGetPageLayoutVersion
* Returns the page layout version of a page.
*
* this can only be called on a formatted page (unlike
* BufferGetPageSize, which can be called on an unformatted page).
* however, it can be called on a page for which there is no buffer.
*/
#define PageSetPageSize(page, size) \
(((PageHeader) (page))->pd_pagesize = (size))
#define PageGetPageLayoutVersion(page) \
(((PageHeader) (page))->pd_pagesize_version & 0x00FF)
/*
* PageSetPageSizeAndVersion
* Sets the page size and page layout version number of a page.
*
* We could support setting these two values separately, but there's
* no real need for it at the moment.
*/
#define PageSetPageSizeAndVersion(page, size, version) \
( \
AssertMacro(((size) & 0xFF00) == (size)), \
AssertMacro(((version) & 0x00FF) == (version)), \
((PageHeader) (page))->pd_pagesize_version = (size) | (version) \
)
/* ----------------
* page special data macros
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment