Permalink
Browse files

Alias subquery used in calculations, to provide better compatibility …

…with databases such as MonetDB

Signed-off-by: Michael Koziarski <michael@koziarski.com>
Signed-off-by: Tom Ward <tom@popdog.net>
[#796 state:committed]
  • Loading branch information...
1 parent eb4668b commit c7375d74d9fff3219d4ea389ba9e36a90afe9d33 @mpolakis mpolakis committed with NZKoz Aug 11, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/calculations.rb
@@ -211,7 +211,7 @@ def construct_calculation_sql(operation, column_name, options) #:nodoc:
sql << " ORDER BY #{options[:order]} " if options[:order]
add_limit!(sql, options, scope)
- sql << ')' if use_workaround
+ sql << ') AS #{aggregate_alias}_subquery' if use_workaround
sql
end

0 comments on commit c7375d7

Please sign in to comment.