mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
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.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.284 2010/01/19 16:33:33 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.285 2010/02/14 18:42:15 rhaas Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -490,9 +490,8 @@ count_agg_clauses_walker(Node *node, AggClauseCounts *counts)
|
||||
}
|
||||
|
||||
/* fetch aggregate transition datatype from pg_aggregate */
|
||||
aggTuple = SearchSysCache(AGGFNOID,
|
||||
ObjectIdGetDatum(aggref->aggfnoid),
|
||||
0, 0, 0);
|
||||
aggTuple = SearchSysCache1(AGGFNOID,
|
||||
ObjectIdGetDatum(aggref->aggfnoid));
|
||||
if (!HeapTupleIsValid(aggTuple))
|
||||
elog(ERROR, "cache lookup failed for aggregate %u",
|
||||
aggref->aggfnoid);
|
||||
@@ -3288,9 +3287,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod,
|
||||
* to the function's pg_proc tuple, so fetch it just once to use in both
|
||||
* attempts.
|
||||
*/
|
||||
func_tuple = SearchSysCache(PROCOID,
|
||||
ObjectIdGetDatum(funcid),
|
||||
0, 0, 0);
|
||||
func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
|
||||
if (!HeapTupleIsValid(func_tuple))
|
||||
elog(ERROR, "cache lookup failed for function %u", funcid);
|
||||
|
||||
@@ -4149,9 +4146,7 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
|
||||
/*
|
||||
* OK, let's take a look at the function's pg_proc entry.
|
||||
*/
|
||||
func_tuple = SearchSysCache(PROCOID,
|
||||
ObjectIdGetDatum(func_oid),
|
||||
0, 0, 0);
|
||||
func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(func_oid));
|
||||
if (!HeapTupleIsValid(func_tuple))
|
||||
elog(ERROR, "cache lookup failed for function %u", func_oid);
|
||||
funcform = (Form_pg_proc) GETSTRUCT(func_tuple);
|
||||
|
||||
Reference in New Issue
Block a user