Re: CASE in ORDER BY clause

Поиск
Список
Период
Сортировка
От Louis-David Mitterrand
Тема Re: CASE in ORDER BY clause
Дата
Msg-id 20070707083712.GA8488@apartia.fr
обсуждение исходный текст
Ответ на Re: CASE in ORDER BY clause  (Viatcheslav Kalinin <vka@ipcb.net>)
Ответы Re: CASE in ORDER BY clause  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-general
On Fri, Jul 06, 2007 at 08:02:54PM +0400, Viatcheslav Kalinin wrote:
>
> # select start_date from show_date
> # order by
> # case when start_date > CURRENT_DATE then start_date end desc,
> # case when start_date <= CURRENT_DATE then start_date end asc;

The strange thing is when I try:

    select start_date from show_date order by case when start_date > CURRENT_DATE then 'start_date asc' else
'start_datedesc ' end; 

It lists start_date's without ordering them (does nothing).

However if I try:

    select start_date from show_date order by 'start_date desc';

I get a:

    ERROR:  non-integer constant in ORDER BY

Bug? Inconsistency?

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

Предыдущее
От: Louis-David Mitterrand
Дата:
Сообщение: Re: CASE in ORDER BY clause
Следующее
От: "Leon Mergen"
Дата:
Сообщение: Unable to get postgres running after long time no vacuum