Opened 16 years ago
Closed 14 years ago
#7726 closed defect (duplicate)
Sorting reports on columns aliased to 'Est.' or 'Act.' fails with PostgreSQL
Reported by: | Owned by: | Remy Blank | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | report system | Version: | 0.11.1 |
Severity: | normal | Keywords: | report reports sort sorting bitesized |
Cc: | mark.m.mcmahon@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
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 (0)
Change History (10)
follow-up: 3 comment:1 by , 16 years ago
comment:2 by , 16 years ago
Milestone: | → 0.11.3 |
---|---|
Owner: | set to |
comment:3 by , 16 years ago
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.
comment:4 by , 15 years ago
Keywords: | verfiy bitesized added |
---|
We should check if this is still present on trunk, as there have been some changes to the reports.
comment:6 by , 15 years ago
Keywords: | verfiy removed |
---|
comment:7 by , 15 years ago
I can't actually reproduce this issue on Trac 0.12dev-r9325. I looked through the log messages since R9234 bug didn't find anything in particular that looked like it would be a solution to this issue.
comment:8 by , 15 years ago
The report given above in the description works fine for the SQLite backend, but when used here (PostgreSQL backend) it fails:
syntax error at or near "'Summ.'" LINE 3: id AS ticket, milestone, summary as 'Summ.', priority as ... ^
comment:9 by , 15 years ago
Cc: | added |
---|---|
Keywords: | sqlite sqlite3 removed |
Summary: | Sorting reports on columns aliased to 'Est.' or 'Act.' fails with sqlite → Sorting reports on columns aliased to 'Est.' or 'Act.' fails with PostgreSQL |
Changed summary based on cboos comment to reference PostgreSQL rather than sqlite. (and also removed sqlite keywords)
comment:10 by , 14 years ago
Milestone: | next-minor-0.12.x |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
This is actually a duplicate of #7764.
Replying to joshuah@…:
Would you mind attaching a patch? This would increase the chances of this getting fixed quickly :-)