summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-04-14 01:38:22 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-04-14 01:38:22 +0000
commit7c13781ee7a617235f24617e3bd7628cda95df15 (patch)
tree5815af97251619f856d480997c71ec9aab3b9262 /src/backend/commands
parent2193a856a229026673cbc56310cd0bddf7b5ea25 (diff)
downloadpostgresql-7c13781ee7a617235f24617e3bd7628cda95df15.tar.gz
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')
-rw-r--r--src/backend/commands/aggregatecmds.c4
-rw-r--r--src/backend/commands/cluster.c13
-rw-r--r--src/backend/commands/comment.c16
-rw-r--r--src/backend/commands/functioncmds.c10
-rw-r--r--src/backend/commands/indexcmds.c13
-rw-r--r--src/backend/commands/opclasscmds.c8
-rw-r--r--src/backend/commands/proclang.c6
-rw-r--r--src/backend/commands/tablecmds.c48
-rw-r--r--src/backend/commands/trigger.c8
-rw-r--r--src/backend/commands/typecmds.c10
-rw-r--r--src/backend/commands/user.c6
-rw-r--r--src/backend/commands/view.c4
12 files changed, 78 insertions, 68 deletions
diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c
index 32bf25389a..95c81b1aac 100644
--- a/src/backend/commands/aggregatecmds.c
+++ b/src/backend/commands/aggregatecmds.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.24 2005/04/12 04:26:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.25 2005/04/14 01:38:16 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -206,7 +206,7 @@ RemoveAggregate(RemoveAggrStmt *stmt)
/*
* Do the deletion
*/
- object.classId = RelOid_pg_proc;
+ object.classId = ProcedureRelationId;
object.objectId = procOid;
object.objectSubId = 0;
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index e29750c535..553a842069 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.134 2005/03/29 00:16:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.135 2005/04/14 01:38:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -527,7 +527,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid)
CommandCounterIncrement();
/* Destroy new heap with old filenode */
- object.classId = RelOid_pg_class;
+ object.classId = RelationRelationId;
object.objectId = OIDNewHeap;
object.objectSubId = 0;
@@ -570,6 +570,7 @@ make_new_heap(Oid OIDOldHeap, const char *NewName, Oid NewTableSpace)
OIDNewHeap = heap_create_with_catalog(NewName,
RelationGetNamespace(OldHeap),
NewTableSpace,
+ InvalidOid,
tupdesc,
OldHeap->rd_rel->relkind,
OldHeap->rd_rel->relisshared,
@@ -799,7 +800,7 @@ swap_relation_files(Oid r1, Oid r2)
/* Delete old dependencies */
if (relform1->reltoastrelid)
{
- count = deleteDependencyRecordsFor(RelOid_pg_class,
+ count = deleteDependencyRecordsFor(RelationRelationId,
relform1->reltoastrelid);
if (count != 1)
elog(ERROR, "expected one dependency record for TOAST table, found %ld",
@@ -807,7 +808,7 @@ swap_relation_files(Oid r1, Oid r2)
}
if (relform2->reltoastrelid)
{
- count = deleteDependencyRecordsFor(RelOid_pg_class,
+ count = deleteDependencyRecordsFor(RelationRelationId,
relform2->reltoastrelid);
if (count != 1)
elog(ERROR, "expected one dependency record for TOAST table, found %ld",
@@ -815,9 +816,9 @@ swap_relation_files(Oid r1, Oid r2)
}
/* Register new dependencies */
- baseobject.classId = RelOid_pg_class;
+ baseobject.classId = RelationRelationId;
baseobject.objectSubId = 0;
- toastobject.classId = RelOid_pg_class;
+ toastobject.classId = RelationRelationId;
toastobject.objectSubId = 0;
if (relform1->reltoastrelid)
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c
index 973719d805..68d498641b 100644
--- a/src/backend/commands/comment.c
+++ b/src/backend/commands/comment.c
@@ -7,7 +7,7 @@
* Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.81 2005/01/27 23:23:54 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.82 2005/04/14 01:38:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,9 +20,11 @@
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/pg_constraint.h"
+#include "catalog/pg_database.h"
#include "catalog/pg_description.h"
#include "catalog/pg_largeobject.h"
#include "catalog/pg_operator.h"
+#include "catalog/pg_proc.h"
#include "catalog/pg_rewrite.h"
#include "catalog/pg_trigger.h"
#include "catalog/pg_type.h"
@@ -352,7 +354,7 @@ CommentRelation(int objtype, List *relname, char *comment)
/* Create the comment using the relation's oid */
- CreateComments(RelationGetRelid(relation), RelOid_pg_class, 0, comment);
+ CreateComments(RelationGetRelid(relation), RelationRelationId, 0, comment);
/* Done, but hold lock until commit */
relation_close(relation, NoLock);
@@ -406,7 +408,7 @@ CommentAttribute(List *qualname, char *comment)
/* Create the comment using the relation's oid */
- CreateComments(RelationGetRelid(relation), RelOid_pg_class,
+ CreateComments(RelationGetRelid(relation), RelationRelationId,
(int32) attnum, comment);
/* Done, but hold lock until commit */
@@ -475,7 +477,7 @@ CommentDatabase(List *qualname, char *comment)
database);
/* Create the comment with the pg_database oid */
- CreateComments(oid, RelOid_pg_database, 0, comment);
+ CreateComments(oid, DatabaseRelationId, 0, comment);
}
/*
@@ -670,7 +672,7 @@ CommentType(List *typename, char *comment)
/* Call CreateComments() to create/drop the comments */
- CreateComments(oid, RelOid_pg_type, 0, comment);
+ CreateComments(oid, TypeRelationId, 0, comment);
}
/*
@@ -706,7 +708,7 @@ CommentAggregate(List *aggregate, List *arguments, char *comment)
/* Call CreateComments() to create/drop the comments */
- CreateComments(oid, RelOid_pg_proc, 0, comment);
+ CreateComments(oid, ProcedureRelationId, 0, comment);
}
/*
@@ -735,7 +737,7 @@ CommentProc(List *function, List *arguments, char *comment)
/* Call CreateComments() to create/drop the comments */
- CreateComments(oid, RelOid_pg_proc, 0, comment);
+ CreateComments(oid, ProcedureRelationId, 0, comment);
}
/*
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 5776738045..fc00b45bae 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.59 2005/03/31 22:46:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.60 2005/04/14 01:38:16 tgl Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@@ -719,7 +719,7 @@ RemoveFunction(RemoveFuncStmt *stmt)
/*
* Do the deletion
*/
- object.classId = RelOid_pg_proc;
+ object.classId = ProcedureRelationId;
object.objectId = funcOid;
object.objectSubId = 0;
@@ -1304,13 +1304,13 @@ CreateCast(CreateCastStmt *stmt)
myself.objectSubId = 0;
/* dependency on source type */
- referenced.classId = RelOid_pg_type;
+ referenced.classId = TypeRelationId;
referenced.objectId = sourcetypeid;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
/* dependency on target type */
- referenced.classId = RelOid_pg_type;
+ referenced.classId = TypeRelationId;
referenced.objectId = targettypeid;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
@@ -1318,7 +1318,7 @@ CreateCast(CreateCastStmt *stmt)
/* dependency on function */
if (OidIsValid(funcid))
{
- referenced.classId = RelOid_pg_proc;
+ referenced.classId = ProcedureRelationId;
referenced.objectId = funcid;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 469e7b3f02..01e3396efa 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);
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c
index 9af0ae15db..5d5ae51a82 100644
--- a/src/backend/commands/opclasscmds.c
+++ b/src/backend/commands/opclasscmds.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.30 2005/03/29 00:16:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.31 2005/04/14 01:38:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -356,7 +356,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
/* dependency on indexed datatype */
- referenced.classId = RelOid_pg_type;
+ referenced.classId = TypeRelationId;
referenced.objectId = typeoid;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
@@ -364,7 +364,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
/* dependency on storage datatype */
if (OidIsValid(storageoid))
{
- referenced.classId = RelOid_pg_type;
+ referenced.classId = TypeRelationId;
referenced.objectId = storageoid;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
@@ -386,7 +386,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
{
OpClassMember *proc = (OpClassMember *) lfirst(l);
- referenced.classId = RelOid_pg_proc;
+ referenced.classId = ProcedureRelationId;
referenced.objectId = proc->object;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c
index f50e0936c8..e94d5b4b28 100644
--- a/src/backend/commands/proclang.c
+++ b/src/backend/commands/proclang.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.58 2005/03/29 03:01:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.59 2005/04/14 01:38:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -149,7 +149,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
myself.objectSubId = 0;
/* dependency on the PL handler function */
- referenced.classId = RelOid_pg_proc;
+ referenced.classId = ProcedureRelationId;
referenced.objectId = procOid;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
@@ -157,7 +157,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
/* dependency on the validator function, if any */
if (OidIsValid(valProcOid))
{
- referenced.classId = RelOid_pg_proc;
+ referenced.classId = ProcedureRelationId;
referenced.objectId = valProcOid;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 79e36c64e7..3a88ea520b 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.153 2005/04/13 16:50:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.154 2005/04/14 01:38:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -424,6 +424,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
relationId = heap_create_with_catalog(relname,
namespaceId,
tablespaceId,
+ InvalidOid,
descriptor,
relkind,
false,
@@ -517,7 +518,7 @@ RemoveRelation(const RangeVar *relation, DropBehavior behavior)
relOid = RangeVarGetRelid(relation, false);
- object.classId = RelOid_pg_class;
+ object.classId = RelationRelationId;
object.objectId = relOid;
object.objectSubId = 0;
@@ -1163,10 +1164,10 @@ StoreCatalogInheritance(Oid relationId, List *supers)
/*
* Store a dependency too
*/
- parentobject.classId = RelOid_pg_class;
+ parentobject.classId = RelationRelationId;
parentobject.objectId = parentOid;
parentobject.objectSubId = 0;
- childobject.classId = RelOid_pg_class;
+ childobject.classId = RelationRelationId;
childobject.objectId = relationId;
childobject.objectSubId = 0;
@@ -2293,7 +2294,7 @@ ATRewriteTables(List **wqueue)
CommandCounterIncrement();
/* Destroy new heap with old filenode */
- object.classId = RelOid_pg_class;
+ object.classId = RelationRelationId;
object.objectId = OIDNewHeap;
object.objectSubId = 0;
@@ -2776,7 +2777,7 @@ find_composite_type_dependencies(Oid typeOid, const char *origTblName)
ScanKeyInit(&key[0],
Anum_pg_depend_refclassid,
BTEqualStrategyNumber, F_OIDEQ,
- ObjectIdGetDatum(RelOid_pg_type));
+ ObjectIdGetDatum(TypeRelationId));
ScanKeyInit(&key[1],
Anum_pg_depend_refobjid,
BTEqualStrategyNumber, F_OIDEQ,
@@ -2793,7 +2794,7 @@ find_composite_type_dependencies(Oid typeOid, const char *origTblName)
/* Ignore dependees that aren't user columns of relations */
/* (we assume system columns are never of rowtypes) */
- if (pg_depend->classid != RelOid_pg_class ||
+ if (pg_depend->classid != RelationRelationId ||
pg_depend->objsubid <= 0)
continue;
@@ -3112,10 +3113,10 @@ add_column_datatype_dependency(Oid relid, int32 attnum, Oid typid)
ObjectAddress myself,
referenced;
- myself.classId = RelOid_pg_class;
+ myself.classId = RelationRelationId;
myself.objectId = relid;
myself.objectSubId = attnum;
- referenced.classId = RelOid_pg_type;
+ referenced.classId = TypeRelationId;
referenced.objectId = typid;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
@@ -3130,10 +3131,10 @@ add_column_support_dependency(Oid relid, int32 attnum, RangeVar *support)
ObjectAddress colobject,
suppobject;
- colobject.classId = RelOid_pg_class;
+ colobject.classId = RelationRelationId;
colobject.objectId = relid;
colobject.objectSubId = attnum;
- suppobject.classId = RelOid_pg_class;
+ suppobject.classId = RelationRelationId;
suppobject.objectId = RangeVarGetRelid(support, false);
suppobject.objectSubId = 0;
recordDependencyOn(&suppobject, &colobject, DEPENDENCY_INTERNAL);
@@ -3637,7 +3638,7 @@ ATExecDropColumn(Relation rel, const char *colName,
/*
* Perform the actual column deletion
*/
- object.classId = RelOid_pg_class;
+ object.classId = RelationRelationId;
object.objectId = RelationGetRelid(rel);
object.objectSubId = attnum;
@@ -3697,6 +3698,7 @@ ATExecAddIndex(AlteredTableInfo *tab, Relation rel,
DefineIndex(stmt->relation, /* relation */
stmt->idxname, /* index name */
+ InvalidOid, /* no predefined OID */
stmt->accessMethod, /* am name */
stmt->tableSpace,
stmt->indexParams, /* parameters */
@@ -4894,7 +4896,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
ScanKeyInit(&key[0],
Anum_pg_depend_refclassid,
BTEqualStrategyNumber, F_OIDEQ,
- ObjectIdGetDatum(RelOid_pg_class));
+ ObjectIdGetDatum(RelationRelationId));
ScanKeyInit(&key[1],
Anum_pg_depend_refobjid,
BTEqualStrategyNumber, F_OIDEQ,
@@ -5018,7 +5020,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
ScanKeyInit(&key[0],
Anum_pg_depend_classid,
BTEqualStrategyNumber, F_OIDEQ,
- ObjectIdGetDatum(RelOid_pg_class));
+ ObjectIdGetDatum(RelationRelationId));
ScanKeyInit(&key[1],
Anum_pg_depend_objid,
BTEqualStrategyNumber, F_OIDEQ,
@@ -5038,7 +5040,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
if (foundDep->deptype != DEPENDENCY_NORMAL)
elog(ERROR, "found unexpected dependency type '%c'",
foundDep->deptype);
- if (foundDep->refclassid != RelOid_pg_type ||
+ if (foundDep->refclassid != TypeRelationId ||
foundDep->refobjid != attTup->atttypid)
elog(ERROR, "found unexpected dependency for column");
@@ -5143,7 +5145,7 @@ ATPostAlterTypeCleanup(List **wqueue, AlteredTableInfo *tab)
performDeletion(&obj, DROP_RESTRICT);
}
- obj.classId = RelOid_pg_class;
+ obj.classId = RelationRelationId;
foreach(l, tab->changedIndexOids)
{
obj.objectId = lfirst_oid(l);
@@ -5399,7 +5401,7 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId)
ScanKeyInit(&key[0],
Anum_pg_depend_refclassid,
BTEqualStrategyNumber, F_OIDEQ,
- ObjectIdGetDatum(RelOid_pg_class));
+ ObjectIdGetDatum(RelationRelationId));
ScanKeyInit(&key[1],
Anum_pg_depend_refobjid,
BTEqualStrategyNumber, F_OIDEQ,
@@ -5416,7 +5418,7 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId)
/* skip dependencies other than internal dependencies on columns */
if (depForm->refobjsubid == 0 ||
- depForm->classid != RelOid_pg_class ||
+ depForm->classid != RelationRelationId ||
depForm->objsubid != 0 ||
depForm->deptype != DEPENDENCY_INTERNAL)
continue;
@@ -5853,6 +5855,7 @@ AlterTableCreateToastTable(Oid relOid, bool silent)
toast_relid = heap_create_with_catalog(toast_relname,
PG_TOAST_NAMESPACE,
rel->rd_rel->reltablespace,
+ InvalidOid,
tupdesc,
RELKIND_TOASTVALUE,
shared_relation,
@@ -5889,7 +5892,8 @@ AlterTableCreateToastTable(Oid relOid, bool silent)
classObjectId[0] = OID_BTREE_OPS_OID;
classObjectId[1] = INT4_BTREE_OPS_OID;
- toast_idxid = index_create(toast_relid, toast_idxname, indexInfo,
+ toast_idxid = index_create(toast_relid, toast_idxname, InvalidOid,
+ indexInfo,
BTREE_AM_OID,
rel->rd_rel->reltablespace,
classObjectId,
@@ -5928,10 +5932,10 @@ AlterTableCreateToastTable(Oid relOid, bool silent)
* Register dependency from the toast table to the master, so that the
* toast table will be deleted if the master is.
*/
- baseobject.classId = RelOid_pg_class;
+ baseobject.classId = RelationRelationId;
baseobject.objectId = relOid;
baseobject.objectSubId = 0;
- toastobject.classId = RelOid_pg_class;
+ toastobject.classId = RelationRelationId;
toastobject.objectId = toast_relid;
toastobject.objectSubId = 0;
@@ -6091,7 +6095,7 @@ PreCommit_on_commit_actions(void)
{
ObjectAddress object;
- object.classId = RelOid_pg_class;
+ object.classId = RelationRelationId;
object.objectId = oc->relid;
object.objectSubId = 0;
performDeletion(&object, DROP_CASCADE);
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 8c8ed9e21c..851aed3b6d 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.184 2005/04/11 19:51:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.185 2005/04/14 01:38:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -422,20 +422,20 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
* dependency on the constraint will indirectly depend on the
* relations.
*/
- referenced.classId = RelOid_pg_proc;
+ referenced.classId = ProcedureRelationId;
referenced.objectId = funcoid;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
if (!forConstraint)
{
- referenced.classId = RelOid_pg_class;
+ referenced.classId = RelationRelationId;
referenced.objectId = RelationGetRelid(rel);
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_AUTO);
if (constrrelid != InvalidOid)
{
- referenced.classId = RelOid_pg_class;
+ referenced.classId = RelationRelationId;
referenced.objectId = constrrelid;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced, DEPENDENCY_AUTO);
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 5fd01c6f59..0af04f86f5 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.68 2005/03/29 03:01:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.69 2005/04/14 01:38:17 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -441,7 +441,7 @@ RemoveType(List *names, DropBehavior behavior)
/*
* Do the deletion
*/
- object.classId = RelOid_pg_type;
+ object.classId = TypeRelationId;
object.objectId = typeoid;
object.objectSubId = 0;
@@ -836,7 +836,7 @@ RemoveDomain(List *names, DropBehavior behavior)
/*
* Do the deletion
*/
- object.classId = RelOid_pg_type;
+ object.classId = TypeRelationId;
object.objectId = typeoid;
object.objectSubId = 0;
@@ -1655,7 +1655,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
ScanKeyInit(&key[0],
Anum_pg_depend_refclassid,
BTEqualStrategyNumber, F_OIDEQ,
- ObjectIdGetDatum(RelOid_pg_type));
+ ObjectIdGetDatum(TypeRelationId));
ScanKeyInit(&key[1],
Anum_pg_depend_refobjid,
BTEqualStrategyNumber, F_OIDEQ,
@@ -1674,7 +1674,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
/* Ignore dependees that aren't user columns of relations */
/* (we assume system columns are never of domain types) */
- if (pg_depend->classid != RelOid_pg_class ||
+ if (pg_depend->classid != RelationRelationId ||
pg_depend->objsubid <= 0)
continue;
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 6136e99519..12dd14ff1b 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.149 2005/02/20 02:21:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.150 2005/04/14 01:38:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -813,10 +813,10 @@ CheckPgUserAclNotNull(void)
HeapTuple htup;
htup = SearchSysCache(RELOID,
- ObjectIdGetDatum(RelOid_pg_shadow),
+ ObjectIdGetDatum(ShadowRelationId),
0, 0, 0);
if (!HeapTupleIsValid(htup)) /* should not happen, we hope */
- elog(ERROR, "cache lookup failed for relation %u", RelOid_pg_shadow);
+ elog(ERROR, "cache lookup failed for relation %u", ShadowRelationId);
if (heap_attisnull(htup, Anum_pg_class_relacl))
ereport(ERROR,
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index 81421f2a7b..6158b16654 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.89 2005/04/13 16:50:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.90 2005/04/14 01:38:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -448,7 +448,7 @@ RemoveView(const RangeVar *view, DropBehavior behavior)
viewOid = RangeVarGetRelid(view, false);
- object.classId = RelOid_pg_class;
+ object.classId = RelationRelationId;
object.objectId = viewOid;
object.objectSubId = 0;