1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-02 17:26:44 +03:00
Commit Graph

19257 Commits

Author SHA1 Message Date
drh
280559b446 For all binary operators, try to avoid computing subquery operands if the
other operand is NULL.

FossilOrigin-Name: d86eb16283c4b573c506d4faa422d5d9aeb6abc279d8e6a8e2104737162d417f
2025-06-30 12:14:47 +00:00
drh
e2e81e6983 Slightly smaller and faster version of the previous check-in.
FossilOrigin-Name: f6e6fd02f4ad49c390a2d3c9626d57f9b2fff1f67eb361b30074cc1f5121810e
2025-06-30 11:04:55 +00:00
drh
e24f20a4f5 Factor out the code that tries to avoid evaluating subquery operands if the
other operand is NULL into a subroutine, so that it can be more easily reused
by other parts of the code generator.

FossilOrigin-Name: 3c6c71bcea16443b82234414137dfa1b59e2ee8fe5097906c738fc1228fec4e6
2025-06-30 10:30:47 +00:00
drh
311d73efc2 Improve the bytecode generated for comparisons so that if one operand is
a subquery and the other operand evaluates to NULL, the subquery operand
is not even computed.  This fixes 5 of the 12 slow queries described
in [forum:/forumpost/52651713ac|forum post 52651713ac].

FossilOrigin-Name: f147bc04776ac0056412f69dfc518016c0d5b4e9d964664e3d88f595fb29dbe0
2025-06-28 17:59:15 +00:00
drh
c52e9d97d4 Raise an error right away if the number of aggregate terms in a query
exceeds the maximum number of columns.

FossilOrigin-Name: 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8
2025-06-27 19:02:21 +00:00
fbf1c0526e API doc typo fixes and closing DD element tags from brickviking.
FossilOrigin-Name: c9ddd15b0197e6e5c5a74581d94cf986523514ffdb28c66ba18de9a22aec97e9
2025-06-27 12:46:50 +00:00
drh
e77e589a35 Work around an apparent GCC UBSAN bug. See
[forum:/forumpost/1d7c25d4a2d6f5e2|forum thread 1d7c25d4a2d] for details.

FossilOrigin-Name: 23056532e51abcff486e38a3319545e6663b4a855abe1bc443e2cd7e0473748c
2025-06-26 18:57:20 +00:00
981022b7ff Minor API doc fixes sent off-list from brickviking.
FossilOrigin-Name: cb4d05633a0c9cdf146f3108e1b4b10754cd79d72a425d8cc9cd21836037a01b
2025-06-25 20:42:40 +00:00
drh
a67c71224f Similar fix to the previous check-in, but this time for
sqlite3_preupdate_new().

FossilOrigin-Name: 9aaff764d508cbd9823f23cdf0c510255721bc5c09be481ebc60bd8902ceb8c5
2025-06-24 18:27:59 +00:00
drh
66cd200ede Range check the column index on the sqlite3_preupdate_old() interface
and return SQLITE_MISUSE if too large.
[forum:/forumpost/b617e497287235d0|Forum post b617e49728].

FossilOrigin-Name: 6a5701e6c7be25cba93e55438f950966e1dacb32eb2b23a8acc8ac53da6f0a85
2025-06-24 15:58:32 +00:00
513fff88c4 API doc typo fixes and one rephrasing improvement from brickviking.
FossilOrigin-Name: 85e8060c4701a601d4bc8a639acd268ee4f2736193820d55ecd9b8abf864132f
2025-06-24 07:38:52 +00:00
drh
b1560be826 Fix an SQL typo introduced by the previous check-in.
FossilOrigin-Name: 72a81d247bc74a21d077d311969ac585d0f26bffbd210ec60f03c38bf138790e
2025-06-23 19:00:30 +00:00
drh
28789029ee Escape the "_" character in LIKE patterns in the CLI.
[forum:/forumpost/6a89702f5d|Forum post 6a89702f5d].

