1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Officially decouple FUNC_MAX_ARGS from INDEX_MAX_KEYS, and set the

former to 100 by default.  Clean up some of the less necessary
dependencies on FUNC_MAX_ARGS; however, the biggie (FunctionCallInfoData)
remains.
This commit is contained in:
Tom Lane
2005-03-29 03:01:32 +00:00
parent 4f6f5db474
commit 8c85a34a3b
15 changed files with 100 additions and 97 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.57 2005/02/14 06:17:44 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.58 2005/03/29 03:01:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,7 +44,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
Oid procOid,
valProcOid;
Oid funcrettype;
Oid typev[FUNC_MAX_ARGS];
Oid funcargtypes[1];
NameData langname;
char nulls[Natts_pg_language];
Datum values[Natts_pg_language];
@@ -80,8 +80,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
* Lookup the PL handler function and check that it is of the expected
* return type
*/
MemSet(typev, 0, sizeof(typev));
procOid = LookupFuncName(stmt->plhandler, 0, typev, false);
procOid = LookupFuncName(stmt->plhandler, 0, funcargtypes, false);
funcrettype = get_func_rettype(procOid);
if (funcrettype != LANGUAGE_HANDLEROID)
{
@@ -108,8 +107,8 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
/* validate the validator function */
if (stmt->plvalidator)
{
typev[0] = OIDOID;
valProcOid = LookupFuncName(stmt->plvalidator, 1, typev, false);
funcargtypes[0] = OIDOID;
valProcOid = LookupFuncName(stmt->plvalidator, 1, funcargtypes, false);
/* return value is ignored, so we don't check the type */
}
else

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.182 2005/03/29 00:16:57 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.183 2005/03/29 03:01:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1179,10 +1179,7 @@ ExecCallTriggerFunc(TriggerData *trigdata,
/*
* Call the function, passing no arguments but setting a context.
*/
MemSet(&fcinfo, 0, sizeof(fcinfo));
fcinfo.flinfo = finfo;
fcinfo.context = (Node *) trigdata;
InitFunctionCallInfoData(fcinfo, finfo, 0, (Node *) trigdata, NULL);
result = FunctionCallInvoke(&fcinfo);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.67 2005/01/27 23:23:56 neilc Exp $
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.68 2005/03/29 03:01:30 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -854,7 +854,7 @@ RemoveDomain(List *names, DropBehavior behavior)
static Oid
findTypeInputFunction(List *procname, Oid typeOid)
{
Oid argList[FUNC_MAX_ARGS];
Oid argList[3];
Oid procOid;
/*
@@ -864,8 +864,6 @@ findTypeInputFunction(List *procname, Oid typeOid)
* For backwards compatibility we allow OPAQUE in place of CSTRING; if we
* see this, we issue a warning and fix up the pg_proc entry.
*/
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
argList[0] = CSTRINGOID;
procOid = LookupFuncName(procname, 1, argList, true);
@@ -880,8 +878,6 @@ findTypeInputFunction(List *procname, Oid typeOid)
return procOid;
/* No luck, try it with OPAQUE */
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
argList[0] = OPAQUEOID;
procOid = LookupFuncName(procname, 1, argList, true);
@@ -925,7 +921,7 @@ findTypeInputFunction(List *procname, Oid typeOid)
static Oid
findTypeOutputFunction(List *procname, Oid typeOid)
{
Oid argList[FUNC_MAX_ARGS];
Oid argList[2];
Oid procOid;
/*
@@ -936,8 +932,6 @@ findTypeOutputFunction(List *procname, Oid typeOid)
* type name; if we see this, we issue a warning and fix up the
* pg_proc entry.
*/
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
argList[0] = typeOid;
procOid = LookupFuncName(procname, 1, argList, true);
@@ -951,8 +945,6 @@ findTypeOutputFunction(List *procname, Oid typeOid)
return procOid;
/* No luck, try it with OPAQUE */
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
argList[0] = OPAQUEOID;
procOid = LookupFuncName(procname, 1, argList, true);
@@ -995,15 +987,13 @@ findTypeOutputFunction(List *procname, Oid typeOid)
static Oid
findTypeReceiveFunction(List *procname, Oid typeOid)
{
Oid argList[FUNC_MAX_ARGS];
Oid argList[2];
Oid procOid;
/*
* Receive functions can take a single argument of type INTERNAL, or
* two arguments (internal, oid).
*/
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
argList[0] = INTERNALOID;
procOid = LookupFuncName(procname, 1, argList, true);
@@ -1027,15 +1017,13 @@ findTypeReceiveFunction(List *procname, Oid typeOid)
static Oid
findTypeSendFunction(List *procname, Oid typeOid)
{
Oid argList[FUNC_MAX_ARGS];
Oid argList[2];
Oid procOid;
/*
* Send functions can take a single argument of the type, or two
* arguments (data value, element OID).
*/
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
argList[0] = typeOid;
procOid = LookupFuncName(procname, 1, argList, true);
@@ -1059,15 +1047,13 @@ findTypeSendFunction(List *procname, Oid typeOid)
static Oid
findTypeAnalyzeFunction(List *procname, Oid typeOid)
{
Oid argList[FUNC_MAX_ARGS];
Oid argList[1];
Oid procOid;
/*
* Analyze functions always take one INTERNAL argument and return
* bool.
*/
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
argList[0] = INTERNALOID;
procOid = LookupFuncName(procname, 1, argList, true);