Edgewall Software
Modify

Opened 3 years ago

Closed 3 years ago

#12399 closed defect (fixed)

Not unique table/alias: 'priority' when priority enums are removed and priority custom field is added

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0.11
Component: query system Version: 1.0-stable
Severity: normal Keywords:
Cc:
Release Notes:

Fix database exceptions in query system when no defined milestones/versions/enums and the same name as custom field is added.

API Changes:

Description (last modified by Jun Omae)

All of priority enums are removed and priority as custom field is added, query system raises an OperationalError on MySQL.

2016-03-14 12:03:35,208 Trac[util] DEBUG: SQL: SELECT COUNT(*) FROM (SELECT t.id AS
 id,t.summary AS summary,t.status AS status,t.type AS type,t.milestone AS
 milestone,t.component AS component,t.time AS time,t.changetime AS changetime,t.owner AS
 owner,priority.value AS priority_value,`priority`.value AS `priority`
FROM ticket AS t
  LEFT OUTER JOIN ticket_custom AS `priority` ON (`priority`.ticket=t.id AND `priority`.name='priority')
  LEFT OUTER JOIN enum AS priority ON (priority.type='priority' AND priority.name=priority)
WHERE ((COALESCE(t.status,'')!=%s) AND (COALESCE(t.owner,'')=%s))
ORDER BY COALESCE(priority.value,'')='',CAST(priority.value AS signed),t.id) AS x
2016-03-14 12:03:35,208 Trac[util] DEBUG: args: [u'closed', u'admin']
2016-03-14 12:03:35,208 Trac[util] DEBUG: execute exception: OperationalError(1066, "Not unique table/alias: 'priority'")

The issue doesn't raise on Trac 0.12.7 and MySQL.

Attachments (0)

Change History (4)

comment:1 Changed 3 years ago by Jun Omae

Description: modified (diff)

comment:2 Changed 3 years ago by Jun Omae

The same issue raises with all datatbase backends.

SQLite:

OperationalError('ambiguous column name: priority.value',)

PostgreSQL:

ProgrammingError: table name "priority" specified more than once

comment:3 Changed 3 years ago by Jun Omae

Proposed changes in log:jomae.git@t12399, which fixes this issue and the similar issues when no defined milestones/versions.

comment:4 Changed 3 years ago by Jun Omae

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

Committed in [14703] and merged to trunk in [14704].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted.
to The owner will be changed from Jun Omae 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.