]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
7 years agoRemove incorrect NEVER() macro added by the previous check-in. int-float-compare
drh [Fri, 18 May 2018 14:19:35 +0000 (14:19 +0000)] 
Remove incorrect NEVER() macro added by the previous check-in.

FossilOrigin-Name: 3d6625111319c0356c57aaf7b7460fd882c3f00ca668dc43c0abe3403c7c2ba3

7 years agoImprovements to the sqlite3IntFloatCompare() routine for systems that
drh [Fri, 18 May 2018 13:39:00 +0000 (13:39 +0000)] 
Improvements to the sqlite3IntFloatCompare() routine for systems that
lack the long double type.

FossilOrigin-Name: ea6a03a89dc23e860e53e79ec3fddf0ae7072a23b73aef3d2d181b426566b677

7 years agoIn the CLI with the -A command, if the file does not previously exist and
drh [Thu, 17 May 2018 20:04:24 +0000 (20:04 +0000)] 
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

7 years agoImproved error and help messages for the ".archive" command and "-A" option
drh [Thu, 17 May 2018 14:09:06 +0000 (14:09 +0000)] 
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

7 years agoFix memory errors associated with argv in the CLI when it is
drh [Thu, 17 May 2018 13:29:14 +0000 (13:29 +0000)] 
Fix memory errors associated with argv in the CLI when it is
compiled on Windows.

FossilOrigin-Name: 4474d69b5c21b4e6f0d1376fbceca0f18c715ff673aea63053a02bfbe041d03b

7 years agoEnhance the sqlite3_str_new() interface so that it always returns a valid
drh [Wed, 16 May 2018 15:35:03 +0000 (15:35 +0000)] 
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

7 years agoCorrect output for the fullkey column of json_each() when the total JSON
drh [Wed, 16 May 2018 12:19:11 +0000 (12:19 +0000)] 
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

7 years agoFix a test case problem in wherelimit.test.
dan [Tue, 15 May 2018 09:09:00 +0000 (09:09 +0000)] 
Fix a test case problem in wherelimit.test.

FossilOrigin-Name: 3012df8b2c0b19d27260f389147a96c501aee9a4aee3813834cc9e438dbacede

7 years agoMake more aggressive use of automatic indexes when processing materalized
drh [Mon, 14 May 2018 22:46:11 +0000 (22:46 +0000)] 
Make more aggressive use of automatic indexes when processing materalized
views and subqueries.

FossilOrigin-Name: 172f5bd27e47cbdaaab54fe4383a5ee505d285257af6153ed626d9493a4adab3

7 years agoConvert the schema creation logic in the rtree extension to use the
drh [Mon, 14 May 2018 15:26:05 +0000 (15:26 +0000)] 
Convert the schema creation logic in the rtree extension to use the
new sqlite3_str interface.

FossilOrigin-Name: fd8b8c4196d3f0f6cb129f43ebf473ada86eefdf16181fa70ceee21e1232b5e1

7 years agoFix typo in the shell.c source file.
mistachkin [Mon, 14 May 2018 12:23:04 +0000 (12:23 +0000)] 
Fix typo in the shell.c source file.

FossilOrigin-Name: 389dc0a901b0ce54c3c773d63e5b288f6dd28b96dffc4b77861db89b275b57d6

7 years agoExport the deduceDatabaseType() function the shell.c source file.
drh [Mon, 14 May 2018 00:41:12 +0000 (00:41 +0000)] 
Export the deduceDatabaseType() function the shell.c source file.

FossilOrigin-Name: d0f35739af3b226c8eef39676407293650cde551acef06fe8628fdd5b59bd66a

7 years agoAdd the --append option to the ".backup" command in the CLI.
drh [Mon, 14 May 2018 00:23:08 +0000 (00:23 +0000)] 
Add the --append option to the ".backup" command in the CLI.

FossilOrigin-Name: 0dfdbdee527b0c429703bc2696bf8d8e44a852aafe0aca742b9d7152eb1f932e

7 years agoIn the CLI, allow comment lines that begin with '#', but only in a context
drh [Sat, 12 May 2018 23:56:22 +0000 (23:56 +0000)] 
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

7 years agoIn the CLI, return non-zero if there are errors on the command-line.
drh [Fri, 11 May 2018 19:11:18 +0000 (19:11 +0000)] 
In the CLI, return non-zero if there are errors on the command-line.

FossilOrigin-Name: 13e7300a37e379eac564594d78d3f039fd25737493b3b627ef02fab57a6c98e1

7 years agoFix a typo in the help message from the ".sha3sum" command in the CLI.
drh [Fri, 11 May 2018 15:10:43 +0000 (15:10 +0000)] 
Fix a typo in the help message from the ".sha3sum" command in the CLI.

FossilOrigin-Name: dba87a201806f93a1736c1ee81d9c9cf9848e401a237dc2af3b4376402976c32

7 years agoMake sure the open_db() routine in the CLI does not invoke access() with
drh [Fri, 11 May 2018 15:10:11 +0000 (15:10 +0000)] 
Make sure the open_db() routine in the CLI does not invoke access() with
a NULL filename.

FossilOrigin-Name: 20a8c61122f37a43c418ca4415b3d26e0f7a27a6faea9048aa9fbb1a56e9d629

7 years agoAdd a test case to check that the fts5 unicode64 tokenizer is dealing with
dan [Wed, 9 May 2018 16:32:00 +0000 (16:32 +0000)] 
Add a test case to check that the fts5 unicode64 tokenizer is dealing with
codepoints greater than 65535 correctly.

FossilOrigin-Name: 9f7a6ae878cd17ff4de7c55e654406773e0ea2b9fe1c4e2a9fc2b0da84d059a4

7 years agoAdd 14 new interfaces to the loadable extension mechanism.
drh [Wed, 9 May 2018 15:17:02 +0000 (15:17 +0000)] 
Add 14 new interfaces to the loadable extension mechanism.

FossilOrigin-Name: 0e809cdcbd1bb1e269298814d6bb1dcdaea48c5b0bb20e0e1caa4dba27654873

7 years agoFix minor problems with the sqlite3_str interface.
drh [Wed, 9 May 2018 14:29:40 +0000 (14:29 +0000)] 
Fix minor problems with the sqlite3_str interface.

FossilOrigin-Name: 43ea8a6836ccb9910314d35e07d881694200c97ef5969629f62e49f7a2a42f92

7 years agoMake the internal dynamic string interface available to extensions using
drh [Wed, 9 May 2018 13:46:26 +0000 (13:46 +0000)] 
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

7 years agoFix a typo in a comment used for documentation. No code changes.
drh [Wed, 9 May 2018 10:11:44 +0000 (10:11 +0000)] 
Fix a typo in a comment used for documentation.  No code changes.

FossilOrigin-Name: b866693e6a50b5c41ca54b56bb20753efb94980ad3365c511cccf23ac43a1c23

7 years agoCorrectly format the STAT1 and STAT4 content in the output from the
drh [Tue, 8 May 2018 23:17:36 +0000 (23:17 +0000)] 
Correctly format the STAT1 and STAT4 content in the output from the
".fullschema" command in the CLI.  Fix for ticket
[e63a34a0045832dc850367552].

FossilOrigin-Name: 0c3f128fd7d5738a8e9da706f5f30aa1985ef5efab70ddaad28ef6b641b04f4a

7 years agoFix a harmless compiler warning in fuzzcheck. Add new OSSFuzz test cases
drh [Tue, 8 May 2018 13:03:31 +0000 (13:03 +0000)] 
Fix a harmless compiler warning in fuzzcheck.  Add new OSSFuzz test cases
to the test case library.

FossilOrigin-Name: d2619746cb233f4be127a77988548dd1d90eebddf0d0ac9107913b240553e5d0

7 years agoFuzz test cases for UPSERT.
drh [Tue, 8 May 2018 12:49:53 +0000 (12:49 +0000)] 
Fuzz test cases for UPSERT.

FossilOrigin-Name: fd11fbd21893d520de5a2249f825ecb5839fa4943f5c207e9e9bf8b52f4e2695

7 years agoActivate the cell-overwrite optimization for index b-trees.
drh [Mon, 7 May 2018 18:41:19 +0000 (18:41 +0000)] 
Activate the cell-overwrite optimization for index b-trees.

FossilOrigin-Name: a68697d10ef17d452c8279181186faad7bc54e3a35858a336552f717449065ea

7 years agoImproved comments on the cell-overwrite optimization code.
drh [Mon, 7 May 2018 17:27:04 +0000 (17:27 +0000)] 
Improved comments on the cell-overwrite optimization code.

FossilOrigin-Name: a4fe966da2fc479b18bf521ff596000410af3a611f7d8723d126795e595ccf22

7 years agoOn an UPDATE, try to overwrite an existing btree cell with the modified
drh [Mon, 7 May 2018 11:48:22 +0000 (11:48 +0000)] 
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

7 years agoFix harmless compiler warnings associated with the new EXPLAIN QUERY PLAN logic.
drh [Mon, 7 May 2018 11:37:34 +0000 (11:37 +0000)] 
Fix harmless compiler warnings associated with the new EXPLAIN QUERY PLAN logic.

FossilOrigin-Name: 374d8e264487b0437a8d995ced1bc026a92d495a2d0568f65f033e9ebe11d0e2

7 years agoFix harmless compiler warnings in the cell-overwrite logic. cell-overwrite-prototype
drh [Mon, 7 May 2018 11:29:59 +0000 (11:29 +0000)] 
Fix harmless compiler warnings in the cell-overwrite logic.

FossilOrigin-Name: 3e11dc3183bc3e8ec49af244a8e8b3e07d12f7a2e59028b2bf64ce0ab589a91f

7 years agoBackout change [05fee1a21ea398f1e4d6f1cf3] because it does not take into
drh [Mon, 7 May 2018 02:50:38 +0000 (02:50 +0000)] 
Backout change [05fee1a21ea398f1e4d6f1cf3] because it does not take into
account the LD_LIBRARY_PATH environment variable used by dl_open().

FossilOrigin-Name: b348d1193a7a3ed4d3e656b6cc95a41f87eae29222e0723850a5eb5ffabffd00

7 years agoIn an ORDER BY LIMIT, make sure the ORDER BY expression evaluator does not
drh [Sat, 5 May 2018 16:50:35 +0000 (16:50 +0000)] 
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

7 years agoFix a slightly incorrect corruption detection branch in the btree logic.
drh [Sat, 5 May 2018 01:23:28 +0000 (01:23 +0000)] 
Fix a slightly incorrect corruption detection branch in the btree logic.

FossilOrigin-Name: 9191ff670cb7f36e0b2dac4a22888679b639845687aef8edcc3c05e35ba71eda

7 years agoMerge enhancements from trunk.
drh [Fri, 4 May 2018 19:18:27 +0000 (19:18 +0000)] 
Merge enhancements from trunk.

FossilOrigin-Name: 9650f71b82ca1b3759e776bbd8a2e8ca61c51f80038e37c9c9a675a8c13b0b06

7 years agoFix requirements marks. No code changes.
drh [Fri, 4 May 2018 18:32:11 +0000 (18:32 +0000)] 
Fix requirements marks.  No code changes.

FossilOrigin-Name: 7fdad122a21e4b01bd678198fd5131dc32febe3af366bd6368505398255f9822

7 years agoFor the amalgamation-tarball, enable FTS5 and JSON1 by default and
drh [Fri, 4 May 2018 04:49:55 +0000 (04:49 +0000)] 
For the amalgamation-tarball, enable FTS5 and JSON1 by default and
provide a new --enable-debug option that actives debugging facilities.

FossilOrigin-Name: 03edecaf9dcfc927aa60c2a17590a432b17de1647d480d277b4aafc8018c2d20

7 years agoMake a separate limb in the EXPLAIN QUERY PLAN output for the various lines
drh [Fri, 4 May 2018 00:39:43 +0000 (00:39 +0000)] 
Make a separate limb in the EXPLAIN QUERY PLAN output for the various lines
associated with the OR-optimization.

FossilOrigin-Name: 75ac7b4e4fd0811ca80c719badacff207e0bbd00ac64dde3b3d4ec676fad472d

7 years agoIn ORDER BY LIMIT queries, try to evaluate the ORDER BY terms first, and it
drh [Thu, 3 May 2018 23:20:06 +0000 (23:20 +0000)] 
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

7 years agoFix a branch that has become unreachable due to recent enhancements.
drh [Thu, 3 May 2018 22:52:56 +0000 (22:52 +0000)] 
Fix a branch that has become unreachable due to recent enhancements.

FossilOrigin-Name: 81ab5e0d106fb9f2de80d17c8167d8542c6721b8d7ec69c43e1571c2dcadeddd

7 years agoImproved security for VACUUM. This check-in combines the fixes
drh [Thu, 3 May 2018 21:51:30 +0000 (21:51 +0000)] 
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

7 years agoOverhaul of EXPLAIN QUERY PLAN. The output is now in the form of a tree.
drh [Thu, 3 May 2018 19:56:50 +0000 (19:56 +0000)] 
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

7 years agoOptimizations to the new EQP framework. rework-EQP
drh [Thu, 3 May 2018 19:47:14 +0000 (19:47 +0000)] 
Optimizations to the new EQP framework.

FossilOrigin-Name: 956fef361a795bd081d8e23ce4075dc8aafcee63ab7275d13b657b529d185b30

7 years agoFix various error handling conditions on the cell overwrite optimization.
drh [Thu, 3 May 2018 16:56:06 +0000 (16:56 +0000)] 
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

7 years agoThe BtCursor.info fields are only valid if info.nSize!=0.
drh [Thu, 3 May 2018 14:07:18 +0000 (14:07 +0000)] 
The BtCursor.info fields are only valid if info.nSize!=0.

FossilOrigin-Name: 54c537eead5b08104cfaf0d5b1e2706e53d6f74be2ca02e06229024fd889fc94

7 years agoAdd more corruption checking to the cell overwrite logic.
drh [Thu, 3 May 2018 13:56:23 +0000 (13:56 +0000)] 
Add more corruption checking to the cell overwrite logic.

FossilOrigin-Name: 58d14afe1e1288d114ea213458b3121e0a95670887861928858b7f143c76f789

7 years agoBug fixes in the overwrite optimization.
drh [Thu, 3 May 2018 12:57:48 +0000 (12:57 +0000)] 
Bug fixes in the overwrite optimization.

FossilOrigin-Name: 0cb6cd2a6a596afaa1cca6c5f5abc2ea75d04f254c7debaf36ecd6a90b66aed6

7 years agoThe sqlite3BtreeInsert() routine tries to overwrite an existing cell with
drh [Thu, 3 May 2018 03:59:02 +0000 (03:59 +0000)] 
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

7 years agoEnhance EXPLAIN QUERY PLAN to report the generation of constant rows using
drh [Thu, 3 May 2018 01:37:13 +0000 (01:37 +0000)] 
Enhance EXPLAIN QUERY PLAN to report the generation of constant rows using
VALUES or just a SELECT without FROM.

FossilOrigin-Name: c75eee69fa8a9b56ee58a4cc539e80cc982f43390dc3a357344d58479dd89a41

7 years agoMore test case updates. Tests are all running now.
drh [Wed, 2 May 2018 19:42:33 +0000 (19:42 +0000)] 
More test case updates.  Tests are all running now.

FossilOrigin-Name: dab5e5294813891469660cceb211ac1a1e526715bb57dcdbb1ab90321e6a4dad

7 years agoFix test cases so that they work with the new EXPLAIN QUERY PLAN output
drh [Wed, 2 May 2018 18:00:17 +0000 (18:00 +0000)] 
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

7 years agoImproved EQP output for recursive CTEs and multi-value VALUES clauses.
drh [Wed, 2 May 2018 16:13:48 +0000 (16:13 +0000)] 
Improved EQP output for recursive CTEs and multi-value VALUES clauses.

FossilOrigin-Name: f2f525548c65f89f55cbe91da8a21512dedc6f7b68b58b7906d653e800a2963a

7 years agoPrevent VACUUM from running any commands in sqlite_master.sql other than
drh [Wed, 2 May 2018 15:00:26 +0000 (15:00 +0000)] 
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

7 years agoFix a dangling-else problem that was causing recursive CTEs to malfunction.
drh [Wed, 2 May 2018 14:24:34 +0000 (14:24 +0000)] 
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

7 years agoFix a problem in the xBestIndex method of the closure extension causing it to
dan [Wed, 2 May 2018 08:12:22 +0000 (08:12 +0000)] 
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

7 years agoAdd sqlite3_win32_set_directory8() and sqlite3_win32_set_directory16() functions.
mistachkin [Wed, 2 May 2018 03:01:50 +0000 (03:01 +0000)] 
Add sqlite3_win32_set_directory8() and sqlite3_win32_set_directory16() functions.

FossilOrigin-Name: 22089ea2bbea93eb1da7f08344789a5455077169443e40025f053d2a117f1c08

7 years agoImprovements to the EQP display for compound select statements.
drh [Wed, 2 May 2018 02:22:22 +0000 (02:22 +0000)] 
Improvements to the EQP display for compound select statements.

FossilOrigin-Name: 699a77e479010a331b0423f157a2fbfc373688e3d0d04ae5e64376c00cb3d488

7 years agoBegin reengineering the EXPLAIN QUERY PLAN function to provide more
drh [Wed, 2 May 2018 00:33:43 +0000 (00:33 +0000)] 
Begin reengineering the EXPLAIN QUERY PLAN function to provide more
intuitive output.

FossilOrigin-Name: 70b48a7972dfbb44af3ccd8ccd830e984bec88d80a78b3566a5de86a16e7fc14

7 years agoThe SQLITE_ALLOW_SQLITE_MASTER_INDEX compile-time option allows a CREATE INDEX
drh [Tue, 1 May 2018 18:39:31 +0000 (18:39 +0000)] 
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

7 years agoDefer loading result column values into registers on an ORDER BY LIMIT until faster-order-by-limit
drh [Mon, 30 Apr 2018 19:32:49 +0000 (19:32 +0000)] 
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

7 years agoTest cases added for SQLITE_DBCONFIG_RESET_DATABASE.
drh [Sat, 28 Apr 2018 19:08:02 +0000 (19:08 +0000)] 
Test cases added for SQLITE_DBCONFIG_RESET_DATABASE.

FossilOrigin-Name: 08665a9e2e50a0a1e62529884cf65f8090debe89a306a3904b53268729ab5ad5

7 years agoFix an RBU problem causing spurious SQLITE_CONSTRAINT errors when restarting
dan [Sat, 28 Apr 2018 18:20:01 +0000 (18:20 +0000)] 
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

7 years agoAdd the SQLITE_DBCONFIG_RESET_DATABASE control for resetting a corrupt
drh [Sat, 28 Apr 2018 13:21:00 +0000 (13:21 +0000)] 
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

7 years agoAdd the SQLITE_DBCONFIG_RESET_DATABASE control as a replacement for
drh [Sat, 28 Apr 2018 12:43:16 +0000 (12:43 +0000)] 
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

