Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ken Tanzer <ken.tanzer@xxxxxxxxx> writes:
> 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

> I am curious though about why this "limitation" exists.  I get that integer
> constants are reserved for sorting by column numbers.  But if Postgres
> already knows that it's a non-integer constant,  why not let it go through
> with the (admittedly pointless) ordering?

I think the argument was that it's almost certainly a mistake, so we're
more helpful by throwing an error than by silently executing a query
that probably won't do what the user was expecting.  In this particular
example, it seems quite likely that the programmer meant "foo" (ie a
quoted column reference) and got the quote style wrong ...

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux