On 2012-10-11, David Johnston <[email protected]> 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: [email protected]
> [mailto:[email protected]] On Behalf Of Ken Tanzer
> Sent: Thursday, October 11, 2012 4:49 PM
> To: [email protected]
> 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