Re: Prepare/Execute silently discards prohibited ORDER BY values
В списке pgsql-bugs по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Prepare/Execute silently discards prohibited ORDER BY values |
| Дата | |
| Msg-id | 432.1431389890@sss.pgh.pa.us обсуждение |
| Ответ на | Prepare/Execute silently discards prohibited ORDER BY values (Josh Berkus <josh@agliodbs.com>) |
| Список | pgsql-bugs |
Josh Berkus <josh@agliodbs.com> writes:
> Tested On: 9.4.1, 9.3.6
> Severity: minor
> Summary: PREPARE/EXECUTE appears to silently discard ORDER BY parameters.
> josh=# prepare foo as select * from test order by $1;
> PREPARE
I don't see anything wrong with this. Ordering by a provably constant
expression is a no-op, not an error.
> What appears to be happening is that the prohibited parameter for ORDER
> BY is being silently discarded during EXECUTE. At first I thought it
> might just be doing ORDER BY 'test' in the background, but that's not it:
> josh=# select * from test order by 'test';
> ERROR: non-integer constant in ORDER BY
This error is purely a syntactic restriction, not a semantic one.
There's nothing that will stop you from ordering by, say, "cos(0)";
and the planner will throw that away too.
regards, tom lane
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера