[Cubicweb] An rql bug ?
alain.leufroy at logilab.fr
Wed Feb 11 09:48:24 CET 2015
aurélien campéas <aurelien.campeas at gmail.com> writes:
>> On 04 février 16:00, aurélien campéas wrote:
>> > It does the trick ! Thank you very much :)
>> that's because OR doesn't work like most people would expect. Every
>> variable in
>> a rql statement (eg beside subquery and union query) has a single
>> even those in EXISTS scope.
> Yes, and I know that quite well, but I have some difficulties "computing"
> behaviour of the expression with a shared variable (in my head).
> For instance, it is not intuitive that the combination of these clauses
> yields what I saw.
I had troubles explaining constraints with that issue when the subject
of a relation has more than one entity type. For example:
subject = ('Project', 'System')
object = 'Subprocess'
subject = 'Subject'
object = 'System'
subject = 'CWUser'
object = 'Project'
And I would like to write the following permission rule on `run`:
RRQLExpression('EXISTS(U can_run O) OR EXISTS(U can_run X, O in_project X)')
Adding this permission rule fails with a "type inconsistancy"
exception from rql.
Looking into the rql code, it seems that the type checker consideres the
OR like an AND, that is the types in the first part 'and' the types of
variables in the second part must be similar.
More information about the Cubicweb