Edgewall Software
Modify

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: joshuah@… 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)

in reply to:  description ; comment:1 by Remy Blank, 16 years ago

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 by Remy Blank, 16 years ago

Milestone: 0.11.3
Owner: set to Remy Blank

in reply to:  1 comment:3 by anonymous, 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 Remy Blank, 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:5 by Christian Boos, 15 years ago

Still a problem on trunk (r9234).

comment:6 by Christian Boos, 15 years ago

Keywords: verfiy removed

comment:7 by Mark Mc Mahon, 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 Christian Boos, 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 mark.m.mcmahon@…, 15 years ago

Cc: mark.m.mcmahon@… added
Keywords: sqlite sqlite3 removed
Summary: Sorting reports on columns aliased to 'Est.' or 'Act.' fails with sqliteSorting 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 Remy Blank, 14 years ago

Milestone: next-minor-0.12.x
Resolution: duplicate
Status: newclosed

This is actually a duplicate of #7764.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.