cubicweb/server/ssplanner.py
changeset 12248 6350e0a482d5
parent 12242 68ca7fe0ca29
parent 12228 8fa3131583ec
child 12567 26744ad37953
--- a/cubicweb/server/ssplanner.py	Tue Dec 12 11:17:25 2017 +0100
+++ b/cubicweb/server/ssplanner.py	Fri Jan 12 11:02:52 2018 +0100
@@ -24,7 +24,7 @@
 
 from cubicweb import QueryError
 from cubicweb.schema import VIRTUAL_RTYPES
-from cubicweb.rqlrewrite import add_types_restriction
+from cubicweb.rqlrewrite import add_types_restriction, RQLRelationRewriter
 from cubicweb.server.edition import EditedEntity
 
 READ_ONLY_RTYPES = set(('eid', 'has_text', 'is', 'is_instance_of', 'identity'))
@@ -302,6 +302,9 @@
         union.append(select)
         select.clean_solutions(solutions)
         add_types_restriction(self.schema, select)
+        # Rewrite computed relations
+        rewriter = RQLRelationRewriter(plan.cnx)
+        rewriter.rewrite(union, plan.args)
         self.rqlhelper.annotate(union)
         return self.build_select_plan(plan, union)