[ms] fix planning bug introduced with recent rql refactoring for queries with only eids (fix unittest_multisources.test_in_eid)
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 06 Apr 2010 20:10:12 +0200
changeset 5161 a19f22bacedc
parent 5160 27d4cab5db03
child 5162 6340ed9f8caf
[ms] fix planning bug introduced with recent rql refactoring for queries with only eids (fix unittest_multisources.test_in_eid)
server/msplanner.py
--- a/server/msplanner.py	Tue Apr 06 19:58:04 2010 +0200
+++ b/server/msplanner.py	Tue Apr 06 20:10:12 2010 +0200
@@ -312,11 +312,15 @@
             # NOTE: use uidrel and not constnode to deal with "X eid IN(1,2,3,4)"
             if varobj.stinfo['uidrel'] is not None:
                 rel = varobj.stinfo['uidrel']
+                hasrel = len(varobj.stinfo['relations']) > 1
                 for const in rel.children[1].get_nodes(Constant):
                     eid = const.eval(self.plan.args)
                     source = self._session.source_from_eid(eid)
-                    if not any(source.support_relation(r.r_type)
-                               for r in varobj.stinfo['relations'] if not r is rel):
+                    if (source is self.system_source
+                        or (hasrel and
+                            not any(source.support_relation(r.r_type)
+                                    for r in varobj.stinfo['relations']
+                                    if not r is rel))):
                         self._set_source_for_term(self.system_source, varobj)
                     else:
                         self._set_source_for_term(source, varobj)