aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/functioncmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/functioncmds.c')
-rw-r--r--src/backend/commands/functioncmds.c86
1 files changed, 28 insertions, 58 deletions
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 5c8e13bc9a2..0a9920097b6 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.115 2010/01/26 16:33:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.116 2010/02/14 18:42:14 rhaas Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@@ -829,9 +829,7 @@ CreateFunction(CreateFunctionStmt *stmt, const char *queryString)
languageName = case_translate_language_name(language);
/* Look up the language and validate permissions */
- languageTuple = SearchSysCache(LANGNAME,
- PointerGetDatum(languageName),
- 0, 0, 0);
+ languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(languageName));
if (!HeapTupleIsValid(languageTuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
@@ -990,9 +988,7 @@ RemoveFunction(RemoveFuncStmt *stmt)
return;
}
- tup = SearchSysCache(PROCOID,
- ObjectIdGetDatum(funcOid),
- 0, 0, 0);
+ tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid);
@@ -1049,9 +1045,7 @@ RemoveFunctionById(Oid funcOid)
*/
relation = heap_open(ProcedureRelationId, RowExclusiveLock);
- tup = SearchSysCache(PROCOID,
- ObjectIdGetDatum(funcOid),
- 0, 0, 0);
+ tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid);
@@ -1070,9 +1064,7 @@ RemoveFunctionById(Oid funcOid)
{
relation = heap_open(AggregateRelationId, RowExclusiveLock);
- tup = SearchSysCache(AGGFNOID,
- ObjectIdGetDatum(funcOid),
- 0, 0, 0);
+ tup = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for pg_aggregate tuple for function %u", funcOid);
@@ -1102,9 +1094,7 @@ RenameFunction(List *name, List *argtypes, const char *newname)
procOid = LookupFuncNameTypeNames(name, argtypes, false);
- tup = SearchSysCacheCopy(PROCOID,
- ObjectIdGetDatum(procOid),
- 0, 0, 0);
+ tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(procOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", procOid);
procForm = (Form_pg_proc) GETSTRUCT(tup);
@@ -1119,11 +1109,10 @@ RenameFunction(List *name, List *argtypes, const char *newname)
namespaceOid = procForm->pronamespace;
/* make sure the new name doesn't exist */
- if (SearchSysCacheExists(PROCNAMEARGSNSP,
- CStringGetDatum(newname),
- PointerGetDatum(&procForm->proargtypes),
- ObjectIdGetDatum(namespaceOid),
- 0))
+ if (SearchSysCacheExists3(PROCNAMEARGSNSP,
+ CStringGetDatum(newname),
+ PointerGetDatum(&procForm->proargtypes),
+ ObjectIdGetDatum(namespaceOid)))
{
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_FUNCTION),
@@ -1169,9 +1158,7 @@ AlterFunctionOwner(List *name, List *argtypes, Oid newOwnerId)
procOid = LookupFuncNameTypeNames(name, argtypes, false);
- tup = SearchSysCache(PROCOID,
- ObjectIdGetDatum(procOid),
- 0, 0, 0);
+ tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", procOid);
@@ -1198,9 +1185,7 @@ AlterFunctionOwner_oid(Oid procOid, Oid newOwnerId)
rel = heap_open(ProcedureRelationId, RowExclusiveLock);
- tup = SearchSysCache(PROCOID,
- ObjectIdGetDatum(procOid),
- 0, 0, 0);
+ tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(procOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", procOid);
AlterFunctionOwner_internal(rel, tup, newOwnerId);
@@ -1317,9 +1302,7 @@ AlterFunction(AlterFunctionStmt *stmt)
stmt->func->funcargs,
false);
- tup = SearchSysCacheCopy(PROCOID,
- ObjectIdGetDatum(funcOid),
- 0, 0, 0);
+ tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid);
@@ -1436,9 +1419,7 @@ SetFunctionReturnType(Oid funcOid, Oid newRetType)
pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy(PROCOID,
- ObjectIdGetDatum(funcOid),
- 0, 0, 0);
+ tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid);
procForm = (Form_pg_proc) GETSTRUCT(tup);
@@ -1472,9 +1453,7 @@ SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType)
pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock);
- tup = SearchSysCacheCopy(PROCOID,
- ObjectIdGetDatum(funcOid),
- 0, 0, 0);
+ tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(funcOid));
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for function %u", funcOid);
procForm = (Form_pg_proc) GETSTRUCT(tup);
@@ -1560,9 +1539,7 @@ CreateCast(CreateCastStmt *stmt)
stmt->func->funcargs,
false);
- tuple = SearchSysCache(PROCOID,
- ObjectIdGetDatum(funcid),
- 0, 0, 0);
+ tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcid));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for function %u", funcid);
@@ -1716,10 +1693,9 @@ CreateCast(CreateCastStmt *stmt)
* the unique index would catch it anyway (so no need to sweat about race
* conditions).
*/
- tuple = SearchSysCache(CASTSOURCETARGET,
- ObjectIdGetDatum(sourcetypeid),
- ObjectIdGetDatum(targettypeid),
- 0, 0);
+ tuple = SearchSysCache2(CASTSOURCETARGET,
+ ObjectIdGetDatum(sourcetypeid),
+ ObjectIdGetDatum(targettypeid));
if (HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
@@ -1790,10 +1766,9 @@ DropCast(DropCastStmt *stmt)
sourcetypeid = typenameTypeId(NULL, stmt->sourcetype, NULL);
targettypeid = typenameTypeId(NULL, stmt->targettype, NULL);
- tuple = SearchSysCache(CASTSOURCETARGET,
- ObjectIdGetDatum(sourcetypeid),
- ObjectIdGetDatum(targettypeid),
- 0, 0);
+ tuple = SearchSysCache2(CASTSOURCETARGET,
+ ObjectIdGetDatum(sourcetypeid),
+ ObjectIdGetDatum(targettypeid));
if (!HeapTupleIsValid(tuple))
{
if (!stmt->missing_ok)
@@ -1888,9 +1863,7 @@ AlterFunctionNamespace(List *name, List *argtypes, bool isagg,
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC,
NameListToString(name));
- tup = SearchSysCacheCopy(PROCOID,
- ObjectIdGetDatum(procOid),
- 0, 0, 0);
+ tup = SearchSysCacheCopy1(PROCOID, ObjectIdGetDatum(procOid));
if (!HeapTupleIsValid(tup))
elog(ERROR, "cache lookup failed for function %u", procOid);
proc = (Form_pg_proc) GETSTRUCT(tup);
@@ -1920,11 +1893,10 @@ AlterFunctionNamespace(List *name, List *argtypes, bool isagg,
errmsg("cannot move objects into or out of TOAST schema")));
/* check for duplicate name (more friendly than unique-index failure) */
- if (SearchSysCacheExists(PROCNAMEARGSNSP,
- CStringGetDatum(NameStr(proc->proname)),
- PointerGetDatum(&proc->proargtypes),
- ObjectIdGetDatum(nspOid),
- 0))
+ if (SearchSysCacheExists3(PROCNAMEARGSNSP,
+ CStringGetDatum(NameStr(proc->proname)),
+ PointerGetDatum(&proc->proargtypes),
+ ObjectIdGetDatum(nspOid)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_FUNCTION),
errmsg("function \"%s\" already exists in schema \"%s\"",
@@ -2011,9 +1983,7 @@ ExecuteDoStmt(DoStmt *stmt)
languageName = case_translate_language_name(language);
/* Look up the language and validate permissions */
- languageTuple = SearchSysCache(LANGNAME,
- PointerGetDatum(languageName),
- 0, 0, 0);
+ languageTuple = SearchSysCache1(LANGNAME, PointerGetDatum(languageName));
if (!HeapTupleIsValid(languageTuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),