]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
3 years agoMerge the latest trunk enhancements into theh begin-concurrent-pnu-wal2 branch.
drh [Tue, 10 May 2022 12:45:41 +0000 (12:45 +0000)] 
Merge the latest trunk enhancements into theh begin-concurrent-pnu-wal2 branch.

FossilOrigin-Name: d28af1f8a5da1810d41766074560fc3a1ec8fdc22b1efa59056eae4e5c6b66a4

3 years agoMerge recent trunk enhancements into the wal2 branch.
drh [Tue, 10 May 2022 12:39:00 +0000 (12:39 +0000)] 
Merge recent trunk enhancements into the wal2 branch.

FossilOrigin-Name: 33d77fea4084c5aba9203dfeddb820424f102dcb8347dc59e32b922bdb241382

3 years agoSimplified "hidden" and "no-expand" handling in the *-expander.
drh [Tue, 10 May 2022 00:24:01 +0000 (00:24 +0000)] 
Simplified "hidden" and "no-expand" handling in the *-expander.

FossilOrigin-Name: c6c3115f3a008cf9b0d7c5c812f17e38c8a75a904032c5f05f0bea03a7340527

3 years agoMinor STAT4 test case change due to the ANALYZE enhancement of
drh [Mon, 9 May 2022 17:55:34 +0000 (17:55 +0000)] 
Minor STAT4 test case change due to the ANALYZE enhancement of
[eb59c46a5aed69bc|check-in eb59c46a5aed69bc].

FossilOrigin-Name: 8ce2fecb580da53fc01c53d8de10e2cc99499094215429ba925e777717e369b2

3 years agoAdd ALWAYS() on two unreachable branches in the * expander.
drh [Mon, 9 May 2022 16:29:53 +0000 (16:29 +0000)] 
Add ALWAYS() on two unreachable branches in the * expander.

FossilOrigin-Name: 387c852375bba62df040330944c9e979a6993f95ece3443597c5fc66e34263ca

3 years agoEnsure that fts5 closes the read-only blob handle used to read the fts index at the...
dan [Mon, 9 May 2022 14:22:54 +0000 (14:22 +0000)] 
Ensure that fts5 closes the read-only blob handle used to read the fts index at the end of each xUpdate operation. This doesn't matter for stock SQLite, as the handle will be closed in the subsequent xRollback or xSync call, but prevents "BEGIN CONCURRENT" transactions from being committed on this branch.

FossilOrigin-Name: 093b60846cbc27175b67132a109d9d98bbc35f00faa9b4677c0aa32f0bd40776

3 years agoSimplify a branch in the "*" expansion logic. New test case for an
drh [Mon, 9 May 2022 12:59:16 +0000 (12:59 +0000)] 
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

3 years agoPerserve the requested reserved-bytes size for the database file when
drh [Fri, 6 May 2022 22:29:45 +0000 (22:29 +0000)] 
Perserve the requested reserved-bytes size for the database file when
doing a VACUUM.

FossilOrigin-Name: dac6d87c71606f3ec7ce601be6d17357d323476ecb60dbb167030146783b62b2

3 years agoPrevent an infinite loop on SQLITE_ERROR_RETRY when trying to modify a
drh [Fri, 6 May 2022 00:43:06 +0000 (00:43 +0000)] 
Prevent an infinite loop on SQLITE_ERROR_RETRY when trying to modify a
corrupt schema while PRAGMA writeable_schema=ON is active.
dbsqlfuzz ded83609f475cc989c7339d45efb5151c1495501

FossilOrigin-Name: 217b33234dc3dc36b5b6add50c170869421057a56a7576d1a61767956248d5c9

3 years agoBackout check-in [9fb20a21feb8f697] which was incorrect.
drh [Thu, 5 May 2022 10:02:19 +0000 (10:02 +0000)] 
Backout check-in [9fb20a21feb8f697] which was incorrect.

FossilOrigin-Name: 99225618a83b577efbd5d13c0d1ff73e9c5a71bb43c259d7c0f22cf3479c992f

3 years agoImprovements for name resolution for parenthsized joins.
drh [Wed, 4 May 2022 18:43:39 +0000 (18:43 +0000)] 
Improvements for name resolution for parenthsized joins.

FossilOrigin-Name: 006b2d9c52201c9e836b649018519acfb47f793f70b968722440f00084e9d846

3 years agoNew test cases for RIGHT and FULL JOIN, focusing on cases that make use
drh [Wed, 4 May 2022 17:43:59 +0000 (17:43 +0000)] 
New test cases for RIGHT and FULL JOIN, focusing on cases that make use
of Bloom filters, and a bug fix related to when ON-clause constraints are
applied.

FossilOrigin-Name: 67510354e69bab98bd8095f5bedd34aae619fe2c7885975d7a6a00b7df5ece4e

3 years agoCode EP_InnerJoin constraints at the same time that EP_FromJoin constraints joinD
drh [Wed, 4 May 2022 17:30:51 +0000 (17:30 +0000)] 
Code EP_InnerJoin constraints at the same time that EP_FromJoin constraints
are coded.

FossilOrigin-Name: b57033d2af2196e2f7e5305f3504fc20da5cadeb66026d38b999fe909cab8ac5

3 years agoMerge ON-clause constraint usage fix from trunk into the joinD branch.
drh [Wed, 4 May 2022 14:46:08 +0000 (14:46 +0000)] 
Merge ON-clause constraint usage fix from trunk into the joinD branch.

FossilOrigin-Name: 0a20d4a85964fb5f2060b9522356ad2711f41d0d526ba3d2e58fc51029878298

3 years agoFix ON-clause constraint usage for FULL and RIGHT JOINs.
drh [Wed, 4 May 2022 14:45:19 +0000 (14:45 +0000)] 
Fix ON-clause constraint usage for FULL and RIGHT JOINs.

FossilOrigin-Name: 544268a723cafdf0460221f5f018e752836436bad0fac90852cec70e63d9dcde

3 years agoNew test cases using various join types and Bloom filters. Two cases
drh [Wed, 4 May 2022 11:49:26 +0000 (11:49 +0000)] 
New test cases using various join types and Bloom filters.  Two cases
differ from PG and need to be resolved.

FossilOrigin-Name: befa8cbc0682bc3269f87e392a1f3d4baacf4db7c716ea84192bb9c13c99490b

3 years agoFix CLI use of wrong allocator for free().
larrybr [Wed, 4 May 2022 03:45:32 +0000 (03:45 +0000)] 
Fix CLI use of wrong allocator for free().

FossilOrigin-Name: 9fb20a21feb8f6979812f45691e06aa3e297d7370cf0d5820523e817a4e97863

3 years agoIn the query planner, do not let tables commute across any outer join.
drh [Wed, 4 May 2022 02:01:49 +0000 (02:01 +0000)] 
In the query planner, do not let tables commute across any outer join.

FossilOrigin-Name: 8cee5388232ade91ea627bb6857eb8937d7530b5ea519e0ae6da362c37c7ed35

3 years agoTypos cleared from README.md
larrybr [Tue, 3 May 2022 21:58:24 +0000 (21:58 +0000)] 
Typos cleared from README.md

FossilOrigin-Name: be3a1879c865cff85d8b1f0cc7b95295019c28cce67c687692a3210eeea6e314

3 years agoMerge Bloom filter bug fix from trunk into the right-join branch. right-join
drh [Tue, 3 May 2022 16:26:50 +0000 (16:26 +0000)] 
Merge Bloom filter bug fix from trunk into the right-join branch.

FossilOrigin-Name: 72131ad1bda3d087e59cd4a51d87f10f65a55e658645397e1ede15f9fb1f5143

3 years agoFix a typo in a comment.
drh [Tue, 3 May 2022 16:18:25 +0000 (16:18 +0000)] 
Fix a typo in a comment.

FossilOrigin-Name: c19c3c48698bf2543d775411c62d01e629791e2f3c5317970fdbb830eacafac6

3 years agoFix the Bloom filter pull-down optimization so that it jumps to the correct
drh [Tue, 3 May 2022 14:01:48 +0000 (14:01 +0000)] 
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

3 years agoAdd assert()s to show that jumps always land an an instruction that is between
drh [Tue, 3 May 2022 12:11:16 +0000 (12:11 +0000)] 
Add assert()s to show that jumps always land an an instruction that is between
1 and Vdbe.nOp-1.  Had these assert()s been in place before, they would have
caused an assertion fault for the byte-code error reported by
[forum:/forumpost/2482b32700|forum post 2482b32700].

FossilOrigin-Name: 8f8a58feb7047d19522ca32efbe42fd9ddf49aaf9064f7373eb56a88982406a2

3 years agoOrganize the various flag bits of the ExprList_item object into a substructure
drh [Mon, 2 May 2022 20:49:30 +0000 (20:49 +0000)] 
Organize the various flag bits of the ExprList_item object into a substructure
so that the whole lot can be copied all at once.  Faster and smaller code.

FossilOrigin-Name: 5341d4bbe9a943f9cdbbdea829e18f108e98972ebb706396c50fc62fcc6a6328

3 years agoMerge trunk fixes into the right-join branch.
drh [Mon, 2 May 2022 20:14:26 +0000 (20:14 +0000)] 
Merge trunk fixes into the right-join branch.

FossilOrigin-Name: e01f4c05c21e89dcc7985e00874f288d9ba5d5d932f7284f8d970bd3145ac0c2

3 years agoImproved comments.
drh [Mon, 2 May 2022 20:04:34 +0000 (20:04 +0000)] 
Improved comments.

FossilOrigin-Name: 158b80bed61ade793ccfd979f26a5231fabc8c14697ca0141bba61bc13e3b2ba

3 years agoName resolution and "*" wildcard expansion for parenthesized FROM clauses
drh [Mon, 2 May 2022 19:59:03 +0000 (19:59 +0000)] 
Name resolution and "*" wildcard expansion for parenthesized FROM clauses
seems to work the same as PG.  The code is chaos, however, and needs some
cleanup.

FossilOrigin-Name: 6f9c0b07aadc5189c65c3ee4e6938aac10fc0d98f1cb06980f5e5d7b0308f237

3 years agoRemove a testcase() macro taht was made obsolete by [a8da85c57e07721d].
drh [Mon, 2 May 2022 15:47:57 +0000 (15:47 +0000)] 
Remove a testcase() macro taht was made obsolete by [a8da85c57e07721d].

FossilOrigin-Name: 053cf45ecaa7eac8cc64c7b2672807f736a45575a84b426263b2e1feb060b401

3 years agoDocument (in comments) that the SQLITE_FlttnUnionAll bit has a specific value
drh [Mon, 2 May 2022 15:31:06 +0000 (15:31 +0000)] 
Document (in comments) that the SQLITE_FlttnUnionAll bit has a specific value
needed by TH3.

FossilOrigin-Name: bcaa4a44749d157c5953c6f54c88b1ba29b4035f4b21fce986b7efbea372e109

3 years agoFix a harmless compiler warning in sqlite3TreeViewWinFunc() (a routine that
drh [Mon, 2 May 2022 15:23:59 +0000 (15:23 +0000)] 
Fix a harmless compiler warning in sqlite3TreeViewWinFunc() (a routine that
does not even appear in release builds).

FossilOrigin-Name: daff6070039e45df7c47b323a8352e56d1264a7bfb065fe2d79c58454c95a262

3 years agoMerge the latest trunk fixes and enhancements into the right-join branch.
drh [Mon, 2 May 2022 15:10:38 +0000 (15:10 +0000)] 
Merge the latest trunk fixes and enhancements into the right-join branch.

FossilOrigin-Name: afbcf075c1e09ae064c7b16e63501cd1d374711812664aef76bd35d02d64a2b6

3 years agoImprovement on check-in [a193749730d6cfba] so that the subroutine call to
drh [Mon, 2 May 2022 14:32:56 +0000 (14:32 +0000)] 
Improvement on check-in [a193749730d6cfba] so that the subroutine call to
the IN operator right-hand side generator from the RIGHT JOIN no-match logic
does not generate unreachable byte code.

FossilOrigin-Name: cc458317bd77046c4328715ae9e3409f3f4cd422a01162cb33405ef3a142b0a3

3 years agoBring the comments on sqlite3FindInIndex() into closer alignment with what
drh [Mon, 2 May 2022 11:24:21 +0000 (11:24 +0000)] 
Bring the comments on sqlite3FindInIndex() into closer alignment with what
that routine actually does.

FossilOrigin-Name: 40f3274745b53bb72933c1052d0e85bc74be56d3a1068e9d54dc28763a2cfef9

3 years agoDefensive code in sqlite3TreeViewWindow() to fix a compiler warning.
drh [Sat, 30 Apr 2022 19:55:28 +0000 (19:55 +0000)] 
Defensive code in sqlite3TreeViewWindow() to fix a compiler warning.

FossilOrigin-Name: b250c218b4b6327a1cae3edbc037625ba998f89ee13a9bfbc2cefd1edfc4b768

3 years agoSimplified fix to the problem with subroutine reuse in the RIGHT JOIN no-match
drh [Sat, 30 Apr 2022 18:40:22 +0000 (18:40 +0000)] 
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

3 years agoPreserve the COLLATE operator on an index on an expression when resolving
drh [Sat, 30 Apr 2022 12:35:51 +0000 (12:35 +0000)] 
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

3 years agoFurther improvements to codeEqualityTerm() for cases when an IN operator with
drh [Sat, 30 Apr 2022 00:06:52 +0000 (00:06 +0000)] 
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

3 years agoEnhance the TreeView debugging output for Expr with opcode TK_IN so as to
drh [Sat, 30 Apr 2022 00:05:37 +0000 (00:05 +0000)] 
Enhance the TreeView debugging output for Expr with opcode TK_IN so as to
show the RHS table and the subroutine address.

FossilOrigin-Name: aec1e4cd59ae874b66335e4f87322fbe31fbb752429e68bf41338db316d0a9ed

3 years agoEnhance the codeEqualityTerm() routine inside the code generator so that it is
drh [Fri, 29 Apr 2022 19:00:11 +0000 (19:00 +0000)] 
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

3 years agoWith TreeView, only show the table columns for a SrcItem if the data source
drh [Fri, 29 Apr 2022 17:45:39 +0000 (17:45 +0000)] 
With TreeView, only show the table columns for a SrcItem if the data source
is a subquery rather than a persistent table.

FossilOrigin-Name: 7b4a0d0fa1d8facaf5e550650d9b261eda7eb7a2a413627f2751f01c5477e1f3

3 years agoMultiple enhancements to the TreeView output for SrcItem, cherrypicked from
drh [Fri, 29 Apr 2022 17:13:52 +0000 (17:13 +0000)] 
Multiple enhancements to the TreeView output for SrcItem, cherrypicked from
the right-join experimental branch.

FossilOrigin-Name: 293afa81112e824eec2557d004a27319d484276f796936e16d64243fe24f6b68

3 years agoShow the USING clause as part of the tree-view display of SrcItem.
drh [Fri, 29 Apr 2022 17:03:25 +0000 (17:03 +0000)] 
Show the USING clause as part of the tree-view display of SrcItem.

FossilOrigin-Name: 9cba3ce577e442f83d7a2d6926e38ffe6bc45953c88ecdd384f3455890303cce

3 years agoMinor typo fix in a comment, for the benefit of broken IDE syntax highlighters.
drh [Fri, 29 Apr 2022 12:09:43 +0000 (12:09 +0000)] 
Minor typo fix in a comment, for the benefit of broken IDE syntax highlighters.

FossilOrigin-Name: 680ccecbc839373194ed2dcc1053e25512d9ea3f12f8c8963cb8fbd1a034d2f8

3 years agoFix problem with SQLITE_OMIT_VIRTUALTABLE builds.
dan [Thu, 28 Apr 2022 18:33:02 +0000 (18:33 +0000)] 
Fix problem with SQLITE_OMIT_VIRTUALTABLE builds.

FossilOrigin-Name: a99ee612b9bd6d75b63e557ef5bdac2143425a558cf023a0480cc28c8300a9a8

3 years agoIn treeview.c, show the columns of the table associated with each SrcItem.
drh [Thu, 28 Apr 2022 18:17:51 +0000 (18:17 +0000)] 
In treeview.c, show the columns of the table associated with each SrcItem.

FossilOrigin-Name: 3aafccb5c3c780c29090ee5eb428a6c3153627ce8bf834bbd392e79a30e9389b

3 years agoTweaks to the name resolution on parenthesized joins. A small number of
drh [Thu, 28 Apr 2022 17:35:58 +0000 (17:35 +0000)] 
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

3 years agoMerge trunk enhancements into the right-join branch.
drh [Thu, 28 Apr 2022 12:52:49 +0000 (12:52 +0000)] 
Merge trunk enhancements into the right-join branch.

FossilOrigin-Name: 3fd9706bba4a71cb5c7ce1341c3be0a7727941445820a073e7b2f0f32512e8ef

3 years agoFix a harmless typo in a comment.
drh [Wed, 27 Apr 2022 18:38:46 +0000 (18:38 +0000)] 
Fix a harmless typo in a comment.

FossilOrigin-Name: e1f4a115df34e45cf1bcf98961c699b582f564a58a979e95853b219bda06212c

3 years agoWhen computing STAT1 values using ANALYZE, if a ratio comes out to be between
drh [Wed, 27 Apr 2022 16:41:56 +0000 (16:41 +0000)] 
When computing STAT1 values using ANALYZE, if a ratio comes out to be between
1.0 and 1.1, then round it down to 1 rather than the using the default rounding
rule of changing it to 2.  The reduces the estimation error for the
case where a column value is very nearly, but not quite unique.

FossilOrigin-Name: eb59c46a5aed69bc6fd096997bf24c082e533c1085439f6ec1fbe5ff78e8b374

3 years agoFix a test problem in rbubusy.test causing a crash under some circumstances.
dan [Wed, 27 Apr 2022 13:33:48 +0000 (13:33 +0000)] 
Fix a test problem in rbubusy.test causing a crash under some circumstances.

FossilOrigin-Name: bc5bbd9fa636cc9ef0cbbc0600b8fc1404b9732670ac4e7a8b5a230fbce758d5

3 years agoUpdate corruptL.test so that it works with SQLITE_ENABLE_OVERSIZE_CELL_CHECK builds.
dan [Tue, 26 Apr 2022 19:16:11 +0000 (19:16 +0000)] 
Update corruptL.test so that it works with SQLITE_ENABLE_OVERSIZE_CELL_CHECK builds.

FossilOrigin-Name: b1bec72043f798f4d4d30e6b60a45ed4dc521115c8a9f97bb8228e3f089deefb

3 years agoFix a problem with automatic indexes introduced by
drh [Mon, 25 Apr 2022 20:56:55 +0000 (20:56 +0000)] 
Fix a problem with automatic indexes introduced by
check-in [664b461bb5063d980] and reported by
[forum:/forumpost/0d3200f4f3bcd3a3|forum post 0d3200f4f3bcd3a3].

FossilOrigin-Name: 134cfb18ff930e4bccc1a7412a02be353bf67c6d5080bc0673afaac81afa889c

3 years agoDo not allow the push-down optimization on the right table of a RIGHT JOIN. autoindex-fix
drh [Mon, 25 Apr 2022 20:47:58 +0000 (20:47 +0000)] 
Do not allow the push-down optimization on the right table of a RIGHT JOIN.

FossilOrigin-Name: 05917bfa02a7b6678c147d10fb53f55532ab15fd5d82d925ae921ae3759f0115

3 years agoThe pushDownWhereTerms() routine should be using
drh [Mon, 25 Apr 2022 20:38:42 +0000 (20:38 +0000)] 
The pushDownWhereTerms() routine should be using
sqlite3ExprIsTableConstraint(), not sqlite3ExprIsTableConstant().  This fixes
many problems, but still an error persists in join7.test.

FossilOrigin-Name: 10bf0e613809f71cc1a47ad40b517e2a66671212a6464e179c9d377e8b70d499

3 years agoFix a problem with automatic indexes introduced by
drh [Mon, 25 Apr 2022 19:40:33 +0000 (19:40 +0000)] 
Fix a problem with automatic indexes introduced by
check-in [664b461bb5063d980] and reported by
[forum:/forumpost/0d3200f4f3bcd3a3|forum post 0d3200f4f3bcd3a3].

FossilOrigin-Name: 7ca3456c00998a429418ff29cf251b381586b330b88344c94a40c5df0b71da85

3 years agoAdd a new optimizer disabling bit to disable just the UNION ALL branch of the
drh [Mon, 25 Apr 2022 14:59:59 +0000 (14:59 +0000)] 
Add a new optimizer disabling bit to disable just the UNION ALL branch of the
query flattener.

FossilOrigin-Name: c0f9ebab5455d8541a562122d3270b95ce571c3fd870b0048dda2b036c2b66c0

3 years agoAvoid unintended side-effects on Parse.nSelect in the
drh [Mon, 25 Apr 2022 14:49:48 +0000 (14:49 +0000)] 
Avoid unintended side-effects on Parse.nSelect in the
sqlite3ViewGetColumnNames() routine.

FossilOrigin-Name: 59789fe1e745bb6f81898176e7e9c6064ac9f4bbefb4dc3c8f3e4c1379568f69

3 years agoRemove NEVER() on branches formerly thought to unreachable
drh [Mon, 25 Apr 2022 10:43:19 +0000 (10:43 +0000)] 
Remove NEVER() on branches formerly thought to unreachable
(see check-in [71272caff5874137]) in order to fix the first bug reported
by [forum:/forumpost/28821db852|forum post 28821db852].

FossilOrigin-Name: bd6811d8110d5f00596e2eff6d4b02af8b6d8557d41990e6f50518ead0fa01fb

3 years agoMerge enhancements and fixes from trunk into the right-join branch.
drh [Sat, 23 Apr 2022 19:26:34 +0000 (19:26 +0000)] 
Merge enhancements and fixes from trunk into the right-join branch.

FossilOrigin-Name: 2fb165cf8bd1e43248612aa2922bd311df30dcbb3c2f1daee73c363e409c501f

3 years agoPrevent the ORDER BY LIMIT optimization from running if the innermost loop
drh [Sat, 23 Apr 2022 19:21:47 +0000 (19:21 +0000)] 
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

3 years agoIn debug builds, add extra code to verify that there are no jumps that try to
drh [Sat, 23 Apr 2022 18:46:03 +0000 (18:46 +0000)] 
In debug builds, add extra code to verify that there are no jumps that try to
escape from the right-join body subroutine.

FossilOrigin-Name: 45fe919266ba1843f3eeeb511ab43126069d4976c9fc64e57e0390c21f110b6e

3 years agoFix false-positives in sqlite3VdbeNoJumpsOutsideSubrtn(). All tests pass now. right-join-subrtn-check
drh [Sat, 23 Apr 2022 18:34:55 +0000 (18:34 +0000)] 
Fix false-positives in sqlite3VdbeNoJumpsOutsideSubrtn().  All tests pass now.

FossilOrigin-Name: 1300d978d5a072780e0f16722e42461dc983de9b4dfb2f5a7023c74c92ab9bc8

3 years agoFor debug builds, if the RIGHT JOIN body subroutine contains a jump that
drh [Sat, 23 Apr 2022 18:04:31 +0000 (18:04 +0000)] 
For debug builds, if the RIGHT JOIN body subroutine contains a jump that
escapes the subroutine, then abort the prepared statement with a descriptive
error and SQLITE_INTERNAL.  This extra sanity check causes many tests to
fail.

FossilOrigin-Name: 2c5bb2bff26cc70d8cac78ddd12d5ac37ab1472f5f88afbd975950a18ac2804d

3 years agoFix an operator typo - This indicates that the branch needs further
drh [Sat, 23 Apr 2022 14:30:22 +0000 (14:30 +0000)] 
Fix an operator typo - This indicates that the branch needs further
investigation and verification.

FossilOrigin-Name: f6ab67965b718b0c6d7faf769c7e47384cfd2ddbb03df518e0c5d367f8583387

3 years agoCorrectly resolve left and right USING columns of an outer join in a
drh [Sat, 23 Apr 2022 07:31:50 +0000 (07:31 +0000)] 
Correctly resolve left and right USING columns of an outer join in a
parenthesized subjoin.

FossilOrigin-Name: ea91aba88c31a042f4e32d66dfa089f95d0f9d316ab26f298085eb34dbf73e86

3 years agoFix minor problems with the new join table name resolution logic. right-join-colnames
drh [Sat, 23 Apr 2022 07:29:34 +0000 (07:29 +0000)] 
Fix minor problems with the new join table name resolution logic.

FossilOrigin-Name: 3a6b0db4519072dbd41b1c105bf1a0c6b4dd90380e94a5662645d8d41483c707

3 years agoAdd the ability to access the USING columns of the right or left tables
drh [Fri, 22 Apr 2022 23:18:21 +0000 (23:18 +0000)] 
Add the ability to access the USING columns of the right or left tables
of an OUTER JOIN even if the OUTER JOIN is in parentheses.  Prototype code
only.

FossilOrigin-Name: c3a427575fe71de3061495059e253c72c7213e2925ee2873e4f59fc73bfae103

3 years agoMerge the latest enhancements and fixes from trunk onto the right-join branch.
drh [Fri, 22 Apr 2022 19:52:51 +0000 (19:52 +0000)] 
Merge the latest enhancements and fixes from trunk onto the right-join branch.

FossilOrigin-Name: 7f8983345d1e3ac28d736fce9f90772aa0e4654670a1db3dd0ee45b55e92f2e4

3 years agoMake use of the "%!S" format when running ExplainSubquery.
drh [Fri, 22 Apr 2022 18:07:38 +0000 (18:07 +0000)] 
Make use of the "%!S" format when running ExplainSubquery.

FossilOrigin-Name: 9425d79cb407dedc259655625369e023d22a04ef7db606ea3eefe7e4d662be1a

3 years agoImprove EXPLAIN QUERY PLAN output and comments on bytecode listings by
drh [Fri, 22 Apr 2022 17:36:10 +0000 (17:36 +0000)] 
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

3 years agoHonor the MATERIALIZED keyword on a common table expression by not flattening
drh [Fri, 22 Apr 2022 16:15:48 +0000 (16:15 +0000)] 
Honor the MATERIALIZED keyword on a common table expression by not flattening
the CTE into an outer query.

FossilOrigin-Name: 8d631a6b9eb06b54b10eda595a4c588ca38f909b4afa653b24d1f720b55d72f7

3 years agoAdd test cases to check the handling of SQLITE_BUSY in rbu.
dan [Fri, 22 Apr 2022 15:18:41 +0000 (15:18 +0000)] 
Add test cases to check the handling of SQLITE_BUSY in rbu.

FossilOrigin-Name: 6fccc733c6041a2946fb3d37e4737ae37defae5c110225dd746cdc038cc64957

3 years agoSimplification of data structures in the wildcard expander for
drh [Fri, 22 Apr 2022 13:34:45 +0000 (13:34 +0000)] 
Simplification of data structures in the wildcard expander for
SF_NestedFrom queries.

FossilOrigin-Name: f7c18262347ff430879d5afc7a118d2b9b0050c845c6b1fe6c047062ea2ba8fe

3 years agoMinor simplification to the result-set wildcard expander for SF_NestedFrom.
drh [Fri, 22 Apr 2022 12:46:46 +0000 (12:46 +0000)] 
Minor simplification to the result-set wildcard expander for SF_NestedFrom.

FossilOrigin-Name: d942530a6550a0cbe31790e462b0f0d57b9b4a896161878b7d45d11cbc1cb7a3

3 years agoMerge the latest trunk fixes into the right-join branch.
drh [Fri, 22 Apr 2022 09:57:57 +0000 (09:57 +0000)] 
Merge the latest trunk fixes into the right-join branch.

FossilOrigin-Name: c74dc574c3b24a7d3533202f33b15341b043cfd89a80250563e6771ab6b6b8a7

3 years agoPrevious fix to join8.test needs a return.
drh [Thu, 21 Apr 2022 23:34:35 +0000 (23:34 +0000)] 
Previous fix to join8.test needs a return.

FossilOrigin-Name: 7b4cd705a0339ddacad19564b07e50e4f68f54bf14dd2cd5d59b39314a4d2523

3 years agoDisable join8.test if the build lacks support for virtual tables.
drh [Thu, 21 Apr 2022 23:01:24 +0000 (23:01 +0000)] 
Disable join8.test if the build lacks support for virtual tables.

FossilOrigin-Name: 94e1916a2f594e6b8a54734027deb99688244d05cefb3c78f23afab49af1e08f

3 years agoAdd support for RIGHT and FULL JOIN.
drh [Thu, 21 Apr 2022 19:38:17 +0000 (19:38 +0000)] 
Add support for RIGHT and FULL JOIN.

FossilOrigin-Name: f766dff012af0ea3c28a8ce4db850cd0205729a8283bce1e442992aded7c734b

3 years agoFix harmless compiler warnings.
drh [Thu, 21 Apr 2022 19:25:51 +0000 (19:25 +0000)] 
Fix harmless compiler warnings.

FossilOrigin-Name: 29255664127a975e5b0d5767cd4e56d93ff2ea1994702cdfbdca1b700952502e

3 years agoFix a harmless uninitialized variable warning in MSVC.
drh [Thu, 21 Apr 2022 19:20:38 +0000 (19:20 +0000)] 
Fix a harmless uninitialized variable warning in MSVC.

FossilOrigin-Name: b870d2a2fa54ddab6ffc9b9d95f52420a5a6831aeb73dac75355ca1ab15a190e

3 years agoFix harmless compiler warnings in the CLI.
drh [Thu, 21 Apr 2022 19:14:23 +0000 (19:14 +0000)] 
Fix harmless compiler warnings in the CLI.

FossilOrigin-Name: dfd2100bc4f316825fd199b347849d1a2b941837f9eedcf36f3c3d280692b991

3 years agoMake sure the code generator knows to invoke row-value subroutines which
drh [Thu, 21 Apr 2022 14:48:40 +0000 (14:48 +0000)] 
Make sure the code generator knows to invoke row-value subroutines which
running the right-join post-processing loop.

FossilOrigin-Name: fd328e52aee1dace12b1c2f44b6f7e9d15d8f77c8e9d9e3d85840a129a4b1808

3 years agoEnsure correct fg.isNestedFrom values even on crazy parses.
drh [Thu, 21 Apr 2022 14:08:29 +0000 (14:08 +0000)] 
Ensure correct fg.isNestedFrom values even on crazy parses.

FossilOrigin-Name: e611e8e62c948d28cd3f28452d3096bab06998a685ed9434061cc2054f5cac32

3 years agoAvoid materializing columns of SF_NestedFrom subqueries that are never used.
drh [Thu, 21 Apr 2022 13:11:26 +0000 (13:11 +0000)] 
Avoid materializing columns of SF_NestedFrom subqueries that are never used.
Other code improvements manually imported from the right-join-paren branch.

FossilOrigin-Name: cd8272fc2a34d1b245fd95208b9b601266ee7d2ff0f5ce52d03752f2c4e852a2

3 years agoFor CLI, fix how columnar mode fills in empty portions of wrapped row outputs.
larrybr [Wed, 20 Apr 2022 22:41:10 +0000 (22:41 +0000)] 
For CLI, fix how columnar mode fills in empty portions of wrapped row outputs.

FossilOrigin-Name: 77aed89192bdbad819ac17bf5d08728278a9b8cbbbef1d805df230caff79b417

3 years agoSmall correction to the new bUsed logic of sqlite3ProcessJoin().
drh [Wed, 20 Apr 2022 18:12:42 +0000 (18:12 +0000)] 
Small correction to the new bUsed logic of sqlite3ProcessJoin().

FossilOrigin-Name: ba04142e09bb1ccc86824760a2e11df47e070285a2d09c2f61b75255886597cd

3 years agoMerge window function fix from trunk.
drh [Wed, 20 Apr 2022 16:54:47 +0000 (16:54 +0000)] 
Merge window function fix from trunk.

FossilOrigin-Name: b6b9e185f8c44b5f2f51111f7c5e4e2d77c8b853c5be271467ce138e8066340c

3 years agoRemove an unnecessary assignment operation.
drh [Wed, 20 Apr 2022 16:53:23 +0000 (16:53 +0000)] 
Remove an unnecessary assignment operation.

FossilOrigin-Name: ed46527aca170ccbe9ed9ea4ae065db72c82dec17da7b99c928fae4495f05c2b

3 years agoFix a problem with using multiple SQLITE_SUBTYPE function as window functions in...
dan [Wed, 20 Apr 2022 16:42:57 +0000 (16:42 +0000)] 
Fix a problem with using multiple SQLITE_SUBTYPE function as window functions in a single query.

FossilOrigin-Name: 9430ead7ba433cbfce99f4f364a0c08499230e3a04f167326b0f131f098ffa09

3 years agoComment fixes and improvements in sqlite3ProcessJoin().
drh [Wed, 20 Apr 2022 16:26:22 +0000 (16:26 +0000)] 
Comment fixes and improvements in sqlite3ProcessJoin().

FossilOrigin-Name: 1118655f4d58da1273e83954c80d8bc17fa3bde7a39e81cb9947d59894d5ab93

3 years agoImproved tracking of nested SELECT objects used to implement
drh [Wed, 20 Apr 2022 15:07:39 +0000 (15:07 +0000)] 
Improved tracking of nested SELECT objects used to implement
parenthensized FROM terms.

FossilOrigin-Name: 0da2232624571f4020c05d775ea518514d748fba8dacd4caba2e2e6ed1ae399f

3 years agoAlso show the ENAME_SPAN value in sqlite3TreeViewExprList(), if there is one.
drh [Wed, 20 Apr 2022 12:15:51 +0000 (12:15 +0000)] 
Also show the ENAME_SPAN value in sqlite3TreeViewExprList(), if there is one.

FossilOrigin-Name: c1d42861778d65f7014c43fbaf09972a69ff0d81bfc2f4720160a989489cf2c8

3 years agoImproved TreeView output for ExprList: Show the ENAME_TAB value, if there
drh [Wed, 20 Apr 2022 12:14:20 +0000 (12:14 +0000)] 
Improved TreeView output for ExprList:   Show the ENAME_TAB value, if there
is one.

FossilOrigin-Name: eb3f883b45f1bf3f388823360f4aec2d4b8776bfd96185b4fb44b7bc95c62318

3 years agoAdd a new comment to the body of lookupName(). No code changes.
drh [Wed, 20 Apr 2022 12:02:52 +0000 (12:02 +0000)] 
Add a new comment to the body of lookupName().  No code changes.

FossilOrigin-Name: 22fa9b9b450fbbf7578597714eb1094f7d7433ac13497dc7d4a9affc4a2652ad

3 years agoMerge the ALTER TABLE fix from trunk.
drh [Tue, 19 Apr 2022 23:00:32 +0000 (23:00 +0000)] 
Merge the ALTER TABLE fix from trunk.

FossilOrigin-Name: d5ceaef3fca8cb4791ead9cbfe00d0eafa1bdc2b0522c3599c68b40fe6a7efe2

3 years agoFix a problem in ALTER TABLE with handling "table.*" expressions within SELECT statem...
dan [Tue, 19 Apr 2022 20:47:18 +0000 (20:47 +0000)] 
Fix a problem in ALTER TABLE with handling "table.*" expressions within SELECT statements in triggers.

FossilOrigin-Name: 24755fd0657252e49793bb1fe906973a2dd84a1bde03bea9a762de36cc96c2d2

3 years agoImproved comment on the JF_LTORJ constant definition.
drh [Tue, 19 Apr 2022 19:51:51 +0000 (19:51 +0000)] 
Improved comment on the JF_LTORJ constant definition.

FossilOrigin-Name: e0744da95fc010dc3a2e030ff491bcfa08a18691ee6ebc7d4e8aab3850f56eec

3 years agoFix a NULL-pointer dereference that can occur on an aggregate query that
drh [Tue, 19 Apr 2022 18:23:01 +0000 (18:23 +0000)] 
Fix a NULL-pointer dereference that can occur on an aggregate query that
uses FULL JOIN.  dbsqlfuzz 496a35dd4eefcd7935aaaeb0c69056bf49785d28.

FossilOrigin-Name: 63b8f8aec2a9ac3fbbd02715aa308eaf43c9ffde9d7c6db026d46edc575e7bdd

3 years agoMark an unreachable "just-in-case" branch as unreachable.
drh [Tue, 19 Apr 2022 15:56:03 +0000 (15:56 +0000)] 
Mark an unreachable "just-in-case" branch as unreachable.

FossilOrigin-Name: b966d52437f08a6759a83a45cafb0d706a8933a8e55dee38ae78166d1a5b3ba4

3 years agoAdd 512 new join test cases derived from PostgreSQL output.
drh [Tue, 19 Apr 2022 15:01:57 +0000 (15:01 +0000)] 
Add 512 new join test cases derived from PostgreSQL output.

FossilOrigin-Name: 78d58e461f99366d2749ccd6d02ab4cba0cab20bb80c097e7128da1e50303549