Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in context variables for sub query? #2818

Closed
publicocean0 opened this issue Sep 19, 2014 · 2 comments
Closed

error in context variables for sub query? #2818

publicocean0 opened this issue Sep 19, 2014 · 2 comments
Assignees
Labels

Comments

@publicocean0
Copy link

I build this simplified query for show the error
I have a class with hierarchy : parent is the field to trasverse.
#93:13 has a child.
but
select from #93:13 let $p = @Rid where scope = #65:1 and @Rid <> #93:14 and ( select count() as count from (traverse parent from #93:13 ) where parent = #93:14 ) contains (count = 0)
is correct
but
select from #93:13 let $p = @Rid where scope = #65:1 and @Rid <> #93:14 and ( select count(
) as count from (traverse parent from #93:13 ) where parent = $p ) contains (count = 0)
is wrong
the query might give the same result cause in this simplified query $p = #93:13

@lvca
Copy link
Member

lvca commented Sep 20, 2014

contexts are per context of execution, so the sub-query can't see $p created 2 level up. Try this:

select from #93:13 
  let $p = @rid 
  where scope = #65:1 and @rid <> #93:14 and (
    select count() as count from (
     traverse parent from #93:13
    ) where parent = $parent.$parent.$p 
   ) contains (count = 0)

@publicocean0
Copy link
Author

thank you very much :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants