xpath_string and group by

Поиск
Список
Период
Сортировка
От Perez
Тема xpath_string and group by
Дата
Msg-id arturo-893D4A.15510226082006@news.hub.org
обсуждение исходный текст
Ответы Re: xpath_string and group by  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
Hi all,

Using 8.1.4 and contrib/xml2.  When I do a

select xpath_string(note, '//Thing') as note,
   count(aDate) from theTable
group by lower(xpath_string(note, '//Thing'))
order by 2 desc;

I get an error:
GROUP BY must contain note.
But I can do that for a plain text/varchar field.  Adding the non-xpath
note field messes up the grouping.

Can someone explain what interaction of features causes the above?  I'm
finding that to do the counts the way I want (case-insensitive with
trimmed blanks) I end up doing some variation of:

select note, count(aDate) from
  (select  lower(xpath_string(note, '//Thing')) as note, aDate from
theTable) as foo
group by note

tia,
arturo

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

Предыдущее
От: Tiger Quimpo
Дата:
Сообщение: Re: Shared Objects (Dynamic loading)
Следующее
От: Jim
Дата:
Сообщение: Fwd: Can't populate database using Copy