Re: postgresql-8.0.jar and failure of ORDER BY parameters

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: postgresql-8.0.jar and failure of ORDER BY parameters
Дата
Msg-id 18496.1115218236@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: postgresql-8.0.jar and failure of ORDER BY parameters  (Guillaume Cottenceau <gc@mnc.ch>)
Ответы Re: postgresql-8.0.jar and failure of ORDER BY parameters  (Guillaume Cottenceau <gc@mnc.ch>)
Список pgsql-jdbc
Guillaume Cottenceau <gc@mnc.ch> writes:
> I'd better write for example:
>         actionSt.setString( 1, "surname" )
> in order to sort by the value of the column named "surname", but
> this has never "worked". Is it supposed to work now?

No, that's just a different way of sorting by a constant.

Parameters are *values*, they are not references to columns, and so
there is no way to do what you want.  The fact that it happened to
work like that before was an implementation artifact that has now
gone away.

AFAICS you'll have to set up multiple prepared statements with all the
different orderings you want.  This is not different from having to set
up different statements depending on which columns you want displayed
--- would you expect "SELECT ? FROM mytab" to allow run-time
selection of a column?

            regards, tom lane

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

Предыдущее
От: "Xavier Poinsard"
Дата:
Сообщение: Re: postgresql-8.0.jar and failure of ORDER BY parameters
Следующее
От: Guillaume Cottenceau
Дата:
Сообщение: Re: postgresql-8.0.jar and failure of ORDER BY parameters