--- a/rql/stcheck.py Wed Jan 11 14:53:16 2017 +0100
+++ b/rql/stcheck.py Thu Dec 01 23:19:18 2016 +0100
@@ -683,7 +683,8 @@
relation.parent.ored()):
if isinstance(constnode, Constant):
lhsvar.stinfo['constnode'] = constnode
- lhsvar.stinfo['uidrel'] = relation
+ if not isinstance(constnode, VariableRef):
+ lhsvar.stinfo['uidrel'] = relation
else:
lhsvar.stinfo.setdefault(key, set()).add(relation)
elif rschema.final or rschema.inlined:
--- a/test/unittest_stcheck.py Wed Jan 11 14:53:16 2017 +0100
+++ b/test/unittest_stcheck.py Thu Dec 01 23:19:18 2016 +0100
@@ -323,5 +323,12 @@
self.parse('Any X, Y WHERE X work_for Z, Y work_for Z, X eid > Y')
self.assertEqual(str(cm.exception), 'variable Y should not be used as rhs of attribute relation X eid > Y')
+ def test_no_uid_rel_if_not_constant(self):
+ rqlst = self.parse('Any X,EID WHERE X eid EID').children[0]
+ self.assertEqual(rqlst.defined_vars['X'].stinfo['uidrel'], None)
+ rqlst = self.parse('Any X WHERE X eid IN (1,2,3)').children[0]
+ self.assertTrue(rqlst.defined_vars['X'].stinfo['uidrel'])
+
+
if __name__ == '__main__':
unittest_main()