31907 Commits

Author SHA1 Message Date
drh
b23a628422 Merge the latest trunk enhancements into the wal2 branch.
FossilOrigin-Name: 28d1d29ad465b150ea705af8352c0e6599b3f42c15474b2ae89e8a2c2b9b097c
2026-04-22 19:47:59 +00:00
dan
2a07c6de2c When updating indexes on expressions, omit the update if the new indexed values are the same as the old.
FossilOrigin-Name: f0fc4e5ec334da3a1db8b0334e23d1911874c96675690da94210b2afb45f7307
2026-04-22 19:38:04 +00:00
dan
68b07ddd41 Add OOM test for the new code on this branch.
FossilOrigin-Name: 685be705a2a69e79de0d581e5bbe9d942133817342121786a551d95d59a4af6c
2026-04-22 19:25:12 +00:00
drh
4b69e7704b Mark branches that are believed to be unreachable.
FossilOrigin-Name: 18ed9736fbbea762e04b8ad156e83e577e60c5234a5e233540ad8664fe3b379c
2026-04-22 19:12:48 +00:00
dan
e17ab401f0 Instead of adding a branch to OP_IdxInsert, use an extra OP_IfNull when updating indexes on expressions.
FossilOrigin-Name: 5112f96cb1428693614b91bcca78326fccf7289e395a920339676ceeba871e3f
2026-04-22 18:19:24 +00:00
dan
57ee077c5e Enable the optimization on this branch for indexes on expressions only.
FossilOrigin-Name: 3576b6930436b3149c5033476f70518e9b4adeaeec2538a68b7dc599eb854c47
2026-04-22 17:50:50 +00:00
dan
c7edd22456 Fix P3/P5 confusion in the comment above OP_IdxDelete.
FossilOrigin-Name: 0fb6ca8e22f355838a02223dd24b34c0669a6cc0b7ac80931c721db72cf5c1c8
2026-04-22 17:31:19 +00:00
dan
8606a52934 Detect and omit cases where an index key is being replaced with an identical key.
FossilOrigin-Name: 7a01caf0d0864a462eb81b7643dcf89048f4ae56a29d762f0cfc38066218504f
2026-04-22 16:58:36 +00:00
drh
5c6404aa77 Fix a integer type bug in the previous check-in.
FossilOrigin-Name: 5e1b5ff1c170e94956bf77bd38afcad6369cb9f9333864711212af045281ad0e
2026-04-22 13:41:20 +00:00
drh
429369f4aa QRF and the CLI preserve zero bytes when outputing unformatted BLOB values.
FossilOrigin-Name: dbc1d6f0a3452607e4e92155df0fdb1c5ea4ea5ad1654664f86383faf6c105ef
2026-04-22 12:22:32 +00:00
drh
9529894a29 Fix harmless compiler warning in QRF.
FossilOrigin-Name: dcfb505ac7762f7a3102e1c3853a83dca1d1ef436cc8981949b63c7d7992cc5b
2026-04-21 22:19:38 +00:00
dan
c4c47a49a8 Disable optimization of nested EXIST loops. Possible fix for [forum:/forumpost/077c02e8ed | forum post 77c02e8ed].
FossilOrigin-Name: d0d95a39bc211034071746395ee6dbcfbea9d573d27480655391ba9698f7e214
2026-04-21 20:40:22 +00:00
drh
ee7f6f29fc Fix the BETWEEN operator so that it propagates the EP_Subquery,
EP_Collate, and EP_HasFunc flags in the expression tree, as it ought.
Fix for the problem reported at
[forum:/forumpost/2026-04-21T19:10:55Z|forum post 2026-04-21T19:10:55Z]
and probably a bunch of other problems too.  This has been incorrect
for a long time.

