rqlrewrite.py
changeset 4908 b3ad329cbe17
parent 4907 e623afd49356
child 5004 4cc020ee70e2
child 5421 8167de96c523
--- a/rqlrewrite.py	Mon Mar 15 18:07:54 2010 +0100
+++ b/rqlrewrite.py	Tue Mar 16 10:54:59 2010 +0100
@@ -11,7 +11,7 @@
 __docformat__ = "restructuredtext en"
 
 from rql import nodes as n, stmts, TypeResolverException
-
+from yams import BadSchemaDefinition
 from logilab.common.graph import has_path
 
 from cubicweb import Unauthorized, typed_eid
@@ -317,6 +317,13 @@
                 rel.children[0].name = selectvar # XXX explain why
                 subselect.add_restriction(rel.copy(subselect))
                 for vref in rel.children[1].iget_nodes(n.VariableRef):
+                    if isinstance(vref.variable, n.ColumnAlias):
+                        # XXX could probably be handled by generating the subquery
+                        # into the detected subquery
+                        raise BadSchemaDefinition(
+                            "cant insert security because of usage two inlined "
+                            "relations in this query. You should probably at "
+                            "least uninline %s" % rel.r_type)
                     subselect.append_selected(vref.copy(subselect))
                     aliases.append(vref.name)
                 self.select.remove_node(rel)