Repository navigation
Conversation
vec0Update_Delete_ClearValidity() tested `bx >> (chunk_offset % CHAR_BIT)`, which is nonzero whenever a later row's bit in the same byte of the chunk's validity bitmap is set. Deleting a row whose own bit was already clear therefore succeeded instead of failing with "validity bit is not set". Only a damaged _chunks table has such a row. The check now tests the row's bit alone, `(bx >> (chunk_offset % CHAR_BIT)) & 1`. Ported from photostructure/sqlite-vec@f6a3244 by Matthew McEachen. test_vec0_delete_errors sets a chunk's validity byte to x'02', clearing row 1's bit while row 2's stays set, and expects the delete of row 1 to fail. It fails on main and passes here. The full suite passes (239 passed, 66 skipped, 204 snapshots).
This was referenced Oct 24, 2026
This branch has not been deployed
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.
vec0Update_Delete_ClearValidity()checks a row's validity bit withbx >> (chunk_offset % CHAR_BIT), which is nonzero whenever a later row's bit in the same byte of the chunk's validity bitmap is set. A DELETE of a row whose own bit is already clear therefore succeeds instead of failing with "validity bit is not set". Only a damaged_chunkstable has such a row:The check now tests the row's bit alone,
(bx >> (chunk_offset % CHAR_BIT)) & 1. This is photostructure/sqlite-vec@f6a3244 by Matthew McEachen, ported.test_vec0_delete_errorsgains that case, which fails on main and passes here. The full suite passes (239 passed, 66 skipped, 204 snapshots), also with vec0 built with AddressSanitizer and UBSan. It merges cleanly with each of our open PRs here.The same change is open on vlasky's fork as vlasky#25.