mirror of
https://github.com/postgres/postgres.git
synced 2025-11-22 12:22:45 +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/catalog/pg_proc.c,v 1.170 2010/01/02 16:57:36 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.171 2010/02/14 18:42:13 rhaas Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -338,11 +338,10 @@ ProcedureCreate(const char *procedureName,
|
||||
tupDesc = RelationGetDescr(rel);
|
||||
|
||||
/* Check for pre-existing definition */
|
||||
oldtup = SearchSysCache(PROCNAMEARGSNSP,
|
||||
PointerGetDatum(procedureName),
|
||||
PointerGetDatum(parameterTypes),
|
||||
ObjectIdGetDatum(procNamespace),
|
||||
0);
|
||||
oldtup = SearchSysCache3(PROCNAMEARGSNSP,
|
||||
PointerGetDatum(procedureName),
|
||||
PointerGetDatum(parameterTypes),
|
||||
ObjectIdGetDatum(procNamespace));
|
||||
|
||||
if (HeapTupleIsValid(oldtup))
|
||||
{
|
||||
@@ -647,9 +646,7 @@ fmgr_internal_validator(PG_FUNCTION_ARGS)
|
||||
* name will be found later if it isn't there now.
|
||||
*/
|
||||
|
||||
tuple = SearchSysCache(PROCOID,
|
||||
ObjectIdGetDatum(funcoid),
|
||||
0, 0, 0);
|
||||
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "cache lookup failed for function %u", funcoid);
|
||||
proc = (Form_pg_proc) GETSTRUCT(tuple);
|
||||
@@ -697,9 +694,7 @@ fmgr_c_validator(PG_FUNCTION_ARGS)
|
||||
* and for pg_dump loading it's much better if we *do* check.
|
||||
*/
|
||||
|
||||
tuple = SearchSysCache(PROCOID,
|
||||
ObjectIdGetDatum(funcoid),
|
||||
0, 0, 0);
|
||||
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "cache lookup failed for function %u", funcoid);
|
||||
proc = (Form_pg_proc) GETSTRUCT(tuple);
|
||||
@@ -742,9 +737,7 @@ fmgr_sql_validator(PG_FUNCTION_ARGS)
|
||||
bool haspolyarg;
|
||||
int i;
|
||||
|
||||
tuple = SearchSysCache(PROCOID,
|
||||
ObjectIdGetDatum(funcoid),
|
||||
0, 0, 0);
|
||||
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "cache lookup failed for function %u", funcoid);
|
||||
proc = (Form_pg_proc) GETSTRUCT(tuple);
|
||||
|
||||
Reference in New Issue
Block a user