diff options
author | Suraj N. Kurapati <sunaku@gmail.com> | 2012-09-21 02:48:20 -0700 |
---|---|---|
committer | Suraj N. Kurapati <sunaku@gmail.com> | 2012-09-21 02:56:40 -0700 |
commit | efdda5030a460e8af58ef0f7f4cd5ce8d7f1b541 (patch) | |
tree | 054cb1b6d3e24b844d59d1139325b62e51523972 /lib/arel | |
parent | e032dabdb2adb34e3db8cd35e9f58bc0536475c1 (diff) | |
download | rails-efdda5030a460e8af58ef0f7f4cd5ce8d7f1b541.tar.gz rails-efdda5030a460e8af58ef0f7f4cd5ce8d7f1b541.tar.bz2 rails-efdda5030a460e8af58ef0f7f4cd5ce8d7f1b541.zip |
GH-139: some aggregations lacked DISTINCT emission
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index a350daa3da..9c76772ef8 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -283,22 +283,22 @@ key on UpdateManager using UpdateManager#key= end def visit_Arel_Nodes_Sum o - "SUM(#{o.expressions.map { |x| + "SUM(#{o.distinct ? 'DISTINCT ' : ''}#{o.expressions.map { |x| visit x }.join(', ')})#{o.alias ? " AS #{visit o.alias}" : ''}" end def visit_Arel_Nodes_Max o - "MAX(#{o.expressions.map { |x| + "MAX(#{o.distinct ? 'DISTINCT ' : ''}#{o.expressions.map { |x| visit x }.join(', ')})#{o.alias ? " AS #{visit o.alias}" : ''}" end def visit_Arel_Nodes_Min o - "MIN(#{o.expressions.map { |x| + "MIN(#{o.distinct ? 'DISTINCT ' : ''}#{o.expressions.map { |x| visit x }.join(', ')})#{o.alias ? " AS #{visit o.alias}" : ''}" end def visit_Arel_Nodes_Avg o - "AVG(#{o.expressions.map { |x| + "AVG(#{o.distinct ? 'DISTINCT ' : ''}#{o.expressions.map { |x| visit x }.join(', ')})#{o.alias ? " AS #{visit o.alias}" : ''}" end |