Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sqlite-vec.c
Original file line number Diff line number Diff line change
Expand Up @@ -9576,7 +9576,7 @@ int vec0Update_Delete_ClearValidity(vec0_vtab *p, i64 chunk_id,
p->schemaName, p->shadowChunksName, chunk_id, validityOffset);
goto cleanup;
}
if (!(bx >> (chunk_offset % CHAR_BIT))) {
if (!((bx >> (chunk_offset % CHAR_BIT)) & 1)) {
// IMP: V21193_05263
rc = SQLITE_ERROR;
vtab_set_error(
Expand Down
8 changes: 8 additions & 0 deletions tests/test-loadable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,14 @@ def test_vec0_delete_errors():
):
db.execute("delete from t1 where rowid = 1")
db.rollback()
# only the row's own bit counts, not a higher one in the same byte
db.execute("begin")
db.execute("UPDATE t1_chunks SET validity = x'02'")
with _raises(
"vec0 deletion error: validity bit is not set for main.t1_chunks.1 at 0"
):
db.execute("delete from t1 where rowid = 1")
db.rollback()

# EVIDENCE-OF: V21193_05263 vec0 DELETE raises error on validity blob error
db.commit()
Expand Down