drh [Fri, 13 Jan 2023 19:32:19 +0000 (19:32 +0000)]
In expression nodes of type REGISTER with sub-type COLUMN, ensure that the
iColumn field is set correctly, as otherwise the "IS NULL" operator might
be incorrectly optimized. Fix for the problem described by
[forum:/forumpost/d010a26798915b53|forum post d010a26798915b53].
drh [Thu, 5 Jan 2023 01:29:59 +0000 (01:29 +0000)]
In the zipvfile extension (which is not part of the SQLite amalgamation, but
which is included in the CLI by default) ensure that fopen() is not invoked
using a NULL filename. Fix for the issue reported by
[forum:/forumpost/d1c96a9032e564f8|forum post d1c96a9032e564f8].
drh [Mon, 26 Dec 2022 17:02:15 +0000 (17:02 +0000)]
Prevent the sessions rebaser from generating changesets containing UPDATE records for which non-PK fields are present in the old.* but not the new.* record. Also update the changeset iterator to work around such changesets.
drh [Mon, 26 Dec 2022 16:54:15 +0000 (16:54 +0000)]
In the unix backend, when implementing the defenses against small file
descriptors, delete a file just created if it was opened with
O_EXCL|O_CREAT so that it can be created again the next time through the
loop. Fix for the problem described by
[forum:/forumpost/699af709ab3a8ccf|forum post 699af709ab3a8ccf].
drh [Mon, 26 Dec 2022 15:55:10 +0000 (15:55 +0000)]
Fix a off-by-one error in code generation that comes up when
doing a DISTINCT query against a virtual table with an OR term in the
WHERE clause and where the ORDER BY clause has 64 or more references to
the result set. [forum:/forumpost/dfe8084751|Forum post dfe8084751].
The error is harmless in production builds, but might cause an assertion
fault in a debugging build.
drh [Mon, 26 Dec 2022 15:21:42 +0000 (15:21 +0000)]
Fix an infinite loop in the MEMSYS5 auxiliary memory allocator that occurs
for memory allocations between 1GiB and 2GiB in size. Error introduced
by check-in [949133231f8f751a]. The problem only affects builds that
include the SQLITE_ENABLE_MEMSYS5 compile-time option.
drh [Mon, 14 Nov 2022 18:57:21 +0000 (18:57 +0000)]
Change the fake_big_file test command so that it fails for files larger than
2MB on Windows, as we have observed that Window10 will sometimes bluescreen
when operating on very large sparse files.
drh [Sat, 12 Nov 2022 17:17:01 +0000 (17:17 +0000)]
Disable the ability to change the schema_version cookie when
SQLITE_DBCONFIG_DEFENSIVE mode is enabled. This is a security
enhancement inspired by the question in
[forum:/forumpost/2b9cc3dae1f1e5f6|forum post 2b9cc3dae1f1e5f6].
stephan [Thu, 10 Nov 2022 13:22:35 +0000 (13:22 +0000)]
Automatically relinquish implicitly-acquired OPFS file locks during VFS idle time in an attempt to help alleviate cross-tab locking contention like that described in [forum:58a377083cd24a|forum post 58a377083cd24a].
stephan [Thu, 10 Nov 2022 11:35:10 +0000 (11:35 +0000)]
OPFS: if an op which needs a lock is called when no lock has been obtained, automatically lock it at the start of the op and unlock it at the end of that op. This is an attempt to alleviate the cross-tab contention described in [forum post 58a377083cd24a|forum:58a377083cd24a] but it increases speedtest1 run time by approximately 4x. Perhaps auto-lock can be combined with the older idle-time-based auto-unlock to unlock such locks (but not those from xLock()) to improve this?
drh [Wed, 9 Nov 2022 10:17:25 +0000 (10:17 +0000)]
Increase the precision of the nData parameter to the dbdataValue() routine
inside the sqlite_dbdata virtual table, to avoid the possibility of integer
overflow.
dan [Tue, 8 Nov 2022 20:04:05 +0000 (20:04 +0000)]
Fix a problem with URI formatting in calls to sqlite3rbu_vacuum(zDb, NULL) causing problems on win32. First reported here <https://sqlite.org/forum/forumpost/a7ae915a9d>.
drh [Mon, 7 Nov 2022 18:36:02 +0000 (18:36 +0000)]
Improve the ability of mkshellc.tcl to remove redundant typedefs from the
generated shell.c code. This is needed to get shell.c to build on older
C compilers.
stephan [Mon, 7 Nov 2022 13:06:20 +0000 (13:06 +0000)]
Add sqlite3.wasm.alloc.impl() as a "public back door" into the low-level non-throwing allocator. Correct sqlite3.WasmAllocError constructor to behave like its usages expect it to and add tests for that.
drh [Mon, 7 Nov 2022 11:19:28 +0000 (11:19 +0000)]
Fix the documentation regarding negative length parameters for
sqlite3_result_text() interfaces, to point out that the length parameter
to sqlite3_result_text64() cannot be negative.
[forum:/forumpost/cf1d043b07|Forum post cf1d043b07].
Comment/documentation change only.
drh [Sun, 6 Nov 2022 17:19:34 +0000 (17:19 +0000)]
The recoverAssertMutexHeld() function is for testing and verification only
and should be a harmless no-op for production builds.
[forum/forumpost/b4f2c7d402|Forum post b4f2c7d402].
drh [Fri, 4 Nov 2022 11:54:42 +0000 (11:54 +0000)]
Enhance the ability of the OP_Found and similar opcodes to detect truncated
index records and report SQLITE_CORRUPT.
dbsqlfuzz 2b12f90aeff8e081706c7e9b58834f04869f446c. Test cases in TH3.
stephan [Thu, 3 Nov 2022 22:51:20 +0000 (22:51 +0000)]
Add experimental esm target to ext/wasm/GNUmakefile to tell emcc to generate sqlite3.mjs (ES6 module) instead of sqlite3.js. Related to discussion at [forum:ed4596cf8496a39b].
stephan [Wed, 2 Nov 2022 11:53:31 +0000 (11:53 +0000)]
Add sqlite3_wasm_vfs_create_file() to replace Emscripten's FS.createDataFile() in a (mostly) VFS-agnostic way. Add a test for worker1's export (to bytearray) support. Re-add worker1 open-from-bytearray using sqlite3_wasm_vfs_create_file() but it's untested (requires a new interactive test app or maybe reconsideration).
drh [Tue, 1 Nov 2022 12:10:39 +0000 (12:10 +0000)]
Enforce affinity on materialized tables for subqueries and views. Also,
do not allow UNION ALL flattening if the affinity of a result column varies
between different arms of the compound. This is a fix for
ticket [57c47526c34f01e8].
drh [Tue, 1 Nov 2022 12:01:10 +0000 (12:01 +0000)]
Improvements to comments. Change the "optimization_control" TCL command
in the test harness so that it returns the new optimization mask, for
verification.
drh [Mon, 31 Oct 2022 18:01:05 +0000 (18:01 +0000)]
Make the UPDATE method of the sqlite_dbpage virtual table rebust against
OOM errors. [forum:/forumpost/bbcf0dd6ca|Forum post bbcf0dd6ca]. Test case
in TH3.
stephan [Mon, 31 Oct 2022 13:50:05 +0000 (13:50 +0000)]
Worker1: use a list, rather than a single slot, to manage the default db link so that we can keep the least-recently-opened db as the default. Re-introduce worker1.export() but do not yet expose it until an equivalent import() (or open() option) is implemented.
stephan [Mon, 31 Oct 2022 11:09:14 +0000 (11:09 +0000)]
Add oo1.DB.exec() 'returnValue' option, which specifies what exec() should return. Defaults to the db object and enables direct return of the result rows array or a list of the individual SQL statements. Other code-adjacent internal cleanups.
stephan [Sun, 30 Oct 2022 09:47:33 +0000 (09:47 +0000)]
Minor WASM build cleanups. Enable custom Module.instantiateWasm() when not in WASMFS mode (where it doesn't work). Add sqlite3.debugModule URL param to enable some module-init-time debugging output.
stephan [Sun, 30 Oct 2022 08:39:18 +0000 (08:39 +0000)]
Reduce wasm module's starting memory from 128mb to 16mb. The latter value is needed only for WASMFS-based batch-runner.js, as WASMFS builds cannot be configured for dynamic memory growth without a tremendous performance hit.
stephan [Sat, 29 Oct 2022 07:54:10 +0000 (07:54 +0000)]
Move the sqlite3.capi.wasm namespace to sqlite3.wasm. This causes a tiny bit of naming confusion with the sqlite3.wasm *file*, but seems to make more sense than having it as a sub-namespace of capi.