mirror of
https://github.com/postgres/postgres.git
synced 2025-07-17 06:41:09 +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/rewrite/rewriteDefine.c,v 1.140 2010/01/02 16:57:51 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.141 2010/02/14 18:42:15 rhaas Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -96,10 +96,9 @@ InsertRule(char *rulname,
|
||||
/*
|
||||
* Check to see if we are replacing an existing tuple
|
||||
*/
|
||||
oldtup = SearchSysCache(RULERELNAME,
|
||||
ObjectIdGetDatum(eventrel_oid),
|
||||
PointerGetDatum(rulname),
|
||||
0, 0);
|
||||
oldtup = SearchSysCache2(RULERELNAME,
|
||||
ObjectIdGetDatum(eventrel_oid),
|
||||
PointerGetDatum(rulname));
|
||||
|
||||
if (HeapTupleIsValid(oldtup))
|
||||
{
|
||||
@ -679,10 +678,9 @@ EnableDisableRule(Relation rel, const char *rulename,
|
||||
* Find the rule tuple to change.
|
||||
*/
|
||||
pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock);
|
||||
ruletup = SearchSysCacheCopy(RULERELNAME,
|
||||
ObjectIdGetDatum(owningRel),
|
||||
PointerGetDatum(rulename),
|
||||
0, 0);
|
||||
ruletup = SearchSysCacheCopy2(RULERELNAME,
|
||||
ObjectIdGetDatum(owningRel),
|
||||
PointerGetDatum(rulename));
|
||||
if (!HeapTupleIsValid(ruletup))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
@ -742,10 +740,9 @@ RenameRewriteRule(Oid owningRel, const char *oldName,
|
||||
|
||||
pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock);
|
||||
|
||||
ruletup = SearchSysCacheCopy(RULERELNAME,
|
||||
ObjectIdGetDatum(owningRel),
|
||||
PointerGetDatum(oldName),
|
||||
0, 0);
|
||||
ruletup = SearchSysCacheCopy2(RULERELNAME,
|
||||
ObjectIdGetDatum(owningRel),
|
||||
PointerGetDatum(oldName));
|
||||
if (!HeapTupleIsValid(ruletup))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
|
Reference in New Issue
Block a user