/ Check-in [32f5f461]
Login

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

Overview
Comment:Merge test script fixes from trunk into this branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA3-256:32f5f4613985283498162f2eaaba04316ee2f9ac6ce14bf238d36ebd16d55fa0
User & Date: dan 2017-11-17 20:10:12
Context
2017-11-17
20:16
Add an 'extern "C"' wrapper to sqlite3_private.h. check-in: 97ab1efe user: dan tags: apple-osx
20:10
Merge test script fixes from trunk into this branch. check-in: 32f5f461 user: dan tags: apple-osx
20:07
Add some missing "finish_test" lines to the end of test scripts. check-in: c21406ab user: dan tags: trunk
13:23
Merge latest changes from trunk, including the temporary db/ATTACH/master-journal fix. check-in: 162c7543 user: dan tags: apple-osx
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  2182   2182   **     SELECT <column1>, <column2>... FROM <table>
  2183   2183   **
  2184   2184   ** If the RHS of the IN operator is a list or a more complex subquery, then
  2185   2185   ** an ephemeral table might need to be generated from the RHS and then
  2186   2186   ** pX->iTable made to point to the ephemeral table instead of an
  2187   2187   ** existing table.
  2188   2188   **
  2189         -** The inFlags parameter must contain exactly one of the bits
  2190         -** IN_INDEX_MEMBERSHIP or IN_INDEX_LOOP.  If inFlags contains
  2191         -** IN_INDEX_MEMBERSHIP, then the generated table will be used for a
  2192         -** fast membership test.  When the IN_INDEX_LOOP bit is set, the
  2193         -** IN index will be used to loop over all values of the RHS of the
  2194         -** IN operator.
         2189  +** The inFlags parameter must contain, at a minimum, one of the bits
         2190  +** IN_INDEX_MEMBERSHIP or IN_INDEX_LOOP but not both.  If inFlags contains
         2191  +** IN_INDEX_MEMBERSHIP, then the generated table will be used for a fast
         2192  +** membership test.  When the IN_INDEX_LOOP bit is set, the IN index will
         2193  +** be used to loop over all values of the RHS of the IN operator.
  2195   2194   **
  2196   2195   ** When IN_INDEX_LOOP is used (and the b-tree will be used to iterate
  2197   2196   ** through the set members) then the b-tree must not contain duplicates.
  2198         -** An epheremal table must be used unless the selected columns are guaranteed
         2197  +** An epheremal table will be created unless the selected columns are guaranteed
  2199   2198   ** to be unique - either because it is an INTEGER PRIMARY KEY or due to
  2200   2199   ** a UNIQUE constraint or index.
  2201   2200   **
  2202   2201   ** When IN_INDEX_MEMBERSHIP is used (and the b-tree will be used 
  2203   2202   ** for fast set membership tests) then an epheremal table must 
  2204   2203   ** be used unless <columns> is a single INTEGER PRIMARY KEY column or an 
  2205   2204   ** index can be found with the specified <columns> as its left-most.

