Re: select DISTINCT not ordering the returned rows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ioana Danes <ioanasoftware(at)yahoo(dot)ca>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: select DISTINCT not ordering the returned rows
Date: 2011-03-02 20:44:27
Message-ID: 14031.1299098667@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ioana Danes <ioanasoftware(at)yahoo(dot)ca> writes:
> I upgraded postgres from 8.3 to 9.0.3 and I have an issue with the order of the returned rows.

Your application is simply broken if it assumes that DISTINCT results in
ordering the rows. The only thing that guarantees that is an ORDER BY.

You could probably work around it for the short term by unsetting
enable_hashagg, but you really ought to fix the query instead.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2011-03-02 20:46:50 Re: select DISTINCT not ordering the returned rows
Previous Message Ioana Danes 2011-03-02 20:39:28 Re: select DISTINCT not ordering the returned rows