Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-7166

Union with different selector names

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: query
    • Labels:
      None

      Description

      The following query returns the wrong nodes:

      /jcr:root/libs/(* | */* | */*/* | */*/*/* | */*/*/*/*)/install
      
      select b.[jcr:path] as [jcr:path], b.[jcr:score] as [jcr:score], b.* from [nt:base] as a
       inner join [nt:base] as b on ischildnode(b, a)
       where ischildnode(a, '/libs') and name(b) = 'install' 
       union select c.[jcr:path] as [jcr:path], c.[jcr:score] as [jcr:score], c.* from [nt:base] as a
       inner join [nt:base] as b on ischildnode(b, a)
       inner join [nt:base] as c on ischildnode(c, b)
       where ischildnode(a, '/libs') and name(c) = 'install' 
       union select d.[jcr:path] as [jcr:path], d.[jcr:score] as [jcr:score], d.* from [nt:base] as a
       inner join [nt:base] as b on ischildnode(b, a)
       inner join [nt:base] as c on ischildnode(c, b)
       inner join [nt:base] as d on ischildnode(d, c)
       where ischildnode(a, '/libs') and name(d) = 'install' 
      

      If I change the selector name to "x" in each subquery, then it works. There is no XPath version of this workaround:

      select x.[jcr:path] as [jcr:path], x.[jcr:score] as [jcr:score], x.* from [nt:base] as a
       inner join [nt:base] as x on ischildnode(x, a)
       where ischildnode(a, '/libs') and name(x) = 'install' 
       union select x.[jcr:path] as [jcr:path], x.[jcr:score] as [jcr:score], x.* from [nt:base] as a
       inner join [nt:base] as b on ischildnode(b, a)
       inner join [nt:base] as x on ischildnode(x, b)
       where ischildnode(a, '/libs') and name(x) = 'install' 
       union select x.[jcr:path] as [jcr:path], x.[jcr:score] as [jcr:score], x.* from [nt:base] as a
       inner join [nt:base] as b on ischildnode(b, a)
       inner join [nt:base] as c on ischildnode(c, b)
       inner join [nt:base] as x on ischildnode(x, c)
       where ischildnode(a, '/libs') and name(x) = 'install' 
      

      Need to check if this is a Oak bug, or a bug in the query tool I use.

        Attachments

          Activity

            People

            • Assignee:
              thomasm Thomas Mueller
              Reporter:
              thomasm Thomas Mueller
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: