]> granicus.if.org Git - postgresql/commitdiff
Now that I look at it, int_array_enum() didn't work either.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 27 Jan 2005 21:50:23 +0000 (21:50 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 27 Jan 2005 21:50:23 +0000 (21:50 +0000)
contrib/intagg/int_aggregate.c

index d968c2011585d1e1c0347ff0a0f9be7adeeba3ce..abb84801fb26003b140471affadedb7b95c19a9a 100644 (file)
@@ -199,6 +199,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 */
@@ -216,6 +220,7 @@ int_enum(PG_FUNCTION_ARGS)
                }
                pc->num = 0;
                fcinfo->context = (Node *) pc;
+               MemoryContextSwitchTo(oldcontext);
        }
        else    /* use an existing one */
                pc = (CTX *) fcinfo->context;