strk <[EMAIL PROTECTED]> writes: >> From whitin an aggregate sfunc I did: > oldcontext = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt); > geom = (GEOMETRY *)PG_DETOAST_DATUM(datum); > MemoryContextSwitchTo(oldcontext);
> And later in aggregate's finalfunc: > pfree(geom); > Result: > segfault! > What's wrong with it ? Perhaps you wanted PG_DETOAST_DATUM_COPY(). Or possibly use PG_FREE_IF_COPY() rather than an unconditional pfree, though that would depend on just what your usage pattern is. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])