diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-14 01:38:22 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-14 01:38:22 +0000 |
commit | 7c13781ee7a617235f24617e3bd7628cda95df15 (patch) | |
tree | 5815af97251619f856d480997c71ec9aab3b9262 /src/backend/commands/indexcmds.c | |
parent | 2193a856a229026673cbc56310cd0bddf7b5ea25 (diff) | |
download | postgresql-7c13781ee7a617235f24617e3bd7628cda95df15.tar.gz postgresql-7c13781ee7a617235f24617e3bd7628cda95df15.zip |
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.
Diffstat (limited to 'src/backend/commands/indexcmds.c')
-rw-r--r-- | src/backend/commands/indexcmds.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 469e7b3f02b..01e3396efa5 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -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); |