Skip to content

Conversation

aidanharan
Copy link
Contributor

Fix ActiveRecord::RelationTest#test_0011_runs queries when using pick with aggregate expression despite empty IN. Test added by rails/rails#53775

https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/actions/runs/13261486046/job/37018909018

 2) Error:
ActiveRecord::RelationTest#test_0011_runs queries when using pick with aggregate expression despite empty IN:
ActiveRecord::StatementInvalid: TinyTds::Error: Column "posts.id" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.
    lib/active_record/connection_adapters/sqlserver/database_statements.rb:446:in `each'
    lib/active_record/connection_adapters/sqlserver/database_statements.rb:446:in `handle_to_names_and_values'
    lib/active_record/connection_adapters/sqlserver/database_statements.rb:67:in `internal_exec_sql_query'
    lib/active_record/connection_adapters/sqlserver/database_statements.rb:25:in `perform_query'

@aidanharan aidanharan changed the title Coerce test Coerce relation test Feb 12, 2025
@aidanharan aidanharan marked this pull request as ready for review February 12, 2025 12:22
@aidanharan aidanharan merged commit 6f89d22 into main Feb 12, 2025
2 of 5 checks passed
@aidanharan aidanharan deleted the coerce-relation-test-aggregate-pick branch February 12, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant