Skip to content
Snippets Groups Projects
Commit a206766be96c authored by Sylvain Thenault's avatar Sylvain Thenault
Browse files

should not simplify variables used in the GROUPBY clause when there is a

     HAVING clause
parent aedcc8f477b7
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
================= =================
-- --
* should not simplify variables used in the GROUPBY clause when there is a
HAVING clause
2008-07-22 -- 0.19.0
* grammar changes: LIMIT / OFFSET should now be before the WHERE clause, * grammar changes: LIMIT / OFFSET should now be before the WHERE clause,
though bw compat will be kept for some time though bw compat will be kept for some time
* when simplifying constant uid nodes, don't remove them from group terms if * when simplifying constant uid nodes, don't remove them from group terms if
......
...@@ -331,6 +331,11 @@ ...@@ -331,6 +331,11 @@
self.visit_union(subquery.query) self.visit_union(subquery.query)
subquery.query.schema = node.root.schema subquery.query.schema = node.root.schema
self._visit_stmt(node) self._visit_stmt(node)
if node.having:
# if there is a having clause, bloc simplification of variables used in GROUPBY
for term in node.groupby:
for vref in term.iget_nodes(VariableRef):
vref.variable.stinfo['blocsimplification'].add(term)
def rewrite_shared_optional(self, exists, var): def rewrite_shared_optional(self, exists, var):
"""if variable is shared across multiple scopes, need some tree """if variable is shared across multiple scopes, need some tree
......
...@@ -125,6 +125,9 @@ ...@@ -125,6 +125,9 @@
('Any X WITH X BEING (Any X WHERE X eid 12)', ('Any X WITH X BEING (Any X WHERE X eid 12)',
'Any X WITH X BEING (Any 12)'), 'Any X WITH X BEING (Any 12)'),
('Any X GROUPBY X WHERE X eid 12, X connait Y HAVING COUNT(Y) > 10',
'Any X GROUPBY X WHERE X eid 12, X connait Y HAVING COUNT(Y) > 10')
): ):
yield self._test_rewrite, rql, expected yield self._test_rewrite, rql, expected
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment