Commit 728775d7 authored by Tom Lane's avatar Tom Lane

Now that I look at it, int_array_enum() didn't work either.

parent 368964e1
...@@ -201,6 +201,10 @@ int_enum(PG_FUNCTION_ARGS) ...@@ -201,6 +201,10 @@ int_enum(PG_FUNCTION_ARGS)
if (!fcinfo->context) if (!fcinfo->context)
{ {
/* Allocate a working context */ /* Allocate a working context */
MemoryContext oldcontext;
oldcontext = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt);
pc = (CTX *) palloc(sizeof(CTX)); pc = (CTX *) palloc(sizeof(CTX));
/* Don't copy attribute if you don't need to */ /* Don't copy attribute if you don't need to */
...@@ -218,6 +222,7 @@ int_enum(PG_FUNCTION_ARGS) ...@@ -218,6 +222,7 @@ int_enum(PG_FUNCTION_ARGS)
} }
pc->num = 0; pc->num = 0;
fcinfo->context = (Node *) pc; fcinfo->context = (Node *) pc;
MemoryContextSwitchTo(oldcontext);
} }
else /* use an existing one */ else /* use an existing one */
pc = (CTX *) fcinfo->context; pc = (CTX *) fcinfo->context;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment