Hi Tom,
thanks for your quick answer.
On 2026-07-30 4:12 AM, Tom Lane wrote:
> [...]
>
> so it's not like things were great beforehand.
>
> The proximate cause of the problem is that coerce_fn_result_column
> thinks it can pass pstate = NULL to coerce_to_target_type, which
> is specifically allowed by that function's header comment; but
> coerce_to_target_type can call coerce_record_to_complex, and that
> function's code path for a whole-row Var absolutely requires a
> valid pstate. This inconsistency seems to go back decades (at
> least to 2004).
>
> I don't see any easy way to make this work -- by the time we get
> to coerce_fn_result_column, we don't have a pstate anymore. But
> since this case has never actually worked AFAICT, maybe it's okay
> to just treat it as unsupported. I agree with fixing
> coerce_record_to_complex to do something less drastic than
> crashing, but probably we also need something in functions.c
> to provide the user-visible error report.
Is there a particular reason we can't just error right here? Why can't
we just do something like the attached patch? That seems genuinely
simple to me.
Regards
Arne