Re: Attribute must be GROUPed.... ? - Mailing list pgsql-hackers

From Stephan Szabo
Subject Re: Attribute must be GROUPed.... ?
Date
Msg-id 20030430144643.O95283-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Attribute must be GROUPed.... ?  (Daniele Orlandi <daniele@orlandi.com>)
Responses Re: Attribute must be GROUPed.... ?  (Daniele Orlandi <daniele@orlandi.com>)
List pgsql-hackers
On Wed, 30 Apr 2003, Daniele Orlandi wrote:

> I always had been doubious about the "must" in the error message
> "Attribute must be GROUPed or used in an aggregate function".

AFAIK it's a requirement of the SQL spec. (SQL92(draft) 7.9 SR 7, "each
<column reference> in each <value expression> that references a column
of T shall reference a grouping column or be specified within a <set
function specification>."

> For example, suppose that you join two tables and the field you group by
> appears to be the primary key of one of the tables. In this case if I
> put any of the fields in that table in the target list, it will always
> be well defined and would make certain queries much simpler.

Well, it'd mean you didn't have to put the extra columns in the group by
list to make them grouping columns.



pgsql-hackers by date:

Previous
From: Daniele Orlandi
Date:
Subject: Attribute must be GROUPed.... ?
Next
From: Daniele Orlandi
Date:
Subject: Re: Attribute must be GROUPed.... ?