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 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. Any thoughts? -- Aymeric Levaux <http://www.javablackbelt.com>