drh [Tue, 19 Jun 2018 21:15:51 +0000 (21:15 +0000)]
Make the ieee754() a built-in function. Add the --ieee754 option to the
".dump" command in the shell to cause it to output floating-point values as
ieee754() calls, so that the floating point number will be reproduced exactly.
Not sure yet that we want to go this way, but it is one option.
dan [Wed, 13 Jun 2018 11:11:13 +0000 (11:11 +0000)]
Check that malloc() has not already failed when invoking the xUpdate() method
of a virtual table implementation. This fixes an assert() failure in FTS5 that
could occur following an OOM condition.
drh [Wed, 13 Jun 2018 02:20:34 +0000 (02:20 +0000)]
Add the unused SQLITE_CANTOPEN_DIRTYWAL result code. This code was used
in some historical versions on the apple-osx branch but was removed
by check-in [27e20d699872b2b8]. Restore it so that old code that actually
references that result code will still compile.
drh [Mon, 11 Jun 2018 18:06:48 +0000 (18:06 +0000)]
Fix the column cache invalidation logic in the code for ROWID uniqueness
constraint checking in the INSERT command. This fixes ticket
[c2432ef9089ee73bd].
drh [Sat, 9 Jun 2018 16:49:00 +0000 (16:49 +0000)]
Slightly smaller and faster code by encapsulating wal-index hash table
location information in a separate WalHashLoc object rather than passing
around the various elements as separate variables.
drh [Sat, 9 Jun 2018 00:09:58 +0000 (00:09 +0000)]
Avoid invoking the whereLoopAddOr() routine in the query planner if there
are no OR operators in the WHERE clause, thus speeding up query planning
slightly.
drh [Fri, 8 Jun 2018 23:23:53 +0000 (23:23 +0000)]
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 looks, 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.
drh [Fri, 8 Jun 2018 19:13:57 +0000 (19:13 +0000)]
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.
drh [Thu, 7 Jun 2018 18:13:49 +0000 (18:13 +0000)]
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.
drh [Wed, 6 Jun 2018 01:18:01 +0000 (01:18 +0000)]
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.
drh [Tue, 5 Jun 2018 20:45:20 +0000 (20:45 +0000)]
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.
dan [Tue, 5 Jun 2018 20:04:28 +0000 (20:04 +0000)]
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.
drh [Tue, 5 Jun 2018 15:16:25 +0000 (15:16 +0000)]
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.
drh [Tue, 5 Jun 2018 13:43:02 +0000 (13:43 +0000)]
Update and correct the documentation on the OP_OpenRead, OP_OpenWrite,
and OP_ReopenIdx opcodes. No code changes other than the addition of
an assert().
drh [Sat, 2 Jun 2018 11:31:15 +0000 (11:31 +0000)]
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.
drh [Wed, 30 May 2018 00:54:23 +0000 (00:54 +0000)]
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.
dan [Mon, 28 May 2018 18:29:46 +0000 (18:29 +0000)]
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.
drh [Mon, 28 May 2018 18:25:19 +0000 (18:25 +0000)]
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.
drh [Mon, 28 May 2018 17:31:20 +0000 (17:31 +0000)]
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.
drh [Sat, 26 May 2018 16:00:26 +0000 (16:00 +0000)]
Store application-defined function names as lower-case to avoid the need
for case conversions before calling xFindFunction on virtual tables.
Avoid using lookaside to store the destructors for application defined
functions, as lookaside should be reserved for transient allocations.
drh [Thu, 24 May 2018 23:51:57 +0000 (23:51 +0000)]
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.
drh [Thu, 24 May 2018 22:31:01 +0000 (22:31 +0000)]
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.
drh [Thu, 24 May 2018 17:38:00 +0000 (17:38 +0000)]
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.
drh [Wed, 23 May 2018 16:50:21 +0000 (16:50 +0000)]
Verify that the sqlite_sequence table exists and is in approximately the
correct format prior to using it to process an autoincrement table.
Fix for ticket [d8dc2b3a58cd5dc2918a1d4a].