1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-09-05 10:44:27 +03:00
Commit Graph

9801 Commits

Author SHA1 Message Date
dan
1be5689087 Avoid returning SQLITE_ERROR_RETRY if collation sequences associated with the table's PK cannot be found when creating an index. Possible fix for [forum:aa61ab56ad | forum post aa61ab56ad].
FossilOrigin-Name: ac649e5b9ca9b8f7729defa8d646df8c0cb57977a5eedcfa2cf1147d109a17f1
2025-08-20 15:42:23 +00:00
dan
6f097125cd Have cksumvfs write checksums to the database file only, not the wal file. Writing them to the wal file breaks wal file recovery.
FossilOrigin-Name: e3bd1feccaee8ff2f68b7b863769dd739e8a434fd32fed73deeeec885628311c
2025-08-13 19:13:16 +00:00
dan
0e77c3fa4d In cksumvfs, do not write checksums to the wal file, as this prevents recovery from working.
FossilOrigin-Name: 5bf48c7e31904f1f7048499c630801846df89f262b32ea1e49fb6e039eaad11a
2025-08-13 18:37:41 +00:00
dan
c5c9c6093b Fix a problem with the checksum-vfs and direct-overflow-reads.
FossilOrigin-Name: 8288edb9f930206f117823cf1d18af632dc6adbd7c4c3b9bcfc252e1a5e5b9cd
2025-08-13 14:35:14 +00:00
dan
b1406a6550 On windows, when opening a UNC path, fall back to using a single file handle shared between all connections for locking.
FossilOrigin-Name: 5c0202d96c3a20a2cbcd38eba5e62371606894a0cbc2da4f60e10a1b5fa7bd04
2025-08-12 17:55:34 +00:00
drh
e7440380c2 Do not allow the number of terms in an ORDER BY or GROUP BY clause to
exceed the maximum number of columns in a table.

FossilOrigin-Name: 139e587c7b349e771d67a8b4ee02ab3ad5d5712d4ff4713dad63cb765bdee248
2025-08-06 19:12:10 +00:00
drh
ff1d5e5bb8 Fix a possible printf() of a NULL string in fuzzcheck. (Passing a NULL to
"%s" in SQLite's internal printf() prints the text
"NULL", but it apparently segfaults glibc.  Whatever.)
[forum:/forumpost/e07d56579b|Forum post e07d56579b].

FossilOrigin-Name: 4ec69baf4f2a75585b92388cbc352836116381dce3f2d44a3b0f7d3360a17cf0
2025-08-05 23:01:31 +00:00
drh
a37bf61539 Fix a bug in the fuzzcheck.c test program introduced by [1cccea0508f5c8b8].
FossilOrigin-Name: 90b217e11c988785d19b8efbba435250c120837492f430cf16d6d4524dd55136
2025-08-04 23:37:48 +00:00
drh
d7d77eb56d When doing an indexed row-value comparison using an IN operator where the
order of the columns in the row-value need to be rearranged in order to match
the index, be sure to make affinity conversions before the rearranging of
columns so that the correct affinity is applied.  Fix for the bug
reported by [forum:/forumpost/eab63506cf|forum post eab63506cf].  This
problem goes back almost nine years to [ddb5f0558c445699].

FossilOrigin-Name: 8800c13deca3717c8a9bed42ef5f09752e4ca8a31adfb4ab0545e0e2b5684bd0
2025-08-04 23:05:35 +00:00
stephan
d38777134b Move the flexarray union members from [527bbc1676a85a9] to the end of their respective objects.
FossilOrigin-Name: 3082e07926695863bd5ef51c3c4803fbe267dc0d9b6ac9a717c225459f8988ba
2025-07-30 21:34:47 +00:00
stephan
df23b518da Apply alignment-related patches suggested in [forum:41cd226375cd49c6 | forum post 41cd226375].
FossilOrigin-Name: 527bbc1676a85a927352cd10a292afe041a72692ec0b1360e5a1ccaa19a32fcb
2025-07-30 19:48:12 +00:00
drh
6d7be8293e Do not apply the [/info/e33da6d5dc964db8|EXISTS-to-JOIN optimization] if
the subquery contains a LIMIT clause.
[forum:/forumpost/2025-07-23T10:59:14z|forum post 2025-07-23T10:59:14z].

FossilOrigin-Name: 314c493f273a34dff7b9f954e7553bc540bbcf5b913f779ef9ce0b9ba11acf7a
2025-07-23 12:48:16 +00:00
dan
91db1c413b Fix vtabH.test so that it works on windows even if there are files that begin with "$" in the root directory.
FossilOrigin-Name: 19a79219a7d52272102ff09d19e6b9b87e88e0070592fd7e6040bd8ce66ad238
2025-07-16 17:24:31 +00:00
dan
7d20c2e8a3 Add test case to between.test.
FossilOrigin-Name: ffebbb7ae977adc6c729d30b51f2ff29d416e018d82e450d87ccd973472819c8
2025-07-15 18:51:46 +00:00
dan
bcfe38b96a Avoid evaluating special vtab operators (e.g. MATCH) that are part of ON clauses attached to left joins from being evaluated too early. Possible fix for [forum:/forumpost/428ef7c468 | forum post 428ef7c468].
FossilOrigin-Name: 18ba07c152294a96d510a7851a0860f982ff1e0725afeebed9a343f550f6925a
2025-07-12 18:14:41 +00:00
stephan
0eca9db776 speedtest1: in WASM builds, disable the "app" test set by default because that one set is triggering file-not-found errors for the db file for reasons not yet understood.
FossilOrigin-Name: 9d68971c58261bce72b49c574cf07ad31add62bee814c58840b927fed7eb87b1
2025-07-11 11:06:25 +00:00
drh
625d0b70fe Improve the accuracy of the ETC on both devtest and releasetest.
FossilOrigin-Name: a3f96cafdc0e1f2eeccc6509f1f9c26d2c48668953550f299cf2805a0a063014
2025-07-10 20:45:00 +00:00
drh
45bff0ea64 Add the estkey column to the jobs table of testrunner.db. The plan is to
use this to collect measurements that will help generate improved ETAs for
a test run.

FossilOrigin-Name: 9eccf5267c6423c9dd4da1d61b62bbb6fbba44fb8089da79f89c84e8b77ff0f0
2025-07-10 17:19:08 +00:00
drh
aa12f0027b Adjustments to test/incrblob4.test so that it works on both Linux and Mac
in spite of error message differences between those platforms.  Minor change
to termIsEquivalent() to provide 100% MC/DC.

FossilOrigin-Name: 720387f8604f7cd997f1850ed62ce6ab32608155d7f02a89c695041caafc4067
2025-07-08 20:28:35 +00:00
drh
9a13a21223 New optimizations to detect early when queries return no rows due to
tables being empty.  This includes the EXISTS-to-JOIN optimization that
tries to transform EXISTS constraints into additional terms of the FROM
clause.

FossilOrigin-Name: e33da6d5dc964db817d1bc63c9083aecd93d49ee14d5198600b47eaf7c5b9331
2025-07-08 19:53:36 +00:00
dan
7fc6e6a272 Only run preupdate-hook tests in incrblob4.test if the preupdate-hook is enabled in the build.
FossilOrigin-Name: 56314b6b53c86ae131f780e20b62bdeabccba6d62dda41becc1c4b2e87cee07b
2025-07-07 20:47:23 +00:00
drh
44a03671c4 Merge the latest trunk enhancements and fixes into the empty-table-optimizations branch.
FossilOrigin-Name: f15cdf07573c05276a13885d74bae21a93544766344f19ef939b7a69edd1073b
2025-07-07 18:35:51 +00:00
drh
0a5508aeb4 Rework the fix to the problem described by
[forum:/forumpost/b9647a113b465950|forum post b9647a113b] so that it
provides a more complete fix that covers cases that were not resolved by
the original fix, and so that it does not cause performance regressions.

FossilOrigin-Name: 28db0d152d90fb5e62d03ea5caceabe8901be98522aef3dc2b54564fbc35355d
2025-07-07 16:19:44 +00:00
drh
4fe1ac8fe1 Simplifications to the row-value IN operator logic. Do not let the query
planner accept a WhereLoop for a row-value IN operator that uses the same
index column more than once.

FossilOrigin-Name: d2adf61f21a3ce901a2b08199ad0de191e88ef16e097c5f7a75c95ad958eff12
2025-07-07 15:40:53 +00:00
dan
8504d37b99 Avoid invoking the preupdate hook from within sqlite3_blob_write() if the cursor is already invalid.
FossilOrigin-Name: 9f335b9a4e9e761a0c6afd6dc69665a24506141bde88530bf59fcbdf957ae881
2025-07-07 11:37:55 +00:00
drh
4aacd1ef8e Back out the fix at [ba7d5bad32ad6aac] because it does not always work and because
it causes a performance regression.  Add new test cases for row-value lookups of
indexes that contain redundant columns, three of which are currently failing.  This
branch is seeking an improved solution to the redundant index column problem for
row-value lookups.

