mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
First phase of project to use fixed OIDs for all system catalogs and
indexes. Extend the macros in include/catalog/*.h to carry the info about hand-assigned OIDs, and adjust the genbki script and bootstrap code to make the relations actually get those OIDs. Remove the small number of RelOid_pg_foo macros that we had in favor of a complete set named like the catname.h and indexing.h macros. Next phase will get rid of internal use of names for looking up catalogs and indexes; but this completes the changes forcing an initdb, so it looks like a good place to commit. Along the way, I made the shared relations (pg_database etc) not be 'bootstrap' relations any more, so as to reduce the number of hardwired entries and simplify changing those relations in future. I'm not sure whether they ever really needed to be handled as bootstrap relations, but it seems to work fine to not do so now.
This commit is contained in:
35
src/backend/utils/cache/relcache.c
vendored
35
src/backend/utils/cache/relcache.c
vendored
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.218 2005/03/29 00:17:11 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.219 2005/04/14 01:38:19 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2150,17 +2150,35 @@ RelationBuildLocalRelation(const char *relname,
|
||||
TupleDesc tupDesc,
|
||||
Oid relid,
|
||||
Oid reltablespace,
|
||||
bool shared_relation,
|
||||
bool nailit)
|
||||
bool shared_relation)
|
||||
{
|
||||
Relation rel;
|
||||
MemoryContext oldcxt;
|
||||
int natts = tupDesc->natts;
|
||||
int i;
|
||||
bool has_not_null;
|
||||
bool nailit;
|
||||
|
||||
AssertArg(natts >= 0);
|
||||
|
||||
/*
|
||||
* check for creation of a rel that must be nailed in cache.
|
||||
*
|
||||
* XXX this list had better match RelationCacheInitialize's list.
|
||||
*/
|
||||
switch (relid)
|
||||
{
|
||||
case RelationRelationId:
|
||||
case AttributeRelationId:
|
||||
case ProcedureRelationId:
|
||||
case TypeRelationId:
|
||||
nailit = true;
|
||||
break;
|
||||
default:
|
||||
nailit = false;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* switch to the cache context to create the relcache entry.
|
||||
*/
|
||||
@ -2179,6 +2197,9 @@ RelationBuildLocalRelation(const char *relname,
|
||||
/* make sure relation is marked as having no open file yet */
|
||||
rel->rd_smgr = NULL;
|
||||
|
||||
/* mark it nailed if appropriate */
|
||||
rel->rd_isnailed = nailit;
|
||||
|
||||
rel->rd_refcnt = nailit ? 1 : 0;
|
||||
|
||||
/* it's being created in this transaction */
|
||||
@ -2190,14 +2211,6 @@ RelationBuildLocalRelation(const char *relname,
|
||||
/* is it a temporary relation? */
|
||||
rel->rd_istemp = isTempNamespace(relnamespace);
|
||||
|
||||
/*
|
||||
* nail the reldesc if this is a bootstrap create reln and we may need
|
||||
* it in the cache later on in the bootstrap process so we don't ever
|
||||
* want it kicked out. e.g. pg_attribute!!!
|
||||
*/
|
||||
if (nailit)
|
||||
rel->rd_isnailed = true;
|
||||
|
||||
/*
|
||||
* create a new tuple descriptor from the one passed in. We do this
|
||||
* partly to copy it into the cache context, and partly because the
|
||||
|
Reference in New Issue
Block a user