Merge changes to the query planner that strive to ensure that any index
usage that is a proper subset of some other index usage always has a slightly
higher cost.
Use OP_Copy instead of OP_SCopy when moving results out of a subquery,
to prevent the subquery results from changing out from under the outer
query. Fix for ticket [1e64dd782a126f48d78].
drh [Fri, 28 Mar 2014 03:12:48 +0000 (03:12 +0000)]
Enhance the sqlite3VdbeRecordCompare() routines so that if they encounter
database corruption, they will set the UnpackedRecord.isCorrupt field and
return 0. The sqlite3BtreeMovetoUnpacked() routine detects this and returns
SQLITE_CORRUPT, causing the corruption to be reported back to the top-level.
drh [Thu, 27 Mar 2014 18:36:34 +0000 (18:36 +0000)]
Minor cleanup of the code in the query planner that computes the costs
estimates for the various plans. There are no changes to the costs at this
time. But the code is slightly more readable now and that might facilitate
future enhancements.
drh [Tue, 25 Mar 2014 11:00:21 +0000 (11:00 +0000)]
Detect when a VdbeCursor is still pointing at a valid row but that row has
moved, and invalidated the return from prior sqlite3BtreeDataFetch() or
sqlite3BtreeKeyFetch() calls.
drh [Sat, 22 Mar 2014 02:19:53 +0000 (02:19 +0000)]
Clear the sort-order flags on the KeyInfo object associated with the
OP_Compare/OP_Jump of the block-sort logic, in order to make the OP_Jump
fully testable.
drh [Sat, 22 Mar 2014 00:27:14 +0000 (00:27 +0000)]
Fix the ORDER BY optimization logic so that it will do a block-sort on
a partial DESC ORDER BY. This enhancement uncovered a memory leak in
pushUntoSorter() which is also fixed.
drh [Fri, 21 Mar 2014 19:56:09 +0000 (19:56 +0000)]
Change the names of SRT_DistTable and SRT_Table used by CTE to more
meaningful SRT_DistFifo and SRT_Fifo, respectively. Simplify the
IgnorableOrderby() macro in the process.
drh [Thu, 20 Mar 2014 19:04:56 +0000 (19:04 +0000)]
Remove a testcase() that is now always true due to the "x IN (?)" optimization.
Add an ALWAYS() around a conditional in the parser that cannot be false.
drh [Thu, 20 Mar 2014 17:03:30 +0000 (17:03 +0000)]
The "x IN (?)" optimization in check-ins [2ff3b25f40] and [e68b427afb] is
incorrect, as demonstrated by the in4-5.1 test case in this check-in.
The "COLLATE binary" that was being added to the RHS of IN was overriding
the implicit collating sequence of the LHS. This change defines the EP_Generic
expression node property that blocks all affinity or collating sequence
information in the expression subtree and adds that property to the expression
taken from RHS of the IN operator.
drh [Thu, 20 Mar 2014 14:56:47 +0000 (14:56 +0000)]
Previous check-in is not quite correct. "x IN (?)" is not exactly the same
as "x==?" do to collation and affinity issues. The correct converstion should
be to "x==(+? COLLATE binary)". The current check-in fixes this problem and
provides test cases. Ticket [e39d032577df69]
drh [Thu, 20 Mar 2014 13:26:47 +0000 (13:26 +0000)]
Convert expressions of the form "X IN (?)" with exactly one value on the
RHS of the IN into equality tests: "X=?". Add test cases to verify that
statements work correctly on this corner case.
Fix for ticket [e39d032577df6942].
dan [Thu, 20 Mar 2014 08:59:47 +0000 (08:59 +0000)]
Add an experimental fix to avoid attempting to mmap memory from an offset that is not a multiple of the system page size on systems with page sizes larger than 32KB.
drh [Wed, 19 Mar 2014 23:24:49 +0000 (23:24 +0000)]
Fix query planner weights associated with choosing block-sorting. Fix
block sorting of tables with collating functions. Fix various test cases.
All "veryquick" tests are now passing, though more tests need to be added.
drh [Wed, 19 Mar 2014 16:56:58 +0000 (16:56 +0000)]
Fix a problem in the block-sort logic that can arise if the VDBE opcode
array is resized while the block-sort logic is being coded. "make test"
now runs to completion, though there are still 17 failures.
drh [Tue, 18 Mar 2014 20:33:42 +0000 (20:33 +0000)]
Make the partial-ORDER-BY information in the query planner available to the
SELECT code generator. Still doesn't make a difference in the generated code.
drh [Tue, 18 Mar 2014 18:59:07 +0000 (18:59 +0000)]
Adjust the query planner to keep track of the number of ORDER BY terms
satisfied. Still doesn't do anything with this information. Some tests
fail after this check-in, but all failures are believed to be benign. The
failures will be addressed at a later stage.
drh [Tue, 11 Mar 2014 23:40:44 +0000 (23:40 +0000)]
Combine the various boolean fields of the BtCursor object into a single
bit-vector. This allows setting or clearing more than one boolean at a
time and makes the overflow-pgno-cache branch faster than trunk on
speedtest1.
drh [Mon, 10 Mar 2014 18:03:09 +0000 (18:03 +0000)]
Attempt to work around MSVC's treatment of __LINE__ as a non-constant value
in "Edit and Continue" mode by avoiding the use of __LINE__ when
SQLITE_VDBE_COVERAGE is not defined.
mistachkin [Fri, 7 Mar 2014 02:29:56 +0000 (02:29 +0000)]
Avoid calling sqlite3OsDelete() on a file that is open, since this causes Windows to run *very* slowly. Comes up on error recovery in journal_mode=PERSIST.
drh [Wed, 5 Mar 2014 15:52:43 +0000 (15:52 +0000)]
Count the number of elements in a SrcList object using an "int" rather than
a "u8", to avoid overflows and to work around an issue in the C compiler on
AIX.
drh [Wed, 5 Mar 2014 14:40:22 +0000 (14:40 +0000)]
When converting a result type from TEXT to BLOB using the
sqlite3_value_blob() interface, continue to report SQLITE_TEXT as
the true type from sqlite3_value_text() as long as that text is still
valid. The maintains legacy behavior from before the noMemType change.