Re: ordering error in query?

Поиск
Список
Период
Сортировка
От ljb
Тема Re: ordering error in query?
Дата
Msg-id afdo5i$mqn$1@news.hub.org
обсуждение исходный текст
Ответ на ordering error in query?  (s <smarie@ekno.com>)
Список pgsql-general
smarie@ekno.com wrote:
> ...
> select distinct f.id, '' from foo f;
>
> I need the empty string as the second attribute because the first part
> of the union has a second attribute.  This works on oracle, but
> postgres says:
>
> ERROR:  Unable to identify an ordering operator '<' for type 'unknown'
>         Use an explicit ordering operator or modify the query
>...
> Suggestions?

   select distinct on (f.id) f.id,'' from foo f;
But "distinct on" is non-standard and Oracle probably won't like it.

Weird-looking, but more likely to work:
   select distinct f.id, ''||'' from foo f;
or even:
   select distinct f.id, tolower('') from foo f;
Either of which seems enough to convince PostgreSQL that we're dealing
with a character type.

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Strange behaviour of SELECT ... IN
Следующее
От: Ben
Дата:
Сообщение: Re: Advocacy Idea.