Re: Requesting advanced Group By support - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Requesting advanced Group By support
Date
Msg-id 31E6FC56-F21C-4F03-8666-F12F51FD2131@anarazel.de
Whole thread Raw
In response to Re: Requesting advanced Group By support  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Requesting advanced Group By support  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Requesting advanced Group By support  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers

Hi,

On October 10, 2018 10:37:40 AM PDT, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
>> On 10/09/2018 03:10 PM, Arun Kumar wrote:
>>> *SELECT a.sno,b.sno,a.name,b.location FROM Name AS a JOIN Location
>AS b
>>> ON a.sno=b.sno GROUP BY a.sno,b.location *
>>>
>>> In this case, a.sno is a primary key so no need to include a.name in
>
>>> GROUP By as it would be identified by the primary key and then for
>b.sno
>>> which is again equated with a.sno (primary key) so no need to add
>this
>>> as well but for b.location, we need to add it in GROUP BY or we
>should
>>> use any aggregate function over this column to avoid error.
>
>> So, which part of this supposedly does not work in PostgreSQL?
>
>The part where it infers that b.sno is unique based solely on it having
>been equated to a.sno.

Isn't the spec compliant thing that's missing dealing with unique not null?

Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.


pgsql-hackers by date:

Previous
From: Andreas Joseph Krogh
Date:
Subject: Sv: Re: Requesting advanced Group By support
Next
From: Tom Lane
Date:
Subject: Re: Requesting advanced Group By support