Hi,

While doing some tests, I noticed an unexpected query result in Basex 9.6.3 (on Windows 10).

This query:

let $ids := for $i in 1 to 10 return random:uuid()
for $id in $ids
order by $id
return $id


... returns 10 UUIDs, but they are not sorted.

Information from the Info pane in the GUI:

Compiling:
- rewrite range expression to range sequence: (1 to 10)
- rewrite simple map to util:replicate(items,count[,multiple]): (1 to 10) ! random:uuid() -> util:replicate(random:uuid(), 10, true())
- inline for $i_1 in (1 to 10)
- simplify FLWOR expression: util:replicate(random:uuid(), 10, true())
- inline let $ids_0 := util:replicate(random:uuid(), 10, true())
- rewrite fn:sort(items[,collation[,function]]) to util:replicate(items,count[,multiple]): sort(util:replicate(random:uuid(), 10, true())) -> util:replicate(random:uuid(), 10, true())
- inline for $id_2 in util:replicate(random:uuid(), 10, true())
- simplify FLWOR expression: util:replicate(random:uuid(), 10, true())
Optimized Query:
util:replicate(random:uuid(), 10, true())

In Basex 9.3.2 (on another Windows machine) items are sorted alphabetically, as I would expect them to be – but I may be overlooking something.

Any ideas?

Thanks,
Tom De Herdt