Commit Graph

7357 Commits

Author SHA1 Message Date
dan
3580843595 Fix a fairly obscure problem causing the planner to sometimes choose sub-optimal plans for a query with a single virtual table in the FROM clause, and at least one IN(...) constraint in the WHERE clause.
FossilOrigin-Name: f5752517f590b37bfc0267650f5800320e22a8ecaba34aa6893281ce8d268026
2019-03-29 13:17:50 +00:00
drh
f72a97925d Add new test cases to test/fuzzdata8.db
FossilOrigin-Name: f908cd40b275a5753d5167ebb25871300381687adcb3a7fcb1f14b57a20ee3d0
2019-03-28 20:50:41 +00:00
dan
4ded26a53c Prevent aliases of window functions expressions from being used as arguments to aggregate or other window functions.
FossilOrigin-Name: 1e16d3e8fc60d39ca3899759ff15d355fdd7d3e23b325d8d2b0f954e11ce8dce
2019-03-28 16:15:05 +00:00
dan
725b1cfc53 Fix a problem with window frames that use "BETWEEN <start> AND 0 PRECEDING".
FossilOrigin-Name: 7927b6b023502e990d23f30251b5b0918b547726b863bfb6747dcd7f1f71d19a
2019-03-26 16:47:17 +00:00
dan
b60c3b01cc Add support for new window functions related features - GROUPS frames, RANGE frames with logical start and end points, the EXCLUDE clause and window chaining.
FossilOrigin-Name: c6da39115d3e2b0fd3a03c4bcae8ee8b05a6bbd6b11f8c54712fbff6387f610d
2019-03-26 13:08:34 +00:00
drh
58b42ad131 Earlier detection of corruption while added to the freelist.
FossilOrigin-Name: 8c80b004cae71aaf820a31dba80c100ed162ef5bae845fb4535ff4d3be407500
2019-03-25 19:50:19 +00:00
drh
1c960269dd Fix a faulty assert() statement in balance_nonroot() - the assert() should use
get2byteNotZero() instead of get2byte() for the corner case where the
number cells is zero on a 65536-byte page.

FossilOrigin-Name: bcbe7d96df3c9515f679ccf671ca9ba89d081b53501495d4218eb5126196838b
2019-03-25 18:44:08 +00:00
dan
781b7ac3f6 Fix a problem with a window function in a correlated sub-query where at least one reference to the outer SELECT appears in a FROM clause sub-select.
FossilOrigin-Name: 9aca86f98388ff66b2bccb3fbfc486a3931398d2a8da139f905826ae2cdbb205
2019-03-22 13:56:49 +00:00
drh
fb5567123f Add the --limit N option to dbfuzz2. Set the default callback limit to 250K.
FossilOrigin-Name: b99f8512c06b9d47e48b028781265512ce8b812ae4e6af0a7139a093cf9a8f74
2019-03-22 11:38:14 +00:00
dan
dcc427cf19 Add an extra test for database corruption to defragmentPage().
FossilOrigin-Name: 80e951fce3e5aaa224c8dba6449832d2efabcdc24e86eb6b7833f85cf08ecc00
2019-03-21 21:18:36 +00:00
dan
c7694a6d1d Remove assert() statements based on the counter-factual proposition that 0 is not a valid cursor number.
FossilOrigin-Name: c7b336181aac6785a515f275c0f50ad4bf2dee20abde959b56d968a7fdce3e5b
2019-03-21 13:51:09 +00:00
dan
2381f6d7e5 Fix a potential dangling pointer deference in an ALTER TABLE run on a schema that contains constructs of the form "PRIMARY KEY(column COLLATE collation)".
FossilOrigin-Name: b9e2393cf201e3fc24519c5ae65d0a5953147d78884e53d44a7958747b4a7e13
2019-03-20 16:58:21 +00:00
mistachkin
065f3bf4f2 Fix various harmless compiler warnings seen with MSVC.
FossilOrigin-Name: 1c0fe5b5763fe5cbace9773dcdab742e126d0bd035ab13d61f9d134afa0afc0c
2019-03-20 05:45:03 +00:00
drh
d0f820a7e6 Enhance the VACUUM INTO command so that it works on read-only databases.
FossilOrigin-Name: 55be6d0a9fa8a64b9c9c5ed51a2b9144304f7f0870a13b92d5864ac4d54491b6
2019-03-19 20:42:42 +00:00
dan
78694ea307 Add further tests to window8.test.
FossilOrigin-Name: ec7e224f50271a69a28074270b01328ec0ee38751fcb93b2c598d8be2b77a95d
2019-03-19 19:39:42 +00:00
dan
6603342f12 Fix a problem with EXCLUDE clauses on window frames with no ORDER BY.
FossilOrigin-Name: e0255063799a2a8531f0eaa8790334509591a5ababc5b915035b46d2faa80363
2019-03-19 19:19:53 +00:00
dan
8eff0cc326 Add tests to ensure that the window functions implementation is not generating code for unnecessary sorts.
FossilOrigin-Name: e195948a6876efe01b5cf2ed67bc9015a781fda39dca668099cb7edc1d331818
2019-03-19 17:45:31 +00:00
dan
e5166e070a Revert the OP_MustBeInt opcode implementation on this branch so that it again matches trunk. The extra functionality is no longer required.
FossilOrigin-Name: c02f77b1b4d025d4243f883d6f3a2b3abcaf4944e0209f641b62c576415343dc
2019-03-19 11:56:39 +00:00
dan
d430c2eb46 Update this branch with latest trunk changes.
FossilOrigin-Name: 98cc26598718e5557ee00aa77336024c91e483ec6de650e172ad1b44a6f0a77b
2019-03-19 11:17:28 +00:00
dan
ced89124d8 Ensure that all the new window-function keywords can still be used as SQL identifiers.
FossilOrigin-Name: a6d61dfd4780eccfce5f7a5ead6c04e3b78bc4a461551fd7dd602550e0d51084
2019-03-19 06:40:29 +00:00
dan
0525b6f47f Add further tests for new window function functionality.
FossilOrigin-Name: 1fbddf01b1c3fff95b05e2f2f709754e2b514296060b4846518791e7161d9ddb
2019-03-18 21:19:40 +00:00
dan
108e6b2c87 Always evaluate window functions using the alternative path usually only used by EXCLUDE frames if the SQLITE_QueryFlattener test flag is set.
FossilOrigin-Name: 2879a691aca9304aea5acb46bab8e82bb2e08eb54201f3679d60bfc0e8383845
2019-03-18 18:55:35 +00:00
dan
bdabe742da Fixes for RANGE windows and NULL values.
FossilOrigin-Name: 723c84be3ec5ae941b7abd2442cdb76ca3bd76a5ce2d830b0e648c6e1424885a
2019-03-18 16:51:24 +00:00
dan
1e7cb19be3 Fix problems with RANGE windows and string, blob and NULL values.
FossilOrigin-Name: cebe09e11cc91d9776f259dd9b87e9c760a460f53ba6fa36481dfe58f77ad417
2019-03-16 20:29:54 +00:00
dan
c782a81aa5 Implement the EXCLUDE clause for window frames.
FossilOrigin-Name: 9b43c3ee2e054b05715573f4f3893b84aabc5100832333c9a0f2a1628552a978
2019-03-15 20:46:19 +00:00
dan
25f5383cb8 Remove a debugging printf() left in test/sessionfuzz.c.
FossilOrigin-Name: 73c4abc90264355f3ea6e8c34e5aad6ed665b70fb136c4d416e2a98e46562bbd
2019-03-15 18:57:49 +00:00
dan
1f3b284b11 Ensure that ALTER TABLE commands open statement transactions. Fix for [596d059a].
FossilOrigin-Name: 0f2129f59f7df929106e2af876c2976dea6528c1dc1850d64cddb256f20e121a
2019-03-15 16:17:32 +00:00
dan
a0f6b83300 Add things to this branch that will be required to support the EXCLUDE clause.
FossilOrigin-Name: 7d66cd2013206ebad50c7cdb7dab9211fa8b47f5cb7067dcb314b3e0180875f8
2019-03-14 16:36:20 +00:00
dan
db7d895e9d Merge latest trunk changes into this branch.
FossilOrigin-Name: 0b904517bd6c4c59082381577246d3d2351b4265fc9151438ee4c33cf16f2eb1
2019-03-13 17:31:20 +00:00
drh
b65e801e5f New test cases added to test/fuzzdata8.db
FossilOrigin-Name: 049e9926202317f58c54b6351ff120fb69bf821f409909b1a1c5e335c0396707
2019-03-13 13:19:05 +00:00
dan
fcb02429ec When deserializing a database (sqlite3_deserialize()), do not attempt to parse the schema before the data is loaded.
FossilOrigin-Name: 4e1b005e8b397a22161a6b89cbd3f17bda70a6e0a86d8abdc61856edf2a74da4
2019-03-13 11:40:30 +00:00
dan
bb40727857 Allow real values to be used in PRECEDING and FOLLOWING expressions for RANGE window frames.
FossilOrigin-Name: 25ff7091cb12c63b1864ce68a9151f8432af5804b5ae905a2175761ab4b9fdd8
2019-03-12 18:28:51 +00:00
dan
9e24439c2f Fix a crash that could occur if the RHS of an IN expression is a correlated sub-query that refers to the outer query from within a window frame definition only.
FossilOrigin-Name: 0524aaaf45681437c2dca3d31ff26a65bee7bd2074730277c29136635ee0be0f
2019-03-12 09:49:10 +00:00
dan
71fddaf195 Fix problems with "RANGE ... ORDER BY <expr> DESC" window frames.
FossilOrigin-Name: e7bced731aa071c95bc398cdecd53c939841bf0c52fbcd06e47ba68f8c5cc35a
2019-03-11 11:12:34 +00:00
dan
72b9fdcf20 Add support for RANGE window frames. Some cases still do not work.
FossilOrigin-Name: ffc32b246d92d53c66094afe11950b53ffab6a1c230c602eebbfedafb2eb57f4
2019-03-09 20:49:17 +00:00
dan
f7b846e4ed Merge latest trunk changes into this branch.
FossilOrigin-Name: 53ea550ce759ae4683bcf0ae3af655bfe04f85db70f74edee6bcab56d83bb041
2019-03-09 07:38:16 +00:00
dan
0d86a9bd54 Add simple tests for GROUPS window frames.
FossilOrigin-Name: 2872702dacadad11f4fd7c437b77ef82763e840c9c92eefe87eac2491c38f963
2019-03-08 20:57:05 +00:00
dan
6c75b39614 Finish consolidation of window frame code. Add untested support for GROUPS frames.
FossilOrigin-Name: 954bf369935083c188c3b14e77ed89fc5ec4323cc5b0c67e4a2e48fcc278df45
2019-03-08 20:02:52 +00:00
drh
bcf1f41a62 Add new test cases in test/fuzzdata8.db
FossilOrigin-Name: 97bdc090f30610cc5dd29101452d1647550387f9c6f742e50f1e07c3cf68a147
2019-03-08 14:07:15 +00:00
dan
66b8457c7c Fix another segfault in fts3 that could occur with corrupt records.
FossilOrigin-Name: fcc24edde471c2214add2dbc3a27da8890a7148105c5ffa024faf72457964a5f
2019-03-08 13:27:27 +00:00
dan
b33487b0b6 Improvements to the way built-in window functions are handled.
FossilOrigin-Name: e8eee566dfca6f4c8af074731dfe91f7fbcd9ca72f0303235b52e4e2e80d5b71
2019-03-06 17:12:32 +00:00
drh
39c5c4ae06 Add the sqlite3_stmt_isexplain() interface.
FossilOrigin-Name: ee642d3e2775ba4c73627ac71d0abf7a0f7a4ab3151d88e0076e9992f4814983
2019-03-06 14:53:27 +00:00
drh
aff0fd483c Add an "|| CORRUPT_DB" term to an assert() that might be false if the database
is corrupt.  Also add a branch to have sqlite3PagerMovepage() return
SQLITE_CORRUPT in that case.

FossilOrigin-Name: b0d5cf40bba34e459caa7480bc84a1d75496c2ab52029f4bb0a31f2d9369a8ee
2019-03-06 14:08:41 +00:00
drh
7bf3133fef New dbfuzz2 test cases added to test/fuzzdata7.db
FossilOrigin-Name: 25975e1fb2be0c011542c0a6b001385cec8113662df93dc618f725f2a4692bc2
2019-03-05 14:47:53 +00:00
dan
4e72e62f3b Merge trunk changes into this branch.
FossilOrigin-Name: 9b4d561f68febdab6624d8c567fb4357bf67dda500664cf708d16a76f37b8ec1
2019-03-04 21:08:53 +00:00
dan
680f6e8e2e Support some "ROWS BETWEEN N PRECEDING AND M FOLLOWING" window functions without caching entire partitions.
FossilOrigin-Name: e7a91f12282afb5d5d7d78397a11d18e0268ee0c931d85e21fce00d13929494e
2019-03-04 21:07:11 +00:00
drh
f10c535fa5 The fts3_tokenizer() function returns NULL if the
SQLITE_DBCONFIG_ENABLE_FTS_TOKENIZER setting is disabled, which is is
by default.

FossilOrigin-Name: f5732f4caf7a37a6445c61ae0d0ac14cc9deb897376e73aa36a1ead025b92c69
2019-03-01 21:33:29 +00:00
drh
c06ede105d Add the new "bind_fallback" method to the "sqlite3" object in the TCL
interface.

FossilOrigin-Name: c7f70b6d96338dba201e005104e7f7148c1a8cd767ab05e35b44617c4c797bc5
2019-02-28 17:29:19 +00:00
drh
4ddf7f4211 New test case loaded into test/fuzzdata8.db.
FossilOrigin-Name: 00ae0c6c4815366bd2f36bc054b13bc7b568dd0a3caceddf0eba4db33f010ee4
2019-02-28 14:09:14 +00:00
dan
95fdb63b7f Avoid an assert() failure and an undefined left-shift operation in the fts3 snippet() function that could occur if the database was corrupt.
FossilOrigin-Name: d5250db6322103326f0d5782ba049996d9ce8784f9e53a3112fb6f09f888f1c3
2019-02-28 13:41:35 +00:00