Add `columns_for_distinct` for MySQL 5.7 with ONLY_FULL_GROUP_BY #22241

Merged
merged 3 commits into from Dec 30, 2015

Projects

None yet

6 participants

@kamipo
Member
kamipo commented Nov 10, 2015

In MySQL 5.7.5 and up, ONLY_FULL_GROUP_BY affects handling of queries
that use DISTINCT and ORDER BY. It requires the ORDER BY columns in the
select list for distinct queries, and requires that the ORDER BY include
the distinct column.

See https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html

@rails-bot

r? @senny

(@rails-bot has picked a reviewer for you, use r? to override)

@senny senny was assigned by rails-bot Nov 10, 2015
@yui-knk
Contributor
yui-knk commented Nov 10, 2015

I think it is better to add test cases for columns_for_distinct like postgresql.

@kamipo
Member
kamipo commented Nov 11, 2015

Added test cases for columns_for_distinct, thanks!

@joker1007
Contributor

👍

@kamipo kamipo Fix `test_find_with_order_on_included_associations_with_construct_fin…
…der_sql_for_association_limiting_and_is_distinct` to NULL-agnostic way

The sort order of NULL depends on the RDBS implementation. This commit
is to fix the test to NULL-agnostic way.

Example:

    ```
    activerecord_unittest=# SELECT  DISTINCT "posts"."id", author_addresses_authors.id AS alias_0 FROM "posts" LEFT OUTER JOIN "authors" ON "authors"."id" = "posts"."author_id" LEFT OUTER JOIN "author_addresses" ON "author_addresses"."id" = "authors"."author_address_id" LEFT OUTER JOIN "categorizations" ON "categorizations"."category_id" = "posts"."id" LEFT OUTER JOIN "authors" "authors_posts" ON "authors_posts"."id" = "categorizations"."author_id" LEFT OUTER JOIN "author_addresses" "author_addresses_authors" ON "author_addresses_authors"."id" = "authors_posts"."author_address_id" ORDER BY author_addresses_authors.id DESC;
     id | alias_0
    ----+---------
      1 |
      2 |
      3 |
      4 |
      5 |
      6 |
      7 |
      8 |
      9 |
     10 |
     11 |
      1 |       1
    (12 rows)
    ```

    ```
    root@localhost [activerecord_unittest] > SELECT  DISTINCT `posts`.`id`, author_addresses_authors.id AS alias_0 FROM `posts` LEFT OUTER JOIN `authors` ON `authors`.`id` = `posts`.`author_id` LEFT OUTER JOIN `author_addresses` ON `author_addresses`.`id` = `authors`.`author_address_id` LEFT OUTER JOIN `categorizations` ON `categorizations`.`category_id` = `posts`.`id` LEFT OUTER JOIN `authors` `authors_posts` ON `authors_posts`.`id` = `categorizations`.`author_id` LEFT OUTER JOIN `author_addresses` `author_addresses_authors` ON `author_addresses_authors`.`id` = `authors_posts`.`author_address_id` ORDER BY author_addresses_authors.id DESC;
    +----+---------+
    | id | alias_0 |
    +----+---------+
    |  1 |       1 |
    |  3 |    NULL |
    |  1 |    NULL |
    |  2 |    NULL |
    |  4 |    NULL |
    |  5 |    NULL |
    |  6 |    NULL |
    |  7 |    NULL |
    |  8 |    NULL |
    |  9 |    NULL |
    | 10 |    NULL |
    | 11 |    NULL |
    +----+---------+
    12 rows in set (0.00 sec)
    ```
a093afd
@kamipo
Member
kamipo commented Dec 21, 2015

The default SQL mode in MySQL 5.7 includes these modes: ONLY_FULL_GROUP_BY, STRICT_TRANS_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, and NO_ENGINE_SUBSTITUTION.

http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-setting

And in MySQL 5.7.5 and up, ONLY_FULL_GROUP_BY affects handling of queries that use DISTINCT and ORDER BY. It requires the ORDER BY columns in the select list for distinct queries, and requires that the ORDER BY include the distinct column.

https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html

This means that Rails doesn't work on MySQL 5.7 with default sql_mode. We need to fix this issue and should backport to 4-2-stable.

test/config.example.yml:

diff --git a/activerecord/test/config.example.yml b/activerecord/test/config.example.yml
index 58e2d45..8168b29 100644
--- a/activerecord/test/config.example.yml
+++ b/activerecord/test/config.example.yml
@@ -53,6 +53,7 @@ connections:

   mysql2:
     arunit:
+      strict: :default
       username: rails
       encoding: utf8
       collation: utf8_unicode_ci

Result:

% rake test_mysql2 --verbose
/Users/kamipo/.rbenv/versions/2.2.3/bin/ruby -w -I"lib:test" -I"/Users/kamipo/.rbenv/versions/2.2.3/lib/ruby/2.2.0" "/Users/kamipo/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rake/rake_test_loader.rb" "test/cases/adapter_test.rb" "test/cases/aggregations_test.rb" "test/cases/ar_schema_test.rb" "test/cases/associations/association_scope_test.rb" "test/cases/associations/belongs_to_associations_test.rb" "test/cases/associations/bidirectional_destroy_dependencies_test.rb" "test/cases/associations/callbacks_test.rb" "test/cases/associations/cascaded_eager_loading_test.rb" "test/cases/associations/eager_load_includes_full_sti_class_test.rb" "test/cases/associations/eager_load_nested_include_test.rb" "test/cases/associations/eager_singularization_test.rb" "test/cases/associations/eager_test.rb" "test/cases/associations/extension_test.rb" "test/cases/associations/has_and_belongs_to_many_associations_test.rb" "test/cases/associations/has_many_associations_test.rb" "test/cases/associations/has_many_through_associations_test.rb" "test/cases/associations/has_one_associations_test.rb" "test/cases/associations/has_one_through_associations_test.rb" "test/cases/associations/inner_join_association_test.rb" "test/cases/associations/inverse_associations_test.rb" "test/cases/associations/join_model_test.rb" "test/cases/associations/left_outer_join_association_test.rb" "test/cases/associations/nested_through_associations_test.rb" "test/cases/associations/required_test.rb" "test/cases/associations_test.rb" "test/cases/attribute_decorators_test.rb" "test/cases/attribute_methods/read_test.rb" "test/cases/attribute_methods_test.rb" "test/cases/attribute_set_test.rb" "test/cases/attribute_test.rb" "test/cases/attributes_test.rb" "test/cases/autosave_association_test.rb" "test/cases/base_test.rb" "test/cases/batches_test.rb" "test/cases/binary_test.rb" "test/cases/bind_parameter_test.rb" "test/cases/cache_key_test.rb" "test/cases/calculations_test.rb" "test/cases/callbacks_test.rb" "test/cases/clone_test.rb" "test/cases/coders/yaml_column_test.rb" "test/cases/collection_cache_key_test.rb" "test/cases/column_alias_test.rb" "test/cases/column_definition_test.rb" "test/cases/connection_adapters/adapter_leasing_test.rb" "test/cases/connection_adapters/connection_handler_test.rb" "test/cases/connection_adapters/connection_specification_test.rb" "test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb" "test/cases/connection_adapters/mysql_type_lookup_test.rb" "test/cases/connection_adapters/quoting_test.rb" "test/cases/connection_adapters/schema_cache_test.rb" "test/cases/connection_adapters/type_lookup_test.rb" "test/cases/connection_management_test.rb" "test/cases/connection_pool_test.rb" "test/cases/connection_specification/resolver_test.rb" "test/cases/core_test.rb" "test/cases/counter_cache_test.rb" "test/cases/custom_locking_test.rb" "test/cases/database_statements_test.rb" "test/cases/date_time_precision_test.rb" "test/cases/date_time_test.rb" "test/cases/defaults_test.rb" "test/cases/dirty_test.rb" "test/cases/disconnected_test.rb" "test/cases/dup_test.rb" "test/cases/enum_test.rb" "test/cases/errors_test.rb" "test/cases/explain_subscriber_test.rb" "test/cases/explain_test.rb" "test/cases/finder_respond_to_test.rb" "test/cases/finder_test.rb" "test/cases/fixture_set/file_test.rb" "test/cases/fixtures_test.rb" "test/cases/forbidden_attributes_protection_test.rb" "test/cases/habtm_destroy_order_test.rb" "test/cases/hot_compatibility_test.rb" "test/cases/i18n_test.rb" "test/cases/inheritance_test.rb" "test/cases/integration_test.rb" "test/cases/invalid_connection_test.rb" "test/cases/invalid_date_test.rb" "test/cases/invertible_migration_test.rb" "test/cases/json_serialization_test.rb" "test/cases/locking_test.rb" "test/cases/log_subscriber_test.rb" "test/cases/migration/change_schema_test.rb" "test/cases/migration/change_table_test.rb" "test/cases/migration/column_attributes_test.rb" "test/cases/migration/column_positioning_test.rb" "test/cases/migration/columns_test.rb" "test/cases/migration/command_recorder_test.rb" "test/cases/migration/create_join_table_test.rb" "test/cases/migration/foreign_key_test.rb" "test/cases/migration/index_test.rb" "test/cases/migration/logger_test.rb" "test/cases/migration/pending_migrations_test.rb" "test/cases/migration/references_foreign_key_test.rb" "test/cases/migration/references_index_test.rb" "test/cases/migration/references_statements_test.rb" "test/cases/migration/rename_table_test.rb" "test/cases/migration/table_and_index_test.rb" "test/cases/migration_test.rb" "test/cases/migrator_test.rb" "test/cases/mixin_test.rb" "test/cases/modules_test.rb" "test/cases/multiparameter_attributes_test.rb" "test/cases/multiple_db_test.rb" "test/cases/nested_attributes_test.rb" "test/cases/nested_attributes_with_callbacks_test.rb" "test/cases/persistence_test.rb" "test/cases/pooled_connections_test.rb" "test/cases/primary_keys_test.rb" "test/cases/query_cache_test.rb" "test/cases/quoting_test.rb" "test/cases/readonly_test.rb" "test/cases/reaper_test.rb" "test/cases/reflection_test.rb" "test/cases/relation/delegation_test.rb" "test/cases/relation/merging_test.rb" "test/cases/relation/mutation_test.rb" "test/cases/relation/or_test.rb" "test/cases/relation/predicate_builder_test.rb" "test/cases/relation/record_fetch_warning_test.rb" "test/cases/relation/where_chain_test.rb" "test/cases/relation/where_clause_test.rb" "test/cases/relation/where_test.rb" "test/cases/relation_test.rb" "test/cases/relations_test.rb" "test/cases/reload_models_test.rb" "test/cases/result_test.rb" "test/cases/sanitize_test.rb" "test/cases/schema_dumper_test.rb" "test/cases/scoping/default_scoping_test.rb" "test/cases/scoping/named_scoping_test.rb" "test/cases/scoping/relation_scoping_test.rb" "test/cases/secure_token_test.rb" "test/cases/serialization_test.rb" "test/cases/serialized_attribute_test.rb" "test/cases/statement_cache_test.rb" "test/cases/store_test.rb" "test/cases/suppressor_test.rb" "test/cases/tasks/database_tasks_test.rb" "test/cases/tasks/mysql_rake_test.rb" "test/cases/tasks/postgresql_rake_test.rb" "test/cases/tasks/sqlite_rake_test.rb" "test/cases/test_fixtures_test.rb" "test/cases/time_precision_test.rb" "test/cases/timestamp_test.rb" "test/cases/touch_later_test.rb" "test/cases/transaction_callbacks_test.rb" "test/cases/transaction_isolation_test.rb" "test/cases/transactions_test.rb" "test/cases/type/adapter_specific_registry_test.rb" "test/cases/type/date_time_test.rb" "test/cases/type/integer_test.rb" "test/cases/type/string_test.rb" "test/cases/type/type_map_test.rb" "test/cases/type_test.rb" "test/cases/types_test.rb" "test/cases/unconnected_test.rb" "test/cases/validations/absence_validation_test.rb" "test/cases/validations/association_validation_test.rb" "test/cases/validations/i18n_generate_message_validation_test.rb" "test/cases/validations/i18n_validation_test.rb" "test/cases/validations/length_validation_test.rb" "test/cases/validations/presence_validation_test.rb" "test/cases/validations/uniqueness_validation_test.rb" "test/cases/validations_test.rb" "test/cases/view_test.rb" "test/cases/yaml_serialization_test.rb" "test/cases/adapters/mysql2/active_schema_test.rb" "test/cases/adapters/mysql2/bind_parameter_test.rb" "test/cases/adapters/mysql2/boolean_test.rb" "test/cases/adapters/mysql2/case_sensitivity_test.rb" "test/cases/adapters/mysql2/charset_collation_test.rb" "test/cases/adapters/mysql2/connection_test.rb" "test/cases/adapters/mysql2/enum_test.rb" "test/cases/adapters/mysql2/explain_test.rb" "test/cases/adapters/mysql2/json_test.rb" "test/cases/adapters/mysql2/quoting_test.rb" "test/cases/adapters/mysql2/reserved_word_test.rb" "test/cases/adapters/mysql2/schema_migrations_test.rb" "test/cases/adapters/mysql2/schema_test.rb" "test/cases/adapters/mysql2/sp_test.rb" "test/cases/adapters/mysql2/sql_types_test.rb" "test/cases/adapters/mysql2/table_options_test.rb" "test/cases/adapters/mysql2/unsigned_type_test.rb" 
Using mysql2
Run options: --seed 1014

