This project is archived and is in readonly mode.

#3237 ✓resolved
Eugene Pimenov

PostgreSQL escape methods aren't thread-safe (in Ruby 1.8)

Reported by Eugene Pimenov | September 20th, 2009 @ 11:39 AM | in 3.0.2

PostgreSQL adapter has code like that

def query_string(s)
  self.class.instance_eval do
    define_method(:query_string) do |s|

In ruby 1.8 it's not thread-safe because block's argument is bound to method's argument. So when you call this method in several threads it could return value you aren't expecting.

Patch renames methods' arguments original_value, so blocks' arguments are no longer bound to them.

Comments and changes to this ticket

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=""></a>


Referenced by