This project is archived and is in readonly mode.
Allow database specific locking clauses to be used
Reported by Jesse Storimer | February 9th, 2011 @ 04:03 PM | in 3.0.5
AR docs say that you can use a custom locking clause like so:
Product.find(1, :lock => 'LOCK IN SHARE MODE')
# select * from products where id=1 LOCK IN SHARE MODE
# https://github.com/rails/rails/blob/master/activerecord/lib/active_record/locking/pessimistic.rb#L11-12
But currently arel always uses 'FOR UPDATE' (https://github.com/rails/arel/blob/master/lib/arel/visitors/mysql.r....
This pull request for arel fixes the bug: https://github.com/rails/arel/pull/21
Wanted to make sure this makes it in for the 3.0.5 release.
Comments and changes to this ticket
-
Aaron Patterson February 22nd, 2011 @ 12:15 AM
- State changed from new to resolved
- Milestone set to 3.0.5
- Importance changed from to Low
Thanks. I've pulled this in to Arel, and the fixes should be released with arel 2.0.9. You can find the tests to ensure custom locks work here:
https://github.com/rails/rails/commit/b3fcabb3a529e8ea3d2d6326b2d99...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>