Arne Roland <arne.roland@malkut.net> writes:
> 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.
The problem I've got with that is that coerce_record_to_complex
has no principled basis for giving that errhint: for all it knows,
the context could be something else entirely. If we could throw that
error within coerce_fn_result_column, it'd be okay.
It does seem like a good idea to put something like
if (pstate == NULL)
elog(ERROR, "cannot handle whole-row Var without a pstate");
into coerce_record_to_complex, and we should certainly also update
the relevant function header comments so that they are not lies.
But that's just defense-in-depth; I don't want it to be the
user-visible behavior.
regards, tom lane