[stcheck] remove overzealous check (closes #240176)

Allow multiple (non "=") operators for uid variables.

authorAurelien Campeas <aurelien.campeas@logilab.fr>
changeset4239093674fe
branchdefault
phasepublic
hiddenno
parent revision#e82edc0de3de Add missing comma in utils.KEYWORDS (closes #245563)
child revision#be1d0045f2e3 Allow rql to work with yapps 2.2.0 which is properly released on pypi, and remove the custom dependency link for it.
files modified by this revision
stcheck.py
test/unittest_stcheck.py
# HG changeset patch
# User Aurelien Campeas <aurelien.campeas@logilab.fr>
# Date 1398254342 -7200
# Wed Apr 23 13:59:02 2014 +0200
# Node ID 4239093674fe5bd7aec8926bbea6c38da32f2031
# Parent e82edc0de3de12bbeb80675fb0580a48c6383114
[stcheck] remove overzealous check (closes #240176)

Allow multiple (non "=") operators for uid variables.

diff --git a/stcheck.py b/stcheck.py
@@ -373,11 +373,11 @@
1                  state.error('unknown relation `%s`' % rtype)
2              else:
3                  if rschema.final and relation.optional not in (None, 'right'):
4                       state.error("optional may only be set on the rhs on final relation `%s`"
5                                   % relation.r_type)
6 -                if self.special_relations.get(rtype) == 'uid':
7 +                if self.special_relations.get(rtype) == 'uid' and relation.operator() == '=':
8                      if state.var_info.get(lhsvar, 0) & VAR_HAS_UID_REL:
9                          state.error('can only one uid restriction per variable '
10                                      '(use IN for %s if desired)' % lhsvar.name)
11                      else:
12                          state.add_var_info(lhsvar, VAR_HAS_UID_REL)
diff --git a/test/unittest_stcheck.py b/test/unittest_stcheck.py
@@ -79,10 +79,12 @@
13      # sorting allowed since order variable reachable from a selected
14      # variable with only ?1 cardinality
15      'DISTINCT Any P ORDERBY PN WHERE P work_for X, P name PN',
16      'DISTINCT Any P ORDERBY XN WHERE P work_for X, X name XN',
17 
18 +    'Any X WHERE X eid > 0, X eid < 42',
19 +    'Any X WHERE X eid 1, X eid < 42',
20 
21 
22      )
23 
24  class CheckClassTest(TestCase):