]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
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 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

3 years agoRemove unnecessary cases for the resolver.
drh [Tue, 19 Apr 2022 09:39:39 +0000 (09:39 +0000)] 
Remove unnecessary cases for the resolver.

FossilOrigin-Name: 5bc9aa68e2f938f6a70dd4b08703fe52416d17efe461ec65d37332b57b827fdd

3 years agoAdd the omitted "finish_test" to the end of joinA.test.
drh [Tue, 19 Apr 2022 02:03:18 +0000 (02:03 +0000)] 
Add the omitted "finish_test" to the end of joinA.test.

FossilOrigin-Name: 0907505cc9bb051280108fe5074211374b31836fae1ae6667a3de69f9d83fc01

3 years agoNew test cases for RIGHT and FULL JOIN.
drh [Tue, 19 Apr 2022 00:24:52 +0000 (00:24 +0000)] 
New test cases for RIGHT and FULL JOIN.

FossilOrigin-Name: 5c2f670e0fb35648e1d6e1c48f4d8af815cd57d59eac6ba22e253511bb078870

3 years agoFix the query flattener so that it does not flatten a RIGHT or FULL JOIN into
drh [Mon, 18 Apr 2022 23:20:02 +0000 (23:20 +0000)] 
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

3 years agoNew test cases, including one that gets a different result than Postgres.
drh [Mon, 18 Apr 2022 22:51:24 +0000 (22:51 +0000)] 
New test cases, including one that gets a different result than Postgres.

FossilOrigin-Name: 49ea11a4a5fd630db44f458304d4f45fa103529ed6b36d538c78074965e8d799

3 years agoDisable the unused EU4_EXPR mode for the IdList object.
drh [Mon, 18 Apr 2022 19:48:31 +0000 (19:48 +0000)] 
Disable the unused EU4_EXPR mode for the IdList object.

FossilOrigin-Name: 5bcf4aa3bf6b1b9f47142bc37683bb3bf0adeffd052d07449af7c9b415add052

3 years agoEven more test cases.
drh [Mon, 18 Apr 2022 19:34:41 +0000 (19:34 +0000)] 
Even more test cases.

FossilOrigin-Name: 5f4310a104443ac3fc56f9d9cd2d428dd3e7a2a0285c8e74de6f499439fd6868

3 years agoNew test cases for parenthesized NATURAL FULL JOINs.
drh [Mon, 18 Apr 2022 19:28:08 +0000 (19:28 +0000)] 
New test cases for parenthesized NATURAL FULL JOINs.

FossilOrigin-Name: e34250efd34b526373bf072a43a7984ca19690836d7d2464dea8338066eaee8f

3 years agoNew test case demonstrating the ability to invoke OP_NullRow on a cursor
drh [Mon, 18 Apr 2022 18:01:38 +0000 (18:01 +0000)] 
New test case demonstrating the ability to invoke OP_NullRow on a cursor
that has never been opened.

FossilOrigin-Name: d173edc242f295f5812a58cad184695881d9b1b160cd5b25e303e22848e90ce1

3 years agoMerge the btree bug-fix from trunk.
drh [Mon, 18 Apr 2022 16:23:01 +0000 (16:23 +0000)] 
Merge the btree bug-fix from trunk.

FossilOrigin-Name: a333c0b50c3af7cd818470a647d78c7c691ef15418ec7cffe80dd88405393069

3 years agoEnsure that left-hand side WITHOUT ROWID tables are set to OP_NullRow prior
drh [Mon, 18 Apr 2022 16:20:59 +0000 (16:20 +0000)] 
Ensure that left-hand side WITHOUT ROWID tables are set to OP_NullRow prior
to running the right-join loop.  This fixes a problem introduced by the
previous check-in.

FossilOrigin-Name: aab7665ce6c004df701a72aef1a5135f2c78f16c6ff728a00076afb66ba9d3a0

3 years agoFix problems with WHERE clauses that follow multiple FULL JOINs. This
drh [Mon, 18 Apr 2022 16:10:07 +0000 (16:10 +0000)] 
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

3 years agoAvoid an assert() failure in allocateSpace() triggered by a corrupt database. dbsqlfu...
dan [Mon, 18 Apr 2022 15:56:58 +0000 (15:56 +0000)] 
Avoid an assert() failure in allocateSpace() triggered by a corrupt database. dbsqlfuzz f022eb0ce64d27808574d1dcde5cf7d002dabde8.

FossilOrigin-Name: 2de7f8cc7fe18f0828bb53f1fd11f5eb828faf4d6dfaf39693dff4f8926c1c7a

3 years agoMerge the latest fixes from trunk.
drh [Mon, 18 Apr 2022 14:41:24 +0000 (14:41 +0000)] 
Merge the latest fixes from trunk.

FossilOrigin-Name: 1ba3b3ccf145d84fa75afabe2fa925f65e43f815b25b15bd60073a41aa97bf57

3 years agoImproved comment field in the bytecode generated for OP_Column and OP_Rowid.
drh [Mon, 18 Apr 2022 14:15:07 +0000 (14:15 +0000)] 
Improved comment field in the bytecode generated for OP_Column and OP_Rowid.

FossilOrigin-Name: 1b2c5cef9560123344db391cd065090d1914724715ec6643d2d9b5fac2051a21

3 years agoImproved comment field in the bytecode generated for OP_Column and OP_Rowid.
drh [Mon, 18 Apr 2022 13:57:57 +0000 (13:57 +0000)] 
Improved comment field in the bytecode generated for OP_Column and OP_Rowid.

FossilOrigin-Name: 009bbf8026106c5a74cced06cced48badb870a4b6e6a2f8104a544d2a8d79e45

3 years agoNew RIGHT JOIN test cases, one of which is currently failing.
drh [Mon, 18 Apr 2022 13:08:17 +0000 (13:08 +0000)] 
New RIGHT JOIN test cases, one of which is currently failing.

FossilOrigin-Name: 9168cbbedd1c9d735279295a78212d830e24269f6d7e445e71faa2c06973223d

3 years agoChange the row-value initialization subroutine call from within the
drh [Mon, 18 Apr 2022 11:22:46 +0000 (11:22 +0000)] 
Change the row-value initialization subroutine call from within the
right-join body subroutine from an issue to an optimization opportunity.

FossilOrigin-Name: 829d49f27c041651ffeadc1397e4dd87a9994c9290e13b93542dbd2c514769cd

3 years agoDo not allow an empty table bypass to jump outside of a right-join body
drh [Mon, 18 Apr 2022 10:26:50 +0000 (10:26 +0000)] 
Do not allow an empty table bypass to jump outside of a right-join body
subroutine.

FossilOrigin-Name: 1549dcd2353903b70abadd428eeef971ab940df04fb05a6b83b04ee30932db6d

3 years agoFix the sqlite3SrcListAppendList() routine so that it correctly adds
drh [Mon, 18 Apr 2022 10:09:29 +0000 (10:09 +0000)] 
Fix the sqlite3SrcListAppendList() routine so that it correctly adds
the JT_LTORJ attribute to the first SrcItem, if needed.

FossilOrigin-Name: 07ed0dca310d828f9fe152efa8ee2a89202771a8f661afa1dbeee34aaabef67a

3 years agoLeave sqlite3ProcessJoin() early if an OOM is encountered in the NATURAL
drh [Mon, 18 Apr 2022 09:59:33 +0000 (09:59 +0000)] 
Leave sqlite3ProcessJoin() early if an OOM is encountered in the NATURAL
to USING converter.  This avoids NULL pointer dereferences further along in
the code.

FossilOrigin-Name: 0ccb224e13ad44c7e1a3aa186821a929faabc0075fe15799476c00d9a92e9d91

3 years agoFix to the coalesce() function generation in the resolver.
drh [Mon, 18 Apr 2022 00:57:11 +0000 (00:57 +0000)] 
Fix to the coalesce() function generation in the resolver.

FossilOrigin-Name: 584bd55e20669d09b7efe3429ba847c42c32fb1eb960784c4e0dedcd96899313

3 years agoWhen converting a NATURAL JOIN into a JOIN USING, make sure to insert the
drh [Mon, 18 Apr 2022 00:04:15 +0000 (00:04 +0000)] 
When converting a NATURAL JOIN into a JOIN USING, make sure to insert the
name correctly into the IdList even if it is a wierd quoted name.

FossilOrigin-Name: e62156b696f2496e2697cb3b46f136551b58644e2a5824aa3d759596694b2f4b

3 years agoFix to the logic that computes coalesc() functions to resolve USING terms.
drh [Sun, 17 Apr 2022 23:46:18 +0000 (23:46 +0000)] 
Fix to the logic that computes coalesc() functions to resolve USING terms.

FossilOrigin-Name: 20388548d868511f8c8437718985d75fe9801835811fec716f1700727b9aa367

3 years agoDeal with OP_Return bypass in the RIGHT JOIN subroutine by adding extra
drh [Sun, 17 Apr 2022 22:58:23 +0000 (22:58 +0000)] 
Deal with OP_Return bypass in the RIGHT JOIN subroutine by adding extra
OP_Returns where needed.

FossilOrigin-Name: 71abe5641f599f27d1f0c800f6182e1168909f8aa99389b835b07d4b5f5483eb

3 years agoChange OP_Return such that if P3 is 1, the Return is a no-op when the
drh [Sun, 17 Apr 2022 20:30:52 +0000 (20:30 +0000)] 
Change OP_Return such that if P3 is 1, the Return is a no-op when the
P1 register contains a NULL.

FossilOrigin-Name: c90602328a4b26f06d76c5343d29ebb7a782186c86ea88f5965a41040cff5346

3 years agoFurther improvements to USING() processing for RIGHT and FULL JOINs. All
drh [Sun, 17 Apr 2022 18:46:17 +0000 (18:46 +0000)] 
Further improvements to USING() processing for RIGHT and FULL JOINs.  All
currently known issues are now resolved.  Performace is improved.

FossilOrigin-Name: 9fd3f22e2228dfba127f6ffe549109f3a4e910fa124adcc9c5483931bd6d5cd7

3 years agoNew test cases, one of which is failing, indicating a bug that needs fixing.
drh [Sat, 16 Apr 2022 23:38:29 +0000 (23:38 +0000)] 
New test cases, one of which is failing, indicating a bug that needs fixing.

FossilOrigin-Name: bd5fd68435ff068c18d7d46b33cf7591263a03c32a917a7df7c087b08c573cc8

3 years agoFix the USING to ON translation so that it works correctly for a sequence
drh [Sat, 16 Apr 2022 22:57:41 +0000 (22:57 +0000)] 
Fix the USING to ON translation so that it works correctly for a sequence
of two or more joins where one of the joins to the right-hand side of the
list is a RIGHT or FULL JOIN.

FossilOrigin-Name: 9ffc2b231956cde1bc90519aa174b0e2dc30ef671ed745f4f3ffa9fbb7ffab4b

3 years agoSince the query planner is unable to cope with a LEFT JOIN on the left-hand side
drh [Sat, 16 Apr 2022 19:13:16 +0000 (19:13 +0000)] 
Since the query planner is unable to cope with a LEFT JOIN on the left-hand side
of a RIGHT JOIN, detect that situation early and raise a parsing error.
This is a temporary measure that needs to be fixed.

FossilOrigin-Name: 6d5d6e0403241c99ab4a47d7b6eedcd8ebc615a8ca8d66d7e81171f901b170d7

3 years agoAdditional SELECT trace logic: Show the tree after result-set wildcard
drh [Sat, 16 Apr 2022 18:33:22 +0000 (18:33 +0000)] 
Additional SELECT trace logic:  Show the tree after result-set wildcard
expansion but before name resolution.

FossilOrigin-Name: a7babf75418adffa27dec7a9d382a60e1b9364fb51d72b0a10e2769b308b3c54

3 years agoMake shell auto-column work with lots of columns when log() is missing.
larrybr [Sat, 16 Apr 2022 17:53:25 +0000 (17:53 +0000)] 
Make shell auto-column work with lots of columns when log() is missing.

FossilOrigin-Name: 82366436ef74838dae1f379f3e5b8ad187225a30ec58fb49f047ab7c08a263cf

3 years agoFix a problem with "ON DELETE RESTRICT" and "ON UPDATE RESTRICT" foreign keys in...
dan [Sat, 16 Apr 2022 15:46:23 +0000 (15:46 +0000)] 
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

3 years agoNew test cases. One of the new test cases shows a flaw in the base design
drh [Sat, 16 Apr 2022 13:55:48 +0000 (13:55 +0000)] 
New test cases.  One of the new test cases shows a flaw in the base design
of RIGHT JOIN.

FossilOrigin-Name: 4c3ce6475a67b1e207a5b63d9e2d38ee5bc45c899ad00ee327f292bf59039b9c

3 years agoRIGHT JOIN USING now appears to work the same as PG-14. Legacy tests pass.
drh [Sat, 16 Apr 2022 12:40:52 +0000 (12:40 +0000)] 
RIGHT JOIN USING now appears to work the same as PG-14.  Legacy tests pass.

FossilOrigin-Name: 5bfb862419541de955dae35fc91f6e9fc70e2744bb786d49fa26bede80b9091d

3 years agoRevamp the USING clause processing so that it works (mostly) with RIGHT
drh [Fri, 15 Apr 2022 19:53:35 +0000 (19:53 +0000)] 
Revamp the USING clause processing so that it works (mostly) with RIGHT
and FULL JOIN.

FossilOrigin-Name: 719c8d920b435b0f234d47467a2abe2941ab7d55ecca886e211cfce577ae648c

3 years agoAvoid deleting substructure of the Expr node in lookupName() until after right-join-using
drh [Fri, 15 Apr 2022 19:49:28 +0000 (19:49 +0000)] 
Avoid deleting substructure of the Expr node in lookupName() until after
the error message is generated.

FossilOrigin-Name: b8e717663957dfd84e580bf21bc8e8881b33fdb94a2cc0c664a230e54d5e5076

3 years agoProgress toward a working USING for FULL JOIN.
drh [Fri, 15 Apr 2022 19:27:02 +0000 (19:27 +0000)] 
Progress toward a working USING for FULL JOIN.

FossilOrigin-Name: fed2646adecb0a05dd674dc1cd2c0ae205078fe552ba93b8d68891c728c67637

3 years agoWhen expanding "*" in the result set of a SELECT, do not attach a table name
drh [Fri, 15 Apr 2022 18:30:48 +0000 (18:30 +0000)] 
When expanding "*" in the result set of a SELECT, do not attach a table name
to columns that are in subsequent USING clauses.

FossilOrigin-Name: 91530990e018580ec5322ace6f0c369a32a3529a0bfb4defb25ca20223a2a80f

3 years agoThe sqlite3ProcessJoin() routine converts a NATURAL JOIN into a JOIN USING so
drh [Fri, 15 Apr 2022 17:08:40 +0000 (17:08 +0000)] 
The sqlite3ProcessJoin() routine converts a NATURAL JOIN into a JOIN USING so
that henceforth the NATURAL keyword can be ignored.

FossilOrigin-Name: 8378e1e0d289627fb294ccd3f5865ef49df3a42b8a5aa211e21be1b42d9da753

3 years agoEnhance the IdList object to exist in a single memory allocation (rather than
drh [Fri, 15 Apr 2022 15:47:14 +0000 (15:47 +0000)] 
Enhance the IdList object to exist in a single memory allocation (rather than
a separate allocate for the base object and the array of IDs).  Also permit
an IdList object to store an Expr pointer together with each name.

FossilOrigin-Name: 40f3c95871e6f40f287ef2756abafb8fc56dffdd0af69436e5c7d8e95022d94e

3 years agoAdd the "3" in the name of the sqlite3ProcessJoin() function.
drh [Fri, 15 Apr 2022 15:15:01 +0000 (15:15 +0000)] 
Add the "3" in the name of the sqlite3ProcessJoin() function.

FossilOrigin-Name: b925f72b6f679c61b0d6be16fabe64dc7605550b7bd86f35c586dcecd8217673

3 years agoRecord the three known big issues with the current RIGHT JOIN design in
drh [Thu, 14 Apr 2022 20:43:22 +0000 (20:43 +0000)] 
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

3 years agoCherry pick subroutine indentation improvements and the hardening of
drh [Thu, 14 Apr 2022 19:48:32 +0000 (19:48 +0000)] 
Cherry pick subroutine indentation improvements and the hardening of
OP_Gosub from the right-join branch back into trunk.

FossilOrigin-Name: 12645f100d902690630a2925674aedbb01d41a53426a26a2f56de5b8fdec955f

3 years agoAnother instance of indenting a subroutine.
drh [Thu, 14 Apr 2022 19:05:17 +0000 (19:05 +0000)] 
Another instance of indenting a subroutine.

FossilOrigin-Name: 73f4036b04798660b30e540cbab69420078df9fb62a6a39944e078c36272f905

3 years agoCheck for interrupts and invoke the progress handler following a Gosub
drh [Thu, 14 Apr 2022 18:19:06 +0000 (18:19 +0000)] 
Check for interrupts and invoke the progress handler following a Gosub
opcode, to avoid and recover from infinite subroutine loops.

FossilOrigin-Name: 647211e044a5856ceb6bf3e7b78e650fe7d81f8b7bf34568b99b346405ba520c

3 years agoRerun the subroutines that compute row-values if necessary from within
drh [Thu, 14 Apr 2022 16:34:07 +0000 (16:34 +0000)] 
Rerun the subroutines that compute row-values if necessary from within
the RIGHT JOIN body subroutine.

FossilOrigin-Name: 9b9038bcd0ab5c4f01661456635526cef764f854ff24018a5e6e43825d07eb59

3 years agoAdjust the output formatting of bytecode listings so that subroutines used
drh [Thu, 14 Apr 2022 15:55:34 +0000 (15:55 +0000)] 
Adjust the output formatting of bytecode listings so that subroutines used
to implement subqueries are indented one level.

FossilOrigin-Name: 079b7b125206fb295720612f4853a5b786ec431ab595d35407195844779c149d

3 years agoDisable autoindexing for the RIGHT JOIN loop.
drh [Thu, 14 Apr 2022 14:58:50 +0000 (14:58 +0000)] 
Disable autoindexing for the RIGHT JOIN loop.

FossilOrigin-Name: 402a89e33e39b00352dc9fb3301d03c6f75d8bb5c2ad540cd22506bff10b4d85

3 years agoAdjust assert() statements to account for the new always-NULL cursor type
drh [Thu, 14 Apr 2022 14:40:29 +0000 (14:40 +0000)] 
Adjust assert() statements to account for the new always-NULL cursor type
added by [4526c5d316508093].

FossilOrigin-Name: 7822faa48a058c0b0313b9241d290153fbe74ab84f58369a70014118a9085d1d

3 years agoPrevious check-in accidentally inverted a test on an assert(). Fix that. right-join-fix
drh [Thu, 14 Apr 2022 14:19:23 +0000 (14:19 +0000)] 
Previous check-in accidentally inverted a test on an assert().  Fix that.

FossilOrigin-Name: 5ec4f806c569428851b6f0159451aa3ed66b3bc61a845fd7c543cffb694b882d

3 years agoFix assert() statements associated with artifical null-value cursors
drh [Thu, 14 Apr 2022 12:59:25 +0000 (12:59 +0000)] 
Fix assert() statements associated with artifical null-value cursors
created by RIGHT JOIN.

FossilOrigin-Name: f5bce5f152259767497ae6826c558003822d976b3f35f4d74edee59a3490efb2

3 years agoFix a harmless (false-positive) unused variable compiler warning on MSVC.
drh [Wed, 13 Apr 2022 19:00:57 +0000 (19:00 +0000)] 
Fix a harmless (false-positive) unused variable compiler warning on MSVC.

FossilOrigin-Name: 63b04c63de680261a0d3eaf27154a1e8e77e3e166c3f2dbaea985603991c74f7

3 years agoMake the sqlite3TreeViewSrcList() routine a no-op if called with a
drh [Wed, 13 Apr 2022 18:32:04 +0000 (18:32 +0000)] 
Make the sqlite3TreeViewSrcList() routine a no-op if called with a
NULL SrcList object.

FossilOrigin-Name: 185d2720e7775e3060a1647353c10aada435244db53a0732ee786788a6ecae3f

3 years agoFix an assert() in OP_Column so that it accounts for the new type of
drh [Wed, 13 Apr 2022 18:20:23 +0000 (18:20 +0000)] 
Fix an assert() in OP_Column so that it accounts for the new type of
pseudo-cursor that always returns NULL for any column.

FossilOrigin-Name: 371ddc97bef8e0d88ad965f00d27e010880174312ea36c4f1165dcf08441f40a

3 years agoIf the OP_NullRow opcode is given a cursor that has not yet been opened,
drh [Wed, 13 Apr 2022 17:41:03 +0000 (17:41 +0000)] 
If the OP_NullRow opcode is given a cursor that has not yet been opened,
then go automatically open it to a special pseudo-cursor that allows returns
NULL for every column.  Used by the new RIGHT JOIN implementation.

FossilOrigin-Name: 4526c5d316508093b7f3aeda1ce9d16ceb0be79842015a6d51f28c22b4473ca2

3 years agoMove the explain comment for the RIGHT-JOIN post-processing loop to the
drh [Wed, 13 Apr 2022 16:46:35 +0000 (16:46 +0000)] 
Move the explain comment for the RIGHT-JOIN post-processing loop to the
verify beginning of the loop - to make the start of the loop clearer to
human bytecode readers.

FossilOrigin-Name: 7ed2a271e6fcbb5e69a7f3a88d3f45fe6318819c0cc6a0dcc06c3dae5aa1503f

3 years agoAdd support for RIGHT and FULL OUTER JOINs.
drh [Wed, 13 Apr 2022 12:34:54 +0000 (12:34 +0000)] 
Add support for RIGHT and FULL OUTER JOINs.

FossilOrigin-Name: fa9d206f904280e3eafc6f4ba6c0c7325948364c62eeeb9f0fdc5825d622ec35

3 years agoThe rows of a RIGHT JOIN might come out in any arbitrary order. So disable
drh [Wed, 13 Apr 2022 12:12:01 +0000 (12:12 +0000)] 
The rows of a RIGHT JOIN might come out in any arbitrary order.  So disable
the ORDER-BY/GROUP-BY optimizations if a RIGHT JOIN is involved.

FossilOrigin-Name: d168f245ecf497368feea4697769930c00420ef47a584904dac85371b61fb78a

3 years agoFix an assert() in btree.c that might not be true for a corrupt database file.
drh [Wed, 13 Apr 2022 10:49:50 +0000 (10:49 +0000)] 
Fix an assert() in btree.c that might not be true for a corrupt database file.

FossilOrigin-Name: dbd8e2e46cfb2de0ebdbb62cda2fe669df3eda98f5d6112d541f581995b1361d

3 years agoAdd missing VdbeCoverage() macros on new branch byte-code opcodes.
drh [Wed, 13 Apr 2022 01:52:32 +0000 (01:52 +0000)] 
Add missing VdbeCoverage() macros on new branch byte-code opcodes.

FossilOrigin-Name: 218c7167e562f5c327124f02a92de85079315320a221fb0508310d927596b14c

3 years agoEnsure that the JT_LTORJ bit in the SrcItem.fg.jointype is preserved during
drh [Tue, 12 Apr 2022 20:20:54 +0000 (20:20 +0000)] 
Ensure that the JT_LTORJ bit in the SrcItem.fg.jointype is preserved during
query flattening.

FossilOrigin-Name: 61259050152321bc57dbdfdc3edcabb4f18c021b1ee0491c1e04ae24c7a59d89

3 years agoFor the bad join type error message "unknown or unsupported join type"
drh [Tue, 12 Apr 2022 18:40:14 +0000 (18:40 +0000)] 
For the bad join type error message "unknown or unsupported join type"
remove the "or unsupported" clause, because we now support all valid join
types.

FossilOrigin-Name: ab0a0562dd3594cf50ee56f6b3a5847fa5dcadf69146d560e3e7a95651b8f405

3 years agoFactor out the RIGHT JOIN non-matched row loop from sqlite3WhereEnd(). This
drh [Tue, 12 Apr 2022 18:04:29 +0000 (18:04 +0000)] 
Factor out the RIGHT JOIN non-matched row loop from sqlite3WhereEnd().  This
reduces the register pressure on that routine and helps it to run faster
in the common case where there is no RIGHT JOIN.

FossilOrigin-Name: beeecf1604d4fb11e45058f48cb2289c6542e0bc218d63a245198113d8d5476b

3 years agoMerge the latest enhancements from trunk into the right-join branch.
drh [Tue, 12 Apr 2022 17:43:30 +0000 (17:43 +0000)] 
Merge the latest enhancements from trunk into the right-join branch.

FossilOrigin-Name: b3e57ba120067c79e0398e39da9f00ecb11a5e18c36479da4c36a39e88a78a27

3 years agoEarlier detection of corruption in balance_nonroot(). dbsqlfuzz 9191ade77ebd3b7a3356e...
dan [Tue, 12 Apr 2022 17:02:27 +0000 (17:02 +0000)] 
Earlier detection of corruption in balance_nonroot(). dbsqlfuzz 9191ade77ebd3b7a3356e074957aa85b0c669d14.

FossilOrigin-Name: bff4f083eb1c35544988493a5d73a42e646c4250b841f5aae38c2183f0867a0e