diff options
author | Yves Senn <yves.senn@gmail.com> | 2016-08-08 17:01:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-08 17:01:31 +0200 |
commit | d8fe25274684eeb5ace1b5f84987776a5ab436f7 (patch) | |
tree | 2303c519a03f872c1435e2a0f027f1f64977f285 | |
parent | 996a27ec3adeee5bcda49dcf4ceb168da981080e (diff) | |
parent | 20501d7ae24afca86f5b6de6f4914e1a6d9d1ac0 (diff) | |
download | rails-d8fe25274684eeb5ace1b5f84987776a5ab436f7.tar.gz rails-d8fe25274684eeb5ace1b5f84987776a5ab436f7.tar.bz2 rails-d8fe25274684eeb5ace1b5f84987776a5ab436f7.zip |
Merge pull request #26067 from yahonda/oracle_can_use_fetch_first
Use `FETCH FIRST` for Oracle12 and test `ROWNUM <=` for Oracle 11g or older version to test sql limit behavior
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 6 | ||||
-rw-r--r-- | activerecord/test/cases/scoping/relation_scoping_test.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 64251c5d11..bf0ce18bb8 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -562,9 +562,9 @@ class FinderTest < ActiveRecord::TestCase end def test_take_and_first_and_last_with_integer_should_use_sql_limit - assert_sql(/LIMIT|ROWNUM <=/) { Topic.take(3).entries } - assert_sql(/LIMIT|ROWNUM <=/) { Topic.first(2).entries } - assert_sql(/LIMIT|ROWNUM <=/) { Topic.last(5).entries } + assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) { Topic.take(3).entries } + assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) { Topic.first(2).entries } + assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) { Topic.last(5).entries } end def test_last_with_integer_and_order_should_keep_the_order diff --git a/activerecord/test/cases/scoping/relation_scoping_test.rb b/activerecord/test/cases/scoping/relation_scoping_test.rb index 0428e1640e..13007e2e73 100644 --- a/activerecord/test/cases/scoping/relation_scoping_test.rb +++ b/activerecord/test/cases/scoping/relation_scoping_test.rb @@ -246,7 +246,7 @@ class NestedRelationScopingTest < ActiveRecord::TestCase devs = Developer.all sql = devs.to_sql assert_match "(salary = 80000)", sql - assert_match "LIMIT 10", sql + assert_match /LIMIT 10|ROWNUM <= 10|FETCH FIRST 10 ROWS ONLY/, sql end end end |