| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера