diff options
author | Dan McGee <dan@archlinux.org> | 2013-03-07 16:16:58 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-03-07 16:16:58 -0600 |
commit | 7a5b06c3e77b6369bf4c813dfc5a3c547cca2280 (patch) | |
tree | 569d4c543babaf008e71d4b02a4f1a996befc0bb /news/urls.py | |
parent | ace95f6e53f41409568d4e4f1cf4c2a69d931e2c (diff) |
Fix IntegrityError in corner case todolist update
We were seeing this in production:
IntegrityError: duplicate key value violates unique constraint "todolists_todolistpackage_todolist_id_700d1b623414814c_uniq"
DETAIL: Key (todolist_id, pkgname, arch_id)=(206, ruby-cairo, 2) already exists.
This is due to a corner case where a package was originally on a
todolist and the underlying package object disappeared, so the todolist
entry was unlinked and pkg_id set to NULL. Later, this package came
back, but our get_or_create tried to create an object that violated our
unique constraint because of the missing pkg_id.
Call get_or_create with the minimum necessary bits to find the todolist
package object, and pass the rest of the values via defaults to avoid
this problem. Additionally, relink any todolist entries up to a package
in the repositories if one is available.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'news/urls.py')
0 files changed, 0 insertions, 0 deletions