Commit Graph

19181 Commits

Author SHA1 Message Date
dan
2e362f9775 Handle multiple window-functions in a single query.
FossilOrigin-Name: 35af0b750e70dcf0f343b115f4bbd0860a7e8064be204d4dfba1a43c22ff07b1
2018-05-17 14:26:27 +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
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