Commit Graph

19642 Commits

Author SHA1 Message Date
dan
f87e10c75e Ensure that all four callbacks are provided when registering a window function
(otherwise SQLITE_MISUSE is returned).

FossilOrigin-Name: 5720dcd8b111b1f8712c8fb4b441ccb129e838db8c26a6e9e0f095dc6a851f6b
2018-06-18 17:36:41 +00:00
dan
660af939b0 Add new API function sqlite3_create_window_function(), for creating new
aggregate window functions.

FossilOrigin-Name: da03fb4318fd2613ec5c5b109a3974ac1120c19ed16bed4ca85bbdc4b35c998c
2018-06-18 16:55:22 +00:00
dan
13b08bb6ff Add extra OOM test.
FossilOrigin-Name: ac251f72608c27c1512a0b3457524f5378a0b13d93d829cf0ed8bc178bc54a73
2018-06-15 20:46:12 +00:00
dan
6fde1799f8 Fix another problem in lead()/lag(). And some errors that could occur
following OOM faults.

FossilOrigin-Name: fadd4dc119d8df0d871f4d839b7a11070e2ffb8927e84b3e7a94f34196db3de3
2018-06-15 19:01:35 +00:00
dan
e0a5e20fa8 Fix a bug in the lead() and lag() window functions causing them to fail when
used in queries featuring multiple window functions.

FossilOrigin-Name: 3839fb18f917e4f705821198d624b19d84eb07f1ee29ad23314ab7cec6bf6a2b
2018-06-15 16:10:44 +00:00
dan
303451a8f7 Fix a problem with handling of statements containing two or more different
windows.

FossilOrigin-Name: 567e09ef2a8cd84a2481117e52595bed0f3b588745a9e441aae0f87680f3a2e8
2018-06-14 20:52:08 +00:00
dan
9a94722d48 Fix problem with window functions min() and max() when used with a PARTITION
clause and a frame starting point other than "UNBOUNDED PRECEDING".

FossilOrigin-Name: 43eb1e75a4d7ac0973ed8589bbaf379c24cdc8eacc4e613610d2d4c24d385dc1
2018-06-14 19:06:36 +00:00
dan
09882a75c4 Merge latest trunk changes into this branch.
FossilOrigin-Name: 5cf5f1808a51f9c2cfc98dd49b4f1ce860b53e935287f89868ce2fdbace8eb06
2018-06-14 14:30:51 +00:00
dan
54a9ab3f13 Improve comments and code legibility in new file window.c.
FossilOrigin-Name: bb915854d435bdd78f141d70e23527e97922ec176acd3ed8060c78dffc96bab8
2018-06-14 14:27:05 +00:00
dan
13078caac4 Fix problems with "RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING" window
frames.

FossilOrigin-Name: c34f31dbd79891249ee9485e91f6ea558ee1db62e04fb0fff2c051612b8fa5e7
2018-06-13 20:29:38 +00:00
drh
2f1f8801ed Output infinity as 1e999 in the ".dump" command of the command-line shell.
FossilOrigin-Name: ee431d55eba618cfba414c3946b3162bc205a70dd4e43d74a7623be332b94c92
2018-06-13 17:19:20 +00:00
drh
4449437b56 Pad out the sqlite3_value structure to be a multiple of 8 bytes.
FossilOrigin-Name: f76dc33bde4b2180b935d1261492d9535772ed37e54489c1a33e9f11c7c90433
2018-06-13 16:52:38 +00:00
dan
c5861ce88f Fix some test case numbers in expert1.test.
FossilOrigin-Name: b90c3c16c04589583d2d1619320bb45a0b012c5960f23bd4e3f9dbe7c84b2eae
2018-06-13 16:08:22 +00:00
dan
45f318275e Unless SQLITE_OMIT_AUTOINIT is defined, allow sqlite3_vfs_unregister() to be called before sqlite3_initialize().
FossilOrigin-Name: ab6c1ae46d992f91ce0995274f48d545eb02ba92544aee89b188f2fc92b66f2a
2018-06-13 11:41:54 +00:00
dan
466ea9b1e2 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.

FossilOrigin-Name: e9a7e4d58f3716991309ca0e3f080717e473c7c231685954aceee36172f19cf2
2018-06-13 11:11:13 +00:00
drh
ea74c1db64 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.

FossilOrigin-Name: 9f40383eed936a6921ef8dc94775eb55d03a761f36eda7be1b9cdd0a0d30fa80
2018-06-13 02:20:34 +00:00
dan
c0bb4459d3 Fix another issue to do with window-functions in aggregate queries.
FossilOrigin-Name: 6413e38a174044c28fa9b8b937e6c972d144547a246e6f2882e782538300d042
2018-06-12 20:53:38 +00:00
drh
5174f17485 Documentation update: clarify that sqlite3_errcode() and related interfaces
do not themselves modify the error code.

FossilOrigin-Name: 858fc52b237702b5e0381eebf5c158bffd7371ff0053a8583b8c175f8f691c82
2018-06-12 19:35:51 +00:00
drh
3086529f7c Documentation updates: clarify the behavior of sqlite3_column and
sqlite3_value interfaces following an OOM error.

FossilOrigin-Name: 428c581e4bed1d140cfb670633c9c61b36be7bb30a862d2e1ae7eaee26dccb4f
2018-06-12 19:22:30 +00:00
dan
7392569f5e Fix some problems with using window-functions in aggregate queries.
FossilOrigin-Name: fe7081e0952950f577234fcbb58f3c1efa4579267654fd2f713dc4804e470e7e
2018-06-12 18:40:17 +00:00
drh
58773a533c Improvements to SCopy correctness tracking when SQLITE_DEBUG is enabled.
FossilOrigin-Name: b2973f2357a2c5e22e0d612c970adbc6d51cbc5e4ff7ac6d2b678722e553e8ec
2018-06-12 13:52:23 +00:00
drh
cd9e01427d Fix the "Synopsis" on the OP_BitNot opcode.
FossilOrigin-Name: acd78df61188591d33ddb9b1b8c16bcc015f4dffac66314529caa747d4395c70
2018-06-12 13:16:57 +00:00
drh
dd2a8f5ee9 Improvements to the --enable and --disable options for the
amalgamation tarball.

FossilOrigin-Name: 02e337e0808947c7ef376b5a300cd3c461f1a368c9fe7ffd7ca5744f102641c2
2018-06-11 21:33:08 +00:00
dan
2a11bb23eb Clarify the relationship between a Window object and its associated Expr.
FossilOrigin-Name: 0cd55e98a478740032f5569ddc00fa5b0e063e90db6e00ac7598c9b7c2fffeee
2018-06-11 20:50:25 +00:00
drh
8fa622d62b Fix various --enable and --disable options on the top-level configure
script.

FossilOrigin-Name: 6fd7e8ceb96981cff023653a54b85bea0e1da3d706cd9f4383f5c5533213ef4d
2018-06-11 19:47:14 +00:00
dan
26522d1c45 Fix handling of window frames containing negative number of rows. e.g. "ROWS x
PRECEDING AND y PRECEDING" where (x<y).

FossilOrigin-Name: b6d9c7eda853420ae46a05bd432711e8bf9ebaa448c7d90ccfc0bcc338a87706
2018-06-11 18:16:51 +00:00
drh
ea64715976 Fix the column cache invalidation logic in the code for ROWID uniqueness
constraint checking in the INSERT command.  This fixes ticket
[c2432ef9089ee73bd].

FossilOrigin-Name: 0b485a571c805a5bc431a231a196ff6034342c6548d92b09c52814dd57c89c75
2018-06-11 18:06:48 +00:00
drh
299bf7c2f0 Add the OP_SetTabCol and OP_VerifyTabCol opcodes, only when compiling with
SQLITE_DEBUG, to do run-time verification of the column cache.

FossilOrigin-Name: b37614a3670770919a7c7f8157c5fd6578d736447998640b52e5cef8174cadc2
2018-06-11 17:35:02 +00:00
drh
8d7b212c4c Strengthen the sqlite3VdbeMemAboutToChange() run-time verification mechanism
to better detect missed calls to AboutToChange().

FossilOrigin-Name: 793e942205a12eedb7ecc5ad8a27e3e52bbd4e1d50a0d1453d04a83ba728884e
2018-06-11 13:10:45 +00:00
dan
72a9f0233b Fix a typon in main.mk.
FossilOrigin-Name: e74f86f271d6ab1ecd17c1ee63ab2aa0885ca56624be7382872f04d46c48ed86
2018-06-11 11:19:35 +00:00
drh
9c3549aa2f Always initialize the WhereClause.hasOr field that was added by check-in
[292724ffc4].  Error detected by OSSFuzz.

FossilOrigin-Name: 9faf41713e865f26485d9e90918d77c25be211384941eadda6a36237f52c25de
2018-06-11 01:30:03 +00:00
dan
980cf25b10 Update Makefile.msc to include window.c in the build.
FossilOrigin-Name: 16db73842ade5eb0fe02f257b91d1c7b41d830d3f17f8638b8fbaed309d9a852
2018-06-10 07:42:35 +00:00
drh
074544d181 Fix a typo in the amalgamation autoconf file.
FossilOrigin-Name: de0857f39620b7f5c921ddf8d11b11723b4ba3cfe52e43cf77e883697b7c1c4c
2018-06-09 20:52:45 +00:00
dan
96f55d0fa5 Merge recent trunk changes with this branch.
FossilOrigin-Name: c71f23590c25b4cecd27722e6c0fc8e3bf320d399c7d9398b7016dd5cf5b05eb
2018-06-09 18:09:44 +00:00
dan
d31e7addd6 Update the amalgamation build script to include window.c.
FossilOrigin-Name: 21d2f4a62eceab0de0b4669bf3e81eb71512211ed710ce0eb525695fb7309d6b
2018-06-09 17:58:51 +00:00
dan
8b98560d6e Add support for FILTER clause on aggregate window functions.
FossilOrigin-Name: ceaf798ea09184bc0e7d3dcf3ad4d909d2e4e7018754a8417a813f33010140a7
2018-06-09 17:43:45 +00:00
drh
4ece2f2657 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.

FossilOrigin-Name: 538a365b7a32ab7fa84f59d7556242cfb59b76d287b6417eb3a823197a354e8e
2018-06-09 16:49:00 +00:00
drh
a46ba6cca5 Improved comments an presentation for the recent IN operator decision
improvement.

FossilOrigin-Name: 31e480f68dfd887cfd9114f9f9fec53d751d3ecc27e36f55c0166b51b2fbb08c
2018-06-09 14:13:46 +00:00
drh
ccf6db5e64 Performance improvement to sqlite3WhereExprUsage().
FossilOrigin-Name: fd0934139076848f2f2edfd3d74d54608531031a05a60ca6ac1d7016dcd538df
2018-06-09 02:49:11 +00:00
drh
1fe3ac7347 Compute the bitmask of indexed columns for each index once when the Index
objecct is constructed, instead of recomputing it every time it is needed.

FossilOrigin-Name: d735872ec383bbd220b08c61d25db9ff3675d2542b9e7867e7d6323a12e0cc23
2018-06-09 01:12:08 +00:00
drh
da230bd484 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.

FossilOrigin-Name: 292724ffc4bfca435fff309383d488ffdbe1e314e5eb26da21cf2f621b64bce5
2018-06-09 00:09:58 +00:00
drh
7128b7c1f4 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.

FossilOrigin-Name: 2cbbabdf5ef624d809fbb40d2d312a29e0b5f02756fc0dbf6985fc8b0c8d1ade
2018-06-08 23:23:53 +00:00
drh
6d6decb8d9 Only choose to scan an IN operator rather than use an index if we have
real STAT1 data to suggest it is advantageous.

FossilOrigin-Name: 30e874661dcc1a2ecb40df2ef74582151d85bb36c754a38548829a3b6285f18d
2018-06-08 21:21:01 +00:00
dan
e3bf632cc2 Add support for the WINDOW clause.
FossilOrigin-Name: 19c983b511f1c823fdfb051713681b4c779f02fa83b41189afca0a9b8b72048d
2018-06-08 20:58:27 +00:00
drh
982c41977c Merge the btreeNext() assertion bug fix from trunk.
FossilOrigin-Name: 11bd66e09035039fbfc4c5631196962dd3f2e6634f5123a7b2fec17aeaaab07b
2018-06-08 19:54:07 +00:00
drh
f3cd0c82df 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.

FossilOrigin-Name: 99057383acc8f92093530e216c621d40386a06fe98131ff0af6df524d80a6410
2018-06-08 19:13:57 +00:00
drh
da4c409aea Consider doing a partial table scan to fulfill an IN operator rather
than using an index.  Try to pick the plan with the lowest cost.

FossilOrigin-Name: 1fa40a78fef4516c39b217bff67efe7e7d2077cca00aae0ef5c2c9cff94f008b
2018-06-08 18:22:10 +00:00
dan
dacf1de95c Do not flatten sub-queries that contain window functions.
FossilOrigin-Name: 236cb75bd1f0d5eb86aa5f52d8d548e7263c34633833dcea9dfc934f142113b8
2018-06-08 16:11:55 +00:00
dan
03854d2ecc Fixes to allow group_concat() to be used as a window function.
FossilOrigin-Name: 89bbc9ba8f66853a7530453f146c9df1baacd8558468016cefa7602911f7578a
2018-06-08 11:45:28 +00:00
dan
07509f8c1e Merge latest trunk changes with this branch.
FossilOrigin-Name: 251022034219819a1dc356542770ff46e3147a080f072eb20af6106771dadd92
2018-06-07 20:35:28 +00:00
dan
fe4e25a0f6 Add window functions lag() and lead().
FossilOrigin-Name: ef34207073c21ce8618486777671ae78d23f290acd6d3c37e91a49b69cb506ac
2018-06-07 20:08:59 +00:00
drh
83193d0133 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.

FossilOrigin-Name: 09fffbdf9f2f6ce31a22d5a6df7a45f19a16628da622f12d6e33171cce09fb21
2018-06-07 18:13:49 +00:00
drh
cf025a8c18 Fix the assert()s in the byte-code engine that prove that cursors
are unidirectional.

FossilOrigin-Name: 4b0b4e14039469b656662312a5f80f086ede293e9ad04c7bc99a202b683a1e55
2018-06-07 18:01:21 +00:00
dan
7095c002b8 Add support for window function first_value().
FossilOrigin-Name: 060b26402880daab085ad01f5f0dbde957c7a22cd219be5b8ec94fba883051a0
2018-06-07 17:45:22 +00:00
drh
f1949b6634 Remove the NextIfOpen and PrevIfOpen opcodes which are no longer needed
when the IN-early-out optimization is working.

FossilOrigin-Name: 439c8162272795b422a0e01b01b832fbc12b39914c9632a674162af8bdecff98
2018-06-07 17:32:59 +00:00
drh
056f5396fe Test cases.
FossilOrigin-Name: 085e863713a3f2d420c0076b275a6ac445a59d4d93f9eb0e8503b4e3f5589249
2018-06-07 16:07:00 +00:00
dan
2e60568fef Fix problems with the nth_value() function.
FossilOrigin-Name: 63002b9a090397668b94fe341a035c42f84e4837af85395bce4cd1c2777c5209
2018-06-07 15:54:26 +00:00
drh
64c1f77a8e Merge the ".stat/.eqp" CLI fix from trunk.
FossilOrigin-Name: a91cad3381bb843d6f58975251bf99f0fa1a1398fae53d97a98a6c8ee65e718e
2018-06-07 15:28:40 +00:00
drh
3c49eaf4be Avoid using a prepared statement for ".stats on" after it has been closed
by the ".eqp full" logic.  Fix for ticket [7be932dfa60a8a6b3b26bcf76].

FossilOrigin-Name: bb87c054b1b76959e46258ac66b24027f468b390a4148ac67f208a1fbeda4060
2018-06-07 15:23:43 +00:00
drh
f7b0a5f3c3 Add the WHERE_IN_EARLYOUT flag and use it to clarify the logic of this
optimization.

FossilOrigin-Name: 522f1eacc20f11002cad58232a7c2610f369568653510e54f46088f579f778dc
2018-06-07 14:59:22 +00:00
drh
bd573c459b Merge recent trunk enhancements.
FossilOrigin-Name: e9d7bf4f7b9d6f8dabc4c95d43ebf12f2149bed1c5e750048b1b684128073c38
2018-06-07 14:32:16 +00:00
drh
df12595c09 Change a comma into a logically equivalent but semantically clearer semicolon.
FossilOrigin-Name: 71f97f0f82b3abfb07feb78d64a182fc50ff396e85d6f5aac479dbf58ba4d00a
2018-06-06 23:31:26 +00:00
drh
6eb3480bd7 More space and performance enhancements to sqlite3VdbeRecordCompare().
FossilOrigin-Name: 83a60ff056a63f18479030e9dfb10926fbb0d906d51f2cf88233098e15c75534
2018-06-06 20:55:10 +00:00
dan
ec891fd40c Add implementation of nth_value() window function.
FossilOrigin-Name: eb1fb420ac70857e7ca4cbad78be15a27bee8f915ba2da080c7efa1879c06c31
2018-06-06 20:51:02 +00:00
drh
d882108a01 Small performance optimization in sqlite3VdbeRecordCompareWithSkip() for
the common case where the comparison is equal.

FossilOrigin-Name: 1e616e256a4fb1b64271706fdfa77dc5790eba0a2f0e619544e169bc61d7c805
2018-06-06 20:29:19 +00:00
drh
4011c44322 Rearrange the order of some checks in the integrity_check pragma for a very
slight performance gain.

FossilOrigin-Name: 4b853f020570bf4af1b14e03f35764c7d7a03a40af58efc783e06f2b883cef78
2018-06-06 19:48:19 +00:00
drh
685a50ad74 Fix the sqlite3BeginTrans() calls within the snapshot extension.
FossilOrigin-Name: 1fef7ad25b6a8e59163ac57f5cf0412bfc5b0e9446fd782f5f0a7d7ee11741fc
2018-06-06 18:50:50 +00:00
drh
397776a823 Another minor optimization to OP_Transaction.
FossilOrigin-Name: d80077aee3904e5d93164b342cae14d813de8e84e567462412751e06c7487d41
2018-06-06 17:45:51 +00:00
drh
bb2d9b1bf1 Change sqlite3BtreeBeginTrans() to return the BTREE_SCHEMA_COOKIE, for a
small speed improvement when starting new transactions.

FossilOrigin-Name: a10662aa915ae2b5a78b3e10920350d32255b2d6b1a8aac0aba1ad173b07ed2b
2018-06-06 16:28:40 +00:00
drh
0cfd46a1ad 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.

FossilOrigin-Name: 27291f2d7fd4dadf2ee9b9a7d1373158cadfbaf83c3654b00d7030dc921770c6
2018-06-06 01:18:01 +00:00
drh
bb777d517d Update the version number to 3.25.0 for the next development cycle.
FossilOrigin-Name: 7598236c356cdb548c6188d69dfef99f7a08b89e512a3addfe1433ccd85e7b68
2018-06-05 23:51:52 +00:00
drh
48baed4f77 Avoid unnecessary loads of columns in an aggregate query that are not
within an aggregate function and that are not part of the GROUP BY clause.

FossilOrigin-Name: e15e100660d290249ef235e7a8927b88296e56ec0f80ec626eecbd542adc7633
2018-06-05 23:21:11 +00:00
drh
8c2b6d784b 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.

FossilOrigin-Name: 6bf251af4347165a470d39457d61ab6d2a06c206db8f30bd8be5dbb388ae8a5b
2018-06-05 20:45:20 +00:00
dan
280c894b74 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.

FossilOrigin-Name: dce2dfbe1590deb3ef5661230ae2d232bd492441195defbf698ac56f9629211c
2018-06-05 20:04:28 +00:00
dan
1c5ed624a0 Add implementation of last_value() window function.
FossilOrigin-Name: 2493ce1a402888f6a8f25e03052c25a4e9bca740639e98cb614f5e5160ac25d3
2018-06-05 16:16:17 +00:00
drh
86d0ea7558 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.

FossilOrigin-Name: 87a9fc504f9a78caf7a7949cc7ada0a19d61bfab51bb49a00a1607194c116212
2018-06-05 15:16:25 +00:00
drh
995bbbf993 Merge trunk changes.
FossilOrigin-Name: 047295c588e9fdf2ffa4e69e166f177fd193309531dc6a9ac755fb7a763adb72
2018-06-05 13:54:06 +00:00
drh
8e9deb61af 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().

FossilOrigin-Name: 8a0b730d0ea640d5cf75febe39b2162411a12eb5275765a85882158b5a085681
2018-06-05 13:43:02 +00:00
drh
00583291bd Version 3.24.0
FossilOrigin-Name: c7ee0833225bfd8c5ec2f9bf62b97c4e04d03bd9566366d5221ac8fb199a87ca
2018-06-04 19:24:41 +00:00
dan
6bc5c9e788 Add implementation of window function ntile().
FossilOrigin-Name: 3f093f608c6cc193aac77e7eafa8006c27a7776682d9d7b6e743710dff41ae42
2018-06-04 18:55:11 +00:00
drh
6b27f5fab7 Merge recent changes from trunk.
FossilOrigin-Name: f8df2a8e28acdd9573a9ffc18027553f35f769a989f5dfbf81f31b0656ee6065
2018-06-04 13:27:39 +00:00
dan
2b1287cf44 Merge latest trunk changes into this branch.
FossilOrigin-Name: 83d6416a868fac81a78c9507185a48d00920e4322276245e285946f760915f4a
2018-06-04 08:28:18 +00:00
dan
f1abe3680e Add support for window function cume_dist(). Improve tests for percent_rank().
FossilOrigin-Name: 76543f7dd3a2310f6e81a1bae17db9bb5d2cf10c1b87ed3f8394b3e75576078b
2018-06-04 08:22:09 +00:00
dan
dfa552f45b Add support for window functions row_number(), rank(), dense_rank() and
percent_rank().

FossilOrigin-Name: 91c1cb7a217d0991a08256269f6c55ef185c25362d57b36bfbd2d85dab38e58f
2018-06-02 21:04:28 +00:00
drh
eb7df46e32 Avoid using a misaligned pointer.
FossilOrigin-Name: 1ecb3aa13de5c8dc611b814ff34010de0bd90aae73d88aa37a59c4627be4cc2d
2018-06-02 19:14:58 +00:00
drh
1fb7a60ca0 Fix the usage of posix_fallocate() so that it correctly responds to
EINVAL returns.

FossilOrigin-Name: ce2c3e7a875ede4366c48660ae8239d2b74e5f690ad5059844a45f1164f41e61
2018-06-02 19:01:54 +00:00
dan
69a4b383a2 Update a test case in malloc5.test to take into account that malloc()
sometimes returns slightly more space than requested.

FossilOrigin-Name: 3d5eae1c26353cdee89f31f1293b05c0edb494c775ba0912d9b4fda9ab0ef304
2018-06-02 17:00:57 +00:00
drh
5ba5f5b5d2 Work around a sanitizer warning about a pointer being only 4-byte aligned
instead of 8-byte aligned.

FossilOrigin-Name: 1b807b51cdf455b4f54216b73fd22bbc90f94e24222401e045f88cfd27f487e3
2018-06-02 16:32:04 +00:00
drh
789df14b11 Proposed fix for the use of posix_fallocate() so that it handles EINVAL
returns correctly.

FossilOrigin-Name: ab3a5539db82814cafb832cdaebd1e14566139306453ef9cdba6b244a994fe0b
2018-06-02 14:37:39 +00:00
drh
e893e2e4ee Fix the CSV extension so that it works with single-column CSV files.
FossilOrigin-Name: e336cf00486bdc0ec04ecded2b7c874d73a87e6aba3544e3678bedfb9a4af3b6
2018-06-02 12:05:18 +00:00
drh
4344dbd3ab 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.

FossilOrigin-Name: d0c3beef7cdc680c0768ddd18f766a4ca7be822c1eb1776b2f73b7433d9962dc
2018-06-02 11:31:15 +00:00
dan
f690b57206 Allow an entire partition to be cached in a temp table for all types of window
frames. This is required by nth_value() and others.

FossilOrigin-Name: b5b18f661341d8d450147e62d321791c706f16c0550bcd98eec3e0220c039189
2018-06-01 21:00:08 +00:00
dan
0f86c9d8fa Fix a bug in the SQLITE_ENABLE_SORTER_REFERENCES code causing an out-of-bounds
array reference.

FossilOrigin-Name: 8cadaf587dc96370f9c8a1dccc366b93021e8cfe4526da9368a088828fd14faf
2018-06-01 13:30:45 +00:00
drh
416a801600 More documentation typo fixes. No code changes.
FossilOrigin-Name: 66c24513c2f6de98bd888c3e4c07bbb39fabf30ea9dd01eb255460054055347d
2018-05-31 19:14:52 +00:00
drh
8cdafc384e Fix a harmless typo in a comment used to generate documentation.
FossilOrigin-Name: 5a2a88cb01ef4b299f9a5b2963f392a3bae90e8a7f84b190e67f86090f891e23
2018-05-31 19:00:20 +00:00
dan
c9a8668ac7 Allow min() and max() to be used as window functions.
FossilOrigin-Name: c16125a884a9131b707ac20033968c4c3177ea79625a15efb64d754568c6c7a0
2018-05-30 20:44:58 +00:00
drh
fc232d6f65 Add the Makefile.fallback makefile to the amalgamation tarball.
FossilOrigin-Name: ce3d04563337c9556d66e55acfb454789b0baa49a1be8fcc349251ce88236d62
2018-05-30 14:17:09 +00:00
drh
5d3112872d Do not use the codec on the resetdb.test script.
FossilOrigin-Name: fe55cea0c80ab29120574c5c4a8473b83fc80f79d7e11bc7c326bfdb32aa3902
2018-05-30 07:36:55 +00:00
drh
8e02a180b9 Fix a typo in an error message in the CLI.
FossilOrigin-Name: 808839808141493c1e5122f40b2cdff725be0cd1212e03d609345dbff7af03e4
2018-05-30 07:24:41 +00:00
drh
6a8b94e266 Fix the parser so that it builds with -DSQLITE_OMIT_CTE.
FossilOrigin-Name: 86ee267ee86f5264774a9f215b1158aeaa2d605e77c205731b5ee3945d7de4c2
2018-05-30 01:14:20 +00:00
drh
3e62ddbf13 Fix a harmless compiler warning.
FossilOrigin-Name: 8d02c7a6a09f7520ad180b0d943db475894cd39b0ccdb2ad2c44009d5f25c8a6
2018-05-30 00:59:09 +00:00
drh
a0368d9396 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.

FossilOrigin-Name: 92f0fe155d5546fc7f4a443d0630613dabe149061966308e5420fad652278f16
2018-05-30 00:54:23 +00:00
dan
ea93e2804d Increase the number of database handles opened by test script oserror.test to
provoke an "out of file-descriptors" error to 20000 (from 2000).

FossilOrigin-Name: 3b00f73456c65dfc1827fdada9afb49245f9addfa684d5ae35e69a07f39164bf
2018-05-29 19:12:58 +00:00
drh
b7d376ee13 Fix a problem in the geopoly json parser associated with spaces before a
coordinate number.

FossilOrigin-Name: 9d8d3af89ab241fd6c68e043e559359c85653aa0e31270b658ff01867ae929c4
2018-05-29 17:17:22 +00:00
dan
867e6de4d7 Fix autoinc.test and resetdb.test so that they work with all permutations.
FossilOrigin-Name: 89f56d6b0a6847b042a1556cdf79c598c9bfdbdd5f9529d508ca7b4d26a6ed38
2018-05-29 16:37:12 +00:00
drh
59ee43a78e Add a comment to justify a goto statement. No code changes.
FossilOrigin-Name: f141d806476aabe592a15d83b72c9409d2cd6bd7f9cced1ea2513c134191430a
2018-05-29 15:18:31 +00:00
dan
1d40cdbd4b More minor changes to test scripts.
FossilOrigin-Name: ce9b756f09df4feb485bbf9695f8c6774906eb1b2fb45a340b74ffd21c9adfd8
2018-05-29 14:29:28 +00:00
dan
d3e17ffbb7 Fix some test script issues caused by recent EXPLAIN QUERY PLAN enhancements.
FossilOrigin-Name: f808e22831c33bfe3d0dd44e209f64d527c23ca7c72be7c694736535afee1317
2018-05-29 14:06:55 +00:00
dan
66e82b47d9 Do not run test file "resetdb.test" as part of permutation "inmemory_journal".
FossilOrigin-Name: 4921e5bae4c12c3413cc0b2e58766cf2ac117ad95f92fcd1c2457db6cfabb054
2018-05-29 13:25:14 +00:00
drh
b0af3d1f97 The geopoly virtual table seems to be working. But only thinly tested so far.
FossilOrigin-Name: 4288f1ad5966701eac4cfe3061e8ce98e34e0d6c112307668729642a06458d5f
2018-05-28 23:59:03 +00:00
dan
d6f784ef92 Further window frame tests and fixes.
FossilOrigin-Name: e74c6e91859ec395c12ba2742542ff176a1d8364dcfb66b862240746bef54efc
2018-05-28 18:30:45 +00:00
dan
fecfb3189b 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.

FossilOrigin-Name: 469a62ca33081854e54f3af6d93ab5a350484b149c8c8c4ee8be0ae5418382d9
2018-05-28 18:29:46 +00:00
drh
50baf3d525 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.
FossilOrigin-Name: ce99c7724460b9cf4ccaf7f6bc1a522b5c34d5ad0683d465f7926b10f31f7d05
2018-05-28 18:25:19 +00:00
drh
341141c339 Fix the build so that it works with -DSQLITE_TEST_REALLOC_STRESS
FossilOrigin-Name: 90ba2b2e5ce2619e68879eb325b43639159f27eb462b9fb6795534c91200a3d2
2018-05-28 17:43:28 +00:00
drh
4031bafafb 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.

FossilOrigin-Name: 5a4542dbcf17a9f7fed600897555c271e1651fd50eb41d0b126725b486e1d14c
2018-05-28 17:31:20 +00:00
drh
48e4ef56c3 Untested incremental check-in. Add the geopoly_xform() function. Complete
basic logic for the geopoly virtual table.

FossilOrigin-Name: ed06cc32568a3abaa0535b379e0ee3b04ffb7582dcda6405670620d1fbe8996c
2018-05-28 13:23:23 +00:00
dan
79d4544d53 More fixes for different window frame types.
FossilOrigin-Name: 2c85668a0f86bcfd3de4c65847ac252e136ce97409a2249c5f4f58e3756e9a69
2018-05-26 21:17:29 +00:00
drh
0624282e5e Merge the ability to plan virtual table queries using overloaded functions.
FossilOrigin-Name: 2c2a202c14fa8803fb1e4b7356cbc9cd49e65a27e19bf6e3fd0e9dff9d5c67f9
2018-05-26 20:04:20 +00:00
drh
59155065e0 Experimental change that allows overloaded functions to be analyzed by
the xBestIndex method and used by the xFilter method of a virtual table.

FossilOrigin-Name: a353b1d7ee6c5989ba1b98a3990c9a4c2ff39ae66572fd1200606e8ef585e5fa
2018-05-26 18:03:48 +00:00
drh
9201184711 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.

FossilOrigin-Name: 777189ce88799f93f393fd14fd716111c85bcdcb23690fd561f78ea2bd2ce5da
2018-05-26 16:00:26 +00:00
drh
7fc86b96ba Add a single sentence of documentation about the virtual table
scan flags.  No changes to code.

FossilOrigin-Name: 27b4fa5dd0defc6ddaf5d8cde6a1e1162b70d99bfdc69c1d2290621a6d23ed91
2018-05-26 13:55:04 +00:00
drh
f403e1af0b Minor correction.
FossilOrigin-Name: f20d9a99a477e1d592edb37d741d9d07b015d6772b4c8cf1541ef290d600ca6b
2018-05-26 12:21:21 +00:00
drh
ecdc742790 Untested incremental check-in. Basic infrastructure for geopoly in place,
except for the MATCH operator.

FossilOrigin-Name: b27451910b6880b166d4777e05b14ab2731c3483b5ed0f42c459bbb61c6cd095
2018-05-25 22:39:29 +00:00
drh
66c43599ce Incremental check-in: Progress toward implementing the geopoly vtab.
FossilOrigin-Name: 9b7d6f986a19f8fbe26d880dc368870a10df80e06097be34ee3639f78c50be61
2018-05-25 20:53:42 +00:00
dan
09590aaa1b Fix "RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING" window frame
processing.

FossilOrigin-Name: b4e9c686697a5211a3bfa47e63f0684e3d4241d8c292cffe1a967bc39ad7cd8f
2018-05-25 20:30:17 +00:00
drh
748b8fda90 Forward port the geopoly extension functions into the r-tree extension,
with the idea of creating a new spatial index based on simply polygons.

FossilOrigin-Name: 0593aac88a8c25ddafba4c29a181ee083dfc3dab44335feb6f12fdea6ce7fb27
2018-05-25 19:22:47 +00:00
dan
83023a3357 Merge latest trunk changes into this branch.
FossilOrigin-Name: 6232519899efc568465d8fcc9fcd79d46a2ce4ec05109d26d5eb1ebd239cd596
2018-05-25 09:36:27 +00:00
dan
e105dd7622 Fixes for "ROWS BETWEEN <expr> FOLLOWING AND <expr> FOLLOWING" and "ROWS
BETWEEN <expr> FOLLOWING AND UNBOUNDED FOLLOWING"

FossilOrigin-Name: 5ac44872fd5c4f92851e7bf57d7207bb4d67de88ea2b5c746ff97f20bd6352e1
2018-05-25 09:29:11 +00:00
drh
338e311acb 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.

FossilOrigin-Name: b816023ce07d01024d5769e16db924374a49bf909edd12dc1344a0a1ef693db5
2018-05-24 23:51:57 +00:00
drh
30fc7f8009 New test case for reading and writing the same rtree concurrently.
FossilOrigin-Name: 3ba08e53d54165f5541756ad13a4c2f0b18516cb612a256e056ed1ff76c1fa83
2018-05-24 22:42:27 +00:00
drh
c8c9cdd9dd 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.

FossilOrigin-Name: d4ce66610851c825cb712f985216b63e015c753fdd5521f929c67ad18bfd7664
2018-05-24 22:31:01 +00:00
dan
31f5639fb7 Allow "<expr> PRECEDING" to be used to specify the end of a window frame.
FossilOrigin-Name: 7b709a989c188dbcf429989a0785294b36c8a7e89b5de8cefc25decf1f5b7f5a
2018-05-24 21:10:57 +00:00
dan
99652dda3c Support other frame types that use "<expr> PRECEDING" or "<expr> FOLLOWING" as
start or end conditions.

FossilOrigin-Name: ec7b648c7f0ee266653561bbb9daa45b9be0d8a1a14f11dc93bce467c35154e6
2018-05-24 17:49:14 +00:00
drh
b9cd2c4536 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.

FossilOrigin-Name: b4d80bd287ca7f3a6d182ba2435273266035b94fdf6a44047a64a4eff931c571
2018-05-24 17:38:00 +00:00
drh
bbd574bc37 Fix a typo in a comment used to generate VDBE opcode documentation. No
code changes.

FossilOrigin-Name: 36cdfbf2ce1811691c790fde3eaeed0238c03b4dc97dc3a20d1e0397520145d1
2018-05-24 17:25:35 +00:00
drh
cf8784cd8f Addition cases for rtree preformance testing in speedtest1.c. Add the
--nodiff option to the speed-check.sh script.

FossilOrigin-Name: 95f2d62cf3cf8dbe0f12b652b47fe1f8e0f52bc269e269955fafdf802afc47c1
2018-05-24 16:18:35 +00:00
drh
7458a9f3f7 Updates to the sqlite3_vtab_nochange() documentation. No changes to code.
FossilOrigin-Name: 5bd99abc10b8153aadff5f815ae15fbe375f34f043c65def4be03014d2efdb50
2018-05-24 13:59:45 +00:00
dan
c3a20c19a8 Add support for "ROWS BETWEEN <expr> PRECEDING AND <expr> FOLLOWING" window
frames.

FossilOrigin-Name: 3a203660f1e4da3b8d2d605c494f4843f6e00752f28042b49e11d7d6550dd406
2018-05-23 20:55:37 +00:00
drh
4c57e326ef Remove a branch that is no longer used due to the fix to the
sqlite_sequence schema problem, ticket
[d8dc2b3a58cd5dc2918a1d4acbba4676a23ada4c]

FossilOrigin-Name: 066742692a9e8735b814c6a145545f97a7fb10b29cead78e68e25324e79aabaa
2018-05-23 17:53:07 +00:00
drh
186ebd41cf 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].

FossilOrigin-Name: e199e859ace4f8381c6380175206e7a276e3f2228fadbbca9341bca8d2fc445d
2018-05-23 16:50:21 +00:00
dan
72779425b5 Merge latest trunk changes into this branch.
FossilOrigin-Name: cdb68d2c64e453fdcd29437d5915c5c5ab6fbc7b5ffac52f4cb393f35b4a0124
2018-05-22 20:36:12 +00:00
dan
8471be3311 Add comments to window.c describing how other window frames will be implemented.
FossilOrigin-Name: 16168146b202915252f9375aef38e65ca20c5d4aa906e851d4d3a484db57562d
2018-05-22 20:35:37 +00:00
dan
f9eae18b56 Begin adding support for more esoteric window frames.
FossilOrigin-Name: bc4b81d60d40583de0f929730159011c1a7696802532ebd02220de3ace94a60d
2018-05-21 19:45:11 +00:00
dan
b6e9f7a4d1 Fix minor problems on this branch.
FossilOrigin-Name: 19c2e4b2f164521eab84cb0a0e12984be9431eaedd001dd3671e9ea1a6212353
2018-05-19 14:15:29 +00:00
drh
e8cf689df3 Add support for auxiliary columns to the rtree extension.
FossilOrigin-Name: c6071ac99cfa4b6272ac4d739fc61a85acb544f6c1c2ae67b31e92aadcc995bd
2018-05-18 17:58:33 +00:00
drh
16d261b3ef Merge enhancements from trunk, especially the CLI fixes.
FossilOrigin-Name: a350040a3bb962823f92908fb31cade52baf13eab90ef608ca3a8349e4c28c9d
2018-05-18 17:17:36 +00:00
drh
9e80403bfc In the CLI, detect and report errors on sqlite3_close(). Clear global
variables prior to exit to so that valgrind can better detect resource
leaks.

FossilOrigin-Name: e3b2e0a078b82ac6cd3c3312e8ac0983c1375e1052f1e324476d2f8d1b227c30
2018-05-18 17:11:50 +00:00
drh
a02fd67b99 Avoid unnecessary sqlite3_finalize() operations.
FossilOrigin-Name: 16f71032a3a2919cb226b25b5256a370adb5c55fa506d4774b7f83dc8868e793
2018-05-18 16:53:07 +00:00
drh
136c9903bf Fix a prepare-statement leak.
FossilOrigin-Name: 95fd296ffc8130526a1453cbdca6ce47f22fc5b5c474aa31d66b627d0c7393a1
2018-05-18 16:46:09 +00:00
drh
252f39619a Improved error messages. Limit the number of auxiliary columns to 100.
FossilOrigin-Name: 059d20abd57727e6d312f15b640359ef778786f577d9b50b17b57195db2d0aef
2018-05-18 15:21:43 +00:00
drh
bc30e2023b Improvements to integer/float comparisons on architectures that lack a
"long double" type.

FossilOrigin-Name: 5139ea62a8a6c6dc6558c337de39bcbadd26f6515742263387be03c862c78cf0
2018-05-18 14:24:23 +00:00
drh
8d1751b6fa Remove incorrect NEVER() macro added by the previous check-in.
FossilOrigin-Name: 3d6625111319c0356c57aaf7b7460fd882c3f00ca668dc43c0abe3403c7c2ba3
2018-05-18 14:19:35 +00:00
drh
6c319e1238 Improvements to the sqlite3IntFloatCompare() routine for systems that
lack the long double type.

FossilOrigin-Name: ea6a03a89dc23e860e53e79ec3fddf0ae7072a23b73aef3d2d181b426566b677
2018-05-18 13:39:00 +00:00
drh
be4ccb2838 In the CLI with the -A command, if the file does not previously exist and
its name looks like a ZIP archive name, then create it as a ZIP archive.

FossilOrigin-Name: 33dc8fad7f2b467f259eb78eb7342a760f01d54d95da7fe4cace10e558788a58
2018-05-17 20:04:24 +00:00
dan
e2f781b9d1 Evaluate multiple window functions in a single pass if they use the same
window definition. Add xValue callbacks for other built-in aggregate
functions.

FossilOrigin-Name: c9f0f140941660ff368e5bb5752d54feb1964b7a9eac986d4bfb8f24a1c20d86
2018-05-17 19:24:08 +00:00
dan
2e362f9775 Handle multiple window-functions in a single query.
FossilOrigin-Name: 35af0b750e70dcf0f343b115f4bbd0860a7e8064be204d4dfba1a43c22ff07b1
2018-05-17 14:26:27 +00:00
drh
d0f9cdcc63 Improved error and help messages for the ".archive" command and "-A" option
to the CLI. If a memory leak in --list processing.

FossilOrigin-Name: 02541ac6f919a8a8b18ef0525c4ee24fdbc5c1883171fb1a492434cd0f006f7c
2018-05-17 14:09:06 +00:00
drh
1f22f62582 Fix memory errors associated with argv in the CLI when it is
compiled on Windows.

FossilOrigin-Name: 4474d69b5c21b4e6f0d1376fbceca0f18c715ff673aea63053a02bfbe041d03b
2018-05-17 13:29:14 +00:00
dan
86fb6e1738 Start of experimental implementation of SQL window functions. Does not yet
work.

FossilOrigin-Name: 3781e520854808fe02ad3fe77dd11fc917448c58ff1fd79123289dd91937decd
2018-05-16 20:58:07 +00:00
drh
26fb126622 Fix an issue with rtreecheck() and auxiliary data columns.
FossilOrigin-Name: 46715136078a51ca7dd08b83214d6ad0e85728af8a26cd342077b8dd4ada1d60
2018-05-16 19:56:20 +00:00
drh
7578456c25 Do not allow auxiliary columns in the rtree to interfere with query planning.
Begin adding test cases.

FossilOrigin-Name: 9abe023e1afa7dc1a7eba7fbb3128401de129873d86b7c71c221decca26a821c
2018-05-16 19:07:07 +00:00
drh
1e76c22b4a Fix the OOM issue mentioned in the previous check-in.
FossilOrigin-Name: c489d8e44eac4cd355096ab66bb40f13ef662f31e080c9f1f2ee379fe55b207a
2018-05-16 18:18:24 +00:00
drh
e297196524 Initial implementation of the ability to have auxiliary columns in an rtree
virtual table that store arbitrary content.  It mostly works, but there are
some minor issues in OOM corner cases.

FossilOrigin-Name: 0c87fec970221f954e0a92f3ef0437b382255479fac5b403ee37b1bb5ab29719
2018-05-16 17:57:30 +00:00
drh
f80bba9d8d Enhance the sqlite3_str_new() interface so that it always returns a valid
and non-NULL pointer even in an OOM condition.

FossilOrigin-Name: ed5b09680fd6659ebbe5ace3c1c56f3962bbd75cfdf65c7565651900cf87917a
2018-05-16 15:35:03 +00:00
drh
dd7460f0fd Correct output for the fullkey column of json_each() when the total JSON
input is a simple value, not an array or object.

FossilOrigin-Name: b45b18850c59f22a163ee482f529f578a8798f96d0e26b5a061d336d480a1540
2018-05-16 12:19:11 +00:00
dan
a44005af4f Fix a test case problem in wherelimit.test.
FossilOrigin-Name: 3012df8b2c0b19d27260f389147a96c501aee9a4aee3813834cc9e438dbacede
2018-05-15 09:09:00 +00:00
drh
492ad131bd Make more aggressive use of automatic indexes when processing materalized
views and subqueries.

FossilOrigin-Name: 172f5bd27e47cbdaaab54fe4383a5ee505d285257af6153ed626d9493a4adab3
2018-05-14 22:46:11 +00:00
drh
a090ab90d6 Convert the schema creation logic in the rtree extension to use the
new sqlite3_str interface.

FossilOrigin-Name: fd8b8c4196d3f0f6cb129f43ebf473ada86eefdf16181fa70ceee21e1232b5e1
2018-05-14 15:26:05 +00:00
mistachkin
a3926f4bbf Fix typo in the shell.c source file.
FossilOrigin-Name: 389dc0a901b0ce54c3c773d63e5b288f6dd28b96dffc4b77861db89b275b57d6
2018-05-14 12:23:04 +00:00
drh
fc97c1c8cb Export the deduceDatabaseType() function the shell.c source file.
FossilOrigin-Name: d0f35739af3b226c8eef39676407293650cde551acef06fe8628fdd5b59bd66a
2018-05-14 00:41:12 +00:00
drh
69ed38a822 Add the --append option to the ".backup" command in the CLI.
FossilOrigin-Name: 0dfdbdee527b0c429703bc2696bf8d8e44a852aafe0aca742b9d7152eb1f932e
2018-05-14 00:23:08 +00:00
drh
1615c37e48 In the CLI, allow comment lines that begin with '#', but only in a context
where a dot-command is allowed.  In other words, '#' at the beginning of a
line in the middle of an SQL statement is just part of the SQL.

FossilOrigin-Name: 4ee136d6d2e029dad8371faf659d3a0bc0ac6ae76940db81d333848545bc990f
2018-05-12 23:56:22 +00:00
drh
fc29a86eee In the CLI, return non-zero if there are errors on the command-line.
FossilOrigin-Name: 13e7300a37e379eac564594d78d3f039fd25737493b3b627ef02fab57a6c98e1
2018-05-11 19:11:18 +00:00
drh
003edba0da Fix a typo in the help message from the ".sha3sum" command in the CLI.
FossilOrigin-Name: dba87a201806f93a1736c1ee81d9c9cf9848e401a237dc2af3b4376402976c32
2018-05-11 15:10:43 +00:00
drh
f2072d136d Make sure the open_db() routine in the CLI does not invoke access() with
a NULL filename.

FossilOrigin-Name: 20a8c61122f37a43c418ca4415b3d26e0f7a27a6faea9048aa9fbb1a56e9d629
2018-05-11 15:10:11 +00:00
dan
cb38809159 Add a test case to check that the fts5 unicode64 tokenizer is dealing with
codepoints greater than 65535 correctly.

FossilOrigin-Name: 9f7a6ae878cd17ff4de7c55e654406773e0ea2b9fe1c4e2a9fc2b0da84d059a4
2018-05-09 16:32:00 +00:00
drh
f0f9dbd384 Add 14 new interfaces to the loadable extension mechanism.
FossilOrigin-Name: 0e809cdcbd1bb1e269298814d6bb1dcdaea48c5b0bb20e0e1caa4dba27654873
2018-05-09 15:17:02 +00:00
drh
446135d724 Fix minor problems with the sqlite3_str interface.
FossilOrigin-Name: 43ea8a6836ccb9910314d35e07d881694200c97ef5969629f62e49f7a2a42f92
2018-05-09 14:29:40 +00:00
drh
0cdbe1aee0 Make the internal dynamic string interface available to extensions using
the new sqlite3_str object and its associated methods.  This is mostly just
a renaming of internal objects and methods to use external names, through
there are a few small wrapper functions.

FossilOrigin-Name: 87f261f0cb800b06ad786f6df16f2c4dddd0d93dfdcc77b4a4eaa22920b56bf1
2018-05-09 13:46:26 +00:00
drh
721e8539c3 Fix a typo in a comment used for documentation. No code changes.
FossilOrigin-Name: b866693e6a50b5c41ca54b56bb20753efb94980ad3365c511cccf23ac43a1c23
2018-05-09 10:11:44 +00:00
drh
4c54045372 Correctly format the STAT1 and STAT4 content in the output from the
".fullschema" command in the CLI.  Fix for ticket
[e63a34a0045832dc850367552].

FossilOrigin-Name: 0c3f128fd7d5738a8e9da706f5f30aa1985ef5efab70ddaad28ef6b641b04f4a
2018-05-08 23:17:36 +00:00
drh
f2cf412a0a Fix a harmless compiler warning in fuzzcheck. Add new OSSFuzz test cases
to the test case library.

FossilOrigin-Name: d2619746cb233f4be127a77988548dd1d90eebddf0d0ac9107913b240553e5d0
2018-05-08 13:03:31 +00:00
drh
5ecf9039b0 Fuzz test cases for UPSERT.
FossilOrigin-Name: fd11fbd21893d520de5a2249f825ecb5839fa4943f5c207e9e9bf8b52f4e2695
2018-05-08 12:49:53 +00:00
drh
89ee229810 Activate the cell-overwrite optimization for index b-trees.
FossilOrigin-Name: a68697d10ef17d452c8279181186faad7bc54e3a35858a336552f717449065ea
2018-05-07 18:41:19 +00:00
drh
d720d394d0 Improved comments on the cell-overwrite optimization code.
FossilOrigin-Name: a4fe966da2fc479b18bf521ff596000410af3a611f7d8723d126795e595ccf22
2018-05-07 17:27:04 +00:00
drh
e3c05a5597 On an UPDATE, try to overwrite an existing btree cell with the modified
content, if the old and new cell are the same size.  Use memcmp() first
to avoid dirtying pages that are unchanged.

