aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/view_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-04-06 13:04:06 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-04-06 15:06:49 +0900
commitc9e4c848eeeb8999b778fa1ae52185ca5537fffe (patch)
tree4715c228b5ff9f12df9db27cf900723913cd5e0b /activerecord/test/cases/view_test.rb
parent0856f7c744e631b6efafbb14d01e60bbfaa593f5 (diff)
downloadrails-c9e4c848eeeb8999b778fa1ae52185ca5537fffe.tar.gz
rails-c9e4c848eeeb8999b778fa1ae52185ca5537fffe.tar.bz2
rails-c9e4c848eeeb8999b778fa1ae52185ca5537fffe.zip
Don't repeat same expression in SELECT and GROUP BY clauses
This refactors `execute_grouped_calculation` and slightly changes generated GROUP BY queries, since I'd not prefer to repeat same expression in SELECT and GROUP BY clauses. Before: ``` SELECT COUNT(*) AS count_all, "topics"."author_name" AS topics_author_name, COALESCE(type, title) AS coalesce_type_title FROM "topics" GROUP BY "topics"."author_name", COALESCE(type, title) ``` After: ``` SELECT COUNT(*) AS count_all, "topics"."author_name" AS topics_author_name, COALESCE(type, title) AS coalesce_type_title FROM "topics" GROUP BY topics_author_name, coalesce_type_title ``` Although we generally don't guarantee to support Arel node constructed by user itself, this also fixes #24207.
Diffstat (limited to 'activerecord/test/cases/view_test.rb')
0 files changed, 0 insertions, 0 deletions