Re: SQL question re aggregates & joins

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
Cc: Thom Brown <thombrown(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: SQL question re aggregates & joins
Date: 2010-01-28 22:36:22
Message-ID: 15678.1264718182@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Scott Ribe <scott_ribe(at)killerbytes(dot)com> writes:
> Given that t2.id is the primary key, grouping by any other column of t2 is
> really redundant. I know *what* SQL won't allow me to do, I'm interested in
> knowing if there's some reason *why* other than historical...

SQL92 says so. More recent versions of the SQL spec describe allowing
omission of grouping columns when one of them can be proven unique,
but it's complicated and we haven't got round to doing it.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mike Bresnahan 2010-01-28 22:45:45 Re: Amazon EC2 CPU Utilization
Previous Message Dann Corbit 2010-01-28 22:29:52 Re: SQL question re aggregates & joins