diff options
author | Matthew Dunbar <matthew.dunbar@lifeway.com> | 2019-02-14 23:07:01 -0500 |
---|---|---|
committer | Matthew Dunbar <matthew.dunbar@lifeway.com> | 2019-02-14 23:25:44 -0500 |
commit | 795c0f8205a23af4dc928b46d15279b57d8ef3c3 (patch) | |
tree | c8a88ef6ac5fd353823fb6e1e2262959792e807e /activerecord/test | |
parent | c43c83984792ac546e7610c898cf9099cc1a2ee6 (diff) | |
download | rails-795c0f8205a23af4dc928b46d15279b57d8ef3c3.tar.gz rails-795c0f8205a23af4dc928b46d15279b57d8ef3c3.tar.bz2 rails-795c0f8205a23af4dc928b46d15279b57d8ef3c3.zip |
Properly handle cached queries with too many bind parameters
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/bind_parameter_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb index 22a98036f3..26be22832c 100644 --- a/activerecord/test/cases/bind_parameter_test.rb +++ b/activerecord/test/cases/bind_parameter_test.rb @@ -44,6 +44,16 @@ if ActiveRecord::Base.connection.prepared_statements assert_equal 0, topics.count end + def test_too_many_binds_with_query_cache + Topic.connection.enable_query_cache! + bind_params_length = @connection.send(:bind_params_length) + topics = Topic.where(id: (1 .. bind_params_length + 1).to_a) + assert_equal Topic.count, topics.count + + topics = Topic.where.not(id: (1 .. bind_params_length + 1).to_a) + assert_equal 0, topics.count + end + def test_bind_from_join_in_subquery subquery = Author.joins(:thinking_posts).where(name: "David") scope = Author.from(subquery, "authors").where(id: 1) |