Edgewall Software

Ticket #7726 (new defect)

Opened 3 months ago

Last modified 2 months ago

Sorting reports on columns aliased to 'Est.' or 'Act.' fails with sqlite

Reported by: joshuah@… Owned by: rblank
Priority: normal Milestone: 0.11.3
Component: report system Version: 0.11.1
Severity: normal Keywords: report reports sort sorting sqlite sqlite3
Cc:

Description

Sorting a report on a column name aliased to end with a period (for example, 'Est.', 'Act.') fails with the following error in sqlite:

Report execution failed: no such column: Est.ASC

Here's the query for the report:

SELECT p.value AS __color__,
   id AS ticket, milestone, summary as 'Summ.', priority as 'Pri.', 
   date(milestone.Due,'unixepoch') as due,
   status,
   changetime AS _changetime, t.description AS _description
  FROM ticket t, enum p 
  JOIN milestone ON milestone.name=t.milestone
WHERE t.owner = '$USER' 
  AND status <> 'closed' 
  AND p.name = t.priority AND p.type = 'priority' 
ORDER BY owner, milestone.Due, p.value, t.type, time

Escaping the column name with single quotes in the ORDER BY clause generated by Trac seems to fix this problem.

Attachments

Change History

in reply to: ↑ description ; follow-up: ↓ 3   Changed 3 months ago by rblank

Replying to joshuah@…:

Escaping the column name with single quotes in the ORDER BY clause generated by Trac seems to fix this problem.

Would you mind attaching a patch? This would increase the chances of this getting fixed quickly :-)

  Changed 2 months ago by rblank

  • owner set to rblank
  • milestone set to 0.11.3

in reply to: ↑ 1   Changed 2 months ago by anonymous

Replying to rblank:

Replying to joshuah@…:

Escaping the column name with single quotes in the ORDER BY clause generated by Trac seems to fix this problem.

Would you mind attaching a patch? This would increase the chances of this getting fixed quickly :-)

Well, the obvious path of using placeholders doesn't quite work. The query executes without error but the sort order appears to ignore the ORDER BY clause, probably because 'Est.' is interpreted as a string literal. Apparently double-quoting it is needed to make SQLite see it as an identifier; see SQLite Keywords.

Add/Change #7726 (Sorting reports on columns aliased to 'Est.' or 'Act.' fails with sqlite)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from rblank. Next status will be 'new'
The owner will change from rblank to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.