# Running:

....................................................................................................................................................................................E...............................................E........E.................................E..............E.............E..............................................E..............E..........................................................................................E...................E................................................................................................................................................................................................................................................................................E..................................................................................................................................................................................................................................................................E..............................E..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................E...............................................................................E................................................................................................................................................................................................................................................................................................................................................S.....................................S..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S.............................................................................................................................................................................................................E..........................................E............E...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F................................................................

Finished in 132.519118s, 35.6401 runs/s, 99.2008 assertions/s.

  1) Error:
CascadedEagerLoadingTest#test_eager_association_loading_with_multiple_stis_and_order:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.authors.name' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `authors`.`id` FROM `authors` LEFT OUTER JOIN `posts` ON `posts`.`author_id` = `authors`.`id` LEFT OUTER JOIN `comments` ON `comments`.`post_id` = `posts`.`id` AND `comments`.`type` IN ('SpecialComment', 'SubSpecialComment') LEFT OUTER JOIN `comments` `very_special_comments_posts` ON `very_special_comments_posts`.`post_id` = `posts`.`id` AND `very_special_comments_posts`.`type` IN ('VerySpecialComment') WHERE (posts.id = 4) ORDER BY authors.name, comments.body, very_special_comments_posts.body LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:495:in `find_nth_with_limit'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:479:in `find_nth'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:122:in `first'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/cascaded_eager_loading_test.rb:143:in `test_eager_association_loading_with_multiple_stis_and_order'


  2) Error:
