/ Check-in [ad38d2c4]
Login

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

Overview
Comment:Fix crash in sqlite3_vtab_collation() when called for an IS NOT NULL constraint.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ad38d2c4f073705c02c7b38675e8ae86fe4a794d54eb796e7ed51a905824d5f5
User & Date: dan 2017-12-19 18:56:28
Context
2017-12-20
23:46
Lowercase local variable names in the SHA3 extension in order to avoid collisions with macros in termios.h. check-in: 3ec73711 user: drh tags: trunk
2017-12-19
18:56
Fix crash in sqlite3_vtab_collation() when called for an IS NOT NULL constraint. check-in: ad38d2c4 user: dan tags: trunk
2017-12-16
19:36
Add the sqlite3_vtab_collation() function, which allows an xBestIndex callback to determine the collation sequence that SQLite will use for a comparison. And the SQLITE_DBCONFIG_FULL_EQP configuration option, which enhances the output of "EXPLAIN QUERY PLAN" so that it includes statements run by triggers. And the code for the sqlite3_expert extension and command line application. check-in: 4c782c95 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/expert/expert1.test.

   287    287   } {
   288    288     SELECT * FROM t2, t1 WHERE b=? AND d=? AND t2.rowid=t1.rowid
   289    289   } {
   290    290     CREATE INDEX t2_idx_00000064 ON t2(d);
   291    291     0|0|0|SEARCH TABLE t2 USING INDEX t2_idx_00000064 (d=?) 
   292    292     0|1|1|SEARCH TABLE t1 USING INTEGER PRIMARY KEY (rowid=?)
   293    293   }
          294  +
          295  +do_setup_rec_test $tn.16 {
          296  +  CREATE TABLE t1(a, b);
          297  +} {
          298  +  SELECT * FROM t1 WHERE b IS NOT NULL;
          299  +} {
          300  +  (no new indexes)
          301  +  0|0|0|SCAN TABLE t1
          302  +}
   294    303   
   295    304   }
   296    305   
   297    306   proc do_candidates_test {tn sql res} {
   298    307     set res [squish [string trim $res]]
   299    308   
   300    309     set expert [sqlite3_expert_new db]

Changes to src/where.c.

  3156   3156   ** array. Or, if iCons is out of range or there is no active xBestIndex
  3157   3157   ** call, return NULL.
  3158   3158   */
  3159   3159   const char *sqlite3_vtab_collation(sqlite3 *db, int iCons){
  3160   3160     struct BestIndexCtx *p = (struct BestIndexCtx*)db->pBestIndexCtx;
  3161   3161     const char *zRet = 0;
  3162   3162     if( p && iCons>=0 && iCons<p->pIdxInfo->nConstraint ){
         3163  +    CollSeq *pC = 0;
  3163   3164       int iTerm = p->pIdxInfo->aConstraint[iCons].iTermOffset;
  3164   3165       Expr *pX = p->pWC->a[iTerm].pExpr;
  3165         -    CollSeq *pC = sqlite3BinaryCompareCollSeq(p->pParse,pX->pLeft,pX->pRight);
         3166  +    if( pX->pLeft ){
         3167  +      pC = sqlite3BinaryCompareCollSeq(p->pParse, pX->pLeft, pX->pRight);
         3168  +    }
  3166   3169       zRet = (pC ? pC->zName : "BINARY");
  3167   3170     }
  3168   3171     return zRet;
  3169   3172   }
  3170   3173   
  3171   3174   /*
  3172   3175   ** Add all WhereLoop objects for a table of the join identified by