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

10441 Commits

Author SHA1 Message Date
drh
a4724302d6 Add the (experimental) SQLITE_PREPARE_STATIC_SQL flag to the
sqlite3_prepare_v3() interface.  If present, SQLite avoids making a
copy of the SQL into heap memory, thus reducing heap memory usage.

FossilOrigin-Name: cb1662740204f40bef163bb92b0a1ca88c7e712d89599915135fcf2b846469ba
2026-10-14 14:17:30 +00:00
drh
9d1806e3c0 Merge bug fix from branch-3.54 into trunk.
FossilOrigin-Name: c2df85dd6e750e84ea64a464d65a315e702cd16c1b4a51cb212ae547dfaea673
2026-10-14 12:48:03 +00:00
drh
9266f1518b In check-in [8800c13deca3717c], fix a double-free of a byte-code register,
resulting in the same register being on the reusable register list twice.
[bugs:/info/2026-10-14T05:52:10Z|Bug 2026-10-14T05:52:10Z].

FossilOrigin-Name: 930df67b442ed677dbe5b22afe4fb91c907c721592a8090f0a70ebea79f3a854
2026-10-14 11:22:24 +00:00
dan
9919c36b55 Avoid incorrectly marking an index used by an OR-scan as a covering index leading to an "internal query planner error" error. Report [bugs:/info/2026-10-11T19:31:18Z | 2026-10-11T19:31:18Z].
FossilOrigin-Name: 3e41413d32122635837ba487bb0b6176ff7c3e4ae50c1c0a179ed0d450a6a2f4
2026-10-13 19:04:06 +00:00
drh
13c92f7522 Add test cases for CLI command parsing (cliparse.sql).
FossilOrigin-Name: a65c63c6a632d60c49f5ddc1ed482d71436da8f4e8dd3106b13c5f6a281ae287
2026-10-13 18:19:05 +00:00
drh
39315a4d35 Enhancements to the partial-index constraint reuse logic of
check-in [8d4160910d651246] to take into account column affinity
and STRICT tables.
[bugs:/info/2026-10-11T20:18:09Z|Bug 2026-10-11T20:18:09Z].

FossilOrigin-Name: cb7816d72cd340def63987c014726f088e06198174bd1f20f402c1aacac17fe2
2026-10-13 14:00:20 +00:00
drh
5bab74a91b Merge the latest fixes on branch-3.54 into trunk
FossilOrigin-Name: c57525b36a4a07ef2080824913effef614f545c3d85377376fe04238f7cddf2d
2026-10-13 11:05:00 +00:00
drh
76b61a60d3 Enhance OP_MustBeInt so that it is able to handle -9223372036854775808.0.
[bugs:/info/2026-10-11T20:33:51Z|Bug 2026-10-11T20:33:51Z].  See
also [987ba5a3dc5f2a22].

FossilOrigin-Name: 5e488c8da369cdf43e945078f3c9475f2cc5d71c099c85424f7c28ff0d4a7d61
2026-10-13 10:51:49 +00:00
drh
ed9745eb7f Fix "csv" output mode in the CLI so that it responds to --colsep and --rowsep
as it should.
[forum:/info/2026-10-12T17:59:34Z|Forum post 2026-10-12T17:59:34Z].

FossilOrigin-Name: d0fe92e0ce8662b9f3391769e4602a5495c2c69591ded7d4e464e90517c1f407
2026-10-13 02:14:25 +00:00
drh
9de75a1245 Merge fixes from branch-3.54 onto trunk.
FossilOrigin-Name: 5a05aded7f54507305edeabbcb54e25d67299769557ae5dc54d0f59d639ac2c6
2026-10-12 22:05:35 +00:00
drh
394e7bc1ac Prevent scalar subqueries from ever returning a value with a non-zero subtype.
Report [bugs:/info/2026-10-12T13:52:22Z | 2026-10-12T13:52:22Z].  Re-added
after the addition of a necessary prerequisite in the previous check-in.

FossilOrigin-Name: 8ab55e0185a1956fb3e131bc5faae0cf3ff5abb1f553217f2d63fcb15c75cc1f
2026-10-12 21:33:49 +00:00
dan
31c9762d0c Avoid leaking pages when remapping a database file on unix. Forum post [forum:3cfba36128 | 3cfba36128].
FossilOrigin-Name: 90d3c595afe345808c6c0fe8042ba1e8241a88132935a9a3fd69e69e71c1059c
2026-10-12 18:20:50 +00:00
drh
e26021ed60 Temporarily back out the penultimate check-in on this branch in order to
prevent an assertion fault.  Need to reconsider this approach in light of
[bug:/info/2026-05-18T14:04:01Z|Bug 2026-05-18T14:04:01Z].  That other
bug might be fixed incorrectly, and might also need to be backed out.
Both bugs reopened until we can complete the analysis.

FossilOrigin-Name: 163413d8e19b97e36b2a1f6734c271b3944195a213973e2975e43f45a1e80735
2026-10-12 17:52:40 +00:00
dan
5bf1891464 Fix a problem causing "aggregate( t1.col1 ORDER BY t2.col2 )" where col1 and col2 are in the same positions in their tables to be treated as "aggregate( t2.col2 ORDER BY t2.col2 )". Report [bugs:info/2026-10-12T13:31:40Z | 2026-10-12T13:31:40Z].
FossilOrigin-Name: ffe3f056f1789f188a0afece0363dc2ea74912510bbbd4edcb656ad8a1acc704
2026-10-12 16:29:30 +00:00
dan
3922c42423 Prevent scalar subqueries from ever returning a value with a non-zero subtype. Report [bugs:/info/2026-10-12T13:52:22Z | 2026-10-12T13:52:22Z].
FossilOrigin-Name: af3c900e2b5251bcbc0611dbe2f86b13fd2daa07bcf42563a9d6db46dfdd6b3d
2026-10-12 16:08:07 +00:00
dan
e037ddd700 Avoid ever repreparing a statement if a call to sqlite3_bind_int64() does not actually change the bound value.
FossilOrigin-Name: 4708cfe5f7fe1874870564956f0f81ba79226657c6d07ea1edffba7d5a6e4e3b
2026-10-12 14:05:08 +00:00
dan
b853a8f042 Add test case for [bugs:/info/2026-10-11T16:09:34Z | 2026-10-11T16:09:34Z]. Bug was already fixed by [7f154192db].
FossilOrigin-Name: 085dca9d30e5ce500e22374573b553f6bcd934549bc5b25305b0b97d6b37a104
2026-10-12 13:44:50 +00:00
dan
48fedaa403 Avoid excessive reprepares when there is an unindexed "col=?" constraint on a join query. This should only be reprepared when the bound value toggles between integer values 0 or 1 and any other value. Report [bugs:/info/2026-10-11T16:06:46Z | 2026-10-11T16:06:46Z].
FossilOrigin-Name: 7f154192db5a3a79f4666edd31dfc29fd73904ccd3630952e3b032e49fee6455
2026-10-12 13:36:00 +00:00
drh
9d7c5b1472 Merge recent branch-3.54 fixes into trunk.
FossilOrigin-Name: a9d8cddccc77bf6c09531e1051eba36f1bd2e95c4e62921c07c4772f12f351ca
2026-10-12 12:51:45 +00:00
drh
e326d6eff0 Do not use an index expression to evaluate a constant expression, as that
uses unnecessary disk access and might actually give incorrect results if
the expression was moved outside of the indexed loop.  The error condition
arose in check-in [44200596aa943963] for version 3.41.0 and was first
reported 3.5 years later by
[bugs:/info/2026-10-11T19:26:40Z|Bug 2026-10-11T19:26:40Z].

FossilOrigin-Name: fee60d93e9fb37234d9cad50c65fb6d62dfe21a7fde21a16ce39025290375ad8
2026-10-12 10:24:09 +00:00
stephan
0f94fa05c0 Update test/fossildelta.sql for output expectation changes.
FossilOrigin-Name: 41e0466cb861e1567e2884667e8186063bd3343f2055e20fb9866e2acbcf896e
2026-10-12 09:36:07 +00:00
drh
c5115c7770 Merge fixes from branch-3.54
FossilOrigin-Name: 7b86d92cf510477eefc92555efed99d482b23086dd83eff1a1c5bd6cea1dfe1b
2026-10-12 07:37:25 +00:00
drh
03e00d6b84 Do not allow the json_valid() routine to use a cached (and possibly edited)
copy of the JSON.  It needs to parse the JSON for itself.
[bugs:/info/2026-10-11T18:32:23Z|Bug 2026-10-11T18:32:23Z].

FossilOrigin-Name: ba74c33b6a69f8eeca3f8c497f9f74dd6dc92bfe8f4b0dcf0325595a5664c9d9
2026-10-11 23:06:04 +00:00
drh
50575da52c Another fix to the order-by-subquery optimization
of check-in [7a0cdc7edb704a88]. Trouble reported by
[bugs:/info/2026-10-11T17:00:56Z|Bug 2026-10-11T17:00:56Z].

FossilOrigin-Name: 1b574df8c7df4f737ca7b7e42203a8090836a05bc808cafc8f8f70aefbe8627b
2026-10-11 18:38:57 +00:00
drh
513c19fa38 Fix a problem in the query flattener associated with RIGHT JOIN, as
reported by [bugs:/info/2026-10-11T16:49:00Z|Bug 2026-10-11T16:49:00Z].
This problem surfaced after the fix to
[forum:/info/2025-08-21T14:14:03Z|Forum post 2025-08-21T14:14:03Z]
at check-in [e0beda7ffe92abf6].  Before that, the query would not parse.

FossilOrigin-Name: e6e27e37eb8c3159d67529959694971f35a589da75648e207c44e317e6d160be
2026-10-11 17:44:08 +00:00
drh
6e35c19f17 Merge branch-3.54 fixes into trunk.
FossilOrigin-Name: dc388e83b05dd637aafa684eee5f7b51627d39ddfbc97633958266803e882e93
2026-10-10 19:19:12 +00:00
drh
e892084680 In the CLI, disallow any use of the fileio extension in --safe mode.
[bugs:/info/2026-10-10T13:15:05Z|Bug 2026-10-10T13:15:05Z]

FossilOrigin-Name: e3e5ef4e17373677e1cc589ac79e20f6fb523e60fe8afdbc0b92f12cc75cff8b
2026-10-10 18:40:16 +00:00
drh
265bd6339f The code for sqlite3_analyzer is still in the tree, and you can still build
it using "make sqlite3_analyzer" but it does not get built as part of
"make tool-zip" and there is no mention of it in the README files and
similar.

FossilOrigin-Name: 77278079d9dddaff30a1862bf412329e91242a41be7eafc19d3fac8d872adeff
2026-10-09 23:18:07 +00:00
drh
0a8c82266c Improved error handling in the ".import" command of the CLI.
[forum:/info/2026-10-09T17:57:07Z|Forum post 2026-10-09T17:57:07Z].

FossilOrigin-Name: 48fedacea79a9cd0a93d88dc38588ae0f1a011ed908b41ba4f2e2ee1160ffa44
2026-10-09 18:34:26 +00:00
dan
bfb858c596 Ensure the join flags on the parent are set correctly when flattening UNION ALL sub-queries that include branches with RIGHT joins. Report [bugs:/info/2026-10-08T15:27:33Z | 2026-10-08T15:27:33Z].
FossilOrigin-Name: cfa69ea48a7aa379ee0c30ae81d2802da862d610f829c933e5eb358c23fc2b9d
2026-10-08 19:34:24 +00:00
drh
f19a90c569 Improvements to the display of DDL SQL statements in the CLI and in
the sqldiff command-line tool in order to close comments and similar
in the case of a corrupt schema, and avoid possible SQL injection
attacks.  ANT-2026-9VFH4DZS.

