Re: BUG #1555: bug in GROUP BY? - Mailing list pgsql-bugs

From Michael Fuhr
Subject Re: BUG #1555: bug in GROUP BY?
Date
Msg-id 20050327062249.GA45629@winnie.fuhr.org
Whole thread Raw
In response to BUG #1555: bug in GROUP BY?  ("Peter Cottingham" <cottingh@rci.rutgers.edu>)
Responses Re: BUG #1555: bug in GROUP BY?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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/

pgsql-bugs by date:

Previous
From: Robert Creager
Date:
Subject: Re: BUG #1563: wrong week returnded by date_trunc('week',
Next
From: "Matthew T. O'Connor"
Date:
Subject: Re: BUG #1567: can't hide password with pg_autovacuum