Opened 19 years ago
Closed 19 years ago
#2116 closed defect (fixed)
Database error in postgres
Reported by: | anonymous | Owned by: | Jonas Borgström |
---|---|---|---|
Priority: | normal | Milestone: | 0.9 |
Component: | general | Version: | |
Severity: | major | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Trac detected an internal error: ERROR: Unable to identify an operator '=' for types 'text' and 'integer' You will have to retype this query using an explicit cast
This is both in postgres 7.2.1 and 7.4.8 whic are on the old side, but I suspect it'll happen in newer versions too.
It's easily resolved by changing the id field in the attachment table from a test field to an integer.
Is there a good reason why the id field is text in attachment but integer in ticket and ticket_custom?
I'll be happy to provide my email when Trac provides email munging.
Attachments (0)
Change History (6)
comment:1 by , 19 years ago
comment:3 by , 19 years ago
Status: | new → assigned |
---|
comment:4 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
[2294] makes sure attachment ids are casted into strings before quering the database (in fetch and select).
Btw, comparing text columns with intergers seems to be possible with PostgreSQL 8.x.
comment:5 by , 19 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Version: | 0.9b1 |
That helped, but it needs to be fixed in one more place.
/usr/lib/python2.3/site-packages/trac/ticket/model.py
256c256 < (self.id, when, str(self.id), when, str(self.id), when)) --- > (self.id, when, self.id, when, self.id, when)) 266c266 < "ORDER BY time", (self.id, str(self.id), str(self.id))) --- > "ORDER BY time", (self.id, self.id, self.id))
comment:6 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Thanks, that should be fixed in [2302].
Upon further investigation, it looks like the id field in the attachment can also hold a wiki page name. So the solution above does not work. Need to find something elese.