FossilOrigin-Name: 028a92f9c353d3b400551954de2e09c1723076491f79ff767dd24b452654fda8
2026-10-08 18:34:12 +00:00
dan
28e05e55f6 Avoid clearing unrelated join related expression flags when processing window function queries. Report [bugs:/info/2026-10-08T15:38:26Z | 2026-10-08T15:38:26Z].
FossilOrigin-Name: c50d7f682cc95715e4577413196dbdb2845d7c845b0e760c7060b7cdcda87770
2026-10-08 17:57:48 +00:00
drh
74675a9e87 Assign the correct encoding to the BLOB values read from an overflow page.
[bugs:/info/2026-10-07T15:44:40Z|Bug 2026-10-07T15:44:40Z]

FossilOrigin-Name: a8895cb047a3aeed35642111fa79bde9db962a5d7bc3f0cc472b4dbe510cb3f9
2026-10-08 03:28:50 +00:00
drh
644fa62518 Fix processing of LEFT JOIN when the right operand is controlled by an IN
loop.  [bugs:/info/2026-10-07T23:22:09Z|Bug 2026-10-07T23:22:09Z].

FossilOrigin-Name: e71b0465b9fa13db3922e767c1d8979d221516475670dcd3fa4df1fab30176c6
2026-10-08 02:55:50 +00:00
drh
9d50c7ebfc Fix the expansion of "TABLE.*" so that it works the same as PostgreSQL
when TABLE is the left operand of a RIGHT JOIN USING.
[bugs:/info/2026-10-07T02:56:24Z|Bug 2026-10-07T02:56:24Z]

FossilOrigin-Name: d232720b7932c1cebe4cf5b1a1e9096889e1807844351390149dfeb2ea7fc304
2026-10-07 10:41:59 +00:00
dan
c62b4abb99 Handle temp triggers attached to databases clobbered by sqlite3_deserialize() in the same way as those attached to DETACHed databases.
FossilOrigin-Name: 84c773fcc2f785346fd12e8a17ac45f9068797d9629ddc367318994b6fed421b
2026-10-05 18:07:26 +00:00
dan
b642a1d56d Ensure that deserializing into a database expires existing prepared statements.
FossilOrigin-Name: de0361b1caa97d36ea79a5bcb032539ccfb235c03581e0e88c54c03a321d7911
2026-10-05 17:51:16 +00:00
drh
95170adc37 Fixes to sqlite3_incomplete() so that it does not appear to presume a
trailing newline if there is none.
[forum:/info/2026-10-05T16:22:33Z|Forum 2026-10-05T16:22:33Z]

FossilOrigin-Name: adc1113cfd1d675a44a4ef34d7be3e0cf20129840e542d692fefa249780e23b8
2026-10-05 17:32:25 +00:00
dan
8a91f5484c Do not run new virtual table tests in memdb1.test for SQLITE_OMIT_VIRTUALTABLE builds.
FossilOrigin-Name: eced240b2a991ff8255f98d189a6874dda44e3cdb1fcd07e74abddf2a9a71ea4
2026-10-05 17:25:06 +00:00
dan
5ee733befe Allow windows clients to open and recover a wal mode database even if an old client still has the *-shm file mapped. Forum post [forum:/info/2026-10-05T14:07:31Z | 2026-10-05T14:07:31Z].
FossilOrigin-Name: 7c103a0b7d509dce58aa87518e13213451e5f70938ff08aa55accd645e3b2ff3
2026-10-05 17:11:27 +00:00
drh
45cd455d79 Update test cases so that they work for configuration that use
-DSQLITE_MAX_EXPR_DEPTH=0.

