mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-09 08:10:09 +08:00
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.
This commit is contained in:
parent
0c9f00506b
commit
497f11845c
@ -200,9 +200,9 @@ int_enum(PG_FUNCTION_ARGS)
|
|||||||
PG_RETURN_NULL();
|
PG_RETURN_NULL();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fcinfo->context)
|
if (!fcinfo->flinfo->fn_extra)
|
||||||
{
|
{
|
||||||
/* Allocate a working context */
|
/* Allocate working state */
|
||||||
MemoryContext oldcontext;
|
MemoryContext oldcontext;
|
||||||
|
|
||||||
oldcontext = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt);
|
oldcontext = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt);
|
||||||
@ -226,19 +226,20 @@ int_enum(PG_FUNCTION_ARGS)
|
|||||||
if (pc->p->a.ndim != 1)
|
if (pc->p->a.ndim != 1)
|
||||||
elog(ERROR, "int_enum only accepts 1-D arrays");
|
elog(ERROR, "int_enum only accepts 1-D arrays");
|
||||||
pc->num = 0;
|
pc->num = 0;
|
||||||
fcinfo->context = (Node *) pc;
|
fcinfo->flinfo->fn_extra = (void *) pc;
|
||||||
MemoryContextSwitchTo(oldcontext);
|
MemoryContextSwitchTo(oldcontext);
|
||||||
}
|
}
|
||||||
else /* use an existing one */
|
else /* use existing working state */
|
||||||
pc = (CTX *) fcinfo->context;
|
pc = (CTX *) fcinfo->flinfo->fn_extra;
|
||||||
|
|
||||||
/* Are we done yet? */
|
/* Are we done yet? */
|
||||||
if (pc->num >= pc->p->items)
|
if (pc->num >= pc->p->items)
|
||||||
{
|
{
|
||||||
/* We are done */
|
/* We are done */
|
||||||
if (pc->flags & TOASTED)
|
if (pc->flags & TOASTED)
|
||||||
pfree(pc->p);
|
pfree(pc->p);
|
||||||
pfree(fcinfo->context);
|
pfree(pc);
|
||||||
fcinfo->context = NULL;
|
fcinfo->flinfo->fn_extra = NULL;
|
||||||
rsi->isDone = ExprEndResult;
|
rsi->isDone = ExprEndResult;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user