DISTINCT and ORDER BY bug?

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: DISTINCT and ORDER BY bug?
Date: 2000-02-07 03:04:18
Message-ID: 3.0.1.32.20000206190418.0107cca0@mail.pacifier.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The following used to work in 6.5, works in Oracle, and is
very useful:

donb=# create table foo(c varchar);
CREATE
donb=# insert into foo values('abc');
INSERT 72649 1

donb=# select distinct c from foo order by upper(c);
ERROR: For SELECT DISTINCT, ORDER BY expressions must appear in target list
donb=#

In other words, we want to order ignoring case - in this case, users
within the Ars Digita Community system. We want don baccus to appear
next to Joe Blow rather than following Xena Xenophoba.

Is this now refused because it is non-standard? It seems a pity...

Of course, one can do "select distinct c, upper(c) as ignore ..."

but that forces the return of more data, so is slower, etc...

BTW the very fact that my testing of our partial port of this web
toolkit under V7 pre-beta has gotten this far is a very good sign.

Among other things, it makes heavy (if simple) use of referential
integrity, which has already uncovered two bugs in the port that
I've fixed.

- Don Baccus, Portland OR <dhogaza(at)pacifier(dot)com>
Nature photos, on-line guides, Pacific Northwest
Rare Bird Alert Service and other goodies at
http://donb.photo.net.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2000-02-07 04:49:47 Re: [HACKERS] pg_ctl man page
Previous Message Tom Lane 2000-02-07 02:29:27 Re: [HACKERS] Case sensitivity issues