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/optimizer/util/predtest.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/optimizer/util/predtest.c')
-rw-r--r-- | src/backend/optimizer/util/predtest.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c index 91b6d49e0ec..dd19e4390b2 100644 --- a/src/backend/optimizer/util/predtest.c +++ b/src/backend/optimizer/util/predtest.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.30 2010/01/02 16:57:48 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.31 2010/02/14 18:42:15 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -1585,9 +1585,7 @@ get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it) * corresponding test operator. This should work for any logically * consistent opfamilies. */ - catlist = SearchSysCacheList(AMOPOPID, 1, - ObjectIdGetDatum(pred_op), - 0, 0, 0); + catlist = SearchSysCacheList1(AMOPOPID, ObjectIdGetDatum(pred_op)); /* * If we couldn't find any opfamily containing the pred_op, perhaps it is @@ -1601,9 +1599,8 @@ get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it) { pred_op_negated = true; ReleaseSysCacheList(catlist); - catlist = SearchSysCacheList(AMOPOPID, 1, - ObjectIdGetDatum(pred_op_negator), - 0, 0, 0); + catlist = SearchSysCacheList1(AMOPOPID, + ObjectIdGetDatum(pred_op_negator)); } } @@ -1638,10 +1635,9 @@ get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it) * From the same opfamily, find a strategy number for the clause_op, * if possible */ - clause_tuple = SearchSysCache(AMOPOPID, - ObjectIdGetDatum(clause_op), - ObjectIdGetDatum(opfamily_id), - 0, 0); + clause_tuple = SearchSysCache2(AMOPOPID, + ObjectIdGetDatum(clause_op), + ObjectIdGetDatum(opfamily_id)); if (HeapTupleIsValid(clause_tuple)) { Form_pg_amop clause_form = (Form_pg_amop) GETSTRUCT(clause_tuple); @@ -1655,10 +1651,9 @@ get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it) } else if (OidIsValid(clause_op_negator)) { - clause_tuple = SearchSysCache(AMOPOPID, - ObjectIdGetDatum(clause_op_negator), - ObjectIdGetDatum(opfamily_id), - 0, 0); + clause_tuple = SearchSysCache2(AMOPOPID, + ObjectIdGetDatum(clause_op_negator), + ObjectIdGetDatum(opfamily_id)); if (HeapTupleIsValid(clause_tuple)) { Form_pg_amop clause_form = (Form_pg_amop) GETSTRUCT(clause_tuple); |