xpath_string and group by - Mailing list pgsql-general

From Perez
Subject xpath_string and group by
Date
Msg-id arturo-893D4A.15510226082006@news.hub.org
Whole thread Raw
Responses Re: xpath_string and group by
List 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 by date:

Previous
From: Tiger Quimpo
Date:
Subject: Re: Shared Objects (Dynamic loading)
Next
From: Jim
Date:
Subject: Fwd: Can't populate database using Copy