[rql2sql] fix scope computation of variable from temporary table stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 02 Jun 2010 16:13:28 +0200
branchstable
changeset 5635 56784e46509f
parent 5634 e01cf2013bf1
child 5636 8138d9c86ac8
child 5641 4c1d0e80a376
[rql2sql] fix scope computation of variable from temporary table
server/sources/rql2sql.py
--- a/server/sources/rql2sql.py	Wed Jun 02 15:55:16 2010 +0200
+++ b/server/sources/rql2sql.py	Wed Jun 02 16:13:28 2010 +0200
@@ -1180,14 +1180,15 @@
     def _temp_table_scope(self, select, table):
         scope = 9999
         for var, sql in self._varmap.iteritems():
-            if table == sql.split('.', 1)[0]:
+            # skip "attribute variable" in varmap (such 'T.login')
+            if not '.' in var and table == sql.split('.', 1)[0]:
                 try:
                     scope = min(scope, self._state.scopes[select.defined_vars[var].scope])
                 except KeyError:
                     scope = 0 # XXX
                 if scope == 0:
-                    return 0
-        return 0
+                    break
+        return scope
 
     def _var_info(self, var):
         try: