Joe Conway <m...@joeconway.com> writes: > On 06/18/2014 08:19 PM, Tom Lane wrote: >> Actually, I was wondering whether we couldn't remove that >> CreateTupleDescCopy call entirely.
> Apparently not, at least without some additional surgery. > ExecMakeTableFunctionResult() tries to free the tupledesc and segfaults. Hmm ... oh, I missed this bit: /* We must get the tupledesc from call context */ if (rsinfo && IsA(rsinfo, ReturnSetInfo) && rsinfo->expectedDesc != NULL) { result = TYPEFUNC_COMPOSITE; if (resultTupleDesc) *resultTupleDesc = rsinfo->expectedDesc; /* Assume no polymorphic columns here, either */ } So it's passing back the same tupdesc passed in by the caller of ExecMakeTableFunctionResult. We can free that all right, but the caller won't be happy :-( regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers