Commit Graph

18184 Commits

Author SHA1 Message Date
drh
8906a4b802 Add some OK_IF_ALWAYS_TRUE() marks on optimization branches in select.c.
FossilOrigin-Name: 1dd828088d6981dfebf9f4d650dad8431bece4405650c61f90eb8d8f43289b52
2017-10-03 17:29:40 +00:00
drh
ce2c482e5a Remove an unused variable from sqlite3Insert() and fix harmless
compiler warnings associated with -DSQLITE_MUTATION_TEST.

FossilOrigin-Name: 7be760e907274131bcd4acfaff9e72c9c59a05e7d411db3d9afe690fe0d64b4b
2017-10-03 17:17:34 +00:00
drh
a78d757c36 Fix the sqlite3_column_decltype() interface to return the correct datatype
when the value comes through a CTE.

FossilOrigin-Name: 966438bd259ade3a2d4a6ec9587ce79c81a21b942248bffb389995b9132b53e3
2017-10-03 16:57:33 +00:00
drh
e2463398fd The simplification to sqlite3SelectExpand() in last night's
[3a4ffb21] check-in was not completely correct.  This adjustment is needed
for correct OOM handling in some configurations.

FossilOrigin-Name: c5ad5e1675f6cb5a54df21606dfec2198a7cf88acc529460ebe27bdab128a6e5
2017-10-03 14:24:24 +00:00
drh
cafc2f7b3e Do not compute column and row size estimates for the transient Table objects
associated with the result set of a SELECT statement, since those estimates
are never used for anything constructive.

FossilOrigin-Name: e4342fd401d4025eecc53ebfcd59f3150166a5f0bd6adb1b5820703bd4a1ec58
2017-10-03 03:01:09 +00:00
drh
878fcf9d4e Mark a single branch within sqlite3SelectExpand() as an optimization.
FossilOrigin-Name: 3a4ffb21d0ee2326c31b9ddc512d79d4ebf3a249a2840e88e99165978eec31fd
2017-10-02 23:50:08 +00:00
drh
b7651e6b60 Simplification to sqlite3SelectPrep() for improved testability.
FossilOrigin-Name: 5bf2ccb908dc6ebf7e063014b0a4bed7e3e9e0a555f78c6b4f6647adfb7209e4
2017-10-02 23:30:45 +00:00
drh
2f65b2f512 Add the OK_IF_ALWAYS_TRUE() and OK_IF_ALWAYS_FALSE() macros for marking
conditionals that improve performance but do not change the outcome.

FossilOrigin-Name: 6035c9b2728f47d338696978eb6fe5a7d6cb84bbea0792ef985c0986ac8f39dd
2017-10-02 21:29:51 +00:00
drh
3ee1416b68 Avoid using lookaside memory for persistent virtual table structures.
FossilOrigin-Name: d815f255dfbcd6d64326f7bc0ad3fe3c4ff08270ca75f8836ef2a919d5e57401
2017-10-02 13:20:43 +00:00
drh
3fc5394258 The query planner now always prefers to implement a FROM-clause subquery using
a co-routine rather than flattening the subquery into the outer query.

FossilOrigin-Name: c9104b59c7ed360291f7f6fc8caae938e9840c77620d598e4096f78183bf807a
2017-10-02 02:52:54 +00:00
drh
de6422a609 Improvements to a comment in lempar.c. No code changes.
FossilOrigin-Name: 8000d230171fe53599fc6a916666f60f88f789e6c9c6c2869514c02d837d6fc8
2017-10-02 02:32:12 +00:00
drh
67cc51a491 More details in the header comment of pushDownWhereTerms(). No changes to
code.

FossilOrigin-Name: 928486231ff7cc0df17a5aa23a080a1b8720e168db5227a7dbd34861283ba689
2017-09-30 11:47:06 +00:00
drh
24ae373ab1 Make sure the SQLITE_Stat34 optimization switch is always 0x800, a value
which is hard-coded in the TH3 test suite.

FossilOrigin-Name: 6aed4ea34c4163c682ad5bb2956fdf4f3a3ad048fefd3edab0fef6761c3783cc
2017-09-30 10:50:34 +00:00
drh
508e2d00f3 Fix unreachable conditionals and revise a testcase that was made obsolete by
the changes on this branch.

FossilOrigin-Name: 71f0adf7ca6824c3aba69104b9976dbb71b377474529e1a36220b4804293501e
2017-09-30 01:25:04 +00:00
drh
25c221eb1d Always render a subquery that is not part of a join as a co-routine.
FossilOrigin-Name: 6b1651d711eae6e7c65a191f02ca2439160bcd677099712289e76a0f8422fd37
2017-09-29 22:13:24 +00:00
drh
fd06385f21 Merge the query flattener comment improvements from trunk.
FossilOrigin-Name: f62cd4d940506c39db82e83ff3df8ab1856f1fb91ffda835ae2d727263ee9b0b
2017-09-29 16:08:46 +00:00
drh
d981e8289a Clean up the comments on the query flattener to more clearly and accurately
express the conditions under which the flattener is able to run.

FossilOrigin-Name: 0840f9f824c16212ce3fd6c859e501176eb0a58924ea1728a54d5bdfd0c25c86
2017-09-29 16:07:56 +00:00
drh
129c398d4b Merge changes from trunk.
FossilOrigin-Name: 06f432fb7c979f1bb7f01f5c90716ce5c0248f73f70b78a9870b9de5c9bf7ef4
2017-09-29 14:31:16 +00:00
drh
824d21aff3 Make sure the 6th parameter to the authorizer callback for view subqueries
has the correct view name.

FossilOrigin-Name: 2a45bbc9fd1c64f1c4c4dac38f063cd67480fcb6da24bf93fdefbfca66fd81ab
2017-09-29 12:44:52 +00:00
drh
23768298d2 Better names for subqueries in EXPLAIN comments.
FossilOrigin-Name: 04ef40a8fea88776e0d8b73d942922d45d0c038fbfac1a9a82b9322181b4ad92
2017-09-29 12:12:52 +00:00
drh
648fe49f96 Do not flatten subqueries that contain an ORDER BY or GROUP BY clause and
can be implemented using a co-routine.

FossilOrigin-Name: 042d655dd9002e8b89a798ad955b0285891aecf79f6978c5312e70ffe0609a46
2017-09-28 20:06:53 +00:00
drh
2e9d706252 Remove the (undocumented) query-planner control that prevents
a "SELECT ALL" subquery in FROM clause from being implemented as a co-routine.

FossilOrigin-Name: ff2f5a31a2ac67a2fdbb25793e8013cb0e062ab90bdcba2d52a62d6d4d8b6d18
2017-09-28 17:29:24 +00:00
drh
3d240d2119 Fix over-length source code lines in select.c. No logic changes.
FossilOrigin-Name: fd3267ef92384fcefaee7460a5ffbaf8ddcb6049eec36f72a7046a43e2871fbf
2017-09-28 16:56:55 +00:00
drh
4e6cec1ca0 Fix an issue introduced by check-in [4cd2a9672c59] (2017-03-03) that could
allow a negative value in the 3rd parameter to memmove() when
defragmentPage() is called on a btree page with a corrupted
freeblock list.  The corruption is now detected early and results in
an SQLITE_CORRUPT return before the memmove() is reached.

FossilOrigin-Name: 5b9ae693120fe4f7bc3b6270f35d773876f6cc8f5990e05cce0d255c54b36ae7
2017-09-28 13:47:35 +00:00
drh
70efa84da7 Add new routines to simplify dealing with collating sequences in expressions:
sqlite3ExprNNCollSeq() and sqlite3ExprCollSeqMatch().

FossilOrigin-Name: 490e488ea963fe725b16212822c8608f2b6abce688931b611446bc2cbfe6b87c
2017-09-28 01:58:23 +00:00
drh
db8e68b4cd Indexes on expressions with a COLLATE clause are able to satisfy an ORDER BY
with the same COLLATE clause.

FossilOrigin-Name: 0413001843dce7c63659d39b329ca14cdcd54f4407922f51b2fb7659572a733e
2017-09-28 01:09:42 +00:00
drh
488e619192 In two places, change the magic number -1 to its proper symbol XN_ROWID.
FossilOrigin-Name: 80277d2fc9b76fe41e345d00952da1528e69884f25911cf6e4f78b09ff778421
2017-09-28 00:01:36 +00:00
drh
9325c87c26 Disable tests for the LIKE optimization when ICU is enabled, since the
LIKE optimization only works for the built-in LIKE operator and ICU overrides
the built-in.

FossilOrigin-Name: f5ef2e1bcd2790f960c15947f87cda19bd6a6a384ad09b25f6d07d5244cfecbd
2017-09-27 16:51:00 +00:00
dan
b92d585c60 Add an extra snapshot related test case.
FossilOrigin-Name: 24a95e143785bb8e12198092d13c979ec2e116fa8b55d0bf482cb473a92294d8
2017-09-25 09:37:37 +00:00
mistachkin
3314062b9d Use the updated Win32 VFS semantics for winOpen from check-in [5d03c738e9] for WinRT, et al, as well.
FossilOrigin-Name: 2c03d8b8f028b6a736aaf2cf8b28a51b3434cf341c95cf3a80469e0a24acdd98
2017-09-22 16:23:23 +00:00
drh
24ddadfa3b Partial backout of check-in [e0af9a904076]. It turns out we do need some
extra space at the end of the record blob as an overrun area to use when
decoding a maliciously malformed record.

FossilOrigin-Name: 403b88a894d877b85bcc33133abad06c3c576e4928de4a4b0c091f74c4015355
2017-09-22 12:52:31 +00:00
drh
0b11bcb3e4 Update the configure script so that it looks for tclsh8.7 ahead of tclsh8.6.
FossilOrigin-Name: 0a12915b373cd0491a58d8f7a645711c620c70efced623e6b40aa01f23284157
2017-09-22 00:24:44 +00:00
drh
0e97e9a4c2 In the Windows VFS, when trying to open a database file read/write, if it
fails check to see if the file exists and is read-only and immediately fall
back to a read-only open attempt, rather than running the AV retry loop.

FossilOrigin-Name: 5d03c738e93d36815248991d9ed3d62297ba1bb966e602e7874410076c144f43
2017-09-21 20:43:48 +00:00
drh
b40d9eea50 In the Windows VFS, do not emit an SQLITE_CANTOPEN error log message when
falling back from SQLITE_OPEN_READWRITE to SQLITE_OPEN_READONLY.  Wait until
the open fails completely.

FossilOrigin-Name: fa3f5bcc23d9342f6df8ea15732988d637e9fa5dade85a73b05a9f66136d6964
2017-09-21 20:03:17 +00:00
drh
8dfde89bc6 Fix harmless UB in the ICU extension.
FossilOrigin-Name: 68e9a840d9cfbf4988e1a68c34e809d15d0235998cf0bfa147a1ab88ea842a61
2017-09-21 19:08:25 +00:00
drh
9616805728 Fix a potential use of an uninitialized pointer in RTree following an OOM
error.

FossilOrigin-Name: fd4ec0cdbd84f3333dd4c7a4236491bce6b9ab21fb2c088751ca1279b31bd864
2017-09-21 13:11:47 +00:00
drh
19be1b631b Fix a bug in tool/mksourceid.c:
The mksourceid.c program was incorrectly including the "# Remove this line"
line of the Fossil-generated "manifest" file in the SHA3 hash.  That means
that all SQLITE_SOURCE_IDs for trunk versions going back to
check-in [30966d56] (2017-08-22) are incorrect.

