/ Check-in [778b1224]
Login

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

Overview
Comment:Fix an assert() failure that could occur in a join query if the RHS of an IN() operator is a list containing correlated expressions. This problem was introduced by checkin [e130319317e7611938] which was part of the fix for ticket [787fa716be3a7f650c] - so this commit is part of that ticket's fix too.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 778b1224a318d0137c7dab8361128f593506d3677267898119b934b4d66dfe38
User & Date: dan 2019-05-18 21:22:25
References
2019-05-19
17:01 Ticket [787fa716] Assertion fault when multi-use subquery implemented by co-routine status still Fixed with 3 other changes artifact: 929aa109 user: mrigger
Context
2019-05-20
10:36
Update the sqlite3ExprCompare() routine so that it does not think "? IS NOT TRUE" is the same as "? IS TRUE". Fix for [d3e7f2ba5b3]. check-in: 99eba69b user: dan tags: trunk
2019-05-18
21:22
Fix an assert() failure that could occur in a join query if the RHS of an IN() operator is a list containing correlated expressions. This problem was introduced by checkin [e130319317e7611938] which was part of the fix for ticket [787fa716be3a7f650c] - so this commit is part of that ticket's fix too. check-in: 778b1224 user: dan tags: trunk
19:49
Avoid including the comment in the output of "PRAGMA table_info" in situations where there is a comment following a DEFAULT value within a CREATE TABLE statement. check-in: d91095ba user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  2804   2804         /* If the expression is not constant then we will need to
  2805   2805         ** disable the test that was generated above that makes sure
  2806   2806         ** this code only executes once.  Because for a non-constant
  2807   2807         ** expression we need to rerun this code each time.
  2808   2808         */
  2809   2809         if( addrOnce && !sqlite3ExprIsConstant(pE2) ){
  2810   2810           sqlite3VdbeChangeToNoop(v, addrOnce);
         2811  +        ExprClearProperty(pExpr, EP_Subrtn);
  2811   2812           addrOnce = 0;
  2812   2813         }
  2813   2814   
  2814   2815         /* Evaluate the expression and insert it into the temp table */
  2815   2816         r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
  2816   2817         sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
  2817   2818         sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1);

Changes to test/join5.test.

   301    301   do_eqp_test 7.4 {
   302    302     SELECT * FROM t3 LEFT JOIN t4 ON (t4.x = t3.x) WHERE (t4.y = ? OR t4.z = ?);
   303    303   } {
   304    304     QUERY PLAN
   305    305     |--SCAN TABLE t3
   306    306     `--SEARCH TABLE t4 USING INDEX t4xz (x=?)
   307    307   } 
          308  +
          309  +reset_db
          310  +do_execsql_test 8.0 {
          311  +  CREATE TABLE t0 (c0, c1, PRIMARY KEY (c0, c1));
          312  +  CREATE TABLE t1 (c0);
          313  +
          314  +  INSERT INTO t1 VALUES (2);
          315  +
          316  +  INSERT INTO t0 VALUES(0, 10);
          317  +  INSERT INTO t0 VALUES(1, 10);
          318  +  INSERT INTO t0 VALUES(2, 10);
          319  +  INSERT INTO t0 VALUES(3, 10);
          320  +}
          321  +
          322  +do_execsql_test 8.1 {
          323  +  SELECT * FROM t0, t1 
          324  +  WHERE (t0.c1 >= 1 OR t0.c1 < 1) AND t0.c0 IN (1, t1.c0) ORDER BY 1;
          325  +} {
          326  +  1 10 2
          327  +  2 10 2
          328  +}
   308    329   
   309    330   finish_test