20689 Commits
Author SHA1 Message Date
drh 1e4e45df24 Fixes to the LIKE optimization to catch new corner cases where it cannot
be applied if the LHS operand does not have TEXT affinity.
[bugs:/info/2026-10-28T05:04:51Z|Bug 2026-10-28T05:04:51Z]

FossilOrigin-Name: d62cdafdcb356c29c3b1ca4d40c3b73d41f79c856c6b2ee9662a5b6496845be6
2026-10-29 01:36:22 +00:00
drh 1a434126ab Add commented-out code that *would* support +NaN and -NaN literals
in JSON were we to choose to support that syntax.

FossilOrigin-Name: 170bf1b4f2b8e5bb1d265aaf092a2054d21c304d1c98d4e44d7f0dc5498d7a0e
2026-10-28 19:23:52 +00:00
drh 3cf93639e3 Fix the log(B,N) function so that it works for 0.0<B<1.0.
[bugs:/info/2026-10-26T16:32:25Z|Bug 2026-10-26T16:32:25Z]

FossilOrigin-Name: 994f05ccd131604c5c6296fab93c1bb1e936ce5ef70d1168abf275c3f30a0158
2026-10-28 00:20:35 +00:00
drh 37a6d8d4e4 When aggregate content passes through the sorter to implement GROUP BY
it loses its subtype.  So do not pass JSON values from an index on an
expression through the sorter
and into a JSON aggregate, as that optimization will not work.
[bugs:/info/2026-10-27T20:02:01Z|Bug 2026-10-27T20:02:01Z]

FossilOrigin-Name: 9887cc52346ff30b54b6236069883dd929df217a3ee80a32e8920cf6a439cf88
2026-10-28 00:00:01 +00:00
drh 7721051f69 Fix a problem introduced by [08e979525ff1eef8] and reported by
[bugs:/forumpost/70e3174f54|a follow-up comment] to the original bug report.

FossilOrigin-Name: 6be81afa66f131d7efe59a24a693e738b0d48f82831ce2e0003dc4e4186fa980
2026-10-27 18:26:34 +00:00
drh ab6b5f2290 Remove an ALWAYS() in the query planner that can be false for a truly
ridiculous 350K+ character input query.
[bugs:/info/2026-10-26T18:22:15Z|Bug 2026-10-26T18:22:15Z].

FossilOrigin-Name: c5f98a311e26856611f841a7938f92a327c21cc9d89661c6e894d6e77fe98629
2026-10-27 16:24:38 +00:00
drh 814fd8ef4d Merge branch-3.54 fixes into trunk
FossilOrigin-Name: 11932649019188e1d8abd30c61dc88f0d9a425e659461bbb78056c86d4dab12d
2026-10-27 15:11:21 +00:00
drh 2ec708af90 Add the SQLITE_FILECTRL_EXPIRE_STMTS file-control to facilitate testing.
FossilOrigin-Name: fc75988f7591ec24db06d03050e5f6c893fb328d99b6392ea6aab0ef0f31aa59
2026-10-27 12:18:02 +00:00
dan fb6bc2334f Disable the "<expr> IN ('const')" to "expr = 'const'" optimization when 'const' has a collation sequence. Bug [bugs:/info/2026-10-26T04:25:22Z | 2026-10-26T04:25:22Z].
FossilOrigin-Name: 46da9e0212d2d3f3108b1985ebbabe637970d7329ed8c9c1ccb2bfb18a14acac
2026-10-27 11:08:15 +00:00
drh aa20b91788 Expire every prepared statement that uses a schema when that schema is
cleared.  In the VDBE, do not access p4.pTab or p4.pIdx fields if the
prepared statement is expired.

FossilOrigin-Name: 6ca068cdcef197ffe137d77d445b17a9d6b7f25d120acb55fb719b6842aef638
2026-10-27 10:07:10 +00:00
drh 2cc8623f54 New test cases for schema resets.
FossilOrigin-Name: b694f96bf89937f8d81fe885b08bc0a9e84ec97d37cb27dda5cbd37719d9e358
2026-10-26 23:21:29 +00:00
drh 4bb628d92d Fix missing prototype for sqlite3DbMaskUnion()
FossilOrigin-Name: 7c2ea69839322d113377122e87250e746712dd7e8920ff867a95cf68c2de3917
2026-10-26 22:53:00 +00:00
drh 51dcf20a61 A more accurate approach to resetting schemas on active statements.
FossilOrigin-Name: 031a3911c352c7d1a70dc9d3b6fa32438ac585ae13e2558759b0b90580784ecf
2026-10-26 21:07:46 +00:00
drh 06e89d6616 Be very permissive for schema resets following a schema cookie mismatch.
FossilOrigin-Name: bfb2c110a9b72d6e6df17c6f4cc50d36e834e290eb95ef990dd941c29a8f305c
2026-10-26 20:07:13 +00:00
drh 37623e85f8 More precision in controlling when to reset schemas.
FossilOrigin-Name: 717b1b90c52d94c54615ef954288695adb8e1647fb2259a906641b6279af8d96
2026-10-26 19:51:23 +00:00
drh 9b3f957fe1 Where possible delete the table root page prior to updating the schema
cookie, and that avoids the need to early-out the reprepare loop.

FossilOrigin-Name: 258891bee056c57cf0459bfcfc0e34bb736866a3ea81fc9d8a1117c572e6f48e
2026-10-26 17:21:24 +00:00
drh f7564c540b Do not be as aggressive at blocking automatic reprepares due to
a pending schema reset.

FossilOrigin-Name: c1a6ef0daa09fdad2ef807dd9defde3e5c7ceb11646f5129b3db19559398fe64
2026-10-26 15:44:25 +00:00
drh 9a7e5d2e43 Update to include the latest trunk enhancements.
FossilOrigin-Name: 95da88756c843bedc858c6e973170770459032340c109bdacb1efc81fc27af8a
2026-10-26 15:26:25 +00:00
drh 77f8caa273 Merge corrections from branch-3.54 into trunk
FossilOrigin-Name: c2c5f34f0f60d3f8b09976149d633b36754c0f139b41cb30fc27b478dee9fdd5
2026-10-26 14:43:56 +00:00
drh 4303eaf221 Reorganize OP_MakeRecord slightly to avoid signed 32-bit integer overflow
prior to discovering an oversize error.

FossilOrigin-Name: 8575e97c30c076d886ca8ce901a8e413d11a41308ca3494b2e196f49160c36fb
2026-10-26 12:46:03 +00:00
drh ac308db785 Back out the tSerial type definition change. It was a mistake.
FossilOrigin-Name: fc56735f1c34ee0d8605d4f79ed2e13e5f54017898178c8d20a79d34fea6597c
2026-10-26 12:37:49 +00:00
drh 2692a5619b Improvements to handling of failed DDL statements from within an
application-defined function.

FossilOrigin-Name: 35cf7c1e811b2b5fa00fd3a2bb1918dd841bc1e950aa0ca00f5102c3b616f104
2026-10-26 11:46:18 +00:00
drh 005a5862a5 Experimental fix to [bugs:/info/2026-10-25T19:26:00Z|Bug 2026-10-25T19:26:00Z]
FossilOrigin-Name: efdff276d2c19f77be5b5b600084996126ec2ae3e2a7ed91f2e7d7e1916043ba
2026-10-26 01:20:04 +00:00
drh 1820defd76 Merge all recent branch-3.54 fixes into trunk
FossilOrigin-Name: 4fee54f1d687c2e2b4a760c59d1d29fceb81623494cf65b72c309f4922dc0a7e
2026-10-25 22:40:37 +00:00
drh 3ba6a65bbb Fix another problem with OS_VXWORKS
FossilOrigin-Name: 5eb1662fbb3af945017821094522cf05dd30df3e7b5e780a96e627c5549a5ce0
2026-10-25 20:15:12 +00:00
drh 5a7949b088 Avoid a small memory leak that might occurs if SQLite is compiled using
-DOS_VXWORKS=1 and a call to sem_open() in the unix-namedsem VFS fails.

FossilOrigin-Name: f0a3729e3835cf27f8ffc0b40239ec722eb0f97543ae3a6026ec2e64baf6cb54
2026-10-25 19:29:06 +00:00
drh e5672e209e Better detection of database corruption in the clearCellOverflow() routine.
FossilOrigin-Name: b6c072240dfe4f5d075b1b505c98281f830579f48ff939cdb6e054bfb179efa3
2026-10-25 18:43:18 +00:00
drh 862625c9ae Use a 64-bit integer to measure expression chain size in
dupedExprSize(), in case of crazy expressions.

FossilOrigin-Name: ed78f5d2bf2042332637edf541c1295f5f5ca7b1cbb4f647492d3f2221afc781
2026-10-25 17:45:41 +00:00
drh 42c9401de2 Use a new typedef "tSerial" to determine the datatype for serial-type
value.  It is 32 bits for reasonable SQLITE_MAX_LENGTH but can be
64 bits if necessary.

FossilOrigin-Name: 8435c6f0b1ac3025f5af5da2a0f03898142c506e5981d55a2b633e611dcecb8f
2026-10-25 17:38:36 +00:00
drh 834c87f539 Increase the size of unixShmNode.nRegion to 32 bits to avoid the possibility
of integer overflow.

FossilOrigin-Name: 033b603cedb4ea246373d4015b4873b8ea1eb523c8f60d9f842cdea25dc97210
2026-10-25 16:54:02 +00:00
drh 732a2f0d97 Teach SQLite's internal sqlite3AtoF() routine to understand "Inf"
and in so doing fix
[bugs:/info/2026-10-22T05:11:21Z|Bug 2026-10-22T05:11:21Z].

FossilOrigin-Name: 8b1fa7497fef8e4bd36dc4614dbb33bc78f34b11300de0caff92a7da0d35a63e
2026-10-25 15:59:53 +00:00
drh c1ee4b4c88 Fix a bug in the whereOrInsert() routine of the query planner that caused
a sub-optimal query plan to be selected.
[bugs:/info/2026-10-24T05:24:02Z|Bug 2026-10-24T05:24:02Z]
The speedtest1.c program is updated to include the test case.

FossilOrigin-Name: acda734dc86a46636b9ea274b887f1587b762263cc7d1767cb43124bae4eaa00
2026-10-25 12:39:29 +00:00
drh f282a6d222 Fix performance problem according to
[bugs:/info/2026-10-25T01:57:04Z|bugs-forum reply 2026-10-25T01:57:04Z].

FossilOrigin-Name: 040d465c8a036c2f2f2d15579d9977b9ddbb35d29124c33932fe03f60b2a9d3f
2026-10-25 11:23:19 +00:00
drh 9626d89e02 Rework the classic seconds-only sleep computations in [458351f9725a423b]
to avoid any chance of integer overflow.

FossilOrigin-Name: d08cabd778f7844d04f3852d93197e80c0d0f4f30a589f7fd0d28577fa3fa68b
2026-10-24 22:25:07 +00:00
drh 0a4a0aab8c Pages that fail the cell-size-check should be marked as uninitialized so
they are not reused without being checked again.
[bugs:/info/2026-10-24T05:20:01Z|Bug 2026-10-24T05:20:01Z]

FossilOrigin-Name: 0f540888bc7c62a44078bd0f1c1f98ed22624608384562e4b8b619382fe15631
2026-10-24 18:13:36 +00:00
drh 3e6bbeaeca This is the change suggested by
[bugs:/info/2026-10-24T05:24:02Z|Bug 2026-10-24T05:24:02Z].
But it makes SQLite run slower, at least on the speedtest1.c benchmark.
Need to investigate further.

FossilOrigin-Name: 1d40327bcf2db8ea63d872f4c2f0b9941cb27a4ea63edeee8268b20f0eaffd4e
2026-10-24 17:25:21 +00:00
drh 30be364a7c Always report back the output flags from the xOpen method of the unix VFS.
[bugs:/info/2026-10-24T04:49:19Z|Bug 2026-10-24T04:49:19Z]

FossilOrigin-Name: 7bd441063bd8d9681aac38f0951108f9d6b814a3e192a9f7f5ffe4c95103317a
2026-10-24 17:08:39 +00:00
drh f565c8efc4 Fix various minor problems in the CLI.
[bugs:/info/2026-10-24T04:43:44Z|Bug 2026-10-24T04:43:44Z]

FossilOrigin-Name: a7fd475c0d34d84232e721c724ccbc07729f594ab20aba9eb0631cf76a09ce23
2026-10-24 16:49:09 +00:00
drh 9410bfb946 Use 64-bit math to avoid integer overflow in unixSleep() on the rare
systems that lack both usleep() and nanosleep().
[bugs:/info/2026-10-24T09:43:25Z|Bug 2026-10-24T09:43:25Z]

FossilOrigin-Name: 458351f9725a423bba4672b83c3f1fd446de2559f416b3877514a0ccb8d4df0e
2026-10-24 14:54:49 +00:00
dan 98fced6200 Change the order of fields in an internal structure to avoid the possibility of leaking heap address information when a corrupt database is queried.
FossilOrigin-Name: 3f9a0ba4f4dffac7a4b9de30e66d94498a1433d96e327cfff43134b8856f4ba1
2026-10-24 14:37:18 +00:00
dan 31b1a10a9c Change the order of fields in an internal structure to avoid the possibility of leaking heap address information when a corrupt database is queried.
FossilOrigin-Name: a5261fd58070d4cb10c627e54491ed7588d96f47073b19612aa669f684e8e5b5
2026-10-24 14:29:45 +00:00
drh 342d4527d3 New CLI commands: .if, .elseif, .else, and .endif. New CLI function:
capable(X).

FossilOrigin-Name: 7ba9c1f65fd2ed16570110decfc4ee28a0deeff20ec09c749acd188d27892e69
2026-10-24 14:05:21 +00:00
drh 32d4ecb572 Improvement to testing using the new CLI commands.
FossilOrigin-Name: 1209b11fda9649891b28add70a6503eeb7b9645c01a76e750703cec0297fb5dd
2026-10-24 13:57:04 +00:00
drh 0e3a71c327 Further improvements and bug fixes to .if. Add the if.sql test script.
FossilOrigin-Name: 8d352db18c50870df83af8ffd2fa2858264cebf2f67674fe1356bcef5bc80a2f
2026-10-24 12:34:08 +00:00
drh 2e1dd36d03 Enhancements and bug fixes to .if. Added a heredoc option to .read for
testing purposes.

FossilOrigin-Name: 680551e7130467ed7f924c8b0c0cb32519d229e463183b72a9eeeff5f1101ac3
2026-10-24 11:59:08 +00:00
drh c14245073f Add the "capable(X)" function to the CLI, with the idea of using it
for things like ".if capable('fts5')".

FossilOrigin-Name: cdef947cd078b117725b1592e13897d010182ad20220dba00a3f293c42b451fd
2026-10-24 08:19:30 +00:00
drh 8ac6750d71 Initial prototype implementation of ".if", ".elseif", ".else" and
".endif" for the CLI.

FossilOrigin-Name: 52f352565670b76425dea3a575b52a9d9465b732e8a6d794f97588a178361e92
2026-10-24 03:27:17 +00:00
drh 19e832b3b3 Merge WAL race condition fixes from branch-3.54
FossilOrigin-Name: 6322b44f1389028fb64cdc1a644b45884b111fcc638ced02a981070af2860426
2026-10-24 00:40:15 +00:00
dan 9a9446f3b0 Fix a race condition with a writer that could cause a connection with a read-only *-shm file to return a spurious SQLITE_READONLY_RECOVERY error.
FossilOrigin-Name: e2e7c8eb02daea0876fb25abccd96c769f55fba3e995f0e7cf29aa992d7c61a6
2026-10-23 18:14:43 +00:00
dan 196f6a9389 Fix a race condition with a writer that could cause a connection with a read-only *-shm file to return a spurious SQLITE_READONLY_CANTINIT error.
FossilOrigin-Name: 30a301835b588f9d57fc04af3140612bef781bdc9b19aa83515d77a24ab06ee0
2026-10-23 17:24:48 +00:00