Skip site navigation (1) Skip section navigation (2)

Re: BUG #1555: bug in GROUP BY?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Peter Cottingham <cottingh(at)rci(dot)rutgers(dot)edu>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1555: bug in GROUP BY?
Date: 2005-03-27 06:22:49
Message-ID: 20050327062249.GA45629@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-bugs
On Mon, Mar 21, 2005 at 07:20:04PM +0000, Peter Cottingham wrote:
> 
> Appears that the GROUP BY clause is not working correctly on new server
> (GROUP BY should order the result set in ASCENDING order, NOT DESCENDING 
> order.)  See below
> 
> **********************************
> select dom_id, count(ste_id) as ste_count
> from ste
> group by dom_id
> **********************************

As far as I know, the SQL standards don't specify that GROUP BY is
supposed to give a particular order.  A query without an ORDER BY
clause, or a query with an ORDER BY clause that isn't specific
enough, has an order that's implementation-dependent.  If you want
a particular order then use ORDER BY.

Somebody please correct me if I'm mistaken (with a relevant citation
from one of the standards).

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

pgsql-bugs by date

Next:From: Matthew T. O'ConnorDate: 2005-03-27 06:24:07
Subject: Re: BUG #1567: can't hide password with pg_autovacuum
Previous:From: Robert CreagerDate: 2005-03-27 06:00:53
Subject: Re: BUG #1563: wrong week returnded by date_trunc('week',

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group