Commit Graph

19440 Commits

Author SHA1 Message Date
mistachkin 5db9a2b364 Fix harmless compiler warning.
FossilOrigin-Name: ead4762dfcd284127e60483e14f88aa4f4f034c2e1efb68a150359ba8f307776
2018-07-22 20:24:38 +00:00
mistachkin 1e8487db29 In the Win32 VFS, when truncating a file, unmap it first.
FossilOrigin-Name: 21510a66dce4d0843ccfe20f092a01f5a52563ef244a94f1d5d2563305cab925
2018-07-22 06:25:35 +00:00
mistachkin 9676e611b6 In 'resetdb.test', close a database prior to trying to delete it.
FossilOrigin-Name: 45137053a511b976f5447b0668e3f3a636785d242f44b110a1107898e847e95e
2018-07-21 23:15:55 +00:00
drh 72d03a646c Change the SQLITE_Stat34 bit of the optimization test-control so that it
prevents STAT4 data from being used but allows it to be loaded into the
Index objects.  This permits STAT4 to be turned on and off on a per-statement
basis.

FossilOrigin-Name: 489f3caf5dcc8cace20a0da58ceb32fdea5770ba570fa3c9f712cd35e726846a
2018-07-20 19:24:02 +00:00
drh 040d77aa71 New checked in PRAGMA integrity_check to validate the autovacuum settings
in the header.

FossilOrigin-Name: a4663f09c91d1381a831f61a2b8e8a113eb6083932c4aea2ad0c011ece1418c5
2018-07-20 15:44:09 +00:00
drh 91d5866eb6 Enhanced detection of problems on the freelist and on overflow list in
PRAGMA integrity_check.

FossilOrigin-Name: 11e58f5b37d99848978007d834d187c262d904eb9d58924742e028d7cb324e64
2018-07-20 13:39:28 +00:00
drh b0b0230082 Avoid a branch in the commit logic that is unreachable when compiled
without SQLITE_ENABLE_BATCH_ATOMIC_WRITE.

FossilOrigin-Name: 271b8980c3bcd0403a40aec26681ec111be1d88d2d5d35199a85a10f09ad6920
2018-07-19 15:27:35 +00:00
drh b657f28bf6 Allow the VACUUM following SQLITE_DBCONFIG_RESET_DATABASE to proceed even
if the write-version in the header indicates that the database file is not
writable.

FossilOrigin-Name: 3dca8b9d5ab1f35f17fc527d8f2a20b6bac989d1406c883d5b4d6719953ef6b4
2018-07-19 14:40:41 +00:00
dan ea933f07b0 Experimental fix for resetting databases that have been deemed read-only due
to a corrupt "read-version" header field.

FossilOrigin-Name: e2394002d02754bb45d56e805df9bc5a2ef0d14e5d94262c1f8ab7643bc27c8f
2018-07-19 11:44:02 +00:00
drh ea99a31c59 Add the SQLITE_FCNTL_DATA_VERSION file control
FossilOrigin-Name: a5087c5c87ad65f92e3bc96bbc84afb43faf10ab6b9ed3ba16304b5c60ad069f
2018-07-18 19:09:07 +00:00
drh 378a2da91e Fix a harmless compiler warning in the pager. Enhance the docs for
sqlite3_changes() and sqlite3_total_changes() to refer to the data_version
pragma.

FossilOrigin-Name: 4c70ea5b0e2a512c6a46ac1f14397720e8c8556875701e78c30b19f850c24f55
2018-07-18 17:37:51 +00:00
dan ac306682df If an SQLITE_IOERR error is encountered as part of an atomic commit on an F2FS file-system, retry the commit in legacy journal mode.
FossilOrigin-Name: 2e0357c2ed30927921cd17129e348a18a6f3fd086d1fc0a42756036b321a084d
2018-07-17 14:01:55 +00:00
dan 4522c3e8d1 Fix for builds without SQLITE_ENABLE_BATCH_ATOMIC_WRITE.
FossilOrigin-Name: b10ec14ef7edcc5d7b0ad298c8230d1eca5508e8cf673fbbc97a0928b76c92fb
2018-07-17 13:55:08 +00:00
dan e79522633a Add new file doc/F2FS.txt, containing notes on the way SQLite uses the F2FS atomic commit feature.
FossilOrigin-Name: 59efb1bfaba12742379aae45c8c796ca539f089af9e553a3a55d6899a9c583c8
2018-07-16 20:44:00 +00:00
drh 7f32dc94a3 Minor simplification to sqlite3RollbackAll().
FossilOrigin-Name: 432fdc221550b3cca4140b1ae411da22201f689c30c72c5472dfdbc79bec9d90
2018-07-16 11:32:59 +00:00
dan 140a59874b If an SQLITE_IOERR error is encountered as part of an atomic commit on an F2FS
file-system, retry the commit in legacy journal mode.

FossilOrigin-Name: 1c41250f67ac5de423b0426ef2ab8fe3303278a270225920033933ca9609592a
2018-07-14 20:25:13 +00:00
dan 2f69b5c5d0 Remove an unused function declaration from fts5.
FossilOrigin-Name: 148d9b61471a874a16a9ec9c9603da03cadb3a40662fb550af51cb36212426b1
2018-07-13 20:28:54 +00:00
dan b80bb6ce88 Add the "categories" option to the unicode61 tokenizer in fts5.
FossilOrigin-Name: 80d2b9e635e3100f90cffdcffa5b5038da6fbbfccc9f5777c59a4ae760d4cb62
2018-07-13 19:52:43 +00:00
dan e882551935 Add a test-control to disable the skip-scan optimization.
FossilOrigin-Name: 650a3fe03d61068e06f3097878a777ca8ed713a769444cdb3f8be7d1e19a0b83
2018-07-12 19:14:39 +00:00
dan 7490128240 Add a test case to check that SQLITE_DBCONFIG_RESET_DATABASE can be used with
wal mode databases even if there are active readers.

FossilOrigin-Name: 6145f5b3bacdee8f377892ac8b885941336c4cc543052f6373e21c1f99e1eca8
2018-07-12 11:28:42 +00:00
drh 222a384a06 On an UPSERT when the order of constraint checks is rearranged, make sure
that the affinity transformations on the inserted content occur before
any of the constraint checks.  Fix for ticket [79cad5e4b2e219dd197242e9e5f4e].

FossilOrigin-Name: d120c45f3dc79f67afed0e44e5133569f784bc6792b15f5d79529deac2d13072
2018-07-11 13:34:24 +00:00
drh 9341916ed5 Adjustments to VdbeCoverage macros to deal with byte-code branches that
can never be taken in some directions.

FossilOrigin-Name: b170c0092b1d0c47dd700843f0c870e51181939607a897fbcae55a58042160f9
2018-07-11 03:27:52 +00:00
drh 5d6374fa39 Remove incorrect ALWAYS() macros from the window function logic.
FossilOrigin-Name: 94ac51cc4e7fdf484214e1936fc96104b96134632a8eb99558b3af743ac8bb8b
2018-07-10 23:31:17 +00:00
drh c3649417fe Add VdbeModuleComment()s on the three main code generators for window
functions.

FossilOrigin-Name: f7c239e959004cb90dc8537ab2e1fca5f26ef21f4f6f3dfd743a05a55e705090
2018-07-10 22:24:14 +00:00
drh b0225bc52d Minor comment changes. Add ALWAYS() macros on some unreachable branches
in the xStep() methods of built-in window functions.

FossilOrigin-Name: f2057542cf6860badb4ae6b1a0df94a78d5b2661dabf16f5705b3f8236521bea
2018-07-10 20:50:27 +00:00
drh fef37760da Identify Select objects within a single statement using small sequential
integers rather than "0x%p".  This is more readable and yields the same result
on successive runs.

