We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b43eaa9 commit 1914baaCopy full SHA for 1914baa
test/cases/offset_and_limit_test_sqlserver.rb
@@ -41,6 +41,7 @@ def setup
41
42
setup do
43
@select_sql = 'SELECT * FROM books'
44
+ @subquery_select_sql = 'SELECT *, (SELECT TOP 1 id FROM books) AS book_id FROM books'
45
@books = (1..10).map {|i| Book.create!}
46
end
47
@@ -75,6 +76,10 @@ def setup
75
76
assert_raise(ArgumentError) { @connection.add_limit_offset!(@select_sql, options) }
77
78
79
+ should 'not create invalid SQL with subquery SELECTs with TOP' do
80
+ options = { :limit => 5, :offset => 1 }
81
+ assert_nothing_raised(ActiveRecord::StatementInvalid) { @connection.add_limit_offset!(@subquery_select_sql, options) }
82
+ end
83
84
85
0 commit comments