Actions
Defect #3942
closedRedmine + PostgreSQL 8.3: ActiveRecord::StatementInvalid in RepositoriesController#revision
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
Updated by Jean-Philippe Lang about 15 years ago
- Status changed from New to Closed
- Resolution set to Fixed
Fixed in r2903.
Updated by Anonymous over 14 years ago
- Status changed from Closed to Reopened
Hi,
I'm reopening this since I have a very similar problem in
app/views/repositories/_dir_list_content.rhtml
I changed<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %>
to<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier.to_s) if entry.lastrev && entry.lastrev.identifier %>
and it worked. Not sure if it applicable everywhere though.
Updated by Felix Schäfer over 14 years ago
- Status changed from Reopened to Closed
Please open a new defect for this issue, thanks.
Actions