FossilOrigin-Name: ad8ddcefab5cc526b1cd77731e00939c672e61ca83350d28961b67635d20da03
2025-07-07 10:54:00 +00:00
drh
c701d17366 Improvements to the EXPLAIN QUERY PLAN output for EXISTS-to-JOIN.
FossilOrigin-Name: 6b1ecbaa2ee405be040901dceac45d027d35c313622748ba4dbbd404e297a7fa
2025-07-06 01:19:09 +00:00
drh
8bc112e3e4 Enhance the EXISTS-to-JOIN optimization so that it works on EXISTS subqueries
that do not have a WHERE clause, and so that it works on nested EXISTS
subqueries.

FossilOrigin-Name: c1d5295724f9cf7f49e0786d28016eff2d268a2b670f934d24c76787626089db
2025-07-05 23:33:21 +00:00
drh
1e3a862b79 Merge the latest trunk fixes and enhancements into the empty-table-optimizations branch
FossilOrigin-Name: d4f47e04f5880e99a53089e2dd5cde64a7ea44f059d9906b5d11324896546714
2025-07-03 20:51:08 +00:00
dan
0e6e05d4d5 Make the value of an explicit LIMIT clause on a scalar sub-query available to xBestIndex for simple "LIMIT 0" and "LIMIT 1" queries.
FossilOrigin-Name: 33b6a63caafccc61b3193714911cd8b5dd9b7f1798054b8c7845b23688d531f2
2025-07-03 15:32:27 +00:00
dan
c525e6e817 Make handling of LIMIT clauses in correlated sub-queries on virtual tables more efficient.
FossilOrigin-Name: 7214cb2a5b35190a06a1040cd4c54f325d347f8d8e36a07fd76c0a421e266522
2025-07-03 14:28:47 +00:00
drh
aa54d7a0ca Merge in the exists-to-join optimization that has been modified
to relax the requirement of having an indexed join constraint.

FossilOrigin-Name: 1c1aef2b7feae29066d0330699ab634ef41f5b60cdcd479a60cb1a5409553138
2025-07-02 20:46:02 +00:00
drh
d82c6a2cf7 When attempting to optimize "expr AND false" to "false" and
"expr IN ()" to "false", take care not to delete aggregate functions
in the "expr" as doing so can change the meaning of the query.
See [forum:/forumpost/f4878de3e7dd4764|forum thread f4878de3e7].

FossilOrigin-Name: 77397bd67d918db57d5ac545d6d963194806fdabcdaa8f822b6b09e4cfe8b715
2025-07-01 12:43:13 +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
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
dan
79a746b1f2 Update walcksum.test so that it works with SQLITE_DEFAULT_AUTOVACUUM=1 builds.
FossilOrigin-Name: 0da16f6c625bff9f2ca5624afa6dce6b5a157f44c1d56b25b92946c13217ab02
2025-06-17 18:17:09 +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
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
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
cfee69fbe4 Updates to new test cases to run with SQLITE_ENABLE_SETLK_TIMEOUT=2 builds.
FossilOrigin-Name: c6d3e3542fdf6a3428d3a2ec20c699c169ed53341dc782d81f7fe5944f769748
2025-06-02 18:09:46 +00:00
dan
eb9a145711 Merge trunk changes into this branch.
FossilOrigin-Name: 7d27451804e525190f8e67da75aaeb3bf2de677021f7566c6681398e60a88c72
2025-06-02 17:44:10 +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
drh
c0190101d1 Enhance "box" and "column" mode formatting in the CLI to better deal with
double-wide characters.

FossilOrigin-Name: b0de22ed0abf2ea5d269f191c884d7b2be167a2ed27018c25aaa0ea238cd621a
2025-05-31 20:51:42 +00:00
dan
977b0f8813 Update a few test scripts so that they run on windows.
FossilOrigin-Name: 14a18f4e3a3f35e636262a253364ab1e8054ed38c0c7fd482633522cbcf5ffc4
2025-05-31 19:55:07 +00:00