FossilOrigin-Name: 2d1d2947b28f5dcbf4c66b594e176038c4e71e61948a88db565c1cb1212657ce
2026-04-21 20:28:38 +00:00
dan
c3b52dff53 Correctly dequote the constraint name passed to ALTER TABLE DROP CONSTRAINT. This improves upon the partial fix in [7f5afb12f4]. Forum post [forum:/forumpost/a746b08b87 | a746b08b87].
FossilOrigin-Name: 9387238cb0bb2651c64ecb229072df039577d71fd91546a2f0c94ca9755bf25d
2026-04-21 18:07:04 +00:00
dan
30af54043e Disable optimization of nested EXIST loops. Possible fix for [forum:/forumpost/077c02e8ed | forum post 77c02e8ed].
FossilOrigin-Name: 64f0d9eb63a351de12bb9643f1f6390a89f6d95dc81c07f1dc409ee31bae6f83
2026-04-21 16:40:08 +00:00
drh
4ebed2a4e5 Fix an off-by-one buffer size calculation in the decimal.c extension.
FossilOrigin-Name: 24df42104d5fd1cf974f2bf539fa7515808e21e68d64899c39f5fcf3bee49a48
2026-04-21 16:07:15 +00:00
drh
532ed30ab2 Do not unnecessarily delay opening the database file in the CLI.
FossilOrigin-Name: ab6ee76c1266b753d0749c63890f40db875536ceb4dd3252cc7a3386e386a0c1
2026-04-21 14:39:23 +00:00
drh
5e99eeb3d8 Fix another bug in [/info/e33da6d5dc964db8|EXISTS-to-JOIN] - this one
having to do with an OFFSET clause of a LIMIT.  Reported by
[forum:/forumpost/2026-04-21T10:57:09Z|forum post 2026-04-21T10:57:09Z].

FossilOrigin-Name: 1dd3c6a5e50ac3f617683678223e42f48636c17e58905506c5c74cc4bf05845c
2026-04-21 12:59:43 +00:00
stephan
d3abfd77f5 Reformulate how the OPFS async proxy Worker is loaded for the bundler-friendly builds to work around a bug in Vite in which it incompatibly rewrites the Worker's URL arguments. Addresses the discussion at [https://github.com/sqlite/sqlite-wasm/pull/159|npm package PR 159] and patch validated by Jure Rotar.
FossilOrigin-Name: ec877a30f5c5db30b9154745140744c5cc80d89673d79e50901d7377599cf2b4
2026-04-21 10:19:38 +00:00
drh
63984b6ab7 Fix the fileio extension for Windows builds so that it does not depend on
the sqlite3_win32_utf8_to_unicode() and sqlite3_win32_unicode_to_utf()
routines that are found in the SQLite core.
[forum:/forumpost/2026-04-20T02:02:56Z|Forum post 2026-04-20T02:02:56Z].

FossilOrigin-Name: fe0414a9a3caf6af67f53a5f3534efd5d4bf4978ebce1c591ef62d6961e55701
2026-04-20 10:28:19 +00:00
drh
93082e5589 Fix a harmless compiler warning in test/speedtest1.c.
FossilOrigin-Name: 13f0fd1daaf787bff6eded4a01c2cf47c79e52cf8812bb344995e28c015a4ed1
2026-04-18 21:51:32 +00:00
drh
f6b807a022 Performance improvement in the substr() and length() SQL functions.
Caution: The new code may give different results for malformed UTF8.
I do not consider that to be a problem by the GI/GO principle.

FossilOrigin-Name: 6124d27a33f4562f40777c2c6318d61709f7b481f23f9ade45064d8ad0700752
2026-04-18 12:31:53 +00:00
drh
8c6a6b85db Fix a test case that started failing due to a change in the help text
for the ".prompt" command of the CLI.

FossilOrigin-Name: bfe9df1bf4660ce6bdfd11a4f06d32694c93750c7bc0a6432459d9f1089eace4
2026-04-17 19:12:27 +00:00
dan
9f76fb019e Update interrupt2.test to avoid using Tcl_GetCommandInfo() from within calls to Tcl_DeleteCommand().
FossilOrigin-Name: 1979aa0902a43f20d4e396c5f9b9a49aaf0094d8520bf53ce058bb379a7720ab
2026-04-17 15:09:50 +00:00
drh
29997b4731 Help-text and comment fixes in the CLI. Add the output-redir-test.txt
testing script.

