Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 1ADE89F94B0 for ; Sun, 4 Nov 2007 13:12:46 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 11234-01 for ; Sun, 4 Nov 2007 13:12:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 6F2429F94AC for ; Sun, 4 Nov 2007 13:12:42 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lA4HCVYC015016; Sun, 4 Nov 2007 12:12:31 -0500 (EST) To: aymeric@javablackbelt.com cc: pgsql-sql@postgresql.org Subject: Re: SELECT DISTINCT ... ORDER BY UPPER(column_name) fails In-reply-to: <472DF7FE.1050504@javablackbelt.com> References: <472DF7FE.1050504@javablackbelt.com> Comments: In-reply-to Aymeric Levaux message dated "Sun, 04 Nov 2007 17:49:02 +0100" Date: Sun, 04 Nov 2007 12:12:31 -0500 Message-ID: <15015.1194196351@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/7 X-Sequence-Number: 29535 Aymeric Levaux 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 expression is "UPPER(tag)" not just "tag". regards, tom lane