Re: [GENERAL] Illegal use of aggregates or non-group column in target list

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "G(dot) Anthony Reina" <reina(at)nsi(dot)edu>
Cc: Jason <neumeier(at)bright(dot)net>, "pgsql-general(at)hub(dot)org" <pgsql-general(at)hub(dot)org>
Subject: Re: [GENERAL] Illegal use of aggregates or non-group column in target list
Date: 2000-03-04 17:05:29
Message-ID: Pine.LNX.4.21.0003040353170.489-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

G. Anthony Reina writes:

> It's interesting that "select target, avg(reaction_time) from data_table
> GROUP BY target;" works but not "select target, avg(reaction_time) from
> data_table;".
>
> Doesn't the parser automatically group by the first variable returned?

The parser really doesn't know much about all of this. While you might
have a point that

select field1, aggregate(field2) from table

doesn't have any other useful interpretation than an implied group by
field1, it's probably too much work to support such a non-SQL construct.

--
Peter Eisentraut Sernanders väg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2000-03-04 17:05:49 Re: [GENERAL] Nested tables
Previous Message Peter Eisentraut 2000-03-04 17:05:17 Re: [GENERAL] Median, Quartile and Percentile Aggregate Functions