SQLite

Check-in [f1eae192]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix another problem with mixed join types and the RIGHT JOIN strength-reduction optimization. Forum post befdab472d.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f1eae192315335d7e385b0a801a17700a9718d245bda6628518c5df9a1e9d3d6
User & Date: dan 2023-11-10 20:55:20
Context
2023-11-11
14:43
Do not cache a statement's column count in the JNI wrapper1 API because an ALTER TABLE via another statement may invalidate it, as reported in forum post 6d80efd58d4591c7. (check-in: a6ab88e9 user: stephan tags: trunk)
06:20
Pervasive changes to console_io.{c,h} in support of simplifying ubiquitous emit ops in shell, and to get better control of console streams that might be opened only via .read or .output commands. Changes to shell to use {s,o,e}put{f,z}(...) calls for initial testing, but this check-in has few such conversions so that most will be in a separate check-in. Many renames to better follow recent coding convention. This code seems to be working, but has not been tested on difficult platforms or with multiple console hosts yet. So it is a WIP. (check-in: 14762a00 user: larrybr tags: console-io-lib)
2023-11-10
21:03
Fix another problem with mixed join types and the RIGHT JOIN strength-reduction optimization. (check-in: 8f01f8b2 user: drh tags: branch-3.44)
20:55
Fix another problem with mixed join types and the RIGHT JOIN strength-reduction optimization. Forum post befdab472d. (check-in: f1eae192 user: dan tags: trunk)
20:46
Additional debugging information on the tree-dump of the BETWEEN operator. (check-in: aca31e49 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/select.c.

7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
              TREETRACE(0x1000,pParse,p,
                        ("RIGHT-JOIN simplifies to JOIN on term %d\n",j));
              pI2->fg.jointype &= ~(JT_RIGHT|JT_OUTER);
              unsetJoinExpr(p->pWhere, pI2->iCursor, 1);
            }
          }
        }
        for(j=pTabList->nSrc-1; j>=i; j--){
          pTabList->a[j].fg.jointype &= ~JT_LTORJ;
          if( pTabList->a[j].fg.jointype & JT_RIGHT ) break;
        }
      }
    }

    /* No further action if this term of the FROM clause is not a subquery */







|







7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
              TREETRACE(0x1000,pParse,p,
                        ("RIGHT-JOIN simplifies to JOIN on term %d\n",j));
              pI2->fg.jointype &= ~(JT_RIGHT|JT_OUTER);
              unsetJoinExpr(p->pWhere, pI2->iCursor, 1);
            }
          }
        }
        for(j=pTabList->nSrc-1; j>=0; j--){
          pTabList->a[j].fg.jointype &= ~JT_LTORJ;
          if( pTabList->a[j].fg.jointype & JT_RIGHT ) break;
        }
      }
    }

    /* No further action if this term of the FROM clause is not a subquery */

Changes to test/joinH.test.

286
287
288
289
290
291
292


















293
294
  SELECT * FROM t1 LEFT JOIN t2 RIGHT JOIN t3 ON (t2.c=10)
} {{} {} {} {} 3 3}

do_execsql_test 11.3 {
  SELECT * FROM t1 LEFT JOIN t2 RIGHT JOIN t3 ON (t2.c=10) WHERE t1.a=1
} {}




















finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
  SELECT * FROM t1 LEFT JOIN t2 RIGHT JOIN t3 ON (t2.c=10)
} {{} {} {} {} 3 3}

do_execsql_test 11.3 {
  SELECT * FROM t1 LEFT JOIN t2 RIGHT JOIN t3 ON (t2.c=10) WHERE t1.a=1
} {}

#-------------------------------------------------------------------------
reset_db

do_execsql_test 12.1 {
  CREATE TABLE t1(a1 INT, b1 TEXT);
  INSERT INTO t1 VALUES(88,'');
  CREATE TABLE t2(c2 INT, d2 TEXT);
  INSERT INTO t2 VALUES(88,'');
  CREATE TABLE t3(e3 TEXT PRIMARY KEY);
  INSERT INTO t3 VALUES('');
}

do_execsql_test 12.2 {
  SELECT * FROM t1 LEFT JOIN t2 ON true RIGHT JOIN t3 ON d2=e3 WHERE c2 BETWEEN NULL AND a1;
}
do_execsql_test 12.3 {
  SELECT * FROM t1 LEFT JOIN t2 ON true RIGHT JOIN t3 ON d2=e3 WHERE c2 BETWEEN NULL AND a1;
}

finish_test