Re: Join Correlation Name

From: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
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-11-01 22:08:35
Message-ID: 0077c494-b721-3c2a-f1b2-b0a6cdb57164@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 30/10/2019 09:04, Fabien COELHO wrote:
>
>> 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.

My reading of SQL:2016-2 7.10 SR 11.a convinces me that this is the case.

My reading of transformFromClauseItem() convinces me that this is way
over my head and I have to abandon it. :-(

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2019-11-01 22:19:33 Re: Make StringInfo available to frontend code.
Previous Message Fabien COELHO 2019-11-01 21:38:09 Re: fe-utils - share query cancellation code