Skip to content

Commit e6a3012

Browse files
committed
int_array_enum function should be using fcinfo->flinfo->fn_extra for
working state, not fcinfo->context. Silly oversight on my part in last go-round of fixes.
1 parent 87808ae commit e6a3012

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

contrib/intagg/int_aggregate.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ int_enum(PG_FUNCTION_ARGS)
220220
PG_RETURN_NULL();
221221
}
222222

223-
if (!fcinfo->context)
223+
if (!fcinfo->flinfo->fn_extra)
224224
{
225-
/* Allocate a working context */
225+
/* Allocate working state */
226226
MemoryContext oldcontext;
227227

228228
oldcontext = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt);
@@ -247,19 +247,20 @@ int_enum(PG_FUNCTION_ARGS)
247247
if (pc->p->a.ndim > 1)
248248
elog(ERROR, "int_enum only accepts 1-D arrays");
249249
pc->num = 0;
250-
fcinfo->context = (Node *) pc;
250+
fcinfo->flinfo->fn_extra = (void *) pc;
251251
MemoryContextSwitchTo(oldcontext);
252252
}
253-
else /* use an existing one */
254-
pc = (CTX *) fcinfo->context;
253+
else /* use existing working state */
254+
pc = (CTX *) fcinfo->flinfo->fn_extra;
255+
255256
/* Are we done yet? */
256257
if (pc->p->a.ndim < 1 || pc->num >= pc->p->items)
257258
{
258259
/* We are done */
259260
if (pc->flags & TOASTED)
260261
pfree(pc->p);
261-
pfree(fcinfo->context);
262-
fcinfo->context = NULL;
262+
pfree(pc);
263+
fcinfo->flinfo->fn_extra = NULL;
263264
rsi->isDone = ExprEndResult;
264265
}
265266
else

0 commit comments

Comments
 (0)