Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#2431 closed defect (fixed)

Custom Query fails with Custom Field containing a hyphen (-)

Reported by: adam@… 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 Christopher Lenz)

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 Christopher Lenz, 19 years ago

Description: modified (diff)
Milestone: 0.9.2
Owner: changed from daniel to Christopher Lenz
Status: newassigned

comment:2 by Christopher Lenz, 19 years ago

Milestone: 0.9.30.9.4

comment:3 by Christopher Lenz, 19 years ago

Resolution: fixed
Status: assignedclosed

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz 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.