stephan [Thu, 17 Oct 2024 12:17:18 +0000 (12:17 +0000)]
Fix the OPFS VFS's xOpen() to honor the read-only flag. Fix the OPFS SAHPool VFS to enable re-installation of the VFS after calling OpfsSAHPoolUtil.removeVfs().
drh [Mon, 26 Aug 2024 23:32:02 +0000 (23:32 +0000)]
Earlier error detection while processing complex aggregate
queries. dbsqlfuzz 5242c2f07f4aa031aa3c80461f18e9b7619ede9b
(The previous check-in on this branch really should have been this
cherrypick.)
drh [Tue, 20 Aug 2024 14:16:26 +0000 (14:16 +0000)]
When the database encoding is UTF-16LE and the GLOB optimization is used,
it is ok to use the range search over an index, but it is not ok to
disable the actual GLOB function call.
drh [Sat, 10 Aug 2024 10:14:47 +0000 (10:14 +0000)]
Enhancements to covering-index prediction.
Add early detection of over-prediction of covering-indexes so that
sqlite3_prepare() will return an error rather than just generate bad
bytecode.
stephan [Fri, 9 Aug 2024 12:20:15 +0000 (12:20 +0000)]
Remove unused static var cBadGroup from ext/consio/console_io.c to resolve a compiler warning reported in the fossil forum. This is a build fix, not a functional change.
drh [Thu, 8 Aug 2024 14:49:54 +0000 (14:49 +0000)]
Do not let the number of terms on a VALUES clause be limited by
SQLITE_LIMIT_COMPOUND_SELECT, even if the VALUES clause contains elements
that appear to be variables due to the use of double-quoted string literals.
stephan [Fri, 12 Jul 2024 13:51:40 +0000 (13:51 +0000)]
Work around a difficult-to-trigger Atomics API message-passing quirk in the OPFS VFS which appears in rare instances in some browsers when running high I/O loads. This resolves [https://github.com/sqlite/sqlite-wasm/issues/12 | issue #12 of the npm distribution].
stephan [Mon, 17 Jun 2024 13:06:53 +0000 (13:06 +0000)]
Improve the JS-exception-to-C-result-code conversion to account for the case of a file disappearing while the OPFS VFS is waiting to acquire a lock on it.
drh [Tue, 21 May 2024 11:11:29 +0000 (11:11 +0000)]
Fix the -> and ->> operators so that when the RHS is a string that looks like
a number, it is still treated as a string, because that is what PG does.
[forum:/forumpost/9e52cdfe15c3926e|Forum post 9e52cdfe15c3926e].
drh [Mon, 20 May 2024 17:52:35 +0000 (17:52 +0000)]
Improvements to the documentation of sqlite3_vtab_distinct(). Do not allow
sqlite3_vtab_distinct() to return 2 or 3 if the rowid column of the virtual
table is used, as doing so might lead to an incorrect answer.
drh [Sat, 18 May 2024 20:00:08 +0000 (20:00 +0000)]
Fix the definition of sqlite3_vtab_distinct() such that return codes 2 and
3 mean that all rows must be distinct over "colUsed" which is a superset of
"aOrderBy". Also, disallow return codes 2 and 3 if the rowid of the virtual
table is accessed.
drh [Thu, 16 May 2024 15:57:42 +0000 (15:57 +0000)]
The sqlite3_declare_vtab() interface should return SQLITE_ERROR, not
SQLITE_MISUSE when a nonsense SQL input is provided, for legacy compatibility.
[forum:/forumpost/4b875d7b2a|Forum post 4b875d7b2a].
drh [Thu, 16 May 2024 00:20:43 +0000 (00:20 +0000)]
Fix a case where an error in the ORDER BY clause of an aggregate function that is part of a trigger body might cause an assert() to fail in an ALTER TABLE command. dbsqlfuzz 899d9255555a07f1fe11a0bb51a2fe197b3150cd
drh [Wed, 15 May 2024 23:36:24 +0000 (23:36 +0000)]
Back out the assert() fixes from [a9443dbfbe25e588] and
[3afaeac56dff58db] (but keep the corresponding test cases) because they
are both made obsolete by the previous fix on this branch.
dan [Wed, 15 May 2024 21:38:04 +0000 (21:38 +0000)]
Fix a case where an error in the ORDER BY clause of an aggregate function that is part of a trigger body might cause an assert() to fail in an ALTER TABLE command.
dan [Wed, 15 May 2024 15:06:27 +0000 (15:06 +0000)]
If there is no data available for a field in a corrupted record, but the type is available, have the recovery extension substitute 0, 0.0, '' or X'' instead of a NULL value.
drh [Fri, 10 May 2024 18:24:15 +0000 (18:24 +0000)]
Fix aggregate function processing to correctly deal with OOMs inside of
sqlite3ParserAddCleanup().
(dbsqlfuzz b2d11ca70e55ee8bde48ae0b53fa3e9355812f95).
Also add improved testing support by causing sqlite3FaultSim(300) to
simulate an OOM inside of sqlite3ParserAddCleanup() and by adding
improved fault-sim support to the CLI.
drh [Fri, 10 May 2024 18:10:34 +0000 (18:10 +0000)]
The sqlite3FaultSim(300) error from [1e8863909ac369e5] must be treated as
an OOM, since it simulates an OOM. Also fix deferred deletion of Expr objects
from [a53bdd311c4154fd] so that it does not corrupt the AST if an OOM occurs.
stephan [Thu, 9 May 2024 18:00:14 +0000 (18:00 +0000)]
Reformulate a for-in loop to a for loop in wasm.xWrap() to work around a downstream framework-level misbehavior, as reported in [forum:b549992634b55104|forum post b549992634b55104].
dan [Mon, 6 May 2024 20:21:31 +0000 (20:21 +0000)]
When extracting links from sqlar archives, clobber any existing file or link, and do not call utimes() to set the timestamp - it looks through the link and operates on the target.
drh [Mon, 6 May 2024 19:04:46 +0000 (19:04 +0000)]
Avoid unnecessary recursion in sqlite3ExprDeleteNN(). This complicates the
code, but it is needed to prevent nuisance "stack overflow" reports from
OSSFuzz while it is running the latest ASAN.
drh [Sat, 4 May 2024 15:10:37 +0000 (15:10 +0000)]
Assume that an SQL function is able to return a subtype if any of its
arguments are SQL functions that are able to return subtypes. This closes
a corner-case hole in the patch at [ba789a7804ab96d8].
drh [Sat, 4 May 2024 15:04:45 +0000 (15:04 +0000)]
Assume that a function is able to return a subtype if either (1) it is itself
marked with SQLITE_RESULT_SUBTYPE, or (2) one of its arguments is a function
that is able to return a subtype. This check-in backs out the code changes
from the previous two on this same branch, but keeps the test cases from
the previous two.
drh [Sat, 4 May 2024 11:31:34 +0000 (11:31 +0000)]
Functions that pass through the sqlite3_value of one of their arguments must
also be marked as SQLITE_RESULT_SUBTYPE, in case one of their arguments has
a subtype.
drh [Fri, 3 May 2024 19:35:43 +0000 (19:35 +0000)]
The coalesce(), ifnull(), and iif() functions pass through subtype values
from their arguments, and hence need to have the SQLITE_RESULT_SUBTYPE flag
set. This fixes an corner-case for the patch at [ba789a7804ab96d8].
drh [Thu, 2 May 2024 12:14:31 +0000 (12:14 +0000)]
Fix the CREATE TABLE performance issue described by
[forum:/forumpost/4cf69794d9dfff7c|forum thread 4cf69794d9dfff7c] in two
different ways: (1) Omit the call to PRAGMA integrity_check('X') that was
being done after CREATE TABLE "X" because the result was being ignored and
the integrity_check was not doing anything other than burning CPU cycles.
(2) Do not interpret the argument to PRAGMA integrity_check as a number if it
is in fact a string that looks like a number.
drh [Thu, 2 May 2024 11:52:31 +0000 (11:52 +0000)]
Do not accept a string that looks like a number used as an argument to
PRAGMA integrity_check as a number. Treat it as a table name that just
happens to look like a number.
drh [Thu, 2 May 2024 11:51:26 +0000 (11:51 +0000)]
Omit the OP_SqlExec to "PRAGMA integrity_check" added by [348fa7aaf7958b3f]
because it is a no-op. Even if the integrity_check failes, the CREATE TABLE
is stull successful. The OP_SqlExec just burns CPU cycles for no reason.
Fix issues in [/info/1e227ad9f413227f|LIMIT/OFFSET support for virtual tables].
The first problem was reported by
[forum:/forumpost/c243b8f856|forum post c243b8f856]. That report prompted
an enhancement to the generate_series() (also included in this merge) which
in turn identified other similar issues.