From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
---|---|
To: | Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Isaac Morland <isaac(dot)morland(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Join Correlation Name |
Date: | 2019-10-30 08:04:12 |
Message-ID: | alpine.DEB.2.21.1910300858100.10013@lancre |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Bonjour Vik,
> Is quoting the spec good enough?
> SQL:2016 Part 2 Foundation Section 7.10 <joined table>:
Ah, this is the one information I did not have when reviewing Peter's
patch.
> <named columns join> ::=
> USING <left paren> <join column list> <right paren> [ AS <join correlation name> ]
>
> <join correlation name> ::=
> <correlation name>
>
> I think possibly what the spec says (and that neither my patch nor
> Peter's implements) is assigning the alias just to the <join column
> list>.
I think you are right, the alias is only on the identical columns.
It solves the issue I raised about inaccessible attributes, and explains
why it is only available with USING and no other join variants.
> So my original example query should actually be:
>
> SELECT a.x, b.y, j.z FROM a INNER JOIN b USING (z) AS j;
Yep, only z should be in j, it is really just about the USING clause.
--
Fabien.
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2019-10-30 08:21:17 | Re: Problem with synchronous replication |
Previous Message | Prabhat Sahu | 2019-10-30 07:49:06 | Re: tableam vs. TOAST |