FossilOrigin-Name: cf61cd359e666c66b6bba4407a653c799f7f07e1f5ee6b837ad467029c461a6a
2025-06-23 16:51:33 +00:00
drh
f453e8d84e Fix a harmless compiler warning injected by [c978aed3b6f82b3d].
FossilOrigin-Name: f46500247b3a2f8b4a2f0f032cc4066af9cb3918e38a09c59db0a1da5747a25c
2025-06-23 13:42:59 +00:00
drh
4c1c400d64 Improved "statement aborts at ..." log-file messages that identify the
trigger that caused the abort.

FossilOrigin-Name: 7691264fe37300c880d612c91cf093327841fbe85fb7ec67e777e911d2cfc9ee
2025-06-23 13:28:13 +00:00
b5aa9593ac API doc typo fixes from brickviking.
FossilOrigin-Name: 18e07f8f53693d0dace3c4025a572c1a10582290a338aa7f0913c83842a69b05
2025-06-22 12:04:47 +00:00
a0c6de56ba Numerous small doc typo from BrickViking.
FossilOrigin-Name: 3aab4415de615c178205936372c625bb571bad1016c3d2e7bb2a45932356f3d6
2025-06-21 06:07:13 +00:00
drh
b68d63158a Enhance sqlite3BtreeSetPageSize() so that it detects early if no changes
are needed and exists with SQLITE_OK.

FossilOrigin-Name: c978aed3b6f82b3d9d2e0ca0283c611351bca5e5496e86a9d5d0731ebcd27c84
2025-06-20 13:12:55 +00:00
drh
37794b4ad0 Improve the accuracy of sqlite3BtreeRowCountEst().
FossilOrigin-Name: e553fb538ec1527457e2927edf9127dccf268a8a3b5918d4fb0d066ad9676094
2025-06-19 20:00:37 +00:00
drh
397b82cf0f Generalize the indexCellCompare() so that works on any index page, not just
the current page that a cursor is pointing to.

FossilOrigin-Name: b305a7f5db183d8e0e5d62ca3c9c6260ad94bb954f7342bd3caabcd8308a21f5
2025-06-19 19:33:06 +00:00
92d1bec584 A slight doc rephrasing for clarity, suggested in the forum.
FossilOrigin-Name: 0d6084a398edb013fcfb613eff8d75e2f86cbb5e3c8049328ede89e75db93cb3
2025-06-19 12:35:30 +00:00
a5c484b432 Doc typo fixes from [forum:0bce273669 | forum post 0bce273669].
FossilOrigin-Name: 8f97e3f00d24b26fe87a9d3396ad855277a1a369f6f89e9c77dc9af4d203bdf1
2025-06-19 10:46:39 +00:00
drh
ab9c91ae82 Extend the pedantic enforcement of type to VIRTUAL columns.
FossilOrigin-Name: b734c74e55acb26eb61b60937bef870f4b55b2e2e7560a22362f5f31ba2fcd03
2025-06-18 19:04:28 +00:00
drh
bcf25e7129 Enforce judgmental typing on STORED generated columns for STRICT
tables.  [forum:/forumpost/6caf195248a849e4|Forum post 6caf195248].

FossilOrigin-Name: 5e9279bff0482806f86657ae05ca3e916708d138bc3c3ceb3fbf454818649d44
2025-06-18 16:17:00 +00:00
drh
9a9140ba59 Change the definition of SQLITE_DYNAMIC to a function that has exactly
the same type as sqlite3_destructor_type, in an effort to work around
possible legacy compiler bugs.

FossilOrigin-Name: 83553edf78c35d171a0ddf1a51306e963d715e56d95b8159b561b729cfb27843
2025-06-18 14:14:46 +00:00
drh
df8aa3745a Avoid writing frames with no checksums into the wal file if a
savepoint is rolled back after dirty pages have already been
spilled into the wal file.

