xpath_string and group by

From: Perez <arturo(at)ethicist(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: xpath_string and group by
Date: 2006-08-26 19:51:06
Message-ID: arturo-893D4A.15510226082006@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message snacktime 2006-08-26 19:51:15 implementing a read lock
Previous Message Jasbinder Bali 2006-08-26 19:32:37 Re: Shared Objects (Dynamic loading)