mirror of
https://github.com/postgres/postgres.git
synced 2025-08-19 23:22:23 +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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user