Re: non-integer constant in ORDER BY: why exactly, and documentation? - Mailing list pgsql-general

From Jasen Betts
Subject Re: non-integer constant in ORDER BY: why exactly, and documentation?
Date
Msg-id k5bbse$8hk$1@reversiblemaps.ath.cx
Whole thread Raw
In response to non-integer constant in ORDER BY: why exactly, and documentation?  (Ken Tanzer <ken.tanzer@gmail.com>)
List pgsql-general
On 2012-10-11, David Johnston <polobo@yahoo.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@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Ken Tanzer
> Sent: Thursday, October 11, 2012 4:49 PM
> To: pgsql-general@postgresql.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

pgsql-general by date:

Previous
From: Jasen Betts
Date:
Subject: Re: moving from MySQL to pgsql
Next
From: Jasen Betts
Date:
Subject: Re: stored procedure multiple call call question