FossilOrigin-Name: 5973f9b9aa828ec9274b02a124b95f452c58235eaafffbdda1c32b4ae2d5616d
2025-06-17 19:10:33 +00:00
drh
110055cd6c Fix a corner-case for [9441fff52cc4e19c].
FossilOrigin-Name: 336a59eb3afd80ce048de472368df6dfc32934ee783859d37663ed8f5cf169a5
2025-06-17 18:57:07 +00:00
dan
1ea6a53762 Avoid writing frames with no checksums into the wal file if a savepoint is rolled back after dirty pages have already been spilled into the wal file. Possible fix for [forum:/forumpost/b490f726db | forum post b490f726db].
FossilOrigin-Name: 3a3269fe8e925a522d5df9f011220a842fb15a9f56e785884e32d2e15abda5bb
2025-06-17 11:36:39 +00:00
drh
86d9c2d9f3 Fix an issue going back to version 3.39.0 with transitive IS constraints
in queries that make use of RIGHT JOIN.  Problem reported by
[forum:/forumpost/68f29a2005|forum post 68f29a2005].

FossilOrigin-Name: 9441fff52cc4e19c44df1a77ffe474f409d519b270c7166ce17f99e6ea48fc1e
2025-06-16 17:36:11 +00:00
drh
d3a13f7d25 Improved debugging output for the transitive constraint optimization.
FossilOrigin-Name: 94b53c20e9bc8687c44272419aa7a93076eebdeae9a4f50b95b96a49993f9c0d
2025-06-16 16:07:14 +00:00
drh
6ed5aa4b9b Make the show-%p-az-zero hack of the previous check-in configurable at
run-time using the 0x100000 bit of either .treetrace or .wheretrace.
As before, this is all a no-op except for debugging builds.

FossilOrigin-Name: a29627d7e7f8344d9a099cc133bda85250b02dc5ee5f358ba59691e0816b5b2d
2025-06-16 15:34:26 +00:00
drh
67f708298f Add an "#if 0" that can be changed to "1" to cause all %p output to render
as 0, thus making comparisons of .treetrace and .wheretrace output easier.

FossilOrigin-Name: 65e2704c0bc329f3dd248548a2d4edb7d3ace8ceaf0b82b8618b9b1b764884cd
2025-06-16 13:51:09 +00:00
dan
792d1d1b6d Have sqlite3_setlk_timeout() take the database handle mutex. This fixes an assert() failure that could occur if sqlite3_setlk_timeout() were called on a threadsafe handle.
FossilOrigin-Name: a95d126e1330e1b83f42b51f97c4c216622cf38062f3b5d72ccb76313187e850
2025-06-12 07:35:38 +00:00
drh
23e59b34e9 Fix the concat_ws() SQL function so that it includes empty strings in the
concatenation.  [forum:/forumpost/52503ac21d|Forum post 52503ac21d].

FossilOrigin-Name: 80a78987da484d435a8242c05c48d546d430920df713b24a9d9d9fff7ba1113d
2025-06-11 00:01:42 +00:00
drh
a09a4fbac9 Improved selection of the divisor when subdividing nested Bitvec objects.
This fixes a potential stack overflow that can occur when the database size
is within 60 pages of the maximum allowed by the file format.

FossilOrigin-Name: f7ab764ed9df6d7a4a96cb0933d291f00174f33fed3d9951785078fe225adcb7
2025-06-10 19:52:21 +00:00
drh
6a23ff5a07 Minor corrections to the new Bitvec testing logic.
FossilOrigin-Name: 77b79ca1277419b91589aff2c601d4abdd7107d48019a58f7f7c85d96c2a538e
2025-06-10 18:26:09 +00:00
drh
5706b316c3 Enhancements to sqlite3BitvecBuiltinTest() that allow testing code to
create very large Bitvec objects that do not use the linear array cross-check.

FossilOrigin-Name: c5680672cae23f65637eebf66f3bb983a2864be03ea70378832034f3c89ef728
2025-06-10 17:22:53 +00:00
drh
90ba0d4995 Improved diagnostics for Bitvec: Add the sqlite3ShowBitvec() routine that
can be called from a debugger (only available with SQLITE_DEBUG).  Add new
output opcodes for sqlite3BitvecBuiltinTest().

FossilOrigin-Name: dea1e37fa67ada6efc1533b449d9eb22338d9e58eec8f89b48c38319c212c8f4
2025-06-10 16:02:29 +00:00
drh
4c323ba4be Remove unnecessary whitespace and otherwise improve comments in the
wherecode.c module.  No coding changes.

