Project

General

Profile

Actions

Defect #3942

closed

Redmine + PostgreSQL 8.3: ActiveRecord::StatementInvalid in RepositoriesController#revision

Added by Luca Pireddu about 15 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
2009-09-29
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Trying to load a specific revision gives the following error:

PGError: ERROR: operator does not exist: character varying = integer
LINE 1: ...RE ("changesets".repository_id = 20 AND (revision = 33)) OR...
 ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT * FROM "changesets" WHERE ("changesets".repository_id = 20 AND (revision = 33)) ORDER BY changesets.committed_on DESC, changesets.id DESC LIMIT 1

ActiveRecord::StatementInvalid (PGError: ERROR:  operator does not exist: character varying = integer
LINE 1: ...RE ("changesets".repository_id = 20 AND (revision = 33))  OR...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT * FROM "changesets" WHERE ("changesets".repository_id = 20 AND (revision = 33))  ORDER BY changesets.committed_on DESC, changesets.id DESC LIMIT 1):
  app/models/repository.rb:97:in `find_changeset_by_name'
  app/controllers/repositories_controller.rb:133:in `revision'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
<snip>

This patch seems to fix the problem:

=== modified file 'app/models/repository.rb'
--- app/models/repository.rb    2009-09-20 15:20:22 +0000
+++ app/models/repository.rb    2009-09-29 15:43:37 +0000
@@ -94,7 +94,7 @@

   # Finds and returns a revision with a number or the beginning of a hash
   def find_changeset_by_name(name)
-    changesets.find(:first, :conditions => (name.match(/^\d*$/) ? ["revision = ?", name.to_i] : ["revision LIKE ?", name + '%']))
+    changesets.find(:first, :conditions => (name.match(/^\d*$/) ? ["revision = ?", name] : ["revision LIKE ?", name + '%']))
   end

   def latest_changeset

About
About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.4
Active Record version     2.3.4
Active Resource version   2.3.4
Action Mailer version     2.3.4
Active Support version    2.3.4
Application root          /home/pireddu/Projects/migrepo/mig_redmine
Environment               development
Database adapter          postgresql
Database schema version   20090704172358

About your Redmine plugins
Redmine Blogs plugin                0.0.6
MIG Redmine Customizations plugin   0.0.1


Related issues

Related to Redmine - Defect #5696: Redmine + PostgreSQL 8.4.4 fails on _dir_list_content.rhtmlClosedEric Davis2010-06-16

Actions
Is duplicate of Redmine - Defect #3937: Revision view not compatible with all databasesClosed2009-09-28

Actions
Actions

Also available in: Atom PDF