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].
Performance improvement in resolveP2Values(). Save over 1 million CPU
cycles by omitting the loop termination condition and exiting when the
OP_Init (always the first opcode in any VDBE program) is encountered.
drh [Sat, 25 Jun 2022 19:43:44 +0000 (19:43 +0000)]
Allow flattening of a subquery that is the right operand of a LEFT JOIN
in an aggregate query as long as there is no GROUP BY clause. (The GROUP BY
clause will interfere with the operation of the TK_IF_NULL_ROW expression
nodes.)
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].
drh [Fri, 10 Jun 2022 16:41:54 +0000 (16:41 +0000)]
The same restrictions on the use of WHERE clause terms to drive indexes
in the presence of RIGHT JOINs also apply to the use of WHERE clause terms
to manufacture automatic indexes. This fixes a problem identified by
[forum:/forumpost/51e6959f61|forum post 51e6959f61].
stephan [Fri, 10 Jun 2022 15:43:03 +0000 (15:43 +0000)]
fiddle: minor style tweaks, including using swapped colors for the input/output fields to help (hopefully) reduce the "which field is which?" dissonance.
drh [Fri, 10 Jun 2022 11:28:52 +0000 (11:28 +0000)]
Do not allow constant propagation between WHERE-clause terms and ON-clause terms
as this can confuse RIGHT JOIN. Fix for the problem reported by
[forum:/forumpost/8e4c352937e82929|forum post 8e4c352937e82929].
drh [Thu, 9 Jun 2022 20:26:06 +0000 (20:26 +0000)]
Do not allow the subtype of a value to cross a subquery boundary. This
fixes the problem identified by
[forum:/forumpost/3d9caa45cbe38c78|forum post 3d9caa45cbe38c78].
drh [Thu, 9 Jun 2022 16:19:01 +0000 (16:19 +0000)]
The subtype of a value should not propagate across a subquery boundary.
Proposed fix for the problem reported by
[forum:/forumpost/3d9caa45cbe38c78|forum post 3d9caa45cbe38c78].
Additional works is needed as not all cases are covered.
drh [Wed, 8 Jun 2022 15:38:16 +0000 (15:38 +0000)]
Fix the query flattener so that it refuses a flattening that might leave both
an inner-join and outer-join ON-clause constraint (or equivalent) on the same
term of the FROM clause.
drh [Wed, 8 Jun 2022 15:30:39 +0000 (15:30 +0000)]
Add restriction (29) to the query flattener - do not allow flattening that
would leave both EP_InnerON and EP_OuterON constraints on the same join term.
drh [Wed, 8 Jun 2022 12:46:58 +0000 (12:46 +0000)]
Do not allow a partial index scan on the left table of a RIGHT JOIN, because
since the index is partial, some rows will be omitted from the scan, and
those rows will subsequently be picked up by the no-match logic in the
right-join post-processing loop.
[forum:/forumpost/c4676c4956|forum post c4676c4956].
drh [Tue, 7 Jun 2022 10:14:22 +0000 (10:14 +0000)]
Preserve the database encoding on the CAST operator in the
sqlite3ValueFromExpr() routine.
[forum:/forumpost/800eecf5e6cdc3f4|Forum thread 800eecf5e6cdc3f4].
Test case in TH3.
drh [Mon, 6 Jun 2022 15:27:42 +0000 (15:27 +0000)]
Do not allow a WHERE clause constraint to be used to drive an index for
the right operand of a RIGHT JOIN, since this can cause problem if the
constraint implies a not-NULL value for one of the columns for the left
operand of the same join. See
[forum:/forumpost/206d99a16dd9212f|forum post 206d99a16dd9212f].
stephan [Mon, 6 Jun 2022 04:09:44 +0000 (04:09 +0000)]
shell: in WASM mode, permit ATTACH because the filesystem is a virtual sandbox and ATTACH can be used to provide more import/export options. Minor doc updates in sqlite3-api.js.
dan [Thu, 2 Jun 2022 16:26:21 +0000 (16:26 +0000)]
Fix a problem with flattening and window functions causing an "IS <column>" to be transformed to "IS TRUE" or "IS FALSE" when <column> is a view or sub-select expression that is the literal value "TRUE" or "FALSE".
drh [Wed, 1 Jun 2022 16:05:25 +0000 (16:05 +0000)]
Ensure that subqueries associated with row-values are invoked before being
used when processing a RIGHT JOIN. Fix for the problem described by
[forum:/forumpost/087de2d9ec87305b|forum post 087de2d9ec87305b].
stephan [Wed, 1 Jun 2022 16:04:29 +0000 (16:04 +0000)]
fiddle: added another UI element to the list of those which are disabled during long-running activities. Added DB.close() binding to the Worker-based wasm binding.