diff options
author | Robert Haas <rhaas@postgresql.org> | 2010-02-14 18:42:19 +0000 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2010-02-14 18:42:19 +0000 |
commit | e26c539e9f326ea843c0ed005af093b56b55cd4d (patch) | |
tree | 4f3830d394229b747cbceeab3cdbbfccccec74d1 /src/backend/commands/conversioncmds.c | |
parent | 1012492bc0bfb322d59db17e17735d17d634e264 (diff) |
Wrap calls to SearchSysCache and related functions using macros.
The purpose of this change is to eliminate the need for every caller
of SearchSysCache, SearchSysCacheCopy, SearchSysCacheExists,
GetSysCacheOid, and SearchSysCacheList to know the maximum number
of allowable keys for a syscache entry (currently 4). This will
make it far easier to increase the maximum number of keys in a
future release should we choose to do so, and it makes the code
shorter, too.
Design and review by Tom Lane.
Diffstat (limited to 'src/backend/commands/conversioncmds.c')
-rw-r--r-- | src/backend/commands/conversioncmds.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/backend/commands/conversioncmds.c b/src/backend/commands/conversioncmds.c index 149237e31b5..2e5a7dfe9ec 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.40 2010/01/02 16:57:37 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.41 2010/02/14 18:42:14 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -162,9 +162,7 @@ DropConversionsCommand(DropStmt *drop) continue; } - tuple = SearchSysCache(CONVOID, - ObjectIdGetDatum(conversionOid), - 0, 0, 0); + tuple = SearchSysCache1(CONVOID, ObjectIdGetDatum(conversionOid)); if (!HeapTupleIsValid(tuple)) elog(ERROR, "cache lookup failed for conversion %u", conversionOid); @@ -211,19 +209,16 @@ RenameConversion(List *name, const char *newname) errmsg("conversion \"%s\" does not exist", NameListToString(name)))); - tup = SearchSysCacheCopy(CONVOID, - ObjectIdGetDatum(conversionOid), - 0, 0, 0); + tup = SearchSysCacheCopy1(CONVOID, ObjectIdGetDatum(conversionOid)); if (!HeapTupleIsValid(tup)) /* should not happen */ elog(ERROR, "cache lookup failed for conversion %u", conversionOid); namespaceOid = ((Form_pg_conversion) GETSTRUCT(tup))->connamespace; /* make sure the new name doesn't exist */ - if (SearchSysCacheExists(CONNAMENSP, - CStringGetDatum(newname), - ObjectIdGetDatum(namespaceOid), - 0, 0)) + if (SearchSysCacheExists2(CONNAMENSP, + CStringGetDatum(newname), + ObjectIdGetDatum(namespaceOid))) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), errmsg("conversion \"%s\" already exists in schema \"%s\"", @@ -301,9 +296,7 @@ AlterConversionOwner_internal(Relation rel, Oid conversionOid, Oid newOwnerId) Assert(RelationGetRelid(rel) == ConversionRelationId); - tup = SearchSysCacheCopy(CONVOID, - ObjectIdGetDatum(conversionOid), - 0, 0, 0); + tup = SearchSysCacheCopy1(CONVOID, ObjectIdGetDatum(conversionOid)); if (!HeapTupleIsValid(tup)) /* should not happen */ elog(ERROR, "cache lookup failed for conversion %u", conversionOid); |