mirror of
https://github.com/postgres/postgres.git
synced 2025-06-22 02:52:08 +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:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.128 2004/12/31 21:59:41 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.129 2005/04/14 01:38:16 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -65,6 +65,8 @@ static bool relationHasPrimaryKey(Relation rel);
|
||||
* 'heapRelation': the relation the index will apply to.
|
||||
* 'indexRelationName': the name for the new index, or NULL to indicate
|
||||
* that a nonconflicting default name should be picked.
|
||||
* 'indexRelationId': normally InvalidOid, but during bootstrap can be
|
||||
* nonzero to specify a preselected OID for the index.
|
||||
* 'accessMethodName': name of the AM to use.
|
||||
* 'tableSpaceName': name of the tablespace to create the index in.
|
||||
* NULL specifies using the appropriate default.
|
||||
@ -86,6 +88,7 @@ static bool relationHasPrimaryKey(Relation rel);
|
||||
void
|
||||
DefineIndex(RangeVar *heapRelation,
|
||||
char *indexRelationName,
|
||||
Oid indexRelationId,
|
||||
char *accessMethodName,
|
||||
char *tableSpaceName,
|
||||
List *attributeList,
|
||||
@ -379,7 +382,7 @@ DefineIndex(RangeVar *heapRelation,
|
||||
primary ? "PRIMARY KEY" : "UNIQUE",
|
||||
indexRelationName, RelationGetRelationName(rel))));
|
||||
|
||||
index_create(relationId, indexRelationName,
|
||||
index_create(relationId, indexRelationName, indexRelationId,
|
||||
indexInfo, accessMethodId, tablespaceId, classObjectId,
|
||||
primary, isconstraint,
|
||||
allowSystemTableMods, skip_build);
|
||||
@ -887,7 +890,7 @@ RemoveIndex(RangeVar *relation, DropBehavior behavior)
|
||||
errmsg("\"%s\" is not an index",
|
||||
relation->relname)));
|
||||
|
||||
object.classId = RelOid_pg_class;
|
||||
object.classId = RelationRelationId;
|
||||
object.objectId = indOid;
|
||||
object.objectSubId = 0;
|
||||
|
||||
@ -1027,7 +1030,7 @@ ReindexDatabase(const char *dbname, bool force /* currently unused */ ,
|
||||
* reindexing itself will try to update pg_class.
|
||||
*/
|
||||
old = MemoryContextSwitchTo(private_context);
|
||||
relids = lappend_oid(relids, RelOid_pg_class);
|
||||
relids = lappend_oid(relids, RelationRelationId);
|
||||
MemoryContextSwitchTo(old);
|
||||
|
||||
/*
|
||||
@ -1057,7 +1060,7 @@ ReindexDatabase(const char *dbname, bool force /* currently unused */ ,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (HeapTupleGetOid(tuple) == RelOid_pg_class)
|
||||
if (HeapTupleGetOid(tuple) == RelationRelationId)
|
||||
continue; /* got it already */
|
||||
|
||||
old = MemoryContextSwitchTo(private_context);
|
||||
|
Reference in New Issue
Block a user