server/sources/rql2sql.py
branchstable
changeset 7472 9833c09460f1
parent 7421 5115daeeb2ff
child 7473 a164fdf3de5d
child 7579 5a610b34d2d2
--- a/server/sources/rql2sql.py	Tue Jun 07 10:17:36 2011 +0200
+++ b/server/sources/rql2sql.py	Wed Jun 08 15:11:45 2011 +0200
@@ -1258,11 +1258,16 @@
         unification (eg X attr1 A, Y attr2 A). In case of selection,
         nothing to do here.
         """
-        for var in rhs_vars:
+        for vref in rhs_vars:
+            var = vref.variable
             if var.name in self._varmap:
                 # ensure table is added
-                self._var_info(var.variable)
-            principal = var.variable.stinfo.get('principal')
+                self._var_info(var)
+            if isinstance(var, ColumnAlias):
+                # force sql generation whatever the computed principal
+                principal = 1
+            else:
+                principal = var.stinfo.get('principal')
             if principal is not None and principal is not relation:
                 # we have to generate unification expression
                 lhssql = self._inlined_var_sql(relation.children[0].variable,