Commit Graph

8845 Commits

Author SHA1 Message Date
dan
73ac958c74 Fix a problem that occurred when using a bloom filter to optimize an (ipk = ?) lookup in the case where the RHS of the expression is a TEXT value. First reported by [forum:/forumpost/f61a8b7053|forum post f61a8b7053].
FossilOrigin-Name: 8e14c351b29bb434ac4e2510681e95716424a73e340d39feff4919f0431c2e00
2022-10-06 14:10:11 +00:00
dan
461fa44be0 Merge latest trunk changes.
FossilOrigin-Name: b0feecaa84b88f534edb49056cf7e92256f4a687c8b4c44e1d1186709a304378
2022-10-04 19:47:17 +00:00
drh
16292a5e52 Adjust the --help output for speedtest1 to clarify that the argument to
the --cachesize option is in pages, not bytes.

FossilOrigin-Name: d7c2be6bdc3402e5a339d0f7b76d2c25f3a444dcbf54a77c1ccb790d1195a7cf
2022-10-03 15:22:59 +00:00
drh
277c7d3516 Copy all of the fiddle-opfs changes to speedtest1 into trunk.
FossilOrigin-Name: f3d31c9982cab517a3907a28c571225cee614ee78375c70eb2efb9a2b6b4b042
2022-10-03 13:56:52 +00:00
drh
3044e77b4a Add the --vfs option to speedtest1.
FossilOrigin-Name: aeb884029ac1c68f0d7361dda0a545cff19ed265b608c1e329a1926397c5c8a3
2022-10-03 13:45:03 +00:00
drh
7bc6a818f0 Remove one of the NEVER() macros added by [5166acf3f0040459] because it
is reachable after all.

FossilOrigin-Name: bd8ae5febbb8d3122f1e2e09b9fcdd6ac20c075ae1cf60bcdbd36080f3736417
2022-09-30 22:40:57 +00:00
drh
1337a2291d New test cases in fuzzdata8.db
FossilOrigin-Name: aa367a3c974041323edb759855f0b83803439ceef2846da2d73eadd80efeaac4
2022-09-30 20:59:09 +00:00
dan
bdbd097280 Merge latest trunk changes into this branch.
FossilOrigin-Name: e87fa70ab0f9b95bbcde18567f47906a222a3fd02b4f3c2903d2bb087d361b7c
2022-09-23 11:30:24 +00:00
drh
0f51aa3972 Do not allow EP_InnerON terms to be used on a outer join.
FossilOrigin-Name: f47aa745690c018800243bf76930b2499ff4537411c4e27b4b16ba3854cc2bf8
2022-09-20 22:19:13 +00:00
drh
0cc6f78bcf Add new test cases that (current) get an incorrect answer.
FossilOrigin-Name: fe5c37736444e397ace387b761ec2491229785d7a437f3f60232aedf9d1f00ec
2022-09-20 21:07:52 +00:00
drh
4c5c941b6e New test cases for query flattening when there are ON clauses and outer joins.
FossilOrigin-Name: db55387b1972bc7bc6855bd3497af744a111e7d28d09893cd985fbb01be41bcc
2022-09-20 19:45:04 +00:00
drh
703c208d30 Update the fuzz invariant checker to conform to the latest changes in
dbsqlfuzz.

FossilOrigin-Name: 8d8c124349d2a25200ace9a60d76751594b722468ad0c39d927a5d2c6e2464e0
2022-09-20 17:21:54 +00:00
dan
b8eaf9a10d Fix recovery of utf-16 databases.
FossilOrigin-Name: 5b05be0861f35804270fbd184ad4b89c23e98cc2fbd56b9e4fe6197daef5fe49
2022-09-14 16:37:59 +00:00
dan
bc2e7fc228 Further fixes to comments in sqlite3recover.h. Also rework some data structures in sqlite3recover.c.
FossilOrigin-Name: 599d1f8ec2f9e24924a6f9e66c85664360c7b95531b07a4efe1dd8c096b3fc99
2022-09-09 20:44:56 +00:00
dan
7920162093 Handle recovery of virtual tables by recovering each shadow table individually, then writing the CREATE VIRTUAL TABLE statement directly into the sqlite_schema table.
FossilOrigin-Name: 5f2d5ccd56c06c3468377126acfd4be39b79b05bb6fb09b674b2e185df143aa3
2022-09-09 16:25:19 +00:00
dan
f2f8a3a348 Further work on making the recover extension compatible with the .recover command.
FossilOrigin-Name: f2ac315844d8db1bd1c6950a4fef7c459ddd37cc21a8f3daafa5639fad8118e2
2022-09-03 20:07:39 +00:00
drh
a3fc683c80 In the query planner, add a heuristic that will reduce the cost of a full
table scan for a materialized view or subquery if the full scan is the
outer-most loop.  This is shown to speed up some queries.

