/ Check-in [5c1cf308]
Login

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

Overview
Comment:Merge latest trunk changes into this branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | reuse-schema
Files: files | file ages | folders
SHA3-256: 5c1cf30859ed734eb2d6bc52adb057ca62a6b5a7eef66d8da1fa833e84468dee
User & Date: dan 2019-02-25 18:07:09
Wiki:reuse-schema
Context
2019-02-25
19:23
Fix a comment in build.c. check-in: d6a9bff6 user: dan tags: reuse-schema
18:07
Merge latest trunk changes into this branch. check-in: 5c1cf308 user: dan tags: reuse-schema
17:54
Where possible, avoid loading all schemas into memory for PRAGMA statements. check-in: 64f97530 user: dan tags: reuse-schema
14:52
Update comments on the fossildelta extension. No changes to code. check-in: 9da4fb59 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3_snippet.c.

  1539   1539     int rc;
  1540   1540   
  1541   1541     UNUSED_PARAMETER(iPhrase);
  1542   1542     rc = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pList);
  1543   1543     nTerm = pExpr->pPhrase->nToken;
  1544   1544     if( pList ){
  1545   1545       fts3GetDeltaPosition(&pList, &iPos);
  1546         -    assert( iPos>=0 );
         1546  +    assert_fts3_nc( iPos>=0 );
  1547   1547     }
  1548   1548   
  1549   1549     for(iTerm=0; iTerm<nTerm; iTerm++){
  1550   1550       TermOffset *pT = &p->aTerm[p->iTerm++];
  1551   1551       pT->iOff = nTerm-iTerm-1;
  1552   1552       pT->pList = pList;
  1553   1553       pT->iPos = iPos;
................................................................................
  1649   1649           }
  1650   1650         }
  1651   1651   
  1652   1652         if( !pTerm ){
  1653   1653           /* All offsets for this column have been gathered. */
  1654   1654           rc = SQLITE_DONE;
  1655   1655         }else{
  1656         -        assert( iCurrent<=iMinPos );
         1656  +        assert_fts3_nc( iCurrent<=iMinPos );
  1657   1657           if( 0==(0xFE&*pTerm->pList) ){
  1658   1658             pTerm->pList = 0;
  1659   1659           }else{
  1660   1660             fts3GetDeltaPosition(&pTerm->pList, &pTerm->iPos);
  1661   1661           }
  1662   1662           while( rc==SQLITE_OK && iCurrent<iMinPos ){
  1663   1663             rc = pMod->xNext(pC, &ZDUMMY, &NDUMMY, &iStart, &iEnd, &iCurrent);

Changes to ext/misc/fossildelta.c.

   596    596       }
   597    597     }
   598    598     /* ERROR: unterminated delta */
   599    599     return -1;
   600    600   }
   601    601   
   602    602   /*
   603         -** SQL functions:  fossildelta_create(X,Y)
          603  +** SQL functions:  delta_create(X,Y)
   604    604   **
   605    605   ** Return a delta for carrying X into Y.
   606    606   */
   607    607   static void deltaCreateFunc(
   608    608     sqlite3_context *context,
   609    609     int argc,
   610    610     sqlite3_value **argv
................................................................................
   631    631       }else{
   632    632         sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
   633    633       }
   634    634     }
   635    635   }
   636    636   
   637    637   /*
   638         -** SQL functions:  fossildelta_apply(X,D)
          638  +** SQL functions:  delta_apply(X,D)
   639    639   **
   640    640   ** Return the result of applying delta D to input X.
   641    641   */
   642    642   static void deltaApplyFunc(
   643    643     sqlite3_context *context,
   644    644     int argc,
   645    645     sqlite3_value **argv
................................................................................
   674    674         sqlite3_result_blob(context, aOut, nOut, sqlite3_free);
   675    675       }
   676    676     }
   677    677   }
   678    678   
   679    679   
   680    680   /*
   681         -** SQL functions:  fossildelta_output_size(D)
          681  +** SQL functions:  delta_output_size(D)
   682    682   **
   683    683   ** Return the size of the output that results from applying delta D.
   684    684   */
   685    685   static void deltaOutputSizeFunc(
   686    686     sqlite3_context *context,
   687    687     int argc,
   688    688     sqlite3_value **argv
................................................................................
   700    700       sqlite3_result_error(context, "corrupt fossil delta", -1);
   701    701       return;
   702    702     }else{
   703    703       sqlite3_result_int(context, nOut);
   704    704     }
   705    705   }
   706    706   
   707         -/* The deltaparse(DELTA) table-valued function parses the DELTA in
   708         -** its input and returns a table that describes that delta.
          707  +/*****************************************************************************
          708  +** Table-valued SQL function:   delta_parse(DELTA)
          709  +**
          710  +** Schema:
          711  +**
          712  +**     CREATE TABLE delta_parse(
          713  +**       op TEXT,
          714  +**       a1 INT,
          715  +**       a2 ANY,
          716  +**       delta HIDDEN BLOB
          717  +**     );
          718  +**
          719  +** Given an input DELTA, this function parses the delta and returns
          720  +** rows for each entry in the delta.  The op column has one of the
          721  +** values SIZE, COPY, INSERT, CHECKSUM, ERROR.
          722  +**
          723  +** Assuming no errors, the first row has op='SIZE'.  a1 is the size of
          724  +** the output in bytes and a2 is NULL.
          725  +**
          726  +** After the initial SIZE row, there are zero or more 'COPY' and/or 'INSERT'
          727  +** rows.  A COPY row means content is copied from the source into the
          728  +** output.  Column a1 is the number of bytes to copy and a2 is the offset
          729  +** into source from which to begin copying.  An INSERT row means to
          730  +** insert text into the output stream.  Column a1 is the number of bytes
          731  +** to insert and column is a BLOB that contains the text to be inserted.
          732  +**
          733  +** The last row of a well-formed delta will have an op value of 'CHECKSUM'.
          734  +** The a1 column will be the value of the checksum and a2 will be NULL.
          735  +**
          736  +** If the input delta is not well-formed, then a row with an op value
          737  +** of 'ERROR' is returned.  The a1 value of the ERROR row is the offset
          738  +** into the delta where the error was encountered and a2 is NULL.
   709    739   */
   710    740   typedef struct deltaparsevtab_vtab deltaparsevtab_vtab;
   711    741   typedef struct deltaparsevtab_cursor deltaparsevtab_cursor;
   712    742   struct deltaparsevtab_vtab {
   713    743     sqlite3_vtab base;  /* Base class - must be first */
   714    744     /* No additional information needed */
   715    745   };

