diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-07-19 23:01:44 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-19 23:01:44 +0900 |
commit | 2caddbf8ae3e094b23be16af25a8b1040892f6b0 (patch) | |
tree | 4abf04d61b02e9990c98ec171fc3de456ccc918d /activerecord/test/cases | |
parent | 2e8c78e164d14bd5590f0ba2eabb2b9cd9780de2 (diff) | |
parent | 77931f4f52e0b95f288997caa531355afe2fc0e9 (diff) | |
download | rails-2caddbf8ae3e094b23be16af25a8b1040892f6b0.tar.gz rails-2caddbf8ae3e094b23be16af25a8b1040892f6b0.tar.bz2 rails-2caddbf8ae3e094b23be16af25a8b1040892f6b0.zip |
Merge pull request #36706 from kirs/dedup-optimizer-hints
[ActiveRecord] Deduplicate optimizer hints
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relation_test.rb | 7 |
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 |