FossilOrigin-Name: 609fbb94b8f01d6792e5941ab23ce041313d359f6788c4dde6b1ca749ab49137
2022-09-01 10:29:02 +00:00
drh
4d28830861 Any function call can abort. Take this into account when deciding if a DML
statement needs a statement journal.  See
[forum:/forumpost/9b9e4716c0d7bbd1|forum thread 9b9e4716c0d7bbd1] for more
information.

FossilOrigin-Name: 5c95ae6c9b93b9bcf698bb1cad93b2da2e28121b35e7c539b1ddc0ef2de33cfe
2022-08-30 00:11:51 +00:00
drh
23593f8e99 Ensure that sqlite3_prepare() inputs always have a semicolon terminator in
speedtest1.

FossilOrigin-Name: c72756b0f2db30c622f00f43be9245d50e36049bd7740ee6332164f0c48f9c3d
2022-08-25 19:29:35 +00:00
drh
09cb5eb5ac Add the --script option to speedtest1.
FossilOrigin-Name: 1c87d7c58d5aec83f9e2ae3771a81aa17cfae0cf06169025a5db085e2d5749f9
2022-08-25 19:19:25 +00:00
dan
aa07b36dd5 Remove a NEVER() macro for a condition that is actually reachable following an OOM. dbsqlfuzz crash-6ef3cd3b18ccc5de86120950a0498641acd90a33.txt.
FossilOrigin-Name: b573e2cffa5fedc893ed30e76e47022b3617ac5583e1eb486afa810b2514c419
2022-08-25 13:32:55 +00:00
dan
f56291ed02 Add test case for fuzzer case crash-18fe4e.
FossilOrigin-Name: 8372468bb5d8922cf20b8bbee34cfd6044ceb09c26a4efa79a5e6df2c7c4b730
2022-08-19 20:10:51 +00:00
drh
0f201fccc0 Omit an unnecessary test case from corruptN.test that does not work with the
new RFC-7539 PRNG.

FossilOrigin-Name: d9e8c65ed25c4f6222c737f4244d5362dbe433d357f7d133765157446cf4e925
2022-08-16 14:09:51 +00:00
dan
207cb6f670 Extra test for SQLITE_MAX_COMPOUND_SELECT.
FossilOrigin-Name: c271096736889530f392ff37e631a77f3bc9c46b290dbda245fa05249f4410fc
2022-08-15 19:23:15 +00:00
drh
9c5e1e40e3 In the documentation emphasize that the use of shared cache is discouraged.
Fix test cases so that they all work with shared cache disabled.

FossilOrigin-Name: 52c3ae063e133c5f88cad2c3084cf46218f865ac817ab937e3529d2c6a7af300
2022-08-15 12:26:26 +00:00
drh
bffd5c1ece Fix a problem with the query optimizer for LIMIT/OFFSET queries when
underlying query is a UNION ALL and both arms of the UNION ALL are
subqueries with an ORDER BY clause.  This bug was reported at
[forum:/forumpost/6b5e9188f0657616|forum post 6b5e9188f0657616].  The
problem was introduced in 2015 (SQLite version 3.9.0) by check-in
[4b631364354068af].  See also ticket [b65cb2c8d91f6685].

FossilOrigin-Name: 6c806f64bbc9e98891bad0868575ee2ec5d0951ceb0c71d3ed417b45d5f27561
2022-08-04 17:15:00 +00:00
dan
4784a78d1c Add test cases related to fix [e717e029].
FossilOrigin-Name: 2909f36bfba8f34b818e5d9ecd8c759f05bbe25765089e78bb022de2b77a4f0f
2022-07-26 15:39:32 +00:00
drh
6b6d6c6bd2 TK_IF_NULL_ROW expressions must be accumulated in the same way as TK_COLUMN
expressions in an aggregate query.  Proposed fix for the problem identifyed by
dbsqlfuzz 8e17857db2c5a9294c975123ac807156a6559f13.

FossilOrigin-Name: 40d08807209638aad728be2cedbc904e342e76c8e486c364bd571b55dd2e1e87
2022-07-25 14:05:11 +00:00
dan
8bd0b250b7 Reduce a timeout in walsetlk.test from 2000ms to 1100ms so that the test runs a bit faster.
FossilOrigin-Name: 836fa097060dadeb2dc5d4ee2e40621c4af606b1ef7241e2264823e23e4ceb1f
2022-07-25 11:04:13 +00:00
dan
cf2ad7ae36 Remove a few unsuitable scripts from the "veryquick" test suite. Also have every second testrunner.tcl process favour running test scripts that contain text like "testrunner: slow" before any others.
FossilOrigin-Name: 22d280a5cd395abbedcfffbac3d3b3a614c327be25763ca380c1338a2a7bd33a
2022-07-18 19:32:30 +00:00
drh
449b473ee6 Enhance the REGEXP extension so that it will accept the start-of-input
mark ("^") in the middle of parentheses.
[forum:/forumpost/0d6a9160f81ef1a8|Forum post 0d6a9160f81ef1a8].

FossilOrigin-Name: ed8a8ebd62a319b5dabbdf67ee27141153b9899d7c8f08eeb4bdf35271015c71
2022-07-18 13:55:21 +00:00
drh
18934137dd Fix a problem in the REGEXP extension for the {M,N} construct where M is zero.
See [forum:/forumpost/8694e55a2c29963c|forum post 8694e55a2c29963c] for more
information.

FossilOrigin-Name: af15bb75306a4b94593b8431a34768b3de3d6689293e85ca02db16bf3e9f39e2
2022-07-18 13:10:53 +00:00
dan
b496eef690 Fixes for the generated "mallocs.tcl" and "leaks.tcl" scripts generated by running tcl tests with the --malloctrace=1 option.
FossilOrigin-Name: 449799e2d5902464540e8fda53ab429e0518278dab3b17c86911759114cddea0
2022-07-16 18:08:48 +00:00
dan
40e3fa3035 Fix a memory leak in fts3 that could occur when processing a corrupt database.
FossilOrigin-Name: d74f6f6d5136995b8bf900eb671e4b15ca81e03cc1ab5b7a1aa43dc4f3617760
2022-07-15 15:08:48 +00:00
drh
b3623e0af7 Fix the whereKeyStats() routine (part of STAT4 processing only) so that it
is able to cope with row-value comparisons against the primary key index
of a WITHOUT ROWID table.
[forum:/forumpost/3607259d3c|Forum post 3607259d3c].

FossilOrigin-Name: 0620e419a927a3da6ebe921aaa3471686f0fdc2e485f4c2d5c88f32092228724
2022-07-15 12:16:11 +00:00
dan
b1c034b2f1 Update some faulty assert() statements in fts3.
FossilOrigin-Name: b072851be1a5e49441469dbfa4580e132ebb1d8bc2de98fe1aa67bb9c7cf13a3
2022-07-15 11:34:23 +00:00
dan
de353fb5c2 Ensure all testrunner.tcl processes use the same pending-byte value when
accessing testrunner.db. Otherwise locking doesn't work and the db is corrupted.

FossilOrigin-Name: b65225653e4e5c20cc43f4dfdde6c110f6d14b87bff02a65fd61beabe50ec8db
2022-07-14 21:17:22 +00:00
dan
ca0720a9d8 Update testrunner.tcl so that it can run the test suites defined in permutation.test.
FossilOrigin-Name: 15ce937ef42491c503cb91f5bb3ce4dc5cdb3a927ff2f2b873fb6bf96808f3aa
2022-07-14 18:09:56 +00:00
dan
615aeceaff Fix testrunner.tcl so that it can detect the number of logical cores on osx.
FossilOrigin-Name: 14918f28221a3124b78a490fbb483279551ccc5a0032ea854ff0ac365684cc60
2022-07-13 21:28:19 +00:00
dan
4f28ee9d76 Minor change to help message in testrunner.tcl.
FossilOrigin-Name: e4f9cb01d790c27394cc021e7d4a16f4d5feda2d2493abd82e9660d7e6e9fec0
2022-07-13 21:10:11 +00:00
dan
2bb2d53bca Add new script test/testrunner.tcl. For running a set of test scripts using
multiple processes.

FossilOrigin-Name: 0122e93dc19c228546908b9ef5c58f88d27d79233523e2d09a4bbd56b0c492f9
2022-07-13 21:02:07 +00:00
dan
cda165ff9a Fix a problem preventing "testrunnter.tcl all" from working.
FossilOrigin-Name: 0ed1e83c6fc12acd06ecf7210a869bebaf5e5e75762e5f16bf1834ecab717d59
2022-07-13 20:26:37 +00:00
dan
95cc6a5e11 Update testrunner.tcl to allow the user to specify which tests to run on the command line.
FossilOrigin-Name: 900febcf362fa5f592c640d16177f33c13aab11ce31a61c7e18ff1be6e70bf9b
2022-07-13 19:57:35 +00:00
dan
e9a7ebe19f Fix testrunner.tcl so that it checks for memory leaks.
FossilOrigin-Name: 106f6724d54ccec3edf8c9a0422b89c4f227adb26021ed6f0fc91392ef4b3fc5
2022-07-13 17:46:42 +00:00
drh
b88bf865c3 The query flattener should not run if the subquery is a compound that contains
a RIGHT JOIN in any arm and the subquery is not the first element of the
outer query.  Otherwise, prior elements of the outer query will not have
the JT_LTORJ flag set.  Fix for the problem reported in
[forum:/forumpost/174afeae5734d42d|forum post 174afeae5734d42d].

FossilOrigin-Name: 274e244c85935084b2f0f85176283f018bf9b74e7703f985bd5a2f6f8bdcff5d
2022-07-13 15:52:15 +00:00
dan
0505851451 Add test/testrunner.tcl, an experimental script for distributing the work of veryquick.test between multiple processes.
FossilOrigin-Name: ef229cbb7ffbeb8c8877dff70e9d6d43050d2297dee582a37df3a0caaebd2a41
2022-07-12 20:31:16 +00:00
dan
03437f7886 Fix another test case error message similar to those fixed in [b3d6b3c3].
FossilOrigin-Name: 6d0f677291d2b5ec68c86292da240c5557422aae1290c0844223974449ce539b
2022-07-12 15:17:50 +00:00
drh
f0af3db770 Fix a bug in wapptest.tcl introduced by [51255bad4c1fb607].
FossilOrigin-Name: b26d097e099b18ff434467adafe83fc55429488dbb8ce9c879bb03d8c5b7d3eb
2022-07-12 10:46:02 +00:00
drh
ebdf4c0240 Add the --config option to wapptest.tcl. The argument is a glob pattern. All
configurations must match the glob pattern in order to run.  The default value
is "*".

FossilOrigin-Name: 51255bad4c1fb6074f602586fabad675ae310b9c37f4b80ecf60e2959fb0db12
2022-07-11 22:20:39 +00:00
dan
f703b42dc4 Update the expected error messages in some OOM test cases to account for [44d77a7f807].
FossilOrigin-Name: b3d6b3c3fc68dca7e20418eefa35ce3b583322b884b88a11c6773419f027a7a4
2022-07-11 21:40:34 +00:00
dan
e7ebe0aa81 Avoid ignoring the last line of a csv file if the final field is empty and
there is no trailing CFLS. Also have the csv extension treat the last line of a
file in the same way as any other line if it is short fields.

FossilOrigin-Name: 587795d47fcaf5142526fabbcc4d5a632f561f258414c2846e8932a49b5b2e6b
2022-07-06 15:44:57 +00:00
dan
e36281fc31 Avoid dropping error codes in the xBegin() method of virtual table sqlite_dbpage.
FossilOrigin-Name: 570e2bce595d3a48977dca0bb573dd3fe745a0d13b7122b3ad8ab4745c0700d0
2022-07-06 13:59:45 +00:00
dan
c578e4f0eb Fix a problem in the csv extension that was triggered when the very first field in the csv file is zero bytes in size.
FossilOrigin-Name: b12ddabf07b5e06bcee8dda3f990af3a131ab52b8fa969ba061b26d38458f31d
2022-07-05 17:49:04 +00:00
drh
0e4ab0db7e Enhance the REGEXP extension so that the end-of-input indicate ("$") is
allowed to occur on one branch of an OR ("|").
[forum:/forumpost/0107d5d40dd273e2|Forum post 0107d5d40dd273e2], second
issue.

FossilOrigin-Name: 3c04d21e6c632feb3bea8d1fa76bedcbfe254b0dc59865633d158a3f1bddefba
2022-07-03 18:12:43 +00:00
drh
f28727f61e Fix the initial-prefix optimization for the REGEXP extension such that it
works even if the prefix contains characters that require a 3-byte UTF8
encoding.  This should fix the problem reported by
[forum:/forumpost/96692f8ba5|forum post 96692f8ba5].

FossilOrigin-Name: c94595a6e15490b432f099fefbe2429fa19287f7bdc86332cba0fd1e08f65bd6
2022-07-03 14:25:47 +00:00
dan
2c1b1ddc55 Do not attempt the OP_Count optimization on queries with HAVING clauses.
FossilOrigin-Name: 566b7842ee286ed8620a87b06de65bc173ad0d208df4157292238fcb059cb484
2022-07-01 21:03:19 +00:00
dan
d85e4ac347 Add missing "finish_test" command to the end of test script merge1.test.
FossilOrigin-Name: 13cb3f1e63ed1e906f820655645a4966f0cae140ac442177b6685637dcfd365a
2022-06-30 11:01:48 +00:00
drh
fe9833482f Allow flattening of a subquery that is the right operand of a LEFT JOIN
in an aggregate query as long as there is no GROUP BY clause.  (The GROUP BY
clause will interfere with the operation of the TK_IF_NULL_ROW expression
nodes.)

FossilOrigin-Name: 2cf373b10c9bc4cbc5fe63d0a6948011df7bbc2f40dc025c9349f875da782b88
2022-06-25 19:43:44 +00:00
dan
a5ec23a705 In sqlite3WhereBegin, do not proceed with coding the loop if an error is detected as part of WHERE expression analysis.
FossilOrigin-Name: db5266dec601a9513bc8dd09a9f8bb4aef55b780d22610946099e8edd4836587
2022-06-24 11:05:36 +00:00
drh
2a40a882f2 A minor fix to test/fuzzinvariants.c so that it works even with column names
that originally contain a ':' and that are disambiguated.

FossilOrigin-Name: 8d9b1fff9d87522c4464aaf3ff0a7b93db244c59b4010562e35a8f161da4859b
2022-06-24 11:02:42 +00:00
drh
521e0b6cb6 New test cases for query flattening with LEFT JOIN.
FossilOrigin-Name: 27f68e47320c751e3663507500c1c44f0b7f885f89c678fce6a35b1bc372dd64
2022-06-23 22:43:11 +00:00
drh
d198183465 Add back the ability to flatten a LEFT JOIN subquery - previously removed
due to ticket [cad1ab4cb7b0fc344].

FossilOrigin-Name: f8fe936ad4f7678f9b26ba6fab41c5df9f4938634cdb3286b0f2dcd1357f919a
2022-06-23 15:15:03 +00:00
drh
f221e4b5d6 Fix requirements marks that changed due to typo fixes in the documentation.
FossilOrigin-Name: 5247df05991df979024df5a30bb3473401add92d4c12b01c040a16dda6da39f5
2022-06-22 18:33:21 +00:00
drh
b9294de1e6 Allow a HAVING clause on any aggregate query, even if there is no GROUP BY
clause.  This brings SQLite into closer agreement with PostgreSQL and fixes
the concern raised by 
[forum:/forumpost/1a7fea4651|forum post 1a7fea4651].

FossilOrigin-Name: 9322a7c21f1c22ba00e9b889223e89bc1591db6e561ce05091e905e98c1bf2b3
2022-06-21 13:41:24 +00:00
drh
436c28a265 Do not allow FROM-clause terms on the left side of a RIGHT or FULL JOIN to
be reordered. [forum:/forumpost/6650cd40b5634f35|forum post 6650cd40b5634f35].
This is probably more strict that necessary to get correct behavior,
but for the first release that supports RIGHT/FULL JOIN it is perhaps better
to be correct than fast.  A less strict constraint might be to prohibit
FROM-clause terms that originate on the left side of a RIGHT JOIN from
crossing from the right side to the left side of a LEFT JOIN.  Revisit this
later.

FossilOrigin-Name: 238453ffab0ba1bdddb529be35da82d5e8fb312a9574003a5441f455e601a909
2022-06-20 18:26:14 +00:00
drh
d7480403bc Do not allow an ON clause to references tables to its right if there is a
RIGHT or LEFT join anywhere in the query.  Other RDBMSes prohibit this always,
but SQLite must allow ON clauses to reference tables to their right for legacy
compatibility, unless there is a RIGHT or LEFT join someplace in the query,
in which case there is no legacy to support.

FossilOrigin-Name: e615dbe02ca949252d1526ed5c48f8ce08159773ea2008ce666484379d0d9854
2022-06-20 17:04:44 +00:00
drh
ae8776e092 The fix at [cab9b4cccd13bf0a] was incomplete, as demonstrated by
[forum:/forumpost/57bdf2217d|forum post 57bdf2217d].  This check-in
should complete the fix.

FossilOrigin-Name: fb0a23b6789da8e934562ce9ebd9d58ea13a10fd10dee5cbfc7ac8f394e1aeec
2022-06-20 12:42:28 +00:00
drh
13736999d9 Enable query invariant checking in fuzzcheck by default. There is no way
to turn it off.  Update the invariant checking logic to be consistant with
dbsqlfuzz.

FossilOrigin-Name: 66ca729bbbf37cb7ff8eb12f51429e0c0833bd5d3f0ef20a1eaeeb10820713c2
2022-06-18 20:20:30 +00:00
drh
d0d21f5565 Abandon a query-invariant check in fuzzcheck if the call to
sqlite3_bind_value() returns anything other than SQLITE_OK or SQLITE_RANGE.

FossilOrigin-Name: d31e1cd2ab44c7cce20b8990dff17719c286dd2fb46ba6d4f581a9553cf31891
2022-06-18 14:50:43 +00:00
drh
8fa6206bc4 In the --query-invariants option of fuzzcheck, correctly deal with OOMs
causing the return value of sqlite3_column_name() to be NULL.

FossilOrigin-Name: eabbee4a51bc1a865bddee890004ff3a1c9cc6b797b21f73e908642e154cef50
2022-06-18 10:26:12 +00:00
drh
c2beb0d8f6 Omit the --query-invariants processing in fuzzcheck for queries that contain
the implies_nonnull_row() test function.

FossilOrigin-Name: 0602a0844893465ac2fe53c0fa648a5cbcbc6452fff6181c42fab517f047b583
2022-06-17 17:11:51 +00:00
drh
f26e45139e Do not run --query-invariants on statements that make use of
sqlite_offset().

FossilOrigin-Name: c5ac4cbfb173c613d633b2c76484d735073692d001a336576174201b8f9af7b1
2022-06-17 16:52:54 +00:00
drh
ea64cb31a5 Allow integers and floating point numbers to compare equal.
FossilOrigin-Name: 0fe2e465ba931d4bceaf171693d2ee7af45a5f96840e65e9d4ee4a2e60f155d8
2022-06-17 16:32:21 +00:00
drh
63880362ed Improve query-invariants to the point that it would have discovered the
[f23a429d4153518d] bug if that bug had not already been fixed.

FossilOrigin-Name: 2a7251ed9c4c959b6df75172159c6b4445e1c2212e357d2c49ab8fa19cb3ac11
2022-06-17 16:09:47 +00:00
drh
c68fb84759 Only run query-invariant checks after the original query has run to completion,
so that we know it does not error-out on a subsequent row.

FossilOrigin-Name: d1fc857bb8dcd5914f5a9bbcc4efe5f4abe19a190e42e2c923b28327a95e4de6
2022-06-17 15:52:43 +00:00
drh
36f904f065 Fix the virtual table detection mechanism to avoid false-positives that were
blocking all failures.  Then fix a few of the additional problems that are
revealed by that fix.  More fixes are needed.

FossilOrigin-Name: 42b2e6676fed1508ea0ba17c292e83134825469735700da97817c45d45c54e66
2022-06-17 15:11:31 +00:00
drh
6efabd6cd3 Fix the new --query-invariants option on fuzzcheck so that it does not
use an unprotected sqlite3_value object as an argument to sqlite3_value_int64().

FossilOrigin-Name: d9f820151d74a690b5fa560597a5b3ace20165a112e1b58cb4a7c47b42745643
2022-06-17 12:25:33 +00:00
dan
2a7aff93ed Avoid omitting the rhs of FULL JOINs in cases where it is only correct to omit the rhs of a LEFT JOIN.
FossilOrigin-Name: f23a429d4153518d37387e121f22a30b22e2b31e126ad168e72049a96be86269
2022-06-17 11:39:24 +00:00
drh
3e245bcef3 Minor fix to the query invariant testing logic of fuzzcheck.
FossilOrigin-Name: 447e62a0946f5d77b7358adcabaeb23a7012cdfbfa1ef6082734cd9b45b2699d
2022-06-16 20:29:36 +00:00
drh
8f9261a8e9 Improvements to query invariants in fuzzcheck.
FossilOrigin-Name: 3a461f61b47e6ba6d5dcc2b7470ebde512b57bc68086f65050e07b06f42b7351
2022-06-15 20:18:44 +00:00
drh
e3bf2c8e9b Improvements to query invariant checking in fuzzcheck.
FossilOrigin-Name: 56c60a35ea457f06db58ec3f694a1ae16fd03e6625da1d7879d63d72bbcb1c62
2022-06-15 16:26:37 +00:00
drh
516c85026b Add the --query-invariants option to fuzzcheck. No changes to the SQLite core.
FossilOrigin-Name: fef282f9fbb10967102f9676d85b8c6a3b36aff7109f1becdaeaeddef0dff4f1
2022-06-15 12:50:51 +00:00
drh
0c278c3d76 Add the --query-invariants flag to fuzzcheck. The query invariant checks are
only run if that flag is enabled.

FossilOrigin-Name: d13b4621291831ff33cc4a8d53653eaa3f59fecf2fbc5d404db17e33a914495d
2022-06-15 10:46:52 +00:00
drh
a913f9b992 Improvements to query invariant testing. Almost working now.
FossilOrigin-Name: e039820418d64fb57cb1a8f9f21186284e6c76255a53445c5d7aef6cca89bfc4
2022-06-15 10:37:16 +00:00
drh
27a242c634 Fix the OP_NullRow opcode so that it works even if it applied to an
ephemeral cursor that has not yet been created.

FossilOrigin-Name: 0e925654c24774933c7738c68f704b229c68e18c8baa45f506b8d6f09164d0d8
2022-06-14 22:21:23 +00:00
drh
a1f79dae98 Attempt to enhance fuzzcheck to do some simple invariant testing on queries.
This is an incremental check-in for a work-in-progress.

FossilOrigin-Name: ce2d780163b3a28486904860a1815acc4169c09b971cfd199bb58d1e9a57b000
2022-06-14 19:12:25 +00:00
drh
92d1afba9b Do not remove the EP_CanBeNull flag from expressions during a LEFT JOIN
strength reduction if the query also contains a RIGHT JOIN. Fix for
the problem identified by
[forum/forumpost/b40696f50145d21c|forum post b40696f50145d21c].

FossilOrigin-Name: b1be2259e2e08ec22a88bc9a18b3ab4d83246ad4c635c05cdf80d3eff84df06a
2022-06-13 12:42:24 +00:00
drh
1cc5c4ac84 The same restrictions on the use of WHERE clause terms to drive indexes
in the presence of RIGHT JOINs also apply to the use of WHERE clause terms
to manufacture automatic indexes.  This fixes a problem identified by
[forum:/forumpost/51e6959f61|forum post 51e6959f61].

FossilOrigin-Name: 342c501f532523347e6c339351e02043dd6ee9e11a291224b65ea72bd6c2ba40
2022-06-10 16:41:54 +00:00
drh
958fcd417c Do not allow constant propagation between WHERE-clause terms and ON-clause terms
as this can confuse RIGHT JOIN.  Fix for the problem reported by
[forum:/forumpost/8e4c352937e82929|forum post 8e4c352937e82929].

FossilOrigin-Name: cab9b4cccd13bf0ab2bc38dc9a9c04ddd34e29c65ab6aef07b6bb3c31a43bece
2022-06-10 11:28:52 +00:00
drh
a27e350b6f Fix a faulty assert() statement identified by
[forum:/forumpost/0b91a75039|forum post 0b91a75039].

FossilOrigin-Name: 1f132bb03a22479ceeca0fd14940e2a1b29ce54b7784d5b0133450056813d877
2022-06-10 10:10:31 +00:00
drh
e5dea28482 Prevent subtype values from slipping across a subquery boundry when the
subquery is implemented as a co-routine.

FossilOrigin-Name: 9e51a6c0fbfb1899b2b01888430125fba6d4da9bad9eeaa3ad41e29fca54bbe5
2022-06-09 17:17:14 +00:00
drh
8878f8a8d3 The subtype of a value should not propagate across a subquery boundary.
Proposed fix for the problem reported by
[forum:/forumpost/3d9caa45cbe38c78|forum post 3d9caa45cbe38c78].
Additional works is needed as not all cases are covered.

FossilOrigin-Name: 08af1fe27ebd0edf6e0f1ac477deea033e7f7c813f1016b75196836daf02d2e4
2022-06-09 16:19:01 +00:00
dan
0a841a2b85 Avoid zeroing the value returned by sqlite3_changes() when a DML statement is automatically reprepared in sqlite3_step().
FossilOrigin-Name: 09c8f9f1970cd5b369d98a2b38f0b04d44ed095cb0bda80f7968bb6be4e0263b
2022-06-08 18:20:36 +00:00
drh
40357f0d5d Fix the query flattener so that it refuses a flattening that might leave both
an inner-join and outer-join ON-clause constraint (or equivalent) on the same
term of the FROM clause.

FossilOrigin-Name: f6c4fb48b65c2e8659aa0a1119c330e8bad5e42b2db2030850bfc9c04afef5c8
2022-06-08 15:38:16 +00:00
drh
a341bae948 New test cases refute check-in [3f45007d544e5f78].
FossilOrigin-Name: 12d3c96c39d12f6b01b77456eb874fff445ebfc60f50aada51b06ed37af364ea
2022-06-08 13:13:12 +00:00
drh
093dd41e97 Do not allow a partial index scan on the left table of a RIGHT JOIN, because
since the index is partial, some rows will be omitted from the scan, and
those rows will subsequently be picked up by the no-match logic in the
right-join post-processing loop.
[forum:/forumpost/c4676c4956|forum post c4676c4956].

FossilOrigin-Name: 615c0026119f7870c3b6ef9dcb57ce4ecf5acedea3e2b5cfc25aa450eb8f17a0
2022-06-08 12:46:58 +00:00
drh
f6bee94e22 Minor fix to test/index9.test so that it can be invoked with other
index tests using a wildcard.

FossilOrigin-Name: ccbd6e774903f9202f9311954979f6fcc3b13eba1f3402a549a7aee6ed1d55eb
2022-06-08 12:35:39 +00:00
drh
33b2cb9aec Fix the query flattener to deal with a RIGHT JOIN corner case described
by [forum:/forumpost/323f86cc30|forum post 323f86cc30].

FossilOrigin-Name: 3f45007d544e5f787d5837b4d9f484ba473d69cdba83c229228e9c2f6b972b75
2022-06-07 13:09:58 +00:00
drh
bb1369037b Test cases for [forum:/forumpost/323f86cc30|forum post 323f86cc30] added
to join8.test, though commented out so that they do not (yet) run.

FossilOrigin-Name: 7f97cb67d01a11f1b7e5b5f05824f9adbc6e4689d1809d60ceda50a595ba6d4a
2022-06-07 11:02:43 +00:00
dan
93c4087ffe Extra test cases for outer joins.
FossilOrigin-Name: c7505765280fb27ec2c8c4da6f87229a4078e3a4a27525226b6bf55864caa04b
2022-06-06 21:08:27 +00:00