SQL error on Trac 0.12
|Reported by:||dwc||Owned by:||rjollos|
|Cc:||jun66j5, hasienda||Trac Release:||0.12|
Description (last modified by hasienda)
On Trac 0.12, an error results when moving a ticket:
ProgrammingError: operator does not exist: text = integer LINE 1: SELECT * FROM attachment WHERE id=17 ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
This occurs on PostgreSQL databases, at least, due to its use of strict type checking.
A simple fix is to quote the value in the SQL statement. This works on PostgreSQL and SQLite databases.
188 188 189 189 # copy the changelog and attachment DBs 190 190 for table, _id in tables.items(): 191 for row in get_all_dict(self.env, "SELECT * FROM %s WHERE %s =%s" % (table, _id, ticket_id)): 191 for row in get_all_dict(self.env, "SELECT * FROM %s WHERE %s" % (table, _id, ticket_id)): 192 192 row[_id] = new_ticket.id 193 193 insert_row_from_dict(env, table, row) 194 194
Change History (7)
comment:3 Changed 19 months ago by rjollos
- Cc jun66j5 added
- Owner changed from k0s to rjollos
- Status changed from new to assigned
comment:5 follow-up: ↓ 6 Changed 19 months ago by rjollos
- Resolution set to fixed
- Status changed from assigned to closed