1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-23 21:49:02 +03:00

Fix integrity-check fails that would occur if the database contained a contentless fts4 table. Report [bugs:/info/2026-10-02T12:22:03Z | 2026-10-02T12:22:03Z].

FossilOrigin-Name: ca8de9a30484d26739a09c972c525a1ae6edcce41b0f3c612805836b894c7a26
This commit is contained in:
dan
2026-10-02 14:33:50 +00:00
parent 9696acb0c7
commit cb5651e46d
4 changed files with 47 additions and 11 deletions

View File

@@ -5329,6 +5329,7 @@ int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk){
u64 cksum1 = 0; /* Checksum based on FTS index contents */
u64 cksum2 = 0; /* Checksum based on %_content contents */
sqlite3_stmt *pAllLangid = 0; /* Statement to return all language-ids */
int bContentless = (p->zContentTbl && p->zContentTbl[0]=='\0');
/* This block calculates the checksum according to the FTS index. */
rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0);
@@ -5348,7 +5349,7 @@ int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk){
}
/* This block calculates the checksum according to the %_content table */
if( rc==SQLITE_OK ){
if( rc==SQLITE_OK && !bContentless ){
sqlite3_tokenizer_module const *pModule = p->pTokenizer->pModule;
sqlite3_stmt *pStmt = 0;
char *zSql;
@@ -5406,7 +5407,7 @@ int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk){
rc = SQLITE_OK;
*pbOk = 0;
}else{
*pbOk = (rc==SQLITE_OK && cksum1==cksum2);
*pbOk = (rc==SQLITE_OK && (bContentless || cksum1==cksum2));
}
return rc;
}

View File

@@ -1,5 +1,5 @@
C Change\sthe\sway\sthe\ssession\smodule\sapplies\schangesets\scontaining\stwo\sor\smore\sUPDATE\schanges\sthat\sform\sa\sdependency\sloop\sin\sorder\sto\savoid\striggering\sON\sDELETE\sCASCADE\sactions.
D 2026-10-01T16:48:03.866
C Fix\sintegrity-check\sfails\sthat\swould\soccur\sif\sthe\sdatabase\scontained\sa\scontentless\sfts4\stable.\sReport\s[bugs:/info/2026-10-02T12:22:03Z\s|\s2026-10-02T12:22:03Z].
D 2026-10-02T14:33:50.451
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -98,7 +98,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
F ext/fts3/fts3_tokenizer1.c c1de4ae28356ad98ccb8b2e3388a7fdcce7607b5523738c9afb6275dab765154
F ext/fts3/fts3_unicode.c de426ff05c1c2e7bce161cf6b706638419c3a1d9c2667de9cb9dc0458c18e226
F ext/fts3/fts3_unicode2.c 416eb7e1e81142703520d284b768ca2751d40e31fa912cae24ba74860532bf0f
F ext/fts3/fts3_write.c 414cec5ccb3c24afe66e666f712c459132140050b082cc998c28ac213f6b02f9
F ext/fts3/fts3_write.c 424a54187c6a60203c00abd92c575d4b4f3d01163897b3b7355b1a0e49086508
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73
F ext/fts3/tool/fts3view.c 4fea96ea2c2d434acb50f30554c30de23eeed5847fe4656470e2ebe5113e4d58
@@ -1281,7 +1281,7 @@ F test/fts3tok_err.test 52273cd193b9036282f7bacb43da78c6be87418d
F test/fts3varint.test 0b84a3fd4eba8a39f3687523804d18f3b322e6d4539a55bf342079c3614f2ada
F test/fts4aa.test 0e6bfd6a81695a39b23e448dda25d864e63dda75bde6949c45ddc95426c6c3f5
F test/fts4check.test f0ea5e5581951d8ef7a341eea14486daf6c5f516a2f3273b0d5e8cb8a6cd3bd2
F test/fts4content.test 7f441866207f5b1e76e0f18bde5d9925d1ee8f60388054613dd14a29a79f0bc4
F test/fts4content.test 1bd518b1fed857d875ff2bda2c55971080878a29c18171eb43258d5758502d3a
F test/fts4docid.test e33c383cfbdff0284685604d256f347a18fdbf01
F test/fts4growth.test 289833c34ad45a5e6e6133b53b6a71647231fb89d36ddcb8d9c87211b6721d7f
F test/fts4growth2.test 13ad4e76451af6e6906c95cdc725d01b00044269
@@ -2278,9 +2278,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
P 92709f54d4c58cf174f305b58971a01878af313157a11549b588a25216701f5c 05acfd4dc9a31b9437b44cd8ca13df9f0c54d53af05d601bde537303dff92435
R 01b4f9c6adac20ba9a351cd0e8678cd1
T +closed 05acfd4dc9a31b9437b44cd8ca13df9f0c54d53af05d601bde537303dff92435
P 99aab2c99220a3814124a57653e6627aa91c24459bf4eb87e69c9ed0b3378a0c
R 09f79f8f3e6531210ce5a559571d7e2a
U dan
Z 51b291a22181f1e943012b3024ddbf15
Z 2851b7404766dff34f76803f1668fc50
# Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
99aab2c99220a3814124a57653e6627aa91c24459bf4eb87e69c9ed0b3378a0c
ca8de9a30484d26739a09c972c525a1ae6edcce41b0f3c612805836b894c7a26

View File

@@ -728,4 +728,40 @@ do_test 13.2.2 {
} msg] $msg
} {1 {(1) unsafe use of virtual table "aa"}}
#---------------------------------------------------------------------------
# Test integrity-check on a contentless table.
#
reset_db
do_execsql_test 14.0 {
CREATE VIRTUAL TABLE ft USING fts3(x, content='');
}
do_execsql_test 14.1 {
PRAGMA integrity_check
} {ok}
do_execsql_test 14.2 {
PRAGMA table_info = ft;
} {
0 x {} 0 {} 0
1 content {} 0 {} 0
}
do_execsql_test 14.3 {
CREATE VIRTUAL TABLE a USING fts4(x, content='');
}
do_execsql_test 14.4 {
PRAGMA table_info = a;
} {
0 x {} 0 {} 0
}
do_execsql_test 14.5 {
PRAGMA integrity_check
} {ok}
do_execsql_test 14.6 {
INSERT INTO a(rowid, x) VALUES(1, 'one two three');
INSERT INTO a(rowid, x) VALUES(2, 'three two one');
} {}
do_execsql_test 14.7 {
PRAGMA integrity_check
} {ok}
finish_test