Commit Graph

10301 Commits

Author SHA1 Message Date
dan
a2ebe4b418 Add a test for the collation-sequence/CHECK constraint problem fixed by the previous commit.
FossilOrigin-Name: 82b6aa77c8d8de4c6fad1960f5958457a929a821
2012-10-05 17:18:16 +00:00
dan
1e92fb59b2 Fix a problem with shared-cache mode and CHECK constraints causing one db handle to invoke a collation sequence function registered with another.
FossilOrigin-Name: c2c776ab73828374836af008aa320cc670c081b5
2012-10-05 16:30:10 +00:00
dan
41fb5cd103 Shared-cache mode fixes for views and virtual tables.
FossilOrigin-Name: 2b370dea704b59262c604af0efcef5660b194454
2012-10-04 19:33:00 +00:00
drh
613a53a029 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.

FossilOrigin-Name: ba2f492f957ab5556cd540e21a76ebb75efea725
2012-10-03 18:09:32 +00:00
drh
325eff58d6 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.

FossilOrigin-Name: 956e4d7f8958e7065ff2d61cd71519d6f4113d4a
2012-10-03 12:56:18 +00:00
drh
6f0e400cba 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.

FossilOrigin-Name: 0f9bb90100aa304a7f28023ca4173e68b445e8bd
2012-10-03 12:38:19 +00:00
drh
c45e67162d 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.

FossilOrigin-Name: c1f10a2643179ec58f3879764e9e89676d4b5f91
2012-10-03 11:02:33 +00:00
drh
d663b5bdef Further attempts to optimize out unnecessary ORDER BY clauses.
FossilOrigin-Name: 6744d9a37faffed59b4d5cb96c8671ec46a87ea7
2012-10-03 00:25:54 +00:00
mistachkin
e7c54168fa Work around an optimization issue with the MSVC compiler for ARM.
FossilOrigin-Name: 7d301fdfeec540e4a58f43bff04d219e9f769dc4
2012-10-02 22:54:27 +00:00
drh
afcd522af8 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.

FossilOrigin-Name: abcf6a5d054559ee5a093ba39180c47b4958d9cd
2012-10-02 15:19:19 +00:00
drh
178eb61c6b 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.

FossilOrigin-Name: b0e7b4df6c2a8c479f8d210bde50c737eaa248f0
2012-10-02 14:11:29 +00:00
drh
3be57d2aba Factor an invariant out the loop termination condition for the ORDER BY
satisfied-by-index analyzer routine.

FossilOrigin-Name: 545bb33688663066cf3f09e4cdc4d5cfe59fb8db
2012-10-02 01:46:48 +00:00
drh
a578d048c6 Make sure the outer loop cursor numbers are recorded in time for them to be
used by the ORDER BY optimizer.

FossilOrigin-Name: 351dc8d9cab8a222f28fb865d3a7d1c622d60d6f
2012-10-02 01:25:16 +00:00
drh
1afcaaea7a Improvements to the wheretrace output.
FossilOrigin-Name: 76b277655646a9fe0f336ff106157f1efcd32019
2012-10-02 01:10:00 +00:00
drh
5ff00f4b00 Fix harmless compiler warnings.
FossilOrigin-Name: 59c2be75ff8b8ccd77320b45e4088e5bf456a1d9
2012-10-01 20:32:38 +00:00
mistachkin
c197eedbb4 Fix several compiler warnings seen with MSVC.
FossilOrigin-Name: 8b5f617c2a5f0bf7bdbd9144aee58d69564db1e2
2012-10-01 20:12:30 +00:00
dan
80bb6f8217 Add SQLITE_FCNTL_BUSYHANDLER. Invoked to provide access to the busy-handler callback to custom VFS implementations.
FossilOrigin-Name: 1262d2f471214a3417dd02159a7aa2355b18f789
2012-10-01 18:44:33 +00:00
drh
04b85bc609 Minor changes to the query planner for improved test coverage.
FossilOrigin-Name: c12044df322283c9deb0d7dacd8a699ac53f27b6
2012-10-01 17:44:05 +00:00
drh
a1f3853793 Omit the sqlite3GetReservedNoMutex() routine in build configurations where
it is not used.

FossilOrigin-Name: f193dbb6b96b2f49dd0d6345802c9c006cd99e3c
2012-10-01 12:44:26 +00:00
drh
c1fd2cfed2 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.

FossilOrigin-Name: daebe3bd2d9bd7b6f876a8110cf5045eb3fee078
2012-10-01 12:16:26 +00:00
dan
c9a5326974 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.
FossilOrigin-Name: 6b4ff83bff07d427af585c9fd03be90abf2fc82f
2012-10-01 06:50:55 +00:00
drh
60441af4f2 Improved ORDER BY optimization when outer loops of a join return a single row.
FossilOrigin-Name: 62225b4a4c4bfe1820ef54cb202edf2cd866429f
2012-09-29 19:10:29 +00:00
drh
befda46598 Disable the bigfile tests on Macs.
FossilOrigin-Name: d869eddaf208c4bf03f6bd1848f510392f9dba49
2012-09-29 15:45:12 +00:00
drh
b3f787f4c7 Fix compiler warnings found on Lion.
FossilOrigin-Name: fd74d3d91721ca404537f195fed04c9edef20bf2
2012-09-29 14:45:54 +00:00
dan
0094f37e1f 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.
FossilOrigin-Name: 89b8c377a6f03d9fa885f3f94c1f0b1eec263dea
2012-09-28 20:23:42 +00:00
mistachkin
70a1b71fb6 Modify the clearCell function to use SQLITE_CORRUPT_BKPT in the one place it was not.
FossilOrigin-Name: 472beb306a4fa7103837d4417aef7d66eef49993
2012-09-28 18:13:35 +00:00
drh
f784c1ede9 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.

FossilOrigin-Name: 1e874629d7cf568368b912b295bd3001147d0b52
2012-09-28 00:44:28 +00:00
drh
a9e3fc05f5 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.

FossilOrigin-Name: 98b633717a1c9a08f6a1d00bc6bc891564ae7e9b
2012-09-27 23:27:23 +00:00
mistachkin
8ccc6d4076 Modify generation of resource header file for MSVC so that it can work from outside the working directory.
FossilOrigin-Name: 20caf80cb3b65e69a99dbc142db8ee435fb2dbdc
2012-09-27 21:03:53 +00:00
drh
5343b2d4a8 More test cases an bug fixes for the ORDER BY optimization of joins. All
veryquick tests now pass.

FossilOrigin-Name: 0d573320057b0903a5589cabfb1b1ece1c57958e
2012-09-27 19:53:38 +00:00
drh
6b10a6a7ed 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.

FossilOrigin-Name: 75cda864ededb6dc0f84bd52ed3311753a58e351
2012-09-27 17:31:32 +00:00
drh
7e5418e4a4 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.

FossilOrigin-Name: d2fcba1e143beca8c45724d2108870657c269e17
2012-09-27 15:05:54 +00:00
drh
32634d270c Enable ORDER BY clauses that span joins to be optimized out.
FossilOrigin-Name: c29538f9b1ee4d4869999570604c9618ca0d08ac
2012-09-27 14:11:36 +00:00
drh
cec320fb0e Merge the "PRAGMA busy_timeout" change into trunk.
FossilOrigin-Name: 1a679a1ef3b4f2d898c8cd83432d2b4c12bd93fa
2012-09-27 12:11:25 +00:00
drh
ff2d52117b Further tweaks to the query planner logic in preparation for adding
ORDER BY opt-out for joins.

FossilOrigin-Name: 53efc10af990d3f293551f3cd8ef2f8be2d9d716
2012-09-27 12:05:09 +00:00
drh
46c35f9b20 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.

FossilOrigin-Name: 96496ddae12a239b30a1fc997fbea43e3a75bfe7
2012-09-26 23:17:01 +00:00
drh
9cd1c99fe1 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.

FossilOrigin-Name: 4226e51ff837f0ffe16355491a655d919d13488e
2012-09-25 20:43:35 +00:00
drh
56f1b99d4d Pass information around between the major routines of the query planner
using a single pointer to a structure rather than a long list of parameters.

FossilOrigin-Name: 1104d42e104d561ce60d05d158acfe499ee9fd50
2012-09-25 14:29:39 +00:00
drh
4d85fa760f Remove an unused subfunction parameter and an obsolete comment from the
query planner logic in where.c.

FossilOrigin-Name: 349a55cd8ba9ce65ebfd987ecfebd1204f7d0a85
2012-09-24 19:50:00 +00:00
drh
46ec5b63e2 Change the internal sqlite3WhereBegin() to report that the ORDER BY clause
is satisfied by indices using the WhereInfo.nOBSat field of the returned
structure.

FossilOrigin-Name: 22989f3588531efd555cc29d6c576e7a34b7edc4
2012-09-24 15:30:54 +00:00
drh
86ae51c991 Update documentation to describe the threadsafety of
sqlite3_enable_shared_cache().

FossilOrigin-Name: e081890cd77ad8de4bf55a8f8cf9d63bfaaf8218
2012-09-24 11:43:43 +00:00
drh
cef4fc89c4 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.

FossilOrigin-Name: 1be4b16b9e900181ae6848f2920ea646f407c9dc
2012-09-21 22:50:45 +00:00
drh
078b1fda34 Command-line shell enhancements: Added the ".print" command. Enhanced
the ".width" command so that negative widths will right-justify.

FossilOrigin-Name: a1d8269da3868e41a6603c1a683e324fe21fb317
2012-09-21 13:40:02 +00:00
drh
e8e4af7697 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.

FossilOrigin-Name: 79e922f7ae29bbe06d639d648fbd72523cf9a28e
2012-09-21 00:04:28 +00:00
drh
634d81dee0 Continuing incremental enhancements of SELECT code generation:
Remove the Select.affinity field.  Use SelectDest.affSdst instead.

FossilOrigin-Name: cf40b7b5ebdacc3215d769aadacce8c9e7e9dfbb
2012-09-20 15:41:31 +00:00
drh
2c79733f3c 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.

FossilOrigin-Name: 0cda241a2bcb3c6f2ae6c48f522780bc4eddfc02
2012-09-20 14:26:22 +00:00
drh
053a128f55 Tighter VDBE code for the WHERE_DISTINCT_ORDERED case of DISTINCT keyword
handling.

FossilOrigin-Name: 94b48064db3cbb43e911fdf7183218b08146ec10
2012-09-19 21:15:46 +00:00
drh
ae651d614e Add comments to the WHERE_DISTINCT_* macros. No changes to code.
FossilOrigin-Name: 82320501904f65030622a67836ba30f412169056
2012-09-19 17:31:15 +00:00
drh
c35dfbb677 Merge the covering-index-scan optimization into trunk.
FossilOrigin-Name: ddd5d789e7ae4a66cd7b7fa79e48d2777f95350b
2012-09-19 00:35:31 +00:00
mistachkin
ba2bba3c32 Silence harmless compiler warning seen with SQLITE_OMIT_DEPRECATED.
FossilOrigin-Name: c5cee969322d14114e4136510c3891a2e743520d
2012-09-18 23:21:32 +00:00