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

32669 Commits

Author SHA1 Message Date
drh
cfbb9e99c5 Add an assert() to demonstrate that an arithmetic right-shift is being
used where it is needed.

FossilOrigin-Name: cce760dc6b3a9162a4afbf9b2b8cefb872092be8616c43b60754794b592fe782
2026-08-10 19:38:44 +00:00
drh
205e512915 Fix the logic for big-endian CPUs. Add comments on how to test various
limbs of the logic.

FossilOrigin-Name: cf49f4fc96d7493745e6611069598a14200ee062d6f25f94d275d18a782cd374
2026-08-10 18:07:34 +00:00
drh
a458960c18 Fix the logic to prevent buffer overruns.
FossilOrigin-Name: 82a8332ed905c47ea99b1d567fae7607018d657d6912e3546d9d67032f9eb0ab
2026-08-10 16:27:10 +00:00
dan
24ad808809 When comparing row values that are sub-selects, do not consider the collation sequences of the expressions returned by the sub-select when determining the collation sequences to use for the comparisons. i.e. in "(a, b)=(SELECT c, d)", do not consider the collation sequences of "c" or "d". Fix for problem [forum:/info/2026-08-09T09:33:49Z | 2026-08-09T09:33:49Z].
FossilOrigin-Name: 88580851be734d1917809a4254f2f117df58c71b4c118509ccb4756a300fa6e6
2026-08-10 15:57:42 +00:00
drh
15b79d7af8 Experimental changes to improve performance of the OP_MakeRecord opcode,
and especially the code the writes integer content into the record.
This change is not yet 100% correct.  It is a work in progress.  Parking
on a branch because I need to stop and work on other things.

FossilOrigin-Name: fa8dd2af6da66d14e6e2dbf68692d02322f750198fdf97be0b72f04e0a4ca79b
2026-08-10 15:36:31 +00:00
drh
2e9b3cf33a Make this optimization available to MSVC in addition to GCC.
FossilOrigin-Name: 648ab3f7aec532689cefd13d37889e262804e2f74b0c276ac4e41647cf08dcdc
2026-08-10 12:56:41 +00:00
stephan
cde725f23c Remove some stray debug output and obsolete bug-hunting comments. No functional changes.
FossilOrigin-Name: 41443d5ffe1f6852f447181071a0d9dac89df51c836d16b1bd9420a8513d2ec2
2026-08-10 12:45:11 +00:00
drh
662efd15c5 Merge the sqlite3Get8byte() enhancement from trunk
FossilOrigin-Name: 661d0c7104cc58c9b74fbf00b51ce6859e7640d0aa7f0b715b43a2d4fa4c8718
2026-08-10 12:41:48 +00:00
stephan
e9930003c1 Expose the sqlite3_backup APIs to JavaScript.
FossilOrigin-Name: fa17d89f76d50c153b6ff7ca96ae06c1ddc130abc3c0056dac3ef6d66f4f40c5
2026-08-10 12:41:17 +00:00
stephan
3d0687bade Disable Module.instantiateWasm() in node builds to match branch-3.53's behavior. Fix a sqlite3_backup test (duplicate finalize). The aforementioned world-breaking bug was caused by my browser having gotten into a funky state and needing a restart.
FossilOrigin-Name: 7d77bb088641881fca7a625d9828503d269d0ca1e245583a2dcf24a4f09390f5
2026-08-10 12:35:49 +00:00
drh
c9771b7018 Replace the EIGHT_BYTE_U64 macro with the in-line function sqlite3Get8byte()
which is more efficient cross-platform.

FossilOrigin-Name: 9492183f2f954d89be698e0d48123d50a6dc96c06b18482e1f06ae9031506033
2026-08-10 12:29:43 +00:00
stephan
961cc1ec09 Add tests for the sqlite3_backup JS bindings but they are disabled while tracking down an unrelated problem which prevents those tests from working (most of the sqlite3.capi methods are being mis-mapped to the sqlite3InitModule function for reasons unimaginable).
FossilOrigin-Name: cb610a8a87cfd29d70ab6b825b4a43d44fd801feecfda1bf4fb7ae181806d84b
2026-08-10 12:18:07 +00:00
stephan
6e93c8c5f1 Fix a circular dep generated by mkwasmbuilds.c
FossilOrigin-Name: f2514ace13c3bcc2ae1d39546fb095676c3540ec8fff6f3f194339660151fc77
2026-08-10 11:51:20 +00:00
stephan
46441db7e8 Merge trunk into the js-backup-bindings branch.
FossilOrigin-Name: 692c4e8ad81f142a454c2038fcdc83317dbaeb71dd6d0497edb4621297c2e35c
2026-08-10 11:23:29 +00:00
jeffchen
3a666ca2c3 Decode fixed-width integer serial types in vdbeRecordCompareInt() with a single eight-byte read and an arithmetic shift, replacing a switch that predicts poorly on mixed-width integer keys.
FossilOrigin-Name: fad1a762e1191b2869926ce27ea8185b9efd40bdf26a26383aaba7c4d490323c
2026-08-09 19:03:50 +00:00
dan
ab5206d096 Remove unused variable from pragma.c.
FossilOrigin-Name: 7e3ad0dcde0fcfae8a6e7e16af5844cd02fe16fef5927891a11166c1f54eb45a
2026-08-08 20:29:57 +00:00
dan
7c8835dc0a Change the way fts5 test code casts between integers and pointers to avoid a ubsan error in some versions of gcc. Report [bugs:/info/2026-08-08T15:54:04Z | 2026-08-08T15:54:04Z].
FossilOrigin-Name: d275eb5b634afb85bf1f5fab4fd5243247ed06e03db3e2077192c01ff43713d0
2026-08-08 19:47:28 +00:00
drh
e0725b0a4f Improve the performance of the OP_Column opcode of the bytecode engine
by in-lining the call to sqlite3VdbeSerialGet().

FossilOrigin-Name: d2dd7b3b1355b245cc5e69dff10ad23de3b280571ab3c1cd29d4446404b31402
2026-08-08 09:58:25 +00:00
drh
e9f4537eaa Fix a comment typo. Remove an unused function prototype.
FossilOrigin-Name: b08d213dafe2ec284fccabeff0350fecdffcdd762841b381a1bcd7e02b1fda77
2026-08-07 19:11:36 +00:00
drh
c1f4848a46 Fix a harmless UBSAN warning.
FossilOrigin-Name: eb492208fceb9ea0e68ba0012806fe36f55f0b270af6f3704c51235bcae27869
2026-08-07 18:41:59 +00:00
drh
c3356c59a7 Change the order of two operations in the REAL decoded in OP_Column for a
small performance boost.

FossilOrigin-Name: d3ab3da0246df5cff298309c7d6ffbb18f1217e248bce819911db50e670eb093
2026-08-07 18:18:31 +00:00
drh
d3b165a85e Code simplifications. This check-in actually gives up a few CPU cycles
relative to the previous, according to speedtest.tcl, but not many.  And
in exchange, the binary is smaller.  The branch has a whole is still much 
faster than trunk.

FossilOrigin-Name: 20f50ea9c617307262b7b8a9b878e3fc0d18729452d7e1efd7c06625559d8afb
2026-08-07 15:09:28 +00:00
dan
67bf81a85d Fix a problem introduced by [32c762bbb1] causing sessions module conflict handling to malfunction when used with a database handle configured with sqlite3_extended_result_codes(). Also ensure the "session_eec" permutation, which would have detected this, is run as part of release testing.
FossilOrigin-Name: 8b3da5d6cea2e3b31784f5e8f05c4801a3d881039aa26ecadf3a50b4454a3de6
2026-08-07 13:33:54 +00:00
drh
da42eb7d05 Further optimization to OP_Column along the lines of the prior check-in.
FossilOrigin-Name: a4b3021d1fc465e162cf648d88b3d0900b7f206bed12d5a9b07bfffd7fc29e49
2026-08-07 11:14:34 +00:00
stephan
d0afe9c60b Lower the range of inputs accepted by the pstack allocator to address [bugs:4dbd096fe335f974dbd096fe3|/bugs/4dbd096fe335].
FossilOrigin-Name: fafefb59481530255a881f22b1f75b587731867d00eabea39eaec7da2199fdff
2026-08-07 05:31:08 +00:00
jeffchen
fec25f94b6 Performance optimization in OP_Column: decode serial types 0 through 6, 8, and 9 (NULL and all integer widths) inline in a switch, avoiding the call and dispatch overhead of sqlite3VdbeSerialGet(). The wide-integer cases 5 and 6 add bulk, but omitting them would leave those types paying the switch miss plus the original call. Other serial types are decoded as before.
FossilOrigin-Name: cf829cc21ba3e00e9201f02a8feb2fe60f937315f1b267457717e8cd824f8e1d
2026-08-07 00:00:05 +00:00
drh
ca0b40d5c0 Fix a hyperlink typo in the Lemon documentation
FossilOrigin-Name: ee8ef5cd4eb0fa2725aef6e27e771e27f04246a11ee235bad4b506d1b116abbe
2026-08-06 17:20:07 +00:00
stephan
a790e273e2 Merge in the errant wasm-updates branch, caused by developer PEBKAC.
FossilOrigin-Name: 75d3343fa3daa0503c057bae14c83ce6a1c5b8dfa4b5a312168b26e5d877684b
2026-08-05 15:40:00 +00:00
drh
111fa8c62e Fix a compiler warning that comes up in gcc 4.0.1 for target powerpc-apple-darwin9
FossilOrigin-Name: 90fe33d9edfd5100c4459940ee39f268da8edcdaa9315d2610428d5d1f99938d
2026-08-05 15:30:43 +00:00
stephan
7dc844581a Strip out 42kb of ext/wasm/libcmpp.c (build tool) by using a destilled build shorn of the capabilities we don't use in this tree, like #pipe and loadable modules.
FossilOrigin-Name: 3ec42b829e8de23f8d050b49b48eac1220463156eb973fd4daff440e6183c868
2026-08-05 15:00:54 +00:00
drh
bf66606d4f Small performance improvement and size reduction in the page cache.
FossilOrigin-Name: 2c3ae5b8e1bba3234dac9eb8869dffc8f54ccd20ea278d8440790c715a7f5a00
2026-08-05 14:00:08 +00:00
jeffchen
da6fd9a046 Avoid an integer divide on the page-cache lookup fast path. The hash
table size in pcache1 is always a power of two, so the bucket index in
pcache1FetchNoMutex() can be computed with a mask instead of a modulo.
An assert() verifies the power-of-two invariant in debug builds.

FossilOrigin-Name: 750c37d4044c0957b81a12448293c0f85bab0b9f981d8e6f573ffe27eeb8f16d
2026-08-05 13:29:06 +00:00
drh
0a5f27711f The sorter enhancement at [bdc841de10fef65b] contains a bug where it
might sort 64-bit integers in the wrong order due to the limited
precision of double.  Fixed here.

FossilOrigin-Name: 6bdfff7ddb63d0b4f28f6c174a36e81486a652056a4e21644378a22feda780fd
2026-08-04 20:40:10 +00:00
drh
eb72953f00 Improved performance in the sorter by adding a special case comparison
function for when the sorting by floating-point numbers.

FossilOrigin-Name: bdc841de10fef65b627deb8b770702c976174a66af847c96ebecf24d91798744
2026-08-04 14:55:51 +00:00
dan
7a4496c474 Fix a single byte buffer overrun in the approximate_match extension.
FossilOrigin-Name: 7f380be91b75307bd7b57415cb53ca5c01894ff921f2ad23736a8faaff25b907
2026-08-04 13:44:14 +00:00
dan
e1c9934f9f In fts5, account for the possibility of negative docids when allocating a buffer to store the results of merging detail=none prefix lists. Fix for report [bugs:/info/2026-08-04T08:49:27Z | 2026-08-04T08:49:27Z].
FossilOrigin-Name: a7f8c92f623e9cbe8a61266d949916acc9e5110c94dff4aa6fd1ad2ea8a60d4e
2026-08-04 11:04:17 +00:00
drh
063b370cc5 Improved comparison function for the sorter, using the idea demonstrated
by the patch in [bugs:/info/2026-08-02T13:41:35Z|Bug 2026-08-02T13:41:35Z].

FossilOrigin-Name: 6cda98ee3c8fcd996fd8986269e0a046f41fc9cee19345e32c055435e1874c67
2026-08-03 19:59:43 +00:00
dan
17cf702308 When processing a vector IN(...) term in a WHERE clause, do not add individual terms for each column if the RHS of the IN(...) is a query that is expected to do the special min-max aggregate behaviour. Fix for [bugs:/info/2026-08-03T09:05:06Z | 2026-08-03T09:05:06Z].
FossilOrigin-Name: 0f873f565192e7d1e0bfa1f1c147d02f6cca5b91492f4498736d2c8896599e9d
2026-08-03 15:05:05 +00:00
dan
0fae7568b2 When processing a vector IN(...) term in a WHERE clause, do not add individual terms for each column if the RHS of the IN(...) is a query that is expected to do the special min-max aggregate behaviour. Possible fix for [bugs:/info/2026-08-03T09:05:06Z | 2026-08-03T09:05:06Z].
FossilOrigin-Name: b5cee626e149c2cd977ad682ca34ccafe847a468f9e01b365a1fd901a08176e4
2026-08-03 14:10:21 +00:00
drh
c2f474e1dc Set O_BINARY for Windows console output in the CLI. Candidate fix for
[bugs:/info/2026-08-03T08:52:42Z|bug 2026-08-03T08:52:42Z].

FossilOrigin-Name: af136dc1d10361e41fa3bd0d31e9b066e34b19bfd2be1076cc7d7ff2bcef337a
2026-08-03 13:22:37 +00:00
drh
1b087395d7 Fix harmless compiler warnings caused by the enhancement at [a67bff640c9e4ffd]
FossilOrigin-Name: e0ab12ec7270046010c0b96682799d5659c10e6ba9620bb4bffc8209ad1272fe
2026-08-02 22:51:45 +00:00
drh
1e7bd5531e Make the test-use-only SQL function fts3_exprtest() (available only if
compiled with SQLITE_TEST) more resistant to out-of-bounds inputs.
[bugs:/info/2026-08-02T12:28:28Z|Bug 2026-08-02T12:28:28Z] and
[bugs:/info/2026-08-02T12:31:40Z|bug 2026-08-02T12:31:40Z].

FossilOrigin-Name: 30a61347077f4b9996f6ea771c7fd27203ab05039d54cc4df3068e45faf4d2d4
2026-08-02 22:45:36 +00:00
drh
ee917329f8 Cap constraint values on constraints to the amatch virtual table so
that they fit into a 32-bit signed integer.
[bugs:/info/2026-08-02T13:01:25Z|Bug 2026-08-02T13:01:25Z]

FossilOrigin-Name: 092b87164aa7d097287ad0fee4be8b66cf840043dc3091193824d74f2d54a833
2026-08-02 21:59:03 +00:00
drh
0950d29072 Update the header comment on the zipfile extension to state clearly that
writes to the ZIP archive are non-transaction.  No code changes.
[bugs:/info/2026-08-02T14:03:49Z|Bug 2026-08-02T14:03:49Z].

FossilOrigin-Name: 1b623a6064427e81dffc2897e017accc98243ecaf23c5f4df752d3da91b51be6
2026-08-02 20:17:53 +00:00
drh
4b43e57193 Fix incorrect header comment in the templatevtab.c demo extension.
[bugs:/info/2026-08-02T13:49:50Z|Bug 2026-08-02T13:49:50Z]

FossilOrigin-Name: 1c95c741ca01be4241657f27e5e8697afb46dbc2ca4764a3de5080b04ffa3750
2026-08-02 19:40:20 +00:00
drh
ba60f9c836 Fix typo in column name generation logic of the (debugging use
only) vtablog.c extension.
[bugs:/info/2026-08-02T13:56:56Z|Bug 2026-08-02T13:56:56Z]

FossilOrigin-Name: 42bde30535f43404a5996618ff923dcc8af71b56f72935e9e22ada315a046e72
2026-08-02 19:35:12 +00:00
drh
b94e0e8468 Take care to avoid trying to compute 0.0/0.0 in the diskused extension.
If such a value needs to be displayed, show the result as 0.0.
[bugs:/info/2026-08-02T12:48:58Z|Bug 2026-08-02T12:48:58Z]

FossilOrigin-Name: a455f347c50872518eff46753ded9a6080ece680be4a1fcc9dc747e16521e95c
2026-08-02 18:27:00 +00:00
drh
a1594cadeb Reduce the size of test cases for the closure extension so that they
run faster.  The closure extension is not important for anything anymore
and is retained mostly for historical reference.  There is no point in
burning CPU cycles testing it with large cases.

FossilOrigin-Name: 73350e128141ab21d8f4c1213a1cca4e153151d85e39643defd438341ed53d14
2026-08-02 17:22:13 +00:00
drh
83e6d3e471 Enhance the (unsupported) closure extension to support 64-bit "depth"
values. [bugs:/info/2026-08-02T13:11:13Z|Bug 2026-08-02T13:11:13Z].

FossilOrigin-Name: fccfd5c410c875c35b72475d442c9c1d384deaef1859ba05586841d6c0909e0d
2026-08-02 17:12:01 +00:00
drh
c59cf28db7 Do not allow the (obsolete and unsupported) closure extension to use itself
as its own reference table.
[bugs:/info/2026-08-02T13:07:40Z|Bug 2026-08-02T13:07:40Z].

FossilOrigin-Name: 5e347561c3f8d271bf47c44473fa4b51b87ccab91b40c33f5aad28990a26e9ba
2026-08-02 16:32:28 +00:00