Skip to content

Commit d8fe252

Browse files
authored
Merge pull request rails#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
2 parents 996a27e + 20501d7 commit d8fe252

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

activerecord/test/cases/finder_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,9 @@ def test_model_class_responds_to_last_bang
562562
end
563563

564564
def test_take_and_first_and_last_with_integer_should_use_sql_limit
565-
assert_sql(/LIMIT|ROWNUM <=/) { Topic.take(3).entries }
566-
assert_sql(/LIMIT|ROWNUM <=/) { Topic.first(2).entries }
567-
assert_sql(/LIMIT|ROWNUM <=/) { Topic.last(5).entries }
565+
assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) { Topic.take(3).entries }
566+
assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) { Topic.first(2).entries }
567+
assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) { Topic.last(5).entries }
568568
end
569569

570570
def test_last_with_integer_and_order_should_keep_the_order

activerecord/test/cases/scoping/relation_scoping_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def test_merge_options
246246
devs = Developer.all
247247
sql = devs.to_sql
248248
assert_match "(salary = 80000)", sql
249-
assert_match "LIMIT 10", sql
249+
assert_match /LIMIT 10|ROWNUM <= 10|FETCH FIRST 10 ROWS ONLY/, sql
250250
end
251251
end
252252
end

0 commit comments

Comments
 (0)