EagerAssociationTest#test_limited_eager_with_multiple_order_columns:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.posts.title' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `posts`.`id` FROM `posts` LEFT OUTER JOIN `authors` ON `authors`.`id` = `posts`.`author_id` LEFT OUTER JOIN `comments` ON `comments`.`post_id` = `posts`.`id` WHERE `authors`.`name` = 'David' ORDER BY UPPER(posts.title), posts.id LIMIT 2 OFFSET 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/eager_test.rb:838:in `test_limited_eager_with_multiple_order_columns'


  3) Error:
EagerAssociationTest#test_include_has_many_using_primary_key:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.clients_using_primary_keys_companies.name' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `companies`.`id` FROM `companies` LEFT OUTER JOIN `companies` `clients_using_primary_keys_companies` ON `clients_using_primary_keys_companies`.`firm_name` = `companies`.`name` AND `clients_using_primary_keys_companies`.`type` IN ('Client', 'SpecialClient', 'VerySpecialClient') WHERE `companies`.`type` IN ('Firm') AND `companies`.`id` = 1 ORDER BY clients_using_primary_keys_companies.name LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:470:in `find_take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:100:in `take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:437:in `find_one'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:418:in `find_with_ids'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:66:in `find'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/eager_test.rb:1132:in `test_include_has_many_using_primary_key'


  4) Error:
EagerAssociationTest#test_limited_eager_with_order:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.posts.title' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `posts`.`id` FROM `posts` LEFT OUTER JOIN `authors` ON `authors`.`id` = `posts`.`author_id` LEFT OUTER JOIN `comments` ON `comments`.`post_id` = `posts`.`id` WHERE `authors`.`name` = 'David' ORDER BY UPPER(posts.title) LIMIT 2 OFFSET 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/eager_test.rb:821:in `test_limited_eager_with_order'


  5) Error:
EagerAssociationTest#test_works_in_combination_with_order(:symbol)_and_reorder(:symbol):
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.authors.name' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `authors`.`id` FROM `authors` LEFT OUTER JOIN `posts` ON `posts`.`author_id` = `authors`.`id` WHERE (posts.title IS NOT NULL) ORDER BY `authors`.`name` ASC LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:470:in `find_take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:100:in `take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:78:in `find_by'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/eager_test.rb:1283:in `block in <class:EagerAssociationTest>'


  6) Error:
EagerAssociationTest#test_order_on_join_table_with_include_and_limit:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.developers_projects.joined_on' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `developers`.`id` FROM `developers` LEFT OUTER JOIN `developers_projects` ON `developers_projects`.`developer_id` = `developers`.`id` LEFT OUTER JOIN `projects` ON `projects`.`id` = `developers_projects`.`project_id` ORDER BY developers_projects.joined_on DESC LIMIT 5
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/eager_test.rb:1025:in `test_order_on_join_table_with_include_and_limit'


  7) Error:
EagerAssociationTest#test_nested_loading_through_has_one_association_with_order_on_nested_association:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.posts.id' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `author_addresses`.`id` FROM `author_addresses` LEFT OUTER JOIN `authors` ON `authors`.`author_address_id` = `author_addresses`.`id` LEFT OUTER JOIN `posts` ON `posts`.`author_id` = `authors`.`id` WHERE `author_addresses`.`id` = 1 ORDER BY posts.id LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:470:in `find_take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:100:in `take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:437:in `find_one'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:418:in `find_with_ids'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:66:in `find'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/eager_test.rb:311:in `test_nested_loading_through_has_one_association_with_order_on_nested_association'


  8) Error:
EagerAssociationTest#test_nested_loading_through_has_one_association_with_order_on_association:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.authors.id' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `author_addresses`.`id` FROM `author_addresses` LEFT OUTER JOIN `authors` ON `authors`.`author_address_id` = `author_addresses`.`id` LEFT OUTER JOIN `posts` ON `posts`.`author_id` = `authors`.`id` WHERE `author_addresses`.`id` = 1 ORDER BY authors.id LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:470:in `find_take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:100:in `take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:437:in `find_one'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:418:in `find_with_ids'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:66:in `find'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/eager_test.rb:306:in `test_nested_loading_through_has_one_association_with_order_on_association'


  9) Error:
