Opened 9 years ago
Closed 9 years ago
#12112 closed defect (fixed)
Duplicate column name 'priority_value' is raised in custom query with MySQL
Reported by: | Jun Omae | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 1.2 |
Component: | query system | Version: | 0.12-stable |
Severity: | normal | Keywords: | mysql |
Cc: | Branch: | ||
Release Notes: |
Fix conflicted |
||
API Changes: |
|
||
Internal Changes: |
Description
When priority_value
is defined as custom field and filter with the field, the following error is raised on MySQL with Trac 0.12-stable and 1.0-stable. No errors on SQLite and PostgreSQL.
2015-06-25 16:30:00,151 Trac[main] ERROR: Internal Server Error: Traceback (most recent call last): File "/venv/trac/1.0.6.post2/lib/python2.5/site-packages/trac/web/main.py", line 534, in _dispatch_request dispatcher.dispatch(req) File "/venv/trac/1.0.6.post2/lib/python2.5/site-packages/trac/web/main.py", line 227, in dispatch resp = chosen_handler.process_request(req) File "/venv/trac/1.0.6.post2/lib/python2.5/site-packages/trac/ticket/query.py", line 984, in process_request return self.display_html(req, query) File "/venv/trac/1.0.6.post2/lib/python2.5/site-packages/trac/ticket/query.py", line 1082, in display_html tickets = query.execute(req) File "/venv/trac/1.0.6.post2/lib/python2.5/site-packages/trac/ticket/query.py", line 301, in execute self.num_items = self._count(sql, args) File "/venv/trac/1.0.6.post2/lib/python2.5/site-packages/trac/ticket/query.py", line 282, in _count % sql, args)[0][0] File "/venv/trac/1.0.6.post2/lib/python2.5/site-packages/trac/db/api.py", line 124, in execute return db.execute(query, params) File "/venv/trac/1.0.6.post2/lib/python2.5/site-packages/trac/db/util.py", line 128, in execute cursor.execute(query, params if params is not None else []) File "/venv/trac/1.0.6.post2/lib/python2.5/site-packages/trac/db/util.py", line 72, in execute return self.cursor.execute(sql_escape_percent(sql), args) File "/venv/py25/lib/python2.5/site-packages/MySQLdb/cursors.py", line 205, in execute self.errorhandler(self, exc, value) File "/venv/py25/lib/python2.5/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue OperationalError: (1060, "Duplicate column name 'priority_value'")
Attachments (0)
Change History (4)
comment:1 by , 9 years ago
Milestone: | next-stable-1.0.x → next-dev-1.1.x |
---|
comment:2 by , 9 years ago
Milestone: | next-dev-1.1.x → 1.2 |
---|---|
Owner: | set to |
Status: | new → assigned |
Proposed changes in log:jomae.git@t12112.
comment:3 by , 9 years ago
Changes look good, and tests pass after rebasing with SQLite, PostgreSQL and MySQL.
comment:4 by , 9 years ago
API Changes: | modified (diff) |
---|---|
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | assigned → closed |
Thanks for the review. Committed in [14570].
Query in
trac/ticket/query.py
has no errors on SQLite and PostgreSQL howeverpriority.value AS priority_value
andpriority_value
custom field are conflicted.We could use
_priority_value
instead ofpriority_value
because name of custom field should match^[a-zA-Z][a-zA-Z0-9_]+$
. But these changes might be API changes for a user which customizesquery_results.html
.trac/ticket/query.py
priority_value")trac/ticket/templates/query_results.html
priority_value}${