/ Check-in [21302076]
Login

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

Overview
Comment:Updates to requirements marks. No code changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 213020769f310aec1591d97756b53891d0b64005
User & Date: drh 2013-08-02 23:40:45
Context
2013-08-05
12:31
Add a missing '#include "tcl.h"' to test_rtree.c. check-in: 4b8b426f user: drh tags: trunk
2013-08-03
20:24
Begin adding experimental sqlite_stat4 table. This commit is buggy. check-in: 2beea303 user: dan tags: sqlite_stat4
2013-08-02
23:40
Updates to requirements marks. No code changes. check-in: 21302076 user: drh tags: trunk
20:11
Add NEVER() and ALWAYS() macros on some unreachable yet prudent branches. check-in: c5c0a8ab user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/tokenize.c.

   119    119         testcase( z[0]=='\r' );
   120    120         for(i=1; sqlite3Isspace(z[i]); i++){}
   121    121         *tokenType = TK_SPACE;
   122    122         return i;
   123    123       }
   124    124       case '-': {
   125    125         if( z[1]=='-' ){
   126         -        /* IMP: R-50417-27976 -- syntax diagram for comments */
   127    126           for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
   128    127           *tokenType = TK_SPACE;   /* IMP: R-22934-25134 */
   129    128           return i;
   130    129         }
   131    130         *tokenType = TK_MINUS;
   132    131         return 1;
   133    132       }
................................................................................
   152    151         return 1;
   153    152       }
   154    153       case '/': {
   155    154         if( z[1]!='*' || z[2]==0 ){
   156    155           *tokenType = TK_SLASH;
   157    156           return 1;
   158    157         }
   159         -      /* IMP: R-50417-27976 -- syntax diagram for comments */
   160    158         for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){}
   161    159         if( c ) i++;
   162    160         *tokenType = TK_SPACE;   /* IMP: R-22934-25134 */
   163    161         return i;
   164    162       }
   165    163       case '%': {
   166    164         *tokenType = TK_REM;

Changes to src/where.c.

   654    654   ** WhereTerms.  All pointers to WhereTerms should be invalidated after
   655    655   ** calling this routine.  Such pointers may be reinitialized by referencing
   656    656   ** the pWC->a[] array.
   657    657   */
   658    658   static int whereClauseInsert(WhereClause *pWC, Expr *p, u8 wtFlags){
   659    659     WhereTerm *pTerm;
   660    660     int idx;
   661         -  testcase( wtFlags & TERM_VIRTUAL );  /* EV: R-00211-15100 */
          661  +  testcase( wtFlags & TERM_VIRTUAL );
   662    662     if( pWC->nTerm>=pWC->nSlot ){
   663    663       WhereTerm *pOld = pWC->a;
   664    664       sqlite3 *db = pWC->pWInfo->pParse->db;
   665    665       pWC->a = sqlite3DbMallocRaw(db, sizeof(pWC->a[0])*pWC->nSlot*2 );
   666    666       if( pWC->a==0 ){
   667    667         if( wtFlags & TERM_DYNAMIC ){
   668    668           sqlite3ExprDelete(db, p);
................................................................................
   799    799     return mask;
   800    800   }
   801    801   
   802    802   /*
   803    803   ** Return TRUE if the given operator is one of the operators that is
   804    804   ** allowed for an indexable WHERE clause term.  The allowed operators are
   805    805   ** "=", "<", ">", "<=", ">=", "IN", and "IS NULL"
   806         -**
   807         -** IMPLEMENTATION-OF: R-59926-26393 To be usable by an index a term must be
   808         -** of one of the following forms: column = expression column > expression
   809         -** column >= expression column < expression column <= expression
   810         -** expression = column expression > column expression >= column
   811         -** expression < column expression <= column column IN
   812         -** (expression-list) column IN (subquery) column IS NULL
   813    806   */
   814    807   static int allowedOp(int op){
   815    808     assert( TK_GT>TK_EQ && TK_GT<TK_GE );
   816    809     assert( TK_LT>TK_EQ && TK_LT<TK_GE );
   817    810     assert( TK_LE>TK_EQ && TK_LE<TK_GE );
   818    811     assert( TK_GE==TK_EQ+4 );
   819    812     return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL;
................................................................................
  1479   1472           }
  1480   1473         }
  1481   1474       }
  1482   1475   
  1483   1476       /* At this point, okToChngToIN is true if original pTerm satisfies
  1484   1477       ** case 1.  In that case, construct a new virtual term that is 
  1485   1478       ** pTerm converted into an IN operator.
  1486         -    **
  1487         -    ** EV: R-00211-15100
  1488   1479       */
  1489   1480       if( okToChngToIN ){
  1490   1481         Expr *pDup;            /* A transient duplicate expression */
  1491   1482         ExprList *pList = 0;   /* The RHS of the IN operator */
  1492   1483         Expr *pLeft = 0;       /* The LHS of the IN operator */
  1493   1484         Expr *pNew;            /* The complete IN operator */
  1494   1485   
................................................................................
  1722   1713         if( noCase ){
  1723   1714           /* The point is to increment the last character before the first
  1724   1715           ** wildcard.  But if we increment '@', that will push it into the
  1725   1716           ** alphabetic range where case conversions will mess up the 
  1726   1717           ** inequality.  To avoid this, make sure to also run the full
  1727   1718           ** LIKE on all candidate expressions by clearing the isComplete flag
  1728   1719           */
  1729         -        if( c=='A'-1 ) isComplete = 0;   /* EV: R-64339-08207 */
  1730         -
  1731         -
         1720  +        if( c=='A'-1 ) isComplete = 0;
  1732   1721           c = sqlite3UpperToLower[c];
  1733   1722         }
  1734   1723         *pC = c + 1;
  1735   1724       }
  1736   1725       sCollSeqName.z = noCase ? "NOCASE" : "BINARY";
  1737   1726       sCollSeqName.n = 6;
  1738   1727       pNewExpr1 = sqlite3ExprDup(db, pLeft, 0);
................................................................................
  2814   2803   **   (2)  SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok'
  2815   2804   **   (3)  SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok'
  2816   2805   **
  2817   2806   ** The t2.z='ok' is disabled in the in (2) because it originates
  2818   2807   ** in the ON clause.  The term is disabled in (3) because it is not part
  2819   2808   ** of a LEFT OUTER JOIN.  In (1), the term is not disabled.
  2820   2809   **
  2821         -** IMPLEMENTATION-OF: R-24597-58655 No tests are done for terms that are
  2822         -** completely satisfied by indices.
  2823         -**
  2824   2810   ** Disabling a term causes that term to not be tested in the inner loop
  2825   2811   ** of the join.  Disabling is an optimization.  When terms are satisfied
  2826   2812   ** by indices, we disable them to prevent redundant tests in the inner
  2827   2813   ** loop.  We would get the correct results if nothing were ever disabled,
  2828   2814   ** but joins might run a little slower.  The trick is to disable as much
  2829   2815   ** as we can without disabling too much.  If we disabled in (1), we'd get
  2830   2816   ** the wrong answer.  See ticket #813.
................................................................................
  3046   3032     for(j=0; j<nEq; j++){
  3047   3033       int r1;
  3048   3034       pTerm = pLoop->aLTerm[j];
  3049   3035       assert( pTerm!=0 );
  3050   3036       /* The following true for indices with redundant columns. 
  3051   3037       ** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */
  3052   3038       testcase( (pTerm->wtFlags & TERM_CODED)!=0 );
  3053         -    testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
         3039  +    testcase( pTerm->wtFlags & TERM_VIRTUAL );
  3054   3040       r1 = codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, regBase+j);
  3055   3041       if( r1!=regBase+j ){
  3056   3042         if( nReg==1 ){
  3057   3043           sqlite3ReleaseTempReg(pParse, regBase);
  3058   3044           regBase = r1;
  3059   3045         }else{
  3060   3046           sqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j);
................................................................................
  3357   3343       */
  3358   3344       assert( pLoop->u.btree.nEq==1 );
  3359   3345       iReleaseReg = sqlite3GetTempReg(pParse);
  3360   3346       pTerm = pLoop->aLTerm[0];
  3361   3347       assert( pTerm!=0 );
  3362   3348       assert( pTerm->pExpr!=0 );
  3363   3349       assert( omitTable==0 );
  3364         -    testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
         3350  +    testcase( pTerm->wtFlags & TERM_VIRTUAL );
  3365   3351       iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg);
  3366   3352       addrNxt = pLevel->addrNxt;
  3367   3353       sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt);
  3368   3354       sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addrNxt, iRowidReg);
  3369   3355       sqlite3ExprCacheAffinityChange(pParse, iRowidReg, 1);
  3370   3356       sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
  3371   3357       VdbeComment((v, "pk"));
................................................................................
  3405   3391              /* TK_GE */  OP_SeekGe
  3406   3392         };
  3407   3393         assert( TK_LE==TK_GT+1 );      /* Make sure the ordering.. */
  3408   3394         assert( TK_LT==TK_GT+2 );      /*  ... of the TK_xx values... */
  3409   3395         assert( TK_GE==TK_GT+3 );      /*  ... is correcct. */
  3410   3396   
  3411   3397         assert( (pStart->wtFlags & TERM_VNULL)==0 );
  3412         -      testcase( pStart->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
         3398  +      testcase( pStart->wtFlags & TERM_VIRTUAL );
  3413   3399         pX = pStart->pExpr;
  3414   3400         assert( pX!=0 );
  3415   3401         testcase( pStart->leftCursor!=iCur ); /* transitive constraints */
  3416   3402         r1 = sqlite3ExprCodeTemp(pParse, pX->pRight, &rTemp);
  3417   3403         sqlite3VdbeAddOp3(v, aMoveOp[pX->op-TK_GT], iCur, addrBrk, r1);
  3418   3404         VdbeComment((v, "pk"));
  3419   3405         sqlite3ExprCacheAffinityChange(pParse, r1, 1);
................................................................................
  3424   3410       }
  3425   3411       if( pEnd ){
  3426   3412         Expr *pX;
  3427   3413         pX = pEnd->pExpr;
  3428   3414         assert( pX!=0 );
  3429   3415         assert( (pEnd->wtFlags & TERM_VNULL)==0 );
  3430   3416         testcase( pEnd->leftCursor!=iCur ); /* Transitive constraints */
  3431         -      testcase( pEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
         3417  +      testcase( pEnd->wtFlags & TERM_VIRTUAL );
  3432   3418         memEndValue = ++pParse->nMem;
  3433   3419         sqlite3ExprCode(pParse, pX->pRight, memEndValue);
  3434   3420         if( pX->op==TK_LT || pX->op==TK_GT ){
  3435   3421           testOp = bRev ? OP_Le : OP_Ge;
  3436   3422         }else{
  3437   3423           testOp = bRev ? OP_Lt : OP_Gt;
  3438   3424         }
................................................................................
  3590   3576             zStartAff[nEq] = SQLITE_AFF_NONE;
  3591   3577           }
  3592   3578           if( sqlite3ExprNeedsNoAffinityChange(pRight, zStartAff[nEq]) ){
  3593   3579             zStartAff[nEq] = SQLITE_AFF_NONE;
  3594   3580           }
  3595   3581         }  
  3596   3582         nConstraint++;
  3597         -      testcase( pRangeStart->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
         3583  +      testcase( pRangeStart->wtFlags & TERM_VIRTUAL );
  3598   3584       }else if( isMinQuery ){
  3599   3585         sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
  3600   3586         nConstraint++;
  3601   3587         startEq = 0;
  3602   3588         start_constraints = 1;
  3603   3589       }
  3604   3590       codeApplyAffinity(pParse, regBase, nConstraint, zStartAff);
................................................................................
  3632   3618           }
  3633   3619           if( sqlite3ExprNeedsNoAffinityChange(pRight, zEndAff[nEq]) ){
  3634   3620             zEndAff[nEq] = SQLITE_AFF_NONE;
  3635   3621           }
  3636   3622         }  
  3637   3623         codeApplyAffinity(pParse, regBase, nEq+1, zEndAff);
  3638   3624         nConstraint++;
  3639         -      testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
         3625  +      testcase( pRangeEnd->wtFlags & TERM_VIRTUAL );
  3640   3626       }
  3641   3627       sqlite3DbFree(db, zStartAff);
  3642   3628       sqlite3DbFree(db, zEndAff);
  3643   3629   
  3644   3630       /* Top of the loop body */
  3645   3631       pLevel->p2 = sqlite3VdbeCurrentAddr(v);
  3646   3632   
................................................................................
  3919   3905       pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrBrk);
  3920   3906       pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
  3921   3907     }
  3922   3908     newNotReady = notReady & ~getMask(&pWInfo->sMaskSet, iCur);
  3923   3909   
  3924   3910     /* Insert code to test every subexpression that can be completely
  3925   3911     ** computed using the current set of tables.
  3926         -  **
  3927         -  ** IMPLEMENTATION-OF: R-49525-50935 Terms that cannot be satisfied through
  3928         -  ** the use of indices become tests that are evaluated against each row of
  3929         -  ** the relevant input tables.
  3930   3912     */
  3931   3913     for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
  3932   3914       Expr *pE;
  3933         -    testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* IMP: R-30575-11662 */
         3915  +    testcase( pTerm->wtFlags & TERM_VIRTUAL );
  3934   3916       testcase( pTerm->wtFlags & TERM_CODED );
  3935   3917       if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
  3936   3918       if( (pTerm->prereqAll & newNotReady)!=0 ){
  3937   3919         testcase( pWInfo->untestedTerms==0
  3938   3920                  && (pWInfo->wctrlFlags & WHERE_ONETABLE_ONLY)!=0 );
  3939   3921         pWInfo->untestedTerms = 1;
  3940   3922         continue;
................................................................................
  3986   3968     */
  3987   3969     if( pLevel->iLeftJoin ){
  3988   3970       pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
  3989   3971       sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
  3990   3972       VdbeComment((v, "record LEFT JOIN hit"));
  3991   3973       sqlite3ExprCacheClear(pParse);
  3992   3974       for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){
  3993         -      testcase( pTerm->wtFlags & TERM_VIRTUAL );  /* IMP: R-30575-11662 */
         3975  +      testcase( pTerm->wtFlags & TERM_VIRTUAL );
  3994   3976         testcase( pTerm->wtFlags & TERM_CODED );
  3995   3977         if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
  3996   3978         if( (pTerm->prereqAll & newNotReady)!=0 ){
  3997   3979           assert( pWInfo->untestedTerms );
  3998   3980           continue;
  3999   3981         }
  4000   3982         assert( pTerm->pExpr );
................................................................................
  5759   5741   
  5760   5742     /* Split the WHERE clause into separate subexpressions where each
  5761   5743     ** subexpression is separated by an AND operator.
  5762   5744     */
  5763   5745     initMaskSet(pMaskSet);
  5764   5746     whereClauseInit(&pWInfo->sWC, pWInfo);
  5765   5747     sqlite3ExprCodeConstants(pParse, pWhere);
  5766         -  whereSplit(&pWInfo->sWC, pWhere, TK_AND);   /* IMP: R-15842-53296 */
         5748  +  whereSplit(&pWInfo->sWC, pWhere, TK_AND);
  5767   5749     sqlite3CodeVerifySchema(pParse, -1); /* Insert the cookie verifier Goto */
  5768   5750       
  5769   5751     /* Special case: a WHERE clause that is constant.  Evaluate the
  5770   5752     ** expression and either jump over all of the code or fall thru.
  5771   5753     */
  5772   5754     if( pWhere && (nTabList==0 || sqlite3ExprIsConstantNotJoin(pWhere)) ){
  5773   5755       sqlite3ExprIfFalse(pParse, pWhere, pWInfo->iBreak, SQLITE_JUMPIFNULL);

Changes to test/e_createtable.test.

    54     54         db eval "SELECT DISTINCT tbl_name FROM $master ORDER BY tbl_name"
    55     55       ]
    56     56     }
    57     57     set res
    58     58   }
    59     59   
    60     60   
    61         -# EVIDENCE-OF: R-47266-09114 -- syntax diagram type-name
    62         -#
    63     61   do_createtable_tests 0.1.1 -repair {
    64     62     drop_all_tables
    65     63   } {
    66     64     1   "CREATE TABLE t1(c1 one)"                        {}
    67     65     2   "CREATE TABLE t1(c1 one two)"                    {}
    68     66     3   "CREATE TABLE t1(c1 one two three)"              {}
    69     67     4   "CREATE TABLE t1(c1 one two three four)"         {}
................................................................................
    75     73   do_createtable_tests 0.1.2 -error {
    76     74     near "%s": syntax error
    77     75   } {
    78     76     1   "CREATE TABLE t1(c1 one(number))"                {number}
    79     77   }
    80     78   
    81     79   
    82         -# EVIDENCE-OF: R-60689-48779 -- syntax diagram column-constraint
           80  +# syntax diagram column-constraint
    83     81   #
    84     82   do_createtable_tests 0.2.1 -repair {
    85     83     drop_all_tables 
    86     84     execsql { CREATE TABLE t2(x PRIMARY KEY) }
    87     85   } {
    88     86     1.1   "CREATE TABLE t1(c1 text PRIMARY KEY)"                         {}
    89     87     1.2   "CREATE TABLE t1(c1 text PRIMARY KEY ASC)"                     {}
................................................................................
   122    120     8.2   {
   123    121       CREATE TABLE t1(c1 
   124    122         REFERENCES t1 DEFAULT 123 CHECK(c1 IS 'ten') UNIQUE NOT NULL PRIMARY KEY 
   125    123       );
   126    124     } {}
   127    125   }
   128    126   
   129         -# EVIDENCE-OF: R-58169-51804 -- syntax diagram table-constraint
          127  +# -- syntax diagram table-constraint
   130    128   #
   131    129   do_createtable_tests 0.3.1 -repair {
   132    130     drop_all_tables 
   133    131     execsql { CREATE TABLE t2(x PRIMARY KEY) }
   134    132   } {
   135    133     1.1   "CREATE TABLE t1(c1, c2, PRIMARY KEY(c1))"                         {}
   136    134     1.2   "CREATE TABLE t1(c1, c2, PRIMARY KEY(c1, c2))"                     {}
................................................................................
   141    139     2.3   "CREATE TABLE t1(c1, c2, UNIQUE(c1, c2) ON CONFLICT IGNORE)"       {}
   142    140   
   143    141     3.1   "CREATE TABLE t1(c1, c2, CHECK(c1 IS NOT c2))"                     {}
   144    142   
   145    143     4.1   "CREATE TABLE t1(c1, c2, FOREIGN KEY(c1) REFERENCES t2)"           {}
   146    144   }
   147    145   
   148         -# EVIDENCE-OF: R-44826-22243 -- syntax diagram column-def
          146  +# -- syntax diagram column-def
   149    147   #
   150    148   do_createtable_tests 0.4.1 -repair {
   151    149     drop_all_tables 
   152    150   } {
   153    151     1     {CREATE TABLE t1(
   154    152              col1,
   155    153              col2 TEXT,
................................................................................
   156    154              col3 INTEGER UNIQUE,
   157    155              col4 VARCHAR(10, 10) PRIMARY KEY,
   158    156              "name with spaces" REFERENCES t1
   159    157            );
   160    158           } {}
   161    159   }
   162    160   
   163         -# EVIDENCE-OF: R-45698-45677 -- syntax diagram create-table-stmt
          161  +# -- syntax diagram create-table-stmt
   164    162   #
   165    163   do_createtable_tests 0.5.1 -repair {
   166    164     drop_all_tables 
   167    165     execsql { CREATE TABLE t2(a, b, c) }
   168    166   } {
   169    167     1     "CREATE TABLE t1(a, b, c)"                                    {}
   170    168     2     "CREATE TEMP TABLE t1(a, b, c)"                               {}
................................................................................
   181    179     12    "CREATE TEMPORARY TABLE IF NOT EXISTS temp.t1(a, b, c)"       {}
   182    180   
   183    181     13    "CREATE TABLE t1 AS SELECT * FROM t2"                         {}
   184    182     14    "CREATE TEMP TABLE t1 AS SELECT c, b, a FROM t2"              {}
   185    183     15    "CREATE TABLE t1 AS SELECT count(*), max(b), min(a) FROM t2"  {}
   186    184   }
   187    185   
   188         -# EVIDENCE-OF: R-24369-11919 -- syntax diagram foreign-key-clause
   189    186   #
   190    187   #   1:         Explicit parent-key columns.
   191    188   #   2:         Implicit child-key columns.
   192    189   #
   193    190   #   1:         MATCH FULL
   194    191   #   2:         MATCH PARTIAL
   195    192   #   3:         MATCH SIMPLE

Changes to test/e_delete.test.

    25     25   }
    26     26   
    27     27   do_execsql_test e_delete-0.0 {
    28     28     CREATE TABLE t1(a, b);
    29     29     CREATE INDEX i1 ON t1(a);
    30     30   } {}
    31     31   
    32         -# EVIDENCE-OF: R-62077-19799 -- syntax diagram delete-stmt
    33         -#
    34         -# EVIDENCE-OF: R-60796-31013 -- syntax diagram qualified-table-name
           32  +# -- syntax diagram delete-stmt
           33  +# -- syntax diagram qualified-table-name
    35     34   #
    36     35   do_delete_tests e_delete-0.1 {
    37     36     1  "DELETE FROM t1"                              {}
    38     37     2  "DELETE FROM t1 INDEXED BY i1"                {}
    39     38     3  "DELETE FROM t1 NOT INDEXED"                  {}
    40     39     4  "DELETE FROM main.t1"                         {}
    41     40     5  "DELETE FROM main.t1 INDEXED BY i1"           {}
................................................................................
   288    287   }
   289    288   
   290    289   # EVIDENCE-OF: R-40026-10531 If SQLite is compiled with the
   291    290   # SQLITE_ENABLE_UPDATE_DELETE_LIMIT compile-time option, then the syntax
   292    291   # of the DELETE statement is extended by the addition of optional ORDER
   293    292   # BY and LIMIT clauses:
   294    293   #
   295         -# EVIDENCE-OF: R-52694-53361 -- syntax diagram delete-stmt-limited
          294  +# -- syntax diagram delete-stmt-limited
   296    295   #
   297    296   do_delete_tests e_delete-3.1 {
   298    297     1   "DELETE FROM t1 LIMIT 5"                                    {}
   299    298     2   "DELETE FROM t1 LIMIT 5-1 OFFSET 2+2"                       {}
   300    299     3   "DELETE FROM t1 LIMIT 2+2, 16/4"                            {}
   301    300     4   "DELETE FROM t1 ORDER BY x LIMIT 5"                         {}
   302    301     5   "DELETE FROM t1 ORDER BY x LIMIT 5-1 OFFSET 2+2"            {}

Changes to test/e_droptrigger.test.

    65     65       CREATE TRIGGER aux.tr1 BEFORE $event ON t3 BEGIN SELECT r('aux.tr1') ; END;
    66     66       CREATE TRIGGER aux.tr2 AFTER  $event ON t3 BEGIN SELECT r('aux.tr2') ; END;
    67     67       CREATE TRIGGER aux.tr3 AFTER  $event ON t3 BEGIN SELECT r('aux.tr3') ; END;
    68     68     "
    69     69   }
    70     70   
    71     71   
    72         -# EVIDENCE-OF: R-27975-10951 -- syntax diagram drop-trigger-stmt
           72  +# -- syntax diagram drop-trigger-stmt
    73     73   #
    74     74   do_droptrigger_tests 1.1 -repair {
    75     75     droptrigger_reopen_db
    76     76   } -tclquery {
    77     77     list_all_triggers 
    78     78   } {
    79     79     1   "DROP TRIGGER main.tr1"            

Changes to test/e_dropview.test.

    66     66     set res
    67     67   }
    68     68   
    69     69   proc do_dropview_tests {nm args} {
    70     70     uplevel do_select_tests $nm $args
    71     71   }
    72     72   
    73         -# EVIDENCE-OF: R-53136-36436 -- syntax diagram drop-view-stmt
           73  +# -- syntax diagram drop-view-stmt
    74     74   #
    75     75   # All paths in the syntax diagram for DROP VIEW are tested by tests 1.*.
    76     76   #
    77     77   do_dropview_tests 1 -repair {
    78     78     dropview_reopen_db
    79     79   } -tclquery {
    80     80     list_all_views

Changes to test/e_expr.test.

   362    362     string compare [reverse_str $zLeft] [reverse_str $zRight]
   363    363   }
   364    364   db collate reverse reverse_collate
   365    365   
   366    366   # EVIDENCE-OF: R-59577-33471 The COLLATE operator is a unary postfix
   367    367   # operator that assigns a collating sequence to an expression.
   368    368   #
   369         -# EVIDENCE-OF: R-23441-22541 The COLLATE operator has a higher
   370         -# precedence (binds more tightly) than any prefix unary operator or any
   371         -# binary operator.
          369  +# EVIDENCE-OF: R-36231-30731 The COLLATE operator has a higher
          370  +# precedence (binds more tightly) than any binary operator and any unary
          371  +# prefix operator except "~".
   372    372   #
   373    373   do_execsql_test e_expr-9.1 { SELECT  'abcd' < 'bbbb'    COLLATE reverse } 0
   374    374   do_execsql_test e_expr-9.2 { SELECT ('abcd' < 'bbbb')   COLLATE reverse } 1
   375    375   do_execsql_test e_expr-9.3 { SELECT  'abcd' <= 'bbbb'   COLLATE reverse } 0
   376    376   do_execsql_test e_expr-9.4 { SELECT ('abcd' <= 'bbbb')  COLLATE reverse } 1
   377    377   
   378    378   do_execsql_test e_expr-9.5 { SELECT  'abcd' > 'bbbb'    COLLATE reverse } 1
