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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-bugs by date

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