7 years agoMerge updates from trunk.
drh [Sat, 28 Apr 2018 11:22:53 +0000 (11:22 +0000)] 
Merge updates from trunk.

FossilOrigin-Name: 94877e495c563f101b51cd8891ca7665c7aab87ff526157f1dc1781e0a2a5d87

7 years agoPrevent deep recursions on nested COLLATE operators.
drh [Sat, 28 Apr 2018 04:16:43 +0000 (04:16 +0000)] 
Prevent deep recursions on nested COLLATE operators.

FossilOrigin-Name: 6e098ee415f1a530e17a942c9ba51d67c25a3ebff6b97377b7858d0b10bcec92

7 years agoFix compiler warnings in FTS3.
drh [Sat, 28 Apr 2018 04:10:55 +0000 (04:10 +0000)] 
Fix compiler warnings in FTS3.

FossilOrigin-Name: de508e831a43f02c3b354a24ea34798da03c163bae5521c852c9ddd252723739

7 years agoDocument and expose sqlite3_win32_set_directory() function for use on Win32.
mistachkin [Sat, 28 Apr 2018 01:46:22 +0000 (01:46 +0000)] 
Document and expose sqlite3_win32_set_directory() function for use on Win32.

FossilOrigin-Name: 7626b593405ca720e371b9f698b72b499b7c829bfe00f758140bc542cf970689

7 years agoAdd comments about the intended use of the sqlite3_data_directory variable as it... win32dir
mistachkin [Sat, 28 Apr 2018 01:44:27 +0000 (01:44 +0000)] 
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

7 years agoAdd the "PRAGMA reset_database=ON|OFF" command. When on, it causes the
drh [Sat, 28 Apr 2018 01:27:09 +0000 (01:27 +0000)] 
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

7 years agoDocument and expose sqlite3_win32_set_directory() function for use on Win32.
mistachkin [Fri, 27 Apr 2018 22:42:37 +0000 (22:42 +0000)] 
Document and expose sqlite3_win32_set_directory() function for use on Win32.

FossilOrigin-Name: cbce7180ee664367ee8fc1f8af703eb7845bb58ade6870cc3b7608dcbe5952b3

7 years agoUpdate test script fts3expr4.test so that it always creates fts3 tokenizers in
dan [Fri, 27 Apr 2018 18:05:01 +0000 (18:05 +0000)] 
Update test script fts3expr4.test so that it always creates fts3 tokenizers in
the "en_US" locality.

FossilOrigin-Name: 576a8f69ae25883f752e58953624e9f7126db998bebaa1f07f7c2ec47aaecabe

7 years agoFix a test script error causing tests to fail in soak.test.
dan [Fri, 27 Apr 2018 16:35:44 +0000 (16:35 +0000)] 
Fix a test script error causing tests to fail in soak.test.

FossilOrigin-Name: 462b52b121c1882e0eca819bc30c0f6e94d7fdd60047d2c32adeff3a1eb70546

7 years agoEnhance the comments in the templatevtab.c implementation.
drh [Fri, 27 Apr 2018 15:17:08 +0000 (15:17 +0000)] 
Enhance the comments in the templatevtab.c implementation.

FossilOrigin-Name: 05f6278a02e5cde89f76ced5af7d508e26576d7291dad7ee9e06b1a3be516cb0

7 years agoThe previous fix for ticket [d85fffd6ffe856092ed8da] in check-in
drh [Thu, 26 Apr 2018 18:34:26 +0000 (18:34 +0000)] 
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

7 years agoWhen processing an "ORDER BY ... LIMIT" that does not use an index, check
dan [Thu, 26 Apr 2018 17:43:35 +0000 (17:43 +0000)] 
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

7 years agoWhen processing an "ORDER BY ... LIMIT" that does not use an index, check sorter-limit-opt
dan [Thu, 26 Apr 2018 16:13:47 +0000 (16:13 +0000)] 
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

7 years agoEnsure that new.* values of an UPDATE do not get clobbered after the
drh [Thu, 26 Apr 2018 15:50:10 +0000 (15:50 +0000)] 
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

7 years agoClarification of the behavior of a BEFORE UPDATE trigger when the trigger
drh [Thu, 26 Apr 2018 15:04:18 +0000 (15:04 +0000)] 
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

7 years agoImproved VDBE comment on the OP_Param opcode. No substantial changes.
drh [Thu, 26 Apr 2018 12:27:03 +0000 (12:27 +0000)] 
Improved VDBE comment on the OP_Param opcode.  No substantial changes.

FossilOrigin-Name: 368c14da868a843767344f6cc17c499fddd83244c0510337ed9a918e64ee2413

7 years agoUpdate the "fuzz_malloc.test" script to print SQL statements in which OOM
dan [Thu, 26 Apr 2018 08:56:40 +0000 (08:56 +0000)] 
Update the "fuzz_malloc.test" script to print SQL statements in which OOM
handling problems are found to stdout.

FossilOrigin-Name: a956363cf6881be590120c7718976b54b12c4bd0d9228d8142b45e0fe1826f7e

7 years agoAdd new interfaces for accessing the list of SQL keywords:
drh [Wed, 25 Apr 2018 19:02:48 +0000 (19:02 +0000)] 
Add new interfaces for accessing the list of SQL keywords:
sqlite3_keyword_count(), sqlite3_keyword_name(), sqlite3_keyword_check().

FossilOrigin-Name: 7dd34e3776fed90a49344d54a1b68bb59f7957b5a8a1a367087b7cafb63111c1

7 years agoAdd the new DO and NOTHING keywords to the keyword lists maintained
drh [Wed, 25 Apr 2018 17:10:30 +0000 (17:10 +0000)] 
Add the new DO and NOTHING keywords to the keyword lists maintained
by various extensions and auxiliary programs.

FossilOrigin-Name: 77a98a0781cd8450e2100111e70526db6a51d7e58e3c505ea87f685388099e82

7 years agoAdd the new SQLITE_SHELL_INIT_PROC compile-time entry point to the CLI. This
drh [Wed, 25 Apr 2018 13:27:07 +0000 (13:27 +0000)] 
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

7 years agoAvoid many unnecessary calls to sqlite3ReadSchema() and sqlite3Init() when
drh [Wed, 25 Apr 2018 12:01:45 +0000 (12:01 +0000)] 
Avoid many unnecessary calls to sqlite3ReadSchema() and sqlite3Init() when
the schema is known to be valid already.

FossilOrigin-Name: 58cf812fd81329e82b3fdd61b7ad2040c9b90d2d80f592b9231e0e1902c8d577

7 years agoAdd an assert() to ensure that schema mutexes are held prior to accessing
drh [Wed, 25 Apr 2018 10:30:46 +0000 (10:30 +0000)] 
Add an assert() to ensure that schema mutexes are held prior to accessing
the DB_SchemaLoaded flag inside of sqlite3Init().

FossilOrigin-Name: d8b46290bb75c695dac523cf9a50d1b43e773802e3b95fd722feca16162ab7c5

7 years agoRemove a recently added NEVER() macro from a branch that can be taken in
dan [Tue, 24 Apr 2018 18:59:18 +0000 (18:59 +0000)] 
Remove a recently added NEVER() macro from a branch that can be taken in
obscure circumstances.

FossilOrigin-Name: 2aa210030ae414782adab9291cc43a149a780f39bd3d306dc2892a8c20422a51

7 years agoFix a problem with processing "LEFT JOIN tbl ON tbl.a = ? AND (tbl.b=? OR
dan [Tue, 24 Apr 2018 18:53:24 +0000 (18:53 +0000)] 
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

7 years agoDo not attempt to use terms from the WHERE clause to drive indexes on the
drh [Tue, 24 Apr 2018 17:34:03 +0000 (17:34 +0000)] 
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

7 years agoUpdate the expert extension test cases to account for the fact that
drh [Tue, 24 Apr 2018 16:51:38 +0000 (16:51 +0000)] 
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

7 years agoAll the OR optimization to proceed even if the OR is also converted into
drh [Tue, 24 Apr 2018 16:41:37 +0000 (16:41 +0000)] 
All the OR optimization to proceed even if the OR is also converted into
an IN operator.

FossilOrigin-Name: e252c6540db266b93beeb47a8f7dbf3b275f8c782cd2d36ba4c00648c382f63f

7 years agoAdd a hyperlink to the ticket on the code comment for the fix to
drh [Tue, 24 Apr 2018 14:18:49 +0000 (14:18 +0000)] 
Add a hyperlink to the ticket on the code comment for the fix to
ticket [7fa8049685b50b5aeb0c2].

FossilOrigin-Name: 45247c7f291bc0cc42600a4aa4ff7cdcd0a703fdfadcb0e12174c5250e70d503

7 years agoDo not attempt to read values from indexes-on-expressions if the index is on
dan [Tue, 24 Apr 2018 14:05:14 +0000 (14:05 +0000)] 
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

7 years agoEnhance the CLI to render EXPLAIN QUERY PLAN using an ASCII-art graph.
drh [Tue, 24 Apr 2018 13:07:40 +0000 (13:07 +0000)] 
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

7 years agoFix a memory leak following failure to open an external CSV file in the
drh [Tue, 24 Apr 2018 10:57:10 +0000 (10:57 +0000)] 
Fix a memory leak following failure to open an external CSV file in the
csv.c extension.

FossilOrigin-Name: 526ee07d19dbc8fd1af3a02a8da12b337020a4be40e045da9a19d0a7c2b6ab54

7 years agoIn EXPLAIN QUERY PLAN output, do not show an EXECUTE LIST SUBQUERY line for
drh [Tue, 24 Apr 2018 01:10:12 +0000 (01:10 +0000)] 
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

7 years agoFix to check-in [ca34c2dd20ee071e] - avoid a NULL pointer dereference
drh [Tue, 24 Apr 2018 00:08:09 +0000 (00:08 +0000)] 
Fix to check-in [ca34c2dd20ee071e] - avoid a NULL pointer dereference
following an OOM.

FossilOrigin-Name: c7e6e848fa91f61bc980a031a17d4cd4784f93a1c9ffee35665efa1a59f2982a

7 years agoFix a problem in sqlite3ExprCompare() associated with UPSERT.
drh [Mon, 23 Apr 2018 20:38:40 +0000 (20:38 +0000)] 
Fix a problem in sqlite3ExprCompare() associated with UPSERT.

FossilOrigin-Name: 67d0b2c15299dd20bca7254ecb33e71b5eee6024e2709bfdc36f877bf2a5679f

7 years agoFix a formatting issue in the TreeView output for bare expression lists.
drh [Mon, 23 Apr 2018 20:04:38 +0000 (20:04 +0000)] 
Fix a formatting issue in the TreeView output for bare expression lists.

FossilOrigin-Name: a6356817815fe986c4d89475194e0537ebd46582d6df1034482bf08521182bdf

7 years agoAdd the ".imposter off" variant of the ".imposter" dot-command in the CLI.
drh [Mon, 23 Apr 2018 18:38:48 +0000 (18:38 +0000)] 
Add the ".imposter off" variant of the ".imposter" dot-command in the CLI.

FossilOrigin-Name: d3dad06ff1b163040c54dd215f30d6669cc2bc339001a362605f26f06eddf98c

7 years agoThe ".selecttrace 0x2000" command causes just the top-level parse tree to
drh [Mon, 23 Apr 2018 17:43:35 +0000 (17:43 +0000)] 
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