for ... group by - minor bug

Thursday, 15 November 2012 · 1 message
HR
Hans-Juergen Rennau15 Nov 2012 13:50 #
Hello, the support for XQuery 3.0 is really wonderful! Thank you. Just a trifle: I think there is a little bug concerning the "group by" clause and the case that a non-grouping variable is reused as grouping variable, but the shorthand notation for this is not used. According to the spec, these expressions should be equivalent:
group by $x
group by $x := $x
I observed that in the shorthand notation $x references the grouping variable, that is, one value per group, as it should. But in the longhand notation, $x references the variable in the pre-grouping variable, and I suppose this should not be so.
For a full example, see below. Kind regards, Hans-Juergen PS: Full example: Code:
for $x in (1, 1, 2)
group by $x := $x
return <r x="{$x}"/>
Output:
<r x="1 1"/>
<r x="2"/>

⚡Generated with XQuery