aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2010-02-14 18:42:19 +0000
committerRobert Haas <rhaas@postgresql.org>2010-02-14 18:42:19 +0000
commite26c539e9f326ea843c0ed005af093b56b55cd4d (patch)
tree4f3830d394229b747cbceeab3cdbbfccccec74d1 /src/backend/executor
parent1012492bc0bfb322d59db17e17735d17d634e264 (diff)
downloadpostgresql-e26c539e9f326ea843c0ed005af093b56b55cd4d.tar.gz
postgresql-e26c539e9f326ea843c0ed005af093b56b55cd4d.zip
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/executor')
-rw-r--r--src/backend/executor/execAmi.c10
-rw-r--r--src/backend/executor/functions.c10
-rw-r--r--src/backend/executor/nodeAgg.c12
-rw-r--r--src/backend/executor/nodeHash.c11
-rw-r--r--src/backend/executor/nodeWindowAgg.c11
-rw-r--r--src/backend/executor/spi.c6
6 files changed, 22 insertions, 38 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index bb5ad281307..dfc36365807 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.107 2010/01/02 16:57:40 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.108 2010/02/14 18:42:14 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -484,17 +484,13 @@ IndexSupportsBackwardScan(Oid indexid)
Form_pg_am amrec;
/* Fetch the pg_class tuple of the index relation */
- ht_idxrel = SearchSysCache(RELOID,
- ObjectIdGetDatum(indexid),
- 0, 0, 0);
+ ht_idxrel = SearchSysCache1(RELOID, ObjectIdGetDatum(indexid));
if (!HeapTupleIsValid(ht_idxrel))
elog(ERROR, "cache lookup failed for relation %u", indexid);
idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel);
/* Fetch the pg_am tuple of the index' access method */
- ht_am = SearchSysCache(AMOID,
- ObjectIdGetDatum(idxrelrec->relam),
- 0, 0, 0);
+ ht_am = SearchSysCache1(AMOID, ObjectIdGetDatum(idxrelrec->relam));
if (!HeapTupleIsValid(ht_am))
elog(ERROR, "cache lookup failed for access method %u",
idxrelrec->relam);
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 831f38882f7..88b47316e24 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.140 2010/01/02 16:57:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.141 2010/02/14 18:42:14 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -232,9 +232,7 @@ init_sql_fcache(FmgrInfo *finfo, bool lazyEvalOK)
/*
* get the procedure tuple corresponding to the given function Oid
*/
- procedureTuple = SearchSysCache(PROCOID,
- ObjectIdGetDatum(foid),
- 0, 0, 0);
+ procedureTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(foid));
if (!HeapTupleIsValid(procedureTuple))
elog(ERROR, "cache lookup failed for function %u", foid);
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
@@ -885,9 +883,7 @@ sql_exec_error_callback(void *arg)
int syntaxerrposition;
/* Need access to function's pg_proc tuple */
- func_tuple = SearchSysCache(PROCOID,
- ObjectIdGetDatum(flinfo->fn_oid),
- 0, 0, 0);
+ func_tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(flinfo->fn_oid));
if (!HeapTupleIsValid(func_tuple))
return; /* shouldn't happen */
functup = (Form_pg_proc) GETSTRUCT(func_tuple);
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 9f748ca6c0a..14a0a091b0f 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -71,7 +71,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.173 2010/02/12 17:33:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.174 2010/02/14 18:42:14 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1597,9 +1597,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
}
peraggstate->numArguments = numArguments;
- 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);
@@ -1620,9 +1619,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
HeapTuple procTuple;
Oid aggOwner;
- procTuple = SearchSysCache(PROCOID,
- ObjectIdGetDatum(aggref->aggfnoid),
- 0, 0, 0);
+ procTuple = SearchSysCache1(PROCOID,
+ ObjectIdGetDatum(aggref->aggfnoid));
if (!HeapTupleIsValid(procTuple))
elog(ERROR, "cache lookup failed for function %u",
aggref->aggfnoid);
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 86bbef9be07..6a41a290126 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.127 2010/02/01 15:43:36 rhaas Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.128 2010/02/14 18:42:14 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -999,11 +999,10 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
/*
* Try to find the MCV statistics for the outer relation's join key.
*/
- statsTuple = SearchSysCache(STATRELATTINH,
- ObjectIdGetDatum(node->skewTable),
- Int16GetDatum(node->skewColumn),
- BoolGetDatum(node->skewInherit),
- 0);
+ statsTuple = SearchSysCache3(STATRELATTINH,
+ ObjectIdGetDatum(node->skewTable),
+ Int16GetDatum(node->skewColumn),
+ BoolGetDatum(node->skewInherit));
if (!HeapTupleIsValid(statsTuple))
return;
diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index c2c0af3cde2..2668d83b03e 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -27,7 +27,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeWindowAgg.c,v 1.10 2010/02/12 17:33:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeWindowAgg.c,v 1.11 2010/02/14 18:42:14 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1726,9 +1726,7 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc,
inputTypes[i++] = exprType((Node *) lfirst(lc));
}
- aggTuple = SearchSysCache(AGGFNOID,
- ObjectIdGetDatum(wfunc->winfnoid),
- 0, 0, 0);
+ aggTuple = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(wfunc->winfnoid));
if (!HeapTupleIsValid(aggTuple))
elog(ERROR, "cache lookup failed for aggregate %u",
wfunc->winfnoid);
@@ -1747,9 +1745,8 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc,
HeapTuple procTuple;
Oid aggOwner;
- procTuple = SearchSysCache(PROCOID,
- ObjectIdGetDatum(wfunc->winfnoid),
- 0, 0, 0);
+ procTuple = SearchSysCache1(PROCOID,
+ ObjectIdGetDatum(wfunc->winfnoid));
if (!HeapTupleIsValid(procTuple))
elog(ERROR, "cache lookup failed for function %u",
wfunc->winfnoid);
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 35261444d61..a78474f037b 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.213 2010/01/02 16:57:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.214 2010/02/14 18:42:14 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -911,9 +911,7 @@ SPI_gettype(TupleDesc tupdesc, int fnumber)
else
typoid = (SystemAttributeDefinition(fnumber, true))->atttypid;
- typeTuple = SearchSysCache(TYPEOID,
- ObjectIdGetDatum(typoid),
- 0, 0, 0);
+ typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typoid));
if (!HeapTupleIsValid(typeTuple))
{