• S
    Don't preserve SELECT columns on COUNT · 9fa3f102
    Steve Klabnik 提交于
    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.
    9fa3f102
has_many_associations_test.rb 55.8 KB