aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorKir Shatrov <shatrov@me.com>2019-07-18 23:21:20 +0100
committerKir Shatrov <shatrov@me.com>2019-07-19 11:52:39 +0100
commit77931f4f52e0b95f288997caa531355afe2fc0e9 (patch)
treea7b20f85110b6790db2cd4f5d3e508b4357345a5 /activerecord/test
parent67705c8bbfa6f6d0e3be1208741a947143111786 (diff)
downloadrails-77931f4f52e0b95f288997caa531355afe2fc0e9.tar.gz
rails-77931f4f52e0b95f288997caa531355afe2fc0e9.tar.bz2
rails-77931f4f52e0b95f288997caa531355afe2fc0e9.zip
[ActiveRecord] Deduplicate optimizer hints
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/relation_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb
index e0743de94b..e74fb1a098 100644
--- a/activerecord/test/cases/relation_test.rb
+++ b/activerecord/test/cases/relation_test.rb
@@ -363,6 +363,13 @@ module ActiveRecord
assert_match %r{/\*\+ BADHINT \*/}, post_with_hint.to_sql
end
+ def test_does_not_duplicate_optimizer_hints_on_merge
+ escaped_table = Post.connection.quote_table_name("posts")
+ expected = "SELECT /*+ OMGHINT */ #{escaped_table}.* FROM #{escaped_table}"
+ query = Post.optimizer_hints("OMGHINT").merge(Post.optimizer_hints("OMGHINT")).to_sql
+ assert_equal expected, query
+ end
+
class EnsureRoundTripTypeCasting < ActiveRecord::Type::Value
def type
:string