mirror of
https://github.com/sqlite/sqlite.git
synced 2026-10-23 21:49:02 +03:00
58 lines
1.2 KiB
Plaintext
58 lines
1.2 KiB
Plaintext
# 2026-08-21
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#***********************************************************************
|
|
#
|
|
#
|
|
|
|
source [file join [file dirname [info script]] vec1_common.tcl]
|
|
set testprefix vec1corrupt
|
|
vec1_load db
|
|
|
|
do_execsql_test 1.0 {
|
|
CREATE VIRTUAL TABLE v1 USING vec1;
|
|
WITH s(i) AS (
|
|
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<100
|
|
)
|
|
INSERT INTO v1(rowid, vector) SELECT NULL, random_vector(128) FROM s;
|
|
|
|
INSERT INTO v1(cmd, arg) VALUES('rebuild', '{index:"flat"}');
|
|
}
|
|
|
|
do_execsql_test 1.1 {
|
|
PRAGMA integrity_check
|
|
} {ok}
|
|
|
|
do_execsql_test 1.2 {
|
|
UPDATE v1_idx SET val = unhex(
|
|
substr( hex(val), 1, 8 ) || '40' || substr( hex(val), 11 )
|
|
);
|
|
} {}
|
|
|
|
do_catchsql_test 1.3 {
|
|
SELECT count(rowid) FROM v1( random_vector(128), 100 );
|
|
} {1 {database disk image is malformed}}
|
|
|
|
do_execsql_test 1.3 {
|
|
PRAGMA integrity_check
|
|
} {{v1: %_idx entry id=1 is corrupt}}
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
finish_test
|
|
|