From e26c539e9f326ea843c0ed005af093b56b55cd4d Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Sun, 14 Feb 2010 18:42:19 +0000 Subject: 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. --- src/backend/parser/parse_oper.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'src/backend/parser/parse_oper.c') diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c index 98af55274e3..daa9e2341fa 100644 --- a/src/backend/parser/parse_oper.c +++ b/src/backend/parser/parse_oper.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.111 2010/01/02 16:57:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.112 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -421,9 +421,7 @@ oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId, operOid = find_oper_cache_entry(&key); if (OidIsValid(operOid)) { - tup = SearchSysCache(OPEROID, - ObjectIdGetDatum(operOid), - 0, 0, 0); + tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid)); if (HeapTupleIsValid(tup)) return (Operator) tup; } @@ -463,9 +461,7 @@ oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId, } if (OidIsValid(operOid)) - tup = SearchSysCache(OPEROID, - ObjectIdGetDatum(operOid), - 0, 0, 0); + tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid)); if (HeapTupleIsValid(tup)) { @@ -571,9 +567,7 @@ right_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location) operOid = find_oper_cache_entry(&key); if (OidIsValid(operOid)) { - tup = SearchSysCache(OPEROID, - ObjectIdGetDatum(operOid), - 0, 0, 0); + tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid)); if (HeapTupleIsValid(tup)) return (Operator) tup; } @@ -605,9 +599,7 @@ right_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location) } if (OidIsValid(operOid)) - tup = SearchSysCache(OPEROID, - ObjectIdGetDatum(operOid), - 0, 0, 0); + tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid)); if (HeapTupleIsValid(tup)) { @@ -653,9 +645,7 @@ left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location) operOid = find_oper_cache_entry(&key); if (OidIsValid(operOid)) { - tup = SearchSysCache(OPEROID, - ObjectIdGetDatum(operOid), - 0, 0, 0); + tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid)); if (HeapTupleIsValid(tup)) return (Operator) tup; } @@ -699,9 +689,7 @@ left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location) } if (OidIsValid(operOid)) - tup = SearchSysCache(OPEROID, - ObjectIdGetDatum(operOid), - 0, 0, 0); + tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid)); if (HeapTupleIsValid(tup)) { -- cgit v1.2.3