Re: non-integer constant in ORDER BY: why exactly, and documentation?

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: non-integer constant in ORDER BY: why exactly, and documentation?
Date: 2012-10-13 09:22:22
Message-ID: k5bbse$8hk$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2012-10-11, David Johnston <polobo(at)yahoo(dot)com> wrote:
> This is a multipart message in MIME format.
>
> ------=_NextPart_000_0400_01CDA7D1.CAF1CC60
> Content-Type: text/plain;
> charset="us-ascii"
> Content-Transfer-Encoding: 7bit
>
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Ken Tanzer
> Sent: Thursday, October 11, 2012 4:49 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] non-integer constant in ORDER BY: why exactly, and
> documentation?
>
>
>
> Hi. I recently ran a query that generate the same error as this:
>
> SELECT * FROM generate_series(1,10) ORDER BY 'foo';
> ERROR: non-integer constant in ORDER BY
> LINE 1: SELECT * FROM generate_series(1,10) ORDER BY 'foo';

yeah, it seems there's a difference between a constant and a
constant-valued expression

SELECT * FROM generate_series(1,10) ORDER BY 'foo'::text;

SELECT * FROM generate_series(1,10) ORDER BY 1::int desc;
SELECT * FROM generate_series(1,10) ORDER BY 1 desc;

--
⚂⚃ 100% natural

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2012-10-13 10:10:13 Re: stored procedure multiple call call question
Previous Message Jasen Betts 2012-10-13 08:22:08 Re: moving from MySQL to pgsql