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

This commit is contained in:
Tom Lane 2005-01-27 21:49:57 +00:00
parent 368964e153
commit 728775d781
1 changed files with 5 additions and 0 deletions

View File

@ -201,6 +201,10 @@ int_enum(PG_FUNCTION_ARGS)
if (!fcinfo->context)
{
/* Allocate a working context */
MemoryContext oldcontext;
oldcontext = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt);
pc = (CTX *) palloc(sizeof(CTX));
/* Don't copy attribute if you don't need to */
@ -218,6 +222,7 @@ int_enum(PG_FUNCTION_ARGS)
}
pc->num = 0;
fcinfo->context = (Node *) pc;
MemoryContextSwitchTo(oldcontext);
}
else /* use an existing one */
pc = (CTX *) fcinfo->context;