From 726b2db5112bebc4ab1429b600cb9009bb8480be Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 29 May 2025 20:33:39 +0000 Subject: [PATCH 01/17] Fix the missing -lm link flag for the sqlite3 shell when building the autoconf bundle with --disable-static-shell, as reported in [forum:5adf1c932a | forum post 5adf1c932a]. FossilOrigin-Name: 80d5a9daa6b34b628d6b5ef8b852d0a29a71fda46dd797091d9cdd3342037a9c --- autoconf/Makefile.in | 2 +- manifest | 25 ++++++++++++++----------- manifest.uuid | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index aaa23b7def..a77386faed 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -224,7 +224,7 @@ install: install-lib # ENABLE_STATIC_SHELL = @ENABLE_STATIC_SHELL@ sqlite3-shell-link-flags.1 = $(TOP)/sqlite3.c $(LDFLAGS.libsqlite3) -sqlite3-shell-link-flags.0 = -L. -lsqlite3 $(LDFLAGS.zlib) +sqlite3-shell-link-flags.0 = -L. -lsqlite3 $(LDFLAGS.zlib) $(LDFLAGS.math) sqlite3-shell-deps.1 = $(TOP)/sqlite3.c sqlite3-shell-deps.0 = $(libsqlite3.DLL) # diff --git a/manifest b/manifest index e40c550bc5..bcfa57b125 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Version\s3.50.0 -D 2025-05-29T14:26:00.000 +C Fix\sthe\smissing\s-lm\slink\sflag\sfor\sthe\ssqlite3\sshell\swhen\sbuilding\sthe\sautoconf\sbundle\swith\s--disable-static-shell,\sas\sreported\sin\s[forum:5adf1c932a\s|\sforum\spost\s5adf1c932a]. +D 2025-05-29T20:33:39.940 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -17,7 +17,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 F auto.def 82c32443a91c1062f7a48beec37dbb2d8d03447b1286bce8df5ebb6d8d353f8a F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in 36516827bb5d2309422bbcbf53e873fa22ef179f5c25b1d3dc6a7255e63270b7 +F autoconf/Makefile.in d0926d2309e563b5ebdfd711e5c218533acab79829a05eef4e97c3a92e17bf42 F autoconf/Makefile.msc f15ad424ca2820df8e39d9157965710af0a64d87773706706a12ea4f96e3a0d8 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt b749816b8452b3af994dc6d607394bef3df1736d7e09359f1087de8439a52807 @@ -2207,12 +2207,15 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f037ca064daeb81cb386da2a372d8e2d2dce55a3a13bc7bea4968ca51bf2843a -R fc3e14ac4195ac71d03a1c1ffcef6f5e -T +bgcolor * green -T +sym-major-release * -T +sym-release * -T +sym-version-3.50.0 * -U drh -Z 5eb6447fe81d0ef07434d8f3c30d7b86 +P dfc790f998f450d9c35e3ba1c8c89c17466cb559f87b0239e4aab9d34e28f742 +Q +e6bf6b1b31a260b27b487fda9b7057066aa0a0445f6dadec18a4e2f93ab928f9 +R 6a3363f98db2c88adb39a14f695cabb9 +T *branch * branch-3.50 +T *sym-branch-3.50 * +T -sym-major-release * Cancelled\sby\sbranch. +T -sym-release * Cancelled\sby\sbranch. +T -sym-trunk * Cancelled\sby\sbranch. +T -sym-version-3.50.0 * Cancelled\sby\sbranch. +U stephan +Z 11e50d16300da88b02cc1ceaf16ccada # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 819b683fc3..f775fcdcaf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dfc790f998f450d9c35e3ba1c8c89c17466cb559f87b0239e4aab9d34e28f742 +80d5a9daa6b34b628d6b5ef8b852d0a29a71fda46dd797091d9cdd3342037a9c From 8dcef6c9258ec3dbbc7c6e9c1a41ace814e85b0b Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 30 May 2025 10:18:47 +0000 Subject: [PATCH 02/17] Squelch an interesting but harmless struct initialization warning emitted after an emsdk update. Fix JS breakage introduced by changes in Emscripten 4.0.7: manually export the HEAPxyz symbols which used to be exposed by default. FossilOrigin-Name: 042c6c6e9568f2ccd14b39812393e71481d04c42d768b4b56f71c02daad6b470 --- ext/wasm/GNUmakefile | 8 +++++--- ext/wasm/api/sqlite3-wasm.c | 2 +- manifest | 22 ++++++++-------------- manifest.uuid | 2 +- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index ec258099fc..6470fd6308 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -410,7 +410,7 @@ DISTCLEAN_FILES += $(bin.stripccomments) # -D... flags which should be included in all invocations should be # appended to $(SQLITE.CALL.C-PP.FILTER.global). bin.c-pp := ./c-pp -$(bin.c-pp): c-pp.c $(sqlite3.c) $(MAKEFILE) +$(bin.c-pp): c-pp.c $(sqlite3.c) # $(MAKEFILE) $(CC) -O0 -o $@ c-pp.c $(sqlite3.c) '-DCMPP_DEFAULT_DELIM="//#"' -I$(dir.top) \ -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_UTF16 \ -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_WAL -DSQLITE_THREADSAFE=0 \ @@ -597,6 +597,9 @@ emcc.flags += -v # -v is _very_ loud but also informative about what it's doing endif + +# wasmMemory ==> required by our code for use with -sIMPORTED_MEMORY +# Emscripten 4.0.7 (2025-04-15) stops exporting HEAP* by default ######################################################################## # emcc flags for .c/.o. emcc.cflags := @@ -615,8 +618,7 @@ emcc.jsflags += -sDYNAMIC_EXECUTION=0 emcc.jsflags += -sNO_POLYFILL emcc.jsflags += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.api) emcc.exportedRuntimeMethods := \ - -sEXPORTED_RUNTIME_METHODS=wasmMemory - # wasmMemory ==> required by our code for use with -sIMPORTED_MEMORY + -sEXPORTED_RUNTIME_METHODS=wasmMemory,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAP64,HEAPU64 emcc.jsflags += $(emcc.exportedRuntimeMethods) emcc.jsflags += -sUSE_CLOSURE_COMPILER=0 emcc.jsflags += -sIMPORTED_MEMORY diff --git a/ext/wasm/api/sqlite3-wasm.c b/ext/wasm/api/sqlite3-wasm.c index d9f0f08ebd..1850d313cb 100644 --- a/ext/wasm/api/sqlite3-wasm.c +++ b/ext/wasm/api/sqlite3-wasm.c @@ -1157,7 +1157,7 @@ const char * sqlite3__wasm_enum_json(void){ { /* Validate that the above struct sizeof()s match ** expectations. We could improve upon this by ** checking the offsetof() for each member. */ - const sqlite3_index_info siiCheck; + const sqlite3_index_info siiCheck = {0}; #define IndexSzCheck(T,M) \ (sizeof(T) == sizeof(*siiCheck.M)) if(!IndexSzCheck(sqlite3_index_constraint,aConstraint) diff --git a/manifest b/manifest index bcfa57b125..e57854733b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\smissing\s-lm\slink\sflag\sfor\sthe\ssqlite3\sshell\swhen\sbuilding\sthe\sautoconf\sbundle\swith\s--disable-static-shell,\sas\sreported\sin\s[forum:5adf1c932a\s|\sforum\spost\s5adf1c932a]. -D 2025-05-29T20:33:39.940 +C Squelch\san\sinteresting\sbut\sharmless\sstruct\sinitialization\swarning\semitted\safter\san\semsdk\supdate.\sFix\sJS\sbreakage\sintroduced\sby\schanges\sin\sEmscripten\s4.0.7:\smanually\sexport\sthe\sHEAPxyz\ssymbols\swhich\sused\sto\sbe\sexposed\sby\sdefault. +D 2025-05-30T10:18:47.623 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -621,7 +621,7 @@ F ext/session/sqlite3session.c 6b0877fe1ab832aa4b85eaca72606dfd1630a1363a1be7af1 F ext/session/sqlite3session.h 9bb1a6687b467764b35178dc29bbd2c57ab8cd3acdc8a62f088c34ad17e4fe2b F ext/session/test_session.c 2ddff73ea368d827028c32851b291416e1008845832feb27b751d15e57e13cc3 F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 24d7e6f446528fa67f5ade6c3c7d7e46e1ac52649d6264cbe24539c1dab608e1 +F ext/wasm/GNUmakefile d6b869cf3d3eaaec8cf56adf925910c3e443f455562bcb4a4cd2d1e43c933d8d F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a F ext/wasm/README.md b89605f65661cf35bf034ff6d43e448cc169b8017fc105d498e33b81218b482c F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff @@ -650,7 +650,7 @@ F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 0f68a64e508598910e7c01214ae27d603dfc8baec6a184506fafac603a901931 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 4ab0704ee198de7d1059eccedc7703c931510b588d10af0ee36ea5b3ebbac284 F ext/wasm/api/sqlite3-vtab-helper.c-pp.js e809739d71e8b35dfe1b55d24d91f02d04239e6aef7ca1ea92a15a29e704f616 -F ext/wasm/api/sqlite3-wasm.c 6a4cd40267eaf08400895c5b9de39c56976c3b97b3c1bbe53fc2e80fa074e9c7 +F ext/wasm/api/sqlite3-wasm.c 7ea3d4a286a2241f6fcc65c9ff10fc04ee5590f80f40763a57001dd5e93aa4c4 F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc65debfe43b81fc39fb25c40ad0cc1946bd82580fbf644351107b544d6177ee F ext/wasm/api/sqlite3-worker1.c-pp.js 5e8706c2c4af2a57fbcdc02f4e7ef79869971bc21bb8ede777687786ce1c92d5 F ext/wasm/batch-runner-sahpool.html e9a38fdeb36a13eac7b50241dfe7ae066fe3f51f5c0b0151e7baee5fce0d07a7 @@ -2207,15 +2207,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P dfc790f998f450d9c35e3ba1c8c89c17466cb559f87b0239e4aab9d34e28f742 -Q +e6bf6b1b31a260b27b487fda9b7057066aa0a0445f6dadec18a4e2f93ab928f9 -R 6a3363f98db2c88adb39a14f695cabb9 -T *branch * branch-3.50 -T *sym-branch-3.50 * -T -sym-major-release * Cancelled\sby\sbranch. -T -sym-release * Cancelled\sby\sbranch. -T -sym-trunk * Cancelled\sby\sbranch. -T -sym-version-3.50.0 * Cancelled\sby\sbranch. +P 80d5a9daa6b34b628d6b5ef8b852d0a29a71fda46dd797091d9cdd3342037a9c +Q +10d0897cc9a5998fe1344cfbb242a78b59012e29aa3b1993895dfac26721b053 +R e73a3e5bcb8a71552be6d104fe0baf90 U stephan -Z 11e50d16300da88b02cc1ceaf16ccada +Z 328644467dfbd0a3495b11a1d524faf1 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f775fcdcaf..c3e3215872 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -80d5a9daa6b34b628d6b5ef8b852d0a29a71fda46dd797091d9cdd3342037a9c +042c6c6e9568f2ccd14b39812393e71481d04c42d768b4b56f71c02daad6b470 From 4cb03d18a41ecf9066cafb542bbc7dada20758b2 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 30 May 2025 11:00:57 +0000 Subject: [PATCH 03/17] Extend the fix for ticket 623eff57e76d45f6]so that it covers RIGHT JOIN in addition to LEFT JOIN. FossilOrigin-Name: cbd9aabaa5f54434c7b744cc9bb439cc702e35d74397d7157f7f06bdf67d8b14 --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/wherecode.c | 9 +++++---- test/join.test | 15 +++++++++++++++ 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index e57854733b..3701dd4f2a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Squelch\san\sinteresting\sbut\sharmless\sstruct\sinitialization\swarning\semitted\safter\san\semsdk\supdate.\sFix\sJS\sbreakage\sintroduced\sby\schanges\sin\sEmscripten\s4.0.7:\smanually\sexport\sthe\sHEAPxyz\ssymbols\swhich\sused\sto\sbe\sexposed\sby\sdefault. -D 2025-05-30T10:18:47.623 +C Extend\sthe\sfix\sfor\sticket\s623eff57e76d45f6]so\sthat\sit\scovers\sRIGHT\sJOIN\nin\saddition\sto\sLEFT\sJOIN. +D 2025-05-30T11:00:57.535 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -871,7 +871,7 @@ F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014 F src/where.c 45a3b496248a0b36d91ce34da3278d54f8fa20e9d3fbd36d45a42051d1118137 F src/whereInt.h ecdbfb5551cf394f04ec7f0bc7ad963146d80eee3071405ac29aa84950128b8e -F src/wherecode.c 8825756ea7b1a49ac830719d28557c638520bb2434fe9c2dd6c7f584034bfe32 +F src/wherecode.c 65670d1ef85ef54a4db3826d63be8b646c9ac280962166b645950901ed1bda29 F src/whereexpr.c 2415c8eee5ff89a8b709d7d83d71c1ff986cd720d0520057e1d8a5371339012a F src/window.c d01227141f622f24fbe36ca105fbe6ef023f9fd98f1ccd65da95f88886565db5 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 @@ -1361,7 +1361,7 @@ F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c F test/ioerr5.test 5984da7bf74b6540aa356f2ab0c6ae68a6d12039a3d798a9ac6a100abc17d520 F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b F test/istrue.test e7f285bb70282625c258e866ce6337d4c762922f5a300e1b50f958aef6e7d9c9 -F test/join.test 0cc86e5fd579780b98cc01c9d6fc5b69f6ecc777f1c4daa501a14d1a74f56a6b +F test/join.test aca62194ad41b522c55577e0e1bd99da6d5436827225aa850801c36e5f4cc914 F test/join2.test f59d63264fb24784ae9c3bc9d867eb569cd6d442da5660f8852effe5c1938c27 F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0 F test/join4.test 1a352e4e267114444c29266ce79e941af5885916 @@ -2207,9 +2207,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 80d5a9daa6b34b628d6b5ef8b852d0a29a71fda46dd797091d9cdd3342037a9c -Q +10d0897cc9a5998fe1344cfbb242a78b59012e29aa3b1993895dfac26721b053 -R e73a3e5bcb8a71552be6d104fe0baf90 -U stephan -Z 328644467dfbd0a3495b11a1d524faf1 +P 042c6c6e9568f2ccd14b39812393e71481d04c42d768b4b56f71c02daad6b470 +Q +29b1e1b97619d03a97ef562a5707929e241d019179b4ff1d0bc2a8c008441431 +R 22d633d49411fe41ad7e5292408c487a +U drh +Z 5f5d2cf050c20b9d8f8b2fb92fb26d08 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c3e3215872..56fb9a951f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -042c6c6e9568f2ccd14b39812393e71481d04c42d768b4b56f71c02daad6b470 +cbd9aabaa5f54434c7b744cc9bb439cc702e35d74397d7157f7f06bdf67d8b14 diff --git a/src/wherecode.c b/src/wherecode.c index 95b12b77ae..8e3e56cb18 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -2201,12 +2201,13 @@ Bitmask sqlite3WhereCodeOneLoopStart( if( pLevel->iLeftJoin==0 ){ /* If a partial index is driving the loop, try to eliminate WHERE clause ** terms from the query that must be true due to the WHERE clause of - ** the partial index. + ** the partial index. This optimization does not work on an outer join, + ** as shown by: ** - ** 2019-11-02 ticket 623eff57e76d45f6: This optimization does not work - ** for a LEFT JOIN. + ** 2019-11-02 ticket 623eff57e76d45f6 (LEFT JOIN) + ** 2025-05-29 forum post 7dee41d32506c4ae (RIGHT JOIN) */ - if( pIdx->pPartIdxWhere ){ + if( pIdx->pPartIdxWhere && pLevel->pRJ==0 ){ whereApplyPartialIndexConstraints(pIdx->pPartIdxWhere, iCur, pWC); } }else{ diff --git a/test/join.test b/test/join.test index b34136f5dd..ecd7bb2b5d 100644 --- a/test/join.test +++ b/test/join.test @@ -1002,6 +1002,21 @@ do_execsql_test join-20.2 { SELECT * FROM t0 LEFT JOIN t1 WHERE NULL IN (c1); } {} +# 2025-05-29 forum post 7dee41d32506c4ae +# The complaint in the forum post appears to be the same as for the +# ticket on 2019-11-02, only for RIGHT JOIN instead of LEFT JOIN. Note +# that RIGHT JOIN did not yet exist in SQLite when the ticket was +# written and fixed. +# +do_execsql_test join-20.3 { + DROP TABLE t1; + CREATE TABLE t1(x INT); INSERT INTO t1(x) VALUES(1); + CREATE TABLE t2(y BOOLEAN); INSERT INTO t2(y) VALUES(false); + CREATE TABLE t3(z INT); INSERT INTO t3(z) VALUES(3); + CREATE INDEX t2y ON t2(y) WHERE y; + SELECT quote(z) FROM t1 RIGHT JOIN t2 ON y LEFT JOIN t3 ON y; +} {NULL} + # 2019-11-30 ticket 7f39060a24b47353 # Do not allow a WHERE clause term to qualify a partial index on the # right table of a LEFT JOIN. From 175c3582f016ad4934492ebd912fccfe63e270e7 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 30 May 2025 11:55:07 +0000 Subject: [PATCH 04/17] Add "include <stddef.h>" to fts5 and rtree to ensure that they use the system version of the offsetof() macro when it is available, as the built-in version triggers ubsan errors with clang. FossilOrigin-Name: 6ceb1322ef10c1586a7ca97b377dce0c6e35d9abbdbff5a01e841a487eac08cb --- ext/fts5/fts5Int.h | 1 + ext/rtree/rtree.c | 2 ++ manifest | 16 ++++++++-------- manifest.uuid | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ext/fts5/fts5Int.h b/ext/fts5/fts5Int.h index 2da347862e..7ad1cc16bd 100644 --- a/ext/fts5/fts5Int.h +++ b/ext/fts5/fts5Int.h @@ -20,6 +20,7 @@ SQLITE_EXTENSION_INIT1 #include #include +#include #ifndef SQLITE_AMALGAMATION diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c index f90fd5a0ab..d8567b65ac 100644 --- a/ext/rtree/rtree.c +++ b/ext/rtree/rtree.c @@ -64,6 +64,8 @@ #endif int sqlite3GetToken(const unsigned char*,int*); /* In the SQLite core */ +#include + /* ** If building separately, we will need some setup that is normally ** found in sqliteInt.h diff --git a/manifest b/manifest index 3701dd4f2a..c9d36ac651 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Extend\sthe\sfix\sfor\sticket\s623eff57e76d45f6]so\sthat\sit\scovers\sRIGHT\sJOIN\nin\saddition\sto\sLEFT\sJOIN. -D 2025-05-30T11:00:57.535 +C Add\s"include\s<stddef.h>"\sto\sfts5\sand\srtree\sto\sensure\sthat\sthey\suse\sthe\nsystem\sversion\sof\sthe\soffsetof()\smacro\swhen\sit\sis\savailable,\sas\sthe\nbuilt-in\sversion\striggers\subsan\serrors\swith\sclang. +D 2025-05-30T11:55:07.037 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -108,7 +108,7 @@ F ext/fts3/unicode/mkunicode.tcl cbf5f7b5c8ce8014bad731f246f2e520eece908465de477 F ext/fts3/unicode/parseunicode.tcl a981bd6466d12dd17967515801c3ff23f74a281be1a03cf1e6f52a6959fc77eb F ext/fts5/extract_api_docs.tcl 009cf59c77afa86d137b0cca3e3b1a5efbe2264faa2df233f9a7aa8563926d15 F ext/fts5/fts5.h ff5d3cc88b29e41612bfb29eb723e29e38973de62ca75ba3e8f94ccb67f5b5f2 -F ext/fts5/fts5Int.h bffbd0acdcdf509899681f4e1cfeef1c955030acd9fe15ff9082410f80c3bead +F ext/fts5/fts5Int.h 4c7380ce83e8f6b5b3216ebe2b33093a20fa72e832a88d14023f827b7d8b9933 F ext/fts5/fts5_aux.c da4a7a9a11ec15c6df0699d908915a209bcde48f0b04101461316b59f71abffb F ext/fts5/fts5_buffer.c f1e6d0324d7c55329d340673befc26681a372a4d36086caa8d1ec7d7c53066c7 F ext/fts5/fts5_config.c e7d8dd062b44a66cd77e5a0f74f23a2354cd1f3f8575afb967b2773c3384f7f8 @@ -539,7 +539,7 @@ F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c3350 F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c F ext/rtree/README 734aa36238bcd2dee91db5dba107d5fcbdb02396612811377a8ad50f1272b1c1 F ext/rtree/geopoly.c f0573d5109fdc658a180db0db6eec86ab2a1cf5ce58ec66cbf3356167ea757eb -F ext/rtree/rtree.c f12180fbc79f4de3dcb93afe55a64703481a23af7f80d1e988d2cb97afd07b6b +F ext/rtree/rtree.c 811edc5c2f3e13dcee825a8ec6f2ebe29b34bdb0186184d75d461621173638fa F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412 F ext/rtree/rtree1.test e0608db762b2aadca0ecb6f97396cf66244490adc3ba88f2a292b27be3e1da3e F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d @@ -2207,9 +2207,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 042c6c6e9568f2ccd14b39812393e71481d04c42d768b4b56f71c02daad6b470 -Q +29b1e1b97619d03a97ef562a5707929e241d019179b4ff1d0bc2a8c008441431 -R 22d633d49411fe41ad7e5292408c487a +P cbd9aabaa5f54434c7b744cc9bb439cc702e35d74397d7157f7f06bdf67d8b14 +Q +838deb7f3423df84061a043928ed34e1d74e2e7d57ef1a9519bb32fea82e4352 +R 929bd7d6d83081dd481eea9142699e65 U drh -Z 5f5d2cf050c20b9d8f8b2fb92fb26d08 +Z 87282ecf773192a5340ad31d2e91ef55 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 56fb9a951f..93b77a67d1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cbd9aabaa5f54434c7b744cc9bb439cc702e35d74397d7157f7f06bdf67d8b14 +6ceb1322ef10c1586a7ca97b377dce0c6e35d9abbdbff5a01e841a487eac08cb From ce3887bde4f22a4e0ae670adf22fba9dafc26030 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 31 May 2025 18:46:44 +0000 Subject: [PATCH 05/17] Cherrypick obscure (fuzzer-generated) RIGHT JOIN bug fixes from trunk. FossilOrigin-Name: a61da8169b4ac64c20b3f1dfe3bb2a57c5e6517828b0224bcde3ee93949733e1 --- main.mk | 6 ++++++ manifest | 22 ++++++++++++---------- manifest.uuid | 2 +- src/select.c | 10 +++++++++- test/join.test | 38 ++++++++++++++++++++++++++++++++++++++ test/joinH.test | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 115 insertions(+), 12 deletions(-) diff --git a/main.mk b/main.mk index 88c641b70f..fe874b1f38 100644 --- a/main.mk +++ b/main.mk @@ -1835,6 +1835,12 @@ mdevtest: srctree-check has_tclsh85 sdevtest: has_tclsh85 $(TCLSH_CMD) $(TOP)/test/testrunner.tcl sdevtest $(TSTRNNR_OPTS) +# Like releasetest, except it omits srctree-check and verify-source so +# that it can be used on a modified source tree. +# +xdevtest: has_tclsh85 + $(TCLSH_CMD) $(TOP)/test/testrunner.tcl release $(TSTRNNR_OPTS) + # # Validate that various generated files in the source tree # are up-to-date. diff --git a/manifest b/manifest index c9d36ac651..46fba033ab 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\s"include\s<stddef.h>"\sto\sfts5\sand\srtree\sto\sensure\sthat\sthey\suse\sthe\nsystem\sversion\sof\sthe\soffsetof()\smacro\swhen\sit\sis\savailable,\sas\sthe\nbuilt-in\sversion\striggers\subsan\serrors\swith\sclang. -D 2025-05-30T11:55:07.037 +C Cherrypick\sobscure\s(fuzzer-generated)\sRIGHT\sJOIN\sbug\sfixes\sfrom\strunk. +D 2025-05-31T18:46:44.241 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -709,7 +709,7 @@ F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36 F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 517db864e770c486bd1465298c20d91899918d395263266997d477b20ef9eec8 +F main.mk 34290a772ec671de1fa5defd4fa4074aad24b1ea7eaabebba071e30564c6498c F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -785,7 +785,7 @@ F src/printf.c 3b91c334f528359145f4dde0dedd945bbb21044d0825ea064934d7222d61662c F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c d40fe18d7c2fd0339f5846ffcf7d6809866e380acdf14c76fb2af87e9fe13f64 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c ee072fe20566119a195a5a3df454479bb6e944de7aef7006ff0b4d4612f9cb86 +F src/select.c 56876401a47da70cc627de75a77fef75fcada23f417c2a28537ae01685efd56f F src/shell.c.in ba53a52dafb167ac6320703da741386c34fbcabe8c078a188bb9f89808e3ef8f F src/sqlite.h.in 22882ddd3a70751aa8864c81993ee4562ed54c2c508b6270f75e223ffee38e1b F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 @@ -1361,7 +1361,7 @@ F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c F test/ioerr5.test 5984da7bf74b6540aa356f2ab0c6ae68a6d12039a3d798a9ac6a100abc17d520 F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b F test/istrue.test e7f285bb70282625c258e866ce6337d4c762922f5a300e1b50f958aef6e7d9c9 -F test/join.test aca62194ad41b522c55577e0e1bd99da6d5436827225aa850801c36e5f4cc914 +F test/join.test 255c1f42b7fe027b518cadb2bf40f41a793a95e7f8db2bceb54faaf59ff19c6c F test/join2.test f59d63264fb24784ae9c3bc9d867eb569cd6d442da5660f8852effe5c1938c27 F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0 F test/join4.test 1a352e4e267114444c29266ce79e941af5885916 @@ -1376,7 +1376,7 @@ F test/joinC.test 1f1a602c2127f55f136e2cbd3bf2d26546614bf8cffe5902ec1ac9c07f87f2 F test/joinD.test 2ce62e7353a0702ca5e70008faf319c1d4686aa19fba34275c6d1da0e960be28 F test/joinE.test d5d182f3812771e2c0d97c9dcf5dbe4c41c8e21c82560e59358731c4a3981d6b F test/joinF.test 53dd66158806823ea680dd7543b5406af151b5aafa5cd06a7f3231cd94938127 -F test/joinH.test 55f69e64da74d4eca2235237f3acb657aef181e22e45daa228e35bba865e0255 +F test/joinH.test 29a25ea2c6323c6dd1ee7f2da906f24efbd467d60a9531e6704b8e2c88de9b9a F test/journal1.test bc61a4228db11bffca118bd358ba4b868524bf080f3532749de6c539656e20fa F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4 F test/journal3.test e5aeff93a7776cf644dbc48dec277655cff80a1cd24689036abc87869b120ea6 @@ -2207,9 +2207,11 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P cbd9aabaa5f54434c7b744cc9bb439cc702e35d74397d7157f7f06bdf67d8b14 -Q +838deb7f3423df84061a043928ed34e1d74e2e7d57ef1a9519bb32fea82e4352 -R 929bd7d6d83081dd481eea9142699e65 +P 6ceb1322ef10c1586a7ca97b377dce0c6e35d9abbdbff5a01e841a487eac08cb +Q +60adc78a22956429d34ccc4e2c193c5994c11c3b3cff7901d47fad7d92dba935 +Q +8d393ca07fe09f48d77adb517e2e4baaa58a9251422de62a0504999205d3ea1d +Q +cf5b37b3a39013d8ca9de92da2289346caf52b56daff59e19b140cc586a3421f +R ffdd73b33732d33d49d6dc53eb2a2c21 U drh -Z 87282ecf773192a5340ad31d2e91ef55 +Z 76d240f3bf8c7f25ba94ce8583ac551a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 93b77a67d1..22c5105b85 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6ceb1322ef10c1586a7ca97b377dce0c6e35d9abbdbff5a01e841a487eac08cb +a61da8169b4ac64c20b3f1dfe3bb2a57c5e6517828b0224bcde3ee93949733e1 diff --git a/src/select.c b/src/select.c index 3b951afffe..e7d9879d3b 100644 --- a/src/select.c +++ b/src/select.c @@ -596,7 +596,7 @@ static int sqlite3ProcessJoin(Parse *pParse, Select *p){ } pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iLeftCol); sqlite3SrcItemColumnUsed(&pSrc->a[iLeft], iLeftCol); - if( (pSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){ + if( (pSrc->a[0].fg.jointype & JT_LTORJ)!=0 && pParse->nErr==0 ){ /* This branch runs if the query contains one or more RIGHT or FULL ** JOINs. If only a single table on the left side of this join ** contains the zName column, then this branch is a no-op. @@ -612,6 +612,8 @@ static int sqlite3ProcessJoin(Parse *pParse, Select *p){ */ ExprList *pFuncArgs = 0; /* Arguments to the coalesce() */ static const Token tkCoalesce = { "coalesce", 8 }; + assert( pE1!=0 ); + ExprSetProperty(pE1, EP_CanBeNull); while( tableAndColumnIndex(pSrc, iLeft+1, i, zName, &iLeft, &iLeftCol, pRight->fg.isSynthUsing)!=0 ){ if( pSrc->a[iLeft].fg.isUsing==0 @@ -628,7 +630,13 @@ static int sqlite3ProcessJoin(Parse *pParse, Select *p){ if( pFuncArgs ){ pFuncArgs = sqlite3ExprListAppend(pParse, pFuncArgs, pE1); pE1 = sqlite3ExprFunction(pParse, pFuncArgs, &tkCoalesce, 0); + if( pE1 ){ + pE1->affExpr = sqlite3ExprAffinity(pFuncArgs->a[0].pExpr); + } } + }else if( (pSrc->a[i+1].fg.jointype & JT_LEFT)!=0 && pParse->nErr==0 ){ + assert( pE1!=0 ); + ExprSetProperty(pE1, EP_CanBeNull); } pE2 = sqlite3CreateColumnExpr(db, pSrc, i+1, iRightCol); sqlite3SrcItemColumnUsed(pRight, iRightCol); diff --git a/test/join.test b/test/join.test index ecd7bb2b5d..ef2f6335c5 100644 --- a/test/join.test +++ b/test/join.test @@ -1304,4 +1304,42 @@ do_execsql_test join-30.3 { WHERE x <= y; } {} +# 2025-05-30 https://sqlite.org/forum/forumpost/4fc70203b61c7e12 +# +# When converting a USING(x) or NATURAL into the constraint expression +# t1.x==t2.x, mark the t1.x term as EP_CanBeNull if it is the left table +# of a RIGHT JOIN. +# +reset_db +db null NULL +do_execsql_test join-31.1 { + CREATE TABLE t1(c0 INT , c1 INT); INSERT INTO t1(c0, c1) VALUES(NULL,11); + CREATE TABLE t2(c0 INT NOT NULL); + CREATE TABLE t2n(c0 INT); + CREATE TABLE t3(x INT); INSERT INTO t3(x) VALUES(3); + CREATE TABLE t4(y INT); INSERT INTO t4(y) VALUES(4); + CREATE TABLE t5(c0 INT, x INT); INSERT INTO t5 VALUES(NULL, 5); +} +do_execsql_test join-31.2 { + SELECT * FROM t2 RIGHT JOIN t3 ON true LEFT JOIN t1 USING(c0); +} {NULL 3 NULL} +do_execsql_test join-31.3 { + SELECT * FROM t2 RIGHT JOIN t3 ON true NATURAL LEFT JOIN t1; +} {NULL 3 NULL} +do_execsql_test join-31.4 { + SELECT * FROM t2n RIGHT JOIN t3 ON true LEFT JOIN t1 USING(c0); +} {NULL 3 NULL} +do_execsql_test join-31.5 { + SELECT * FROM t5 LEFT JOIN t1 USING(c0); +} {NULL 5 NULL} +do_execsql_test join-31.6 { + SELECT * FROM t3 LEFT JOIN t2 ON true LEFT JOIN t1 USING(c0); +} {3 NULL NULL} +do_execsql_test join-31.7 { + SELECT * FROM t3 LEFT JOIN t2 ON true NATURAL LEFT JOIN t1; +} {3 NULL NULL} +do_execsql_test join-31.8 { + SELECT * FROM t3 LEFT JOIN t2 ON true JOIN t4 ON true NATURAL LEFT JOIN t1; +} {3 NULL 4 NULL} + finish_test diff --git a/test/joinH.test b/test/joinH.test index 908b93dee5..822ba45b21 100644 --- a/test/joinH.test +++ b/test/joinH.test @@ -341,4 +341,53 @@ do_execsql_test 13.4 { GROUP BY a1.a ORDER BY 1; } {-1480 240 480} +#------------------------------------------------------------------------- +# 2025-05-30 +# https://sqlite.org/forum/forumpost/5028c785b6 +# +reset_db + +do_execsql_test 14.0 { + CREATE TABLE t1(c0 INT); + CREATE TABLE t2(c0 BLOB); + CREATE TABLE t3(c0 BLOB); + CREATE TABLE t4(c4 BLOB); + INSERT INTO t1(c0) VALUES(0); + INSERT INTO t3(c0) VALUES('0'); +} + +do_execsql_test 14.1.1 { + SELECT * FROM t1 NATURAL LEFT JOIN t2 NATURAL JOIN t3; +} {0} + +do_execsql_test 14.1.2 { + SELECT * FROM t1 NATURAL LEFT JOIN t2 NATURAL JOIN t3 FULL JOIN t4 ON true; +} {0 {}} + +do_execsql_test 14.1.3 { + SELECT * FROM (t1 NATURAL LEFT JOIN t2 NATURAL JOIN t3) FULL JOIN t4 ON true; +} {0 {}} + +do_execsql_test 14.1.4 { + SELECT * + FROM (t1 NATURAL LEFT JOIN t2 NATURAL JOIN t3) AS qq FULL JOIN t4 ON true; +} {0 {}} + +do_execsql_test 14.2.1 { + SELECT * FROM t3 NATURAL LEFT JOIN t2 NATURAL JOIN t1; +} {0} + +do_execsql_test 14.2.2 { + SELECT * FROM t3 NATURAL LEFT JOIN t2 NATURAL JOIN t1 FULL JOIN t4 ON true; +} {0 {}} + +do_execsql_test 14.2.3 { + SELECT * FROM (t3 NATURAL LEFT JOIN t2 NATURAL JOIN t1) FULL JOIN t4 ON true; +} {0 {}} + +do_execsql_test 14.2.4 { + SELECT * + FROM (t3 NATURAL LEFT JOIN t2 NATURAL JOIN t1) AS qq FULL JOIN t4 ON true; +} {0 {}} + finish_test From 7c1d13bcd891cde06ab9b4aa3fd8c68dda8d3107 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sun, 1 Jun 2025 21:49:45 +0000 Subject: [PATCH 06/17] Fix an off-by-one error in the size computation of a vdbe-sorter. FossilOrigin-Name: d5ab065727969c1b74c0f6cb2ef8d47f552e7071f790cf6fb43ac26248525086 --- manifest | 16 +++++++--------- manifest.uuid | 2 +- src/vdbesort.c | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 46fba033ab..890c40dd42 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Cherrypick\sobscure\s(fuzzer-generated)\sRIGHT\sJOIN\sbug\sfixes\sfrom\strunk. -D 2025-05-31T18:46:44.241 +C Fix\san\soff-by-one\serror\sin\sthe\ssize\scomputation\sof\sa\svdbe-sorter. +D 2025-06-01T21:49:45.627 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -861,7 +861,7 @@ F src/vdbeapi.c 28fab30ed0acc981aecfdcaab0a421503609078e29850eb28494816682baf0a7 F src/vdbeaux.c 948c379976885a073b54cc7d8ffda087dc1a1095d1f5bb8df218796f8c933ac3 F src/vdbeblob.c b1b4032cac46b41e44b957c4d00aee9851f862dfd85ecb68116ba49884b03dfd F src/vdbemem.c e67d9c6484d868c879d20c70d00bf4a9058082f1d4058607ca15d50eb3aebc21 -F src/vdbesort.c 49e366d0216c782eba287bf602384e4330d2526a22f1275492d2785ce103c79b +F src/vdbesort.c 706acdc581944cf6381f75c0ccf40f2debf71cdd51c5056592f3b74a1a0c3624 F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3 F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859 @@ -2207,11 +2207,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6ceb1322ef10c1586a7ca97b377dce0c6e35d9abbdbff5a01e841a487eac08cb -Q +60adc78a22956429d34ccc4e2c193c5994c11c3b3cff7901d47fad7d92dba935 -Q +8d393ca07fe09f48d77adb517e2e4baaa58a9251422de62a0504999205d3ea1d -Q +cf5b37b3a39013d8ca9de92da2289346caf52b56daff59e19b140cc586a3421f -R ffdd73b33732d33d49d6dc53eb2a2c21 +P a61da8169b4ac64c20b3f1dfe3bb2a57c5e6517828b0224bcde3ee93949733e1 +Q +8b7a7fcf62e5c2742c243808fa482472954f2b4aae0bc7ae513bc07065c93737 +R 006bf61a8c231ef984bac8a365197718 U drh -Z 76d240f3bf8c7f25ba94ce8583ac551a +Z ec6f9fc2f97b77f2ae574ce0af539602 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 22c5105b85..5a1c796d45 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a61da8169b4ac64c20b3f1dfe3bb2a57c5e6517828b0224bcde3ee93949733e1 +d5ab065727969c1b74c0f6cb2ef8d47f552e7071f790cf6fb43ac26248525086 diff --git a/src/vdbesort.c b/src/vdbesort.c index 9a7e0760c6..6b1b4cff5d 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -969,7 +969,7 @@ int sqlite3VdbeSorterInit( assert( pCsr->eCurType==CURTYPE_SORTER ); assert( sizeof(KeyInfo) + UMXV(pCsr->pKeyInfo->nKeyField)*sizeof(CollSeq*) < 0x7fffffff ); - szKeyInfo = SZ_KEYINFO(pCsr->pKeyInfo->nKeyField+1); + szKeyInfo = SZ_KEYINFO(pCsr->pKeyInfo->nKeyField); sz = SZ_VDBESORTER(nWorker+1); pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo); From 6510bebf48482ab4044e963af965e2890ec424b4 Mon Sep 17 00:00:00 2001 From: drh <> Date: Sun, 1 Jun 2025 21:55:17 +0000 Subject: [PATCH 07/17] Update the version number to 3.50.1 FossilOrigin-Name: 86f0e4eabe1010c00955edf19e6d7e251ca03c33dd6eed38460148473aea8e42 --- VERSION | 2 +- manifest | 13 ++++++------- manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index ca25ff637a..b05723fc60 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.50.0 +3.50.1 diff --git a/manifest b/manifest index 890c40dd42..451895c336 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\soff-by-one\serror\sin\sthe\ssize\scomputation\sof\sa\svdbe-sorter. -D 2025-06-01T21:49:45.627 +C Update\sthe\sversion\snumber\sto\s3.50.1 +D 2025-06-01T21:55:17.563 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -8,7 +8,7 @@ F Makefile.in c3e414df4dc8dfb12f1f6baf129fcb6d18cd0ebd3c9109370fb3fceeeef9a37a F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc 0206f28988bb6634c7e8aff05bf6cfa65d6dfe1d2b6bd95160dd99290a83dfc7 F README.md e28077cfbef795e99c9c75ed95aa7257a1166709b562076441a8506ac421b7c1 -F VERSION 001dea55eb8304ec9130b6b44a32d3fc349f279d45a7e224fc0730c3cb8e2372 +F VERSION 1283c71d85c60203d57aafc1457c71668ba6090ceaa709a16b90279f54146579 F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5 F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d87031 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 @@ -2207,9 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a61da8169b4ac64c20b3f1dfe3bb2a57c5e6517828b0224bcde3ee93949733e1 -Q +8b7a7fcf62e5c2742c243808fa482472954f2b4aae0bc7ae513bc07065c93737 -R 006bf61a8c231ef984bac8a365197718 +P d5ab065727969c1b74c0f6cb2ef8d47f552e7071f790cf6fb43ac26248525086 +R fcd860133cec9c002d69e7882e838e3b U drh -Z ec6f9fc2f97b77f2ae574ce0af539602 +Z fee35a75dc3b36f1da1c36f4b7b2246a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5a1c796d45..1e3f652e91 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d5ab065727969c1b74c0f6cb2ef8d47f552e7071f790cf6fb43ac26248525086 +86f0e4eabe1010c00955edf19e6d7e251ca03c33dd6eed38460148473aea8e42 From 13efb2f67651ce9011488d120fb4cf91dca263da Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 2 Jun 2025 18:42:49 +0000 Subject: [PATCH 08/17] Improve the accuracy of affinity and collating sequence analysis for NATURAL JOINs to the left of RIGHT JOINs where source tables are views or subqueries. FossilOrigin-Name: d6a8b1ea5ca7e0d4e640144a4b3ada516486564bb5922af688328399c4cc4427 --- manifest | 19 ++++++++++--------- manifest.uuid | 2 +- src/expr.c | 8 ++++++-- src/select.c | 2 +- src/sqliteInt.h | 1 + test/joinH.test | 21 +++++++++++++++++++++ 6 files changed, 40 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 451895c336..dee0ba1134 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\sversion\snumber\sto\s3.50.1 -D 2025-06-01T21:55:17.563 +C Improve\sthe\saccuracy\sof\saffinity\sand\scollating\ssequence\sanalysis\sfor\nNATURAL\sJOINs\sto\sthe\sleft\sof\sRIGHT\sJOINs\swhere\ssource\stables\sare\sviews\nor\ssubqueries. +D 2025-06-02T18:42:49.982 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -736,7 +736,7 @@ F src/date.c 9db4d604e699a73e10b8e85a44db074a1f04c0591a77e2abfd77703f50dce1e9 F src/dbpage.c fcb1aafe00872a8aff9a7aa0ef7ff1b01e5817ec7bbd521f8f3e1e674ac8d609 F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42 -F src/expr.c 6f184da1f36576ad1ecc48a03f14774235373c64f88d462c710834930ee6c145 +F src/expr.c f16fa5cbd849991462edf1d31bb7def5b970bb9611afcb4ea21c77e88e52a220 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f F src/func.c 7686ea382b20e8bfe2ab9de76150c99ee7b6e83523561f3c7787e0f68cb435c2 @@ -785,12 +785,12 @@ F src/printf.c 3b91c334f528359145f4dde0dedd945bbb21044d0825ea064934d7222d61662c F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c d40fe18d7c2fd0339f5846ffcf7d6809866e380acdf14c76fb2af87e9fe13f64 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 56876401a47da70cc627de75a77fef75fcada23f417c2a28537ae01685efd56f +F src/select.c 122c496dcbc117b88af7e75ffbc684570317b44cb285f5b0b006aa100ee66fb5 F src/shell.c.in ba53a52dafb167ac6320703da741386c34fbcabe8c078a188bb9f89808e3ef8f F src/sqlite.h.in 22882ddd3a70751aa8864c81993ee4562ed54c2c508b6270f75e223ffee38e1b F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3ext.h 0bfd049bb2088cc44c2ad54f2079d1c6e43091a4e1ce8868779b75f6c1484f1e -F src/sqliteInt.h ded2e1527c84603d9d91adccb63dda460d96a2e2f98111d0438a479aa0dbe4e3 +F src/sqliteInt.h c7af428bc3087678f0e6ac7685b9968c7259b428de706ab8c212e486c4ead4d9 F src/sqliteLimit.h 6d817c28a8f19af95e6f4921933b7fbbca48a962bce0eb0ec81e8bb3ef38e68b F src/status.c 0e72e4f6be6ccfde2488eb63210297e75f569f3ce9920f6c3d77590ec6ce5ffd F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -1376,7 +1376,7 @@ F test/joinC.test 1f1a602c2127f55f136e2cbd3bf2d26546614bf8cffe5902ec1ac9c07f87f2 F test/joinD.test 2ce62e7353a0702ca5e70008faf319c1d4686aa19fba34275c6d1da0e960be28 F test/joinE.test d5d182f3812771e2c0d97c9dcf5dbe4c41c8e21c82560e59358731c4a3981d6b F test/joinF.test 53dd66158806823ea680dd7543b5406af151b5aafa5cd06a7f3231cd94938127 -F test/joinH.test 29a25ea2c6323c6dd1ee7f2da906f24efbd467d60a9531e6704b8e2c88de9b9a +F test/joinH.test fd76024ff104baec16417db5cafc0894ad4e0863e70803e63c1bba0322706339 F test/journal1.test bc61a4228db11bffca118bd358ba4b868524bf080f3532749de6c539656e20fa F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4 F test/journal3.test e5aeff93a7776cf644dbc48dec277655cff80a1cd24689036abc87869b120ea6 @@ -2207,8 +2207,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d5ab065727969c1b74c0f6cb2ef8d47f552e7071f790cf6fb43ac26248525086 -R fcd860133cec9c002d69e7882e838e3b +P 86f0e4eabe1010c00955edf19e6d7e251ca03c33dd6eed38460148473aea8e42 +Q +f184d1d236e47962658a4639d9533f67a525b74cfe0f06c93e9b85fdcd02a15f +R 66afacf81ef488bbb70ae8ef19dd342a U drh -Z fee35a75dc3b36f1da1c36f4b7b2246a +Z 4004d915cde8c6e4b997df8dbcc7f756 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1e3f652e91..463a87ea4f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -86f0e4eabe1010c00955edf19e6d7e251ca03c33dd6eed38460148473aea8e42 +d6a8b1ea5ca7e0d4e640144a4b3ada516486564bb5922af688328399c4cc4427 diff --git a/src/expr.c b/src/expr.c index 12c94362f7..606a4cd7eb 100644 --- a/src/expr.c +++ b/src/expr.c @@ -73,7 +73,9 @@ char sqlite3ExprAffinity(const Expr *pExpr){ pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr ); } - if( op==TK_VECTOR ){ + if( op==TK_VECTOR + || (op==TK_FUNCTION && pExpr->affExpr==SQLITE_AFF_DEFER) + ){ assert( ExprUseXList(pExpr) ); return sqlite3ExprAffinity(pExpr->x.pList->a[0].pExpr); } @@ -266,7 +268,9 @@ CollSeq *sqlite3ExprCollSeq(Parse *pParse, const Expr *pExpr){ p = p->pLeft; continue; } - if( op==TK_VECTOR ){ + if( op==TK_VECTOR + || (op==TK_FUNCTION && p->affExpr==SQLITE_AFF_DEFER) + ){ assert( ExprUseXList(p) ); p = p->x.pList->a[0].pExpr; continue; diff --git a/src/select.c b/src/select.c index e7d9879d3b..ff37f29302 100644 --- a/src/select.c +++ b/src/select.c @@ -631,7 +631,7 @@ static int sqlite3ProcessJoin(Parse *pParse, Select *p){ pFuncArgs = sqlite3ExprListAppend(pParse, pFuncArgs, pE1); pE1 = sqlite3ExprFunction(pParse, pFuncArgs, &tkCoalesce, 0); if( pE1 ){ - pE1->affExpr = sqlite3ExprAffinity(pFuncArgs->a[0].pExpr); + pE1->affExpr = SQLITE_AFF_DEFER; } } }else if( (pSrc->a[i+1].fg.jointype & JT_LEFT)!=0 && pParse->nErr==0 ){ diff --git a/src/sqliteInt.h b/src/sqliteInt.h index af7ed4a4c8..41adccf690 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2329,6 +2329,7 @@ struct CollSeq { #define SQLITE_AFF_INTEGER 0x44 /* 'D' */ #define SQLITE_AFF_REAL 0x45 /* 'E' */ #define SQLITE_AFF_FLEXNUM 0x46 /* 'F' */ +#define SQLITE_AFF_DEFER 0x58 /* 'X' - defer computation until later */ #define sqlite3IsNumericAffinity(X) ((X)>=SQLITE_AFF_NUMERIC) diff --git a/test/joinH.test b/test/joinH.test index 822ba45b21..3392009680 100644 --- a/test/joinH.test +++ b/test/joinH.test @@ -390,4 +390,25 @@ do_execsql_test 14.2.4 { FROM (t3 NATURAL LEFT JOIN t2 NATURAL JOIN t1) AS qq FULL JOIN t4 ON true; } {0 {}} +# 2025-06-01 +# +reset_db +do_execsql_test 15.1 { + CREATE TABLE t0(c0); + CREATE TABLE t1(c0); + CREATE TABLE t2(c0); + INSERT INTO t0 VALUES ('1.0'); + INSERT INTO t2(c0) VALUES (9); + SELECT t0.c0,t2.c0 FROM (SELECT CAST(t0.c0 as REAL) AS c0 FROM t0) as subquery NATURAL LEFT JOIN t1 NATURAL JOIN t0 RIGHT JOIN t2 ON 1; +} {1.0 9} +do_execsql_test 15.2 { + CREATE TABLE x1(x COLLATE nocase); + CREATE TABLE x2(x); + CREATE TABLE x3(x); + CREATE TABLE t4(y); + INSERT INTO x1 VALUES('ABC'); + INSERT INTO x3 VALUES('abc'); + SELECT lower(x), quote(y) FROM x1 LEFT JOIN x2 USING (x) JOIN x3 USING (x) FULL JOIN t4; +} {abc NULL} + finish_test From 1daead7a11080a166df2c0c89827d1dfe98ee0dd Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 2 Jun 2025 23:41:56 +0000 Subject: [PATCH 09/17] Fix JSONB edit so that when it is trying to reduce the size of an element it understands 0xf0 (8-byte) sizes. FossilOrigin-Name: cee271122784bf88f576ce29ead2c54f2833e5326f24a4cce8efa4d4c8ec9f32 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/json.c | 4 +++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index dee0ba1134..b8feb68de5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improve\sthe\saccuracy\sof\saffinity\sand\scollating\ssequence\sanalysis\sfor\nNATURAL\sJOINs\sto\sthe\sleft\sof\sRIGHT\sJOINs\swhere\ssource\stables\sare\sviews\nor\ssubqueries. -D 2025-06-02T18:42:49.982 +C Fix\sJSONB\sedit\sso\sthat\swhen\sit\sis\strying\sto\sreduce\sthe\ssize\sof\san\selement\nit\sunderstands\s0xf0\s(8-byte)\ssizes. +D 2025-06-02T23:41:56.332 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -746,7 +746,7 @@ F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c d05934dfab2c5c0c480fc6fd2038f11215661de08ea6ff38d2563216bd555c1b -F src/json.c d34969ecb9555f33fc0b2227628189a9a4e20dda5df5d173db9918a014aa7ad1 +F src/json.c cb87977b1ee25ee7d27505d65a9261b687395bf895342c8ba566b7c01aee2047 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c d7edd8e671237539d795d30daaf888908a2c82e99bade4c78f3be021e8b7d655 F src/main.c 07f78d917ffcdf327982840cfd8e855fd000527a2ea5ace372ce4febcbd0bf97 @@ -2207,9 +2207,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 86f0e4eabe1010c00955edf19e6d7e251ca03c33dd6eed38460148473aea8e42 -Q +f184d1d236e47962658a4639d9533f67a525b74cfe0f06c93e9b85fdcd02a15f -R 66afacf81ef488bbb70ae8ef19dd342a +P d6a8b1ea5ca7e0d4e640144a4b3ada516486564bb5922af688328399c4cc4427 +Q +5b3de6e8ab6b228bf6c0e0c31b50ca29d8b7852b460eaaca6c6ecf5a3c083cab +R 72fb5c22cd4c5a09904409c7a75e4355 U drh -Z 4004d915cde8c6e4b997df8dbcc7f756 +Z d5d4211c5c7fc4cc7586494029a3a3cb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 463a87ea4f..f4792dcb54 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d6a8b1ea5ca7e0d4e640144a4b3ada516486564bb5922af688328399c4cc4427 +cee271122784bf88f576ce29ead2c54f2833e5326f24a4cce8efa4d4c8ec9f32 diff --git a/src/json.c b/src/json.c index 4ae17a5a4b..3078be34ba 100644 --- a/src/json.c +++ b/src/json.c @@ -1285,8 +1285,10 @@ static int jsonBlobChangePayloadSize( nExtra = 1; }else if( szType==13 ){ nExtra = 2; - }else{ + }else if( szType==14 ){ nExtra = 4; + }else{ + nExtra = 8; } if( szPayload<=11 ){ nNeeded = 0; From 9412d98419e67b1d87f470784958de4cd81973bd Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 3 Jun 2025 10:30:31 +0000 Subject: [PATCH 10/17] Fix an off-by-one error in sqlite3_rsync. FossilOrigin-Name: e13a9492c102d8ad756fc4b0b86d7008303a1fa7660c41b574add6e111ed9b0c --- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/sqlite3_rsync.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index b8feb68de5..1fba54471c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sJSONB\sedit\sso\sthat\swhen\sit\sis\strying\sto\sreduce\sthe\ssize\sof\san\selement\nit\sunderstands\s0xf0\s(8-byte)\ssizes. -D 2025-06-02T23:41:56.332 +C Fix\san\soff-by-one\serror\sin\ssqlite3_rsync. +D 2025-06-03T10:30:31.459 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -2189,7 +2189,7 @@ F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d F tool/split-sqlite3c.tcl 4969fd642dad0ea483e4e104163021d92baf98f6a8eac981fe48525f9b873430 F tool/sqldiff.c 134be7866be19f8beb32043d5aea5657f01aaeae2df8d33d758ff722c78666b9 F tool/sqlite3_analyzer.c.in 14f02cb5ec3c264cd6107d1f1dad77092b1cf440fc196c30b69ae87b56a1a43b -F tool/sqlite3_rsync.c e8659970e839d71d2ef04b96d48ad65f1d4298a41636affaf93c32ed71f3f879 +F tool/sqlite3_rsync.c 4e152221a51ed2974f08100d86500c2cda549472e48e09699a8011bfb956d00c F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898 F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c 6c655d9a8d6b30f3648fc78a79bf3838ed68f8543869d380c43ea9f17b3b8501 @@ -2207,9 +2207,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d6a8b1ea5ca7e0d4e640144a4b3ada516486564bb5922af688328399c4cc4427 -Q +5b3de6e8ab6b228bf6c0e0c31b50ca29d8b7852b460eaaca6c6ecf5a3c083cab -R 72fb5c22cd4c5a09904409c7a75e4355 +P cee271122784bf88f576ce29ead2c54f2833e5326f24a4cce8efa4d4c8ec9f32 +Q +27d9e8e79b921c4a86916556f3bf56b94684a7e3d40166c0fdaaf750d4011de0 +R a701ffffcfd84d6dd0a95446198e7f0e U drh -Z d5d4211c5c7fc4cc7586494029a3a3cb +Z 80b075793a4cee2af6968dbbd3e96a6b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f4792dcb54..fddfa17579 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cee271122784bf88f576ce29ead2c54f2833e5326f24a4cce8efa4d4c8ec9f32 +e13a9492c102d8ad756fc4b0b86d7008303a1fa7660c41b574add6e111ed9b0c diff --git a/tool/sqlite3_rsync.c b/tool/sqlite3_rsync.c index 46ff2e50e3..84ebf15c58 100644 --- a/tool/sqlite3_rsync.c +++ b/tool/sqlite3_rsync.c @@ -1538,7 +1538,7 @@ static void originSide(SQLiteRsync *p){ sqlite3_finalize(pInsHash); pCkHash = 0; pInsHash = 0; - if( mxHashnPage ){ + if( mxHash<=p->nPage ){ runSql(p, "WITH RECURSIVE c(n) AS" " (VALUES(%d) UNION ALL SELECT n+1 FROM c WHERE n<%d)" " INSERT INTO badHash SELECT n, 1 FROM c", From d95ba2fb0361d55584effa34b3d7e36c7abd2287 Mon Sep 17 00:00:00 2001 From: drh <> Date: Tue, 3 Jun 2025 17:46:24 +0000 Subject: [PATCH 11/17] Relax query flattener constraint (3b) and thereby allow flattening the RHS of a LEFT JOIN even if the RHS contains a virtual table. This is a performance optimization that would not normally be found on a patch branch, but downstream needs it and does not want to wait on the next full release. FossilOrigin-Name: 916dde1f409d5cb9300da464daa1e06e6fcee3d8a6a68d469fa9580ae8700bfa --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/select.c | 8 ++++---- test/fts3join.test | 5 +---- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/manifest b/manifest index 1fba54471c..dc82f2a3c8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\soff-by-one\serror\sin\ssqlite3_rsync. -D 2025-06-03T10:30:31.459 +C Relax\squery\sflattener\sconstraint\s(3b)\sand\sthereby\sallow\sflattening\sthe\sRHS\sof\na\sLEFT\sJOIN\seven\sif\sthe\sRHS\scontains\sa\svirtual\stable.\s\sThis\sis\sa\sperformance\noptimization\sthat\swould\snot\snormally\sbe\sfound\son\sa\spatch\sbranch,\sbut\ndownstream\sneeds\sit\sand\sdoes\snot\swant\sto\swait\son\sthe\snext\sfull\srelease. +D 2025-06-03T17:46:24.222 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -785,7 +785,7 @@ F src/printf.c 3b91c334f528359145f4dde0dedd945bbb21044d0825ea064934d7222d61662c F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c d40fe18d7c2fd0339f5846ffcf7d6809866e380acdf14c76fb2af87e9fe13f64 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 -F src/select.c 122c496dcbc117b88af7e75ffbc684570317b44cb285f5b0b006aa100ee66fb5 +F src/select.c 7a21df5db6bb1a4c1bb6d9fb76c8e2485a22ff8306519ad69d8ddf0d5fa10903 F src/shell.c.in ba53a52dafb167ac6320703da741386c34fbcabe8c078a188bb9f89808e3ef8f F src/sqlite.h.in 22882ddd3a70751aa8864c81993ee4562ed54c2c508b6270f75e223ffee38e1b F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 @@ -1222,7 +1222,7 @@ F test/fts3fault3.test ccdd2292dd2d4e21e30fc5f4c8e064f79e516087eec5ff57ab6bc4f6a F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641 F test/fts3fuzz001.test c78afcd8ad712ea0b8d2ed50851a8aab3bc9dc52c64a536291e07112f519357c F test/fts3integrity.test 0c6fe7353d7b24d78862f4272ee9df4da2f32b3ff30fa3396945cda8119580a8 -F test/fts3join.test 1a4d786539b2b79a41c28ef2ac22cacd92a8ee830249b68a7dee4a020848e3bb +F test/fts3join.test de31d304ba479043a7d33d2f201c514b3e1da809da6797d7a58704d00e8da2e6 F test/fts3malloc.test b0e4c133b8d61d4f6d112d8110f8320e9e453ef6 F test/fts3matchinfo.test aa66cc50615578b30f6df9984819ae5b702511cf8a94251ec7c594096a703a4a F test/fts3matchinfo2.test 00144e841704b8debfcdf6097969cd9f2a1cf759e2203cda42583648f2e6bf58 @@ -2207,9 +2207,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P cee271122784bf88f576ce29ead2c54f2833e5326f24a4cce8efa4d4c8ec9f32 -Q +27d9e8e79b921c4a86916556f3bf56b94684a7e3d40166c0fdaaf750d4011de0 -R a701ffffcfd84d6dd0a95446198e7f0e +P e13a9492c102d8ad756fc4b0b86d7008303a1fa7660c41b574add6e111ed9b0c +Q +1ddaa92057e550ea281d45d9860eafe69399224725548a93dd91c47a34e52152 +R 545467a16f2e3c52bb906b5fe4568673 U drh -Z 80b075793a4cee2af6968dbbd3e96a6b +Z 0c3a9a55642ff216df822a8b3fa30e55 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index fddfa17579..6220c3580a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e13a9492c102d8ad756fc4b0b86d7008303a1fa7660c41b574add6e111ed9b0c +916dde1f409d5cb9300da464daa1e06e6fcee3d8a6a68d469fa9580ae8700bfa diff --git a/src/select.c b/src/select.c index ff37f29302..8e4c939cd4 100644 --- a/src/select.c +++ b/src/select.c @@ -4244,9 +4244,9 @@ static int compoundHasDifferentAffinities(Select *p){ ** from 2015-02-09.) ** ** (3) If the subquery is the right operand of a LEFT JOIN then -** (3a) the subquery may not be a join and -** (3b) the FROM clause of the subquery may not contain a virtual -** table and +** (3a) the subquery may not be a join +** (**) Was (3b): "the FROM clause of the subquery may not contain +** a virtual table" ** (**) Was: "The outer query may not have a GROUP BY." This case ** is now managed correctly ** (3d) the outer query may not be DISTINCT. @@ -4462,7 +4462,7 @@ static int flattenSubquery( */ if( (pSubitem->fg.jointype & (JT_OUTER|JT_LTORJ))!=0 ){ if( pSubSrc->nSrc>1 /* (3a) */ - || IsVirtual(pSubSrc->a[0].pSTab) /* (3b) */ + /**** || IsVirtual(pSubSrc->a[0].pSTab) (3b)-omitted */ || (p->selFlags & SF_Distinct)!=0 /* (3d) */ || (pSubitem->fg.jointype & JT_RIGHT)!=0 /* (26) */ ){ diff --git a/test/fts3join.test b/test/fts3join.test index cbd08b63f2..9171c817be 100644 --- a/test/fts3join.test +++ b/test/fts3join.test @@ -97,11 +97,8 @@ do_eqp_test 4.2 { WHERE t4.y = ?; } { QUERY PLAN - |--MATERIALIZE rr - | `--SCAN ft4 VIRTUAL TABLE INDEX 3: |--SCAN t4 - |--BLOOM FILTER ON rr (docid=?) - `--SEARCH rr USING AUTOMATIC COVERING INDEX (docid=?) LEFT-JOIN + `--SCAN ft4 VIRTUAL TABLE INDEX 3: LEFT-JOIN } finish_test From d282fbc59c304fe08921cf0a645644c604eeb571 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 3 Jun 2025 18:11:27 +0000 Subject: [PATCH 12/17] Apply the duplicate 'export default' workaround to the (untested and unsupported) node-specific build rules in mkwasmbuilds.c to resolve a problem reported off-list by Thomas Steiner. FossilOrigin-Name: c8523d9e145ebdc74dc0516d4eed55e96f324166edcf0f65766de3a7622d561f --- ext/wasm/mkwasmbuilds.c | 2 +- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/wasm/mkwasmbuilds.c b/ext/wasm/mkwasmbuilds.c index d13302769e..8aa29c0fed 100644 --- a/ext/wasm/mkwasmbuilds.c +++ b/ext/wasm/mkwasmbuilds.c @@ -328,7 +328,7 @@ static void mk_lib_mode(const char *zName /* build name */, pf("\t\t$(cflags.common) $(SQLITE_OPT) \\\n" "\t\t$(cflags.%s) $(cflags.%s.%s) \\\n" "\t\t$(cflags.wasm_extra_init) $(sqlite3-wasm.cfiles)\n", zName, zNM); - if( LIBMODE_ESM & flags ){ + if( (LIBMODE_ESM & flags) || (LIBMODE_NODEJS & flags) ){ /* TODO? Replace this $(call) with the corresponding makefile ** code. OTOH, we also use this $(call) in the speedtest1-wasmfs ** build, which is not part of the rules emitted by this diff --git a/manifest b/manifest index dc82f2a3c8..84a12a1c62 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Relax\squery\sflattener\sconstraint\s(3b)\sand\sthereby\sallow\sflattening\sthe\sRHS\sof\na\sLEFT\sJOIN\seven\sif\sthe\sRHS\scontains\sa\svirtual\stable.\s\sThis\sis\sa\sperformance\noptimization\sthat\swould\snot\snormally\sbe\sfound\son\sa\spatch\sbranch,\sbut\ndownstream\sneeds\sit\sand\sdoes\snot\swant\sto\swait\son\sthe\snext\sfull\srelease. -D 2025-06-03T17:46:24.222 +C Apply\sthe\sduplicate\s'export\sdefault'\sworkaround\sto\sthe\s(untested\sand\sunsupported)\snode-specific\sbuild\srules\sin\smkwasmbuilds.c\sto\sresolve\sa\sproblem\sreported\soff-list\sby\sThomas\sSteiner. +D 2025-06-03T18:11:27.718 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -682,7 +682,7 @@ F ext/wasm/index-dist.html 56132399702b15d70c474c3f1952541e25cb0922942868f70daf1 F ext/wasm/index.html bcaa00eca521b372a6a62c7e7b17a870b0fcdf3e418a5921df1fd61e5344080d F ext/wasm/jaccwabyt/jaccwabyt.js 6e4f26d0edb5c2e7d381b7eff1924832a040a12274afab2d1e1789027e9f6c5c F ext/wasm/jaccwabyt/jaccwabyt.md 1128e3563e7eff90b5a373395251fc76cb32386fad1fea6075b0f34a8f1b9bdf -F ext/wasm/mkwasmbuilds.c 6e0b22002bc520b7af053681571a96d30049a51f7f1389e81c524e8d420f5d40 +F ext/wasm/mkwasmbuilds.c 5b096a3c9fdf6e67eb20329dc685f995e820248a67fa970633c2c8f49bf472ad F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337 F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96 F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63 @@ -2207,9 +2207,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e13a9492c102d8ad756fc4b0b86d7008303a1fa7660c41b574add6e111ed9b0c -Q +1ddaa92057e550ea281d45d9860eafe69399224725548a93dd91c47a34e52152 -R 545467a16f2e3c52bb906b5fe4568673 -U drh -Z 0c3a9a55642ff216df822a8b3fa30e55 +P 916dde1f409d5cb9300da464daa1e06e6fcee3d8a6a68d469fa9580ae8700bfa +Q +2f8a1b79533879e4975b405c46fea496ba8bffbef065e7dd0ad29fd4aa8f8f92 +R 41c01a172b03dd880c79ca13e83cf135 +U stephan +Z acc1f71883b832db57747eeba12d14e5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6220c3580a..b7679cc099 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -916dde1f409d5cb9300da464daa1e06e6fcee3d8a6a68d469fa9580ae8700bfa +c8523d9e145ebdc74dc0516d4eed55e96f324166edcf0f65766de3a7622d561f From af388ef35f027e262f7c16cc10879dbb8f7c6e41 Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 4 Jun 2025 18:40:03 +0000 Subject: [PATCH 13/17] tea build: add an info-exists check after a 'scan' call, as scan does not create its target vars on error. Problem reported at [forum:fde857fb8101a4be | forum post fde857fb8101a4be] and triggers when the 'vsatisfies' test for the host's Tcl version fails (so the build would fail anyway, but will fail more informatively with this fix). FossilOrigin-Name: a7eb03e26345abb450f15f0e25eb843bee1320837d41d272ec1aada8b5bf7ab5 --- autosetup/teaish/core.tcl | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autosetup/teaish/core.tcl b/autosetup/teaish/core.tcl index 33c6e18984..09017029d7 100644 --- a/autosetup/teaish/core.tcl +++ b/autosetup/teaish/core.tcl @@ -522,7 +522,7 @@ proc teaish__configure_phase1 {} { set vputs "puts \[ $vsat \]" #puts "*** vputs = $vputs" scan [exec echo $vputs | $tclsh] %d vvcheck - if {0 == $vvcheck} { + if {![info exists vvcheck] || 0 == $vvcheck} { proj-fatal -up $tclsh "check failed:" $vsat } } diff --git a/manifest b/manifest index 84a12a1c62..af64644372 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Apply\sthe\sduplicate\s'export\sdefault'\sworkaround\sto\sthe\s(untested\sand\sunsupported)\snode-specific\sbuild\srules\sin\smkwasmbuilds.c\sto\sresolve\sa\sproblem\sreported\soff-list\sby\sThomas\sSteiner. -D 2025-06-03T18:11:27.718 +C tea\sbuild:\sadd\san\sinfo-exists\scheck\safter\sa\s'scan'\scall,\sas\sscan\sdoes\snot\screate\sits\starget\svars\son\serror.\sProblem\sreported\sat\s[forum:fde857fb8101a4be\s|\sforum\spost\sfde857fb8101a4be]\sand\striggers\swhen\sthe\s'vsatisfies'\stest\sfor\sthe\shost's\sTcl\sversion\sfails\s(so\sthe\sbuild\swould\sfail\sanyway,\sbut\swill\sfail\smore\sinformatively\swith\sthis\sfix). +D 2025-06-04T18:40:03.091 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -51,7 +51,7 @@ F autosetup/proj.tcl c4a77735b57f3c016a185bff048212a197b77723f9bea6cfafe396e4b54 F autosetup/sqlite-config.tcl ccda82e43e377b832aae72a1678b1dc17dcaff36ed0ebbd8f0cfc88612ae8de3 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F autosetup/teaish/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca -F autosetup/teaish/core.tcl a37bd039881bc1b0adfa25808966e62108b1e8194e730f1d1e06aad7e57b1f6e +F autosetup/teaish/core.tcl 42b4f76ebcacafded7c13a225ce55454bd1fcf8a11912729128e1076b12f6433 F autosetup/teaish/feature.tcl 18194fb79a24d30e5bbdeab40999616f39278b53a27525349ded033af2fd73be F autosetup/teaish/tester.tcl 091745984473faea6985254b9986c6dfd0cce06f68bc515ba4afc1e6b3742fa8 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x @@ -2207,9 +2207,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 916dde1f409d5cb9300da464daa1e06e6fcee3d8a6a68d469fa9580ae8700bfa -Q +2f8a1b79533879e4975b405c46fea496ba8bffbef065e7dd0ad29fd4aa8f8f92 -R 41c01a172b03dd880c79ca13e83cf135 +P c8523d9e145ebdc74dc0516d4eed55e96f324166edcf0f65766de3a7622d561f +Q +4f21874d5d20aef2e2d67a59e4fa03d98aa6514b16e4d956acfc817142cfbdb6 +R f6c2b6f73a240f63c71e09366a91a469 U stephan -Z acc1f71883b832db57747eeba12d14e5 +Z 9a86ecb0976a91631a1d0c9c9337d03b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b7679cc099..898aee9dd0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c8523d9e145ebdc74dc0516d4eed55e96f324166edcf0f65766de3a7622d561f +a7eb03e26345abb450f15f0e25eb843bee1320837d41d272ec1aada8b5bf7ab5 From 74db1f323513d72180ce491c86d6b92861da133b Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 5 Jun 2025 08:33:08 +0000 Subject: [PATCH 14/17] Merge TEA README updates from [bf7be67e3f]. No code changes. FossilOrigin-Name: 65c5e66af77a233c6255cb9fca5887269bb38566d3c5482569b8697c72e355ae --- autoconf/tea/README.txt | 43 +++++++++++++++++++++++------------------ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/autoconf/tea/README.txt b/autoconf/tea/README.txt index 28f23a88dd..fb7cb19248 100644 --- a/autoconf/tea/README.txt +++ b/autoconf/tea/README.txt @@ -41,24 +41,32 @@ step-by-step instructions at the links below for more information: https://sqlite.org/src/doc/trunk/doc/compile-for-unix.md https://sqlite.org/src/doc/trunk/doc/compile-for-windows.md -The whole point of the amalgamation-autoconf tarball (in which this -README.txt file is embedded) is to provide a means of compiling -SQLite that does not require first installing TCL and/or "tclsh". -The canonical Makefile in the SQLite source tree provides more -capabilities (such as the the ability to run test cases to ensure -that the build worked) and is better maintained. The only -downside of the canonical Makefile is that it requires a TCL -installation. But if you are wanting to build the TCL extension for -SQLite, then presumably you already have a TCL installation. So why -not just use the more-capable and better-maintained canoncal Makefile? +And info about the extension's Tcl interface can be found at: -This TEA builder is derived from code found at + https://sqlite.org/tclsqlite.html + +The whole point of the amalgamation-autoconf tarball (in which this +README.txt file is embedded) is to provide a means of compiling SQLite +that does not require first installing TCL and/or "tclsh". The +canonical Makefile in the SQLite source tree provides more +capabilities (such as the the ability to run test cases to ensure that +the build worked) and is better maintained. The only downside of the +canonical Makefile is that it requires a TCL installation. But if you +are wanting to build the TCL extension for SQLite, then presumably you +already have a TCL installation. So why not just use the more-capable +and better-maintained canoncal Makefile? + +As of version 3.50.0, this build process uses "teaish": + + https://fossil.wanderinghorse.net/r/teaish + +which is conceptually derived from the pre-3.50 toolchain, TEA: http://core.tcl-lang.org/tclconfig http://core.tcl-lang.org/sampleextension -The SQLite developers do not understand how it works. It seems to -work for us. It might also work for you. But we cannot promise that. +It to works for us. It might also work for you. But we cannot +promise that. If you want to use this TEA builder and it works for you, that's fine. But if you have trouble, the first thing you should do is go back @@ -70,13 +78,11 @@ to using the canonical Makefile in the SQLite source tree. UNIX BUILD ========== -Building under most UNIX systems is easy, just run the configure script -and then run make. For more information about the build process, see -the tcl/unix/README file in the Tcl src dist. The following minimal -example will install the extension in the /opt/tcl directory. +Building under most UNIX systems is easy, just run the configure +script and then run make. For example: $ cd sqlite-*-tea - $ ./configure --prefix=/opt/tcl + $ ./configure --with-tcl=/path/to/tcl/install/root $ make $ make install @@ -89,7 +95,6 @@ generating native Windows binaries. Using the Msys + Mingw build tools means that you can use the same configure script as per the Unix build to create a Makefile. See the tcl/win/README file for the URL of the Msys + Mingw download. - If you have VC++ then you may wish to use the files in the win subdirectory and build the extension using just VC++. These files have been designed to be as generic as possible but will require some diff --git a/manifest b/manifest index af64644372..cfbfa42d3f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C tea\sbuild:\sadd\san\sinfo-exists\scheck\safter\sa\s'scan'\scall,\sas\sscan\sdoes\snot\screate\sits\starget\svars\son\serror.\sProblem\sreported\sat\s[forum:fde857fb8101a4be\s|\sforum\spost\sfde857fb8101a4be]\sand\striggers\swhen\sthe\s'vsatisfies'\stest\sfor\sthe\shost's\sTcl\sversion\sfails\s(so\sthe\sbuild\swould\sfail\sanyway,\sbut\swill\sfail\smore\sinformatively\swith\sthis\sfix). -D 2025-06-04T18:40:03.091 +C Merge\sTEA\sREADME\supdates\sfrom\s[bf7be67e3f].\sNo\scode\schanges. +D 2025-06-05T08:33:08.327 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -23,7 +23,7 @@ F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d6484909 F autoconf/README.txt b749816b8452b3af994dc6d607394bef3df1736d7e09359f1087de8439a52807 F autoconf/auto.def 3d994f3a9cc9b712dbce92a5708570ddcf3b988141b6eb738f2ed16127a9f0ac F autoconf/tea/Makefile.in 14c6a79ce87e10d8a35398f2d0e04e1d83a88eb52ee16ebf0eeaccf005ff84b3 -F autoconf/tea/README.txt 656d4686c509d375f5988ff3deda94f65fe6cd8358cd55d1f1dcc7b6e2ff73aa +F autoconf/tea/README.txt 6301adfea2e75eabcc550a1ed4812faaa4024c9584ac89a7f018e39f9bc9defb F autoconf/tea/_teaish.tester.tcl.in ed5445512e91c12afbbb99771efb68a23be4a046d52d61213fb5b6f010118129 F autoconf/tea/auto.def ce95b9450e2fa4ba5dc857e208fe10f4e6f2d737796ac3278aee6079db417529 F autoconf/tea/configure d0b12b984edca6030d1976375b80157ac78b5b90a5b4f0dcee39357f63f4a80b x @@ -2207,9 +2207,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c8523d9e145ebdc74dc0516d4eed55e96f324166edcf0f65766de3a7622d561f -Q +4f21874d5d20aef2e2d67a59e4fa03d98aa6514b16e4d956acfc817142cfbdb6 -R f6c2b6f73a240f63c71e09366a91a469 +P a7eb03e26345abb450f15f0e25eb843bee1320837d41d272ec1aada8b5bf7ab5 +Q +bf7be67e3fb7b75fc281997f7bf9aa69eaf4da6bdf2fefe359b12d25ec95f512 +R 52f90b034f01ad9dd1968d896e9c6ce2 U stephan -Z 9a86ecb0976a91631a1d0c9c9337d03b +Z 7ce4d2874386e874e24917f2f9025685 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 898aee9dd0..01c0a76b4c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a7eb03e26345abb450f15f0e25eb843bee1320837d41d272ec1aada8b5bf7ab5 +65c5e66af77a233c6255cb9fca5887269bb38566d3c5482569b8697c72e355ae From d7cb1ea7ba2c0d168762db7a6814e34ac6524cf0 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 5 Jun 2025 11:57:20 +0000 Subject: [PATCH 15/17] Fixes to ensure SQLITE_ENABLE_SETLK_TIMEOUT builds use a blocking lock and do not call xSleep() when (a) opening a snapshot transaction, and (b) when blocked by another process running recovery. FossilOrigin-Name: 8ac4525a2e3100bb5b9460cc49bb64f007911180d5f51461282b1de0201328b6 --- manifest | 28 ++++----- manifest.uuid | 2 +- src/btree.c | 7 +++ src/os_unix.c | 11 ++-- src/os_win.c | 15 +++-- src/pager.c | 9 +++ src/wal.c | 3 +- test/snapshot3.test | 3 + test/walsetlk_recover.test | 104 ++++++++++++++++++++++++++++++++++ test/walsetlk_snapshot.test | 109 ++++++++++++++++++++++++++++++++++++ 10 files changed, 264 insertions(+), 27 deletions(-) create mode 100644 test/walsetlk_recover.test create mode 100644 test/walsetlk_snapshot.test diff --git a/manifest b/manifest index cfbfa42d3f..a31084e34b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sTEA\sREADME\supdates\sfrom\s[bf7be67e3f].\sNo\scode\schanges. -D 2025-06-05T08:33:08.327 +C Fixes\sto\sensure\sSQLITE_ENABLE_SETLK_TIMEOUT\sbuilds\suse\sa\sblocking\slock\nand\sdo\snot\scall\sxSleep()\swhen\s(a)\sopening\sa\ssnapshot\stransaction,\sand\n(b)\swhen\sblocked\sby\sanother\sprocess\srunning\srecovery. +D 2025-06-05T11:57:20.960 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -726,7 +726,7 @@ F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 F src/bitvec.c 782cc29b42b47e7ec6348eb0aaf9ffe60063f498387e7249f458d445af4b53e9 F src/btmutex.c 30dada73a819a1ef5b7583786370dce1842e12e1ad941e4d05ac29695528daea -F src/btree.c 00fcee37947641f48d4b529d96143e74d056b7afa8f26d61292c90ee59c056b2 +F src/btree.c da98489a981c347cc3a3982ea2810bbb583511a73cc34762547f30dbb4cda7f0 F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50 F src/btreeInt.h 9c0f9ea5c9b5f4dcaea18111d43efe95f2ac276cd86d770dce10fd99ccc93886 F src/build.c 67c1db4c5e89a8519fe9b6dafc287f6bc3627696b5b8536dc5e06db570d8c05f @@ -770,10 +770,10 @@ F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63 F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06 F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107 -F src/os_unix.c 410185df4900817c218c0efdb8064b3481af88cb3f7cea7392f820b6eebc7889 -F src/os_win.c b39f31fb0b137d67091d21880f0fded6b1c3c8c59b9e24e42844a1c0070437d4 +F src/os_unix.c 04e054ab86d86a7be99ebe5265922687791a40df5afc781d059beb47f4a40acd +F src/os_win.c b8d3cfdf2f40e2f9715b7d8df64f3c0c7ee18743a2dd0c4fc70c1d57fa1aadc7 F src/os_win.h 4c247cdb6d407c75186c94a1e84d5a22cbae4adcec93fcae8d2bc1f956fd1f19 -F src/pager.c 9fbb541b46125dfa8914827575e6bb4d15048caa008073b1709112d495d7983b +F src/pager.c 23c0f17deb892da6b32fef1f465507df7ab5cd01d774288cb43695658a649259 F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8 F src/parse.y e426d7323311554c75b0aebc426d0fe3c88d9777ffefed236f343ad9e661dc4c F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 @@ -866,7 +866,7 @@ F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf8 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3 F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 -F src/wal.c bcf40795a09b699ad7e42624dd6282b13335164fbabcd5a98a717758cebef451 +F src/wal.c 78da33510b8cb1b096fb5ae9954be910998d2477ddb623e56f5df84e56b5814d F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014 F src/where.c 45a3b496248a0b36d91ce34da3278d54f8fa20e9d3fbd36d45a42051d1118137 @@ -1664,7 +1664,7 @@ F test/skipscan5.test 0672103fd2c8f96bd114133f356192b35ece45c794fe3677e1d9e5e310 F test/skipscan6.test e2b256cf5d538a605beb97dc97ca5e2836dfc24c5e1d9b7a09e13c069a3b8b49 F test/snapshot.test a504f2e7009f512ef66c719f0ea1c55a556bdaf1e1312c80a04d46fc1a3e9632 F test/snapshot2.test 8d6ff5dd9cc503f6e12d408a30409c3f9c653507b24408d9cd7195931c89bc54 -F test/snapshot3.test 41350216abc6c7da37113ad462259c070786e5ad70bdc8709daaed148b1b3a2c +F test/snapshot3.test 2e0328ba019aa981848e10aded4d7dcd6094ec1f9c6290a34ab18415be0c44eb F test/snapshot4.test d4e9347ef2fcabc491fc893506c7bbaf334da3be111d6eb4f3a97cc623b78322 F test/snapshot_fault.test 129234ceb9b26a0e1000e8563a16e790f5c1412354e70749cbd78c3d5d07d60a F test/snapshot_up.test 77dc7853bfb2b4fa249f76e1714cfa1e596826165d9ef22c06ac3a0b7b778d9a @@ -2036,6 +2036,8 @@ F test/walseh1.test bae700eb99519b6d5cd3f893c04759accc5a59c391d4189fe4dd6995a533 F test/walsetlk.test 9079cd8ef82570b8cf0067f31e049a72bec353fb2d5f0cc88f1736dc42ba9704 F test/walsetlk2.test 9097083633cdf55bf1098b694fb8651d0356d38fef28b869481d18029d7ceaf4 F test/walsetlk3.test 1b82bd92dea7e58f498b4399b0b3d26773dd8ac5c74205ce4a23c207cb8e85fe +F test/walsetlk_recover.test adccbffc59e365063a4efd2da6b661ae2fcf15d775b6719fe46acd87face08ff +F test/walsetlk_snapshot.test 86d5588380f9927d8fcbbd75133b0a34fddf959378d6823c6f164a390123f70a F test/walshared.test 42e3808582504878af237ea02c42ca793e8a0efaa19df7df26ac573370dbc7a3 F test/walslow.test 0c51843836c9dcf40a5ac05aa781bfb977b396ee2c872d92bd48b79d5dd9aa23 F test/walthread.test 14b20fcfa6ae152f5d8e12f5dc8a8a724b7ef189f5d8ef1e2ceab79f2af51747 @@ -2207,9 +2209,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a7eb03e26345abb450f15f0e25eb843bee1320837d41d272ec1aada8b5bf7ab5 -Q +bf7be67e3fb7b75fc281997f7bf9aa69eaf4da6bdf2fefe359b12d25ec95f512 -R 52f90b034f01ad9dd1968d896e9c6ce2 -U stephan -Z 7ce4d2874386e874e24917f2f9025685 +P 65c5e66af77a233c6255cb9fca5887269bb38566d3c5482569b8697c72e355ae +Q +7f9c0cdd0630a41db359b188b226a1ad6a3bae1663c27169acfe25edc7fb171b +R 0d812b70b020867d9ada415d63c65888 +U drh +Z 689cb8e844bd2f2b69f9acf239c1ccad # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 01c0a76b4c..9c7ea5c54d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -65c5e66af77a233c6255cb9fca5887269bb38566d3c5482569b8697c72e355ae +8ac4525a2e3100bb5b9460cc49bb64f007911180d5f51461282b1de0201328b6 diff --git a/src/btree.c b/src/btree.c index 1bd59a1b1f..25a9b1b4ae 100644 --- a/src/btree.c +++ b/src/btree.c @@ -3697,6 +3697,13 @@ static SQLITE_NOINLINE int btreeBeginTrans( (void)sqlite3PagerWalWriteLock(pPager, 0); unlockBtreeIfUnused(pBt); } +#if defined(SQLITE_ENABLE_SETLK_TIMEOUT) + if( rc==SQLITE_BUSY_TIMEOUT ){ + /* If a blocking lock timed out, break out of the loop here so that + ** the busy-handler is not invoked. */ + break; + } +#endif }while( (rc&0xFF)==SQLITE_BUSY && pBt->inTransaction==TRANS_NONE && btreeInvokeBusyHandler(pBt) ); sqlite3PagerWalDb(pPager, 0); diff --git a/src/os_unix.c b/src/os_unix.c index 1146545fea..784bc35176 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5035,21 +5035,20 @@ static int unixShmLock( /* Check that, if this to be a blocking lock, no locks that occur later ** in the following list than the lock being obtained are already held: ** - ** 1. Checkpointer lock (ofst==1). - ** 2. Write lock (ofst==0). - ** 3. Read locks (ofst>=3 && ofst=3 && ofstexclMask|p->sharedMask); assert( (flags & SQLITE_SHM_UNLOCK) || pDbFd->iBusyTimeout==0 || ( - (ofst!=2) /* not RECOVER */ + (ofst!=2 || lockMask==0) && (ofst!=1 || lockMask==0 || lockMask==2) && (ofst!=0 || lockMask<3) && (ofst<3 || lockMask<(1<=3 && ofst=3 && ofstexclMask|p->sharedMask); assert( (flags & SQLITE_SHM_UNLOCK) || pDbFd->iBusyTimeout==0 || ( - (ofst!=2) /* not RECOVER */ + (ofst!=2 || lockMask==0) && (ofst!=1 || lockMask==0 || lockMask==2) && (ofst!=0 || lockMask<3) && (ofst<3 || lockMask<(1<fd, pPager->zWal, pPager->exclusiveMode, pPager->journalSizeLimit, &pPager->pWal ); +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + if( rc==SQLITE_OK ){ + sqlite3WalDb(pPager->pWal, pPager->dbWal); + } +#endif } pagerFixMaplimit(pPager); @@ -7700,6 +7708,7 @@ int sqlite3PagerWalWriteLock(Pager *pPager, int bLock){ ** blocking locks are required. */ void sqlite3PagerWalDb(Pager *pPager, sqlite3 *db){ + pPager->dbWal = db; if( pagerUseWal(pPager) ){ sqlite3WalDb(pPager->pWal, db); } diff --git a/src/wal.c b/src/wal.c index 5fe2296d6c..fc176988bd 100644 --- a/src/wal.c +++ b/src/wal.c @@ -3062,7 +3062,6 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){ rc = walIndexReadHdr(pWal, pChanged); } #ifdef SQLITE_ENABLE_SETLK_TIMEOUT - walDisableBlocking(pWal); if( rc==SQLITE_BUSY_TIMEOUT ){ rc = SQLITE_BUSY; *pCnt |= WAL_RETRY_BLOCKED_MASK; @@ -3077,6 +3076,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){ ** WAL_RETRY this routine will be called again and will probably be ** right on the second iteration. */ + walEnableBlocking(pWal); if( pWal->apWiData[0]==0 ){ /* This branch is taken when the xShmMap() method returns SQLITE_BUSY. ** We assume this is a transient condition, so return WAL_RETRY. The @@ -3093,6 +3093,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){ rc = SQLITE_BUSY_RECOVERY; } } + walDisableBlocking(pWal); if( rc!=SQLITE_OK ){ return rc; } diff --git a/test/snapshot3.test b/test/snapshot3.test index 470d463a66..6d57b1d0c4 100644 --- a/test/snapshot3.test +++ b/test/snapshot3.test @@ -96,6 +96,9 @@ do_test 1.8 { list [catch { sqlite3_snapshot_open_blob db3 main $snap } msg] $msg } {1 SQLITE_ERROR_SNAPSHOT} +db3 close +db2 close + #------------------------------------------------------------------------- reset_db do_execsql_test 2.0 { diff --git a/test/walsetlk_recover.test b/test/walsetlk_recover.test new file mode 100644 index 0000000000..1daece7470 --- /dev/null +++ b/test/walsetlk_recover.test @@ -0,0 +1,104 @@ +# 2025 May 30 +# +# 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. +# +#*********************************************************************** +# +# TESTRUNNER: slow +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +source $testdir/lock_common.tcl +set testprefix walsetlk_recover + +ifcapable !wal {finish_test ; return } +# ifcapable !setlk_timeout {finish_test ; return } + +do_execsql_test 1.0 { + PRAGMA journal_mode = wal; + CREATE TABLE t1(a, b); + INSERT INTO t1 VALUES(1, 2); + INSERT INTO t1 VALUES(3, 4); + INSERT INTO t1 VALUES(5, 6); +} {wal} + +db_save_and_close +db_restore + +testfixture_nb myvar { + + testvfs tvfs -fullshm 1 + sqlite3 db test.db -vfs tvfs + tvfs script vfs_callback + tvfs filter xRead + + set ::done 0 + proc vfs_callback {method file args} { + if {$::done==0 && [string match *wal $file]} { + after 4000 + set ::done 1 + } + return "SQLITE_OK" + } + + db eval { + SELECT * FROM t1 + } + + db close +} + +# Give the [testfixture_nb] command time to start +after 1000 {set xyz 1} +vwait xyz + +testvfs tvfs -fullshm 1 +sqlite3 db test.db -vfs tvfs + +tvfs script sleep_callback +tvfs filter xSleep +set ::sleep_count 0 +proc sleep_callback {args} { + incr ::sleep_count +} + +sqlite3 db test.db -vfs tvfs +db timeout 500 +set tm [lindex [time { + catch { + db eval {SELECT * FROM t1} + } msg +}] 0] + +do_test 1.2 { set ::msg } {database is locked} +do_test 1.3.($::tm) { expr $::tm>400000 && $::tm<2000000 } 1 + +vwait myvar + +do_execsql_test 1.4 { + SELECT * FROM t1 +} {1 2 3 4 5 6} + +db close +tvfs delete + +# All SQLite builds should pass the tests above. SQLITE_ENABLE_SETLK_TIMEOUT=1 +# builds do so without calling the VFS xSleep method. +if {$::sqlite_options(setlk_timeout)==1} { + do_test 1.5.1 { + set ::sleep_count + } 0 +} else { + do_test 1.5.2 { + expr $::sleep_count>0 + } 1 +} + +finish_test + diff --git a/test/walsetlk_snapshot.test b/test/walsetlk_snapshot.test new file mode 100644 index 0000000000..e05ad69cce --- /dev/null +++ b/test/walsetlk_snapshot.test @@ -0,0 +1,109 @@ +# 2025 May 30 +# +# 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. +# +#*********************************************************************** +# +# TESTRUNNER: slow +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +source $testdir/lock_common.tcl +set testprefix walsetlk_snapshot + +ifcapable !wal {finish_test ; return } +ifcapable !snapshot {finish_test; return} + +db close +testvfs tvfs -fullshm 1 +sqlite3 db test.db -vfs tvfs +tvfs script sleep_callback +tvfs filter xSleep +set ::sleep_count 0 +proc sleep_callback {args} { + incr ::sleep_count +} + +do_execsql_test 1.0 { + PRAGMA journal_mode = wal; + CREATE TABLE t1(a, b); + INSERT INTO t1 VALUES(1, 2); + INSERT INTO t1 VALUES(3, 4); + INSERT INTO t1 VALUES(5, 6); +} {wal} + +do_test 1.1 { + db eval BEGIN + set ::snap [sqlite3_snapshot_get db main] + db eval { + INSERT INTO t1 VALUES(7, 8); + COMMIT; + } +} {} + +testfixture_nb myvar { + + testvfs tvfs -fullshm 1 + sqlite3 db test.db -vfs tvfs + tvfs script vfs_callback + tvfs filter {xWrite} + + set ::done 0 + proc vfs_callback {args} { + if {$::done==0} { + after 4000 + set ::done 1 + } + return "SQLITE_OK" + } + + db eval { + PRAGMA wal_checkpoint; + } + + db close +} + +# Give the [testfixture_nb] command time to start +after 1000 {set xyz 1} +vwait xyz + +db timeout 500 +set tm [lindex [time { + catch { + db eval BEGIN + sqlite3_snapshot_open db main $::snap + } msg +}] 0] + +do_test 1.2 { set ::msg } {SQLITE_BUSY} +do_test 1.3.($::tm) { expr $::tm<2000000 } 1 + +do_execsql_test 1.4 { + SELECT * FROM t1 +} {1 2 3 4 5 6 7 8} + +sqlite3_snapshot_free $::snap + +vwait myvar + +# All SQLite builds should pass the tests above. SQLITE_ENABLE_SETLK_TIMEOUT=1 +# builds do so without calling the VFS xSleep method. +if {$::sqlite_options(setlk_timeout)==1} { + do_test 1.5.1 { + set ::sleep_count + } 0 +} else { + do_test 1.5.2 { + expr $::sleep_count>0 + } 1 +} + +finish_test + From 36350af403c7477f5394e00fc76fbb8ff2cb8e46 Mon Sep 17 00:00:00 2001 From: drh <> Date: Thu, 5 Jun 2025 13:14:46 +0000 Subject: [PATCH 16/17] Fix harmless compiler warning introduced by the setlk-snapshot-fix merge. FossilOrigin-Name: cbab5d86517f0c57c6025aaddbb9408e29bccdc8b158d2b8d40bd2f3b333ef69 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/wal.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index a31084e34b..54ddfdb351 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fixes\sto\sensure\sSQLITE_ENABLE_SETLK_TIMEOUT\sbuilds\suse\sa\sblocking\slock\nand\sdo\snot\scall\sxSleep()\swhen\s(a)\sopening\sa\ssnapshot\stransaction,\sand\n(b)\swhen\sblocked\sby\sanother\sprocess\srunning\srecovery. -D 2025-06-05T11:57:20.960 +C Fix\sharmless\scompiler\swarning\sintroduced\sby\sthe\ssetlk-snapshot-fix\smerge. +D 2025-06-05T13:14:46.332 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -866,7 +866,7 @@ F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf8 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3 F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 -F src/wal.c 78da33510b8cb1b096fb5ae9954be910998d2477ddb623e56f5df84e56b5814d +F src/wal.c b0f848cfba8dd057f77073493cdd542f9125b4cf87941f53e9d0db21604155c8 F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014 F src/where.c 45a3b496248a0b36d91ce34da3278d54f8fa20e9d3fbd36d45a42051d1118137 @@ -2209,9 +2209,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 65c5e66af77a233c6255cb9fca5887269bb38566d3c5482569b8697c72e355ae -Q +7f9c0cdd0630a41db359b188b226a1ad6a3bae1663c27169acfe25edc7fb171b -R 0d812b70b020867d9ada415d63c65888 +P 8ac4525a2e3100bb5b9460cc49bb64f007911180d5f51461282b1de0201328b6 +Q +c1f20f89d9eb3e1dd1018c0e0efe5d3043a592f078e235ad04b960334c7186c2 +R 2e4328669cf34776de6f2dce452a9a18 U drh -Z 689cb8e844bd2f2b69f9acf239c1ccad +Z f346dec9e265e58e5acbec45d51de62c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9c7ea5c54d..1e9b063feb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8ac4525a2e3100bb5b9460cc49bb64f007911180d5f51461282b1de0201328b6 +cbab5d86517f0c57c6025aaddbb9408e29bccdc8b158d2b8d40bd2f3b333ef69 diff --git a/src/wal.c b/src/wal.c index fc176988bd..1fd5b201cb 100644 --- a/src/wal.c +++ b/src/wal.c @@ -3076,7 +3076,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){ ** WAL_RETRY this routine will be called again and will probably be ** right on the second iteration. */ - walEnableBlocking(pWal); + (void)walEnableBlocking(pWal); if( pWal->apWiData[0]==0 ){ /* This branch is taken when the xShmMap() method returns SQLITE_BUSY. ** We assume this is a transient condition, so return WAL_RETRY. The From 979a07af38c8fb1d344253f59736cbfa91bd0a66 Mon Sep 17 00:00:00 2001 From: drh <> Date: Fri, 6 Jun 2025 14:52:32 +0000 Subject: [PATCH 17/17] Version 3.50.1 FossilOrigin-Name: b77dc5e0f596d2140d9ac682b2893ff65d3a4140aa86067a3efebe29dc914c95 --- manifest | 11 ++++++----- manifest.uuid | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/manifest b/manifest index 54ddfdb351..77f51e9f0e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarning\sintroduced\sby\sthe\ssetlk-snapshot-fix\smerge. -D 2025-06-05T13:14:46.332 +C Version\s3.50.1 +D 2025-06-06T14:52:32.856 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -2209,9 +2209,10 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 8ac4525a2e3100bb5b9460cc49bb64f007911180d5f51461282b1de0201328b6 -Q +c1f20f89d9eb3e1dd1018c0e0efe5d3043a592f078e235ad04b960334c7186c2 +P cbab5d86517f0c57c6025aaddbb9408e29bccdc8b158d2b8d40bd2f3b333ef69 R 2e4328669cf34776de6f2dce452a9a18 +T +sym-release * +T +sym-version-3.50.1 * U drh -Z f346dec9e265e58e5acbec45d51de62c +Z 9176f9c7403d4ffbbc5c61ed5ec557f1 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1e9b063feb..7df133b85f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cbab5d86517f0c57c6025aaddbb9408e29bccdc8b158d2b8d40bd2f3b333ef69 +b77dc5e0f596d2140d9ac682b2893ff65d3a4140aa86067a3efebe29dc914c95