/ Check-in [3fde6276]
Login

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

Overview
Comment:Improvements to the sqlite3ExprImpliesNonNullRow() theorem prover.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3fde627616030ca0de87169467e2e453fdc91154942e3a3a92a221df5923b2d2
User & Date: drh 2019-04-01 19:42:42
Context
2019-04-02
00:28
Add the sqlite3_value_frombind() interface. Use that interface to improve fts3_tokenizer(). check-in: b3f2c320 user: drh tags: trunk
2019-04-01
19:42
Improvements to the sqlite3ExprImpliesNonNullRow() theorem prover. check-in: 3fde6276 user: drh tags: trunk
18:43
Add a test case to cover a missed VDBE branch generated by window.c. check-in: b36813d6 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  5028   5028   ** an ordinary JOIN.  The p argument is the WHERE clause.  If the WHERE
  5029   5029   ** clause requires that some column of the right table of the LEFT JOIN
  5030   5030   ** be non-NULL, then the LEFT JOIN can be safely converted into an
  5031   5031   ** ordinary join.
  5032   5032   */
  5033   5033   int sqlite3ExprImpliesNonNullRow(Expr *p, int iTab){
  5034   5034     Walker w;
         5035  +  p = sqlite3ExprSkipCollate(p);
         5036  +  while( p ){
         5037  +    if( p->op==TK_NOTNULL ){
         5038  +      p = p->pLeft;
         5039  +    }else if( p->op==TK_AND ){
         5040  +      if( sqlite3ExprImpliesNonNullRow(p->pLeft, iTab) ) return 1;
         5041  +      p = p->pRight;
         5042  +    }else{
         5043  +      break;
         5044  +    }
         5045  +  }
  5035   5046     w.xExprCallback = impliesNotNullRow;
  5036   5047     w.xSelectCallback = 0;
  5037   5048     w.xSelectCallback2 = 0;
  5038   5049     w.eCode = 0;
  5039   5050     w.u.iCur = iTab;
  5040   5051     sqlite3WalkExpr(&w, p);
  5041   5052     return w.eCode;