Re: Wrong results with references to JOIN USING aliases

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

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 于2026年11月7日周六 10:51写道:
>
> BTW, I have a different issue with this query: it seems like "x"
> is just ROW(a), not ROW(a, t2.b, t3.b). It's late and I'm frazzled,
> but isn't that wrong?

I think ROW(a) is intended here: in “JOIN ... USING (a) AS x”, x
aliases only the USING columns, rather than the whole join result.

To make x refer to ROW(a, t2.b, t3.b), the alias would go outside the
parentheses:

“(t t2 JOIN t t3 USING (a)) AS x”

--
Thanks,
Tender Wang

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tender Wang 2026-11-07 06:29:56 Re: Wrong results with references to JOIN USING aliases
Previous Message Mingjie Gao 2026-11-07 06:13:16 Re: [PATCH v1] Fix initial sync of zero-column published tables