mirror of
https://github.com/postgres/postgres.git
synced 2025-10-21 02:52:47 +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:
@@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.407 2010/02/09 21:43:30 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.408 2010/02/14 18:42:14 rhaas Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -498,9 +498,7 @@ vac_update_relstats(Relation relation,
|
||||
rd = heap_open(RelationRelationId, RowExclusiveLock);
|
||||
|
||||
/* Fetch a copy of the tuple to scribble on */
|
||||
ctup = SearchSysCacheCopy(RELOID,
|
||||
ObjectIdGetDatum(relid),
|
||||
0, 0, 0);
|
||||
ctup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid));
|
||||
if (!HeapTupleIsValid(ctup))
|
||||
elog(ERROR, "pg_class entry for relid %u vanished during vacuuming",
|
||||
relid);
|
||||
@@ -644,9 +642,7 @@ vac_update_datfrozenxid(void)
|
||||
relation = heap_open(DatabaseRelationId, RowExclusiveLock);
|
||||
|
||||
/* Fetch a copy of the tuple to scribble on */
|
||||
tuple = SearchSysCacheCopy(DATABASEOID,
|
||||
ObjectIdGetDatum(MyDatabaseId),
|
||||
0, 0, 0);
|
||||
tuple = SearchSysCacheCopy1(DATABASEOID, ObjectIdGetDatum(MyDatabaseId));
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "could not find tuple for database %u", MyDatabaseId);
|
||||
dbform = (Form_pg_database) GETSTRUCT(tuple);
|
||||
|
Reference in New Issue
Block a user