diff -r e3a5b7c3f767 -r 83c5499e1436 entity.py --- 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,