Skip to content
This repository
Browse code

Merge pull request #37 from shiroginne/master

Wrong UPDATE sql query for postgresql db
  • Loading branch information...
commit dcef79a2548f597baab2d18e6abb1aef661ed801 2 parents 3436dd0 + 9108e04
Erik Michaels-Ober authored February 25, 2013

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  lib/delayed/backend/active_record.rb
2  lib/delayed/backend/active_record.rb
@@ -58,7 +58,7 @@ def self.reserve(worker, max_run_time = Worker.max_run_time)
58 58
             # This locks the single record 'FOR UPDATE' in the subquery (http://www.postgresql.org/docs/9.0/static/sql-select.html#SQL-FOR-UPDATE-SHARE)
59 59
             # Note: active_record would attempt to generate UPDATE...LIMIT like sql for postgres if we use a .limit() filter, but it would not use
60 60
             # 'FOR UPDATE' and we would have many locking conflicts
61  
-            quotedTableName = ::ActiveRecord::Base.connection.quote_column_name(self.table_name)
  61
+            quotedTableName = ::ActiveRecord::Base.connection.quote_table_name(self.table_name)
62 62
             subquerySql = nextScope.lock(true).select('id').to_sql
63 63
             reserved = self.find_by_sql(["UPDATE #{quotedTableName} SET locked_at = ?, locked_by = ? WHERE id IN (#{subquerySql}) RETURNING *",now,worker.name])
64 64
             return reserved[0]

0 notes on commit dcef79a

Please sign in to comment.
Something went wrong with that request. Please try again.