diff options
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/aggregatecmds.c | 7 | ||||
-rw-r--r-- | src/backend/commands/analyze.c | 8 | ||||
-rw-r--r-- | src/backend/commands/async.c | 13 | ||||
-rw-r--r-- | src/backend/commands/cluster.c | 9 | ||||
-rw-r--r-- | src/backend/commands/comment.c | 93 | ||||
-rw-r--r-- | src/backend/commands/conversioncmds.c | 7 | ||||
-rw-r--r-- | src/backend/commands/copy.c | 3 | ||||
-rw-r--r-- | src/backend/commands/dbcommands.c | 41 | ||||
-rw-r--r-- | src/backend/commands/functioncmds.c | 28 | ||||
-rw-r--r-- | src/backend/commands/indexcmds.c | 5 | ||||
-rw-r--r-- | src/backend/commands/opclasscmds.c | 34 | ||||
-rw-r--r-- | src/backend/commands/operatorcmds.c | 9 | ||||
-rw-r--r-- | src/backend/commands/proclang.c | 13 | ||||
-rw-r--r-- | src/backend/commands/schemacmds.c | 11 | ||||
-rw-r--r-- | src/backend/commands/tablecmds.c | 64 | ||||
-rw-r--r-- | src/backend/commands/tablespace.c | 17 | ||||
-rw-r--r-- | src/backend/commands/trigger.c | 39 | ||||
-rw-r--r-- | src/backend/commands/typecmds.c | 29 | ||||
-rw-r--r-- | src/backend/commands/user.c | 35 | ||||
-rw-r--r-- | src/backend/commands/vacuum.c | 11 |
20 files changed, 214 insertions, 262 deletions
diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c index 95c81b1aac4..9833937b705 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.25 2005/04/14 01:38:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.26 2005/04/14 20:03:23 tgl Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -23,7 +23,6 @@ #include "postgres.h" #include "access/heapam.h" -#include "catalog/catname.h" #include "catalog/dependency.h" #include "catalog/indexing.h" #include "catalog/namespace.h" @@ -236,7 +235,7 @@ RenameAggregate(List *name, TypeName *basetype, const char *newname) else basetypeOid = ANYOID; - rel = heap_openr(ProcedureRelationName, RowExclusiveLock); + rel = heap_open(ProcedureRelationId, RowExclusiveLock); procOid = find_aggregate_func(name, basetypeOid, false); @@ -315,7 +314,7 @@ AlterAggregateOwner(List *name, TypeName *basetype, AclId newOwnerSysId) else basetypeOid = ANYOID; - rel = heap_openr(ProcedureRelationName, RowExclusiveLock); + rel = heap_open(ProcedureRelationId, RowExclusiveLock); procOid = find_aggregate_func(name, basetypeOid, false); diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 94e1971a4df..34bb0be1516 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.84 2005/03/21 01:24:02 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.85 2005/04/14 20:03:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,7 +19,6 @@ #include "access/heapam.h" #include "access/tuptoaster.h" #include "catalog/catalog.h" -#include "catalog/catname.h" #include "catalog/index.h" #include "catalog/indexing.h" #include "catalog/namespace.h" @@ -187,8 +186,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt) /* * We can ANALYZE any table except pg_statistic. See update_attstats */ - if (IsSystemNamespace(RelationGetNamespace(onerel)) && - strcmp(RelationGetRelationName(onerel), StatisticRelationName) == 0) + if (RelationGetRelid(onerel) == StatisticRelationId) { relation_close(onerel, AccessShareLock); return; @@ -1091,7 +1089,7 @@ update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats) if (natts <= 0) return; /* nothing to do */ - sd = heap_openr(StatisticRelationName, RowExclusiveLock); + sd = heap_open(StatisticRelationId, RowExclusiveLock); for (attno = 0; attno < natts; attno++) { diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 11ad8c69bce..3ddb9ae1a7c 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.120 2005/03/20 23:40:24 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.121 2005/04/14 20:03:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -79,7 +79,6 @@ #include <netinet/in.h> #include "access/heapam.h" -#include "catalog/catname.h" #include "catalog/pg_listener.h" #include "commands/async.h" #include "libpq/libpq.h" @@ -205,7 +204,7 @@ Async_Listen(char *relname, int pid) if (Trace_notify) elog(DEBUG1, "Async_Listen(%s,%d)", relname, pid); - lRel = heap_openr(ListenerRelationName, ExclusiveLock); + lRel = heap_open(ListenerRelationId, ExclusiveLock); /* Detect whether we are already listening on this relname */ scan = heap_beginscan(lRel, SnapshotNow, 0, NULL); @@ -299,7 +298,7 @@ Async_Unlisten(char *relname, int pid) if (Trace_notify) elog(DEBUG1, "Async_Unlisten(%s,%d)", relname, pid); - lRel = heap_openr(ListenerRelationName, ExclusiveLock); + lRel = heap_open(ListenerRelationId, ExclusiveLock); scan = heap_beginscan(lRel, SnapshotNow, 0, NULL); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) @@ -357,7 +356,7 @@ Async_UnlistenAll(void) if (Trace_notify) elog(DEBUG1, "Async_UnlistenAll"); - lRel = heap_openr(ListenerRelationName, ExclusiveLock); + lRel = heap_open(ListenerRelationId, ExclusiveLock); tdesc = RelationGetDescr(lRel); /* Find and delete all entries with my listenerPID */ @@ -466,7 +465,7 @@ AtCommit_Notify(void) value[0] = value[1] = value[2] = (Datum) 0; value[Anum_pg_listener_notify - 1] = Int32GetDatum(MyProcPid); - lRel = heap_openr(ListenerRelationName, ExclusiveLock); + lRel = heap_open(ListenerRelationId, ExclusiveLock); tdesc = RelationGetDescr(lRel); scan = heap_beginscan(lRel, SnapshotNow, 0, NULL); @@ -902,7 +901,7 @@ ProcessIncomingNotify(void) StartTransactionCommand(); - lRel = heap_openr(ListenerRelationName, ExclusiveLock); + lRel = heap_open(ListenerRelationId, ExclusiveLock); tdesc = RelationGetDescr(lRel); /* Scan only entries with my listenerPID */ diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 553a8420699..e1c5a0ef778 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.135 2005/04/14 01:38:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.136 2005/04/14 20:03:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,6 @@ #include "access/genam.h" #include "access/heapam.h" #include "catalog/catalog.h" -#include "catalog/catname.h" #include "catalog/dependency.h" #include "catalog/heap.h" #include "catalog/index.h" @@ -434,7 +433,7 @@ mark_index_clustered(Relation rel, Oid indexOid) /* * Check each index of the relation and set/clear the bit as needed. */ - pg_index = heap_openr(IndexRelationName, RowExclusiveLock); + pg_index = heap_open(IndexRelationId, RowExclusiveLock); foreach(index, RelationGetIndexList(rel)) { @@ -719,7 +718,7 @@ swap_relation_files(Oid r1, Oid r2) CatalogIndexState indstate; /* We need writable copies of both pg_class tuples. */ - relRelation = heap_openr(RelationRelationName, RowExclusiveLock); + relRelation = heap_open(RelationRelationId, RowExclusiveLock); reltup1 = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(r1), @@ -883,7 +882,7 @@ get_tables_to_cluster(MemoryContext cluster_context) * ever have indisclustered set, because CLUSTER will refuse to set it * when called with one of them as argument. */ - indRelation = relation_openr(IndexRelationName, AccessShareLock); + indRelation = heap_open(IndexRelationId, AccessShareLock); ScanKeyInit(&entry, Anum_pg_index_indisclustered, BTEqualStrategyNumber, F_BOOLEQ, diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c index 68d498641b8..8177e39c71c 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.82 2005/04/14 01:38:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.83 2005/04/14 20:03:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -16,13 +16,17 @@ #include "access/genam.h" #include "access/heapam.h" -#include "catalog/catname.h" #include "catalog/indexing.h" #include "catalog/namespace.h" +#include "catalog/pg_cast.h" #include "catalog/pg_constraint.h" +#include "catalog/pg_conversion.h" #include "catalog/pg_database.h" #include "catalog/pg_description.h" +#include "catalog/pg_language.h" #include "catalog/pg_largeobject.h" +#include "catalog/pg_namespace.h" +#include "catalog/pg_opclass.h" #include "catalog/pg_operator.h" #include "catalog/pg_proc.h" #include "catalog/pg_rewrite.h" @@ -192,9 +196,9 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment) BTEqualStrategyNumber, F_INT4EQ, Int32GetDatum(subid)); - description = heap_openr(DescriptionRelationName, RowExclusiveLock); + description = heap_open(DescriptionRelationId, RowExclusiveLock); - sd = systable_beginscan(description, DescriptionObjIndex, true, + sd = systable_beginscan(description, DescriptionObjIndexId, true, SnapshotNow, 3, skey); while ((oldtuple = systable_getnext(sd)) != NULL) @@ -274,9 +278,9 @@ DeleteComments(Oid oid, Oid classoid, int32 subid) else nkeys = 2; - description = heap_openr(DescriptionRelationName, RowExclusiveLock); + description = heap_open(DescriptionRelationId, RowExclusiveLock); - sd = systable_beginscan(description, DescriptionObjIndex, true, + sd = systable_beginscan(description, DescriptionObjIndexId, true, SnapshotNow, nkeys, skey); while ((oldtuple = systable_getnext(sd)) != NULL) @@ -353,8 +357,8 @@ CommentRelation(int objtype, List *relname, char *comment) } /* Create the comment using the relation's oid */ - - CreateComments(RelationGetRelid(relation), RelationRelationId, 0, comment); + CreateComments(RelationGetRelid(relation), RelationRelationId, + 0, comment); /* Done, but hold lock until commit */ relation_close(relation, NoLock); @@ -407,7 +411,6 @@ CommentAttribute(List *qualname, char *comment) attrname, RelationGetRelationName(relation)))); /* Create the comment using the relation's oid */ - CreateComments(RelationGetRelid(relation), RelationRelationId, (int32) attnum, comment); @@ -476,7 +479,7 @@ CommentDatabase(List *qualname, char *comment) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE, database); - /* Create the comment with the pg_database oid */ + /* Call CreateComments() to create/drop the comments */ CreateComments(oid, DatabaseRelationId, 0, comment); } @@ -493,7 +496,6 @@ static void CommentNamespace(List *qualname, char *comment) { Oid oid; - Oid classoid; char *namespace; if (list_length(qualname) != 1) @@ -515,11 +517,8 @@ CommentNamespace(List *qualname, char *comment) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_NAMESPACE, namespace); - /* pg_namespace doesn't have a hard-coded OID, so must look it up */ - classoid = get_system_catalog_relid(NamespaceRelationName); - /* Call CreateComments() to create/drop the comments */ - CreateComments(oid, classoid, 0, comment); + CreateComments(oid, NamespaceRelationId, 0, comment); } /* @@ -547,7 +546,6 @@ CommentRule(List *qualname, char *comment) HeapTuple tuple; Oid reloid; Oid ruleoid; - Oid classoid; AclResult aclcheck; /* Separate relname and trig name */ @@ -567,7 +565,7 @@ CommentRule(List *qualname, char *comment) BTEqualStrategyNumber, F_NAMEEQ, PointerGetDatum(rulename)); - RewriteRelation = heap_openr(RewriteRelationName, AccessShareLock); + RewriteRelation = heap_open(RewriteRelationId, AccessShareLock); scanDesc = heap_beginscan(RewriteRelation, SnapshotNow, 1, &scanKeyData); @@ -631,11 +629,8 @@ CommentRule(List *qualname, char *comment) aclcheck_error(aclcheck, ACL_KIND_CLASS, get_rel_name(reloid)); - /* pg_rewrite doesn't have a hard-coded OID, so must look it up */ - classoid = get_system_catalog_relid(RewriteRelationName); - /* Call CreateComments() to create/drop the comments */ - CreateComments(ruleoid, classoid, 0, comment); + CreateComments(ruleoid, RewriteRelationId, 0, comment); heap_close(relation, NoLock); } @@ -671,7 +666,6 @@ CommentType(List *typename, char *comment) TypeNameToString(tname)); /* Call CreateComments() to create/drop the comments */ - CreateComments(oid, TypeRelationId, 0, comment); } @@ -707,7 +701,6 @@ CommentAggregate(List *aggregate, List *arguments, char *comment) NameListToString(aggregate)); /* Call CreateComments() to create/drop the comments */ - CreateComments(oid, ProcedureRelationId, 0, comment); } @@ -736,7 +729,6 @@ CommentProc(List *function, List *arguments, char *comment) NameListToString(function)); /* Call CreateComments() to create/drop the comments */ - CreateComments(oid, ProcedureRelationId, 0, comment); } @@ -756,7 +748,6 @@ CommentOperator(List *opername, List *arguments, char *comment) TypeName *typenode1 = (TypeName *) linitial(arguments); TypeName *typenode2 = (TypeName *) lsecond(arguments); Oid oid; - Oid classoid; /* Look up the operator */ oid = LookupOperNameTypeNames(opername, typenode1, typenode2, false); @@ -766,11 +757,8 @@ CommentOperator(List *opername, List *arguments, char *comment) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPER, NameListToString(opername)); - /* pg_operator doesn't have a hard-coded OID, so must look it up */ - classoid = get_system_catalog_relid(OperatorRelationName); - /* Call CreateComments() to create/drop the comments */ - CreateComments(oid, classoid, 0, comment); + CreateComments(oid, OperatorRelationId, 0, comment); } /* @@ -817,7 +805,7 @@ CommentTrigger(List *qualname, char *comment) * Fetch the trigger tuple from pg_trigger. There can be only one * because of the unique index. */ - pg_trigger = heap_openr(TriggerRelationName, AccessShareLock); + pg_trigger = heap_open(TriggerRelationId, AccessShareLock); ScanKeyInit(&entry[0], Anum_pg_trigger_tgrelid, BTEqualStrategyNumber, F_OIDEQ, @@ -826,7 +814,7 @@ CommentTrigger(List *qualname, char *comment) Anum_pg_trigger_tgname, BTEqualStrategyNumber, F_NAMEEQ, CStringGetDatum(trigname)); - scan = systable_beginscan(pg_trigger, TriggerRelidNameIndex, true, + scan = systable_beginscan(pg_trigger, TriggerRelidNameIndexId, true, SnapshotNow, 2, entry); triggertuple = systable_getnext(scan); @@ -842,9 +830,8 @@ CommentTrigger(List *qualname, char *comment) systable_endscan(scan); - /* Create the comment with the pg_trigger oid */ - - CreateComments(oid, RelationGetRelid(pg_trigger), 0, comment); + /* Call CreateComments() to create/drop the comments */ + CreateComments(oid, TriggerRelationId, 0, comment); /* Done, but hold lock on relation */ @@ -896,14 +883,14 @@ CommentConstraint(List *qualname, char *comment) * than one match, because constraints are not required to have unique * names; if so, error out. */ - pg_constraint = heap_openr(ConstraintRelationName, AccessShareLock); + pg_constraint = heap_open(ConstraintRelationId, AccessShareLock); ScanKeyInit(&skey[0], Anum_pg_constraint_conrelid, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(RelationGetRelid(relation))); - scan = systable_beginscan(pg_constraint, ConstraintRelidIndex, true, + scan = systable_beginscan(pg_constraint, ConstraintRelidIndexId, true, SnapshotNow, 1, skey); while (HeapTupleIsValid(tuple = systable_getnext(scan))) @@ -930,8 +917,8 @@ CommentConstraint(List *qualname, char *comment) errmsg("constraint \"%s\" for table \"%s\" does not exist", conName, RelationGetRelationName(relation)))); - /* Create the comment with the pg_constraint oid */ - CreateComments(conOid, RelationGetRelid(pg_constraint), 0, comment); + /* Call CreateComments() to create/drop the comments */ + CreateComments(conOid, ConstraintRelationId, 0, comment); /* Done, but hold lock on relation */ heap_close(pg_constraint, AccessShareLock); @@ -951,7 +938,6 @@ static void CommentConversion(List *qualname, char *comment) { Oid conversionOid; - Oid classoid; conversionOid = FindConversionByName(qualname); if (!OidIsValid(conversionOid)) @@ -965,11 +951,8 @@ CommentConversion(List *qualname, char *comment) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CONVERSION, NameListToString(qualname)); - /* pg_conversion doesn't have a hard-coded OID, so must look it up */ - classoid = get_system_catalog_relid(ConversionRelationName); - /* Call CreateComments() to create/drop the comments */ - CreateComments(conversionOid, classoid, 0, comment); + CreateComments(conversionOid, ConversionRelationId, 0, comment); } /* @@ -985,7 +968,6 @@ static void CommentLanguage(List *qualname, char *comment) { Oid oid; - Oid classoid; char *language; if (list_length(qualname) != 1) @@ -1008,11 +990,8 @@ CommentLanguage(List *qualname, char *comment) (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be superuser to comment on procedural language"))); - /* pg_language doesn't have a hard-coded OID, so must look it up */ - classoid = get_system_catalog_relid(LanguageRelationName); - /* Call CreateComments() to create/drop the comments */ - CreateComments(oid, classoid, 0, comment); + CreateComments(oid, LanguageRelationId, 0, comment); } /* @@ -1032,7 +1011,6 @@ CommentOpClass(List *qualname, List *arguments, char *comment) char *opcname; Oid amID; Oid opcID; - Oid classoid; HeapTuple tuple; Assert(list_length(arguments) == 1); @@ -1098,11 +1076,8 @@ CommentOpClass(List *qualname, List *arguments, char *comment) ReleaseSysCache(tuple); - /* pg_opclass doesn't have a hard-coded OID, so must look it up */ - classoid = get_system_catalog_relid(OperatorClassRelationName); - /* Call CreateComments() to create/drop the comments */ - CreateComments(opcID, classoid, 0, comment); + CreateComments(opcID, OperatorClassRelationId, 0, comment); } /* @@ -1118,7 +1093,6 @@ static void CommentLargeObject(List *qualname, char *comment) { Oid loid; - Oid classoid; Node *node; Assert(list_length(qualname) == 1); @@ -1152,11 +1126,8 @@ CommentLargeObject(List *qualname, char *comment) (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("large object %u does not exist", loid))); - /* pg_largeobject doesn't have a hard-coded OID, so must look it up */ - classoid = get_system_catalog_relid(LargeObjectRelationName); - /* Call CreateComments() to create/drop the comments */ - CreateComments(loid, classoid, 0, comment); + CreateComments(loid, LargeObjectRelationId, 0, comment); } /* @@ -1178,7 +1149,6 @@ CommentCast(List *qualname, List *arguments, char *comment) Oid targettypeid; HeapTuple tuple; Oid castOid; - Oid classoid; Assert(list_length(qualname) == 1); sourcetype = (TypeName *) linitial(qualname); @@ -1226,9 +1196,6 @@ CommentCast(List *qualname, List *arguments, char *comment) ReleaseSysCache(tuple); - /* pg_cast doesn't have a hard-coded OID, so must look it up */ - classoid = get_system_catalog_relid(CastRelationName); - /* Call CreateComments() to create/drop the comments */ - CreateComments(castOid, classoid, 0, comment); + CreateComments(castOid, CastRelationId, 0, comment); } diff --git a/src/backend/commands/conversioncmds.c b/src/backend/commands/conversioncmds.c index 2f87caf3a8e..c42580d624b 100644 --- a/src/backend/commands/conversioncmds.c +++ b/src/backend/commands/conversioncmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.16 2004/12/31 21:59:41 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.17 2005/04/14 20:03:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,6 @@ #include "catalog/pg_conversion.h" #include "access/heapam.h" #include "catalog/catalog.h" -#include "catalog/catname.h" #include "catalog/indexing.h" #include "catalog/namespace.h" #include "catalog/pg_type.h" @@ -124,7 +123,7 @@ RenameConversion(List *name, const char *newname) Relation rel; AclResult aclresult; - rel = heap_openr(ConversionRelationName, RowExclusiveLock); + rel = heap_open(ConversionRelationId, RowExclusiveLock); conversionOid = FindConversionByName(name); if (!OidIsValid(conversionOid)) @@ -183,7 +182,7 @@ AlterConversionOwner(List *name, AclId newOwnerSysId) Relation rel; Form_pg_conversion convForm; - rel = heap_openr(ConversionRelationName, RowExclusiveLock); + rel = heap_open(ConversionRelationId, RowExclusiveLock); conversionOid = FindConversionByName(name); if (!OidIsValid(conversionOid)) diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 3713a039b4f..26c270926d8 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.239 2005/03/25 21:57:57 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.240 2005/04/14 20:03:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -22,7 +22,6 @@ #include "access/genam.h" #include "access/heapam.h" #include "access/printtup.h" -#include "catalog/catname.h" #include "catalog/index.h" #include "catalog/namespace.h" #include "catalog/pg_index.h" diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 3473e98cde0..ec04619175b 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.155 2005/03/23 00:03:28 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.156 2005/04/14 20:03:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,7 +27,6 @@ #include "access/genam.h" #include "access/heapam.h" -#include "catalog/catname.h" #include "catalog/catalog.h" #include "catalog/pg_database.h" #include "catalog/pg_shadow.h" @@ -364,7 +363,7 @@ createdb(const CreatedbStmt *stmt) * Iterate through all tablespaces of the template database, and copy * each one to the new database. */ - rel = heap_openr(TableSpaceRelationName, AccessShareLock); + rel = heap_open(TableSpaceRelationId, AccessShareLock); scan = heap_beginscan(rel, SnapshotNow, 0, NULL); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { @@ -459,7 +458,7 @@ createdb(const CreatedbStmt *stmt) /* * Now OK to grab exclusive lock on pg_database. */ - pg_database_rel = heap_openr(DatabaseRelationName, ExclusiveLock); + pg_database_rel = heap_open(DatabaseRelationId, ExclusiveLock); /* Check to see if someone else created same DB name meanwhile. */ if (get_db_info(dbname, NULL, NULL, NULL, @@ -557,7 +556,7 @@ dropdb(const char *dbname) * since ReverifyMyDatabase takes RowShareLock. This allows ordinary * readers of pg_database to proceed in parallel. */ - pgdbrel = heap_openr(DatabaseRelationName, ExclusiveLock); + pgdbrel = heap_open(DatabaseRelationId, ExclusiveLock); if (!get_db_info(dbname, &db_id, &db_owner, NULL, &db_istemplate, NULL, NULL, NULL, NULL, NULL)) @@ -596,7 +595,7 @@ dropdb(const char *dbname) BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(db_id)); - pgdbscan = systable_beginscan(pgdbrel, DatabaseOidIndex, true, + pgdbscan = systable_beginscan(pgdbrel, DatabaseOidIndexId, true, SnapshotNow, 1, &key); tup = systable_getnext(pgdbscan); @@ -621,7 +620,7 @@ dropdb(const char *dbname) * NOTE: this is probably dead code since any such comments should have * been in that database, not mine. */ - DeleteComments(db_id, RelationGetRelid(pgdbrel), 0); + DeleteComments(db_id, DatabaseRelationId, 0); /* * Drop pages for this database that are in the shared buffer cache. @@ -676,13 +675,13 @@ RenameDatabase(const char *oldname, const char *newname) * Obtain ExclusiveLock so that no new session gets started * while the rename is in progress. */ - rel = heap_openr(DatabaseRelationName, ExclusiveLock); + rel = heap_open(DatabaseRelationId, ExclusiveLock); ScanKeyInit(&key, Anum_pg_database_datname, BTEqualStrategyNumber, F_NAMEEQ, NameGetDatum(oldname)); - scan = systable_beginscan(rel, DatabaseNameIndex, true, + scan = systable_beginscan(rel, DatabaseNameIndexId, true, SnapshotNow, 1, &key); tup = systable_getnext(scan); @@ -717,7 +716,7 @@ RenameDatabase(const char *oldname, const char *newname) Anum_pg_database_datname, BTEqualStrategyNumber, F_NAMEEQ, NameGetDatum(newname)); - scan2 = systable_beginscan(rel, DatabaseNameIndex, true, + scan2 = systable_beginscan(rel, DatabaseNameIndexId, true, SnapshotNow, 1, &key2); if (HeapTupleIsValid(systable_getnext(scan2))) ereport(ERROR, @@ -776,12 +775,12 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt) * We don't need ExclusiveLock since we aren't updating the * flat file. */ - rel = heap_openr(DatabaseRelationName, RowExclusiveLock); + rel = heap_open(DatabaseRelationId, RowExclusiveLock); ScanKeyInit(&scankey, Anum_pg_database_datname, BTEqualStrategyNumber, F_NAMEEQ, NameGetDatum(stmt->dbname)); - scan = systable_beginscan(rel, DatabaseNameIndex, true, + scan = systable_beginscan(rel, DatabaseNameIndexId, true, SnapshotNow, 1, &scankey); tuple = systable_getnext(scan); if (!HeapTupleIsValid(tuple)) @@ -861,12 +860,12 @@ AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId) * We don't need ExclusiveLock since we aren't updating the * flat file. */ - rel = heap_openr(DatabaseRelationName, RowExclusiveLock); + rel = heap_open(DatabaseRelationId, RowExclusiveLock); ScanKeyInit(&scankey, Anum_pg_database_datname, BTEqualStrategyNumber, F_NAMEEQ, NameGetDatum(dbname)); - scan = systable_beginscan(rel, DatabaseNameIndex, true, + scan = systable_beginscan(rel, DatabaseNameIndexId, true, SnapshotNow, 1, &scankey); tuple = systable_getnext(scan); if (!HeapTupleIsValid(tuple)) @@ -958,14 +957,14 @@ get_db_info(const char *name, Oid *dbIdP, int4 *ownerIdP, AssertArg(name); /* Caller may wish to grab a better lock on pg_database beforehand... */ - relation = heap_openr(DatabaseRelationName, AccessShareLock); + relation = heap_open(DatabaseRelationId, AccessShareLock); ScanKeyInit(&scanKey, Anum_pg_database_datname, BTEqualStrategyNumber, F_NAMEEQ, NameGetDatum(name)); - scan = systable_beginscan(relation, DatabaseNameIndex, true, + scan = systable_beginscan(relation, DatabaseNameIndexId, true, SnapshotNow, 1, &scanKey); tuple = systable_getnext(scan); @@ -1041,7 +1040,7 @@ remove_dbtablespaces(Oid db_id) HeapScanDesc scan; HeapTuple tuple; - rel = heap_openr(TableSpaceRelationName, AccessShareLock); + rel = heap_open(TableSpaceRelationId, AccessShareLock); scan = heap_beginscan(rel, SnapshotNow, 0, NULL); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { @@ -1108,12 +1107,12 @@ get_database_oid(const char *dbname) Oid oid; /* There's no syscache for pg_database, so must look the hard way */ - pg_database = heap_openr(DatabaseRelationName, AccessShareLock); + pg_database = heap_open(DatabaseRelationId, AccessShareLock); ScanKeyInit(&entry[0], Anum_pg_database_datname, BTEqualStrategyNumber, F_NAMEEQ, CStringGetDatum(dbname)); - scan = systable_beginscan(pg_database, DatabaseNameIndex, true, + scan = systable_beginscan(pg_database, DatabaseNameIndexId, true, SnapshotNow, 1, entry); dbtuple = systable_getnext(scan); @@ -1148,12 +1147,12 @@ get_database_name(Oid dbid) char *result; /* There's no syscache for pg_database, so must look the hard way */ - pg_database = heap_openr(DatabaseRelationName, AccessShareLock); + pg_database = heap_open(DatabaseRelationId, AccessShareLock); ScanKeyInit(&entry[0], ObjectIdAttributeNumber, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(dbid)); - scan = systable_beginscan(pg_database, DatabaseOidIndex, true, + scan = systable_beginscan(pg_database, DatabaseOidIndexId, true, SnapshotNow, 1, entry); dbtuple = systable_getnext(scan); diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index fc00b45baec..ea3c3811837 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.60 2005/04/14 01:38:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.61 2005/04/14 20:03:23 tgl Exp $ * * DESCRIPTION * These routines take the parse tree and pick out the @@ -34,10 +34,10 @@ #include "access/genam.h" #include "access/heapam.h" -#include "catalog/catname.h" #include "catalog/dependency.h" #include "catalog/indexing.h" #include "catalog/namespace.h" +#include "catalog/pg_aggregate.h" #include "catalog/pg_cast.h" #include "catalog/pg_language.h" #include "catalog/pg_proc.h" @@ -742,7 +742,7 @@ RemoveFunctionById(Oid funcOid) /* * Delete the pg_proc tuple. */ - relation = heap_openr(ProcedureRelationName, RowExclusiveLock); + relation = heap_open(ProcedureRelationId, RowExclusiveLock); tup = SearchSysCache(PROCOID, ObjectIdGetDatum(funcOid), @@ -763,7 +763,7 @@ RemoveFunctionById(Oid funcOid) */ if (isagg) { - relation = heap_openr(AggregateRelationName, RowExclusiveLock); + relation = heap_open(AggregateRelationId, RowExclusiveLock); tup = SearchSysCache(AGGFNOID, ObjectIdGetDatum(funcOid), @@ -793,7 +793,7 @@ RenameFunction(List *name, List *argtypes, const char *newname) Relation rel; AclResult aclresult; - rel = heap_openr(ProcedureRelationName, RowExclusiveLock); + rel = heap_open(ProcedureRelationId, RowExclusiveLock); procOid = LookupFuncNameTypeNames(name, argtypes, false); @@ -860,7 +860,7 @@ AlterFunctionOwner(List *name, List *argtypes, AclId newOwnerSysId) Form_pg_proc procForm; Relation rel; - rel = heap_openr(ProcedureRelationName, RowExclusiveLock); + rel = heap_open(ProcedureRelationId, RowExclusiveLock); procOid = LookupFuncNameTypeNames(name, argtypes, false); @@ -948,7 +948,7 @@ AlterFunction(AlterFunctionStmt *stmt) DefElem *strict_item = NULL; DefElem *security_def_item = NULL; - rel = heap_openr(ProcedureRelationName, RowExclusiveLock); + rel = heap_open(ProcedureRelationId, RowExclusiveLock); funcOid = LookupFuncNameTypeNames(stmt->func->funcname, stmt->func->funcargs, @@ -1014,7 +1014,7 @@ SetFunctionReturnType(Oid funcOid, Oid newRetType) HeapTuple tup; Form_pg_proc procForm; - pg_proc_rel = heap_openr(ProcedureRelationName, RowExclusiveLock); + pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock); tup = SearchSysCacheCopy(PROCOID, ObjectIdGetDatum(funcOid), @@ -1050,7 +1050,7 @@ SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType) HeapTuple tup; Form_pg_proc procForm; - pg_proc_rel = heap_openr(ProcedureRelationName, RowExclusiveLock); + pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock); tup = SearchSysCacheCopy(PROCOID, ObjectIdGetDatum(funcOid), @@ -1266,7 +1266,7 @@ CreateCast(CreateCastStmt *stmt) break; } - relation = heap_openr(CastRelationName, RowExclusiveLock); + relation = heap_open(CastRelationId, RowExclusiveLock); /* * Check for duplicate. This is just to give a friendly error @@ -1299,7 +1299,7 @@ CreateCast(CreateCastStmt *stmt) CatalogUpdateIndexes(relation, tuple); /* make dependency entries */ - myself.classId = RelationGetRelid(relation); + myself.classId = CastRelationId; myself.objectId = HeapTupleGetOid(tuple); myself.objectSubId = 0; @@ -1379,7 +1379,7 @@ DropCast(DropCastStmt *stmt) /* * Do the deletion */ - object.classId = get_system_catalog_relid(CastRelationName); + object.classId = CastRelationId; object.objectId = HeapTupleGetOid(tuple); object.objectSubId = 0; @@ -1397,13 +1397,13 @@ DropCastById(Oid castOid) SysScanDesc scan; HeapTuple tuple; - relation = heap_openr(CastRelationName, RowExclusiveLock); + relation = heap_open(CastRelationId, RowExclusiveLock); ScanKeyInit(&scankey, ObjectIdAttributeNumber, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(castOid)); - scan = systable_beginscan(relation, CastOidIndex, true, + scan = systable_beginscan(relation, CastOidIndexId, true, SnapshotNow, 1, &scankey); tuple = systable_getnext(scan); diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 01e3396efa5..93bdab2440d 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.129 2005/04/14 01:38:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.130 2005/04/14 20:03:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,6 @@ #include "access/heapam.h" #include "catalog/catalog.h" -#include "catalog/catname.h" #include "catalog/dependency.h" #include "catalog/heap.h" #include "catalog/index.h" @@ -1039,7 +1038,7 @@ ReindexDatabase(const char *dbname, bool force /* currently unused */ , * We only consider plain relations here (toast rels will be processed * indirectly by reindex_relation). */ - relationRelation = heap_openr(RelationRelationName, AccessShareLock); + relationRelation = heap_open(RelationRelationId, AccessShareLock); scan = heap_beginscan(relationRelation, SnapshotNow, 0, NULL); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c index 5d5ae51a82c..e64924c43a7 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.31 2005/04/14 01:38:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.32 2005/04/14 20:03:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,13 +17,13 @@ #include "access/genam.h" #include "access/heapam.h" -#include "catalog/catname.h" #include "catalog/dependency.h" #include "catalog/indexing.h" #include "catalog/namespace.h" #include "catalog/pg_am.h" #include "catalog/pg_amop.h" #include "catalog/pg_amproc.h" +#include "catalog/pg_namespace.h" #include "catalog/pg_opclass.h" #include "catalog/pg_operator.h" #include "catalog/pg_proc.h" @@ -255,7 +255,7 @@ DefineOpClass(CreateOpClassStmt *stmt) } } - rel = heap_openr(OperatorClassRelationName, RowExclusiveLock); + rel = heap_open(OperatorClassRelationId, RowExclusiveLock); /* * Make sure there is no existing opclass of this name (this is just @@ -287,7 +287,7 @@ DefineOpClass(CreateOpClassStmt *stmt) BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(amoid)); - scan = systable_beginscan(rel, OpclassAmNameNspIndex, true, + scan = systable_beginscan(rel, OpclassAmNameNspIndexId, true, SnapshotNow, 1, skey); while (HeapTupleIsValid(tup = systable_getnext(scan))) @@ -345,12 +345,12 @@ DefineOpClass(CreateOpClassStmt *stmt) * Create dependencies. Note: we do not create a dependency link to * the AM, because we don't currently support DROP ACCESS METHOD. */ - myself.classId = RelationGetRelid(rel); + myself.classId = OperatorClassRelationId; myself.objectId = opclassoid; myself.objectSubId = 0; /* dependency on namespace */ - referenced.classId = get_system_catalog_relid(NamespaceRelationName); + referenced.classId = NamespaceRelationId; referenced.objectId = namespaceoid; referenced.objectSubId = 0; recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); @@ -371,11 +371,11 @@ DefineOpClass(CreateOpClassStmt *stmt) } /* dependencies on operators */ - referenced.classId = get_system_catalog_relid(OperatorRelationName); foreach(l, operators) { OpClassMember *op = (OpClassMember *) lfirst(l); + referenced.classId = OperatorRelationId; referenced.objectId = op->object; referenced.objectSubId = 0; recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); @@ -547,7 +547,7 @@ storeOperators(Oid opclassoid, List *operators) ListCell *l; int i; - rel = heap_openr(AccessMethodOperatorRelationName, RowExclusiveLock); + rel = heap_open(AccessMethodOperatorRelationId, RowExclusiveLock); foreach(l, operators) { @@ -591,7 +591,7 @@ storeProcedures(Oid opclassoid, List *procedures) ListCell *l; int i; - rel = heap_openr(AccessMethodProcedureRelationName, RowExclusiveLock); + rel = heap_open(AccessMethodProcedureRelationId, RowExclusiveLock); foreach(l, procedures) { @@ -701,7 +701,7 @@ RemoveOpClass(RemoveOpClassStmt *stmt) /* * Do the deletion */ - object.classId = get_system_catalog_relid(OperatorClassRelationName); + object.classId = OperatorClassRelationId; object.objectId = opcID; object.objectSubId = 0; @@ -722,7 +722,7 @@ RemoveOpClassById(Oid opclassOid) /* * First remove the pg_opclass entry itself. */ - rel = heap_openr(OperatorClassRelationName, RowExclusiveLock); + rel = heap_open(OperatorClassRelationId, RowExclusiveLock); tup = SearchSysCache(CLAOID, ObjectIdGetDatum(opclassOid), @@ -744,9 +744,9 @@ RemoveOpClassById(Oid opclassOid) BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(opclassOid)); - rel = heap_openr(AccessMethodOperatorRelationName, RowExclusiveLock); + rel = heap_open(AccessMethodOperatorRelationId, RowExclusiveLock); - scan = systable_beginscan(rel, AccessMethodStrategyIndex, true, + scan = systable_beginscan(rel, AccessMethodStrategyIndexId, true, SnapshotNow, 1, skey); while (HeapTupleIsValid(tup = systable_getnext(scan))) @@ -763,9 +763,9 @@ RemoveOpClassById(Oid opclassOid) BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(opclassOid)); - rel = heap_openr(AccessMethodProcedureRelationName, RowExclusiveLock); + rel = heap_open(AccessMethodProcedureRelationId, RowExclusiveLock); - scan = systable_beginscan(rel, AccessMethodProcedureIndex, true, + scan = systable_beginscan(rel, AccessMethodProcedureIndexId, true, SnapshotNow, 1, skey); while (HeapTupleIsValid(tup = systable_getnext(scan))) @@ -800,7 +800,7 @@ RenameOpClass(List *name, const char *access_method, const char *newname) errmsg("access method \"%s\" does not exist", access_method))); - rel = heap_openr(OperatorClassRelationName, RowExclusiveLock); + rel = heap_open(OperatorClassRelationId, RowExclusiveLock); /* * Look up the opclass @@ -900,7 +900,7 @@ AlterOpClassOwner(List *name, const char *access_method, AclId newOwnerSysId) errmsg("access method \"%s\" does not exist", access_method))); - rel = heap_openr(OperatorClassRelationName, RowExclusiveLock); + rel = heap_open(OperatorClassRelationId, RowExclusiveLock); /* * Look up the opclass diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c index bd93b1ea8dc..45dc1eafeaa 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.20 2004/12/31 21:59:41 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.21 2005/04/14 20:03:24 tgl Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -35,7 +35,6 @@ #include "postgres.h" #include "access/heapam.h" -#include "catalog/catname.h" #include "catalog/dependency.h" #include "catalog/indexing.h" #include "catalog/namespace.h" @@ -234,7 +233,7 @@ RemoveOperator(RemoveOperStmt *stmt) /* * Do the deletion */ - object.classId = get_system_catalog_relid(OperatorRelationName); + object.classId = OperatorRelationId; object.objectId = operOid; object.objectSubId = 0; @@ -250,7 +249,7 @@ RemoveOperatorById(Oid operOid) Relation relation; HeapTuple tup; - relation = heap_openr(OperatorRelationName, RowExclusiveLock); + relation = heap_open(OperatorRelationId, RowExclusiveLock); tup = SearchSysCache(OPEROID, ObjectIdGetDatum(operOid), @@ -277,7 +276,7 @@ AlterOperatorOwner(List *name, TypeName *typeName1, TypeName *typeName2, Relation rel; Form_pg_operator oprForm; - rel = heap_openr(OperatorRelationName, RowExclusiveLock); + rel = heap_open(OperatorRelationId, RowExclusiveLock); operOid = LookupOperNameTypeNames(name, typeName1, typeName2, false); diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c index e94d5b4b288..3b90b4158be 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.59 2005/04/14 01:38:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.60 2005/04/14 20:03:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,6 @@ #include <ctype.h> #include "access/heapam.h" -#include "catalog/catname.h" #include "catalog/dependency.h" #include "catalog/indexing.h" #include "catalog/namespace.h" @@ -132,7 +131,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) values[i++] = ObjectIdGetDatum(valProcOid); /* lanvalidator */ nulls[i] = 'n'; /* lanacl */ - rel = heap_openr(LanguageRelationName, RowExclusiveLock); + rel = heap_open(LanguageRelationId, RowExclusiveLock); tupDesc = rel->rd_att; tup = heap_formtuple(tupDesc, values, nulls); @@ -144,7 +143,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) /* * Create dependencies for language */ - myself.classId = RelationGetRelid(rel); + myself.classId = LanguageRelationId; myself.objectId = HeapTupleGetOid(tup); myself.objectSubId = 0; @@ -200,7 +199,7 @@ DropProceduralLanguage(DropPLangStmt *stmt) (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("language \"%s\" does not exist", languageName))); - object.classId = get_system_catalog_relid(LanguageRelationName); + object.classId = LanguageRelationId; object.objectId = HeapTupleGetOid(langTup); object.objectSubId = 0; @@ -221,7 +220,7 @@ DropProceduralLanguageById(Oid langOid) Relation rel; HeapTuple langTup; - rel = heap_openr(LanguageRelationName, RowExclusiveLock); + rel = heap_open(LanguageRelationId, RowExclusiveLock); langTup = SearchSysCache(LANGOID, ObjectIdGetDatum(langOid), @@ -245,7 +244,7 @@ RenameLanguage(const char *oldname, const char *newname) HeapTuple tup; Relation rel; - rel = heap_openr(LanguageRelationName, RowExclusiveLock); + rel = heap_open(LanguageRelationId, RowExclusiveLock); tup = SearchSysCacheCopy(LANGNAME, CStringGetDatum(oldname), diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c index f6c7a624bea..678169b18a5 100644 --- a/src/backend/commands/schemacmds.c +++ b/src/backend/commands/schemacmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.28 2005/01/27 23:23:55 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.29 2005/04/14 20:03:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,6 @@ #include "access/heapam.h" #include "catalog/catalog.h" -#include "catalog/catname.h" #include "catalog/dependency.h" #include "catalog/indexing.h" #include "catalog/namespace.h" @@ -189,7 +188,7 @@ RemoveSchema(List *names, DropBehavior behavior) * Do the deletion. Objects contained in the schema are removed by * means of their dependency links to the schema. */ - object.classId = get_system_catalog_relid(NamespaceRelationName); + object.classId = NamespaceRelationId; object.objectId = namespaceId; object.objectSubId = 0; @@ -206,7 +205,7 @@ RemoveSchemaById(Oid schemaOid) Relation relation; HeapTuple tup; - relation = heap_openr(NamespaceRelationName, RowExclusiveLock); + relation = heap_open(NamespaceRelationId, RowExclusiveLock); tup = SearchSysCache(NAMESPACEOID, ObjectIdGetDatum(schemaOid), @@ -232,7 +231,7 @@ RenameSchema(const char *oldname, const char *newname) Relation rel; AclResult aclresult; - rel = heap_openr(NamespaceRelationName, RowExclusiveLock); + rel = heap_open(NamespaceRelationId, RowExclusiveLock); tup = SearchSysCacheCopy(NAMESPACENAME, CStringGetDatum(oldname), @@ -287,7 +286,7 @@ AlterSchemaOwner(const char *name, AclId newOwnerSysId) Relation rel; Form_pg_namespace nspForm; - rel = heap_openr(NamespaceRelationName, RowExclusiveLock); + rel = heap_open(NamespaceRelationId, RowExclusiveLock); tup = SearchSysCache(NAMESPACENAME, CStringGetDatum(name), diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 3a88ea520b8..446a6b9aed3 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.154 2005/04/14 01:38:17 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.155 2005/04/14 20:03:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,6 @@ #include "access/genam.h" #include "access/tuptoaster.h" #include "catalog/catalog.h" -#include "catalog/catname.h" #include "catalog/dependency.h" #include "catalog/heap.h" #include "catalog/index.h" @@ -1133,7 +1132,7 @@ StoreCatalogInheritance(Oid relationId, List *supers) * and then entered into pg_ipl. Since that catalog doesn't exist * anymore, there's no need to look for indirect ancestors.) */ - relation = heap_openr(InheritsRelationName, RowExclusiveLock); + relation = heap_open(InheritsRelationId, RowExclusiveLock); desc = RelationGetDescr(relation); seqNumber = 1; @@ -1224,7 +1223,7 @@ setRelhassubclassInRelation(Oid relationId, bool relhassubclass) * If the tuple already has the right relhassubclass setting, we don't * need to update it, but we still need to issue an SI inval message. */ - relationRelation = heap_openr(RelationRelationName, RowExclusiveLock); + relationRelation = heap_open(RelationRelationId, RowExclusiveLock); tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relationId), 0, 0, 0); @@ -1347,7 +1346,7 @@ renameatt(Oid myrelid, oldattname))); } - attrelation = heap_openr(AttributeRelationName, RowExclusiveLock); + attrelation = heap_open(AttributeRelationId, RowExclusiveLock); atttup = SearchSysCacheCopyAttName(myrelid, oldattname); if (!HeapTupleIsValid(atttup)) @@ -1514,7 +1513,7 @@ renamerel(Oid myrelid, const char *newrelname) * Find relation's pg_class tuple, and make sure newrelname isn't in * use. */ - relrelation = heap_openr(RelationRelationName, RowExclusiveLock); + relrelation = heap_open(RelationRelationId, RowExclusiveLock); reltup = SearchSysCacheCopy(RELOID, PointerGetDatum(myrelid), @@ -1626,14 +1625,14 @@ update_ri_trigger_args(Oid relid, char nulls[Natts_pg_trigger]; char replaces[Natts_pg_trigger]; - tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); + tgrel = heap_open(TriggerRelationId, RowExclusiveLock); if (fk_scan) { ScanKeyInit(&skey[0], Anum_pg_trigger_tgconstrrelid, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(relid)); - trigscan = systable_beginscan(tgrel, TriggerConstrRelidIndex, + trigscan = systable_beginscan(tgrel, TriggerConstrRelidIndexId, true, SnapshotNow, 1, skey); } @@ -1643,7 +1642,7 @@ update_ri_trigger_args(Oid relid, Anum_pg_trigger_tgrelid, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(relid)); - trigscan = systable_beginscan(tgrel, TriggerRelidNameIndex, + trigscan = systable_beginscan(tgrel, TriggerRelidNameIndexId, true, SnapshotNow, 1, skey); } @@ -2772,7 +2771,7 @@ find_composite_type_dependencies(Oid typeOid, const char *origTblName) * We scan pg_depend to find those things that depend on the rowtype. * (We assume we can ignore refobjsubid for a rowtype.) */ - depRel = relation_openr(DependRelationName, AccessShareLock); + depRel = heap_open(DependRelationId, AccessShareLock); ScanKeyInit(&key[0], Anum_pg_depend_refclassid, @@ -2783,7 +2782,7 @@ find_composite_type_dependencies(Oid typeOid, const char *origTblName) BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(typeOid)); - depScan = systable_beginscan(depRel, DependReferenceIndex, true, + depScan = systable_beginscan(depRel, DependReferenceIndexId, true, SnapshotNow, 2, key); while (HeapTupleIsValid(depTup = systable_getnext(depScan))) @@ -2894,7 +2893,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, Form_pg_type tform; Expr *defval; - attrdesc = heap_openr(AttributeRelationName, RowExclusiveLock); + attrdesc = heap_open(AttributeRelationId, RowExclusiveLock); /* * Are we adding the column to a recursion child? If so, check @@ -2935,7 +2934,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel, } } - pgclass = heap_openr(RelationRelationName, RowExclusiveLock); + pgclass = heap_open(RelationRelationId, RowExclusiveLock); reltup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(myrelid), @@ -3155,7 +3154,7 @@ ATExecDropNotNull(Relation rel, const char *colName) /* * lookup the attribute */ - attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock); + attr_rel = heap_open(AttributeRelationId, RowExclusiveLock); tuple = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName); @@ -3248,7 +3247,7 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel, /* * lookup the attribute */ - attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock); + attr_rel = heap_open(AttributeRelationId, RowExclusiveLock); tuple = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName); @@ -3396,7 +3395,7 @@ ATExecSetStatistics(Relation rel, const char *colName, Node *newValue) newtarget))); } - attrelation = heap_openr(AttributeRelationName, RowExclusiveLock); + attrelation = heap_open(AttributeRelationId, RowExclusiveLock); tuple = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName); @@ -3457,7 +3456,7 @@ ATExecSetStorage(Relation rel, const char *colName, Node *newValue) newstorage = 0; /* keep compiler quiet */ } - attrelation = heap_openr(AttributeRelationName, RowExclusiveLock); + attrelation = heap_open(AttributeRelationId, RowExclusiveLock); tuple = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName); @@ -3564,7 +3563,7 @@ ATExecDropColumn(Relation rel, const char *colName, Relation attr_rel; ListCell *child; - attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock); + attr_rel = heap_open(AttributeRelationId, RowExclusiveLock); foreach(child, children) { Oid childrelid = lfirst_oid(child); @@ -3652,7 +3651,7 @@ ATExecDropColumn(Relation rel, const char *colName, Relation class_rel; Form_pg_class tuple_class; - class_rel = heap_openr(RelationRelationName, RowExclusiveLock); + class_rel = heap_open(RelationRelationId, RowExclusiveLock); tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(RelationGetRelid(rel)), @@ -4404,10 +4403,10 @@ createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint, /* * Preset objectAddress fields */ - constrobj.classId = get_system_catalog_relid(ConstraintRelationName); + constrobj.classId = ConstraintRelationId; constrobj.objectId = constrOid; constrobj.objectSubId = 0; - trigobj.classId = get_system_catalog_relid(TriggerRelationName); + trigobj.classId = TriggerRelationId; trigobj.objectSubId = 0; /* Make changes-so-far visible */ @@ -4820,7 +4819,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, SysScanDesc scan; HeapTuple depTup; - attrelation = heap_openr(AttributeRelationName, RowExclusiveLock); + attrelation = heap_open(AttributeRelationId, RowExclusiveLock); /* Look up the target column */ heapTup = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName); @@ -4891,7 +4890,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, * index that implements a constraint will not show a direct * dependency on the column. */ - depRel = heap_openr(DependRelationName, RowExclusiveLock); + depRel = heap_open(DependRelationId, RowExclusiveLock); ScanKeyInit(&key[0], Anum_pg_depend_refclassid, @@ -4906,7 +4905,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, BTEqualStrategyNumber, F_INT4EQ, Int32GetDatum((int32) attnum)); - scan = systable_beginscan(depRel, DependReferenceIndex, true, + scan = systable_beginscan(depRel, DependReferenceIndexId, true, SnapshotNow, 3, key); while (HeapTupleIsValid(depTup = systable_getnext(scan))) @@ -5030,7 +5029,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, BTEqualStrategyNumber, F_INT4EQ, Int32GetDatum((int32) attnum)); - scan = systable_beginscan(depRel, DependDependerIndex, true, + scan = systable_beginscan(depRel, DependDependerIndexId, true, SnapshotNow, 3, key); while (HeapTupleIsValid(depTup = systable_getnext(scan))) @@ -5136,18 +5135,17 @@ ATPostAlterTypeCleanup(List **wqueue, AlteredTableInfo *tab) * It should be okay to use DROP_RESTRICT here, since nothing else * should be depending on these objects. */ - if (tab->changedConstraintOids) - obj.classId = get_system_catalog_relid(ConstraintRelationName); foreach(l, tab->changedConstraintOids) { + obj.classId = ConstraintRelationId; obj.objectId = lfirst_oid(l); obj.objectSubId = 0; performDeletion(&obj, DROP_RESTRICT); } - obj.classId = RelationRelationId; foreach(l, tab->changedIndexOids) { + obj.classId = RelationRelationId; obj.objectId = lfirst_oid(l); obj.objectSubId = 0; performDeletion(&obj, DROP_RESTRICT); @@ -5266,7 +5264,7 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId) target_rel = relation_open(relationOid, AccessExclusiveLock); /* Get its pg_class tuple, too */ - class_rel = heap_openr(RelationRelationName, RowExclusiveLock); + class_rel = heap_open(RelationRelationId, RowExclusiveLock); tuple = SearchSysCache(RELOID, ObjectIdGetDatum(relationOid), @@ -5396,7 +5394,7 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId) * SERIAL sequences are those having an internal dependency on one * of the table's columns (we don't care *which* column, exactly). */ - depRel = heap_openr(DependRelationName, AccessShareLock); + depRel = heap_open(DependRelationId, AccessShareLock); ScanKeyInit(&key[0], Anum_pg_depend_refclassid, @@ -5408,7 +5406,7 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId) ObjectIdGetDatum(relationOid)); /* we leave refobjsubid unspecified */ - scan = systable_beginscan(depRel, DependReferenceIndex, true, + scan = systable_beginscan(depRel, DependReferenceIndexId, true, SnapshotNow, 2, key); while (HeapTupleIsValid(tup = systable_getnext(scan))) @@ -5587,7 +5585,7 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace) reltoastidxid = rel->rd_rel->reltoastidxid; /* Get a modifiable copy of the relation's pg_class row */ - pg_class = heap_openr(RelationRelationName, RowExclusiveLock); + pg_class = heap_open(RelationRelationId, RowExclusiveLock); tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(tableOid), @@ -5909,7 +5907,7 @@ AlterTableCreateToastTable(Oid relOid, bool silent) /* * Store the toast table's OID in the parent relation's pg_class row */ - class_rel = heap_openr(RelationRelationName, RowExclusiveLock); + class_rel = heap_open(RelationRelationId, RowExclusiveLock); reltup = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relOid), diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index f59cd84e0eb..9a18fd6e839 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.16 2005/01/27 23:23:55 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.17 2005/04/14 20:03:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -50,7 +50,6 @@ #include "access/heapam.h" #include "catalog/catalog.h" -#include "catalog/catname.h" #include "catalog/indexing.h" #include "catalog/pg_namespace.h" #include "catalog/pg_tablespace.h" @@ -125,7 +124,7 @@ TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo) Relation rel; if (!isRedo) - rel = heap_openr(TableSpaceRelationName, ExclusiveLock); + rel = heap_open(TableSpaceRelationId, ExclusiveLock); else rel = NULL; @@ -291,7 +290,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt) * is to lock the proposed tablename against other would-be creators. * The insertion will roll back if we find problems below. */ - rel = heap_openr(TableSpaceRelationName, RowExclusiveLock); + rel = heap_open(TableSpaceRelationId, RowExclusiveLock); MemSet(nulls, ' ', Natts_pg_tablespace); @@ -407,7 +406,7 @@ DropTableSpace(DropTableSpaceStmt *stmt) * is trying to do DROP TABLESPACE or TablespaceCreateDbspace * concurrently. */ - rel = heap_openr(TableSpaceRelationName, ExclusiveLock); + rel = heap_open(TableSpaceRelationId, ExclusiveLock); /* * Find the target tuple @@ -736,7 +735,7 @@ RenameTableSpace(const char *oldname, const char *newname) Form_pg_tablespace newform; /* Search pg_tablespace */ - rel = heap_openr(TableSpaceRelationName, RowExclusiveLock); + rel = heap_open(TableSpaceRelationId, RowExclusiveLock); ScanKeyInit(&entry[0], Anum_pg_tablespace_spcname, @@ -803,7 +802,7 @@ AlterTableSpaceOwner(const char *name, AclId newOwnerSysId) HeapTuple tup; /* Search pg_tablespace */ - rel = heap_openr(TableSpaceRelationName, RowExclusiveLock); + rel = heap_open(TableSpaceRelationId, RowExclusiveLock); ScanKeyInit(&entry[0], Anum_pg_tablespace_spcname, @@ -952,7 +951,7 @@ get_tablespace_oid(const char *tablespacename) ScanKeyData entry[1]; /* Search pg_tablespace */ - rel = heap_openr(TableSpaceRelationName, AccessShareLock); + rel = heap_open(TableSpaceRelationId, AccessShareLock); ScanKeyInit(&entry[0], Anum_pg_tablespace_spcname, @@ -987,7 +986,7 @@ get_tablespace_name(Oid spc_oid) ScanKeyData entry[1]; /* Search pg_tablespace */ - rel = heap_openr(TableSpaceRelationName, AccessShareLock); + rel = heap_open(TableSpaceRelationId, AccessShareLock); ScanKeyInit(&entry[0], ObjectIdAttributeNumber, diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 851aed3b6d8..c298cba3047 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.185 2005/04/14 01:38:17 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.186 2005/04/14 20:03:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,6 @@ #include "access/heapam.h" #include "access/xact.h" #include "catalog/catalog.h" -#include "catalog/catname.h" #include "catalog/dependency.h" #include "catalog/indexing.h" #include "catalog/namespace.h" @@ -252,12 +251,12 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint) * NOTE that this is cool only because we have AccessExclusiveLock on the * relation, so the trigger set won't be changing underneath us. */ - tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); + tgrel = heap_open(TriggerRelationId, RowExclusiveLock); ScanKeyInit(&key, Anum_pg_trigger_tgrelid, BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(RelationGetRelid(rel))); - tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true, + tgscan = systable_beginscan(tgrel, TriggerRelidNameIndexId, true, SnapshotNow, 1, &key); while (HeapTupleIsValid(tuple = systable_getnext(tgscan))) { @@ -374,7 +373,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint) CatalogUpdateIndexes(tgrel, tuple); - myself.classId = RelationGetRelid(tgrel); + myself.classId = TriggerRelationId; myself.objectId = trigoid; myself.objectSubId = 0; @@ -389,7 +388,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint) * backends (and this one too!) are sent SI message to make them * rebuild relcache entries. */ - pgrel = heap_openr(RelationRelationName, RowExclusiveLock); + pgrel = heap_open(RelationRelationId, RowExclusiveLock); tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(RelationGetRelid(rel)), 0, 0, 0); @@ -463,7 +462,7 @@ DropTrigger(Oid relid, const char *trigname, DropBehavior behavior) /* * Find the trigger, verify permissions, set up object address */ - tgrel = heap_openr(TriggerRelationName, AccessShareLock); + tgrel = heap_open(TriggerRelationId, AccessShareLock); ScanKeyInit(&skey[0], Anum_pg_trigger_tgrelid, @@ -475,7 +474,7 @@ DropTrigger(Oid relid, const char *trigname, DropBehavior behavior) BTEqualStrategyNumber, F_NAMEEQ, CStringGetDatum(trigname)); - tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true, + tgscan = systable_beginscan(tgrel, TriggerRelidNameIndexId, true, SnapshotNow, 2, skey); tup = systable_getnext(tgscan); @@ -490,7 +489,7 @@ DropTrigger(Oid relid, const char *trigname, DropBehavior behavior) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS, get_rel_name(relid)); - object.classId = RelationGetRelid(tgrel); + object.classId = TriggerRelationId; object.objectId = HeapTupleGetOid(tup); object.objectSubId = 0; @@ -519,7 +518,7 @@ RemoveTriggerById(Oid trigOid) HeapTuple tuple; Form_pg_class classForm; - tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); + tgrel = heap_open(TriggerRelationId, RowExclusiveLock); /* * Find the trigger to delete. @@ -529,7 +528,7 @@ RemoveTriggerById(Oid trigOid) BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(trigOid)); - tgscan = systable_beginscan(tgrel, TriggerOidIndex, true, + tgscan = systable_beginscan(tgrel, TriggerOidIndexId, true, SnapshotNow, 1, skey); tup = systable_getnext(tgscan); @@ -572,7 +571,7 @@ RemoveTriggerById(Oid trigOid) * so no one else is creating/deleting triggers on this rel at the * same time. */ - pgrel = heap_openr(RelationRelationName, RowExclusiveLock); + pgrel = heap_open(RelationRelationId, RowExclusiveLock); tuple = SearchSysCacheCopy(RELOID, ObjectIdGetDatum(relid), 0, 0, 0); @@ -636,7 +635,7 @@ renametrig(Oid relid, * NOTE that this is cool only because we have AccessExclusiveLock on the * relation, so the trigger set won't be changing underneath us. */ - tgrel = heap_openr(TriggerRelationName, RowExclusiveLock); + tgrel = heap_open(TriggerRelationId, RowExclusiveLock); /* * First pass -- look for name conflict @@ -649,7 +648,7 @@ renametrig(Oid relid, Anum_pg_trigger_tgname, BTEqualStrategyNumber, F_NAMEEQ, PointerGetDatum(newname)); - tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true, + tgscan = systable_beginscan(tgrel, TriggerRelidNameIndexId, true, SnapshotNow, 2, key); if (HeapTupleIsValid(tuple = systable_getnext(tgscan))) ereport(ERROR, @@ -669,7 +668,7 @@ renametrig(Oid relid, Anum_pg_trigger_tgname, BTEqualStrategyNumber, F_NAMEEQ, PointerGetDatum(oldname)); - tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true, + tgscan = systable_beginscan(tgrel, TriggerRelidNameIndexId, true, SnapshotNow, 2, key); if (HeapTupleIsValid(tuple = systable_getnext(tgscan))) { @@ -739,7 +738,7 @@ RelationBuildTriggers(Relation relation) triggers = (Trigger *) palloc(ntrigs * sizeof(Trigger)); /* - * Note: since we scan the triggers using TriggerRelidNameIndex, we + * Note: since we scan the triggers using TriggerRelidNameIndexId, we * will be reading the triggers in name order, except possibly during * emergency-recovery operations (ie, IsIgnoringSystemIndexes). This * in turn ensures that triggers will be fired in name order. @@ -749,8 +748,8 @@ RelationBuildTriggers(Relation relation) BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(RelationGetRelid(relation))); - tgrel = heap_openr(TriggerRelationName, AccessShareLock); - tgscan = systable_beginscan(tgrel, TriggerRelidNameIndex, true, + tgrel = heap_open(TriggerRelationId, AccessShareLock); + tgscan = systable_beginscan(tgrel, TriggerRelidNameIndexId, true, SnapshotNow, 1, &skey); while (HeapTupleIsValid(htup = systable_getnext(tgscan))) @@ -2802,7 +2801,7 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt) * First lookup all trigger Oid's for the constraint names. * ---------- */ - tgrel = heap_openr(TriggerRelationName, AccessShareLock); + tgrel = heap_open(TriggerRelationId, AccessShareLock); foreach(l, stmt->constraints) { @@ -2828,7 +2827,7 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt) BTEqualStrategyNumber, F_NAMEEQ, PointerGetDatum(cname)); - tgscan = systable_beginscan(tgrel, TriggerConstrNameIndex, true, + tgscan = systable_beginscan(tgrel, TriggerConstrNameIndexId, true, SnapshotNow, 1, &skey); /* diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index 0af04f86f54..1ec9621000e 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.69 2005/04/14 01:38:17 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.70 2005/04/14 20:03:24 tgl Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -33,7 +33,6 @@ #include "access/heapam.h" #include "access/genam.h" -#include "catalog/catname.h" #include "catalog/dependency.h" #include "catalog/heap.h" #include "catalog/indexing.h" @@ -458,7 +457,7 @@ RemoveTypeById(Oid typeOid) Relation relation; HeapTuple tup; - relation = heap_openr(TypeRelationName, RowExclusiveLock); + relation = heap_open(TypeRelationId, RowExclusiveLock); tup = SearchSysCache(TYPEOID, ObjectIdGetDatum(typeOid), @@ -1143,7 +1142,7 @@ AlterDomainDefault(List *names, Node *defaultRaw) typename->arrayBounds = NIL; /* Lock the domain in the type table */ - rel = heap_openr(TypeRelationName, RowExclusiveLock); + rel = heap_open(TypeRelationId, RowExclusiveLock); /* Use LookupTypeName here so that shell types can be removed. */ domainoid = LookupTypeName(typename); @@ -1265,7 +1264,7 @@ AlterDomainNotNull(List *names, bool notNull) typename->arrayBounds = NIL; /* Lock the type table */ - typrel = heap_openr(TypeRelationName, RowExclusiveLock); + typrel = heap_open(TypeRelationId, RowExclusiveLock); /* Use LookupTypeName here so that shell types can be found (why?). */ domainoid = LookupTypeName(typename); @@ -1377,7 +1376,7 @@ AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior beha typename->arrayBounds = NIL; /* Lock the type table */ - rel = heap_openr(TypeRelationName, RowExclusiveLock); + rel = heap_open(TypeRelationId, RowExclusiveLock); /* Use LookupTypeName here so that shell types can be removed. */ domainoid = LookupTypeName(typename); @@ -1397,7 +1396,7 @@ AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior beha domainOwnerCheck(tup, typename); /* Grab an appropriate lock on the pg_constraint relation */ - conrel = heap_openr(ConstraintRelationName, RowExclusiveLock); + conrel = heap_open(ConstraintRelationId, RowExclusiveLock); /* Use the index to scan only constraints of the target relation */ ScanKeyInit(&key[0], @@ -1405,7 +1404,7 @@ AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior beha BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(HeapTupleGetOid(tup))); - conscan = systable_beginscan(conrel, ConstraintTypidIndex, true, + conscan = systable_beginscan(conrel, ConstraintTypidIndexId, true, SnapshotNow, 1, key); typTup = (Form_pg_type) GETSTRUCT(tup); @@ -1421,7 +1420,7 @@ AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior beha { ObjectAddress conobj; - conobj.classId = RelationGetRelid(conrel); + conobj.classId = ConstraintRelationId; conobj.objectId = HeapTupleGetOid(contup); conobj.objectSubId = 0; @@ -1464,7 +1463,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint) typename->arrayBounds = NIL; /* Lock the type table */ - typrel = heap_openr(TypeRelationName, RowExclusiveLock); + typrel = heap_open(TypeRelationId, RowExclusiveLock); /* Use LookupTypeName here so that shell types can be found (why?). */ domainoid = LookupTypeName(typename); @@ -1650,7 +1649,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode) * We scan pg_depend to find those things that depend on the domain. * (We assume we can ignore refobjsubid for a domain.) */ - depRel = relation_openr(DependRelationName, AccessShareLock); + depRel = heap_open(DependRelationId, AccessShareLock); ScanKeyInit(&key[0], Anum_pg_depend_refclassid, @@ -1661,7 +1660,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode) BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(domainOid)); - depScan = systable_beginscan(depRel, DependReferenceIndex, true, + depScan = systable_beginscan(depRel, DependReferenceIndexId, true, SnapshotNow, 2, key); while (HeapTupleIsValid(depTup = systable_getnext(depScan))) @@ -1927,7 +1926,7 @@ GetDomainConstraints(Oid typeOid) bool notNull = false; Relation conRel; - conRel = heap_openr(ConstraintRelationName, AccessShareLock); + conRel = heap_open(ConstraintRelationId, AccessShareLock); for (;;) { @@ -1961,7 +1960,7 @@ GetDomainConstraints(Oid typeOid) BTEqualStrategyNumber, F_OIDEQ, ObjectIdGetDatum(typeOid)); - scan = systable_beginscan(conRel, ConstraintTypidIndex, true, + scan = systable_beginscan(conRel, ConstraintTypidIndexId, true, SnapshotNow, 1, key); while (HeapTupleIsValid(conTup = systable_getnext(scan))) @@ -2052,7 +2051,7 @@ AlterTypeOwner(List *names, AclId newOwnerSysId) typename->arrayBounds = NIL; /* Lock the type table */ - rel = heap_openr(TypeRelationName, RowExclusiveLock); + rel = heap_open(TypeRelationId, RowExclusiveLock); /* Use LookupTypeName here so that shell types can be processed (why?) */ typeOid = LookupTypeName(typename); diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index 12dd14ff1b9..3c70c579785 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -6,14 +6,13 @@ * 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.150 2005/04/14 01:38:17 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.151 2005/04/14 20:03:24 tgl Exp $ * *------------------------------------------------------------------------- */ #include "postgres.h" #include "access/heapam.h" -#include "catalog/catname.h" #include "catalog/indexing.h" #include "catalog/pg_database.h" #include "catalog/pg_group.h" @@ -180,7 +179,7 @@ CreateUser(CreateUserStmt *stmt) * to be sure of what the next usesysid should be, and we need to * protect our eventual update of the flat password file. */ - pg_shadow_rel = heap_openr(ShadowRelationName, ExclusiveLock); + pg_shadow_rel = heap_open(ShadowRelationId, ExclusiveLock); pg_shadow_dsc = RelationGetDescr(pg_shadow_rel); scan = heap_beginscan(pg_shadow_rel, SnapshotNow, 0, NULL); @@ -401,7 +400,7 @@ AlterUser(AlterUserStmt *stmt) * secure exclusive lock to protect our update of the flat password * file. */ - pg_shadow_rel = heap_openr(ShadowRelationName, ExclusiveLock); + pg_shadow_rel = heap_open(ShadowRelationId, ExclusiveLock); pg_shadow_dsc = RelationGetDescr(pg_shadow_rel); tuple = SearchSysCache(SHADOWNAME, @@ -516,7 +515,7 @@ AlterUserSet(AlterUserSetStmt *stmt) * RowExclusiveLock is sufficient, because we don't need to update the * flat password file. */ - rel = heap_openr(ShadowRelationName, RowExclusiveLock); + rel = heap_open(ShadowRelationId, RowExclusiveLock); oldtuple = SearchSysCache(SHADOWNAME, PointerGetDatum(stmt->user), 0, 0, 0); @@ -594,7 +593,7 @@ DropUser(DropUserStmt *stmt) * deleted. Note we secure exclusive lock, because we need to protect * our update of the flat password file. */ - pg_shadow_rel = heap_openr(ShadowRelationName, ExclusiveLock); + pg_shadow_rel = heap_open(ShadowRelationId, ExclusiveLock); pg_shadow_dsc = RelationGetDescr(pg_shadow_rel); foreach(item, stmt->users) @@ -635,7 +634,7 @@ DropUser(DropUserStmt *stmt) * don't read the manual, it doesn't seem to be the behaviour one * would expect either.) -- petere 2000/01/14) */ - pg_rel = heap_openr(DatabaseRelationName, AccessShareLock); + pg_rel = heap_open(DatabaseRelationId, AccessShareLock); pg_dsc = RelationGetDescr(pg_rel); ScanKeyInit(&scankey, @@ -677,7 +676,7 @@ DropUser(DropUserStmt *stmt) * * try calling alter group drop user for every group */ - pg_rel = heap_openr(GroupRelationName, ExclusiveLock); + pg_rel = heap_open(GroupRelationId, ExclusiveLock); pg_dsc = RelationGetDescr(pg_rel); scan = heap_beginscan(pg_rel, SnapshotNow, 0, NULL); while ((tmp_tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) @@ -734,7 +733,7 @@ RenameUser(const char *oldname, const char *newname) int i; /* ExclusiveLock because we need to update the password file */ - rel = heap_openr(ShadowRelationName, ExclusiveLock); + rel = heap_open(ShadowRelationId, ExclusiveLock); dsc = RelationGetDescr(rel); oldtuple = SearchSysCache(SHADOWNAME, @@ -819,13 +818,17 @@ CheckPgUserAclNotNull(void) elog(ERROR, "cache lookup failed for relation %u", ShadowRelationId); if (heap_attisnull(htup, Anum_pg_class_relacl)) + { + Form_pg_class classForm = (Form_pg_class) GETSTRUCT(htup); + ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("before using passwords you must revoke privileges on %s", - ShadowRelationName), + errmsg("before using passwords you must revoke privileges on %s", + NameStr(classForm->relname)), errdetail("This restriction is to prevent unprivileged users from reading the passwords."), errhint("Try REVOKE ALL ON \"%s\" FROM PUBLIC.", - ShadowRelationName))); + NameStr(classForm->relname)))); + } ReleaseSysCache(htup); } @@ -914,7 +917,7 @@ CreateGroup(CreateGroupStmt *stmt) * to be sure of what the next grosysid should be, and we need to * protect our eventual update of the flat group file. */ - pg_group_rel = heap_openr(GroupRelationName, ExclusiveLock); + pg_group_rel = heap_open(GroupRelationId, ExclusiveLock); pg_group_dsc = RelationGetDescr(pg_group_rel); scan = heap_beginscan(pg_group_rel, SnapshotNow, 0, NULL); @@ -1032,7 +1035,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag) /* * Secure exclusive lock to protect our update of the flat group file. */ - pg_group_rel = heap_openr(GroupRelationName, ExclusiveLock); + pg_group_rel = heap_open(GroupRelationId, ExclusiveLock); pg_group_dsc = RelationGetDescr(pg_group_rel); /* @@ -1271,7 +1274,7 @@ DropGroup(DropGroupStmt *stmt) /* * Secure exclusive lock to protect our update of the flat group file. */ - pg_group_rel = heap_openr(GroupRelationName, ExclusiveLock); + pg_group_rel = heap_open(GroupRelationId, ExclusiveLock); /* Find and delete the group. */ @@ -1308,7 +1311,7 @@ RenameGroup(const char *oldname, const char *newname) Relation rel; /* ExclusiveLock because we need to update the flat group file */ - rel = heap_openr(GroupRelationName, ExclusiveLock); + rel = heap_open(GroupRelationId, ExclusiveLock); tup = SearchSysCacheCopy(GRONAME, CStringGetDatum(oldname), diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index b2b39c5a58c..f52e9ecb3c2 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.305 2005/03/20 22:00:52 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.306 2005/04/14 20:03:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -28,7 +28,6 @@ #include "access/subtrans.h" #include "access/xlog.h" #include "catalog/catalog.h" -#include "catalog/catname.h" #include "catalog/namespace.h" #include "catalog/pg_database.h" #include "catalog/pg_index.h" @@ -542,7 +541,7 @@ get_rel_oids(const RangeVar *vacrel, const char *stmttype) BTEqualStrategyNumber, F_CHAREQ, CharGetDatum(RELKIND_RELATION)); - pgclass = heap_openr(RelationRelationName, AccessShareLock); + pgclass = heap_open(RelationRelationId, AccessShareLock); scan = heap_beginscan(pgclass, SnapshotNow, 1, &key); @@ -642,7 +641,7 @@ vac_update_relstats(Oid relid, BlockNumber num_pages, double num_tuples, /* * update number of tuples and number of pages in pg_class */ - rd = heap_openr(RelationRelationName, RowExclusiveLock); + rd = heap_open(RelationRelationId, RowExclusiveLock); ctup = SearchSysCache(RELOID, ObjectIdGetDatum(relid), @@ -718,7 +717,7 @@ vac_update_dbstats(Oid dbid, HeapTuple tuple; Form_pg_database dbform; - relation = heap_openr(DatabaseRelationName, RowExclusiveLock); + relation = heap_open(DatabaseRelationId, RowExclusiveLock); /* Must use a heap scan, since there's no syscache for pg_database */ ScanKeyInit(&entry[0], @@ -792,7 +791,7 @@ vac_truncate_clog(TransactionId vacuumXID, TransactionId frozenXID) * Note: the "already wrapped" cases should now be impossible due to the * defenses in GetNewTransactionId, but we keep them anyway. */ - relation = heap_openr(DatabaseRelationName, AccessShareLock); + relation = heap_open(DatabaseRelationId, AccessShareLock); scan = heap_beginscan(relation, SnapshotNow, 0, NULL); |