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