Skip to content

Commit 5e7d5f0

Browse files
committed
fixed a bug in make_arg_list()
1 parent d9a5003 commit 5e7d5f0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/pl_funcs.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,22 +1276,22 @@ make_arg_list(StringInfoData *buf, HeapTuple tup, TupleDesc tupdesc,
12761276
int *nargs, Oid **argtypes, Datum **args, char **nulls)
12771277
{
12781278
int i;
1279-
bool isnull;
1279+
bool isnull;
12801280

12811281
*nargs = tupdesc->natts;
1282-
*args = palloc(sizeof(Datum) * tupdesc->natts);
1283-
*argtypes = palloc(sizeof(Oid) * tupdesc->natts);
1284-
*nulls = palloc(sizeof(char) * tupdesc->natts);
1282+
*args = (Datum *) palloc(sizeof(Datum) * tupdesc->natts);
1283+
*argtypes = (Oid *) palloc(sizeof(Oid) * tupdesc->natts);
1284+
*nulls = (char *) palloc(sizeof(char) * tupdesc->natts);
12851285

1286-
for (i = 0; i < tupdesc->natts; i++)
1286+
for (i = 0; i < *nargs; i++)
12871287
{
12881288
/* Skip dropped columns */
12891289
if (tupdesc->attrs[i]->attisdropped)
12901290
continue;
12911291

1292-
*args[i] = heap_getattr(tup, i + 1, tupdesc, &isnull);
1293-
*nulls[i] = isnull ? 'n' : ' ';
1294-
*argtypes[i] = tupdesc->attrs[i]->atttypid;
1292+
(*args)[i] = heap_getattr(tup, i + 1, tupdesc, &isnull);
1293+
(*nulls)[i] = isnull ? 'n' : ' ';
1294+
(*argtypes)[i] = tupdesc->attrs[i]->atttypid;
12951295

12961296
/* Add comma separator (except the first time) */
12971297
if (i != 0)

0 commit comments

Comments
 (0)