SQLite

Check-in [e4129cd3a0]
Login

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

Overview
Comment:Make sure Expr.eX changes back to EX_None after Expr.x.pRight is set to NULL due to an OOM.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | expr-simplify
Files: files | file ages | folders
SHA3-256: e4129cd3a04bff314d2318f33d7ca02c05de35d35f6c650dddb5cabc7c430017
User & Date: drh 2018-09-19 16:35:38.728
Context
2018-09-19
17:24
Fix an issue in virtual table handling associated with the new Expr.x.pRight field. (check-in: 8487f84af0 user: drh tags: expr-simplify)
16:35
Make sure Expr.eX changes back to EX_None after Expr.x.pRight is set to NULL due to an OOM. (check-in: e4129cd3a0 user: drh tags: expr-simplify)
14:54
Reduce the size of Expr from 80 to 72 bytes moving the pRight field inside the "x" union. This is an incremental check-in that still has issues. (check-in: 147c61a6d4 user: drh tags: expr-simplify)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/expr.c.
1359
1360
1361
1362
1363
1364
1365

1366
1367
1368
1369
1370
1371
1372
          assert( p->iColumn==0 || p->eX!=EX_Right );
          /* OLD: assert( p->pRight==0  || p->x.pRight==p->pLeft ); */
        }else{
          pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0);
        }
        if( p->eX==EX_Right ){
          pNew->x.pRight = sqlite3ExprDup(db, p->x.pRight, 0);

        }
      }
    }
  }
  return pNew;
}








>







1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
          assert( p->iColumn==0 || p->eX!=EX_Right );
          /* OLD: assert( p->pRight==0  || p->x.pRight==p->pLeft ); */
        }else{
          pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0);
        }
        if( p->eX==EX_Right ){
          pNew->x.pRight = sqlite3ExprDup(db, p->x.pRight, 0);
          if( pNew->x.pRight==0 ) pNew->eX = EX_None;
        }
      }
    }
  }
  return pNew;
}

Changes to src/select.c.
3479
3480
3481
3482
3483
3484
3485

3486
3487
3488
3489
3490
3491
3492
      }
      case EX_List: {
        substExprList(pSubst, pExpr->x.pList);
        break;
      }
      case EX_Right: {
        pExpr->x.pRight = substExpr(pSubst, pExpr->x.pRight);

        break;
      }
    }
  }
  return pExpr;
}
static void substExprList(







>







3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
      }
      case EX_List: {
        substExprList(pSubst, pExpr->x.pList);
        break;
      }
      case EX_Right: {
        pExpr->x.pRight = substExpr(pSubst, pExpr->x.pRight);
        if( pExpr->x.pRight==0 ) pExpr->eX = EX_None;
        break;
      }
    }
  }
  return pExpr;
}
static void substExprList(