FossilOrigin-Name: 65765222ef6f4e80c05a24994fcee145f5fbc0ad35c9fab3d75492964b3eb187
2017-09-21 10:24:10 +00:00
drh
c07df4c3b9 Revert one performance improvement changes from check-in [3b3e32d4cd07] as
it was causing a reference to an uninitialized value.

FossilOrigin-Name: f8b1c64d3eeb8413ca149f34cc00f9154a5446d06ad33bbffa69118e6110f81d
2017-09-21 01:04:30 +00:00
drh
b5c1063ab7 Fix the rendering of the P4_INTARRAY argument to the OP_IntegrityCk opcode
in the output of EXPLAIN.

FossilOrigin-Name: adc12c83dda8ba93ca220bbff649f763058b9440968ae463621f0cb7de8889cf
2017-09-21 00:49:15 +00:00
drh
762dffa54a Size and performance optimization on sqlite3VdbeMemGrow().
FossilOrigin-Name: 4b3f7eacb862fbb5b75cf50b72fb60dfbd0acb5818e9f83383a6a63c8bbeacdf
2017-09-20 18:47:51 +00:00
drh
63d1632f1e The BLOB returned by sqlite3VdbeMemFromBtree() does not need to be
zero-terminated.

FossilOrigin-Name: e0af9a9040768adf8bba42a8780adeb6304bc442afb1f35d239d019db1624f40
2017-09-20 18:07:50 +00:00
drh
97397a70e4 Small size and performance optimization in the bytecode engine.
FossilOrigin-Name: 3b3e32d4cd07a1d2d1708fffa47819345ae6b39205a9f548280d499c8f481d64
2017-09-20 17:49:12 +00:00
drh
84d4f1a328 Improved resolution of large integer values in "CAST(x AS NUMERIC)".
FossilOrigin-Name: 7f2bd4ff45fba29528c18cac6da983bd9b164303525d3965056f5b40f85dc83f
2017-09-20 10:47:10 +00:00
drh
9a243e69c2 Updates to the "lemon.html" document received from Andy Goth.
FossilOrigin-Name: 5b2002f3df1902aaa571a0efd01ab8bae7f4d37ac4819cc51595277f4de93433
2017-09-20 09:09:34 +00:00
drh
cf51255c44 Add the sqlite3_mmap_warm() function as an extension in the ext/misc/mmapwarm.c source file.
FossilOrigin-Name: 1b2de41453ac33de82f9cd6cbb92eee4fe184fb282c27e5efa5243c8cb239630
2017-09-18 18:17:01 +00:00
drh
262d55121f Fix a typo in the MSVC makefile.
FossilOrigin-Name: 3235835babb49b4dd1acaabd1aa6cfb0b7fe19a914db1cb511e8cc872d3c0c39
2017-09-18 18:08:54 +00:00
dan
460f1fa55c Add extension "mmapwarm.c". Provides function sqlite3_mmap_warm(), used to
"warm up" the memory mapping used by SQLite in mmap mode to access db file
content.

FossilOrigin-Name: d4a30b91f9aad93510baead8c04ee51b82c98763be5a224ed4873298214c963a
2017-09-18 16:28:56 +00:00
drh
63347e7df8 Minor simplification of error message generation during compound query
code generation.

FossilOrigin-Name: a944719314e0ac2f1954b65668815769eba3ab3e39a74666293b8dea52a184b2
2017-09-18 13:16:10 +00:00
drh
edea4a7cc9 The out-of-bounds read on recovery fix of check-in [378afa16381a222a] caused
problems for some corner-case error conditions.  This alternative fix appears
to work better.

FossilOrigin-Name: 74f399d81fe250e09fde730ac0c17fe8b2b776ed32a3f576adaad56090f2b7fa
2017-09-18 09:40:46 +00:00
drh
2acd24d90c Fix the CSV virtual table extension so that it works when the default character
is unsigned.

FossilOrigin-Name: 42f07775556758754e92e29a759d200d0d81d16eee83ab982b840db11292f834
2017-09-18 00:18:31 +00:00