diff options
author | Steve Klabnik <steve@steveklabnik.com> | 2012-09-15 12:31:53 +0400 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-09-16 23:20:39 -0300 |
commit | 9fa3f102813eeeec440abd75870dfa7b23835665 (patch) | |
tree | 7efe47807fd516409abb7b241956f0906bd3de4d /activerecord/lib/active_record/result.rb | |
parent | 60c88e64e26682a954f7c8cd6669d409ffffcc8b (diff) | |
download | rails-9fa3f102813eeeec440abd75870dfa7b23835665.tar.gz rails-9fa3f102813eeeec440abd75870dfa7b23835665.tar.bz2 rails-9fa3f102813eeeec440abd75870dfa7b23835665.zip |
Don't preserve SELECT columns on COUNT
The COUNT clause of a finder_sql relationship is being rewritten from
COUNT(*) to COUNT(table_name.*). This does not appear to be valid syntax
in MySQL:
```
mysql> SELECT COUNT( table_name.* ) FROM `table_name`;
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '* ) FROM `table_name`' at line 1
```
This fixes the bug, as well as adding tests so we don't re-introduce
it in the future.
Fixes #3956.
Diffstat (limited to 'activerecord/lib/active_record/result.rb')
0 files changed, 0 insertions, 0 deletions