Same tag twice in different case causes ConstraintError

Bug #1216398 reported by Jim Miller on 2013-08-24
30
This bug affects 4 people
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

Starting in v1.0, trying to set tags to have the same word twice, but with different case causes a ConstraintError.

The easiest way to duplicate the problem I've found is to create an empty book and try setting tags to contain a,A.

calibre, version 1.0.0
ERROR: Unhandled exception: <b>ConstraintError</b>:ConstraintError: columns book, tag are not unique

calibre 1.0 [64bit] isfrozen: True is64bit: True
Windows-8-6.2.9200 Windows ('64bit', 'WindowsPE')
('Windows', '8', '6.2.9200')
Python 2.7.4
Windows: ('8', '6.2.9200', '', 'Multiprocessor Free')
Traceback (most recent call last):
  File "site-packages\calibre\gui2\metadata\single.py", line 496, in accept
  File "site-packages\calibre\gui2\metadata\single.py", line 469, in apply_changes
  File "site-packages\calibre\gui2\metadata\basic_widgets.py", line 1188, in commit
  File "site-packages\calibre\db\legacy.py", line 451, in set_tags
  File "site-packages\calibre\db\cache.py", line 906, in set_field
  File "site-packages\calibre\db\write.py", line 502, in set_books
  File "site-packages\calibre\db\write.py", line 415, in many_many
  File "site-packages\calibre\db\backend.py", line 291, in executemany
  File "c:\cygwin\home\kovid\sw\build\apsw-3.7.14.1-r1\src\cursor.c", line 231, in resetcursor
ConstraintError: ConstraintError: columns book, tag are not unique

I would expect it to either accept and keep both or only keep one.

I first found this issue from users bumping into it when updating metadata from the FanFictionDownLoader plugin.

Jim Miller (retiefjimm) wrote :

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
Marco Hiller (marcohiller85) wrote :

The buf appeared again:

calibre, version 1.2.0
FEHLER: Nicht abgefangener Fehler: <b>ConstraintError</b>:ConstraintError: column name is not unique

calibre 1.2 isfrozen: True is64bit: False
Windows-7-6.1.7601-SP1 Windows ('32bit', 'WindowsPE')
('Windows', '7', '6.1.7601')
Python 2.7.4
Windows: ('7', '6.1.7601', 'SP1', 'Multiprocessor Free')
Traceback (most recent call last):
  File "site-packages\calibre\gui2\metadata\single.py", line 526, in next_clicked
  File "site-packages\calibre\gui2\metadata\single.py", line 469, in apply_changes
  File "site-packages\calibre\gui2\metadata\basic_widgets.py", line 1425, in commit
  File "site-packages\calibre\db\legacy.py", line 792, in func
  File "site-packages\calibre\db\cache.py", line 56, in ans
  File "site-packages\calibre\db\cache.py", line 939, in set_field
  File "site-packages\calibre\db\write.py", line 505, in set_books
  File "site-packages\calibre\db\write.py", line 289, in many_one
  File "site-packages\calibre\db\write.py", line 264, in change_case
  File "site-packages\calibre\db\backend.py", line 291, in executemany
  File "c:\cygwin\home\kovid\sw\build\apsw-3.7.17-r1\src\cursor.c", line 231, in resetcursor
ConstraintError: ConstraintError: column name is not unique

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers