Officially decouple FUNC_MAX_ARGS from INDEX_MAX_KEYS, and set the
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Mar 2005 03:01:32 +0000 (03:01 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Mar 2005 03:01:32 +0000 (03:01 +0000)
former to 100 by default.  Clean up some of the less necessary
dependencies on FUNC_MAX_ARGS; however, the biggie (FunctionCallInfoData)
remains.

15 files changed:
doc/src/sgml/runtime.sgml
src/backend/access/transam/xlog.c
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_operator.c
src/backend/commands/proclang.c
src/backend/commands/trigger.c
src/backend/commands/typecmds.c
src/backend/parser/parse_func.c
src/backend/tcop/fastpath.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/fmgr/fmgr.c
src/bin/pg_controldata/pg_controldata.c
src/bin/pg_resetxlog/pg_resetxlog.c
src/include/catalog/pg_control.h
src/include/pg_config_manual.h

index 4a4614742d6defec3f419f9e69411eb8daa4ff0b..40bbf5bbcfdde1f860799e6f7afd004de10be0d0 100644 (file)
@@ -3774,7 +3774,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
        <para>
         Shows the maximum number of function arguments. It is determined by
         the value of <literal>FUNC_MAX_ARGS</> when building the server. The
-        default value is 32.
+        default value is 100.
        </para>
       </listitem>
      </varlistentry>
index 3eca30625866d9b18372732824999a811fd8e6fb..cafa931adf638e4c797ecb417577d8f5c5387d43 100644 (file)
@@ -3120,7 +3120,7 @@ WriteControlFile(void)
        ControlFile->xlog_seg_size = XLOG_SEG_SIZE;
 
        ControlFile->nameDataLen = NAMEDATALEN;
-       ControlFile->funcMaxArgs = FUNC_MAX_ARGS;
+       ControlFile->indexMaxKeys = INDEX_MAX_KEYS;
 
 #ifdef HAVE_INT64_TIMESTAMP
        ControlFile->enableIntTimes = TRUE;
@@ -3285,12 +3285,12 @@ ReadControlFile(void)
                                         " but the server was compiled with NAMEDATALEN %d.",
                                                   ControlFile->nameDataLen, NAMEDATALEN),
                         errhint("It looks like you need to recompile or initdb.")));
-       if (ControlFile->funcMaxArgs != FUNC_MAX_ARGS)
+       if (ControlFile->indexMaxKeys != INDEX_MAX_KEYS)
                ereport(FATAL,
                                (errmsg("database files are incompatible with server"),
-                                errdetail("The database cluster was initialized with FUNC_MAX_ARGS %d,"
-                                  " but the server was compiled with FUNC_MAX_ARGS %d.",
-                                                  ControlFile->funcMaxArgs, FUNC_MAX_ARGS),
+                                errdetail("The database cluster was initialized with INDEX_MAX_KEYS %d,"
+                                  " but the server was compiled with INDEX_MAX_KEYS %d.",
+                                                  ControlFile->indexMaxKeys, INDEX_MAX_KEYS),
                         errhint("It looks like you need to recompile or initdb.")));
 
 #ifdef HAVE_INT64_TIMESTAMP
index 40b59c4d3a64a424c6b39c2dd4400c7a3a39f375..dd4459e2aba36b3f31098a3591f38ccac1fa3ab4 100644 (file)
@@ -57,7 +57,7 @@ AggregateCreate(const char *aggName,
        Oid                     finalfn = InvalidOid;   /* can be omitted */
        Oid                     rettype;
        Oid                     finaltype;
-       Oid                     fnArgs[FUNC_MAX_ARGS];
+       Oid                     fnArgs[2];              /* we only deal with 1- and 2-arg fns */
        int                     nargs_transfn;
        Oid                     procOid;
        TupleDesc       tupDesc;
@@ -85,7 +85,6 @@ AggregateCreate(const char *aggName,
                        "transition type must have one of them as its base type.")));
 
        /* handle transfn */
-       MemSet(fnArgs, 0, FUNC_MAX_ARGS * sizeof(Oid));
        fnArgs[0] = aggTransType;
        if (aggBaseType == ANYOID)
                nargs_transfn = 1;
