Repository navigation
Deleting a book wipes shared text/enumeration custom column values from all books - #1669
Open
wheezer256 wants to merge 1 commit into
Open
wheezer256 wants to merge 1 commit into
wheezer256 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Deleting a single book from the web UI removes that book's value of any single-value text or enumeration custom column from every other book in the library.
In
delete_whole_book(), the fallthroughelse:branch for non-multiple custom columns doescalibre_db.session.delete(del_cc). Fortextandenumerationcolumns,del_ccis not a per-book row: it is the shared value row incustom_column_N, linked to books throughbooks_custom_column_N_link. Deleting it orphans the link for every book that carried that value.Reproduce
#topicwith valuesFantasyandRomance.#topic = Fantasyon books A, B and C.#topic, andFantasyis gone fromcustom_column_N.We hit this on a real library. Three UI deletes cleared the category from 233 books. An earlier single delete cleared it from about 2000 books.
Fix
Apply the guard the
ratingbranch already uses. A shared (normalized) value row is deleted only when no other book links to it.datetimeandcommentsvalues are per-book rows, so they are still deleted as before.Verified
Ran with the patch applied in a live instance. Deleting one book with
#topic = Historical Fictionfrom the UI removed only that book. The other 49 books kept the value.(Note:
'int'is in the per-book tuple becausedb.pynames that datatype'int', while the numeric branch above checks'integer', so integer columns reach this branch. Those rows havebook, notbooks.)