8000 Officially decouple FUNC_MAX_ARGS from INDEX_MAX_KEYS, and set the · postgrespro/postgres_cluster@8c85a34 · GitHub
[go: up one dir, main page]

Skip to content
  • Commit 8c85a34

    Browse files
    committed
    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.
    1 parent 4f6f5db commit 8c85a34

    File tree

    15 files changed

    +100
    -97
    lines changed

    15 files changed

    +100
    -97
    lines changed

    doc/src/sgml/runtime.sgml

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,5 +1,5 @@
    11
    <!--
    2-
    $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.311 2005/03/24 04:36:17 momjian Exp $
    2+
    $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.312 2005/03/29 03:01:29 tgl Exp $
    33
    -->
    44

    55
    <chapter Id="runtime">
    @@ -3774,7 +3774,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
    37743774
    <para>
    37753775
    Shows the maximum number of function arguments. It is determined by
    37763776
    the value of <literal>FUNC_MAX_ARGS</> when building the server. The
    3777-
    default value is 32.
    3777+
    default value is 100.
    37783778
    </para>
    37793779
    </listitem>
    37803780
    </varlistentry>

    src/backend/access/transam/xlog.c

    Lines changed: 6 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -7,7 +7,7 @@
    77
    * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
    88
    * Portions Copyright (c) 1994, Regents of the University of California
    99
    *
    10-
    * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.182 2005/03/24 04:36:17 momjian Exp $
    10+
    * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.183 2005/03/29 03:01:30 tgl Exp $
    1111
    *
    1212
    *-------------------------------------------------------------------------
    1313
    */
    @@ -3120,7 +3120,7 @@ WriteControlFile(void)
    31203120
    ControlFile->xlog_seg_size = XLOG_SEG_SIZE;
    31213121

    31223122
    ControlFile->nameDataLen = NAMEDATALEN;
    3123-
    ControlFile->funcMaxArgs = FUNC_MAX_ARGS;
    3123+
    ControlFile->indexMaxKeys = INDEX_MAX_KEYS;
    31243124

    31253125
    #ifdef HAVE_INT64_TIMESTAMP
    31263126
    ControlFile->enableIntTimes = TRUE;
    @@ -3285,12 +3285,12 @@ ReadControlFile(void)
    32853285
    " but the server was compiled with NAMEDATALEN %d.",
    32863286
    ControlFile->nameDataLen, NAMEDATALEN),
    32873287
    errhint("It looks like you need to recompile or initdb.")));
    3288-
    if (ControlFile->funcMaxArgs != FUNC_MAX_ARGS)
    3288+
    if (ControlFile->indexMaxKeys != INDEX_MAX_KEYS)
    32893289
    ereport(FATAL,
    32903290
    (errmsg("database files are incompatible with server"),
    3291-
    errdetail("The database cluster was initialized with FUNC_MAX_ARGS %d,"
    3292-
    " but the server was compiled with FUNC_MAX_ARGS %d.",
    3293-
    ControlFile->funcMaxArgs, FUNC_MAX_ARGS),
    3291+
    errdetail("The database cluster was initialized with INDEX_MAX_KEYS %d,"
    3292+
    " but the server was compiled with INDEX_MAX_KEYS %d.",
    3293+
    ControlFile->indexMaxKeys, INDEX_MAX_KEYS),
    32943294
    errhint("It looks like you need to recompile or initdb.")));
    32953295

    32963296
    #ifdef HAVE_INT64_TIMESTAMP

    src/backend/catalog/pg_aggregate.c

    Lines changed: 2 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -8,7 +8,7 @@
    88
    *
    99
    *
    1010
    * IDENTIFICATION
    11-
    * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.70 2005/01/27 23:42:15 tgl Exp $
    11+
    * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.71 2005/03/29 03:01:30 tgl Exp $
    1212
    *
    1313
    *-------------------------------------------------------------------------
    1414
    */
    @@ -57,7 +57,7 @@ AggregateCreate(const char *aggName,
    5757
    Oid finalfn = InvalidOid; /* can be omitted */
    5858
    Oid rettype;
    5959
    Oid finaltype;
    60-
    Oid fnArgs[FUNC_MAX_ARGS];
    60+
    Oid fnArgs[2]; /* we only deal with 1- and 2-arg fns */
    6161
    int nargs_transfn;
    6262
    Oid procOid;
    6363
    TupleDesc tupDesc;
    @@ -85,7 +85,6 @@ AggregateCreate(const char *aggName,
    8585
    "transition type must have one of them as its base type.")));
    8686

    8787
    /* handle transfn */
    88-
    MemSet(fnArgs, 0, FUNC_MAX_ARGS * sizeof(Oid));
    8988
    fnArgs[0] = aggTransType;
    9089
    if (aggBaseType == ANYOID)
    9190
    nargs_transfn = 1;
    @@ -139,7 +138,6 @@ AggregateCreate(const char *aggName,
    139138
    /* handle finalfn, if supplied */
    140139
    if (aggfinalfnName)
    141140
    {
    142-
    MemSet(fnArgs, 0, FUNC_MAX_ARGS * sizeof(Oid));
    143141
    fnArgs[0] = aggTransType;
    144142
    finalfn = lookup_agg_function(aggfinalfnName, 1, fnArgs,
    145143
    &finaltype);
    @@ -174,7 +172,6 @@ AggregateCreate(const char *aggName,
    174172
    * aggregate. (This could fail if there's already a conflicting
    175173
    * entry.)
    176174
    */
    177-
    MemSet(fnArgs, 0, FUNC_MAX_ARGS * sizeof(Oid));
    178175
    fnArgs[0] = aggBaseType;
    179176

    180177
    procOid = ProcedureCreate(aggName,

    src/backend/catalog/pg_operator.c

    Lines changed: 2 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -8,7 +8,7 @@
    88
    *
    99
    *
    1010
    * IDENTIFICATION
    11-
    * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.88 2005/01/27 23:23:51 neilc Exp $
    11+
    * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.89 2005/03/29 03:01:30 tgl Exp $
    1212
    *
    1313
    * NOTES
    1414
    * these routines moved here from commands/define.c and somewhat cleaned up.
    @@ -391,7 +391,7 @@ OperatorCreate(const char *operatorName,
    391391
    restOid,
    392392
    joinOid;
    393393
    bool selfCommutator = false;
    394-
    Oid typeId[FUNC_MAX_ARGS];
    394+
    Oid typeId[4]; /* only need up to 4 args here */
    395395
    int nargs;
    396396
    NameData oname;
    397397
    TupleDesc tupDesc;
    @@ -454,7 +454,6 @@ OperatorCreate(const char *operatorName,
    454454
    * procedureName to place in "result" field. Do this before shells are
    455455
    * created so we don't have to worry about deleting them later.
    456456
    */
    457-
    MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
    458457
    if (!OidIsValid(leftTypeId))
    459458
    {
    460459
    typeId[0] = rightTypeId;
    @@ -479,7 +478,6 @@ OperatorCreate(const char *operatorName,
    479478
    */
    480479
    if (restrictionName)
    481480
    {
    482-
    MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
    483481
    typeId[0] = INTERNALOID; /* Query */
    484482
    typeId[1] = OIDOID; /* operator OID */
    485483
    typeId[2] = INTERNALOID; /* args list */
    @@ -495,7 +493,6 @@ OperatorCreate(const char *operatorName,
    495493
    */
    496494
    if (joinName)
    497495
    {
    498-
    MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
    499496
    typeId[0] = INTERNALOID; /* Query */
    500497
    typeId[1] = OIDOID; /* operator OID */
    501498
    typeId[2] = INTERNALOID; /* args list */

    src/backend/commands/proclang.c

    Lines changed: 5 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -7,7 +7,7 @@
    77
    * Portions Copyright (c) 1994, Regents of the University of California
    88
    *
    99
    * IDENTIFICATION
    10-
    * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.57 2005/02/14 06:17:44 tgl Exp $
    10+
    * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.58 2005/03/29 03:01:30 tgl Exp $
    1111
    *
    1212
    *-------------------------------------------------------------------------
    1313
    */
    @@ -44,7 +44,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
    4444
    Oid procOid,
    4545
    valProcOid;
    4646
    Oid funcrettype;
    47-
    Oid typev[FUNC_MAX_ARGS];
    47+
    Oid funcargtypes[1];
    4848
    NameData langname;
    4949
    char nulls[Natts_pg_language];
    5050
    Datum values[Natts_pg_language];
    @@ -80,8 +80,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
    8080
    * Lookup the PL handler function and check that it is of the expected
    8181
    * return type
    8282
    */
    83-
    MemSet(typev, 0, sizeof(typev));
    84-
    procOid = LookupFuncName(stmt->plhandler, 0, typev, false);
    83+
    procOid = LookupFuncName(stmt->plhandler, 0, funcargtypes, false);
    8584
    funcrettype = get_func_rettype(procOid);
    8685
    if (funcrettype != LANGUAGE_HANDLEROID)
    8786
    {
    @@ -108,8 +107,8 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
    108107
    /* validate the validator function */
    109108
    if (stmt->plvalidator)
    110109
    {
    111-
    typev[0] = OIDOID;
    112-
    valProcOid = LookupFuncName(stmt->plvalidator, 1, typev, false);
    110+
    funcargtypes[0] = OIDOID;
    111+
    valProcOid = LookupFuncName(stmt->plvalidator, 1, funcargtypes, false);
    113112
    /* return value is ignored, so we don't check the type */
    114113
    }
    115114
    else

    src/backend/commands/trigger.c

    Lines changed: 2 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -7,7 +7,7 @@
    77
    * Portions Copyright (c) 1994, Regents of the University of California
    88
    *
    99
    * IDENTIFICATION
    10-
    * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.182 2005/03/29 00:16:57 tgl Exp $
    10+
    * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.183 2005/03/29 03:01:30 tgl Exp $
    1111
    *
    1212
    *-------------------------------------------------------------------------
    1313
    */
    @@ -1179,10 +1179,7 @@ ExecCallTriggerFunc(TriggerData *trigdata,
    11791179
    /*
    11801180
    * Call the function, passing no arguments but setting a context.
    11811181
    */
    1182-
    MemSet(&fcinfo, 0, sizeof(fcinfo));
    1183-
    1184-
    fcinfo.flinfo = finfo;
    1185-
    fcinfo.context = (Node *) trigdata;
    1182+
    InitFunctionCallInfoData(fcinfo, finfo, 0, (Node *) trigdata, NULL);
    11861183

    11871184
    result = FunctionCallInvoke(&fcinfo);
    11881185

    src/backend/commands/typecmds.c

    Lines changed: 6 additions & 20 deletions
    Original file line numberDiff line numberDiff line change
    @@ -8,7 +8,7 @@
    88
    *
    99
    *
    1010
    * IDENTIFICATION
    11-
    * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.67 2005/01/27 23:23:56 neilc Exp $
    11+
    * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.68 2005/03/29 03:01:30 tgl Exp $
    1212
    *
    1313
    * DESCRIPTION
    1414
    * The "DefineFoo" routines take the parse tree and pick out the
    @@ -854,7 +854,7 @@ RemoveDomain(List *names, DropBehavior behavior)
    854854
    static Oid
    855855
    findTypeInputFunction(List *procname, Oid typeOid)
    856856
    {
    857-
    Oid argList[FUNC_MAX_ARGS];
    857+
    Oid argList[3];
    858858
    Oid procOid;
    859859

    860860
    /*
    @@ -864,8 +864,6 @@ findTypeInputFunction(List *procname, Oid typeOid)
    864864
    * For backwards compatibility we allow OPAQUE in place of CSTRING; if we
    865865
    * see this, we issue a warning and fix up the pg_proc entry.
    866866
    */
    867-
    MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
    868-
    869867
    argList[0] = CSTRINGOID;
    870868

    871869
    procOid = LookupFuncName(procname, 1, argList, true);
    @@ -880,8 +878,6 @@ findTypeInputFunction(List *procname, Oid typeOid)
    880878
    return procOid;
    881879

    882880
    /* No luck, try it with OPAQUE */
    883-
    MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
    884-
    885881
    argList[0] = OPAQUEOID;
    886882

    887883
    procOid = LookupFuncName(procname, 1, argList, true);
    @@ -925,7 +921,7 @@ findTypeInputFunction(List *procname, Oid typeOid)
    925921
    static Oid
    926922
    findTypeOutputFunction(List *procname, Oid typeOid)
    927923
    {
    928-
    Oid argList[FUNC_MAX_ARGS];
    924+
    Oid argList[2];
    929925
    Oid procOid;
    930926

    931927
    /*
    @@ -936,8 +932,6 @@ findTypeOutputFunction(List *procname, Oid typeOid)
    936932
    * type name; if we see this, we issue a warning and fix up the
    937933
    * pg_proc entry.
    938934
    */
    939-
    MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
    940-
    941935
    argList[0] = typeOid;
    942936

    943937
    procOid = LookupFuncName(procname, 1, argList, true);
    @@ -951,8 +945,6 @@ findTypeOutputFunction(List *procname, Oid typeOid)
    951945
    return procOid;
    952946

    953947
    /* No luck, try it with OPAQUE */
    954-
    MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
    955-
    956948
    argList[0] = OPAQUEOID;
    957949

    958950
    procOid = LookupFuncName(procname, 1, argList, true);
    @@ -995,15 +987,13 @@ findTypeOutputFunction(List *procname, Oid typeOid)
    995987
    static Oid
    996988
    findTypeReceiveFunction(List *procname, Oid typeOid)
    997989
    {
    998-
    Oid argList[FUNC_MAX_ARGS];
    990+
    Oid argList[2];
    999991
    Oid procOid;
    1000992

    1001993
    /*
    1002994
    * Receive functions can take a single argument of type INTERNAL, or
    1003995
    * two arguments (internal, oid).
    1004996
    */
    1005-
    MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
    1006-
    1007997
    argList[0] = INTERNALOID;
    1008998

    1009999
    procOid = LookupFuncName(procname, 1, argList, true);
    @@ -1027,15 +1017,13 @@ findTypeReceiveFunction(List *procname, Oid typeOid)
    10271017
    static Oid
    10281018
    findTypeSendFunction(List *procname, Oid typeOid)
    10291019
    {
    1030-
    Oid argList[FUNC_MAX_ARGS];
    1020+
    Oid argList[2];
    10311021
    Oid procOid;
    10321022

    10331023
    /*
    10341024
    * Send functions can take a single argument of the type, or two
    10351025
    * arguments (data value, element OID).
    10361026
    */
    1037-
    MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
    1038-
    10391027
    argList[0] = typeOid;
    10401028

    10411029
    procOid = LookupFuncName(procname, 1, argList, true);
    @@ -1059,15 +1047,13 @@ findTypeSendFunction(List *procname, Oid typeOid)
    10591047
    static Oid
    10601048
    findTypeAnalyzeFunction(List *procname, Oid typeOid)
    10611049
    {
    1062-
    Oid argList[FUNC_MAX_ARGS];
    1050+
    Oid argList[1];
    10631051
    Oid procOid;
    10641052

    10651053
    /*
    10661054
    * Analyze functions always take one INTERNAL argument and return
    10671055
    * bool.
    10681056
    */
    1069-
    MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
    1070-
    10711057
    argList[0] = INTERNALOID;
    10721058

    10731059
    procOid = LookupFuncName(procname, 1, argList, true);

    0 commit comments

    Comments
     (0)
    0