This project is archived and is in readonly mode.
Optimistic Locking and Double Quoting of Strings
Reported by Christopher Meiklejohn | March 15th, 2011 @ 02:26 AM
Follow up to: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets..., as I wasn't able to comment on that ticket (updates kept disappearing).
Reported by: Alexander Gorkunov
Content:
In: activerecord/lib/active_record/locking/optimistic.rb
line 91:
relation.table[self.class.primary_key].eq(quoted_id).and(
quoted_id is superfluous because it quoted in arel engine.
So in compiled SQL we get : '''id''' instead of 'id'
This problem has already fixed in destroy statement (see line
117)
--
Included is a patch to resolve this issue. The delete method uses ID, not quoted ID, as ARel will quote it.
Follow this same convention.
Comments and changes to this ticket
-
Christopher Meiklejohn March 16th, 2011 @ 06:09 PM
Just wondering if someone had a chance to take a look at the included patch?
-
jgpawletko May 2nd, 2011 @ 03:53 AM
I just confirmed the same bug as Christopher Meiklejohn.
(Thank you Christopher for the fix.)As of this writing the problem does not appear to be fixed in the current 3.0-stable release of rails.
https://github.com/rails/rails/blob/3-0-stable/activerecord/lib/act...
line 91.(rdb:2) pp quoted_id "'64536156-E2F3-4659-BB55-483FA43BF672'" (rdb:2) pp relation.where(relation.table[self.class.primary_key].eq(quoted_id)) [] (rdb:2) pp relation.where(relation.table[self.class.primary_key].eq('64536156-E2F3-4659-BB55-483FA43BF672')) [#]
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>