aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2025-05-31 16:17:14 +0000
committerdrh <>2025-05-31 16:17:14 +0000
commit52486939249c1104572b8c45563de19f600e7f96 (patch)
tree81be46aa39fd2207b61a2f05e1fe261c59b61b46 /src
parent1ff4233f903d0fae532a6bda64ccbb7a319e13db (diff)
downloadsqlite-52486939249c1104572b8c45563de19f600e7f96.tar.gz
sqlite-52486939249c1104572b8c45563de19f600e7f96.zip
Relax query flattener constraint (3b) and thereby allow flattening the RHS of
a LEFT JOIN even if the RHS contains a virtual table. This was previously disallowed by [9dbae1df75219e2a] as a performance optimization. It turns out that the constraint causes performance issues, and we do not have a record of any performance issue that it solves. FossilOrigin-Name: 1ddaa92057e550ea281d45d9860eafe69399224725548a93dd91c47a34e52152
Diffstat (limited to 'src')
-rw-r--r--src/select.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/select.c b/src/select.c
index a8af934e4..8eaf5e2b6 100644
--- a/src/select.c
+++ b/src/select.c
@@ -4245,9 +4245,9 @@ static int compoundHasDifferentAffinities(Select *p){
** from 2015-02-09.)
**
** (3) If the subquery is the right operand of a LEFT JOIN then
-** (3a) the subquery may not be a join and
-** (3b) the FROM clause of the subquery may not contain a virtual
-** table and
+** (3a) the subquery may not be a join
+** (**) Was (3b): "the FROM clause of the subquery may not contain
+** a virtual table"
** (**) Was: "The outer query may not have a GROUP BY." This case
** is now managed correctly
** (3d) the outer query may not be DISTINCT.
@@ -4463,7 +4463,7 @@ static int flattenSubquery(
*/
if( (pSubitem->fg.jointype & (JT_OUTER|JT_LTORJ))!=0 ){
if( pSubSrc->nSrc>1 /* (3a) */
- || IsVirtual(pSubSrc->a[0].pSTab) /* (3b) */
+ /**** || IsVirtual(pSubSrc->a[0].pSTab) (3b)-omitted */
|| (p->selFlags & SF_Distinct)!=0 /* (3d) */
|| (pSubitem->fg.jointype & JT_RIGHT)!=0 /* (26) */
){