Thomas Mueller created JCR-3376:
-----------------------------------

             Summary: TCK: SQLPathTest.testChildAxisRoot expected root node not 
in result
                 Key: JCR-3376
                 URL: https://issues.apache.org/jira/browse/JCR-3376
             Project: Jackrabbit Content Repository
          Issue Type: Improvement
            Reporter: Thomas Mueller
            Assignee: Thomas Mueller
            Priority: Minor


The TCK test SQLPathTest.testChildAxisRoot runs the following SQL-1 query:

    SELECT * FROM nt:base WHERE jcr:path LIKE '/%' AND NOT jcr:path LIKE '/%/%'

It expected the result to be

    /jcr:system, /testroot, /testdata

It does not allow the implementation to return the root node ('/'). According 
to the specification, a JCR implementation may filter the root node, as noted 
by Randall Hauch - 
http://jackrabbit.510166.n4.nabble.com/TCK-SQLPathTest-testChildAxisRoot-td4655670.html
 - quote:

"
Section 6.6.5.1 ("jcr:like function") defines the semantics of the wildcard 
characters as generally used within LIKE predicates (and "jcr:like" in XPath):

        "As in SQL, the character '%' represents any string of zero or more 
        characters, and the character '_' (underscore) represents any 
        single character."

while Section 8.5.2.2 ("Pseudo-property jcr:path") specifies the semantics 
"jcr:path" pseudo column and narrows the semantics of using LIKE with 
"jcr:path" in the second-to-last bullet point:

        "Predicates in the WHERE clause that test jcr:path are only required to 
        support the operators =, <> and LIKE. In the case of LIKE predicates, 
        support is only required for tests using the % wildcard character as a 
        match for a whole path segment (the part between two / characters) 
        or within index brackets...."

Because the '%' matches only a whole path segment, the "/%" literal only 
matches paths that have at least one path segment, which means that it matches 
all descendants of the root node.
"

the specification says "In the case of LIKE predicates, support is only 
required for tests using the % wildcard character as a match for a whole path 
segment (the part between two / characters)..." but it doesn't specify it needs 
to do so.

To allow an implementation to return the root node, I suggest to change the 
test as follows:

... AND NOT jcr:path LIKE '/%/%' AND jcr:path <> '/'



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to