Changes to src/expr.c.

  2548   2548       ** We will have to generate an ephemeral table to do the job.
  2549   2549       */
  2550   2550       u32 savedNQueryLoop = pParse->nQueryLoop;
  2551   2551       int rMayHaveNull = 0;
  2552   2552       eType = IN_INDEX_EPH;
  2553   2553       if( inFlags & IN_INDEX_LOOP ){
  2554   2554         pParse->nQueryLoop = 0;
  2555         -      if( pX->pLeft->iColumn<0 && !ExprHasProperty(pX, EP_xIsSelect) ){
  2556         -        eType = IN_INDEX_ROWID;
  2557         -      }
  2558   2555       }else if( prRhsHasNull ){
  2559   2556         *prRhsHasNull = rMayHaveNull = ++pParse->nMem;
  2560   2557       }
  2561   2558       assert( pX->op==TK_IN );
  2562         -    sqlite3CodeRhsOfIN(pParse, pX, iTab, eType==IN_INDEX_ROWID);
         2559  +    sqlite3CodeRhsOfIN(pParse, pX, iTab);
  2563   2560       if( rMayHaveNull ){
  2564   2561         sqlite3SetHasNullFlag(v, iTab, rMayHaveNull);
  2565   2562       }
  2566   2563       pParse->nQueryLoop = savedNQueryLoop;
  2567   2564     }
  2568   2565   
  2569   2566     if( aiMap && eType!=IN_INDEX_INDEX_ASC && eType!=IN_INDEX_INDEX_DESC ){
................................................................................
  2656   2653   **
  2657   2654   ** The pExpr parameter is the IN operator.  The cursor number for the
  2658   2655   ** constructed ephermeral table is returned.  The first time the ephemeral
  2659   2656   ** table is computed, the cursor number is also stored in pExpr->iTable,
  2660   2657   ** however the cursor number returned might not be the same, as it might
  2661   2658   ** have been duplicated using OP_OpenDup.
  2662   2659   **
  2663         -** If parameter isRowid is non-zero, then LHS of the IN operator is guaranteed
  2664         -** to be a non-null integer. In this case, the ephemeral table can be an
  2665         -** table B-Tree that keyed by only integers.  The more general cases uses
  2666         -** an index B-Tree which can have arbitrary keys, but is slower to both
  2667         -** read and write.
  2668         -**
  2669   2660   ** If the LHS expression ("x" in the examples) is a column value, or
  2670   2661   ** the SELECT statement returns a column value, then the affinity of that
  2671   2662   ** column is used to build the index keys. If both 'x' and the
  2672   2663   ** SELECT... statement are columns, then numeric affinity is used
  2673   2664   ** if either column has NUMERIC or INTEGER affinity. If neither
  2674   2665   ** 'x' nor the SELECT... statement are columns, then numeric affinity
  2675   2666   ** is used.
  2676   2667   */
  2677   2668   void sqlite3CodeRhsOfIN(
  2678   2669     Parse *pParse,          /* Parsing context */
  2679   2670     Expr *pExpr,            /* The IN operator */
  2680         -  int iTab,               /* Use this cursor number */
  2681         -  int isRowid             /* If true, LHS is a rowid */
         2671  +  int iTab                /* Use this cursor number */
  2682   2672   ){
  2683   2673     int addrOnce = 0;           /* Address of the OP_Once instruction at top */
  2684   2674     int addr;                   /* Address of OP_OpenEphemeral instruction */
  2685   2675     Expr *pLeft;                /* the LHS of the IN operator */
  2686   2676     KeyInfo *pKeyInfo = 0;      /* Key information */
  2687   2677     int nVal;                   /* Size of vector pLeft */
  2688   2678     Vdbe *v;                    /* The prepared statement under construction */
................................................................................
  2727   2717   
  2728   2718       addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
  2729   2719     }
  2730   2720   
  2731   2721     /* Check to see if this is a vector IN operator */
  2732   2722     pLeft = pExpr->pLeft;
  2733   2723     nVal = sqlite3ExprVectorSize(pLeft);
  2734         -  assert( !isRowid || nVal==1 );
  2735   2724   
  2736   2725     /* Construct the ephemeral table that will contain the content of
  2737   2726     ** RHS of the IN operator.
  2738   2727     */
  2739   2728     pExpr->iTable = iTab;
  2740         -  addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, 
  2741         -      pExpr->iTable, (isRowid?0:nVal));
         2729  +  addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, nVal);
  2742   2730   #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
  2743   2731     if( ExprHasProperty(pExpr, EP_xIsSelect) ){
  2744   2732       VdbeComment((v, "Result of SELECT %u", pExpr->x.pSelect->selId));
  2745   2733     }else{
  2746   2734       VdbeComment((v, "RHS of IN operator"));
  2747   2735     }
  2748   2736   #endif
  2749         -  pKeyInfo = isRowid ? 0 : sqlite3KeyInfoAlloc(pParse->db, nVal, 1);
         2737  +  pKeyInfo = sqlite3KeyInfoAlloc(pParse->db, nVal, 1);
  2750   2738   
  2751   2739     if( ExprHasProperty(pExpr, EP_xIsSelect) ){
  2752   2740       /* Case 1:     expr IN (SELECT ...)
  2753   2741       **
  2754   2742       ** Generate code to write the results of the select into the temporary
  2755   2743       ** table allocated and opened above.
  2756   2744       */
  2757   2745       Select *pSelect = pExpr->x.pSelect;
  2758   2746       ExprList *pEList = pSelect->pEList;
  2759   2747   
  2760   2748       ExplainQueryPlan((pParse, 1, "%sLIST SUBQUERY %d",
  2761   2749           addrOnce?"":"CORRELATED ", pSelect->selId
  2762   2750       ));
  2763         -    assert( !isRowid );
  2764   2751       /* If the LHS and RHS of the IN operator do not match, that
  2765   2752       ** error will have been caught long before we reach this point. */
  2766   2753       if( ALWAYS(pEList->nExpr==nVal) ){
  2767   2754         SelectDest dest;
  2768   2755         int i;
  2769   2756         sqlite3SelectDestInit(&dest, SRT_Set, iTab);
  2770   2757         dest.zAffSdst = exprINAffinity(pParse, pExpr);
................................................................................
  2809   2796         assert( sqlite3KeyInfoIsWriteable(pKeyInfo) );
  2810   2797         pKeyInfo->aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft);
  2811   2798       }
  2812   2799   
  2813   2800       /* Loop through each expression in <exprlist>. */
  2814   2801       r1 = sqlite3GetTempReg(pParse);
  2815   2802       r2 = sqlite3GetTempReg(pParse);
  2816         -    if( isRowid ) sqlite3VdbeAddOp4(v, OP_Blob, 0, r2, 0, "", P4_STATIC);
  2817   2803       for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
  2818   2804         Expr *pE2 = pItem->pExpr;
  2819         -      int iValToIns;
  2820   2805   
  2821   2806         /* If the expression is not constant then we will need to
  2822   2807         ** disable the test that was generated above that makes sure
  2823   2808         ** this code only executes once.  Because for a non-constant
  2824   2809         ** expression we need to rerun this code each time.
  2825   2810         */
  2826   2811         if( addrOnce && !sqlite3ExprIsConstant(pE2) ){
  2827   2812           sqlite3VdbeChangeToNoop(v, addrOnce);
  2828   2813           addrOnce = 0;
  2829   2814         }
  2830   2815   
  2831   2816         /* Evaluate the expression and insert it into the temp table */
  2832         -      if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){
  2833         -        sqlite3VdbeAddOp3(v, OP_InsertInt, iTab, r2, iValToIns);
  2834         -      }else{
  2835         -        r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
  2836         -        if( isRowid ){
  2837         -          sqlite3VdbeAddOp2(v, OP_MustBeInt, r3,
  2838         -                            sqlite3VdbeCurrentAddr(v)+2);
  2839         -          VdbeCoverage(v);
  2840         -          sqlite3VdbeAddOp3(v, OP_Insert, iTab, r2, r3);
  2841         -        }else{
  2842         -          sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
  2843         -          sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1);
  2844         -        }
  2845         -      }
         2817  +      r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
         2818  +      sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
         2819  +      sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1);
  2846   2820       }
  2847   2821       sqlite3ReleaseTempReg(pParse, r1);
  2848   2822       sqlite3ReleaseTempReg(pParse, r2);
  2849   2823     }
  2850   2824     if( pKeyInfo ){
  2851   2825       sqlite3VdbeChangeP4(v, addr, (void *)pKeyInfo, P4_KEYINFO);
  2852   2826     }

