drh [Wed, 3 Oct 2012 18:09:32 +0000 (18:09 +0000)]
Fix an out-of-order memset() that occurs before all variable declarations
are finished. Also fix a line that exceeds the 80-character line length
limit.
drh [Wed, 3 Oct 2012 12:56:18 +0000 (12:56 +0000)]
Update the query planner to recognize more cases where ORDER BY clauses
can be optimized out. Add test cases to verify correct behavior of the
ORDER BY optimization when the covering-index-scan optimization is disabled.
Fix a harmless compiler warning in the TCL interface.
drh [Wed, 3 Oct 2012 12:38:19 +0000 (12:38 +0000)]
Fix a query planner problem that only occurs when covering-index-scan is
disabled. Fix to tests whose output changed due to the new and more
aggressive ORDER BY optimization.
drh [Wed, 3 Oct 2012 11:02:33 +0000 (11:02 +0000)]
Fix the TCL interface so that SQL functions implemented in TCL honor the
"nullvalue" setting. Also remove from the TCL interface some unused
legacy UTF8 translation code left over from SQLite2.
drh [Tue, 2 Oct 2012 15:19:19 +0000 (15:19 +0000)]
More lenient handling of ORDER BY optimization in joins with mixed ASC/DESC.
This is a better and less restrictive fix for the problem addressed by
the previous check-in.
drh [Tue, 2 Oct 2012 14:11:29 +0000 (14:11 +0000)]
Only continue an ORDER BY optimization into inner loops if the equality
constraints on the inner loop match terms of an outer ordered index that
are actually used by the ORDER BY clause.
drh [Mon, 1 Oct 2012 12:16:26 +0000 (12:16 +0000)]
Make sure the size parameter to read and write VFS methods in the unix VFS
do not become too big or go negative. This was not actually possible in the
current code. The checks are added to make sure some future bug does not
make it possible.
dan [Mon, 1 Oct 2012 06:50:55 +0000 (06:50 +0000)]
Ensure that the value returned by xSectorSize() is reasonable (currently defined as between 2^5 and 2^16 bytes) before using it to calculate the amount of padding to add to a wal file.
dan [Fri, 28 Sep 2012 20:23:42 +0000 (20:23 +0000)]
Avoid calling sqlite3BtreeEnter() in a corner case where the corresponding database handle mutex (sqlite3.mutex) may not be held. This prevents a potential deadlock or crash that can occur if the backup API, shared-cache mode and SQLITE_HAVE_CODEC are all in use.
Query planner enhancements to be more agressive about optimizing out ORDER BY
clauses - in particular the query planner now has the ability to omit ORDER BY
clauses that span multiple tables in a join.
Fix some corner case behavior in the new ORDER BY optimization logic.
Remove the SQLITE_OrderByIdx bit from the
SQLITE_TESTCTRL_OPTIMIZATIONS mask, since enabling it caused many
TH3 tests to fail when the NO_OPT configuration parameter was engaged,
and since there really isn't any need to turn that optimization off.
The SQLITE_OrderByIdxJoin bit remains.
Test cases and bug fixes applied to the ORDER BY optimization for joins.
Some test cases fail, but except for the new orderby1.test failures, all
failures appear to be issues with the tests, not with the core code.
Add more bits to the bit vector that is used to disable optimizations for
built-in test. Add specific bit patterns to disable ORDER BY using an
index in general and for joins. Use macros to test for bits in the
disabled-optimization bit vector, in order to make the code clearer.
Further refactoring of the ORDER BY related query-planning logic in order
to make it easier to extend to support optimizing out ORDER BY on joins.
No actual behavior changes, yet.
Augment the WhereBestIdx structure to pass down into the query planner
information that might be used to better detect ORDER BY and DISTINCT
optimizations spanning multiple tables of a join.
Change the internal sqlite3WhereBegin() to report that the ORDER BY clause
is satisfied by indices using the WhereInfo.nOBSat field of the returned
structure.
Enable query planner tracing using the new (and undocumented) ".wheretrace 1"
command in the command-line shell if both the shell and the core are
compiled with SQLITE_DEBUG and SQLITE_ENABLE_WHERETRACE. This is not a
supported API. Use for testing and debugging only.
Consolidate more of the DISTINCT processing logic into a single spot in the
code. Reduce the number of OP_Column operations needed to perform a
WHERE_DISTINCT_ORDERED.
Refactoring of DISTINCT code. Change the name of the local variable
"distinct" to "distinctTab". Generate cleaner code w/o unnecessary P4
and P5 values on the OP_Null for WHERE_DISTINCT_ORDERED.
Enhance IN processing to allow efficient use of indices with numeric affinities.
Add test cases for IN processing that would have spotted the error in the
[2be661a48023f4] check-in.
Update the vdbe-compress.tcl script so that it accepts variable declarations
inside of #ifdef...#endif.
This enhancement is needed due to the change of check-in [39866c0ede5d6ef4].
Add the ability to disable the covering-index-scan optimization at compile-time,
start-time, or at run-time. Add test cases to check this configurability.
Attempt to use a covering index even on a full table scan, under the theory
that the index will be smaller and require less disk I/O and thus be faster.
Factor out the code that generates a co-routine for evaluating the SELECT
on the RHS of an INSERT statement so that the same code can potentially
be reused in other places.
Add an experimental busy_timeout pragma to facilitate access to the
sqlite3_busy_timeout() interfaces for programmers that are working from
behind a language wrapper that does not expose that interface.
Avoid repeating calls to the sqlite3_trace() callback when the same statement
is evaluted multiple times by sqlite3_step() due to an SQLITE_SCHEMA
reprepare.
drh [Thu, 30 Aug 2012 20:24:39 +0000 (20:24 +0000)]
Exclude the atof1.test test script from the valgrind permutations test since
valgrind sets up the floating point hardware in an unusual way that makes
atof1 fail.
dan [Tue, 28 Aug 2012 14:45:50 +0000 (14:45 +0000)]
Fix a case where SQLite was failing to detect a syntax error in queries like "SELECT ... FROM (<select-1> UNION ALL <select-2>)" when <select-1> and <select-2> return different numbers of result columns.