Skip to content

Commit 8a093d0

Browse files
committed
Make number of args to a function configurable.
1 parent 6456b17 commit 8a093d0

30 files changed

+374
-305
lines changed

src/backend/access/hash/hashfunc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.21 2000/01/10 16:13:10 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.22 2000/01/10 17:14:28 momjian Exp $
1111
*
1212
* NOTES
1313
* These functions are stored in pg_amproc. For each operator class
@@ -145,7 +145,7 @@ hashoidvector(Oid *key)
145145
int i;
146146
uint32 result = 0;
147147

148-
for (i = 0; i < 8; i++)
148+
for (i = 0; i < INDEX_MAX_KEYS; i++)
149149
result = result ^ (~(uint32) key[i]);
150150
return result;
151151
}

src/backend/access/nbtree/nbtcompare.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.29 2000/01/10 16:13:10 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.30 2000/01/10 17:14:29 momjian Exp $
1111
*
1212
* NOTES
1313
* These functions are stored in pg_amproc. For each operator class
@@ -98,7 +98,7 @@ btoidvectorcmp(Oid *a, Oid *b)
9898
{
9999
int i;
100100

101-
for (i = 0; i < 8; i++)
101+
for (i = 0; i < INDEX_MAX_KEYS; i++)
102102
/* we use this because we need the int4gt, etc */
103103
if (!int4eq(a[i], b[i]))
104104
{

src/backend/catalog/pg_aggregate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.26 1999/11/22 17:55:58 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.27 2000/01/10 17:14:31 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -71,11 +71,11 @@ AggregateCreate(char *aggName,
7171
Oid xret1 = InvalidOid;
7272
Oid xret2 = InvalidOid;
7373
Oid fret = InvalidOid;
74-
Oid fnArgs[8];
74+
Oid fnArgs[FUNC_MAX_ARGS];
7575
NameData aname;
7676
TupleDesc tupDesc;
7777

78-
MemSet(fnArgs, 0, 8 * sizeof(Oid));
78+
MemSet(fnArgs, 0, FUNC_MAX_ARGS * sizeof(Oid));
7979

8080
/* sanity checks */
8181
if (!aggName)

src/backend/catalog/pg_operator.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.46 2000/01/05 18:23:45 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.47 2000/01/10 17:14:31 momjian Exp $
1111
*
1212
* NOTES
1313
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -482,7 +482,7 @@ OperatorDef(char *operatorName,
482482
bool rightDefined = false;
483483
bool selfCommutator = false;
484484
char *name[4];
485-
Oid typeId[8];
485+
Oid typeId[FUNC_MAX_ARGS];
486486
int nargs;
487487
NameData oname;
488488
TupleDesc tupDesc;
@@ -556,7 +556,7 @@ OperatorDef(char *operatorName,
556556
* have to worry about deleting them later.
557557
* ----------------
558558
*/
559-
MemSet(typeId, 0, 8 * sizeof(Oid));
559+
MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
560560
if (!leftTypeName)
561561
{
562562
typeId[0] = rightTypeId;
@@ -592,7 +592,7 @@ OperatorDef(char *operatorName,
592592
*/
593593
if (restrictionName)
594594
{ /* optional */
595-
MemSet(typeId, 0, 8 * sizeof(Oid));
595+
MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
596596
typeId[0] = OIDOID; /* operator OID */
597597
typeId[1] = OIDOID; /* relation OID */
598598
typeId[2] = INT2OID; /* attribute number */
@@ -617,7 +617,7 @@ OperatorDef(char *operatorName,
617617
*/
618618
if (joinName)
619619
{ /* optional */
620-
MemSet(typeId, 0, 8 * sizeof(Oid));
620+
MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
621621
typeId[0] = OIDOID; /* operator OID */
622622
typeId[1] = OIDOID; /* relation OID 1 */
623623
typeId[2] = INT2OID; /* attribute number 1 */
@@ -923,11 +923,11 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
923923
setheapoverride(true);
924924
heap_update(pg_operator_desc, &tup->t_self, tup, NULL);
925925
setheapoverride(false);
926-
926+
927927
if (RelationGetForm(pg_operator_desc)->relhasindex)
928928
{
929929
Relation idescs[Num_pg_operator_indices];
930-
930+
931931
CatalogOpenIndices(Num_pg_operator_indices, Name_pg_operator_indices, idescs);
932932
CatalogIndexInsert(idescs, Num_pg_operator_indices, pg_operator_desc, tup);
933933
CatalogCloseIndices(Num_pg_operator_indices, idescs);
@@ -961,7 +961,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
961961
if (RelationGetForm(pg_operator_desc)->relhasindex)
962962
{
963963
Relation idescs[Num_pg_operator_indices];
964-
964+
965965
CatalogOpenIndices(Num_pg_operator_indices, Name_pg_operator_indices, idescs);
966966
CatalogIndexInsert(idescs, Num_pg_operator_indices, pg_operator_desc, tup);
967967
CatalogCloseIndices(Num_pg_operator_indices, idescs);
@@ -1001,7 +1001,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
10011001
if (RelationGetForm(pg_operator_desc)->relhasindex)
10021002
{
10031003
Relation idescs[Num_pg_operator_indices];
1004-
1004+
10051005
CatalogOpenIndices(Num_pg_operator_indices, Name_pg_operator_indices, idescs);
10061006
CatalogIndexInsert(idescs, Num_pg_operator_indices, pg_operator_desc, tup);
10071007
CatalogCloseIndices(Num_pg_operator_indices, idescs);

src/backend/catalog/pg_proc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.36 1999/11/22 17:55:58 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.37 2000/01/10 17:14:31 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -61,7 +61,7 @@ ProcedureCreate(char *procedureName,
6161
List *x;
6262
List *querytree_list;
6363
List *plan_list;
64-
Oid typev[8];
64+
Oid typev[FUNC_MAX_ARGS];
6565
Oid relid;
6666
Oid toid;
6767
NameData procname;
@@ -75,13 +75,13 @@ ProcedureCreate(char *procedureName,
7575
Assert(PointerIsValid(probin));
7676

7777
parameterCount = 0;
78-
MemSet(typev, 0, 8 * sizeof(Oid));
78+
MemSet(typev, 0, FUNC_MAX_ARGS * sizeof(Oid));
7979
foreach(x, argList)
8080
{
8181
Value *t = lfirst(x);
8282

83-
if (parameterCount == 8)
84-
elog(ERROR, "Procedures cannot take more than 8 arguments");
83+
if (parameterCount == FUNC_MAX_ARGS)
84+
elog(ERROR, "Procedures cannot take more than %d arguments",FUNC_MAX_ARGS);
8585

8686
if (strcmp(strVal(t), "opaque") == 0)
8787
{

src/backend/catalog/pg_type.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.44 1999/12/16 22:19:39 wieck Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.45 2000/01/10 17:14:31 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -305,7 +305,7 @@ TypeCreate(char *typeName,
305305
bool defined;
306306
NameData name;
307307
TupleDesc tupDesc;
308-
Oid argList[8];
308+
Oid argList[FUNC_MAX_ARGS];
309309

310310
static ScanKeyData typeKey[1] = {
311311
{0, Anum_pg_type_typname, F_NAMEEQ}
@@ -393,7 +393,7 @@ TypeCreate(char *typeName,
393393
* First look for a 1-argument func with all argtypes 0. This is
394394
* valid for all four kinds of procedure.
395395
*/
396-
MemSet(argList, 0, 8 * sizeof(Oid));
396+
MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
397397

398398
tup = SearchSysCacheTuple(PROCNAME,
399399
PointerGetDatum(procname),

src/backend/commands/_deadcode/recipe.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/recipe.c,v 1.7 1999/07/16 04:58:42 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/recipe.c,v 1.8 2000/01/10 17:14:33 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -695,14 +695,14 @@ getParamTypes(TgElement * elem, Oid *typev)
695695
j;
696696

697697
parameterCount = 0;
698-
for (i = 0; i < 8; i++)
698+
for (i = 0; i < FUNC_MAX_ARGS; i++)
699699
typev[i] = 0;
700700
for (j = 0; j < elem->inTypes->num; j++)
701701
{
702-
if (parameterCount == 8)
702+
if (parameterCount == FUNC_MAX_ARGS)
703703
{
704704
elog(ERROR,
705-
"getParamTypes: Ingredients cannot take > 8 arguments");
705+
"getParamTypes: Ingredients cannot take > %d arguments",FUNC_MAX_ARGS);
706706
}
707707
t = elem->inTypes->val[j];
708708
if (strcmp(t, "opaque") == 0)
@@ -810,7 +810,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
810810
{
811811
TgElement *elem;
812812
char *funcName;
813-
Oid typev[8], /* eight arguments maximum */
813+
Oid typev[FUNC_MAX_ARGS], /* eight arguments maximum */
814814
relid;
815815
int i,
816816
parameterCount;

0 commit comments

Comments
 (0)