dan [Mon, 12 Apr 2021 12:02:49 +0000 (12:02 +0000)]
Avoid an assert() failure when a compound scalar sub-select is, due to a "WHERE (sub-select) AND (... OR ...)" clause, coded twice by the code generator.
Refactor NameContext.nErr into nNcErr to avoid confusion with Parse.nErr.
Do not abandon sqlite3ResolveExprList() on nNcErr if nErr is still zero
as we might have hit a problem with ORDER BY resolution that should be a
suppressed error. dbsqlfuzz 41b9dad40919d3549ca7e52d893da81a6dded4ad
dan [Fri, 9 Apr 2021 20:50:40 +0000 (20:50 +0000)]
Have the VFS in memdb.c return SQLITE_IOERR_NOMEM instead of SQLITE_NOMEM when an OOM error is encountered. This is required to get the pager module to handle such OOM errors correctly in some cases.
dan [Thu, 8 Apr 2021 15:19:46 +0000 (15:19 +0000)]
Handle a special case of corruption that can present if "PRAGMA writable_schema=1" is set. Fix for dbsqlfuzz test case 6229ad63de49e3ba0630aaf0058868f36008bcca.
Also prohibit the use of rowid from a subquery. Add the
SQLITE_ALLOW_ROWID_IN_VIEW compile-time option to restore legacy behavior
in case somebody actually needs it.
In FTS3, if the xBegin method fails to start a transaction due to an OOM
error, then make sure that the virtual table is left in a consistent state.
dbsqlfuzz 85ef48423fda4eef79a551654445d8ef3537a590.
Earlier detection of page 1 on the freelist (which is impossible) and
reporting of that as database corruption.
dbsqlfuzz 6fe6c504b320be5e3eed66896cb0db28bfb38a93.
Do not apply the optimization that omits DISTINCT if all result terms are
part of a UNIQUE index if the index is also a partial index.
Fix for the bug reported by
[forum:/forumpost/66954e9ece|forum post 66954e9ece].
dan [Tue, 6 Apr 2021 13:53:10 +0000 (13:53 +0000)]
Handle "RETURNING rowid" clauses attached to INSERTs on views without causing an assert() to fail. Fixes dbsqlfuzz crash 0081f863d7b2002045ac2361879fc80dfebb98f1.
Do not invoke the xDelete method when converting to PRAGMA journal_mode=OFF
if the underlying VFS does not support that method.
dbsqlfuzz 39d6af88ef5242f866c4f9b21ede330c5c1e36a8.
As a continuation of [1f66a85b7757754f], ensure that an OOM that occurs
while checking the validity of the schema is reported out as SQLITE_NOMEM
and not as SQLITE_SCHEMA.
dan [Sat, 3 Apr 2021 19:23:59 +0000 (19:23 +0000)]
Fix a crash in handling queries of the form "SELECT aggregate(DISTINCT tbl.col) FROM ... LEFT JOIN tbl ...". Fixes a problem introduced by [ef4ac0ddd297bbd3].
Correctly capture the error when a RETURNING clause appears on an
attempt to UPDATE an eponymous virtual table.
dbsqlfuzz 486f791cbe2dc45839310073e71367a1d8ad22dd.
drh [Wed, 31 Mar 2021 23:56:55 +0000 (23:56 +0000)]
When resolving names in the RETURNING clause, do not accept trigger names
even within subquires. See
[forum:/info/34c81d83c9177f46|forum post 34c81d83c9177f46] for context.
drh [Wed, 31 Mar 2021 17:42:24 +0000 (17:42 +0000)]
When resolving column names in the RETURNING clause, do not ignore an
incorrect table name qualifier. Raise an error instead.
See [forum:forumpost/85aef8bc01|forum post 85aef8bc01] for context.
drh [Wed, 31 Mar 2021 13:31:33 +0000 (13:31 +0000)]
Defer deletion of expressions that are optimized out by the AND optimizer
in the sqlite3ExprAnd() routine until the corresponding Parse object is
deleted. This avoids a dangling pointer in AggInfo if sqlite3ExprAnd()
is invoked by the push-down optimization. The dangling pointer appears
to be harmless in release builds, only showing up in debug builds.
Problem found by dbsqlfuzz.
drh [Tue, 30 Mar 2021 01:52:21 +0000 (01:52 +0000)]
Raise an error if a term of the form "TABLE.*" appears in the RETURNING clause,
as SQLite does not (yet) know how to handle that.
Ticket [132994c8b1063bfb].
drh [Mon, 29 Mar 2021 18:53:47 +0000 (18:53 +0000)]
Omit the SQLITE_STOREP2 and SQLITE_KEEPNULL options from the comparison
opcodes, allowing them to run faster. This required refactoring the
vector comparison logic, which in turn required changing OP_ElseNotEq into
OP_ElseEq.
drh [Mon, 29 Mar 2021 14:40:48 +0000 (14:40 +0000)]
Add the OP_ZeroOrNull opcode and use it to compute boolean values for
scalar comparisons, rather than the SQLITE_STOREP2 parameter to the comparison
opcode.
drh [Mon, 29 Mar 2021 13:47:20 +0000 (13:47 +0000)]
The comparison opcodes (ex: OP_Eq) now set the iCompare flag so that the
result of comparison can be used by subsequent OP_Jump or OP_ElseNotEq
opcodes.
drh [Sat, 27 Mar 2021 16:21:34 +0000 (16:21 +0000)]
For the sqlite3_bind_text16 TCL binding used for testing, ensure that there
are at least 3 terminating zeros, so that there will always be a \u0000
character even if the original byte sequence is an odd number of bytes.
drh [Fri, 26 Mar 2021 23:59:37 +0000 (23:59 +0000)]
In the sqlite3_bind_text and sqlite3_bind_text16 TCL commands of the test
suite, ensure that the string is zero-terminated if the size argument is
negative.
drh [Wed, 24 Mar 2021 19:44:01 +0000 (19:44 +0000)]
Comment improvements to on the distinct-agg optimization. Show a line in
the EQP output when using an ephemeral table to implement DISTINCT on an
aggregate.
drh [Wed, 24 Mar 2021 17:28:11 +0000 (17:28 +0000)]
Improvements to distinct aggregates such that they can sometimes avoid
using an ephermeral table to test for duplicates if the column that is
distinct is part of an index.
drh [Tue, 23 Mar 2021 01:06:02 +0000 (01:06 +0000)]
Enhance the EXPLAIN QUERY PLAN output to use symbolic names to describe
subqueries, where possible, instead of cryptic subquery index numbers.
And in other ways, make the EQP output cleaner and easier to read. Little
code is changed, but many of the test results had to be tweaked to align
with the new output format.
drh [Sun, 21 Mar 2021 18:23:48 +0000 (18:23 +0000)]
Fix an assert() that in preupdate-hook logic (not normally built) that
can be false when running VACUUM on a corrupt database file under
PRAGMA writable_schema=ON.
drh [Sun, 21 Mar 2021 17:52:47 +0000 (17:52 +0000)]
Add a better comment and an assert() on the code inside sqlite3CreateIndex()
that REPLACE indexes come at the end of the index list.
[forum:/forumpost/ceb51d83f7|forum post ceb51d83f7]