Commit Graph

8649 Commits

Author SHA1 Message Date
drh
0338f53b05 Fix a stale requirement mark.
FossilOrigin-Name: fcda7fb1f184a31a67572aae15f3cdcd60f8aac199106a7b0f90aca251ca7017
2022-05-10 18:18:45 +00:00
drh
f71b8123df Minor STAT4 test case change due to the ANALYZE enhancement of
[eb59c46a5aed69bc|check-in eb59c46a5aed69bc].

FossilOrigin-Name: 8ce2fecb580da53fc01c53d8de10e2cc99499094215429ba925e777717e369b2
2022-05-09 17:55:34 +00:00
drh
77874e782b Simplify a branch in the "*" expansion logic. New test case for an
INSTEAD OF trigger on a RIGHT and FULL outer join.

FossilOrigin-Name: d2717348f43b571c7bb58498e0c723331abf85de174189e66aca2c438ca26d5f
2022-05-09 12:59:16 +00:00
drh
c915b9c46f Improvements for name resolution for parenthsized joins.
FossilOrigin-Name: 006b2d9c52201c9e836b649018519acfb47f793f70b968722440f00084e9d846
2022-05-04 18:43:39 +00:00
drh
b2cc3cf36e Merge ON-clause constraint usage fix from trunk into the joinD branch.
FossilOrigin-Name: 0a20d4a85964fb5f2060b9522356ad2711f41d0d526ba3d2e58fc51029878298
2022-05-04 14:46:08 +00:00
drh
11d63ebf2c Fix ON-clause constraint usage for FULL and RIGHT JOINs.
FossilOrigin-Name: 544268a723cafdf0460221f5f018e752836436bad0fac90852cec70e63d9dcde
2022-05-04 14:45:19 +00:00
drh
3b52f80237 New test cases using various join types and Bloom filters. Two cases
differ from PG and need to be resolved.

FossilOrigin-Name: befa8cbc0682bc3269f87e392a1f3d4baacf4db7c716ea84192bb9c13c99490b
2022-05-04 11:49:26 +00:00
drh
eeada07457 Merge Bloom filter bug fix from trunk into the right-join branch.
FossilOrigin-Name: 72131ad1bda3d087e59cd4a51d87f10f65a55e658645397e1ede15f9fb1f5143
2022-05-03 16:26:50 +00:00
drh
8aa7f4d813 Fix the Bloom filter pull-down optimization so that it jumps to the correct
place if it encounters a NULL key.  Fix for the bug described by
[forum:/forumpost/2482b32700384a0f|forum thread 2482b32700384a0f].

FossilOrigin-Name: 6eda9b1a7784cf6d58c8876551f67ab98e78a08e726a0579d4def5ba881985bb
2022-05-03 14:01:48 +00:00
drh
85f93850f7 Merge the latest trunk fixes and enhancements into the right-join branch.
FossilOrigin-Name: afbcf075c1e09ae064c7b16e63501cd1d374711812664aef76bd35d02d64a2b6
2022-05-02 15:10:38 +00:00
drh
7497364749 Simplified fix to the problem with subroutine reuse in the RIGHT JOIN no-match
logic for a subquery on the right-hand side of an IN operator.  The code still
needs simplification.

FossilOrigin-Name: a193749730d6cfba617f2a64e7254c78f92bbf29b109c19055fc33f6cc643d4c
2022-04-30 18:40:22 +00:00
drh
2aa1086cab Preserve the COLLATE operator on an index on an expression when resolving
the use of that expression into a reference to the index.  See
[forum:/info/7efabf4b03328e57|forum thread 7efabf4b03328e57] for details.

FossilOrigin-Name: a8da85c57e07721dc1c918d67433d6c99ce48421e369123cc3194d855e55f7e8
2022-04-30 12:35:51 +00:00
drh
a25bbaf74a Further improvements to codeEqualityTerm() for cases when an IN operator with
a right-hand side subquery is used as a constraint that needs to be processed
by the RIGHT JOIN non-matched logic.

FossilOrigin-Name: bb2798be3fb5737827eec505db2d4c8cb510d227d98fc26ce748bf2da7e8b382
2022-04-30 00:06:52 +00:00
drh
3d5665366f Enhance the codeEqualityTerm() routine inside the code generator so that it is
able to reuse an IN operator that has an invariant subquery on its right-hand
side while coding the non-matched loop of a RIGHT JOIN.
dbsqlfuzz 19f1102a70cf966ab249de56d944fc20dbebcfcf

FossilOrigin-Name: 56dd3065469e49320b13af039471b3f0b85e6f7368cfd97b1cdc0cf8fa8e1956
2022-04-29 19:00:11 +00:00
drh
4bea8c6b56 Tweaks to the name resolution on parenthesized joins. A small number of
tests fail now due to extra columns appearing in the expansion of "*".

FossilOrigin-Name: c86804917e3fffcf0c19bbf11875667f7968275210fc768e650826bd9c87a5d2
2022-04-28 17:35:58 +00:00
dan
5487cdcc0a Update corruptL.test so that it works with SQLITE_ENABLE_OVERSIZE_CELL_CHECK builds.
FossilOrigin-Name: b1bec72043f798f4d4d30e6b60a45ed4dc521115c8a9f97bb8228e3f089deefb
2022-04-26 19:16:11 +00:00
drh
a9cdb90421 Fix a problem with automatic indexes introduced by
check-in [664b461bb5063d980] and reported by
[forum:/forumpost/0d3200f4f3bcd3a3|forum post 0d3200f4f3bcd3a3].

FossilOrigin-Name: 7ca3456c00998a429418ff29cf251b381586b330b88344c94a40c5df0b71da85
2022-04-25 19:40:33 +00:00
drh
ecb386b71f Prevent the ORDER BY LIMIT optimization from running if the innermost loop
is a right-join, as doing so will get an incorrect answer.

FossilOrigin-Name: 3aefc874d31885c64a5e02868edb2aa56a2b4429252d494e67e4088a9298ce5b
2022-04-23 19:21:47 +00:00
drh
da653b897d Improve EXPLAIN QUERY PLAN output and comments on bytecode listings by
distinguishing between "subquery" and "join" and using consistent names
across EQP and bytecode.

FossilOrigin-Name: a2d3ee92420ec564e31eb0005367cf7ff3d00bfaed5a98ffdbe17c91c95d9d97
2022-04-22 17:36:10 +00:00
drh
67f70bea06 Honor the MATERIALIZED keyword on a common table expression by not flattening
the CTE into an outer query.

FossilOrigin-Name: 8d631a6b9eb06b54b10eda595a4c588ca38f909b4afa653b24d1f720b55d72f7
2022-04-22 16:15:48 +00:00
drh
1c69bc912d Previous fix to join8.test needs a return.
FossilOrigin-Name: 7b4cd705a0339ddacad19564b07e50e4f68f54bf14dd2cd5d59b39314a4d2523
2022-04-21 23:34:35 +00:00
drh
abb4e7598c Disable join8.test if the build lacks support for virtual tables.
FossilOrigin-Name: 94e1916a2f594e6b8a54734027deb99688244d05cefb3c78f23afab49af1e08f
2022-04-21 23:01:24 +00:00
drh
11140addbb Add support for RIGHT and FULL JOIN.
FossilOrigin-Name: f766dff012af0ea3c28a8ce4db850cd0205729a8283bce1e442992aded7c734b
2022-04-21 19:38:17 +00:00
drh
503ad9c72d Make sure the code generator knows to invoke row-value subroutines which
running the right-join post-processing loop.

FossilOrigin-Name: fd328e52aee1dace12b1c2f44b6f7e9d15d8f77c8e9d9e3d85840a129a4b1808
2022-04-21 14:48:40 +00:00
drh
825a6bffc4 Ensure correct fg.isNestedFrom values even on crazy parses.
FossilOrigin-Name: e611e8e62c948d28cd3f28452d3096bab06998a685ed9434061cc2054f5cac32
2022-04-21 14:08:29 +00:00
larrybr
6403e77d3b For CLI, fix how columnar mode fills in empty portions of wrapped row outputs.
FossilOrigin-Name: 77aed89192bdbad819ac17bf5d08728278a9b8cbbbef1d805df230caff79b417
2022-04-20 22:41:10 +00:00
drh
e60ffa3350 Merge window function fix from trunk.
FossilOrigin-Name: b6b9e185f8c44b5f2f51111f7c5e4e2d77c8b853c5be271467ce138e8066340c
2022-04-20 16:54:47 +00:00
dan
41150bf35b Fix a problem with using multiple SQLITE_SUBTYPE function as window functions in a single query.
FossilOrigin-Name: 9430ead7ba433cbfce99f4f364a0c08499230e3a04f167326b0f131f098ffa09
2022-04-20 16:42:57 +00:00
drh
befbb40f44 Merge the ALTER TABLE fix from trunk.
FossilOrigin-Name: d5ceaef3fca8cb4791ead9cbfe00d0eafa1bdc2b0522c3599c68b40fe6a7efe2
2022-04-19 23:00:32 +00:00
dan
cbde37d8e4 Fix a problem in ALTER TABLE with handling "table.*" expressions within SELECT statements in triggers.
FossilOrigin-Name: 24755fd0657252e49793bb1fe906973a2dd84a1bde03bea9a762de36cc96c2d2
2022-04-19 20:47:18 +00:00
drh
de75638b33 Add 512 new join test cases derived from PostgreSQL output.
FossilOrigin-Name: 78d58e461f99366d2749ccd6d02ab4cba0cab20bb80c097e7128da1e50303549
2022-04-19 15:01:57 +00:00
drh
d737b16f92 Add the omitted "finish_test" to the end of joinA.test.
FossilOrigin-Name: 0907505cc9bb051280108fe5074211374b31836fae1ae6667a3de69f9d83fc01
2022-04-19 02:03:18 +00:00
drh
3b8c7545df New test cases for RIGHT and FULL JOIN.
FossilOrigin-Name: 5c2f670e0fb35648e1d6e1c48f4d8af815cd57d59eac6ba22e253511bb078870
2022-04-19 00:24:52 +00:00
drh
1c2bf41a12 Fix the query flattener so that it does not flatten a RIGHT or FULL JOIN into
any position of the outer query other than the first.

FossilOrigin-Name: 837322aa95b1c46201b7dd0c2e6c7b9915b4276d997949f1ecf961fb7f3514cf
2022-04-18 23:20:02 +00:00
drh
ec39c96473 New test cases, including one that gets a different result than Postgres.
FossilOrigin-Name: 49ea11a4a5fd630db44f458304d4f45fa103529ed6b36d538c78074965e8d799
2022-04-18 22:51:24 +00:00
drh
7466d5665a Even more test cases.
FossilOrigin-Name: 5f4310a104443ac3fc56f9d9cd2d428dd3e7a2a0285c8e74de6f499439fd6868
2022-04-18 19:34:41 +00:00
drh
23f240b325 New test cases for parenthesized NATURAL FULL JOINs.
FossilOrigin-Name: e34250efd34b526373bf072a43a7984ca19690836d7d2464dea8338066eaee8f
2022-04-18 19:28:08 +00:00
drh
a20922cb20 New test case demonstrating the ability to invoke OP_NullRow on a cursor
that has never been opened.

FossilOrigin-Name: d173edc242f295f5812a58cad184695881d9b1b160cd5b25e303e22848e90ce1
2022-04-18 18:01:38 +00:00
drh
25f2ce6e71 Merge the btree bug-fix from trunk.
FossilOrigin-Name: a333c0b50c3af7cd818470a647d78c7c691ef15418ec7cffe80dd88405393069
2022-04-18 16:23:01 +00:00
drh
2e1bcc9dd0 Fix problems with WHERE clauses that follow multiple FULL JOINs. This
introduces some new faults in the tests, probably due to something
unrelated.

FossilOrigin-Name: 95b242d4c2fed7c713299565ac1010f8a7534a5695589e87d5a0204c7bf5f3dc
2022-04-18 16:10:07 +00:00
dan
1942d1f236 Avoid an assert() failure in allocateSpace() triggered by a corrupt database. dbsqlfuzz f022eb0ce64d27808574d1dcde5cf7d002dabde8.
FossilOrigin-Name: 2de7f8cc7fe18f0828bb53f1fd11f5eb828faf4d6dfaf39693dff4f8926c1c7a
2022-04-18 15:56:58 +00:00
drh
41db500274 Merge the latest fixes from trunk.
FossilOrigin-Name: 1ba3b3ccf145d84fa75afabe2fa925f65e43f815b25b15bd60073a41aa97bf57
2022-04-18 14:41:24 +00:00
drh
01a6c16e0c New RIGHT JOIN test cases, one of which is currently failing.
FossilOrigin-Name: 9168cbbedd1c9d735279295a78212d830e24269f6d7e445e71faa2c06973223d
2022-04-18 13:08:17 +00:00
drh
a1848a5d22 Change the row-value initialization subroutine call from within the
right-join body subroutine from an issue to an optimization opportunity.

FossilOrigin-Name: 829d49f27c041651ffeadc1397e4dd87a9994c9290e13b93542dbd2c514769cd
2022-04-18 11:22:46 +00:00
drh
d875c7eefe Do not allow an empty table bypass to jump outside of a right-join body
subroutine.

FossilOrigin-Name: 1549dcd2353903b70abadd428eeef971ab940df04fb05a6b83b04ee30932db6d
2022-04-18 10:26:50 +00:00
drh
6fda176ba6 New test cases, one of which is failing, indicating a bug that needs fixing.
FossilOrigin-Name: bd5fd68435ff068c18d7d46b33cf7591263a03c32a917a7df7c087b08c573cc8
2022-04-16 23:38:29 +00:00
dan
b192970809 Fix a problem with "ON DELETE RESTRICT" and "ON UPDATE RESTRICT" foreign keys in attached databases scanning child tables in the wrong schema.
FossilOrigin-Name: 04d5b637f087520cd58211505f9b5c086ff96d864a1908f60464b6fe22c62b7d
2022-04-16 15:46:23 +00:00
drh
977eef6cdc New test cases. One of the new test cases shows a flaw in the base design
of RIGHT JOIN.

FossilOrigin-Name: 4c3ce6475a67b1e207a5b63d9e2d38ee5bc45c899ad00ee327f292bf59039b9c
2022-04-16 13:55:48 +00:00
drh
bdbda1eb1f RIGHT JOIN USING now appears to work the same as PG-14. Legacy tests pass.
FossilOrigin-Name: 5bfb862419541de955dae35fc91f6e9fc70e2744bb786d49fa26bede80b9091d
2022-04-16 12:40:52 +00:00
drh
a51379ad78 Record the three known big issues with the current RIGHT JOIN design in
the join8 test module, with tests that deliberately fail in order to remind
us to fix the issues.

FossilOrigin-Name: 2c4ee723f4d0591d09776adfb82246bfa89153ab390b8b3f1878d1cdc43d68c8
2022-04-14 20:43:22 +00:00