FossilOrigin-Name: ec58a133b4716d4f5a53c38853f8ecdb7a1275b931663ce07c8dc700d845e62e
2026-04-17 11:41:33 +00:00
drh
f0c8e27670 Less error-prone parsing of ".once" options. Fix for the problem reported
by [forum:/info/2026-04-17T01:26:56Z|forum post 2026-04-17T01:26:56Z].

FossilOrigin-Name: b235a8093734f457c2731af017c99027510d04e5cd1060f5559afbec5409a472
2026-04-17 01:50:40 +00:00
drh
d6c985ad0b Fix testrunner.tcl so that it does not create directories with names
ending in "sqlite3.o" or "sqlite3.lo".  Use "sqlite3obj" for those
directory names instead.  Otherwise "make clean" gets confused.

FossilOrigin-Name: a4bf9289c9cdb12b22bfb24e7e2b0243384e9edece12ae3fed14afbfe9b93260
2026-04-16 19:50:52 +00:00
drh
1696740fdc Improved comments explaining the logic, and improved diagnostic messages
when testrunner.tcl encounters trouble loading the sqlite3 extension.

FossilOrigin-Name: 8d820b0ccfccff94ed5b7297fa587ac27a74e990f233cfe229da7409ab2e3af8
2026-04-16 19:33:04 +00:00
drh
2cefd5954a Minor updates to testrunner documentation.
FossilOrigin-Name: f8507bd5e221783175be2bb7b907c098e0970b1cbcb01817df7217005eab9ab4
2026-04-16 17:07:23 +00:00
dan
8895c50403 Run C-language tests in tests/c/ as part of release test.
FossilOrigin-Name: e6929022b71c6bff7aa9cfbdb8a5e80499ca856b8c06d4211c55311b48704a08
2026-04-16 16:43:32 +00:00
drh
a2116f86b0 The sqlite3_str_new() interface never returns NULL, even after an OOM.
Code that uses that interface should invoke sqlite3_str_errcode() to see
if an OOM has occurred.

FossilOrigin-Name: cb910047edc591102dd4ed0d57c863b366981b8aa1d3085d5f95b1fbbabf6c31
2026-04-15 14:41:25 +00:00
drh
1e472f2d32 Bug fix in sqlite3_str_free(): Do not crash if called on an sqlite3_str
object returned from sqlite3_str_new() following an OOM.

FossilOrigin-Name: 92d8ac0c4938e43b00111b43630ecfa91c30e5200ca03937a84f4b50bd1a13b3
2026-04-15 14:17:58 +00:00
drh
e3dbf75160 Add support for the analyze() extension function to the fuzzcheck test
program.

FossilOrigin-Name: abd94554d24122f0e0c3b7b36e5846e8c7aa0dddbddd9aae35b3f6ae6ab283c0
2026-04-15 13:05:43 +00:00
drh
ade9289540 Improve the analyze() extension so that it returns a simple error message
as text (it does not throw an error) if the database is empty or is "temp"
or does not exist.

FossilOrigin-Name: 35379f60922f14d4f6d231ae627df066ad4e4510208bcc244505b9afb279f2fa
2026-04-15 12:47:37 +00:00
drh
dfba4eb34a Fix harmless compiler warnings seen by MSVC in the previous check-in.
Also add ext/misc/analyze.c to the makefile dependencies for the CLI.

FossilOrigin-Name: 5a0ee6e227042e41ac64869c75f961798b252458670c18662175fe5bfa8b87d3
2026-04-15 12:35:23 +00:00
drh
b57d2a5a51 Add the analyze() SQL function implemented the ext/misc/analyze.c extension
(but not part of the amalgamation).  Make that function available in the
CLI and add a new ".dbinfo" command to the CLI using that function.