FossilOrigin-Name: 5887d8beb502ad62689d31b850f46ab50831a1e9db36adf20d55ad45619d207e
2018-05-07 11:48:22 +00:00
drh
e2188f0b0f Fix harmless compiler warnings associated with the new EXPLAIN QUERY PLAN logic.
FossilOrigin-Name: 374d8e264487b0437a8d995ced1bc026a92d495a2d0568f65f033e9ebe11d0e2
2018-05-07 11:37:34 +00:00
drh
30f7a25325 Fix harmless compiler warnings in the cell-overwrite logic.
FossilOrigin-Name: 3e11dc3183bc3e8ec49af244a8e8b3e07d12f7a2e59028b2bf64ce0ab589a91f
2018-05-07 11:29:59 +00:00
drh
60208c34bb Backout change [05fee1a21ea398f1e4d6f1cf3] because it does not take into
account the LD_LIBRARY_PATH environment variable used by dl_open().

FossilOrigin-Name: b348d1193a7a3ed4d3e656b6cc95a41f87eae29222e0723850a5eb5ffabffd00
2018-05-07 02:50:38 +00:00
drh
c6f36fa33a In an ORDER BY LIMIT, make sure the ORDER BY expression evaluator does not
try to reuse values from the result set if the result set has not yet
be computed.  This fixes a bug in the recent deferred-row loading 
optimization, check-in [c381f0ea57002a264fd958b28e].
OSSFuzz discovered the problem.

FossilOrigin-Name: 5d61e75f32de09c81dbe844443209f063cccb005d60b846900de5b023643fc3b
2018-05-05 16:50:35 +00:00
drh
6fcf83a503 Fix a slightly incorrect corruption detection branch in the btree logic.
FossilOrigin-Name: 9191ff670cb7f36e0b2dac4a22888679b639845687aef8edcc3c05e35ba71eda
2018-05-05 01:23:28 +00:00
drh
cb737dc29e Merge enhancements from trunk.
FossilOrigin-Name: 9650f71b82ca1b3759e776bbd8a2e8ca61c51f80038e37c9c9a675a8c13b0b06
2018-05-04 19:18:27 +00:00
drh
e3d511c078 Fix requirements marks. No code changes.
FossilOrigin-Name: 7fdad122a21e4b01bd678198fd5131dc32febe3af366bd6368505398255f9822
2018-05-04 18:32:11 +00:00
drh
e632ae796a For the amalgamation-tarball, enable FTS5 and JSON1 by default and
provide a new --enable-debug option that actives debugging facilities.

FossilOrigin-Name: 03edecaf9dcfc927aa60c2a17590a432b17de1647d480d277b4aafc8018c2d20
2018-05-04 04:49:55 +00:00
drh
5d72d9245d Make a separate limb in the EXPLAIN QUERY PLAN output for the various lines
associated with the OR-optimization.

FossilOrigin-Name: 75ac7b4e4fd0811ca80c719badacff207e0bbd00ac64dde3b3d4ec676fad472d
2018-05-04 00:39:43 +00:00
drh
4388522561 In ORDER BY LIMIT queries, try to evaluate the ORDER BY terms first, and it
it becomes clear that the row will not come in under the LIMIT, then skip
evaluation of the other columns.

FossilOrigin-Name: c381f0ea57002a264fd958b28e4921cb9c9e73a10fb592f6bb64e6bc9bd16d39
2018-05-03 23:20:06 +00:00
drh
5e8b9853da Fix a branch that has become unreachable due to recent enhancements.
FossilOrigin-Name: 81ab5e0d106fb9f2de80d17c8167d8542c6721b8d7ec69c43e1571c2dcadeddd
2018-05-03 22:52:56 +00:00
drh
34b27edc80 Improved security for VACUUM. This check-in combines the fixes
of [ab0d99d0b5ede] and [27754b74ddf646] in a way that is less likely to
to be broken by future changes.

FossilOrigin-Name: 260fc696538b195e8decabaab46771f664fb829b539efa86fb0b8170db01fa0a
2018-05-03 21:51:30 +00:00
drh
98b677f2cb Overhaul of EXPLAIN QUERY PLAN. The output is now in the form of a tree.
More details of the query plan are shown, and what is shown is truer to what
actually happens.

FossilOrigin-Name: ff01bbdabc4b9db3db8b928979442c91b32d72082158e4f5fe62ae51a73649d2
2018-05-03 19:56:50 +00:00
drh
4d79983ca5 Optimizations to the new EQP framework.
FossilOrigin-Name: 956fef361a795bd081d8e23ce4075dc8aafcee63ab7275d13b657b529d185b30
2018-05-03 19:47:14 +00:00
drh
d5aa9262a6 Fix various error handling conditions on the cell overwrite optimization.
Fix a test case so that it works with the new optimization.

FossilOrigin-Name: f89b54f41405ed7e28132f66b8a0c690a087c2412c8f55790c2beabb0b521645
2018-05-03 16:56:06 +00:00
drh
da65fc6e32 The BtCursor.info fields are only valid if info.nSize!=0.
FossilOrigin-Name: 54c537eead5b08104cfaf0d5b1e2706e53d6f74be2ca02e06229024fd889fc94
2018-05-03 14:07:18 +00:00
drh
4f84e9c7e2 Add more corruption checking to the cell overwrite logic.
FossilOrigin-Name: 58d14afe1e1288d114ea213458b3121e0a95670887861928858b7f143c76f789
2018-05-03 13:56:23 +00:00
drh
9b03192e15 Bug fixes in the overwrite optimization.
FossilOrigin-Name: 0cb6cd2a6a596afaa1cca6c5f5abc2ea75d04f254c7debaf36ecd6a90b66aed6
2018-05-03 12:57:48 +00:00
drh
3de5d16cf7 The sqlite3BtreeInsert() routine tries to overwrite an existing cell with
modified content if the new content is the same size.  Pages are only dirtied
if they change.  This prototype works some, but still has issues.

FossilOrigin-Name: 489451b378819621537231c1c8a07704437e11c1f5384fd53b09f3977d2213a4
2018-05-03 03:59:02 +00:00
drh
fa16f5d9d6 Enhance EXPLAIN QUERY PLAN to report the generation of constant rows using
VALUES or just a SELECT without FROM.

FossilOrigin-Name: c75eee69fa8a9b56ee58a4cc539e80cc982f43390dc3a357344d58479dd89a41
2018-05-03 01:37:13 +00:00
drh
cdf88760da More test case updates. Tests are all running now.
FossilOrigin-Name: dab5e5294813891469660cceb211ac1a1e526715bb57dcdbb1ab90321e6a4dad
2018-05-02 19:42:33 +00:00
drh
b3f0276b9e Fix test cases so that they work with the new EXPLAIN QUERY PLAN output
format.  Only some of the cases have been fixed.  This is an incremental
check-in.

FossilOrigin-Name: 5f0e803e33aa557865d5fc830d9202d628de9a94c9757058ca48f1a560702cd3
2018-05-02 18:00:17 +00:00
drh
84a01debf9 Improved EQP output for recursive CTEs and multi-value VALUES clauses.
FossilOrigin-Name: f2f525548c65f89f55cbe91da8a21512dedc6f7b68b58b7906d653e800a2963a
2018-05-02 16:13:48 +00:00
drh
85a40ebc03 Prevent VACUUM from running any commands in sqlite_master.sql other than
CREATE statements.  That is all that should be there anyhow.  This fixes
a problem discovered by OSSFuzz.  Test cases in TH3.

FossilOrigin-Name: ab0d99d0b5edece4c639baa47ce1ca2c02774cb2515e5b7f36d9bd312ccd3310
2018-05-02 15:00:26 +00:00
drh
03c3905f94 Fix a dangling-else problem that was causing recursive CTEs to malfunction.
Begin fixing test cases to work with the new EQP output.

FossilOrigin-Name: 82ca44b82fed6814c84440ba8bfaa019488ab956e84ac165180e2fcece6facb2
2018-05-02 14:24:34 +00:00
dan
fa5c69f5cb Fix a problem in the xBestIndex method of the closure extension causing it to
allocate non-contiguous argvIndex values in some cases (an "xBestIndex
malfunction" error).

FossilOrigin-Name: 0c67150749cb3d067e14b2dcac9c3489e0f14bd18c0387f1d9bc93d21fc96fe5
2018-05-02 08:12:22 +00:00
mistachkin
07430a8caf Add sqlite3_win32_set_directory8() and sqlite3_win32_set_directory16() functions.
FossilOrigin-Name: 22089ea2bbea93eb1da7f08344789a5455077169443e40025f053d2a117f1c08
2018-05-02 03:01:50 +00:00
drh
c631ded5e8 Improvements to the EQP display for compound select statements.
FossilOrigin-Name: 699a77e479010a331b0423f157a2fbfc373688e3d0d04ae5e64376c00cb3d488
2018-05-02 02:22:22 +00:00
drh
e2ca99c907 Begin reengineering the EXPLAIN QUERY PLAN function to provide more
intuitive output.

FossilOrigin-Name: 70b48a7972dfbb44af3ccd8ccd830e984bec88d80a78b3566a5de86a16e7fc14
2018-05-02 00:33:43 +00:00
drh
8c2e6c5fe0 The SQLITE_ALLOW_SQLITE_MASTER_INDEX compile-time option allows a CREATE INDEX
statement against the sqlite_master table.  Once created, the index works, and
is usable by legacy instances of SQLite.

FossilOrigin-Name: 853f3163597b9946c0cbeb808ea6fd33a0cf48ae6b8f4459c4165db377f33a9e
2018-05-01 18:39:31 +00:00
drh
bbd4ae5a2f Defer loading result column values into registers on an ORDER BY LIMIT until
we know that the LIMIT does not exclude the current row.

FossilOrigin-Name: ce4ef46058f4aaea6623a41255a2e4b69bb24f16a287391df48f6bacdb4c4989
2018-04-30 19:32:49 +00:00
drh
b57e3ec5d8 Test cases added for SQLITE_DBCONFIG_RESET_DATABASE.
FossilOrigin-Name: 08665a9e2e50a0a1e62529884cf65f8090debe89a306a3904b53268729ab5ad5
2018-04-28 19:08:02 +00:00
dan
2b137d65f5 Fix an RBU problem causing spurious SQLITE_CONSTRAINT errors when restarting
an RBU update in which more than one source table writes to a single target
database table.

FossilOrigin-Name: 564ae8297d417ba4b7978e430d41f125007177673163f6ed9adc3a3974f73d24
2018-04-28 18:20:01 +00:00
drh
a19d09677b Add the SQLITE_DBCONFIG_RESET_DATABASE control for resetting a corrupt
database file without closing any database connections.  Added the
".dbconfig" command to the CLI.

FossilOrigin-Name: a200a49edeaca5a787a3036070f7ced3cb6e9495f8afe7b74d5cde02c79b20dc
2018-04-28 13:21:00 +00:00
drh
7df011969c Add the SQLITE_DBCONFIG_RESET_DATABASE control as a replacement for
the reset_database pragma.  Resetting the database should be hard enough
to do that it cannot be done by accident.

FossilOrigin-Name: ff836cb8b0377c5970ecb2b797702e2b5d208eda443ecbd55f4c238a3094b28a
2018-04-28 12:43:16 +00:00
drh
46462e35d3 Merge updates from trunk.
FossilOrigin-Name: 94877e495c563f101b51cd8891ca7665c7aab87ff526157f1dc1781e0a2a5d87
2018-04-28 11:22:53 +00:00
drh
1efa8023a1 Prevent deep recursions on nested COLLATE operators.
FossilOrigin-Name: 6e098ee415f1a530e17a942c9ba51d67c25a3ebff6b97377b7858d0b10bcec92
2018-04-28 04:16:43 +00:00
drh
6bfd973ce6 Fix compiler warnings in FTS3.
FossilOrigin-Name: de508e831a43f02c3b354a24ea34798da03c163bae5521c852c9ddd252723739
2018-04-28 04:10:55 +00:00
mistachkin
542805d174 Document and expose sqlite3_win32_set_directory() function for use on Win32.
FossilOrigin-Name: 7626b593405ca720e371b9f698b72b499b7c829bfe00f758140bc542cf970689
2018-04-28 01:46:22 +00:00
mistachkin
c1e1ffeafb Add comments about the intended use of the sqlite3_data_directory variable as it pertains to the sqlite3_win32_set_directory function.
FossilOrigin-Name: d11c419756ce28fcc1f58df6bbe59a3d8d19d0441970aa7bfa216ba915ceddf5
2018-04-28 01:44:27 +00:00
drh
0314cf3aa5 Add the "PRAGMA reset_database=ON|OFF" command. When on, it causes the
database to appear to be empty, causing the next transaction to reset it to
an empty database.

FossilOrigin-Name: 02e1a13c1f04bb72599b98f51240c78d0d050de264fef5808fd97db3f4c16dac
2018-04-28 01:27:09 +00:00
mistachkin
95d5ae19d1 Document and expose sqlite3_win32_set_directory() function for use on Win32.
FossilOrigin-Name: cbce7180ee664367ee8fc1f8af703eb7845bb58ade6870cc3b7608dcbe5952b3
2018-04-27 22:42:37 +00:00
dan
03db962ab5 Update test script fts3expr4.test so that it always creates fts3 tokenizers in
the "en_US" locality.

FossilOrigin-Name: 576a8f69ae25883f752e58953624e9f7126db998bebaa1f07f7c2ec47aaecabe
2018-04-27 18:05:01 +00:00
dan
0ef54fa6e8 Fix a test script error causing tests to fail in soak.test.
FossilOrigin-Name: 462b52b121c1882e0eca819bc30c0f6e94d7fdd60047d2c32adeff3a1eb70546
2018-04-27 16:35:44 +00:00
drh
ef9e3d78f2 Enhance the comments in the templatevtab.c implementation.
FossilOrigin-Name: 05f6278a02e5cde89f76ced5af7d508e26576d7291dad7ee9e06b1a3be516cb0
2018-04-27 15:17:08 +00:00
drh
6876dccbfe The previous fix for ticket [d85fffd6ffe856092ed8da] in check-in
[0a514e62ad1ebe5c12da8dae] did not completely address the
probably in that it only worked for cases where the OP_SCopy that loaded
the register was the last instruction in the sequence for the expression, which
is not necessarily the case for expressions like CASE...END.  This revision
prevents the registered that will be recomputed from being cached in the first
place.

FossilOrigin-Name: 9fd0faf517993587d2f54212638545fc85fbbc84a031bcfae8c1e5894825d83b
2018-04-26 18:34:26 +00:00
dan
c040e2b186 When processing an "ORDER BY ... LIMIT" that does not use an index, check
whether or not a record may appear in the final result set before adding it to
the temp b-tree used for sorting.

FossilOrigin-Name: 0fcfc36ceb820fc70136b799a0405fe92e50646e697be2872bbe9a53a05ed5a9
2018-04-26 17:43:35 +00:00
dan
f226f03d4f When processing an "ORDER BY ... LIMIT" that does not use an index, check
whether or not a record may appear in the final result set before adding it to
the sorter.

FossilOrigin-Name: 71bf91c218334381b1b4bdba6a093e623b62e17f3e8550e154a11f0cb0b404f3
2018-04-26 16:13:47 +00:00
drh
909066bba0 Ensure that new.* values of an UPDATE do not get clobbered after the
BEFORE triggers run when unmodified columns of the row being updated are
reloaded.  Fix for ticket [d85fffd6ffe856092ed8da]

FossilOrigin-Name: 0a514e62ad1ebe5c12da8daed429ae2f9d9910471d3c5cef3b6870bdadfefca1
2018-04-26 15:50:10 +00:00
drh
de7ca50dac Clarification of the behavior of a BEFORE UPDATE trigger when the trigger
changes the values of some of the columns used to compute new columns in
the UPDATE.

FossilOrigin-Name: 7bb23c2a3d37f0d5e5515b917860818906819d54a0066e1ba8e9792a82f7d279
2018-04-26 15:04:18 +00:00
drh
896494e8ad Improved VDBE comment on the OP_Param opcode. No substantial changes.
FossilOrigin-Name: 368c14da868a843767344f6cc17c499fddd83244c0510337ed9a918e64ee2413
2018-04-26 12:27:03 +00:00
dan
1e08074906 Update the "fuzz_malloc.test" script to print SQL statements in which OOM
handling problems are found to stdout.

FossilOrigin-Name: a956363cf6881be590120c7718976b54b12c4bd0d9228d8142b45e0fe1826f7e
2018-04-26 08:56:40 +00:00
drh
fc0ec3e5e8 Add new interfaces for accessing the list of SQL keywords:
sqlite3_keyword_count(), sqlite3_keyword_name(), sqlite3_keyword_check().

FossilOrigin-Name: 7dd34e3776fed90a49344d54a1b68bb59f7957b5a8a1a367087b7cafb63111c1
2018-04-25 19:02:48 +00:00
drh
7eabc44dee Add the new DO and NOTHING keywords to the keyword lists maintained
by various extensions and auxiliary programs.

FossilOrigin-Name: 77a98a0781cd8450e2100111e70526db6a51d7e58e3c505ea87f685388099e82
2018-04-25 17:10:30 +00:00
drh
d11b8f671f Add the new SQLITE_SHELL_INIT_PROC compile-time entry point to the CLI. This
is needed to work around the tighter sqlite3_config() constraints now in the
CLI.

FossilOrigin-Name: 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3
2018-04-25 13:27:07 +00:00
drh
b2c8559fad Avoid many unnecessary calls to sqlite3ReadSchema() and sqlite3Init() when
the schema is known to be valid already.

FossilOrigin-Name: 58cf812fd81329e82b3fdd61b7ad2040c9b90d2d80f592b9231e0e1902c8d577
2018-04-25 12:01:45 +00:00
drh
3215872446 Add an assert() to ensure that schema mutexes are held prior to accessing
the DB_SchemaLoaded flag inside of sqlite3Init().

FossilOrigin-Name: d8b46290bb75c695dac523cf9a50d1b43e773802e3b95fd722feca16162ab7c5
2018-04-25 10:30:46 +00:00
dan
ccb9eb782c Remove a recently added NEVER() macro from a branch that can be taken in
obscure circumstances.

FossilOrigin-Name: 2aa210030ae414782adab9291cc43a149a780f39bd3d306dc2892a8c20422a51
2018-04-24 18:59:18 +00:00
dan
820fcd2ce9 Fix a problem with processing "LEFT JOIN tbl ON tbl.a = ? AND (tbl.b=? OR
tbl.c=?)" in cases where there are indexes on both tbl(a, b) and tbl(a, c).

FossilOrigin-Name: ce35e39c5cc2b00dd6b4a9ffaa9d5eb7d9b862759e87d5f053729de7643eee9c
2018-04-24 18:53:24 +00:00
drh
c447595df5 Do not attempt to use terms from the WHERE clause to drive indexes on the
right table of a LEFT JOIN.  Fix for ticket [4ba5abf65c5b0f9a96a7a40cd18b]

FossilOrigin-Name: aeb694e3f787f1f8b55650c17f90c197eee3f7f9b890a88f458c33e43009a082
2018-04-24 17:34:03 +00:00
drh
cd90ca7ded Update the expert extension test cases to account for the fact that
EXPLAIN QUERY PLAN now shows the start of each trigger in its output.

FossilOrigin-Name: 8acb42f48929d908fe67a8536e240ca252a9ab780dce79eaa85b8fba35d52250
2018-04-24 16:51:38 +00:00
drh
cb23e5d5d1 All the OR optimization to proceed even if the OR is also converted into
an IN operator.

FossilOrigin-Name: e252c6540db266b93beeb47a8f7dbf3b275f8c782cd2d36ba4c00648c382f63f
2018-04-24 16:41:37 +00:00
drh
5776c139a4 Add a hyperlink to the ticket on the code comment for the fix to
ticket [7fa8049685b50b5aeb0c2].

FossilOrigin-Name: 45247c7f291bc0cc42600a4aa4ff7cdcd0a703fdfadcb0e12174c5250e70d503
2018-04-24 14:18:49 +00:00
dan
4da04f784f Do not attempt to read values from indexes-on-expressions if the index is on
the RHS of a LEFT JOIN. This won't work if the index cursor points at a
null-row. Fix for [7fa80496].

FossilOrigin-Name: b8ef967ab1bebf2846c06c4f7200d6fa1c60e52e55711ea171c25ef1331f8a24
2018-04-24 14:05:14 +00:00
drh
4b5345ccc7 Enhance the CLI to render EXPLAIN QUERY PLAN using an ASCII-art graph.
This works with ".eqp" modes and when the query begins with exactly
"EXPLAIN QUERY PLAN".  To see the original output format, add extra space
characters in between words of the initial "EXPLAIN QUERY PLAN".

FossilOrigin-Name: f53716ee2ab5a6d47a5551529aae526bb39058f4a8e11e6243b32c1ddc25a19e
2018-04-24 13:07:40 +00:00
drh
4d3e61403a Fix a memory leak following failure to open an external CSV file in the
csv.c extension.

FossilOrigin-Name: 526ee07d19dbc8fd1af3a02a8da12b337020a4be40e045da9a19d0a7c2b6ab54
2018-04-24 10:57:10 +00:00
drh
8349c11d02 In EXPLAIN QUERY PLAN output, do not show an EXECUTE LIST SUBQUERY line for
IN operators where the RHS is a list and not a subquery, since in that case
there is no SUBQUERY to execute.

FossilOrigin-Name: 8bc0207abdeeb3ffac003703e78826759f07994698f6cdf40c89c3443ba22a47
2018-04-24 01:10:12 +00:00
drh
5279af8061 Fix to check-in [ca34c2dd20ee071e] - avoid a NULL pointer dereference
following an OOM.

FossilOrigin-Name: c7e6e848fa91f61bc980a031a17d4cd4784f93a1c9ffee35665efa1a59f2982a
2018-04-24 00:08:09 +00:00
drh
f49ff6ffb3 Fix a problem in sqlite3ExprCompare() associated with UPSERT.
FossilOrigin-Name: 67d0b2c15299dd20bca7254ecb33e71b5eee6024e2709bfdc36f877bf2a5679f
2018-04-23 20:38:40 +00:00
drh
fbe07539d3 Fix a formatting issue in the TreeView output for bare expression lists.
FossilOrigin-Name: a6356817815fe986c4d89475194e0537ebd46582d6df1034482bf08521182bdf
2018-04-23 20:04:38 +00:00
drh
48d219af4c Add the ".imposter off" variant of the ".imposter" dot-command in the CLI.
FossilOrigin-Name: d3dad06ff1b163040c54dd215f30d6669cc2bc339001a362605f26f06eddf98c
2018-04-23 18:38:48 +00:00
drh
f20609d107 The ".selecttrace 0x2000" command causes just the top-level parse tree to
be displayed, after all transformations, and showing the EQP iSelectId at
each level.

FossilOrigin-Name: ca34c2dd20ee071e6f8d60f91dbf474515a688ba57949143483da1641246cb25
2018-04-23 17:43:35 +00:00
drh
e2243d26f3 The ".selecttrace 4" command now shows only a single parse tree after
name resolution.

FossilOrigin-Name: 5682146e8a4ebb4edc1e1b53fbf3daf77f8cb9cd9bc2aa32acb34fa5824bd518
2018-04-23 17:18:03 +00:00
drh
1bddf23b89 Do not restore the iSelectId value until after the last SELECTTRACE when
debugging Select processing.

FossilOrigin-Name: 8088d8cac317adb96e357a8f4a196d7c1e0115af9c2335f167b4d7e7154299b0
2018-04-23 17:09:58 +00:00
drh
b3b0d317e0 In the ".selecttrace" output, include the EXPLAIN QUERY PLAN iSelectId as
part of each Select identifier.

FossilOrigin-Name: 5c6339f955eaa550c7d112488d7830e67ceacba4fbba12e1c5ce2970980159e0
2018-04-23 17:02:14 +00:00
drh
4751b87f19 Ensure that there are no bind-parameters or incorrect schema references in
the UPSERT portions of an INSERT within a TRIGGER.

FossilOrigin-Name: d47a6bdda0ce967a7b70bc6eb56278c8b79525622381ff4adcf04525eafc1461
2018-04-23 13:28:55 +00:00
drh
05ef50d08a Fix an unreachable branch associated with stack overflow in the
LEMON-generated parser.

FossilOrigin-Name: e3064ba3b68ca2a1c54561756e8c898866a19ef6e785d315171cd47827a50c85
2018-04-23 00:25:31 +00:00
drh
fd39c5874a Performance improvements on the main loop of the LEMON-generated parser.
FossilOrigin-Name: fec1ebadeb9d6b55b19a1c159c543fd7ae67b3307c4caee4d2541bd783630e23
2018-04-21 22:40:08 +00:00
drh
539e741e50 Enhance LEMON to track which symbols actually carry semantic content.
Output the list of symbols that do not carry content at the end of the
report, but do not (yet) do anything else with the information.

FossilOrigin-Name: dcf2bafc159179859b91ffea3a4ebd70b5ca6de9e1d515eaf9afde8cfff26c6c
2018-04-21 20:24:19 +00:00
dan
42d181604c A few more tests for upsert.
FossilOrigin-Name: b78005b6d41640203c163ffde4faf9336f11f47f42e8b7fe10b95415bbaed028
2018-04-21 14:11:18 +00:00
drh
fb32c44e41 Add the %extra_context directive to lemon, as an alternative to %extra_argument.
Use this to improve the performance of the parser.

FossilOrigin-Name: be47a6f5262a43f477700579512fe7112a0872faedcbbe5c3383d13a08af6440
2018-04-21 13:51:42 +00:00
drh
f3d7bbb767 Fix UPSERT so that it plays nicely with AUTOINCREMENT.
FossilOrigin-Name: 359725ab36339b443b7745e84f6d27991038ceb063c653805dde17f3eb5a03c5
2018-04-21 03:06:29 +00:00
drh
9f88e6d861 Add the -dDIRECTORY command-line option to LEMON.
FossilOrigin-Name: 9cd20475ff3b2ca1a58e441194c921780d25bdb9b9c744a6b4541b888194efb8
2018-04-20 20:47:49 +00:00
dan
340e9e125b Enhance the "rbu" command line utility a bit.
FossilOrigin-Name: 61eb516f83d1a7fe44f72bebe2a2745ab904a02e06e38fb6d932348c49607976
2018-04-20 20:37:25 +00:00
drh
4b8bd84302 Fix a harmless compiler warning.
FossilOrigin-Name: d2ab24f59d92527fe503fa7dc2128078fbc4dd2d2c1148effa9ea1957ab19940
2018-04-20 20:09:22 +00:00
drh
7c48360d7c Avoid the use of statement journals on DELETEs of a single row without
triggers or foreign keys.

FossilOrigin-Name: 20bf5800808ea02b2aa4bf01a380926784c0e7514a2c73ca303cac1f5c732ae0
2018-04-20 19:46:52 +00:00
drh
ac9151d848 Avoid opening a statement journal on single-row UPDATEs without triggers or
FK constraints.

FossilOrigin-Name: 2772404b8c570caf3c31d2b0530cf347a24f6f60e220e726c086537b38ebfa85
2018-04-20 19:32:35 +00:00
drh
9cadb2308b Fix a VDBE comment on upsert. Provide an error message when upsert detects
index corruption.

FossilOrigin-Name: 279c48f6061f766f5437edd6964c0dd1e10399314eb17b6e5ee34df925a776ed
2018-04-20 18:01:31 +00:00
dan
224d92c8c0 Add tests for name resolution in ON CONFLICT clauses.
FossilOrigin-Name: cf253584ecf7aed04406b4bae78b536818fadfb3fb96c05f2c99954b841db85f
2018-04-20 17:50:49 +00:00
drh
4da91eed80 Avoid unnecessary cursor seeking when performing an UPSERT.
FossilOrigin-Name: 693a3dcbdd8fb2d516c0f46fdbb478838cde675afc1026740e942705aac3c07f
2018-04-20 17:02:16 +00:00
drh
023e89760f Improved VDBE comment on UPSERT code.
FossilOrigin-Name: 131ed95e1452a5b0d92341c48a5d3915b328ccfce2cf605f702428ae7ee3e21b
2018-04-20 16:49:51 +00:00
drh
5deb1813cd Minor simplification of the previous checkin.
FossilOrigin-Name: d1906689abdb685f78aa97bca4bf301204d12846016d27bc86dcc9ce2b024d24
2018-04-20 16:27:57 +00:00
drh
fb2213e1ff Avoid unnecessary cursor seeks during upsert processing.
FossilOrigin-Name: 7c4b6d5475092a3e205f01a6972366e27a404568e8e7ba327f2feefac2ce2c7c
2018-04-20 15:56:24 +00:00
dan
a46838cb13 Add test cases for UPSERT. And a fix for a "REPLACE INTO ... ON CONFLICT"
statement where the new row conflicts with both the IPK and the ON CONFLICT
indexes.

FossilOrigin-Name: d8eb9f8d9b61400c7e12f01ef5c233257b03532221f7c7a8386f7ac2db439626
2018-04-20 15:34:08 +00:00
drh
7fc3aba862 Enhance UPSERT so that the UPDATE uses the same set of cursors as the INSERT.
FossilOrigin-Name: c37f39d18d41ae5ba6c4561d87cbbf71f3b6896b86cc5cff9cdf046b02dc521a
2018-04-20 13:18:51 +00:00
drh
2ac4e5cca9 Minor simplification of the cursor allocation logic for update.
FossilOrigin-Name: fdf71be65835e7e8915d16dd64114de35c4754ef5b94a2af6cac88a94817fb75
2018-04-20 00:40:19 +00:00
drh
7963691314 Fix the handling of "PRAGMA count_changes=ON" with UPSERT. Also improved
the implementation of count_changes in other places, without changing the
behavior.

FossilOrigin-Name: c6f71115eb933c2aee295bc31e5139112463c28e15a3b3ea242fd9bac168aed9
2018-04-19 23:52:39 +00:00
drh
2633b28983 Minor simplification to the upsert logic.
FossilOrigin-Name: e657c1d60f5fca9464e9bcab24bc328855bec9986e0a029877f639355da4b201
2018-04-19 21:29:52 +00:00
dan
a67d02f509 Modify a test case in zipfile2.test to take into account that with some
platform/file-system combinations it is possible to fopen() and fread() (but
not fwrite()) a directory.

FossilOrigin-Name: 893e6089c875e947ddadb23f031a81bc36da8b060d2212363098992ddb90378b
2018-04-19 20:06:10 +00:00
drh
482dc64505 Add the --upsert option to the wordcount test program.
FossilOrigin-Name: ee1e750baaf4c66b4e1f103d8b80362f57e711ac601e57f99ed6a33913f443d2
2018-04-19 16:52:37 +00:00
drh
55a3490cf2 Add the ext/misc/tmeplatevtab.c template for virtual tables. This is a
work-in-progress as it still needs improvements to the comments in order to
be useful as a template.

FossilOrigin-Name: 22358fb5495c727a4dde129128fe409a7b929a5ffa143b1e2879f84d7680ec3c
2018-04-19 16:14:59 +00:00
drh
bb6b1ca73d Fix a problem in the new upsert implemention, discovered by OSSFuzz.
FossilOrigin-Name: b6d5ea59fe83716f464e408b7eef0310c6d30b3493e3f966362db2e30b36e821
2018-04-19 13:52:39 +00:00
drh
5e3a6ebf34 Fix the table name aliasing on INSERT so that it occurs before the column list
rather than afterwards, just as it does for PostgreSQL.  Add table name
aliasing to UPDATE and DELETE.

FossilOrigin-Name: 861a2e2a4895f96a5d8e1730e744983b2ac4311d0c2cf201c0e59f409030d5d7
2018-04-19 11:45:16 +00:00
dan
dedff6be8a Add the "sorter-reference" optimization, allowing SQLite to be configured so
that some required values may be loaded from the database after external
sorting occurs for SELECT statements with ORDER BY clauses that are not
satisfied by database indexes.

FossilOrigin-Name: ef74090a40ceaef2fd93a7613ec99a191ce986811c852e96f4a19719f18af4f0
2018-04-18 19:56:14 +00:00
dan
52b3e340cc Minor changes to test script upsert4.test.
FossilOrigin-Name: 0cb83c84d10b89ef7a5504862566a609307c63e7571dd711d8b9f995d29e5a8c
2018-04-18 19:45:14 +00:00
drh
5a2e65ed63 Avoid a NULL-pointer deref following OOM.
FossilOrigin-Name: 413015c029d850d4ce7e66be1f59b57f291254240a958856378a62f5ac4a5092
2018-04-18 19:08:44 +00:00
drh
4e8b9925bf Fix a test case inside distinct.test.
FossilOrigin-Name: 61cb8a391a0c709340ac60ffd0c58f950567892a8404c2bec7b9b1f64b3cc5cf
2018-04-18 18:19:25 +00:00
drh
277434e9a7 Improved matching of COLLATE clauses within the ON CONFLICT conflict-target.
FossilOrigin-Name: 8f4376e52b6124986937a3837ad83a18863c3144ef3b438a0d5e9231bf6c8980
2018-04-18 18:18:12 +00:00
dan
370c32628f Add extra test cases for UPSERT.
FossilOrigin-Name: 7ea08d0750dd9e07d2ffea336127034800db14aa23e60adec384d338871bf53a
2018-04-18 17:56:37 +00:00
drh
e79f629985 Fix a problem in the sqlite3ExprCompare() function that caused two
dissimilar expressions to match if they have the same "COLLATE name" at
the outer layer.

FossilOrigin-Name: fb16348a5bd52752098c9aeacc3281c4e1e8eb5a868d131ea6c3271dc4226b40
2018-04-18 17:52:28 +00:00
drh
6651e10ee7 Add support for PostgreSQL UPSERT syntax and functionality.
FossilOrigin-Name: fba24aec235dd6f124c1ece66cdac485c9d96e0578c4fbacd8f49d7b767a5b4a
2018-04-18 16:03:36 +00:00
drh
5412eb5106 Fix the build for SQLITE_OMIT_UPSERT
FossilOrigin-Name: 32956519173ee49ec9dd9aa7952278eb4effe567493c6cb304e16f887df6bafa
2018-04-18 15:33:21 +00:00
drh
a90d84fe21 Add the --sorterref N option to the CLI.
FossilOrigin-Name: 902a40897f74ac8a3bc72ef84c2161ab308b5601381cc9eea18147bfefa978ce
2018-04-18 15:21:13 +00:00
drh
bbade8d1f6 Omit some code not used without SQLITE_ENABLE_SORTER_REFERENCES. Improvements
to comments used for documentation.

FossilOrigin-Name: f3596ab9eb1168dc75202e6f79e12c67d518b3a0659a0a629c707f43990fa7cf
2018-04-18 14:48:08 +00:00
drh
7590d09324 Remove an unused local variable.
FossilOrigin-Name: 9afeb0c88b211e3ad90697778ec8ebb80f216fe7078c3a2f51651c35d3828746
2018-04-18 14:04:19 +00:00
drh
3bc431550a Enhance ALTER TABLE ADD COLUMN to support "DEFAULT true" and "DEFAULT false".
FossilOrigin-Name: 594ebc69557095c9262db39129dd50a3dbf038556a3d2a3ea69b82ed4c61e2b9
2018-04-18 11:35:35 +00:00
drh
e7df892ad8 Add checks to the CLI that issue a warning if SQLite gets initialized prior
to the last sqlite3_config() call.

FossilOrigin-Name: 40b117347763ef67f6621d3665ca7f287eebfd7435e3178055a8c624eb06b2c5
2018-04-18 10:44:58 +00:00
dan
16a474273e Fix a problem in the shell preventing it from working with
SQLITE_OMIT_AUTOINIT builds.

FossilOrigin-Name: 89209000a205c685bb6bd941376ef16e507919d192d606c1be110ccf2921d9bd
2018-04-18 09:16:11 +00:00
drh
9916048b89 Add new testcase() macros and fix a bug that was revealed when trying to
cover all the new test cases.

FossilOrigin-Name: 266a99f7c068aadbd08157d1d495a428109ad7a32d872f8026e8db0f89c40f91
2018-04-18 01:34:39 +00:00
drh
54514c9813 Remove unreachable branches. 100% MC/DC in TH3 now.
FossilOrigin-Name: 558865d5c3c297155e1be5ea73effb46a995ea146bd745b23330c94782c6c45b
2018-04-17 21:59:34 +00:00
drh
7ef8a3e666 Added a comment on the assert() added to the previous check-in.
FossilOrigin-Name: 542547c1ce770a1427d3023d8c8fdcb2db7b1e017bc111e3484641f97e42381a
2018-04-17 20:09:27 +00:00
drh
7f5f306b84 Fixes to the logic for constraint check reordering during upsert.
Improved comments on constraint check bytecode.  Add an assert that
prevents the same label from being resolved more than once.

FossilOrigin-Name: 1ddbb0ff5586ef5ca987e4309979f24f95eea883ed68937094a2db2d61e75657
2018-04-17 20:06:24 +00:00
drh
2928546d04 During PRAGMA vdbe_addoptrace=ON, show calls to sqlite3VdbeResolveLabel()
in the debugging output.

FossilOrigin-Name: 9ff07a06cef6e04777d2d5b81f96e8626e835382e62320ecf17b3ff73573e23e
2018-04-17 19:29:58 +00:00
drh
6e341b9347 TK_REGISTER expressions nodes are probably not constant. Make sure
sqlite3ExprIsConstant() knows this.

FossilOrigin-Name: f3d91cad929cfbee8f621425f55b5f12e79567362cf8769a786adb3e1bbef214
2018-04-17 18:50:40 +00:00
drh
dedbc50811 Simplification to the upsert logic.
FossilOrigin-Name: f36d07a5b24cc48e3daa8b18dd34c50d9025c6c0ba019926610538b54f7b66ec
2018-04-17 18:18:05 +00:00
dan
2cc00423a0 Add some more simple test cases for UPSERT. And a minor fix.
FossilOrigin-Name: 27cd3b2fb2ad0cf2b36741bd1057cb7973954d40456e9db158261a38b049d2b5
2018-04-17 18:16:10 +00:00
drh
5015c9b50e New test cases for upsert.
FossilOrigin-Name: 907b5a37c539ea67c285c87399b494c7fe15014389a2ea3d49e90640b58946ae
2018-04-17 16:16:40 +00:00
dan
2e3a5a810a Add SQLITE_CONFIG_SORTERREF_SIZE configuration option.
FossilOrigin-Name: b25a7bb769b8397a00736bd922bd24b1200b2f82d36d42ecb4c3eb17efb4b84d
2018-04-16 21:12:42 +00:00
drh
f1a0223077 Merge the Lemon enhancement from trunk, resulting in smaller parser tables.
FossilOrigin-Name: 641f41722c68f1d51251b10d4d3d7c473d08ee999f6db20023ef6dcd4dc5f6e8
2018-04-16 14:36:34 +00:00
drh
ed0c15b52e Lemon enhancements: (1) Do not allocate space for the 'error' non-terminal
if it is not used. (2) Fix an off-by-one problem so that 'unsigned char' can
be used for symbol numbers if the number of symbols is 256.

FossilOrigin-Name: 3b7801acff91905d0e78e06121ebcf2664f6de5f605699dc8726ec9bcb558eb8
2018-04-16 14:31:34 +00:00
drh
0a6259f539 Remove the MySQL upsert syntax. As an optional alias to the insert table
name in order to finish out PostgreSQL upsert syntax emulation.

FossilOrigin-Name: 810d9f63be46c1452718b05e51c519fb64e9fabf2f1813b5e07b1041dbb71880
2018-04-16 13:26:53 +00:00
drh
eac9fabbc9 Add support for the "excluded.*" names in the UPDATE clause of an upsert.
FossilOrigin-Name: 0203f34faae07fbea0bff2d23b81fb37df8854cded4cdadac5a034132a096b6d
2018-04-16 13:00:50 +00:00
drh
1d621f7f0d Merge changes from trunk.
FossilOrigin-Name: 54d96772e78b7f57d5b590aebe34a139ade73629aebe16677372650b33513b1d
2018-04-16 10:47:38 +00:00
drh
f5ced1f3b1 Increase the version number to 3.24.0
FossilOrigin-Name: f94528e1c70765c8649750b2d9c17f23e81f191554ff56d905a9abe3fb6037b7
2018-04-16 10:41:15 +00:00
drh
25c3b8caf4 Reduce the size of the NameContext object by grouping seldom-used fields
into a union.

FossilOrigin-Name: dba3095feeeb55b5c0ebe33bdd4be8ba1f24478406685d3a042a69d9c380e742
2018-04-16 10:34:13 +00:00
drh
e966a36cf4 Get upsert working on WITHOUT ROWID tables.
FossilOrigin-Name: d3c53fd3177946f50137d48da871de43d78d10ef9990cc4ea6750f7020f89b6a
2018-04-14 22:35:34 +00:00
drh
096fd476c1 Make sure constraint checks occur in the correct order, even in the
presence of upserts.

FossilOrigin-Name: 07fb30c3de7ff396ae2ce8a0d20352b56f17a5db0af99a921c7bfe9bd4018115
2018-04-14 20:24:36 +00:00
dan
24e25d32ce Experimental change to "SELECT * FROM ... ORDER BY" processing to load some
column values from the db after sorting.

FossilOrigin-Name: 9719cb46bbf501ce80f185159d594f593dd0b2639b9ef5a71a6c7b70046cb08d
2018-04-14 18:46:20 +00:00
drh
0b30a11645 First cut at logic to perform DO UPDATE for rowid tables.
FossilOrigin-Name: a9080bc8b8c5f3b399eb1819bb5009581f178d85bb2b2cca7bc16a7b81b06863
2018-04-13 21:55:22 +00:00
drh
9eddacade9 Add infrastructure for doing an UPDATE as part of an UPSERT. Still no actual
UPDATE code, however.

FossilOrigin-Name: 6d3017f92bce3e50a91fab2f605e2af8b913b1b374adbfd977299eb042683de8
2018-04-13 18:59:17 +00:00
drh
12e40cebb7 Merge the preupdate hook change from trunk.
FossilOrigin-Name: 7353caabb31803ccff83fe188c4ee65e75c883de2beea79cbe17375a4a98d9ac
2018-04-13 16:29:50 +00:00
drh
54f2cd905b Remove an always-true branch from the preupdate hook logic.
FossilOrigin-Name: 0ab4518811b23bdb57feba55014cef07de66028f8fcbf8cf0831a712b2954b91
2018-04-13 16:23:22 +00:00
drh
c8a0c90b62 Get the ON CONFLICT DO NOTHING form of upsert working by mapping it
into INSERT OR IGNORE.

FossilOrigin-Name: d07f05e98bb9ce0f9b46db159d9df161b7499d6face6a5299ecd2d00a94fb8d0
2018-04-13 15:14:33 +00:00
drh
d5af54207d Get the conflict-target clause parsing working correctly, with test
cases.  This change involves an enhancement to sqlite3ExprCompare() which
needs to be reviewed on trunk prior to merging.

FossilOrigin-Name: 5bf704256206f84b3db7a5d8523215604eeb218ef8db86316d1e43ecd7248d6a
2018-04-13 14:27:01 +00:00
drh
3b45d8bfb7 Improved conflict-target matching logic.
FossilOrigin-Name: 98d32ba661f4ba662b639994b74352b695d53a33bc8a498bd09b9e02f794c81e
2018-04-13 13:44:48 +00:00
drh
e9c2e772f1 Back off of the extended upsert syntax that allows multiple ON CONFLICT
clauses.  The syntax now is exactly as in PostgreSQL and MySQL.  Add support
for WHERE clauses on the conflict-target phrase, for partial indexes.

FossilOrigin-Name: 2c1b1987d8de1efa8ed7e1f199710e32ff20edf8ceec570514fc63bb1ef264e0
2018-04-13 13:06:45 +00:00
drh
788d55aa77 Begin adding upsert logic. This is an incremental check-in.
FossilOrigin-Name: 809696434097e62e8ef486c7478b5eb62c0cf1342522a5584939fade82821410
2018-04-13 01:15:09 +00:00
drh
fcfd756fe3 Break out the upsert code into a separate source file.
FossilOrigin-Name: 389806b05f163687d8eb858b0f87f9a2d02e90af9f2097924a66715f05177613
2018-04-12 21:42:51 +00:00
drh
4357e22637 Fix another typo in a comment.
FossilOrigin-Name: 046bb6d25865041477f046f24c39a4791224f5b622ff70eda909d8ee3c097511
2018-04-12 20:21:42 +00:00
drh
7007640f2e Simple comment clarification. No code or logic changes.
FossilOrigin-Name: a26f9c9f89c24048cb77d5c0c8de37f46de7dce80f8bf49cadcd58b239dbdfa7
2018-04-12 19:51:22 +00:00
drh
dab0eb58d7 Extend the upsert syntax to allow a WHERE clause on the UPDATE.
FossilOrigin-Name: e4396c540a22fbc087a01050a32bfad514259d700c2381d7ac912580d7dca00f
2018-04-12 17:28:06 +00:00
drh
6cd7d489db Update the upsert parsing so that it accepts conflict-target labels using
the PostgreSQL syntax, and also accepts the MySQL "ON DUPLICATE KEY"
syntax.

FossilOrigin-Name: c48f64d8ae2625a19267b02e4a173a07766934235ad3052cd9d38f5ecbcbfbc3
2018-04-12 15:43:05 +00:00
drh
46d2e5c35a Add the Upsert object for holding upsert clause information.
FossilOrigin-Name: d83eaed539b274c2abd650d07522f491865d4917acbb64d05d01b3ba5c3cd446
2018-04-12 13:15:43 +00:00
drh
35e86bf15d Merge changes from trunk.
FossilOrigin-Name: 9f6f11805eb7cc02f7eb3044250f3981d46d2dbf0c421bd73e7f8b437390db25
2018-04-12 12:25:45 +00:00
drh
2424aa723b Help the parser run faster by avoiding the "explain ::= ." production.
FossilOrigin-Name: d7ec7b5970df9e542401f8299e098a5039d1875e2e3383dad06a0ec998589b6e
2018-04-11 17:10:54 +00:00
drh
84fbff18d0 Prohibit bound parameters in the arguments to table-valued functions within
a trigger.  Problem discovered by OSSFuzz.

FossilOrigin-Name: b7178209152452e82f5908513385018524472640d67547927d6b4c0aa0c15a46
2018-04-11 16:04:01 +00:00
dan
d6189eafa4 Minor simplification to internal function generateSortTail().
FossilOrigin-Name: f32cdb41ca213cfcfe0bb5bfe56930d43e55525fa5640274b00f1ccce7f69634
2018-04-11 14:11:53 +00:00
mistachkin
8384e43c18 Include the 'sqlite3rebaser_' APIs in the Windows '.def' file.
FossilOrigin-Name: 56e4965f7ac850c59596120878434f5ef023e77919ef9416d20812eac764bac1
2018-04-10 18:56:21 +00:00
drh
80aab206a4 Version 3.23.1
FossilOrigin-Name: 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b
2018-04-10 17:39:29 +00:00
dan
0493222ff8 Fix a problem causing the LEFT JOIN strength reduction optimization to be
incorrectly applied in some cases where the WHERE clause of the query contains
a filter expression of the form "lhs.x IS NOT ?".

FossilOrigin-Name: 1fdaf2c34431adcac1c7ff29aae0623c4cbaa6a7f38e843c786bd407d8b3e730
2018-04-10 15:31:56 +00:00
dan
6831dbedeb When testing, avoid injecting an OOM fault into a file-control call made by
SQLite on an unopened file-descriptor.

FossilOrigin-Name: 9c1a5eba3ec37c877af4b83c6f8c05b7140304f3d23e49832ba63e321247fc8d
2018-04-10 14:29:51 +00:00
drh
032495a34e Increase the version number to 3.23.1.
FossilOrigin-Name: 9488c87b54ace8a92a52a368e8cf161dfdd24201bd6b60d50e88c2d92d592f0c
2018-04-10 12:33:42 +00:00
dan
a1054dcc3f Fix a problem causing the LEFT JOIN strength reduction optimization to be
incorrectly applied in some cases where the WHERE clause of the query contains
a filter expression of the form NOT(x AND y). Ticket [1e39b966].

FossilOrigin-Name: 38d319c153641ea4138fab2d5a47c31a86f57a071a1e1c299ca54c980cfb2b60
2018-04-10 12:10:01 +00:00
drh
a2ce1b99a8 Remove an unnecessary SQLITE_UNTESTABLE compile-time conditional from
the command-line shell.

FossilOrigin-Name: 80b75a34a2a4c11bc35b8638f8f05d999db416c81edc1a1c81aa5029f0301da1
2018-04-10 10:37:33 +00:00