unblock aux failures for now

This commit is contained in:
Alex Garcia 2024-11-19 15:21:33 -08:00
parent 7b67c78530
commit d0993b7496
3 changed files with 16 additions and 13 deletions

View file

@ -8188,7 +8188,7 @@ int vec0Update_Insert(sqlite3_vtab *pVTab, int argc, sqlite3_value **argv,
int v_type = sqlite3_value_type(v); int v_type = sqlite3_value_type(v);
if(v_type != SQLITE_NULL && (v_type != p->auxiliary_columns[auxiliary_key_idx].type)) { if(v_type != SQLITE_NULL && (v_type != p->auxiliary_columns[auxiliary_key_idx].type)) {
sqlite3_finalize(stmt); sqlite3_finalize(stmt);
rc = SQLITE_ERROR; rc = SQLITE_CONSTRAINT;
vtab_set_error( vtab_set_error(
pVTab, pVTab,
"Auxiliary column type mismatch: The auxiliary column %.*s has type %s, but %s was provided.", "Auxiliary column type mismatch: The auxiliary column %.*s has type %s, but %s was provided.",

View file

@ -409,25 +409,25 @@
# --- # ---
# name: test_types.3 # name: test_types.3
dict({ dict({
'error': 'OperationalError', 'error': 'IntegrityError',
'message': 'Auxiliary column type mismatch: The auxiliary column aux_int has type INTEGER, but TEXT was provided.', 'message': 'Auxiliary column type mismatch: The auxiliary column aux_int has type INTEGER, but TEXT was provided.',
}) })
# --- # ---
# name: test_types.4 # name: test_types.4
dict({ dict({
'error': 'OperationalError', 'error': 'IntegrityError',
'message': 'Auxiliary column type mismatch: The auxiliary column aux_float has type FLOAT, but TEXT was provided.', 'message': 'Auxiliary column type mismatch: The auxiliary column aux_float has type FLOAT, but TEXT was provided.',
}) })
# --- # ---
# name: test_types.5 # name: test_types.5
dict({ dict({
'error': 'OperationalError', 'error': 'IntegrityError',
'message': 'Auxiliary column type mismatch: The auxiliary column aux_text has type TEXT, but INTEGER was provided.', 'message': 'Auxiliary column type mismatch: The auxiliary column aux_text has type TEXT, but INTEGER was provided.',
}) })
# --- # ---
# name: test_types.6 # name: test_types.6
dict({ dict({
'error': 'OperationalError', 'error': 'IntegrityError',
'message': 'Auxiliary column type mismatch: The auxiliary column aux_blob has type BLOB, but INTEGER was provided.', 'message': 'Auxiliary column type mismatch: The auxiliary column aux_blob has type BLOB, but INTEGER was provided.',
}) })
# --- # ---

View file

@ -49,13 +49,15 @@ def test_types(db, snapshot):
) )
assert exec(db, "select * from v") == snapshot() assert exec(db, "select * from v") == snapshot()
INSERT = "insert into v(vector, aux_int, aux_float, aux_text, aux_blob) values (?, ?, ?, ?, ?)" INSERT = "insert into v(vector, aux_int, aux_float, aux_text, aux_blob) values (?, ?, ?, ?, ?)"
assert ( assert (
exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 1.22, "text", b"blob"]) == snapshot() exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 1.22, "text", b"blob"]) == snapshot()
) )
assert exec(db, "select * from v") == snapshot() assert exec(db, "select * from v") == snapshot()
# TODO: integrity test transaction failures in shadow tables
db.commit()
# bad types # bad types
db.execute("BEGIN")
assert ( assert (
exec(db, INSERT, [b"\x11\x11\x11\x11", "not int", 1.2, "text", b"blob"]) exec(db, INSERT, [b"\x11\x11\x11\x11", "not int", 1.2, "text", b"blob"])
== snapshot() == snapshot()
@ -66,6 +68,7 @@ def test_types(db, snapshot):
) )
assert exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 1.2, 1, b"blob"]) == snapshot() assert exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 1.2, 1, b"blob"]) == snapshot()
assert exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 1.2, "text", 1]) == snapshot() assert exec(db, INSERT, [b"\x11\x11\x11\x11", 1, 1.2, "text", 1]) == snapshot()
db.execute("ROLLBACK")
# NULLs are totally chill # NULLs are totally chill
assert exec(db, INSERT, [b"\x11\x11\x11\x11", None, None, None, None]) == snapshot() assert exec(db, INSERT, [b"\x11\x11\x11\x11", None, None, None, None]) == snapshot()