[BUGS] ORDER BY $1 behaves inconsistently

Поиск
Список
Период
Сортировка
От Jordan Lewis
Тема [BUGS] ORDER BY $1 behaves inconsistently
Дата
Msg-id CAALgziJijki4_scH=3LENpJ-K8WOfSQwSx_TCv4Qph6-U6XceA@mail.gmail.com
обсуждение исходный текст
Ответы Re: [BUGS] ORDER BY $1 behaves inconsistently
Список pgsql-bugs
Version: 10.0

As I understand it, the only valid constant datatype in an ORDER BY is integer. That's validated by the following test:

jordan=# SELECT * FROM t ORDER BY 'foo';
ERROR:  non-integer constant in ORDER BY
LINE 1: SELECT * FROM t ORDER BY 'foo';

However, using a prepared statement, this behavior can be avoided:

jordan=# PREPARE x as SELECT * FROM t ORDER BY $1;
PREPARE
jordan=# EXECUTE x('foo');
 c
---
 1

It seems to me that there is some missing type checking from ORDER BY.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: [BUGS] BUG #14877: DISCARD ALL incorrectly resets user parameters
Следующее
От: Jordan Lewis
Дата:
Сообщение: Re: [BUGS] ORDER BY $1 behaves inconsistently