Edgewall Software

Opened 7 years ago

Closed 7 years ago

#11769 closed defect (duplicate)

query: link with duplicated columns leads "OperationalError: Duplicate column name" on MySQL

Reported by: Jun Omae Owned by:
Priority: normal Milestone:
Component: query system Version: 0.12-stable
Severity: normal Keywords: mysql
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:


The query: link with duplicated columns, e.g. query:col=version|version, leads OperationalError: Duplicate column name on MySQL. No errors on SQLite and PostgreSQL.

This issue is similar to TicketQuery macro issue in comment:9:ticket:11140.

2014-09-30 15:53:20,340 Trac[util] DEBUG: SQL: u"SELECT COUNT(*) FROM (SELECT t.id AS id,t.version AS version,t.version AS version,t.status AS status,t.priority AS priority,t.time AS time,t.changetime AS changetime,priority.value AS priority_value\nFROM ticket AS t\n  LEFT OUTER JOIN enum AS priority ON (priority.type='priority' AND priority.name=priority)\nORDER BY COALESCE(priority.value,'')='',CAST(priority.value AS signed),t.id) AS foo"
2014-09-30 15:53:20,340 Trac[util] DEBUG: execute exception: <_mysql_exceptions.OperationalError instance at 0x7f22e48a6e18>
2014-09-30 15:53:20,341 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/venv/trac/0.12.5/lib/python2.4/site-packages/trac/web/main.py", line 522, in _dispatch_request
  File "/venv/trac/0.12.5/lib/python2.4/site-packages/trac/web/main.py", line 243, in dispatch
    resp = chosen_handler.process_request(req)
  File "/venv/trac/0.12.5/lib/python2.4/site-packages/trac/ticket/query.py", line 952, in process_request
    return self.display_html(req, query)
  File "/venv/trac/0.12.5/lib/python2.4/site-packages/trac/ticket/query.py", line 1052, in display_html
    tickets = query.execute(req, db)
  File "/venv/trac/0.12.5/lib/python2.4/site-packages/trac/ticket/query.py", line 301, in execute
    self.num_items = self._count(sql, args, db)
  File "/venv/trac/0.12.5/lib/python2.4/site-packages/trac/ticket/query.py", line 282, in _count
    cursor.execute(count_sql, args)
  File "/venv/trac/0.12.5/lib/python2.4/site-packages/trac/db/util.py", line 56, in execute
    r = self.cursor.execute(sql)
  File "/venv/py24/lib/python2.4/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/venv/py24/lib/python2.4/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1060, "Duplicate column name 'version'")

Attachments (0)

Change History (1)

comment:1 by Jun Omae, 7 years ago

Milestone: 0.12.7
Resolution: duplicate
Status: newclosed

The issue has been fixed by #11140 and [12298] (0.12.6).

Modify Ticket

Change Properties
Set your email in Preferences
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) 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.