don't deparenthesise subqueries with a group by
Matt S Trout [Thu, 23 Aug 2012 18:27:39 +0000 (18:27 +0000)]
lib/Data/Query/Renderer/SQL/Naive.pm

index c9d356c..96abe9c 100644 (file)
@@ -144,7 +144,7 @@ sub _render_operator {
 sub _maybe_parenthesise {
   my ($self, $dq) = @_;
   for ($dq) {
-    return is_Select() || is_Slice()
+    return is_Select() || is_Group() || is_Slice()
       ? [ '(', $self->_render($dq), ')' ]
       : $self->_render($dq);
   }