................................................................................
   627    627          [sqlite3_column_type $stmt 3] 
   628    628   } {NULL NULL NULL NULL}
   629    629   do_test e_expr-11.7.1 { sqlite3_finalize $stmt } SQLITE_OK
   630    630   
   631    631   #-------------------------------------------------------------------------
   632    632   # "Test" the syntax diagrams in lang_expr.html.
   633    633   #
   634         -# EVIDENCE-OF: R-02989-21050 -- syntax diagram signed-number
          634  +# -- syntax diagram signed-number
   635    635   #
   636    636   do_execsql_test e_expr-12.1.1 { SELECT 0, +0, -0 } {0 0 0}
   637    637   do_execsql_test e_expr-12.1.2 { SELECT 1, +1, -1 } {1 1 -1}
   638    638   do_execsql_test e_expr-12.1.3 { SELECT 2, +2, -2 } {2 2 -2}
   639    639   do_execsql_test e_expr-12.1.4 { 
   640    640     SELECT 1.4, +1.4, -1.4 
   641    641   } {1.4 1.4 -1.4}
................................................................................
   642    642   do_execsql_test e_expr-12.1.5 { 
   643    643     SELECT 1.5e+5, +1.5e+5, -1.5e+5 
   644    644   } {150000.0 150000.0 -150000.0}
   645    645   do_execsql_test e_expr-12.1.6 { 
   646    646     SELECT 0.0001, +0.0001, -0.0001 
   647    647   } {0.0001 0.0001 -0.0001}
   648    648   
   649         -# EVIDENCE-OF: R-43188-60852 -- syntax diagram literal-value
          649  +# -- syntax diagram literal-value
   650    650   #
   651    651   set sqlite_current_time 1
   652    652   do_execsql_test e_expr-12.2.1 {SELECT 123}               {123}
   653    653   do_execsql_test e_expr-12.2.2 {SELECT 123.4e05}          {12340000.0}
   654    654   do_execsql_test e_expr-12.2.3 {SELECT 'abcde'}           {abcde}
   655    655   do_execsql_test e_expr-12.2.4 {SELECT X'414243'}         {ABC}
   656    656   do_execsql_test e_expr-12.2.5 {SELECT NULL}              {{}}
   657    657   do_execsql_test e_expr-12.2.6 {SELECT CURRENT_TIME}      {00:00:01}
   658    658   do_execsql_test e_expr-12.2.7 {SELECT CURRENT_DATE}      {1970-01-01}
   659    659   do_execsql_test e_expr-12.2.8 {SELECT CURRENT_TIMESTAMP} {{1970-01-01 00:00:01}}
   660    660   set sqlite_current_time 0
   661    661   
   662         -# EVIDENCE-OF: R-50544-32159 -- syntax diagram expr
          662  +# -- syntax diagram expr
   663    663   #
   664    664   forcedelete test.db2
   665    665   execsql {
   666    666     ATTACH 'test.db2' AS dbname;
   667    667     CREATE TABLE dbname.tblname(cname);
   668    668   }
   669    669   
