Re: [SQL] SELECT DISTINCT ... ORDER BY UPPER(column_name) fails

2007-11-04 Thread Tom Lane
Aymeric Levaux <[EMAIL PROTECTED]> writes: > SELECT DISTINCT tag FROM logs ORDER BY UPPER(tag); > You get the following error message : > for SELECT DISTINCT, ORDER BY expressions must appear in select list. > It is weird as the order by column appears in the select. No it doesn't. The ORDER BY

[SQL] SELECT DISTINCT ... ORDER BY UPPER(column_name) fails

2007-11-04 Thread Aymeric Levaux
On pgsql 8.2, if you do the following query, everything is fine: SELECT DISTINCT tag FROM logs ORDER BY tag; But if you'd like to do a case insensitive order by like this: SELECT DISTINCT tag FROM logs ORDER BY UPPER(tag); or SELECT DISTINCT tag FROM logs ORDER BY LOWER(tag); You get the fol