Edgewall Software

Ticket #4119 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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@…

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

Change History

Changed 3 years ago by sineer

  • cc sineer@… added

Changed 3 years ago by sid

Is this substantially different from #2604?

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

Changed 3 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from new to assigned

... that's for me ;)

Changed 3 years ago by cboos

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in r4239.

Add/Change #4119 (Query breaks with `id` as a field.)

Author


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


Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.