FossilOrigin-Name: a7cdc5bc85e0edfcc38f920c2ce91599bcbfdb49522d88b08c64596546d13881
2018-07-10 19:48:35 +00:00
dan fd908888d3 Modify tests in window3.test to be tolerant of rounding errors when comparing
floating point values.

FossilOrigin-Name: 7c26c443e7f6455ca7f11f640e42285b42d95c9ae5f2e19e9c066d6d9cdcceb2
2018-07-10 18:50:01 +00:00
dan b556f26145 Fix a problem with using scalar sub-selects in window function queries.
FossilOrigin-Name: 687fe532c274265ca77451f97829743fcb8a714d0f6b1ceb9a147ab9babdc5b5
2018-07-10 17:26:12 +00:00
drh 6ccbd2787b Further improvements to bytecode branch testing. Fix cases where the
macros said a branch could not be taken when in fact it could be.  Alter
some window function branch coverage macros to indicate that comparison
operands cannot be NULL.

FossilOrigin-Name: 76e42b7071a71137c0da4f10db4e653ae94a89b56e95cd3f036bff08c9500d08
2018-07-10 17:10:44 +00:00
drh 7083a487ad Enhancements and improved documentation to the byte-code branch coverage
testing logic.  Provide new macros that allow the code to specify that
some branch instructions can never take the NULL path and that the OP_Jump
opcode is only interested in equal/not-equal.  The
SQLITE_TESTCTRL_VDBE_COVERAGE file control callback now works slightly
differently (it provides the callback with a bitmask of the branch action,
rather than an integer).

FossilOrigin-Name: cd2da7e1ba4e78e68ccf65d4969df963c1e3085930e74419450bda2799381e05
2018-07-10 16:04:04 +00:00
drh eee0861155 Fix a harmless warning about comment formatting in the previous
check-in.  Simplify the ORDER BY dereferencing logic so that it avoids
unreachable branches.

FossilOrigin-Name: 0f6ec605e131ab3d53b9df32af0a3207146a9abbd22dcabd6ef050b92f96735d
2018-07-10 07:39:23 +00:00
drh 38630ae1de Assert that if two functions compare equal in every other way, then they
must both have OVER clauses, or neither has an OVER clause.  Use this fact
to simplify expression comparison.

FossilOrigin-Name: 52559ad58ce412af40f1f34e80bfe9fadc6a93f3ca0cfaf69f94d615bbb99831
2018-07-10 07:25:42 +00:00
drh 6cbb4c936c Enhance the sqlite3ExprCompare() routine so that it knows to compare the
OVER clause of window functions.

FossilOrigin-Name: 0a7649afebc9349bf44a0e3588e81ab595ea85be1c70de08859ea76a7b271f62
2018-07-10 06:47:07 +00:00
drh a1fd4b520b Enhance the TreeView mechanism so that it shows the window function
data structures as part of the abstract syntax tree.

FossilOrigin-Name: a2c0e1bec0d8a6f982572c4c5a8166319b8db0fe586057f7900f0ab72af6554e
2018-07-10 06:32:53 +00:00
drh 0b3b0dd1b1 New VDBE comments and coverage macros.
FossilOrigin-Name: a9a307265b0626b3e9df69534c8eacf18413ea31784c9d931eadcff515d3dd84
2018-07-10 05:11:03 +00:00
drh c7bf57168a Fixes for various harmless compiler warnings.
FossilOrigin-Name: 5023b1b85b883a716a5da673740b6effe214ee0490f4ca45f161bb8b04784366
2018-07-09 22:49:01 +00:00
drh 142066d4b0 Add a comment to restriction (6) of the push-down optimization. No changes
to code.

FossilOrigin-Name: 0c8a2f257fb71b2b053c4a2028db063e92dd9ff585a17fa22a70f9223fb11e75
2018-07-09 20:58:43 +00:00
drh f710345303 Add an ALWAYS() around a branch in sqlite3BtreeSkipNext() that we believe
must always be true.

FossilOrigin-Name: 12be361a532df0c22a7e4d97658b82a69b1a205d4cca8d092b9e6b7790c1ee40
2018-07-09 20:41:39 +00:00
dan 77f3f40292 Avoid leaving view-definitions with an incomplete set of column names/types in
the in-memory schema if an OOM strikes while allocating the same.

FossilOrigin-Name: 1ddbb5372e7ea8407369b88698b3fb922b62dcac72be633a17bd0e41baa369f4
2018-07-09 18:55:44 +00:00
dan e6fcd1d5de Add a couple of OOM tests.
FossilOrigin-Name: 50de2a0d2d96b6b5b8de7ac6277d60859a8d9a56f6a792950734386bb9f10b79
2018-07-09 18:11:52 +00:00
drh 7999cc434e Remove redundant branches in window function processing.
FossilOrigin-Name: 8fdaf3f37e5ddac9b7337a50f32f5d2bcdd64780797f08cfd3fccfa95819edfe
2018-07-09 17:33:24 +00:00
drh a57aac262f Simplification to the grammar rules for window functions. Fix a memory
leak that can follow an OOM while parsing a comma-separated list of
window definitions.

FossilOrigin-Name: a568f9c9db594f3b194c6e870305c9d6f2392ce6bc8ac00e9688883e97560fff
2018-07-09 16:24:00 +00:00
dan a1a7e112fe Throw an error if the second argument passed to nth_value() is not a positive
integer.

FossilOrigin-Name: 1a06e57a0b4279fa580c7ff4f152645f005794aaf86eeabf694637b7da11f763
2018-07-09 13:31:18 +00:00
dan f5e8e31399 Fix a bad assert() in window.c.
FossilOrigin-Name: fe8aaf0c806413965f50a03e34b5fdfaaa8b09dc0af73f41e830f7b664bd1ced
2018-07-09 06:51:36 +00:00
drh 1e80ace47a Simplification to the logic that detects misuse of the application-defined
function creation interfaces.

FossilOrigin-Name: 8f21d778450e1e5d2bc7f109d614fe018eb3d228b0bfc91cd3c6a5204415998f
2018-07-09 02:37:12 +00:00
drh 8ff21f47f0 During WITHOUT ROWID table creation, if the sqlite3CreateTable() call fails
due to an authorizer denying the INSERT into the sqlite_master table, then
detect this fact and abort the CREATE TABLE early, to avoid an assertion
fault.

FossilOrigin-Name: 164b1641e346994f0b9f91261c3cbc86b68e1c96cc401b78e48e186e26916abe
2018-07-09 02:02:09 +00:00
drh 19dc4d40e7 Identify specific FuncDef objects for window functions using the pointer to
the function name (FuncDef.zName) rather than the pointer to the xStep method.
This allows xStep method pointer to be replaced with a single noopStepFunc()
procedure, and thus save having lots of different no-op step functions.

FossilOrigin-Name: 410e13b0e0fb6e040808f076014d55ecf2b541c5439b4fd53c5bdcb8d800098e
2018-07-08 01:02:26 +00:00
drh a546ef219e Simplifications to the implementation of the sum() SQL function.
FossilOrigin-Name: a8b13002378fc4ef0b41c367b44b67bf2b28b6624303c087a3c6d657b5bfe32e
2018-07-07 20:55:16 +00:00
dan 51a6b19337 Fix another problem with reusing LSM cursors for range scans.
FossilOrigin-Name: ae3fc7652f27ba0a86f4c26f64c2e148d9496a5edb7f54dc9980edd91c326e4f
2018-07-07 20:26:30 +00:00
drh 491d4c89f5 Fix the JSON extension so that it can be compiled separately from the
amalgamation.

FossilOrigin-Name: 4b8cfe7bfe5f049eb4607fd480429fcd2060e691891d8bffc9917f13fa373988
2018-07-07 20:23:46 +00:00