]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
9 months agoBack out [e283d817e3a9] because further testing has proven it unnecessary. solaris-alignment
stephan [Wed, 30 Jul 2025 21:39:27 +0000 (21:39 +0000)] 
Back out [e283d817e3a9] because further testing has proven it unnecessary.

FossilOrigin-Name: 7318a00de64ec89c2a08d86e9f50c694894c4b59b07ff52b0d1f9f0ab8c4df44

9 months agoMove the flexarray union members from [527bbc1676a85a9] to the end of their respectiv...
stephan [Wed, 30 Jul 2025 21:34:47 +0000 (21:34 +0000)] 
Move the flexarray union members from [527bbc1676a85a9] to the end of their respective objects.

FossilOrigin-Name: 3082e07926695863bd5ef51c3c4803fbe267dc0d9b6ac9a717c225459f8988ba

9 months agoApply alignment-related patches suggested in [forum:41cd226375cd49c6 | forum post...
stephan [Wed, 30 Jul 2025 19:48:12 +0000 (19:48 +0000)] 
Apply alignment-related patches suggested in [forum:41cd226375cd49c6 | forum post 41cd226375].

FossilOrigin-Name: 527bbc1676a85a927352cd10a292afe041a72692ec0b1360e5a1ccaa19a32fcb

9 months agoDefault pointer size for the __SUNPRO_C compiler is 4 bytes.
drh [Wed, 30 Jul 2025 18:23:33 +0000 (18:23 +0000)] 
Default pointer size for the __SUNPRO_C compiler is 4 bytes.

FossilOrigin-Name: e283d817e3a93a3cd42c7b79e08e5fb61cb4fa4734137b92f1748dbbe8b8b919

9 months agoJS: ensure that sqlite3WorkerPromiser.v2.defaultConfig initially refers to sqlite3Wor...
stephan [Wed, 30 Jul 2025 16:17:14 +0000 (16:17 +0000)] 
JS: ensure that sqlite3WorkerPromiser.v2.defaultConfig initially refers to sqlite3WorkerPromiser.defaultConfig. This fixes a longstanding oversight rather than a known in-the-wild problem.

FossilOrigin-Name: cf7163f82ca380958a79350473b2c5a2cebda7496d6d575fa2835c362010fea1

9 months agoAdjust the previous check-in to replace the db's WASM address with yet another random...
stephan [Wed, 30 Jul 2025 15:02:32 +0000 (15:02 +0000)] 
Adjust the previous check-in to replace the db's WASM address with yet another random number, and increase the range of random numbers, reducing the chance of cross-worker db ID collision to 1 in many billions.

FossilOrigin-Name: f5e2a72c57e802c5042ab8343e5009ba9f22ca7138a1c78f4b8201ab9b4fd395

9 months agoJS: add a random element when assigning db IDs to Worker1 db instances. This addresse...
stephan [Wed, 30 Jul 2025 14:50:44 +0000 (14:50 +0000)] 
JS: add a random element when assigning db IDs to Worker1 db instances. This addresses [https://github.com/sqlite/sqlite-wasm/issues/113 | the npm project's ticket #113], which demonstrates that two independent workers can end up generating non-globally-unique IDs. That's not a bug, per se, but it makes the IDs useless for client-side mapping of db connection IDs to client-side state, so we add some randomness to them.

FossilOrigin-Name: 6d2a43075fda9c4eae28f9ca4aaf459c41d305c861947a47fb2cbd513249c4b9

9 months agoEnhance the printf formatter for %#f such that the minus sign is omitted
drh [Wed, 30 Jul 2025 13:37:49 +0000 (13:37 +0000)] 
Enhance the printf formatter for %#f such that the minus sign is omitted
if the '+' is missing and all digits shown in the rendering are zero.
Thus, for example, '%#.2f' renders -0.004 as "0.00" instead of "-0.00".

FossilOrigin-Name: 09e1d7c7b4615262dd03adf1be201122f3cb8909ad381d67f51c812f07e25719

9 months agoFix SQLITE_OMIT_WAL builds on windows.
dan [Tue, 29 Jul 2025 11:04:32 +0000 (11:04 +0000)] 
Fix SQLITE_OMIT_WAL builds on windows.

FossilOrigin-Name: 575271c3ae53c64784a2aa1e9b7c6cdcb0402022967155dd176a6b1f1e560b50

9 months agoAdd new extended error codes to SQLITE_ERROR and SQLITE_IOERR, for use
drh [Sat, 26 Jul 2025 12:51:18 +0000 (12:51 +0000)] 
Add new extended error codes to SQLITE_ERROR and SQLITE_IOERR, for use
by extensions.

FossilOrigin-Name: 02b241bc4ce72d50a8d7621a663e759443b532a5ff9354fc3266ad6bb9433ed4

9 months agoDo not apply the [/info/e33da6d5dc964db8|EXISTS-to-JOIN optimization] if
drh [Wed, 23 Jul 2025 12:48:16 +0000 (12:48 +0000)] 
Do not apply the [/info/e33da6d5dc964db8|EXISTS-to-JOIN optimization] if
the subquery contains a LIMIT clause.
[forum:/forumpost/2025-07-23T10:59:14z|forum post 2025-07-23T10:59:14z].

FossilOrigin-Name: 314c493f273a34dff7b9f954e7553bc540bbcf5b913f779ef9ce0b9ba11acf7a

9 months agoFix a potentially uninitialized field in the WhereLoop object that is used
drh [Tue, 22 Jul 2025 15:51:41 +0000 (15:51 +0000)] 
Fix a potentially uninitialized field in the WhereLoop object that is used
as part of the skip-ahead-distinct optimization.  This fixes various
[forum:/timeline?ymd=20250722&u=yxchen&vfx|recent forum reports from yxchen].

FossilOrigin-Name: c10f9970c6a3ffacaef0f0728fc7ff11011686835dc78ca43035c0493e0af319

9 months agoApply [ebb346c5aa]'s change to sqlite3.1, as reported in [forum:bf92f78344 | forum...
stephan [Mon, 21 Jul 2025 18:00:44 +0000 (18:00 +0000)] 
Apply [ebb346c5aa]'s change to sqlite3.1, as reported in [forum:bf92f78344 | forum post bf92f78344].

FossilOrigin-Name: 477211be60cd873d078293f0dd767506c069c3dd83bc1759ae7258d4d3dff359

9 months agoEnsure that certain local files are not inadvertently carried over into the snapshot...
stephan [Sun, 20 Jul 2025 18:29:35 +0000 (18:29 +0000)] 
Ensure that certain local files are not inadvertently carried over into the snapshot tarball and causing confusing build results.

FossilOrigin-Name: 47fdf7ed2cad7ec56118cf4f77297b1178cd2104a21b19d4afad46437a944378

9 months agoTeach autoconf/tea/configure to be able to run from the canonical source tree so...
stephan [Sun, 20 Jul 2025 18:05:45 +0000 (18:05 +0000)] 
Teach autoconf/tea/configure to be able to run from the canonical source tree so that a snapshot build or appropriate symlinks are not necessary in order to test the extension.

FossilOrigin-Name: 71b9365b848d9b2bc75336ebbec815eba3a7ed5168798759753a990a1b706fc8

9 months agoFactor out the unusual encoding-change case from vdbeCompareMemString() for
drh [Sat, 19 Jul 2025 20:10:07 +0000 (20:10 +0000)] 
Factor out the unusual encoding-change case from vdbeCompareMemString() for
a performance improvement in the common case, and a small size reduction.

FossilOrigin-Name: cbd46ab8a8b4622f42dd9f87f28b812c1d6fa5ea73a4e8f1253514455f397783

9 months agoSmall performance optimization in sqlite3VdbeRecordUnpack().
drh [Sat, 19 Jul 2025 19:54:44 +0000 (19:54 +0000)] 
Small performance optimization in sqlite3VdbeRecordUnpack().

FossilOrigin-Name: eae168def2ff11f57f730f8a3bd86748b0943077e37b2709c10de0aecff664ec

9 months agoSplit the (internal) sqlite3VdbeCheckFk() routine into two variants,
drh [Sat, 19 Jul 2025 18:46:03 +0000 (18:46 +0000)] 
Split the (internal) sqlite3VdbeCheckFk() routine into two variants,
sqlite3VdbeCheckFkImmediate() and sqlite3VdbeCheckFkDeferred(), which
run faster than the combined general-purpose variant.

FossilOrigin-Name: 872b1b52ed93ef85911c2ef87b15673f9e102aef564f208e0a916af62671df93

9 months agoUse fewer CPU cycles to commit a read transaction.
drh [Sat, 19 Jul 2025 18:17:06 +0000 (18:17 +0000)] 
Use fewer CPU cycles to commit a read transaction.

FossilOrigin-Name: 861e55656abb208b4f1f2c8808c76c0454427af85a8930ab53f9c053605f39c7

10 months agoAdd SQLITE_SELFORDER1 to JS's sqlite3.capi namespace. It's only useful when built...
stephan [Fri, 18 Jul 2025 22:18:41 +0000 (22:18 +0000)] 
Add SQLITE_SELFORDER1 to JS's sqlite3.capi namespace. It's only useful when built with an sqlite3.c which itself was created with -DSQLITE_ENABLE_ORDERED_SET_AGGREGATES, which the canonical build does not do but custom builds may.

FossilOrigin-Name: fdd15e938ccfac9e871d781d1c8fe8be6dbd9e8cbbcb8b7f0b035e5ceebb8746

10 months agoFix a minor comment inaccuracy.
drh [Fri, 18 Jul 2025 19:17:32 +0000 (19:17 +0000)] 
Fix a minor comment inaccuracy.

FossilOrigin-Name: b66fcb61a1d044fa18419ab382a8b159e9b6bb52956917d8a9de4dccf8dc9a87

10 months agoIncrease the precision of the "real time" output from the ".timer" command
drh [Fri, 18 Jul 2025 17:40:34 +0000 (17:40 +0000)] 
Increase the precision of the "real time" output from the ".timer" command
in the CLI from milliseconds to microseconds.

FossilOrigin-Name: c5dbe93114d318fea431859e388af74aeb4cb854c514c9910590441c990321f3

10 months agoEnsure that the accumulator for an aggregate always gets initialized,
drh [Fri, 18 Jul 2025 12:10:15 +0000 (12:10 +0000)] 
Ensure that the accumulator for an aggregate always gets initialized,
even when the aggregate is on the right side of a LEFT JOIN and never
gets evaluated.  This fixes a problem introduced by [663f5dd32d9db832]
and found by dbsqlfuzz.  Test cases in TH3.

FossilOrigin-Name: 235cf6586b9ac914a32bd8adfd460daae998687f02f0998a7aa3c6bfc857d1c9

10 months agoPedantic internal build doc fix.
stephan [Thu, 17 Jul 2025 19:18:01 +0000 (19:18 +0000)] 
Pedantic internal build doc fix.

FossilOrigin-Name: 9ef429a8507745e0a6fae4f0ec1dc2b142dad1357f9a7ff576e7834c8ff5c6fe

10 months agoDiverse wasm build cleanups.
stephan [Wed, 16 Jul 2025 20:50:40 +0000 (20:50 +0000)] 
Diverse wasm build cleanups.

FossilOrigin-Name: 14ca18f72a7edde7c65a6c6b23fdc3f5ed6860371795926045c987f7b2c75e1b

10 months agoFix vtabH.test so that it works on windows even if there are files that begin with...
dan [Wed, 16 Jul 2025 17:24:31 +0000 (17:24 +0000)] 
Fix vtabH.test so that it works on windows even if there are files that begin with "$" in the root directory.

FossilOrigin-Name: 19a79219a7d52272102ff09d19e6b9b87e88e0070592fd7e6040bd8ce66ad238

10 months agoRemove some stray makefile debug output.
stephan [Wed, 16 Jul 2025 16:56:33 +0000 (16:56 +0000)] 
Remove some stray makefile debug output.

FossilOrigin-Name: 7ef22c3d11088210d2267375ec188bd352b067614200394b9877f2e40dc12bb2

10 months agoIn the wasm makefiles, replace X:=Y with X=Y because := has different semantics depen...
stephan [Wed, 16 Jul 2025 14:51:23 +0000 (14:51 +0000)] 
In the wasm makefiles, replace X:=Y with X=Y because := has different semantics depending on the make impl and its use is arguably a bad muscle-memory habit worth breaking. These makefiles are very specifically for GNU make, but long-term it would be nice to eliminate that requirement.

FossilOrigin-Name: d4203311a2f39189ed8f30d519468aed8983af7772a5b247e7557d3e1936064e

10 months agowasm: remove some extraneous levels of makefile var and fix the (unsupported) wasmfs...
stephan [Wed, 16 Jul 2025 13:22:38 +0000 (13:22 +0000)] 
wasm: remove some extraneous levels of makefile var and fix the (unsupported) wasmfs speedtest1 build to account for var renaming which happened long before this.

FossilOrigin-Name: 35b2315343e22ca12c6ee3f5be8741eba889bb6461e08fad0a8ae7db033319cb

10 months agoRemove an unnecessary step from the wasm builds and account for a recent Emscripten...
stephan [Wed, 16 Jul 2025 11:56:16 +0000 (11:56 +0000)] 
Remove an unnecessary step from the wasm builds and account for a recent Emscripten-internal code-generation change which caused a post-build cleanup step to not actually clean up (harmless, but adds about 26k of useless stuff to the resulting JS).

FossilOrigin-Name: a8ed16989dcd324bd9caa09aec7979249deaf59ca13bc377379ddd83c53379cd

10 months agoFurther internal wasm build cleanups. No functional changes.
stephan [Wed, 16 Jul 2025 11:09:18 +0000 (11:09 +0000)] 
Further internal wasm build cleanups. No functional changes.

FossilOrigin-Name: 8364d89c3bc1d1dbd95b4324a41bd655251ebd2da5b9f1b9f9aceba9c3d26d3d

10 months agoInternal refactoring of the WASM build makefile rule generator, working towards paral...
stephan [Wed, 16 Jul 2025 10:34:14 +0000 (10:34 +0000)] 
Internal refactoring of the WASM build makefile rule generator, working towards parallelizing the various build modes (which is not currently possible because most modes share the same sqlite3.wasm output file name).

FossilOrigin-Name: 1062b61e9c949d76791ed7974cf6c38d1cec9797a930e9ad7ca851130f5e9a48

10 months agoTeach the sqlite3 CLI shell to look in XDG_STATE_HOME for the CLI history file before...
stephan [Wed, 16 Jul 2025 09:27:55 +0000 (09:27 +0000)] 
Teach the sqlite3 CLI shell to look in XDG_STATE_HOME for the CLI history file before falling back to its historical location in the user's home directory.

FossilOrigin-Name: 1e663374c3fcc20ab0b3250aa1ff9d5e5ac391c89808ad589aa30c8882d4b61e

10 months agoSquelch a legitimate but harmless 'discards const' warning. shell-xdg-vars
stephan [Wed, 16 Jul 2025 09:20:02 +0000 (09:20 +0000)] 
Squelch a legitimate but harmless 'discards const' warning.

FossilOrigin-Name: 73539fe0932494234b8f2293b0dbc1f0aac60a7d00fdaf4a59c2da654ce26f5b

10 months agoAvoid evaluating special vtab operators (e.g. MATCH) that are part of ON clauses...
dan [Tue, 15 Jul 2025 19:00:01 +0000 (19:00 +0000)] 
Avoid evaluating special vtab operators (e.g. MATCH) that are part of ON clauses attached to left joins from being evaluated too early. Fix for [forum:/forumpost/428ef7c468 | forum post 428ef7c468].

FossilOrigin-Name: 9f184f8dfa5ef6d57e10376adc30e0060ceda07d283c23dfdfe3dbdd6608f839

10 months agoAdd test case to between.test. vtab-leftjoin-fix
dan [Tue, 15 Jul 2025 18:51:46 +0000 (18:51 +0000)] 
Add test case to between.test.

FossilOrigin-Name: ffebbb7ae977adc6c729d30b51f2ff29d416e018d82e450d87ccd973472819c8

10 months agoOptimize allocation of large tombstone arrays in fts5.
dan [Tue, 15 Jul 2025 14:06:15 +0000 (14:06 +0000)] 
Optimize allocation of large tombstone arrays in fts5.

FossilOrigin-Name: 0fcc3cbdfa21adf97aed01fa76991cccf9380e2755b0182a9e2c94e3c8fb38d7

10 months agoAdd the snapshot-zip makefile targets for both Windows and Posix.
drh [Mon, 14 Jul 2025 18:27:32 +0000 (18:27 +0000)] 
Add the snapshot-zip makefile targets for both Windows and Posix.

FossilOrigin-Name: 8c73c0c5935431556f687556bfdb459754609f07c6366c810a55bf7583ee303d

10 months agoEnhance the "mktoolzip.tcl" script (used by the "tool-zip" makefile target) so that
drh [Mon, 14 Jul 2025 16:05:59 +0000 (16:05 +0000)] 
Enhance the "mktoolzip.tcl" script (used by the "tool-zip" makefile target) so that
it uses "fossil test-filezip" to build the ZIP archive if available, and so that
it also generates windows-dll-*.zip on Windows platforms.

FossilOrigin-Name: 63ddc215eb6106985c53d3c8d99f5445a92acf4359a6bb2681882c49583df871

10 months agoIn rtree.c, ensure that the pReadAux statement is reset whenever the bAuxValid flag...
dan [Mon, 14 Jul 2025 15:40:25 +0000 (15:40 +0000)] 
In rtree.c, ensure that the pReadAux statement is reset whenever the bAuxValid flag is cleared. Fix for [forum:/forumpost/3e45ed31d8 | forum post 3e45ed31d8].

FossilOrigin-Name: 3c0afda372cd688e9aff7be1c0a41f557c8c8819f5f47420166ce8255cd806c8

10 months agoIn rtree.c, ensure that the pReadAux statement is reset whenever the bAuxValid flag... rtree-aux-column-fix
dan [Mon, 14 Jul 2025 15:34:11 +0000 (15:34 +0000)] 
In rtree.c, ensure that the pReadAux statement is reset whenever the bAuxValid flag is cleared. Possible fix for [forum:/forumpost/3e45ed31d8 | forum post 3e45ed31d8].

FossilOrigin-Name: 1740f9a09850f6647fc1f6384353d89a1ac0b2b15c429b576b6014eada71937e

10 months agoAdd new sessions function sqlite3changeset_apply_v3() and its streaming equivalent...
dan [Mon, 14 Jul 2025 14:51:43 +0000 (14:51 +0000)] 
Add new sessions function sqlite3changeset_apply_v3() and its streaming equivalent. This allows changesets to be filtered on a per-change basis, not just per-table.

FossilOrigin-Name: 10ebd7a119ef1985755ef143a941fbaed1b5ca1c8a71e011c8bbc70e383fd337

10 months agoFix harmless compiler warnings in builds that use SQLITE_OMIT_DATETIME_FUNCS.
drh [Mon, 14 Jul 2025 09:41:59 +0000 (09:41 +0000)] 
Fix harmless compiler warnings in builds that use SQLITE_OMIT_DATETIME_FUNCS.

FossilOrigin-Name: e11fbf9fd630a7de2e0b0e4b67dded05b905b2a0ba04aa7e915ca9df2d9ebe21

10 months agoAvoid evaluating special vtab operators (e.g. MATCH) that are part of ON clauses...
dan [Sat, 12 Jul 2025 18:14:41 +0000 (18:14 +0000)] 
Avoid evaluating special vtab operators (e.g. MATCH) that are part of ON clauses attached to left joins from being evaluated too early. Possible fix for [forum:/forumpost/428ef7c468 | forum post 428ef7c468].

FossilOrigin-Name: 18ba07c152294a96d510a7851a0860f982ff1e0725afeebed9a343f550f6925a

10 months agowasm: introduce the sqlite3.oo1.DB.wrapHandle() and Stmt.wrapHandle() APIs, which...
stephan [Fri, 11 Jul 2025 19:52:36 +0000 (19:52 +0000)] 
wasm: introduce the sqlite3.oo1.DB.wrapHandle() and Stmt.wrapHandle() APIs, which enable clients to wrap (sqlite3*) resp. (sqlite3_stmt*) pointers in their oo1 API counterparts, optionally with or without taking over ownership of the pointer.

FossilOrigin-Name: e5d079549594ca44852773b8919894866394e47ad725dadc7f65242413a219d3

10 months agoClearer docs for the unowned db/stmt handle mechanism. oo1-unowned-handles
stephan [Fri, 11 Jul 2025 19:44:42 +0000 (19:44 +0000)] 
Clearer docs for the unowned db/stmt handle mechanism.

FossilOrigin-Name: 53401b5435e30c4b47b6e203976b714d616246d734b5876a34f53f6388f872f8

10 months agoCorrect a one-too-many-exclamation-points bug which caused the opposite of intended...
stephan [Fri, 11 Jul 2025 19:34:30 +0000 (19:34 +0000)] 
Correct a one-too-many-exclamation-points bug which caused the opposite of intended semantics in oo1.Stmt.pointer ownership.

FossilOrigin-Name: 91e709f36d36174534b4cf4ff548a558e66cca5e23a6c8c106bc43375fc3ce72

10 months agoAdditional header comment documentation in the ext/misc/vtablog.c test extension.
drh [Fri, 11 Jul 2025 17:02:11 +0000 (17:02 +0000)] 
Additional header comment documentation in the ext/misc/vtablog.c test extension.

FossilOrigin-Name: 3656acfaa3011321a6e17fb81e5bdedcfffeab6035f133ab89ae9589bf5bef72

10 months agospeedtest1: in WASM builds, disable the "app" test set by default because that one...
stephan [Fri, 11 Jul 2025 11:06:25 +0000 (11:06 +0000)] 
speedtest1: in WASM builds, disable the "app" test set by default because that one set is triggering file-not-found errors for the db file for reasons not yet understood.

FossilOrigin-Name: 9d68971c58261bce72b49c574cf07ad31add62bee814c58840b927fed7eb87b1

10 months agoDo not export the numerous Emscripten HEAPxy symbols and remove the last remaining...
stephan [Fri, 11 Jul 2025 10:27:06 +0000 (10:27 +0000)] 
Do not export the numerous Emscripten HEAPxy symbols and remove the last remaining JS code which references them. They have long-since been replaced by internal equivalents and a specific feature check on one of them (which is also no longer needed) is triggering an exception from Emscripten. More details are in [https://github.com/emscripten-core/emscripten/issues/24656 | Emscripten ticket #24656], noting that this is not an Emscripten bug but an Emscripten behavior change brought it to light.

FossilOrigin-Name: b9462dc1461c830466f4e1de4a4d3bf249e3f81aea363f13462ea915769878d9

10 months agoImprove the accuracy of the ETC on both devtest and releasetest.
drh [Thu, 10 Jul 2025 20:45:00 +0000 (20:45 +0000)] 
Improve the accuracy of the ETC on both devtest and releasetest.

FossilOrigin-Name: a3f96cafdc0e1f2eeccc6509f1f9c26d2c48668953550f299cf2805a0a063014

10 months agoAdd the estkey column to the jobs table of testrunner.db. The plan is to
drh [Thu, 10 Jul 2025 17:19:08 +0000 (17:19 +0000)] 
Add the estkey column to the jobs table of testrunner.db.  The plan is to
use this to collect measurements that will help generate improved ETAs for
a test run.

FossilOrigin-Name: 9eccf5267c6423c9dd4da1d61b62bbb6fbba44fb8089da79f89c84e8b77ff0f0

10 months agoMinor internal doc correction in vdbeInt.h.
stephan [Thu, 10 Jul 2025 09:27:57 +0000 (09:27 +0000)] 
Minor internal doc correction in vdbeInt.h.

FossilOrigin-Name: c3a2ef639c22255a298cbccb7fd871ec9b24929f82bf95d6982b12daf5c963d6

10 months agoMinor JS doc tweaks.
stephan [Thu, 10 Jul 2025 09:25:57 +0000 (09:25 +0000)] 
Minor JS doc tweaks.

FossilOrigin-Name: 34d893b4837be8bb679e9809befd98201dd79c8d2054f41429b18793b77e840f

10 months agoFix the empty-table optimization on INTERSECT so that it does not try to
drh [Wed, 9 Jul 2025 20:11:49 +0000 (20:11 +0000)] 
Fix the empty-table optimization on INTERSECT so that it does not try to
use an uninitialized register for LIMIT processing.

FossilOrigin-Name: 6918ada008507b4564ca0dc5f4f6818c49a42eb14a16285b2074e21dcc8f2c3f

10 months agowasm: DB.wrapHandle() no longer accepts a DB object as its first argument, as there...
stephan [Wed, 9 Jul 2025 13:43:53 +0000 (13:43 +0000)] 
wasm: DB.wrapHandle() no longer accepts a DB object as its first argument, as there's no apparent use case for proxying one DB object with another. Doc improvements for the new code.

FossilOrigin-Name: 0ee19db02a9b9320681d4393d9ba52889d149eac8ee114fc7b7f52a57271c139

10 months agowasm: add a few tests demonstrating that oo1.Stmt.paramaterCount's new impl does...
stephan [Wed, 9 Jul 2025 13:13:01 +0000 (13:13 +0000)] 
wasm: add a few tests demonstrating that oo1.Stmt.paramaterCount's new impl does not change visible behaviors. Add the c-pp-filtered files to 'make clean'.

FossilOrigin-Name: 3fe61545967f82190011edb90b1be6a448b590555c7ba5f8e96494aeea8f88ce

10 months agoFix a possible user-after free following OOM in the EXISTS-to-JOIN
drh [Tue, 8 Jul 2025 22:11:39 +0000 (22:11 +0000)] 
Fix a possible user-after free following OOM in the EXISTS-to-JOIN
optimization.

FossilOrigin-Name: 498ee8d514e64cdc93a8d68e1971b6326c6132daf25067936bec921c42494caa

10 months agoAdjustments to test/incrblob4.test so that it works on both Linux and Mac
drh [Tue, 8 Jul 2025 20:28:35 +0000 (20:28 +0000)] 
Adjustments to test/incrblob4.test so that it works on both Linux and Mac
in spite of error message differences between those platforms.  Minor change
to termIsEquivalent() to provide 100% MC/DC.

FossilOrigin-Name: 720387f8604f7cd997f1850ed62ce6ab32608155d7f02a89c695041caafc4067

10 months agoNew optimizations to detect early when queries return no rows due to
drh [Tue, 8 Jul 2025 19:53:36 +0000 (19:53 +0000)] 
New optimizations to detect early when queries return no rows due to
tables being empty.  This includes the EXISTS-to-JOIN optimization that
tries to transform EXISTS constraints into additional terms of the FROM
clause.

FossilOrigin-Name: e33da6d5dc964db817d1bc63c9083aecd93d49ee14d5198600b47eaf7c5b9331

10 months agoFix a problem with the fix in [5cb8e342e1].
dan [Tue, 8 Jul 2025 19:02:26 +0000 (19:02 +0000)] 
Fix a problem with the fix in [5cb8e342e1].

FossilOrigin-Name: 043ff54fb746c54bc6cfa6aa8c8a32c876c09d36163125916ad01024b98d447b

10 months agoFix another problem with running fts5 integrity-check in SQLITE_DEBUG builds, this...
dan [Tue, 8 Jul 2025 18:44:56 +0000 (18:44 +0000)] 
Fix another problem with running fts5 integrity-check in SQLITE_DEBUG builds, this one causing an assert() failure.

FossilOrigin-Name: 5cb8e342e1d33a0fd04fd022900eeada46a2ee23f15c6abca1b37633e77429d6

10 months agoEnable the EXISTS-to-JOIN optimization if the outer query has no empty-table-optimizations
drh [Tue, 8 Jul 2025 17:28:09 +0000 (17:28 +0000)] 
Enable the EXISTS-to-JOIN optimization if the outer query has no
FROM clause.

FossilOrigin-Name: 1b9b124f9a35ebd1ac4ea70ef1ee08a4c82c11da690d4164f6b785a6fd9730d9

10 months agoIf SQLITE_DEBUG is defined, fts5 does extra checks as part of integrity-check. Ensure...
dan [Tue, 8 Jul 2025 14:54:20 +0000 (14:54 +0000)] 
If SQLITE_DEBUG is defined, fts5 does extra checks as part of integrity-check. Ensure that errors from these extra checks are only reported if the other, normal, tests all pass. This fixes a test case in fts5corrupt3.test that was failing if SQLITE_DEBUG was defined.

FossilOrigin-Name: 98a53fb276fa1fa733da2dd3255c35ce9f6af9b9feef6e76fb577b6d142167a2

10 months agoFix test case results in FTS5 that were changed error message improvements
drh [Tue, 8 Jul 2025 12:37:25 +0000 (12:37 +0000)] 
Fix test case results in FTS5 that were changed error message improvements
in [48044a6b57c0a16c] but which were omitted from that check-in.

FossilOrigin-Name: e1f8e0240b14f1338e947634e840af785e5042a09cd365975e922a13a562f4cd

10 months agoOnly run preupdate-hook tests in incrblob4.test if the preupdate-hook is enabled...
dan [Mon, 7 Jul 2025 20:47:23 +0000 (20:47 +0000)] 
Only run preupdate-hook tests in incrblob4.test if the preupdate-hook is enabled in the build.

FossilOrigin-Name: 56314b6b53c86ae131f780e20b62bdeabccba6d62dda41becc1c4b2e87cee07b

10 months agoSmall performance optimization in the resolver.
drh [Mon, 7 Jul 2025 19:03:50 +0000 (19:03 +0000)] 
Small performance optimization in the resolver.

FossilOrigin-Name: 840646df0696706bd4dd7a04dfc8b16ad80c24cbcbc57a22c9e65a93cc17af2b

10 months agoMerge the latest trunk enhancements and fixes into the empty-table-optimizations...
drh [Mon, 7 Jul 2025 18:35:51 +0000 (18:35 +0000)] 
Merge the latest trunk  enhancements and fixes into the empty-table-optimizations branch.

FossilOrigin-Name: f15cdf07573c05276a13885d74bae21a93544766344f19ef939b7a69edd1073b

10 months agoRework the fix to the problem described by
drh [Mon, 7 Jul 2025 16:19:44 +0000 (16:19 +0000)] 
Rework the fix to the problem described by
[forum:/forumpost/b9647a113b465950|forum post b9647a113b] so that it
provides a more complete fix that covers cases that were not resolved by
the original fix, and so that it does not cause performance regressions.

FossilOrigin-Name: 28db0d152d90fb5e62d03ea5caceabe8901be98522aef3dc2b54564fbc35355d

10 months agoSimplifications to the row-value IN operator logic. Do not let the query redundant-idx-columns
drh [Mon, 7 Jul 2025 15:40:53 +0000 (15:40 +0000)] 
Simplifications to the row-value IN operator logic.  Do not let the query
planner accept a WhereLoop for a row-value IN operator that uses the same
index column more than once.

FossilOrigin-Name: d2adf61f21a3ce901a2b08199ad0de191e88ef16e097c5f7a75c95ad958eff12

10 months agoWork around the Emscripten 4.10 regression described in [https://github.com/emscripte...
stephan [Mon, 7 Jul 2025 12:11:26 +0000 (12:11 +0000)] 
Work around the Emscripten 4.10 regression described in [https://github.com/emscripten-core/emscripten/issues/24656 | Emscripten ticket #24656]. Problem reported off-list by BrickViking.

FossilOrigin-Name: c385475b250f3364507a95c5832137098a9bb7c7fc12ab3bb116e1fad7bb7645

10 months agoAvoid invoking the preupdate hook from within sqlite3_blob_write() if the cursor...
dan [Mon, 7 Jul 2025 11:37:55 +0000 (11:37 +0000)] 
Avoid invoking the preupdate hook from within sqlite3_blob_write() if the cursor is already invalid.

FossilOrigin-Name: 9f335b9a4e9e761a0c6afd6dc69665a24506141bde88530bf59fcbdf957ae881

10 months agoBack out the fix at [ba7d5bad32ad6aac] because it does not always work and because
drh [Mon, 7 Jul 2025 10:54:00 +0000 (10:54 +0000)] 
Back out the fix at [ba7d5bad32ad6aac] because it does not always work and because
it causes a performance regression.  Add new test cases for row-value lookups of
indexes that contain redundant columns, three of which are currently failing.  This
branch is seeking an improved solution to the redundant index column problem for
row-value lookups.

FossilOrigin-Name: ad8ddcefab5cc526b1cd77731e00939c672e61ca83350d28961b67635d20da03

10 months agoFix parser error introduced by [325e547a2195571e]. See
drh [Mon, 7 Jul 2025 02:18:27 +0000 (02:18 +0000)] 
Fix parser error introduced by [325e547a2195571e].  See
[forum:/forumpost/095dbfc06e5b1f7e|forum post 095dbfc06e5].

FossilOrigin-Name: 4eefab44941fc6e17742fa49c8734e7f00a2177d82bc572e596228add53aad39

10 months agoRemove some dead JS code and some extraneous debug output from test code.
stephan [Sun, 6 Jul 2025 15:36:28 +0000 (15:36 +0000)] 
Remove some dead JS code and some extraneous debug output from test code.

FossilOrigin-Name: 6e73770a7f3845055e0130012d844c32c4a1bfdb87e8379c161e1a266a808143

10 months agoJS doc additions.
stephan [Sun, 6 Jul 2025 15:13:06 +0000 (15:13 +0000)] 
JS doc additions.

FossilOrigin-Name: 7933505f0c1d25c6ee81ead8edc5ea649a84ec0582321bcf5ed4a17232750f90

10 months agoExperimentally add sqlite3.oo1.DB/Stmt.wrapHandle(), which allow DB/Stmt instances...
stephan [Sun, 6 Jul 2025 15:01:44 +0000 (15:01 +0000)] 
Experimentally add sqlite3.oo1.DB/Stmt.wrapHandle(), which allow DB/Stmt instances to wrap a (sqlite3*)/(sqlite3_stmt*) optionally with or without taking ownership of it. The intent is to enable mix-and-match use of the C API, the oo1 API, and any other hypothetical API which exposes those pointers. oo1.Stmt.parameterCount is now a property access interceptor like Stmt.columnCount is, but that doesn't change how it's used.

FossilOrigin-Name: 1227543b87c3320d6b80e0f61b88ea53b68779966a0295c4d6a1db6369c48207

10 months agoImprovements to the EXPLAIN QUERY PLAN output for EXISTS-to-JOIN.
drh [Sun, 6 Jul 2025 01:19:09 +0000 (01:19 +0000)] 
Improvements to the EXPLAIN QUERY PLAN output for EXISTS-to-JOIN.

FossilOrigin-Name: 6b1ecbaa2ee405be040901dceac45d027d35c313622748ba4dbbd404e297a7fa

10 months agoEnhance the EXISTS-to-JOIN optimization so that it works on EXISTS subqueries
drh [Sat, 5 Jul 2025 23:33:21 +0000 (23:33 +0000)] 
Enhance the EXISTS-to-JOIN optimization so that it works on EXISTS subqueries
that do not have a WHERE clause, and so that it works on nested EXISTS
subqueries.

FossilOrigin-Name: c1d5295724f9cf7f49e0786d28016eff2d268a2b670f934d24c76787626089db

10 months agoAdd 'reconfigure' target to Makefile.in to re-run the configure script with the same...
stephan [Fri, 4 Jul 2025 18:32:18 +0000 (18:32 +0000)] 
Add 'reconfigure' target to Makefile.in to re-run the configure script with the same flags it was generated with.

FossilOrigin-Name: c60907e77b32824aaaf024d299cdaf161b5f64fc927ffe5d5455eeb5754e6b01

10 months agoPropagate the -ldl and -lpthread flags, if needed, into sqlite3.pc, per request in...
stephan [Fri, 4 Jul 2025 17:20:37 +0000 (17:20 +0000)] 
Propagate the -ldl and -lpthread flags, if needed, into sqlite3.pc, per request in [forum:44a58c807353162f | forum post 44a58c807353162f].

FossilOrigin-Name: 64f5f14322349b47451b8cac03bf8cd6f1ae45a8822e7f1ddee3d0b265047501

10 months agoMerge fixes from trunk into the empty-table-optimizations branch
drh [Fri, 4 Jul 2025 14:24:18 +0000 (14:24 +0000)] 
Merge fixes from trunk into the empty-table-optimizations branch

FossilOrigin-Name: 6f98b16d210a9f5b6ca4b4599e3dab3263eddbae7c70ddbcabf988f4a1014e8b

10 months agoFix harmless compiler warnings.
drh [Fri, 4 Jul 2025 12:25:24 +0000 (12:25 +0000)] 
Fix harmless compiler warnings.

FossilOrigin-Name: 13af4acebe09b047756c22b800136cffaba532e7fcaa448a4edf4fedb94e9bbc

10 months agoRemove an ALWAYS() added by [960a8e6fc91f4] that turns out to be false
drh [Fri, 4 Jul 2025 11:48:11 +0000 (11:48 +0000)] 
Remove an ALWAYS() added by [960a8e6fc91f4] that turns out to be false
in some cases of malformed SQL.

FossilOrigin-Name: cc8171461bf35f584888a24b844c8b79ad30155b19b61161e9f3abc276e8aae5

10 months agoDo not allow the EXISTS-to-JOIN optimization if the EXISTS clause is based
drh [Fri, 4 Jul 2025 11:06:34 +0000 (11:06 +0000)] 
Do not allow the EXISTS-to-JOIN optimization if the EXISTS clause is based
on a view, since that view might expand into a join.

FossilOrigin-Name: 872c41feddafcc21a02f1229ce017ceea9f8e309a4dd5b6e323477d67f975947

10 months agoImprove the early-termination optimization so that it works in queries
drh [Fri, 4 Jul 2025 10:26:55 +0000 (10:26 +0000)] 
Improve the early-termination optimization so that it works in queries
which use the LIKE optimization in the outer loop.

FossilOrigin-Name: b4e4d148243cfcb09aa0aaca30e83812b42e2780073e55c0e8c6e3da16243dfc

10 months agoMerge the latest trunk fixes and enhancements into the empty-table-optimizations...
drh [Thu, 3 Jul 2025 20:51:08 +0000 (20:51 +0000)] 
Merge the latest trunk fixes and enhancements into the empty-table-optimizations branch

FossilOrigin-Name: d4f47e04f5880e99a53089e2dd5cde64a7ea44f059d9906b5d11324896546714

10 months agoFix a few cases where LIMIT clauses that were part of scalar sub-queries on virtual...
dan [Thu, 3 Jul 2025 16:05:41 +0000 (16:05 +0000)] 
Fix a few cases where LIMIT clauses that were part of scalar sub-queries on virtual tables were not being passed to xBestIndex methods correctly.

FossilOrigin-Name: 960a8e6fc91f47add3a089dc6cef013109deadf809994c5149ad3bdfb3884de0

10 months agoImprovements to sqlite3_vtab_rhs_value() logging in the vtab-limit-fixes
drh [Thu, 3 Jul 2025 15:50:18 +0000 (15:50 +0000)] 
Improvements to sqlite3_vtab_rhs_value() logging in the
ext/misc/vtablog.c extension.

FossilOrigin-Name: 25131ee84f53dab1191e02c19cefd256aed2828c7edea325fcc0ba3b0a668583

10 months agoMake the value of an explicit LIMIT clause on a scalar sub-query available to xBestIn...
dan [Thu, 3 Jul 2025 15:32:27 +0000 (15:32 +0000)] 
Make the value of an explicit LIMIT clause on a scalar sub-query available to xBestIndex for simple "LIMIT 0" and "LIMIT 1" queries.

FossilOrigin-Name: 33b6a63caafccc61b3193714911cd8b5dd9b7f1798054b8c7845b23688d531f2

10 months agoMake handling of LIMIT clauses in correlated sub-queries on virtual tables more effic...
dan [Thu, 3 Jul 2025 14:28:47 +0000 (14:28 +0000)] 
Make handling of LIMIT clauses in correlated sub-queries on virtual tables more efficient.

FossilOrigin-Name: 7214cb2a5b35190a06a1040cd4c54f325d347f8d8e36a07fd76c0a421e266522

10 months agoEnhancements to the xBestIndex output from the ext/misc/vtablog.c
drh [Thu, 3 Jul 2025 14:10:03 +0000 (14:10 +0000)] 
Enhancements to the xBestIndex output from the ext/misc/vtablog.c
extension.

FossilOrigin-Name: 8b31acc0b18f38eb4af6efebd1ea25cd65a146651101579aee20afd9ec6dc2de

10 months agoFix an uninitialized variable added yesterday by [d27d34fb746280e7].
drh [Thu, 3 Jul 2025 11:52:17 +0000 (11:52 +0000)] 
Fix an uninitialized variable added yesterday by [d27d34fb746280e7].
This problem was discovered overnight by
[https://github.com/google/oss-fuzz|OSSFuzz].

FossilOrigin-Name: 6db4703f1178fc808f3a75c355fb6638fb12c88f6e1ce7f579e200ced8089114

10 months agoMinor tweaks to the exists-to-join optimization.
drh [Thu, 3 Jul 2025 00:17:27 +0000 (00:17 +0000)] 
Minor tweaks to the exists-to-join optimization.

FossilOrigin-Name: 9cb600ad576c68647ed943a0773019312c5f01c9c1ca9ff0bf1214b03a531b48

10 months agoMerge in the exists-to-join optimization that has been modified
drh [Wed, 2 Jul 2025 20:46:02 +0000 (20:46 +0000)] 
Merge in the exists-to-join optimization that has been modified
to relax the requirement of having an indexed join constraint.

FossilOrigin-Name: 1c1aef2b7feae29066d0330699ab634ef41f5b60cdcd479a60cb1a5409553138

10 months agoFix VDBE coverage
drh [Wed, 2 Jul 2025 17:43:59 +0000 (17:43 +0000)] 
Fix VDBE coverage

FossilOrigin-Name: ff593a16d61cc5c588d1737deb822abb90b1759475a4cabfcf608978b1191487

10 months agoEarly exit if one of the inner loops of a 3-way or larger join is an
drh [Wed, 2 Jul 2025 14:53:48 +0000 (14:53 +0000)] 
Early exit if one of the inner loops of a 3-way or larger join is an
empty table.

FossilOrigin-Name: eaad6ac707a5960d9518d4049b7b1759e7512727ce87be3c402408144bda0a97

10 months agoIf the LHS for an EXCEPT or INTERSECT operator is empty, skip over the
drh [Wed, 2 Jul 2025 13:19:24 +0000 (13:19 +0000)] 
If the LHS for an EXCEPT or INTERSECT operator is empty, skip over the
computation of the RHS.

FossilOrigin-Name: 13f096ae8a850a05d4a8684561066f11693ee66289e6568c44ef32822cca06f6

10 months agoImprove the bytecode for joins such that it exits earlier if it determines
drh [Wed, 2 Jul 2025 11:47:54 +0000 (11:47 +0000)] 
Improve the bytecode for joins such that it exits earlier if it determines
that no output is possible.

FossilOrigin-Name: 2d2b61cba44a756a3a41ef5c95bbb0c0b7111f4b679c578fec9bd0b214cca367

10 months agoEnsure that Expr.op2 values for TK_AGG_FUNCTION nodes are adjusted when
drh [Wed, 2 Jul 2025 02:03:43 +0000 (02:03 +0000)] 
Ensure that Expr.op2 values for TK_AGG_FUNCTION nodes are adjusted when
query flattening.

FossilOrigin-Name: d27d34fb746280e7e81335db4e195914b15403ef0da7b2955550553dd78fbe9a