--- a/server/sources/rql2sql.py Thu Jul 07 11:08:58 2011 +0200
+++ b/server/sources/rql2sql.py Thu Jul 07 16:47:34 2011 +0200
@@ -1251,6 +1251,8 @@
return condition
self._state.add_outer_join_condition(leftalias, condition)
return
+ if leftalias is None:
+ leftalias = leftvar._q_sql.split('.', 1)[0]
self._state.replace_tables_by_outer_join(
leftalias, rightalias, outertype, '%s=%s' % (lhssql, rhs.accept(self)))
return ''
--- a/server/test/unittest_rql2sql.py Thu Jul 07 11:08:58 2011 +0200
+++ b/server/test/unittest_rql2sql.py Thu Jul 07 16:47:34 2011 +0200
@@ -954,6 +954,12 @@
'''SELECT rel_tags0.eid_from, rel_tags0.eid_to, rel_tags1.eid_from
FROM tags_relation AS rel_tags0 LEFT OUTER JOIN tags_relation AS rel_tags1 ON (rel_tags1.eid_to=123)
WHERE rel_tags0.eid_from=123'''),
+
+ ('Any CASE, CALIBCFG, CFG '
+ 'WHERE CASE eid 1, CFG ecrit_par CASE, CALIBCFG? ecrit_par CASE',
+ '''SELECT _CFG.cw_ecrit_par, _CALIBCFG.cw_eid, _CFG.cw_eid
+FROM cw_Note AS _CFG LEFT OUTER JOIN cw_Note AS _CALIBCFG ON (_CALIBCFG.cw_ecrit_par=_CFG.cw_ecrit_par)
+WHERE _CFG.cw_ecrit_par=1'''),
]
VIRTUAL_VARS = [