Edgewall Software

Opened 7 years ago

Closed 7 years ago

#4119 closed defect (fixed)

Query breaks with `id` as a field.

Reported by: Noah Kantrowitz (coderanger) <coderanger@…> Owned by: cboos
Priority: normal Milestone: 0.11
Component: ticket system Version: 0.10
Severity: minor Keywords:
Cc: kantrn@…, sineer@…
Release Notes:
API Changes:


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 Changed 7 years ago by sineer

  • Cc sineer@… added

comment:2 Changed 7 years ago by sid

Is this substantially different from #2604?

comment:3 Changed 7 years ago by Noah Kantrowitz (coderanger) <coderanger@…>

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).

comment:4 Changed 7 years ago by cboos

  • Owner changed from jonas to cboos
  • Status changed from new to assigned

… that's for me ;)

comment:5 Changed 7 years ago by cboos

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in r4239.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed The owner will remain cboos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from cboos to the specified user.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.