Joe Conway <mail@joeconway.com> writes:
> On a side note, while perusing this section of code:
> 8<-------------------------- at dblink.c:1176 --------------------------
> /* make sure we have a persistent copy of the tupdesc */
> tupdesc = CreateTupleDescCopy(tupdesc);
> Shouldn't that CreateTupleDescCopy() happen in ecxt_per_query_memory?
Not necessary (we'd have seen crashes long since if it was).
ExecMakeTableFunctionResult doesn't need the tupdesc to persist past
return.
Actually, I was wondering whether we couldn't remove that
CreateTupleDescCopy call entirely. The risk would be if
get_call_result_type returned a pointer into relcache or some other cached
tuple descriptor, which might be subject to a cache flush --- but AFAICS
it always returns a freshly created or copied tupdesc. (This might not
have been true originally, which could explain why dblink thinks it needs
to copy.)
regards, tom lane