Edgewall Software
Modify

Ticket #7726 (closed defect: duplicate)

Opened 3 years ago

Last modified 19 months ago

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

Reported by: joshuah@… Owned by: rblank
Priority: normal Milestone:
Component: report system Version: 0.11.1
Severity: normal Keywords: report reports sort sorting bitesized
Cc: mark.m.mcmahon@…
Release Notes:
API 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

Change History

comment:1 in reply to: ↑ description ; follow-up: Changed 3 years 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 :-)

comment:2 Changed 3 years ago by rblank

  • Milestone set to 0.11.3
  • Owner set to rblank

comment:3 in reply to: ↑ 1 Changed 3 years 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.

comment:4 Changed 2 years ago by rblank

  • Keywords verfiy bitesized added

We should check if this is still present on trunk, as there have been some changes to the reports.

comment:5 Changed 2 years ago by cboos

Still a problem on trunk (r9234).

comment:6 Changed 2 years ago by cboos

  • Keywords verfiy removed

comment:7 Changed 2 years ago by Mark Mc Mahon

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

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 Changed 2 years ago by mark.m.mcmahon@…

  • Cc mark.m.mcmahon@… added
  • Keywords sqlite sqlite3 removed
  • Summary changed from Sorting reports on columns aliased to 'Est.' or 'Act.' fails with sqlite to 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 Changed 19 months ago by rblank

  • Milestone next-minor-0.12.x deleted
  • Resolution set to duplicate
  • Status changed from new to closed

This is actually a duplicate of #7764.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from rblank. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.