Changes to src/wherecode.c.

   372    372       if( sqlite3CompareAffinity(p, zAff[i])==SQLITE_AFF_BLOB
   373    373        || sqlite3ExprNeedsNoAffinityChange(p, zAff[i])
   374    374       ){
   375    375         zAff[i] = SQLITE_AFF_BLOB;
   376    376       }
   377    377     }
   378    378   }
          379  +
          380  +#ifdef SQLITE_DEBUG
          381  +/* Return true if the pSub ExprList is a subset of pMain.  The terms
          382  +** of pSub can be in a different order from pMain.  The only requirement
          383  +** is that every term in pSub must exist somewhere in pMain.
          384  +**
          385  +** Return false if pSub contains any term that is not found in pMain.
          386  +*/
          387  +static int exprListSubset(ExprList *pSub, ExprList *pMain){
          388  +  int i, j;
          389  +  for(i=0; i<pSub->nExpr; i++){
          390  +    Expr *p = pSub->a[i].pExpr;
          391  +    for(j=0; j<pMain->nExpr; j++){
          392  +      if( sqlite3ExprCompare(0, p, pMain->a[j].pExpr, 0)==0 ) break;
          393  +    }
          394  +    if( j>=pMain->nExpr ) return 0;
          395  +  }
          396  +  return 1;
          397  +}
          398  +#endif /* SQLITE_DEBUG */
          399  +
   379    400   
   380    401   /*
   381    402   ** Generate code for a single equality term of the WHERE clause.  An equality
   382    403   ** term can be either X=expr or X IN (...).   pTerm is the term to be 
   383    404   ** coded.
   384    405   **
   385    406   ** The current value for the constraint is left in a register, the index
................................................................................
   459    480             Expr *pNewRhs = sqlite3ExprDup(db, pOrigRhs->a[iField].pExpr, 0);
   460    481             Expr *pNewLhs = sqlite3ExprDup(db, pOrigLhs->a[iField].pExpr, 0);
   461    482   
   462    483             pRhs = sqlite3ExprListAppend(pParse, pRhs, pNewRhs);
   463    484             pLhs = sqlite3ExprListAppend(pParse, pLhs, pNewLhs);
   464    485           }
   465    486         }
          487  + 
          488  +      /* pRhs should be a subset of pOrigRhs (though possibly in a different
          489  +      ** order).  And pLhs should be a subset of pOrigLhs.  To put it 
          490  +      ** another way:  Every term of pRhs should exist in pOrigRhs and
          491  +      ** every term of pLhs should exist in pOrigLhs. */
          492  +      assert( db->mallocFailed || exprListSubset(pRhs, pOrigRhs) );
          493  +      assert( db->mallocFailed || exprListSubset(pLhs, pOrigLhs) );
          494  +
   466    495         if( !db->mallocFailed ){
   467    496           Expr *pLeft = pX->pLeft;
   468    497   
   469    498           if( pSelect->pOrderBy ){
   470    499             /* If the SELECT statement has an ORDER BY clause, zero the 
   471    500             ** iOrderByCol variables. These are set to non-zero when an 
   472    501             ** ORDER BY term exactly matches one of the terms of the 

Changes to test/tkt-26ff0c2d1e.test.

    27     27   do_test bug-20100512-3 {
    28     28     sqlite3_bind_int $STMT 1 123
    29     29     sqlite3_bind_int $STMT 2 456
    30     30     sqlite3_step $STMT
    31     31     sqlite3_column_int $STMT 0
    32     32   } {555}
    33     33   sqlite3_finalize $STMT
           34  +
           35  +finish_test

Changes to test/tkt-7a31705a7e6.test.

    19     19   
    20     20   do_execsql_test tkt-7a31705a7e6-1.1 {
    21     21     CREATE TABLE t1 (a INTEGER PRIMARY KEY);
    22     22     CREATE TABLE t2 (a INTEGER PRIMARY KEY, b INTEGER);
    23     23     CREATE TABLE t2x (b INTEGER PRIMARY KEY);
    24     24     SELECT t1.a FROM ((t1 JOIN t2 ON t1.a=t2.a) AS x JOIN t2x ON x.b=t2x.b) as y;
    25     25   } {}
           26  +
           27  +finish_test

Changes to test/tkt-a8a0d2996a.test.

    87     87   } {-9.22337203685478e+18}
    88     88   do_execsql_test 4.5 {
    89     89     SELECT '9223372036854775806x'+'1x';
    90     90   } {9.22337203685478e+18}
    91     91   do_execsql_test 4.6 {
    92     92     SELECT '1234x'/'10y';
    93     93   } {123.4}
           94  +
           95  +finish_test

Changes to test/tkt3334.test.

    78     78     }
    79     79   } {1 1 1}
    80     80   do_test tkt3334-1.10 {
    81     81     execsql {
    82     82       SELECT count(*) FROM (SELECT a FROM t1) WHERE a=1;
    83     83     }
    84     84   } {3}
           85  +
           86  +finish_test

Changes to test/vacuum4.test.

    61     61         c120, c121, c122, c123, c124, c125, c126, c127, c128, c129,
    62     62         c130, c131, c132, c133, c134, c135, c136, c137, c138, c139,
    63     63         c140, c141, c142, c143, c144, c145, c146, c147, c148, c149
    64     64       );
    65     65       VACUUM;
    66     66     }
    67     67   } {}
           68  +
           69  +finish_test

Changes to test/varint.test.

    26     26         incr cnt
    27     27         do_test varint-1.$cnt {
    28     28           btree_varint_test $start $mult 5000 $incr
    29     29         } {}
    30     30       }
    31     31     }
    32     32   }
           33  +
           34  +finish_test