From: Vik Fearing <vik.fearing@2ndquadrant.com>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Fabien COELHO <coelho@cri.ensmp.fr>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Allow an alias to be attached directly to a JOIN ... USING
Date: Tue, 31 Dec 2019 00:07:55 +0100
Message-ID: <8568b66d-405d-5d83-ac8c-e107f1b9f113@2ndquadrant.com> (raw)
In-Reply-To: <9a5c9ed2-1dd7-8c2a-6b90-0de54f4c13a1@2ndquadrant.com>
References: <20190917173742.GA8735@alvherre.pgsql>
<alpine.DEB.2.21.1912241908490.27864@pseudo>
<9a5c9ed2-1dd7-8c2a-6b90-0de54f4c13a1@2ndquadrant.com>
On 30/12/2019 22:25, Peter Eisentraut wrote:
> On 2019-12-24 19:13, Fabien COELHO wrote:
>>>> Indeed, that seems like a problem, and it's a good question. You can
>>>> see this on unpatched master with SELECT x.filler FROM
>>>> (pgbench_tellers AS t JOIN b USING (bid)) AS x.
>>>
>>> I'm not sure I understand why that problem is a blocker for this patch.
>>
>> As discussed on another thread,
>>
>>
>> https://www.postgresql.org/message-id/flat/2aa57950-b1d7-e9b6-0770-fa592d565dda@2ndquadrant.com
>>
>> the patch does not conform to spec
>>
>> SQL:2016 Part 2 Foundation Section 7.10 <joined table>
>>
>> Basically "x" is expected to include *ONLY* joined attributes with
>> USING,
>> i.e. above only x.bid should exists, and per-table aliases are
>> expected to
>> still work for other attributes.
>
> I took another crack at this. Attached is a new patch that addresses
> the semantic comments from this and the other thread. It's all a bit
> tricky, comments welcome.
Excellent! Thank you for working on this, Peter.
One thing I notice is that the joined columns are still accessible from
their respective table names when they should not be per spec. That
might be one of those "silly restrictions" that we choose to ignore, but
it should probably be noted somewhere, at the very least in a code
comment if not in user documentation. (This is my reading of SQL:2016 SR
11.a.i)
--
Vik Fearing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: vik.fearing@2ndquadrant.com, peter.eisentraut@2ndquadrant.com, coelho@cri.ensmp.fr, alvherre@2ndquadrant.com, thomas.munro@gmail.com
Subject: Re: Allow an alias to be attached directly to a JOIN ... USING
In-Reply-To: <8568b66d-405d-5d83-ac8c-e107f1b9f113@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox