Re: type coercion of record types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Arne Roland <arne(dot)roland(at)malkut(dot)net>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: type coercion of record types
Date: 2026-07-30 02:44:56
Message-ID: 995749.1785379496@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Arne Roland <arne(dot)roland(at)malkut(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tender Wang 2026-07-30 03:33:40 Re: BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables
Previous Message Arne Roland 2026-07-30 02:29:11 Re: type coercion of record types