HasAndBelongsToManyAssociationsTest#test_dynamic_find_should_respect_association_include:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.authors.id' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `posts`.`id` FROM `posts` LEFT OUTER JOIN `categorizations` ON `categorizations`.`category_id` = `posts`.`id` LEFT OUTER JOIN `authors` ON `authors`.`id` = `categorizations`.`author_id` INNER JOIN `categories_posts` ON `posts`.`id` = `categories_posts`.`post_id` WHERE `categories_posts`.`category_id` = 1 AND `posts`.`title` = 'Welcome to the weblog' ORDER BY authors.id LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/association_relation.rb:32:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:470:in `find_take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:100:in `take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:78:in `find_by'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/querying.rb:7:in `find_by'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/core.rb:175:in `find_by'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/dynamic_matchers.rb:65:in `find_by_title'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/dynamic_matchers.rb:19:in `method_missing'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:88:in `public_send'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:88:in `block in method_missing'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/associations/collection_proxy.rb:897:in `block in scoping'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:343:in `scoping'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/associations/collection_proxy.rb:897:in `scoping'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:88:in `method_missing'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb:799:in `test_dynamic_find_should_respect_association_include'


 10) Error:
HasManyAssociationsTestForReorderWithJoinDependency#test_should_generate_valid_sql:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.posts.comments_count' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `posts`.`id` FROM `posts` LEFT OUTER JOIN `comments` ON `comments`.`post_id` = `posts`.`id` WHERE `posts`.`author_id` = 1 AND (comments.id > 0) ORDER BY posts.comments_count ASC, posts.tags_count ASC LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/association_relation.rb:32:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:506:in `find_last'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:155:in `last'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/has_many_associations_test.rb:49:in `test_should_generate_valid_sql'


 11) Error:
HasManyThroughAssociationsTest#test_dynamic_find_should_respect_association_include:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.comments.id' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `posts`.`id` FROM `posts` LEFT OUTER JOIN `comments` ON `comments`.`post_id` = `posts`.`id` INNER JOIN `readers` ON `posts`.`id` = `readers`.`post_id` WHERE `readers`.`person_id` = 1 AND `posts`.`title` = 'Welcome to the weblog' ORDER BY comments.id LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/association_relation.rb:32:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:470:in `find_take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:100:in `take'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:78:in `find_by'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/querying.rb:7:in `find_by'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/core.rb:175:in `find_by'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/dynamic_matchers.rb:65:in `find_by_title'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:64:in `block in find_by_title'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/associations/collection_proxy.rb:897:in `block in scoping'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:343:in `scoping'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/associations/collection_proxy.rb:897:in `scoping'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:64:in `find_by_title'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb:730:in `test_dynamic_find_should_respect_association_include'


 12) Error:
InverseHasManyTests#test_parent_instance_should_be_shared_with_eager_loaded_children:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.interests.id' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `men`.`id` FROM `men` LEFT OUTER JOIN `interests` ON `interests`.`man_id` = `men`.`id` WHERE `men`.`name` = 'Gordon' ORDER BY interests.id LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:495:in `find_nth_with_limit'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:479:in `find_nth'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:122:in `first'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/inverse_associations_test.rb:324:in `test_parent_instance_should_be_shared_with_eager_loaded_children'


 13) Error:
AssociationsJoinModelTest#test_eager_load_has_many_through_has_many:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.comments.id' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `authors`.`id` FROM `authors` LEFT OUTER JOIN `posts` ON `posts`.`author_id` = `authors`.`id` LEFT OUTER JOIN `comments` ON `comments`.`post_id` = `posts`.`id` WHERE (name = 'David') ORDER BY comments.id LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:495:in `find_nth_with_limit'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:479:in `find_nth'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:122:in `first'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/associations/join_model_test.rb:414:in `test_eager_load_has_many_through_has_many'


 14) Error:
FinderTest#test_find_with_order_on_included_associations_with_construct_finder_sql_for_association_limiting_and_is_distinct:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.author_addresses.id' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `posts`.`id` FROM `posts` LEFT OUTER JOIN `categorizations` ON `categorizations`.`category_id` = `posts`.`id` LEFT OUTER JOIN `authors` ON `authors`.`id` = `categorizations`.`author_id` LEFT OUTER JOIN `author_addresses` ON `author_addresses`.`id` = `authors`.`author_address_id` ORDER BY author_addresses.id DESC  LIMIT 2
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/finder_test.rb:923:in `test_find_with_order_on_included_associations_with_construct_finder_sql_for_association_limiting_and_is_distinct'


 15) Error:
FinderTest#test_exists_with_distinct_association_includes_limit_and_order:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.comments.tags_count' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `posts`.`id` FROM `posts` LEFT OUTER JOIN `comments` ON `comments`.`post_id` = `posts`.`id` AND `comments`.`type` IN ('SpecialComment', 'SubSpecialComment') INNER JOIN `categorizations` ON `posts`.`id` = `categorizations`.`post_id` WHERE `categorizations`.`author_id` = 1 ORDER BY comments.tags_count DESC LIMIT 0
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:283:in `exists?'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/finder_test.rb:156:in `test_exists_with_distinct_association_includes_limit_and_order'


 16) Error:
