Hello,

I noticed I get different result sets with the following queries and I can't understand how they differ from each other.

1) Correct behaviour, returns 3 records

let $file := db:list("Snomed")[matches(.,"MRCM")][3]
return
  for $record in (db:open("Snomed", $file)/csv/record)
  [position() = (1 to 3)]
  return $record



2) Unexpected behaviour, returns 21 records

let $file := db:list("Snomed")[matches(.,"MRCM")][3]
return
  for $record in (db:open("Snomed", $file)/csv/record)
  where position() = (1 to 3)
  return $record


I have highlighted the one line that differs between them, e.g the first uses the positional predicate in a path expression and the second uses it in a where clause.

Best regards,
Kristian Kankainen