................................................................................
   812    812       incr x
   813    813       do_test e_expr-12.3.$tn.$x { 
   814    814         set rc [catch { execsql "SELECT $e FROM tblname" } msg]
   815    815       } {0}
   816    816     }
   817    817   }
   818    818   
   819         -# EVIDENCE-OF: R-39820-63916 -- syntax diagram raise-function
          819  +# -- syntax diagram raise-function
   820    820   #
   821    821   foreach {tn raiseexpr} {
   822    822     1 "RAISE(IGNORE)"
   823    823     2 "RAISE(ROLLBACK, 'error message')"
   824    824     3 "RAISE(ABORT, 'error message')"
   825    825     4 "RAISE(FAIL, 'error message')"
   826    826   } {

Changes to test/e_insert.test.

    46     46     CREATE TABLE a4(c UNIQUE, d);
    47     47   } {}
    48     48   
    49     49   proc do_insert_tests {args} {
    50     50     uplevel do_select_tests $args
    51     51   }
    52     52   
    53         -# EVIDENCE-OF: R-21350-31508 -- syntax diagram insert-stmt
           53  +# -- syntax diagram insert-stmt
    54     54   #
    55     55   do_insert_tests e_insert-0 {
    56     56        1  "INSERT             INTO a1 DEFAULT VALUES"                   {}
    57     57        2  "INSERT             INTO main.a1 DEFAULT VALUES"              {}
    58     58        3  "INSERT OR ROLLBACK INTO main.a1 DEFAULT VALUES"              {}
    59     59        4  "INSERT OR ROLLBACK INTO a1 DEFAULT VALUES"                   {}
    60     60        5  "INSERT OR ABORT    INTO main.a1 DEFAULT VALUES"              {}

Changes to test/e_reindex.test.

    22     22   
    23     23   do_execsql_test e_reindex-0.0 {
    24     24     CREATE TABLE t1(a, b);
    25     25     CREATE INDEX i1 ON t1(a, b);
    26     26     CREATE INDEX i2 ON t1(b, a);
    27     27   } {}
    28     28   
    29         -# EVIDENCE-OF: R-51477-38549 -- syntax diagram reindex-stmt
           29  +#  -- syntax diagram reindex-stmt
    30     30   #
    31     31   do_reindex_tests e_reindex-0.1 {
    32     32     1   "REINDEX"           {}
    33     33     2   "REINDEX nocase"    {}
    34     34     3   "REINDEX binary"    {}
    35     35     4   "REINDEX t1"        {}
    36     36     5   "REINDEX main.t1"   {}

Changes to test/e_select.test.

    79     79     }
    80     80   }
    81     81   
    82     82   #-------------------------------------------------------------------------
    83     83   # The following tests check that all paths on the syntax diagrams on
    84     84   # the lang_select.html page may be taken.
    85     85   #
    86         -# EVIDENCE-OF: R-11353-33501 -- syntax diagram join-constraint
           86  +# -- syntax diagram join-constraint
    87     87   #
    88     88   do_join_test e_select-0.1.1 {
    89     89     SELECT count(*) FROM t1 %JOIN% t2 ON (t1.a=t2.a)
    90     90   } {3}
    91     91   do_join_test e_select-0.1.2 {
    92     92     SELECT count(*) FROM t1 %JOIN% t2 USING (a)
    93     93   } {3}
................................................................................
    97     97   do_catchsql_test e_select-0.1.4 {
    98     98     SELECT count(*) FROM t1, t2 ON (t1.a=t2.a) USING (a)
    99     99   } {1 {cannot have both ON and USING clauses in the same join}}
   100    100   do_catchsql_test e_select-0.1.5 {
   101    101     SELECT count(*) FROM t1, t2 USING (a) ON (t1.a=t2.a)
   102    102   } {1 {near "ON": syntax error}}
   103    103   
   104         -# EVIDENCE-OF: R-40919-40941 -- syntax diagram select-core
          104  +# -- syntax diagram select-core
   105    105   #
   106    106   #   0: SELECT ...
   107    107   #   1: SELECT DISTINCT ...
   108    108   #   2: SELECT ALL ...
   109    109   #
   110    110   #   0: No FROM clause
   111    111   #   1: Has FROM clause
