aboutsummaryrefslogtreecommitdiffstats
path: root/test/visitors
diff options
context:
space:
mode:
authorYasuo Honda <yasuo.honda@gmail.com>2016-05-02 13:31:06 +0000
committerYasuo Honda <yasuo.honda@gmail.com>2016-05-02 14:22:15 +0000
commitf852b608d140addcbdc7ecb85d42eef0bbd512c5 (patch)
tree3ccf4d3fdc2668b587708c26dda7390ab4bbe12d /test/visitors
parentf2ad22320d82021277ab835d4d44bef5e8b61866 (diff)
downloadrails-f852b608d140addcbdc7ecb85d42eef0bbd512c5.tar.gz
rails-f852b608d140addcbdc7ecb85d42eef0bbd512c5.tar.bz2
rails-f852b608d140addcbdc7ecb85d42eef0bbd512c5.zip
Raise ArgumentError if limit and lock are used for Oracle12 visitor
it would generates `SELECT ... FETCH FIRST n ROWS ONLY FOR UPDATE` which causes Oracle 12c database returns this error : ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
Diffstat (limited to 'test/visitors')
-rw-r--r--test/visitors/test_oracle12.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/visitors/test_oracle12.rb b/test/visitors/test_oracle12.rb
index df0f01b30b..3263007ddb 100644
--- a/test/visitors/test_oracle12.rb
+++ b/test/visitors/test_oracle12.rb
@@ -29,12 +29,13 @@ module Arel
end
describe 'locking' do
- it 'removes limit when locking' do
+ it 'generates ArgumentError if limit and lock are used' do
stmt = Nodes::SelectStatement.new
stmt.limit = Nodes::Limit.new(10)
stmt.lock = Nodes::Lock.new(Arel.sql('FOR UPDATE'))
- sql = compile(stmt)
- sql.must_be_like "SELECT FOR UPDATE"
+ assert_raises ArgumentError do
+ sql = compile(stmt)
+ end
end
it 'defaults to FOR UPDATE when locking' do