1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-04 04:22:36 +03:00

19158 Commits

Author SHA1 Message Date
drh
03c65171b8 Fix GCC-isms and compiler warnings introduced by recent check-ins
[c56092507c967230] and [6e57848fe1e0e2b5].

FossilOrigin-Name: 91102c04375f83cffcd0f3204870e476636f651710e9e6fb773cf74085ef7636
2025-02-08 13:34:19 +00:00
drh
f62d053b49 Improvements to the hash table used to store symbols in the schema, so that
it works better (requires fewer calls to sqlite3StrICmp()) for large schemas,
and uses less code space.

FossilOrigin-Name: 0318b68c845c84eded757c67f820e1783551574ac9e5670be640c4bfe22a934b
2025-02-08 11:15:41 +00:00
drh
84b0f221f4 Fix comments on the Parse.nMaxArgs field so that they are correct. Add
assert()s to ensure they are correct.  Other Parse changes to reduce the
amount of memset() needed to initialize it.

FossilOrigin-Name: c56092507c96723030589ddd9121bc993d615a7acd453305fc3b1dbb9e30554c
2025-02-07 19:09:20 +00:00
drh
7fd936e5ed Further reduction in the amount of memset() needed to initialize the Parse
object.

FossilOrigin-Name: 45e462c0060e51c3375a226d636148e3415ee6020e544ecc84861c7aef4ecf7b
2025-02-07 15:49:21 +00:00
drh
ede1690cce Reduce the amount of memset() needed to initialize the Parse object.
FossilOrigin-Name: 284538d8486ef3e9bee1ab980043b53c144743c31b984be13a5cc137e7cbec31
2025-02-07 13:37:15 +00:00
drh
65552a7ae1 Fix a harmless typo in a comment.
FossilOrigin-Name: ed82272904deb37640286448e03153316f828c629547a615a504af1d7ec5a278
2025-02-06 17:10:38 +00:00
drh
b6859b6f2c Attempted improvements to the SQLITE_DBCONFIG_... documentation.
FossilOrigin-Name: baac853871ad307b67b4d624b9ee47fc1313f1aa62c9f8072fb49e97aa33db94
2025-02-05 12:02:43 +00:00
drh
802b042f6e Detect and report signed integer overflow in the sumInverse() routine,
used by window functions.

FossilOrigin-Name: 317e9a470fba2a4b717b9cb66488b8fccb44810a80f3a7deaf1ea81906e2b8d2
2025-02-04 02:38:23 +00:00
drh
0d9f2a15f2 The Parse.addrExplain field is never even if SQLITE_OMIT_EXPLAIN is defined.
FossilOrigin-Name: 5d81a984c6aabb9fa9180efde8ca942b40f1ec18ff5a89f2fbb1252734f051d3
2025-02-03 21:04:21 +00:00
drh
4b99ec0b8c Fix a comment typo - in a comment used to generate documentation.
FossilOrigin-Name: b8de75eeded79a8312218d7a543e7c7d11181c9f4004e875495608d11a81ff38
2025-02-01 23:34:33 +00:00
drh
454a426e31 Remove an ALWAYS() added by [2567298f4b0fdfeb] because dbsqlfuzz found a way
to reach it.  The test case was added to TH3.

FossilOrigin-Name: d08a7aa8987458a91fcb861d58289e622ba8722936c7874a284f9f2fd782e269
2025-02-01 23:28:49 +00:00
drh
de50617bcb Fix an issue with sqlite3_normalized_sql() caused by changes needed to
support SQLITE_DBCONFIG_ENABLE_COMMENT.

FossilOrigin-Name: 79d287a39443f2d098fcc24199627555a656b34aa5bf5d484f91cb513d83e143
2025-02-01 20:53:17 +00:00
drh
276d213b2a Tweaks to [4b4f33d791fe4318] to make it easier to test.
FossilOrigin-Name: 2567298f4b0fdfeb42aa6bba7e0bec3bc8d0b89bf644a79b41893dd6a6c5774c
2025-01-31 20:18:34 +00:00
dan
8fbf400bb0 Remove an assert() that is not true if a trace-callback is deregistered while there are active statements.
FossilOrigin-Name: 0ecfc4d0ebdb272a69f8f98ddb069c7e0735fb899804027eb16f241d83b3d046
2025-01-31 18:33:37 +00:00
dan
f6ca35d88c Fix a problem with LIKE and GLOB processing in utf-16be databases in cases where the utf-8 encoding of a character ends with the byte 0xBF.
FossilOrigin-Name: 4b4f33d791fe4318c4597bee7d2f9e486ed223e731982af470f5cc0dbdc600fc
2025-01-31 14:52:36 +00:00
drh
a033790303 If any errors occur while processing sqlite_dbpage changes, cancel
pending truncate operations.

FossilOrigin-Name: 6138e0dc4e0e4e19cb048fe0cd969156151fdc427eee21188d2a822642aad043
2025-01-31 14:52:05 +00:00
drh
824a5bfcf0 Improvements to the SQLITE_DBCONFIG option documentation.
FossilOrigin-Name: 59f0ba10062a6ccfd56061a16af3436b9e1b9d23378bff3302bcf33bb3137cb9
2025-01-31 12:09:36 +00:00
drh
e16b345243 Add the SQLITE_DBCONFIG_ENABLE_COMMENTS setting (default on) to enable or
disable the ability to include comments in SQL input text.

FossilOrigin-Name: 393749a2e22d5c8eba36e2106a35909420aa6316652d1ab4f18ef699247b6fba
2025-01-31 01:34:19 +00:00
drh
0911f86abf Merge all the latest trunk changes into the extra-security branch.
FossilOrigin-Name: 86ba57561a8d8c14e401c06b2345a9417053aa3a5f0c84e52460f23f5e6aa8d0
2025-01-31 00:54:59 +00:00
drh
49906e8e4b The reuse-subroutine optimization [c9a3498113074bbc] might have generated
byte-code that loops forever.  This check-in fixes the problem.

FossilOrigin-Name: 0cc4ed8c6e53aca1f5e94c132bedbc7f561c04a77f1a30b965ffe7560634bfeb
2025-01-30 21:12:58 +00:00
dan
df54ecb1bf Fix a problem causing the write-lock to be held when it should not be in some circumstances following a SEH exception.
FossilOrigin-Name: 7eb5accb7cf937fc967dcd86da0af813fb18a2697348bd231fbefd3c09b930ab
2025-01-30 17:04:28 +00:00
drh
8bffd498ea Remove an unused parameter from an internal-use subroutine in the TCL interface.
FossilOrigin-Name: a700692b39e24f5ca9ea6f879d413e20c2ad2b85f62c867407dafe111f13d931
2025-01-30 16:07:51 +00:00
drh
000e39e9a8 Improvements to the TCL interface for Tcl9 as suggested by Jan Nijtmans.
FossilOrigin-Name: d76c5db866de2732b68401a4c3e39acddc7a99bed965160c1796477c062b478a
2025-01-30 16:00:28 +00:00
dan
462888819e Have sqlite3_enable_setlk(-1) configure indefinite blocking locks where they are supported.
FossilOrigin-Name: 62009565d2f2a2c4d347e1da0d5b4ad43056742df47fd6ddb92e62f53a2b57f1
2025-01-30 15:26:16 +00:00
drh
36279c256b Enhance the if() and iif() SQL functions so that they support any
number of arguments greater than or equal to two.
Suggested by [forum:/forumpost/40f7867f75f80|forum post 40f7867f75f80].

FossilOrigin-Name: fb76d184ee5afc41009c4023bb68b3ddd42c9235a79ec9695c26f5bbe9a1aa25
2025-01-28 20:32:48 +00:00
dan
9dcf3d08c9 Fix sessions module handling of tables with generated columns.
FossilOrigin-Name: 437fb316389bc3c24c5cdb4d01edfc81e2c2e9f2b399fc2a95b05d279361d8ec
2025-01-28 19:03:37 +00:00
drh
8b62a82ae3 Simplifh the IdList object to remove unnecessary fields. Performance
increases by about 0.8%.

FossilOrigin-Name: a4625bb995dd5582d1f3cf0c2e54eb3f01f1cc1405811dda86ebd38b2b858994
2025-01-28 12:50:17 +00:00
drh
d8c37bbc54 Remove an ALWAYS() in the star-query heuristic that is sometimes false if you
have a corrupt database.  dbsqlfuzz c37ba7728d79859b79c8341b59297e88fba017d3.
Test case in TH3.

FossilOrigin-Name: 6b9a339628eb8bfb6dfbee02000a6ac91cc8a9ae16bd990e62c4142b9f912c36
2025-01-28 00:48:01 +00:00
drh
44980e8169 Use hashing to accelerate column matching on INSERT statements. Code is
smaller and about 1.8% faster overall according to test/speedtest.tcl.

FossilOrigin-Name: 8be956383e0344fb613ec2e56fce7b518f439ae34bf9ddb424de2bd9b31c9889
2025-01-27 21:18:13 +00:00
drh
7c727bb61b Avoid splitting a hyperlink across lines in the documentation comment for
sqlite3_serialize().

FossilOrigin-Name: 74b770bd445d98ff883000ab2e31603d729e415e4e4f640646eef30825634f48
2025-01-27 14:12:14 +00:00
dan
43aad25b1b Add the sqlite3_setlk_timeout() API. For setting the timeout used by SQLITE_ENABLE_SETLK_TIMEOUT blocking locks without also setting the regular retry-based busy-timeout.
FossilOrigin-Name: 4a7eb492797abb47b18b7dfc557aeae43a0dea5b861efc203398d5059b10d131
2025-01-27 11:50:03 +00:00
drh
2228567ad3 Further comment improvements in the star-query heuristic. Add an ALWAYS()
on an unreachable branch to achieve MC/DC.

FossilOrigin-Name: 5e18ce68fbc5e73e6694936f3ba71f5b5e3758cf380951805ca6ea6a3f0943aa
2025-01-26 20:09:57 +00:00
drh
fe54b7a1f4 Small size and complexity reduction on the star-query heuristic. Improved
comments for the star-query heuristic.

FossilOrigin-Name: a7ecb2f4b7eee78b88f1b2e026dffed2007ca4ffeb152632624ab2582839b250
2025-01-26 17:29:33 +00:00
drh
fb9e8e48fd Revise the strategy used by the star-query heuristic: Instead of decreasing
the cost of all fact-table WhereLoops, increase the run-cost of WhereLoops that
are SCANs of dimension tables.

FossilOrigin-Name: 1bc09c9e8bd77ac41ecbe510c7e003757fc11d0f586da6cdf3584315aa9d6407
2025-01-25 23:04:05 +00:00
drh
0186ee1cd7 Improvments to debug output on the star-query heuristic.
FossilOrigin-Name: b3ebeb0682a2c837987acf4ed92f06cf91aea235830c5a0f9dd1ce64afe16e84
2025-01-25 14:30:36 +00:00
drh
dea434ea65 Avoid calling computeMxChoice() after an OOM as some assert()s can fail
in that routine if a prior OOM occurred while building the WhereLoop array.

FossilOrigin-Name: 8b9e621dbf599d7e75e07d75d4c400247d693ea76e00eba0919f4e33e3e10bdd
2025-01-25 00:07:14 +00:00
drh
bc7e41c03c Remove an incorrect ALWAYS() added in check-in [7cfbe14d199bb631].
FossilOrigin-Name: 431a1a29f93dc642779dc21c3a0edad5fcda1d175e9d1e3b216fa02c234fe774
2025-01-24 20:59:12 +00:00
77731d5ec0 Clarify handling of a NULL for the 2nd argument to sqlite3_serialize(), as pointed out in [forum:3df7168b90|forum post 3df7168b90].
FossilOrigin-Name: 340edbe5540762656b648c18a359ab7039b4a0af15db199fc86317a415e2bafa
2025-01-24 18:37:55 +00:00
drh
d37412b80c The debugging output for WhereLoop objects now shows cost
estimate changes due to the star-query heuristic.

FossilOrigin-Name: a280f5f5480e560fc2b80e8947d8062e8b3487d930e71cb60fc9ba90d87977c1
2025-01-24 16:27:18 +00:00
drh
f1c5830311 Minor tweaks to the star-query detection and processing.
FossilOrigin-Name: 61f76a45ac7aa454419fd7539a3d8e60f0733fb5a2abd034d795328f3c1b6e9b
2025-01-24 15:55:20 +00:00
dan
2539fb2bc5 Fix a race condition causing SQLite to use a busy-handler for an operation that should not.
FossilOrigin-Name: 6ab9ed8eef77781898375038ab05fc6e5f46b745e4906691393b8b1d90570eb6
2025-01-24 15:49:47 +00:00
drh
299fe02393 When looking for star-queries, do not count a table as a dimension table
if that table is separated from the fact table by an OUTER or CROSS join
or if the table is a self-join.

FossilOrigin-Name: 5aebd7df0d577e98b3affd22b84b42dfe84a9f37fa29187505cc245b95460ba4
2025-01-24 14:51:15 +00:00
drh
1519675a1a Fix a possible infinity loop in debugging-printf logic in the query planner.
No changes to production code.

FossilOrigin-Name: 9a20b94080f5379867530772e081b737ae4cf6b416469dcabb85b8dd819f491f
2025-01-23 21:06:59 +00:00
drh
c850c2be75 Add two new sqlite3_db_config() options that enable the ATTACH command
to create new database files and to open databases read/write.  Both
default to on for backwards compatibility.

FossilOrigin-Name: fe0c58d00b491d1af7c0894f5c32542954aeea2e6510853b3bcbf13ac0bf5ce0
2025-01-22 19:37:47 +00:00
drh
255548562b Fix date/time computations to deal with the sub-millisecond rounding
problem identified in [forum:/forumpost/766a2c9231|forum post 766a2c9231].

FossilOrigin-Name: afb0a5923a6db4045fab5226198aab970d746d4866294ebba943c6986e97ecde
2025-01-21 17:37:58 +00:00
drh
8e7a16895c Performance improvements to the (debug-use only) Mem.pScopyFrom logic, resulting
in about 8x faster performance under -DSQLITE_DEBUG for the query in from
[forum:/forumpost/0025389d0860af82|forum post 0025389d0860af82].  This change
only affects builds that use -DSQLITE_DEBUG.

FossilOrigin-Name: 7fb1ae25d1572dd7709a0f850c148a5f745a524f01ea231e29a1ebc37c173fb9
2025-01-21 16:30:55 +00:00
drh
2e899ccaff The FuncDev.nArg field values -3 and -4 now have special meansing of 1 or more
or 2 or more arguments, respectively.  This saves space in the built-in
function table, resulting in slightly faster performance and a reduced binary
size.

FossilOrigin-Name: 753fd747f24c5e9a019eb00b8a4f66e65c6733ba10a7adbd1b55786867c32ca6
2025-01-21 15:12:00 +00:00
drh
d0db5edf61 Use Tcl_GetString() instead of Tcl_GetCharLength() to test for a zero-length
string in the TCL interface, since that is much more efficient.

FossilOrigin-Name: a8d9dcfd23fbfcd887e451382836c1e88215984cc01e00be11387dbf4ab26fd8
2025-01-21 11:10:16 +00:00
drh
c69d537b93 Remove an assert() in the unix file locking logic that is not true
if alternative VFS "unix-excl" is used for a read-only connection.

FossilOrigin-Name: bd5dc92368e41231a07bb59dd3db8942e238129ec7a3c8d785459d9b62bfcba3
2025-01-20 19:19:31 +00:00
dan
467e20ad1d Fix an assert() that could fail if a virtual table called sqlite3_step() from within the xSync() method while committing a "PRAGMA defer_foreign_keys=1" transaction.
FossilOrigin-Name: 39bdbb3f6dd1d30d180526d35c11f789f5e9d45b99ead72fd4a3b136afab66b1
2025-01-20 18:26:58 +00:00