You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2013/05/21 11:11:16 UTC

[jira] [Reopened] (OAK-830) XPathToSQL2Converter fails to wrap or clauses

     [ https://issues.apache.org/jira/browse/OAK-830?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Mueller reopened OAK-830:
--------------------------------

      Assignee: Thomas Mueller  (was: Alex Parvulescu)

Thanks for finding the issue! However, the problem is not quite fixed. For example, the XPath query:

{code}
//*[@a=1 or @b=1]/sub[@c=1]
{code}

Is converted to:

{code}
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 a.[a] = 1 or a.[b] = 1 and b.[c] = 1 
and name(b) = 'sub' /* xpath: //*[@a=1 or @b=1]/sub[@c=1] */
{code}

Which is incorrect.

I will solve it in a slightly different way.
                
> XPathToSQL2Converter fails to wrap or clauses
> ---------------------------------------------
>
>                 Key: OAK-830
>                 URL: https://issues.apache.org/jira/browse/OAK-830
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: Alex Parvulescu
>            Assignee: Thomas Mueller
>             Fix For: 0.8
>
>
> There are some xpath queries that contain some 'or' clauses which are not properly converted to sql2:
> For example
> {code}
> /jcr:root/home//test/* [@type='t1' or @type='t2' or @type='t3']
> {code}
> turns into 
> {code}
> 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 (name(a) = 'test' and isdescendantnode(a, '/home')) and b.[type] = 't1' or b.[type] = 't2') or b.[type] = 't3' /* xpath: /jcr:root/home//test/* [@type='t1' or @type='t2' or @type='t3'] */
> {code}
> Notice how the 3 'or's should be wrapped into parenthesis, otherwise the resulting query is simply wrong.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira