Defect #5696

Redmine + PostgreSQL 8.4.4 fails on _dir_list_content.rhtml

Added by Aurélien Pocheville about 8 years ago. Updated almost 8 years ago.

Status:ClosedStart date:2010-06-16
Priority:LowDue date:
Assignee:Eric Davis% Done:


Target version:1.0.0 (RC)
Resolution:Cant reproduce Affected version:0.9.3


This bug is very similar to #3942.

When requesting directory contents, postgresql fails with an error like:

PGError: ERROR: operator does not exist: character varying = integer

The solution is about the same.
I changed in _dir_list_content.rhtml
< % changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier % >
< % changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier.to_s) if entry.lastrev && entry.lastrev.identifier % >
and it worked.

  • Ubuntu server 10.04
  • Redmine 0.9.3
  • PostgreSQL 8.4.4
  • Ruby version 1.8.7 (i486-linux)
  • RubyGems version 1.3.5
  • Rails version 2.2.3
  • Active Record version 2.2.3
  • Action Pack version 2.2.3
  • Active Resource version 2.2.3
  • Action Mailer version 2.2.3
  • Active Support version 2.2.3
  • Edge Rails revision unknown
  • Application root /usr/share/redmine
  • Environment production
  • Database adapter postgresql
  • Database schema version 20100221100219

Related issues

Related to Redmine - Defect #3942: Redmine + PostgreSQL 8.3: ActiveRecord::StatementInvalid ... Closed 2009-09-29


#1 Updated by Felix Schäfer about 8 years ago

  • Assignee set to Eric Davis
  • Target version set to 1.0.0 (RC)

@Aurélien, I edited your report so that the code showed rather than being interpreted.

@Eric, this fix seems simple enough, though I'm not sure why the postgres adapter needs an explicitely cast string. The other thing bothering me is it seems wikified text doesn't get sanitized correctly, stuff in "< % % >" seems to either get thrown out or (worse) rendered.

#2 Updated by Aurélien Pocheville about 8 years ago

Thank you, I wasn't aware of this formatting problem.

I grepped 'find_by_revision' in source and this comes out:

app/views/repositories/_dir_list_content.rhtml:19:<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier.to_s) if entry.lastrev && entry.lastrev.identifier %>
app/helpers/application_helper.rb:513:          if project && (changeset = project.changesets.find_by_revision(identifier))
app/models/repository/darcs.rb:32:    patch = identifier.nil? ? nil : changesets.find_by_revision(identifier)
app/models/repository/darcs.rb:37:    patch = identifier.nil? ? nil : changesets.find_by_revision(identifier)
app/models/repository/darcs.rb:55:    patch = identifier.nil? ? nil : changesets.find_by_revision(identifier.to_s)
app/models/repository/darcs.rb:60:    patch_from = changesets.find_by_revision(rev)
app/models/repository/darcs.rb:62:    patch_to = changesets.find_by_revision(rev_to) if rev_to
app/models/repository/cvs.rb:33:    rev = identifier.nil? ? nil : changesets.find_by_revision(identifier)
app/models/repository/cvs.rb:38:    rev = identifier.nil? ? nil : changesets.find_by_revision(identifier)
app/models/repository/cvs.rb:43:          change=changes.find_by_revision_and_path( entry.lastrev.revision, scm.with_leading_slash(entry.path) )
app/models/repository/cvs.rb:57:    rev = identifier.nil? ? nil : changesets.find_by_revision(identifier)
app/models/repository/cvs.rb:64:    changeset_from=changesets.find_by_revision(rev)
app/models/repository/cvs.rb:66:      changeset_to=changesets.find_by_revision(rev_to)

Maybe those also need to be escaped for postgresql ? I'm sure since I do not use darcs neither cvs, I can't say if it is a problem or not.

#3 Updated by Holger Just almost 8 years ago

Seems like Postgres 8.3 and 8.4 differ in the way the interpret data types. Especially by interpreting strings as integers and vice versa. We have seen various such issues in the last few days.

#4 Updated by Eric Davis almost 8 years ago

  • Status changed from New to 7

Anyone have access to a Postgres 8.3 database to test this out on? I'm on 8.4 and don't want to fight a downgrade if I can help it.

#5 Updated by Jean-Baptiste Barth almost 8 years ago

I can, I'll give you a feedback in the day.

#6 Updated by Jean-Baptiste Barth almost 8 years ago

I did not have the time to test it deeply, but it seems it works fine with Postgresql 8.3. Maybe I'll have a bit more time tomorrow evening (french hours, it's 19h30 here!) to explore it if you want.

#7 Updated by Holger Just almost 8 years ago

Postgres 8.3 works as advertised with and without the original patch.

#8 Updated by Eric Davis almost 8 years ago

  • Status changed from 7 to Closed
  • Resolution set to Cant reproduce

I'm closing this as can't reproduce.

Aurélien Pocheville, once Redmine 1.0 is released could you upgrade and let us know if this is still happening for you? If so, feel free to reopen the issue.

Also available in: Atom PDF