#2431 closed defect (fixed)
Custom Query fails with Custom Field containing a hyphen (-)
| Reported by: | Owned by: | Christopher Lenz | |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.9.4 |
| Component: | report system | Version: | 0.9 |
| Severity: | minor | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description (last modified by )
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
Attachments (0)
Change History (3)
comment:1 by , 20 years ago
| Description: | modified (diff) |
|---|---|
| Milestone: | → 0.9.2 |
| Owner: | changed from to |
| Status: | new → assigned |
comment:2 by , 20 years ago
| Milestone: | 0.9.3 → 0.9.4 |
|---|
comment:3 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |



Since [2885]/[2886] custom field names are now restricted to contain only letters, digits and underscores. You'll get a warning in the log otherwise, and the field will be ignored.