Project

General

Profile

Actions

Defect #3937

closed

Revision view not compatible with all databases

Added by Aaron Fischer over 14 years ago. Updated over 14 years ago.

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

100%

Estimated time:
Resolution:
Fixed
Affected version:

Description

The bug was introduced on rev. r2898.
Some databases are strongly typed (like PostgreSQL). The revision column is a varchar, so the method find_changeset_by_name throws an error if the revision (from type string) is compared with the name (which is casted to a integer).

-    changesets.find(:first, :conditions => (name.match(/^\d*$/) ? ["revision = ?", name.to_i] : ["revision LIKE ?", name + '%']))
+    changesets.find(:first, :conditions => (name.match(/^\d*$/) ? ["revision = ?", name.to_s] : ["revision LIKE ?", name + '%']))
(16:34:34) Florian Eitel: --- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -94,7 +94,7 @@ class Repository < ActiveRecord::Base

   # 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.to_s] : ["revision LIKE ?", name + '%']))
   end

   def latest_changeset

Related issues

Has duplicate Redmine - Defect #3942: Redmine + PostgreSQL 8.3: ActiveRecord::StatementInvalid in RepositoriesController#revisionClosed2009-09-29

Actions
Actions #1

Updated by Jean-Philippe Lang over 14 years ago

  • Status changed from New to Closed
  • Affected version (unused) set to devel
  • Resolution set to Fixed

Fixed in r2903. Thanks.

Actions

Also available in: Atom PDF