@@ -139,7 +138,6 @@ AggregateCreate(const char *aggName,
        /* handle finalfn, if supplied */
        if (aggfinalfnName)
        {
-               MemSet(fnArgs, 0, FUNC_MAX_ARGS * sizeof(Oid));
                fnArgs[0] = aggTransType;
                finalfn = lookup_agg_function(aggfinalfnName, 1, fnArgs,
                                                                          &finaltype);
@@ -174,7 +172,6 @@ AggregateCreate(const char *aggName,
         * aggregate.  (This could fail if there's already a conflicting
         * entry.)
         */
-       MemSet(fnArgs, 0, FUNC_MAX_ARGS * sizeof(Oid));
        fnArgs[0] = aggBaseType;
 
        procOid = ProcedureCreate(aggName,
index 72c979d0cbde59b4030a1ea98e3947346b4098c4..09e01ebd2f66bae6ba6f08df66aeabd4fde131fc 100644 (file)
@@ -391,7 +391,7 @@ OperatorCreate(const char *operatorName,
                                restOid,
                                joinOid;
        bool            selfCommutator = false;
-       Oid                     typeId[FUNC_MAX_ARGS];
+       Oid                     typeId[4];              /* only need up to 4 args here */
        int                     nargs;
        NameData        oname;
        TupleDesc       tupDesc;
@@ -454,7 +454,6 @@ OperatorCreate(const char *operatorName,
         * procedureName to place in "result" field. Do this before shells are
         * created so we don't have to worry about deleting them later.
         */
-       MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
        if (!OidIsValid(leftTypeId))
        {
                typeId[0] = rightTypeId;
@@ -479,7 +478,6 @@ OperatorCreate(const char *operatorName,
         */
        if (restrictionName)
        {
-               MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
                typeId[0] = INTERNALOID;        /* Query */
                typeId[1] = OIDOID;             /* operator OID */
                typeId[2] = INTERNALOID;        /* args list */
@@ -495,7 +493,6 @@ OperatorCreate(const char *operatorName,
         */
        if (joinName)
        {
-               MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
                typeId[0] = INTERNALOID;        /* Query */
                typeId[1] = OIDOID;             /* operator OID */
                typeId[2] = INTERNALOID;        /* args list */
index d672df5021f9849dee5785cecc95ae34c23e8ade..46fa97f4a772a3bb8acaa1fa65c6b404359bcfa3 100644 (file)
@@ -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
index ccd0f64aed3aa365a8f4931eca751557df60c373..ddf20d60cbc108ae942b3f4eaaf9aaee0c2f2506 100644 (file)
@@ -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);
 
index 5a66d4e4cea2d24f4891e80369fe8ec426032182..6f80fc3a89a0d3bada014dd51c4ad466736946fa 100644 (file)
@@ -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);
index 674c62e55cf827199ff8997a87604bc18bc8136d..cc3373cd8b9af103b295540b6d4e34efbf11c6d8 100644 (file)
@@ -85,8 +85,8 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
        if (nargs > FUNC_MAX_ARGS)
                ereport(ERROR,
                                (errcode(ERRCODE_TOO_MANY_ARGUMENTS),
-                          errmsg("cannot pass more than %d arguments to a function",
-                                         FUNC_MAX_ARGS)));
+                                errmsg("cannot pass more than %d arguments to a function",
+                                               FUNC_MAX_ARGS)));
 
        if (fargs)
        {
@@ -123,8 +123,6 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
         * Okay, it's not a column projection, so it must really be a
         * function. Extract arg type info in preparation for function lookup.
         */
-       MemSet(actual_arg_types, 0, FUNC_MAX_ARGS * sizeof(Oid));
-
        argn = 0;
        foreach(l, fargs)
        {
@@ -376,6 +374,13 @@ func_select_candidate(int nargs,
        bool            slot_has_preferred_type[FUNC_MAX_ARGS];
        bool            resolved_unknowns;
 
+       /* protect local fixed-size arrays */
+       if (nargs > FUNC_MAX_ARGS)
+               ereport(ERROR,
+                               (errcode(ERRCODE_TOO_MANY_ARGUMENTS),
+                                errmsg("cannot pass more than %d arguments to a function",
+                                               FUNC_MAX_ARGS)));
+
        /*
         * If any input types are domains, reduce them to their base types.
         * This ensures that we will consider functions on the base type to be
@@ -866,9 +871,13 @@ func_get_detail(List *funcname,
 static Oid **
 argtype_inherit(int nargs, Oid *argtypes)
 {
+       Oid               **result;
        Oid                     relid;
        int                     i;
-       InhPaths        arginh[FUNC_MAX_ARGS];
+       InhPaths   *arginh;
+
+       /* Set up the vector of superclass information */
+       arginh = (InhPaths *) palloc(nargs * sizeof(InhPaths));
 
        for (i = 0; i < nargs; i++)
        {
@@ -882,8 +891,12 @@ argtype_inherit(int nargs, Oid *argtypes)
                }
        }
 
-       /* return an ordered cross-product of the classes involved */
-       return gen_cross_product(arginh, nargs);
+       /* Compute an ordered cross-product of the classes involved */
+       result = gen_cross_product(arginh, nargs);
+
+       pfree(arginh);
+
+       return result;
 }
 
 /*
@@ -993,7 +1006,7 @@ gen_cross_product(InhPaths *arginh, int nargs)
        Oid                *oneres;
        int                     i,
                                j;
-       int                     cur[FUNC_MAX_ARGS];
+       int                *cur;
 
        /*
         * At each position we want to try the original datatype, plus each
@@ -1016,7 +1029,7 @@ gen_cross_product(InhPaths *arginh, int nargs)
         * generate the original input type at position i.      When cur[i] == k
         * for k > 0, generate its k'th supertype.
         */
-       MemSet(cur, 0, sizeof(cur));
+       cur = (int *) palloc0(nargs * sizeof(int));
 
        for (;;)
        {
@@ -1036,7 +1049,7 @@ gen_cross_product(InhPaths *arginh, int nargs)
                cur[i] += 1;
 
                /* Generate the proper output type-OID vector */
-               oneres = (Oid *) palloc0(FUNC_MAX_ARGS * sizeof(Oid));
+               oneres = (Oid *) palloc(nargs * sizeof(Oid));
 
                for (i = 0; i < nargs; i++)
                {
@@ -1054,6 +1067,8 @@ gen_cross_product(InhPaths *arginh, int nargs)
 
        Assert(j == nanswers);
 
+       pfree(cur);
+
        return result;
 }
 
@@ -1380,7 +1395,6 @@ LookupFuncNameTypeNames(List *funcname, List *argtypes, bool noError)
        int                     i;
        ListCell   *args_item;
 
-       MemSet(argoids, 0, FUNC_MAX_ARGS * sizeof(Oid));
        argcount = list_length(argtypes);
        if (argcount > FUNC_MAX_ARGS)
                ereport(ERROR,
index fe87f69c032000fd8aa1dcbe9c48a7d32a7b1ed0..eef2438e7cd1896aabd3ef31e581087e42ee6062 100644 (file)
@@ -216,7 +216,7 @@ fetch_fp_info(Oid func_id, struct fp_info * fip)
         * the struct fp_info across transactions anymore, but keep it
         * anyway.]
         */
-       MemSet((char *) fip, 0, sizeof(struct fp_info));
+       MemSet(fip, 0, sizeof(struct fp_info));
        fip->funcid = InvalidOid;
 
        fmgr_info(func_id, &fip->flinfo);
@@ -341,8 +341,7 @@ HandleFunctionRequest(StringInfo msgBuf)
        /*
         * Prepare function call info block and insert arguments.
         */
-       MemSet(&fcinfo, 0, sizeof(fcinfo));
-       fcinfo.flinfo = &fip->flinfo;
+       InitFunctionCallInfoData(fcinfo, &fip->flinfo, 0, NULL, NULL);
 
        if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
                rformat = parse_fcall_arguments(msgBuf, fip, &fcinfo);
@@ -443,6 +442,7 @@ parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip,
                        fcinfo->argnull[i] = true;
                        continue;
                }
+               fcinfo->argnull[i] = false;
                if (argsize < 0)
                        ereport(ERROR,
                                        (errcode(ERRCODE_PROTOCOL_VIOLATION),
@@ -566,6 +566,7 @@ parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info * fip,
                        fcinfo->argnull[i] = true;
                        continue;
                }
+               fcinfo->argnull[i] = false;
                if (argsize < 0)
                        ereport(ERROR,
                                        (errcode(ERRCODE_PROTOCOL_VIOLATION),
index 7725002a15427550423cdca0bf5158fa265a92c7..6d4f4cfa7d63ec3299d72fc25d6273599a25fb6b 100644 (file)
@@ -2577,9 +2577,8 @@ array_eq(PG_FUNCTION_ARGS)
                /*
                 * apply the operator to each pair of array elements.
                 */
-               MemSet(&locfcinfo, 0, sizeof(locfcinfo));
-               locfcinfo.flinfo = &typentry->eq_opr_finfo;
-               locfcinfo.nargs = 2;
+               InitFunctionCallInfoData(locfcinfo, &typentry->eq_opr_finfo, 2,
+                                                                NULL, NULL);
 
                /* Loop over source data */
                for (i = 0; i < nitems1; i++)
@@ -2727,9 +2726,8 @@ array_cmp(FunctionCallInfo fcinfo)
        /*
         * apply the operator to each pair of array elements.
         */
-       MemSet(&locfcinfo, 0, sizeof(locfcinfo));
-       locfcinfo.flinfo = &typentry->cmp_proc_finfo;
-       locfcinfo.nargs = 2;
+       InitFunctionCallInfoData(locfcinfo, &typentry->cmp_proc_finfo, 2,
+                                                        NULL, NULL);
 
        /* Loop over source data */
        min_nitems = Min(nitems1, nitems2);
@@ -3172,12 +3170,14 @@ array_type_length_coerce_internal(ArrayType *src,
         * We pass on the desttypmod and isExplicit flags whether or not the
         * function wants them.
         */
-       MemSet(&locfcinfo, 0, sizeof(locfcinfo));
-       locfcinfo.flinfo = &my_extra->coerce_finfo;
-       locfcinfo.nargs = 3;
+       InitFunctionCallInfoData(locfcinfo, &my_extra->coerce_finfo, 3,
+                                                        NULL, NULL);
        locfcinfo.arg[0] = PointerGetDatum(src);
        locfcinfo.arg[1] = Int32GetDatum(desttypmod);
        locfcinfo.arg[2] = BoolGetDatum(isExplicit);
+       locfcinfo.argnull[0] = false;
+       locfcinfo.argnull[1] = false;
+       locfcinfo.argnull[2] = false;
 
        return array_map(&locfcinfo, my_extra->srctype, my_extra->desttype,
                                         &my_extra->amstate);
@@ -3246,12 +3246,14 @@ array_length_coerce(PG_FUNCTION_ARGS)
         *
         * Note: we pass isExplicit whether or not the function wants it ...
         */
-       MemSet(&locfcinfo, 0, sizeof(locfcinfo));
-       locfcinfo.flinfo = &my_extra->coerce_finfo;
-       locfcinfo.nargs = 3;
+       InitFunctionCallInfoData(locfcinfo, &my_extra->coerce_finfo, 3,
+                                                        NULL, NULL);
        locfcinfo.arg[0] = PointerGetDatum(v);
        locfcinfo.arg[1] = Int32GetDatum(desttypmod);
        locfcinfo.arg[2] = BoolGetDatum(isExplicit);
+       locfcinfo.argnull[0] = false;
+       locfcinfo.argnull[1] = false;
+       locfcinfo.argnull[2] = false;
 
        return array_map(&locfcinfo, ARR_ELEMTYPE(v), ARR_ELEMTYPE(v),
                                         &my_extra->amstate);
index aec8b6449ec35c04a6955b7e8e5aa35f1ba9f96b..6972fba57a24341a762855fa5cbbe55f4dd27ad4 100644 (file)
@@ -337,9 +337,9 @@ fmgr_info_C_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedureTuple)
                        /* Old style: need to use a handler */
                        finfo->fn_addr = fmgr_oldstyle;
                        fnextra = (Oldstyle_fnextra *)
-                               MemoryContextAlloc(finfo->fn_mcxt, sizeof(Oldstyle_fnextra));
+                               MemoryContextAllocZero(finfo->fn_mcxt,
+                                                                          sizeof(Oldstyle_fnextra));
                        finfo->fn_extra = (void *) fnextra;
-                       MemSet(fnextra, 0, sizeof(Oldstyle_fnextra));
                        fnextra->func = (func_ptr) user_fn;
                        for (i = 0; i < procedureStruct->pronargs; i++)
                        {
@@ -795,8 +795,8 @@ fmgr_security_definer(PG_FUNCTION_ARGS)
 
        if (!fcinfo->flinfo->fn_extra)
        {
-               fcache = MemoryContextAlloc(fcinfo->flinfo->fn_mcxt, sizeof(*fcache));
-               memset(fcache, 0, sizeof(*fcache));
+               fcache = MemoryContextAllocZero(fcinfo->flinfo->fn_mcxt,
+                                                                               sizeof(*fcache));
 
                fmgr_info_cxt_security(fcinfo->flinfo->fn_oid, &fcache->flinfo,
                                                           fcinfo->flinfo->fn_mcxt, true);
index aeb46d6c703b42445d57bbbfd6f6caaaa2570033..aee4ac97c926379cc4ce5823bc6a07c2fa0f7bcf 100644 (file)
@@ -170,7 +170,7 @@ main(int argc, char *argv[])
        printf(_("Blocks per segment of large relation: %u\n"), ControlFile.relseg_size);
        printf(_("Bytes per WAL segment:                %u\n"), ControlFile.xlog_seg_size);
        printf(_("Maximum length of identifiers:        %u\n"), ControlFile.nameDataLen);
-       printf(_("Maximum number of function arguments: %u\n"), ControlFile.funcMaxArgs);
+       printf(_("Maximum columns in an index:          %u\n"), ControlFile.indexMaxKeys);
        printf(_("Date/time type storage:               %s\n"),
                   (ControlFile.enableIntTimes ? _("64-bit integers") : _("floating-point numbers")));
        printf(_("Maximum length of locale name:        %u\n"), ControlFile.localeBuflen);
index 68398275596c63fce459271f6170dbba8712fb66..fc0e805fb38a6c9cf2c665a597b1e7a1385c6207 100644 (file)
@@ -417,7 +417,7 @@ GuessControlValues(void)
        ControlFile.relseg_size = RELSEG_SIZE;
        ControlFile.xlog_seg_size = XLOG_SEG_SIZE;
        ControlFile.nameDataLen = NAMEDATALEN;
-       ControlFile.funcMaxArgs = FUNC_MAX_ARGS;
+       ControlFile.indexMaxKeys = INDEX_MAX_KEYS;
 #ifdef HAVE_INT64_TIMESTAMP
        ControlFile.enableIntTimes = TRUE;
 #else
@@ -481,7 +481,7 @@ PrintControlValues(bool guessed)
        printf(_("Database block size:                  %u\n"), ControlFile.blcksz);
        printf(_("Blocks per segment of large relation: %u\n"), ControlFile.relseg_size);
        printf(_("Maximum length of identifiers:        %u\n"), ControlFile.nameDataLen);
-       printf(_("Maximum number of function arguments: %u\n"), ControlFile.funcMaxArgs);
+       printf(_("Maximum columns in an index:          %u\n"), ControlFile.indexMaxKeys);
        printf(_("Date/time type storage:               %s\n"),
                   (ControlFile.enableIntTimes ? _("64-bit integers") : _("floating-point numbers")));
        printf(_("Maximum length of locale name:        %u\n"), ControlFile.localeBuflen);
index 44cfcf8c6d462a9f6e95029e5ac5150a61a0440f..f935785e891a566805e2f50e87700b2e23af3ebb 100644 (file)
@@ -116,7 +116,7 @@ typedef struct ControlFileData
        uint32          xlog_seg_size;  /* size of each WAL segment */
 
        uint32          nameDataLen;    /* catalog name field width */
-       uint32          funcMaxArgs;    /* maximum number of function arguments */
+       uint32          indexMaxKeys;   /* max number of columns in an index */
 
        /* flag indicating internal format of timestamp, interval, time */
        uint32          enableIntTimes; /* int64 storage enabled? */
index 51c432848b03757108f95b58790ceb0ab7fd7495..d3945ebbc8a461908841cefaba9a7595342c47ad 100644 (file)
 #define XLOG_SEG_SIZE  (16*1024*1024)
 
 /*
- * Maximum number of columns in an index and maximum number of
- * arguments to a function. They must be the same value.
+ * Maximum number of arguments to a function.
  *
  * The minimum value is 8 (index creation uses 8-argument functions).
- * There is no specific upper limit, although large values will waste
- * system-table space and processing time.
+ * The maximum possible value is around 600 (limited by index tuple size in
+ * pg_proc's index; BLCKSZ larger than 8K would allow more).  Values larger
+ * than needed will waste memory and processing time, but do not directly
+ * cost disk space.
  *
- * Changing these requires an initdb.
+ * Changing this does not require an initdb, but it does require a full
+ * backend recompile (including any user-defined C functions).
+ */
+#define FUNC_MAX_ARGS          100
+
+/*
+ * Maximum number of columns in an index.  There is little point in making
+ * this anything but a multiple of 32, because the main cost is associated
+ * with index tuple header size (see access/itup.h).
+ *
+ * Changing this requires an initdb.
  */
 #define INDEX_MAX_KEYS         32
-#define FUNC_MAX_ARGS          INDEX_MAX_KEYS
 
 /*
  * Define this to make libpgtcl's "pg_result -assign" command process