................................................................................
   222    222       1 a 1 c
   223    223     }
   224    224     2112.2  "SELECT ALL count(*), max(a) FROM t1 
   225    225              WHERE 0 GROUP BY b HAVING count(*)=2" { }
   226    226   }
   227    227   
   228    228   
   229         -# EVIDENCE-OF: R-41378-26734 -- syntax diagram result-column
          229  +# -- syntax diagram result-column
   230    230   #
   231    231   do_select_tests e_select-0.3 {
   232    232     1  "SELECT * FROM t1" {a one b two c three}
   233    233     2  "SELECT t1.* FROM t1" {a one b two c three}
   234    234     3  "SELECT 'x'||a||'x' FROM t1" {xax xbx xcx}
   235    235     4  "SELECT 'x'||a||'x' alias FROM t1" {xax xbx xcx}
   236    236     5  "SELECT 'x'||a||'x' AS alias FROM t1" {xax xbx xcx}
   237    237   }
   238    238   
   239         -# EVIDENCE-OF: R-43129-35648 -- syntax diagram join-source
          239  +# -- syntax diagram join-source
   240    240   #
   241         -# EVIDENCE-OF: R-36683-37460 -- syntax diagram join-op
          241  +# -- syntax diagram join-op
   242    242   #
   243    243   do_select_tests e_select-0.4 {
   244    244     1  "SELECT t1.rowid FROM t1" {1 2 3}
   245    245     2  "SELECT t1.rowid FROM t1,t2" {1 1 1 2 2 2 3 3 3}
   246    246     3  "SELECT t1.rowid FROM t1,t2,t3" {1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3}
   247    247   
   248    248     4  "SELECT t1.rowid FROM t1" {1 2 3}
................................................................................
   259    259     12 "SELECT t1.rowid FROM t1 JOIN t3" {1 1 2 2 3 3}
   260    260     13 "SELECT t1.rowid FROM t1 LEFT OUTER JOIN t3" {1 1 2 2 3 3}
   261    261     14 "SELECT t1.rowid FROM t1 LEFT JOIN t3" {1 1 2 2 3 3}
   262    262     15 "SELECT t1.rowid FROM t1 INNER JOIN t3" {1 1 2 2 3 3}
   263    263     16 "SELECT t1.rowid FROM t1 CROSS JOIN t3" {1 1 2 2 3 3}
   264    264   }
   265    265   
   266         -# EVIDENCE-OF: R-28308-37813 -- syntax diagram compound-operator
          266  +# -- syntax diagram compound-operator
   267    267   #
   268    268   do_select_tests e_select-0.5 {
   269    269     1  "SELECT rowid FROM t1 UNION ALL SELECT rowid+2 FROM t4" {1 2 3 3 4}
   270    270     2  "SELECT rowid FROM t1 UNION     SELECT rowid+2 FROM t4" {1 2 3 4}
   271    271     3  "SELECT rowid FROM t1 INTERSECT SELECT rowid+2 FROM t4" {3}
   272    272     4  "SELECT rowid FROM t1 EXCEPT    SELECT rowid+2 FROM t4" {1 2}
   273    273   }
   274    274   
   275         -# EVIDENCE-OF: R-06480-34950 -- syntax diagram ordering-term
          275  +# -- syntax diagram ordering-term
   276    276   #
   277    277   do_select_tests e_select-0.6 {
   278    278     1  "SELECT b||a FROM t1 ORDER BY b||a"                  {onea threec twob}
   279    279     2  "SELECT b||a FROM t1 ORDER BY (b||a) COLLATE nocase" {onea threec twob}
   280    280     3  "SELECT b||a FROM t1 ORDER BY (b||a) ASC"            {onea threec twob}
   281    281     4  "SELECT b||a FROM t1 ORDER BY (b||a) DESC"           {twob threec onea}
   282    282   }
   283    283   
   284         -# EVIDENCE-OF: R-23926-36668 -- syntax diagram select-stmt
          284  +# -- syntax diagram select-stmt
   285    285   #
   286    286   do_select_tests e_select-0.7 {
   287    287     1  "SELECT * FROM t1" {a one b two c three}
   288    288     2  "SELECT * FROM t1 ORDER BY b" {a one c three b two}
   289    289     3  "SELECT * FROM t1 ORDER BY b, a" {a one c three b two}
   290    290   
   291    291     4  "SELECT * FROM t1 LIMIT 10" {a one b two c three}
................................................................................
   391    391   #    The tests are built on this assertion. Really, they test that the output
   392    392   #    of a CROSS JOIN, JOIN, INNER JOIN or "," join matches the expected result
   393    393   #    of calculating the cartesian product of the left and right-hand datasets. 
   394    394   #
   395    395   # EVIDENCE-OF: R-46256-57243 There is no difference between the "INNER
   396    396   # JOIN", "JOIN" and "," join operators.
   397    397   #
   398         -# EVIDENCE-OF: R-07544-24155 The "CROSS JOIN" join operator produces the
   399         -# same data as the "INNER JOIN", "JOIN" and "," operators
          398  +# EVIDENCE-OF: R-25071-21202 The "CROSS JOIN" join operator produces the
          399  +# same result as the "INNER JOIN", "JOIN" and "," operators
   400    400   #
   401    401   #    All tests are run 4 times, with the only difference in each run being
   402    402   #    which of the 4 equivalent cartesian product join operators are used.
   403    403   #    Since the output data is the same in all cases, we consider that this
   404    404   #    qualifies as testing the two statements above.
   405    405   #
   406    406   do_execsql_test e_select-1.4.0 {
................................................................................
  1222   1222     1   "SELECT ALL a FROM h1"      {1 1 1 4 4 4}
  1223   1223     2   "SELECT DISTINCT a FROM h1" {1 4}
  1224   1224   }
  1225   1225   
  1226   1226   # EVIDENCE-OF: R-08861-34280 If the simple SELECT is a SELECT ALL, then
  1227   1227   # the entire set of result rows are returned by the SELECT.
  1228   1228   #
  1229         -# EVIDENCE-OF: R-47911-02086 If neither ALL or DISTINCT are present,
         1229  +# EVIDENCE-OF: R-01256-01950 If neither ALL or DISTINCT are present,
  1230   1230   # then the behavior is as if ALL were specified.
  1231   1231   #
  1232   1232   # EVIDENCE-OF: R-14442-41305 If the simple SELECT is a SELECT DISTINCT,
  1233   1233   # then duplicate rows are removed from the set of result rows before it
  1234   1234   # is returned.
  1235   1235   #
  1236   1236   #   The three testable statements above are tested by e_select-5.2.*,

Changes to test/e_select2.test.

   348    348     # JOIN", "JOIN" or a comma (",") and there is no ON or USING clause,
   349    349     # then the result of the join is simply the cartesian product of the
   350    350     # left and right-hand datasets.
   351    351     #
   352    352     # EVIDENCE-OF: R-46256-57243 There is no difference between the "INNER
   353    353     # JOIN", "JOIN" and "," join operators.
   354    354     #
   355         -  # EVIDENCE-OF: R-07544-24155 The "CROSS JOIN" join operator produces the
   356         -  # same data as the "INNER JOIN", "JOIN" and "," operators
          355  +  # EVIDENCE-OF: R-25071-21202 The "CROSS JOIN" join operator produces the
          356  +  # same result as the "INNER JOIN", "JOIN" and "," operators
   357    357     #
   358    358     test_join $tn.1.1  "t1, t2"                {t1 t2}
   359    359     test_join $tn.1.2  "t1 INNER JOIN t2"      {t1 t2}
   360    360     test_join $tn.1.3  "t1 CROSS JOIN t2"      {t1 t2}
   361    361     test_join $tn.1.4  "t1 JOIN t2"            {t1 t2}
   362    362     test_join $tn.1.5  "t2, t3"                {t2 t3}
   363    363     test_join $tn.1.6  "t2 INNER JOIN t3"      {t2 t3}

Changes to test/e_update.test.

    45     45     CREATE TABLE aux.t5(a, b);
    46     46   } {}
    47     47   
    48     48   proc do_update_tests {args} {
    49     49     uplevel do_select_tests $args
    50     50   }
    51     51   
    52         -# EVIDENCE-OF: R-62337-45828 -- syntax diagram update-stmt
           52  +# -- syntax diagram update-stmt
    53     53   #
    54     54   do_update_tests e_update-0 {
    55     55     1    "UPDATE t1 SET a=10" {}
    56     56     2    "UPDATE t1 SET a=10, b=5" {}
    57     57     3    "UPDATE t1 SET a=10 WHERE b=5" {}
    58     58     4    "UPDATE t1 SET b=5,a=10 WHERE 1" {}
    59     59     5    "UPDATE main.t1 SET a=10" {}
................................................................................
   489    489   }
   490    490   
   491    491   # EVIDENCE-OF: R-59581-44104 If SQLite is built with the
   492    492   # SQLITE_ENABLE_UPDATE_DELETE_LIMIT compile-time option then the syntax
   493    493   # of the UPDATE statement is extended with optional ORDER BY and LIMIT
   494    494   # clauses
   495    495   #
   496         -# EVIDENCE-OF: R-45169-39597 -- syntax diagram update-stmt-limited
          496  +# -- syntax diagram update-stmt-limited
   497    497   #
   498    498   do_update_tests e_update-3.0 {
   499    499     1   "UPDATE t1 SET a=b LIMIT 5"                                    {}
   500    500     2   "UPDATE t1 SET a=b LIMIT 5-1 OFFSET 2+2"                       {}
   501    501     3   "UPDATE t1 SET a=b LIMIT 2+2, 16/4"                            {}
   502    502     4   "UPDATE t1 SET a=b ORDER BY a LIMIT 5"                         {}
   503    503     5   "UPDATE t1 SET a=b ORDER BY a LIMIT 5-1 OFFSET 2+2"            {}

Changes to test/e_uri.test.

   355    355   # EVIDENCE-OF: R-23027-03515 Setting it to "shared" is equivalent to
   356    356   # setting the SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed
   357    357   # to sqlite3_open_v2().
   358    358   #
   359    359   # EVIDENCE-OF: R-49793-28525 Setting the cache parameter to "private" is
   360    360   # equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.
   361    361   #
   362         -# EVIDENCE-OF: R-19510-48080 If sqlite3_open_v2() is used and the
          362  +# EVIDENCE-OF: R-31773-41793 If sqlite3_open_v2() is used and the
   363    363   # "cache" parameter is present in a URI filename, its value overrides
   364    364   # any behavior requested by setting SQLITE_OPEN_PRIVATECACHE or
   365    365   # SQLITE_OPEN_SHAREDCACHE flag.
   366    366   #
   367    367   set orig [sqlite3_enable_shared_cache]
   368    368   foreach {tn uri flags shared_default isshared} {
   369    369     1.1   "file:test.db"                  ""         0    0

Changes to test/e_vacuum.test.

    61     61       set prevpageno $pageno
    62     62     }
    63     63     execsql { DROP TABLE temp.stat }
    64     64     set nFrag
    65     65   }
    66     66   
    67     67   
    68         -# EVIDENCE-OF: R-45173-45977 -- syntax diagram vacuum-stmt
           68  +# -- syntax diagram vacuum-stmt
    69     69   #
    70     70   do_execsql_test e_vacuum-0.1 { VACUUM } {}
    71     71   
    72     72   # EVIDENCE-OF: R-51469-36013 Unless SQLite is running in
    73     73   # "auto_vacuum=FULL" mode, when a large amount of data is deleted from
    74     74   # the database file it leaves behind empty space, or "free" database
    75     75   # pages.

