Re: non-integer constant in ORDER BY: why exactly, and documentation?
| От | Tom Lane |
|---|---|
| Тема | Re: non-integer constant in ORDER BY: why exactly, and documentation? |
| Дата | |
| Msg-id | 28246.1349989583@sss.pgh.pa.us обсуждение |
| Ответ на | non-integer constant in ORDER BY: why exactly, and documentation? (Ken Tanzer <ken.tanzer@gmail.com>) |
| Ответы |
Re: non-integer constant in ORDER BY: why exactly, and documentation?
|
| Список | pgsql-general |
Ken Tanzer <ken.tanzer@gmail.com> 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
В списке pgsql-general по дате отправления: