server/msplanner.py
branchstable
changeset 2165 dd40c375044e
parent 2114 862f27d94af4
child 2170 6adbc965c51b
--- a/server/msplanner.py	Thu Jun 25 08:26:25 2009 +0200
+++ b/server/msplanner.py	Thu Jun 25 11:26:46 2009 +0200
@@ -553,6 +553,14 @@
         # NOTE: < 2 since may be 0 on queries such as Any X WHERE X eid 2
         if len(self._sourcesterms) < 2:
             self.needsplit = False
+            # if this is not the system source but we have only constant terms
+            # and no relation (other than eid), apply query on the system source
+            #
+            # testing for rqlst with nothing in vargraph nor defined_vars is the
+            # simplest way the check the condition explained below
+            if not self.system_source in self._sourcesterms and \
+                   not self.rqlst.vargraph and not self.rqlst.defined_vars:
+                self._sourcesterms = {self.system_source: {}}
         elif not self.needsplit:
             if not allequals(self._sourcesterms.itervalues()):
                 for terms in self._sourcesterms.itervalues():