Changes to src/insert.c.

  1917   1917       pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
  1918   1918       if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
  1919   1919         assert( pParse->nested==0 );
  1920   1920         pik_flags |= OPFLAG_NCHANGE;
  1921   1921         pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
  1922   1922   #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
  1923   1923         if( update_flags==0 ){
  1924         -        sqlite3VdbeAddOp4(v, OP_InsertInt, 
  1925         -            iIdxCur+i, aRegIdx[i], 0, (char*)pTab, P4_TABLE
         1924  +        int r = sqlite3GetTempReg(pParse);
         1925  +        sqlite3VdbeAddOp2(v, OP_Integer, 0, r);
         1926  +        sqlite3VdbeAddOp4(v, OP_Insert, 
         1927  +            iIdxCur+i, aRegIdx[i], r, (char*)pTab, P4_TABLE
  1926   1928           );
  1927   1929           sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP);
         1930  +        sqlite3ReleaseTempReg(pParse, r);
  1928   1931         }
  1929   1932   #endif
  1930   1933       }
  1931   1934       sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
  1932   1935                            aRegIdx[i]+1,
  1933   1936                            pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn);
  1934   1937       sqlite3VdbeChangeP5(v, pik_flags);

Changes to src/resolve.c.

  1239   1239         resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,
  1240   1240                      zType,0);
  1241   1241       }
  1242   1242     }
  1243   1243     return 0;
  1244   1244   }
  1245   1245   
         1246  +#ifndef SQLITE_OMIT_WINDOWFUNC
         1247  +/*
         1248  +** Walker callback for resolveRemoveWindows().
         1249  +*/
         1250  +static int resolveRemoveWindowsCb(Walker *pWalker, Expr *pExpr){
         1251  +  if( ExprHasProperty(pExpr, EP_WinFunc) ){
         1252  +    Window **pp;
         1253  +    for(pp=&pWalker->u.pSelect->pWin; *pp; pp=&(*pp)->pNextWin){
         1254  +      if( *pp==pExpr->y.pWin ){
         1255  +        *pp = (*pp)->pNextWin;
         1256  +        break;
         1257  +      }    
         1258  +    }
         1259  +  }
         1260  +  return WRC_Continue;
         1261  +}
         1262  +
         1263  +/*
         1264  +** Remove any Window objects owned by the expression pExpr from the
         1265  +** Select.pWin list of Select object pSelect.
         1266  +*/
         1267  +static void resolveRemoveWindows(Select *pSelect, Expr *pExpr){
         1268  +  Walker sWalker;
         1269  +  memset(&sWalker, 0, sizeof(Walker));
         1270  +  sWalker.xExprCallback = resolveRemoveWindowsCb;
         1271  +  sWalker.u.pSelect = pSelect;
         1272  +  sqlite3WalkExpr(&sWalker, pExpr);
         1273  +}
         1274  +#else
         1275  +# define resolveRemoveWindows(x,y)
         1276  +#endif
         1277  +
  1246   1278   /*
  1247   1279   ** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect.
  1248   1280   ** The Name context of the SELECT statement is pNC.  zType is either
  1249   1281   ** "ORDER" or "GROUP" depending on which type of clause pOrderBy is.
  1250   1282   **
  1251   1283   ** This routine resolves each term of the clause into an expression.
  1252   1284   ** If the order-by term is an integer I between 1 and N (where N is the
................................................................................
  1305   1337       /* Otherwise, treat the ORDER BY term as an ordinary expression */
  1306   1338       pItem->u.x.iOrderByCol = 0;
  1307   1339       if( sqlite3ResolveExprNames(pNC, pE) ){
  1308   1340         return 1;
  1309   1341       }
  1310   1342       for(j=0; j<pSelect->pEList->nExpr; j++){
  1311   1343         if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){
  1312         -#ifndef SQLITE_OMIT_WINDOWFUNC
  1313         -        if( ExprHasProperty(pE, EP_WinFunc) ){
  1314         -          /* Since this window function is being changed into a reference
  1315         -          ** to the same window function the result set, remove the instance
  1316         -          ** of this window function from the Select.pWin list. */
  1317         -          Window **pp;
  1318         -          for(pp=&pSelect->pWin; *pp; pp=&(*pp)->pNextWin){
  1319         -            if( *pp==pE->y.pWin ){
  1320         -              *pp = (*pp)->pNextWin;
  1321         -            }    
  1322         -          }
  1323         -        }
  1324         -#endif
         1344  +        /* Since this expresion is being changed into a reference
         1345  +        ** to an identical expression in the result set, remove all Window
         1346  +        ** objects belonging to the expression from the Select.pWin list. */
         1347  +        resolveRemoveWindows(pSelect, pE);
  1325   1348           pItem->u.x.iOrderByCol = j+1;
  1326   1349         }
  1327   1350       }
  1328   1351     }
  1329   1352     return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType);
  1330   1353   }
  1331   1354   

Changes to src/sqlite.h.in.

  2367   2367   ** does not affect the value returned by sqlite3_total_changes().
  2368   2368   ** 
  2369   2369   ** ^Changes made as part of [foreign key actions] are included in the
  2370   2370   ** count, but those made as part of REPLACE constraint resolution are
  2371   2371   ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers 
  2372   2372   ** are not counted.
  2373   2373   **
  2374         -** This the [sqlite3_total_changes(D)] interface only reports the number
         2374  +** The [sqlite3_total_changes(D)] interface only reports the number
  2375   2375   ** of rows that changed due to SQL statement run against database
  2376   2376   ** connection D.  Any changes by other database connections are ignored.
  2377   2377   ** To detect changes against a database file from other database
  2378   2378   ** connections use the [PRAGMA data_version] command or the
  2379   2379   ** [SQLITE_FCNTL_DATA_VERSION] [file control].
  2380   2380   ** 
  2381   2381   ** If a separate thread makes changes on the same database connection

