diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-07-27 12:07:53 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-07-27 12:07:53 -0700 |
commit | c9517c1b62e7d8acd5a45f72b148942ff2f549a7 (patch) | |
tree | b8c53360331f2319979ccc7973165271e7dcdcaf /lib/arel | |
parent | 7d5ef0b0c6a37dd068f68ee1c5aca5aefe395ce7 (diff) | |
parent | 472c8c709c00a28091e723b095d8fbc23bf8a583 (diff) | |
download | rails-c9517c1b62e7d8acd5a45f72b148942ff2f549a7.tar.gz rails-c9517c1b62e7d8acd5a45f72b148942ff2f549a7.tar.bz2 rails-c9517c1b62e7d8acd5a45f72b148942ff2f549a7.zip |
Merge branch 'master' of github.com:rails/arel
* 'master' of github.com:rails/arel:
Oracle does not allow ORDER BY/LIMIT in UPDATE queries.
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/visitors/oracle.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb index 3beea287a6..375f7dbfe9 100644 --- a/lib/arel/visitors/oracle.rb +++ b/lib/arel/visitors/oracle.rb @@ -65,6 +65,18 @@ module Arel "( #{visit o.left} MINUS #{visit o.right} )" end + def visit_Arel_Nodes_UpdateStatement o + # Oracle does not allow ORDER BY/LIMIT in UPDATEs. + if o.orders.any? && o.limit.nil? + # However, there is no harm in silently eating the ORDER BY clause if no LIMIT has been provided, + # otherwise let the user deal with the error + o = o.dup + o.orders = [] + end + + super + end + ### # Hacks for the order clauses specific to Oracle def order_hacks o |