summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-09-02 01:05:06 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-09-02 01:05:06 +0000
commitc7a165adc64e3e67e0dcee4088d84a0638b3515a (patch)
tree97d02a63e6ab6a516cb8e8ba24b0ba42782d202d /src/backend/utils/cache
parentfcd34f9f7ff561213beef97f93c32f415e35a79c (diff)
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.
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r--src/backend/utils/cache/catcache.c6
-rw-r--r--src/backend/utils/cache/inval.c5
-rw-r--r--src/backend/utils/cache/relcache.c19
3 files changed, 13 insertions, 17 deletions
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 21f1e01dabb..5703bf16530 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.97 2002/07/20 05:16:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.98 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -907,7 +907,6 @@ CatalogCacheInitializeCache(CatCache *cache)
* copy the relcache's tuple descriptor to permanent cache storage
*/
tupdesc = CreateTupleDescCopyConstr(RelationGetDescr(relation));
- AssertTupleDescHasOidIsValid(tupdesc);
/*
* get the relation's OID and relisshared flag, too
@@ -1687,10 +1686,7 @@ build_dummy_tuple(CatCache *cache, int nkeys, ScanKey skeys)
ntp = heap_formtuple(tupDesc, values, nulls);
if (tupOid != InvalidOid)
- {
- AssertTupleDescHasOid(tupDesc);
HeapTupleSetOid(ntp, tupOid);
- }
pfree(values);
pfree(nulls);
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index c2929262381..d64f5bf0b57 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -74,7 +74,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.53 2002/07/20 05:16:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.54 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -525,10 +525,7 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple,
tupleRelId = RelationGetRelid(relation);
if (tupleRelId == RelOid_pg_class)
- {
- AssertTupleDescHasOid(relation->rd_att);
relationId = HeapTupleGetOid(tuple);
- }
else if (tupleRelId == RelOid_pg_attribute)
relationId = ((Form_pg_attribute) GETSTRUCT(tuple))->attrelid;
else
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 1b5717029aa..036d11022bb 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.172 2002/08/11 21:17:35 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.173 2002/09/02 01:05:06 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -434,7 +434,8 @@ AllocateRelationDesc(Relation relation, Form_pg_class relp)
relation->rd_rel = relationForm;
/* and allocate attribute tuple form storage */
- relation->rd_att = CreateTemplateTupleDesc(relationForm->relnatts, BoolToHasOid(relationForm->relhasoids));
+ relation->rd_att = CreateTemplateTupleDesc(relationForm->relnatts,
+ relationForm->relhasoids);
MemoryContextSwitchTo(oldcxt);
@@ -460,6 +461,8 @@ RelationBuildTupleDesc(RelationBuildDescInfo buildinfo,
AttrDefault *attrdef = NULL;
int ndef = 0;
+ relation->rd_att->tdhasoid = RelationGetForm(relation)->relhasoids;
+
constr = (TupleConstr *) MemoryContextAlloc(CacheMemoryContext,
sizeof(TupleConstr));
constr->has_not_null = false;
@@ -695,7 +698,6 @@ RelationBuildRuleLock(Relation relation)
rule = (RewriteRule *) MemoryContextAlloc(rulescxt,
sizeof(RewriteRule));
- AssertTupleDescHasOid(rewrite_tupdesc);
rule->ruleId = HeapTupleGetOid(rewrite_tuple);
rule->event = rewrite_form->ev_type - '0';
@@ -871,7 +873,6 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
* initialize the tuple descriptor (relation->rd_att).
*/
RelationBuildTupleDesc(buildinfo, relation);
- RelationGetDescr(relation)->tdhasoid = BoolToHasOid(RelationGetForm(relation)->relhasoids);
/*
* Fetch rules and triggers that affect this relation
@@ -1405,7 +1406,8 @@ formrdesc(const char *relationName,
* right because it will never be replaced. The input values must be
* correctly defined by macros in src/include/catalog/ headers.
*/
- relation->rd_att = CreateTemplateTupleDesc(natts, BoolToHasOid(relation->rd_rel->relhasoids));
+ relation->rd_att = CreateTemplateTupleDesc(natts,
+ relation->rd_rel->relhasoids);
/*
* initialize tuple desc info
@@ -2101,7 +2103,7 @@ RelationBuildLocalRelation(const char *relname,
rel->rd_rel->relnamespace = relnamespace;
rel->rd_rel->relkind = RELKIND_UNCATALOGED;
- rel->rd_rel->relhasoids = (rel->rd_att->tdhasoid == WITHOID);
+ rel->rd_rel->relhasoids = rel->rd_att->tdhasoid;
rel->rd_rel->relnatts = natts;
rel->rd_rel->reltype = InvalidOid;
@@ -2304,7 +2306,7 @@ RelationCacheInitializePhase2(void)
*/
Assert(relation->rd_rel != NULL);
memcpy((char *) relation->rd_rel, (char *) relp, CLASS_TUPLE_SIZE);
- relation->rd_att->tdhasoid = BoolToHasOid(relp->relhasoids);
+ relation->rd_att->tdhasoid = relp->relhasoids;
ReleaseSysCache(htup);
}
@@ -2766,7 +2768,8 @@ load_relcache_init_file(void)
rel->rd_rel = relform;
/* initialize attribute tuple forms */
- rel->rd_att = CreateTemplateTupleDesc(relform->relnatts, BoolToHasOid(relform->relhasoids));
+ rel->rd_att = CreateTemplateTupleDesc(relform->relnatts,
+ relform->relhasoids);
/* next read all the attribute tuple form data entries */
for (i = 0; i < relform->relnatts; i++)