Modify

Opened 15 months ago

Closed 15 months ago

Last modified 13 months ago

#11039 closed defect (fixed)

IntegrityError: column name is not unique

Reported by: anonymous Owned by: rjollos
Priority: normal Component: DefaultCcPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description (last modified by rjollos)

Trac detected an internal error:
IntegrityError: column name is not unique

Python Traceback
Most recent call last:
File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 522, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 208, in dispatch
  chosen_handler)
File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 350, in _pre_process_request
  chosen_handler = filter_.pre_process_request(req, chosen_handler)
File "/usr/lib64/python2.7/site-packages/defaultcc/admin.py", line 77, in pre_process_request
  cc.insert()
File "/usr/lib64/python2.7/site-packages/defaultcc/model.py", line 59, in insert
  (self.name, _fixup_cc_list(self.cc)))
File "/usr/lib64/python2.7/site-packages/trac/db/util.py", line 65, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)
File "/usr/lib64/python2.7/site-packages/trac/db/sqlite_backend.py", line 78, in execute
  result = PyFormatCursor.execute(self, *args)
File "/usr/lib64/python2.7/site-packages/trac/db/sqlite_backend.py", line 56, in execute
  args or [])
File "/usr/lib64/python2.7/site-packages/trac/db/sqlite_backend.py", line 48, in _rollback_on_error
  return function(self, *args, **kwargs)

Attachments (0)

Change History (5)

comment:1 Changed 15 months ago by rjollos

  • Description modified (diff)

comment:2 Changed 15 months ago by rjollos

I'll take a look. Any hints on how to reproduce the issue?

comment:3 Changed 15 months ago by rjollos

  • Status changed from new to assigned

I can reproduce the error when trying to rename a component with a name that already exists. The plugin is doing an insert into the defaultcc table in pre_process_request, before any check is performed to determine if the component name already exists. The fix that I'll put in place will check that the user is not attempting to rename the component to the name of an already existing component before doing the delete and insert operations.

In Trac 0.11.7 and 0.12.5, IntegrityError will be raised when renaming a Component but the new name already exists. This was fixed in Trac 1.0, t 10737#file8 so that a TracError is raised. Therefore, even after the fix is put in place, you'll see an IntegrityError in Trac < 1.0, but the traceback will not involve the DefaultCcPlugin.

File "/home/user/Workspace/test/trac.git/trac/web/main.py", line 522, in _dispatch_request
  dispatcher.dispatch(req)
File "/home/user/Workspace/test/trac.git/trac/web/main.py", line 243, in dispatch
  resp = chosen_handler.process_request(req)
File "/home/user/Workspace/test/trac.git/trac/admin/web_ui.py", line 117, in process_request
  path_info)
File "/home/user/Workspace/test/trac.git/trac/ticket/admin.py", line 53, in render_admin_panel
  return self._render_admin_panel(req, cat, page, version)
File "/home/user/Workspace/test/trac.git/trac/ticket/admin.py", line 88, in _render_admin_panel
  comp.update()
File "/home/user/Workspace/test/trac.git/trac/ticket/model.py", line 875, in update
  @self.env.with_transaction(db)
File "/home/user/Workspace/test/trac.git/trac/db/api.py", line 77, in transaction_wrapper
  fn(ldb)
File "/home/user/Workspace/test/trac.git/trac/ticket/model.py", line 882, in do_update
  """, (self.name, self.owner, self.description, self._old_name))
File "/home/user/Workspace/test/trac.git/trac/db/util.py", line 65, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)
File "/home/user/Workspace/test/trac.git/trac/db/sqlite_backend.py", line 78, in execute
  result = PyFormatCursor.execute(self, *args)
File "/home/user/Workspace/test/trac.git/trac/db/sqlite_backend.py", line 56, in execute
  args or [])
File "/home/user/Workspace/test/trac.git/trac/db/sqlite_backend.py", line 48, in _rollback_on_error
  return function(self, *args, **kwargs)

comment:4 Changed 15 months ago by rjollos

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [13017]) Fixes #11039: Don't modify the component_default_cc table if the Component name is being changed to the name of an already existing component, as trac.ticket.model.ComponentAdmin will raise a TracError (or an IntegrityError for Trac < 1.0) and abort the transaction.

comment:5 Changed 13 months ago by rjollos

In 13333:

0.3dev: Edits to the Default CC field of a component were not being saved. Related to [13017]. Refs #11039, Fixes #11225.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from rjollos. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.