Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UpgTS-0002Nc-S9 for pgsql-bugs@arkaria.postgresql.org; Thu, 20 Jun 2013 15:08:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UpgTS-00049g-CT for pgsql-bugs@arkaria.postgresql.org; Thu, 20 Jun 2013 15:08:34 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UpgTR-00049a-Kl for pgsql-bugs@postgresql.org; Thu, 20 Jun 2013 15:08:33 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UpgTP-0003Cf-ET for pgsql-bugs@postgresql.org; Thu, 20 Jun 2013 15:08:33 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UpgTP-00046q-5Z for pgsql-bugs@postgresql.org; Thu, 20 Jun 2013 15:08:31 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.80) (envelope-from ) id 1UpgTJ-0007Di-Qu for pgsql-bugs@postgresql.org; Thu, 20 Jun 2013 15:08:25 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: BUG #8243: Order by with column ordinal and collate - fails to parse To: pgsql-bugs@postgresql.org From: tim.kane@gmail.com Message-Id: Date: Thu, 20 Jun 2013 15:08:25 +0000 X-Pg-Spam-Score: 0.4 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 8243 Logged by: Tim Kane Email address: tim.kane@gmail.com PostgreSQL version: 9.1.9 Operating system: Debian Description: As per psql general mailing list thread: http://www.postgresql.org/message-id/CADVWZZJd5veDpEi_kgzBJ3uRNuE23Zs=x=az_PewssBfmA7TSA@mail.gmail.com The following query refuses to parse: # select distinct(value) from properties order by 1 collate "C"; ERROR: collations are not supported by type integer LINE 1: ... distinct(value) from properties order by 1 collate "C... ^ # select distinct(value) from properties order by distinct(value) collate "C"; ERROR: syntax error at or near "distinct" LINE 1: ...ct distinct(value) from properties order by distinct(v... ^ # select distinct(value) as foo from properties order by foo collate "C"; ERROR: column "foo" does not exist LINE 1: ...tinct(value) as foo from properties order by foo collat... The solution was as follows: # select distinct(value) collate "C" from properties order by 1; It's arguable if this is a bug or not, though I would have expected the first attempt at least to be valid. Cheers, Tim -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs