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
5ff4a5390c Remove some unnecessary sqlite3_test_control() optimization control flags
for a small performance increase and size reduction.

FossilOrigin-Name: 2a9cb1e12ab4b81875e2d08f6cdecfb08b57137a69f6eb4efd19a56347184c3b
2026-08-22 16:33:58 +00:00
drh
2a71db26fa Improved use of LIMIT in UNION operators.
FossilOrigin-Name: 7304e5aeafe3981670d2f415b42a4ecc2371647c492d3b13098e564b27ba541e
2026-08-22 15:56:08 +00:00
drh
ea9d7d9db1 New optimization bit SQLITE_UnionLimit.
FossilOrigin-Name: 5890dbe54dd06fc7770267f59a430a47a39f7aaa0563274b851931e0dae754b2
2026-08-22 14:41:42 +00:00
drh
32db3f9843 Improved testability.
FossilOrigin-Name: e8e1ce6daecc2a142e9ea86b77aea159dd9f5040f02dd3f89bdbd8a915df8077
2026-08-22 11:10:24 +00:00
drh
ccfd5e0941 Add an optimization that converts UNION into UNION ALL if there is
a LIMIT 1 and no ORDER BY.

FossilOrigin-Name: fb83742dd163363b9c18c530b6f95964562a0fca2a563462379595632af94387
2026-08-22 10:39:18 +00:00
drh
3468c5b73e Fix check-in [468e730036edac22] so that it works with DESC indexes.
[bugs:/info/2026-08-22T07:01:45Z|Bug 2026-08-22T07:01:45Z].

FossilOrigin-Name: d1f4fa43f30d0aaf04af1b2afe9ec488654df43444bd49fae31ba1e2ab16b985
2026-08-22 09:33:37 +00:00
drh
45f4f1c1cb A couple of fixes, one of them important, for the previous check-in.
FossilOrigin-Name: 3a01099c45bd5965286640c23d727ef0c4a61bd97146bf01bac63e296808cba9
2026-08-22 01:21:46 +00:00
drh
6f1110ce05 Faster implementation of sqlite3_bind_int64(). Reduce the need to
reprepare when replacing one integer binding with a different integer
value is many cases.

FossilOrigin-Name: 98edd4ac227e555a84ee7025983a4a394c89d52cb5dfe2076ad9431566be2288
2026-08-21 20:32:06 +00:00
drh
8fafd53c09 Refactor. 2M cycles faster on x64.
FossilOrigin-Name: 2b3e73200b7842db493da6c9912c3f4405f629384127449edd46febdc21a0228
2026-08-21 20:21:23 +00:00
drh
54508b2801 In the CLI, finer-grain control of what status information is displayed via
the ".stats" command.  Add the ability to reset peak measurements after
each display.

FossilOrigin-Name: 852972861636d75ed935c3a0b1b170442048a1eaa80c4d4abd1c9de14c8be022
2026-08-21 14:04:05 +00:00
drh
a7969a001d Fix a harmless compiler warning in the non-deliverable normalize.c
extension.  [bugs:/info/2026-08-20T23:33:57Z|Bug 2026-08-20T23:33:57Z].

FossilOrigin-Name: 11a73d18be23f52c83d4b1a81841bef140a3cbd117bf3351c0bd143e0435a17f
2026-08-21 00:31:55 +00:00
drh
8d0cc5e4c6 Fix a faulty assert() in lemon, as reported at
[forum:/info/2026-08-20T14:18:08Z|Forum post 2026-08-20T14:18:08Z].

FossilOrigin-Name: 0672f6f07483b570eb9b3d27ca50a3f8564d2adad18fa7703240d45bbbd098b2
2026-08-20 16:47:20 +00:00
drh
48f575d0c0 Remove a literal 0x0d character from a sessions test script, using
char(0x0d) in its place, to avoid false-positive mixed-line-ending
warnings from Fossil.

FossilOrigin-Name: d0e4714aff80e74d16ed2d5b3a2186890ae0f801e9cef0199bb9ebc8de3c81ac
2026-08-20 15:59:53 +00:00
drh
5d92a8f1b5 Merge the latest trunk enhancements into the reduce-reprepares branch.
FossilOrigin-Name: 62ad88fe1ccd647ef77910d116856d6f2d9c96a726a2a270eacc8f5785875264
2026-08-20 14:05:49 +00:00
drh
47774fd90b Performance enhancements (inlining and partial inlining) in the
jsonbPayloadSize() routine of the JSON logic saves a little more than
10 million cycles (0.6%) on the standard benchmark (gcc 13.3, -Os, mint linux)
while using less than 700 extra bytes of code space.

FossilOrigin-Name: 3bd5456e50ef321f2cafcf67261d556a760624ce0caab430ed9454cebec233e7
2026-08-20 13:25:12 +00:00
drh
6c4e218239 Use testcase() macros to prove coverage in jsonbPayloadSizeWide()
FossilOrigin-Name: cff777eeb9b3e124a775bdd284b498fedf3945b42e20bd1ff68bf0c4085971bc
2026-08-20 13:12:16 +00:00
stephan
912706d94a Latest upstream libcmpp.c for #eval and #include -resolve, and removal of the clumsy @'string' literals.
FossilOrigin-Name: dc176e433555fc818fb20218d846f06477305e6524dc1d73f175de9efccb3428
2026-08-20 11:50:33 +00:00
stephan
73e39488f7 Internal doc typo fix. No code changes.
FossilOrigin-Name: 1c19bc27cbeb6614e7c01a28c76a7e5f649dba3c15c5fa4588c4e84fe5541947
2026-08-20 11:12:56 +00:00
drh
eb50028b75 Fix typo in comment. No code changes.
FossilOrigin-Name: da3cb2b23eef2a9e4a421f1a16301894a6dcc533009f4a70a938a2309540edec
2026-08-20 10:24:54 +00:00
drh
d7a233c837 Revise the OP_Int64, OP_Real, and OP_ColumnsUsed opcodes to split their
64-bit argument across two ordinary 32-bit arguments rather than storing
the 64-bit value as a separate memory allocation.  This gives a small
performance boost and size reduction, and makes the code a little easier
to maintain.

FossilOrigin-Name: 83e72cc862bf0e586271eed64660f70172a5b7d5a3299debb6b97ef71bd0802e
2026-08-20 10:08:42 +00:00
drh
16d41abcbd Fix a comment typo and add back a missing assert().
FossilOrigin-Name: 63de2f92abe39b9cccb6f4df5b4ade58823b456dd3382af57cdb7a5478dc4d46
2026-08-20 10:03:54 +00:00
drh
d99abf5ced Add a comment on the OP_ColumnsUsed operator.
FossilOrigin-Name: 8b3a5599940fe92e632a482275f8ee9ade48defc7f0d3cafc8d47035ed75d443
2026-08-20 09:41:13 +00:00
drh
ed22d61dd2 Fix the order of 32-bit works on an OP_ColumnsUsed operator.
FossilOrigin-Name: 0433f33e02e181fecfaff043f72c24118303d767aa9768ed118f48e548f61db3
2026-08-20 09:26:01 +00:00
drh
408aeef166 Fix a harmless compiler warning.
FossilOrigin-Name: 4278ee631a33400edd81f5bf33df195daf327a7f46711d1fc749b076200e3491
2026-08-20 01:27:47 +00:00
drh
255f7220fd Modify the OP_Int64 and OP_Real opcodes so that their 64-bit immediate value
is stored split across to arguments, P1 and P3, rather than being stored
as a separate memory allocation pointed to by P4.  Slightly smaller and
slightly faster, but perhaps also easier to maintain.

FossilOrigin-Name: c13b4c2c41e19fc47925dfb75e5f48d9972ef9ffb68c2d3c57e71a23e75717f9
2026-08-20 01:22:18 +00:00
drh
7e50e63de2 Disable three unimportant scanstatus tests on Windows to work around
platform incompatibilities.
[bugs:/info/2026-08-19T20:22:44Z|Bug 2026-08-19T20:22:44Z].

FossilOrigin-Name: 3f2b5dc6cd9d83724fcf39e9d7e2ca0eae6b8c698d1eb5444c705696a866d85a
2026-08-19 21:01:42 +00:00
drh
2b356863cc Merge recent trunk enhancements into the reduce-reprepares branch.
FossilOrigin-Name: f3adcd561a50646fa53173da162ed3952065d7bd6cc82babbecf3973be269d57
2026-08-19 17:25:54 +00:00
drh
c69f996361 Fix the zipvfs virtual table so that it works with UPDATE OR REPLACE.
[bugs:/info/2026-08-19T01:52:09Z|Bug 2026-08-19T01:52:09Z].

FossilOrigin-Name: 1f71a577adfbfe9ca691766b9c97d002720118dbfdee5f16424ecf96b4a40b9b
2026-08-19 15:29:15 +00:00
drh
17e0414503 In the (test and debug use only) qpvtab extension, terminate each string
at the first 0x00 character.
[bugs:/info/2026-08-19T02:29:00Z|Bug 2026-08-19T02:29:00Z].

FossilOrigin-Name: 15192e7a4f6b08dc267b7215e1a126a5e6664e988ad68195195ab164cb63e90e
2026-08-19 15:06:04 +00:00
drh
93f6407070 Detect and report FTS5 index corruption early enough to prevent CPU stack
overflow.
[bugs:/info/2026-08-19T01:42:02Z|Bug 2026-08-19T01:42:02Z].

FossilOrigin-Name: 663aa876b54ddf477bc31e286e2101726bc637fe4f4570fd3b47abc4dc9ba713
2026-08-19 14:27:45 +00:00
drh
55bf04a530 Fix the (test and debug use only) vtablog.c extension so that it avoids
NULL pointer dereferences following an OOM fault.
[bugs:/info/2026-08-19T02:38:14Z|Bug 2026-08-19T02:38:14Z].

FossilOrigin-Name: 33296ed1d6cf6ebd7ff6638b20afaad2b0ffd7ed997a70450354034a74e7f643
2026-08-19 13:01:34 +00:00
drh
2da02239d1 Limit the depth of recursion in the internal clearDatabasePage() routine.
Raise a database corruption error if it goes too deep.
[bugs:/info/2026-08-19T02:05:18Z|Bug 2026-08-19T02:05:18Z].

FossilOrigin-Name: 4a7b12914eee31f2892f32c2a792a2d40cd29aeff63bc204ed93e7b673cea6a7
2026-08-19 11:59:36 +00:00
drh
9b438bee82 In Lemon, do not invoke qsort() with a NULL array pointer even if the
number of elements is zero.  That is harmless in practice, but is
technically undefined behavior.  This change does not affect SQLite.
[bugs:/info/2026-08-19T05:56:54Z|Bug 2026-08-19T05:56:54Z].

FossilOrigin-Name: fc3c471a7e494a014364d68be5471223c8e4ebc99eed7468dcccab095a22787a
2026-08-19 11:15:38 +00:00
drh
857f41a4ae Fix a minor error in [d287358b8d356d4f] that was causing an assertion fault.
FossilOrigin-Name: 1357ac105a0e0c380dc88b13d53b93799221a389f3f81ba6d05fe8fd9ffc6975
2026-08-19 10:38:49 +00:00
drh
d3d39ef12f Merge the latest trunk enhancements into the opt-inline-jsonbPayloadSize
branch.

FossilOrigin-Name: 88fbeafc8d783fe72625c3c631cf0163ff98b2eb42152e401e14d3df66199a7a
2026-08-18 23:04:22 +00:00
dan
bb7c3e8eac Refactor the new code on this branch.
FossilOrigin-Name: 76a03b5314bd3a48e5f8de60c47cdb6ae749a8741bf0dede0a3b599a796d76d1
2026-08-18 21:12:12 +00:00
dan
2018b9c3f6 Ensure that Vdbe.smimask is correctly set after a reprepare.
FossilOrigin-Name: 56cdd2d432d30766e1e7e9c24766ab121230ad09608922473234f42dbefb29cd
2026-08-18 20:22:37 +00:00
dan
c60dd4af07 Experimental attempt to reduce reprepares caused by bound variables and "=" constraints in WHERE clauses.
FossilOrigin-Name: 1cfdde74f1c68589d722b876c20317c2a70cec2d915546a2200035190d3fb082
2026-08-18 18:22:47 +00:00
dan
9e5727e51d Correctly process "x IS TRUE" and similar expressions that appear in the second or later rows of a VALUES() clause. Report [bugs:/info/2026-08-18T05:06:40Z | 2026-08-18T05:06:40Z].
FossilOrigin-Name: d287358b8d356d4fd3643b6776c56c6a6fdfb175834351eaed0148db4079dc67
2026-08-18 15:13:10 +00:00
dan
7fa8cff00c Fix a buffer overread in the fts5vocab virtual table when processing "term < 123" constraints. Problem recently introduced by [db05b203f4].
FossilOrigin-Name: 08e5a730d4ccfba16e961550a232512a956f0f2f9116a2e59e4a2124c3277915
2026-08-18 15:06:31 +00:00
dan
6252e83bec Also correctly process "x IS NOT TRUE" expressions that appear in the second or later rows of a VALUES() clause.
FossilOrigin-Name: 0de50d5685b2edf317bdc48f79052f58a64738d3ee966ad1e631f76f4aba6168
2026-08-18 14:40:24 +00:00
dan
6227f9abd7 Correctly process an "x IS TRUE" expression that appears in the second or later rows of a VALUES() clause. Possible fix for report [bugs:/info/2026-08-18T05:06:40Z 2026-08-18T05:06:40Z].
FossilOrigin-Name: 1be96edbd5f695e8a12620e4d74d2b7bc7fb277a956c4b5e5ee8274121920c7b
2026-08-18 14:21:27 +00:00
drh
048112def6 The geopoly_regular() SQL function now returns NULL if the radius argument
is too large (+1.0e+300 or larger).
[bugs:/info/2026-08-18T09:12:02Z|Bug 2026-08-18T09:12:02Z]

FossilOrigin-Name: 15da75f10429e8831793325926b8d6ea175aa26773e6fbce3042b5a22c34f772
2026-08-18 14:15:25 +00:00
stephan
f919d99246 Filter the rtree tests out of speedtest1's default configuration when built without SQLITE_ENABLE_RTREE. Resolves [forum:e19d434249|forum post 2026-08-18T11:15:33Z].
FossilOrigin-Name: 198c9678a2010235232570d80c348834823d28e08bf6c76f2519eeac9b063925
2026-08-18 14:00:25 +00:00
drh
fe8153124a Prevent a corrupt database from causing a CPU stack overflow in PRAGMA
integrity_check.  Report the excess btree depth instead.
[bugs:/info/2026-08-18T10:33:10Z|Bug 2026-08-18T10:33:10Z].

FossilOrigin-Name: afd9f401c4dd99be3df2bb5681d8e5c73f9268282392185a2b40c91407732788
2026-08-18 13:07:33 +00:00
drh
9ac0c79e11 Use a typecast to fix a possible integer overflow in the
(unsupported) ext/misc/compress.c extension.
[bugs:/info/2026-08-18T09:33:57Z|Bug 2026-08-18T09:33:57Z].

FossilOrigin-Name: d0f1f683b94f90ba111509ec1c108a73388579c870aa740379b28cbb00a2827b
2026-08-18 10:33:46 +00:00
drh
714ab82489 Limit the number of nested RIGHT JOINs (or FULL JOINs) that can occur
in a single query.  Report [bugs:/info/2026-08-18T07:03:05Z|2026-08-18T07:03:05Z].

FossilOrigin-Name: 003ed951d85416da97f5cabf96d89b974279bd8ef2433ae1987bdedad38a4b90
2026-08-18 10:12:46 +00:00
drh
9fd4cbde74 Add SQLITE_LIMIT_TRIGGER_STEPS and -DSQLITE_MAX_TRIGGER_STEPS=n. Default maximum
is 65000.

FossilOrigin-Name: 6fbed57b1447725ae9d923d69b509fd5932d8c6bae6cf6ac0d1248a943752a58
2026-08-18 09:17:48 +00:00
stephan
0489a60a42 Plaform portability improvements for autosetup/find_tclconfig.tcl, from Dan Shearer at forum post [bugs:778223d22549a1a1|2026-08-13T20:55:18Z].
FossilOrigin-Name: 2df4fe72f74afb650e23c3643e61ec5bf8a3f1d163af9adbc4ce8ba4c1f895ec
2026-08-18 07:51:01 +00:00
drh
d51b899263 Fix the include guard on pcache.h, as requested by Report
[bugs:/info/2026-08-17T20:09:10Z|2026-08-17T20:09:10Z].

FossilOrigin-Name: e53c5fd75f3e0b7642acb4ca1cd4ef8155f256986bd6f112f372360a434cd4bf
2026-08-18 00:36:18 +00:00