Changes to src/sqliteInt.h.

  4289   4289   void sqlite3Reindex(Parse*, Token*, Token*);
  4290   4290   void sqlite3AlterFunctions(void);
  4291   4291   void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
  4292   4292   void sqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*);
  4293   4293   int sqlite3GetToken(const unsigned char *, int *);
  4294   4294   void sqlite3NestedParse(Parse*, const char*, ...);
  4295   4295   void sqlite3ExpirePreparedStatements(sqlite3*, int);
  4296         -void sqlite3CodeRhsOfIN(Parse*, Expr*, int, int);
         4296  +void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
  4297   4297   int sqlite3CodeSubselect(Parse*, Expr*);
  4298   4298   void sqlite3SelectPrep(Parse*, Select*, NameContext*);
  4299   4299   void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
  4300   4300   int sqlite3MatchSpanName(const char*, const char*, const char*, const char*);
  4301   4301   int sqlite3ResolveExprNames(NameContext*, Expr*);
  4302   4302   int sqlite3ResolveExprListNames(NameContext*, ExprList*);
  4303   4303   void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*);

Changes to src/vdbe.c.

  4565   4565   ** and register P2 becomes ephemeral.  If the cursor is changed, the
  4566   4566   ** value of register P2 will then change.  Make sure this does not
  4567   4567   ** cause any problems.)
  4568   4568   **
  4569   4569   ** This instruction only works on tables.  The equivalent instruction
  4570   4570   ** for indices is OP_IdxInsert.
  4571   4571   */
  4572         -/* Opcode: InsertInt P1 P2 P3 P4 P5
  4573         -** Synopsis: intkey=P3 data=r[P2]
  4574         -**
  4575         -** This works exactly like OP_Insert except that the key is the
  4576         -** integer value P3, not the value of the integer stored in register P3.
  4577         -*/
  4578         -case OP_Insert: 
  4579         -case OP_InsertInt: {
         4572  +case OP_Insert: {
  4580   4573     Mem *pData;       /* MEM cell holding data for the record to be inserted */
  4581   4574     Mem *pKey;        /* MEM cell holding key  for the record */
  4582   4575     VdbeCursor *pC;   /* Cursor to table into which insert is written */
  4583   4576     int seekResult;   /* Result of prior seek or 0 if no USESEEKRESULT flag */
  4584   4577     const char *zDb;  /* database name - used by the update hook */
  4585   4578     Table *pTab;      /* Table structure - used by update and pre-update hooks */
  4586   4579     BtreePayload x;   /* Payload to be inserted */
................................................................................
  4593   4586     assert( pC->eCurType==CURTYPE_BTREE );
  4594   4587     assert( pC->uc.pCursor!=0 );
  4595   4588     assert( (pOp->p5 & OPFLAG_ISNOOP) || pC->isTable );
  4596   4589     assert( pOp->p4type==P4_TABLE || pOp->p4type>=P4_STATIC );
  4597   4590     REGISTER_TRACE(pOp->p2, pData);
  4598   4591     sqlite3VdbeIncrWriteCounter(p, pC);
  4599   4592   
  4600         -  if( pOp->opcode==OP_Insert ){
  4601         -    pKey = &aMem[pOp->p3];
  4602         -    assert( pKey->flags & MEM_Int );
  4603         -    assert( memIsValid(pKey) );
  4604         -    REGISTER_TRACE(pOp->p3, pKey);
  4605         -    x.nKey = pKey->u.i;
  4606         -  }else{
  4607         -    assert( pOp->opcode==OP_InsertInt );
  4608         -    x.nKey = pOp->p3;
  4609         -  }
         4593  +  pKey = &aMem[pOp->p3];
         4594  +  assert( pKey->flags & MEM_Int );
         4595  +  assert( memIsValid(pKey) );
         4596  +  REGISTER_TRACE(pOp->p3, pKey);
         4597  +  x.nKey = pKey->u.i;
  4610   4598   
  4611   4599     if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){
  4612   4600       assert( pC->iDb>=0 );
  4613   4601       zDb = db->aDb[pC->iDb].zDbSName;
  4614   4602       pTab = pOp->p4.pTab;
  4615   4603       assert( (pOp->p5 & OPFLAG_ISNOOP) || HasRowid(pTab) );
  4616   4604     }else{

Changes to src/wherecode.c.

   578    578       if( pIn ){
   579    579         int iMap = 0;               /* Index in aiMap[] */
   580    580         pIn += i;
   581    581         for(i=iEq;i<pLoop->nLTerm; i++){
   582    582           if( pLoop->aLTerm[i]->pExpr==pX ){
   583    583             int iOut = iReg + i - iEq;
   584    584             if( eType==IN_INDEX_ROWID ){
   585         -            testcase( nEq>1 );  /* Happens with a UNIQUE index on ROWID */
   586    585               pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);
   587    586             }else{
   588    587               int iCol = aiMap ? aiMap[iMap++] : 0;
   589    588               pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);
   590    589             }
   591    590             sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);
   592    591             if( i==iEq ){
................................................................................
  1340   1339       iReleaseReg = ++pParse->nMem;
  1341   1340       iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg);
  1342   1341       if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);
  1343   1342       addrNxt = pLevel->addrNxt;
  1344   1343       sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg);
  1345   1344       VdbeCoverage(v);
  1346   1345       pLevel->op = OP_Noop;
  1347         -    pTerm->wtFlags |= TERM_CODED;
         1346  +    if( (pTerm->prereqAll & pLevel->notReady)==0 ){
         1347  +      pTerm->wtFlags |= TERM_CODED;
         1348  +    }
  1348   1349     }else if( (pLoop->wsFlags & WHERE_IPK)!=0
  1349   1350            && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0
  1350   1351     ){
  1351   1352       /* Case 3:  We have an inequality comparison against the ROWID field.
  1352   1353       */
  1353   1354       int testOp = OP_Noop;
  1354   1355       int start;

Changes to test/fts3corrupt4.test.

  2582   2582   |   4032: 6d 65 72 67 65 3d 35 0d 04 02 23 6d 65 72 67 65   merge=5...#merge
  2583   2583   |   4048: 3d 31 30 30 2c 38 11 03 02 2b 69 6e 74 65 67 72   =100,8...+integr
  2584   2584   |   4064: 69 74 79 2d 63 68 65 63 6b 09 02 02 1b 72 65 62   ity-check....reb
  2585   2585   |   4080: 75 69 6c 64 0a 01 02 1d 6f 70 74 69 6d 69 7a 65   uild....optimize
  2586   2586   | end crash-f15972acf5bc1c.db
  2587   2587   }]} {}
  2588   2588   
  2589         -breakpoint
  2590   2589   do_execsql_test 17.1 {
  2591   2590     BEGIN;
  2592   2591       INSERT INTO t1(t1) SELECT x FROM t2;
  2593   2592       UPDATE t1 SET b=quote(zeroblob(200)) WHERE a MATCH 'thread*';
  2594   2593   }
  2595   2594   
  2596   2595   do_catchsql_test 17.2 {
................................................................................
  3254   3253     WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<10)
  3255   3254       INSERT INTO t1(a) SELECT randomblob(3000) FROM c;
  3256   3255   }
  3257   3256   
  3258   3257   do_execsql_test 20.2 {
  3259   3258     INSERT INTO t1(t1) VALUES('optimize');
  3260   3259   } 
         3260  +
         3261  +#-------------------------------------------------------------------------
         3262  +reset_db
         3263  +do_test 21.0 {
         3264  +  sqlite3 db {}
         3265  +  db deserialize [decode_hexdb {
         3266  +| size 28672 pagesize 4096 filename crash-18cc014e42e828.db
         3267  +| page 1 offset 0
         3268  +|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
         3269  +|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 07   .....@  ........
         3270  +|     32: 00 00 00 02 00 00 00 01 00 00 00 07 00 00 00 04   ................
         3271  +|     96: 00 00 00 00 0d 0e b1 00 06 0d a4 00 0f 8d 0f 21   ...............!
         3272  +|    112: 0e b9 0d c8 0e 7e 0d a4 00 00 00 00 00 00 00 00   .....~..........
         3273  +|   3488: 00 00 00 00 22 07 06 17 11 11 01 31 74 61 62 6c   ...........1tabl
         3274  +|   3504: 66 74 32 74 32 07 43 52 45 41 54 45 20 54 41 42   ft2t2.CREATE TAB
         3275  +|   3520: 4c 45 20 74 32 28 78 29 81 33 05 07 17 1f 1f 01   LE t2(x).3......
         3276  +|   3536: 82 35 74 61 62 6c 65 74 31 5f 73 75 67 64 69 72   .5tablet1_sugdir
         3277  +|   3552: 74 31 5f 73 65 67 64 69 72 05 43 52 45 41 54 45   t1_segdir.CREATE
         3278  +|   3568: 20 54 41 42 4c 45 20 27 74 31 5f 73 65 67 64 69    TABLE 't1_segdi
         3279  +|   3584: 72 27 28 6c 65 76 65 6c 20 49 4e 54 45 47 45 52   r'(level INTEGER
         3280  +|   3600: 2c 69 64 78 20 49 4e 54 45 47 45 52 2c 73 74 61   ,idx INTEGER,sta
         3281  +|   3616: 72 74 5f 62 6c 6f 63 6b 20 49 4e 54 46 47 45 52   rt_block INTFGER
         3282  +|   3632: 2c 6c 65 61 76 65 73 5f 65 6e 64 5f 62 6c 6f 63   ,leaves_end_bloc
         3283  +|   3648: 6b 20 49 4e 54 45 47 45 52 2c 65 6e 64 5f 62 6c   k INTEGER,end_bl
         3284  +|   3664: 6f 63 6b 20 49 4e 54 45 47 45 62 2c 72 6f 6f 74   ock INTEGEb,root
         3285  +|   3680: 20 42 4c 4f 42 2c 50 52 49 4d 41 52 59 20 4b 45    BLOB,PRIMARY KE
         3286  +|   3696: 59 28 6c 65 76 65 6c 2c 20 69 64 78 29 29 31 06   Y(level, idx))1.
         3287  +|   3712: 06 17 45 1f 01 00 69 6e 64 65 78 73 71 6c 69 74   ..E...indexsqlit
         3288  +|   3728: 65 5f 61 75 74 6f 69 6e 64 65 78 5f 74 31 5f 73   e_autoindex_t1_s
         3289  +|   3744: 65 67 64 69 72 5f 31 74 31 5f 73 65 67 64 69 72   egdir_1t1_segdir
         3290  +|   3760: 06 0f c7 00 08 00 00 00 00 66 04 07 17 23 23 01   .........f...##.
         3291  +|   3776: 81 13 74 61 62 6c 65 74 31 5f 73 65 67 6d 65 6e   ..tablet1_segmen
         3292  +|   3792: 74 73 74 31 5f 73 65 67 6d 65 6e 74 73 04 43 52   tst1_segments.CR
         3293  +|   3808: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 73   EATE TABLE 't1_s
         3294  +|   3824: 65 67 6d 65 6e 74 73 27 28 62 6c 6f 63 6b 69 64   egments'(blockid
         3295  +|   3840: 20 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59    INTEGER PRIMARY
         3296  +|   3856: 20 4b 45 59 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42    KEY, block BLOB
         3297  +|   3872: 29 6a 03 07 17 21 21 01 81 1f 74 61 62 6c 65 74   )j...!!...tablet
         3298  +|   3888: 31 5f 63 6f 6e 74 65 6e 74 74 31 5f 63 6f 6e 74   1_contentt1_cont
         3299  +|   3904: 65 6e 74 03 43 52 45 41 54 45 20 54 41 42 4c 45   ent.CREATE TABLE
         3300  +|   3920: 20 27 74 31 5f 63 6f 6e 74 65 6e 74 27 28 64 6f    't1_content'(do
         3301  +|   3936: 63 69 64 20 49 4e 54 45 47 45 52 20 50 52 49 4d   cid INTEGER PRIM
         3302  +|   3952: 41 52 59 20 4b 45 59 2c 20 27 63 30 61 27 2c 20   ARY KEY, 'c0a', 
         3303  +|   3968: 27 63 31 62 27 2c 20 27 63 32 63 27 29 38 02 06   'c1b', 'c2c')8..
         3304  +|   3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52   ...._tablet1t1CR
         3305  +|   4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42   EATE VIRTUAL TAB
         3306  +|   4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 33   LE t1 USING fts3
         3307  +|   4032: 28 61 2c 62 2c 63 29 00 00 00 00 00 00 00 00 00   (a,b,c).........
         3308  +| page 3 offset 8192
         3309  +|      0: 0d 00 00 00 25 0b 48 00 0f d8 0f af 0f 86 0f 74   ....%.H........t
         3310  +|     16: 0f 61 0f 4e 0f 2f 0f 0f 0e ef 0e d7 0e be 0e a5   .a.N./..........
         3311  +|     32: 0e 8d 0e 74 0e 5b 0e 40 0e 24 0e 08 0d ef 0d d5   ...t.[.@.$......
         3312  +|     48: 0d bb 0d a0 0d 84 0d 68 0d 4e 0d 35 0d 1b 0c fb   .......h.N.5....
         3313  +|     64: 0c da 0c b9 0c 99 0c 78 0c 57 0c 3e 0c 24 00 00   .......x.W.>.$..
         3314  +|   2880: 00 00 00 00 00 00 00 00 81 3f 25 06 00 82 7f 00   .........?%.....
         3315  +|   2896: 00 43 4f 4d 50 49 4c 45 52 3d 67 63 63 2d 35 2e   .COMPILER=gcc-5.
         3316  +|   2912: 34 23 00 20 32 30 31 36 30 36 30 39 20 44 45 42   4#. 20160609 DEB
         3317  +|   2928: 55 47 20 45 4e 41 42 4c 45 20 44 42 53 54 41 54   UG ENABLE DBSTAT
         3318  +|   2944: 20 56 54 41 42 20 45 4e 41 42 4c 45 20 46 43 53    VTAB ENABLE FCS
         3319  +|   2960: 34 20 45 4e 41 42 4c 45 20 46 54 53 35 20 45 4e   4 ENABLE FTS5 EN
         3320  +|   2976: 41 42 4c 45 20 47 45 4f 50 4f 4c 59 20 45 4e 41   ABLE GEOPOLY ENA
         3321  +|   2992: 42 4c 45 20 4a 53 4f 4e 31 20 45 4e 41 42 4c 45   BLE JSON1 ENABLE
         3322  +|   3008: 20 4d 45 4d 53 59 53 35 20 45 4e 41 42 4c 45 20    MEMSYS5 ENABLE 
         3323  +|   3024: 52 54 52 45 45 20 4d 41 58 20 4d 45 4d 4f 52 59   RTREE MAX MEMORY
         3324  +|   3040: 3d 35 30 30 30 30 30 30 30 20 4f 4d 49 54 20 4c   =50000000 OMIT L
         3325  +|   3056: 4f 41 44 20 45 58 54 45 4e 53 49 4f 4e 20 54 48   OAD EXTENSION TH
         3326  +|   3072: 52 45 41 44 53 41 46 45 3d 30 18 24 05 00 25 0f   READSAFE=0.$..%.
         3327  +|   3088: 19 54 48 52 45 41 44 53 41 46 45 3d 30 58 42 49   .THREADSAFE=0XBI
         3328  +|   3104: 4e 41 52 59 18 23 05 00 25 0f 19 54 48 52 45 41   NARY.#..%..THREA
         3329  +|   3120: 44 53 41 46 45 3d 30 58 4e 4f 43 41 53 45 17 22   DSAFE=0XNOCASE..
         3330  +|   3136: 05 00 25 0f 17 54 48 52 45 41 44 53 41 46 45 3d   ..%..THREADSAFE=
         3331  +|   3152: 30 58 52 54 52 49 4d 20 21 05 00 33 0f 19 4f 4d   0XRTRIM !..3..OM
         3332  +|   3168: 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 49 4f   IT LOAD EXTENSIO
         3333  +|   3184: 4e 58 42 49 4e 41 52 59 1f 20 05 00 33 0f 19 4f   NXBINARY. ..3..O
         3334  +|   3200: 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 49   MIT LOAD EXTENSI
         3335  +|   3216: 4f 4e 58 4e 4f 43 41 53 45 1e 1f 05 00 33 0f 17   ONXNOCASE....3..
         3336  +|   3232: 4f 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53   OMIT LOAD EXTENS
         3337  +|   3248: 49 4f 4e 58 52 54 52 49 4d 1f 1e 05 00 33 0f 19   IONXRTRIM....3..
         3338  +|   3264: 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30 30   MAX MEMORY=50000
         3339  +|   3280: 30 30 30 58 42 49 4e 41 52 59 1f 1d 05 00 33 0f   000XBINARY....3.
         3340  +|   3296: 19 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30   .MAX MEMORY=5000
         3341  +|   3312: 30 30 30 30 58 4e 4f 43 41 53 45 1e 1c 05 00 33   0000XNOCASE....3
         3342  +|   3328: 0f 17 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30   ..MAX MEMORY=500
         3343  +|   3344: 30 30 30 30 30 58 52 54 52 49 4d 18 1b 05 00 25   00000XRTRIM....%
         3344  +|   3360: 0f 19 45 4e 41 42 4c 45 20 52 54 52 45 45 58 42   ..ENABLE RTREEXB
         3345  +|   3376: 49 4e 41 52 59 18 1a 05 00 25 0f 19 45 4e 41 42   INARY....%..ENAB
         3346  +|   3392: 4c 45 20 52 54 52 45 45 58 4e 4f 43 41 53 45 17   LE RTREEXNOCASE.
         3347  +|   3408: 19 05 00 25 0f 17 45 4e 41 42 4c 45 20 52 54 52   ...%..ENABLE RTR
         3348  +|   3424: 45 45 58 52 54 52 49 4d 1a 18 05 00 29 0f 19 45   EEXRTRIM....)..E
         3349  +|   3440: 4e 41 42 4c 45 20 4d 45 4d 53 59 53 35 58 42 49   NABLE MEMSYS5XBI
         3350  +|   3456: 4e 41 52 59 1a 17 05 00 29 0f 19 45 4e 41 42 4c   NARY....)..ENABL
         3351  +|   3472: 45 20 4d 45 4d 53 59 53 35 58 4e 4f 43 41 53 45   E MEMSYS5XNOCASE
         3352  +|   3488: 19 16 05 00 29 0f 17 45 4e 41 42 4c 45 20 4d 45   ....)..ENABLE ME
         3353  +|   3504: 4d 53 59 53 35 58 52 54 52 49 4d 18 15 05 00 25   MSYS5XRTRIM....%
         3354  +|   3520: 0f 19 45 4e 41 42 4c 45 20 4a 53 4f 4e 31 58 42   ..ENABLE JSON1XB
         3355  +|   3536: 49 4e 41 52 59 18 14 05 00 25 0f 19 45 4e 41 42   INARY....%..ENAB
         3356  +|   3552: 4c 45 20 4a 53 4f 4e 31 58 4e 4f 43 41 53 45 17   LE JSON1XNOCASE.
         3357  +|   3568: 13 05 00 25 0f 17 45 4e 41 42 4c 45 20 4a 53 4f   ...%..ENABLE JSO
         3358  +|   3584: 4e 31 58 52 54 52 49 4d 1a 12 05 00 29 0f 19 45   N1XRTRIM....)..E
         3359  +|   3600: 4e 41 42 4c 45 20 47 45 4f 50 4f 4c 59 58 42 39   NABLE GEOPOLYXB9
         3360  +|   3616: 4e 41 52 59 1a 11 05 00 29 0f 19 45 4e 41 1e 4c   NARY....)..ENA.L
         3361  +|   3632: 45 20 47 45 4f 50 4f 4c 59 58 4e 4f 43 41 53 45   E GEOPOLYXNOCASE
         3362  +|   3648: 19 10 05 00 29 0f 17 45 4e 41 42 4c 45 20 47 45   ....)..ENABLE GE
         3363  +|   3664: 4f 50 4f 4c 59 58 52 54 52 49 4d 17 0f 05 00 23   OPOLYXRTRIM....#
         3364  +|   3680: 0f 19 45 4e 41 42 4c 45 20 46 54 53 35 58 42 49   ..ENABLE FTS5XBI
         3365  +|   3696: 4e 41 52 59 17 0e 05 00 23 0f 19 45 4e 41 42 4c   NARY....#..ENABL
         3366  +|   3712: 45 20 46 54 53 35 58 4e 4f 43 41 53 45 16 0d 05   E FTS5XNOCASE...
         3367  +|   3728: 00 23 0f 16 45 4e 41 42 4c 45 20 46 54 53 35 58   .#..ENABLE FTS5X
         3368  +|   3744: 52 54 52 49 4d 17 0c 05 00 23 0f 19 45 4e 41 42   RTRIM....#..ENAB
         3369  +|   3760: 4c 45 20 46 54 53 34 58 42 48 4e 41 52 59 17 0b   LE FTS4XBHNARY..
         3370  +|   3776: 05 00 23 0e 19 45 4e 41 42 4c 45 20 46 54 53 35   ..#..ENABLE FTS5
         3371  +|   3792: 58 4e 4f 43 40 53 45 16 0a 05 00 23 0f 17 45 4e   XNOC@SE....#..EN
         3372  +|   3808: 41 42 4c 45 20 46 54 53 34 58 52 2e 52 49 4d 1e   ABLE FTS4XR.RIM.
         3373  +|   3824: 09 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         3374  +|   3840: 54 41 54 20 56 54 41 42 58 42 49 4e 41 52 59 1e   TAT VTABXBINARY.
         3375  +|   3856: 08 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         3376  +|   3872: 54 41 54 20 56 54 41 42 58 4e 4f 43 41 53 45 1d   TAT VTABXNOCASE.
         3377  +|   3888: 07 05 00 31 0f 17 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         3378  +|   3904: 54 41 54 20 56 54 41 42 58 52 54 52 49 4d 11 06   TAT VTABXRTRIM..
         3379  +|   3920: 05 00 17 0f 19 44 45 42 55 47 58 42 49 4e 41 52   .....DEBUGXBINAR
         3380  +|   3936: 59 11 05 05 00 17 0f 19 44 45 42 55 47 58 4e 4f   Y.......DEBUGXNO
         3381  +|   3952: 43 41 53 45 10 04 05 00 17 0f 17 44 45 42 55 47   CASE.......DEBUG
         3382  +|   3968: 58 52 54 52 49 4d 27 03 05 00 43 0f 19 43 4f 4d   XRTRIM'...C..COM
         3383  +|   3984: 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e 30 20   PILER=gcc-5.4.0 
         3384  +|   4000: 32 30 31 36 30 36 30 39 58 42 49 da 41 52 59 27   20160609XBI.ARY'
         3385  +|   4016: 02 05 00 43 0f 19 43 4f 4d 50 49 4c 45 52 3d 67   ...C..COMPILER=g
         3386  +|   4032: 63 63 2d 35 2e 34 2e 30 20 32 30 31 36 30 36 30   cc-5.4.0 2016060
         3387  +|   4048: 39 58 4e 4f 43 41 53 45 26 01 05 00 43 0f 17 43   9XNOCASE&...C..C
         3388  +|   4064: 4f 4d 50 49 4c 45 52 3d 67 63 63 2d 00 00 00 00   OMPILER=gcc-....
         3389  +| page 5 offset 16384
         3390  +|      0: 0d 00 00 00 02 0b a0 00 0c ad 0b a0 00 00 00 00   ................
         3391  +|   2976: 82 0a 02 08 08 09 08 08 17 84 06 30 20 32 35 33   ...........0 253
         3392  +|   2992: 00 01 30 04 25 06 1b 00 00 08 32 30 31 36 30 36   ..0.%.....201606
         3393  +|   3008: 30 3a 03 25 07 00 00 01 34 03 25 05 00 00 01 35   0:.%....4.%....5
         3394  +|   3024: 03 25 04 00 01 07 30 30 30 30 30 30 30 03 25 1a   .%....0000000.%.
         3395  +|   3040: 00 00 08 63 6f 6d 70 69 6c 65 72 03 25 02 00 00   ...compiler.%...
         3396  +|   3056: 06 64 62 73 74 61 74 03 25 0a 00 01 04 65 62 75   .dbstat.%....ebu
         3397  +|   3072: 67 03 25 08 00 00 06 65 6e 61 62 6c 65 09 25 09   g.%....enable.%.
         3398  +|   3088: 05 04 04 04 04 04 00 01 08 78 74 65 6e 73 69 6f   .........xtensio
         3399  +|   3104: 6e 03 25 1d 00 00 04 66 74 73 34 03 25 0d 00 03   n.%....fts4.%...
         3400  +|   3120: 01 35 03 25 0f 00 00 03 57 63 63 03 25 03 00 01   .5.%....Wcc.%...
         3401  +|   3136: 06 65 6f 70 6f 6c 79 03 25 11 00 00 05 6a 73 6f   .eopoly.%....jso
         3402  +|   3152: 6e 31 03 25 13 00 00 04 6c 6f 61 64 03 25 1c 00   n1.%....load.%..
         3403  +|   3168: 00 03 6d 61 78 03 25 18 00 01 05 65 6d 6f 72 79   ..max.%....emory
         3404  +|   3184: 03 25 19 00 03 04 73 79 73 35 03 25 15 00 00 04   .%....sys5.%....
         3405  +|   3200: 6f 6d 69 74 03 25 1b 00 00 05 72 74 72 65 65 03   omit.%....rtree.
         3406  +|   3216: 25 17 00 00 0a 74 68 72 65 64 64 73 61 66 65 03   %....threddsafe.
         3407  +|   3232: 25 1e 00 00 04 76 74 61 62 03 25 0b 00 86 50 01   %....vtab.%...P.
         3408  +|   3248: 08 08 08 08 08 17 8d 12 30 20 38 33 35 00 01 30   ........0 835..0
         3409  +|   3264: 12 01 06 00 01 06 00 01 06 00 1f 03 00 01 03 00   ................
         3410  +|   3280: 01 03 00 00 08 32 30 31 36 30 36 30 39 09 01 07   .....20160609...
         3411  +|   3296: 00 01 07 00 01 07 00 00 01 34 09 01 05 00 01 05   .........4......
         3412  +|   3312: 00 01 05 00 00 01 35 09 01 04 00 01 04 00 01 04   ......5.........
         3413  +|   3328: 00 01 07 30 30 30 30 30 30 30 09 1c 04 00 01 04   ...0000000......
         3414  +|   3344: 00 01 04 00 00 06 62 69 6e 61 72 79 3c 03 01 02   ......binary<...
         3415  +|   3360: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02   ................
         3416  +|   3376: 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00   ................
         3417  +|   3392: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03   ................
         3418  +|   3408: 01 02 02 00 03 01 02 02 00 00 08 63 6f 6d 70 69   ...........compi
         3419  +|   3424: 6c 65 72 09 01 02 00 01 02 00 01 02 00 00 06 64   ler............d
         3420  +|   3440: 62 73 74 61 74 09 07 03 00 01 03 00 01 03 00 01   bstat...........
         3421  +|   3456: 04 65 62 75 67 09 04 02 00 01 02 00 01 02 00 00   .ebug...........
         3422  +|   3472: 06 65 6e 61 62 6c 65 3f 07 02 00 01 02 00 01 12   .enable?........
         3423  +|   3488: 00 01 02 00 01 02 00 01 02 00 01 02 0e 97 02 00   ................
         3424  +|   3504: 01 02 00 01 cb 00 01 02 00 01 02 00 01 02 10 01   ................
         3425  +|   3520: 02 00 01 02 00 01 02 01 01 02 00 01 02 00 01 02   ................
         3426  +|   3536: 00 01 02 00 01 02 00 01 08 78 74 65 6e 73 69 6f   .........xtensio
         3427  +|   3552: 6e 09 1f 04 00 01 04 00 01 04 00 00 04 66 74 73   n............fts
         3428  +|   3568: 34 09 0a 03 00 01 03 00 01 03 00 03 01 35 09 0d   4............5..
         3429  +|   3584: 03 00 01 03 00 01 03 00 00 03 67 63 63 09 01 03   ..........gcc...
         3430  +|   3600: 00 01 03 00 01 03 00 01 06 65 6f 70 6f 6c 79 09   .........eopoly.
         3431  +|   3616: 10 03 00 01 03 00 01 03 00 00 05 6a 73 6f 6e 31   ...........json1
         3432  +|   3632: 09 13 03 00 01 03 00 01 03 00 00 04 6c 6f 61 64   ............load
         3433  +|   3648: 09 1f 03 00 01 03 00 01 03 00 00 03 6d 61 78 09   ............max.
         3434  +|   3664: 1c 02 00 01 02 00 01 02 00 01 05 65 6d 6f 72 79   ...........emory
         3435  +|   3680: 09 1c 03 00 01 03 00 01 03 00 03 04 73 79 73 35   ............sys5
         3436  +|   3696: 09 16 03 00 01 03 00 01 03 00 00 06 6e 6f 63 61   ............noca
         3437  +|   3712: 73 65 3c 02 01 02 02 00 03 01 02 02 00 03 01 02   se<.............
         3438  +|   3728: 02 00 03 01 02 02 00 03 01 02 02 00 ab 01 02 02   ................
         3439  +|   3744: 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00   ................
         3440  +|   3760: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 00   ................
         3441  +|   3776: 04 6f 6d 69 74 09 1f 12 00 01 02 00 01 02 00 00   .omit...........
         3442  +|   3792: 05 72 74 72 65 65 09 19 03 00 01 03 00 01 03 00   .rtree..........
         3443  +|   3808: 03 02 69 6d 3c 01 01 02 02 00 03 01 02 02 00 03   ..im<...........
         3444  +|   3824: 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01   ................
         3445  +|   3840: 02 02 00 03 01 02 01 f0 03 01 02 02 00 03 01 02   ................
         3446  +|   3856: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02   ................
         3447  +|   3872: 00 00 0a 74 68 72 65 61 64 73 61 66 65 09 22 02   ...threadsafe...
         3448  +|   3888: 00 01 02 00 02 02 00 00 04 76 74 61 62 09 07 04   .........vtab...
         3449  +|   3904: 00 01 04 00 01 04 00 00 01 78 b4 01 01 01 08 a2   .........x......
         3450  +|   3920: 00 01 01 01 02 00 01 01 01 02 00 02 01 01 02 00   ................
         3451  +|   3936: 01 01 01 01 ff f1 01 01 02 00 01 01 01 02 00 01   ................
         3452  +|   3952: 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01   ................
         3453  +|   3968: 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01   ................
         3454  +|   3984: 02 00 01 01 01 02 00 01 01 01 02 01 01 01 01 02   ................
         3455  +|   4000: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00   ................
         3456  +|   4016: 01 01 01 02 00 01 01 01 02 00 01 01 01 03 00 01   ................
         3457  +|   4032: 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01   ................
         3458  +|   4048: 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01   ................
         3459  +|   4064: 02 00 01 01 01 02 00 01 02 01 02 00 01 01 01 02   ................
         3460  +|   4080: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00   ................
         3461  +| page 6 offset 20480
         3462  +|      0: 0a 00 00 00 02 0f f5 00 0f fb 0f f5 00 00 00 00   ................
         3463  +|   4080: 00 00 00 00 00 05 04 08 09 01 02 04 04 08 08 09   ................
         3464  +| page 7 offset 24576
         3465  +|      0: 0d 00 00 00 05 0f b8 00 00 00 00 00 00 00 00 00   ................
         3466  +|   4016: 00 00 00 00 00 00 00 00 0d 05 02 23 61 75 74 6f   ...........#auto
         3467  +|   4032: 6d 65 72 67 65 3d 35 0d 04 02 23 6d 65 72 67 65   merge=5...#merge
         3468  +|   4048: 3d 31 30 30 2c 38 11 03 02 2b 69 6e 74 65 67 72   =100,8...+integr
         3469  +|   4064: 69 74 79 2d 63 68 65 63 6b 09 02 02 1b 72 65 62   ity-check....reb
         3470  +|   4080: 75 69 6c 64 0a 01 02 1d 00 00 00 00 00 00 00 00   uild............
         3471  +| end crash-18cc014e42e828.db
         3472  +}]} {}
         3473  +
         3474  +breakpoint
         3475  +do_catchsql_test 21.1 {
         3476  +  SELECT offsets(t1) FROM t1 WHERE t1 MATCH 'R*';
         3477  +} {1 {database disk image is malformed}}
  3261   3478   
  3262   3479   
  3263   3480   finish_test
  3264   3481   