FossilOrigin-Name: 4bfc6e53a95d710b7f40fa9c80d8cdd1df50d69ed8614e9800f7e6a1ca5a3c29
2026-10-05 14:22:13 +00:00
dan
6e20be1c58 Ensure that eponymous virtual table objects are not left with dangling schema pointers if the main database is overwritten using sqlite3_serialize().
FossilOrigin-Name: 18d2646f6fa56244be12122873cd9aa48b2074a22f0be637edfcc9b5de99158b
2026-10-05 14:03:54 +00:00
drh
8532bf12f4 Correctly rollback "OR REPLACE" changes following a "datatype mismatch" error.
[bugs:/info/2026-10-05T07:15:40Z|Bug 2026-10-05T07:15:40Z].

FossilOrigin-Name: 028f3f96a0af9fc71f1c191bbd44e0b7c3884d0571931b2808e4cdd1bb2f5081
2026-10-05 13:27:07 +00:00
dan
4cf3766d09 Ensure that when a value that may be stored without data loss as an integer is stored in a column with REAL affinity, the values passed to the preupdate-hook are of type SQLITE_FLOAT, not SQLITE_INTEGER. Report [bugs:/info/2026-10-04T16:18:21Z | 2026-10-04T16:18:21Z].
FossilOrigin-Name: 9f7490065e24fc69a5fc13371aeb40214d617209bb0cd9a3e23f76486d4704c0
2026-10-05 11:29:02 +00:00
dan
1ad569d147 Ensure that it is not a constraint violation if a CHECK constraint that evaluates to NULL for one or more existing rows is added to a table using ALTER TABLE. Report [bugs:/info/2026-10-05T07:36:38Z | 2026-10-05T07:36:38Z].
FossilOrigin-Name: f940c67b21b112e33bfdd54f2c3a19b06ad5bf661ddf2f85dd464fb76d115e31
2026-10-05 10:54:29 +00:00
drh
996ded6c48 Raise a "nested too deep" error if the number of cursors consumed when
resolving a CTE name exceeds SQLITE_LIMIT_EXPR_DEPTH.
[bugs:/info/2026-10-04T05:35:14Z|Bug 2026-10-04T05:35:14Z]

FossilOrigin-Name: e68aa6e1293a2c7ad37d4b9fea8e649c318f9b4c64381eefebd0413363f56da4
2026-10-05 10:41:45 +00:00
drh
e6ff280c83 Limit the depth of recursion for CTEs using SQLITE_LIMIT_EXPR_DEPTH.
[bugs:/info/2026-10-04T04:58:58Z|Bug 2026-10-04T04:58:58Z].

FossilOrigin-Name: f54730871303e655a70f3167ce1a39dcd4e53fcf017d225f429e2bb67ad96604
2026-10-05 09:32:24 +00:00
drh
d54522a5b8 Fix expression tree depth calculations for COLLATE.
[bugs:/info/2026-10-04T04:50:56Z|Bug 2026-10-04T04:50:56Z]

FossilOrigin-Name: 252c0b7bf5a727d29605672bb58e06c758173c276671df3e388a68294998b4d3
2026-10-04 21:54:17 +00:00
drh
e8cbe2c96a In QRF, add the zero-pad flag to the default floating-point format in
output modes that render JSON or INSERT, so that infinities are shown
as 9e999 or similar instead of as "Inf".
[bugs:/info/2026-10-04T05:35:43Z|Bug 2026-10-04T05:35:43Z]

FossilOrigin-Name: f63139ba68bc7df770bbd3c26bcd760c479889fb45fa921e9e225e38c9e2044c
2026-10-04 16:23:01 +00:00
drh
2f77d50f7e Fix test cases added by [e21c5bc59ae66173] so that they work with
in-memory configurations.

FossilOrigin-Name: 85207e5253967c2d30c67ff1f5b572ca3117b5d95ecba65affc861c4ce7ec10c
2026-10-03 10:45:03 +00:00