Ticket #2431 (closed defect: fixed)
Custom Query fails with Custom Field containing a hyphen (-)
| Reported by: | adam@… | Owned by: | cmlenz |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.9.4 |
| Component: | report system | Version: | 0.9 |
| Severity: | minor | Keywords: | |
| Cc: |
Description (last modified by cmlenz) (diff)
When trying to create a Custom Query and trying to either Filter OR Group By a custom field which contains a hyphen, the query fails with the following traceback.
In my case, the field was named 'merge-status' and was working properly otherwise. After renaming the field to 'merge_status' the error went away.
I'm guessing that the problem is with the generated sql appearing like "SELECT merge-status AS merge-status" when it should be "SELECT merge-status AS 'merge-status'", but I don't know python so I can't be sure.
Python traceback
Traceback (most recent call last):
File "/usr/local/lib/python2.4/site-packages/trac/web/cgi_frontend.py", line 131, in run
dispatch_request(req.path_info, req, env)
File "/usr/local/lib/python2.4/site-packages/trac/web/main.py", line 139, in dispatch_request
dispatcher.dispatch(req)
File "/usr/local/lib/python2.4/site-packages/trac/web/main.py", line 107, in dispatch
resp = chosen_handler.process_request(req)
File "/usr/local/lib/python2.4/site-packages/trac/ticket/query.py", line 393, in process_request
self.display_html(req, query)
File "/usr/local/lib/python2.4/site-packages/trac/ticket/query.py", line 497, in display_html
tickets = query.execute(db)
File "/usr/local/lib/python2.4/site-packages/trac/ticket/query.py", line 140, in execute
cursor.execute(sql)
File "/usr/local/lib/python2.4/site-packages/trac/db.py", line 219, in execute
args or [])
File "/usr/local/lib/python2.4/site-packages/trac/db.py", line 211, in _rollback_on_error
return function(self, *args, **kwargs)
OperationalError: near "-": syntax error


