1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib
Ryuta Kamizono c9e4c848ee 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.
2019-04-06 15:06:49 +09:00
..
active_record Don't repeat same expression in SELECT and GROUP BY clauses 2019-04-06 15:06:49 +09:00
arel Revert unused code and re-using query annotation for update_all and delete_all 2019-04-01 15:04:11 +09:00
rails/generators Add attachment and attachments field generators 2019-03-30 12:15:17 -05:00
active_record.rb Refactor Relation#cache_key is moved from CollectionCacheKey#collection_cache_key 2019-04-04 13:18:59 +09:00
arel.rb Fix eager loading polymorphic association with mixed table conditions 2019-02-18 00:41:43 +09:00