Re: PostgreSQL bug in SELECT DISTINCT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "J(dot)R(dot) Onyschak" <jonyschak(at)nvisia(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: PostgreSQL bug in SELECT DISTINCT
Date: 2001-05-03 15:26:10
Message-ID: 24905.988903570@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"J.R. Onyschak" <jonyschak(at)nvisia(dot)com> writes:
> When I execute the following query:
> SELECT DISTINCT title FROM division ORDER BY UPPER(title);

> I get:
> ERROR: For SELECT DISTINCT, ORDER BY expressions must appear in target list

> If I remove DISTINCT, the query works fine.

> Is this illegal or a known bug?

This is not a bug, but an intentional restriction to prevent ill-defined
query results. Why don't you just "ORDER BY title"?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Patin 2001-05-03 15:37:55 Doc bug undefined special characters
Previous Message Thomas Lockhart 2001-05-03 15:19:32 Re: PostgreSQL bug in SELECT DISTINCT