entity.py
branchstable
changeset 2871 83c5499e1436
parent 2658 5535857eeaa5
child 2872 9d641d98cc86
--- a/entity.py	Mon Aug 17 10:31:28 2009 +0200
+++ b/entity.py	Mon Aug 17 11:05:28 2009 +0200
@@ -254,8 +254,11 @@
                     selection.pop()
                     restrictions.pop()
                     continue
-                if card == '?':
-                    restrictions[-1] += '?' # left outer join if not mandatory
+                # XXX we need outer join in case the relation is not mandatory
+                # (card == '?')  *or if the entity is being added*, since in
+                # that case the relation may still be missing. As we miss this
+                # later information here, systematically add it.
+                restrictions[-1] += '?'
                 destcls = cls.vreg['etypes'].etype_class(desttype)
                 destcls._fetch_restrictions(var, varmaker, destcls.fetch_attrs,
                                             selection, orderby, restrictions,