RelationTest#test_finding_with_complex_order_and_limit:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.taggings.taggable_type' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `tags`.`id` FROM `tags` LEFT OUTER JOIN `taggings` ON `taggings`.`tag_id` = `tags`.`id` ORDER BY REPLACE('abc', taggings.taggable_type, taggings.taggable_type) LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/record_fetch_warning.rb:17:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:292:in `test_finding_with_complex_order_and_limit'


 17) Error:
RelationTest#test_update_all_with_joins_and_offset_and_order:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.posts.id' which is not in SELECT list; this is incompatible with DISTINCT: UPDATE `comments` SET `comments`.`post_id` = 2 WHERE `comments`.`id` IN (SELECT id FROM (SELECT DISTINCT `comments`.`id` FROM `comments` INNER JOIN `posts` ON `posts`.`id` = `comments`.`post_id` WHERE `posts`.`id` = 1 ORDER BY posts.id, comments.id LIMIT 18446744073709551615 OFFSET 1) __active_record_temp)
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:163:in `exec_delete'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:125:in `update'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `update'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:384:in `update_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:1538:in `test_update_all_with_joins_and_offset_and_order'


 18) Error:
RelationTest#test_finding_with_cross_table_order_and_limit:
ActiveRecord::StatementInvalid: Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'activerecord_unittest.tags.name' which is not in SELECT list; this is incompatible with DISTINCT: SELECT  DISTINCT `tags`.`id` FROM `tags` LEFT OUTER JOIN `taggings` ON `taggings`.`tag_id` = `tags`.`id` ORDER BY tags.name asc, taggings.taggable_id asc, REPLACE('abc', taggings.taggable_type, taggings.taggable_type) LIMIT 1
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `_query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:107:in `block in query'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `handle_interrupt'
    /Users/kamipo/src/github.com/rails/rails/vendor/bundle/ruby/2.2.0/gems/mysql2-0.4.2/lib/mysql2/client.rb:106:in `query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `block in execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:535:in `block in log'
    /Users/kamipo/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:529:in `log'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:400:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:141:in `execute'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:145:in `exec_query'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in `select_all'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:396:in `limited_ids_for'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:382:in `apply_join_dependency'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:342:in `find_with_associations'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:691:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation/record_fetch_warning.rb:17:in `exec_queries'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:572:in `load'
    /Users/kamipo/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:252:in `to_a'
    /Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:287:in `test_finding_with_cross_table_order_and_limit'


 19) Failure:
Mysql2ConnectionTest#test_mysql_default_in_strict_mode [/Users/kamipo/src/github.com/rails/rails/activerecord/test/cases/adapters/mysql2/connection_test.rb:76]:
--- expected
+++ actual
@@ -1 +1 @@
-[["STRICT_ALL_TABLES"]]
+[["ONLY_FULL_GROUP_BY,NO_AUTO_VALUE_ON_ZERO,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"]]


4723 runs, 13146 assertions, 1 failures, 18 errors, 4 skips

You have skipped tests. Run with --verbose for details.
rake aborted!
Command failed with status (1): [ruby -w -I"lib:test" -I"/Users/kamipo/.rbenv/versions/2.2.3/lib/ruby/2.2.0" "/Users/kamipo/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rake/rake_test_loader.rb" "test/cases/adapter_test.rb" "test/cases/aggregations_test.rb" "test/cases/ar_schema_test.rb" "test/cases/associations/association_scope_test.rb" "test/cases/associations/belongs_to_associations_test.rb" "test/cases/associations/bidirectional_destroy_dependencies_test.rb" "test/cases/associations/callbacks_test.rb" "test/cases/associations/cascaded_eager_loading_test.rb" "test/cases/associations/eager_load_includes_full_sti_class_test.rb" "test/cases/associations/eager_load_nested_include_test.rb" "test/cases/associations/eager_singularization_test.rb" "test/cases/associations/eager_test.rb" "test/cases/associations/extension_test.rb" "test/cases/associations/has_and_belongs_to_many_associations_test.rb" "test/cases/associations/has_many_associations_test.rb" "test/cases/associations/has_many_through_associations_test.rb" "test/cases/associations/has_one_associations_test.rb" "test/cases/associations/has_one_through_associations_test.rb" "test/cases/associations/inner_join_association_test.rb" "test/cases/associations/inverse_associations_test.rb" "test/cases/associations/join_model_test.rb" "test/cases/associations/left_outer_join_association_test.rb" "test/cases/associations/nested_through_associations_test.rb" "test/cases/associations/required_test.rb" "test/cases/associations_test.rb" "test/cases/attribute_decorators_test.rb" "test/cases/attribute_methods/read_test.rb" "test/cases/attribute_methods_test.rb" "test/cases/attribute_set_test.rb" "test/cases/attribute_test.rb" "test/cases/attributes_test.rb" "test/cases/autosave_association_test.rb" "test/cases/base_test.rb" "test/cases/batches_test.rb" "test/cases/binary_test.rb" "test/cases/bind_parameter_test.rb" "test/cases/cache_key_test.rb" "test/cases/calculations_test.rb" "test/cases/callbacks_test.rb" "test/cases/clone_test.rb" "test/cases/coders/yaml_column_test.rb" "test/cases/collection_cache_key_test.rb" "test/cases/column_alias_test.rb" "test/cases/column_definition_test.rb" "test/cases/connection_adapters/adapter_leasing_test.rb" "test/cases/connection_adapters/connection_handler_test.rb" "test/cases/connection_adapters/connection_specification_test.rb" "test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb" "test/cases/connection_adapters/mysql_type_lookup_test.rb" "test/cases/connection_adapters/quoting_test.rb" "test/cases/connection_adapters/schema_cache_test.rb" "test/cases/connection_adapters/type_lookup_test.rb" "test/cases/connection_management_test.rb" "test/cases/connection_pool_test.rb" "test/cases/connection_specification/resolver_test.rb" "test/cases/core_test.rb" "test/cases/counter_cache_test.rb" "test/cases/custom_locking_test.rb" "test/cases/database_statements_test.rb" "test/cases/date_time_precision_test.rb" "test/cases/date_time_test.rb" "test/cases/defaults_test.rb" "test/cases/dirty_test.rb" "test/cases/disconnected_test.rb" "test/cases/dup_test.rb" "test/cases/enum_test.rb" "test/cases/errors_test.rb" "test/cases/explain_subscriber_test.rb" "test/cases/explain_test.rb" "test/cases/finder_respond_to_test.rb" "test/cases/finder_test.rb" "test/cases/fixture_set/file_test.rb" "test/cases/fixtures_test.rb" "test/cases/forbidden_attributes_protection_test.rb" "test/cases/habtm_destroy_order_test.rb" "test/cases/hot_compatibility_test.rb" "test/cases/i18n_test.rb" "test/cases/inheritance_test.rb" "test/cases/integration_test.rb" "test/cases/invalid_connection_test.rb" "test/cases/invalid_date_test.rb" "test/cases/invertible_migration_test.rb" "test/cases/json_serialization_test.rb" "test/cases/locking_test.rb" "test/cases/log_subscriber_test.rb" "test/cases/migration/change_schema_test.rb" "test/cases/migration/change_table_test.rb" "test/cases/migration/column_attributes_test.rb" "test/cases/migration/column_positioning_test.rb" "test/cases/migration/columns_test.rb" "test/cases/migration/command_recorder_test.rb" "test/cases/migration/create_join_table_test.rb" "test/cases/migration/foreign_key_test.rb" "test/cases/migration/index_test.rb" "test/cases/migration/logger_test.rb" "test/cases/migration/pending_migrations_test.rb" "test/cases/migration/references_foreign_key_test.rb" "test/cases/migration/references_index_test.rb" "test/cases/migration/references_statements_test.rb" "test/cases/migration/rename_table_test.rb" "test/cases/migration/table_and_index_test.rb" "test/cases/migration_test.rb" "test/cases/migrator_test.rb" "test/cases/mixin_test.rb" "test/cases/modules_test.rb" "test/cases/multiparameter_attributes_test.rb" "test/cases/multiple_db_test.rb" "test/cases/nested_attributes_test.rb" "test/cases/nested_attributes_with_callbacks_test.rb" "test/cases/persistence_test.rb" "test/cases/pooled_connections_test.rb" "test/cases/primary_keys_test.rb" "test/cases/query_cache_test.rb" "test/cases/quoting_test.rb" "test/cases/readonly_test.rb" "test/cases/reaper_test.rb" "test/cases/reflection_test.rb" "test/cases/relation/delegation_test.rb" "test/cases/relation/merging_test.rb" "test/cases/relation/mutation_test.rb" "test/cases/relation/or_test.rb" "test/cases/relation/predicate_builder_test.rb" "test/cases/relation/record_fetch_warning_test.rb" "test/cases/relation/where_chain_test.rb" "test/cases/relation/where_clause_test.rb" "test/cases/relation/where_test.rb" "test/cases/relation_test.rb" "test/cases/relations_test.rb" "test/cases/reload_models_test.rb" "test/cases/result_test.rb" "test/cases/sanitize_test.rb" "test/cases/schema_dumper_test.rb" "test/cases/scoping/default_scoping_test.rb" "test/cases/scoping/named_scoping_test.rb" "test/cases/scoping/relation_scoping_test.rb" "test/cases/secure_token_test.rb" "test/cases/serialization_test.rb" "test/cases/serialized_attribute_test.rb" "test/cases/statement_cache_test.rb" "test/cases/store_test.rb" "test/cases/suppressor_test.rb" "test/cases/tasks/database_tasks_test.rb" "test/cases/tasks/mysql_rake_test.rb" "test/cases/tasks/postgresql_rake_test.rb" "test/cases/tasks/sqlite_rake_test.rb" "test/cases/test_fixtures_test.rb" "test/cases/time_precision_test.rb" "test/cases/timestamp_test.rb" "test/cases/touch_later_test.rb" "test/cases/transaction_callbacks_test.rb" "test/cases/transaction_isolation_test.rb" "test/cases/transactions_test.rb" "test/cases/type/adapter_specific_registry_test.rb" "test/cases/type/date_time_test.rb" "test/cases/type/integer_test.rb" "test/cases/type/string_test.rb" "test/cases/type/type_map_test.rb" "test/cases/type_test.rb" "test/cases/types_test.rb" "test/cases/unconnected_test.rb" "test/cases/validations/absence_validation_test.rb" "test/cases/validations/association_validation_test.rb" "test/cases/validations/i18n_generate_message_validation_test.rb" "test/cases/validations/i18n_validation_test.rb" "test/cases/validations/length_validation_test.rb" "test/cases/validations/presence_validation_test.rb" "test/cases/validations/uniqueness_validation_test.rb" "test/cases/validations_test.rb" "test/cases/view_test.rb" "test/cases/yaml_serialization_test.rb" "test/cases/adapters/mysql2/active_schema_test.rb" "test/cases/adapters/mysql2/bind_parameter_test.rb" "test/cases/adapters/mysql2/boolean_test.rb" "test/cases/adapters/mysql2/case_sensitivity_test.rb" "test/cases/adapters/mysql2/charset_collation_test.rb" "test/cases/adapters/mysql2/connection_test.rb" "test/cases/adapters/mysql2/enum_test.rb" "test/cases/adapters/mysql2/explain_test.rb" "test/cases/adapters/mysql2/json_test.rb" "test/cases/adapters/mysql2/quoting_test.rb" "test/cases/adapters/mysql2/reserved_word_test.rb" "test/cases/adapters/mysql2/schema_migrations_test.rb" "test/cases/adapters/mysql2/schema_test.rb" "test/cases/adapters/mysql2/sp_test.rb" "test/cases/adapters/mysql2/sql_types_test.rb" "test/cases/adapters/mysql2/table_options_test.rb" "test/cases/adapters/mysql2/unsigned_type_test.rb" ]

Tasks: TOP => test_mysql2 => test:mysql2
(See full trace by running task with --trace)
@kamipo
Member
kamipo commented Dec 21, 2015

@rafaelfranca What do you think about this issue?

kamipo added some commits Nov 11, 2015
@kamipo kamipo Add `columns_for_distinct` for MySQL 5.7 with ONLY_FULL_GROUP_BY
In MySQL 5.7.5 and up, ONLY_FULL_GROUP_BY affects handling of queries
that use DISTINCT and ORDER BY. It requires the ORDER BY columns in the
select list for distinct queries, and requires that the ORDER BY include
the distinct column.

See https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html
d0be40c
@kamipo kamipo Avoid `distinct` if a subquery has already materialized
Follow up to #19359 and avoid #22241.
9c5732d
@kamipo
Member
kamipo commented Dec 30, 2015
@rails-bot rails-bot assigned rafaelfranca and unassigned senny Dec 30, 2015
@rafaelfranca
Member

Awesome work!

@rafaelfranca rafaelfranca merged commit 3affdc1 into rails:master Dec 30, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@rafaelfranca
Member

Could you open a backport PR to 4-2-stable? The patch doesn't apply clearly.

@kamipo kamipo deleted the kamipo:add_columns_for_distinct_for_mysql57 branch Dec 31, 2015
@kamipo kamipo added a commit to kamipo/rails that referenced this pull request Dec 31, 2015
@kamipo kamipo Avoid `distinct` if a subquery has already materialized
Follow up to #19359 and avoid #22241.
5e90170
@sealocal sealocal added a commit to sealocal/rails that referenced this pull request Mar 14, 2016
@kamipo @sealocal kamipo + sealocal Avoid `distinct` if a subquery has already materialized
Follow up to #19359 and avoid #22241.
23a47d2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment