Edgewall Software

Opened 3 years ago

Closed 3 years ago

#13035 closed defect (fixed)

OperationalError: (1241, 'Operand should contain 1 column(s)') — at Version 2

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.17
Component: roadmap Version: 1.0-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Avoid exception in log due to invalid milestone request.

API Changes:
Internal Changes:

Description

2018-06-01 01:32:49,607 Trac[main] ERROR: [206.47.39.180] Internal Server Error: <RequestWithSession "GET '/milestone/1.10?by=owner&by=owner'">, referrer 'https://bugs.jquery.com/milestone/1.10?by=owner'
Traceback (most recent call last):
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/web/main.py", line 623, in _dispatch_request
    dispatcher.dispatch(req)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/web/main.py", line 239, in dispatch
    resp = chosen_handler.process_request(req)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/ticket/roadmap.py", line 766, in process_request
    return self._render_view(req, milestone)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/ticket/roadmap.py", line 1000, in _render_view
    field=by)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/ticket/roadmap.py", line 312, in get_tickets_for_milestone
    for tkt_id, status, fieldval in env.db_query(sql, args)]
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/db/api.py", line 122, in execute
    return db.execute(query, params)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/db/util.py", line 128, in execute
    cursor.execute(query, params if params is not None else [])
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/trac/db/util.py", line 72, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/var/www/bugs.jquery.com/private/pve/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1241, 'Operand should contain 1 column(s)')

Change History (2)

comment:1 by Ryan J Ollos, 3 years ago

Milestone: 1.2.31.0.17
Version: 1.2.21.0-stable

Similarly, with SQLite rather than MySQL:

10:16:31 Trac[main] ERROR: [127.0.0.1] Internal Server Error: <RequestWithSession "GET '/milestone/milestone1?by=owner&by=owner'">, referrer None
Traceback (most recent call last):
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/web/main.py", line 647, in _dispatch_request
    dispatcher.dispatch(req)
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/web/main.py", line 248, in dispatch
    resp = chosen_handler.process_request(req)
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/ticket/roadmap.py", line 766, in process_request
    return self._render_view(req, milestone)
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/ticket/roadmap.py", line 1010, in _render_view
    field=by)
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/ticket/roadmap.py", line 312, in get_tickets_for_milestone
    for tkt_id, status, fieldval in env.db_query(sql, args)]
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/db/api.py", line 122, in execute
    return db.execute(query, params)
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/db/util.py", line 128, in execute
    cursor.execute(query, params if params is not None else [])
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/db/util.py", line 61, in execute
    r = self.cursor.execute(sql_escape_percent(sql), args)
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/db/sqlite_backend.py", line 88, in execute
    result = PyFormatCursor.execute(self, *args)
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/db/sqlite_backend.py", line 64, in execute
    args or [])
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/db/sqlite_backend.py", line 55, in _rollback_on_error
    return function(self, *args, **kwargs)
InterfaceError: Error binding parameter 0 - probably unsupported type.

Proposed fix:

  • trac/ticket/roadmap.py

    diff --git a/trac/ticket/roadmap.py b/trac/ticket/roadmap.py
    index 51c68fe3d..d47b1b561 100644
    a b class MilestoneModule(Component):  
    10041004            by = self.default_group_by
    10051005        elif available_groups:
    10061006            by = available_groups[0]['name']
    1007         by = req.args.get('by', by)
     1007        by = req.args.getfirst('by', by)
    10081008
    10091009        tickets = get_tickets_for_milestone(self.env, milestone=milestone.name,
    10101010                                            field=by)

comment:2 by Ryan J Ollos, 3 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.0-stable in r16616, merged in r16617, r16618.

Note: See TracTickets for help on using tickets.