drh [Mon, 31 Oct 2022 18:11:12 +0000 (18:11 +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.
drh [Tue, 25 Oct 2022 13:46:38 +0000 (13:46 +0000)]
Fix the ".dump" command in the CLI so that it is more rebust against
corrupt database files. At the same time,
enhance the sqlite3_strglob() and sqlite3_strlike() interfaces so that they
will do sensible things with NULL string pointers.
drh [Mon, 17 Oct 2022 16:29:08 +0000 (16:29 +0000)]
Fix a potential call to strlen() with a null argument in the command-line shell
following an OOM error. [forum:/forumpost/9c4f2ebe22|forum post 9c4f2ebe22].
drh [Mon, 10 Oct 2022 12:10:07 +0000 (12:10 +0000)]
Improved detection of database corrupting when moving pages on an
autovacuumed database when creating a new btree.
dbsqlfuzz 9a55397eae13cec64aebf1fd35489c3a90bdaac5
drh [Fri, 7 Oct 2022 19:11:22 +0000 (19:11 +0000)]
Fix a problem causing the seek-scan optimization to skip over valid rows that could occur when it is used with expressions of the form (a IN (?,?..) AND b >= ?). dbsqlfuzz ab1db6dc0efb04cba1cd3431ee6da4894fdc4520.
drh [Fri, 7 Oct 2022 18:06:51 +0000 (18:06 +0000)]
Fix a problem that occurred when using a bloom filter to optimize an (ipk = ?) lookup in the case where the RHS of the expression is a TEXT value. First reported by [forum:/forumpost/f61a8b7053|forum post f61a8b7053].
Enhance defensive mode so that it disallows CREATE TRIGGER statements if
the statements within the trigger attempt to write on a shadow table. Also
make the legacy FTS3 code more robust against integer overflow during
memory allocation.
dan [Sat, 10 Sep 2022 13:50:33 +0000 (13:50 +0000)]
Enhance the b-tree page sorting code to ensure that sqlite3PagerRekey() never
overloads a page number and uses only the PENDING_BYTE page for temporary
storage.
Mutex protect access to the sqlite3_test_directory and sqlite3_data_directory
global variables. See
[forum:/forumpost/719a11e1314d1c70|forum thread 719a11e1314d1c70].
drh [Tue, 30 Aug 2022 14:13:15 +0000 (14:13 +0000)]
Any function call can abort. Take this into account when deciding if a DML
statement needs a statement journal. See
[forum:/forumpost/9b9e4716c0d7bbd1|forum thread 9b9e4716c0d7bbd1] for more
information.
drh [Thu, 4 Aug 2022 17:17:41 +0000 (17:17 +0000)]
Fix a problem with the query optimizer for LIMIT/OFFSET queries when
underlying query is a UNION ALL and both arms of the UNION ALL are
subqueries with an ORDER BY clause. This bug was reported at
[forum:/forumpost/6b5e9188f0657616|forum post 6b5e9188f0657616]. The
problem was introduced in 2015 (SQLite version 3.9.0) by check-in
[4b631364354068af]. See also ticket [b65cb2c8d91f6685].
drh [Wed, 3 Aug 2022 16:04:12 +0000 (16:04 +0000)]
For an IN operator used with a RIGHT JOIN, use the number of terms in the
vector, not the number of equality terms, to size the column map.
dbsqlfuzz 14cfdad6ca45e607163f54049ddf5065183dc657.
drh [Mon, 1 Aug 2022 13:15:29 +0000 (13:15 +0000)]
In the xUpdate method of the GeoPoly virtual table, make sure that the
number of updated columns does not exceed the underlying implementation, even
if the virtual table object records an excess number of column in the nAux
field due to table constraints in the table definition.
Fix for the problem reported by
[forum:/forumpost/a096ab7d96bb057a|forum post a096ab7d96bb057a].
In the query planner, restore the former aggressiveness in reordering of
FROM clause terms that existed prior to version 3.39.0 for queries that
contain no RIGHT or FULL JOINs.
Fix the whereKeyStats() routine (part of STAT4 processing only) so that it
is able to cope with row-value comparisons against the primary key index
of a WITHOUT ROWID table.
[forum:/forumpost/3607259d3c|Forum post 3607259d3c].
The query flattener should not run if the subquery is a compound that contains
a RIGHT JOIN in any arm and the subquery is not the first element of the
outer query. Otherwise, prior elements of the outer query will not have
the JT_LTORJ flag set. Fix for the problem reported in
[forum:/forumpost/174afeae5734d42d|forum post 174afeae5734d42d].
Ensure that the Parse.nErr flag is set following an SQLITE_TOOBIG error on
a nested parse. Fix for the problem identified by
[forum/forumpost/d5a82ba9eedee30c | forum post d5a82ba9eedee30c].
Also, remove unnecessary clearing of the Parse.zErrMsg field
following a nested parse.
Fix the initial-prefix optimization for the REGEXP extension such that it
works even if the prefix contains characters that require a 3-byte UTF8
encoding. This should fix the problem reported by
[forum:/forumpost/96692f8ba5|forum post 96692f8ba5].
drh [Thu, 30 Jun 2022 14:19:38 +0000 (14:19 +0000)]
Fix documentation and test-script typos and a dependency problem on a Makefile. Fix the sqlite_stmt extension virtual table so that it shows the state of all
prepared statements for a single instant in time.
drh [Sat, 25 Jun 2022 02:39:29 +0000 (02:39 +0000)]
Change a harmless assert() into a testcase(). The actually test case code
is in TH3. Fix for the problem described at
[forum:/info/ed29e196d5c4f3d5|forum post ed29e196d5c4f3d5].
drh [Wed, 22 Jun 2022 14:43:52 +0000 (14:43 +0000)]
Allow more line with on the debugging output for SrcItem elements in the
parse tree. This affects debugging builds only and is a no-op for production
builds.
drh [Tue, 21 Jun 2022 13:41:24 +0000 (13:41 +0000)]
Allow a HAVING clause on any aggregate query, even if there is no GROUP BY
clause. This brings SQLite into closer agreement with PostgreSQL and fixes
the concern raised by
[forum:/forumpost/1a7fea4651|forum post 1a7fea4651].
drh [Mon, 20 Jun 2022 18:26:14 +0000 (18:26 +0000)]
Do not allow FROM-clause terms on the left side of a RIGHT or FULL JOIN to
be reordered. [forum:/forumpost/6650cd40b5634f35|forum post 6650cd40b5634f35].
This is probably more strict that necessary to get correct behavior,
but for the first release that supports RIGHT/FULL JOIN it is perhaps better
to be correct than fast. A less strict constraint might be to prohibit
FROM-clause terms that originate on the left side of a RIGHT JOIN from
crossing from the right side to the left side of a LEFT JOIN. Revisit this
later.
drh [Mon, 20 Jun 2022 17:04:44 +0000 (17:04 +0000)]
Do not allow an ON clause to references tables to its right if there is a
RIGHT or LEFT join anywhere in the query. Other RDBMSes prohibit this always,
but SQLite must allow ON clauses to reference tables to their right for legacy
compatibility, unless there is a RIGHT or LEFT join someplace in the query,
in which case there is no legacy to support.
drh [Mon, 20 Jun 2022 12:42:28 +0000 (12:42 +0000)]
The fix at [cab9b4cccd13bf0a] was incomplete, as demonstrated by
[forum:/forumpost/57bdf2217d|forum post 57bdf2217d]. This check-in
should complete the fix.
drh [Sun, 19 Jun 2022 16:55:07 +0000 (16:55 +0000)]
Follow-up to check-in [0057bbb508e7662b] - ensure that the database page
has been initialized prior to continuing with the optimization. If the page
is not initialized, that indicates that the database is corrupt.
dbsqlfuzz 09ee46becd5e6d1b2a55c9f8ad767335a90aadb0.
drh [Sat, 18 Jun 2022 20:20:30 +0000 (20:20 +0000)]
Enable query invariant checking in fuzzcheck by default. There is no way
to turn it off. Update the invariant checking logic to be consistant with
dbsqlfuzz.
drh [Fri, 17 Jun 2022 21:31:30 +0000 (21:31 +0000)]
Fix the OP_Concat operator such that when concatenating a BLOB with an
odd number of bytes on a database that is UTF16, the size of the resulting
string is reduced to a multiple of two.
drh [Fri, 17 Jun 2022 15:11:31 +0000 (15:11 +0000)]
Fix the virtual table detection mechanism to avoid false-positives that were
blocking all failures. Then fix a few of the additional problems that are
revealed by that fix. More fixes are needed.
drh [Fri, 17 Jun 2022 12:25:33 +0000 (12:25 +0000)]
Fix the new --query-invariants option on fuzzcheck so that it does not
use an unprotected sqlite3_value object as an argument to sqlite3_value_int64().
drh [Wed, 15 Jun 2022 14:57:04 +0000 (14:57 +0000)]
When running an incremental vacuum, detect growth in the size of the database
file (which can only occur if the file is corrupt) and fail with SQLITE_CORRUPT.
drh [Wed, 15 Jun 2022 12:32:27 +0000 (12:32 +0000)]
Dbsqlfuzz discovered a case where a bytecode branch is in fact taken, so change
the designator from VdbeCoverageNeverTaken() to VdbeCoverage(). Test case
in TH3.
drh [Mon, 13 Jun 2022 12:42:24 +0000 (12:42 +0000)]
Do not remove the EP_CanBeNull flag from expressions during a LEFT JOIN
strength reduction if the query also contains a RIGHT JOIN. Fix for
the problem identified by
[forum/forumpost/b40696f50145d21c|forum post b40696f50145d21c].