On an UPSERT when the order of constraint checks is rearranged, make sure
that the affinity transformations on the inserted content occur before
any of the constraint checks. Fix for ticket [79cad5e4b2e219dd197242e9e5f4e].
check-in: d120c45f user: drh tags: trunk

Identify Select objects within a single statement using small sequential
integers rather than "0x%p". This is more readable and yields the same result
on successive runs.
check-in: a7cdc5bc user: drh tags: trunk

Further improvements to bytecode branch testing. Fix cases where the
macros said a branch could not be taken when in fact it could be. Alter
some window function branch coverage macros to indicate that comparison
operands cannot be NULL.
check-in: 76e42b70 user: drh tags: trunk

Enhancements and improved documentation to the byte-code branch coverage
testing logic. Provide new macros that allow the code to specify that
some branch instructions can never take the NULL path and that the OP_Jump
opcode is only interested in equal/not-equal. The
SQLITE_TESTCTRL_VDBE_COVERAGE file control callback now works slightly
differently (it provides the callback with a bitmask of the branch action,
rather than an integer).
check-in: cd2da7e1 user: drh tags: trunk

Assert that if two functions compare equal in every other way, then they
must both have OVER clauses, or neither has an OVER clause. Use this fact
to simplify expression comparison.
check-in: 52559ad5 user: drh tags: trunk

During WITHOUT ROWID table creation, if the sqlite3CreateTable() call fails
due to an authorizer denying the INSERT into the sqlite_master table, then
detect this fact and abort the CREATE TABLE early, to avoid an assertion
fault.
check-in: 164b1641 user: drh tags: trunk

Identify specific FuncDef objects for window functions using the pointer to
the function name (FuncDef.zName) rather than the pointer to the xStep method.
This allows xStep method pointer to be replaced with a single noopStepFunc()
procedure, and thus save having lots of different no-op step functions.
check-in: 410e13b0 user: drh tags: trunk

In wal mode, if a "BEGIN EXCLUSIVE" command (or any other command that
upgrades from no transaction directly to a write transaction) hits an
SQLITE_BUSY_SNAPSHOT error, change the error code to SQLITE_BUSY to indicate
to the caller that the condition may be transient.
check-in: e6108047 user: dan tags: trunk

In wal mode, if a "BEGIN EXCLUSIVE" command (or any other command that
upgrades from no transaction directly to a write transaction) hits an
SQLITE_BUSY_SNAPSHOT error, change the error code to SQLITE_BUSY to indicate
to the caller that the condition may be transient.
check-in: 221ff63e user: dan tags: exp-busy-snapshot-fix

Quick patch to the Lemon parser template to avoid an array overread reported
by OSSFuzz. A proper fix involves enhancements to the table generators in
Lemon to make the overread impossible. That fix will take longer to
implement. The current check-in is a stop-gap.
check-in: 3f6730be user: drh tags: trunk

When the query planner has the opportunity to use an IN operater constraint
on a term of an index other than the left-most term, use the estimated number
of elements on the right-hand side of the IN operator to determine if makes
sense to use the IN operator with index lookups, or to just do a scan over the
range of the table identified by the index terms to the left. Only do this
if sqlite_stat1 measurements are available as otherwise the performance
estimates will not be accurate enough to discern the best plan. Bias the
decision slightly in favor of using index lookups on each element of the IN
operator.
check-in: 2cbbabdf user: drh tags: trunk

Fix an assert() that can be false for a corrupt database and a strange query
that uses a recursive SQL function to delete content from a corrupt database
file while it is being queried.
check-in: 99057383 user: drh tags: trunk

The IN-early-out optimization: When doing a look-up on a multi-column index
and an IN operator is used on a column other than the left-most column, then
if no rows match against the first IN value, check to make sure there exist
rows that match the columns to the right before continuing with the next IN
value.
check-in: 09fffbdf user: drh tags: trunk

Fix the ".archive" command in the CLI (and the corresponding -A command-line
option) so that it silently ignores filenames that contain "../" in their
names. This prevents the "Zip Slip" attack.
check-in: 27291f2d user: drh tags: trunk

Add the OP_IfNoHope and OP_SeekHit opcodes used to reduce the number of
unnecessary sqlite3BtreeMovetoUnpacked() calls when checking for an early
exit on IN-operator loops. Futher optimizations are likely possible here.
check-in: 6bf251af user: drh tags: multikey-opt-idea

Calculate non-aggregate expressions in the SELECT list of an aggregate query
that does not use min() or max() once per group, instead of once per row
visited.
Closed-Leaf
check-in: dce2dfbe user: dan tags: exp-agg-opt

Use an OP_NotFound opcode to cancel futile IN operators early. The current
implementation is suboptimal because it always runs teh OP_NotFound. This
still needs to be enhanced to only do the OP_NotFound if no results have been
seen on the current loop.
check-in: 87a9fc50 user: drh tags: multikey-opt-idea

Ensure that sqlite3AuthRead() is only call for TK_COLUMN and TK_TRIGGER
expression nodes. This fixes a harmless assert() identified by OSSFuzz.
Move the assert() into a position where it is tested even if the authorizer
is disabled.
check-in: d0c3beef user: drh tags: trunk

Demonstration code on a possible technique for optimizing the use of IN
operator on columns to the right of multicolumn indexes. If the OP_Noop
generated where were really a new opcode that checked to see if there existed
any entries in the index with a matching prefix, it might prevent unnecessary
iterations of the IN operator.
check-in: 92f0fe15 user: drh tags: multikey-opt-idea

Do not require a statement journal in cases where REPLACE conflict handling is
used to insert a single row, so long as the REPLACE operation cannot fire any
triggers or foreign key actions.
check-in: 469a62ca user: dan tags: trunk

When compiling with SQLITE_DEBUG, add run-time checks to ensure that no statement aborts unless either there have been no writes or else there is a statement journal.
check-in: ce99c772 user: drh tags: trunk

When compiling with SQLITE_DEBUG, add run-time checks to ensure that no
statement aborts unless either there have been no writes or else there is
a statement journal.
check-in: 5a4542db user: drh tags: stmt-journal-testing

When doing a one-pass UPDATE or DELETE on virtual tables, close the cursor
prior to running VUpdate. This allows one-pass to work on virtual tables
that do not allow concurrent reads and writes. Enhance rtree to take
advantage of this new capability.
check-in: b816023c user: drh tags: trunk

Do not allow RTree writes when a read cursor is active on the same virtual
table, as the writes might rebalance and disrupt the read cursors. Return
the new SQLITE_LOCKED_VTAB error code if this happens.
check-in: d4ce6661 user: drh tags: trunk

In the OOM testing logic, add the sqlite3FirstFault() routine as a place to
set a breakpoint the first time any simulated OOM fault occurs for a single
test case.
check-in: b4d80bd2 user: drh tags: trunk