Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
476 commits
Select commit Hold shift + click to select a range
5badd04
Correctly initialize the SrcItem.iCursor field to -1 when creating a …
Mar 12, 2024
eea6bdc
On testrunner.tcl: (1) Add the "help" command. (2) Add the "script" …
Mar 13, 2024
3de08a6
Have testrunner.tcl set SQLITE_TMPDIR on windows as well.
Mar 13, 2024
1769640
Add pointer to documentation to testrunner.tcl help message.
Mar 13, 2024
484193f
Improvements to the "help" message generated by testrunner.tcl. Add the
Mar 13, 2024
c2764db
Minor tweaks to the testrunner documentation.
Mar 13, 2024
9b6e535
Improve one of the error messages from testrunner.tcl.
Mar 13, 2024
4659ec3
Add the --explain option to testrunner.tcl.
Mar 13, 2024
4565c84
Document the testrunner.tcl --explain option in doc/testrunner.md.
Mar 13, 2024
6bb6a9c
If the NJOB environment variable is a positive integer, it causes
Mar 13, 2024
609aba0
Avoid creating a co-routine incrementally for a VALUES clause that ha…
Mar 13, 2024
e116fa1
Ensure that if a multi-row VALUES cannot be coded while being parsed,…
Mar 13, 2024
693d386
Merge trunk into this branch.
Mar 13, 2024
81a244c
Minor change to the "mdevtest" and "sdevtest" in testrunner.tcl, to m…
Mar 13, 2024
35057fb
Fix some OOM handling problems on this branch.
Mar 13, 2024
aa2e244
Remove unreachable code from this branch.
Mar 13, 2024
56be6f6
Change the way parse.y handles multi-row VALUES clauses to save a few…
Mar 13, 2024
a06c046
Add further tests for VALUES clauses in various contexts.
Mar 14, 2024
5a0fd81
JS: remove an unused function argument and some debug-related comment…
Mar 14, 2024
f0f4323
Avoid some OP_SCopy instructions in "INSERT INTO .. VALUES" statement…
Mar 14, 2024
400992b
Fix a problem handling "INSERT INTO ... SELECT ... UNION VALUES(...),…
Mar 14, 2024
26a3ef7
Fix a problem with ALTER TABLE and correlated multi-row VALUES clauses.
Mar 14, 2024
932b5f4
Fix testcase to account for new behaviors with this branch.
Mar 14, 2024
0ebd1c3
Tweaks to the func4.test test module (which tests the rarely used tot…
Mar 15, 2024
8255964
Fix (totally harmless) memory leaks in Lemon to avoid warnings during…
Mar 15, 2024
d31fc6e
New options for testrunner.tcl: --stop-on-error and --stop-on-coredump.
Mar 15, 2024
f696591
Enhance the sqlite3ExprIsConstant() function so that it recognizes
Mar 16, 2024
40514dd
Fix exprNodeIsConstantFunction() so that it returns WRC_Continue, not…
Mar 16, 2024
bf4105d
Extend the scope expr-is-constant for function to cover the IN-to-EQ
Mar 16, 2024
b918a0f
Activate the enhanced constant-expression for the
Mar 16, 2024
4713b2d
Assert that the eCode is always non-zero upon entry into exprNodeIsCo…
Mar 16, 2024
7dc3e92
Further expand the scope of usage for the enhacement to expr-is-const…
Mar 16, 2024
ec00a4d
A formerly impossible case has now become possible because of the new
Mar 16, 2024
1c5257d
Recognize when an SQL function is constant and can occur inside an
Mar 16, 2024
e4a1b4d
Add an ALWAYS on an unreachable branch.
Mar 17, 2024
54bf109
Omit the "noop(X)" test SQL function. Accomplish the same thing using
Mar 17, 2024
2f4a8cc
Fix a problem caused by a non-aggregate function with an OVER clause …
Mar 18, 2024
75924d3
Ensure the database schema has been loaded and the database encoding …
Mar 18, 2024
27a5ee8
Improvements to EXPLAIN QUERY PLAN output for multi-row VALUES claues.
Mar 18, 2024
871786b
Fix the patch at [10ee6fcba08ab128] so that it works on reduced-size …
Mar 18, 2024
ac7c6f5
Add assert() statements to validate access to the SrcItem.u1.nRow uni…
Mar 18, 2024
b03805b
Change a test case to use a window function rather than random() to d…
Mar 18, 2024
c195e23
Allow the VALUES-as-coroutine optimization to be applied to later row…
Mar 18, 2024
2ad2584
Fix harmless compiler (scan-build) warnings.
Mar 18, 2024
43a5119
Add the "VALUES-as-coroutine" optimization. Large VALUES clauses on an
Mar 18, 2024
fc2d862
Remove unnecessary blank lines from build commands in the default Mak…
Mar 18, 2024
365b6e9
Avoid spurious SQLITE_IOERR_DATA errors when reading partial pages fr…
Mar 18, 2024
28cd72a
Fix asan problems in sqlite3rbu.c. Enable RBU for sanitizer release t…
Mar 18, 2024
108dd6a
First steps toward getting -DSQLITE_ALLOW_ROWID_IN_VIEW to work again…
Mar 19, 2024
5ed044e
Fix another problem from [c63e26e705f5e967] involving infinities and the
Mar 19, 2024
1fe31dc
Adjustments to the test cases for the previous check-in to make them
Mar 19, 2024
4b42b52
When compiled with SQLITE_ALLOW_ROWID_IN_VIEW, rowid-in-view is on by…
Mar 19, 2024
261c6df
On second thought, change SQLITE_TESTCTRL_ROWID_IN_VIEW into a start-…
Mar 19, 2024
d75bdf5
Improvements to the first check-in on this branch, causing less colla…
Mar 19, 2024
967c303
Fix the fuzzinvariants.c test module so that it does not generate
Mar 19, 2024
a10c2a9
Return the error "ambiguous column name: rowid", instead of "no such …
Mar 19, 2024
f891ef8
Update tests to work with SQLITE_ALLOW_ROWID_IN_VIEW.
Mar 19, 2024
e9feb0a
In the name resolver when SQLITE_ALLOW_ROWID_IN_INDEX is enabled, if …
Mar 19, 2024
ffbe492
Update test scripts to account for [8fcea4cd].
Mar 19, 2024
27ea83f
Make sure the new u1.nRow value is copied when making a copy of a Src…
Mar 19, 2024
4aa2149
Add the --no-rowid-in-view option to the --help output of the CLI.
Mar 19, 2024
36f01f2
Return the error "ambiguous column name: rowid", instead of "no such …
Mar 19, 2024
254729e
Change the SQLITE_CONFIG_NO_ROWID_IN_VIEW configuration option to be
Mar 19, 2024
697e122
Fix typos in the SQLITE_CONFIG_ROWID_IN_VIEW documentation.
Mar 20, 2024
7128c78
Fix a typo in a comment.
Mar 20, 2024
daee74c
Fix the SQLITE_ALLOW_ROWID_IN_VIEW bug-compatibility option so that i…
Mar 20, 2024
e555bd4
Change EXPLAIN QUERY PLAN output to say "USE TEMP B-TREE FOR LAST TER…
Mar 20, 2024
219b4f2
Change EXPLAIN QUERY PLAN output to say "USE TEMP B-TREE FOR LAST TER…
Mar 20, 2024
296ae1e
Fix all test cases so that they work with SQLITE_ALLOW_ROWID_IN_VIEW.
Mar 21, 2024
af64a22
Have os_unix.c reuse cached file-descriptors in the case when a read-…
Mar 21, 2024
529ed1a
Enhancements to testrunner.tcl:
Mar 21, 2024
006a9b5
Add comments (only, no code) to the JS sqlite3_config() bindings remi…
Mar 21, 2024
2faaf38
Test case for the assert() problem fixed by [9ba3cff9d48fe8fc].
Mar 21, 2024
378bf82
Fix incorrect boundary assert()s on the new OP_IfSizeBetween opcode.
Mar 22, 2024
d9eee78
Fix an adverse interaction between CREATE TABLE AS and the new
Mar 23, 2024
a631eb3
Do not automatically assume that ROWID is NOT NULL when compiled with
Mar 24, 2024
4a402b8
Improved "wheretrace" debugging output for calls to xBestIndex. No c…
Mar 24, 2024
cf84ae0
Fix the xBestIndex method of the pragma virtual table so that it corr…
Mar 24, 2024
d2b3b72
Improvements to the vtablog.c extension, for better logging of virtual
Mar 25, 2024
55051d6
Flag sqlite3_trace() and sqlite3_profile() as deprecated so that the …
Mar 25, 2024
4397d28
Improvements to the vtablog.c extension: Eliminate memory leaks.
Mar 25, 2024
41c9945
Use the SQLITE_CONSTRAINT return value from xBestIndex to prohibit bad
Mar 25, 2024
99b4e6e
Fix recent test case changes so that they also work on Windows.
Mar 25, 2024
bcf97e7
Fix the pragma4.test script so that it works with SQLITE_OMIT_VIRTUAL…
Mar 25, 2024
ed6c9aa
Fix an inaccuracy in automatic indexes that was exposed by the fix
Mar 25, 2024
f7aab65
Remove an ALWAYS() from a condition that can be true.
Mar 25, 2024
791b6f3
Revert the previous change. Instead, do a pre-check of the CREATE TABLE
Mar 25, 2024
eb5bd4d
Fix a theoretical OOB memory access in sqlite3_stmt_scanstatus_v2().
Mar 25, 2024
1872f8d
Simplifications to the sqlite3_declare_vtab() implementation. Changes
Mar 25, 2024
ca3b909
Add further tests for sqlite3_declare_vtab().
Mar 25, 2024
a509a90
The RAISE() operator is not a constant expression and cannot particip…
Mar 25, 2024
dcc1219
Avoid expanding integer values in columns with real affinity to the f…
Mar 26, 2024
ed517a7
Add extra tests to vtabL.test.
Mar 26, 2024
6921a2d
Update comments in fts5.h.
Mar 27, 2024
cfd4507
Document that the order of an update hook call is unspecied vis-a-vis…
Mar 28, 2024
69dbd7a
Make explicit that sqlite3_keyword_name()'s index is 0-based, per for…
Mar 30, 2024
9352cfa
Improved comments in the query planner logic that computes the cost f…
Apr 1, 2024
7f7d0b1
Add a heuristic in between the two solver() passes of the query plann…
Apr 2, 2024
8ce73ce
Fix typos in comments. Provided ".wheretrace" debugging output for the
Apr 2, 2024
307f290
Add an optional 3rd argument to the icu_load_collation() function that
Apr 2, 2024
13f5910
Fix exception propagation when the opfs-sahpool VFS fails to initiali…
Apr 4, 2024
efe9500
Fix test cases due to an error message change.
Apr 4, 2024
634f434
Fix an ASAN problem in part of the test harness. No changes to SQLit…
Apr 4, 2024
f895173
Add the "interstage-heuristic" that attempts to avoid wildly inefficient
Apr 4, 2024
7fd9b53
Optimize sqlite3.oo1.DB.exec() for the rowMode='object' case to avoid…
Apr 4, 2024
65a1d7a
When compiling with SQLITE_ALLOW_ROWID_IN_VIEW, if the RETURNING clau…
Apr 5, 2024
b411c4d
Check-in [a9657c87c53c1922] is wrong: the IndexedExpr.bMaybeNullRow f…
Apr 5, 2024
743ae4c
Experimental enhancement in which expressions of the form "expr IN ta…
Apr 5, 2024
de6a4be
Generalize pushdown to allow any uncorrelated subquery to be pushed d…
Apr 6, 2024
8181cc6
Improvements to the accurancy of the fuzzinvariants.c testing module …
Apr 6, 2024
ed27183
Merge testing logic fixes on trunk into the pushdown-subquery branch.
Apr 6, 2024
6951c49
Do not allow changes to sqlite3ExprIsTableConstant() that support pus…
Apr 6, 2024
05c6d13
Add comments to note the name abiguity between the MySQL push-down
Apr 7, 2024
660322f
Merge trunk enhancements into the pushdown-subquery branch.
Apr 7, 2024
1152def
If SQLITE_ALLOW_ROWID_IN_VIEW is set to 2, then all rowids for views …
Apr 7, 2024
fa4c424
Omit all rowid-in-view restrictions from the fuzzinvariant.c test module
Apr 7, 2024
5b613ed
Merge trunk testing enhancements into the pushdown-subquery branch.
Apr 7, 2024
ac94cf3
Enhancements to the fuzzer invariant checker to turn optimizations on…
Apr 8, 2024
0389d5f
Fix a harmless compiler warning in the ICU extension due to [acddbc48…
Apr 8, 2024
d59afcf
Enhance the WHERE-clause push-down optimization so that it is able to
Apr 8, 2024
1278ac4
Update tests in returning1.test to account for [c7896e88].
Apr 8, 2024
d21d5b2
The read-only CHECK-constraint optimization of [34ddf02d3d21151b] inh…
Apr 9, 2024
73a50fa
Avoid some performance problems in the recover extension when recover…
Apr 9, 2024
495ce22
Fix a "shift exponent is too large" usan error that could occur in th…
Apr 9, 2024
b6d108f
Fix handling of the SQLITE_OMIT_WAL check in one place. Resolves [for…
Apr 11, 2024
c494fdb
Mark the BTree cell overflow cache as invalid whenever the rowid goes…
Apr 12, 2024
366b419
Test case for the fix in the previous check-in.
Apr 12, 2024
ae7ede4
New assert() statements to verify the correctness of the BTCF_AtLast …
Apr 12, 2024
1d40237
Add assert() statements to help verify the overflow page cache.
Apr 12, 2024
6f4e5ee
Fixes and new tests logic to ensure that the btree overflow page cach…
Apr 12, 2024
0221cac
If a build fails in testrunner.tcl, do not attempt to run the jobs that
Apr 12, 2024
06915d0
The first assert() added in [0ebc65481f4a3e79] is not necessarily tru…
Apr 15, 2024
0526db3
Correct handling of OUTER JOIN when on or the other operand is a subq…
Apr 18, 2024
d737fee
Fix a problem where an expression like (a, b) IN (SELECT ...) might n…
Apr 20, 2024
5749e1e
Slight performance improvement for the new code on this branch.
Apr 20, 2024
db2a33a
Fix an indentation problem in debugging routine sqlite3ShowSrcList().…
Apr 21, 2024
2c26adb
Continuation of the fix at [8c0f69e0e4ae0a44]: If a viaCoroutine FROM…
Apr 22, 2024
2469350
For sqlite3.oo1.DB JavaScript classes, bypass execution of any on-ope…
Apr 22, 2024
4f2f6c7
Extra robustness in the code that causes cursors to return NULL when …
Apr 22, 2024
0a42e99
Extend the JS/WASM SEE build support by (A) filtering SEE-related bit…
Apr 22, 2024
5d8daf1
Minor cleanups to [8fbda563d2f5].
Apr 22, 2024
46435a0
Add extra tests for aborting conflicts in the sessions module.
Apr 22, 2024
6e6dfd6
When running the 'dist' target in ext/wasm for an SEE-capable build, …
Apr 23, 2024
642e950
Minor touchups in JS docs and exception messages.
Apr 23, 2024
3ac612d
Remove some dead WASM-side code.
Apr 23, 2024
0309fb9
Fix an uninitialized variable problem in the new code on this branch.
Apr 23, 2024
14602ea
Fix a problem with vector IN operators used with an index where the a…
Apr 23, 2024
99200b2
Remove an undocumented feature from the JS Worker1.open API because i…
Apr 24, 2024
b065ece
Ensure that temporary SrcItem objects created by trigger processing have
Apr 24, 2024
5b27eca
Avoid slowdown when exprNodeIsConstant() is called on deeply nested S…
Apr 24, 2024
35b771e
Add comments linking the assert() added in [cef4d9e3ba586735] to the …
Apr 24, 2024
dfa6289
Fix a case where a corrupt stat4 record could go unrecognized due to …
Apr 24, 2024
0868d58
If a RETURNING clause contains a subquery that references the table t…
Apr 24, 2024
f8e1951
An experimental minor tweak to the way affinities are computed for co…
Apr 24, 2024
c859f02
wasm: add a makefile comment about the static sqlite3.h/c version inf…
Apr 25, 2024
23afc2c
Back out the previous change on this branch. In its place: Determin…
Apr 25, 2024
ddc6bd9
Further improvements to the computation of affinity for compound subq…
Apr 25, 2024
ec14ef8
Improvement to the way that affinity is determined for columns of a
Apr 25, 2024
fed13d5
Fix the TreeView display of a LIMIT clause on a compound query. Debu…
Apr 26, 2024
d591a5b
Add test demonstrating the problem at [forum:/forumpost/c243b8f856|fo…
Apr 26, 2024
317b741
Enhance the generated_series() table-valued-function to respond to
Apr 26, 2024
99ac232
Fix handling of LIMIT and OFFSET in virtual tables that are part of
Apr 26, 2024
3afd5b6
Fix a problem allowing a LIMIT constraint to be passed to a virtual t…
Apr 26, 2024
84a231e
Use hex flag masks rather than decimals in ext/misc/series.c.
Apr 26, 2024
d3a4dbe
Further fixes and improvements to the generate_series() enhancements on
Apr 26, 2024
297472a
Have where.c ignore any plan from a virtual table that tries to use L…
Apr 26, 2024
4c3ab54
Allow virtual table implementations to handle OFFSET but not LIMIT, b…
Apr 26, 2024
6c290cc
Additional internal docs in the wasm utilities.
Apr 26, 2024
b95c1d0
Internal JS doc touchups. No functional changes.
Apr 26, 2024
b11daa5
Fix issues in [/info/1e227ad9f413227f|LIMIT/OFFSET support for virtua…
Apr 26, 2024
8d5fe07
Avoid 32-bit overflow when calculating ncycle for ".scanstats vm".
Apr 30, 2024
19ca99e
Fix a problem causing the recovery extension to use excessive memory …
May 1, 2024
2ad1e92
Fix another problem in the recovery extension where a corrupt sqlite_…
May 1, 2024
f3ea92c
Avoid an OP_Next in cases where an IN(...) query against a UNIQUE ind…
May 1, 2024
2ae4531
Omit the OP_SqlExec to "PRAGMA integrity_check" added by [348fa7aaf79…
May 2, 2024
78bc133
Do not accept a string that looks like a number used as an argument to
May 2, 2024
9b4e789
Add a test case to the fix to PRAGMA integrity_check in the previous …
May 2, 2024
d059774
Fix the CREATE TABLE performance issue described by
May 2, 2024
aeb6288
Avoid an OP_Next in cases where an IN(...) query against a UNIQUE ind…
May 2, 2024
01508c8
Fix a case where the recovery extension might write uninitialized dat…
May 2, 2024
7281493
Avoid an assert failure accessible only when internal testing feature…
May 2, 2024
9c0d777
Fix a problem with queries that use "IN(...) ORDER BY ... NULLS LAST"…
May 2, 2024
0901571
The coalesce(), ifnull(), and iif() functions pass through subtype va…
May 3, 2024
5b9b7cb
Functions that pass through the sqlite3_value of one of their argumen…
May 4, 2024
2eb9adb
Assume that a function is able to return a subtype if either (1) it i…
May 4, 2024
e8ba446
Assume that an SQL function is able to return a subtype if any of its
May 4, 2024
c52c00f
Add test cases to test/in7.test. No code changes.
May 4, 2024
5b80dbe
Add new sessions API sqlite3changegroup_add_change().
May 4, 2024
1aa94b5
Add comment to the test/lemon-test01.y file indicating that it does n…
May 5, 2024
1002bcf
Fix problem in sqlar_uncompress() when being used to extract symbolic…
May 6, 2024
0f78aaf
Add tests for sqlite3changegroup_add_change().
May 6, 2024
cbea8d5
Edit comments in sqlite3session.h.
May 6, 2024
f4744ff
Add new sessions API sqlite3changegroup_add_change().
May 6, 2024
ebf9702
Avoid unnecessary recursion in sqlite3ExprDeleteNN(). This complicat…
May 6, 2024
07305e3
Omit redundant unary + operators from the AST.
May 6, 2024
11a088b
When extracting links from sqlar archives, clobber any existing file …
May 6, 2024
e871779
Fix a compilation error in test/lemon-test01.y, reported in [forum:f0…
May 7, 2024
a40cae7
Ensure successive scans of pragma virtual tables return consistent ro…
May 7, 2024
d1122a4
Fix bug in test script sessionconflict.test.
May 7, 2024
538ad6c
Fix a hyperlink typo in session documentation.
May 8, 2024
f0c9bc5
Rename a shadowed local var, as reported in [forum:2ba65af3148585cf|f…
May 8, 2024
0e93237
Reformulate a for-in loop to a for loop in wasm.xWrap() to work aroun…
May 9, 2024
a8c4383
Add a maintenance-reminder comment explaining [dc58ed65492857].
May 9, 2024
8292aa7
Squelch two OMIT-flag-related warnings reported in [forum:388243d9882…
May 10, 2024
7e60106
Add an sqlite3FaultSim(300) call to the sqlite3ParserAddCleanup() rou…
May 10, 2024
0e4afdd
Improvements to the ".testctrl fault_install" command in the CLI.
May 10, 2024
3254206
The sqlite3FaultSim(300) error from [1e8863909ac369e5] must be treate…
May 10, 2024
e09e451
Add a test for the fixes on this branch.
May 10, 2024
5d783d5
Fix aggregate function processing to correctly deal with OOMs inside of
May 10, 2024
f722d91
Add tests to bestindexC.test. No changes to code.
May 11, 2024
9a1a482
If there is no data available for a field in a corrupted record, but …
May 15, 2024
1550771
Fix a case where an error in the ORDER BY clause of an aggregate func…
May 15, 2024
61f2ee6
Back out the assert() fixes from [a9443dbfbe25e588] and
May 15, 2024
c4439fb
Fix a case where an error in the ORDER BY clause of an aggregate func…
May 16, 2024
c72953a
The sqlite3_declare_vtab() interface should return SQLITE_ERROR, not
May 16, 2024
fa0763e
Add extra tests for the error messages generated by sqlite3_declare_v…
May 16, 2024
b834f62
Improvements to a VDBE comment. No changes to anything that affects …
May 17, 2024
79dac84
JS error message and doc typos reported in the forum. No code changes.
May 18, 2024
0462499
Fix the definition of sqlite3_vtab_distinct() such that return codes …
May 18, 2024
df903fe
Improvements to the sqlite3_vtab_distinct() documentation.
May 20, 2024
e212493
Improvements to the documentation of sqlite3_vtab_distinct(). Do not…
May 20, 2024
f765aec
Do not run the tests in recovercorrupt4.test with the inmemory_journa…
May 20, 2024
0020847
Omit a capi3 test from 2007 that depends upon undefined behavior (UAF).
May 20, 2024
b833793
Fix the -> and ->> operators so that when the RHS is a string that lo…
May 21, 2024
33087db
Fix harmless compiler warnings.
May 21, 2024
2526668
Do not attempt to run mmapcorrupt.test with builds that do not suppor…
May 21, 2024
3731703
Ensure an sqlite_dbdata cursor is properly reset before being used ag…
May 21, 2024
bebe2d8
Version 3.46.0
May 23, 2024
936c8e4
Fix the window-function group_concat() so that it returns an empty st…
May 23, 2024
0ed22ad
Increase the version number to 3.46.1
May 23, 2024
ee8e00f
Ensure that sqlite3ViewGetColumnNames() returns non-zero on any error.
May 25, 2024
2eec675
Fix a possible buffer overwrite in the ".import" command.
May 27, 2024
ec79dfa
Fix an fts5 problem with secure-delete mode causing integrity-check t…
Jun 5, 2024
2fdb323
Disable the omit-noop-join optimization when there are 64 or more ter…
Jun 9, 2024
94dbae0
Fix a potential db corruption case triggered by the OPFS VFS's xCheck…
Jun 12, 2024
17b83d2
Improve the JS-exception-to-C-result-code conversion to account for t…
Jun 17, 2024
a4ccda2
Work around a difficult-to-trigger Atomics API message-passing quirk …
Jul 12, 2024
6552198
Slight doc touchup for [af41a1e6fc8b36e9bf65]/[c7519d98ff09e] based o…
Jul 15, 2024
3903ad4
Improved robustness of parsing of tokenize= arguments in FTS5.
Aug 6, 2024
9dc32ea
Move a misplaced va_end, as reported in [forum:702c79e9da|forum post …
Aug 8, 2024
3c44d50
Do not let the number of terms on a VALUES clause be limited by
Aug 8, 2024
b11e7e6
Ensure sqlite3expert.c unregisters any SQL user-functions it register…
Aug 8, 2024
4c6a129
Remove unused static var cBadGroup from ext/consio/console_io.c to re…
Aug 9, 2024
21219fe
Enhancements to covering-index prediction.
Aug 10, 2024
3b17183
Cherrypick various minor fixes from trunk into branch-3.46.
Aug 10, 2024
016214d
Cherrypick ALTER TABLE fixes from trunk so that ALTER TABLE no longer
Aug 10, 2024
8cec7ac
Fix behavior change in the offset() SQL function introduced by
Aug 10, 2024
a751fdd
Revision to check-in d9f726ade6b258f8 so that OOM and other unrelated…
Aug 10, 2024
f3d536d
Version 3.46.1
Aug 13, 2024
02c7bd6
Merge upstream SQLite 3.46.1
penberg May 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions libsql-ffi/bundled/SQLite3MultipleCiphers/src/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ static int writeFile(
#if !defined(_WIN32) && !defined(WIN32)
if( S_ISLNK(mode) ){
const char *zTo = (const char*)sqlite3_value_text(pData);
if( zTo==0 || symlink(zTo, zFile)<0 ) return 1;
if( zTo==0 ) return 1;
unlink(zFile);
if( symlink(zTo, zFile)<0 ) return 1;
}else
#endif
{
Expand Down Expand Up @@ -458,13 +460,19 @@ static int writeFile(
return 1;
}
#else
/* Legacy unix */
struct timeval times[2];
times[0].tv_usec = times[1].tv_usec = 0;
times[0].tv_sec = time(0);
times[1].tv_sec = mtime;
if( utimes(zFile, times) ){
return 1;
/* Legacy unix.
**
** Do not use utimes() on a symbolic link - it sees through the link and
** modifies the timestamps on the target. Or fails if the target does
** not exist. */
if( 0==S_ISLNK(mode) ){
struct timeval times[2];
times[0].tv_usec = times[1].tv_usec = 0;
times[0].tv_sec = time(0);
times[1].tv_sec = mtime;
if( utimes(zFile, times) ){
return 1;
}
}
#endif
}
Expand Down
120 changes: 88 additions & 32 deletions libsql-ffi/bundled/SQLite3MultipleCiphers/src/series.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,20 @@ SQLITE_EXTENSION_INIT1
** index is ix. The 0th member is given by smBase. The sequence members
** progress per ix increment by smStep.
*/
static sqlite3_int64 genSeqMember(sqlite3_int64 smBase,
sqlite3_int64 smStep,
sqlite3_uint64 ix){
if( ix>=(sqlite3_uint64)LLONG_MAX ){
static sqlite3_int64 genSeqMember(
sqlite3_int64 smBase,
sqlite3_int64 smStep,
sqlite3_uint64 ix
){
static const sqlite3_uint64 mxI64 =
((sqlite3_uint64)0x7fffffff)<<32 | 0xffffffff;
if( ix>=mxI64 ){
/* Get ix into signed i64 range. */
ix -= (sqlite3_uint64)LLONG_MAX;
ix -= mxI64;
/* With 2's complement ALU, this next can be 1 step, but is split into
* 2 for UBSAN's satisfaction (and hypothetical 1's complement ALUs.) */
smBase += (LLONG_MAX/2) * smStep;
smBase += (LLONG_MAX - LLONG_MAX/2) * smStep;
smBase += (mxI64/2) * smStep;
smBase += (mxI64 - mxI64/2) * smStep;
}
/* Under UBSAN (or on 1's complement machines), must do this last term
* in steps to avoid the dreaded (and harmless) signed multiply overlow. */
Expand Down Expand Up @@ -372,13 +376,13 @@ static int seriesEof(sqlite3_vtab_cursor *cur){
** parameter. (idxStr is not used in this implementation.) idxNum
** is a bitmask showing which constraints are available:
**
** 1: start=VALUE
** 2: stop=VALUE
** 4: step=VALUE
**
** Also, if bit 8 is set, that means that the series should be output
** in descending order rather than in ascending order. If bit 16 is
** set, then output must appear in ascending order.
** 0x01: start=VALUE
** 0x02: stop=VALUE
** 0x04: step=VALUE
** 0x08: descending order
** 0x10: ascending order
** 0x20: LIMIT VALUE
** 0x40: OFFSET VALUE
**
** This routine should initialize the cursor and position it so that it
** is pointing at the first row, or pointing off the end of the table
Expand All @@ -392,26 +396,44 @@ static int seriesFilter(
series_cursor *pCur = (series_cursor *)pVtabCursor;
int i = 0;
(void)idxStrUnused;
if( idxNum & 1 ){
if( idxNum & 0x01 ){
pCur->ss.iBase = sqlite3_value_int64(argv[i++]);
}else{
pCur->ss.iBase = 0;
}
if( idxNum & 2 ){
if( idxNum & 0x02 ){
pCur->ss.iTerm = sqlite3_value_int64(argv[i++]);
}else{
pCur->ss.iTerm = 0xffffffff;
}
if( idxNum & 4 ){
if( idxNum & 0x04 ){
pCur->ss.iStep = sqlite3_value_int64(argv[i++]);
if( pCur->ss.iStep==0 ){
pCur->ss.iStep = 1;
}else if( pCur->ss.iStep<0 ){
if( (idxNum & 16)==0 ) idxNum |= 8;
if( (idxNum & 0x10)==0 ) idxNum |= 0x08;
}
}else{
pCur->ss.iStep = 1;
}
if( idxNum & 0x20 ){
sqlite3_int64 iLimit = sqlite3_value_int64(argv[i++]);
sqlite3_int64 iTerm;
if( idxNum & 0x40 ){
sqlite3_int64 iOffset = sqlite3_value_int64(argv[i++]);
if( iOffset>0 ){
pCur->ss.iBase += pCur->ss.iStep*iOffset;
}
}
if( iLimit>=0 ){
iTerm = pCur->ss.iBase + (iLimit - 1)*pCur->ss.iStep;
if( pCur->ss.iStep<0 ){
if( iTerm>pCur->ss.iTerm ) pCur->ss.iTerm = iTerm;
}else{
if( iTerm<pCur->ss.iTerm ) pCur->ss.iTerm = iTerm;
}
}
}
for(i=0; i<argc; i++){
if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
/* If any of the constraints have a NULL value, then return no rows.
Expand All @@ -422,7 +444,7 @@ static int seriesFilter(
break;
}
}
if( idxNum & 8 ){
if( idxNum & 0x08 ){
pCur->ss.isReversing = pCur->ss.iStep > 0;
}else{
pCur->ss.isReversing = pCur->ss.iStep < 0;
Expand All @@ -442,50 +464,81 @@ static int seriesFilter(
**
** The query plan is represented by bits in idxNum:
**
** (1) start = $value -- constraint exists
** (2) stop = $value -- constraint exists
** (4) step = $value -- constraint exists
** (8) output in descending order
** 0x01 start = $value -- constraint exists
** 0x02 stop = $value -- constraint exists
** 0x04 step = $value -- constraint exists
** 0x08 output is in descending order
** 0x10 output is in ascending order
** 0x20 LIMIT $value -- constraint exists
** 0x40 OFFSET $value -- constraint exists
*/
static int seriesBestIndex(
sqlite3_vtab *pVTab,
sqlite3_index_info *pIdxInfo
){
int i, j; /* Loop over constraints */
int idxNum = 0; /* The query plan bitmask */
#ifndef ZERO_ARGUMENT_GENERATE_SERIES
int bStartSeen = 0; /* EQ constraint seen on the START column */
#endif
int unusableMask = 0; /* Mask of unusable constraints */
int nArg = 0; /* Number of arguments that seriesFilter() expects */
int aIdx[3]; /* Constraints on start, stop, and step */
int aIdx[5]; /* Constraints on start, stop, step, LIMIT, OFFSET */
const struct sqlite3_index_constraint *pConstraint;

/* This implementation assumes that the start, stop, and step columns
** are the last three columns in the virtual table. */
assert( SERIES_COLUMN_STOP == SERIES_COLUMN_START+1 );
assert( SERIES_COLUMN_STEP == SERIES_COLUMN_START+2 );

aIdx[0] = aIdx[1] = aIdx[2] = -1;
aIdx[0] = aIdx[1] = aIdx[2] = aIdx[3] = aIdx[4] = -1;
pConstraint = pIdxInfo->aConstraint;
for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
int iCol; /* 0 for start, 1 for stop, 2 for step */
int iMask; /* bitmask for those column */
int op = pConstraint->op;
if( op>=SQLITE_INDEX_CONSTRAINT_LIMIT
&& op<=SQLITE_INDEX_CONSTRAINT_OFFSET
){
if( pConstraint->usable==0 ){
/* do nothing */
}else if( op==SQLITE_INDEX_CONSTRAINT_LIMIT ){
aIdx[3] = i;
idxNum |= 0x20;
}else{
assert( op==SQLITE_INDEX_CONSTRAINT_OFFSET );
aIdx[4] = i;
idxNum |= 0x40;
}
continue;
}
if( pConstraint->iColumn<SERIES_COLUMN_START ) continue;
iCol = pConstraint->iColumn - SERIES_COLUMN_START;
assert( iCol>=0 && iCol<=2 );
iMask = 1 << iCol;
if( iCol==0 ) bStartSeen = 1;
#ifndef ZERO_ARGUMENT_GENERATE_SERIES
if( iCol==0 && op==SQLITE_INDEX_CONSTRAINT_EQ ){
bStartSeen = 1;
}
#endif
if( pConstraint->usable==0 ){
unusableMask |= iMask;
continue;
}else if( pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
}else if( op==SQLITE_INDEX_CONSTRAINT_EQ ){
idxNum |= iMask;
aIdx[iCol] = i;
}
}
for(i=0; i<3; i++){
if( aIdx[3]==0 ){
/* Ignore OFFSET if LIMIT is omitted */
idxNum &= ~0x60;
aIdx[4] = 0;
}
for(i=0; i<5; i++){
if( (j = aIdx[i])>=0 ){
pIdxInfo->aConstraintUsage[j].argvIndex = ++nArg;
pIdxInfo->aConstraintUsage[j].omit = !SQLITE_SERIES_CONSTRAINT_VERIFY;
pIdxInfo->aConstraintUsage[j].omit =
!SQLITE_SERIES_CONSTRAINT_VERIFY || i>=3;
}
}
/* The current generate_column() implementation requires at least one
Expand All @@ -506,19 +559,22 @@ static int seriesBestIndex(
** this plan is unusable */
return SQLITE_CONSTRAINT;
}
if( (idxNum & 3)==3 ){
if( (idxNum & 0x03)==0x03 ){
/* Both start= and stop= boundaries are available. This is the
** the preferred case */
pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
pIdxInfo->estimatedRows = 1000;
if( pIdxInfo->nOrderBy>=1 && pIdxInfo->aOrderBy[0].iColumn==0 ){
if( pIdxInfo->aOrderBy[0].desc ){
idxNum |= 8;
idxNum |= 0x08;
}else{
idxNum |= 16;
idxNum |= 0x10;
}
pIdxInfo->orderByConsumed = 1;
}
}else if( (idxNum & 0x21)==0x21 ){
/* We have start= and LIMIT */
pIdxInfo->estimatedRows = 2500;
}else{
/* If either boundary is missing, we have to generate a huge span
** of numbers. Make this case very expensive so that the query
Expand Down
29 changes: 22 additions & 7 deletions libsql-ffi/bundled/bindings/session_bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ extern "C" {
) -> ::std::os::raw::c_int;
}

pub const SQLITE_VERSION: &[u8; 7] = b"3.45.1\0";
pub const SQLITE_VERSION_NUMBER: i32 = 3045001;
pub const SQLITE_VERSION: &[u8; 7] = b"3.46.1\0";
pub const SQLITE_VERSION_NUMBER: i32 = 3046001;
pub const SQLITE_SOURCE_ID: &[u8; 85] =
b"2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257ccalt1\0";
b"2024-08-13 09:16:08 c9c2ab54ba1f5f46360f1b4f35d849cd3f080e6fc2b6c60e91b16c63f69aalt1\0";
pub const LIBSQL_VERSION: &[u8; 6] = b"0.2.3\0";
pub const SQLITE_OK: i32 = 0;
pub const SQLITE_ERROR: i32 = 1;
Expand Down Expand Up @@ -263,6 +263,7 @@ pub const SQLITE_CONFIG_STMTJRNL_SPILL: i32 = 26;
pub const SQLITE_CONFIG_SMALL_MALLOC: i32 = 27;
pub const SQLITE_CONFIG_SORTERREF_SIZE: i32 = 28;
pub const SQLITE_CONFIG_MEMDB_MAXSIZE: i32 = 29;
pub const SQLITE_CONFIG_ROWID_IN_VIEW: i32 = 30;
pub const SQLITE_DBCONFIG_MAINDBNAME: i32 = 1000;
pub const SQLITE_DBCONFIG_LOOKASIDE: i32 = 1001;
pub const SQLITE_DBCONFIG_ENABLE_FKEY: i32 = 1002;
Expand Down Expand Up @@ -956,7 +957,7 @@ extern "C" {
extern "C" {
pub fn sqlite3_vmprintf(
arg1: *const ::std::os::raw::c_char,
arg2: va_list,
arg2: *mut __va_list_tag,
) -> *mut ::std::os::raw::c_char;
}
extern "C" {
Expand All @@ -972,7 +973,7 @@ extern "C" {
arg1: ::std::os::raw::c_int,
arg2: *mut ::std::os::raw::c_char,
arg3: *const ::std::os::raw::c_char,
arg4: va_list,
arg4: *mut __va_list_tag,
) -> *mut ::std::os::raw::c_char;
}
extern "C" {
Expand Down Expand Up @@ -2522,7 +2523,7 @@ extern "C" {
pub fn sqlite3_str_vappendf(
arg1: *mut sqlite3_str,
zFormat: *const ::std::os::raw::c_char,
arg2: va_list,
arg2: *mut __va_list_tag,
);
}
extern "C" {
Expand Down Expand Up @@ -3227,6 +3228,12 @@ extern "C" {
pData: *mut ::std::os::raw::c_void,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn sqlite3changegroup_add_change(
arg1: *mut sqlite3_changegroup,
arg2: *mut sqlite3_changeset_iter,
) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn sqlite3changegroup_output(
arg1: *mut sqlite3_changegroup,
Expand Down Expand Up @@ -4085,4 +4092,12 @@ extern "C" {
extern "C" {
pub static sqlite3_wal_manager: libsql_wal_manager;
}
pub type __builtin_va_list = *mut ::std::os::raw::c_char;
pub type __builtin_va_list = [__va_list_tag; 1usize];
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __va_list_tag {
pub gp_offset: ::std::os::raw::c_uint,
pub fp_offset: ::std::os::raw::c_uint,
pub overflow_arg_area: *mut ::std::os::raw::c_void,
pub reg_save_area: *mut ::std::os::raw::c_void,
}
Loading
Loading