Changes to test/where.test.

  1421   1421     CREATE TABLE t1(a INT);
  1422   1422     CREATE INDEX t1a ON t1(a);
  1423   1423     INSERT INTO t1(a) VALUES(NULL),(NULL),(42),(NULL),(NULL);
  1424   1424     CREATE TABLE t2(dummy INT);
  1425   1425     SELECT count(*) FROM t1 LEFT JOIN t2 ON a IS NOT NULL;
  1426   1426   } {5}
  1427   1427   
         1428  +# 20190-02-22:  A bug introduced by checkin
         1429  +# https://www.sqlite.org/src/info/fa792714ae62fa98.
         1430  +#
         1431  +do_execsql_test where-23.0 {
         1432  +  DROP TABLE IF EXISTS t1;
         1433  +  DROP TABLE IF EXISTS t2;
         1434  +  CREATE TABLE t1(a INTEGER PRIMARY KEY);
         1435  +  INSERT INTO t1(a) VALUES(1),(2),(3);
         1436  +  CREATE TABLE t2(x INTEGER PRIMARY KEY, y INT);
         1437  +  INSERT INTO t2(y) VALUES(2),(3);
         1438  +  SELECT * FROM t1, t2 WHERE a=y AND y=3;
         1439  +} {3 2 3}
  1428   1440   
  1429   1441   finish_test

Changes to test/window1.test.

   695    695     SELECT rowid, sum(a) OVER w1 FROM t7 
   696    696     WINDOW w1 AS (PARTITION BY b IN (SELECT rowid FROM t7));
   697    697   } {
   698    698     2 10
   699    699     1 101
   700    700     3 101
   701    701   }
          702  +
          703  +#-------------------------------------------------------------------------
          704  +do_execsql_test 17.0 {
          705  +  CREATE TABLE t8(a);
          706  +  INSERT INTO t8 VALUES(1), (2), (3);
          707  +}
          708  +
          709  +do_execsql_test 17.1 {
          710  +  SELECT +sum(0) OVER () ORDER BY +sum(0) OVER ();
          711  +} {0}
          712  +
          713  +do_execsql_test 17.2 {
          714  +  select +sum(a) OVER () FROM t8 ORDER BY +sum(a) OVER () DESC;
          715  +} {6 6 6}
          716  +
          717  +do_execsql_test 17.3 {
          718  +  SELECT 10+sum(a) OVER (ORDER BY a) 
          719  +  FROM t8 
          720  +  ORDER BY 10+sum(a) OVER (ORDER BY a) DESC;
          721  +} {16 13 11}
   702    722   
   703    723   
   704    724   finish_test