mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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.
This commit is contained in:
6
src/backend/utils/cache/catcache.c
vendored
6
src/backend/utils/cache/catcache.c
vendored
@ -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);
|
||||
|
5
src/backend/utils/cache/inval.c
vendored
5
src/backend/utils/cache/inval.c
vendored
@ -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
|
||||
|
19
src/backend/utils/cache/relcache.c
vendored
19
src/backend/utils/cache/relcache.c
vendored
@ -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++)
|
||||
|
Reference in New Issue
Block a user