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

SQL2 query with union, limit and offset can return invalid results

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0.17, 1.2.3, 1.3.2, 1.4
    • query
    • None

    Description

      when using order, limit and offset and a SQL2 query that contains an union of two subqueries that have common results can return invalid results

      Example: assuming content tree /test/a/b/c/d/e exists

      SELECT [jcr:path] FROM [nt:base] AS a WHERE ISDESCENDANTNODE(a, '/test') UNION SELECT [jcr:path] FROM [nt:base] AS a WHERE ISDESCENDANTNODE(a, '/test')" ORDER BY [jcr:path]
      

      with limit=3 and offset 2 returns only one row ( instead of 3 )

      the correct result set is

      /test/a/b/c
      /test/a/b/c/d
      /test/a/b/c/d/e
      

      Attachments

        1. OAK-3013-test.patch
          4 kB
          Teodor Rosu
        2. OAK-3013-fix.patch
          0.9 kB
          Teodor Rosu

        Activity

          People

            amitjain Amit Jain
            rosu Teodor Rosu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: