SQLite

Check-in [440a7cda00]
Login

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

Overview
Comment:Do not do the optimization that attempts to pull expression values from an index on that expression when processing a multi-index OR (see check-in [a47efb7c8520a0111]) because the expression transformations that are applied become invalid when the processing moves off of the current index and on to the next index. Fix for ticket [4e8e4857d32d401f].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 440a7cda000164d3b46109caf2e1dde80681ba9b0d94ba9be6847d2b917445cf
User & Date: drh 2019-02-08 04:15:19.414
Context
2019-02-08
14:59
Merge the fix for ticket [4e8e4857d32d401f], so that this branch now contains release 3.27.1 plus the extra patch to preserve ROWID values on VACUUM. (check-in: 0cdae60ed7 user: drh tags: apple-osx)
14:55
Give the sqlite3 object a pointer to the current Parse so that if an OOM occurs, it can automatically set the Parse.rc value to SQLITE_NOMEM. This avoids a frequent extra test of db.mallocFailed in the innermost parser loop. (check-in: 5c6638040b user: drh tags: trunk)
12:46
Cherrypick the fix for ticket [4e8e4857d32d401f] from trunk. (check-in: d5d944d794 user: drh tags: branch-3.27)
04:15
Do not do the optimization that attempts to pull expression values from an index on that expression when processing a multi-index OR (see check-in [a47efb7c8520a0111]) because the expression transformations that are applied become invalid when the processing moves off of the current index and on to the next index. Fix for ticket [4e8e4857d32d401f]. (check-in: 440a7cda00 user: drh tags: trunk)
2019-02-07
19:07
Change VACUUM so that it preserves ROWID values. (check-in: 49e5d11d46 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/wherecode.c.
1752
1753
1754
1755
1756
1757
1758





1759
1760
1761
1762
1763
1764
1765
1766
1767
    ** into reference to index columns.
    **
    ** Do not do this for the RHS of a LEFT JOIN. This is because the 
    ** expression may be evaluated after OP_NullRow has been executed on
    ** the cursor. In this case it is important to do the full evaluation,
    ** as the result of the expression may not be NULL, even if all table
    ** column values are.  https://www.sqlite.org/src/info/7fa8049685b50b5a





    */
    if( pLevel->iLeftJoin==0 ){
      whereIndexExprTrans(pIdx, iCur, iIdxCur, pWInfo);
    }

    /* Record the instruction used to terminate the loop. */
    if( pLoop->wsFlags & WHERE_ONEROW ){
      pLevel->op = OP_Noop;
    }else if( bRev ){







>
>
>
>
>

|







1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
    ** into reference to index columns.
    **
    ** Do not do this for the RHS of a LEFT JOIN. This is because the 
    ** expression may be evaluated after OP_NullRow has been executed on
    ** the cursor. In this case it is important to do the full evaluation,
    ** as the result of the expression may not be NULL, even if all table
    ** column values are.  https://www.sqlite.org/src/info/7fa8049685b50b5a
    **
    ** Also, do not do this when processing one index an a multi-index
    ** OR clause, since the transformation will become invalid once we
    ** move forward to the next index.
    ** https://sqlite.org/src/info/4e8e4857d32d401f
    */
    if( pLevel->iLeftJoin==0 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){
      whereIndexExprTrans(pIdx, iCur, iIdxCur, pWInfo);
    }

    /* Record the instruction used to terminate the loop. */
    if( pLoop->wsFlags & WHERE_ONEROW ){
      pLevel->op = OP_Noop;
    }else if( bRev ){
Changes to test/join5.test.
236
237
238
239
240
241
242












243
244
245
246
247
248
249
  SELECT ifnull(z, '!!!') FROM t3 LEFT JOIN t4 ON (x=y);
} {!!!}

do_execsql_test 6.3.2 {
  CREATE INDEX t4i ON t4(y, ifnull(z, '!!!'));
  SELECT ifnull(z, '!!!') FROM t3 LEFT JOIN t4 ON (x=y);
} {!!!}













#-------------------------------------------------------------------------
#
reset_db
do_execsql_test 7.0 {
  CREATE TABLE t1(x);
  INSERT INTO t1 VALUES(1);







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







236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
  SELECT ifnull(z, '!!!') FROM t3 LEFT JOIN t4 ON (x=y);
} {!!!}

do_execsql_test 6.3.2 {
  CREATE INDEX t4i ON t4(y, ifnull(z, '!!!'));
  SELECT ifnull(z, '!!!') FROM t3 LEFT JOIN t4 ON (x=y);
} {!!!}

# 2019-02-08 https://sqlite.org/src/info/4e8e4857d32d401f
reset_db
do_execsql_test 6.100 {
  CREATE TABLE t1(aa, bb);
  CREATE INDEX t1x1 on t1(abs(aa), abs(bb));
  INSERT INTO t1 VALUES(-2,-3),(+2,-3),(-2,+3),(+2,+3);
  SELECT * FROM (t1) 
   WHERE ((abs(aa)=1 AND 1=2) OR abs(aa)=2)
     AND abs(bb)=3
  ORDER BY +1, +2;
} {-2 -3 -2 3 2 -3 2 3}

#-------------------------------------------------------------------------
#
reset_db
do_execsql_test 7.0 {
  CREATE TABLE t1(x);
  INSERT INTO t1 VALUES(1);