Opened 18 years ago
Closed 18 years ago
#4119 closed defect (fixed)
Query breaks with `id` as a field.
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | ticket system | Version: | 0.10 |
Severity: | minor | Keywords: | |
Cc: | kantrn@…, sineer@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The query id=5
generates the following SQL:
SELECT t.summary AS summary,t.owner AS owner,t.type AS type,t.status AS status,t.priority AS priority,t.milestone AS milestone,t.component AS component,t.time AS time,t.changetime AS changetime,t.id AS id,priority.value AS priority_value FROM ticket AS t LEFT OUTER JOIN enum AS priority ON (priority.type='priority' AND priority.name=priority) WHERE COALESCE(t.id,'')=%s ORDER BY COALESCE(t.priority,'')='',priority.value,t.id
Because of the %s
, the where clause ends up looking like WHERE COALESCE(t.id,'')='5'
after interpolation. This returns no rows under SQLite, probably because t.id
is numeric. It works if it is WHERE COALESCE(t.id,'')=5
. This did work at one point in the past (on 0.10dev).
Attachments (0)
Change History (5)
comment:1 by , 18 years ago
Cc: | added |
---|
comment:2 by , 18 years ago
comment:3 by , 18 years ago
Ahh, didn't see that one when looking for an existing report. This would be the cause of that issue as well. I am not using the macro, but using a Query object directly in a plugin (the datamover plugin specifically).
Is this substantially different from #2604?