[Bug 5290] [XQuery] Unclear meaning of "collation" in order-by clause

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5290





--- Comment #4 from Don Chamberlin <chamberl@almaden.ibm.com>  2008-09-03 19:10:23 ---
Mike Kay has pointed out that the text in Comment #2 does not accurately
reflect the intent of the working group that ordering is based on fn:compare()
when a collation is specified and the ordering keys are convertible to strings.
As stated in Comment #2, if fn:compare() returns a non-negative result (Rule
c), the algorithm falls through to Rule d and applies the "gt" operator. This
is a mistake.

The corrected rules are as follows:

When the orderspec specifies empty least, the following rules are applied in
order:
(1) If V is an empty sequence and W is not an empty sequence, then W
greater-than V is true.
(2) If V is NaN and W is neither NaN nor an empty sequence, then W greater-than
V is true.
(3) If a specific collation C is specified, and V and W are both of type
xs:string or are convertible to xs:string by subtype substitution and/or type
promotion, then:
If fn:compare(V, W, C) is less than zero, then W greater-than V is true;
otherwise W greater-than V is false.
(4) If none of the above rules apply, then:
If W gt V is true, then W greater-than V is true; otherwise W greater-than V is
false.

An analogous set of rules apply when the orderspec specifies empty greatest.

Since this change simply corrects an error in accurately reflecting the
decision of the working group, I am leaving this bug report in "Closed" status.

Don Chamberlin


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 3 September 2008 19:11:06 UTC