Changes to test/eqp.test.

   366    366   
   367    367   #-------------------------------------------------------------------------
   368    368   # This next block of tests verifies that the examples on the 
   369    369   # lang_explain.html page are correct.
   370    370   #
   371    371   drop_all_tables
   372    372   
   373         -# EVIDENCE-OF: R-64208-08323 sqlite> EXPLAIN QUERY PLAN SELECT a, b
   374         -# FROM t1 WHERE a=1; 0|0|0|SCAN TABLE t1
          373  +# EVIDENCE-OF: R-47779-47605 sqlite> EXPLAIN QUERY PLAN SELECT a, b
          374  +# FROM t1 WHERE a=1;
          375  +# 0|0|0|SCAN TABLE t1
          376  +#
   375    377   do_execsql_test 5.1.0 { CREATE TABLE t1(a, b) }
   376    378   det 5.1.1 "SELECT a, b FROM t1 WHERE a=1" {
   377    379     0 0 0 {SCAN TABLE t1}
   378    380   }
   379    381   
   380         -# EVIDENCE-OF: R-09022-44606 sqlite> CREATE INDEX i1 ON t1(a);
          382  +# EVIDENCE-OF: R-55852-17599 sqlite> CREATE INDEX i1 ON t1(a);
   381    383   # sqlite> EXPLAIN QUERY PLAN SELECT a, b FROM t1 WHERE a=1;
   382         -# 0|0|0|SEARCH TABLE t1 USING INDEX i1 (a=?)
          384  +# 0|0|0|SEARCH TABLE t1 USING INDEX i1
          385  +#
   383    386   do_execsql_test 5.2.0 { CREATE INDEX i1 ON t1(a) }
   384    387   det 5.2.1 "SELECT a, b FROM t1 WHERE a=1" {
   385    388     0 0 0 {SEARCH TABLE t1 USING INDEX i1 (a=?)}
   386    389   }
   387    390   
   388         -# EVIDENCE-OF: R-62228-34103 sqlite> CREATE INDEX i2 ON t1(a, b);
          391  +# EVIDENCE-OF: R-21179-11011 sqlite> CREATE INDEX i2 ON t1(a, b);
   389    392   # sqlite> EXPLAIN QUERY PLAN SELECT a, b FROM t1 WHERE a=1;
   390    393   # 0|0|0|SEARCH TABLE t1 USING COVERING INDEX i2 (a=?)
          394  +#
   391    395   do_execsql_test 5.3.0 { CREATE INDEX i2 ON t1(a, b) }
   392    396   det 5.3.1 "SELECT a, b FROM t1 WHERE a=1" {
   393    397     0 0 0 {SEARCH TABLE t1 USING COVERING INDEX i2 (a=?)}
   394    398   }
   395    399   
   396         -# EVIDENCE-OF: R-22253-05302 sqlite> EXPLAIN QUERY PLAN SELECT t1.*,
   397         -# t2.* FROM t1, t2 WHERE t1.a=1 AND t1.b>2; 0|0|0|SEARCH TABLE t1
   398         -# USING COVERING INDEX i2 (a=? AND b>?) 0|1|1|SCAN TABLE t2
          400  +# EVIDENCE-OF: R-09991-48941 sqlite> EXPLAIN QUERY PLAN
          401  +# SELECT t1.*, t2.* FROM t1, t2 WHERE t1.a=1 AND t1.b>2;
          402  +# 0|0|0|SEARCH TABLE t1 USING COVERING INDEX i2 (a=? AND b>?)
          403  +# 0|1|1|SCAN TABLE t2
   399    404   #
   400    405   do_execsql_test 5.4.0 {CREATE TABLE t2(c, d)}
   401    406   det 5.4.1 "SELECT t1.*, t2.* FROM t1, t2 WHERE t1.a=1 AND t1.b>2" {
   402    407     0 0 0 {SEARCH TABLE t1 USING COVERING INDEX i2 (a=? AND b>?)}
   403    408     0 1 1 {SCAN TABLE t2}
   404    409   }
   405    410   
   406         -# EVIDENCE-OF: R-21040-07025 sqlite> EXPLAIN QUERY PLAN SELECT t1.*,
   407         -# t2.* FROM t2, t1 WHERE t1.a=1 AND t1.b>2; 0|0|1|SEARCH TABLE t1
   408         -# USING COVERING INDEX i2 (a=? AND b>?) 0|1|0|SCAN TABLE t2
          411  +# EVIDENCE-OF: R-33626-61085 sqlite> EXPLAIN QUERY PLAN
          412  +# SELECT t1.*, t2.* FROM t2, t1 WHERE t1.a=1 AND t1.b>2;
          413  +# 0|0|1|SEARCH TABLE t1 USING COVERING INDEX i2 (a=? AND b>?)
          414  +# 0|1|0|SCAN TABLE t2
   409    415   #
   410    416   det 5.5 "SELECT t1.*, t2.* FROM t2, t1 WHERE t1.a=1 AND t1.b>2" {
   411    417     0 0 1 {SEARCH TABLE t1 USING COVERING INDEX i2 (a=? AND b>?)}
   412    418     0 1 0 {SCAN TABLE t2}
   413    419   }
   414    420   
   415         -# EVIDENCE-OF: R-39007-61103 sqlite> CREATE INDEX i3 ON t1(b);
          421  +# EVIDENCE-OF: R-04002-25654 sqlite> CREATE INDEX i3 ON t1(b);
   416    422   # sqlite> EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a=1 OR b=2;
   417    423   # 0|0|0|SEARCH TABLE t1 USING COVERING INDEX i2 (a=?)
   418    424   # 0|0|0|SEARCH TABLE t1 USING INDEX i3 (b=?)
          425  +#
   419    426   do_execsql_test 5.5.0 {CREATE INDEX i3 ON t1(b)}
   420    427   det 5.6.1 "SELECT * FROM t1 WHERE a=1 OR b=2" {
   421    428     0 0 0 {SEARCH TABLE t1 USING COVERING INDEX i2 (a=?)}
   422    429     0 0 0 {SEARCH TABLE t1 USING INDEX i3 (b=?)}
   423    430   }
   424    431   
   425         -# EVIDENCE-OF: R-33025-54904 sqlite> EXPLAIN QUERY PLAN SELECT c, d
   426         -# FROM t2 ORDER BY c; 0|0|0|SCAN TABLE t2 0|0|0|USE TEMP
   427         -# B-TREE FOR ORDER BY
          432  +# EVIDENCE-OF: R-24577-38891 sqlite> EXPLAIN QUERY PLAN
          433  +# SELECT c, d FROM t2 ORDER BY c;
          434  +# 0|0|0|SCAN TABLE t2
          435  +# 0|0|0|USE TEMP B-TREE FOR ORDER BY
          436  +#
   428    437   det 5.7 "SELECT c, d FROM t2 ORDER BY c" {
   429    438     0 0 0 {SCAN TABLE t2}
   430    439     0 0 0 {USE TEMP B-TREE FOR ORDER BY}
   431    440   }
   432    441   
   433         -# EVIDENCE-OF: R-38854-22809 sqlite> CREATE INDEX i4 ON t2(c);
          442  +# EVIDENCE-OF: R-58157-12355 sqlite> CREATE INDEX i4 ON t2(c);
   434    443   # sqlite> EXPLAIN QUERY PLAN SELECT c, d FROM t2 ORDER BY c;
   435    444   # 0|0|0|SCAN TABLE t2 USING INDEX i4
          445  +#
   436    446   do_execsql_test 5.8.0 {CREATE INDEX i4 ON t2(c)}
   437    447   det 5.8.1 "SELECT c, d FROM t2 ORDER BY c" {
   438    448     0 0 0 {SCAN TABLE t2 USING INDEX i4}
   439    449   }
   440    450   
   441         -# EVIDENCE-OF: R-29884-43993 sqlite> EXPLAIN QUERY PLAN SELECT
          451  +# EVIDENCE-OF: R-13931-10421 sqlite> EXPLAIN QUERY PLAN SELECT
   442    452   # (SELECT b FROM t1 WHERE a=0), (SELECT a FROM t1 WHERE b=t2.c) FROM t2;
   443         -# 0|0|0|SCAN TABLE t2 0|0|0|EXECUTE SCALAR SUBQUERY 1
          453  +# 0|0|0|SCAN TABLE t2
          454  +# 0|0|0|EXECUTE SCALAR SUBQUERY 1
   444    455   # 1|0|0|SEARCH TABLE t1 USING COVERING INDEX i2 (a=?)
   445         -# 0|0|0|EXECUTE CORRELATED SCALAR SUBQUERY 2 2|0|0|SEARCH TABLE t1 USING
   446         -# INDEX i3 (b=?)
          456  +# 0|0|0|EXECUTE CORRELATED SCALAR SUBQUERY 2
          457  +# 2|0|0|SEARCH TABLE t1 USING INDEX i3 (b=?)
          458  +#
   447    459   det 5.9 {
   448    460     SELECT (SELECT b FROM t1 WHERE a=0), (SELECT a FROM t1 WHERE b=t2.c) FROM t2
   449    461   } {
   450    462     0 0 0 {SCAN TABLE t2 USING COVERING INDEX i4}
   451    463     0 0 0 {EXECUTE SCALAR SUBQUERY 1}
   452    464     1 0 0 {SEARCH TABLE t1 USING COVERING INDEX i2 (a=?)}
   453    465     0 0 0 {EXECUTE CORRELATED SCALAR SUBQUERY 2}
   454    466     2 0 0 {SEARCH TABLE t1 USING INDEX i3 (b=?)}
   455    467   }
   456    468   
   457         -# EVIDENCE-OF: R-17911-16445 sqlite> EXPLAIN QUERY PLAN SELECT
   458         -# count(*) FROM (SELECT max(b) AS x FROM t1 GROUP BY a) GROUP BY x;
   459         -# 1|0|0|SCAN TABLE t1 USING COVERING INDEX i2 0|0|0|SCAN
   460         -# SUBQUERY 1 0|0|0|USE TEMP B-TREE FOR GROUP BY
          469  +# EVIDENCE-OF: R-50892-45943 sqlite> EXPLAIN QUERY PLAN
          470  +# SELECT count(*) FROM (SELECT max(b) AS x FROM t1 GROUP BY a) GROUP BY x;
          471  +# 1|0|0|SCAN TABLE t1 USING COVERING INDEX i2
          472  +# 0|0|0|SCAN SUBQUERY 1
          473  +# 0|0|0|USE TEMP B-TREE FOR GROUP BY
          474  +#
   461    475   det 5.10 {
   462    476     SELECT count(*) FROM (SELECT max(b) AS x FROM t1 GROUP BY a) GROUP BY x
   463    477   } {
   464    478     1 0 0 {SCAN TABLE t1 USING COVERING INDEX i2}
   465    479     0 0 0 {SCAN SUBQUERY 1}
   466    480     0 0 0 {USE TEMP B-TREE FOR GROUP BY}
   467    481   }
   468    482   
   469         -# EVIDENCE-OF: R-18544-33103 sqlite> EXPLAIN QUERY PLAN SELECT * FROM
   470         -# (SELECT * FROM t2 WHERE c=1), t1; 0|0|0|SEARCH TABLE t2 USING INDEX i4
   471         -# (c=?) 0|1|1|SCAN TABLE t1
          483  +# EVIDENCE-OF: R-46219-33846 sqlite> EXPLAIN QUERY PLAN
          484  +# SELECT * FROM (SELECT * FROM t2 WHERE c=1), t1;
          485  +# 0|0|0|SEARCH TABLE t2 USING INDEX i4 (c=?)
          486  +# 0|1|1|SCAN TABLE t1
          487  +#
   472    488   det 5.11 "SELECT * FROM (SELECT * FROM t2 WHERE c=1), t1" {
   473    489     0 0 0 {SEARCH TABLE t2 USING INDEX i4 (c=?)}
   474    490     0 1 1 {SCAN TABLE t1 USING COVERING INDEX i2}
   475    491   }
   476    492   
   477         -# EVIDENCE-OF: R-40701-42164 sqlite> EXPLAIN QUERY PLAN SELECT a FROM
   478         -# t1 UNION SELECT c FROM t2; 1|0|0|SCAN TABLE t1
   479         -# 2|0|0|SCAN TABLE t2 0|0|0|COMPOUND SUBQUERIES 1 AND 2
   480         -# USING TEMP B-TREE (UNION)
          493  +# EVIDENCE-OF: R-37879-39987 sqlite> EXPLAIN QUERY PLAN
          494  +# SELECT a FROM t1 UNION SELECT c FROM t2;
          495  +# 1|0|0|SCAN TABLE t1
          496  +# 2|0|0|SCAN TABLE t2
          497  +# 0|0|0|COMPOUND SUBQUERIES 1 AND 2 USING TEMP B-TREE (UNION)
          498  +#
   481    499   det 5.12 "SELECT a FROM t1 UNION SELECT c FROM t2" {
   482    500     1 0 0 {SCAN TABLE t1 USING COVERING INDEX i2}
   483    501     2 0 0 {SCAN TABLE t2 USING COVERING INDEX i4}
   484    502     0 0 0 {COMPOUND SUBQUERIES 1 AND 2 USING TEMP B-TREE (UNION)}
   485    503   }
   486    504   
   487         -# EVIDENCE-OF: R-61538-24748 sqlite> EXPLAIN QUERY PLAN SELECT a FROM
   488         -# t1 EXCEPT SELECT d FROM t2 ORDER BY 1; 1|0|0|SCAN TABLE t1 USING
   489         -# COVERING INDEX i2 2|0|0|SCAN TABLE t2
   490         -# 2|0|0|USE TEMP B-TREE FOR ORDER BY 0|0|0|COMPOUND SUBQUERIES 1 AND 2
   491         -# (EXCEPT)
          505  +# EVIDENCE-OF: R-44864-63011 sqlite> EXPLAIN QUERY PLAN
          506  +# SELECT a FROM t1 EXCEPT SELECT d FROM t2 ORDER BY 1;
          507  +# 1|0|0|SCAN TABLE t1 USING COVERING INDEX i2
          508  +# 2|0|0|SCAN TABLE t2 2|0|0|USE TEMP B-TREE FOR ORDER BY
          509  +# 0|0|0|COMPOUND SUBQUERIES 1 AND 2 (EXCEPT)
          510  +#
   492    511   det 5.13 "SELECT a FROM t1 EXCEPT SELECT d FROM t2 ORDER BY 1" {
   493    512     1 0 0 {SCAN TABLE t1 USING COVERING INDEX i2}
   494    513     2 0 0 {SCAN TABLE t2}
   495    514     2 0 0 {USE TEMP B-TREE FOR ORDER BY}
   496    515     0 0 0 {COMPOUND SUBQUERIES 1 AND 2 (EXCEPT)}
   497    516   }
   498    517