BaseXdb / basex

BaseX Main Repository.
http://basex.org
BSD 3-Clause "New" or "Revised" License
684 stars 265 forks source link

XQuery: Bug on child node selection with count() #2193

Closed Twilight-Shuxin closed 1 year ago

Twilight-Shuxin commented 1 year ago

Description of the Problem

Given this XML document:

<A1 id="1">
    <B1 id="2">
        <C1 id="3">1</C1>
    </B1>
    <D1 id="4">2</D1>
</A1>

and XPath Query

//*[count(./*/*) >= 1]/*

BaseX give result

<B1 id="2">
        <C1 id="3">1</C1>
    </B1>

Expected Behavior

Should return both node 2 and 4 as Saxon & Exist db.

Steps to Reproduce the Behavior

  1. Create database create database test
  2. Insert XML file into database put test.xml path/to/file
  3. Execute XPath query //*[count(./*/*) >= 1]/*

Do you have an idea how to solve the issue?

No response

What is your configuration?

BaseX version: BaseX 10.6 beta latest commit 816b386 on Windows

ChristianGruen commented 1 year ago

Good catch! It turns out the optimization introduced in #1864 is flawed and needs to be revised.

Twilight-Shuxin commented 1 year ago

Thank you very much!