FossilOrigin-Name: 2eb4e9bf0f2df50324a62fb272a92bbd931b8b4e4b35bac0c05b676c97b61339
2025-06-06 23:10:18 +00:00
drh
b1929b7117 Remove the clunky test_windirent.h and test_windirent.c files from src/
and replace them with a much cleaner and more compact ext/misc/windirent.h.

FossilOrigin-Name: acc978df52ec41ffdb5c27764f30d53efa1f25a314b7d98983dc0d211a36b570
2025-06-05 20:12:41 +00:00
drh
140748f949 Fix harmless compiler warning introduced by the setlk-snapshot-fix merge.
FossilOrigin-Name: c1f20f89d9eb3e1dd1018c0e0efe5d3043a592f078e235ad04b960334c7186c2
2025-06-03 10:18:54 +00:00
drh
2bd9f69d40 Fix JSONB edit so that when it is trying to reduce the size of an element
it understands 0xf0 (8-byte) sizes.

FossilOrigin-Name: 5b3de6e8ab6b228bf6c0e0c31b50ca29d8b7852b460eaaca6c6ecf5a3c083cab
2025-06-02 23:34:42 +00:00
dan
9269b212bf Fixes to ensure SQLITE_ENABLE_SETLK_TIMEOUT builds use a blocking lock and do not call xSleep() when (a) opening a snapshot transaction, and (b) when blocked by another process running recovery.
FossilOrigin-Name: 7f9c0cdd0630a41db359b188b226a1ad6a3bae1663c27169acfe25edc7fb171b
2025-06-02 18:48:36 +00:00
dan
69ce758efa Fix os_win.c so that SQLITE_ENABLE_SETLK_TIMEOUT=2 builds work on windows.
FossilOrigin-Name: 8efb95e0d4670b9c5dbd8cf34512334f47951a8dff8fdadc8645f75076acd91f
2025-06-02 18:37:32 +00:00
drh
342ef63e63 Improve the accuracy of affinity and collating sequence analysis for
NATURAL JOINs to the left of RIGHT JOINs where source tables are views
or subqueries.  Initial problem report in
[forum:/forumpost/829306db47|forum post 829306db47].

FossilOrigin-Name: f184d1d236e47962658a4639d9533f67a525b74cfe0f06c93e9b85fdcd02a15f
2025-06-02 18:34:17 +00:00
dan
eb9a145711 Merge trunk changes into this branch.
FossilOrigin-Name: 7d27451804e525190f8e67da75aaeb3bf2de677021f7566c6681398e60a88c72
2025-06-02 17:44:10 +00:00
drh
8658a8df59 Remove an unnecessary parameter from sqlite3VdbeRecordUnpack(). Improved
comments and assert()s on KeyInfo.

FossilOrigin-Name: 387f4c4d98b8fb83f6ae406e4143dabda7766e8752b7f6ca104655e51330c978
2025-06-02 13:54:33 +00:00
drh
7590bfd7fc Fix stale comments related to KeyInfo. Add new assert()s associated with
memory management of KeyInfo.

FossilOrigin-Name: abd805bc76f14ede7359b029908179b7ca57e929c5918acae1403ef73ae0bd47
2025-06-02 09:49:07 +00:00
drh
d4c224b833 Fix an off-by-one error in the size computation of a vdbe-sorter.
[forum:/forumpost/c1cc8b057a|Forum post c1cc8b057a].
Problem introduced by checkin [d4307a0d43f42e96].

FossilOrigin-Name: 8b7a7fcf62e5c2742c243808fa482472954f2b4aae0bc7ae513bc07065c93737
2025-06-01 21:38:35 +00:00
drh
f18bf8997b Fix VACUUM so that it works even when ATTACH_WRITE is disabled.
FossilOrigin-Name: 42494f85acb303919d3f1f2202f8b95fbd657652da4b8dc00451c10ea6c496e0
2025-06-01 16:10:25 +00:00