Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[BUGS] BUG #7486: Error Group by

0 views
Skip to first unread message

anders...@gmail.com

unread,
Aug 10, 2012, 1:33:23 PM8/10/12
to
The following bug has been logged on the website:

Bug reference: 7486
Logged by: Anderson Abreu
Email address: anders...@gmail.com
PostgreSQL version: 8.4.12
Operating system: Linux
Description:

Dear,

I'm test the script, for example: select attA, attB from table1 group by
attA.

In postgre 8.4.X show error column attB must appear in the GROUP BY clause
or be used in an aggregate function.

But, in postgre 9.1.X the query running sucesfully.

Why?

Thank's


-
Sent via pgsql-bugs mailing list (pgsql...@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Daniel Farina

unread,
Aug 11, 2012, 5:13:03 AM8/11/12
to
On Fri, Aug 10, 2012 at 10:33 AM, <anders...@gmail.com> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 7486
> Logged by: Anderson Abreu
> Email address: anders...@gmail.com
> PostgreSQL version: 8.4.12
> Operating system: Linux
> Description:
>
> Dear,
>
> I'm test the script, for example: select attA, attB from table1 group by
> attA.
>
> In postgre 8.4.X show error column attB must appear in the GROUP BY clause
> or be used in an aggregate function.
>
> But, in postgre 9.1.X the query running sucesfully.
>
> Why?

attA is probably a primary key, is that the case?

http://www.postgresql.org/docs/9.1/static/release-9-1.html#AEN107670

"Allow non-GROUP BY columns in the query target list when the primary
key is specified in the GROUP BY clause (Peter Eisentraut)

The SQL standard allows this behavior, and because of the primary key,
the result is unambiguous."

--
fdr
0 new messages