Skip to content

Commit d433a36

Browse files
committed
Make pg_dump independent of FUNC_MAX_ARGS.
1 parent 5a99671 commit d433a36

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
*
2424
* IDENTIFICATION
25-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.250 2002/04/19 23:13:54 tgl Exp $
25+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.251 2002/04/21 05:21:17 petere Exp $
2626
*
2727
*-------------------------------------------------------------------------
2828
*/
@@ -1636,9 +1636,13 @@ clearFuncInfo(FuncInfo *fun, int numFuncs)
16361636
free(fun[i].proname);
16371637
if (fun[i].usename)
16381638
free(fun[i].usename);
1639-
for (a = 0; a < FUNC_MAX_ARGS; ++a)
1640-
if (fun[i].argtypes[a])
1641-
free(fun[i].argtypes[a]);
1639+
if (fun[i].argtypes)
1640+
{
1641+
for (a = 0; a < fun[i].nargs; ++a)
1642+
if (fun[i].argtypes[a])
1643+
free(fun[i].argtypes[a]);
1644+
free(fun[i].argtypes);
1645+
}
16421646
if (fun[i].prorettype)
16431647
free(fun[i].prorettype);
16441648
if (fun[i].prosrc)
@@ -2066,12 +2070,7 @@ getFuncs(int *numFuncs)
20662070
write_msg(NULL, "WARNING: owner of function \"%s\" appears to be invalid\n",
20672071
finfo[i].proname);
20682072

2069-
if (finfo[i].nargs < 0 || finfo[i].nargs > FUNC_MAX_ARGS)
2070-
{
2071-
write_msg(NULL, "failed sanity check: function %s has more than %d (namely %d) arguments\n",
2072-
finfo[i].proname, FUNC_MAX_ARGS, finfo[i].nargs);
2073-
exit_nicely();
2074-
}
2073+
finfo[i].argtypes = malloc(finfo[i].nargs * sizeof(finfo[i].argtypes[0]));
20752074
parseNumericArray(PQgetvalue(res, i, i_proargtypes),
20762075
finfo[i].argtypes,
20772076
finfo[i].nargs);

src/bin/pg_dump/pg_dump.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: pg_dump.h,v 1.81 2002/04/11 20:00:08 tgl Exp $
9+
* $Id: pg_dump.h,v 1.82 2002/04/21 05:21:18 petere Exp $
1010
*
1111
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
1212
*
@@ -66,7 +66,7 @@ typedef struct _funcInfo
6666
char *proowner;
6767
Oid lang;
6868
int nargs;
69-
char *argtypes[FUNC_MAX_ARGS];
69+
char **argtypes;
7070
char *prorettype;
7171
int retset; /* 1 if the function returns a set, else 0 */
7272
char *prosrc;

0 commit comments

Comments
 (0)