FossilOrigin-Name: 4c4988e56df3c668b8891e2a55887a6618f5b84e9111e562b93059ddb9a662dc
2026-04-15 12:20:11 +00:00
drh
84c1079220 Add a missing open_db() call in the new ".dbstat" command of the CLI.
FossilOrigin-Name: a138e44a243466f8679e9652421f8c893a4a1bc0addc86736588d9aee51cf090
2026-04-15 11:58:54 +00:00
drh
c8d866294b Add the .dbstat command to the CLI.
FossilOrigin-Name: fdba76df2b3a5b4d56ba79f80fd8b16d5faebca1fb07a266262be2ea635e6f94
2026-04-15 11:41:50 +00:00
stephan
f0baddb205 On platforms which support ./configure --with-icu-config, ensure that 'make tclextension' includes the ICU pieces in the tcl extension. Intended to resolve [forum:92a88de4b88929fe|forum post 92a88de4b88929fe].
FossilOrigin-Name: 404fde8bacc3f05254a2fcdb1531a7f53125a7ad45dc6b68a5065c1d0c73b670
2026-04-15 11:40:13 +00:00
dan
ec2ea68d1f Avoid a potentially undefined left-shift in the fts5 porter tokenizer.
FossilOrigin-Name: 46a288e43e4c48fca6610bce6a2db418aaa3c8a1dcb115b7a0bfad2063355e58
2026-04-15 11:23:30 +00:00
dan
c71e6dd054 Handle the case where the name of the constraint in an "ALTER TABLE DROP CONSTRAINT" command is quoted. [forum:8bfbaec404 | Forum post 8bfbaec404].
FossilOrigin-Name: 7f5afb12f4a5d35cfe6b95f17d85ce85ce62159515bfe26fb9c67d3ce26b6d4a
2026-04-15 11:07:58 +00:00
drh
9efde40a5d Compute the average fanout for b-trees of depth 2 or more.
FossilOrigin-Name: 2f8598bb09f32100f22dd1d9465f3fa0f7f8d81f5d67c34de9919708345f090b
2026-04-15 10:49:14 +00:00
stephan
afef1f2923 Minor doc typo fixes contributed by BrickViking.
FossilOrigin-Name: c4660ce205919ce0d9262e7fd7879375a72ef65d9e5ac97f19caf5dc36e355aa
2026-04-14 23:53:38 +00:00
drh
09f37099a7 Code simplifications. Return NULL is the specified SCHEMA does not exist.
FossilOrigin-Name: 953969c88149ea2f589942b98a0a96d907956319e5aa09e2d5a3ae76d3e7d70a
2026-04-14 23:19:02 +00:00
dan
846fbd6653 Handle a special case of a corrupt changeset in sqlite3changegroup_add().
FossilOrigin-Name: eba625f917935437e3f366197df1c6717c7120ce0418a0cbac1d2024b2235091
2026-04-14 20:18:54 +00:00
dan
1b14a925dc Have the session module detect some corrupt changesets earlier.
FossilOrigin-Name: 0de91ff0d798cff21289d893cc441b89fc37b051d5cdf611d92d3ae2bc41cdf2
2026-04-14 20:17:41 +00:00
drh
526acc1834 Merge trunk enhancements and fixes into the analyze-sql-func branch.
FossilOrigin-Name: bb4a9beac87796b4186efce416bf03f840041bc588be6702c5a444d643df684e
2026-04-14 20:17:03 +00:00
drh
d962afef2d Various minor tweaks and refinements to the analyze() function.
FossilOrigin-Name: 48d94e72eaec443011dd1f7a7264e5222c05bb515c84deaf20ed4195b74d45ff
2026-04-14 20:07:29 +00:00
dan
839433d457 Handle a special case of a corrupt changeset in sqlite3changegroup_add().
FossilOrigin-Name: 49b3bac482c831f503c7f90c35959e7ea731950e991baba86b2ab95987d2539b
2026-04-14 20:02:49 +00:00
drh
395ac6c1bc Implementation of the analyze() SQL function is now mostly complete.
FossilOrigin-Name: 1ca0386ab2df0d88ed52941469d459114f483ecf6b7e4691bcc32e909636cb7d
2026-04-14 19:36:33 +00:00