Edgewall Software

Opened 9 years ago

Last modified 9 years ago

#10623 closed defect

When using an alias with a space in it for a column name in a report you get this error 'Date ASC LIMIT 100 OFFSET 0' — at Initial Version

Reported by: signup@… Owned by:
Priority: normal Milestone:
Component: report system Version: 0.11.6
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


Take the default Active Ticket report and modify it to add a space in the id column alias SELECT p.value AS color,

id AS ticket,

SELECT p.value AS color,

id AS 'ticket id',

Now execute the report and sort on the 'ticket id' column and you will get the following error

Report execution failed: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Date ASC LIMIT 100 OFFSET 0' at line 13")

The can be traced to this file report.py C:\Python25\Lib\site-packages\Trac-0.11.6-py2.5.egg\trac\ticket System info; Trac: 0.11.6 Python: 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] setuptools: 0.6c11 MySQL: server: "5.1.41-community", client: "5.0.27", thread-safe: 1 MySQLdb: 1.2.2 Genshi: 0.5.1 mod_python: 3.3.1 Subversion: 1.6.6 (r40053) jQuery: 1.2.6

Results of debug, notice the sort column is Due Date instead of 'Due Date' Without the single quotes around the column alias the order by clause causes an error. 2012-03-12 21:20:23,657 Trac[report] DEBUG: Columns [u'color', u'ticket', u'Due Date', u'summary', u'component', u'version', u'milestone', u'type', u'owner', u'status', u'created', u'_changetime', u'_description', u'_reporter'], Sort column Due Date 2012-03-12 21:20:23,657 Trac[report] DEBUG: Query SQL: SELECT * FROM (

SELECT p.value AS color,

id AS ticket, d.value AS 'Due Date', summary, component, version, milestone, t.type AS type,

owner, status,

time AS created,

changetime AS _changetime, description AS _description,

reporter AS _reporter

FROM ticket t

LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'

LEFT JOIN ticket_custom d ON t.id = d.ticket AND d.name = 'duedate'

WHERE status ≠ 'closed'

ORDER BY CAST(p.value AS signed), milestone, t.type, time


2012-03-12 21:20:23,657 Trac[chrome] DEBUG: Prepare chrome data for request 2012-03-12 21:20:23,657 Trac[session] DEBUG: Retrieving session for ID u'anonymous'

Change History (0)

Note: See TracTickets for help on using tickets.