Opened 15 years ago
Closed 14 years ago
Last modified 14 years ago
#6808 closed defect (fixed)
Exception: column name is not unique
|Reported by:||Owned by:||Eli Carter|
|Severity:||normal||Keywords:||exception column name not unique|
Description (last modified by )
In the admin section, add a version that already exists.
Traceback (most recent call last): File "/usr/local/lib/python2.4/site-packages/trac/web/main.py", line 406, in dispatch_request dispatcher.dispatch(req) File "/usr/local/lib/python2.4/site-packages/trac/web/main.py", line 237, in dispatch resp = chosen_handler.process_request(req) File "/usr/local/lib/python2.4/site-packages/TracWebAdmin-0.1.2-py2.4.egg/webadmin/web_ui.py", line 109, in process_request path_info) File "/usr/local/lib/python2.4/site-packages/TracWebAdmin-0.1.2-py2.4.egg/webadmin/ticket.py", line 244, in process_admin_request ver.insert() File "/usr/local/lib/python2.4/site-packages/trac/ticket/model.py", line 723, in insert (self.name, self.time, self.description)) File "/usr/local/lib/python2.4/site-packages/trac/db/util.py", line 50, in execute return self.cursor.execute(sql_escape_percent(sql), args) File "/usr/local/lib/python2.4/site-packages/trac/db/sqlite_backend.py", line 56, in execute args or ) File "/usr/local/lib/python2.4/site-packages/trac/db/sqlite_backend.py", line 48, in _rollback_on_error return function(self, *args, **kwargs) IntegrityError: column name is not unique
Change History (8)
follow-up: 2 comment:1 by , 15 years ago
|Milestone:||0.10.5 → 0.11.1|
|Version:||0.10.4 → devel|
comment:2 by , 15 years ago
Replying to osimons:
trying to add a new valid version gives Trac Error:
Version 3.0 does not exist.
That's the usual Trac approach for handling the data model objects: when the constructor gets an identifier, it expects to be able to fetch an existing instance for that identifier. If not, it will raise a TracError. Some have already pointed out the trouble with this approach, see #4130.
comment:3 by , 15 years ago
|Milestone:||0.11.1 → 0.12|
|Priority:||low → high|
comment:4 by , 15 years ago
follow-up: 6 comment:5 by , 15 years ago
comment:6 by , 15 years ago
Replying to ecarter:
The reported error is now fixed in trunk , with testcases in sandbox/testing  . There may be a better implementation, but I suggest we close this one.
+1. Let's use #6348 to note the various duplicates and variations of this error - and to hopefully solve it for all.
comment:7 by , 14 years ago
|Milestone:||0.13 → 0.11|
|Status:||new → closed|
comment:8 by , 14 years ago
It exists in trunk as well, and is the same for other enums as well. It also happens from both webadmin and trac-admin.
Regarding 2, here is what I see in the current trunk
Versionis identical in implementation):
Just did a quick check in
trac.ticket.admin.pycode for adding versions, and the reason why this does not trigger is that we do not instantiate by passing the name to
self._old_valuewill not get set:
However, doing that it seems that
__init__()does not have a fallback of
Noneif it does not exist (no row fetched from datababase), so trying to add a new valid version gives Trac Error:
Catch-22 it seems… I think we should:
model.Version(self.env, name=req.args.get('name'))in all trac-admin and webadmin code.
__init__()in the various model classes to have a fallback if there is no actual existing instance of that name. Why would we want to raise a
the_version.existsproperty after object creation.