Re: Wrong results with references to JOIN USING aliases

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Wrong results with references to JOIN USING aliases
Date: 2026-11-07 06:29:56
Message-ID: CAHewXNkxvQznuBiHqrb_ER3UTuUmm9GqZ40e9y5YgkpatFV=ow@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Richard Guo <guofenglinux(at)gmail(dot)com> 于2026年11月7日周六 10:21写道:
>
> To fix, I think we can build the fields with expandNSItemVars()
> instead. It yields the same Vars, but also marks them with
> markNullableIfNeeded(), as scanNSItemForColumn() does for a plain
> reference such as x.a.

Using expandNSItemVars() looks right to me: it adds the required
nullingrels and expands only the USING alias's columns, so the
truncation is no longer needed.

The patch looks good to me.

--
Thanks,
Tender Wang

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Denis Smirnov 2026-11-07 07:09:38 Re: Fold NOT IN / <> ALL expressions containing NULL to FALSE
Previous Message Tender Wang 2026-11-07 06:15:05 Re: Wrong results with references to JOIN USING aliases