/ Check-in [6e7b4527]
Login

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

Overview
Comment:Fix a bug introduced earlier today by check-in [88833a9c2849c959]. Ticket [29f635e0af71234b]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6e7b4527d32cc1be0294614b9d7363d4b59cf654a954b86515b3f6888975ce73
User & Date: drh 2019-09-02 22:13:06
Context
2019-09-03
14:27
When we play games with COLLATE in order to commute an operator in the WHERE clause processing, be sure not to use the commuted operator to qualify a partial index, as insufficient COLLATE information is preserved to verify that the expression will correctly qualify the index. Ticket [767a8cbc6d20bd68] check-in: 5351e920 user: drh tags: trunk
2019-09-02
22:13
Fix a bug introduced earlier today by check-in [88833a9c2849c959]. Ticket [29f635e0af71234b] check-in: 6e7b4527 user: drh tags: trunk
14:46
Fix a potential crash in fts5 caused by using an auxiliary function on a "special" query like '*id' or '*reads'. check-in: 9490683a user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  3128   3128       assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
  3129   3129       if( destIfNull!=destIfFalse ){
  3130   3130         regCkNull = sqlite3GetTempReg(pParse);
  3131   3131         sqlite3VdbeAddOp3(v, OP_BitAnd, rLhs, rLhs, regCkNull);
  3132   3132       }
  3133   3133       bLhsReal = sqlite3ExprAffinity(pExpr->pLeft)==SQLITE_AFF_REAL;
  3134   3134       for(ii=0; ii<pList->nExpr; ii++){
  3135         -      r2 = sqlite3ExprCodeTemp(pParse, pList->a[ii].pExpr, &regToFree);
  3136   3135         if( bLhsReal ){
         3136  +        r2 = regToFree = sqlite3GetTempReg(pParse);
         3137  +        sqlite3ExprCode(pParse, pList->a[ii].pExpr, r2);
  3137   3138           sqlite3VdbeAddOp4(v, OP_Affinity, r2, 1, 0, "E", P4_STATIC);
         3139  +      }else{
         3140  +        r2 = sqlite3ExprCodeTemp(pParse, pList->a[ii].pExpr, &regToFree);
  3138   3141         }
  3139   3142         if( regCkNull && sqlite3ExprCanBeNull(pList->a[ii].pExpr) ){
  3140   3143           sqlite3VdbeAddOp3(v, OP_BitAnd, regCkNull, r2, regCkNull);
  3141   3144         }
  3142   3145         if( ii<pList->nExpr-1 || destIfNull!=destIfFalse ){
  3143   3146           sqlite3VdbeAddOp4(v, OP_Eq, rLhs, labelOk, r2,
  3144   3147                             (void*)pColl, P4_COLLSEQ);

Changes to test/in.test.

   759    759     SELECT * FROM t0 WHERE '1' IN (t0.c0);
   760    760   } {}
   761    761   
   762    762   # 2019-09-02 ticket https://www.sqlite.org/src/info/2841e99d104c6436
   763    763   # For the IN_INDEX_NOOP optimization, apply REAL affinity to the LHS
   764    764   # values prior to comparison if the RHS has REAL affinity.
   765    765   #
          766  +# Also ticket https://sqlite.org/src/info/29f635e0af71234b
          767  +#
   766    768   do_execsql_test in-19.1 {
   767    769     DROP TABLE IF EXISTS t0;
   768    770     CREATE TABLE t0(c0 REAL UNIQUE);
   769    771     INSERT INTO t0(c0) VALUES(2.07093491255203046E18);
   770    772     SELECT 1 FROM t0 WHERE c0 IN ('2070934912552030444');
   771    773   } {1}
   772    774   do_execsql_test in-19.2 {
   773    775     SELECT c0 IN ('2070934912552030444') FROM t0;
   774    776   } {1}
   775    777   do_execsql_test in-19.3 {
   776    778     SELECT c0 IN ('2070934912552030444',2,3) FROM t0;
   777    779   } {1}
          780  +do_execsql_test in-19.4 {
          781  +  DROP TABLE t0;
          782  +  CREATE TABLE t0(c0 TEXT, c1 REAL, c2, PRIMARY KEY(c2, c0, c1));
          783  +  CREATE INDEX i0 ON t0(c1 IN (c0));
          784  +  INSERT INTO t0(c0, c2) VALUES (0, NULL) ON CONFLICT(c2, c1, c0) DO NOTHING;
          785  +  PRAGMA integrity_check;
          786  +} {ok}
   778    787   
   779    788   finish_test