SQLite Android Bindings
Check-in [28c307dbdb]
Not logged in

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

Overview
Comment:Update this project to version 3.29.0.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1: 28c307dbdb397c7a3382854160727234f0550886
User & Date: dan 2019-07-10 19:39:45
Context
2019-07-10
19:39
Update this project to version 3.29.0. Leaf check-in: 28c307dbdb user: dan tags: trunk
2019-04-17
11:26
Update this project to SQLite version 3.28.0. check-in: e77aed0138 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to sqlite3/src/main/jni/sqlite/sqlite3.c.

     1      1   /******************************************************************************
     2      2   ** This file is an amalgamation of many separate C source files from SQLite
     3         -** version 3.28.0.  By combining all the individual C code files into this
            3  +** version 3.29.0.  By combining all the individual C code files into this
     4      4   ** single large file, the entire code can be compiled as a single translation
     5      5   ** unit.  This allows many compilers to do optimizations that would not be
     6      6   ** possible if the files were compiled separately.  Performance improvements
     7      7   ** of 5% or more are commonly seen when SQLite is compiled as a single
     8      8   ** translation unit.
     9      9   **
    10     10   ** This file is all you need to compile SQLite.  To use SQLite in other
................................................................................
    35     35   **
    36     36   *************************************************************************
    37     37   **
    38     38   ** This file implements routines used to report what compile-time options
    39     39   ** SQLite was built with.
    40     40   */
    41     41   
    42         -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
           42  +#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS /* IMP: R-16824-07538 */
    43     43   
    44     44   /*
    45     45   ** Include the configuration header output by 'configure' if we're using the
    46     46   ** autoconf-based build
    47     47   */
    48     48   #if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H)
    49     49   #include "config.h"
................................................................................
   884    884   #pragma warning(disable : 4244)
   885    885   #pragma warning(disable : 4305)
   886    886   #pragma warning(disable : 4306)
   887    887   #pragma warning(disable : 4702)
   888    888   #pragma warning(disable : 4706)
   889    889   #endif /* defined(_MSC_VER) */
   890    890   
          891  +#if defined(_MSC_VER) && !defined(_WIN64)
          892  +#undef SQLITE_4_BYTE_ALIGNED_MALLOC
          893  +#define SQLITE_4_BYTE_ALIGNED_MALLOC
          894  +#endif /* defined(_MSC_VER) && !defined(_WIN64) */
          895  +
   891    896   #endif /* SQLITE_MSVC_H */
   892    897   
   893    898   /************** End of msvc.h ************************************************/
   894    899   /************** Continuing where we left off in sqliteInt.h ******************/
   895    900   
   896    901   /*
   897    902   ** Special setup for VxWorks
................................................................................
  1158   1163   ** been edited in any way since it was last checked in, then the last
  1159   1164   ** four hexadecimal digits of the hash may be modified.
  1160   1165   **
  1161   1166   ** See also: [sqlite3_libversion()],
  1162   1167   ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
  1163   1168   ** [sqlite_version()] and [sqlite_source_id()].
  1164   1169   */
  1165         -#define SQLITE_VERSION        "3.28.0"
  1166         -#define SQLITE_VERSION_NUMBER 3028000
  1167         -#define SQLITE_SOURCE_ID      "2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f83156b50"
         1170  +#define SQLITE_VERSION        "3.29.0"
         1171  +#define SQLITE_VERSION_NUMBER 3029000
         1172  +#define SQLITE_SOURCE_ID      "2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6"
  1168   1173   
  1169   1174   /*
  1170   1175   ** CAPI3REF: Run-Time Library Version Numbers
  1171   1176   ** KEYWORDS: sqlite3_version sqlite3_sourceid
  1172   1177   **
  1173   1178   ** These interfaces provide the same information as the [SQLITE_VERSION],
  1174   1179   ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
  2331   2336   ** element will be valid after xOpen returns regardless of the success
  2332   2337   ** or failure of the xOpen call.
  2333   2338   **
  2334   2339   ** [[sqlite3_vfs.xAccess]]
  2335   2340   ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
  2336   2341   ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
  2337   2342   ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
  2338         -** to test whether a file is at least readable.   The file can be a
  2339         -** directory.
         2343  +** to test whether a file is at least readable.  The SQLITE_ACCESS_READ
         2344  +** flag is never actually used and is not implemented in the built-in
         2345  +** VFSes of SQLite.  The file is named by the second argument and can be a
         2346  +** directory. The xAccess method returns [SQLITE_OK] on success or some
         2347  +** non-zero error code if there is an I/O error or if the name of
         2348  +** the file given in the second argument is illegal.  If SQLITE_OK
         2349  +** is returned, then non-zero or zero is written into *pResOut to indicate
         2350  +** whether or not the file is accessible.  
  2340   2351   **
  2341   2352   ** ^SQLite will always allocate at least mxPathname+1 bytes for the
  2342   2353   ** output buffer xFullPathname.  The exact size of the output buffer
  2343   2354   ** is also passed as a parameter to both  methods. If the output buffer
  2344   2355   ** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
  2345   2356   ** handled as a fatal error by SQLite, vfs implementations should endeavor
  2346   2357   ** to prevent this by setting mxPathname to a sufficiently large value.
................................................................................
  3233   3244   ** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the
  3234   3245   ** "defensive" flag for a database connection.  When the defensive
  3235   3246   ** flag is enabled, language features that allow ordinary SQL to 
  3236   3247   ** deliberately corrupt the database file are disabled.  The disabled
  3237   3248   ** features include but are not limited to the following:
  3238   3249   ** <ul>
  3239   3250   ** <li> The [PRAGMA writable_schema=ON] statement.
         3251  +** <li> The [PRAGMA journal_mode=OFF] statement.
  3240   3252   ** <li> Writes to the [sqlite_dbpage] virtual table.
  3241   3253   ** <li> Direct writes to [shadow tables].
  3242   3254   ** </ul>
  3243   3255   ** </dd>
  3244   3256   **
  3245   3257   ** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt>
  3246   3258   ** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the
................................................................................
  3248   3260   ** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF].
  3249   3261   ** The first argument to this setting is an integer which is 0 to disable 
  3250   3262   ** the writable_schema, positive to enable writable_schema, or negative to
  3251   3263   ** leave the setting unchanged. The second parameter is a pointer to an
  3252   3264   ** integer into which is written 0 or 1 to indicate whether the writable_schema
  3253   3265   ** is enabled or disabled following this call.
  3254   3266   ** </dd>
         3267  +**
         3268  +** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
         3269  +** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt>
         3270  +** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
         3271  +** the legacy behavior of the [ALTER TABLE RENAME] command such it
         3272  +** behaves as it did prior to [version 3.24.0] (2018-06-04).  See the
         3273  +** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for
         3274  +** additional information. This feature can also be turned on and off
         3275  +** using the [PRAGMA legacy_alter_table] statement.
         3276  +** </dd>
         3277  +**
         3278  +** [[SQLITE_DBCONFIG_DQS_DML]]
         3279  +** <dt>SQLITE_DBCONFIG_DQS_DML</td>
         3280  +** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
         3281  +** the legacy [double-quoted string literal] misfeature for DML statement
         3282  +** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
         3283  +** default value of this setting is determined by the [-DSQLITE_DQS]
         3284  +** compile-time option.
         3285  +** </dd>
         3286  +**
         3287  +** [[SQLITE_DBCONFIG_DQS_DDL]]
         3288  +** <dt>SQLITE_DBCONFIG_DQS_DDL</td>
         3289  +** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates
         3290  +** the legacy [double-quoted string literal] misfeature for DDL statements,
         3291  +** such as CREATE TABLE and CREATE INDEX. The
         3292  +** default value of this setting is determined by the [-DSQLITE_DQS]
         3293  +** compile-time option.
         3294  +** </dd>
  3255   3295   ** </dl>
  3256   3296   */
  3257   3297   #define SQLITE_DBCONFIG_MAINDBNAME            1000 /* const char* */
  3258   3298   #define SQLITE_DBCONFIG_LOOKASIDE             1001 /* void* int int */
  3259   3299   #define SQLITE_DBCONFIG_ENABLE_FKEY           1002 /* int int* */
  3260   3300   #define SQLITE_DBCONFIG_ENABLE_TRIGGER        1003 /* int int* */
  3261   3301   #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
................................................................................
  3262   3302   #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
  3263   3303   #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE      1006 /* int int* */
  3264   3304   #define SQLITE_DBCONFIG_ENABLE_QPSG           1007 /* int int* */
  3265   3305   #define SQLITE_DBCONFIG_TRIGGER_EQP           1008 /* int int* */
  3266   3306   #define SQLITE_DBCONFIG_RESET_DATABASE        1009 /* int int* */
  3267   3307   #define SQLITE_DBCONFIG_DEFENSIVE             1010 /* int int* */
  3268   3308   #define SQLITE_DBCONFIG_WRITABLE_SCHEMA       1011 /* int int* */
  3269         -#define SQLITE_DBCONFIG_MAX                   1011 /* Largest DBCONFIG */
         3309  +#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE    1012 /* int int* */
         3310  +#define SQLITE_DBCONFIG_DQS_DML               1013 /* int int* */
         3311  +#define SQLITE_DBCONFIG_DQS_DDL               1014 /* int int* */
         3312  +#define SQLITE_DBCONFIG_MAX                   1014 /* Largest DBCONFIG */
  3270   3313   
  3271   3314   /*
  3272   3315   ** CAPI3REF: Enable Or Disable Extended Result Codes
  3273   3316   ** METHOD: sqlite3
  3274   3317   **
  3275   3318   ** ^The sqlite3_extended_result_codes() routine enables or disables the
  3276   3319   ** [extended result codes] feature of SQLite. ^The extended result
................................................................................
  8354   8397   #define SQLITE_TESTCTRL_NEVER_CORRUPT           20
  8355   8398   #define SQLITE_TESTCTRL_VDBE_COVERAGE           21
  8356   8399   #define SQLITE_TESTCTRL_BYTEORDER               22
  8357   8400   #define SQLITE_TESTCTRL_ISINIT                  23
  8358   8401   #define SQLITE_TESTCTRL_SORTER_MMAP             24
  8359   8402   #define SQLITE_TESTCTRL_IMPOSTER                25
  8360   8403   #define SQLITE_TESTCTRL_PARSER_COVERAGE         26
  8361         -#define SQLITE_TESTCTRL_LAST                    26  /* Largest TESTCTRL */
         8404  +#define SQLITE_TESTCTRL_RESULT_INTREAL          27
         8405  +#define SQLITE_TESTCTRL_LAST                    27  /* Largest TESTCTRL */
  8362   8406   
  8363   8407   /*
  8364   8408   ** CAPI3REF: SQL Keyword Checking
  8365   8409   **
  8366   8410   ** These routines provide access to the set of SQL language keywords 
  8367   8411   ** recognized by SQLite.  Applications can uses these routines to determine
  8368   8412   ** whether or not a specific identifier needs to be escaped (for example,
................................................................................
 13948  13992   **
 13949  13993   ** For best performance, an attempt is made to guess at the byte-order
 13950  13994   ** using C-preprocessor macros.  If that is unsuccessful, or if
 13951  13995   ** -DSQLITE_BYTEORDER=0 is set, then byte-order is determined
 13952  13996   ** at run-time.
 13953  13997   */
 13954  13998   #ifndef SQLITE_BYTEORDER
 13955         -# if defined(i386)     || defined(__i386__)   || defined(_M_IX86) ||    \
 13956         -     defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)  ||    \
 13957         -     defined(_M_AMD64) || defined(_M_ARM)     || defined(__x86)   ||    \
 13958         -     defined(__arm__)  || defined(_M_ARM64)
        13999  +# if defined(i386)      || defined(__i386__)      || defined(_M_IX86) ||    \
        14000  +     defined(__x86_64)  || defined(__x86_64__)    || defined(_M_X64)  ||    \
        14001  +     defined(_M_AMD64)  || defined(_M_ARM)        || defined(__x86)   ||    \
        14002  +     defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
 13959  14003   #   define SQLITE_BYTEORDER    1234
 13960         -# elif defined(sparc)    || defined(__ppc__)
        14004  +# elif defined(sparc)     || defined(__ppc__) || \
        14005  +       defined(__ARMEB__) || defined(__AARCH64EB__)
 13961  14006   #   define SQLITE_BYTEORDER    4321
 13962  14007   # else
 13963  14008   #   define SQLITE_BYTEORDER 0
 13964  14009   # endif
 13965  14010   #endif
 13966  14011   #if SQLITE_BYTEORDER==4321
 13967  14012   # define SQLITE_BIGENDIAN    1
................................................................................
 16466  16511   #define SQLITE_Fts3Tokenizer  0x00400000  /* Enable fts3_tokenizer(2) */
 16467  16512   #define SQLITE_EnableQPSG     0x00800000  /* Query Planner Stability Guarantee*/
 16468  16513   #define SQLITE_TriggerEQP     0x01000000  /* Show trigger EXPLAIN QUERY PLAN */
 16469  16514   #define SQLITE_ResetDatabase  0x02000000  /* Reset the database */
 16470  16515   #define SQLITE_LegacyAlter    0x04000000  /* Legacy ALTER TABLE behaviour */
 16471  16516   #define SQLITE_NoSchemaError  0x08000000  /* Do not report schema parse errors*/
 16472  16517   #define SQLITE_Defensive      0x10000000  /* Input SQL is likely hostile */
        16518  +#define SQLITE_DqsDDL         0x20000000  /* dbl-quoted strings allowed in DDL*/
        16519  +#define SQLITE_DqsDML         0x40000000  /* dbl-quoted strings allowed in DML*/
 16473  16520   
 16474  16521   /* Flags used only if debugging */
 16475  16522   #define HI(X)  ((u64)(X)<<32)
 16476  16523   #ifdef SQLITE_DEBUG
 16477  16524   #define SQLITE_SqlTrace       HI(0x0001)  /* Debug print SQL as it executes */
 16478  16525   #define SQLITE_VdbeListing    HI(0x0002)  /* Debug listings of VDBE progs */
 16479  16526   #define SQLITE_VdbeTrace      HI(0x0004)  /* True to trace VDBE execution */
................................................................................
 17172  17219     unsigned bUnordered:1;   /* Use this index for == or IN queries only */
 17173  17220     unsigned uniqNotNull:1;  /* True if UNIQUE and NOT NULL for all columns */
 17174  17221     unsigned isResized:1;    /* True if resizeIndexObject() has been called */
 17175  17222     unsigned isCovering:1;   /* True if this is a covering index */
 17176  17223     unsigned noSkipScan:1;   /* Do not try to use skip-scan if true */
 17177  17224     unsigned hasStat1:1;     /* aiRowLogEst values come from sqlite_stat1 */
 17178  17225     unsigned bNoQuery:1;     /* Do not use this index to optimize queries */
        17226  +  unsigned bAscKeyBug:1;   /* True if the bba7b69f9849b5bf bug applies */
 17179  17227   #ifdef SQLITE_ENABLE_STAT3_OR_STAT4
 17180  17228     int nSample;             /* Number of elements in aSample[] */
 17181  17229     int nSampleCol;          /* Size of IndexSample.anEq[] and so on */
 17182  17230     tRowcnt *aAvgEq;         /* Average nEq values for keys not in aSample */
 17183  17231     IndexSample *aSample;    /* Samples of the left-most key */
 17184  17232     tRowcnt *aiRowEst;       /* Non-logarithmic stat1 data for this index */
 17185  17233     tRowcnt nRowEst0;        /* Non-logarithmic number of rows in the index */
................................................................................
 17399  17447                            ** EP_Unlikely:  134217728 times likelihood
 17400  17448                            ** TK_SELECT: 1st register of result vector */
 17401  17449     ynVar iColumn;         /* TK_COLUMN: column index.  -1 for rowid.
 17402  17450                            ** TK_VARIABLE: variable number (always >= 1).
 17403  17451                            ** TK_SELECT_COLUMN: column of the result vector */
 17404  17452     i16 iAgg;              /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
 17405  17453     i16 iRightJoinTable;   /* If EP_FromJoin, the right table of the join */
 17406         -  u8 op2;                /* TK_REGISTER: original value of Expr.op
        17454  +  u8 op2;                /* TK_REGISTER/TK_TRUTH: original value of Expr.op
 17407  17455                            ** TK_COLUMN: the value of p5 for OP_Column
 17408  17456                            ** TK_AGG_FUNCTION: nesting depth */
 17409  17457     AggInfo *pAggInfo;     /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
 17410  17458     union {
 17411  17459       Table *pTab;           /* TK_COLUMN: Table containing column. Can be NULL
 17412  17460                              ** for a column of an index on an expression */
 17413  17461       Window *pWin;          /* TK_FUNCTION: Window definition for the func */
................................................................................
 17433  17481   #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
 17434  17482   #define EP_DblQuoted 0x000040 /* token.z was originally in "..." */
 17435  17483   #define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */
 17436  17484   #define EP_Collate   0x000100 /* Tree contains a TK_COLLATE operator */
 17437  17485   #define EP_Generic   0x000200 /* Ignore COLLATE or affinity on this tree */
 17438  17486   #define EP_IntValue  0x000400 /* Integer value contained in u.iValue */
 17439  17487   #define EP_xIsSelect 0x000800 /* x.pSelect is valid (otherwise x.pList is) */
 17440         -#define EP_Skip      0x001000 /* COLLATE, AS, or UNLIKELY */
        17488  +#define EP_Skip      0x001000 /* Operator does not contribute to affinity */
 17441  17489   #define EP_Reduced   0x002000 /* Expr struct EXPR_REDUCEDSIZE bytes only */
 17442  17490   #define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */
 17443  17491   #define EP_Win       0x008000 /* Contains window functions */
 17444  17492   #define EP_MemToken  0x010000 /* Need to sqlite3DbFree() Expr.zToken */
 17445  17493   #define EP_NoReduce  0x020000 /* Cannot EXPRDUP_REDUCE this Expr */
 17446  17494   #define EP_Unlikely  0x040000 /* unlikely() or likelihood() function */
 17447  17495   #define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */
................................................................................
 17449  17497   #define EP_Subquery  0x200000 /* Tree contains a TK_SELECT operator */
 17450  17498   #define EP_Alias     0x400000 /* Is an alias for a result set column */
 17451  17499   #define EP_Leaf      0x800000 /* Expr.pLeft, .pRight, .u.pSelect all NULL */
 17452  17500   #define EP_WinFunc  0x1000000 /* TK_FUNCTION with Expr.y.pWin set */
 17453  17501   #define EP_Subrtn   0x2000000 /* Uses Expr.y.sub. TK_IN, _SELECT, or _EXISTS */
 17454  17502   #define EP_Quoted   0x4000000 /* TK_ID was originally quoted */
 17455  17503   #define EP_Static   0x8000000 /* Held in memory not obtained from malloc() */
        17504  +#define EP_IsTrue  0x10000000 /* Always has boolean value of TRUE */
        17505  +#define EP_IsFalse 0x20000000 /* Always has boolean value of FALSE */
 17456  17506   
 17457  17507   /*
 17458  17508   ** The EP_Propagate mask is a set of properties that automatically propagate
 17459  17509   ** upwards into parent nodes.
 17460  17510   */
 17461  17511   #define EP_Propagate (EP_Collate|EP_Subquery|EP_HasFunc)
 17462  17512   
................................................................................
 17464  17514   ** These macros can be used to test, set, or clear bits in the
 17465  17515   ** Expr.flags field.
 17466  17516   */
 17467  17517   #define ExprHasProperty(E,P)     (((E)->flags&(P))!=0)
 17468  17518   #define ExprHasAllProperty(E,P)  (((E)->flags&(P))==(P))
 17469  17519   #define ExprSetProperty(E,P)     (E)->flags|=(P)
 17470  17520   #define ExprClearProperty(E,P)   (E)->flags&=~(P)
        17521  +#define ExprAlwaysTrue(E)   (((E)->flags&(EP_FromJoin|EP_IsTrue))==EP_IsTrue)
        17522  +#define ExprAlwaysFalse(E)  (((E)->flags&(EP_FromJoin|EP_IsFalse))==EP_IsFalse)
 17471  17523   
 17472  17524   /* The ExprSetVVAProperty() macro is used for Verification, Validation,
 17473  17525   ** and Accreditation only.  It works like ExprSetProperty() during VVA
 17474  17526   ** processes but is a no-op for delivery.
 17475  17527   */
 17476  17528   #ifdef SQLITE_DEBUG
 17477  17529   # define ExprSetVVAProperty(E,P)  (E)->flags|=(P)
................................................................................
 17680  17732       ExprList *pEList;    /* Optional list of result-set columns */
 17681  17733       AggInfo *pAggInfo;   /* Information about aggregates at this level */
 17682  17734       Upsert *pUpsert;     /* ON CONFLICT clause information from an upsert */
 17683  17735     } uNC;
 17684  17736     NameContext *pNext;  /* Next outer name context.  NULL for outermost */
 17685  17737     int nRef;            /* Number of names resolved by this context */
 17686  17738     int nErr;            /* Number of errors encountered while resolving names */
 17687         -  u16 ncFlags;         /* Zero or more NC_* flags defined below */
        17739  +  int ncFlags;         /* Zero or more NC_* flags defined below */
 17688  17740     Select *pWinSelect;  /* SELECT statement for any window functions */
 17689  17741   };
 17690  17742   
 17691  17743   /*
 17692  17744   ** Allowed values for the NameContext, ncFlags field.
 17693  17745   **
 17694  17746   ** Value constraints (all checked via assert()):
................................................................................
 17707  17759   #define NC_UEList    0x0080  /* True if uNC.pEList is used */
 17708  17760   #define NC_UAggInfo  0x0100  /* True if uNC.pAggInfo is used */
 17709  17761   #define NC_UUpsert   0x0200  /* True if uNC.pUpsert is used */
 17710  17762   #define NC_MinMaxAgg 0x1000  /* min/max aggregates seen.  See note above */
 17711  17763   #define NC_Complex   0x2000  /* True if a function or subquery seen */
 17712  17764   #define NC_AllowWin  0x4000  /* Window functions are allowed here */
 17713  17765   #define NC_HasWin    0x8000  /* One or more window functions seen */
        17766  +#define NC_IsDDL    0x10000  /* Resolving names in a CREATE statement */
 17714  17767   
 17715  17768   /*
 17716  17769   ** An instance of the following object describes a single ON CONFLICT
 17717  17770   ** clause in an upsert.
 17718  17771   **
 17719  17772   ** The pUpsertTarget field is only set if the ON CONFLICT clause includes
 17720  17773   ** conflict-target clause.  (In "ON CONFLICT(a,b)" the "(a,b)" is the
................................................................................
 18713  18766   #if defined(SQLITE_ENABLE_MULTITHREADED_CHECKS) && !defined(SQLITE_MUTEX_OMIT)
 18714  18767   SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex*);
 18715  18768   #else
 18716  18769   # define sqlite3MutexWarnOnContention(x)
 18717  18770   #endif
 18718  18771   
 18719  18772   #ifndef SQLITE_OMIT_FLOATING_POINT
        18773  +# define EXP754 (((u64)0x7ff)<<52)
        18774  +# define MAN754 ((((u64)1)<<52)-1)
        18775  +# define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0)
 18720  18776   SQLITE_PRIVATE   int sqlite3IsNaN(double);
 18721  18777   #else
        18778  +# define IsNaN(X)         0
 18722  18779   # define sqlite3IsNaN(X)  0
 18723  18780   #endif
 18724  18781   
 18725  18782   /*
 18726  18783   ** An instance of the following structure holds information about SQL
 18727  18784   ** functions arguments that are the parameters to the printf() function.
 18728  18785   */
................................................................................
 18773  18830   SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
 18774  18831   #endif
 18775  18832   SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
 18776  18833   SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
 18777  18834   SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
 18778  18835   SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
 18779  18836   SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
 18780         -SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);
        18837  +SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*);
        18838  +SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr*);
 18781  18839   SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int);
 18782  18840   SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
 18783  18841   SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*);
        18842  +SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse*, Expr*);
 18784  18843   SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
 18785  18844   SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
 18786  18845   SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int);
 18787  18846   SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int);
 18788  18847   SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*);
 18789  18848   SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*);
 18790  18849   SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList*);
................................................................................
 19085  19144   SQLITE_PRIVATE void sqlite3Detach(Parse*, Expr*);
 19086  19145   SQLITE_PRIVATE void sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*);
 19087  19146   SQLITE_PRIVATE int sqlite3FixSrcList(DbFixer*, SrcList*);
 19088  19147   SQLITE_PRIVATE int sqlite3FixSelect(DbFixer*, Select*);
 19089  19148   SQLITE_PRIVATE int sqlite3FixExpr(DbFixer*, Expr*);
 19090  19149   SQLITE_PRIVATE int sqlite3FixExprList(DbFixer*, ExprList*);
 19091  19150   SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
        19151  +SQLITE_PRIVATE int sqlite3RealSameAsInt(double,sqlite3_int64);
 19092  19152   SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
 19093  19153   SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
 19094  19154   SQLITE_PRIVATE int sqlite3Atoi(const char*);
 19095  19155   #ifndef SQLITE_OMIT_UTF16
 19096  19156   SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar);
 19097  19157   #endif
 19098  19158   SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
................................................................................
 19186  19246   
 19187  19247   SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8);
 19188  19248   SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);
 19189  19249   SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
 19190  19250                           void(*)(void*));
 19191  19251   SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*);
 19192  19252   SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
        19253  +#ifndef SQLITE_UNTESTABLE
        19254  +SQLITE_PRIVATE void sqlite3ResultIntReal(sqlite3_context*);
        19255  +#endif
 19193  19256   SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
 19194  19257   #ifndef SQLITE_OMIT_UTF16
 19195  19258   SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
 19196  19259   #endif
 19197  19260   SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
 19198  19261   SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
 19199  19262   #ifndef SQLITE_AMALGAMATION
................................................................................
 19748  19811   # endif
 19749  19812   #endif
 19750  19813   
 19751  19814   /* EVIDENCE-OF: R-38720-18127 The default setting is determined by the
 19752  19815   ** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if
 19753  19816   ** that compile-time option is omitted.
 19754  19817   */
 19755         -#ifndef SQLITE_ALLOW_COVERING_INDEX_SCAN
        19818  +#if !defined(SQLITE_ALLOW_COVERING_INDEX_SCAN)
 19756  19819   # define SQLITE_ALLOW_COVERING_INDEX_SCAN 1
        19820  +#else
        19821  +# if !SQLITE_ALLOW_COVERING_INDEX_SCAN 
        19822  +#   error "Compile-time disabling of covering index scan using the\
        19823  + -DSQLITE_ALLOW_COVERING_INDEX_SCAN=0 option is deprecated.\
        19824  + Contact SQLite developers if this is a problem for you, and\
        19825  + delete this #error macro to continue with your build."
        19826  +# endif
 19757  19827   #endif
 19758  19828   
 19759  19829   /* The minimum PMA size is set to this value multiplied by the database
 19760  19830   ** page size in bytes.
 19761  19831   */
 19762  19832   #ifndef SQLITE_SORTER_PMASZ
 19763  19833   # define SQLITE_SORTER_PMASZ 250
................................................................................
 20176  20246   ** flags may coexist with the MEM_Str flag.
 20177  20247   */
 20178  20248   #define MEM_Null      0x0001   /* Value is NULL (or a pointer) */
 20179  20249   #define MEM_Str       0x0002   /* Value is a string */
 20180  20250   #define MEM_Int       0x0004   /* Value is an integer */
 20181  20251   #define MEM_Real      0x0008   /* Value is a real number */
 20182  20252   #define MEM_Blob      0x0010   /* Value is a BLOB */
 20183         -#define MEM_AffMask   0x001f   /* Mask of affinity bits */
 20184         -#define MEM_FromBind  0x0020   /* Value originates from sqlite3_bind() */
 20185         -/* Available          0x0040   */
        20253  +#define MEM_IntReal   0x0020   /* MEM_Int that stringifies like MEM_Real */
        20254  +#define MEM_AffMask   0x003f   /* Mask of affinity bits */
        20255  +#define MEM_FromBind  0x0040   /* Value originates from sqlite3_bind() */
 20186  20256   #define MEM_Undefined 0x0080   /* Value is undefined */
 20187  20257   #define MEM_Cleared   0x0100   /* NULL set by OP_Null, not from data */
 20188         -#define MEM_TypeMask  0xc1df   /* Mask of type bits */
        20258  +#define MEM_TypeMask  0xc1bf   /* Mask of type bits */
 20189  20259   
 20190  20260   
 20191  20261   /* Whenever Mem contains a valid string or blob representation, one of
 20192  20262   ** the following flags must be set to determine the memory management
 20193  20263   ** policy for Mem.z.  The MEM_Term flag tells us whether or not the
 20194  20264   ** string is \000 or \u0000 terminated
 20195  20265   */
................................................................................
 21301  21371     double r;
 21302  21372     if( parseYyyyMmDd(zDate,p)==0 ){
 21303  21373       return 0;
 21304  21374     }else if( parseHhMmSs(zDate, p)==0 ){
 21305  21375       return 0;
 21306  21376     }else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){
 21307  21377       return setDateTimeToCurrent(context, p);
 21308         -  }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8) ){
        21378  +  }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8)>0 ){
 21309  21379       setRawDateNumber(p, r);
 21310  21380       return 0;
 21311  21381     }
 21312  21382     return 1;
 21313  21383   }
 21314  21384   
 21315  21385   /* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999.
................................................................................
 21635  21705         **    weekday N
 21636  21706         **
 21637  21707         ** Move the date to the same time on the next occurrence of
 21638  21708         ** weekday N where 0==Sunday, 1==Monday, and so forth.  If the
 21639  21709         ** date is already on the appropriate weekday, this is a no-op.
 21640  21710         */
 21641  21711         if( sqlite3_strnicmp(z, "weekday ", 8)==0
 21642         -               && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8)
        21712  +               && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8)>0
 21643  21713                  && (n=(int)r)==r && n>=0 && r<7 ){
 21644  21714           sqlite3_int64 Z;
 21645  21715           computeYMD_HMS(p);
 21646  21716           p->validTZ = 0;
 21647  21717           p->validJD = 0;
 21648  21718           computeJD(p);
 21649  21719           Z = ((p->iJD + 129600000)/86400000) % 7;
................................................................................
 21694  21764       case '6':
 21695  21765       case '7':
 21696  21766       case '8':
 21697  21767       case '9': {
 21698  21768         double rRounder;
 21699  21769         int i;
 21700  21770         for(n=1; z[n] && z[n]!=':' && !sqlite3Isspace(z[n]); n++){}
 21701         -      if( !sqlite3AtoF(z, &r, n, SQLITE_UTF8) ){
        21771  +      if( sqlite3AtoF(z, &r, n, SQLITE_UTF8)<=0 ){
 21702  21772           rc = 1;
 21703  21773           break;
 21704  21774         }
 21705  21775         if( z[n]==':' ){
 21706  21776           /* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the
 21707  21777           ** specified number of hours, minutes, seconds, and fractional seconds
 21708  21778           ** to the time.  The ".FFF" may be omitted.  The ":SS.FFF" may be
................................................................................
 27327  27397   
 27328  27398     /* All the rest are undocumented and are for internal use only */
 27329  27399     {  'T',  0, 0, etTOKEN,      0,  0 },
 27330  27400     {  'S',  0, 0, etSRCLIST,    0,  0 },
 27331  27401     {  'r', 10, 1, etORDINAL,    0,  0 },
 27332  27402   };
 27333  27403   
        27404  +/* Floating point constants used for rounding */
        27405  +static const double arRound[] = {
        27406  +  5.0e-01, 5.0e-02, 5.0e-03, 5.0e-04, 5.0e-05,
        27407  +  5.0e-06, 5.0e-07, 5.0e-08, 5.0e-09, 5.0e-10,
        27408  +};
        27409  +
 27334  27410   /*
 27335  27411   ** If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point
 27336  27412   ** conversions will work.
 27337  27413   */
 27338  27414   #ifndef SQLITE_OMIT_FLOATING_POINT
 27339  27415   /*
 27340  27416   ** "*val" is a double such that 0.1 <= *val < 10.0
................................................................................
 27745  27821             realvalue = -realvalue;
 27746  27822             prefix = '-';
 27747  27823           }else{
 27748  27824             prefix = flag_prefix;
 27749  27825           }
 27750  27826           if( xtype==etGENERIC && precision>0 ) precision--;
 27751  27827           testcase( precision>0xfff );
 27752         -        for(idx=precision&0xfff, rounder=0.5; idx>0; idx--, rounder*=0.1){}
 27753         -        if( xtype==etFLOAT ) realvalue += rounder;
        27828  +        idx = precision & 0xfff;
        27829  +        rounder = arRound[idx%10];
        27830  +        while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
        27831  +        if( xtype==etFLOAT ){
        27832  +          double rx = (double)realvalue;
        27833  +          sqlite3_uint64 u;
        27834  +          int ex;
        27835  +          memcpy(&u, &rx, sizeof(u));
        27836  +          ex = -1023 + (int)((u>>52)&0x7ff);
        27837  +          if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
        27838  +          realvalue += rounder;
        27839  +        }
 27754  27840           /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
 27755  27841           exp = 0;
 27756  27842           if( sqlite3IsNaN((double)realvalue) ){
 27757  27843             bufpt = "NaN";
 27758  27844             length = 3;
 27759  27845             break;
 27760  27846           }
................................................................................
 29026  29112       case TK_TRUTH: {
 29027  29113         int x;
 29028  29114         const char *azOp[] = {
 29029  29115            "IS-FALSE", "IS-TRUE", "IS-NOT-FALSE", "IS-NOT-TRUE"
 29030  29116         };
 29031  29117         assert( pExpr->op2==TK_IS || pExpr->op2==TK_ISNOT );
 29032  29118         assert( pExpr->pRight );
 29033         -      assert( pExpr->pRight->op==TK_TRUEFALSE );
        29119  +      assert( sqlite3ExprSkipCollate(pExpr->pRight)->op==TK_TRUEFALSE );
 29034  29120         x = (pExpr->op2==TK_ISNOT)*2 + sqlite3ExprTruthValue(pExpr->pRight);
 29035  29121         zUniOp = azOp[x];
 29036  29122         break;
 29037  29123       }
 29038  29124   
 29039  29125       case TK_SPAN: {
 29040  29126         sqlite3TreeViewLine(pView, "SPAN %Q", pExpr->u.zToken);
................................................................................
 30208  30294   **
 30209  30295   ** This file contains functions for allocating memory, comparing
 30210  30296   ** strings, and stuff like that.
 30211  30297   **
 30212  30298   */
 30213  30299   /* #include "sqliteInt.h" */
 30214  30300   /* #include <stdarg.h> */
 30215         -#if HAVE_ISNAN || SQLITE_HAVE_ISNAN
 30216         -# include <math.h>
 30217         -#endif
        30301  +#include <math.h>
 30218  30302   
 30219  30303   /*
 30220  30304   ** Routine needed to support the testcase() macro.
 30221  30305   */
 30222  30306   #ifdef SQLITE_COVERAGE_TEST
 30223  30307   SQLITE_PRIVATE void sqlite3Coverage(int x){
 30224  30308     static unsigned dummy = 0;
................................................................................
 30251  30335     return xCallback ? xCallback(iTest) : SQLITE_OK;
 30252  30336   }
 30253  30337   #endif
 30254  30338   
 30255  30339   #ifndef SQLITE_OMIT_FLOATING_POINT
 30256  30340   /*
 30257  30341   ** Return true if the floating point value is Not a Number (NaN).
 30258         -**
 30259         -** Use the math library isnan() function if compiled with SQLITE_HAVE_ISNAN.
 30260         -** Otherwise, we have our own implementation that works on most systems.
 30261  30342   */
 30262  30343   SQLITE_PRIVATE int sqlite3IsNaN(double x){
 30263         -  int rc;   /* The value return */
 30264         -#if !SQLITE_HAVE_ISNAN && !HAVE_ISNAN
 30265         -  /*
 30266         -  ** Systems that support the isnan() library function should probably
 30267         -  ** make use of it by compiling with -DSQLITE_HAVE_ISNAN.  But we have
 30268         -  ** found that many systems do not have a working isnan() function so
 30269         -  ** this implementation is provided as an alternative.
 30270         -  **
 30271         -  ** This NaN test sometimes fails if compiled on GCC with -ffast-math.
 30272         -  ** On the other hand, the use of -ffast-math comes with the following
 30273         -  ** warning:
 30274         -  **
 30275         -  **      This option [-ffast-math] should never be turned on by any
 30276         -  **      -O option since it can result in incorrect output for programs
 30277         -  **      which depend on an exact implementation of IEEE or ISO 
 30278         -  **      rules/specifications for math functions.
 30279         -  **
 30280         -  ** Under MSVC, this NaN test may fail if compiled with a floating-
 30281         -  ** point precision mode other than /fp:precise.  From the MSDN 
 30282         -  ** documentation:
 30283         -  **
 30284         -  **      The compiler [with /fp:precise] will properly handle comparisons 
 30285         -  **      involving NaN. For example, x != x evaluates to true if x is NaN 
 30286         -  **      ...
 30287         -  */
 30288         -#ifdef __FAST_MATH__
 30289         -# error SQLite will not work correctly with the -ffast-math option of GCC.
 30290         -#endif
 30291         -  volatile double y = x;
 30292         -  volatile double z = y;
 30293         -  rc = (y!=z);
 30294         -#else  /* if HAVE_ISNAN */
 30295         -  rc = isnan(x);
 30296         -#endif /* HAVE_ISNAN */
 30297         -  testcase( rc );
 30298         -  return rc;
        30344  +  u64 y;
        30345  +  memcpy(&y,&x,sizeof(y));
        30346  +  return IsNaN(y);
 30299  30347   }
 30300  30348   #endif /* SQLITE_OMIT_FLOATING_POINT */
 30301  30349   
 30302  30350   /*
 30303  30351   ** Compute a string length that is limited to what can be stored in
 30304  30352   ** lower 30 bits of a 32-bit signed integer.
 30305  30353   **
................................................................................
 30513  30561     }else if( zRight==0 ){
 30514  30562       return 1;
 30515  30563     }
 30516  30564     return sqlite3StrICmp(zLeft, zRight);
 30517  30565   }
 30518  30566   SQLITE_PRIVATE int sqlite3StrICmp(const char *zLeft, const char *zRight){
 30519  30567     unsigned char *a, *b;
 30520         -  int c;
        30568  +  int c, x;
 30521  30569     a = (unsigned char *)zLeft;
 30522  30570     b = (unsigned char *)zRight;
 30523  30571     for(;;){
 30524         -    c = (int)UpperToLower[*a] - (int)UpperToLower[*b];
 30525         -    if( c || *a==0 ) break;
        30572  +    c = *a;
        30573  +    x = *b;
        30574  +    if( c==x ){
        30575  +      if( c==0 ) break;
        30576  +    }else{
        30577  +      c = (int)UpperToLower[c] - (int)UpperToLower[x];
        30578  +      if( c ) break;
        30579  +    }
 30526  30580       a++;
 30527  30581       b++;
 30528  30582     }
 30529  30583     return c;
 30530  30584   }
 30531  30585   SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
 30532  30586     register unsigned char *a, *b;
................................................................................
 30546  30600   ** E==2 results in 100.  E==50 results in 1.0e50.
 30547  30601   **
 30548  30602   ** This routine only works for values of E between 1 and 341.
 30549  30603   */
 30550  30604   static LONGDOUBLE_TYPE sqlite3Pow10(int E){
 30551  30605   #if defined(_MSC_VER)
 30552  30606     static const LONGDOUBLE_TYPE x[] = {
 30553         -    1.0e+001,
 30554         -    1.0e+002,
 30555         -    1.0e+004,
 30556         -    1.0e+008,
 30557         -    1.0e+016,
 30558         -    1.0e+032,
 30559         -    1.0e+064,
 30560         -    1.0e+128,
 30561         -    1.0e+256
        30607  +    1.0e+001L,
        30608  +    1.0e+002L,
        30609  +    1.0e+004L,
        30610  +    1.0e+008L,
        30611  +    1.0e+016L,
        30612  +    1.0e+032L,
        30613  +    1.0e+064L,
        30614  +    1.0e+128L,
        30615  +    1.0e+256L
 30562  30616     };
 30563  30617     LONGDOUBLE_TYPE r = 1.0;
 30564  30618     int i;
 30565  30619     assert( E>=0 && E<=307 );
 30566  30620     for(i=0; E!=0; i++, E >>=1){
 30567  30621       if( E & 1 ) r *= x[i];
 30568  30622     }
................................................................................
 30584  30638   ** The string z[] is an text representation of a real number.
 30585  30639   ** Convert this string to a double and write it into *pResult.
 30586  30640   **
 30587  30641   ** The string z[] is length bytes in length (bytes, not characters) and
 30588  30642   ** uses the encoding enc.  The string is not necessarily zero-terminated.
 30589  30643   **
 30590  30644   ** Return TRUE if the result is a valid real number (or integer) and FALSE
 30591         -** if the string is empty or contains extraneous text.  Valid numbers
 30592         -** are in one of these formats:
        30645  +** if the string is empty or contains extraneous text.  More specifically
        30646  +** return
        30647  +**      1          =>  The input string is a pure integer
        30648  +**      2 or more  =>  The input has a decimal point or eNNN clause
        30649  +**      0 or less  =>  The input string is not a valid number
        30650  +**     -1          =>  Not a valid number, but has a valid prefix which 
        30651  +**                     includes a decimal point and/or an eNNN clause
        30652  +**
        30653  +** Valid numbers are in one of these formats:
 30593  30654   **
 30594  30655   **    [+-]digits[E[+-]digits]
 30595  30656   **    [+-]digits.[digits][E[+-]digits]
 30596  30657   **    [+-].digits[E[+-]digits]
 30597  30658   **
 30598  30659   ** Leading and trailing whitespace is ignored for the purpose of determining
 30599  30660   ** validity.
................................................................................
 30610  30671     int sign = 1;    /* sign of significand */
 30611  30672     i64 s = 0;       /* significand */
 30612  30673     int d = 0;       /* adjust exponent for shifting decimal point */
 30613  30674     int esign = 1;   /* sign of exponent */
 30614  30675     int e = 0;       /* exponent */
 30615  30676     int eValid = 1;  /* True exponent is either not used or is well-formed */
 30616  30677     double result;
 30617         -  int nDigits = 0;
 30618         -  int nonNum = 0;  /* True if input contains UTF16 with high byte non-zero */
        30678  +  int nDigit = 0;  /* Number of digits processed */
        30679  +  int eType = 1;   /* 1: pure integer,  2+: fractional  -1 or less: bad UTF16 */
 30619  30680   
 30620  30681     assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
 30621  30682     *pResult = 0.0;   /* Default return value, in case of an error */
 30622  30683   
 30623  30684     if( enc==SQLITE_UTF8 ){
 30624  30685       incr = 1;
 30625  30686     }else{
 30626  30687       int i;
 30627  30688       incr = 2;
 30628  30689       assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
        30690  +    testcase( enc==SQLITE_UTF16LE );
        30691  +    testcase( enc==SQLITE_UTF16BE );
 30629  30692       for(i=3-enc; i<length && z[i]==0; i+=2){}
 30630         -    nonNum = i<length;
        30693  +    if( i<length ) eType = -100;
 30631  30694       zEnd = &z[i^1];
 30632  30695       z += (enc&1);
 30633  30696     }
 30634  30697   
 30635  30698     /* skip leading spaces */
 30636  30699     while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;
 30637  30700     if( z>=zEnd ) return 0;
................................................................................
 30641  30704       sign = -1;
 30642  30705       z+=incr;
 30643  30706     }else if( *z=='+' ){
 30644  30707       z+=incr;
 30645  30708     }
 30646  30709   
 30647  30710     /* copy max significant digits to significand */
 30648         -  while( z<zEnd && sqlite3Isdigit(*z) && s<((LARGEST_INT64-9)/10) ){
        30711  +  while( z<zEnd && sqlite3Isdigit(*z) ){
 30649  30712       s = s*10 + (*z - '0');
 30650         -    z+=incr; nDigits++;
        30713  +    z+=incr; nDigit++;
        30714  +    if( s>=((LARGEST_INT64-9)/10) ){
        30715  +      /* skip non-significant significand digits
        30716  +      ** (increase exponent by d to shift decimal left) */
        30717  +      while( z<zEnd && sqlite3Isdigit(*z) ){ z+=incr; d++; }
        30718  +    }
 30651  30719     }
 30652         -
 30653         -  /* skip non-significant significand digits
 30654         -  ** (increase exponent by d to shift decimal left) */
 30655         -  while( z<zEnd && sqlite3Isdigit(*z) ){ z+=incr; nDigits++; d++; }
 30656  30720     if( z>=zEnd ) goto do_atof_calc;
 30657  30721   
 30658  30722     /* if decimal point is present */
 30659  30723     if( *z=='.' ){
 30660  30724       z+=incr;
        30725  +    eType++;
 30661  30726       /* copy digits from after decimal to significand
 30662  30727       ** (decrease exponent by d to shift decimal right) */
 30663  30728       while( z<zEnd && sqlite3Isdigit(*z) ){
 30664  30729         if( s<((LARGEST_INT64-9)/10) ){
 30665  30730           s = s*10 + (*z - '0');
 30666  30731           d--;
        30732  +        nDigit++;
 30667  30733         }
 30668         -      z+=incr; nDigits++;
        30734  +      z+=incr;
 30669  30735       }
 30670  30736     }
 30671  30737     if( z>=zEnd ) goto do_atof_calc;
 30672  30738   
 30673  30739     /* if exponent is present */
 30674  30740     if( *z=='e' || *z=='E' ){
 30675  30741       z+=incr;
 30676  30742       eValid = 0;
        30743  +    eType++;
 30677  30744   
 30678  30745       /* This branch is needed to avoid a (harmless) buffer overread.  The 
 30679  30746       ** special comment alerts the mutation tester that the correct answer
 30680  30747       ** is obtained even if the branch is omitted */
 30681  30748       if( z>=zEnd ) goto do_atof_calc;              /*PREVENTS-HARMLESS-OVERREAD*/
 30682  30749   
 30683  30750       /* get sign of exponent */
................................................................................
 30768  30835       }
 30769  30836     }
 30770  30837   
 30771  30838     /* store the result */
 30772  30839     *pResult = result;
 30773  30840   
 30774  30841     /* return true if number and no extra non-whitespace chracters after */
 30775         -  return z==zEnd && nDigits>0 && eValid && nonNum==0;
        30842  +  if( z==zEnd && nDigit>0 && eValid && eType>0 ){
        30843  +    return eType;
        30844  +  }else if( eType>=2 && (eType==3 || eValid) && nDigit>0 ){
        30845  +    return -1;
        30846  +  }else{
        30847  +    return 0;
        30848  +  }
 30776  30849   #else
 30777  30850     return !sqlite3Atoi64(z, pResult, length, enc);
 30778  30851   #endif /* SQLITE_OMIT_FLOATING_POINT */
 30779  30852   }
 30780  30853   
 30781  30854   /*
 30782  30855   ** Compare the 19-character string zNum against the text representation
................................................................................
 30811  30884   
 30812  30885   /*
 30813  30886   ** Convert zNum to a 64-bit signed integer.  zNum must be decimal. This
 30814  30887   ** routine does *not* accept hexadecimal notation.
 30815  30888   **
 30816  30889   ** Returns:
 30817  30890   **
        30891  +**    -1    Not even a prefix of the input text looks like an integer
 30818  30892   **     0    Successful transformation.  Fits in a 64-bit signed integer.
 30819  30893   **     1    Excess non-space text after the integer value
 30820  30894   **     2    Integer too large for a 64-bit signed integer or is malformed
 30821  30895   **     3    Special case of 9223372036854775808
 30822  30896   **
 30823  30897   ** length is the number of bytes in the string (bytes, not characters).
 30824  30898   ** The string is not necessarily zero-terminated.  The encoding is
................................................................................
 30870  30944       *pNum = neg ? SMALLEST_INT64 : LARGEST_INT64;
 30871  30945     }else if( neg ){
 30872  30946       *pNum = -(i64)u;
 30873  30947     }else{
 30874  30948       *pNum = (i64)u;
 30875  30949     }
 30876  30950     rc = 0;
 30877         -  if( (i==0 && zStart==zNum)     /* No digits */
 30878         -   || nonNum                     /* UTF16 with high-order bytes non-zero */
 30879         -  ){
        30951  +  if( i==0 && zStart==zNum ){    /* No digits */
        30952  +    rc = -1;
        30953  +  }else if( nonNum ){            /* UTF16 with high-order bytes non-zero */
 30880  30954       rc = 1;
 30881  30955     }else if( &zNum[i]<zEnd ){     /* Extra bytes at the end */
 30882  30956       int jj = i;
 30883  30957       do{
 30884  30958         if( !sqlite3Isspace(zNum[jj]) ){
 30885  30959           rc = 1;          /* Extra non-space text after the integer */
 30886  30960           break;
................................................................................
 31103  31177   /*
 31104  31178   ** Read a 64-bit variable-length integer from memory starting at p[0].
 31105  31179   ** Return the number of bytes read.  The value is stored in *v.
 31106  31180   */
 31107  31181   SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
 31108  31182     u32 a,b,s;
 31109  31183   
 31110         -  a = *p;
 31111         -  /* a: p0 (unmasked) */
 31112         -  if (!(a&0x80))
 31113         -  {
 31114         -    *v = a;
        31184  +  if( ((signed char*)p)[0]>=0 ){
        31185  +    *v = *p;
 31115  31186       return 1;
 31116  31187     }
 31117         -
 31118         -  p++;
 31119         -  b = *p;
 31120         -  /* b: p1 (unmasked) */
 31121         -  if (!(b&0x80))
 31122         -  {
 31123         -    a &= 0x7f;
 31124         -    a = a<<7;
 31125         -    a |= b;
 31126         -    *v = a;
        31188  +  if( ((signed char*)p)[1]>=0 ){
        31189  +    *v = ((u32)(p[0]&0x7f)<<7) | p[1];
 31127  31190       return 2;
 31128  31191     }
 31129  31192   
 31130  31193     /* Verify that constants are precomputed correctly */
 31131  31194     assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );
 31132  31195     assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) );
 31133  31196   
 31134         -  p++;
 31135         -  a = a<<14;
        31197  +  a = ((u32)p[0])<<14;
        31198  +  b = p[1];
        31199  +  p += 2;
 31136  31200     a |= *p;
 31137  31201     /* a: p0<<14 | p2 (unmasked) */
 31138  31202     if (!(a&0x80))
 31139  31203     {
 31140  31204       a &= SLOT_2_0;
 31141  31205       b &= 0x7f;
 31142  31206       b = b<<7;
................................................................................
 47998  48062   */
 47999  48063   static int numberOfCachePages(PCache *p){
 48000  48064     if( p->szCache>=0 ){
 48001  48065       /* IMPLEMENTATION-OF: R-42059-47211 If the argument N is positive then the
 48002  48066       ** suggested cache size is set to N. */
 48003  48067       return p->szCache;
 48004  48068     }else{
 48005         -    /* IMPLEMENTATION-OF: R-61436-13639 If the argument N is negative, then
 48006         -    ** the number of cache pages is adjusted to use approximately abs(N*1024)
 48007         -    ** bytes of memory. */
        48069  +    /* IMPLEMANTATION-OF: R-59858-46238 If the argument N is negative, then the
        48070  +    ** number of cache pages is adjusted to be a number of pages that would
        48071  +    ** use approximately abs(N*1024) bytes of memory based on the current
        48072  +    ** page size. */
 48008  48073       return (int)((-1024*(i64)p->szCache)/(p->szPage+p->szExtra));
 48009  48074     }
 48010  48075   }
 48011  48076   
 48012  48077   /*************************************************** General Interfaces ******
 48013  48078   **
 48014  48079   ** Initialize and shutdown the page cache subsystem. Neither of these 
................................................................................
 49416  49481     if( pCache ){
 49417  49482       if( pcache1.separateCache ){
 49418  49483         pGroup = (PGroup*)&pCache[1];
 49419  49484         pGroup->mxPinned = 10;
 49420  49485       }else{
 49421  49486         pGroup = &pcache1.grp;
 49422  49487       }
        49488  +    pcache1EnterMutex(pGroup);
 49423  49489       if( pGroup->lru.isAnchor==0 ){
 49424  49490         pGroup->lru.isAnchor = 1;
 49425  49491         pGroup->lru.pLruPrev = pGroup->lru.pLruNext = &pGroup->lru;
 49426  49492       }
 49427  49493       pCache->pGroup = pGroup;
 49428  49494       pCache->szPage = szPage;
 49429  49495       pCache->szExtra = szExtra;
 49430  49496       pCache->szAlloc = szPage + szExtra + ROUND8(sizeof(PgHdr1));
 49431  49497       pCache->bPurgeable = (bPurgeable ? 1 : 0);
 49432         -    pcache1EnterMutex(pGroup);
 49433  49498       pcache1ResizeHash(pCache);
 49434  49499       if( bPurgeable ){
 49435  49500         pCache->nMin = 10;
 49436  49501         pGroup->nMinPage += pCache->nMin;
 49437  49502         pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;
 49438  49503         pCache->pnPurgeable = &pGroup->nPurgeable;
 49439  49504       }else{
................................................................................
 61218  61283   
 61219  61284       rc = walHashGet(pWal, iHash, &sLoc);
 61220  61285       if( rc!=SQLITE_OK ){
 61221  61286         return rc;
 61222  61287       }
 61223  61288       nCollide = HASHTABLE_NSLOT;
 61224  61289       for(iKey=walHash(pgno); sLoc.aHash[iKey]; iKey=walNextHash(iKey)){
 61225         -      u32 iFrame = sLoc.aHash[iKey] + sLoc.iZero;
 61226         -      if( iFrame<=iLast && iFrame>=pWal->minFrame
 61227         -       && sLoc.aPgno[sLoc.aHash[iKey]]==pgno ){
        61290  +      u32 iH = sLoc.aHash[iKey];
        61291  +      u32 iFrame = iH + sLoc.iZero;
        61292  +      if( iFrame<=iLast && iFrame>=pWal->minFrame && sLoc.aPgno[iH]==pgno ){
 61228  61293           assert( iFrame>iRead || CORRUPT_DB );
 61229  61294           iRead = iFrame;
 61230  61295         }
 61231  61296         if( (nCollide--)==0 ){
 61232  61297           return SQLITE_CORRUPT_BKPT;
 61233  61298         }
 61234  61299       }
................................................................................
 64812  64877     assert( gap<=65536 );
 64813  64878     /* EVIDENCE-OF: R-29356-02391 If the database uses a 65536-byte page size
 64814  64879     ** and the reserved space is zero (the usual value for reserved space)
 64815  64880     ** then the cell content offset of an empty page wants to be 65536.
 64816  64881     ** However, that integer is too large to be stored in a 2-byte unsigned
 64817  64882     ** integer, so a value of 0 is used in its place. */
 64818  64883     top = get2byte(&data[hdr+5]);
 64819         -  assert( top<=(int)pPage->pBt->usableSize ); /* Prevent by getAndInitPage() */
        64884  +  assert( top<=(int)pPage->pBt->usableSize ); /* by btreeComputeFreeSpace() */
 64820  64885     if( gap>top ){
 64821  64886       if( top==0 && pPage->pBt->usableSize==65536 ){
 64822  64887         top = 65536;
 64823  64888       }else{
 64824  64889         return SQLITE_CORRUPT_PAGE(pPage);
 64825  64890       }
 64826  64891     }
................................................................................
 65109  65174     /* At this point, nFree contains the sum of the offset to the start
 65110  65175     ** of the cell-content area plus the number of free bytes within
 65111  65176     ** the cell-content area. If this is greater than the usable-size
 65112  65177     ** of the page, then the page must be corrupted. This check also
 65113  65178     ** serves to verify that the offset to the start of the cell-content
 65114  65179     ** area, according to the page header, lies within the page.
 65115  65180     */
 65116         -  if( nFree>usableSize ){
        65181  +  if( nFree>usableSize || nFree<iCellFirst ){
 65117  65182       return SQLITE_CORRUPT_PAGE(pPage);
 65118  65183     }
 65119  65184     pPage->nFree = (u16)(nFree - iCellFirst);
 65120  65185     return SQLITE_OK;
 65121  65186   }
 65122  65187   
 65123  65188   /*
................................................................................
 67336  67401         }
 67337  67402         btreeReleaseAllCursorPages(p);
 67338  67403       }
 67339  67404       sqlite3BtreeLeave(pBtree);
 67340  67405     }
 67341  67406     return rc;
 67342  67407   }
        67408  +
        67409  +/*
        67410  +** Set the pBt->nPage field correctly, according to the current
        67411  +** state of the database.  Assume pBt->pPage1 is valid.
        67412  +*/
        67413  +static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){
        67414  +  int nPage = get4byte(&pPage1->aData[28]);
        67415  +  testcase( nPage==0 );
        67416  +  if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);
        67417  +  testcase( pBt->nPage!=nPage );
        67418  +  pBt->nPage = nPage;
        67419  +}
 67343  67420   
 67344  67421   /*
 67345  67422   ** Rollback the transaction in progress.
 67346  67423   **
 67347  67424   ** If tripCode is not SQLITE_OK then cursors will be invalidated (tripped).
 67348  67425   ** Only write cursors are tripped if writeOnly is true but all cursors are
 67349  67426   ** tripped if writeOnly is false.  Any attempt to use
................................................................................
 67382  67459         rc = rc2;
 67383  67460       }
 67384  67461   
 67385  67462       /* The rollback may have destroyed the pPage1->aData value.  So
 67386  67463       ** call btreeGetPage() on page 1 again to make
 67387  67464       ** sure pPage1->aData is set correctly. */
 67388  67465       if( btreeGetPage(pBt, 1, &pPage1, 0)==SQLITE_OK ){
 67389         -      int nPage = get4byte(28+(u8*)pPage1->aData);
 67390         -      testcase( nPage==0 );
 67391         -      if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);
 67392         -      testcase( pBt->nPage!=nPage );
 67393         -      pBt->nPage = nPage;
        67466  +      btreeSetNPage(pBt, pPage1);
 67394  67467         releasePageOne(pPage1);
 67395  67468       }
 67396  67469       assert( countValidCursors(pBt, 1)==0 );
 67397  67470       pBt->inTransaction = TRANS_READ;
 67398  67471       btreeClearHasContent(pBt);
 67399  67472     }
 67400  67473   
................................................................................
 67466  67539         rc = sqlite3PagerSavepoint(pBt->pPager, op, iSavepoint);
 67467  67540       }
 67468  67541       if( rc==SQLITE_OK ){
 67469  67542         if( iSavepoint<0 && (pBt->btsFlags & BTS_INITIALLY_EMPTY)!=0 ){
 67470  67543           pBt->nPage = 0;
 67471  67544         }
 67472  67545         rc = newDatabase(pBt);
 67473         -      pBt->nPage = get4byte(28 + pBt->pPage1->aData);
        67546  +      btreeSetNPage(pBt, pBt->pPage1);
 67474  67547   
 67475         -      /* The database size was written into the offset 28 of the header
 67476         -      ** when the transaction started, so we know that the value at offset
 67477         -      ** 28 is nonzero. */
 67478         -      assert( pBt->nPage>0 );
        67548  +      /* pBt->nPage might be zero if the database was corrupt when 
        67549  +      ** the transaction was started. Otherwise, it must be at least 1.  */
        67550  +      assert( CORRUPT_DB || pBt->nPage>0 );
 67479  67551       }
 67480  67552       sqlite3BtreeLeave(p);
 67481  67553     }
 67482  67554     return rc;
 67483  67555   }
 67484  67556   
 67485  67557   /*
................................................................................
 68479  68551       int ii;
 68480  68552       for(ii=0; ii<pCur->iPage; ii++){
 68481  68553         assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell );
 68482  68554       }
 68483  68555       assert( pCur->ix==pCur->pPage->nCell-1 );
 68484  68556       assert( pCur->pPage->leaf );
 68485  68557   #endif
        68558  +    *pRes = 0;
 68486  68559       return SQLITE_OK;
 68487  68560     }
 68488  68561   
 68489  68562     rc = moveToRoot(pCur);
 68490  68563     if( rc==SQLITE_OK ){
 68491  68564       assert( pCur->eState==CURSOR_VALID );
 68492  68565       *pRes = 0;
................................................................................
 68700  68773             **
 68701  68774             ** If the record is corrupt, the xRecordCompare routine may read
 68702  68775             ** up to two varints past the end of the buffer. An extra 18 
 68703  68776             ** bytes of padding is allocated at the end of the buffer in
 68704  68777             ** case this happens.  */
 68705  68778             void *pCellKey;
 68706  68779             u8 * const pCellBody = pCell - pPage->childPtrSize;
        68780  +          const int nOverrun = 18;  /* Size of the overrun padding */
 68707  68781             pPage->xParseCell(pPage, pCellBody, &pCur->info);
 68708  68782             nCell = (int)pCur->info.nKey;
 68709  68783             testcase( nCell<0 );   /* True if key size is 2^32 or more */
 68710  68784             testcase( nCell==0 );  /* Invalid key size:  0x80 0x80 0x00 */
 68711  68785             testcase( nCell==1 );  /* Invalid key size:  0x80 0x80 0x01 */
 68712  68786             testcase( nCell==2 );  /* Minimum legal index key size */
 68713  68787             if( nCell<2 || nCell/pCur->pBt->usableSize>pCur->pBt->nPage ){
 68714  68788               rc = SQLITE_CORRUPT_PAGE(pPage);
 68715  68789               goto moveto_finish;
 68716  68790             }
 68717         -          pCellKey = sqlite3Malloc( nCell+18 );
        68791  +          pCellKey = sqlite3Malloc( nCell+nOverrun );
 68718  68792             if( pCellKey==0 ){
 68719  68793               rc = SQLITE_NOMEM_BKPT;
 68720  68794               goto moveto_finish;
 68721  68795             }
 68722  68796             pCur->ix = (u16)idx;
 68723  68797             rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 0);
        68798  +          memset(((u8*)pCellKey)+nCell,0,nOverrun); /* Fix uninit warnings */
 68724  68799             pCur->curFlags &= ~BTCF_ValidOvfl;
 68725  68800             if( rc ){
 68726  68801               sqlite3_free(pCellKey);
 68727  68802               goto moveto_finish;
 68728  68803             }
 68729  68804             c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey);
 68730  68805             sqlite3_free(pCellKey);
................................................................................
 70821  70896     for(i=0; i<nOld; i++){
 70822  70897       MemPage *pOld = apOld[i];
 70823  70898       int limit = pOld->nCell;
 70824  70899       u8 *aData = pOld->aData;
 70825  70900       u16 maskPage = pOld->maskPage;
 70826  70901       u8 *piCell = aData + pOld->cellOffset;
 70827  70902       u8 *piEnd;
        70903  +    VVA_ONLY( int nCellAtStart = b.nCell; )
 70828  70904   
 70829  70905       /* Verify that all sibling pages are of the same "type" (table-leaf,
 70830  70906       ** table-interior, index-leaf, or index-interior).
 70831  70907       */
 70832  70908       if( pOld->aData[0]!=apOld[0]->aData[0] ){
 70833  70909         rc = SQLITE_CORRUPT_BKPT;
 70834  70910         goto balance_cleanup;
................................................................................
 70849  70925       ** This must be done in advance.  Once the balance starts, the cell
 70850  70926       ** offset section of the btree page will be overwritten and we will no
 70851  70927       ** long be able to find the cells if a pointer to each cell is not saved
 70852  70928       ** first.
 70853  70929       */
 70854  70930       memset(&b.szCell[b.nCell], 0, sizeof(b.szCell[0])*(limit+pOld->nOverflow));
 70855  70931       if( pOld->nOverflow>0 ){
        70932  +      if( limit<pOld->aiOvfl[0] ){
        70933  +        rc = SQLITE_CORRUPT_BKPT;
        70934  +        goto balance_cleanup;
        70935  +      }
 70856  70936         limit = pOld->aiOvfl[0];
 70857  70937         for(j=0; j<limit; j++){
 70858  70938           b.apCell[b.nCell] = aData + (maskPage & get2byteAligned(piCell));
 70859  70939           piCell += 2;
 70860  70940           b.nCell++;
 70861  70941         }
 70862  70942         for(k=0; k<pOld->nOverflow; k++){
................................................................................
 70868  70948       piEnd = aData + pOld->cellOffset + 2*pOld->nCell;
 70869  70949       while( piCell<piEnd ){
 70870  70950         assert( b.nCell<nMaxCells );
 70871  70951         b.apCell[b.nCell] = aData + (maskPage & get2byteAligned(piCell));
 70872  70952         piCell += 2;
 70873  70953         b.nCell++;
 70874  70954       }
        70955  +    assert( (b.nCell-nCellAtStart)==(pOld->nCell+pOld->nOverflow) );
 70875  70956   
 70876  70957       cntOld[i] = b.nCell;
 70877  70958       if( i<nOld-1 && !leafData){
 70878  70959         u16 sz = (u16)szNew[i];
 70879  70960         u8 *pTemp;
 70880  70961         assert( b.nCell<nMaxCells );
 70881  70962         b.szCell[b.nCell] = sz;
................................................................................
 71168  71249       int iOld = 0;
 71169  71250   
 71170  71251       for(i=0; i<b.nCell; i++){
 71171  71252         u8 *pCell = b.apCell[i];
 71172  71253         while( i==cntOldNext ){
 71173  71254           iOld++;
 71174  71255           assert( iOld<nNew || iOld<nOld );
        71256  +        assert( iOld>=0 && iOld<NB );
 71175  71257           pOld = iOld<nNew ? apNew[iOld] : apOld[iOld];
 71176  71258           cntOldNext += pOld->nCell + pOld->nOverflow + !leafData;
 71177  71259         }
 71178  71260         if( i==cntNew[iNew] ){
 71179  71261           pNew = apNew[++iNew];
 71180  71262           if( !leafData ) continue;
 71181  71263         }
................................................................................
 73888  73970     ** between source and destination.  If there is a difference, try to
 73889  73971     ** fix the destination to agree with the source.  If that is not possible,
 73890  73972     ** then the backup cannot proceed.
 73891  73973     */
 73892  73974     if( nSrcReserve!=nDestReserve ){
 73893  73975       u32 newPgsz = nSrcPgsz;
 73894  73976       rc = sqlite3PagerSetPagesize(pDestPager, &newPgsz, nSrcReserve);
 73895         -    if( rc==SQLITE_OK && newPgsz!=nSrcPgsz ) rc = SQLITE_READONLY;
        73977  +    if( rc==SQLITE_OK && newPgsz!=(u32)nSrcPgsz ) rc = SQLITE_READONLY;
 73896  73978     }
 73897  73979   #endif
 73898  73980   
 73899  73981     /* This loop runs once for each destination page spanned by the source 
 73900  73982     ** page. For each iteration, variable iOff is set to the byte offset
 73901  73983     ** of the destination page.
 73902  73984     */
................................................................................
 74435  74517   ** stores a single value in the VDBE.  Mem is an opaque structure visible
 74436  74518   ** only within the VDBE.  Interface routines refer to a Mem using the
 74437  74519   ** name sqlite_value
 74438  74520   */
 74439  74521   /* #include "sqliteInt.h" */
 74440  74522   /* #include "vdbeInt.h" */
 74441  74523   
        74524  +/* True if X is a power of two.  0 is considered a power of two here.
        74525  +** In other words, return true if X has at most one bit set.
        74526  +*/
        74527  +#define ISPOWEROF2(X)  (((X)&((X)-1))==0)
        74528  +
 74442  74529   #ifdef SQLITE_DEBUG
 74443  74530   /*
 74444  74531   ** Check invariants on a Mem object.
 74445  74532   **
 74446  74533   ** This routine is intended for use inside of assert() statements, like
 74447  74534   ** this:    assert( sqlite3VdbeCheckMemInvariants(pMem) );
 74448  74535   */
................................................................................
 74454  74541   
 74455  74542     /* MEM_Dyn may only be set if Mem.szMalloc==0.  In this way we
 74456  74543     ** ensure that if Mem.szMalloc>0 then it is safe to do
 74457  74544     ** Mem.z = Mem.zMalloc without having to check Mem.flags&MEM_Dyn.
 74458  74545     ** That saves a few cycles in inner loops. */
 74459  74546     assert( (p->flags & MEM_Dyn)==0 || p->szMalloc==0 );
 74460  74547   
 74461         -  /* Cannot be both MEM_Int and MEM_Real at the same time */
 74462         -  assert( (p->flags & (MEM_Int|MEM_Real))!=(MEM_Int|MEM_Real) );
        74548  +  /* Cannot have more than one of MEM_Int, MEM_Real, or MEM_IntReal */
        74549  +  assert( ISPOWEROF2(p->flags & (MEM_Int|MEM_Real|MEM_IntReal)) );
 74463  74550   
 74464  74551     if( p->flags & MEM_Null ){
 74465  74552       /* Cannot be both MEM_Null and some other type */
 74466  74553       assert( (p->flags & (MEM_Int|MEM_Real|MEM_Str|MEM_Blob|MEM_Agg))==0 );
 74467  74554   
 74468  74555       /* If MEM_Null is set, then either the value is a pure NULL (the usual
 74469  74556       ** case) or it is a pointer set using sqlite3_bind_pointer() or
................................................................................
 74508  74595         ((p->flags&MEM_Ephem)!=0 ? 1 : 0) +
 74509  74596         ((p->flags&MEM_Static)!=0 ? 1 : 0) == 1
 74510  74597       );
 74511  74598     }
 74512  74599     return 1;
 74513  74600   }
 74514  74601   #endif
        74602  +
        74603  +/*
        74604  +** Render a Mem object which is one of MEM_Int, MEM_Real, or MEM_IntReal
        74605  +** into a buffer.
        74606  +*/
        74607  +static void vdbeMemRenderNum(int sz, char *zBuf, Mem *p){
        74608  +  StrAccum acc;
        74609  +  assert( p->flags & (MEM_Int|MEM_Real|MEM_IntReal) );
        74610  +  sqlite3StrAccumInit(&acc, 0, zBuf, sz, 0);
        74611  +  if( p->flags & MEM_Int ){
        74612  +    sqlite3_str_appendf(&acc, "%lld", p->u.i);
        74613  +  }else if( p->flags & MEM_IntReal ){
        74614  +    sqlite3_str_appendf(&acc, "%!.15g", (double)p->u.i);
        74615  +  }else{
        74616  +    sqlite3_str_appendf(&acc, "%!.15g", p->u.r);
        74617  +  }
        74618  +  assert( acc.zText==zBuf && acc.mxAlloc<=0 );
        74619  +  zBuf[acc.nChar] = 0; /* Fast version of sqlite3StrAccumFinish(&acc) */
        74620  +}
 74515  74621   
 74516  74622   #ifdef SQLITE_DEBUG
 74517  74623   /*
 74518         -** Check that string value of pMem agrees with its integer or real value.
        74624  +** Validity checks on pMem.  pMem holds a string.
        74625  +**
        74626  +** (1) Check that string value of pMem agrees with its integer or real value.
        74627  +** (2) Check that the string is correctly zero terminated
 74519  74628   **
 74520  74629   ** A single int or real value always converts to the same strings.  But
 74521  74630   ** many different strings can be converted into the same int or real.
 74522  74631   ** If a table contains a numeric value and an index is based on the
 74523  74632   ** corresponding string value, then it is important that the string be
 74524  74633   ** derived from the numeric value, not the other way around, to ensure
 74525  74634   ** that the index and table are consistent.  See ticket
................................................................................
 74529  74638   ** This routine looks at pMem to verify that if it has both a numeric
 74530  74639   ** representation and a string representation then the string rep has
 74531  74640   ** been derived from the numeric and not the other way around.  It returns
 74532  74641   ** true if everything is ok and false if there is a problem.
 74533  74642   **
 74534  74643   ** This routine is for use inside of assert() statements only.
 74535  74644   */
 74536         -SQLITE_PRIVATE int sqlite3VdbeMemConsistentDualRep(Mem *p){
        74645  +SQLITE_PRIVATE int sqlite3VdbeMemValidStrRep(Mem *p){
 74537  74646     char zBuf[100];
 74538  74647     char *z;
 74539  74648     int i, j, incr;
 74540  74649     if( (p->flags & MEM_Str)==0 ) return 1;
 74541         -  if( (p->flags & (MEM_Int|MEM_Real))==0 ) return 1;
 74542         -  if( p->flags & MEM_Int ){
 74543         -    sqlite3_snprintf(sizeof(zBuf),zBuf,"%lld",p->u.i);
 74544         -  }else{
 74545         -    sqlite3_snprintf(sizeof(zBuf),zBuf,"%!.15g",p->u.r);
        74650  +  if( p->flags & MEM_Term ){
        74651  +    /* Insure that the string is properly zero-terminated.  Pay particular
        74652  +    ** attention to the case where p->n is odd */
        74653  +    if( p->szMalloc>0 && p->z==p->zMalloc ){
        74654  +      assert( p->enc==SQLITE_UTF8 || p->szMalloc >= ((p->n+1)&~1)+2 );
        74655  +      assert( p->enc!=SQLITE_UTF8 || p->szMalloc >= p->n+1 );
        74656  +    }
        74657  +    assert( p->z[p->n]==0 );
        74658  +    assert( p->enc==SQLITE_UTF8 || p->z[(p->n+1)&~1]==0 );
        74659  +    assert( p->enc==SQLITE_UTF8 || p->z[((p->n+1)&~1)+1]==0 );
 74546  74660     }
        74661  +  if( (p->flags & (MEM_Int|MEM_Real|MEM_IntReal))==0 ) return 1;
        74662  +  vdbeMemRenderNum(sizeof(zBuf), zBuf, p);
 74547  74663     z = p->z;
 74548  74664     i = j = 0;
 74549  74665     incr = 1;
 74550  74666     if( p->enc!=SQLITE_UTF8 ){
 74551  74667       incr = 2;
 74552  74668       if( p->enc==SQLITE_UTF16BE ) z++;
 74553  74669     }
................................................................................
 74651  74767   /*
 74652  74768   ** Change the pMem->zMalloc allocation to be at least szNew bytes.
 74653  74769   ** If pMem->zMalloc already meets or exceeds the requested size, this
 74654  74770   ** routine is a no-op.
 74655  74771   **
 74656  74772   ** Any prior string or blob content in the pMem object may be discarded.
 74657  74773   ** The pMem->xDel destructor is called, if it exists.  Though MEM_Str
 74658         -** and MEM_Blob values may be discarded, MEM_Int, MEM_Real, and MEM_Null
 74659         -** values are preserved.
        74774  +** and MEM_Blob values may be discarded, MEM_Int, MEM_Real, MEM_IntReal,
        74775  +** and MEM_Null values are preserved.
 74660  74776   **
 74661  74777   ** Return SQLITE_OK on success or an error code (probably SQLITE_NOMEM)
 74662  74778   ** if unable to complete the resizing.
 74663  74779   */
 74664  74780   SQLITE_PRIVATE int sqlite3VdbeMemClearAndResize(Mem *pMem, int szNew){
 74665  74781     assert( CORRUPT_DB || szNew>0 );
 74666  74782     assert( (pMem->flags & MEM_Dyn)==0 || pMem->szMalloc==0 );
 74667  74783     if( pMem->szMalloc<szNew ){
 74668  74784       return sqlite3VdbeMemGrow(pMem, szNew, 0);
 74669  74785     }
 74670  74786     assert( (pMem->flags & MEM_Dyn)==0 );
 74671  74787     pMem->z = pMem->zMalloc;
 74672         -  pMem->flags &= (MEM_Null|MEM_Int|MEM_Real);
        74788  +  pMem->flags &= (MEM_Null|MEM_Int|MEM_Real|MEM_IntReal);
 74673  74789     return SQLITE_OK;
 74674  74790   }
 74675  74791   
 74676  74792   /*
 74677  74793   ** It is already known that pMem contains an unterminated string.
 74678  74794   ** Add the zero terminator.
        74795  +**
        74796  +** Three bytes of zero are added.  In this way, there is guaranteed
        74797  +** to be a double-zero byte at an even byte boundary in order to
        74798  +** terminate a UTF16 string, even if the initial size of the buffer
        74799  +** is an odd number of bytes.
 74679  74800   */
 74680  74801   static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){
 74681         -  if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){
        74802  +  if( sqlite3VdbeMemGrow(pMem, pMem->n+3, 1) ){
 74682  74803       return SQLITE_NOMEM_BKPT;
 74683  74804     }
 74684  74805     pMem->z[pMem->n] = 0;
 74685  74806     pMem->z[pMem->n+1] = 0;
        74807  +  pMem->z[pMem->n+2] = 0;
 74686  74808     pMem->flags |= MEM_Term;
 74687  74809     return SQLITE_OK;
 74688  74810   }
 74689  74811   
 74690  74812   /*
 74691  74813   ** Change pMem so that its MEM_Str or MEM_Blob value is stored in
 74692  74814   ** MEM.zMalloc, where it can be safely written.
................................................................................
 74752  74874       return SQLITE_OK;   /* Nothing to do */
 74753  74875     }else{
 74754  74876       return vdbeMemAddTerminator(pMem);
 74755  74877     }
 74756  74878   }
 74757  74879   
 74758  74880   /*
 74759         -** Add MEM_Str to the set of representations for the given Mem.  Numbers
 74760         -** are converted using sqlite3_snprintf().  Converting a BLOB to a string
 74761         -** is a no-op.
        74881  +** Add MEM_Str to the set of representations for the given Mem.  This
        74882  +** routine is only called if pMem is a number of some kind, not a NULL
        74883  +** or a BLOB.
 74762  74884   **
 74763         -** Existing representations MEM_Int and MEM_Real are invalidated if
 74764         -** bForce is true but are retained if bForce is false.
        74885  +** Existing representations MEM_Int, MEM_Real, or MEM_IntReal are invalidated
        74886  +** if bForce is true but are retained if bForce is false.
 74765  74887   **
 74766  74888   ** A MEM_Null value will never be passed to this function. This function is
 74767  74889   ** used for converting values to text for returning to the user (i.e. via
 74768  74890   ** sqlite3_value_text()), or for ensuring that values to be used as btree
 74769  74891   ** keys are strings. In the former case a NULL pointer is returned the
 74770  74892   ** user and the latter is an internal programming error.
 74771  74893   */
 74772  74894   SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){
 74773         -  int fg = pMem->flags;
 74774  74895     const int nByte = 32;
 74775  74896   
 74776  74897     assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
 74777         -  assert( !(fg&MEM_Zero) );
 74778         -  assert( !(fg&(MEM_Str|MEM_Blob)) );
 74779         -  assert( fg&(MEM_Int|MEM_Real) );
        74898  +  assert( !(pMem->flags&MEM_Zero) );
        74899  +  assert( !(pMem->flags&(MEM_Str|MEM_Blob)) );
        74900  +  assert( pMem->flags&(MEM_Int|MEM_Real|MEM_IntReal) );
 74780  74901     assert( !sqlite3VdbeMemIsRowSet(pMem) );
 74781  74902     assert( EIGHT_BYTE_ALIGNMENT(pMem) );
 74782  74903   
 74783  74904   
 74784  74905     if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){
 74785  74906       pMem->enc = 0;
 74786  74907       return SQLITE_NOMEM_BKPT;
 74787  74908     }
 74788  74909   
 74789         -  /* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
 74790         -  ** string representation of the value. Then, if the required encoding
 74791         -  ** is UTF-16le or UTF-16be do a translation.
 74792         -  ** 
 74793         -  ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.
 74794         -  */
 74795         -  if( fg & MEM_Int ){
 74796         -    sqlite3_snprintf(nByte, pMem->z, "%lld", pMem->u.i);
 74797         -  }else{
 74798         -    assert( fg & MEM_Real );
 74799         -    sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->u.r);
 74800         -  }
        74910  +  vdbeMemRenderNum(nByte, pMem->z, pMem);
 74801  74911     assert( pMem->z!=0 );
 74802  74912     pMem->n = sqlite3Strlen30NN(pMem->z);
 74803  74913     pMem->enc = SQLITE_UTF8;
 74804  74914     pMem->flags |= MEM_Str|MEM_Term;
 74805         -  if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real);
        74915  +  if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal);
 74806  74916     sqlite3VdbeChangeEncoding(pMem, enc);
 74807  74917     return SQLITE_OK;
 74808  74918   }
 74809  74919   
 74810  74920   /*
 74811  74921   ** Memory cell pMem contains the context of an aggregate function.
 74812  74922   ** This routine calls the finalize method for that function.  The
................................................................................
 74972  75082     return value;
 74973  75083   }
 74974  75084   SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){
 74975  75085     int flags;
 74976  75086     assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
 74977  75087     assert( EIGHT_BYTE_ALIGNMENT(pMem) );
 74978  75088     flags = pMem->flags;
 74979         -  if( flags & MEM_Int ){
        75089  +  if( flags & (MEM_Int|MEM_IntReal) ){
        75090  +    testcase( flags & MEM_IntReal );
 74980  75091       return pMem->u.i;
 74981  75092     }else if( flags & MEM_Real ){
 74982  75093       return doubleToInt64(pMem->u.r);
 74983  75094     }else if( flags & (MEM_Str|MEM_Blob) ){
 74984  75095       assert( pMem->z || pMem->n==0 );
 74985  75096       return memIntValue(pMem);
 74986  75097     }else{
................................................................................
 75001  75112     return val;
 75002  75113   }
 75003  75114   SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){
 75004  75115     assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
 75005  75116     assert( EIGHT_BYTE_ALIGNMENT(pMem) );
 75006  75117     if( pMem->flags & MEM_Real ){
 75007  75118       return pMem->u.r;
 75008         -  }else if( pMem->flags & MEM_Int ){
        75119  +  }else if( pMem->flags & (MEM_Int|MEM_IntReal) ){
        75120  +    testcase( pMem->flags & MEM_IntReal );
 75009  75121       return (double)pMem->u.i;
 75010  75122     }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
 75011  75123       return memRealValue(pMem);
 75012  75124     }else{
 75013  75125       /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */
 75014  75126       return (double)0;
 75015  75127     }
................................................................................
 75016  75128   }
 75017  75129   
 75018  75130   /*
 75019  75131   ** Return 1 if pMem represents true, and return 0 if pMem represents false.
 75020  75132   ** Return the value ifNull if pMem is NULL.  
 75021  75133   */
 75022  75134   SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem *pMem, int ifNull){
 75023         -  if( pMem->flags & MEM_Int ) return pMem->u.i!=0;
        75135  +  testcase( pMem->flags & MEM_IntReal );
        75136  +  if( pMem->flags & (MEM_Int|MEM_IntReal) ) return pMem->u.i!=0;
 75024  75137     if( pMem->flags & MEM_Null ) return ifNull;
 75025  75138     return sqlite3VdbeRealValue(pMem)!=0.0;
 75026  75139   }
 75027  75140   
 75028  75141   /*
 75029  75142   ** The MEM structure is already a MEM_Real.  Try to also make it a
 75030  75143   ** MEM_Int if we can.
................................................................................
 75078  75191     pMem->u.r = sqlite3VdbeRealValue(pMem);
 75079  75192     MemSetTypeFlag(pMem, MEM_Real);
 75080  75193     return SQLITE_OK;
 75081  75194   }
 75082  75195   
 75083  75196   /* Compare a floating point value to an integer.  Return true if the two
 75084  75197   ** values are the same within the precision of the floating point value.
        75198  +**
        75199  +** This function assumes that i was obtained by assignment from r1.
 75085  75200   **
 75086  75201   ** For some versions of GCC on 32-bit machines, if you do the more obvious
 75087  75202   ** comparison of "r1==(double)i" you sometimes get an answer of false even
 75088  75203   ** though the r1 and (double)i values are bit-for-bit the same.
 75089  75204   */
 75090         -static int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){
        75205  +SQLITE_PRIVATE int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){
 75091  75206     double r2 = (double)i;
 75092         -  return memcmp(&r1, &r2, sizeof(r1))==0;
        75207  +  return r1==0.0
        75208  +      || (memcmp(&r1, &r2, sizeof(r1))==0
        75209  +          && i >= -2251799813685248LL && i < 2251799813685248LL);
 75093  75210   }
 75094  75211   
 75095  75212   /*
 75096         -** Convert pMem so that it has types MEM_Real or MEM_Int or both.
        75213  +** Convert pMem so that it has type MEM_Real or MEM_Int.
 75097  75214   ** Invalidate any prior representations.
 75098  75215   **
 75099  75216   ** Every effort is made to force the conversion, even if the input
 75100  75217   ** is a string that does not look completely like a number.  Convert
 75101  75218   ** as much of the string as we can and ignore the rest.
 75102  75219   */
 75103  75220   SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){
 75104         -  if( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))==0 ){
        75221  +  testcase( pMem->flags & MEM_Int );
        75222  +  testcase( pMem->flags & MEM_Real );
        75223  +  testcase( pMem->flags & MEM_IntReal );
        75224  +  testcase( pMem->flags & MEM_Null );
        75225  +  if( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Null))==0 ){
 75105  75226       int rc;
        75227  +    sqlite3_int64 ix;
 75106  75228       assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 );
 75107  75229       assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
 75108         -    rc = sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc);
 75109         -    if( rc==0 ){
        75230  +    rc = sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc);
        75231  +    if( ((rc==0 || rc==1) && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1)
        75232  +     || sqlite3RealSameAsInt(pMem->u.r, (ix = (i64)pMem->u.r))
        75233  +    ){
        75234  +      pMem->u.i = ix;
 75110  75235         MemSetTypeFlag(pMem, MEM_Int);
 75111  75236       }else{
 75112         -      i64 i = pMem->u.i;
 75113         -      sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc);
 75114         -      if( rc==1 && sqlite3RealSameAsInt(pMem->u.r, i) ){
 75115         -        pMem->u.i = i;
 75116         -        MemSetTypeFlag(pMem, MEM_Int);
 75117         -      }else{
 75118         -        MemSetTypeFlag(pMem, MEM_Real);
 75119         -      }
        75237  +      MemSetTypeFlag(pMem, MEM_Real);
 75120  75238       }
 75121  75239     }
 75122         -  assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))!=0 );
        75240  +  assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Null))!=0 );
 75123  75241     pMem->flags &= ~(MEM_Str|MEM_Blob|MEM_Zero);
 75124  75242     return SQLITE_OK;
 75125  75243   }
 75126  75244   
 75127  75245   /*
 75128  75246   ** Cast the datatype of the value in pMem according to the affinity
 75129  75247   ** "aff".  Casting is different from applying affinity in that a cast
................................................................................
 75158  75276       }
 75159  75277       default: {
 75160  75278         assert( aff==SQLITE_AFF_TEXT );
 75161  75279         assert( MEM_Str==(MEM_Blob>>3) );
 75162  75280         pMem->flags |= (pMem->flags&MEM_Blob)>>3;
 75163  75281         sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding);
 75164  75282         assert( pMem->flags & MEM_Str || pMem->db->mallocFailed );
 75165         -      pMem->flags &= ~(MEM_Int|MEM_Real|MEM_Blob|MEM_Zero);
        75283  +      pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal|MEM_Blob|MEM_Zero);
 75166  75284         break;
 75167  75285       }
 75168  75286     }
 75169  75287   }
 75170  75288   
 75171  75289   /*
 75172  75290   ** Initialize bulk memory to be a consistent Mem object.
................................................................................
 75342  75460         /* If pX is marked as a shallow copy of pMem, then verify that
 75343  75461         ** no significant changes have been made to pX since the OP_SCopy.
 75344  75462         ** A significant change would indicated a missed call to this
 75345  75463         ** function for pX.  Minor changes, such as adding or removing a
 75346  75464         ** dual type, are allowed, as long as the underlying value is the
 75347  75465         ** same. */
 75348  75466         u16 mFlags = pMem->flags & pX->flags & pX->mScopyFlags;
 75349         -      assert( (mFlags&MEM_Int)==0 || pMem->u.i==pX->u.i );
        75467  +      assert( (mFlags&(MEM_Int|MEM_IntReal))==0 || pMem->u.i==pX->u.i );
 75350  75468         assert( (mFlags&MEM_Real)==0 || pMem->u.r==pX->u.r );
 75351  75469         assert( (mFlags&MEM_Str)==0  || (pMem->n==pX->n && pMem->z==pX->z) );
 75352  75470         assert( (mFlags&MEM_Blob)==0  || sqlite3BlobCompare(pMem,pX)==0 );
 75353  75471         
 75354  75472         /* pMem is the register that is changing.  But also mark pX as
 75355  75473         ** undefined so that we can quickly detect the shallow-copy error */
 75356  75474         pX->flags = MEM_Undefined;
................................................................................
 75617  75735     }else{
 75618  75736       sqlite3VdbeMemStringify(pVal, enc, 0);
 75619  75737       assert( 0==(1&SQLITE_PTR_TO_INT(pVal->z)) );
 75620  75738     }
 75621  75739     assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0
 75622  75740                 || pVal->db->mallocFailed );
 75623  75741     if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){
 75624         -    assert( sqlite3VdbeMemConsistentDualRep(pVal) );
        75742  +    assert( sqlite3VdbeMemValidStrRep(pVal) );
 75625  75743       return pVal->z;
 75626  75744     }else{
 75627  75745       return 0;
 75628  75746     }
 75629  75747   }
 75630  75748   
 75631  75749   /* This function is only available internally, it is not part of the
................................................................................
 75640  75758   */
 75641  75759   SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){
 75642  75760     if( !pVal ) return 0;
 75643  75761     assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );
 75644  75762     assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );
 75645  75763     assert( !sqlite3VdbeMemIsRowSet(pVal) );
 75646  75764     if( (pVal->flags&(MEM_Str|MEM_Term))==(MEM_Str|MEM_Term) && pVal->enc==enc ){
 75647         -    assert( sqlite3VdbeMemConsistentDualRep(pVal) );
        75765  +    assert( sqlite3VdbeMemValidStrRep(pVal) );
 75648  75766       return pVal->z;
 75649  75767     }
 75650  75768     if( pVal->flags&MEM_Null ){
 75651  75769       return 0;
 75652  75770     }
 75653  75771     return valueToText(pVal, enc);
 75654  75772   }
................................................................................
 75905  76023         sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);
 75906  76024       }
 75907  76025       if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){
 75908  76026         sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8);
 75909  76027       }else{
 75910  76028         sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8);
 75911  76029       }
 75912         -    if( pVal->flags & (MEM_Int|MEM_Real) ) pVal->flags &= ~MEM_Str;
        76030  +    assert( (pVal->flags & MEM_IntReal)==0 );
        76031  +    if( pVal->flags & (MEM_Int|MEM_IntReal|MEM_Real) ){
        76032  +      testcase( pVal->flags & MEM_Int );
        76033  +      testcase( pVal->flags & MEM_Real );
        76034  +      pVal->flags &= ~MEM_Str;
        76035  +    }
 75913  76036       if( enc!=SQLITE_UTF8 ){
 75914  76037         rc = sqlite3VdbeChangeEncoding(pVal, enc);
 75915  76038       }
 75916  76039     }else if( op==TK_UMINUS ) {
 75917  76040       /* This branch happens for multiple negative signs.  Ex: -(-5) */
 75918  76041       if( SQLITE_OK==valueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal,pCtx) 
 75919  76042        && pVal!=0
................................................................................
 75928  76051           pVal->u.i = -pVal->u.i;
 75929  76052         }
 75930  76053         sqlite3ValueApplyAffinity(pVal, affinity, enc);
 75931  76054       }
 75932  76055     }else if( op==TK_NULL ){
 75933  76056       pVal = valueNew(db, pCtx);
 75934  76057       if( pVal==0 ) goto no_mem;
 75935         -    sqlite3VdbeMemNumerify(pVal);
        76058  +    sqlite3VdbeMemSetNull(pVal);
 75936  76059     }
 75937  76060   #ifndef SQLITE_OMIT_BLOB_LITERAL
 75938  76061     else if( op==TK_BLOB ){
 75939  76062       int nVal;
 75940  76063       assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' );
 75941  76064       assert( pExpr->u.zToken[1]=='\'' );
 75942  76065       pVal = valueNew(db, pCtx);
................................................................................
 76940  77063   **
 76941  77064   **   assert( sqlite3VdbeAssertMayAbort(pParse->pVdbe, pParse->mayAbort) );
 76942  77065   */
 76943  77066   SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
 76944  77067     int hasAbort = 0;
 76945  77068     int hasFkCounter = 0;
 76946  77069     int hasCreateTable = 0;
        77070  +  int hasCreateIndex = 0;
 76947  77071     int hasInitCoroutine = 0;
 76948  77072     Op *pOp;
 76949  77073     VdbeOpIter sIter;
 76950  77074     memset(&sIter, 0, sizeof(sIter));
 76951  77075     sIter.v = v;
 76952  77076   
 76953  77077     while( (pOp = opIterNext(&sIter))!=0 ){
................................................................................
 76958  77082        || ((opcode==OP_Halt || opcode==OP_HaltIfNull) 
 76959  77083         && ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort))
 76960  77084       ){
 76961  77085         hasAbort = 1;
 76962  77086         break;
 76963  77087       }
 76964  77088       if( opcode==OP_CreateBtree && pOp->p3==BTREE_INTKEY ) hasCreateTable = 1;
        77089  +    if( mayAbort ){
        77090  +      /* hasCreateIndex may also be set for some DELETE statements that use
        77091  +      ** OP_Clear. So this routine may end up returning true in the case 
        77092  +      ** where a "DELETE FROM tbl" has a statement-journal but does not
        77093  +      ** require one. This is not so bad - it is an inefficiency, not a bug. */
        77094  +      if( opcode==OP_CreateBtree && pOp->p3==BTREE_BLOBKEY ) hasCreateIndex = 1;
        77095  +      if( opcode==OP_Clear ) hasCreateIndex = 1;
        77096  +    }
 76965  77097       if( opcode==OP_InitCoroutine ) hasInitCoroutine = 1;
 76966  77098   #ifndef SQLITE_OMIT_FOREIGN_KEY
 76967  77099       if( opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1 ){
 76968  77100         hasFkCounter = 1;
 76969  77101       }
 76970  77102   #endif
 76971  77103     }
................................................................................
 76973  77105   
 76974  77106     /* Return true if hasAbort==mayAbort. Or if a malloc failure occurred.
 76975  77107     ** If malloc failed, then the while() loop above may not have iterated
 76976  77108     ** through all opcodes and hasAbort may be set incorrectly. Return
 76977  77109     ** true for this case to prevent the assert() in the callers frame
 76978  77110     ** from failing.  */
 76979  77111     return ( v->db->mallocFailed || hasAbort==mayAbort || hasFkCounter
 76980         -              || (hasCreateTable && hasInitCoroutine) );
        77112  +        || (hasCreateTable && hasInitCoroutine) || hasCreateIndex
        77113  +  );
 76981  77114   }
 76982  77115   #endif /* SQLITE_DEBUG - the sqlite3AssertMayAbort() function */
 76983  77116   
 76984  77117   #ifdef SQLITE_DEBUG
 76985  77118   /*
 76986  77119   ** Increment the nWrite counter in the VDBE if the cursor is not an
 76987  77120   ** ephemeral cursor, or if the cursor argument is NULL.
................................................................................
 77845  77978         sqlite3_str_appendf(&x, "%.16g", *pOp->p4.pReal);
 77846  77979         break;
 77847  77980       }
 77848  77981       case P4_MEM: {
 77849  77982         Mem *pMem = pOp->p4.pMem;
 77850  77983         if( pMem->flags & MEM_Str ){
 77851  77984           zP4 = pMem->z;
 77852         -      }else if( pMem->flags & MEM_Int ){
        77985  +      }else if( pMem->flags & (MEM_Int|MEM_IntReal) ){
 77853  77986           sqlite3_str_appendf(&x, "%lld", pMem->u.i);
 77854  77987         }else if( pMem->flags & MEM_Real ){
 77855  77988           sqlite3_str_appendf(&x, "%.16g", pMem->u.r);
 77856  77989         }else if( pMem->flags & MEM_Null ){
 77857  77990           zP4 = "NULL";
 77858  77991         }else{
 77859  77992           assert( pMem->flags & MEM_Blob );
................................................................................
 79207  79340             db->autoCommit = 1;
 79208  79341             p->nChange = 0;
 79209  79342           }
 79210  79343         }
 79211  79344       }
 79212  79345   
 79213  79346       /* Check for immediate foreign key violations. */
 79214         -    if( p->rc==SQLITE_OK ){
        79347  +    if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){
 79215  79348         sqlite3VdbeCheckFk(p, 0);
 79216  79349       }
 79217  79350     
 79218  79351       /* If the auto-commit flag is set and this is the only active writer 
 79219  79352       ** VM, then we do either a commit or rollback of the current transaction. 
 79220  79353       **
 79221  79354       ** Note: This block also runs if one of the special errors handled 
................................................................................
 79733  79866   **
 79734  79867   ** The 8 and 9 types were added in 3.3.0, file format 4.  Prior versions
 79735  79868   ** of SQLite will not understand those serial types.
 79736  79869   */
 79737  79870   
 79738  79871   /*
 79739  79872   ** Return the serial-type for the value stored in pMem.
        79873  +**
        79874  +** This routine might convert a large MEM_IntReal value into MEM_Real.
 79740  79875   */
 79741  79876   SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format, u32 *pLen){
 79742  79877     int flags = pMem->flags;
 79743  79878     u32 n;
 79744  79879   
 79745  79880     assert( pLen!=0 );
 79746  79881     if( flags&MEM_Null ){
 79747  79882       *pLen = 0;
 79748  79883       return 0;
 79749  79884     }
 79750         -  if( flags&MEM_Int ){
        79885  +  if( flags&(MEM_Int|MEM_IntReal) ){
 79751  79886       /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */
 79752  79887   #   define MAX_6BYTE ((((i64)0x00008000)<<32)-1)
 79753  79888       i64 i = pMem->u.i;
 79754  79889       u64 u;
        79890  +    testcase( flags & MEM_Int );
        79891  +    testcase( flags & MEM_IntReal );
 79755  79892       if( i<0 ){
 79756  79893         u = ~i;
 79757  79894       }else{
 79758  79895         u = i;
 79759  79896       }
 79760  79897       if( u<=127 ){
 79761  79898         if( (i&1)==i && file_format>=4 ){
................................................................................
 79767  79904         }
 79768  79905       }
 79769  79906       if( u<=32767 ){ *pLen = 2; return 2; }
 79770  79907       if( u<=8388607 ){ *pLen = 3; return 3; }
 79771  79908       if( u<=2147483647 ){ *pLen = 4; return 4; }
 79772  79909       if( u<=MAX_6BYTE ){ *pLen = 6; return 5; }
 79773  79910       *pLen = 8;
        79911  +    if( flags&MEM_IntReal ){
        79912  +      /* If the value is IntReal and is going to take up 8 bytes to store
        79913  +      ** as an integer, then we might as well make it an 8-byte floating
        79914  +      ** point value */
        79915  +      pMem->u.r = (double)pMem->u.i;
        79916  +      pMem->flags &= ~MEM_IntReal;
        79917  +      pMem->flags |= MEM_Real;
        79918  +      return 7;
        79919  +    }
 79774  79920       return 6;
 79775  79921     }
 79776  79922     if( flags&MEM_Real ){
 79777  79923       *pLen = 8;
 79778  79924       return 7;
 79779  79925     }
 79780  79926     assert( pMem->db->mallocFailed || flags&(MEM_Str|MEM_Blob) );
................................................................................
 79940  80086   ** and store the result in pMem.  Return the number of bytes read.
 79941  80087   **
 79942  80088   ** This function is implemented as two separate routines for performance.
 79943  80089   ** The few cases that require local variables are broken out into a separate
 79944  80090   ** routine so that in most cases the overhead of moving the stack pointer
 79945  80091   ** is avoided.
 79946  80092   */ 
 79947         -static u32 SQLITE_NOINLINE serialGet(
        80093  +static u32 serialGet(
 79948  80094     const unsigned char *buf,     /* Buffer to deserialize from */
 79949  80095     u32 serial_type,              /* Serial type to deserialize */
 79950  80096     Mem *pMem                     /* Memory cell to write value into */
 79951  80097   ){
 79952  80098     u64 x = FOUR_BYTE_UINT(buf);
 79953  80099     u32 y = FOUR_BYTE_UINT(buf+4);
 79954  80100     x = (x<<32) + y;
................................................................................
 79972  80118       u64 t2 = t1;
 79973  80119       swapMixedEndianFloat(t2);
 79974  80120       assert( sizeof(r1)==sizeof(t2) && memcmp(&r1, &t2, sizeof(r1))==0 );
 79975  80121   #endif
 79976  80122       assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 );
 79977  80123       swapMixedEndianFloat(x);
 79978  80124       memcpy(&pMem->u.r, &x, sizeof(x));
 79979         -    pMem->flags = sqlite3IsNaN(pMem->u.r) ? MEM_Null : MEM_Real;
        80125  +    pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real;
 79980  80126     }
 79981  80127     return 8;
 79982  80128   }
 79983  80129   SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
 79984  80130     const unsigned char *buf,     /* Buffer to deserialize from */
 79985  80131     u32 serial_type,              /* Serial type to deserialize */
 79986  80132     Mem *pMem                     /* Memory cell to write value into */
................................................................................
 80422  80568     */
 80423  80569     if( combined_flags&MEM_Null ){
 80424  80570       return (f2&MEM_Null) - (f1&MEM_Null);
 80425  80571     }
 80426  80572   
 80427  80573     /* At least one of the two values is a number
 80428  80574     */
 80429         -  if( combined_flags&(MEM_Int|MEM_Real) ){
 80430         -    if( (f1 & f2 & MEM_Int)!=0 ){
        80575  +  if( combined_flags&(MEM_Int|MEM_Real|MEM_IntReal) ){
        80576  +    testcase( combined_flags & MEM_Int );
        80577  +    testcase( combined_flags & MEM_Real );
        80578  +    testcase( combined_flags & MEM_IntReal );
        80579  +    if( (f1 & f2 & (MEM_Int|MEM_IntReal))!=0 ){
        80580  +      testcase( f1 & f2 & MEM_Int );
        80581  +      testcase( f1 & f2 & MEM_IntReal );
 80431  80582         if( pMem1->u.i < pMem2->u.i ) return -1;
 80432  80583         if( pMem1->u.i > pMem2->u.i ) return +1;
 80433  80584         return 0;
 80434  80585       }
 80435  80586       if( (f1 & f2 & MEM_Real)!=0 ){
 80436  80587         if( pMem1->u.r < pMem2->u.r ) return -1;
 80437  80588         if( pMem1->u.r > pMem2->u.r ) return +1;
 80438  80589         return 0;
 80439  80590       }
 80440         -    if( (f1&MEM_Int)!=0 ){
        80591  +    if( (f1&(MEM_Int|MEM_IntReal))!=0 ){
        80592  +      testcase( f1 & MEM_Int );
        80593  +      testcase( f1 & MEM_IntReal );
 80441  80594         if( (f2&MEM_Real)!=0 ){
 80442  80595           return sqlite3IntFloatCompare(pMem1->u.i, pMem2->u.r);
        80596  +      }else if( (f2&(MEM_Int|MEM_IntReal))!=0 ){
        80597  +        if( pMem1->u.i < pMem2->u.i ) return -1;
        80598  +        if( pMem1->u.i > pMem2->u.i ) return +1;
        80599  +        return 0;
 80443  80600         }else{
 80444  80601           return -1;
 80445  80602         }
 80446  80603       }
 80447  80604       if( (f1&MEM_Real)!=0 ){
 80448         -      if( (f2&MEM_Int)!=0 ){
        80605  +      if( (f2&(MEM_Int|MEM_IntReal))!=0 ){
        80606  +        testcase( f2 & MEM_Int );
        80607  +        testcase( f2 & MEM_IntReal );
 80449  80608           return -sqlite3IntFloatCompare(pMem2->u.i, pMem1->u.r);
 80450  80609         }else{
 80451  80610           return -1;
 80452  80611         }
 80453  80612       }
 80454  80613       return +1;
 80455  80614     }
................................................................................
 80590  80749     assert( pPKey2->pKeyInfo->aSortOrder!=0 );
 80591  80750     assert( pPKey2->pKeyInfo->nKeyField>0 );
 80592  80751     assert( idx1<=szHdr1 || CORRUPT_DB );
 80593  80752     do{
 80594  80753       u32 serial_type;
 80595  80754   
 80596  80755       /* RHS is an integer */
 80597         -    if( pRhs->flags & MEM_Int ){
        80756  +    if( pRhs->flags & (MEM_Int|MEM_IntReal) ){
        80757  +      testcase( pRhs->flags & MEM_Int );
        80758  +      testcase( pRhs->flags & MEM_IntReal );
 80598  80759         serial_type = aKey1[idx1];
 80599  80760         testcase( serial_type==12 );
 80600  80761         if( serial_type>=10 ){
 80601  80762           rc = +1;
 80602  80763         }else if( serial_type==0 ){
 80603  80764           rc = -1;
 80604  80765         }else if( serial_type==7 ){
................................................................................
 80935  81096       }
 80936  81097       if( (flags & MEM_Int) ){
 80937  81098         return vdbeRecordCompareInt;
 80938  81099       }
 80939  81100       testcase( flags & MEM_Real );
 80940  81101       testcase( flags & MEM_Null );
 80941  81102       testcase( flags & MEM_Blob );
 80942         -    if( (flags & (MEM_Real|MEM_Null|MEM_Blob))==0 && p->pKeyInfo->aColl[0]==0 ){
        81103  +    if( (flags & (MEM_Real|MEM_IntReal|MEM_Null|MEM_Blob))==0
        81104  +     && p->pKeyInfo->aColl[0]==0
        81105  +    ){
 80943  81106         assert( flags & MEM_Str );
 80944  81107         return vdbeRecordCompareString;
 80945  81108       }
 80946  81109     }
 80947  81110   
 80948  81111     return sqlite3VdbeRecordCompare;
 80949  81112   }
................................................................................
 81525  81688   #endif /* SQLITE_OMIT_UTF16 */
 81526  81689   /* EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five
 81527  81690   ** fundamental datatypes: 64-bit signed integer 64-bit IEEE floating
 81528  81691   ** point number string BLOB NULL
 81529  81692   */
 81530  81693   SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){
 81531  81694     static const u8 aType[] = {
 81532         -     SQLITE_BLOB,     /* 0x00 */
 81533         -     SQLITE_NULL,     /* 0x01 */
 81534         -     SQLITE_TEXT,     /* 0x02 */
 81535         -     SQLITE_NULL,     /* 0x03 */
 81536         -     SQLITE_INTEGER,  /* 0x04 */
 81537         -     SQLITE_NULL,     /* 0x05 */
 81538         -     SQLITE_INTEGER,  /* 0x06 */
 81539         -     SQLITE_NULL,     /* 0x07 */
 81540         -     SQLITE_FLOAT,    /* 0x08 */
 81541         -     SQLITE_NULL,     /* 0x09 */
 81542         -     SQLITE_FLOAT,    /* 0x0a */
 81543         -     SQLITE_NULL,     /* 0x0b */
 81544         -     SQLITE_INTEGER,  /* 0x0c */
 81545         -     SQLITE_NULL,     /* 0x0d */
 81546         -     SQLITE_INTEGER,  /* 0x0e */
 81547         -     SQLITE_NULL,     /* 0x0f */
 81548         -     SQLITE_BLOB,     /* 0x10 */
 81549         -     SQLITE_NULL,     /* 0x11 */
 81550         -     SQLITE_TEXT,     /* 0x12 */
 81551         -     SQLITE_NULL,     /* 0x13 */
 81552         -     SQLITE_INTEGER,  /* 0x14 */
 81553         -     SQLITE_NULL,     /* 0x15 */
 81554         -     SQLITE_INTEGER,  /* 0x16 */
 81555         -     SQLITE_NULL,     /* 0x17 */
 81556         -     SQLITE_FLOAT,    /* 0x18 */
 81557         -     SQLITE_NULL,     /* 0x19 */
 81558         -     SQLITE_FLOAT,    /* 0x1a */
 81559         -     SQLITE_NULL,     /* 0x1b */
 81560         -     SQLITE_INTEGER,  /* 0x1c */
 81561         -     SQLITE_NULL,     /* 0x1d */
 81562         -     SQLITE_INTEGER,  /* 0x1e */
 81563         -     SQLITE_NULL,     /* 0x1f */
 81564         -  };
        81695  +     SQLITE_BLOB,     /* 0x00 (not possible) */
        81696  +     SQLITE_NULL,     /* 0x01 NULL */
        81697  +     SQLITE_TEXT,     /* 0x02 TEXT */
        81698  +     SQLITE_NULL,     /* 0x03 (not possible) */
        81699  +     SQLITE_INTEGER,  /* 0x04 INTEGER */
        81700  +     SQLITE_NULL,     /* 0x05 (not possible) */
        81701  +     SQLITE_INTEGER,  /* 0x06 INTEGER + TEXT */
        81702  +     SQLITE_NULL,     /* 0x07 (not possible) */
        81703  +     SQLITE_FLOAT,    /* 0x08 FLOAT */
        81704  +     SQLITE_NULL,     /* 0x09 (not possible) */
        81705  +     SQLITE_FLOAT,    /* 0x0a FLOAT + TEXT */
        81706  +     SQLITE_NULL,     /* 0x0b (not possible) */
        81707  +     SQLITE_INTEGER,  /* 0x0c (not possible) */
        81708  +     SQLITE_NULL,     /* 0x0d (not possible) */
        81709  +     SQLITE_INTEGER,  /* 0x0e (not possible) */
        81710  +     SQLITE_NULL,     /* 0x0f (not possible) */
        81711  +     SQLITE_BLOB,     /* 0x10 BLOB */
        81712  +     SQLITE_NULL,     /* 0x11 (not possible) */
        81713  +     SQLITE_TEXT,     /* 0x12 (not possible) */
        81714  +     SQLITE_NULL,     /* 0x13 (not possible) */
        81715  +     SQLITE_INTEGER,  /* 0x14 INTEGER + BLOB */
        81716  +     SQLITE_NULL,     /* 0x15 (not possible) */
        81717  +     SQLITE_INTEGER,  /* 0x16 (not possible) */
        81718  +     SQLITE_NULL,     /* 0x17 (not possible) */
        81719  +     SQLITE_FLOAT,    /* 0x18 FLOAT + BLOB */
        81720  +     SQLITE_NULL,     /* 0x19 (not possible) */
        81721  +     SQLITE_FLOAT,    /* 0x1a (not possible) */
        81722  +     SQLITE_NULL,     /* 0x1b (not possible) */
        81723  +     SQLITE_INTEGER,  /* 0x1c (not possible) */
        81724  +     SQLITE_NULL,     /* 0x1d (not possible) */
        81725  +     SQLITE_INTEGER,  /* 0x1e (not possible) */
        81726  +     SQLITE_NULL,     /* 0x1f (not possible) */
        81727  +     SQLITE_FLOAT,    /* 0x20 INTREAL */
        81728  +     SQLITE_NULL,     /* 0x21 (not possible) */
        81729  +     SQLITE_TEXT,     /* 0x22 INTREAL + TEXT */
        81730  +     SQLITE_NULL,     /* 0x23 (not possible) */
        81731  +     SQLITE_FLOAT,    /* 0x24 (not possible) */
        81732  +     SQLITE_NULL,     /* 0x25 (not possible) */
        81733  +     SQLITE_FLOAT,    /* 0x26 (not possible) */
        81734  +     SQLITE_NULL,     /* 0x27 (not possible) */
        81735  +     SQLITE_FLOAT,    /* 0x28 (not possible) */
        81736  +     SQLITE_NULL,     /* 0x29 (not possible) */
        81737  +     SQLITE_FLOAT,    /* 0x2a (not possible) */
        81738  +     SQLITE_NULL,     /* 0x2b (not possible) */
        81739  +     SQLITE_FLOAT,    /* 0x2c (not possible) */
        81740  +     SQLITE_NULL,     /* 0x2d (not possible) */
        81741  +     SQLITE_FLOAT,    /* 0x2e (not possible) */
        81742  +     SQLITE_NULL,     /* 0x2f (not possible) */
        81743  +     SQLITE_BLOB,     /* 0x30 (not possible) */
        81744  +     SQLITE_NULL,     /* 0x31 (not possible) */
        81745  +     SQLITE_TEXT,     /* 0x32 (not possible) */
        81746  +     SQLITE_NULL,     /* 0x33 (not possible) */
        81747  +     SQLITE_FLOAT,    /* 0x34 (not possible) */
        81748  +     SQLITE_NULL,     /* 0x35 (not possible) */
        81749  +     SQLITE_FLOAT,    /* 0x36 (not possible) */
        81750  +     SQLITE_NULL,     /* 0x37 (not possible) */
        81751  +     SQLITE_FLOAT,    /* 0x38 (not possible) */
        81752  +     SQLITE_NULL,     /* 0x39 (not possible) */
        81753  +     SQLITE_FLOAT,    /* 0x3a (not possible) */
        81754  +     SQLITE_NULL,     /* 0x3b (not possible) */
        81755  +     SQLITE_FLOAT,    /* 0x3c (not possible) */
        81756  +     SQLITE_NULL,     /* 0x3d (not possible) */
        81757  +     SQLITE_FLOAT,    /* 0x3e (not possible) */
        81758  +     SQLITE_NULL,     /* 0x3f (not possible) */
        81759  +  };
        81760  +#ifdef SQLITE_DEBUG
        81761  +  {
        81762  +    int eType = SQLITE_BLOB;
        81763  +    if( pVal->flags & MEM_Null ){
        81764  +      eType = SQLITE_NULL;
        81765  +    }else if( pVal->flags & (MEM_Real|MEM_IntReal) ){
        81766  +      eType = SQLITE_FLOAT;
        81767  +    }else if( pVal->flags & MEM_Int ){
        81768  +      eType = SQLITE_INTEGER;
        81769  +    }else if( pVal->flags & MEM_Str ){
        81770  +      eType = SQLITE_TEXT;
        81771  +    }
        81772  +    assert( eType == aType[pVal->flags&MEM_AffMask] );
        81773  +  }
        81774  +#endif
 81565  81775     return aType[pVal->flags&MEM_AffMask];
 81566  81776   }
 81567  81777   
 81568  81778   /* Return true if a parameter to xUpdate represents an unchanged column */
 81569  81779   SQLITE_API int sqlite3_value_nochange(sqlite3_value *pVal){
 81570  81780     return (pVal->flags&(MEM_Null|MEM_Zero))==(MEM_Null|MEM_Zero);
 81571  81781   }
................................................................................
 81806  82016   /* An SQLITE_NOMEM error. */
 81807  82017   SQLITE_API void sqlite3_result_error_nomem(sqlite3_context *pCtx){
 81808  82018     assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
 81809  82019     sqlite3VdbeMemSetNull(pCtx->pOut);
 81810  82020     pCtx->isError = SQLITE_NOMEM_BKPT;
 81811  82021     sqlite3OomFault(pCtx->pOut->db);
 81812  82022   }
        82023  +
        82024  +#ifndef SQLITE_UNTESTABLE
        82025  +/* Force the INT64 value currently stored as the result to be
        82026  +** a MEM_IntReal value.  See the SQLITE_TESTCTRL_RESULT_INTREAL
        82027  +** test-control.
        82028  +*/
        82029  +SQLITE_PRIVATE void sqlite3ResultIntReal(sqlite3_context *pCtx){ 
        82030  +  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
        82031  +  if( pCtx->pOut->flags & MEM_Int ){
        82032  +    pCtx->pOut->flags &= ~MEM_Int;
        82033  +    pCtx->pOut->flags |= MEM_IntReal;
        82034  +  }
        82035  +}
        82036  +#endif
        82037  +
 81813  82038   
 81814  82039   /*
 81815  82040   ** This function is called after a transaction has been committed. It 
 81816  82041   ** invokes callbacks registered with sqlite3_wal_hook() as required.
 81817  82042   */
 81818  82043   static int doWalCallbacks(sqlite3 *db){
 81819  82044     int rc = SQLITE_OK;
................................................................................
 83093  83318   
 83094  83319     pMem = *ppValue = &p->pUnpacked->aMem[iIdx];
 83095  83320     if( iIdx==p->pTab->iPKey ){
 83096  83321       sqlite3VdbeMemSetInt64(pMem, p->iKey1);
 83097  83322     }else if( iIdx>=p->pUnpacked->nField ){
 83098  83323       *ppValue = (sqlite3_value *)columnNullValue();
 83099  83324     }else if( p->pTab->aCol[iIdx].affinity==SQLITE_AFF_REAL ){
 83100         -    if( pMem->flags & MEM_Int ){
        83325  +    if( pMem->flags & (MEM_Int|MEM_IntReal) ){
        83326  +      testcase( pMem->flags & MEM_Int );
        83327  +      testcase( pMem->flags & MEM_IntReal );
 83101  83328         sqlite3VdbeMemRealify(pMem);
 83102  83329       }
 83103  83330     }
 83104  83331   
 83105  83332    preupdate_old_out:
 83106  83333     sqlite3Error(db, rc);
 83107  83334     return sqlite3ApiExit(db, rc);
................................................................................
 83412  83639         }
 83413  83640         zRawSql += nToken;
 83414  83641         nextIndex = idx + 1;
 83415  83642         assert( idx>0 && idx<=p->nVar );
 83416  83643         pVar = &p->aVar[idx-1];
 83417  83644         if( pVar->flags & MEM_Null ){
 83418  83645           sqlite3_str_append(&out, "NULL", 4);
 83419         -      }else if( pVar->flags & MEM_Int ){
        83646  +      }else if( pVar->flags & (MEM_Int|MEM_IntReal) ){
 83420  83647           sqlite3_str_appendf(&out, "%lld", pVar->u.i);
 83421  83648         }else if( pVar->flags & MEM_Real ){
 83422  83649           sqlite3_str_appendf(&out, "%!.15g", pVar->u.r);
 83423  83650         }else if( pVar->flags & MEM_Str ){
 83424  83651           int nOut;  /* Number of bytes of the string text to include in output */
 83425  83652   #ifndef SQLITE_OMIT_UTF16
 83426  83653           u8 enc = ENC(db);
................................................................................
 83674  83901         if( (mNever&0x08)!=0 && (I&0x05)!=0) I |= 0x05; /*NO_TEST*/
 83675  83902       }
 83676  83903       sqlite3GlobalConfig.xVdbeBranch(sqlite3GlobalConfig.pVdbeBranchArg,
 83677  83904                                       iSrcLine&0xffffff, I, M);
 83678  83905     }
 83679  83906   #endif
 83680  83907   
 83681         -/*
 83682         -** Convert the given register into a string if it isn't one
 83683         -** already. Return non-zero if a malloc() fails.
 83684         -*/
 83685         -#define Stringify(P, enc) \
 83686         -   if(((P)->flags&(MEM_Str|MEM_Blob))==0 && sqlite3VdbeMemStringify(P,enc,0)) \
 83687         -     { goto no_mem; }
 83688         -
 83689  83908   /*
 83690  83909   ** An ephemeral string value (signified by the MEM_Ephem flag) contains
 83691  83910   ** a pointer to a dynamically allocated string where some other entity
 83692  83911   ** is responsible for deallocating that string.  Because the register
 83693  83912   ** does not control the string, it might be deleted without the register
 83694  83913   ** knowing it.
 83695  83914   **
................................................................................
 83743  83962   
 83744  83963     assert( iCur>=0 && iCur<p->nCursor );
 83745  83964     if( p->apCsr[iCur] ){ /*OPTIMIZATION-IF-FALSE*/
 83746  83965       /* Before calling sqlite3VdbeFreeCursor(), ensure the isEphemeral flag
 83747  83966       ** is clear. Otherwise, if this is an ephemeral cursor created by 
 83748  83967       ** OP_OpenDup, the cursor will not be closed and will still be part
 83749  83968       ** of a BtShared.pCursor list.  */
 83750         -    p->apCsr[iCur]->isEphemeral = 0;
        83969  +    if( p->apCsr[iCur]->pBtx==0 ) p->apCsr[iCur]->isEphemeral = 0;
 83751  83970       sqlite3VdbeFreeCursor(p, p->apCsr[iCur]);
 83752  83971       p->apCsr[iCur] = 0;
 83753  83972     }
 83754  83973     if( SQLITE_OK==sqlite3VdbeMemClearAndResize(pMem, nByte) ){
 83755  83974       p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z;
 83756  83975       memset(pCx, 0, offsetof(VdbeCursor,pAltCursor));
 83757  83976       pCx->eCurType = eCurType;
................................................................................
 83762  83981         pCx->uc.pCursor = (BtCursor*)
 83763  83982             &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField];
 83764  83983         sqlite3BtreeCursorZero(pCx->uc.pCursor);
 83765  83984       }
 83766  83985     }
 83767  83986     return pCx;
 83768  83987   }
        83988  +
        83989  +/*
        83990  +** The string in pRec is known to look like an integer and to have a
        83991  +** floating point value of rValue.  Return true and set *piValue to the
        83992  +** integer value if the string is in range to be an integer.  Otherwise,
        83993  +** return false.
        83994  +*/
        83995  +static int alsoAnInt(Mem *pRec, double rValue, i64 *piValue){
        83996  +  i64 iValue = (double)rValue;
        83997  +  if( sqlite3RealSameAsInt(rValue,iValue) ){
        83998  +    *piValue = iValue;
        83999  +    return 1;
        84000  +  }
        84001  +  return 0==sqlite3Atoi64(pRec->z, piValue, pRec->n, pRec->enc);
        84002  +}
 83769  84003   
 83770  84004   /*
 83771  84005   ** Try to convert a value into a numeric representation if we can
 83772  84006   ** do so without loss of information.  In other words, if the string
 83773  84007   ** looks like a number, convert it into a number.  If it does not
 83774  84008   ** look like a number, leave it alone.
 83775  84009   **
................................................................................
 83780  84014   **
 83781  84015   ** If bTryForInt is false, then if the input string contains a decimal
 83782  84016   ** point or exponential notation, the result is only MEM_Real, even
 83783  84017   ** if there is an exact integer representation of the quantity.
 83784  84018   */
 83785  84019   static void applyNumericAffinity(Mem *pRec, int bTryForInt){
 83786  84020     double rValue;
 83787         -  i64 iValue;
 83788  84021     u8 enc = pRec->enc;
 83789         -  assert( (pRec->flags & (MEM_Str|MEM_Int|MEM_Real))==MEM_Str );
 83790         -  if( sqlite3AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return;
 83791         -  if( 0==sqlite3Atoi64(pRec->z, &iValue, pRec->n, enc) ){
 83792         -    pRec->u.i = iValue;
        84022  +  int rc;
        84023  +  assert( (pRec->flags & (MEM_Str|MEM_Int|MEM_Real|MEM_IntReal))==MEM_Str );
        84024  +  rc = sqlite3AtoF(pRec->z, &rValue, pRec->n, enc);
        84025  +  if( rc<=0 ) return;
        84026  +  if( rc==1 && alsoAnInt(pRec, rValue, &pRec->u.i) ){
 83793  84027       pRec->flags |= MEM_Int;
 83794  84028     }else{
 83795  84029       pRec->u.r = rValue;
 83796  84030       pRec->flags |= MEM_Real;
 83797  84031       if( bTryForInt ) sqlite3VdbeIntegerAffinity(pRec);
 83798  84032     }
 83799  84033     /* TEXT->NUMERIC is many->one.  Hence, it is important to invalidate the
................................................................................
 83839  84073     }else if( affinity==SQLITE_AFF_TEXT ){
 83840  84074       /* Only attempt the conversion to TEXT if there is an integer or real
 83841  84075       ** representation (blob and NULL do not get converted) but no string
 83842  84076       ** representation.  It would be harmless to repeat the conversion if 
 83843  84077       ** there is already a string rep, but it is pointless to waste those
 83844  84078       ** CPU cycles. */
 83845  84079       if( 0==(pRec->flags&MEM_Str) ){ /*OPTIMIZATION-IF-FALSE*/
 83846         -      if( (pRec->flags&(MEM_Real|MEM_Int)) ){
        84080  +      if( (pRec->flags&(MEM_Real|MEM_Int|MEM_IntReal)) ){
        84081  +        testcase( pRec->flags & MEM_Int );
        84082  +        testcase( pRec->flags & MEM_Real );
        84083  +        testcase( pRec->flags & MEM_IntReal );
 83847  84084           sqlite3VdbeMemStringify(pRec, enc, 1);
 83848  84085         }
 83849  84086       }
 83850         -    pRec->flags &= ~(MEM_Real|MEM_Int);
        84087  +    pRec->flags &= ~(MEM_Real|MEM_Int|MEM_IntReal);
 83851  84088     }
 83852  84089   }
 83853  84090   
 83854  84091   /*
 83855  84092   ** Try to convert the type of a function argument or a result column
 83856  84093   ** into a numeric representation.  Use either INTEGER or REAL whichever
 83857  84094   ** is appropriate.  But only do the conversion if it is possible without
................................................................................
 83882  84119   /*
 83883  84120   ** pMem currently only holds a string type (or maybe a BLOB that we can
 83884  84121   ** interpret as a string if we want to).  Compute its corresponding
 83885  84122   ** numeric type, if has one.  Set the pMem->u.r and pMem->u.i fields
 83886  84123   ** accordingly.
 83887  84124   */
 83888  84125   static u16 SQLITE_NOINLINE computeNumericType(Mem *pMem){
 83889         -  assert( (pMem->flags & (MEM_Int|MEM_Real))==0 );
        84126  +  int rc;
        84127  +  sqlite3_int64 ix;
        84128  +  assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal))==0 );
 83890  84129     assert( (pMem->flags & (MEM_Str|MEM_Blob))!=0 );
 83891  84130     ExpandBlob(pMem);
 83892         -  if( sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc)==0 ){
 83893         -    return 0;
 83894         -  }
 83895         -  if( sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc)==0 ){
        84131  +  rc = sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc);
        84132  +  if( rc<=0 ){
        84133  +    if( rc==0 && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1 ){
        84134  +      pMem->u.i = ix;
        84135  +      return MEM_Int;
        84136  +    }else{
        84137  +      return MEM_Real;
        84138  +    }
        84139  +  }else if( rc==1 && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)==0 ){
        84140  +    pMem->u.i = ix;
 83896  84141       return MEM_Int;
 83897  84142     }
 83898  84143     return MEM_Real;
 83899  84144   }
 83900  84145   
 83901  84146   /*
 83902  84147   ** Return the numeric type for pMem, either MEM_Int or MEM_Real or both or
 83903  84148   ** none.  
 83904  84149   **
 83905  84150   ** Unlike applyNumericAffinity(), this routine does not modify pMem->flags.
 83906  84151   ** But it does set pMem->u.r and pMem->u.i appropriately.
 83907  84152   */
 83908  84153   static u16 numericType(Mem *pMem){
 83909         -  if( pMem->flags & (MEM_Int|MEM_Real) ){
 83910         -    return pMem->flags & (MEM_Int|MEM_Real);
        84154  +  if( pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal) ){
        84155  +    testcase( pMem->flags & MEM_Int );
        84156  +    testcase( pMem->flags & MEM_Real );
        84157  +    testcase( pMem->flags & MEM_IntReal );
        84158  +    return pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal);
 83911  84159     }
 83912  84160     if( pMem->flags & (MEM_Str|MEM_Blob) ){
        84161  +    testcase( pMem->flags & MEM_Str );
        84162  +    testcase( pMem->flags & MEM_Blob );
 83913  84163       return computeNumericType(pMem);
 83914  84164     }
 83915  84165     return 0;
 83916  84166   }
 83917  84167   
 83918  84168   #ifdef SQLITE_DEBUG
 83919  84169   /*
................................................................................
 84001  84251   static void memTracePrint(Mem *p){
 84002  84252     if( p->flags & MEM_Undefined ){
 84003  84253       printf(" undefined");
 84004  84254     }else if( p->flags & MEM_Null ){
 84005  84255       printf(p->flags & MEM_Zero ? " NULL-nochng" : " NULL");
 84006  84256     }else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){
 84007  84257       printf(" si:%lld", p->u.i);
        84258  +  }else if( (p->flags & (MEM_IntReal))!=0 ){
        84259  +    printf(" ir:%lld", p->u.i);
 84008  84260     }else if( p->flags & MEM_Int ){
 84009  84261       printf(" i:%lld", p->u.i);
 84010  84262   #ifndef SQLITE_OMIT_FLOATING_POINT
 84011  84263     }else if( p->flags & MEM_Real ){
 84012  84264       printf(" r:%g", p->u.r);
 84013  84265   #endif
 84014  84266     }else if( sqlite3VdbeMemIsRowSet(p) ){
................................................................................
 85031  85283   **   P3 = P2 || P1
 85032  85284   **
 85033  85285   ** It is illegal for P1 and P3 to be the same register. Sometimes,
 85034  85286   ** if P3 is the same register as P2, the implementation is able
 85035  85287   ** to avoid a memcpy().
 85036  85288   */
 85037  85289   case OP_Concat: {           /* same as TK_CONCAT, in1, in2, out3 */
 85038         -  i64 nByte;
        85290  +  i64 nByte;          /* Total size of the output string or blob */
        85291  +  u16 flags1;         /* Initial flags for P1 */
        85292  +  u16 flags2;         /* Initial flags for P2 */
 85039  85293   
 85040  85294     pIn1 = &aMem[pOp->p1];
 85041  85295     pIn2 = &aMem[pOp->p2];
 85042  85296     pOut = &aMem[pOp->p3];
        85297  +  testcase( pIn1==pIn2 );
        85298  +  testcase( pOut==pIn2 );
 85043  85299     assert( pIn1!=pOut );
 85044         -  if( (pIn1->flags | pIn2->flags) & MEM_Null ){
        85300  +  flags1 = pIn1->flags;
        85301  +  testcase( flags1 & MEM_Null );
        85302  +  testcase( pIn2->flags & MEM_Null );
        85303  +  if( (flags1 | pIn2->flags) & MEM_Null ){
 85045  85304       sqlite3VdbeMemSetNull(pOut);
 85046  85305       break;
 85047  85306     }
 85048         -  if( ExpandBlob(pIn1) || ExpandBlob(pIn2) ) goto no_mem;
 85049         -  Stringify(pIn1, encoding);
 85050         -  Stringify(pIn2, encoding);
        85307  +  if( (flags1 & (MEM_Str|MEM_Blob))==0 ){
        85308  +    if( sqlite3VdbeMemStringify(pIn1,encoding,0) ) goto no_mem;
        85309  +    flags1 = pIn1->flags & ~MEM_Str;
        85310  +  }else if( (flags1 & MEM_Zero)!=0 ){
        85311  +    if( sqlite3VdbeMemExpandBlob(pIn1) ) goto no_mem;
        85312  +    flags1 = pIn1->flags & ~MEM_Str;
        85313  +  }
        85314  +  flags2 = pIn2->flags;
        85315  +  if( (flags2 & (MEM_Str|MEM_Blob))==0 ){
        85316  +    if( sqlite3VdbeMemStringify(pIn2,encoding,0) ) goto no_mem;
        85317  +    flags2 = pIn2->flags & ~MEM_Str;
        85318  +  }else if( (flags2 & MEM_Zero)!=0 ){
        85319  +    if( sqlite3VdbeMemExpandBlob(pIn2) ) goto no_mem;
        85320  +    flags2 = pIn2->flags & ~MEM_Str;
        85321  +  }
 85051  85322     nByte = pIn1->n + pIn2->n;
 85052  85323     if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){
 85053  85324       goto too_big;
 85054  85325     }
 85055         -  if( sqlite3VdbeMemGrow(pOut, (int)nByte+2, pOut==pIn2) ){
        85326  +  if( sqlite3VdbeMemGrow(pOut, (int)nByte+3, pOut==pIn2) ){
 85056  85327       goto no_mem;
 85057  85328     }
 85058  85329     MemSetTypeFlag(pOut, MEM_Str);
 85059  85330     if( pOut!=pIn2 ){
 85060  85331       memcpy(pOut->z, pIn2->z, pIn2->n);
        85332  +    assert( (pIn2->flags & MEM_Dyn) == (flags2 & MEM_Dyn) );
        85333  +    pIn2->flags = flags2;
 85061  85334     }
 85062  85335     memcpy(&pOut->z[pIn2->n], pIn1->z, pIn1->n);
        85336  +  assert( (pIn1->flags & MEM_Dyn) == (flags1 & MEM_Dyn) );
        85337  +  pIn1->flags = flags1;
 85063  85338     pOut->z[nByte]=0;
 85064  85339     pOut->z[nByte+1] = 0;
        85340  +  pOut->z[nByte+2] = 0;
 85065  85341     pOut->flags |= MEM_Term;
 85066  85342     pOut->n = (int)nByte;
 85067  85343     pOut->enc = encoding;
 85068  85344     UPDATE_MAX_BLOBSIZE(pOut);
 85069  85345     break;
 85070  85346   }
 85071  85347   
................................................................................
 85108  85384   ** If either operand is NULL, the result is NULL.
 85109  85385   */
 85110  85386   case OP_Add:                   /* same as TK_PLUS, in1, in2, out3 */
 85111  85387   case OP_Subtract:              /* same as TK_MINUS, in1, in2, out3 */
 85112  85388   case OP_Multiply:              /* same as TK_STAR, in1, in2, out3 */
 85113  85389   case OP_Divide:                /* same as TK_SLASH, in1, in2, out3 */
 85114  85390   case OP_Remainder: {           /* same as TK_REM, in1, in2, out3 */
 85115         -  char bIntint;   /* Started out as two integer operands */
 85116  85391     u16 flags;      /* Combined MEM_* flags from both inputs */
 85117  85392     u16 type1;      /* Numeric type of left operand */
 85118  85393     u16 type2;      /* Numeric type of right operand */
 85119  85394     i64 iA;         /* Integer value of left operand */
 85120  85395     i64 iB;         /* Integer value of right operand */
 85121  85396     double rA;      /* Real value of left operand */
 85122  85397     double rB;      /* Real value of right operand */
................................................................................
 85126  85401     pIn2 = &aMem[pOp->p2];
 85127  85402     type2 = numericType(pIn2);
 85128  85403     pOut = &aMem[pOp->p3];
 85129  85404     flags = pIn1->flags | pIn2->flags;
 85130  85405     if( (type1 & type2 & MEM_Int)!=0 ){
 85131  85406       iA = pIn1->u.i;
 85132  85407       iB = pIn2->u.i;
 85133         -    bIntint = 1;
 85134  85408       switch( pOp->opcode ){
 85135  85409         case OP_Add:       if( sqlite3AddInt64(&iB,iA) ) goto fp_math;  break;
 85136  85410         case OP_Subtract:  if( sqlite3SubInt64(&iB,iA) ) goto fp_math;  break;
 85137  85411         case OP_Multiply:  if( sqlite3MulInt64(&iB,iA) ) goto fp_math;  break;
 85138  85412         case OP_Divide: {
 85139  85413           if( iA==0 ) goto arithmetic_result_is_null;
 85140  85414           if( iA==-1 && iB==SMALLEST_INT64 ) goto fp_math;
................................................................................
 85149  85423         }
 85150  85424       }
 85151  85425       pOut->u.i = iB;
 85152  85426       MemSetTypeFlag(pOut, MEM_Int);
 85153  85427     }else if( (flags & MEM_Null)!=0 ){
 85154  85428       goto arithmetic_result_is_null;
 85155  85429     }else{
 85156         -    bIntint = 0;
 85157  85430   fp_math:
 85158  85431       rA = sqlite3VdbeRealValue(pIn1);
 85159  85432       rB = sqlite3VdbeRealValue(pIn2);
 85160  85433       switch( pOp->opcode ){
 85161  85434         case OP_Add:         rB += rA;       break;
 85162  85435         case OP_Subtract:    rB -= rA;       break;
 85163  85436         case OP_Multiply:    rB *= rA;       break;
................................................................................
 85181  85454       MemSetTypeFlag(pOut, MEM_Int);
 85182  85455   #else
 85183  85456       if( sqlite3IsNaN(rB) ){
 85184  85457         goto arithmetic_result_is_null;
 85185  85458       }
 85186  85459       pOut->u.r = rB;
 85187  85460       MemSetTypeFlag(pOut, MEM_Real);
 85188         -    if( ((type1|type2)&MEM_Real)==0 && !bIntint ){
 85189         -      sqlite3VdbeIntegerAffinity(pOut);
 85190         -    }
 85191  85461   #endif
 85192  85462     }
 85193  85463     break;
 85194  85464   
 85195  85465   arithmetic_result_is_null:
 85196  85466     sqlite3VdbeMemSetNull(pOut);
 85197  85467     break;
................................................................................
 85352  85622   ** This opcode is used when extracting information from a column that
 85353  85623   ** has REAL affinity.  Such column values may still be stored as
 85354  85624   ** integers, for space efficiency, but after extraction we want them
 85355  85625   ** to have only a real value.
 85356  85626   */
 85357  85627   case OP_RealAffinity: {                  /* in1 */
 85358  85628     pIn1 = &aMem[pOp->p1];
 85359         -  if( pIn1->flags & MEM_Int ){
        85629  +  if( pIn1->flags & (MEM_Int|MEM_IntReal) ){
        85630  +    testcase( pIn1->flags & MEM_Int );
        85631  +    testcase( pIn1->flags & MEM_IntReal );
 85360  85632       sqlite3VdbeMemRealify(pIn1);
 85361  85633     }
 85362  85634     break;
 85363  85635   }
 85364  85636   #endif
 85365  85637   
 85366  85638   #ifndef SQLITE_OMIT_CAST
................................................................................
 85544  85816         break;
 85545  85817       }
 85546  85818     }else{
 85547  85819       /* Neither operand is NULL.  Do a comparison. */
 85548  85820       affinity = pOp->p5 & SQLITE_AFF_MASK;
 85549  85821       if( affinity>=SQLITE_AFF_NUMERIC ){
 85550  85822         if( (flags1 | flags3)&MEM_Str ){
 85551         -        if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
        85823  +        if( (flags1 & (MEM_Int|MEM_IntReal|MEM_Real|MEM_Str))==MEM_Str ){
 85552  85824             applyNumericAffinity(pIn1,0);
 85553  85825             assert( flags3==pIn3->flags );
 85554  85826             /* testcase( flags3!=pIn3->flags );
 85555  85827             ** this used to be possible with pIn1==pIn3, but not since
 85556  85828             ** the column cache was removed.  The following assignment
 85557  85829             ** is essentially a no-op.  But, it provides defense-in-depth
 85558  85830             ** in case our analysis is incorrect, so it is left in. */
 85559  85831             flags3 = pIn3->flags;
 85560  85832           }
 85561         -        if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
        85833  +        if( (flags3 & (MEM_Int|MEM_IntReal|MEM_Real|MEM_Str))==MEM_Str ){
 85562  85834             applyNumericAffinity(pIn3,0);
 85563  85835           }
 85564  85836         }
 85565  85837         /* Handle the common case of integer comparison here, as an
 85566  85838         ** optimization, to avoid a call to sqlite3MemCompare() */
 85567  85839         if( (pIn1->flags & pIn3->flags & MEM_Int)!=0 ){
 85568  85840           if( pIn3->u.i > pIn1->u.i ){ res = +1; goto compare_op; }
 85569  85841           if( pIn3->u.i < pIn1->u.i ){ res = -1; goto compare_op; }
 85570  85842           res = 0;
 85571  85843           goto compare_op;
 85572  85844         }
 85573  85845       }else if( affinity==SQLITE_AFF_TEXT ){
 85574         -      if( (flags1 & MEM_Str)==0 && (flags1 & (MEM_Int|MEM_Real))!=0 ){
        85846  +      if( (flags1 & MEM_Str)==0 && (flags1&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){
 85575  85847           testcase( pIn1->flags & MEM_Int );
 85576  85848           testcase( pIn1->flags & MEM_Real );
        85849  +        testcase( pIn1->flags & MEM_IntReal );
 85577  85850           sqlite3VdbeMemStringify(pIn1, encoding, 1);
 85578  85851           testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) );
 85579  85852           flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);
 85580  85853           assert( pIn1!=pIn3 );
 85581  85854         }
 85582         -      if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){
        85855  +      if( (flags3 & MEM_Str)==0 && (flags3&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){
 85583  85856           testcase( pIn3->flags & MEM_Int );
 85584  85857           testcase( pIn3->flags & MEM_Real );
        85858  +        testcase( pIn3->flags & MEM_IntReal );
 85585  85859           sqlite3VdbeMemStringify(pIn3, encoding, 1);
 85586  85860           testcase( (flags3&MEM_Dyn) != (pIn3->flags&MEM_Dyn) );
 85587  85861           flags3 = (pIn3->flags & ~MEM_TypeMask) | (flags3 & MEM_TypeMask);
 85588  85862         }
 85589  85863       }
 85590  85864       assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 );
 85591  85865       res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl);
................................................................................
 86333  86607     const char *zAffinity;   /* The affinity to be applied */
 86334  86608   
 86335  86609     zAffinity = pOp->p4.z;
 86336  86610     assert( zAffinity!=0 );
 86337  86611     assert( pOp->p2>0 );
 86338  86612     assert( zAffinity[pOp->p2]==0 );
 86339  86613     pIn1 = &aMem[pOp->p1];
 86340         -  do{
        86614  +  while( 1 /*edit-by-break*/ ){
 86341  86615       assert( pIn1 <= &p->aMem[(p->nMem+1 - p->nCursor)] );
 86342  86616       assert( memIsValid(pIn1) );
 86343         -    applyAffinity(pIn1, *(zAffinity++), encoding);
        86617  +    applyAffinity(pIn1, zAffinity[0], encoding);
        86618  +    if( zAffinity[0]==SQLITE_AFF_REAL && (pIn1->flags & MEM_Int)!=0 ){
        86619  +      /* When applying REAL affinity, if the result is still MEM_Int, 
        86620  +      ** indicate that REAL is actually desired */
        86621  +      pIn1->flags |= MEM_IntReal;
        86622  +      pIn1->flags &= ~MEM_Int;
        86623  +    }
        86624  +    REGISTER_TRACE((int)(pIn1-aMem), pIn1);
        86625  +    zAffinity++;
        86626  +    if( zAffinity[0]==0 ) break;
 86344  86627       pIn1++;
 86345         -  }while( zAffinity[0] );
        86628  +  }
 86346  86629     break;
 86347  86630   }
 86348  86631   
 86349  86632   /* Opcode: MakeRecord P1 P2 P3 P4 *
 86350  86633   ** Synopsis: r[P3]=mkrec(r[P1@P2])
 86351  86634   **
 86352  86635   ** Convert P2 registers beginning with P1 into the [record format]
................................................................................
 86359  86642   **
 86360  86643   ** The mapping from character to affinity is given by the SQLITE_AFF_
 86361  86644   ** macros defined in sqliteInt.h.
 86362  86645   **
 86363  86646   ** If P4 is NULL then all index fields have the affinity BLOB.
 86364  86647   */
 86365  86648   case OP_MakeRecord: {
 86366         -  u8 *zNewRecord;        /* A buffer to hold the data for the new record */
 86367  86649     Mem *pRec;             /* The new record */
 86368  86650     u64 nData;             /* Number of bytes of data space */
 86369  86651     int nHdr;              /* Number of bytes of header space */
 86370  86652     i64 nByte;             /* Data space required for this record */
 86371  86653     i64 nZero;             /* Number of zero bytes at the end of the record */
 86372  86654     int nVarint;           /* Number of bytes in a varint */
 86373  86655     u32 serial_type;       /* Type field */
 86374  86656     Mem *pData0;           /* First field to be combined into the record */
 86375  86657     Mem *pLast;            /* Last field of the record */
 86376  86658     int nField;            /* Number of fields in the record */
 86377  86659     char *zAffinity;       /* The affinity string for the record */
 86378  86660     int file_format;       /* File format to use for encoding */
 86379         -  int i;                 /* Space used in zNewRecord[] header */
 86380         -  int j;                 /* Space used in zNewRecord[] content */
 86381  86661     u32 len;               /* Length of a field */
        86662  +  u8 *zHdr;              /* Where to write next byte of the header */
        86663  +  u8 *zPayload;          /* Where to write next byte of the payload */
 86382  86664   
 86383  86665     /* Assuming the record contains N fields, the record format looks
 86384  86666     ** like this:
 86385  86667     **
 86386  86668     ** ------------------------------------------------------------------------
 86387  86669     ** | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 | 
 86388  86670     ** ------------------------------------------------------------------------
................................................................................
 86413  86695   
 86414  86696     /* Apply the requested affinity to all inputs
 86415  86697     */
 86416  86698     assert( pData0<=pLast );
 86417  86699     if( zAffinity ){
 86418  86700       pRec = pData0;
 86419  86701       do{
 86420         -      applyAffinity(pRec++, *(zAffinity++), encoding);
        86702  +      applyAffinity(pRec, zAffinity[0], encoding);
        86703  +      if( zAffinity[0]==SQLITE_AFF_REAL && (pRec->flags & MEM_Int) ){
        86704  +        pRec->flags |= MEM_IntReal;
        86705  +        pRec->flags &= ~(MEM_Int);
        86706  +      }
        86707  +      REGISTER_TRACE((int)(pRec-aMem), pRec);
        86708  +      zAffinity++;
        86709  +      pRec++;
 86421  86710         assert( zAffinity[0]==0 || pRec<=pLast );
 86422  86711       }while( zAffinity[0] );
 86423  86712     }
 86424  86713   
 86425  86714   #ifdef SQLITE_ENABLE_NULL_TRIM
 86426  86715     /* NULLs can be safely trimmed from the end of the record, as long as
 86427  86716     ** as the schema format is 2 or more and none of the omitted columns
................................................................................
 86501  86790       if( nByte+nZero>db->aLimit[SQLITE_LIMIT_LENGTH] ){
 86502  86791         goto too_big;
 86503  86792       }
 86504  86793       if( sqlite3VdbeMemClearAndResize(pOut, (int)nByte) ){
 86505  86794         goto no_mem;
 86506  86795       }
 86507  86796     }
 86508         -  zNewRecord = (u8 *)pOut->z;
        86797  +  pOut->n = (int)nByte;
        86798  +  pOut->flags = MEM_Blob;
        86799  +  if( nZero ){
        86800  +    pOut->u.nZero = nZero;
        86801  +    pOut->flags |= MEM_Zero;
        86802  +  }
        86803  +  UPDATE_MAX_BLOBSIZE(pOut);
        86804  +  zHdr = (u8 *)pOut->z;
        86805  +  zPayload = zHdr + nHdr;
 86509  86806   
 86510  86807     /* Write the record */
 86511         -  i = putVarint32(zNewRecord, nHdr);
 86512         -  j = nHdr;
        86808  +  zHdr += putVarint32(zHdr, nHdr);
 86513  86809     assert( pData0<=pLast );
 86514  86810     pRec = pData0;
 86515  86811     do{
 86516  86812       serial_type = pRec->uTemp;
 86517  86813       /* EVIDENCE-OF: R-06529-47362 Following the size varint are one or more
 86518  86814       ** additional varints, one per column. */
 86519         -    i += putVarint32(&zNewRecord[i], serial_type);            /* serial type */
        86815  +    zHdr += putVarint32(zHdr, serial_type);            /* serial type */
 86520  86816       /* EVIDENCE-OF: R-64536-51728 The values for each column in the record
 86521  86817       ** immediately follow the header. */
 86522         -    j += sqlite3VdbeSerialPut(&zNewRecord[j], pRec, serial_type); /* content */
        86818  +    zPayload += sqlite3VdbeSerialPut(zPayload, pRec, serial_type); /* content */
 86523  86819     }while( (++pRec)<=pLast );
 86524         -  assert( i==nHdr );
 86525         -  assert( j==nByte );
        86820  +  assert( nHdr==(int)(zHdr - (u8*)pOut->z) );
        86821  +  assert( nByte==(int)(zPayload - (u8*)pOut->z) );
 86526  86822   
 86527  86823     assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
 86528         -  pOut->n = (int)nByte;
 86529         -  pOut->flags = MEM_Blob;
 86530         -  if( nZero ){
 86531         -    pOut->u.nZero = nZero;
 86532         -    pOut->flags |= MEM_Zero;
 86533         -  }
 86534  86824     REGISTER_TRACE(pOp->p3, pOut);
 86535         -  UPDATE_MAX_BLOBSIZE(pOut);
 86536  86825     break;
 86537  86826   }
 86538  86827   
 86539  86828   /* Opcode: Count P1 P2 * * *
 86540  86829   ** Synopsis: r[P2]=count()
 86541  86830   **
 86542  86831   ** Store the number of entries (an integer value) in the table or index 
................................................................................
 86558  86847     break;
 86559  86848   }
 86560  86849   #endif
 86561  86850   
 86562  86851   /* Opcode: Savepoint P1 * * P4 *
 86563  86852   **
 86564  86853   ** Open, release or rollback the savepoint named by parameter P4, depending
 86565         -** on the value of P1. To open a new savepoint, P1==0. To release (commit) an
 86566         -** existing savepoint, P1==1, or to rollback an existing savepoint P1==2.
        86854  +** on the value of P1. To open a new savepoint set P1==0 (SAVEPOINT_BEGIN).
        86855  +** To release (commit) an existing savepoint set P1==1 (SAVEPOINT_RELEASE).
        86856  +** To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK).
 86567  86857   */
 86568  86858   case OP_Savepoint: {
 86569  86859     int p1;                         /* Value of P1 operand */
 86570  86860     char *zName;                    /* Name of savepoint */
 86571  86861     int nName;
 86572  86862     Savepoint *pNew;
 86573  86863     Savepoint *pSavepoint;
................................................................................
 86627  86917           pNew->pNext = db->pSavepoint;
 86628  86918           db->pSavepoint = pNew;
 86629  86919           pNew->nDeferredCons = db->nDeferredCons;
 86630  86920           pNew->nDeferredImmCons = db->nDeferredImmCons;
 86631  86921         }
 86632  86922       }
 86633  86923     }else{
        86924  +    assert( p1==SAVEPOINT_RELEASE || p1==SAVEPOINT_ROLLBACK );
 86634  86925       iSavepoint = 0;
 86635  86926   
 86636  86927       /* Find the named savepoint. If there is no such savepoint, then an
 86637  86928       ** an error is returned to the user.  */
 86638  86929       for(
 86639  86930         pSavepoint = db->pSavepoint; 
 86640  86931         pSavepoint && sqlite3StrICmp(pSavepoint->zName, zName);
................................................................................
 86680  86971             for(ii=0; ii<db->nDb; ii++){
 86681  86972               rc = sqlite3BtreeTripAllCursors(db->aDb[ii].pBt,
 86682  86973                                          SQLITE_ABORT_ROLLBACK,
 86683  86974                                          isSchemaChange==0);
 86684  86975               if( rc!=SQLITE_OK ) goto abort_due_to_error;
 86685  86976             }
 86686  86977           }else{
        86978  +          assert( p1==SAVEPOINT_RELEASE );
 86687  86979             isSchemaChange = 0;
 86688  86980           }
 86689  86981           for(ii=0; ii<db->nDb; ii++){
 86690  86982             rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint);
 86691  86983             if( rc!=SQLITE_OK ){
 86692  86984               goto abort_due_to_error;
 86693  86985             }
................................................................................
 86716  87008           assert( pSavepoint==db->pSavepoint );
 86717  87009           db->pSavepoint = pSavepoint->pNext;
 86718  87010           sqlite3DbFree(db, pSavepoint);
 86719  87011           if( !isTransaction ){
 86720  87012             db->nSavepoint--;
 86721  87013           }
 86722  87014         }else{
        87015  +        assert( p1==SAVEPOINT_ROLLBACK );
 86723  87016           db->nDeferredCons = pSavepoint->nDeferredCons;
 86724  87017           db->nDeferredImmCons = pSavepoint->nDeferredImmCons;
 86725  87018         }
 86726  87019   
 86727  87020         if( !isTransaction || p1==SAVEPOINT_ROLLBACK ){
 86728  87021           rc = sqlite3VtabSavepoint(db, p1, iSavepoint);
 86729  87022           if( rc!=SQLITE_OK ) goto abort_due_to_error;
................................................................................
 87254  87547         SQLITE_OPEN_TRANSIENT_DB;
 87255  87548     assert( pOp->p1>=0 );
 87256  87549     assert( pOp->p2>=0 );
 87257  87550     pCx = p->apCsr[pOp->p1];
 87258  87551     if( pCx ){
 87259  87552       /* If the ephermeral table is already open, erase all existing content
 87260  87553       ** so that the table is empty again, rather than creating a new table. */
 87261         -    rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0);
        87554  +    assert( pCx->isEphemeral );
        87555  +    pCx->seqCount = 0;
        87556  +    pCx->cacheStatus = CACHE_STALE;
        87557  +    if( pCx->pBtx ){
        87558  +      rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0);
        87559  +    }
 87262  87560     }else{
 87263  87561       pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE);
 87264  87562       if( pCx==0 ) goto no_mem;
 87265         -    pCx->nullRow = 1;
 87266  87563       pCx->isEphemeral = 1;
 87267  87564       rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx, 
 87268  87565                             BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5,
 87269  87566                             vfsFlags);
 87270  87567       if( rc==SQLITE_OK ){
 87271  87568         rc = sqlite3BtreeBeginTrans(pCx->pBtx, 1, 0);
 87272  87569       }
................................................................................
 87294  87591                                   0, pCx->uc.pCursor);
 87295  87592           pCx->isTable = 1;
 87296  87593         }
 87297  87594       }
 87298  87595       pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
 87299  87596     }
 87300  87597     if( rc ) goto abort_due_to_error;
        87598  +  pCx->nullRow = 1;
 87301  87599     break;
 87302  87600   }
 87303  87601   
 87304  87602   /* Opcode: SorterOpen P1 P2 P3 P4 *
 87305  87603   **
 87306  87604   ** This opcode works like OP_OpenEphemeral except that it opens
 87307  87605   ** a transient index that is specifically designed to sort large
................................................................................
 87522  87820     oc = pOp->opcode;
 87523  87821     eqOnly = 0;
 87524  87822     pC->nullRow = 0;
 87525  87823   #ifdef SQLITE_DEBUG
 87526  87824     pC->seekOp = pOp->opcode;
 87527  87825   #endif
 87528  87826   
        87827  +  pC->deferredMoveto = 0;
        87828  +  pC->cacheStatus = CACHE_STALE;
 87529  87829     if( pC->isTable ){
 87530  87830       /* The BTREE_SEEK_EQ flag is only set on index cursors */
 87531  87831       assert( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ)==0
 87532  87832                 || CORRUPT_DB );
 87533  87833   
 87534  87834       /* The input value in P3 might be of any type: integer, real, string,
 87535  87835       ** blob, or NULL.  But it needs to be an integer before we can do
 87536  87836       ** the seek, so convert it. */
 87537  87837       pIn3 = &aMem[pOp->p3];
 87538         -    if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
        87838  +    if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Str))==MEM_Str ){
 87539  87839         applyNumericAffinity(pIn3, 0);
 87540  87840       }
 87541  87841       iKey = sqlite3VdbeIntValue(pIn3);
 87542  87842   
 87543  87843       /* If the P3 value could not be converted into an integer without
 87544  87844       ** loss of information, then special processing is required... */
 87545         -    if( (pIn3->flags & MEM_Int)==0 ){
        87845  +    if( (pIn3->flags & (MEM_Int|MEM_IntReal))==0 ){
 87546  87846         if( (pIn3->flags & MEM_Real)==0 ){
 87547         -        /* If the P3 value cannot be converted into any kind of a number,
 87548         -        ** then the seek is not possible, so jump to P2 */
 87549         -        VdbeBranchTaken(1,2); goto jump_to_p2;
 87550         -        break;
 87551         -      }
        87847  +        if( (pIn3->flags & MEM_Null) || oc>=OP_SeekGE ){
        87848  +          VdbeBranchTaken(1,2); goto jump_to_p2;
        87849  +          break;
        87850  +        }else{
        87851  +          rc = sqlite3BtreeLast(pC->uc.pCursor, &res);
        87852  +          if( rc!=SQLITE_OK ) goto abort_due_to_error;
        87853  +          goto seek_not_found;
        87854  +        }
        87855  +      }else
 87552  87856   
 87553  87857         /* If the approximation iKey is larger than the actual real search
 87554  87858         ** term, substitute >= for > and < for <=. e.g. if the search term
 87555  87859         ** is 4.9 and the integer approximation 5:
 87556  87860         **
 87557  87861         **        (x >  4.9)    ->     (x >= 5)
 87558  87862         **        (x <= 4.9)    ->     (x <  5)
................................................................................
 87568  87872         ** term, substitute <= for < and > for >=.  */
 87569  87873         else if( pIn3->u.r>(double)iKey ){
 87570  87874           assert( OP_SeekLE==(OP_SeekLT+1) );
 87571  87875           assert( OP_SeekGT==(OP_SeekGE+1) );
 87572  87876           assert( (OP_SeekLT & 0x0001)==(OP_SeekGE & 0x0001) );
 87573  87877           if( (oc & 0x0001)==(OP_SeekLT & 0x0001) ) oc++;
 87574  87878         }
 87575         -    } 
        87879  +    }
 87576  87880       rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)iKey, 0, &res);
 87577  87881       pC->movetoTarget = iKey;  /* Used by OP_Delete */
 87578  87882       if( rc!=SQLITE_OK ){
 87579  87883         goto abort_due_to_error;
 87580  87884       }
 87581  87885     }else{
 87582  87886       /* For a cursor with the BTREE_SEEK_EQ hint, only the OP_SeekGE and
................................................................................
 87622  87926         goto abort_due_to_error;
 87623  87927       }
 87624  87928       if( eqOnly && r.eqSeen==0 ){
 87625  87929         assert( res!=0 );
 87626  87930         goto seek_not_found;
 87627  87931       }
 87628  87932     }
 87629         -  pC->deferredMoveto = 0;
 87630         -  pC->cacheStatus = CACHE_STALE;
 87631  87933   #ifdef SQLITE_TEST
 87632  87934     sqlite3_search_count++;
 87633  87935   #endif
 87634  87936     if( oc>=OP_SeekGE ){  assert( oc==OP_SeekGE || oc==OP_SeekGT );
 87635  87937       if( res<0 || (res==0 && oc==OP_SeekGT) ){
 87636  87938         res = 0;
 87637  87939         rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
................................................................................
 87923  88225   case OP_SeekRowid: {        /* jump, in3 */
 87924  88226     VdbeCursor *pC;
 87925  88227     BtCursor *pCrsr;
 87926  88228     int res;
 87927  88229     u64 iKey;
 87928  88230   
 87929  88231     pIn3 = &aMem[pOp->p3];
 87930         -  if( (pIn3->flags & MEM_Int)==0 ){
        88232  +  testcase( pIn3->flags & MEM_Int );
        88233  +  testcase( pIn3->flags & MEM_IntReal );
        88234  +  if( (pIn3->flags & (MEM_Int|MEM_IntReal))==0 ){
 87931  88235       /* Make sure pIn3->u.i contains a valid integer representation of
 87932  88236       ** the key value, but do not change the datatype of the register, as
 87933  88237       ** other parts of the perpared statement might be depending on the
 87934  88238       ** current datatype. */
 87935  88239       u16 origFlags = pIn3->flags;
 87936  88240       int isNotInt;
 87937  88241       applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding);
................................................................................
 88298  88602   
 88299  88603   #ifdef SQLITE_DEBUG
 88300  88604     if( pOp->p4type==P4_TABLE && HasRowid(pOp->p4.pTab) && pOp->p5==0 ){
 88301  88605       /* If p5 is zero, the seek operation that positioned the cursor prior to
 88302  88606       ** OP_Delete will have also set the pC->movetoTarget field to the rowid of
 88303  88607       ** the row that is being deleted */
 88304  88608       i64 iKey = sqlite3BtreeIntegerKey(pC->uc.pCursor);
 88305         -    assert( pC->movetoTarget==iKey );
        88609  +    assert( CORRUPT_DB || pC->movetoTarget==iKey );
 88306  88610     }
 88307  88611   #endif
 88308  88612   
 88309  88613     /* If the update-hook or pre-update-hook will be invoked, set zDb to
 88310  88614     ** the name of the db to pass as to it. Also set local pTab to a copy
 88311  88615     ** of p4.pTab. Finally, if p5 is true, indicating that this cursor was
 88312  88616     ** last moved with OP_Next or OP_Prev, not Seek or NotFound, set 
................................................................................
 95256  95560     }
 95257  95561     zSpan += n+1;
 95258  95562     if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){
 95259  95563       return 0;
 95260  95564     }
 95261  95565     return 1;
 95262  95566   }
        95567  +
        95568  +/*
        95569  +** Return TRUE if the double-quoted string  mis-feature should be supported.
        95570  +*/
        95571  +static int areDoubleQuotedStringsEnabled(sqlite3 *db, NameContext *pTopNC){
        95572  +  if( db->init.busy ) return 1;  /* Always support for legacy schemas */
        95573  +  if( pTopNC->ncFlags & NC_IsDDL ){
        95574  +    /* Currently parsing a DDL statement */
        95575  +    if( sqlite3WritableSchema(db) && (db->flags & SQLITE_DqsDML)!=0 ){
        95576  +      return 1;
        95577  +    }
        95578  +    return (db->flags & SQLITE_DqsDDL)!=0;
        95579  +  }else{
        95580  +    /* Currently parsing a DML statement */
        95581  +    return (db->flags & SQLITE_DqsDML)!=0;
        95582  +  }
        95583  +}
 95263  95584   
 95264  95585   /*
 95265  95586   ** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up
 95266  95587   ** that name in the set of source tables in pSrcList and make the pExpr 
 95267  95588   ** expression node refer back to that source column.  The following changes
 95268  95589   ** are made to pExpr:
 95269  95590   **
................................................................................
 95585  95906     ** pExpr.
 95586  95907     **
 95587  95908     ** Because no reference was made to outer contexts, the pNC->nRef
 95588  95909     ** fields are not changed in any context.
 95589  95910     */
 95590  95911     if( cnt==0 && zTab==0 ){
 95591  95912       assert( pExpr->op==TK_ID );
 95592         -    if( ExprHasProperty(pExpr,EP_DblQuoted) ){
        95913  +    if( ExprHasProperty(pExpr,EP_DblQuoted)
        95914  +     && areDoubleQuotedStringsEnabled(db, pTopNC)
        95915  +    ){
 95593  95916         /* If a double-quoted identifier does not match any known column name,
 95594  95917         ** then treat it as a string.
 95595  95918         **
 95596  95919         ** This hack was added in the early days of SQLite in a misguided attempt
 95597  95920         ** to be compatible with MySQL 3.x, which used double-quotes for strings.
 95598  95921         ** I now sorely regret putting in this hack. The effect of this hack is
 95599  95922         ** that misspelled identifier names are silently converted into strings
................................................................................
 95854  96177             no_such_func = 1;
 95855  96178           }else{
 95856  96179             wrong_num_args = 1;
 95857  96180           }
 95858  96181         }else{
 95859  96182           is_agg = pDef->xFinalize!=0;
 95860  96183           if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){
 95861         -          ExprSetProperty(pExpr, EP_Unlikely|EP_Skip);
        96184  +          ExprSetProperty(pExpr, EP_Unlikely);
 95862  96185             if( n==2 ){
 95863  96186               pExpr->iTable = exprProbability(pList->a[1].pExpr);
 95864  96187               if( pExpr->iTable<0 ){
 95865  96188                 sqlite3ErrorMsg(pParse,
 95866  96189                   "second argument to likelihood() must be a "
 95867  96190                   "constant between 0.0 and 1.0");
 95868  96191                 pNC->nErr++;
................................................................................
 95975  96298           }
 95976  96299         }
 95977  96300         sqlite3WalkExprList(pWalker, pList);
 95978  96301         if( is_agg ){
 95979  96302   #ifndef SQLITE_OMIT_WINDOWFUNC
 95980  96303           if( pExpr->y.pWin ){
 95981  96304             Select *pSel = pNC->pWinSelect;
 95982         -          sqlite3WindowUpdate(pParse, pSel->pWinDefn, pExpr->y.pWin, pDef);
        96305  +          if( IN_RENAME_OBJECT==0 ){
        96306  +            sqlite3WindowUpdate(pParse, pSel->pWinDefn, pExpr->y.pWin, pDef);
        96307  +          }
 95983  96308             sqlite3WalkExprList(pWalker, pExpr->y.pWin->pPartition);
 95984  96309             sqlite3WalkExprList(pWalker, pExpr->y.pWin->pOrderBy);
 95985  96310             sqlite3WalkExpr(pWalker, pExpr->y.pWin->pFilter);
 95986  96311             if( 0==pSel->pWin 
 95987  96312              || 0==sqlite3WindowCompare(pParse, pSel->pWin, pExpr->y.pWin) 
 95988  96313             ){
 95989  96314               pExpr->y.pWin->pNextWin = pSel->pWin;
................................................................................
 96035  96360       }
 96036  96361       case TK_VARIABLE: {
 96037  96362         notValid(pParse, pNC, "parameters", NC_IsCheck|NC_PartIdx|NC_IdxExpr);
 96038  96363         break;
 96039  96364       }
 96040  96365       case TK_IS:
 96041  96366       case TK_ISNOT: {
 96042         -      Expr *pRight;
        96367  +      Expr *pRight = sqlite3ExprSkipCollate(pExpr->pRight);
 96043  96368         assert( !ExprHasProperty(pExpr, EP_Reduced) );
 96044  96369         /* Handle special cases of "x IS TRUE", "x IS FALSE", "x IS NOT TRUE",
 96045  96370         ** and "x IS NOT FALSE". */
 96046         -      if( (pRight = pExpr->pRight)->op==TK_ID ){
        96371  +      if( pRight->op==TK_ID ){
 96047  96372           int rc = resolveExprStep(pWalker, pRight);
 96048  96373           if( rc==WRC_Abort ) return WRC_Abort;
 96049  96374           if( pRight->op==TK_TRUEFALSE ){
 96050  96375             pExpr->op2 = pExpr->op;
 96051  96376             pExpr->op = TK_TRUTH;
 96052  96377             return WRC_Continue;
 96053  96378           }
................................................................................
 96761  97086   ** An error message is left in pParse if anything is amiss.  The number
 96762  97087   ** if errors is returned.
 96763  97088   */
 96764  97089   SQLITE_PRIVATE int sqlite3ResolveExprNames( 
 96765  97090     NameContext *pNC,       /* Namespace to resolve expressions in. */
 96766  97091     Expr *pExpr             /* The expression to be analyzed. */
 96767  97092   ){
 96768         -  u16 savedHasAgg;
        97093  +  int savedHasAgg;
 96769  97094     Walker w;
 96770  97095   
 96771  97096     if( pExpr==0 ) return SQLITE_OK;
 96772  97097     savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin);
 96773  97098     pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin);
 96774  97099     w.pParse = pNC->pParse;
 96775  97100     w.xExprCallback = resolveExprStep;
................................................................................
 96875  97200       sSrc.nSrc = 1;
 96876  97201       sSrc.a[0].zName = pTab->zName;
 96877  97202       sSrc.a[0].pTab = pTab;
 96878  97203       sSrc.a[0].iCursor = -1;
 96879  97204     }
 96880  97205     sNC.pParse = pParse;
 96881  97206     sNC.pSrcList = &sSrc;
 96882         -  sNC.ncFlags = type;
        97207  +  sNC.ncFlags = type | NC_IsDDL;
 96883  97208     if( (rc = sqlite3ResolveExprNames(&sNC, pExpr))!=SQLITE_OK ) return rc;
 96884  97209     if( pList ) rc = sqlite3ResolveExprListNames(&sNC, pList);
 96885  97210     return rc;
 96886  97211   }
 96887  97212   
 96888  97213   /************** End of resolve.c *********************************************/
 96889  97214   /************** Begin file expr.c ********************************************/
................................................................................
 96929  97254   ** CREATE TABLE t1(a);
 96930  97255   ** SELECT * FROM t1 WHERE a;
 96931  97256   ** SELECT a AS b FROM t1 WHERE b;
 96932  97257   ** SELECT * FROM t1 WHERE (select a from t1);
 96933  97258   */
 96934  97259   SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr){
 96935  97260     int op;
 96936         -  pExpr = sqlite3ExprSkipCollate(pExpr);
 96937  97261     if( pExpr->flags & EP_Generic ) return 0;
        97262  +  while( ExprHasProperty(pExpr, EP_Skip) ){
        97263  +    assert( pExpr->op==TK_COLLATE );
        97264  +    pExpr = pExpr->pLeft;
        97265  +    assert( pExpr!=0 );
        97266  +  }
 96938  97267     op = pExpr->op;
 96939  97268     if( op==TK_SELECT ){
 96940  97269       assert( pExpr->flags&EP_xIsSelect );
 96941  97270       return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr);
 96942  97271     }
 96943  97272     if( op==TK_REGISTER ) op = pExpr->op2;
 96944  97273   #ifndef SQLITE_OMIT_CAST
................................................................................
 96991  97320   }
 96992  97321   
 96993  97322   /*
 96994  97323   ** Skip over any TK_COLLATE operators and any unlikely()
 96995  97324   ** or likelihood() function at the root of an expression.
 96996  97325   */
 96997  97326   SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr *pExpr){
 96998         -  while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){
        97327  +  while( pExpr && ExprHasProperty(pExpr, EP_Skip|EP_Unlikely) ){
 96999  97328       if( ExprHasProperty(pExpr, EP_Unlikely) ){
 97000  97329         assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
 97001  97330         assert( pExpr->x.pList->nExpr>0 );
 97002  97331         assert( pExpr->op==TK_FUNCTION );
 97003  97332         pExpr = pExpr->x.pList->a[0].pExpr;
 97004  97333       }else{
 97005  97334         assert( pExpr->op==TK_COLLATE );
................................................................................
 97658  97987     pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra);
 97659  97988     if( pNew ){
 97660  97989       memset(pNew, 0, sizeof(Expr));
 97661  97990       pNew->op = (u8)op;
 97662  97991       pNew->iAgg = -1;
 97663  97992       if( pToken ){
 97664  97993         if( nExtra==0 ){
 97665         -        pNew->flags |= EP_IntValue|EP_Leaf;
        97994  +        pNew->flags |= EP_IntValue|EP_Leaf|(iValue?EP_IsTrue:EP_IsFalse);
 97666  97995           pNew->u.iValue = iValue;
 97667  97996         }else{
 97668  97997           pNew->u.zToken = (char*)&pNew[1];
 97669  97998           assert( pToken->z!=0 || pToken->n==0 );
 97670  97999           if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
 97671  98000           pNew->u.zToken[pToken->n] = 0;
 97672  98001           if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
................................................................................
 97735  98064   SQLITE_PRIVATE Expr *sqlite3PExpr(
 97736  98065     Parse *pParse,          /* Parsing context */
 97737  98066     int op,                 /* Expression opcode */
 97738  98067     Expr *pLeft,            /* Left operand */
 97739  98068     Expr *pRight            /* Right operand */
 97740  98069   ){
 97741  98070     Expr *p;
 97742         -  if( op==TK_AND && pParse->nErr==0 && !IN_RENAME_OBJECT ){
 97743         -    /* Take advantage of short-circuit false optimization for AND */
 97744         -    p = sqlite3ExprAnd(pParse->db, pLeft, pRight);
 97745         -  }else{
 97746         -    p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr));
 97747         -    if( p ){
 97748         -      memset(p, 0, sizeof(Expr));
 97749         -      p->op = op & 0xff;
 97750         -      p->iAgg = -1;
 97751         -    }
        98071  +  p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr));
        98072  +  if( p ){
        98073  +    memset(p, 0, sizeof(Expr));
        98074  +    p->op = op & 0xff;
        98075  +    p->iAgg = -1;
 97752  98076       sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight);
 97753         -  }
 97754         -  if( p ) {
 97755  98077       sqlite3ExprCheckHeight(pParse, p->nHeight);
        98078  +  }else{
        98079  +    sqlite3ExprDelete(pParse->db, pLeft);
        98080  +    sqlite3ExprDelete(pParse->db, pRight);
 97756  98081     }
 97757  98082     return p;
 97758  98083   }
 97759  98084   
 97760  98085   /*
 97761  98086   ** Add pSelect to the Expr.x.pSelect field.  Or, if pExpr is NULL (due
 97762  98087   ** do a memory allocation failure) then delete the pSelect object.
................................................................................
 97769  98094     }else{
 97770  98095       assert( pParse->db->mallocFailed );
 97771  98096       sqlite3SelectDelete(pParse->db, pSelect);
 97772  98097     }
 97773  98098   }
 97774  98099   
 97775  98100   
 97776         -/*
 97777         -** If the expression is always either TRUE or FALSE (respectively),
 97778         -** then return 1.  If one cannot determine the truth value of the
 97779         -** expression at compile-time return 0.
 97780         -**
 97781         -** This is an optimization.  If is OK to return 0 here even if
 97782         -** the expression really is always false or false (a false negative).
 97783         -** But it is a bug to return 1 if the expression might have different
 97784         -** boolean values in different circumstances (a false positive.)
 97785         -**
 97786         -** Note that if the expression is part of conditional for a
 97787         -** LEFT JOIN, then we cannot determine at compile-time whether or not
 97788         -** is it true or false, so always return 0.
 97789         -*/
 97790         -static int exprAlwaysTrue(Expr *p){
 97791         -  int v = 0;
 97792         -  if( ExprHasProperty(p, EP_FromJoin) ) return 0;
 97793         -  if( !sqlite3ExprIsInteger(p, &v) ) return 0;
 97794         -  return v!=0;
 97795         -}
 97796         -static int exprAlwaysFalse(Expr *p){
 97797         -  int v = 0;
 97798         -  if( ExprHasProperty(p, EP_FromJoin) ) return 0;
 97799         -  if( !sqlite3ExprIsInteger(p, &v) ) return 0;
 97800         -  return v==0;
 97801         -}
 97802         -
 97803  98101   /*
 97804  98102   ** Join two expressions using an AND operator.  If either expression is
 97805  98103   ** NULL, then just return the other expression.
 97806  98104   **
 97807  98105   ** If one side or the other of the AND is known to be false, then instead
 97808  98106   ** of returning an AND expression, just return a constant expression with
 97809  98107   ** a value of false.
 97810  98108   */
 97811         -SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){
 97812         -  if( pLeft==0 ){
        98109  +SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){
        98110  +  sqlite3 *db = pParse->db;
        98111  +  if( pLeft==0  ){
 97813  98112       return pRight;
 97814  98113     }else if( pRight==0 ){
 97815  98114       return pLeft;
 97816         -  }else if( exprAlwaysFalse(pLeft) || exprAlwaysFalse(pRight) ){
 97817         -    sqlite3ExprDelete(db, pLeft);
 97818         -    sqlite3ExprDelete(db, pRight);
        98115  +  }else if( ExprAlwaysFalse(pLeft) || ExprAlwaysFalse(pRight) ){
        98116  +    sqlite3ExprUnmapAndDelete(pParse, pLeft);
        98117  +    sqlite3ExprUnmapAndDelete(pParse, pRight);
 97819  98118       return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0);
 97820  98119     }else{
 97821         -    Expr *pNew = sqlite3ExprAlloc(db, TK_AND, 0, 0);
 97822         -    sqlite3ExprAttachSubtrees(db, pNew, pLeft, pRight);
 97823         -    return pNew;
        98120  +    return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
 97824  98121     }
 97825  98122   }
 97826  98123   
 97827  98124   /*
 97828  98125   ** Construct a new expression node for a function with multiple
 97829  98126   ** arguments.
 97830  98127   */
................................................................................
 97972  98269     if( !ExprHasProperty(p, EP_Static) ){
 97973  98270       sqlite3DbFreeNN(db, p);
 97974  98271     }
 97975  98272   }
 97976  98273   SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){
 97977  98274     if( p ) sqlite3ExprDeleteNN(db, p);
 97978  98275   }
        98276  +
        98277  +/* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the
        98278  +** expression.
        98279  +*/
        98280  +SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse *pParse, Expr *p){
        98281  +  if( p ){
        98282  +    if( IN_RENAME_OBJECT ){
        98283  +      sqlite3RenameExprUnmap(pParse, p);
        98284  +    }
        98285  +    sqlite3ExprDeleteNN(pParse->db, p);
        98286  +  }
        98287  +}
 97979  98288   
 97980  98289   /*
 97981  98290   ** Return the number of bytes allocated for the expression structure 
 97982  98291   ** passed as the first argument. This is always one of EXPR_FULLSIZE,
 97983  98292   ** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE.
 97984  98293   */
 97985  98294   static int exprStructSize(Expr *p){
................................................................................
 98555  98864   
 98556  98865       /* Remember the size of the LHS in iTable so that we can check that
 98557  98866       ** the RHS and LHS sizes match during code generation. */
 98558  98867       pFirst->iTable = pColumns->nId;
 98559  98868     }
 98560  98869   
 98561  98870   vector_append_error:
 98562         -  if( IN_RENAME_OBJECT ){
 98563         -    sqlite3RenameExprUnmap(pParse, pExpr);
 98564         -  }
 98565         -  sqlite3ExprDelete(db, pExpr);
        98871  +  sqlite3ExprUnmapAndDelete(pParse, pExpr);
 98566  98872     sqlite3IdListDelete(db, pColumns);
 98567  98873     return pList;
 98568  98874   }
 98569  98875   
 98570  98876   /*
 98571  98877   ** Set the sort order for the last element on the given ExprList.
 98572  98878   */
................................................................................
 98706  99012   SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr *pExpr){
 98707  99013     assert( pExpr->op==TK_ID || pExpr->op==TK_STRING );
 98708  99014     if( !ExprHasProperty(pExpr, EP_Quoted)
 98709  99015      && (sqlite3StrICmp(pExpr->u.zToken, "true")==0
 98710  99016          || sqlite3StrICmp(pExpr->u.zToken, "false")==0)
 98711  99017     ){
 98712  99018       pExpr->op = TK_TRUEFALSE;
        99019  +    ExprSetProperty(pExpr, pExpr->u.zToken[4]==0 ? EP_IsTrue : EP_IsFalse);
 98713  99020       return 1;
 98714  99021     }
 98715  99022     return 0;
 98716  99023   }
 98717  99024   
 98718  99025   /*
 98719  99026   ** The argument must be a TK_TRUEFALSE Expr node.  Return 1 if it is TRUE
 98720  99027   ** and 0 if it is FALSE.
 98721  99028   */
 98722  99029   SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr *pExpr){
        99030  +  pExpr = sqlite3ExprSkipCollate((Expr*)pExpr);
 98723  99031     assert( pExpr->op==TK_TRUEFALSE );
 98724  99032     assert( sqlite3StrICmp(pExpr->u.zToken,"true")==0
 98725  99033          || sqlite3StrICmp(pExpr->u.zToken,"false")==0 );
 98726  99034     return pExpr->u.zToken[4]==0;
 98727  99035   }
        99036  +
        99037  +/*
        99038  +** If pExpr is an AND or OR expression, try to simplify it by eliminating
        99039  +** terms that are always true or false.  Return the simplified expression.
        99040  +** Or return the original expression if no simplification is possible.
        99041  +**
        99042  +** Examples:
        99043  +**
        99044  +**     (x<10) AND true                =>   (x<10)
        99045  +**     (x<10) AND false               =>   false
        99046  +**     (x<10) AND (y=22 OR false)     =>   (x<10) AND (y=22)
        99047  +**     (x<10) AND (y=22 OR true)      =>   (x<10)
        99048  +**     (y=22) OR true                 =>   true
        99049  +*/
        99050  +SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){
        99051  +  assert( pExpr!=0 );
        99052  +  if( pExpr->op==TK_AND || pExpr->op==TK_OR ){
        99053  +    Expr *pRight = sqlite3ExprSimplifiedAndOr(pExpr->pRight);
        99054  +    Expr *pLeft = sqlite3ExprSimplifiedAndOr(pExpr->pLeft);
        99055  +    if( ExprAlwaysTrue(pLeft) || ExprAlwaysFalse(pRight) ){
        99056  +      pExpr = pExpr->op==TK_AND ? pRight : pLeft;
        99057  +    }else if( ExprAlwaysTrue(pRight) || ExprAlwaysFalse(pLeft) ){
        99058  +      pExpr = pExpr->op==TK_AND ? pLeft : pRight;
        99059  +    }
        99060  +  }
        99061  +  return pExpr;
        99062  +}
 98728  99063   
 98729  99064   
 98730  99065   /*
 98731  99066   ** These routines are Walker callbacks used to check expressions to
 98732  99067   ** see if they are "constant" for some definition of constant.  The
 98733  99068   ** Walker.eCode value determines the type of "constant" we are looking
 98734  99069   ** for.
................................................................................
 98966  99301   ** If the expression p codes a constant integer that is small enough
 98967  99302   ** to fit in a 32-bit integer, return 1 and put the value of the integer
 98968  99303   ** in *pValue.  If the expression is not an integer or if it is too big
 98969  99304   ** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.
 98970  99305   */
 98971  99306   SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){
 98972  99307     int rc = 0;
 98973         -  if( p==0 ) return 0;  /* Can only happen following on OOM */
        99308  +  if( NEVER(p==0) ) return 0;  /* Used to only happen following on OOM */
 98974  99309   
 98975  99310     /* If an expression is an integer literal that fits in a signed 32-bit
 98976  99311     ** integer, then the EP_IntValue flag will have already been set */
 98977  99312     assert( p->op!=TK_INTEGER || (p->flags & EP_IntValue)!=0
 98978  99313              || sqlite3GetInt32(p->u.zToken, &rc)==0 );
 98979  99314   
 98980  99315     if( p->flags & EP_IntValue ){
................................................................................
 99695 100030         /* If the expression is not constant then we will need to
 99696 100031         ** disable the test that was generated above that makes sure
 99697 100032         ** this code only executes once.  Because for a non-constant
 99698 100033         ** expression we need to rerun this code each time.
 99699 100034         */
 99700 100035         if( addrOnce && !sqlite3ExprIsConstant(pE2) ){
 99701 100036           sqlite3VdbeChangeToNoop(v, addrOnce);
       100037  +        ExprClearProperty(pExpr, EP_Subrtn);
 99702 100038           addrOnce = 0;
 99703 100039         }
 99704 100040   
 99705 100041         /* Evaluate the expression and insert it into the temp table */
 99706 100042         r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
 99707 100043         sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
 99708 100044         sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1);
................................................................................
100261 100597   }
100262 100598   
100263 100599   /*
100264 100600   ** Convert a scalar expression node to a TK_REGISTER referencing
100265 100601   ** register iReg.  The caller must ensure that iReg already contains
100266 100602   ** the correct value for the expression.
100267 100603   */
100268         -static void exprToRegister(Expr *p, int iReg){
       100604  +static void exprToRegister(Expr *pExpr, int iReg){
       100605  +  Expr *p = sqlite3ExprSkipCollate(pExpr);
100269 100606     p->op2 = p->op;
100270 100607     p->op = TK_REGISTER;
100271 100608     p->iTable = iReg;
100272 100609     ExprClearProperty(p, EP_Skip);
100273 100610   }
100274 100611   
100275 100612   /*
................................................................................
101313 101650     int r1, r2;
101314 101651   
101315 101652     assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );
101316 101653     if( NEVER(v==0) )     return;  /* Existence of VDBE checked by caller */
101317 101654     if( NEVER(pExpr==0) ) return;  /* No way this can happen */
101318 101655     op = pExpr->op;
101319 101656     switch( op ){
101320         -    case TK_AND: {
101321         -      int d2 = sqlite3VdbeMakeLabel(pParse);
101322         -      testcase( jumpIfNull==0 );
101323         -      sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL);
101324         -      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
101325         -      sqlite3VdbeResolveLabel(v, d2);
101326         -      break;
101327         -    }
       101657  +    case TK_AND:
101328 101658       case TK_OR: {
101329         -      testcase( jumpIfNull==0 );
101330         -      sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
101331         -      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
       101659  +      Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
       101660  +      if( pAlt!=pExpr ){
       101661  +        sqlite3ExprIfTrue(pParse, pAlt, dest, jumpIfNull);
       101662  +      }else if( op==TK_AND ){
       101663  +        int d2 = sqlite3VdbeMakeLabel(pParse);
       101664  +        testcase( jumpIfNull==0 );
       101665  +        sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,
       101666  +                           jumpIfNull^SQLITE_JUMPIFNULL);
       101667  +        sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
       101668  +        sqlite3VdbeResolveLabel(v, d2);
       101669  +      }else{
       101670  +        testcase( jumpIfNull==0 );
       101671  +        sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
       101672  +        sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
       101673  +      }
101332 101674         break;
101333 101675       }
101334 101676       case TK_NOT: {
101335 101677         testcase( jumpIfNull==0 );
101336 101678         sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
101337 101679         break;
101338 101680       }
................................................................................
101410 101752         sqlite3VdbeGoto(v, dest);
101411 101753         sqlite3VdbeResolveLabel(v, destIfFalse);
101412 101754         break;
101413 101755       }
101414 101756   #endif
101415 101757       default: {
101416 101758       default_expr:
101417         -      if( exprAlwaysTrue(pExpr) ){
       101759  +      if( ExprAlwaysTrue(pExpr) ){
101418 101760           sqlite3VdbeGoto(v, dest);
101419         -      }else if( exprAlwaysFalse(pExpr) ){
       101761  +      }else if( ExprAlwaysFalse(pExpr) ){
101420 101762           /* No-op */
101421 101763         }else{
101422 101764           r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);
101423 101765           sqlite3VdbeAddOp3(v, OP_If, r1, dest, jumpIfNull!=0);
101424 101766           VdbeCoverage(v);
101425 101767           testcase( regFree1==0 );
101426 101768           testcase( jumpIfNull==0 );
................................................................................
101480 101822     assert( pExpr->op!=TK_EQ || op==OP_Ne );
101481 101823     assert( pExpr->op!=TK_LT || op==OP_Ge );
101482 101824     assert( pExpr->op!=TK_LE || op==OP_Gt );
101483 101825     assert( pExpr->op!=TK_GT || op==OP_Le );
101484 101826     assert( pExpr->op!=TK_GE || op==OP_Lt );
101485 101827   
101486 101828     switch( pExpr->op ){
101487         -    case TK_AND: {
101488         -      testcase( jumpIfNull==0 );
101489         -      sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
101490         -      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
101491         -      break;
101492         -    }
       101829  +    case TK_AND:
101493 101830       case TK_OR: {
101494         -      int d2 = sqlite3VdbeMakeLabel(pParse);
101495         -      testcase( jumpIfNull==0 );
101496         -      sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL);
101497         -      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
101498         -      sqlite3VdbeResolveLabel(v, d2);
       101831  +      Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
       101832  +      if( pAlt!=pExpr ){
       101833  +        sqlite3ExprIfFalse(pParse, pAlt, dest, jumpIfNull);
       101834  +      }else if( pExpr->op==TK_AND ){
       101835  +        testcase( jumpIfNull==0 );
       101836  +        sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
       101837  +        sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
       101838  +      }else{
       101839  +        int d2 = sqlite3VdbeMakeLabel(pParse);
       101840  +        testcase( jumpIfNull==0 );
       101841  +        sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2,
       101842  +                          jumpIfNull^SQLITE_JUMPIFNULL);
       101843  +        sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
       101844  +        sqlite3VdbeResolveLabel(v, d2);
       101845  +      }
101499 101846         break;
101500 101847       }
101501 101848       case TK_NOT: {
101502 101849         testcase( jumpIfNull==0 );
101503 101850         sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
101504 101851         break;
101505 101852       }
................................................................................
101580 101927           sqlite3VdbeResolveLabel(v, destIfNull);
101581 101928         }
101582 101929         break;
101583 101930       }
101584 101931   #endif
101585 101932       default: {
101586 101933       default_expr: 
101587         -      if( exprAlwaysFalse(pExpr) ){
       101934  +      if( ExprAlwaysFalse(pExpr) ){
101588 101935           sqlite3VdbeGoto(v, dest);
101589         -      }else if( exprAlwaysTrue(pExpr) ){
       101936  +      }else if( ExprAlwaysTrue(pExpr) ){
101590 101937           /* no-op */
101591 101938         }else{
101592 101939           r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);
101593 101940           sqlite3VdbeAddOp3(v, OP_IfNot, r1, dest, jumpIfNull!=0);
101594 101941           VdbeCoverage(v);
101595 101942           testcase( regFree1==0 );
101596 101943           testcase( jumpIfNull==0 );
................................................................................
101738 102085       if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2;
101739 102086       if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
101740 102087       if( pA->op!=TK_STRING
101741 102088        && pA->op!=TK_TRUEFALSE
101742 102089        && (combinedFlags & EP_Reduced)==0
101743 102090       ){
101744 102091         if( pA->iColumn!=pB->iColumn ) return 2;
       102092  +      if( pA->op2!=pB->op2 ) return 2;
101745 102093         if( pA->iTable!=pB->iTable 
101746 102094          && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
101747 102095       }
101748 102096     }
101749 102097     return 0;
101750 102098   }
101751 102099   
................................................................................
101784 102132   */
101785 102133   SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
101786 102134     return sqlite3ExprCompare(0,
101787 102135                sqlite3ExprSkipCollate(pA),
101788 102136                sqlite3ExprSkipCollate(pB),
101789 102137                iTab);
101790 102138   }
       102139  +
       102140  +/*
       102141  +** Return non-zero if Expr p can only be true if pNN is not NULL.
       102142  +*/
       102143  +static int exprImpliesNotNull(
       102144  +  Parse *pParse,      /* Parsing context */
       102145  +  Expr *p,            /* The expression to be checked */
       102146  +  Expr *pNN,          /* The expression that is NOT NULL */
       102147  +  int iTab,           /* Table being evaluated */
       102148  +  int seenNot         /* True if p is an operand of NOT */
       102149  +){
       102150  +  assert( p );
       102151  +  assert( pNN );
       102152  +  if( sqlite3ExprCompare(pParse, p, pNN, iTab)==0 ) return 1;
       102153  +  switch( p->op ){
       102154  +    case TK_IN: {
       102155  +      if( seenNot && ExprHasProperty(p, EP_xIsSelect) ) return 0;
       102156  +      assert( ExprHasProperty(p,EP_xIsSelect)
       102157  +           || (p->x.pList!=0 && p->x.pList->nExpr>0) );
       102158  +      return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot);
       102159  +    }
       102160  +    case TK_BETWEEN: {
       102161  +      ExprList *pList = p->x.pList;
       102162  +      assert( pList!=0 );
       102163  +      assert( pList->nExpr==2 );
       102164  +      if( seenNot ) return 0;
       102165  +      if( exprImpliesNotNull(pParse, pList->a[0].pExpr, pNN, iTab, seenNot)
       102166  +       || exprImpliesNotNull(pParse, pList->a[1].pExpr, pNN, iTab, seenNot)
       102167  +      ){
       102168  +        return 1;
       102169  +      }
       102170  +      return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot);
       102171  +    }
       102172  +    case TK_EQ:
       102173  +    case TK_NE:
       102174  +    case TK_LT:
       102175  +    case TK_LE:
       102176  +    case TK_GT:
       102177  +    case TK_GE:
       102178  +    case TK_PLUS:
       102179  +    case TK_MINUS:
       102180  +    case TK_STAR:
       102181  +    case TK_REM:
       102182  +    case TK_BITAND:
       102183  +    case TK_BITOR:
       102184  +    case TK_SLASH:
       102185  +    case TK_LSHIFT:
       102186  +    case TK_RSHIFT: 
       102187  +    case TK_CONCAT: {
       102188  +      if( exprImpliesNotNull(pParse, p->pRight, pNN, iTab, seenNot) ) return 1;
       102189  +      /* Fall thru into the next case */
       102190  +    }
       102191  +    case TK_SPAN:
       102192  +    case TK_COLLATE:
       102193  +    case TK_BITNOT:
       102194  +    case TK_UPLUS:
       102195  +    case TK_UMINUS: {
       102196  +      return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot);
       102197  +    }
       102198  +    case TK_TRUTH: {
       102199  +      if( seenNot ) return 0;
       102200  +      if( p->op2!=TK_IS ) return 0;
       102201  +      return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot);
       102202  +    }
       102203  +    case TK_NOT: {
       102204  +      return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, 1);
       102205  +    }
       102206  +  }
       102207  +  return 0;
       102208  +}
101791 102209   
101792 102210   /*
101793 102211   ** Return true if we can prove the pE2 will always be true if pE1 is
101794 102212   ** true.  Return false if we cannot complete the proof or if pE2 might
101795 102213   ** be false.  Examples:
101796 102214   **
101797 102215   **     pE1: x==5       pE2: x==5             Result: true
................................................................................
101820 102238     }
101821 102239     if( pE2->op==TK_OR
101822 102240      && (sqlite3ExprImpliesExpr(pParse, pE1, pE2->pLeft, iTab)
101823 102241                || sqlite3ExprImpliesExpr(pParse, pE1, pE2->pRight, iTab) )
101824 102242     ){
101825 102243       return 1;
101826 102244     }
101827         -  if( pE2->op==TK_NOTNULL && pE1->op!=TK_ISNULL && pE1->op!=TK_IS ){
101828         -    Expr *pX = sqlite3ExprSkipCollate(pE1->pLeft);
101829         -    testcase( pX!=pE1->pLeft );
101830         -    if( sqlite3ExprCompare(pParse, pX, pE2->pLeft, iTab)==0 ) return 1;
       102245  +  if( pE2->op==TK_NOTNULL
       102246  +   && exprImpliesNotNull(pParse, pE1, pE2->pLeft, iTab, 0)
       102247  +  ){
       102248  +    return 1;
101831 102249     }
101832 102250     return 0;
101833 102251   }
101834 102252   
101835 102253   /*
101836 102254   ** This is the Expr node callback for sqlite3ExprImpliesNotNullRow().
101837 102255   ** If the expression node requires that the table at pWalker->iCur
................................................................................
102397 102815   ** statement to ensure that the operation has not rendered any schema
102398 102816   ** objects unusable.
102399 102817   */
102400 102818   static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){
102401 102819     sqlite3NestedParse(pParse, 
102402 102820         "SELECT 1 "
102403 102821         "FROM \"%w\".%s "
102404         -      "WHERE name NOT LIKE 'sqlite_%%'"
       102822  +      "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
102405 102823         " AND sql NOT LIKE 'create virtual%%'"
102406 102824         " AND sqlite_rename_test(%Q, sql, type, name, %d)=NULL ",
102407 102825         zDb, MASTER_NAME, 
102408 102826         zDb, bTemp
102409 102827     );
102410 102828   
102411 102829     if( bTemp==0 ){
102412 102830       sqlite3NestedParse(pParse, 
102413 102831           "SELECT 1 "
102414 102832           "FROM temp.%s "
102415         -        "WHERE name NOT LIKE 'sqlite_%%'"
       102833  +        "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
102416 102834           " AND sql NOT LIKE 'create virtual%%'"
102417 102835           " AND sqlite_rename_test(%Q, sql, type, name, 1)=NULL ",
102418 102836           MASTER_NAME, zDb 
102419 102837       );
102420 102838     }
102421 102839   }
102422 102840   
................................................................................
102529 102947   
102530 102948     /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in
102531 102949     ** the schema to use the new table name.  */
102532 102950     sqlite3NestedParse(pParse, 
102533 102951         "UPDATE \"%w\".%s SET "
102534 102952         "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) "
102535 102953         "WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)"
102536         -      "AND   name NOT LIKE 'sqlite_%%'"
       102954  +      "AND   name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
102537 102955         , zDb, MASTER_NAME, zDb, zTabName, zName, (iDb==1), zTabName
102538 102956     );
102539 102957   
102540 102958     /* Update the tbl_name and name columns of the sqlite_master table
102541 102959     ** as required.  */
102542 102960     sqlite3NestedParse(pParse,
102543 102961         "UPDATE %Q.%s SET "
102544 102962             "tbl_name = %Q, "
102545 102963             "name = CASE "
102546 102964               "WHEN type='table' THEN %Q "
102547         -            "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN "
       102965  +            "WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' "
       102966  +            "     AND type='index' THEN "
102548 102967                "'sqlite_autoindex_' || %Q || substr(name,%d+18) "
102549 102968               "ELSE name END "
102550 102969         "WHERE tbl_name=%Q COLLATE nocase AND "
102551 102970             "(type='table' OR type='index' OR type='trigger');", 
102552 102971         zDb, MASTER_NAME, 
102553 102972         zName, zName, zName, 
102554 102973         nTabName, zTabName
................................................................................
102914 103333     zNew = sqlite3NameFromToken(db, pNew);
102915 103334     if( !zNew ) goto exit_rename_column;
102916 103335     assert( pNew->n>0 );
102917 103336     bQuote = sqlite3Isquote(pNew->z[0]);
102918 103337     sqlite3NestedParse(pParse, 
102919 103338         "UPDATE \"%w\".%s SET "
102920 103339         "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) "
102921         -      "WHERE name NOT LIKE 'sqlite_%%' AND (type != 'index' OR tbl_name = %Q)"
       103340  +      "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' "
       103341  +      " AND (type != 'index' OR tbl_name = %Q)"
102922 103342         " AND sql NOT LIKE 'create virtual%%'",
102923 103343         zDb, MASTER_NAME, 
102924 103344         zDb, pTab->zName, iCol, zNew, bQuote, iSchema==1,
102925 103345         pTab->zName
102926 103346     );
102927 103347   
102928 103348     sqlite3NestedParse(pParse, 
................................................................................
103067 103487   ** Walker callback used by sqlite3RenameExprUnmap().
103068 103488   */
103069 103489   static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){
103070 103490     Parse *pParse = pWalker->pParse;
103071 103491     sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr);
103072 103492     return WRC_Continue;
103073 103493   }
       103494  +
       103495  +/*
       103496  +** Walker callback used by sqlite3RenameExprUnmap().
       103497  +*/
       103498  +static int renameUnmapSelectCb(Walker *pWalker, Select *p){
       103499  +  Parse *pParse = pWalker->pParse;
       103500  +  int i;
       103501  +  if( ALWAYS(p->pEList) ){
       103502  +    ExprList *pList = p->pEList;
       103503  +    for(i=0; i<pList->nExpr; i++){
       103504  +      if( pList->a[i].zName ){
       103505  +        sqlite3RenameTokenRemap(pParse, 0, (void*)pList->a[i].zName);
       103506  +      }
       103507  +    }
       103508  +  }
       103509  +  if( ALWAYS(p->pSrc) ){  /* Every Select as a SrcList, even if it is empty */
       103510  +    SrcList *pSrc = p->pSrc;
       103511  +    for(i=0; i<pSrc->nSrc; i++){
       103512  +      sqlite3RenameTokenRemap(pParse, 0, (void*)pSrc->a[i].zName);
       103513  +    }
       103514  +  }
       103515  +  return WRC_Continue;
       103516  +}
103074 103517   
103075 103518   /*
103076 103519   ** Remove all nodes that are part of expression pExpr from the rename list.
103077 103520   */
103078 103521   SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){
103079 103522     Walker sWalker;
103080 103523     memset(&sWalker, 0, sizeof(Walker));
103081 103524     sWalker.pParse = pParse;
103082 103525     sWalker.xExprCallback = renameUnmapExprCb;
       103526  +  sWalker.xSelectCallback = renameUnmapSelectCb;
103083 103527     sqlite3WalkExpr(&sWalker, pExpr);
103084 103528   }
103085 103529   
103086 103530   /*
103087 103531   ** Remove all nodes that are part of expression-list pEList from the 
103088 103532   ** rename list.
103089 103533   */
................................................................................
107455 107899   ** used by the Table object.
107456 107900   */
107457 107901   static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){
107458 107902     Index *pIndex, *pNext;
107459 107903   
107460 107904   #ifdef SQLITE_DEBUG
107461 107905     /* Record the number of outstanding lookaside allocations in schema Tables
107462         -  ** prior to doing any free() operations.  Since schema Tables do not use
107463         -  ** lookaside, this number should not change. */
       107906  +  ** prior to doing any free() operations. Since schema Tables do not use
       107907  +  ** lookaside, this number should not change. 
       107908  +  **
       107909  +  ** If malloc has already failed, it may be that it failed while allocating
       107910  +  ** a Table object that was going to be marked ephemeral. So do not check
       107911  +  ** that no lookaside memory is used in this case either. */
107464 107912     int nLookaside = 0;
107465         -  if( db && (pTable->tabFlags & TF_Ephemeral)==0 ){
       107913  +  if( db && !db->mallocFailed && (pTable->tabFlags & TF_Ephemeral)==0 ){
107466 107914       nLookaside = sqlite3LookasideUsed(db, 0);
107467 107915     }
107468 107916   #endif
107469 107917   
107470 107918     /* Delete all indices associated with this table. */
107471 107919     for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
107472 107920       pNext = pIndex->pNext;
................................................................................
108166 108614   **     CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim)
108167 108615   **     CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC);
108168 108616   **
108169 108617   ** This is goofy.  But to preserve backwards compatibility we continue to
108170 108618   ** accept it.  This routine does the necessary conversion.  It converts
108171 108619   ** the expression given in its argument from a TK_STRING into a TK_ID
108172 108620   ** if the expression is just a TK_STRING with an optional COLLATE clause.
108173         -** If the epxression is anything other than TK_STRING, the expression is
       108621  +** If the expression is anything other than TK_STRING, the expression is
108174 108622   ** unchanged.
108175 108623   */
108176 108624   static void sqlite3StringToId(Expr *p){
108177 108625     if( p->op==TK_STRING ){
108178 108626       p->op = TK_ID;
108179 108627     }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){
108180 108628       p->pLeft->op = TK_ID;
................................................................................
108563 109011       i16 x = pIdx->aiColumn[i];
108564 109012       assert( x<pIdx->pTable->nCol );
108565 109013       wIndex += x<0 ? 1 : aCol[pIdx->aiColumn[i]].szEst;
108566 109014     }
108567 109015     pIdx->szIdxRow = sqlite3LogEst(wIndex*4);
108568 109016   }
108569 109017   
108570         -/* Return true if value x is found any of the first nCol entries of aiCol[]
       109018  +/* Return true if column number x is any of the first nCol entries of aiCol[].
       109019  +** This is used to determine if the column number x appears in any of the
       109020  +** first nCol entries of an index.
108571 109021   */
108572 109022   static int hasColumn(const i16 *aiCol, int nCol, int x){
108573         -  while( nCol-- > 0 ) if( x==*(aiCol++) ) return 1;
       109023  +  while( nCol-- > 0 ){
       109024  +    assert( aiCol[0]>=0 );
       109025  +    if( x==*(aiCol++) ){
       109026  +      return 1;
       109027  +    }
       109028  +  }
       109029  +  return 0;
       109030  +}
       109031  +
       109032  +/*
       109033  +** Return true if any of the first nKey entries of index pIdx exactly
       109034  +** match the iCol-th entry of pPk.  pPk is always a WITHOUT ROWID
       109035  +** PRIMARY KEY index.  pIdx is an index on the same table.  pIdx may
       109036  +** or may not be the same index as pPk.
       109037  +**
       109038  +** The first nKey entries of pIdx are guaranteed to be ordinary columns,
       109039  +** not a rowid or expression.
       109040  +**
       109041  +** This routine differs from hasColumn() in that both the column and the
       109042  +** collating sequence must match for this routine, but for hasColumn() only
       109043  +** the column name must match.
       109044  +*/
       109045  +static int isDupColumn(Index *pIdx, int nKey, Index *pPk, int iCol){
       109046  +  int i, j;
       109047  +  assert( nKey<=pIdx->nColumn );
       109048  +  assert( iCol<MAX(pPk->nColumn,pPk->nKeyCol) );
       109049  +  assert( pPk->idxType==SQLITE_IDXTYPE_PRIMARYKEY );
       109050  +  assert( pPk->pTable->tabFlags & TF_WithoutRowid );
       109051  +  assert( pPk->pTable==pIdx->pTable );
       109052  +  testcase( pPk==pIdx );
       109053  +  j = pPk->aiColumn[iCol];
       109054  +  assert( j!=XN_ROWID && j!=XN_EXPR );
       109055  +  for(i=0; i<nKey; i++){
       109056  +    assert( pIdx->aiColumn[i]>=0 || j>=0 );
       109057  +    if( pIdx->aiColumn[i]==j 
       109058  +     && sqlite3StrICmp(pIdx->azColl[i], pPk->azColl[iCol])==0
       109059  +    ){
       109060  +      return 1;
       109061  +    }
       109062  +  }
108574 109063     return 0;
108575 109064   }
108576 109065   
108577 109066   /* Recompute the colNotIdxed field of the Index.
108578 109067   **
108579 109068   ** colNotIdxed is a bitmask that has a 0 bit representing each indexed
108580 109069   ** columns that are within the first 63 columns of the table.  The
................................................................................
108655 109144     if( pTab->iPKey>=0 ){
108656 109145       ExprList *pList;
108657 109146       Token ipkToken;
108658 109147       sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName);
108659 109148       pList = sqlite3ExprListAppend(pParse, 0, 
108660 109149                     sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0));
108661 109150       if( pList==0 ) return;
       109151  +    if( IN_RENAME_OBJECT ){
       109152  +      sqlite3RenameTokenRemap(pParse, pList->a[0].pExpr, &pTab->iPKey);
       109153  +    }
108662 109154       pList->a[0].sortOrder = pParse->iPkSortOrder;
108663 109155       assert( pParse->pNewTable==pTab );
       109156  +    pTab->iPKey = -1;
108664 109157       sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0,
108665 109158                          SQLITE_IDXTYPE_PRIMARYKEY);
108666 109159       if( db->mallocFailed || pParse->nErr ) return;
108667 109160       pPk = sqlite3PrimaryKeyIndex(pTab);
108668         -    pTab->iPKey = -1;
108669 109161     }else{
108670 109162       pPk = sqlite3PrimaryKeyIndex(pTab);
108671 109163       assert( pPk!=0 );
108672 109164   
108673 109165       /*
108674 109166       ** Remove all redundant columns from the PRIMARY KEY.  For example, change
108675 109167       ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)".  Later
108676 109168       ** code assumes the PRIMARY KEY contains no repeated columns.
108677 109169       */
108678 109170       for(i=j=1; i<pPk->nKeyCol; i++){
108679         -      if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){
       109171  +      if( isDupColumn(pPk, j, pPk, i) ){
108680 109172           pPk->nColumn--;
108681 109173         }else{
       109174  +        testcase( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) );
108682 109175           pPk->aiColumn[j++] = pPk->aiColumn[i];
108683 109176         }
108684 109177       }
108685 109178       pPk->nKeyCol = j;
108686 109179     }
108687 109180     assert( pPk!=0 );
108688 109181     pPk->isCovering = 1;
................................................................................
108704 109197     /* Update the in-memory representation of all UNIQUE indices by converting
108705 109198     ** the final rowid column into one or more columns of the PRIMARY KEY.
108706 109199     */
108707 109200     for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
108708 109201       int n;
108709 109202       if( IsPrimaryKeyIndex(pIdx) ) continue;
108710 109203       for(i=n=0; i<nPk; i++){
108711         -      if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++;
       109204  +      if( !isDupColumn(pIdx, pIdx->nKeyCol, pPk, i) ){
       109205  +        testcase( hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) );
       109206  +        n++;
       109207  +      }
108712 109208       }
108713 109209       if( n==0 ){
108714 109210         /* This index is a superset of the primary key */
108715 109211         pIdx->nColumn = pIdx->nKeyCol;
108716 109212         continue;
108717 109213       }
108718 109214       if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return;
108719 109215       for(i=0, j=pIdx->nKeyCol; i<nPk; i++){
108720         -      if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){
       109216  +      if( !isDupColumn(pIdx, pIdx->nKeyCol, pPk, i) ){
       109217  +        testcase( hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) );
108721 109218           pIdx->aiColumn[j] = pPk->aiColumn[i];
108722 109219           pIdx->azColl[j] = pPk->azColl[i];
       109220  +        if( pPk->aSortOrder[i] ){
       109221  +          /* See ticket https://www.sqlite.org/src/info/bba7b69f9849b5bf */
       109222  +          pIdx->bAscKeyBug = 1;
       109223  +        }
108723 109224           j++;
108724 109225         }
108725 109226       }
108726 109227       assert( pIdx->nColumn>=pIdx->nKeyCol+n );
108727 109228       assert( pIdx->nColumn>=j );
108728 109229     }
108729 109230   
................................................................................
109834 110335       addr2 = sqlite3VdbeCurrentAddr(v);
109835 110336       sqlite3VdbeVerifyAbortable(v, OE_Abort);
109836 110337       sqlite3VdbeAddOp4Int(v, OP_SorterCompare, iSorter, j2, regRecord,
109837 110338                            pIndex->nKeyCol); VdbeCoverage(v);
109838 110339       sqlite3UniqueConstraint(pParse, OE_Abort, pIndex);
109839 110340       sqlite3VdbeJumpHere(v, j2);
109840 110341     }else{
       110342  +    /* Most CREATE INDEX and REINDEX statements that are not UNIQUE can not
       110343  +    ** abort. The exception is if one of the indexed expressions contains a
       110344  +    ** user function that throws an exception when it is evaluated. But the
       110345  +    ** overhead of adding a statement journal to a CREATE INDEX statement is
       110346  +    ** very small (since most of the pages written do not contain content that
       110347  +    ** needs to be restored if the statement aborts), so we call 
       110348  +    ** sqlite3MayAbort() for all CREATE INDEX statements.  */
       110349  +    sqlite3MayAbort(pParse);
109841 110350       addr2 = sqlite3VdbeCurrentAddr(v);
109842 110351     }
109843 110352     sqlite3VdbeAddOp3(v, OP_SorterData, iSorter, regRecord, iIdx);
109844         -  sqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx);
       110353  +  if( !pIndex->bAscKeyBug ){
       110354  +    /* This OP_SeekEnd opcode makes index insert for a REINDEX go much
       110355  +    ** faster by avoiding unnecessary seeks.  But the optimization does
       110356  +    ** not work for UNIQUE constraint indexes on WITHOUT ROWID tables
       110357  +    ** with DESC primary keys, since those indexes have there keys in
       110358  +    ** a different order from the main table.
       110359  +    ** See ticket: https://www.sqlite.org/src/info/bba7b69f9849b5bf
       110360  +    */
       110361  +    sqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx);
       110362  +  }
109845 110363     sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord);
109846 110364     sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
109847 110365     sqlite3ReleaseTempReg(pParse, regRecord);
109848 110366     sqlite3VdbeAddOp2(v, OP_SorterNext, iSorter, addr2); VdbeCoverage(v);
109849 110367     sqlite3VdbeJumpHere(v, addr1);
109850 110368   
109851 110369     sqlite3VdbeAddOp1(v, OP_Close, iTab);
................................................................................
110229 110747     ** tables (when pPk!=0) this will be the declared PRIMARY KEY.  For
110230 110748     ** normal tables (when pPk==0) this will be the rowid.
110231 110749     */
110232 110750     if( pPk ){
110233 110751       for(j=0; j<pPk->nKeyCol; j++){
110234 110752         int x = pPk->aiColumn[j];
110235 110753         assert( x>=0 );
110236         -      if( hasColumn(pIndex->aiColumn, pIndex->nKeyCol, x) ){
       110754  +      if( isDupColumn(pIndex, pIndex->nKeyCol, pPk, j) ){
110237 110755           pIndex->nColumn--; 
110238 110756         }else{
       110757  +        testcase( hasColumn(pIndex->aiColumn,pIndex->nKeyCol,x) );
110239 110758           pIndex->aiColumn[i] = x;
110240 110759           pIndex->azColl[i] = pPk->azColl[j];
110241 110760           pIndex->aSortOrder[i] = pPk->aSortOrder[j];
110242 110761           i++;
110243 110762         }
110244 110763       }
110245 110764       assert( i==pIndex->nColumn );
................................................................................
113002 113521   ** This file contains the C-language implementations for many of the SQL
113003 113522   ** functions of SQLite.  (Some function, and in particular the date and
113004 113523   ** time functions, are implemented separately.)
113005 113524   */
113006 113525   /* #include "sqliteInt.h" */
113007 113526   /* #include <stdlib.h> */
113008 113527   /* #include <assert.h> */
       113528  +/* #include <math.h> */
113009 113529   /* #include "vdbeInt.h" */
113010 113530   
113011 113531   /*
113012 113532   ** Return the collating function associated with a function.
113013 113533   */
113014 113534   static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){
113015 113535     VdbeOp *pOp;
................................................................................
113372 113892     }
113373 113893     if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
113374 113894     r = sqlite3_value_double(argv[0]);
113375 113895     /* If Y==0 and X will fit in a 64-bit int,
113376 113896     ** handle the rounding directly,
113377 113897     ** otherwise use printf.
113378 113898     */
113379         -  if( n==0 && r>=0 && r<LARGEST_INT64-1 ){
113380         -    r = (double)((sqlite_int64)(r+0.5));
113381         -  }else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){
113382         -    r = -(double)((sqlite_int64)((-r)+0.5));
       113899  +  if( r<-4503599627370496.0 || r>+4503599627370496.0 ){
       113900  +    /* The value has no fractional part so there is nothing to round */
       113901  +  }else if( n==0 ){  
       113902  +    r = (double)((sqlite_int64)(r+(r<0?-0.5:+0.5)));
113383 113903     }else{
113384 113904       zBuf = sqlite3_mprintf("%.*f",n,r);
113385 113905       if( zBuf==0 ){
113386 113906         sqlite3_result_error_nomem(context);
113387 113907         return;
113388 113908       }
113389 113909       sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8);
................................................................................
113829 114349   #ifdef SQLITE_TEST
113830 114350       sqlite3_like_count++;
113831 114351   #endif
113832 114352       sqlite3_result_int(context, 0);
113833 114353       return;
113834 114354     }
113835 114355   #endif
113836         -  zB = sqlite3_value_text(argv[0]);
113837         -  zA = sqlite3_value_text(argv[1]);
113838 114356   
113839 114357     /* Limit the length of the LIKE or GLOB pattern to avoid problems
113840 114358     ** of deep recursion and N*N behavior in patternCompare().
113841 114359     */
113842 114360     nPat = sqlite3_value_bytes(argv[0]);
113843 114361     testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] );
113844 114362     testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]+1 );
113845 114363     if( nPat > db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ){
113846 114364       sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1);
113847 114365       return;
113848 114366     }
113849         -  assert( zB==sqlite3_value_text(argv[0]) );  /* Encoding did not change */
113850         -
113851 114367     if( argc==3 ){
113852 114368       /* The escape character string must consist of a single UTF-8 character.
113853 114369       ** Otherwise, return an error.
113854 114370       */
113855 114371       const unsigned char *zEsc = sqlite3_value_text(argv[2]);
113856 114372       if( zEsc==0 ) return;
113857 114373       if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){
................................................................................
113859 114375             "ESCAPE expression must be a single character", -1);
113860 114376         return;
113861 114377       }
113862 114378       escape = sqlite3Utf8Read(&zEsc);
113863 114379     }else{
113864 114380       escape = pInfo->matchSet;
113865 114381     }
       114382  +  zB = sqlite3_value_text(argv[0]);
       114383  +  zA = sqlite3_value_text(argv[1]);
113866 114384     if( zA && zB ){
113867 114385   #ifdef SQLITE_TEST
113868 114386       sqlite3_like_count++;
113869 114387   #endif
113870 114388       sqlite3_result_int(context,
113871 114389                         patternCompare(zB, zA, pInfo, escape)==SQLITE_MATCH);
113872 114390     }
................................................................................
114784 115302     assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );
114785 115303     if( rc==SQLITE_NOMEM ){
114786 115304       sqlite3OomFault(db);
114787 115305     }
114788 115306   }
114789 115307   
114790 115308   /*
114791         -** Set the LIKEOPT flag on the 2-argument function with the given name.
114792         -*/
114793         -static void setLikeOptFlag(sqlite3 *db, const char *zName, u8 flagVal){
114794         -  FuncDef *pDef;
114795         -  pDef = sqlite3FindFunction(db, zName, 2, SQLITE_UTF8, 0);
114796         -  if( ALWAYS(pDef) ){
114797         -    pDef->funcFlags |= flagVal;
114798         -  }
114799         -  pDef = sqlite3FindFunction(db, zName, 3, SQLITE_UTF8, 0);
114800         -  if( pDef ){
114801         -    pDef->funcFlags |= flagVal;
114802         -  }
114803         -}
114804         -
114805         -/*
114806         -** Register the built-in LIKE and GLOB functions.  The caseSensitive
       115309  +** Re-register the built-in LIKE functions.  The caseSensitive
114807 115310   ** parameter determines whether or not the LIKE operator is case
114808         -** sensitive.  GLOB is always case sensitive.
       115311  +** sensitive.
114809 115312   */
114810 115313   SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){
114811 115314     struct compareInfo *pInfo;
       115315  +  int flags;
114812 115316     if( caseSensitive ){
114813 115317       pInfo = (struct compareInfo*)&likeInfoAlt;
       115318  +    flags = SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE;
114814 115319     }else{
114815 115320       pInfo = (struct compareInfo*)&likeInfoNorm;
       115321  +    flags = SQLITE_FUNC_LIKE;
114816 115322     }
114817 115323     sqlite3CreateFunc(db, "like", 2, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0, 0, 0);
114818 115324     sqlite3CreateFunc(db, "like", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0, 0, 0);
114819         -  sqlite3CreateFunc(db, "glob", 2, SQLITE_UTF8, 
114820         -      (struct compareInfo*)&globInfo, likeFunc, 0, 0, 0, 0, 0);
114821         -  setLikeOptFlag(db, "glob", SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE);
114822         -  setLikeOptFlag(db, "like", 
114823         -      caseSensitive ? (SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE) : SQLITE_FUNC_LIKE);
       115325  +  sqlite3FindFunction(db, "like", 2, SQLITE_UTF8, 0)->funcFlags |= flags;
       115326  +  sqlite3FindFunction(db, "like", 3, SQLITE_UTF8, 0)->funcFlags |= flags;
114824 115327   }
114825 115328   
114826 115329   /*
114827 115330   ** pExpr points to an expression which implements a function.  If
114828 115331   ** it is appropriate to apply the LIKE optimization to that function
114829 115332   ** then set aWc[0] through aWc[2] to the wildcard characters and the
114830 115333   ** escape character and then return TRUE.  If the function is not a 
................................................................................
115606 116109       iCol = pIdx ? pIdx->aiColumn[i] : -1;
115607 116110       pLeft = exprTableRegister(pParse, pTab, regData, iCol);
115608 116111       iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;
115609 116112       assert( iCol>=0 );
115610 116113       zCol = pFKey->pFrom->aCol[iCol].zName;
115611 116114       pRight = sqlite3Expr(db, TK_ID, zCol);
115612 116115       pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight);
115613         -    pWhere = sqlite3ExprAnd(db, pWhere, pEq);
       116116  +    pWhere = sqlite3ExprAnd(pParse, pWhere, pEq);
115614 116117     }
115615 116118   
115616 116119     /* If the child table is the same as the parent table, then add terms
115617 116120     ** to the WHERE clause that prevent this entry from being scanned.
115618 116121     ** The added WHERE clause terms are like this:
115619 116122     **
115620 116123     **     $current_rowid!=rowid
................................................................................
115640 116143         assert( pIdx!=0 );
115641 116144         for(i=0; i<pIdx->nKeyCol; i++){
115642 116145           i16 iCol = pIdx->aiColumn[i];
115643 116146           assert( iCol>=0 );
115644 116147           pLeft = exprTableRegister(pParse, pTab, regData, iCol);
115645 116148           pRight = sqlite3Expr(db, TK_ID, pTab->aCol[iCol].zName);
115646 116149           pEq = sqlite3PExpr(pParse, TK_IS, pLeft, pRight);
115647         -        pAll = sqlite3ExprAnd(db, pAll, pEq);
       116150  +        pAll = sqlite3ExprAnd(pParse, pAll, pEq);
115648 116151         }
115649 116152         pNe = sqlite3PExpr(pParse, TK_NOT, pAll, 0);
115650 116153       }
115651         -    pWhere = sqlite3ExprAnd(db, pWhere, pNe);
       116154  +    pWhere = sqlite3ExprAnd(pParse, pWhere, pNe);
115652 116155     }
115653 116156   
115654 116157     /* Resolve the references in the WHERE clause. */
115655 116158     memset(&sNameContext, 0, sizeof(NameContext));
115656 116159     sNameContext.pSrcList = pSrc;
115657 116160     sNameContext.pParse = pParse;
115658 116161     sqlite3ResolveExprNames(&sNameContext, pWhere);
................................................................................
116250 116753         ** parent table are used for the comparison. */
116251 116754         pEq = sqlite3PExpr(pParse, TK_EQ,
116252 116755             sqlite3PExpr(pParse, TK_DOT, 
116253 116756               sqlite3ExprAlloc(db, TK_ID, &tOld, 0),
116254 116757               sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)),
116255 116758             sqlite3ExprAlloc(db, TK_ID, &tFromCol, 0)
116256 116759         );
116257         -      pWhere = sqlite3ExprAnd(db, pWhere, pEq);
       116760  +      pWhere = sqlite3ExprAnd(pParse, pWhere, pEq);
116258 116761   
116259 116762         /* For ON UPDATE, construct the next term of the WHEN clause.
116260 116763         ** The final WHEN clause will be like this:
116261 116764         **
116262 116765         **    WHEN NOT(old.col1 IS new.col1 AND ... AND old.colN IS new.colN)
116263 116766         */
116264 116767         if( pChanges ){
................................................................................
116266 116769               sqlite3PExpr(pParse, TK_DOT, 
116267 116770                 sqlite3ExprAlloc(db, TK_ID, &tOld, 0),
116268 116771                 sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)),
116269 116772               sqlite3PExpr(pParse, TK_DOT, 
116270 116773                 sqlite3ExprAlloc(db, TK_ID, &tNew, 0),
116271 116774                 sqlite3ExprAlloc(db, TK_ID, &tToCol, 0))
116272 116775               );
116273         -        pWhen = sqlite3ExprAnd(db, pWhen, pEq);
       116776  +        pWhen = sqlite3ExprAnd(pParse, pWhen, pEq);
116274 116777         }
116275 116778     
116276 116779         if( action!=OE_Restrict && (action!=OE_Cascade || pChanges) ){
116277 116780           Expr *pNew;
116278 116781           if( action==OE_Cascade ){
116279 116782             pNew = sqlite3PExpr(pParse, TK_DOT, 
116280 116783               sqlite3ExprAlloc(db, TK_ID, &tNew, 0),
................................................................................
117263 117766     }
117264 117767   
117265 117768     /* If this is not a view, open the table and and all indices */
117266 117769     if( !isView ){
117267 117770       int nIdx;
117268 117771       nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, -1, 0,
117269 117772                                         &iDataCur, &iIdxCur);
117270         -    aRegIdx = sqlite3DbMallocRawNN(db, sizeof(int)*(nIdx+1));
       117773  +    aRegIdx = sqlite3DbMallocRawNN(db, sizeof(int)*(nIdx+2));
117271 117774       if( aRegIdx==0 ){
117272 117775         goto insert_cleanup;
117273 117776       }
117274 117777       for(i=0, pIdx=pTab->pIndex; i<nIdx; pIdx=pIdx->pNext, i++){
117275 117778         assert( pIdx );
117276 117779         aRegIdx[i] = ++pParse->nMem;
117277 117780         pParse->nMem += pIdx->nColumn;
117278 117781       }
       117782  +    aRegIdx[i] = ++pParse->nMem;  /* Register to store the table record */
117279 117783     }
117280 117784   #ifndef SQLITE_OMIT_UPSERT
117281 117785     if( pUpsert ){
117282 117786       if( IsVirtual(pTab) ){
117283 117787         sqlite3ErrorMsg(pParse, "UPSERT not implemented for virtual table \"%s\"",
117284 117788                 pTab->zName);
117285 117789         goto insert_cleanup;
................................................................................
117674 118178   ** value for either the rowid column or its INTEGER PRIMARY KEY alias.
117675 118179   **
117676 118180   ** The code generated by this routine will store new index entries into
117677 118181   ** registers identified by aRegIdx[].  No index entry is created for
117678 118182   ** indices where aRegIdx[i]==0.  The order of indices in aRegIdx[] is
117679 118183   ** the same as the order of indices on the linked list of indices
117680 118184   ** at pTab->pIndex.
       118185  +**
       118186  +** (2019-05-07) The generated code also creates a new record for the
       118187  +** main table, if pTab is a rowid table, and stores that record in the
       118188  +** register identified by aRegIdx[nIdx] - in other words in the first
       118189  +** entry of aRegIdx[] past the last index.  It is important that the
       118190  +** record be generated during constraint checks to avoid affinity changes
       118191  +** to the register content that occur after constraint checks but before
       118192  +** the new record is inserted.
117681 118193   **
117682 118194   ** The caller must have already opened writeable cursors on the main
117683 118195   ** table and all applicable indices (that is to say, all indices for which
117684 118196   ** aRegIdx[] is not zero).  iDataCur is the cursor for the main table when
117685 118197   ** inserting or updating a rowid table, or the cursor for the PRIMARY KEY
117686 118198   ** index when operating on a WITHOUT ROWID table.  iIdxCur is the cursor
117687 118199   ** for the first index in the pTab->pIndex list.  Cursors for other indices
................................................................................
117865 118377         sqlite3VdbeVerifyAbortable(v, onError);
117866 118378         sqlite3ExprIfTrue(pParse, pExpr, allOk, SQLITE_JUMPIFNULL);
117867 118379         if( onError==OE_Ignore ){
117868 118380           sqlite3VdbeGoto(v, ignoreDest);
117869 118381         }else{
117870 118382           char *zName = pCheck->a[i].zName;
117871 118383           if( zName==0 ) zName = pTab->zName;
117872         -        if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */
       118384  +        if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-26383-51744 */
117873 118385           sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK,
117874 118386                                 onError, zName, P4_TRANSIENT,
117875 118387                                 P5_ConstraintCheck);
117876 118388         }
117877 118389         sqlite3VdbeResolveLabel(v, allOk);
117878 118390       }
117879 118391       pParse->iSelfTab = 0;
................................................................................
118293 118805   
118294 118806     /* If the IPK constraint is a REPLACE, run it last */
118295 118807     if( ipkTop ){
118296 118808       sqlite3VdbeGoto(v, ipkTop);
118297 118809       VdbeComment((v, "Do IPK REPLACE"));
118298 118810       sqlite3VdbeJumpHere(v, ipkBottom);
118299 118811     }
       118812  +
       118813  +  /* Generate the table record */
       118814  +  if( HasRowid(pTab) ){
       118815  +    int regRec = aRegIdx[ix];
       118816  +    sqlite3VdbeAddOp3(v, OP_MakeRecord, regNewData+1, pTab->nCol, regRec);
       118817  +    sqlite3SetMakeRecordP5(v, pTab);
       118818  +    if( !bAffinityDone ){
       118819  +      sqlite3TableAffinity(v, pTab, 0);
       118820  +    }
       118821  +  }
118300 118822   
118301 118823     *pbMayReplace = seenReplace;
118302 118824     VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace));
118303 118825   }
118304 118826   
118305 118827   #ifdef SQLITE_ENABLE_NULL_TRIM
118306 118828   /*
................................................................................
118343 118865     int update_flags,   /* True for UPDATE, False for INSERT */
118344 118866     int appendBias,     /* True if this is likely to be an append */
118345 118867     int useSeekResult   /* True to set the USESEEKRESULT flag on OP_[Idx]Insert */
118346 118868   ){
118347 118869     Vdbe *v;            /* Prepared statements under construction */
118348 118870     Index *pIdx;        /* An index being inserted or updated */
118349 118871     u8 pik_flags;       /* flag values passed to the btree insert */
118350         -  int regData;        /* Content registers (after the rowid) */
118351         -  int regRec;         /* Register holding assembled record for the table */
118352 118872     int i;              /* Loop counter */
118353         -  u8 bAffinityDone = 0; /* True if OP_Affinity has been run already */
118354 118873   
118355 118874     assert( update_flags==0
118356 118875          || update_flags==OPFLAG_ISUPDATE
118357 118876          || update_flags==(OPFLAG_ISUPDATE|OPFLAG_SAVEPOSITION)
118358 118877     );
118359 118878   
118360 118879     v = sqlite3GetVdbe(pParse);
118361 118880     assert( v!=0 );
118362 118881     assert( pTab->pSelect==0 );  /* This table is not a VIEW */
118363 118882     for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
118364 118883       if( aRegIdx[i]==0 ) continue;
118365         -    bAffinityDone = 1;
118366 118884       if( pIdx->pPartIdxWhere ){
118367 118885         sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
118368 118886         VdbeCoverage(v);
118369 118887       }
118370 118888       pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
118371 118889       if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
118372 118890         assert( pParse->nested==0 );
................................................................................
118386 118904       }
118387 118905       sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
118388 118906                            aRegIdx[i]+1,
118389 118907                            pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn);
118390 118908       sqlite3VdbeChangeP5(v, pik_flags);
118391 118909     }
118392 118910     if( !HasRowid(pTab) ) return;
118393         -  regData = regNewData + 1;
118394         -  regRec = sqlite3GetTempReg(pParse);
118395         -  sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);
118396         -  sqlite3SetMakeRecordP5(v, pTab);
118397         -  if( !bAffinityDone ){
118398         -    sqlite3TableAffinity(v, pTab, 0);
118399         -  }
118400 118911     if( pParse->nested ){
118401 118912       pik_flags = 0;
118402 118913     }else{
118403 118914       pik_flags = OPFLAG_NCHANGE;
118404 118915       pik_flags |= (update_flags?update_flags:OPFLAG_LASTROWID);
118405 118916     }
118406 118917     if( appendBias ){
118407 118918       pik_flags |= OPFLAG_APPEND;
118408 118919     }
118409 118920     if( useSeekResult ){
118410 118921       pik_flags |= OPFLAG_USESEEKRESULT;
118411 118922     }
118412         -  sqlite3VdbeAddOp3(v, OP_Insert, iDataCur, regRec, regNewData);
       118923  +  sqlite3VdbeAddOp3(v, OP_Insert, iDataCur, aRegIdx[i], regNewData);
118413 118924     if( !pParse->nested ){
118414 118925       sqlite3VdbeAppendP4(v, pTab, P4_TABLE);
118415 118926     }
118416 118927     sqlite3VdbeChangeP5(v, pik_flags);
118417 118928   }
118418 118929   
118419 118930   /*
................................................................................
120591 121102   #define PragTyp_TABLE_INFO                    34
120592 121103   #define PragTyp_TEMP_STORE                    35
120593 121104   #define PragTyp_TEMP_STORE_DIRECTORY          36
120594 121105   #define PragTyp_THREADS                       37
120595 121106   #define PragTyp_WAL_AUTOCHECKPOINT            38
120596 121107   #define PragTyp_WAL_CHECKPOINT                39
120597 121108   #define PragTyp_ACTIVATE_EXTENSIONS           40
120598         -#define PragTyp_HEXKEY                        41
120599         -#define PragTyp_KEY                           42
120600         -#define PragTyp_LOCK_STATUS                   43
120601         -#define PragTyp_STATS                         44
       121109  +#define PragTyp_KEY                           41
       121110  +#define PragTyp_LOCK_STATUS                   42
       121111  +#define PragTyp_STATS                         43
120602 121112   
120603 121113   /* Property flags associated with various pragma. */
120604 121114   #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
120605 121115   #define PragFlg_NoColumns  0x02 /* OP_ResultRow called with zero columns */
120606 121116   #define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
120607 121117   #define PragFlg_ReadOnly   0x08 /* Read-only HEADER_VALUE */
120608 121118   #define PragFlg_Result0    0x10 /* Acts as query when no argument */
................................................................................
120723 121233   #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
120724 121234    {/* zName:     */ "cache_spill",
120725 121235     /* ePragTyp:  */ PragTyp_CACHE_SPILL,
120726 121236     /* ePragFlg:  */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
120727 121237     /* ColNames:  */ 0, 0,
120728 121238     /* iArg:      */ 0 },
120729 121239   #endif
       121240  +#if !defined(SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA)
120730 121241    {/* zName:     */ "case_sensitive_like",
120731 121242     /* ePragTyp:  */ PragTyp_CASE_SENSITIVE_LIKE,
120732 121243     /* ePragFlg:  */ PragFlg_NoColumns,
120733 121244     /* ColNames:  */ 0, 0,
120734 121245     /* iArg:      */ 0 },
       121246  +#endif
120735 121247    {/* zName:     */ "cell_size_check",
120736 121248     /* ePragTyp:  */ PragTyp_FLAG,
120737 121249     /* ePragFlg:  */ PragFlg_Result0|PragFlg_NoColumns1,
120738 121250     /* ColNames:  */ 0, 0,
120739 121251     /* iArg:      */ SQLITE_CellSizeCk },
120740 121252   #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
120741 121253    {/* zName:     */ "checkpoint_fullfsync",
................................................................................
120865 121377     /* ePragFlg:  */ PragFlg_Result0,
120866 121378     /* ColNames:  */ 41, 2,
120867 121379     /* iArg:      */ 0 },
120868 121380   #endif
120869 121381   #endif
120870 121382   #if defined(SQLITE_HAS_CODEC)
120871 121383    {/* zName:     */ "hexkey",
120872         -  /* ePragTyp:  */ PragTyp_HEXKEY,
       121384  +  /* ePragTyp:  */ PragTyp_KEY,
120873 121385     /* ePragFlg:  */ 0,
120874 121386     /* ColNames:  */ 0, 0,
120875 121387     /* iArg:      */ 2 },
120876 121388    {/* zName:     */ "hexrekey",
120877         -  /* ePragTyp:  */ PragTyp_HEXKEY,
       121389  +  /* ePragTyp:  */ PragTyp_KEY,
120878 121390     /* ePragFlg:  */ 0,
120879 121391     /* ColNames:  */ 0, 0,
120880 121392     /* iArg:      */ 3 },
120881 121393   #endif
120882 121394   #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
120883 121395   #if !defined(SQLITE_OMIT_CHECK)
120884 121396    {/* zName:     */ "ignore_check_constraints",
................................................................................
121831 122343           if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break;
121832 122344         }
121833 122345         if( !zMode ){
121834 122346           /* If the "=MODE" part does not match any known journal mode,
121835 122347           ** then do a query */
121836 122348           eMode = PAGER_JOURNALMODE_QUERY;
121837 122349         }
       122350  +      if( eMode==PAGER_JOURNALMODE_OFF && (db->flags & SQLITE_Defensive)!=0 ){
       122351  +        /* Do not allow journal-mode "OFF" in defensive since the database
       122352  +        ** can become corrupted using ordinary SQL when the journal is off */
       122353  +        eMode = PAGER_JOURNALMODE_QUERY;
       122354  +      }
121838 122355       }
121839 122356       if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){
121840 122357         /* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */
121841 122358         iDb = 0;
121842 122359         pId2->n = 1;
121843 122360       }
121844 122361       for(ii=db->nDb-1; ii>=0; ii--){
................................................................................
122608 123125         sqlite3VdbeJumpHere(v, addrTop);
122609 123126       }
122610 123127     }
122611 123128     break;
122612 123129   #endif /* !defined(SQLITE_OMIT_TRIGGER) */
122613 123130   #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
122614 123131   
       123132  +#ifndef SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA
122615 123133     /* Reinstall the LIKE and GLOB functions.  The variant of LIKE
122616 123134     ** used will be case sensitive or not depending on the RHS.
122617 123135     */
122618 123136     case PragTyp_CASE_SENSITIVE_LIKE: {
122619 123137       if( zRight ){
122620 123138         sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0));
122621 123139       }
122622 123140     }
122623 123141     break;
       123142  +#endif /* SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA */
122624 123143   
122625 123144   #ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX
122626 123145   # define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100
122627 123146   #endif
122628 123147   
122629 123148   #ifndef SQLITE_OMIT_INTEGRITY_CHECK
122630 123149     /*    PRAGMA integrity_check
................................................................................
123310 123829     **  hexkey        2
123311 123830     **  hexrekey      3
123312 123831     **  textkey       4
123313 123832     **  textrekey     5
123314 123833     */
123315 123834     case PragTyp_KEY: {
123316 123835       if( zRight ){
123317         -      int n = pPragma->iArg<4 ? sqlite3Strlen30(zRight) : -1;
123318         -      if( (pPragma->iArg & 1)==0 ){
123319         -        sqlite3_key_v2(db, zDb, zRight, n);
       123836  +      char zBuf[40];
       123837  +      const char *zKey = zRight;
       123838  +      int n;
       123839  +      if( pPragma->iArg==2 || pPragma->iArg==3 ){
       123840  +        u8 iByte;
       123841  +        int i;
       123842  +        for(i=0, iByte=0; i<sizeof(zBuf)*2 && sqlite3Isxdigit(zRight[i]); i++){
       123843  +          iByte = (iByte<<4) + sqlite3HexToInt(zRight[i]);
       123844  +          if( (i&1)!=0 ) zBuf[i/2] = iByte;
       123845  +        }
       123846  +        zKey = zBuf;
       123847  +        n = i/2;
123320 123848         }else{
123321         -        sqlite3_rekey_v2(db, zDb, zRight, n);
123322         -      }
123323         -    }
123324         -    break;
123325         -  }
123326         -  case PragTyp_HEXKEY: {
123327         -    if( zRight ){
123328         -      u8 iByte;
123329         -      int i;
123330         -      char zKey[40];
123331         -      for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zRight[i]); i++){
123332         -        iByte = (iByte<<4) + sqlite3HexToInt(zRight[i]);
123333         -        if( (i&1)!=0 ) zKey[i/2] = iByte;
       123849  +        n = pPragma->iArg<4 ? sqlite3Strlen30(zRight) : -1;
123334 123850         }
123335 123851         if( (pPragma->iArg & 1)==0 ){
123336         -        sqlite3_key_v2(db, zDb, zKey, i/2);
       123852  +        rc = sqlite3_key_v2(db, zDb, zKey, n);
123337 123853         }else{
123338         -        sqlite3_rekey_v2(db, zDb, zKey, i/2);
       123854  +        rc = sqlite3_rekey_v2(db, zDb, zKey, n);
       123855  +      }
       123856  +      if( rc==SQLITE_OK && n!=0 ){
       123857  +        sqlite3VdbeSetNumCols(v, 1);
       123858  +        sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "ok", SQLITE_STATIC);
       123859  +        returnSingleText(v, "ok");
123339 123860         }
123340 123861       }
123341 123862       break;
123342 123863     }
123343 123864   #endif
123344 123865   #if defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD)
123345 123866     case PragTyp_ACTIVATE_EXTENSIONS: if( zRight ){
................................................................................
124972 125493     pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2);
124973 125494     if( pEq && isOuterJoin ){
124974 125495       ExprSetProperty(pEq, EP_FromJoin);
124975 125496       assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) );
124976 125497       ExprSetVVAProperty(pEq, EP_NoReduce);
124977 125498       pEq->iRightJoinTable = (i16)pE2->iTable;
124978 125499     }
124979         -  *ppWhere = sqlite3ExprAnd(db, *ppWhere, pEq);
       125500  +  *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq);
124980 125501   }
124981 125502   
124982 125503   /*
124983 125504   ** Set the EP_FromJoin property on all terms of the given expression.
124984 125505   ** And set the Expr.iRightJoinTable to iTable for every term in the
124985 125506   ** expression.
124986 125507   **
................................................................................
125106 125627       }
125107 125628   
125108 125629       /* Add the ON clause to the end of the WHERE clause, connected by
125109 125630       ** an AND operator.
125110 125631       */
125111 125632       if( pRight->pOn ){
125112 125633         if( isOuter ) setJoinExpr(pRight->pOn, pRight->iCursor);
125113         -      p->pWhere = sqlite3ExprAnd(pParse->db, p->pWhere, pRight->pOn);
       125634  +      p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pRight->pOn);
125114 125635         pRight->pOn = 0;
125115 125636       }
125116 125637   
125117 125638       /* Create extra terms on the WHERE clause for each column named
125118 125639       ** in the USING clause.  Example: If the two tables to be joined are 
125119 125640       ** A and B and the USING clause names X, Y, and Z, then add this
125120 125641       ** to the WHERE clause:    A.X=B.X AND A.Y=B.Y AND A.Z=B.Z
................................................................................
126713 127234     db->flags = savedFlags;
126714 127235     if( pParse->nErr ) return 0;
126715 127236     while( pSelect->pPrior ) pSelect = pSelect->pPrior;
126716 127237     pTab = sqlite3DbMallocZero(db, sizeof(Table) );
126717 127238     if( pTab==0 ){
126718 127239       return 0;
126719 127240     }
126720         -  /* The sqlite3ResultSetOfSelect() is only used n contexts where lookaside
126721         -  ** is disabled */
126722         -  assert( db->lookaside.bDisable );
126723 127241     pTab->nTabRef = 1;
126724 127242     pTab->zName = 0;
126725 127243     pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
126726 127244     sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);
126727 127245     sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSelect);
126728 127246     pTab->iPKey = -1;
126729 127247     if( db->mallocFailed ){
................................................................................
127157 127675     sqlite3 *db;          /* Database connection */
127158 127676   
127159 127677     /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs.  Only
127160 127678     ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.
127161 127679     */
127162 127680     assert( p && p->pPrior );  /* Calling function guarantees this much */
127163 127681     assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION );
       127682  +  assert( p->selFlags & SF_Compound );
127164 127683     db = pParse->db;
127165 127684     pPrior = p->pPrior;
127166 127685     dest = *pDest;
127167 127686     if( pPrior->pOrderBy || pPrior->pLimit ){
127168 127687       sqlite3ErrorMsg(pParse,"%s clause should come after %s not before",
127169 127688         pPrior->pOrderBy!=0 ? "ORDER BY" : "LIMIT", selectOpName(p->op));
127170 127689       rc = 1;
................................................................................
128651 129170         pSub->pOrderBy = 0;
128652 129171       }
128653 129172       pWhere = pSub->pWhere;
128654 129173       pSub->pWhere = 0;
128655 129174       if( isLeftJoin>0 ){
128656 129175         setJoinExpr(pWhere, iNewParent);
128657 129176       }
128658         -    pParent->pWhere = sqlite3ExprAnd(db, pWhere, pParent->pWhere);
       129177  +    pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere);
128659 129178       if( db->mallocFailed==0 ){
128660 129179         SubstContext x;
128661 129180         x.pParse = pParse;
128662 129181         x.iTable = iParent;
128663 129182         x.iNewTable = iNewParent;
128664 129183         x.isLeftJoin = isLeftJoin;
128665 129184         x.pEList = pSub->pEList;
128666 129185         substSelect(&x, pParent, 0);
128667 129186       }
128668 129187     
128669         -    /* The flattened query is distinct if either the inner or the
128670         -    ** outer query is distinct. 
128671         -    */
128672         -    pParent->selFlags |= pSub->selFlags & SF_Distinct;
       129188  +    /* The flattened query is a compound if either the inner or the
       129189  +    ** outer query is a compound. */
       129190  +    pParent->selFlags |= pSub->selFlags & SF_Compound;
       129191  +    assert( (pSub->selFlags & SF_Distinct)==0 ); /* restriction (17b) */
128673 129192     
128674 129193       /*
128675 129194       ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;
128676 129195       **
128677 129196       ** One is tempted to try to add a and b to combine the limits.  But this
128678 129197       ** does not work if either limit is negative.
128679 129198       */
................................................................................
128986 129505         x.pParse = pParse;
128987 129506         x.iTable = iCursor;
128988 129507         x.iNewTable = iCursor;
128989 129508         x.isLeftJoin = 0;
128990 129509         x.pEList = pSubq->pEList;
128991 129510         pNew = substExpr(&x, pNew);
128992 129511         if( pSubq->selFlags & SF_Aggregate ){
128993         -        pSubq->pHaving = sqlite3ExprAnd(pParse->db, pSubq->pHaving, pNew);
       129512  +        pSubq->pHaving = sqlite3ExprAnd(pParse, pSubq->pHaving, pNew);
128994 129513         }else{
128995         -        pSubq->pWhere = sqlite3ExprAnd(pParse->db, pSubq->pWhere, pNew);
       129514  +        pSubq->pWhere = sqlite3ExprAnd(pParse, pSubq->pWhere, pNew);
128996 129515         }
128997 129516         pSubq = pSubq->pPrior;
128998 129517       }
128999 129518     }
129000 129519     return nChng;
129001 129520   }
129002 129521   #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
................................................................................
129414 129933     }
129415 129934     while( pSel->pPrior ){ pSel = pSel->pPrior; }
129416 129935     sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol);
129417 129936     pTab->iPKey = -1;
129418 129937     pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
129419 129938     pTab->tabFlags |= TF_Ephemeral;
129420 129939   
129421         -  return SQLITE_OK;
       129940  +  return pParse->nErr ? SQLITE_ERROR : SQLITE_OK;
129422 129941   }
129423 129942   
129424 129943   /*
129425 129944   ** This routine is a Walker callback for "expanding" a SELECT statement.
129426 129945   ** "Expanding" means to do the following:
129427 129946   **
129428 129947   **    (1)  Make sure VDBE cursor numbers have been assigned to every
................................................................................
129460 129979     if( db->mallocFailed  ){
129461 129980       return WRC_Abort;
129462 129981     }
129463 129982     assert( p->pSrc!=0 );
129464 129983     if( (selFlags & SF_Expanded)!=0 ){
129465 129984       return WRC_Prune;
129466 129985     }
       129986  +  if( pWalker->eCode ){
       129987  +    /* Renumber selId because it has been copied from a view */
       129988  +    p->selId = ++pParse->nSelect;
       129989  +  }
129467 129990     pTabList = p->pSrc;
129468 129991     pEList = p->pEList;
129469 129992     sqlite3WithPush(pParse, p->pWith, 0);
129470 129993   
129471 129994     /* Make sure cursor numbers have been assigned to all entries in
129472 129995     ** the FROM clause of the SELECT statement.
129473 129996     */
................................................................................
129509 130032         pTab->nTabRef++;
129510 130033         if( !IsVirtual(pTab) && cannotBeFunction(pParse, pFrom) ){
129511 130034           return WRC_Abort;
129512 130035         }
129513 130036   #if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE)
129514 130037         if( IsVirtual(pTab) || pTab->pSelect ){
129515 130038           i16 nCol;
       130039  +        u8 eCodeOrig = pWalker->eCode;
129516 130040           if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort;
129517 130041           assert( pFrom->pSelect==0 );
129518 130042           pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0);
129519 130043           nCol = pTab->nCol;
129520 130044           pTab->nCol = -1;
       130045  +        pWalker->eCode = 1;  /* Turn on Select.selId renumbering */
129521 130046           sqlite3WalkSelect(pWalker, pFrom->pSelect);
       130047  +        pWalker->eCode = eCodeOrig;
129522 130048           pTab->nCol = nCol;
129523 130049         }
129524 130050   #endif
129525 130051       }
129526 130052   
129527 130053       /* Locate the index named by the INDEXED BY clause, if any. */
129528 130054       if( sqlite3IndexedByLookup(pParse, pFrom) ){
................................................................................
129764 130290     if( OK_IF_ALWAYS_TRUE(pParse->hasCompound) ){
129765 130291       w.xSelectCallback = convertCompoundSelectToSubquery;
129766 130292       w.xSelectCallback2 = 0;
129767 130293       sqlite3WalkSelect(&w, pSelect);
129768 130294     }
129769 130295     w.xSelectCallback = selectExpander;
129770 130296     w.xSelectCallback2 = selectPopWith;
       130297  +  w.eCode = 0;
129771 130298     sqlite3WalkSelect(&w, pSelect);
129772 130299   }
129773 130300   
129774 130301   
129775 130302   #ifndef SQLITE_OMIT_SUBQUERY
129776 130303   /*
129777 130304   ** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo()
................................................................................
130035 130562       Select *pS = pWalker->u.pSelect;
130036 130563       if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){
130037 130564         sqlite3 *db = pWalker->pParse->db;
130038 130565         Expr *pNew = sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[1], 0);
130039 130566         if( pNew ){
130040 130567           Expr *pWhere = pS->pWhere;
130041 130568           SWAP(Expr, *pNew, *pExpr);
130042         -        pNew = sqlite3ExprAnd(db, pWhere, pNew);
       130569  +        pNew = sqlite3ExprAnd(pWalker->pParse, pWhere, pNew);
130043 130570           pS->pWhere = pNew;
130044 130571           pWalker->eCode = 1;
130045 130572         }
130046 130573       }
130047 130574       return WRC_Prune;
130048 130575     }
130049 130576     return WRC_Continue;
................................................................................
130090 130617   ){
130091 130618     struct SrcList_item *pItem;
130092 130619     for(pItem = pTabList->a; pItem<pThis; pItem++){
130093 130620       Select *pS1;
130094 130621       if( pItem->pSelect==0 ) continue;
130095 130622       if( pItem->fg.viaCoroutine ) continue;
130096 130623       if( pItem->zName==0 ) continue;
130097         -    if( sqlite3_stricmp(pItem->zDatabase, pThis->zDatabase)!=0 ) continue;
       130624  +    assert( pItem->pTab!=0 );
       130625  +    assert( pThis->pTab!=0 );
       130626  +    if( pItem->pTab->pSchema!=pThis->pTab->pSchema ) continue;
130098 130627       if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue;
130099 130628       pS1 = pItem->pSelect;
130100         -    if( pThis->pSelect->selId!=pS1->selId ){
       130629  +    if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){
130101 130630         /* The query flattener left two different CTE tables with identical
130102 130631         ** names in the same FROM clause. */
130103 130632         continue;
130104 130633       }
130105         -    if( sqlite3ExprCompare(0, pThis->pSelect->pWhere, pS1->pWhere, -1) ){
       130634  +    if( sqlite3ExprCompare(0, pThis->pSelect->pWhere, pS1->pWhere, -1)
       130635  +     || sqlite3ExprCompare(0, pThis->pSelect->pHaving, pS1->pHaving, -1) 
       130636  +    ){
130106 130637         /* The view was modified by some other optimization such as
130107 130638         ** pushDownWhereTerms() */
130108 130639         continue;
130109 130640       }
130110 130641       return pItem;
130111 130642     }
130112 130643     return 0;
................................................................................
130123 130654   **    SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2)
130124 130655   **
130125 130656   ** The transformation only works if all of the following are true:
130126 130657   **
130127 130658   **   *  The subquery is a UNION ALL of two or more terms
130128 130659   **   *  The subquery does not have a LIMIT clause
130129 130660   **   *  There is no WHERE or GROUP BY or HAVING clauses on the subqueries
130130         -**   *  The outer query is a simple count(*)
       130661  +**   *  The outer query is a simple count(*) with no WHERE clause or other
       130662  +**      extraneous syntax.
130131 130663   **
130132 130664   ** Return TRUE if the optimization is undertaken.
130133 130665   */
130134 130666   static int countOfViewOptimization(Parse *pParse, Select *p){
130135 130667     Select *pSub, *pPrior;
130136 130668     Expr *pExpr;
130137 130669     Expr *pCount;
130138 130670     sqlite3 *db;
130139 130671     if( (p->selFlags & SF_Aggregate)==0 ) return 0;   /* This is an aggregate */
130140 130672     if( p->pEList->nExpr!=1 ) return 0;               /* Single result column */
       130673  +  if( p->pWhere ) return 0;
       130674  +  if( p->pGroupBy ) return 0;
130141 130675     pExpr = p->pEList->a[0].pExpr;
130142 130676     if( pExpr->op!=TK_AGG_FUNCTION ) return 0;        /* Result is an aggregate */
130143 130677     if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0;  /* Is count() */
130144 130678     if( pExpr->x.pList!=0 ) return 0;                 /* Must be count(*) */
130145 130679     if( p->pSrc->nSrc!=1 ) return 0;                  /* One table in FROM  */
130146 130680     pSub = p->pSrc->a[0].pSelect;
130147 130681     if( pSub==0 ) return 0;                           /* The FROM is a subquery */
................................................................................
132784 133318     Table *pTab;           /* The table to be updated */
132785 133319     int addrTop = 0;       /* VDBE instruction address of the start of the loop */
132786 133320     WhereInfo *pWInfo;     /* Information about the WHERE clause */
132787 133321     Vdbe *v;               /* The virtual database engine */
132788 133322     Index *pIdx;           /* For looping over indices */
132789 133323     Index *pPk;            /* The PRIMARY KEY index for WITHOUT ROWID tables */
132790 133324     int nIdx;              /* Number of indices that need updating */
       133325  +  int nAllIdx;           /* Total number of indexes */
132791 133326     int iBaseCur;          /* Base cursor number */
132792 133327     int iDataCur;          /* Cursor for the canonical data btree */
132793 133328     int iIdxCur;           /* Cursor for the first index */
132794 133329     sqlite3 *db;           /* The database structure */
132795         -  int *aRegIdx = 0;      /* First register in array assigned to each index */
       133330  +  int *aRegIdx = 0;      /* Registers for to each index and the main table */
132796 133331     int *aXRef = 0;        /* aXRef[i] is the index in pChanges->a[] of the
132797 133332                            ** an expression for the i-th column of the table.
132798 133333                            ** aXRef[i]==-1 if the i-th column is not changed. */
132799 133334     u8 *aToOpen;           /* 1 for tables and indices to be opened */
132800 133335     u8 chngPk;             /* PRIMARY KEY changed in a WITHOUT ROWID table */
132801 133336     u8 chngRowid;          /* Rowid changed in a normal table */
132802 133337     u8 chngKey;            /* Either chngPk or chngRowid */
................................................................................
132902 133437       pParse->nTab = iBaseCur;
132903 133438     }
132904 133439     pTabList->a[0].iCursor = iDataCur;
132905 133440   
132906 133441     /* Allocate space for aXRef[], aRegIdx[], and aToOpen[].  
132907 133442     ** Initialize aXRef[] and aToOpen[] to their default values.
132908 133443     */
132909         -  aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx) + nIdx+2 );
       133444  +  aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx+1) + nIdx+2 );
132910 133445     if( aXRef==0 ) goto update_cleanup;
132911 133446     aRegIdx = aXRef+pTab->nCol;
132912         -  aToOpen = (u8*)(aRegIdx+nIdx);
       133447  +  aToOpen = (u8*)(aRegIdx+nIdx+1);
132913 133448     memset(aToOpen, 1, nIdx+1);
132914 133449     aToOpen[nIdx+1] = 0;
132915 133450     for(i=0; i<pTab->nCol; i++) aXRef[i] = -1;
132916 133451   
132917 133452     /* Initialize the name-context */
132918 133453     memset(&sNC, 0, sizeof(sNC));
132919 133454     sNC.pParse = pParse;
................................................................................
132984 133519     hasFK = sqlite3FkRequired(pParse, pTab, aXRef, chngKey);
132985 133520   
132986 133521     /* There is one entry in the aRegIdx[] array for each index on the table
132987 133522     ** being updated.  Fill in aRegIdx[] with a register number that will hold
132988 133523     ** the key for accessing each index.
132989 133524     */
132990 133525     if( onError==OE_Replace ) bReplace = 1;
132991         -  for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
       133526  +  for(nAllIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nAllIdx++){
132992 133527       int reg;
132993 133528       if( chngKey || hasFK>1 || pIdx==pPk
132994 133529        || indexWhereClauseMightChange(pIdx,aXRef,chngRowid)
132995 133530       ){
132996 133531         reg = ++pParse->nMem;
132997 133532         pParse->nMem += pIdx->nColumn;
132998 133533       }else{
................................................................................
133004 133539             if( onError==OE_Default && pIdx->onError==OE_Replace ){
133005 133540               bReplace = 1;
133006 133541             }
133007 133542             break;
133008 133543           }
133009 133544         }
133010 133545       }
133011         -    if( reg==0 ) aToOpen[j+1] = 0;
133012         -    aRegIdx[j] = reg;
       133546  +    if( reg==0 ) aToOpen[nAllIdx+1] = 0;
       133547  +    aRegIdx[nAllIdx] = reg;
133013 133548     }
       133549  +  aRegIdx[nAllIdx] = ++pParse->nMem;  /* Register storing the table record */
133014 133550     if( bReplace ){
133015 133551       /* If REPLACE conflict resolution might be invoked, open cursors on all 
133016 133552       ** indexes in case they are needed to delete records.  */
133017 133553       memset(aToOpen, 1, nIdx+1);
133018 133554     }
133019 133555   
133020 133556     /* Begin generating code. */
................................................................................
133021 133557     v = sqlite3GetVdbe(pParse);
133022 133558     if( v==0 ) goto update_cleanup;
133023 133559     if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
133024 133560     sqlite3BeginWriteOperation(pParse, pTrigger || hasFK, iDb);
133025 133561   
133026 133562     /* Allocate required registers. */
133027 133563     if( !IsVirtual(pTab) ){
133028         -    regRowSet = ++pParse->nMem;
       133564  +    /* For now, regRowSet and aRegIdx[nAllIdx] share the same register.
       133565  +    ** If regRowSet turns out to be needed, then aRegIdx[nAllIdx] will be
       133566  +    ** reallocated.  aRegIdx[nAllIdx] is the register in which the main
       133567  +    ** table record is written.  regRowSet holds the RowSet for the
       133568  +    ** two-pass update algorithm. */
       133569  +    assert( aRegIdx[nAllIdx]==pParse->nMem );
       133570  +    regRowSet = aRegIdx[nAllIdx];
133029 133571       regOldRowid = regNewRowid = ++pParse->nMem;
133030 133572       if( chngPk || pTrigger || hasFK ){
133031 133573         regOld = pParse->nMem + 1;
133032 133574         pParse->nMem += pTab->nCol;
133033 133575       }
133034 133576       if( chngKey || pTrigger || hasFK ){
133035 133577         regNewRowid = ++pParse->nMem;
................................................................................
133151 133693   
133152 133694     if( HasRowid(pTab) ){
133153 133695       /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF
133154 133696       ** mode, write the rowid into the FIFO. In either of the one-pass modes,
133155 133697       ** leave it in register regOldRowid.  */
133156 133698       sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid);
133157 133699       if( eOnePass==ONEPASS_OFF ){
       133700  +      /* We need to use regRowSet, so reallocate aRegIdx[nAllIdx] */
       133701  +      aRegIdx[nAllIdx] = ++pParse->nMem;
133158 133702         sqlite3VdbeAddOp2(v, OP_RowSetAdd, regRowSet, regOldRowid);
133159 133703       }
133160 133704     }else{
133161 133705       /* Read the PK of the current row into an array of registers. In
133162 133706       ** ONEPASS_OFF mode, serialize the array into a record and store it in
133163 133707       ** the ephemeral table. Or, in ONEPASS_SINGLE or MULTI mode, change
133164 133708       ** the OP_OpenEphemeral instruction to a Noop (the ephemeral table 
................................................................................
133982 134526   ** transient would cause the database file to appear to be deleted
133983 134527   ** following reboot.
133984 134528   */
133985 134529   SQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse, Token *pNm, Expr *pInto){
133986 134530     Vdbe *v = sqlite3GetVdbe(pParse);
133987 134531     int iDb = 0;
133988 134532     if( v==0 ) goto build_vacuum_end;
       134533  +  if( pParse->nErr ) goto build_vacuum_end;
133989 134534     if( pNm ){
133990 134535   #ifndef SQLITE_BUG_COMPATIBLE_20160819
133991 134536       /* Default behavior:  Report an error if the argument to VACUUM is
133992 134537       ** not recognized */
133993 134538       iDb = sqlite3TwoPartName(pParse, pNm, pNm, &pNm);
133994 134539       if( iDb<0 ) goto build_vacuum_end;
133995 134540   #else
................................................................................
135134 135679         if( p->pVtab->nRef>0 ){
135135 135680           return SQLITE_LOCKED;
135136 135681         }
135137 135682       }
135138 135683       p = vtabDisconnectAll(db, pTab);
135139 135684       xDestroy = p->pMod->pModule->xDestroy;
135140 135685       assert( xDestroy!=0 );  /* Checked before the virtual table is created */
       135686  +    pTab->nTabRef++;
135141 135687       rc = xDestroy(p->pVtab);
135142 135688       /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */
135143 135689       if( rc==SQLITE_OK ){
135144 135690         assert( pTab->pVTable==p && p->pNext==0 );
135145 135691         p->pVtab = 0;
135146 135692         pTab->pVTable = 0;
135147 135693         sqlite3VtabUnlock(p);
135148 135694       }
       135695  +    sqlite3DeleteTable(db, pTab);
135149 135696     }
135150 135697   
135151 135698     return rc;
135152 135699   }
135153 135700   
135154 135701   /*
135155 135702   ** This function invokes either the xRollback or xCommit method
................................................................................
135584 136131   **
135585 136132   *************************************************************************
135586 136133   **
135587 136134   ** This file contains structure and macro definitions for the query
135588 136135   ** planner logic in "where.c".  These definitions are broken out into
135589 136136   ** a separate source file for easier editing.
135590 136137   */
       136138  +#ifndef SQLITE_WHEREINT_H
       136139  +#define SQLITE_WHEREINT_H
135591 136140   
135592 136141   /*
135593 136142   ** Trace output macros
135594 136143   */
135595 136144   #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
135596 136145   /***/ extern int sqlite3WhereTrace;
135597 136146   #endif
................................................................................
136154 136703   #define WHERE_ONEROW       0x00001000  /* Selects no more than one row */
136155 136704   #define WHERE_MULTI_OR     0x00002000  /* OR using multiple indices */
136156 136705   #define WHERE_AUTO_INDEX   0x00004000  /* Uses an ephemeral index */
136157 136706   #define WHERE_SKIPSCAN     0x00008000  /* Uses the skip-scan algorithm */
136158 136707   #define WHERE_UNQ_WANTED   0x00010000  /* WHERE_ONEROW would have been helpful*/
136159 136708   #define WHERE_PARTIALIDX   0x00020000  /* The automatic index is partial */
136160 136709   #define WHERE_IN_EARLYOUT  0x00040000  /* Perhaps quit IN loops early */
       136710  +
       136711  +#endif /* !defined(SQLITE_WHEREINT_H) */
136161 136712   
136162 136713   /************** End of whereInt.h ********************************************/
136163 136714   /************** Continuing where we left off in wherecode.c ******************/
136164 136715   
136165 136716   #ifndef SQLITE_OMIT_EXPLAIN
136166 136717   
136167 136718   /*
................................................................................
137137 137688         sWalker.eCode = 0;
137138 137689         sWalker.xExprCallback = codeCursorHintCheckExpr;
137139 137690         sqlite3WalkExpr(&sWalker, pTerm->pExpr);
137140 137691         if( sWalker.eCode ) continue;
137141 137692       }
137142 137693   
137143 137694       /* If we survive all prior tests, that means this term is worth hinting */
137144         -    pExpr = sqlite3ExprAnd(db, pExpr, sqlite3ExprDup(db, pTerm->pExpr, 0));
       137695  +    pExpr = sqlite3ExprAnd(pParse, pExpr, sqlite3ExprDup(db, pTerm->pExpr, 0));
137145 137696     }
137146 137697     if( pExpr!=0 ){
137147 137698       sWalker.xExprCallback = codeCursorHintFixExpr;
137148 137699       sqlite3WalkExpr(&sWalker, pExpr);
137149 137700       sqlite3VdbeAddOp4(v, OP_CursorHint, 
137150 137701                         (sHint.pIdx ? sHint.iIdxCur : sHint.iTabCur), 0, 0,
137151 137702                         (const char*)pExpr, P4_EXPR);
................................................................................
138102 138653           if( &pWC->a[iTerm] == pTerm ) continue;
138103 138654           testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );
138104 138655           testcase( pWC->a[iTerm].wtFlags & TERM_CODED );
138105 138656           if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue;
138106 138657           if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
138107 138658           testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
138108 138659           pExpr = sqlite3ExprDup(db, pExpr, 0);
138109         -        pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr);
       138660  +        pAndExpr = sqlite3ExprAnd(pParse, pAndExpr, pExpr);
138110 138661         }
138111 138662         if( pAndExpr ){
138112 138663           /* The extra 0x10000 bit on the opcode is masked off and does not
138113 138664           ** become part of the new Expr.op.  However, it does make the
138114 138665           ** op==TK_AND comparison inside of sqlite3PExpr() false, and this
138115 138666           ** prevents sqlite3PExpr() from implementing AND short-circuit 
138116 138667           ** optimization, which we do not want here. */
................................................................................
138253 138804         pAndExpr->pLeft = 0;
138254 138805         sqlite3ExprDelete(db, pAndExpr);
138255 138806       }
138256 138807       sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v));
138257 138808       sqlite3VdbeGoto(v, pLevel->addrBrk);
138258 138809       sqlite3VdbeResolveLabel(v, iLoopBody);
138259 138810   
138260         -    if( pWInfo->nLevel>1 ) sqlite3StackFree(db, pOrTab);
       138811  +    if( pWInfo->nLevel>1 ){ sqlite3StackFree(db, pOrTab); }
138261 138812       if( !untestedTerms ) disableTerm(pLevel, pTerm);
138262 138813     }else
138263 138814   #endif /* SQLITE_OMIT_OR_OPTIMIZATION */
138264 138815   
138265 138816     {
138266 138817       /* Case 6:  There is no usable index.  We must do a complete
138267 138818       **          scan of the entire table.
................................................................................
138686 139237           char *zNew = pPrefix->u.zToken;
138687 139238           zNew[cnt] = 0;
138688 139239           for(iFrom=iTo=0; iFrom<cnt; iFrom++){
138689 139240             if( zNew[iFrom]==wc[3] ) iFrom++;
138690 139241             zNew[iTo++] = zNew[iFrom];
138691 139242           }
138692 139243           zNew[iTo] = 0;
138693         -
138694         -        /* If the RHS begins with a digit or a minus sign, then the LHS must be
138695         -        ** an ordinary column (not a virtual table column) with TEXT affinity.
138696         -        ** Otherwise the LHS might be numeric and "lhs >= rhs" would be false
138697         -        ** even though "lhs LIKE rhs" is true.  But if the RHS does not start
138698         -        ** with a digit or '-', then "lhs LIKE rhs" will always be false if
138699         -        ** the LHS is numeric and so the optimization still works.
138700         -        **
138701         -        ** 2018-09-10 ticket c94369cae9b561b1f996d0054bfab11389f9d033
138702         -        ** The RHS pattern must not be '/%' because the termination condition
138703         -        ** will then become "x<'0'" and if the affinity is numeric, will then
138704         -        ** be converted into "x<0", which is incorrect.
138705         -        */
138706         -        if( sqlite3Isdigit(zNew[0])
138707         -         || zNew[0]=='-'
138708         -         || (zNew[0]+1=='0' && iTo==1)
138709         -        ){
138710         -          if( pLeft->op!=TK_COLUMN 
138711         -           || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT 
138712         -           || IsVirtual(pLeft->y.pTab)  /* Value might be numeric */
138713         -          ){
       139244  +        assert( iTo>0 );
       139245  +
       139246  +        /* If the LHS is not an ordinary column with TEXT affinity, then the
       139247  +        ** pattern prefix boundaries (both the start and end boundaries) must
       139248  +        ** not look like a number.  Otherwise the pattern might be treated as
       139249  +        ** a number, which will invalidate the LIKE optimization.
       139250  +        **
       139251  +        ** Getting this right has been a persistent source of bugs in the
       139252  +        ** LIKE optimization.  See, for example:
       139253  +        **    2018-09-10 https://sqlite.org/src/info/c94369cae9b561b1
       139254  +        **    2019-05-02 https://sqlite.org/src/info/b043a54c3de54b28
       139255  +        **    2019-06-10 https://sqlite.org/src/info/fd76310a5e843e07
       139256  +        **    2019-06-14 https://sqlite.org/src/info/ce8717f0885af975
       139257  +        */
       139258  +        if( pLeft->op!=TK_COLUMN 
       139259  +         || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT 
       139260  +         || IsVirtual(pLeft->y.pTab)  /* Value might be numeric */
       139261  +        ){
       139262  +          int isNum;
       139263  +          double rDummy;
       139264  +          isNum = sqlite3AtoF(zNew, &rDummy, iTo, SQLITE_UTF8);
       139265  +          if( isNum<=0 ){
       139266  +            zNew[iTo-1]++;
       139267  +            isNum = sqlite3AtoF(zNew, &rDummy, iTo, SQLITE_UTF8);
       139268  +            zNew[iTo-1]--;
       139269  +          }
       139270  +          if( isNum>0 ){
138714 139271               sqlite3ExprDelete(db, pPrefix);
138715 139272               sqlite3ValueFree(pVal);
138716 139273               return 0;
138717 139274             }
138718 139275           }
138719 139276         }
138720 139277         *ppPrefix = pPrefix;
................................................................................
140593 141150   /*
140594 141151   ** Convert OP_Column opcodes to OP_Copy in previously generated code.
140595 141152   **
140596 141153   ** This routine runs over generated VDBE code and translates OP_Column
140597 141154   ** opcodes into OP_Copy when the table is being accessed via co-routine 
140598 141155   ** instead of via table lookup.
140599 141156   **
140600         -** If the bIncrRowid parameter is 0, then any OP_Rowid instructions on
140601         -** cursor iTabCur are transformed into OP_Null. Or, if bIncrRowid is non-zero,
140602         -** then each OP_Rowid is transformed into an instruction to increment the
140603         -** value stored in its output register.
       141157  +** If the iAutoidxCur is not zero, then any OP_Rowid instructions on
       141158  +** cursor iTabCur are transformed into OP_Sequence opcode for the
       141159  +** iAutoidxCur cursor, in order to generate unique rowids for the
       141160  +** automatic index being generated.
140604 141161   */
140605 141162   static void translateColumnToCopy(
140606 141163     Parse *pParse,      /* Parsing context */
140607 141164     int iStart,         /* Translate from this opcode to the end */
140608 141165     int iTabCur,        /* OP_Column/OP_Rowid references to this table */
140609 141166     int iRegister,      /* The first column is in this register */
140610         -  int bIncrRowid      /* If non-zero, transform OP_rowid to OP_AddImm(1) */
       141167  +  int iAutoidxCur     /* If non-zero, cursor of autoindex being generated */
140611 141168   ){
140612 141169     Vdbe *v = pParse->pVdbe;
140613 141170     VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart);
140614 141171     int iEnd = sqlite3VdbeCurrentAddr(v);
140615 141172     if( pParse->db->mallocFailed ) return;
140616 141173     for(; iStart<iEnd; iStart++, pOp++){
140617 141174       if( pOp->p1!=iTabCur ) continue;
140618 141175       if( pOp->opcode==OP_Column ){
140619 141176         pOp->opcode = OP_Copy;
140620 141177         pOp->p1 = pOp->p2 + iRegister;
140621 141178         pOp->p2 = pOp->p3;
140622 141179         pOp->p3 = 0;
140623 141180       }else if( pOp->opcode==OP_Rowid ){
140624         -      if( bIncrRowid ){
140625         -        /* Increment the value stored in the P2 operand of the OP_Rowid. */
140626         -        pOp->opcode = OP_AddImm;
140627         -        pOp->p1 = pOp->p2;
140628         -        pOp->p2 = 1;
       141181  +      if( iAutoidxCur ){
       141182  +        pOp->opcode = OP_Sequence;
       141183  +        pOp->p1 = iAutoidxCur;
140629 141184         }else{
140630 141185           pOp->opcode = OP_Null;
140631 141186           pOp->p1 = 0;
140632 141187           pOp->p3 = 0;
140633 141188         }
140634 141189       }
140635 141190     }
................................................................................
140768 141323       assert( !ExprHasProperty(pExpr, EP_FromJoin)    /* prereq always non-zero */
140769 141324            || pExpr->iRightJoinTable!=pSrc->iCursor   /*   for the right-hand   */
140770 141325            || pLoop->prereq!=0 );                     /*   table of a LEFT JOIN */
140771 141326       if( pLoop->prereq==0
140772 141327        && (pTerm->wtFlags & TERM_VIRTUAL)==0
140773 141328        && !ExprHasProperty(pExpr, EP_FromJoin)
140774 141329        && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
140775         -      pPartial = sqlite3ExprAnd(pParse->db, pPartial,
       141330  +      pPartial = sqlite3ExprAnd(pParse, pPartial,
140776 141331                                   sqlite3ExprDup(pParse->db, pExpr, 0));
140777 141332       }
140778 141333       if( termCanDriveIndex(pTerm, pSrc, notReady) ){
140779 141334         int iCol = pTerm->u.leftColumn;
140780 141335         Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
140781 141336         testcase( iCol==BMS );
140782 141337         testcase( iCol==BMS-1 );
................................................................................
140895 141450     );
140896 141451     sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
140897 141452     sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
140898 141453     if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
140899 141454     if( pTabItem->fg.viaCoroutine ){
140900 141455       sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
140901 141456       testcase( pParse->db->mallocFailed );
       141457  +    assert( pLevel->iIdxCur>0 );
140902 141458       translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
140903         -                          pTabItem->regResult, 1);
       141459  +                          pTabItem->regResult, pLevel->iIdxCur);
140904 141460       sqlite3VdbeGoto(v, addrTop);
140905 141461       pTabItem->fg.viaCoroutine = 0;
140906 141462     }else{
140907 141463       sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
140908 141464     }
140909 141465     sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
140910 141466     sqlite3VdbeJumpHere(v, addrTop);
................................................................................
146141 146697   ** selectWindowRewriteExprCb() by selectWindowRewriteEList().
146142 146698   */
146143 146699   typedef struct WindowRewrite WindowRewrite;
146144 146700   struct WindowRewrite {
146145 146701     Window *pWin;
146146 146702     SrcList *pSrc;
146147 146703     ExprList *pSub;
       146704  +  Table *pTab;
146148 146705     Select *pSubSelect;             /* Current sub-select, if any */
146149 146706   };
146150 146707   
146151 146708   /*
146152 146709   ** Callback function used by selectWindowRewriteEList(). If necessary,
146153 146710   ** this function appends to the output expression-list and updates 
146154 146711   ** expression (*ppExpr) in place.
................................................................................
146201 146758           sqlite3ExprDelete(pParse->db, pExpr);
146202 146759           ExprClearProperty(pExpr, EP_Static);
146203 146760           memset(pExpr, 0, sizeof(Expr));
146204 146761   
146205 146762           pExpr->op = TK_COLUMN;
146206 146763           pExpr->iColumn = p->pSub->nExpr-1;
146207 146764           pExpr->iTable = p->pWin->iEphCsr;
       146765  +        pExpr->y.pTab = p->pTab;
146208 146766         }
146209 146767   
146210 146768         break;
146211 146769       }
146212 146770   
146213 146771       default: /* no-op */
146214 146772         break;
................................................................................
146244 146802   ** appending the new one.
146245 146803   */
146246 146804   static void selectWindowRewriteEList(
146247 146805     Parse *pParse, 
146248 146806     Window *pWin,
146249 146807     SrcList *pSrc,
146250 146808     ExprList *pEList,               /* Rewrite expressions in this list */
       146809  +  Table *pTab,
146251 146810     ExprList **ppSub                /* IN/OUT: Sub-select expression-list */
146252 146811   ){
146253 146812     Walker sWalker;
146254 146813     WindowRewrite sRewrite;
146255 146814   
146256 146815     memset(&sWalker, 0, sizeof(Walker));
146257 146816     memset(&sRewrite, 0, sizeof(WindowRewrite));
146258 146817   
146259 146818     sRewrite.pSub = *ppSub;
146260 146819     sRewrite.pWin = pWin;
146261 146820     sRewrite.pSrc = pSrc;
       146821  +  sRewrite.pTab = pTab;
146262 146822   
146263 146823     sWalker.pParse = pParse;
146264 146824     sWalker.xExprCallback = selectWindowRewriteExprCb;
146265 146825     sWalker.xSelectCallback = selectWindowRewriteSelectCb;
146266 146826     sWalker.u.pRewrite = &sRewrite;
146267 146827   
146268 146828     (void)sqlite3WalkExprList(&sWalker, pEList);
................................................................................
146273 146833   /*
146274 146834   ** Append a copy of each expression in expression-list pAppend to
146275 146835   ** expression list pList. Return a pointer to the result list.
146276 146836   */
146277 146837   static ExprList *exprListAppendList(
146278 146838     Parse *pParse,          /* Parsing context */
146279 146839     ExprList *pList,        /* List to which to append. Might be NULL */
146280         -  ExprList *pAppend       /* List of values to append. Might be NULL */
       146840  +  ExprList *pAppend,      /* List of values to append. Might be NULL */
       146841  +  int bIntToNull
146281 146842   ){
146282 146843     if( pAppend ){
146283 146844       int i;
146284 146845       int nInit = pList ? pList->nExpr : 0;
146285 146846       for(i=0; i<pAppend->nExpr; i++){
146286 146847         Expr *pDup = sqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0);
       146848  +      if( bIntToNull && pDup && pDup->op==TK_INTEGER ){
       146849  +        pDup->op = TK_NULL;
       146850  +        pDup->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse);
       146851  +      }
146287 146852         pList = sqlite3ExprListAppend(pParse, pList, pDup);
146288 146853         if( pList ) pList->a[nInit+i].sortOrder = pAppend->a[i].sortOrder;
146289 146854       }
146290 146855     }
146291 146856     return pList;
146292 146857   }
146293 146858   
................................................................................
146309 146874       ExprList *pGroupBy = p->pGroupBy;
146310 146875       Expr *pHaving = p->pHaving;
146311 146876       ExprList *pSort = 0;
146312 146877   
146313 146878       ExprList *pSublist = 0;       /* Expression list for sub-query */
146314 146879       Window *pMWin = p->pWin;      /* Master window object */
146315 146880       Window *pWin;                 /* Window object iterator */
       146881  +    Table *pTab;
       146882  +
       146883  +    pTab = sqlite3DbMallocZero(db, sizeof(Table));
       146884  +    if( pTab==0 ){
       146885  +      return SQLITE_NOMEM;
       146886  +    }
146316 146887   
146317 146888       p->pSrc = 0;
146318 146889       p->pWhere = 0;
146319 146890       p->pGroupBy = 0;
146320 146891       p->pHaving = 0;
       146892  +    p->selFlags &= ~SF_Aggregate;
146321 146893   
146322 146894       /* Create the ORDER BY clause for the sub-select. This is the concatenation
146323 146895       ** of the window PARTITION and ORDER BY clauses. Then, if this makes it
146324 146896       ** redundant, remove the ORDER BY from the parent SELECT.  */
146325 146897       pSort = sqlite3ExprListDup(db, pMWin->pPartition, 0);
146326         -    pSort = exprListAppendList(pParse, pSort, pMWin->pOrderBy);
       146898  +    pSort = exprListAppendList(pParse, pSort, pMWin->pOrderBy, 1);
146327 146899       if( pSort && p->pOrderBy ){
146328 146900         if( sqlite3ExprListCompare(pSort, p->pOrderBy, -1)==0 ){
146329 146901           sqlite3ExprListDelete(db, p->pOrderBy);
146330 146902           p->pOrderBy = 0;
146331 146903         }
146332 146904       }
146333 146905   
146334 146906       /* Assign a cursor number for the ephemeral table used to buffer rows.
146335 146907       ** The OpenEphemeral instruction is coded later, after it is known how
146336 146908       ** many columns the table will have.  */
146337 146909       pMWin->iEphCsr = pParse->nTab++;
146338 146910       pParse->nTab += 3;
146339 146911   
146340         -    selectWindowRewriteEList(pParse, pMWin, pSrc, p->pEList, &pSublist);
146341         -    selectWindowRewriteEList(pParse, pMWin, pSrc, p->pOrderBy, &pSublist);
       146912  +    selectWindowRewriteEList(pParse, pMWin, pSrc, p->pEList, pTab, &pSublist);
       146913  +    selectWindowRewriteEList(pParse, pMWin, pSrc, p->pOrderBy, pTab, &pSublist);
146342 146914       pMWin->nBufferCol = (pSublist ? pSublist->nExpr : 0);
146343 146915   
146344 146916       /* Append the PARTITION BY and ORDER BY expressions to the to the 
146345 146917       ** sub-select expression list. They are required to figure out where 
146346 146918       ** boundaries for partitions and sets of peer rows lie.  */
146347         -    pSublist = exprListAppendList(pParse, pSublist, pMWin->pPartition);
146348         -    pSublist = exprListAppendList(pParse, pSublist, pMWin->pOrderBy);
       146919  +    pSublist = exprListAppendList(pParse, pSublist, pMWin->pPartition, 0);
       146920  +    pSublist = exprListAppendList(pParse, pSublist, pMWin->pOrderBy, 0);
146349 146921   
146350 146922       /* Append the arguments passed to each window function to the
146351 146923       ** sub-select expression list. Also allocate two registers for each
146352 146924       ** window function - one for the accumulator, another for interim
146353 146925       ** results.  */
146354 146926       for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
146355 146927         pWin->iArgCol = (pSublist ? pSublist->nExpr : 0);
146356         -      pSublist = exprListAppendList(pParse, pSublist, pWin->pOwner->x.pList);
       146928  +      pSublist = exprListAppendList(pParse, pSublist, pWin->pOwner->x.pList, 0);
146357 146929         if( pWin->pFilter ){
146358 146930           Expr *pFilter = sqlite3ExprDup(db, pWin->pFilter, 0);
146359 146931           pSublist = sqlite3ExprListAppend(pParse, pSublist, pFilter);
146360 146932         }
146361 146933         pWin->regAccum = ++pParse->nMem;
146362 146934         pWin->regResult = ++pParse->nMem;
146363 146935         sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum);
................................................................................
146376 146948       }
146377 146949   
146378 146950       pSub = sqlite3SelectNew(
146379 146951           pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
146380 146952       );
146381 146953       p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
146382 146954       if( p->pSrc ){
       146955  +      Table *pTab2;
146383 146956         p->pSrc->a[0].pSelect = pSub;
146384 146957         sqlite3SrcListAssignCursors(pParse, p->pSrc);
146385         -      if( sqlite3ExpandSubquery(pParse, &p->pSrc->a[0]) ){
       146958  +      pSub->selFlags |= SF_Expanded;
       146959  +      pTab2 = sqlite3ResultSetOfSelect(pParse, pSub);
       146960  +      if( pTab2==0 ){
146386 146961           rc = SQLITE_NOMEM;
146387 146962         }else{
146388         -        pSub->selFlags |= SF_Expanded;
146389         -        p->selFlags &= ~SF_Aggregate;
146390         -        sqlite3SelectPrep(pParse, pSub, 0);
       146963  +        memcpy(pTab, pTab2, sizeof(Table));
       146964  +        pTab->tabFlags |= TF_Ephemeral;
       146965  +        p->pSrc->a[0].pTab = pTab;
       146966  +        pTab = pTab2;
146391 146967         }
146392         -
146393 146968         sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pMWin->iEphCsr, pSublist->nExpr);
146394 146969         sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+1, pMWin->iEphCsr);
146395 146970         sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+2, pMWin->iEphCsr);
146396 146971         sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+3, pMWin->iEphCsr);
146397 146972       }else{
146398 146973         sqlite3SelectDelete(db, pSub);
146399 146974       }
146400 146975       if( db->mallocFailed ) rc = SQLITE_NOMEM;
       146976  +    sqlite3DbFree(db, pTab);
146401 146977     }
146402 146978   
146403 146979     return rc;
146404 146980   }
146405 146981   
146406 146982   /*
146407 146983   ** Free the Window object passed as the second argument.
................................................................................
148361 148937   **    YY_MAX_REDUCE      Maximum value for reduce actions
148362 148938   */
148363 148939   #ifndef INTERFACE
148364 148940   # define INTERFACE 1
148365 148941   #endif
148366 148942   /************* Begin control #defines *****************************************/
148367 148943   #define YYCODETYPE unsigned short int
148368         -#define YYNOCODE 301
       148944  +#define YYNOCODE 302
148369 148945   #define YYACTIONTYPE unsigned short int
148370 148946   #define YYWILDCARD 95
148371 148947   #define sqlite3ParserTOKENTYPE Token
148372 148948   typedef union {
148373 148949     int yyinit;
148374 148950     sqlite3ParserTOKENTYPE yy0;
148375         -  With* yy59;
148376         -  IdList* yy62;
148377         -  struct TrigEvent yy90;
148378         -  Upsert* yy136;
148379         -  struct FrameBound yy201;
148380         -  u8 yy238;
148381         -  const char* yy294;
148382         -  Window* yy295;
148383         -  struct {int value; int mask;} yy355;
148384         -  ExprList* yy434;
148385         -  TriggerStep* yy455;
148386         -  Select* yy457;
148387         -  SrcList* yy483;
148388         -  int yy494;
148389         -  Expr* yy524;
       148951  +  TriggerStep* yy11;
       148952  +  IdList* yy76;
       148953  +  ExprList* yy94;
       148954  +  Upsert* yy95;
       148955  +  int yy100;
       148956  +  Expr* yy102;
       148957  +  struct {int value; int mask;} yy199;
       148958  +  u8 yy218;
       148959  +  With* yy243;
       148960  +  struct TrigEvent yy298;
       148961  +  Window* yy379;
       148962  +  struct FrameBound yy389;
       148963  +  Select* yy391;
       148964  +  SrcList* yy407;
       148965  +  const char* yy528;
148390 148966   } YYMINORTYPE;
148391 148967   #ifndef YYSTACKDEPTH
148392 148968   #define YYSTACKDEPTH 100
148393 148969   #endif
148394 148970   #define sqlite3ParserARG_SDECL
148395 148971   #define sqlite3ParserARG_PDECL
148396 148972   #define sqlite3ParserARG_PARAM
................................................................................
148398 148974   #define sqlite3ParserARG_STORE
148399 148975   #define sqlite3ParserCTX_SDECL Parse *pParse;
148400 148976   #define sqlite3ParserCTX_PDECL ,Parse *pParse
148401 148977   #define sqlite3ParserCTX_PARAM ,pParse
148402 148978   #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
148403 148979   #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
148404 148980   #define YYFALLBACK 1
148405         -#define YYNSTATE             541
148406         -#define YYNRULE              375
       148981  +#define YYNSTATE             540
       148982  +#define YYNRULE              376
148407 148983   #define YYNTOKEN             176
148408         -#define YY_MAX_SHIFT         540
148409         -#define YY_MIN_SHIFTREDUCE   784
       148984  +#define YY_MAX_SHIFT         539
       148985  +#define YY_MIN_SHIFTREDUCE   783
148410 148986   #define YY_MAX_SHIFTREDUCE   1158
148411 148987   #define YY_ERROR_ACTION      1159
148412 148988   #define YY_ACCEPT_ACTION     1160
148413 148989   #define YY_NO_ACTION         1161
148414 148990   #define YY_MIN_REDUCE        1162
148415         -#define YY_MAX_REDUCE        1536
       148991  +#define YY_MAX_REDUCE        1537
148416 148992   /************* End control #defines *******************************************/
148417 148993   #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
148418 148994   
148419 148995   /* Define the yytestcase() macro to be a no-op if is not already defined
148420 148996   ** otherwise.
148421 148997   **
148422 148998   ** Applications can choose to define yytestcase() in the %include section
................................................................................
148477 149053   **  yy_reduce_ofst[]   For each state, the offset into yy_action for
148478 149054   **                     shifting non-terminals after a reduce.
148479 149055   **  yy_default[]       Default action for each state.
148480 149056   **
148481 149057   *********** Begin parsing tables **********************************************/
148482 149058   #define YY_ACTTAB_COUNT (2142)
148483 149059   static const YYACTIONTYPE yy_action[] = {
148484         - /*     0 */   535, 1323,  112,  109,  209,  112,  109,  209, 1160,    1,
148485         - /*    10 */     1,  540,    2, 1164,  535, 1292, 1228, 1207,  289,  384,
148486         - /*    20 */   134,   42,   42, 1427,  382, 1228,    9, 1241,  242,  492,
148487         - /*    30 */  1291,  915,  373,  379, 1026,   70,   70,  427, 1026,  916,
148488         - /*    40 */   529,  529,  529,  119,  120,  110, 1136, 1136,  981,  984,
148489         - /*    50 */   974,  974,  117,  117,  118,  118,  118,  118,  380,  264,
148490         - /*    60 */   264,  264,  264, 1134,  264,  264,  112,  109,  209,  397,
148491         - /*    70 */   454,  517,  532,  491,  532, 1233, 1233,  532,  239,  206,
148492         - /*    80 */   493,  112,  109,  209,  464,  219,  118,  118,  118,  118,
148493         - /*    90 */   111,  393,  440,  444,   16,   16,  116,  116,  116,  116,
148494         - /*   100 */   115,  115,  114,  114,  114,  113,  415,  971,  971,  982,
148495         - /*   110 */   985,  235, 1463,  351, 1134,  419,  384,  116,  116,  116,
148496         - /*   120 */   116,  115,  115,  114,  114,  114,  113,  415,  116,  116,
148497         - /*   130 */   116,  116,  115,  115,  114,  114,  114,  113,  415,  961,
       149060  + /*     0 */   112,  109,  209,  112,  109,  209, 1160,    1,    1,  539,
       149061  + /*    10 */     2, 1164,  490, 1193, 1293,  534,  289, 1196,  134,  383,
       149062  + /*    20 */  1485, 1428, 1164, 1229, 1208, 1242, 1195,  289,  491,  134,
       149063  + /*    30 */   373,  915, 1229,  443,   16,   16, 1242,   70,   70,  916,
       149064  + /*    40 */   242, 1292,  296,  119,  120,  110, 1136, 1136,  981,  984,
       149065  + /*    50 */   974,  974,  117,  117,  118,  118,  118,  118,  264,  264,
       149066  + /*    60 */   190,  264,  264,  264,  264,  112,  109,  209,  362,  264,
       149067  + /*    70 */   264,  531,  376,  497,  531, 1134,  531, 1501,  239,  206,
       149068  + /*    80 */   338,    9,  531,  242,  219, 1203,  118,  118,  118,  118,
       149069  + /*    90 */   111,  439,  112,  109,  209,  219,  116,  116,  116,  116,
       149070  + /*   100 */   115,  115,  114,  114,  114,  113,  414,  115,  115,  114,
       149071  + /*   110 */   114,  114,  113,  414,  418,   12,  383,  400, 1134,  114,
       149072  + /*   120 */   114,  114,  113,  414, 1115,  418, 1134, 1392,  116,  116,
       149073  + /*   130 */   116,  116,  115,  115,  114,  114,  114,  113,  414,  961,
148498 149074    /*   140 */   119,  120,  110, 1136, 1136,  981,  984,  974,  974,  117,
148499         - /*   150 */   117,  118,  118,  118,  118,  952,  415,  941,  298,  951,
148500         - /*   160 */   941, 1480,  540,    2, 1164, 1115,  535, 1458,  160,  289,
148501         - /*   170 */     6,  134, 1504,  389,  406,  975,  338, 1024, 1241,  337,
148502         - /*   180 */  1089, 1476, 1089,  118,  118,  118,  118,   42,   42,  329,
       149075  + /*   150 */   117,  118,  118,  118,  118,  952,  534,  414,  941,  951,
       149076  + /*   160 */  1481,  539,    2, 1164, 1505,  534,  160,  175,  289, 1134,
       149077  + /*   170 */   134,  434,  312,  297, 1115, 1116, 1117, 1242,   70,   70,
       149078  + /*   180 */  1089,  338, 1089,  118,  118,  118,  118,   42,   42,  448,
148503 149079    /*   190 */   951,  951,  953,  116,  116,  116,  116,  115,  115,  114,
148504         - /*   200 */   114,  114,  113,  415,  311,  430,  299,  311,  881,  160,
148505         - /*   210 */   264,  264,  401,  384,  324, 1115, 1116, 1117,  288,  526,
148506         - /*   220 */    96,  159, 1441,  532,  141,  116,  116,  116,  116,  115,
148507         - /*   230 */   115,  114,  114,  114,  113,  415,  219,  119,  120,  110,
       149080  + /*   200 */   114,  114,  113,  414, 1115,  311,  264,  264,   82,  441,
       149081  + /*   210 */   264,  264,  190,  383,  284,   12,  288,  525,  407,  531,
       149082  + /*   220 */    96,  159,  458,  531,  371,  116,  116,  116,  116,  115,
       149083  + /*   230 */   115,  114,  114,  114,  113,  414,  219,  119,  120,  110,
148508 149084    /*   240 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
148509         - /*   250 */   118,  118,  115,  115,  114,  114,  114,  113,  415,  288,
148510         - /*   260 */   526,  403,  533,  121,  870,  870,  419,  250,  267,  336,
148511         - /*   270 */   475,  331,  474,  236,  160,  319, 1084,  322, 1465,  329,
148512         - /*   280 */   350,   12,  535,  384,  502, 1115, 1084,  435,  312, 1084,
       149085  + /*   250 */   118,  118,  511, 1477, 1115, 1116, 1117,  113,  414,  534,
       149086  + /*   260 */   528,  528,  528,  121,  534, 1427,  418,  116,  116,  116,
       149087  + /*   270 */   116,  115,  115,  114,  114,  114,  113,  414, 1464,  351,
       149088  + /*   280 */   270,   42,   42,  383,  187, 1115,   70,   70,  533,  433,
148513 149089    /*   290 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
148514         - /*   300 */   415,  535,  836,   42,   42,  138,  426,  119,  120,  110,
       149090  + /*   300 */   414,  534, 1339,  405,  159,  411,  410,  119,  120,  110,
148515 149091    /*   310 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
148516         - /*   320 */   118,  118,   70,   70,  288,  526,  412,  411,  480, 1457,
148517         - /*   330 */   335,   79,    6,  473, 1140, 1115, 1116, 1117,  501, 1142,
148518         - /*   340 */   334,  837,  811, 1484,  512, 1164,  534, 1141,  123,  187,
148519         - /*   350 */   289,  384,  134,  448,  434, 1115,   80,  349,  498, 1241,
       149092  + /*   320 */   118,  118,  285,   42,   42,  349,  411,  410,  514,  479,
       149093  + /*   330 */  1458,   79, 1084,    6, 1140, 1115, 1116, 1117,  480, 1142,
       149094  + /*   340 */   501, 1115, 1084,  123,  238, 1084,  136, 1141, 1234, 1234,
       149095  + /*   350 */  1143,  383, 1143, 1115,  167,  426,   80,  447,  512, 1451,
148520 149096    /*   360 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
148521         - /*   370 */   415, 1143, 1115, 1143,  459,  119,  120,  110, 1136, 1136,
       149097  + /*   370 */   414, 1143, 1466, 1143,  350,  119,  120,  110, 1136, 1136,
148522 149098    /*   380 */   981,  984,  974,  974,  117,  117,  118,  118,  118,  118,
148523         - /*   390 */   404,  264,  264,  811, 1463,  506,  368, 1156,  535,  114,
148524         - /*   400 */   114,  114,  113,  415,  532, 1115, 1116, 1117,  231,  518,
148525         - /*   410 */  1500,  472,  469,  468,  175,  497,  422,  219, 1202,   70,
148526         - /*   420 */    70,  467, 1115, 1116, 1117,  176,  201,  200,  116,  116,
148527         - /*   430 */   116,  116,  115,  115,  114,  114,  114,  113,  415,  535,
148528         - /*   440 */  1115,  264,  264,  435,  312, 1115,  273,  419,  384,  513,
148529         - /*   450 */  1450, 1115,  326, 1084,  532,  517,   82, 1084,  167,  388,
148530         - /*   460 */    69,   69, 1115, 1084,  519,  509, 1084, 1084,   12, 1157,
148531         - /*   470 */  1084,  420,  119,  120,  110, 1136, 1136,  981,  984,  974,
148532         - /*   480 */   974,  117,  117,  118,  118,  118,  118,  258,  258,  535,
148533         - /*   490 */  1115, 1116, 1117, 1045,  535, 1115, 1116, 1117, 1323,  535,
148534         - /*   500 */   532, 1115, 1116, 1117,  296,  483, 1211,  818, 1046,  448,
148535         - /*   510 */    70,   70, 1115, 1116, 1117,   50,   50,  448,  356,  500,
148536         - /*   520 */    70,   70,  207, 1047,   32,  116,  116,  116,  116,  115,
148537         - /*   530 */   115,  114,  114,  114,  113,  415,  453,  264,  264, 1115,
148538         - /*   540 */   450,  449,  961,  508,  856,  384,  517,    5,  900,  822,
148539         - /*   550 */   532,  484,  181, 1115,  857,  516,  517,  818,  952,  507,
148540         - /*   560 */     3, 1115,  951, 1231, 1231,  482,  398, 1115, 1095,  119,
       149099  + /*   390 */   402, 1115, 1116, 1117,  500,  534,  250,  267,  336,  474,
       149100  + /*   400 */   331,  473,  236, 1115, 1116, 1117,  231, 1115,  329,  471,
       149101  + /*   410 */   468,  467,  509, 1458, 1464,  505,    6,   70,   70,  466,
       149102  + /*   420 */   181,  380,  379,  534,  971,  971,  982,  985,  116,  116,
       149103  + /*   430 */   116,  116,  115,  115,  114,  114,  114,  113,  414, 1115,
       149104  + /*   440 */   412,  412,  412,  496, 1115,   69,   69,  235,  383,  288,
       149105  + /*   450 */   525,  273,  326,  516,  337,  458, 1084, 1115, 1116, 1117,
       149106  + /*   460 */  1232, 1232,  492,  160,  508,  441, 1084, 1067, 1531, 1084,
       149107  + /*   470 */   207, 1531,  119,  120,  110, 1136, 1136,  981,  984,  974,
       149108  + /*   480 */   974,  117,  117,  118,  118,  118,  118,  881,  534, 1115,
       149109  + /*   490 */  1116, 1117,  975,  534, 1115, 1116, 1117,  534,  421,  534,
       149110  + /*   500 */   141,  534,  176,  356,  517, 1119,   32,  511,  482,  388,
       149111  + /*   510 */    70,   70,  818,  288,  525,   70,   70,  441,  499,   50,
       149112  + /*   520 */    50,   70,   70,   70,   70,  116,  116,  116,  116,  115,
       149113  + /*   530 */   115,  114,  114,  114,  113,  414,  274,  264,  264, 1115,
       149114  + /*   540 */  1065,  264,  264, 1115,  355,  383,  409,  961, 1439,  822,
       149115  + /*   550 */   531,  516,  190,  419,  531,  483, 1119,  516,  337,  516,
       149116  + /*   560 */   518, 1115,  818,  952,  382,  458,  515,  951,  481,  119,
148541 149117    /*   570 */   120,  110, 1136, 1136,  981,  984,  974,  974,  117,  117,
148542         - /*   580 */   118,  118,  118,  118, 1115,  535,  238, 1115, 1391, 1115,
148543         - /*   590 */  1116, 1117,  159,  951,  951,  953,  231, 1115,  259,  472,
148544         - /*   600 */   469,  468,  310, 1115, 1116, 1117,   13,   13,  297,  467,
148545         - /*   610 */   276, 1115, 1116, 1117,  412,  411, 1095, 1115, 1116, 1117,
148546         - /*   620 */   395,  355,  116,  116,  116,  116,  115,  115,  114,  114,
148547         - /*   630 */   114,  113,  415,  208, 1115, 1116, 1117, 1115, 1116, 1117,
148548         - /*   640 */   264,  264,  384,  337,  902,  393,  815, 1115, 1116, 1117,
148549         - /*   650 */   413,  413,  413,  532,  112,  109,  209,  309,  900, 1143,
148550         - /*   660 */   535, 1143,  535,  393,  901, 1210,  119,  120,  110, 1136,
       149118  + /*   580 */   118,  118,  118,  118, 1338,  278, 1045,  278,  275, 1115,
       149119  + /*   590 */  1116, 1117,  259, 1115, 1116, 1117,  534,    5,  951,  951,
       149120  + /*   600 */   953, 1046,  231,    3,  143,  471,  468,  467, 1391,  463,
       149121  + /*   610 */  1115, 1115, 1116, 1117, 1452,  466, 1047,  836,   70,   70,
       149122  + /*   620 */   480,  534,  116,  116,  116,  116,  115,  115,  114,  114,
       149123  + /*   630 */   114,  113,  414,   95, 1115,  287,  235,  856,  902,  420,
       149124  + /*   640 */  1115,  534,  383,   13,   13,  381,  815,  857,  472,  112,
       149125  + /*   650 */   109,  209, 1115,  337,  413,  309,  837,  394, 1436,  534,
       149126  + /*   660 */  1115, 1116, 1117,   54,   54,  291,  119,  120,  110, 1136,
148551 149127    /*   670 */  1136,  981,  984,  974,  974,  117,  117,  118,  118,  118,
148552         - /*   680 */   118,   13,   13,   13,   13,  265,  265,  535,  143,  264,
148553         - /*   690 */   264,  288,  526,  535, 1119,  400,  535,  402,  532,  510,
148554         - /*   700 */  1457,  512,  532,    6,  113,  415, 1067, 1530,   70,   70,
148555         - /*   710 */  1530,  535,  271,  535,   70,   70,  535,   13,   13,  116,
148556         - /*   720 */   116,  116,  116,  115,  115,  114,  114,  114,  113,  415,
148557         - /*   730 */   272,  277,   13,   13,   13,   13,  535,   13,   13,  384,
148558         - /*   740 */   535,  304,  425, 1100,  284, 1119,  184,  801,  185,  338,
148559         - /*   750 */   285,  514, 1532,  369, 1239, 1438, 1182,   70,   70,  425,
148560         - /*   760 */   424,   70,   70,  119,  120,  110, 1136, 1136,  981,  984,
148561         - /*   770 */   974,  974,  117,  117,  118,  118,  118,  118,  190, 1065,
148562         - /*   780 */  1067, 1531,  442,  107, 1531,  408,  264,  264,  264,  264,
148563         - /*   790 */   383, 1396,  261,  410,   95,  900,  485,  414,  421,  532,
148564         - /*   800 */  1045,  532,  301, 1133,  303,  488,  433, 1451, 1396, 1398,
148565         - /*   810 */   278,  535,  278,  520, 1435, 1046,  116,  116,  116,  116,
148566         - /*   820 */   115,  115,  114,  114,  114,  113,  415,  425,  264,  264,
148567         - /*   830 */  1047,  190,   54,   54,  535,  291,  384,  264,  264,  362,
148568         - /*   840 */   962,  532, 1004,  376, 1084,  264,  264, 1029, 1029,  456,
148569         - /*   850 */   532,  523,  270, 1065, 1084,   55,   55, 1084,  532,  442,
       149128  + /*   680 */   118,   13,   13, 1084, 1115, 1116, 1117,  901,  264,  264,
       149129  + /*   690 */  1115, 1116, 1117, 1084,  292,  399, 1084,  800,  388,  140,
       149130  + /*   700 */   295,  531, 1115, 1116, 1117,  403,  447,  532,  534,  870,
       149131  + /*   710 */   870,  534, 1240,  534,  329,  534, 1185,  389,  534,  116,
       149132  + /*   720 */   116,  116,  116,  115,  115,  114,  114,  114,  113,  414,
       149133  + /*   730 */    13,   13, 1024,   13,   13,   13,   13,   13,   13,  383,
       149134  + /*   740 */    13,   13,  424, 1100,  401,  264,  264,  277,  160,  184,
       149135  + /*   750 */  1182,  185, 1533,  369,  513,  484,  432,  487,  531,  424,
       149136  + /*   760 */   423, 1397,  941,  119,  120,  110, 1136, 1136,  981,  984,
       149137  + /*   770 */   974,  974,  117,  117,  118,  118,  118,  118, 1397, 1399,
       149138  + /*   780 */   425,  519,  392,  264,  264, 1029, 1029,  455,  264,  264,
       149139  + /*   790 */   264,  264, 1004,  304,  261, 1278,  531,  900,  288,  525,
       149140  + /*   800 */   310,  531,  493,  531, 1067, 1532,  458,  387, 1532,  311,
       149141  + /*   810 */   429,  299,  534,  107,  264,  264,  116,  116,  116,  116,
       149142  + /*   820 */   115,  115,  114,  114,  114,  113,  414,  531,  424, 1384,
       149143  + /*   830 */   507,  258,  258, 1246,   55,   55,  383, 1277,  265,  265,
       149144  + /*   840 */   962,  324,  434,  312,  531,  531,  506, 1397, 1026, 1241,
       149145  + /*   850 */   298,  531, 1026,  445,  301, 1095,  303,  534,  368, 1156,
148570 149146    /*   860 */   119,  120,  110, 1136, 1136,  981,  984,  974,  974,  117,
148571         - /*   870 */   117,  118,  118,  118,  118,  535, 1396,  190,  302, 1383,
148572         - /*   880 */   208,  535,  789,  790,  791,  535,  515,  535, 1323,  371,
148573         - /*   890 */   337,  234,  233,  232,  459,  515,   15,   15,  459,  477,
148574         - /*   900 */   459,  459,   44,   44,  136,  900,   56,   56,   57,   57,
148575         - /*   910 */  1185,  390,  197,  116,  116,  116,  116,  115,  115,  114,
148576         - /*   920 */   114,  114,  113,  415,  535,  876,  535,  442,  535,  274,
148577         - /*   930 */   875, 1323,  357,  384,  353,  140, 1426,  946, 1455, 1323,
148578         - /*   940 */  1390,    6, 1240, 1236,  292,   58,   58,   59,   59,   60,
148579         - /*   950 */    60,  535, 1456,  384,  535,    6,  399,  119,  120,  110,
       149147  + /*   870 */   117,  118,  118,  118,  118, 1045,  534, 1065,  534,   15,
       149148  + /*   880 */    15, 1084,  208, 1324,  453,  452,  534, 1324,  534,  449,
       149149  + /*   890 */  1046, 1084,  494,  458, 1084,  234,  233,  232,   44,   44,
       149150  + /*   900 */    56,   56,  319, 1095,  322, 1047,  534,  900,   57,   57,
       149151  + /*   910 */    58,   58,  534,  116,  116,  116,  116,  115,  115,  114,
       149152  + /*   920 */   114,  114,  113,  414,  534,  514,  522,  534,   59,   59,
       149153  + /*   930 */   302, 1157,  534,  383,   60,   60, 1237,  946,  788,  789,
       149154  + /*   940 */   790, 1459, 1456,  446,    6,    6,   61,   61, 1212,   45,
       149155  + /*   950 */    45,  534,  396,  383,   46,   46,  397,  119,  120,  110,
148580 149156    /*   960 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
148581         - /*   970 */   118,  118,   61,   61,  535,   45,   45,  119,  120,  110,
       149157  + /*   970 */   118,  118,  428,   48,   48,  534,  392,  119,  120,  110,
148582 149158    /*   980 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
148583         - /*   990 */   118,  118, 1477,  479,  202,   46,   46,  275,   95,  455,
148584         - /*  1000 */   535,  212,  535,  337,  535, 1454,  535,  409,    6,  242,
       149159  + /*   990 */   118,  118, 1324,  368, 1066,  447,  825,   49,   49,  534,
       149160  + /*  1000 */   458,  357,  534,  353,  534,  138,  534,  337, 1478,  478,
148585 149161    /*  1010 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
148586         - /*  1020 */   415,   48,   48,   49,   49,   62,   62,   63,   63,  535,
       149162  + /*  1020 */   414,   62,   62,  392,   63,   63,   64,   64,   14,   14,
148587 149163    /*  1030 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
148588         - /*  1040 */   415,  535,  459,  535, 1134,  535, 1151,  535,  142,  535,
148589         - /*  1050 */    64,   64,  535, 1338,  535,  494,  535,  446,  535, 1264,
148590         - /*  1060 */   535, 1337,   14,   14,   65,   65,  125,  125,   66,   66,
148591         - /*  1070 */    51,   51,  535,   67,   67,   68,   68,   52,   52,  147,
148592         - /*  1080 */   147,  148,  148, 1453,  317,   98,    6,  535, 1245,  481,
148593         - /*  1090 */   535,  827,  535,   75,   75, 1134,  102,  481,  100,  535,
148594         - /*  1100 */   532,  535,  368, 1066, 1503,  384,  535,  845,   53,   53,
148595         - /*  1110 */    93,   71,   71,  126,  126,  295,  528,  390,  288,  526,
148596         - /*  1120 */    72,   72,  127,  127,  139,  384,   38,  128,  128,  119,
       149164  + /*  1040 */   414,  534,  810,  317,  271,  534, 1457,  825,  534,    6,
       149165  + /*  1050 */   534, 1324,  534,  142,  534, 1442,  534,  212,  534, 1324,
       149166  + /*  1060 */   534,  398,  305,   65,   65,  534, 1157,  125,  125,  476,
       149167  + /*  1070 */    66,   66,   51,   51,   67,   67,   68,   68,   52,   52,
       149168  + /*  1080 */   147,  147,  148,  148,  534,   98,  534,   75,   75,  276,
       149169  + /*  1090 */   534,  272,  534,  810,  534,  876,  534,  527,  389,  534,
       149170  + /*  1100 */   875,  534, 1151,  202,  534,  383,   53,   53,   71,   71,
       149171  + /*  1110 */   288,  525,  126,  126,   72,   72,  127,  127,  128,  128,
       149172  + /*  1120 */   454,  124,  124,  146,  146,  383,  145,  145,  408,  119,
148597 149173    /*  1130 */   120,  110, 1136, 1136,  981,  984,  974,  974,  117,  117,
148598         - /*  1140 */   118,  118,  118,  118,  535,  495,  535,  447,  535,  119,
       149174  + /*  1140 */   118,  118,  118,  118,  534,  900,  534,   95,  534,  119,
148599 149175    /*  1150 */   120,  110, 1136, 1136,  981,  984,  974,  974,  117,  117,
148600         - /*  1160 */   118,  118,  118,  118,  235,  124,  124,  146,  146,  145,
148601         - /*  1170 */   145,  287,  535, 1277,  535, 1157,  535,  391,  161,  263,
148602         - /*  1180 */   206,  381,  116,  116,  116,  116,  115,  115,  114,  114,
148603         - /*  1190 */   114,  113,  415,  132,  132,  131,  131,  129,  129,  535,
148604         - /*  1200 */    30,  535,  116,  116,  116,  116,  115,  115,  114,  114,
148605         - /*  1210 */   114,  113,  415,  535,  216, 1062, 1276,  535,  370,  535,
148606         - /*  1220 */   130,  130,   74,   74,  535,  915,  389,  876,   17,  437,
148607         - /*  1230 */   429,   31,  875,  916,   76,   76,  266,  101,   73,   73,
148608         - /*  1240 */    43,   43,  835,  834,  308,   47,   47,   95,  825,  943,
148609         - /*  1250 */   441,  938,  241,  241,  305,  443,  313,  384,  241,   95,
148610         - /*  1260 */   842,  843,  193,  465, 1209,  327,  237,  436,   95, 1011,
148611         - /*  1270 */  1007,  909,  873,  237,  241,  107, 1023,  384, 1023,  955,
148612         - /*  1280 */  1415,  119,  120,  110, 1136, 1136,  981,  984,  974,  974,
148613         - /*  1290 */   117,  117,  118,  118,  118,  118, 1022,  809, 1022,  825,
       149176  + /*  1160 */   118,  118,  118,  118,  390,  161,  132,  132,  131,  131,
       149177  + /*  1170 */   129,  129,  534,  915,  534, 1455,  534, 1454,    6, 1416,
       149178  + /*  1180 */     6,  916,  116,  116,  116,  116,  115,  115,  114,  114,
       149179  + /*  1190 */   114,  113,  414, 1415,  130,  130,   74,   74,   76,   76,
       149180  + /*  1200 */   534,   30,  116,  116,  116,  116,  115,  115,  114,  114,
       149181  + /*  1210 */   114,  113,  414,  534,  263,  206,  534, 1133, 1504,   93,
       149182  + /*  1220 */   876,  845,   73,   73,  102,  875,  100,  139,   17,   38,
       149183  + /*  1230 */   208, 1062,   31,  450,  370,   43,   43,  101,   47,   47,
       149184  + /*  1240 */   827,  216,  436,  308,  943,  440,   95,  241,  241,  442,
       149185  + /*  1250 */   313,  464,  241,   95,  237,  900,  327,  383,  266,   95,
       149186  + /*  1260 */   835,  834,  193,  335,  938,  314, 1011,  435,  842,  843,
       149187  + /*  1270 */   955, 1007,  909,  334,  237,  241,  873,  383, 1023,  107,
       149188  + /*  1280 */  1023,  119,  120,  110, 1136, 1136,  981,  984,  974,  974,
       149189  + /*  1290 */   117,  117,  118,  118,  118,  118, 1022,  808, 1022, 1274,
148614 149190    /*  1300 */   137,  119,  108,  110, 1136, 1136,  981,  984,  974,  974,
148615         - /*  1310 */   117,  117,  118,  118,  118,  118,  874, 1414,  451,  107,
148616         - /*  1320 */  1011,  314, 1273,  318,  218,  321,  323,  325, 1224, 1208,
148617         - /*  1330 */   955,  330,  339,  340,  116,  116,  116,  116,  115,  115,
148618         - /*  1340 */   114,  114,  114,  113,  415, 1285, 1322, 1260, 1493, 1470,
148619         - /*  1350 */  1271,  283,  521, 1328,  116,  116,  116,  116,  115,  115,
148620         - /*  1360 */   114,  114,  114,  113,  415, 1191, 1184, 1173, 1172, 1174,
148621         - /*  1370 */   522, 1487,  211,  460,  384,  256,  199,  367, 1257,  342,
148622         - /*  1380 */   195,  470,  307,  344,   11,  333,  525,  445, 1307, 1315,
148623         - /*  1390 */   375,  203, 1207, 1151,  384,  346, 1387,  188,  360,  120,
       149191  + /*  1310 */   117,  117,  118,  118,  118,  118,  874, 1011,  318,  107,
       149192  + /*  1320 */   321,  955,  323,  325, 1225, 1211,  197, 1210, 1209,  330,
       149193  + /*  1330 */   339, 1265,  340,  283,  116,  116,  116,  116,  115,  115,
       149194  + /*  1340 */   114,  114,  114,  113,  414, 1286, 1323, 1261, 1471, 1272,
       149195  + /*  1350 */   520,  218,  521, 1329,  116,  116,  116,  116,  115,  115,
       149196  + /*  1360 */   114,  114,  114,  113,  414, 1192, 1184, 1173, 1172, 1174,
       149197  + /*  1370 */  1494, 1488,  459,  256,  383, 1258,  342,  199,  367,  344,
       149198  + /*  1380 */   211,  195,  307,  444,   11,  346,  469,  333, 1308, 1316,
       149199  + /*  1390 */   375,  427,  203,  360,  383, 1388,  188, 1387,  189,  120,
148624 149200    /*  1400 */   110, 1136, 1136,  981,  984,  974,  974,  117,  117,  118,
148625         - /*  1410 */   118,  118,  118, 1386,  428, 1490,  245,  300,  348, 1148,
       149201  + /*  1410 */   118,  118,  118, 1208, 1151,  300,  348, 1491,  245, 1148,
148626 149202    /*  1420 */   110, 1136, 1136,  981,  984,  974,  974,  117,  117,  118,
148627         - /*  1430 */   118,  118,  118,  189,  198, 1434, 1432,   78,   81,  163,
148628         - /*  1440 */    82,  392,  439, 1392,  173,  105,  527,   35,    4,  157,
148629         - /*  1450 */  1312,  116,  116,  116,  116,  115,  115,  114,  114,  114,
148630         - /*  1460 */   113,  415,  530,  165,   93, 1304,  431,  432,  168,  463,
148631         - /*  1470 */   221,  116,  116,  116,  116,  115,  115,  114,  114,  114,
148632         - /*  1480 */   113,  415,  169,  452,  170,  416,  171,  374,  372,  438,
148633         - /*  1490 */    36, 1318,  177,  225, 1381,   87,  458,  524, 1403,  316,
148634         - /*  1500 */   257,  105,  527,  227,    4,  182,  461,  160,  320,  228,
148635         - /*  1510 */   377, 1175,  476,  229, 1227, 1226,  405, 1225,  530, 1218,
148636         - /*  1520 */   961,  378, 1199, 1198,  827,  332,  103,  103, 1197,  407,
148637         - /*  1530 */     8, 1217, 1502,  104,  487,  416,  537,  536,  281,  282,
148638         - /*  1540 */   951,  416,  490, 1268,  496,   92,  341,  243, 1269,  343,
148639         - /*  1550 */   244, 1267,  122,  524,  345, 1461,  515,  288,  526,   10,
148640         - /*  1560 */   354, 1266, 1460,  352,  504, 1250,   99, 1367,   94,  503,
148641         - /*  1570 */   499,  951,  951,  953,  954,   27,  961,  347, 1249,  194,
148642         - /*  1580 */   251,  358,  103,  103,  359, 1181,   34,  538, 1110,  104,
148643         - /*  1590 */   255,  416,  537,  536,  286,  252,  951,  254,  539,  149,
148644         - /*  1600 */  1170, 1419, 1165, 1420, 1418,  150, 1417,  135,  279,  785,
148645         - /*  1610 */   151,  417, 1195,  196,  290,  210,  386, 1194,  269,  387,
148646         - /*  1620 */   162, 1021,  133,   77, 1192, 1019,  935,  951,  951,  953,
148647         - /*  1630 */   954,   27, 1479, 1104,  418,  164,  153,  268,  217,  166,
148648         - /*  1640 */   859,  306,  366,  366,  365,  253,  363,  220, 1035,  798,
148649         - /*  1650 */   172,  939,  105,  527,  155,    4,  394,  174,  396,  156,
148650         - /*  1660 */    83, 1038,  213,   84,  294,   85,   86,  223,  222,  530,
148651         - /*  1670 */  1034,  144,  293,   18,  224,  315,  241, 1027, 1145,  178,
148652         - /*  1680 */   457,  226,  179,   37,  800,  334,  462,  230,  328,  466,
148653         - /*  1690 */   180,  471,  416,   88,   19,   20,   89,  280,  838,  158,
148654         - /*  1700 */   191,   90,  215,  478,  524, 1097,  204,  192,  987,   91,
148655         - /*  1710 */   152, 1070,   39,  154, 1071,  504,  486,   40,  489,  205,
148656         - /*  1720 */   505,  260,  105,  527,  214,    4,  908,  961,  262,  183,
148657         - /*  1730 */   240,   21,  903,  103,  103,  107,   22, 1086,   23,  530,
148658         - /*  1740 */   104, 1088,  416,  537,  536,   24, 1093,  951,   25, 1074,
148659         - /*  1750 */  1090, 1094,    7,   33,  511,  186,   26, 1002,  385,   95,
148660         - /*  1760 */   988,  986,  416,  288,  526,  990, 1044,  246, 1043,  247,
148661         - /*  1770 */   991,   28,   41,  106,  524,  956,  810,   29,  951,  951,
148662         - /*  1780 */   953,  954,   27,  531,  361,  504,  423,  248,  869,  249,
148663         - /*  1790 */   503, 1495,  364, 1105, 1161, 1494, 1161,  961, 1161, 1161,
       149203  + /*  1430 */   118,  118,  118,  198, 1435, 1433,  524,   78,  391,  163,
       149204  + /*  1440 */    82, 1393,  438,  173,   81,  105,  526, 1313,    4,   35,
       149205  + /*  1450 */   157,  116,  116,  116,  116,  115,  115,  114,  114,  114,
       149206  + /*  1460 */   113,  414,  529,  165,   93,  430, 1305,  168,  169,  431,
       149207  + /*  1470 */   462,  116,  116,  116,  116,  115,  115,  114,  114,  114,
       149208  + /*  1480 */   113,  414,  170,  171,  221,  415,  372,  437, 1319,  177,
       149209  + /*  1490 */   374,   36,  451,  225, 1382,   87,  457,  523,  257, 1404,
       149210  + /*  1500 */   316,  105,  526,  227,    4,  182,  460,  160,  320,  228,
       149211  + /*  1510 */   377, 1175,  475,  229, 1228,  404, 1227, 1226,  529,  827,
       149212  + /*  1520 */   961, 1219,  378, 1200, 1199,  406,  103,  103, 1218,  332,
       149213  + /*  1530 */     8,  281, 1198,  104, 1503,  415,  536,  535,  486,  282,
       149214  + /*  1540 */   951,  415,  489,  495,   92,  244, 1269,  341,  243,  122,
       149215  + /*  1550 */  1270,  343,  514,  523, 1268, 1462,   10,  288,  525,  345,
       149216  + /*  1560 */  1461,  354,   99,  352,  503,   94, 1267,  347, 1251,  502,
       149217  + /*  1570 */   498,  951,  951,  953,  954,   27,  961, 1250,  194,  358,
       149218  + /*  1580 */   251,  359,  103,  103, 1181,   34,  537, 1110,  252,  104,
       149219  + /*  1590 */   254,  415,  536,  535,  255, 1368,  951, 1420,  286,  538,
       149220  + /*  1600 */  1170, 1165, 1421,  135, 1419, 1418,  149,  150,  279,  784,
       149221  + /*  1610 */   416,  196,  151,  290,  210,  200,   77,  385,  269,  386,
       149222  + /*  1620 */   133,  162,  935, 1021,  201, 1019,  153,  951,  951,  953,
       149223  + /*  1630 */   954,   27, 1480, 1104,  417,  164,  217,  268,  859,  166,
       149224  + /*  1640 */   306, 1035,  366,  366,  365,  253,  363,  220,  172,  797,
       149225  + /*  1650 */   939,  155,  105,  526,  393,    4,  395,  174,  156,   83,
       149226  + /*  1660 */  1038,   84,  213,   85,  294,  222,   86,  223, 1034,  529,
       149227  + /*  1670 */   144,   18,  293,  224,  315,  456,  241, 1027, 1145,  178,
       149228  + /*  1680 */   226,  179,   37,  799,  334,  461,  230,  465,  470,  838,
       149229  + /*  1690 */   180,   88,  415,   19,  280,  328,   20,   89,   90,  158,
       149230  + /*  1700 */   191,  477,  215, 1097,  523,  204,  192,  987,   91, 1070,
       149231  + /*  1710 */   152,   39,  485,  154, 1071,  503,   40,  488,  205,  260,
       149232  + /*  1720 */   504,  262,  105,  526,  214,    4,  908,  961,  183,  240,
       149233  + /*  1730 */   903,  107, 1086,  103,  103,   21,   22, 1088,   23,  529,
       149234  + /*  1740 */   104,   24,  415,  536,  535, 1090, 1093,  951, 1094,   25,
       149235  + /*  1750 */  1074,   33,    7,   26,  510, 1002,  247,  186,  384,   95,
       149236  + /*  1760 */   988,  986,  415,  288,  525,  990, 1044,  246, 1043,  991,
       149237  + /*  1770 */    28,   41,  530,  956,  523,  809,  106,   29,  951,  951,
       149238  + /*  1780 */   953,  954,   27,  869,  361,  503,  422,  248,  364, 1105,
       149239  + /*  1790 */   502,  249, 1161, 1496, 1495, 1161, 1161,  961, 1161, 1161,
148664 149240    /*  1800 */  1161, 1161, 1161,  103,  103, 1161, 1161, 1161, 1161, 1161,
148665         - /*  1810 */   104, 1161,  416,  537,  536, 1104,  418,  951, 1161,  268,
       149241  + /*  1810 */   104, 1161,  415,  536,  535, 1104,  417,  951, 1161,  268,
148666 149242    /*  1820 */  1161, 1161, 1161, 1161,  366,  366,  365,  253,  363, 1161,
148667         - /*  1830 */  1161,  798, 1161, 1161, 1161, 1161,  105,  527, 1161,    4,
       149243  + /*  1830 */  1161,  797, 1161, 1161, 1161, 1161,  105,  526, 1161,    4,
148668 149244    /*  1840 */  1161, 1161, 1161, 1161,  213, 1161,  294, 1161,  951,  951,
148669         - /*  1850 */   953,  954,   27,  530,  293, 1161, 1161, 1161, 1161, 1161,
       149245  + /*  1850 */   953,  954,   27,  529,  293, 1161, 1161, 1161, 1161, 1161,
148670 149246    /*  1860 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
148671         - /*  1870 */  1161, 1161, 1161, 1161, 1161, 1161,  416, 1161, 1161, 1161,
148672         - /*  1880 */  1161, 1161, 1161, 1161,  215, 1161, 1161, 1161,  524, 1161,
148673         - /*  1890 */  1161, 1161,  152, 1161, 1161,  154,  105,  527, 1161,    4,
       149247  + /*  1870 */  1161, 1161, 1161, 1161, 1161, 1161,  415, 1161, 1161, 1161,
       149248  + /*  1880 */  1161, 1161, 1161, 1161,  215, 1161, 1161, 1161,  523, 1161,
       149249  + /*  1890 */  1161, 1161,  152, 1161, 1161,  154,  105,  526, 1161,    4,
148674 149250    /*  1900 */  1161, 1161, 1161, 1161, 1161, 1161,  214, 1161, 1161, 1161,
148675         - /*  1910 */  1161,  961, 1161,  530, 1161, 1161, 1161,  103,  103,  880,
148676         - /*  1920 */  1161, 1161, 1161, 1161,  104, 1161,  416,  537,  536, 1161,
148677         - /*  1930 */  1161,  951, 1161, 1161, 1161, 1161,  416, 1161, 1161, 1161,
148678         - /*  1940 */   385, 1161, 1161, 1161, 1161,  288,  526, 1161,  524, 1161,
148679         - /*  1950 */  1161, 1161, 1161, 1161, 1161, 1161,   97,  527, 1161,    4,
148680         - /*  1960 */  1161, 1161,  951,  951,  953,  954,   27, 1161,  423, 1161,
148681         - /*  1970 */  1161,  961, 1161,  530, 1161, 1161, 1161,  103,  103, 1161,
148682         - /*  1980 */  1161, 1161, 1161, 1161,  104, 1161,  416,  537,  536, 1161,
148683         - /*  1990 */  1161,  951,  268, 1161, 1161, 1161,  416,  366,  366,  365,
148684         - /*  2000 */   253,  363, 1161, 1161,  798, 1161, 1161, 1161,  524, 1161,
       149251  + /*  1910 */  1161,  961, 1161,  529, 1161, 1161, 1161,  103,  103,  880,
       149252  + /*  1920 */  1161, 1161, 1161, 1161,  104, 1161,  415,  536,  535, 1161,
       149253  + /*  1930 */  1161,  951, 1161, 1161, 1161, 1161,  415, 1161, 1161, 1161,
       149254  + /*  1940 */   384, 1161, 1161, 1161, 1161,  288,  525, 1161,  523, 1161,
       149255  + /*  1950 */  1161, 1161, 1161, 1161, 1161, 1161,   97,  526, 1161,    4,
       149256  + /*  1960 */  1161, 1161,  951,  951,  953,  954,   27, 1161,  422, 1161,
       149257  + /*  1970 */  1161,  961, 1161,  529, 1161, 1161, 1161,  103,  103, 1161,
       149258  + /*  1980 */  1161, 1161, 1161, 1161,  104, 1161,  415,  536,  535, 1161,
       149259  + /*  1990 */  1161,  951,  268, 1161, 1161, 1161,  415,  366,  366,  365,
       149260  + /*  2000 */   253,  363, 1161, 1161,  797, 1161, 1161, 1161,  523, 1161,
148685 149261    /*  2010 */  1161, 1161, 1161, 1161, 1161, 1161, 1161,  213, 1161,  294,
148686 149262    /*  2020 */  1161, 1161,  951,  951,  953,  954,   27,  293, 1161, 1161,
148687 149263    /*  2030 */  1161,  961, 1161, 1161, 1161, 1161, 1161,  103,  103, 1161,
148688         - /*  2040 */  1161, 1161, 1161, 1161,  104, 1161,  416,  537,  536, 1161,
       149264  + /*  2040 */  1161, 1161, 1161, 1161,  104, 1161,  415,  536,  535, 1161,
148689 149265    /*  2050 */  1161,  951, 1161, 1161, 1161, 1161, 1161,  215, 1161, 1161,
148690 149266    /*  2060 */  1161, 1161, 1161, 1161, 1161,  152, 1161, 1161,  154, 1161,
148691 149267    /*  2070 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,  214,
148692 149268    /*  2080 */  1161, 1161,  951,  951,  953,  954,   27, 1161, 1161, 1161,
148693 149269    /*  2090 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
148694 149270    /*  2100 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
148695         - /*  2110 */  1161, 1161, 1161,  385, 1161, 1161, 1161, 1161,  288,  526,
       149271  + /*  2110 */  1161, 1161, 1161,  384, 1161, 1161, 1161, 1161,  288,  525,
148696 149272    /*  2120 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
148697 149273    /*  2130 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
148698         - /*  2140 */  1161,  423,
       149274  + /*  2140 */  1161,  422,
148699 149275   };
148700 149276   static const YYCODETYPE yy_lookahead[] = {
148701         - /*     0 */   184,  184,  259,  260,  261,  259,  260,  261,  176,  177,
148702         - /*    10 */   178,  179,  180,  181,  184,  208,  212,  213,  186,   19,
148703         - /*    20 */   188,  205,  206,  280,  205,  221,   22,  195,   24,  195,
148704         - /*    30 */   208,   31,  195,  205,   29,  205,  206,  255,   33,   39,
148705         - /*    40 */   200,  201,  202,   43,   44,   45,   46,   47,   48,   49,
148706         - /*    50 */    50,   51,   52,   53,   54,   55,   56,   57,  205,  227,
148707         - /*    60 */   228,  227,  228,   59,  227,  228,  259,  260,  261,  252,
148708         - /*    70 */    65,  241,  240,  184,  240,  223,  224,  240,  244,  245,
148709         - /*    80 */   250,  259,  260,  261,   19,  253,   54,   55,   56,   57,
148710         - /*    90 */    58,  184,  255,  184,  205,  206,   96,   97,   98,   99,
148711         - /*   100 */   100,  101,  102,  103,  104,  105,  106,   46,   47,   48,
148712         - /*   110 */    49,   46,  296,  297,  110,  283,   19,   96,   97,   98,
148713         - /*   120 */    99,  100,  101,  102,  103,  104,  105,  106,   96,   97,
       149277  + /*     0 */   260,  261,  262,  260,  261,  262,  176,  177,  178,  179,
       149278  + /*    10 */   180,  181,  184,  206,  209,  184,  186,  206,  188,   19,
       149279  + /*    20 */   179,  281,  181,  213,  214,  195,  206,  186,  195,  188,
       149280  + /*    30 */   195,   31,  222,  184,  206,  207,  195,  206,  207,   39,
       149281  + /*    40 */    24,  209,  184,   43,   44,   45,   46,   47,   48,   49,
       149282  + /*    50 */    50,   51,   52,   53,   54,   55,   56,   57,  228,  229,
       149283  + /*    60 */   184,  228,  229,  228,  229,  260,  261,  262,  192,  228,
       149284  + /*    70 */   229,  241,  196,  242,  241,   59,  241,  205,  245,  246,
       149285  + /*    80 */   184,   22,  241,   24,  254,  213,   54,   55,   56,   57,
       149286  + /*    90 */    58,  256,  260,  261,  262,  254,   96,   97,   98,   99,
       149287  + /*   100 */   100,  101,  102,  103,  104,  105,  106,  100,  101,  102,
       149288  + /*   110 */   103,  104,  105,  106,  284,  203,   19,  221,   59,  102,
       149289  + /*   120 */   103,  104,  105,  106,   59,  284,  110,  269,   96,   97,
148714 149290    /*   130 */    98,   99,  100,  101,  102,  103,  104,  105,  106,   94,
148715 149291    /*   140 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
148716         - /*   150 */    53,   54,   55,   56,   57,  110,  106,   73,  251,  114,
148717         - /*   160 */    73,  178,  179,  180,  181,   59,  184,  292,   81,  186,
148718         - /*   170 */   295,  188,  218,  108,   19,  114,  184,   11,  195,  184,
148719         - /*   180 */    83,  184,   85,   54,   55,   56,   57,  205,  206,  124,
       149292  + /*   150 */    53,   54,   55,   56,   57,  110,  184,  106,   73,  114,
       149293  + /*   160 */   178,  179,  180,  181,  219,  184,   81,   22,  186,  110,
       149294  + /*   170 */   188,  121,  122,  195,  109,  110,  111,  195,  206,  207,
       149295  + /*   180 */    83,  184,   85,   54,   55,   56,   57,  206,  207,  277,
148720 149296    /*   190 */   145,  146,  147,   96,   97,   98,   99,  100,  101,  102,
148721         - /*   200 */   103,  104,  105,  106,  120,  121,  122,  120,  102,   81,
148722         - /*   210 */   227,  228,  220,   19,   16,  109,  110,  111,  131,  132,
148723         - /*   220 */    26,  184,  184,  240,  229,   96,   97,   98,   99,  100,
148724         - /*   230 */   101,  102,  103,  104,  105,  106,  253,   43,   44,   45,
       149297  + /*   200 */   103,  104,  105,  106,   59,  120,  228,  229,  143,  184,
       149298  + /*   210 */   228,  229,  184,   19,  242,  203,  131,  132,  221,  241,
       149299  + /*   220 */    26,  184,  184,  241,  196,   96,   97,   98,   99,  100,
       149300  + /*   230 */   101,  102,  103,  104,  105,  106,  254,   43,   44,   45,
148725 149301    /*   240 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
148726         - /*   250 */    56,   57,  100,  101,  102,  103,  104,  105,  106,  131,
148727         - /*   260 */   132,  106,  127,   69,  129,  130,  283,  112,  113,  114,
148728         - /*   270 */   115,  116,  117,  118,   81,   77,   76,   79,  296,  124,
148729         - /*   280 */   298,  203,  184,   19,   84,   59,   86,  121,  122,   89,
       149302  + /*   250 */    56,   57,  184,  184,  109,  110,  111,  105,  106,  184,
       149303  + /*   260 */   200,  201,  202,   69,  184,  227,  284,   96,   97,   98,
       149304  + /*   270 */    99,  100,  101,  102,  103,  104,  105,  106,  297,  298,
       149305  + /*   280 */   255,  206,  207,   19,  272,   59,  206,  207,  184,  277,
148730 149306    /*   290 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
148731         - /*   300 */   106,  184,   35,  205,  206,   22,  113,   43,   44,   45,
       149307  + /*   300 */   106,  184,  259,   19,  184,  100,  101,   43,   44,   45,
148732 149308    /*   310 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
148733         - /*   320 */    56,   57,  205,  206,  131,  132,  100,  101,  291,  292,
148734         - /*   330 */   114,   67,  295,   66,  108,  109,  110,  111,  138,  113,
148735         - /*   340 */   124,   74,   59,  179,  184,  181,  184,  121,   22,  271,
148736         - /*   350 */   186,   19,  188,  184,  276,   59,   24,  184,  241,  195,
       149309  + /*   320 */    56,   57,  242,  206,  207,  184,  100,  101,  138,  292,
       149310  + /*   330 */   293,   67,   76,  296,  108,  109,  110,  111,  295,  113,
       149311  + /*   340 */    84,   59,   86,   22,   26,   89,  156,  121,  224,  225,
       149312  + /*   350 */   145,   19,  147,   59,   72,  256,   24,  184,  290,  291,
148737 149313    /*   360 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
148738         - /*   370 */   106,  145,   59,  147,  184,   43,   44,   45,   46,   47,
       149314  + /*   370 */   106,  145,  297,  147,  299,   43,   44,   45,   46,   47,
148739 149315    /*   380 */    48,   49,   50,   51,   52,   53,   54,   55,   56,   57,
148740         - /*   390 */   123,  227,  228,  110,  296,  297,   22,   23,  184,  102,
148741         - /*   400 */   103,  104,  105,  106,  240,  109,  110,  111,  112,  195,
148742         - /*   410 */   204,  115,  116,  117,   22,  184,  226,  253,  212,  205,
148743         - /*   420 */   206,  125,  109,  110,  111,   22,  100,  101,   96,   97,
148744         - /*   430 */    98,   99,  100,  101,  102,  103,  104,  105,  106,  184,
148745         - /*   440 */    59,  227,  228,  121,  122,   59,  277,  283,   19,  289,
148746         - /*   450 */   290,   59,   23,   76,  240,  241,  143,   76,   72,  189,
148747         - /*   460 */   205,  206,   59,   86,  250,   84,   89,   86,  203,   95,
148748         - /*   470 */    89,  281,   43,   44,   45,   46,   47,   48,   49,   50,
148749         - /*   480 */    51,   52,   53,   54,   55,   56,   57,  227,  228,  184,
148750         - /*   490 */   109,  110,  111,   12,  184,  109,  110,  111,  184,  184,
148751         - /*   500 */   240,  109,  110,  111,  184,  195,  214,   59,   27,  184,
148752         - /*   510 */   205,  206,  109,  110,  111,  205,  206,  184,  263,  138,
148753         - /*   520 */   205,  206,  184,   42,   22,   96,   97,   98,   99,  100,
148754         - /*   530 */   101,  102,  103,  104,  105,  106,  266,  227,  228,   59,
148755         - /*   540 */   270,  276,   94,   66,   63,   19,  241,   22,   26,   23,
148756         - /*   550 */   240,  241,   72,   59,   73,  250,  241,  109,  110,   82,
148757         - /*   560 */    22,   59,  114,  223,  224,  250,  252,   59,   91,   43,
       149316  + /*   390 */   106,  109,  110,  111,  138,  184,  112,  113,  114,  115,
       149317  + /*   400 */   116,  117,  118,  109,  110,  111,  112,   59,  124,  115,
       149318  + /*   410 */   116,  117,  292,  293,  297,  298,  296,  206,  207,  125,
       149319  + /*   420 */    72,  100,  101,  184,   46,   47,   48,   49,   96,   97,
       149320  + /*   430 */    98,   99,  100,  101,  102,  103,  104,  105,  106,   59,
       149321  + /*   440 */   200,  201,  202,  184,   59,  206,  207,   46,   19,  131,
       149322  + /*   450 */   132,  278,   23,  242,  184,  184,   76,  109,  110,  111,
       149323  + /*   460 */   224,  225,  251,   81,   84,  184,   86,   22,   23,   89,
       149324  + /*   470 */   184,   26,   43,   44,   45,   46,   47,   48,   49,   50,
       149325  + /*   480 */    51,   52,   53,   54,   55,   56,   57,  102,  184,  109,
       149326  + /*   490 */   110,  111,  114,  184,  109,  110,  111,  184,  227,  184,
       149327  + /*   500 */   230,  184,   22,  264,  195,   59,   22,  184,  195,  108,
       149328  + /*   510 */   206,  207,   59,  131,  132,  206,  207,  184,  138,  206,
       149329  + /*   520 */   207,  206,  207,  206,  207,   96,   97,   98,   99,  100,
       149330  + /*   530 */   101,  102,  103,  104,  105,  106,  255,  228,  229,   59,
       149331  + /*   540 */    95,  228,  229,   59,  184,   19,  242,   94,  184,   23,
       149332  + /*   550 */   241,  242,  184,  282,  241,  242,  110,  242,  184,  242,
       149333  + /*   560 */   251,   59,  109,  110,  196,  184,  251,  114,  251,   43,
148758 149334    /*   570 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,
148759         - /*   580 */    54,   55,   56,   57,   59,  184,   26,   59,  268,  109,
148760         - /*   590 */   110,  111,  184,  145,  146,  147,  112,   59,  203,  115,
148761         - /*   600 */   116,  117,  277,  109,  110,  111,  205,  206,  195,  125,
148762         - /*   610 */   277,  109,  110,  111,  100,  101,  139,  109,  110,  111,
148763         - /*   620 */   219,  184,   96,   97,   98,   99,  100,  101,  102,  103,
148764         - /*   630 */   104,  105,  106,  111,  109,  110,  111,  109,  110,  111,
148765         - /*   640 */   227,  228,   19,  184,  136,  184,   23,  109,  110,  111,
148766         - /*   650 */   200,  201,  202,  240,  259,  260,  261,  195,  136,  145,
148767         - /*   660 */   184,  147,  184,  184,  136,  214,   43,   44,   45,   46,
       149335  + /*   580 */    54,   55,   56,   57,  259,  217,   12,  219,  255,  109,
       149336  + /*   590 */   110,  111,  203,  109,  110,  111,  184,   22,  145,  146,
       149337  + /*   600 */   147,   27,  112,   22,  230,  115,  116,  117,  227,   19,
       149338  + /*   610 */    59,  109,  110,  111,  291,  125,   42,   35,  206,  207,
       149339  + /*   620 */   295,  184,   96,   97,   98,   99,  100,  101,  102,  103,
       149340  + /*   630 */   104,  105,  106,   26,   59,  233,   46,   63,  136,  184,
       149341  + /*   640 */    59,  184,   19,  206,  207,  243,   23,   73,   66,  260,
       149342  + /*   650 */   261,  262,   59,  184,  242,  195,   74,  220,  184,  184,
       149343  + /*   660 */   109,  110,  111,  206,  207,  184,   43,   44,   45,   46,
148768 149344    /*   670 */    47,   48,   49,   50,   51,   52,   53,   54,   55,   56,
148769         - /*   680 */    57,  205,  206,  205,  206,  227,  228,  184,  229,  227,
148770         - /*   690 */   228,  131,  132,  184,   59,  219,  184,  219,  240,  291,
148771         - /*   700 */   292,  184,  240,  295,  105,  106,   22,   23,  205,  206,
148772         - /*   710 */    26,  184,  251,  184,  205,  206,  184,  205,  206,   96,
       149345  + /*   680 */    57,  206,  207,   76,  109,  110,  111,  136,  228,  229,
       149346  + /*   690 */   109,  110,  111,   86,  184,  220,   89,   21,  108,  230,
       149347  + /*   700 */   184,  241,  109,  110,  111,  123,  184,  127,  184,  129,
       149348  + /*   710 */   130,  184,  195,  184,  124,  184,  198,  199,  184,   96,
148773 149349    /*   720 */    97,   98,   99,  100,  101,  102,  103,  104,  105,  106,
148774         - /*   730 */   251,  219,  205,  206,  205,  206,  184,  205,  206,   19,
148775         - /*   740 */   184,   16,  184,   23,  241,  110,  219,   21,  219,  184,
148776         - /*   750 */   241,  219,  286,  287,  195,  184,  195,  205,  206,  201,
148777         - /*   760 */   202,  205,  206,   43,   44,   45,   46,   47,   48,   49,
148778         - /*   770 */    50,   51,   52,   53,   54,   55,   56,   57,  184,   95,
148779         - /*   780 */    22,   23,  184,   26,   26,  220,  227,  228,  227,  228,
148780         - /*   790 */   196,  184,   23,  241,   26,   26,  195,  241,  184,  240,
148781         - /*   800 */    12,  240,   77,   26,   79,  195,   80,  290,  201,  202,
148782         - /*   810 */   216,  184,  218,  195,  184,   27,   96,   97,   98,   99,
148783         - /*   820 */   100,  101,  102,  103,  104,  105,  106,  269,  227,  228,
148784         - /*   830 */    42,  184,  205,  206,  184,  184,   19,  227,  228,  192,
148785         - /*   840 */    23,  240,  116,  196,   76,  227,  228,  120,  121,  122,
148786         - /*   850 */   240,   63,  254,   95,   86,  205,  206,   89,  240,  184,
       149350  + /*   730 */   206,  207,   11,  206,  207,  206,  207,  206,  207,   19,
       149351  + /*   740 */   206,  207,  184,   23,  220,  228,  229,  220,   81,  220,
       149352  + /*   750 */   195,  220,  287,  288,  220,  195,   80,  195,  241,  201,
       149353  + /*   760 */   202,  184,   73,   43,   44,   45,   46,   47,   48,   49,
       149354  + /*   770 */    50,   51,   52,   53,   54,   55,   56,   57,  201,  202,
       149355  + /*   780 */   113,  195,  184,  228,  229,  120,  121,  122,  228,  229,
       149356  + /*   790 */   228,  229,  116,   16,   23,  184,  241,   26,  131,  132,
       149357  + /*   800 */   278,  241,   19,  241,   22,   23,  184,  189,   26,  120,
       149358  + /*   810 */   121,  122,  184,   26,  228,  229,   96,   97,   98,   99,
       149359  + /*   820 */   100,  101,  102,  103,  104,  105,  106,  241,  270,  153,
       149360  + /*   830 */    66,  228,  229,  229,  206,  207,   19,  184,  228,  229,
       149361  + /*   840 */    23,   16,  121,  122,  241,  241,   82,  270,   29,  227,
       149362  + /*   850 */   252,  241,   33,   19,   77,   91,   79,  184,   22,   23,
148787 149363    /*   860 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
148788         - /*   870 */    53,   54,   55,   56,   57,  184,  269,  184,  153,  153,
148789         - /*   880 */   111,  184,    7,    8,    9,  184,  138,  184,  184,  196,
148790         - /*   890 */   184,  120,  121,  122,  184,  138,  205,  206,  184,  102,
148791         - /*   900 */   184,  184,  205,  206,  156,  136,  205,  206,  205,  206,
148792         - /*   910 */   198,  199,  135,   96,   97,   98,   99,  100,  101,  102,
148793         - /*   920 */   103,  104,  105,  106,  184,  128,  184,  184,  184,  254,
148794         - /*   930 */   133,  184,  237,   19,  239,  229,  226,   23,  292,  184,
148795         - /*   940 */   226,  295,  226,  226,  184,  205,  206,  205,  206,  205,
148796         - /*   950 */   206,  184,  292,   19,  184,  295,  252,   43,   44,   45,
       149364  + /*   870 */    53,   54,   55,   56,   57,   12,  184,   95,  184,  206,
       149365  + /*   880 */   207,   76,  111,  184,   65,  267,  184,  184,  184,  271,
       149366  + /*   890 */    27,   86,  109,  184,   89,  120,  121,  122,  206,  207,
       149367  + /*   900 */   206,  207,   77,  139,   79,   42,  184,  136,  206,  207,
       149368  + /*   910 */   206,  207,  184,   96,   97,   98,   99,  100,  101,  102,
       149369  + /*   920 */   103,  104,  105,  106,  184,  138,   63,  184,  206,  207,
       149370  + /*   930 */   153,   95,  184,   19,  206,  207,  227,   23,    7,    8,
       149371  + /*   940 */     9,  293,  293,  109,  296,  296,  206,  207,  215,  206,
       149372  + /*   950 */   207,  184,  253,   19,  206,  207,  253,   43,   44,   45,
148797 149373    /*   960 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
148798         - /*   970 */    56,   57,  205,  206,  184,  205,  206,   43,   44,   45,
       149374  + /*   970 */    56,   57,  184,  206,  207,  184,  184,   43,   44,   45,
148799 149375    /*   980 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
148800         - /*   990 */    56,   57,  157,  158,   26,  205,  206,  254,   26,  252,
148801         - /*  1000 */   184,   15,  184,  184,  184,  292,  184,  252,  295,   24,
       149376  + /*   990 */    56,   57,  184,   22,   23,  184,   59,  206,  207,  184,
       149377  + /*  1000 */   184,  238,  184,  240,  184,   22,  184,  184,  157,  158,
148802 149378    /*  1010 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
148803         - /*  1020 */   106,  205,  206,  205,  206,  205,  206,  205,  206,  184,
       149379  + /*  1020 */   106,  206,  207,  184,  206,  207,  206,  207,  206,  207,
148804 149380    /*  1030 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
148805         - /*  1040 */   106,  184,  184,  184,   59,  184,   60,  184,  229,  184,
148806         - /*  1050 */   205,  206,  184,  258,  184,   19,  184,   19,  184,  246,
148807         - /*  1060 */   184,  258,  205,  206,  205,  206,  205,  206,  205,  206,
148808         - /*  1070 */   205,  206,  184,  205,  206,  205,  206,  205,  206,  205,
148809         - /*  1080 */   206,  205,  206,  292,  226,  151,  295,  184,  228,  294,
148810         - /*  1090 */   184,  119,  184,  205,  206,  110,  150,  294,  152,  184,
148811         - /*  1100 */   240,  184,   22,   23,   23,   19,  184,   26,  205,  206,
148812         - /*  1110 */   142,  205,  206,  205,  206,  184,  198,  199,  131,  132,
148813         - /*  1120 */   205,  206,  205,  206,   22,   19,   24,  205,  206,   43,
       149381  + /*  1040 */   106,  184,   59,  227,  252,  184,  293,  110,  184,  296,
       149382  + /*  1050 */   184,  184,  184,  230,  184,  184,  184,   15,  184,  184,
       149383  + /*  1060 */   184,  253,  184,  206,  207,  184,   95,  206,  207,  102,
       149384  + /*  1070 */   206,  207,  206,  207,  206,  207,  206,  207,  206,  207,
       149385  + /*  1080 */   206,  207,  206,  207,  184,  151,  184,  206,  207,  278,
       149386  + /*  1090 */   184,  252,  184,  110,  184,  128,  184,  198,  199,  184,
       149387  + /*  1100 */   133,  184,   60,   26,  184,   19,  206,  207,  206,  207,
       149388  + /*  1110 */   131,  132,  206,  207,  206,  207,  206,  207,  206,  207,
       149389  + /*  1120 */   253,  206,  207,  206,  207,   19,  206,  207,  253,   43,
148814 149390    /*  1130 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,
148815         - /*  1140 */    54,   55,   56,   57,  184,  109,  184,  109,  184,   43,
       149391  + /*  1140 */    54,   55,   56,   57,  184,   26,  184,   26,  184,   43,
148816 149392    /*  1150 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,
148817         - /*  1160 */    54,   55,   56,   57,   46,  205,  206,  205,  206,  205,
148818         - /*  1170 */   206,  232,  184,  184,  184,   95,  184,  284,  285,  244,
148819         - /*  1180 */   245,  242,   96,   97,   98,   99,  100,  101,  102,  103,
148820         - /*  1190 */   104,  105,  106,  205,  206,  205,  206,  205,  206,  184,
148821         - /*  1200 */    22,  184,   96,   97,   98,   99,  100,  101,  102,  103,
148822         - /*  1210 */   104,  105,  106,  184,   24,   23,  184,  184,   26,  184,
148823         - /*  1220 */   205,  206,  205,  206,  184,   31,  108,  128,   22,  122,
148824         - /*  1230 */   184,   53,  133,   39,  205,  206,   22,  151,  205,  206,
148825         - /*  1240 */   205,  206,  113,  114,   23,  205,  206,   26,   59,   23,
148826         - /*  1250 */    23,  144,   26,   26,  184,   23,   23,   19,   26,   26,
148827         - /*  1260 */     7,    8,   24,   23,  214,   23,   26,   61,   26,   59,
148828         - /*  1270 */    23,   23,   23,   26,   26,   26,  145,   19,  147,   59,
148829         - /*  1280 */   184,   43,   44,   45,   46,   47,   48,   49,   50,   51,
148830         - /*  1290 */    52,   53,   54,   55,   56,   57,  145,   23,  147,  110,
       149393  + /*  1160 */    54,   55,   56,   57,  285,  286,  206,  207,  206,  207,
       149394  + /*  1170 */   206,  207,  184,   31,  184,  293,  184,  293,  296,  184,
       149395  + /*  1180 */   296,   39,   96,   97,   98,   99,  100,  101,  102,  103,
       149396  + /*  1190 */   104,  105,  106,  184,  206,  207,  206,  207,  206,  207,
       149397  + /*  1200 */   184,   22,   96,   97,   98,   99,  100,  101,  102,  103,
       149398  + /*  1210 */   104,  105,  106,  184,  245,  246,  184,   26,   23,  142,
       149399  + /*  1220 */   128,   26,  206,  207,  150,  133,  152,   22,   22,   24,
       149400  + /*  1230 */   111,   23,   53,  184,   26,  206,  207,  151,  206,  207,
       149401  + /*  1240 */   119,   24,  122,   23,   23,   23,   26,   26,   26,   23,
       149402  + /*  1250 */    23,   23,   26,   26,   26,  136,   23,   19,   22,   26,
       149403  + /*  1260 */   113,  114,   24,  114,  144,  184,   59,   61,    7,    8,
       149404  + /*  1270 */    59,   23,   23,  124,   26,   26,   23,   19,  145,   26,
       149405  + /*  1280 */   147,   43,   44,   45,   46,   47,   48,   49,   50,   51,
       149406  + /*  1290 */    52,   53,   54,   55,   56,   57,  145,   23,  147,  184,
148831 149407    /*  1300 */    26,   43,   44,   45,   46,   47,   48,   49,   50,   51,
148832         - /*  1310 */    52,   53,   54,   55,   56,   57,   23,  184,  184,   26,
148833         - /*  1320 */   110,  184,  184,  184,  134,  184,  184,  184,  184,  184,
148834         - /*  1330 */   110,  184,  184,  184,   96,   97,   98,   99,  100,  101,
148835         - /*  1340 */   102,  103,  104,  105,  106,  184,  184,  184,  134,  300,
148836         - /*  1350 */   184,  243,  184,  184,   96,   97,   98,   99,  100,  101,
       149408  + /*  1310 */    52,   53,   54,   55,   56,   57,   23,  110,  184,   26,
       149409  + /*  1320 */   184,  110,  184,  184,  184,  215,  135,  215,  184,  184,
       149410  + /*  1330 */   184,  247,  184,  244,   96,   97,   98,   99,  100,  101,
       149411  + /*  1340 */   102,  103,  104,  105,  106,  184,  184,  184,  301,  184,
       149412  + /*  1350 */   184,  134,  225,  184,   96,   97,   98,   99,  100,  101,
148837 149413    /*  1360 */   102,  103,  104,  105,  106,  184,  184,  184,  184,  184,
148838         - /*  1370 */   224,  184,  282,  273,   19,  272,  203,  182,  243,  243,
148839         - /*  1380 */   230,  209,  278,  243,  231,  208,  265,  278,  234,  234,
148840         - /*  1390 */   234,  217,  213,   60,   19,  243,  208,  237,  233,   44,
       149414  + /*  1370 */   134,  184,  274,  273,   19,  244,  244,  204,  182,  244,
       149415  + /*  1380 */   283,  231,  279,  279,  232,  244,  210,  209,  235,  235,
       149416  + /*  1390 */   235,  248,  218,  234,   19,  209,  238,  209,  238,   44,
148841 149417    /*  1400 */    45,   46,   47,   48,   49,   50,   51,   52,   53,   54,
148842         - /*  1410 */    55,   56,   57,  208,  247,  187,  134,  247,  247,   38,
       149418  + /*  1410 */    55,   56,   57,  214,   60,  248,  248,  187,  134,   38,
148843 149419    /*  1420 */    45,   46,   47,   48,   49,   50,   51,   52,   53,   54,
148844         - /*  1430 */    55,   56,   57,  237,  231,  191,  191,  279,  279,  282,
148845         - /*  1440 */   143,  191,  108,  268,   22,   19,   20,  256,   22,   43,
148846         - /*  1450 */   257,   96,   97,   98,   99,  100,  101,  102,  103,  104,
148847         - /*  1460 */   105,  106,   36,  222,  142,  234,   18,  191,  225,   18,
148848         - /*  1470 */   190,   96,   97,   98,   99,  100,  101,  102,  103,  104,
148849         - /*  1480 */   105,  106,  225,  191,  225,   59,  225,  257,  234,  234,
148850         - /*  1490 */   256,  222,  222,  190,  234,  150,   62,   71,  275,  274,
148851         - /*  1500 */   191,   19,   20,  190,   22,   22,  210,   81,  191,  190,
148852         - /*  1510 */   210,  191,  108,  190,  207,  207,   64,  207,   36,  215,
148853         - /*  1520 */    94,  210,  207,  209,  119,  207,  100,  101,  207,  106,
148854         - /*  1530 */    48,  215,  207,  107,  210,  109,  110,  111,  267,  267,
148855         - /*  1540 */   114,   59,  210,  249,  137,  108,  248,  191,  249,  248,
148856         - /*  1550 */    88,  249,  141,   71,  248,  299,  138,  131,  132,   22,
148857         - /*  1560 */   191,  249,  299,  237,   82,  238,  150,  262,  140,   87,
148858         - /*  1570 */   139,  145,  146,  147,  148,  149,   94,  248,  238,  236,
148859         - /*  1580 */    25,  235,  100,  101,  234,  194,   26,  193,   13,  107,
148860         - /*  1590 */     6,  109,  110,  111,  264,  185,  114,  185,  183,  197,
148861         - /*  1600 */   183,  203,  183,  203,  203,  197,  203,  211,  211,    4,
148862         - /*  1610 */   197,    3,  203,   22,  155,   15,  288,  203,   93,  288,
148863         - /*  1620 */   285,   23,   16,  203,  203,   23,  132,  145,  146,  147,
148864         - /*  1630 */   148,  149,    0,    1,    2,  143,  123,    5,   24,  135,
148865         - /*  1640 */    20,   16,   10,   11,   12,   13,   14,  137,    1,   17,
148866         - /*  1650 */   135,  144,   19,   20,  123,   22,   61,  143,   37,  123,
148867         - /*  1660 */    53,  109,   30,   53,   32,   53,   53,  134,   34,   36,
148868         - /*  1670 */     1,    5,   40,   22,  108,  153,   26,   68,   75,   68,
148869         - /*  1680 */    41,  134,  108,   24,   20,  124,   19,  118,   23,   67,
148870         - /*  1690 */    22,   67,   59,   22,   22,   22,   22,   67,   28,   37,
148871         - /*  1700 */    23,  142,   70,   22,   71,   23,  157,   23,   23,   26,
148872         - /*  1710 */    78,   23,   22,   81,   23,   82,   24,   22,   24,  134,
148873         - /*  1720 */    87,   23,   19,   20,   92,   22,  109,   94,   23,   22,
148874         - /*  1730 */    34,   34,  136,  100,  101,   26,   34,   85,   34,   36,
148875         - /*  1740 */   107,   83,  109,  110,  111,   34,   90,  114,   34,   23,
148876         - /*  1750 */    75,   75,   44,   22,   24,   26,   34,   23,  126,   26,
148877         - /*  1760 */    23,   23,   59,  131,  132,   23,   23,   26,   23,   22,
148878         - /*  1770 */    11,   22,   22,   22,   71,   23,   23,   22,  145,  146,
148879         - /*  1780 */   147,  148,  149,   26,   23,   82,  154,  134,  128,  134,
148880         - /*  1790 */    87,  134,   15,    1,  301,  134,  301,   94,  301,  301,
148881         - /*  1800 */   301,  301,  301,  100,  101,  301,  301,  301,  301,  301,
148882         - /*  1810 */   107,  301,  109,  110,  111,    1,    2,  114,  301,    5,
148883         - /*  1820 */   301,  301,  301,  301,   10,   11,   12,   13,   14,  301,
148884         - /*  1830 */   301,   17,  301,  301,  301,  301,   19,   20,  301,   22,
148885         - /*  1840 */   301,  301,  301,  301,   30,  301,   32,  301,  145,  146,
148886         - /*  1850 */   147,  148,  149,   36,   40,  301,  301,  301,  301,  301,
148887         - /*  1860 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148888         - /*  1870 */   301,  301,  301,  301,  301,  301,   59,  301,  301,  301,
148889         - /*  1880 */   301,  301,  301,  301,   70,  301,  301,  301,   71,  301,
148890         - /*  1890 */   301,  301,   78,  301,  301,   81,   19,   20,  301,   22,
148891         - /*  1900 */   301,  301,  301,  301,  301,  301,   92,  301,  301,  301,
148892         - /*  1910 */   301,   94,  301,   36,  301,  301,  301,  100,  101,  102,
148893         - /*  1920 */   301,  301,  301,  301,  107,  301,  109,  110,  111,  301,
148894         - /*  1930 */   301,  114,  301,  301,  301,  301,   59,  301,  301,  301,
148895         - /*  1940 */   126,  301,  301,  301,  301,  131,  132,  301,   71,  301,
148896         - /*  1950 */   301,  301,  301,  301,  301,  301,   19,   20,  301,   22,
148897         - /*  1960 */   301,  301,  145,  146,  147,  148,  149,  301,  154,  301,
148898         - /*  1970 */   301,   94,  301,   36,  301,  301,  301,  100,  101,  301,
148899         - /*  1980 */   301,  301,  301,  301,  107,  301,  109,  110,  111,  301,
148900         - /*  1990 */   301,  114,    5,  301,  301,  301,   59,   10,   11,   12,
148901         - /*  2000 */    13,   14,  301,  301,   17,  301,  301,  301,   71,  301,
148902         - /*  2010 */   301,  301,  301,  301,  301,  301,  301,   30,  301,   32,
148903         - /*  2020 */   301,  301,  145,  146,  147,  148,  149,   40,  301,  301,
148904         - /*  2030 */   301,   94,  301,  301,  301,  301,  301,  100,  101,  301,
148905         - /*  2040 */   301,  301,  301,  301,  107,  301,  109,  110,  111,  301,
148906         - /*  2050 */   301,  114,  301,  301,  301,  301,  301,   70,  301,  301,
148907         - /*  2060 */   301,  301,  301,  301,  301,   78,  301,  301,   81,  301,
148908         - /*  2070 */   301,  301,  301,  301,  301,  301,  301,  301,  301,   92,
148909         - /*  2080 */   301,  301,  145,  146,  147,  148,  149,  301,  301,  301,
148910         - /*  2090 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148911         - /*  2100 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148912         - /*  2110 */   301,  301,  301,  126,  301,  301,  301,  301,  131,  132,
148913         - /*  2120 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148914         - /*  2130 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148915         - /*  2140 */   301,  154,  301,  301,  301,  301,  301,  301,  301,  301,
148916         - /*  2150 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148917         - /*  2160 */   301,  301,  301,  301,  301,  301,  301,  301,  301,
148918         -};
148919         -#define YY_SHIFT_COUNT    (540)
       149420  + /*  1430 */    55,   56,   57,  232,  191,  191,  266,  280,  191,  283,
       149421  + /*  1440 */   143,  269,  108,   22,  280,   19,   20,  258,   22,  257,
       149422  + /*  1450 */    43,   96,   97,   98,   99,  100,  101,  102,  103,  104,
       149423  + /*  1460 */   105,  106,   36,  223,  142,   18,  235,  226,  226,  191,
       149424  + /*  1470 */    18,   96,   97,   98,   99,  100,  101,  102,  103,  104,
       149425  + /*  1480 */   105,  106,  226,  226,  190,   59,  235,  235,  223,  223,
       149426  + /*  1490 */   258,  257,  191,  190,  235,  150,   62,   71,  191,  276,
       149427  + /*  1500 */   275,   19,   20,  190,   22,   22,  211,   81,  191,  190,
       149428  + /*  1510 */   211,  191,  108,  190,  208,   64,  208,  208,   36,  119,
       149429  + /*  1520 */    94,  216,  211,  208,  210,  106,  100,  101,  216,  208,
       149430  + /*  1530 */    48,  268,  208,  107,  208,  109,  110,  111,  211,  268,
       149431  + /*  1540 */   114,   59,  211,  137,  108,   88,  250,  249,  191,  141,
       149432  + /*  1550 */   250,  249,  138,   71,  250,  300,   22,  131,  132,  249,
       149433  + /*  1560 */   300,  191,  150,  238,   82,  140,  250,  249,  239,   87,
       149434  + /*  1570 */   139,  145,  146,  147,  148,  149,   94,  239,  237,  236,
       149435  + /*  1580 */    25,  235,  100,  101,  194,   26,  193,   13,  185,  107,
       149436  + /*  1590 */   185,  109,  110,  111,    6,  263,  114,  203,  265,  183,
       149437  + /*  1600 */   183,  183,  203,  212,  203,  203,  197,  197,  212,    4,
       149438  + /*  1610 */     3,   22,  197,  155,   15,  204,  203,  289,   93,  289,
       149439  + /*  1620 */    16,  286,  132,   23,  204,   23,  123,  145,  146,  147,
       149440  + /*  1630 */   148,  149,    0,    1,    2,  143,   24,    5,   20,  135,
       149441  + /*  1640 */    16,    1,   10,   11,   12,   13,   14,  137,  135,   17,
       149442  + /*  1650 */   144,  123,   19,   20,   61,   22,   37,  143,  123,   53,
       149443  + /*  1660 */   109,   53,   30,   53,   32,   34,   53,  134,    1,   36,
       149444  + /*  1670 */     5,   22,   40,  108,  153,   41,   26,   68,   75,   68,
       149445  + /*  1680 */   134,  108,   24,   20,  124,   19,  118,   67,   67,   28,
       149446  + /*  1690 */    22,   22,   59,   22,   67,   23,   22,   22,  142,   37,
       149447  + /*  1700 */    23,   22,   70,   23,   71,  157,   23,   23,   26,   23,
       149448  + /*  1710 */    78,   22,   24,   81,   23,   82,   22,   24,  134,   23,
       149449  + /*  1720 */    87,   23,   19,   20,   92,   22,  109,   94,   22,   34,
       149450  + /*  1730 */   136,   26,   85,  100,  101,   34,   34,   83,   34,   36,
       149451  + /*  1740 */   107,   34,  109,  110,  111,   75,   90,  114,   75,   34,
       149452  + /*  1750 */    23,   22,   44,   34,   24,   23,   22,   26,  126,   26,
       149453  + /*  1760 */    23,   23,   59,  131,  132,   23,   23,   26,   23,   11,
       149454  + /*  1770 */    22,   22,   26,   23,   71,   23,   22,   22,  145,  146,
       149455  + /*  1780 */   147,  148,  149,  128,   23,   82,  154,  134,   15,    1,
       149456  + /*  1790 */    87,  134,  302,  134,  134,  302,  302,   94,  302,  302,
       149457  + /*  1800 */   302,  302,  302,  100,  101,  302,  302,  302,  302,  302,
       149458  + /*  1810 */   107,  302,  109,  110,  111,    1,    2,  114,  302,    5,
       149459  + /*  1820 */   302,  302,  302,  302,   10,   11,   12,   13,   14,  302,
       149460  + /*  1830 */   302,   17,  302,  302,  302,  302,   19,   20,  302,   22,
       149461  + /*  1840 */   302,  302,  302,  302,   30,  302,   32,  302,  145,  146,
       149462  + /*  1850 */   147,  148,  149,   36,   40,  302,  302,  302,  302,  302,
       149463  + /*  1860 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
       149464  + /*  1870 */   302,  302,  302,  302,  302,  302,   59,  302,  302,  302,
       149465  + /*  1880 */   302,  302,  302,  302,   70,  302,  302,  302,   71,  302,
       149466  + /*  1890 */   302,  302,   78,  302,  302,   81,   19,   20,  302,   22,
       149467  + /*  1900 */   302,  302,  302,  302,  302,  302,   92,  302,  302,  302,
       149468  + /*  1910 */   302,   94,  302,   36,  302,  302,  302,  100,  101,  102,
       149469  + /*  1920 */   302,  302,  302,  302,  107,  302,  109,  110,  111,  302,
       149470  + /*  1930 */   302,  114,  302,  302,  302,  302,   59,  302,  302,  302,
       149471  + /*  1940 */   126,  302,  302,  302,  302,  131,  132,  302,   71,  302,
       149472  + /*  1950 */   302,  302,  302,  302,  302,  302,   19,   20,  302,   22,
       149473  + /*  1960 */   302,  302,  145,  146,  147,  148,  149,  302,  154,  302,
       149474  + /*  1970 */   302,   94,  302,   36,  302,  302,  302,  100,  101,  302,
       149475  + /*  1980 */   302,  302,  302,  302,  107,  302,  109,  110,  111,  302,
       149476  + /*  1990 */   302,  114,    5,  302,  302,  302,   59,   10,   11,   12,
       149477  + /*  2000 */    13,   14,  302,  302,   17,  302,  302,  302,   71,  302,
       149478  + /*  2010 */   302,  302,  302,  302,  302,  302,  302,   30,  302,   32,
       149479  + /*  2020 */   302,  302,  145,  146,  147,  148,  149,   40,  302,  302,
       149480  + /*  2030 */   302,   94,  302,  302,  302,  302,  302,  100,  101,  302,
       149481  + /*  2040 */   302,  302,  302,  302,  107,  302,  109,  110,  111,  302,
       149482  + /*  2050 */   302,  114,  302,  302,  302,  302,  302,   70,  302,  302,
       149483  + /*  2060 */   302,  302,  302,  302,  302,   78,  302,  302,   81,  302,
       149484  + /*  2070 */   302,  302,  302,  302,  302,  302,  302,  302,  302,   92,
       149485  + /*  2080 */   302,  302,  145,  146,  147,  148,  149,  302,  302,  302,
       149486  + /*  2090 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
       149487  + /*  2100 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
       149488  + /*  2110 */   302,  302,  302,  126,  302,  302,  302,  302,  131,  132,
       149489  + /*  2120 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
       149490  + /*  2130 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
       149491  + /*  2140 */   302,  154,  302,  302,  302,  302,  302,  302,  302,  302,
       149492  + /*  2150 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
       149493  + /*  2160 */   302,  302,  302,  302,  302,  302,  302,  302,  302,
       149494  +};
       149495  +#define YY_SHIFT_COUNT    (539)
148920 149496   #define YY_SHIFT_MIN      (0)
148921 149497   #define YY_SHIFT_MAX      (1987)
148922 149498   static const unsigned short int yy_shift_ofst[] = {
148923         - /*     0 */  1814, 1632, 1987, 1426, 1426,  128, 1482, 1633, 1703, 1877,
148924         - /*    10 */  1877, 1877,   87,    0,    0,  264, 1106, 1877, 1877, 1877,
       149499  + /*     0 */  1814, 1632, 1987, 1426, 1426,  382, 1482, 1633, 1703, 1877,
       149500  + /*    10 */  1877, 1877,   85,    0,    0,  264, 1106, 1877, 1877, 1877,
148925 149501    /*    20 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
148926         - /*    30 */   226,  226,  381,  381,  296,  193,  128,  128,  128,  128,
148927         - /*    40 */   128,  128,   97,  194,  332,  429,  526,  623,  720,  817,
       149502  + /*    30 */   226,  226,  380,  380,  294,  667,  382,  382,  382,  382,
       149503  + /*    40 */   382,  382,   97,  194,  332,  429,  526,  623,  720,  817,
148928 149504    /*    50 */   914,  934, 1086, 1238, 1106, 1106, 1106, 1106, 1106, 1106,
148929 149505    /*    60 */  1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
148930 149506    /*    70 */  1106, 1106, 1258, 1106, 1355, 1375, 1375, 1817, 1877, 1877,
148931 149507    /*    80 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
148932 149508    /*    90 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
148933 149509    /*   100 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
148934 149510    /*   110 */  1937, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
148935 149511    /*   120 */  1877, 1877, 1877, 1877,   32,  129,  129,  129,  129,  129,
148936         - /*   130 */    21,  152,  297,  494,  726,   65,  494,  514,  514,  494,
148937         - /*   140 */   560,  560,  560,  560,  322,  599,   50, 2142, 2142,  155,
148938         - /*   150 */   155,  155,  313,  392,  386,  392,  392,  481,  481,  200,
148939         - /*   160 */   480,  684,  758,  494,  494,  494,  494,  494,  494,  494,
148940         - /*   170 */   494,  494,  494,  494,  494,  494,  494,  494,  494,  494,
148941         - /*   180 */   494,  494,  494,  494,  768,  768,  494,  166,  377,  377,
148942         - /*   190 */   635,  835,  835,  635,  748,  987, 2142, 2142, 2142,  448,
148943         - /*   200 */    45,   45,  403,  484,  502,  106,  525,  508,  528,  538,
148944         - /*   210 */   494,  494,  494,  494,  494,  494,  494,  494,  494,   84,
148945         - /*   220 */   494,  494,  494,  494,  494,  494,  494,  494,  494,  494,
148946         - /*   230 */   494,  494,  267,  267,  267,  494,  494,  494,  494,  769,
148947         - /*   240 */   494,  494,  494,    4,  477,  494,  494,  788,  494,  494,
148948         - /*   250 */   494,  494,  494,  494,  494,  494,  727,    5,  135,  985,
148949         - /*   260 */   985,  985,  985,  522,  135,  135,  797,  326,  875,  986,
148950         - /*   270 */   968, 1036, 1036, 1038,  968,  968, 1038,  972, 1081, 1118,
148951         - /*   280 */  1194, 1194, 1194, 1036,  757,  757,  946,  777, 1099, 1102,
148952         - /*   290 */  1333, 1282, 1282, 1381, 1381, 1282, 1297, 1334, 1422, 1406,
148953         - /*   300 */  1322, 1448, 1448, 1448, 1448, 1282, 1451, 1322, 1322, 1334,
148954         - /*   310 */  1422, 1406, 1406, 1322, 1282, 1451, 1345, 1434, 1282, 1451,
148955         - /*   320 */  1483, 1282, 1451, 1282, 1451, 1483, 1404, 1404, 1404, 1452,
148956         - /*   330 */  1483, 1404, 1405, 1404, 1452, 1404, 1404, 1483, 1423, 1423,
148957         - /*   340 */  1483, 1407, 1437, 1407, 1437, 1407, 1437, 1407, 1437, 1282,
148958         - /*   350 */  1462, 1462, 1411, 1418, 1537, 1282, 1416, 1411, 1428, 1431,
148959         - /*   360 */  1322, 1555, 1560, 1575, 1575, 1584, 1584, 1584, 2142, 2142,
       149512  + /*   130 */   171,    7,   17,  593,  676,  590,  593,  205,  205,  593,
       149513  + /*   140 */   318,  318,  318,  318,   50,  152,   51, 2142, 2142,  284,
       149514  + /*   150 */   284,  284,   65,  145,  282,  145,  145,  574,  574,  256,
       149515  + /*   160 */   348,  445,  782,  593,  593,  593,  593,  593,  593,  593,
       149516  + /*   170 */   593,  593,  593,  593,  593,  593,  593,  593,  593,  593,
       149517  + /*   180 */   593,  593,  593,  593,  607,  607,  593,  721,  805,  805,
       149518  + /*   190 */   446,  851,  851,  446,  190,  979, 2142, 2142, 2142,  453,
       149519  + /*   200 */    45,   45,  480,  490,  484,  385,  575,  502,  551,  581,
       149520  + /*   210 */   593,  593,  593,  593,  593,  593,  593,  593,  593,  689,
       149521  + /*   220 */   593,  593,  593,  593,  593,  593,  593,  593,  593,  593,
       149522  + /*   230 */   593,  593,  582,  582,  582,  593,  593,  593,  593,  771,
       149523  + /*   240 */   593,  593,  593,   59,  764,  593,  593,  863,  593,  593,
       149524  + /*   250 */   593,  593,  593,  593,  593,  593,  665,  819,  580,   16,
       149525  + /*   260 */    16,   16,   16, 1119,  580,  580,  967,  321,  931, 1042,
       149526  + /*   270 */  1077,  783,  783,  834, 1077, 1077,  834, 1121, 1195,  401,
       149527  + /*   280 */  1142, 1142, 1142,  783,  787,  787, 1074, 1191, 1092, 1205,
       149528  + /*   290 */  1354, 1284, 1284, 1381, 1381, 1284, 1297, 1334, 1421, 1407,
       149529  + /*   300 */  1322, 1447, 1447, 1447, 1447, 1284, 1452, 1322, 1322, 1334,
       149530  + /*   310 */  1421, 1407, 1407, 1322, 1284, 1452, 1345, 1434, 1284, 1452,
       149531  + /*   320 */  1483, 1284, 1452, 1284, 1452, 1483, 1404, 1404, 1404, 1451,
       149532  + /*   330 */  1483, 1404, 1400, 1404, 1451, 1404, 1404, 1483, 1419, 1419,
       149533  + /*   340 */  1483, 1406, 1436, 1406, 1436, 1406, 1436, 1406, 1436, 1284,
       149534  + /*   350 */  1457, 1457, 1408, 1414, 1534, 1284, 1412, 1408, 1425, 1431,
       149535  + /*   360 */  1322, 1555, 1559, 1574, 1574, 1588, 1588, 1588, 2142, 2142,
148960 149536    /*   370 */  2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
148961         - /*   380 */  2142, 2142, 2142, 2142,   61,  725,  374, 1080,  198,  771,
148962         - /*   390 */   283, 1192, 1178, 1190, 1107, 1221, 1206, 1226, 1227, 1232,
148963         - /*   400 */  1233, 1240, 1242, 1189, 1129, 1253,  216, 1210, 1247, 1248,
148964         - /*   410 */  1249, 1131, 1151, 1274, 1293, 1220, 1214, 1605, 1608, 1591,
148965         - /*   420 */  1459, 1600, 1525, 1606, 1598, 1602, 1494, 1492, 1513, 1614,
148966         - /*   430 */  1504, 1620, 1510, 1625, 1647, 1515, 1507, 1531, 1595, 1621,
148967         - /*   440 */  1514, 1607, 1610, 1612, 1613, 1536, 1552, 1634, 1533, 1669,
148968         - /*   450 */  1666, 1651, 1566, 1522, 1609, 1650, 1611, 1603, 1639, 1547,
148969         - /*   460 */  1574, 1659, 1664, 1667, 1561, 1569, 1668, 1622, 1671, 1672,
148970         - /*   470 */  1665, 1673, 1624, 1670, 1674, 1630, 1662, 1677, 1559, 1681,
148971         - /*   480 */  1682, 1549, 1684, 1685, 1683, 1688, 1690, 1692, 1691, 1695,
148972         - /*   490 */  1694, 1585, 1698, 1705, 1617, 1696, 1707, 1596, 1709, 1697,
148973         - /*   500 */  1702, 1704, 1711, 1652, 1675, 1658, 1708, 1676, 1656, 1714,
148974         - /*   510 */  1726, 1731, 1730, 1729, 1733, 1722, 1734, 1709, 1737, 1738,
148975         - /*   520 */  1742, 1743, 1741, 1745, 1747, 1759, 1749, 1750, 1752, 1753,
148976         - /*   530 */  1751, 1755, 1757, 1660, 1653, 1655, 1657, 1661, 1761, 1777,
148977         - /*   540 */  1792,
148978         -};
148979         -#define YY_REDUCE_COUNT (383)
148980         -#define YY_REDUCE_MIN   (-257)
148981         -#define YY_REDUCE_MAX   (1421)
       149537  + /*   380 */  2142, 2142, 2142,  378,  777,  836,  971,  825,  775,  983,
       149538  + /*   390 */  1208, 1179, 1217, 1120, 1220, 1206, 1221, 1222, 1226, 1227,
       149539  + /*   400 */  1228, 1233,  937, 1147, 1261, 1149, 1207, 1248, 1249, 1253,
       149540  + /*   410 */  1133, 1151, 1274, 1293, 1211, 1236, 1605, 1607, 1589, 1458,
       149541  + /*   420 */  1599, 1525, 1604, 1600, 1602, 1490, 1492, 1503, 1612, 1504,
       149542  + /*   430 */  1618, 1510, 1624, 1640, 1513, 1506, 1528, 1593, 1619, 1514,
       149543  + /*   440 */  1606, 1608, 1610, 1613, 1535, 1551, 1631, 1533, 1667, 1665,
       149544  + /*   450 */  1649, 1565, 1521, 1609, 1650, 1611, 1603, 1634, 1546, 1573,
       149545  + /*   460 */  1658, 1663, 1666, 1560, 1568, 1668, 1620, 1669, 1671, 1672,
       149546  + /*   470 */  1674, 1621, 1661, 1675, 1627, 1662, 1677, 1556, 1679, 1680,
       149547  + /*   480 */  1548, 1683, 1684, 1682, 1686, 1689, 1688, 1691, 1694, 1693,
       149548  + /*   490 */  1584, 1696, 1698, 1617, 1695, 1706, 1594, 1705, 1701, 1702,
       149549  + /*   500 */  1704, 1707, 1647, 1670, 1654, 1708, 1673, 1656, 1715, 1727,
       149550  + /*   510 */  1729, 1730, 1731, 1733, 1719, 1732, 1705, 1737, 1738, 1742,
       149551  + /*   520 */  1743, 1741, 1745, 1734, 1758, 1748, 1749, 1750, 1752, 1754,
       149552  + /*   530 */  1755, 1746, 1655, 1653, 1657, 1659, 1660, 1761, 1773, 1788,
       149553  +};
       149554  +#define YY_REDUCE_COUNT (382)
       149555  +#define YY_REDUCE_MIN   (-260)
       149556  +#define YY_REDUCE_MAX   (1420)
148982 149557   static const short yy_reduce_ofst[] = {
148983         - /*     0 */  -168,  -17,  164,  214,  310, -166, -184,  -18,   98, -170,
148984         - /*    10 */   305,  315, -163, -193, -178, -257,  395,  401,  476,  478,
148985         - /*    20 */   512,  117,  527,  529,  503,  509,  532,  255,  552,  556,
148986         - /*    30 */   558,  607,   37,  408,  594,  413,  462,  559,  561,  601,
148987         - /*    40 */   610,  618, -254, -254, -254, -254, -254, -254, -254, -254,
148988         - /*    50 */  -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,
148989         - /*    60 */  -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,
148990         - /*    70 */  -254, -254, -254, -254, -254, -254, -254, -111,  627,  650,
148991         - /*    80 */   691,  697,  701,  703,  740,  742,  744,  767,  770,  790,
148992         - /*    90 */   816,  818,  820,  822,  845,  857,  859,  861,  863,  865,
148993         - /*   100 */   868,  870,  872,  874,  876,  888,  903,  906,  908,  915,
148994         - /*   110 */   917,  922,  960,  962,  964,  988,  990,  992, 1015, 1017,
148995         - /*   120 */  1029, 1033, 1035, 1040, -254, -254, -254, -254, -254, -254,
148996         - /*   130 */  -254, -254, -254,  190,  270, -196,  160, -160,  450,  647,
148997         - /*   140 */   260,  458,  260,  458,   78, -254, -254, -254, -254,  206,
148998         - /*   150 */   206,  206,  320,  598,   -5,  675,  743, -148,  340, -125,
148999         - /*   160 */   459,  466,  466,  693,  -93,  461,  479,  706,  710,  714,
149000         - /*   170 */   716,  717,  169, -183,  325,  314,  704,  333,  747,  858,
149001         - /*   180 */    -8,  819,  565,  755,  646,  660,  517,  265,  713,  791,
149002         - /*   190 */   712,  795,  803,  918,  695,  860,  893,  935,  939, -181,
149003         - /*   200 */  -172, -147,  -91,  -46,   -3,  162,  173,  231,  338,  437,
149004         - /*   210 */   571,  614,  630,  651,  760,  931,  989, 1032, 1046, -218,
149005         - /*   220 */    38, 1070, 1096, 1133, 1134, 1137, 1138, 1139, 1141, 1142,
149006         - /*   230 */  1143, 1144,  292,  451, 1050, 1145, 1147, 1148, 1149,  813,
149007         - /*   240 */  1161, 1162, 1163, 1108, 1049, 1166, 1168, 1146, 1169,  162,
149008         - /*   250 */  1181, 1182, 1183, 1184, 1185, 1187, 1100, 1103, 1150, 1135,
149009         - /*   260 */  1136, 1140, 1152,  813, 1150, 1150, 1153, 1173, 1195, 1090,
149010         - /*   270 */  1154, 1167, 1170, 1104, 1155, 1156, 1109, 1172, 1174, 1179,
149011         - /*   280 */  1177, 1188, 1205, 1171, 1160, 1196, 1121, 1165, 1203, 1228,
149012         - /*   290 */  1157, 1244, 1245, 1158, 1159, 1250, 1175, 1193, 1191, 1241,
149013         - /*   300 */  1231, 1243, 1257, 1259, 1261, 1276, 1280, 1254, 1255, 1230,
149014         - /*   310 */  1234, 1269, 1270, 1260, 1292, 1303, 1223, 1225, 1309, 1313,
149015         - /*   320 */  1296, 1317, 1319, 1320, 1323, 1300, 1307, 1308, 1310, 1304,
149016         - /*   330 */  1311, 1315, 1314, 1318, 1316, 1321, 1325, 1324, 1271, 1272,
149017         - /*   340 */  1332, 1294, 1298, 1299, 1301, 1302, 1306, 1312, 1329, 1356,
149018         - /*   350 */  1256, 1263, 1327, 1326, 1305, 1369, 1330, 1340, 1343, 1346,
149019         - /*   360 */  1350, 1391, 1394, 1410, 1412, 1415, 1417, 1419, 1328, 1331,
149020         - /*   370 */  1335, 1402, 1398, 1400, 1401, 1403, 1408, 1396, 1397, 1409,
149021         - /*   380 */  1414, 1420, 1421, 1413,
       149558  + /*     0 */  -170,  -18, -159,  309,  313, -167,  -19,   75,  117,  211,
       149559  + /*    10 */   315,  317, -165, -195, -168, -260,  389,  437,  475,  524,
       149560  + /*    20 */   527, -169,  529,  531,  -28,   80,  534,  239,  304,  412,
       149561  + /*    30 */   558,  577,   37,  120,  368,  -22,  460,  517,  555,  560,
       149562  + /*    40 */   562,  586, -257, -257, -257, -257, -257, -257, -257, -257,
       149563  + /*    50 */  -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,
       149564  + /*    60 */  -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,
       149565  + /*    70 */  -257, -257, -257, -257, -257, -257, -257, -172,  457,  628,
       149566  + /*    80 */   673,  692,  694,  702,  704,  722,  728,  740,  743,  748,
       149567  + /*    90 */   767,  791,  815,  818,  820,  822,  857,  861,  864,  866,
       149568  + /*   100 */   868,  870,  872,  874,  876,  881,  900,  902,  906,  908,
       149569  + /*   110 */   910,  912,  915,  917,  920,  960,  962,  964,  988,  990,
       149570  + /*   120 */   992, 1016, 1029, 1032, -257, -257, -257, -257, -257, -257,
       149571  + /*   130 */  -257, -257, -257,  271,  618, -190,   68,   60,  240, -124,
       149572  + /*   140 */   603,  610,  603,  610,   12, -257, -257, -257, -257, -128,
       149573  + /*   150 */  -128, -128, -142,   25,  270,  281,  333,  124,  236,  648,
       149574  + /*   160 */   374,  465,  465,   28,  598,  792,  839,  469,   38,  381,
       149575  + /*   170 */   622,  709,  173,  699,  522,  703,  808,  811,  867,  816,
       149576  + /*   180 */  -104,  823,   -3,  875,  649,  753,  323,  -88,  882,  884,
       149577  + /*   190 */   518,   43,  325,  899,  763,  604,  879,  969,  402, -193,
       149578  + /*   200 */  -189, -180, -151,  -55,   69,  104,  141,  259,  286,  360,
       149579  + /*   210 */   364,  455,  474,  481,  510,  516,  611,  653,  788,   99,
       149580  + /*   220 */   871,  878,  995, 1009, 1049, 1081, 1115, 1134, 1136, 1138,
       149581  + /*   230 */  1139, 1140,  733, 1110, 1112, 1144, 1145, 1146, 1148, 1084,
       149582  + /*   240 */  1161, 1162, 1163, 1089, 1047, 1165, 1166, 1127, 1169,  104,
       149583  + /*   250 */  1181, 1182, 1183, 1184, 1185, 1187, 1098, 1100, 1150, 1131,
       149584  + /*   260 */  1132, 1135, 1141, 1084, 1150, 1150, 1152, 1173, 1196, 1097,
       149585  + /*   270 */  1153, 1143, 1167, 1103, 1154, 1155, 1104, 1176, 1174, 1199,
       149586  + /*   280 */  1178, 1186, 1188, 1168, 1158, 1160, 1170, 1159, 1201, 1230,
       149587  + /*   290 */  1156, 1243, 1244, 1157, 1164, 1247, 1172, 1189, 1192, 1240,
       149588  + /*   300 */  1231, 1241, 1242, 1256, 1257, 1278, 1294, 1251, 1252, 1232,
       149589  + /*   310 */  1234, 1265, 1266, 1259, 1301, 1303, 1223, 1225, 1307, 1313,
       149590  + /*   320 */  1295, 1317, 1319, 1320, 1323, 1299, 1306, 1308, 1309, 1305,
       149591  + /*   330 */  1311, 1315, 1314, 1321, 1312, 1324, 1326, 1327, 1263, 1271,
       149592  + /*   340 */  1331, 1296, 1298, 1300, 1302, 1304, 1310, 1316, 1318, 1357,
       149593  + /*   350 */  1255, 1260, 1329, 1325, 1332, 1370, 1333, 1338, 1341, 1343,
       149594  + /*   360 */  1346, 1390, 1393, 1403, 1405, 1416, 1417, 1418, 1328, 1330,
       149595  + /*   370 */  1335, 1409, 1394, 1399, 1401, 1402, 1410, 1391, 1396, 1411,
       149596  + /*   380 */  1420, 1413, 1415,
149022 149597   };
149023 149598   static const YYACTIONTYPE yy_default[] = {
149024         - /*     0 */  1536, 1536, 1536, 1376, 1159, 1265, 1159, 1159, 1159, 1376,
149025         - /*    10 */  1376, 1376, 1159, 1295, 1295, 1429, 1190, 1159, 1159, 1159,
149026         - /*    20 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1375, 1159, 1159,
149027         - /*    30 */  1159, 1159, 1459, 1459, 1159, 1159, 1159, 1159, 1159, 1159,
149028         - /*    40 */  1159, 1159, 1159, 1301, 1159, 1159, 1159, 1159, 1159, 1377,
149029         - /*    50 */  1378, 1159, 1159, 1159, 1428, 1430, 1393, 1311, 1310, 1309,
149030         - /*    60 */  1308, 1411, 1282, 1306, 1299, 1303, 1371, 1372, 1370, 1374,
149031         - /*    70 */  1378, 1377, 1159, 1302, 1342, 1356, 1341, 1159, 1159, 1159,
       149599  + /*     0 */  1537, 1537, 1537, 1377, 1159, 1266, 1159, 1159, 1159, 1377,
       149600  + /*    10 */  1377, 1377, 1159, 1296, 1296, 1430, 1190, 1159, 1159, 1159,
       149601  + /*    20 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1376, 1159, 1159,
       149602  + /*    30 */  1159, 1159, 1460, 1460, 1159, 1159, 1159, 1159, 1159, 1159,
       149603  + /*    40 */  1159, 1159, 1159, 1302, 1159, 1159, 1159, 1159, 1159, 1378,
       149604  + /*    50 */  1379, 1159, 1159, 1159, 1429, 1431, 1394, 1312, 1311, 1310,
       149605  + /*    60 */  1309, 1412, 1283, 1307, 1300, 1304, 1372, 1373, 1371, 1375,
       149606  + /*    70 */  1379, 1378, 1159, 1303, 1343, 1357, 1342, 1159, 1159, 1159,
149032 149607    /*    80 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149033 149608    /*    90 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149034 149609    /*   100 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149035 149610    /*   110 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149036         - /*   120 */  1159, 1159, 1159, 1159, 1350, 1355, 1361, 1354, 1351, 1344,
149037         - /*   130 */  1343, 1345, 1346, 1159, 1180, 1229, 1159, 1159, 1159, 1159,
149038         - /*   140 */  1447, 1446, 1159, 1159, 1190, 1347, 1348, 1358, 1357, 1436,
149039         - /*   150 */  1492, 1491, 1394, 1159, 1159, 1159, 1159, 1159, 1159, 1459,
       149611  + /*   120 */  1159, 1159, 1159, 1159, 1351, 1356, 1362, 1355, 1352, 1345,
       149612  + /*   130 */  1344, 1346, 1347, 1159, 1180, 1230, 1159, 1159, 1159, 1159,
       149613  + /*   140 */  1448, 1447, 1159, 1159, 1190, 1348, 1349, 1359, 1358, 1437,
       149614  + /*   150 */  1493, 1492, 1395, 1159, 1159, 1159, 1159, 1159, 1159, 1460,
149040 149615    /*   160 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149041 149616    /*   170 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149042         - /*   180 */  1159, 1159, 1159, 1159, 1459, 1459, 1159, 1190, 1459, 1459,
149043         - /*   190 */  1186, 1336, 1335, 1186, 1289, 1159, 1442, 1265, 1256, 1159,
       149617  + /*   180 */  1159, 1159, 1159, 1159, 1460, 1460, 1159, 1190, 1460, 1460,
       149618  + /*   190 */  1186, 1337, 1336, 1186, 1290, 1159, 1443, 1266, 1257, 1159,
149044 149619    /*   200 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149045         - /*   210 */  1159, 1159, 1159, 1433, 1431, 1159, 1159, 1159, 1159, 1159,
       149620  + /*   210 */  1159, 1159, 1159, 1434, 1432, 1159, 1159, 1159, 1159, 1159,
149046 149621    /*   220 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149047 149622    /*   230 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149048         - /*   240 */  1159, 1159, 1159, 1261, 1159, 1159, 1159, 1159, 1159, 1159,
149049         - /*   250 */  1159, 1159, 1159, 1159, 1159, 1486, 1159, 1406, 1243, 1261,
149050         - /*   260 */  1261, 1261, 1261, 1263, 1244, 1242, 1255, 1190, 1166, 1528,
149051         - /*   270 */  1305, 1284, 1284, 1525, 1305, 1305, 1525, 1204, 1506, 1201,
149052         - /*   280 */  1295, 1295, 1295, 1284, 1289, 1289, 1373, 1262, 1255, 1159,
149053         - /*   290 */  1528, 1270, 1270, 1527, 1527, 1270, 1394, 1314, 1320, 1232,
149054         - /*   300 */  1305, 1238, 1238, 1238, 1238, 1270, 1177, 1305, 1305, 1314,
149055         - /*   310 */  1320, 1232, 1232, 1305, 1270, 1177, 1410, 1522, 1270, 1177,
149056         - /*   320 */  1384, 1270, 1177, 1270, 1177, 1384, 1230, 1230, 1230, 1219,
149057         - /*   330 */  1384, 1230, 1204, 1230, 1219, 1230, 1230, 1384, 1388, 1388,
149058         - /*   340 */  1384, 1288, 1283, 1288, 1283, 1288, 1283, 1288, 1283, 1270,
149059         - /*   350 */  1469, 1469, 1300, 1289, 1379, 1270, 1159, 1300, 1298, 1296,
149060         - /*   360 */  1305, 1183, 1222, 1489, 1489, 1485, 1485, 1485, 1533, 1533,
149061         - /*   370 */  1442, 1501, 1190, 1190, 1190, 1190, 1501, 1206, 1206, 1190,
149062         - /*   380 */  1190, 1190, 1190, 1501, 1159, 1159, 1159, 1159, 1159, 1159,
149063         - /*   390 */  1496, 1159, 1395, 1274, 1159, 1159, 1159, 1159, 1159, 1159,
       149623  + /*   240 */  1159, 1159, 1159, 1262, 1159, 1159, 1159, 1159, 1159, 1159,
       149624  + /*   250 */  1159, 1159, 1159, 1159, 1159, 1487, 1159, 1407, 1244, 1262,
       149625  + /*   260 */  1262, 1262, 1262, 1264, 1245, 1243, 1256, 1191, 1166, 1529,
       149626  + /*   270 */  1306, 1285, 1285, 1526, 1306, 1306, 1526, 1205, 1507, 1202,
       149627  + /*   280 */  1296, 1296, 1296, 1285, 1290, 1290, 1374, 1263, 1256, 1159,
       149628  + /*   290 */  1529, 1271, 1271, 1528, 1528, 1271, 1395, 1315, 1321, 1233,
       149629  + /*   300 */  1306, 1239, 1239, 1239, 1239, 1271, 1177, 1306, 1306, 1315,
       149630  + /*   310 */  1321, 1233, 1233, 1306, 1271, 1177, 1411, 1523, 1271, 1177,
       149631  + /*   320 */  1385, 1271, 1177, 1271, 1177, 1385, 1231, 1231, 1231, 1220,
       149632  + /*   330 */  1385, 1231, 1205, 1231, 1220, 1231, 1231, 1385, 1389, 1389,
       149633  + /*   340 */  1385, 1289, 1284, 1289, 1284, 1289, 1284, 1289, 1284, 1271,
       149634  + /*   350 */  1470, 1470, 1301, 1290, 1380, 1271, 1159, 1301, 1299, 1297,
       149635  + /*   360 */  1306, 1183, 1223, 1490, 1490, 1486, 1486, 1486, 1534, 1534,
       149636  + /*   370 */  1443, 1502, 1190, 1190, 1190, 1190, 1502, 1207, 1207, 1191,
       149637  + /*   380 */  1191, 1190, 1502, 1159, 1159, 1159, 1159, 1159, 1159, 1497,
       149638  + /*   390 */  1159, 1396, 1275, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149064 149639    /*   400 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149065         - /*   410 */  1159, 1159, 1159, 1159, 1159, 1159, 1325, 1159, 1162, 1439,
149066         - /*   420 */  1159, 1159, 1437, 1159, 1159, 1159, 1159, 1159, 1159, 1275,
       149640  + /*   410 */  1159, 1159, 1159, 1159, 1159, 1326, 1159, 1162, 1440, 1159,
       149641  + /*   420 */  1159, 1438, 1159, 1159, 1159, 1159, 1159, 1159, 1276, 1159,
149067 149642    /*   430 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149068         - /*   440 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1524, 1159,
149069         - /*   450 */  1159, 1159, 1159, 1159, 1159, 1409, 1408, 1159, 1159, 1272,
       149643  + /*   440 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1525, 1159, 1159,
       149644  + /*   450 */  1159, 1159, 1159, 1159, 1410, 1409, 1159, 1159, 1273, 1159,
149070 149645    /*   460 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149071 149646    /*   470 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149072 149647    /*   480 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149073         - /*   490 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1297, 1159,
       149648  + /*   490 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1298, 1159, 1159,
149074 149649    /*   500 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149075         - /*   510 */  1159, 1159, 1159, 1474, 1290, 1159, 1159, 1515, 1159, 1159,
       149650  + /*   510 */  1159, 1159, 1475, 1291, 1159, 1159, 1516, 1159, 1159, 1159,
149076 149651    /*   520 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149077         - /*   530 */  1159, 1159, 1510, 1246, 1327, 1159, 1326, 1330, 1159, 1171,
149078         - /*   540 */  1159,
       149652  + /*   530 */  1159, 1511, 1247, 1328, 1159, 1327, 1331, 1159, 1171, 1159,
149079 149653   };
149080 149654   /********** End of lemon-generated parsing tables *****************************/
149081 149655   
149082 149656   /* The next table maps tokens (terminal symbols) into fallback tokens.  
149083 149657   ** If a construct like the following:
149084 149658   ** 
149085 149659   **      %fallback ID X Y Z.
................................................................................
149477 150051     /*  197 */ "carglist",
149478 150052     /*  198 */ "typetoken",
149479 150053     /*  199 */ "typename",
149480 150054     /*  200 */ "signed",
149481 150055     /*  201 */ "plus_num",
149482 150056     /*  202 */ "minus_num",
149483 150057     /*  203 */ "scanpt",
149484         -  /*  204 */ "ccons",
149485         -  /*  205 */ "term",
149486         -  /*  206 */ "expr",
149487         -  /*  207 */ "onconf",
149488         -  /*  208 */ "sortorder",
149489         -  /*  209 */ "autoinc",
149490         -  /*  210 */ "eidlist_opt",
149491         -  /*  211 */ "refargs",
149492         -  /*  212 */ "defer_subclause",
149493         -  /*  213 */ "refarg",
149494         -  /*  214 */ "refact",
149495         -  /*  215 */ "init_deferred_pred_opt",
149496         -  /*  216 */ "conslist",
149497         -  /*  217 */ "tconscomma",
149498         -  /*  218 */ "tcons",
149499         -  /*  219 */ "sortlist",
149500         -  /*  220 */ "eidlist",
149501         -  /*  221 */ "defer_subclause_opt",
149502         -  /*  222 */ "orconf",
149503         -  /*  223 */ "resolvetype",
149504         -  /*  224 */ "raisetype",
149505         -  /*  225 */ "ifexists",
149506         -  /*  226 */ "fullname",
149507         -  /*  227 */ "selectnowith",
149508         -  /*  228 */ "oneselect",
149509         -  /*  229 */ "wqlist",
149510         -  /*  230 */ "multiselect_op",
149511         -  /*  231 */ "distinct",
149512         -  /*  232 */ "selcollist",
149513         -  /*  233 */ "from",
149514         -  /*  234 */ "where_opt",
149515         -  /*  235 */ "groupby_opt",
149516         -  /*  236 */ "having_opt",
149517         -  /*  237 */ "orderby_opt",
149518         -  /*  238 */ "limit_opt",
149519         -  /*  239 */ "window_clause",
149520         -  /*  240 */ "values",
149521         -  /*  241 */ "nexprlist",
149522         -  /*  242 */ "sclp",
149523         -  /*  243 */ "as",
149524         -  /*  244 */ "seltablist",
149525         -  /*  245 */ "stl_prefix",
149526         -  /*  246 */ "joinop",
149527         -  /*  247 */ "indexed_opt",
149528         -  /*  248 */ "on_opt",
149529         -  /*  249 */ "using_opt",
149530         -  /*  250 */ "exprlist",
149531         -  /*  251 */ "xfullname",
149532         -  /*  252 */ "idlist",
149533         -  /*  253 */ "with",
149534         -  /*  254 */ "setlist",
149535         -  /*  255 */ "insert_cmd",
149536         -  /*  256 */ "idlist_opt",
149537         -  /*  257 */ "upsert",
149538         -  /*  258 */ "over_clause",
149539         -  /*  259 */ "likeop",
149540         -  /*  260 */ "between_op",
149541         -  /*  261 */ "in_op",
149542         -  /*  262 */ "paren_exprlist",
149543         -  /*  263 */ "case_operand",
149544         -  /*  264 */ "case_exprlist",
149545         -  /*  265 */ "case_else",
149546         -  /*  266 */ "uniqueflag",
149547         -  /*  267 */ "collate",
149548         -  /*  268 */ "vinto",
149549         -  /*  269 */ "nmnum",
149550         -  /*  270 */ "trigger_decl",
149551         -  /*  271 */ "trigger_cmd_list",
149552         -  /*  272 */ "trigger_time",
149553         -  /*  273 */ "trigger_event",
149554         -  /*  274 */ "foreach_clause",
149555         -  /*  275 */ "when_clause",
149556         -  /*  276 */ "trigger_cmd",
149557         -  /*  277 */ "trnm",
149558         -  /*  278 */ "tridxby",
149559         -  /*  279 */ "database_kw_opt",
149560         -  /*  280 */ "key_opt",
149561         -  /*  281 */ "add_column_fullname",
149562         -  /*  282 */ "kwcolumn_opt",
149563         -  /*  283 */ "create_vtab",
149564         -  /*  284 */ "vtabarglist",
149565         -  /*  285 */ "vtabarg",
149566         -  /*  286 */ "vtabargtoken",
149567         -  /*  287 */ "lp",
149568         -  /*  288 */ "anylist",
149569         -  /*  289 */ "windowdefn_list",
149570         -  /*  290 */ "windowdefn",
149571         -  /*  291 */ "window",
149572         -  /*  292 */ "frame_opt",
149573         -  /*  293 */ "part_opt",
149574         -  /*  294 */ "filter_opt",
149575         -  /*  295 */ "range_or_rows",
149576         -  /*  296 */ "frame_bound",
149577         -  /*  297 */ "frame_bound_s",
149578         -  /*  298 */ "frame_bound_e",
149579         -  /*  299 */ "frame_exclude_opt",
149580         -  /*  300 */ "frame_exclude",
       150058  +  /*  204 */ "scantok",
       150059  +  /*  205 */ "ccons",
       150060  +  /*  206 */ "term",
       150061  +  /*  207 */ "expr",
       150062  +  /*  208 */ "onconf",
       150063  +  /*  209 */ "sortorder",
       150064  +  /*  210 */ "autoinc",
       150065  +  /*  211 */ "eidlist_opt",
       150066  +  /*  212 */ "refargs",
       150067  +  /*  213 */ "defer_subclause",
       150068  +  /*  214 */ "refarg",
       150069  +  /*  215 */ "refact",
       150070  +  /*  216 */ "init_deferred_pred_opt",
       150071  +  /*  217 */ "conslist",
       150072  +  /*  218 */ "tconscomma",
       150073  +  /*  219 */ "tcons",
       150074  +  /*  220 */ "sortlist",
       150075  +  /*  221 */ "eidlist",
       150076  +  /*  222 */ "defer_subclause_opt",
       150077  +  /*  223 */ "orconf",
       150078  +  /*  224 */ "resolvetype",
       150079  +  /*  225 */ "raisetype",
       150080  +  /*  226 */ "ifexists",
       150081  +  /*  227 */ "fullname",
       150082  +  /*  228 */ "selectnowith",
       150083  +  /*  229 */ "oneselect",
       150084  +  /*  230 */ "wqlist",
       150085  +  /*  231 */ "multiselect_op",
       150086  +  /*  232 */ "distinct",
       150087  +  /*  233 */ "selcollist",
       150088  +  /*  234 */ "from",
       150089  +  /*  235 */ "where_opt",
       150090  +  /*  236 */ "groupby_opt",
       150091  +  /*  237 */ "having_opt",
       150092  +  /*  238 */ "orderby_opt",
       150093  +  /*  239 */ "limit_opt",
       150094  +  /*  240 */ "window_clause",
       150095  +  /*  241 */ "values",
       150096  +  /*  242 */ "nexprlist",
       150097  +  /*  243 */ "sclp",
       150098  +  /*  244 */ "as",
       150099  +  /*  245 */ "seltablist",
       150100  +  /*  246 */ "stl_prefix",
       150101  +  /*  247 */ "joinop",
       150102  +  /*  248 */ "indexed_opt",
       150103  +  /*  249 */ "on_opt",
       150104  +  /*  250 */ "using_opt",
       150105  +  /*  251 */ "exprlist",
       150106  +  /*  252 */ "xfullname",
       150107  +  /*  253 */ "idlist",
       150108  +  /*  254 */ "with",
       150109  +  /*  255 */ "setlist",
       150110  +  /*  256 */ "insert_cmd",
       150111  +  /*  257 */ "idlist_opt",
       150112  +  /*  258 */ "upsert",
       150113  +  /*  259 */ "over_clause",
       150114  +  /*  260 */ "likeop",
       150115  +  /*  261 */ "between_op",
       150116  +  /*  262 */ "in_op",
       150117  +  /*  263 */ "paren_exprlist",
       150118  +  /*  264 */ "case_operand",
       150119  +  /*  265 */ "case_exprlist",
       150120  +  /*  266 */ "case_else",
       150121  +  /*  267 */ "uniqueflag",
       150122  +  /*  268 */ "collate",
       150123  +  /*  269 */ "vinto",
       150124  +  /*  270 */ "nmnum",
       150125  +  /*  271 */ "trigger_decl",
       150126  +  /*  272 */ "trigger_cmd_list",
       150127  +  /*  273 */ "trigger_time",
       150128  +  /*  274 */ "trigger_event",
       150129  +  /*  275 */ "foreach_clause",
       150130  +  /*  276 */ "when_clause",
       150131  +  /*  277 */ "trigger_cmd",
       150132  +  /*  278 */ "trnm",
       150133  +  /*  279 */ "tridxby",
       150134  +  /*  280 */ "database_kw_opt",
       150135  +  /*  281 */ "key_opt",
       150136  +  /*  282 */ "add_column_fullname",
       150137  +  /*  283 */ "kwcolumn_opt",
       150138  +  /*  284 */ "create_vtab",
       150139  +  /*  285 */ "vtabarglist",
       150140  +  /*  286 */ "vtabarg",
       150141  +  /*  287 */ "vtabargtoken",
       150142  +  /*  288 */ "lp",
       150143  +  /*  289 */ "anylist",
       150144  +  /*  290 */ "windowdefn_list",
       150145  +  /*  291 */ "windowdefn",
       150146  +  /*  292 */ "window",
       150147  +  /*  293 */ "frame_opt",
       150148  +  /*  294 */ "part_opt",
       150149  +  /*  295 */ "filter_opt",
       150150  +  /*  296 */ "range_or_rows",
       150151  +  /*  297 */ "frame_bound",
       150152  +  /*  298 */ "frame_bound_s",
       150153  +  /*  299 */ "frame_bound_e",
       150154  +  /*  300 */ "frame_exclude_opt",
       150155  +  /*  301 */ "frame_exclude",
149581 150156   };
149582 150157   #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
149583 150158   
149584 150159   #ifndef NDEBUG
149585 150160   /* For tracing reduce actions, the names of all rules are required.
149586 150161   */
149587 150162   static const char *const yyRuleName[] = {
................................................................................
149610 150185    /*  22 */ "table_options ::= WITHOUT nm",
149611 150186    /*  23 */ "columnname ::= nm typetoken",
149612 150187    /*  24 */ "typetoken ::=",
149613 150188    /*  25 */ "typetoken ::= typename LP signed RP",
149614 150189    /*  26 */ "typetoken ::= typename LP signed COMMA signed RP",
149615 150190    /*  27 */ "typename ::= typename ID|STRING",
149616 150191    /*  28 */ "scanpt ::=",
149617         - /*  29 */ "ccons ::= CONSTRAINT nm",
149618         - /*  30 */ "ccons ::= DEFAULT scanpt term scanpt",
149619         - /*  31 */ "ccons ::= DEFAULT LP expr RP",
149620         - /*  32 */ "ccons ::= DEFAULT PLUS term scanpt",
149621         - /*  33 */ "ccons ::= DEFAULT MINUS term scanpt",
149622         - /*  34 */ "ccons ::= DEFAULT scanpt ID|INDEXED",
149623         - /*  35 */ "ccons ::= NOT NULL onconf",
149624         - /*  36 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
149625         - /*  37 */ "ccons ::= UNIQUE onconf",
149626         - /*  38 */ "ccons ::= CHECK LP expr RP",
149627         - /*  39 */ "ccons ::= REFERENCES nm eidlist_opt refargs",
149628         - /*  40 */ "ccons ::= defer_subclause",
149629         - /*  41 */ "ccons ::= COLLATE ID|STRING",
149630         - /*  42 */ "autoinc ::=",
149631         - /*  43 */ "autoinc ::= AUTOINCR",
149632         - /*  44 */ "refargs ::=",
149633         - /*  45 */ "refargs ::= refargs refarg",
149634         - /*  46 */ "refarg ::= MATCH nm",
149635         - /*  47 */ "refarg ::= ON INSERT refact",
149636         - /*  48 */ "refarg ::= ON DELETE refact",
149637         - /*  49 */ "refarg ::= ON UPDATE refact",
149638         - /*  50 */ "refact ::= SET NULL",
149639         - /*  51 */ "refact ::= SET DEFAULT",
149640         - /*  52 */ "refact ::= CASCADE",
149641         - /*  53 */ "refact ::= RESTRICT",
149642         - /*  54 */ "refact ::= NO ACTION",
149643         - /*  55 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
149644         - /*  56 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
149645         - /*  57 */ "init_deferred_pred_opt ::=",
149646         - /*  58 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
149647         - /*  59 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
149648         - /*  60 */ "conslist_opt ::=",
149649         - /*  61 */ "tconscomma ::= COMMA",
149650         - /*  62 */ "tcons ::= CONSTRAINT nm",
149651         - /*  63 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf",
149652         - /*  64 */ "tcons ::= UNIQUE LP sortlist RP onconf",
149653         - /*  65 */ "tcons ::= CHECK LP expr RP onconf",
149654         - /*  66 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt",
149655         - /*  67 */ "defer_subclause_opt ::=",
149656         - /*  68 */ "onconf ::=",
149657         - /*  69 */ "onconf ::= ON CONFLICT resolvetype",
149658         - /*  70 */ "orconf ::=",
149659         - /*  71 */ "orconf ::= OR resolvetype",
149660         - /*  72 */ "resolvetype ::= IGNORE",
149661         - /*  73 */ "resolvetype ::= REPLACE",
149662         - /*  74 */ "cmd ::= DROP TABLE ifexists fullname",
149663         - /*  75 */ "ifexists ::= IF EXISTS",
149664         - /*  76 */ "ifexists ::=",
149665         - /*  77 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select",
149666         - /*  78 */ "cmd ::= DROP VIEW ifexists fullname",
149667         - /*  79 */ "cmd ::= select",
149668         - /*  80 */ "select ::= WITH wqlist selectnowith",
149669         - /*  81 */ "select ::= WITH RECURSIVE wqlist selectnowith",
149670         - /*  82 */ "select ::= selectnowith",
149671         - /*  83 */ "selectnowith ::= selectnowith multiselect_op oneselect",
149672         - /*  84 */ "multiselect_op ::= UNION",
149673         - /*  85 */ "multiselect_op ::= UNION ALL",
149674         - /*  86 */ "multiselect_op ::= EXCEPT|INTERSECT",
149675         - /*  87 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
149676         - /*  88 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt",
149677         - /*  89 */ "values ::= VALUES LP nexprlist RP",
149678         - /*  90 */ "values ::= values COMMA LP nexprlist RP",
149679         - /*  91 */ "distinct ::= DISTINCT",
149680         - /*  92 */ "distinct ::= ALL",
149681         - /*  93 */ "distinct ::=",
149682         - /*  94 */ "sclp ::=",
149683         - /*  95 */ "selcollist ::= sclp scanpt expr scanpt as",
149684         - /*  96 */ "selcollist ::= sclp scanpt STAR",
149685         - /*  97 */ "selcollist ::= sclp scanpt nm DOT STAR",
149686         - /*  98 */ "as ::= AS nm",
149687         - /*  99 */ "as ::=",
149688         - /* 100 */ "from ::=",
149689         - /* 101 */ "from ::= FROM seltablist",
149690         - /* 102 */ "stl_prefix ::= seltablist joinop",
149691         - /* 103 */ "stl_prefix ::=",
149692         - /* 104 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
149693         - /* 105 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
149694         - /* 106 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
149695         - /* 107 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
149696         - /* 108 */ "dbnm ::=",
149697         - /* 109 */ "dbnm ::= DOT nm",
149698         - /* 110 */ "fullname ::= nm",
149699         - /* 111 */ "fullname ::= nm DOT nm",
149700         - /* 112 */ "xfullname ::= nm",
149701         - /* 113 */ "xfullname ::= nm DOT nm",
149702         - /* 114 */ "xfullname ::= nm DOT nm AS nm",
149703         - /* 115 */ "xfullname ::= nm AS nm",
149704         - /* 116 */ "joinop ::= COMMA|JOIN",
149705         - /* 117 */ "joinop ::= JOIN_KW JOIN",
149706         - /* 118 */ "joinop ::= JOIN_KW nm JOIN",
149707         - /* 119 */ "joinop ::= JOIN_KW nm nm JOIN",
149708         - /* 120 */ "on_opt ::= ON expr",
149709         - /* 121 */ "on_opt ::=",
149710         - /* 122 */ "indexed_opt ::=",
149711         - /* 123 */ "indexed_opt ::= INDEXED BY nm",
149712         - /* 124 */ "indexed_opt ::= NOT INDEXED",
149713         - /* 125 */ "using_opt ::= USING LP idlist RP",
149714         - /* 126 */ "using_opt ::=",
149715         - /* 127 */ "orderby_opt ::=",
149716         - /* 128 */ "orderby_opt ::= ORDER BY sortlist",
149717         - /* 129 */ "sortlist ::= sortlist COMMA expr sortorder",
149718         - /* 130 */ "sortlist ::= expr sortorder",
149719         - /* 131 */ "sortorder ::= ASC",
149720         - /* 132 */ "sortorder ::= DESC",
149721         - /* 133 */ "sortorder ::=",
149722         - /* 134 */ "groupby_opt ::=",
149723         - /* 135 */ "groupby_opt ::= GROUP BY nexprlist",
149724         - /* 136 */ "having_opt ::=",
149725         - /* 137 */ "having_opt ::= HAVING expr",
149726         - /* 138 */ "limit_opt ::=",
149727         - /* 139 */ "limit_opt ::= LIMIT expr",
149728         - /* 140 */ "limit_opt ::= LIMIT expr OFFSET expr",
149729         - /* 141 */ "limit_opt ::= LIMIT expr COMMA expr",
149730         - /* 142 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
149731         - /* 143 */ "where_opt ::=",
149732         - /* 144 */ "where_opt ::= WHERE expr",
149733         - /* 145 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
149734         - /* 146 */ "setlist ::= setlist COMMA nm EQ expr",
149735         - /* 147 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
149736         - /* 148 */ "setlist ::= nm EQ expr",
149737         - /* 149 */ "setlist ::= LP idlist RP EQ expr",
149738         - /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
149739         - /* 151 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
149740         - /* 152 */ "upsert ::=",
149741         - /* 153 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
149742         - /* 154 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
149743         - /* 155 */ "upsert ::= ON CONFLICT DO NOTHING",
149744         - /* 156 */ "insert_cmd ::= INSERT orconf",
149745         - /* 157 */ "insert_cmd ::= REPLACE",
149746         - /* 158 */ "idlist_opt ::=",
149747         - /* 159 */ "idlist_opt ::= LP idlist RP",
149748         - /* 160 */ "idlist ::= idlist COMMA nm",
149749         - /* 161 */ "idlist ::= nm",
149750         - /* 162 */ "expr ::= LP expr RP",
149751         - /* 163 */ "expr ::= ID|INDEXED",
149752         - /* 164 */ "expr ::= JOIN_KW",
149753         - /* 165 */ "expr ::= nm DOT nm",
149754         - /* 166 */ "expr ::= nm DOT nm DOT nm",
149755         - /* 167 */ "term ::= NULL|FLOAT|BLOB",
149756         - /* 168 */ "term ::= STRING",
149757         - /* 169 */ "term ::= INTEGER",
149758         - /* 170 */ "expr ::= VARIABLE",
149759         - /* 171 */ "expr ::= expr COLLATE ID|STRING",
149760         - /* 172 */ "expr ::= CAST LP expr AS typetoken RP",
149761         - /* 173 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
149762         - /* 174 */ "expr ::= ID|INDEXED LP STAR RP",
149763         - /* 175 */ "expr ::= ID|INDEXED LP distinct exprlist RP over_clause",
149764         - /* 176 */ "expr ::= ID|INDEXED LP STAR RP over_clause",
149765         - /* 177 */ "term ::= CTIME_KW",
149766         - /* 178 */ "expr ::= LP nexprlist COMMA expr RP",
149767         - /* 179 */ "expr ::= expr AND expr",
149768         - /* 180 */ "expr ::= expr OR expr",
149769         - /* 181 */ "expr ::= expr LT|GT|GE|LE expr",
149770         - /* 182 */ "expr ::= expr EQ|NE expr",
149771         - /* 183 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
149772         - /* 184 */ "expr ::= expr PLUS|MINUS expr",
149773         - /* 185 */ "expr ::= expr STAR|SLASH|REM expr",
149774         - /* 186 */ "expr ::= expr CONCAT expr",
149775         - /* 187 */ "likeop ::= NOT LIKE_KW|MATCH",
149776         - /* 188 */ "expr ::= expr likeop expr",
149777         - /* 189 */ "expr ::= expr likeop expr ESCAPE expr",
149778         - /* 190 */ "expr ::= expr ISNULL|NOTNULL",
149779         - /* 191 */ "expr ::= expr NOT NULL",
149780         - /* 192 */ "expr ::= expr IS expr",
149781         - /* 193 */ "expr ::= expr IS NOT expr",
149782         - /* 194 */ "expr ::= NOT expr",
149783         - /* 195 */ "expr ::= BITNOT expr",
149784         - /* 196 */ "expr ::= PLUS|MINUS expr",
149785         - /* 197 */ "between_op ::= BETWEEN",
149786         - /* 198 */ "between_op ::= NOT BETWEEN",
149787         - /* 199 */ "expr ::= expr between_op expr AND expr",
149788         - /* 200 */ "in_op ::= IN",
149789         - /* 201 */ "in_op ::= NOT IN",
149790         - /* 202 */ "expr ::= expr in_op LP exprlist RP",
149791         - /* 203 */ "expr ::= LP select RP",
149792         - /* 204 */ "expr ::= expr in_op LP select RP",
149793         - /* 205 */ "expr ::= expr in_op nm dbnm paren_exprlist",
149794         - /* 206 */ "expr ::= EXISTS LP select RP",
149795         - /* 207 */ "expr ::= CASE case_operand case_exprlist case_else END",
149796         - /* 208 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
149797         - /* 209 */ "case_exprlist ::= WHEN expr THEN expr",
149798         - /* 210 */ "case_else ::= ELSE expr",
149799         - /* 211 */ "case_else ::=",
149800         - /* 212 */ "case_operand ::= expr",
149801         - /* 213 */ "case_operand ::=",
149802         - /* 214 */ "exprlist ::=",
149803         - /* 215 */ "nexprlist ::= nexprlist COMMA expr",
149804         - /* 216 */ "nexprlist ::= expr",
149805         - /* 217 */ "paren_exprlist ::=",
149806         - /* 218 */ "paren_exprlist ::= LP exprlist RP",
149807         - /* 219 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
149808         - /* 220 */ "uniqueflag ::= UNIQUE",
149809         - /* 221 */ "uniqueflag ::=",
149810         - /* 222 */ "eidlist_opt ::=",
149811         - /* 223 */ "eidlist_opt ::= LP eidlist RP",
149812         - /* 224 */ "eidlist ::= eidlist COMMA nm collate sortorder",
149813         - /* 225 */ "eidlist ::= nm collate sortorder",
149814         - /* 226 */ "collate ::=",
149815         - /* 227 */ "collate ::= COLLATE ID|STRING",
149816         - /* 228 */ "cmd ::= DROP INDEX ifexists fullname",
149817         - /* 229 */ "cmd ::= VACUUM vinto",
149818         - /* 230 */ "cmd ::= VACUUM nm vinto",
149819         - /* 231 */ "vinto ::= INTO expr",
149820         - /* 232 */ "vinto ::=",
149821         - /* 233 */ "cmd ::= PRAGMA nm dbnm",
149822         - /* 234 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
149823         - /* 235 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
149824         - /* 236 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
149825         - /* 237 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
149826         - /* 238 */ "plus_num ::= PLUS INTEGER|FLOAT",
149827         - /* 239 */ "minus_num ::= MINUS INTEGER|FLOAT",
149828         - /* 240 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
149829         - /* 241 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
149830         - /* 242 */ "trigger_time ::= BEFORE|AFTER",
149831         - /* 243 */ "trigger_time ::= INSTEAD OF",
149832         - /* 244 */ "trigger_time ::=",
149833         - /* 245 */ "trigger_event ::= DELETE|INSERT",
149834         - /* 246 */ "trigger_event ::= UPDATE",
149835         - /* 247 */ "trigger_event ::= UPDATE OF idlist",
149836         - /* 248 */ "when_clause ::=",
149837         - /* 249 */ "when_clause ::= WHEN expr",
149838         - /* 250 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
149839         - /* 251 */ "trigger_cmd_list ::= trigger_cmd SEMI",
149840         - /* 252 */ "trnm ::= nm DOT nm",
149841         - /* 253 */ "tridxby ::= INDEXED BY nm",
149842         - /* 254 */ "tridxby ::= NOT INDEXED",
149843         - /* 255 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
149844         - /* 256 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
149845         - /* 257 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
149846         - /* 258 */ "trigger_cmd ::= scanpt select scanpt",
149847         - /* 259 */ "expr ::= RAISE LP IGNORE RP",
149848         - /* 260 */ "expr ::= RAISE LP raisetype COMMA nm RP",
149849         - /* 261 */ "raisetype ::= ROLLBACK",
149850         - /* 262 */ "raisetype ::= ABORT",
149851         - /* 263 */ "raisetype ::= FAIL",
149852         - /* 264 */ "cmd ::= DROP TRIGGER ifexists fullname",
149853         - /* 265 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
149854         - /* 266 */ "cmd ::= DETACH database_kw_opt expr",
149855         - /* 267 */ "key_opt ::=",
149856         - /* 268 */ "key_opt ::= KEY expr",
149857         - /* 269 */ "cmd ::= REINDEX",
149858         - /* 270 */ "cmd ::= REINDEX nm dbnm",
149859         - /* 271 */ "cmd ::= ANALYZE",
149860         - /* 272 */ "cmd ::= ANALYZE nm dbnm",
149861         - /* 273 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
149862         - /* 274 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
149863         - /* 275 */ "add_column_fullname ::= fullname",
149864         - /* 276 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
149865         - /* 277 */ "cmd ::= create_vtab",
149866         - /* 278 */ "cmd ::= create_vtab LP vtabarglist RP",
149867         - /* 279 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
149868         - /* 280 */ "vtabarg ::=",
149869         - /* 281 */ "vtabargtoken ::= ANY",
149870         - /* 282 */ "vtabargtoken ::= lp anylist RP",
149871         - /* 283 */ "lp ::= LP",
149872         - /* 284 */ "with ::= WITH wqlist",
149873         - /* 285 */ "with ::= WITH RECURSIVE wqlist",
149874         - /* 286 */ "wqlist ::= nm eidlist_opt AS LP select RP",
149875         - /* 287 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
149876         - /* 288 */ "windowdefn_list ::= windowdefn",
149877         - /* 289 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
149878         - /* 290 */ "windowdefn ::= nm AS LP window RP",
149879         - /* 291 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
149880         - /* 292 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
149881         - /* 293 */ "window ::= ORDER BY sortlist frame_opt",
149882         - /* 294 */ "window ::= nm ORDER BY sortlist frame_opt",
149883         - /* 295 */ "window ::= frame_opt",
149884         - /* 296 */ "window ::= nm frame_opt",
149885         - /* 297 */ "frame_opt ::=",
149886         - /* 298 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
149887         - /* 299 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
149888         - /* 300 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
149889         - /* 301 */ "frame_bound_s ::= frame_bound",
149890         - /* 302 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
149891         - /* 303 */ "frame_bound_e ::= frame_bound",
149892         - /* 304 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
149893         - /* 305 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
149894         - /* 306 */ "frame_bound ::= CURRENT ROW",
149895         - /* 307 */ "frame_exclude_opt ::=",
149896         - /* 308 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
149897         - /* 309 */ "frame_exclude ::= NO OTHERS",
149898         - /* 310 */ "frame_exclude ::= CURRENT ROW",
149899         - /* 311 */ "frame_exclude ::= GROUP|TIES",
149900         - /* 312 */ "window_clause ::= WINDOW windowdefn_list",
149901         - /* 313 */ "over_clause ::= filter_opt OVER LP window RP",
149902         - /* 314 */ "over_clause ::= filter_opt OVER nm",
149903         - /* 315 */ "filter_opt ::=",
149904         - /* 316 */ "filter_opt ::= FILTER LP WHERE expr RP",
149905         - /* 317 */ "input ::= cmdlist",
149906         - /* 318 */ "cmdlist ::= cmdlist ecmd",
149907         - /* 319 */ "cmdlist ::= ecmd",
149908         - /* 320 */ "ecmd ::= SEMI",
149909         - /* 321 */ "ecmd ::= cmdx SEMI",
149910         - /* 322 */ "ecmd ::= explain cmdx",
149911         - /* 323 */ "trans_opt ::=",
149912         - /* 324 */ "trans_opt ::= TRANSACTION",
149913         - /* 325 */ "trans_opt ::= TRANSACTION nm",
149914         - /* 326 */ "savepoint_opt ::= SAVEPOINT",
149915         - /* 327 */ "savepoint_opt ::=",
149916         - /* 328 */ "cmd ::= create_table create_table_args",
149917         - /* 329 */ "columnlist ::= columnlist COMMA columnname carglist",
149918         - /* 330 */ "columnlist ::= columnname carglist",
149919         - /* 331 */ "nm ::= ID|INDEXED",
149920         - /* 332 */ "nm ::= STRING",
149921         - /* 333 */ "nm ::= JOIN_KW",
149922         - /* 334 */ "typetoken ::= typename",
149923         - /* 335 */ "typename ::= ID|STRING",
149924         - /* 336 */ "signed ::= plus_num",
149925         - /* 337 */ "signed ::= minus_num",
149926         - /* 338 */ "carglist ::= carglist ccons",
149927         - /* 339 */ "carglist ::=",
149928         - /* 340 */ "ccons ::= NULL onconf",
149929         - /* 341 */ "conslist_opt ::= COMMA conslist",
149930         - /* 342 */ "conslist ::= conslist tconscomma tcons",
149931         - /* 343 */ "conslist ::= tcons",
149932         - /* 344 */ "tconscomma ::=",
149933         - /* 345 */ "defer_subclause_opt ::= defer_subclause",
149934         - /* 346 */ "resolvetype ::= raisetype",
149935         - /* 347 */ "selectnowith ::= oneselect",
149936         - /* 348 */ "oneselect ::= values",
149937         - /* 349 */ "sclp ::= selcollist COMMA",
149938         - /* 350 */ "as ::= ID|STRING",
149939         - /* 351 */ "expr ::= term",
149940         - /* 352 */ "likeop ::= LIKE_KW|MATCH",
149941         - /* 353 */ "exprlist ::= nexprlist",
149942         - /* 354 */ "nmnum ::= plus_num",
149943         - /* 355 */ "nmnum ::= nm",
149944         - /* 356 */ "nmnum ::= ON",
149945         - /* 357 */ "nmnum ::= DELETE",
149946         - /* 358 */ "nmnum ::= DEFAULT",
149947         - /* 359 */ "plus_num ::= INTEGER|FLOAT",
149948         - /* 360 */ "foreach_clause ::=",
149949         - /* 361 */ "foreach_clause ::= FOR EACH ROW",
149950         - /* 362 */ "trnm ::= nm",
149951         - /* 363 */ "tridxby ::=",
149952         - /* 364 */ "database_kw_opt ::= DATABASE",
149953         - /* 365 */ "database_kw_opt ::=",
149954         - /* 366 */ "kwcolumn_opt ::=",
149955         - /* 367 */ "kwcolumn_opt ::= COLUMNKW",
149956         - /* 368 */ "vtabarglist ::= vtabarg",
149957         - /* 369 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
149958         - /* 370 */ "vtabarg ::= vtabarg vtabargtoken",
149959         - /* 371 */ "anylist ::=",
149960         - /* 372 */ "anylist ::= anylist LP anylist RP",
149961         - /* 373 */ "anylist ::= anylist ANY",
149962         - /* 374 */ "with ::=",
       150192  + /*  29 */ "scantok ::=",
       150193  + /*  30 */ "ccons ::= CONSTRAINT nm",
       150194  + /*  31 */ "ccons ::= DEFAULT scantok term",
       150195  + /*  32 */ "ccons ::= DEFAULT LP expr RP",
       150196  + /*  33 */ "ccons ::= DEFAULT PLUS scantok term",
       150197  + /*  34 */ "ccons ::= DEFAULT MINUS scantok term",
       150198  + /*  35 */ "ccons ::= DEFAULT scantok ID|INDEXED",
       150199  + /*  36 */ "ccons ::= NOT NULL onconf",
       150200  + /*  37 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
       150201  + /*  38 */ "ccons ::= UNIQUE onconf",
       150202  + /*  39 */ "ccons ::= CHECK LP expr RP",
       150203  + /*  40 */ "ccons ::= REFERENCES nm eidlist_opt refargs",
       150204  + /*  41 */ "ccons ::= defer_subclause",
       150205  + /*  42 */ "ccons ::= COLLATE ID|STRING",
       150206  + /*  43 */ "autoinc ::=",
       150207  + /*  44 */ "autoinc ::= AUTOINCR",
       150208  + /*  45 */ "refargs ::=",
       150209  + /*  46 */ "refargs ::= refargs refarg",
       150210  + /*  47 */ "refarg ::= MATCH nm",
       150211  + /*  48 */ "refarg ::= ON INSERT refact",
       150212  + /*  49 */ "refarg ::= ON DELETE refact",
       150213  + /*  50 */ "refarg ::= ON UPDATE refact",
       150214  + /*  51 */ "refact ::= SET NULL",
       150215  + /*  52 */ "refact ::= SET DEFAULT",
       150216  + /*  53 */ "refact ::= CASCADE",
       150217  + /*  54 */ "refact ::= RESTRICT",
       150218  + /*  55 */ "refact ::= NO ACTION",
       150219  + /*  56 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
       150220  + /*  57 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
       150221  + /*  58 */ "init_deferred_pred_opt ::=",
       150222  + /*  59 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
       150223  + /*  60 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
       150224  + /*  61 */ "conslist_opt ::=",
       150225  + /*  62 */ "tconscomma ::= COMMA",
       150226  + /*  63 */ "tcons ::= CONSTRAINT nm",
       150227  + /*  64 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf",
       150228  + /*  65 */ "tcons ::= UNIQUE LP sortlist RP onconf",
       150229  + /*  66 */ "tcons ::= CHECK LP expr RP onconf",
       150230  + /*  67 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt",
       150231  + /*  68 */ "defer_subclause_opt ::=",
       150232  + /*  69 */ "onconf ::=",
       150233  + /*  70 */ "onconf ::= ON CONFLICT resolvetype",
       150234  + /*  71 */ "orconf ::=",
       150235  + /*  72 */ "orconf ::= OR resolvetype",
       150236  + /*  73 */ "resolvetype ::= IGNORE",
       150237  + /*  74 */ "resolvetype ::= REPLACE",
       150238  + /*  75 */ "cmd ::= DROP TABLE ifexists fullname",
       150239  + /*  76 */ "ifexists ::= IF EXISTS",
       150240  + /*  77 */ "ifexists ::=",
       150241  + /*  78 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select",
       150242  + /*  79 */ "cmd ::= DROP VIEW ifexists fullname",
       150243  + /*  80 */ "cmd ::= select",
       150244  + /*  81 */ "select ::= WITH wqlist selectnowith",
       150245  + /*  82 */ "select ::= WITH RECURSIVE wqlist selectnowith",
       150246  + /*  83 */ "select ::= selectnowith",
       150247  + /*  84 */ "selectnowith ::= selectnowith multiselect_op oneselect",
       150248  + /*  85 */ "multiselect_op ::= UNION",
       150249  + /*  86 */ "multiselect_op ::= UNION ALL",
       150250  + /*  87 */ "multiselect_op ::= EXCEPT|INTERSECT",
       150251  + /*  88 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
       150252  + /*  89 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt",
       150253  + /*  90 */ "values ::= VALUES LP nexprlist RP",
       150254  + /*  91 */ "values ::= values COMMA LP nexprlist RP",
       150255  + /*  92 */ "distinct ::= DISTINCT",
       150256  + /*  93 */ "distinct ::= ALL",
       150257  + /*  94 */ "distinct ::=",
       150258  + /*  95 */ "sclp ::=",
       150259  + /*  96 */ "selcollist ::= sclp scanpt expr scanpt as",
       150260  + /*  97 */ "selcollist ::= sclp scanpt STAR",
       150261  + /*  98 */ "selcollist ::= sclp scanpt nm DOT STAR",
       150262  + /*  99 */ "as ::= AS nm",
       150263  + /* 100 */ "as ::=",
       150264  + /* 101 */ "from ::=",
       150265  + /* 102 */ "from ::= FROM seltablist",
       150266  + /* 103 */ "stl_prefix ::= seltablist joinop",
       150267  + /* 104 */ "stl_prefix ::=",
       150268  + /* 105 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
       150269  + /* 106 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
       150270  + /* 107 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
       150271  + /* 108 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
       150272  + /* 109 */ "dbnm ::=",
       150273  + /* 110 */ "dbnm ::= DOT nm",
       150274  + /* 111 */ "fullname ::= nm",
       150275  + /* 112 */ "fullname ::= nm DOT nm",
       150276  + /* 113 */ "xfullname ::= nm",
       150277  + /* 114 */ "xfullname ::= nm DOT nm",
       150278  + /* 115 */ "xfullname ::= nm DOT nm AS nm",
       150279  + /* 116 */ "xfullname ::= nm AS nm",
       150280  + /* 117 */ "joinop ::= COMMA|JOIN",
       150281  + /* 118 */ "joinop ::= JOIN_KW JOIN",
       150282  + /* 119 */ "joinop ::= JOIN_KW nm JOIN",
       150283  + /* 120 */ "joinop ::= JOIN_KW nm nm JOIN",
       150284  + /* 121 */ "on_opt ::= ON expr",
       150285  + /* 122 */ "on_opt ::=",
       150286  + /* 123 */ "indexed_opt ::=",
       150287  + /* 124 */ "indexed_opt ::= INDEXED BY nm",
       150288  + /* 125 */ "indexed_opt ::= NOT INDEXED",
       150289  + /* 126 */ "using_opt ::= USING LP idlist RP",
       150290  + /* 127 */ "using_opt ::=",
       150291  + /* 128 */ "orderby_opt ::=",
       150292  + /* 129 */ "orderby_opt ::= ORDER BY sortlist",
       150293  + /* 130 */ "sortlist ::= sortlist COMMA expr sortorder",
       150294  + /* 131 */ "sortlist ::= expr sortorder",
       150295  + /* 132 */ "sortorder ::= ASC",
       150296  + /* 133 */ "sortorder ::= DESC",
       150297  + /* 134 */ "sortorder ::=",
       150298  + /* 135 */ "groupby_opt ::=",
       150299  + /* 136 */ "groupby_opt ::= GROUP BY nexprlist",
       150300  + /* 137 */ "having_opt ::=",
       150301  + /* 138 */ "having_opt ::= HAVING expr",
       150302  + /* 139 */ "limit_opt ::=",
       150303  + /* 140 */ "limit_opt ::= LIMIT expr",
       150304  + /* 141 */ "limit_opt ::= LIMIT expr OFFSET expr",
       150305  + /* 142 */ "limit_opt ::= LIMIT expr COMMA expr",
       150306  + /* 143 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
       150307  + /* 144 */ "where_opt ::=",
       150308  + /* 145 */ "where_opt ::= WHERE expr",
       150309  + /* 146 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
       150310  + /* 147 */ "setlist ::= setlist COMMA nm EQ expr",
       150311  + /* 148 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
       150312  + /* 149 */ "setlist ::= nm EQ expr",
       150313  + /* 150 */ "setlist ::= LP idlist RP EQ expr",
       150314  + /* 151 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
       150315  + /* 152 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
       150316  + /* 153 */ "upsert ::=",
       150317  + /* 154 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
       150318  + /* 155 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
       150319  + /* 156 */ "upsert ::= ON CONFLICT DO NOTHING",
       150320  + /* 157 */ "insert_cmd ::= INSERT orconf",
       150321  + /* 158 */ "insert_cmd ::= REPLACE",
       150322  + /* 159 */ "idlist_opt ::=",
       150323  + /* 160 */ "idlist_opt ::= LP idlist RP",
       150324  + /* 161 */ "idlist ::= idlist COMMA nm",
       150325  + /* 162 */ "idlist ::= nm",
       150326  + /* 163 */ "expr ::= LP expr RP",
       150327  + /* 164 */ "expr ::= ID|INDEXED",
       150328  + /* 165 */ "expr ::= JOIN_KW",
       150329  + /* 166 */ "expr ::= nm DOT nm",
       150330  + /* 167 */ "expr ::= nm DOT nm DOT nm",
       150331  + /* 168 */ "term ::= NULL|FLOAT|BLOB",
       150332  + /* 169 */ "term ::= STRING",
       150333  + /* 170 */ "term ::= INTEGER",
       150334  + /* 171 */ "expr ::= VARIABLE",
       150335  + /* 172 */ "expr ::= expr COLLATE ID|STRING",
       150336  + /* 173 */ "expr ::= CAST LP expr AS typetoken RP",
       150337  + /* 174 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
       150338  + /* 175 */ "expr ::= ID|INDEXED LP STAR RP",
       150339  + /* 176 */ "expr ::= ID|INDEXED LP distinct exprlist RP over_clause",
       150340  + /* 177 */ "expr ::= ID|INDEXED LP STAR RP over_clause",
       150341  + /* 178 */ "term ::= CTIME_KW",
       150342  + /* 179 */ "expr ::= LP nexprlist COMMA expr RP",
       150343  + /* 180 */ "expr ::= expr AND expr",
       150344  + /* 181 */ "expr ::= expr OR expr",
       150345  + /* 182 */ "expr ::= expr LT|GT|GE|LE expr",
       150346  + /* 183 */ "expr ::= expr EQ|NE expr",
       150347  + /* 184 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
       150348  + /* 185 */ "expr ::= expr PLUS|MINUS expr",
       150349  + /* 186 */ "expr ::= expr STAR|SLASH|REM expr",
       150350  + /* 187 */ "expr ::= expr CONCAT expr",
       150351  + /* 188 */ "likeop ::= NOT LIKE_KW|MATCH",
       150352  + /* 189 */ "expr ::= expr likeop expr",
       150353  + /* 190 */ "expr ::= expr likeop expr ESCAPE expr",
       150354  + /* 191 */ "expr ::= expr ISNULL|NOTNULL",
       150355  + /* 192 */ "expr ::= expr NOT NULL",
       150356  + /* 193 */ "expr ::= expr IS expr",
       150357  + /* 194 */ "expr ::= expr IS NOT expr",
       150358  + /* 195 */ "expr ::= NOT expr",
       150359  + /* 196 */ "expr ::= BITNOT expr",
       150360  + /* 197 */ "expr ::= PLUS|MINUS expr",
       150361  + /* 198 */ "between_op ::= BETWEEN",
       150362  + /* 199 */ "between_op ::= NOT BETWEEN",
       150363  + /* 200 */ "expr ::= expr between_op expr AND expr",
       150364  + /* 201 */ "in_op ::= IN",
       150365  + /* 202 */ "in_op ::= NOT IN",
       150366  + /* 203 */ "expr ::= expr in_op LP exprlist RP",
       150367  + /* 204 */ "expr ::= LP select RP",
       150368  + /* 205 */ "expr ::= expr in_op LP select RP",
       150369  + /* 206 */ "expr ::= expr in_op nm dbnm paren_exprlist",
       150370  + /* 207 */ "expr ::= EXISTS LP select RP",
       150371  + /* 208 */ "expr ::= CASE case_operand case_exprlist case_else END",
       150372  + /* 209 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
       150373  + /* 210 */ "case_exprlist ::= WHEN expr THEN expr",
       150374  + /* 211 */ "case_else ::= ELSE expr",
       150375  + /* 212 */ "case_else ::=",
       150376  + /* 213 */ "case_operand ::= expr",
       150377  + /* 214 */ "case_operand ::=",
       150378  + /* 215 */ "exprlist ::=",
       150379  + /* 216 */ "nexprlist ::= nexprlist COMMA expr",
       150380  + /* 217 */ "nexprlist ::= expr",
       150381  + /* 218 */ "paren_exprlist ::=",
       150382  + /* 219 */ "paren_exprlist ::= LP exprlist RP",
       150383  + /* 220 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
       150384  + /* 221 */ "uniqueflag ::= UNIQUE",
       150385  + /* 222 */ "uniqueflag ::=",
       150386  + /* 223 */ "eidlist_opt ::=",
       150387  + /* 224 */ "eidlist_opt ::= LP eidlist RP",
       150388  + /* 225 */ "eidlist ::= eidlist COMMA nm collate sortorder",
       150389  + /* 226 */ "eidlist ::= nm collate sortorder",
       150390  + /* 227 */ "collate ::=",
       150391  + /* 228 */ "collate ::= COLLATE ID|STRING",
       150392  + /* 229 */ "cmd ::= DROP INDEX ifexists fullname",
       150393  + /* 230 */ "cmd ::= VACUUM vinto",
       150394  + /* 231 */ "cmd ::= VACUUM nm vinto",
       150395  + /* 232 */ "vinto ::= INTO expr",
       150396  + /* 233 */ "vinto ::=",
       150397  + /* 234 */ "cmd ::= PRAGMA nm dbnm",
       150398  + /* 235 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
       150399  + /* 236 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
       150400  + /* 237 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
       150401  + /* 238 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
       150402  + /* 239 */ "plus_num ::= PLUS INTEGER|FLOAT",
       150403  + /* 240 */ "minus_num ::= MINUS INTEGER|FLOAT",
       150404  + /* 241 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
       150405  + /* 242 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
       150406  + /* 243 */ "trigger_time ::= BEFORE|AFTER",
       150407  + /* 244 */ "trigger_time ::= INSTEAD OF",
       150408  + /* 245 */ "trigger_time ::=",
       150409  + /* 246 */ "trigger_event ::= DELETE|INSERT",
       150410  + /* 247 */ "trigger_event ::= UPDATE",
       150411  + /* 248 */ "trigger_event ::= UPDATE OF idlist",
       150412  + /* 249 */ "when_clause ::=",
       150413  + /* 250 */ "when_clause ::= WHEN expr",
       150414  + /* 251 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
       150415  + /* 252 */ "trigger_cmd_list ::= trigger_cmd SEMI",
       150416  + /* 253 */ "trnm ::= nm DOT nm",
       150417  + /* 254 */ "tridxby ::= INDEXED BY nm",
       150418  + /* 255 */ "tridxby ::= NOT INDEXED",
       150419  + /* 256 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
       150420  + /* 257 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
       150421  + /* 258 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
       150422  + /* 259 */ "trigger_cmd ::= scanpt select scanpt",
       150423  + /* 260 */ "expr ::= RAISE LP IGNORE RP",
       150424  + /* 261 */ "expr ::= RAISE LP raisetype COMMA nm RP",
       150425  + /* 262 */ "raisetype ::= ROLLBACK",
       150426  + /* 263 */ "raisetype ::= ABORT",
       150427  + /* 264 */ "raisetype ::= FAIL",
       150428  + /* 265 */ "cmd ::= DROP TRIGGER ifexists fullname",
       150429  + /* 266 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
       150430  + /* 267 */ "cmd ::= DETACH database_kw_opt expr",
       150431  + /* 268 */ "key_opt ::=",
       150432  + /* 269 */ "key_opt ::= KEY expr",
       150433  + /* 270 */ "cmd ::= REINDEX",
       150434  + /* 271 */ "cmd ::= REINDEX nm dbnm",
       150435  + /* 272 */ "cmd ::= ANALYZE",
       150436  + /* 273 */ "cmd ::= ANALYZE nm dbnm",
       150437  + /* 274 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
       150438  + /* 275 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
       150439  + /* 276 */ "add_column_fullname ::= fullname",
       150440  + /* 277 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
       150441  + /* 278 */ "cmd ::= create_vtab",
       150442  + /* 279 */ "cmd ::= create_vtab LP vtabarglist RP",
       150443  + /* 280 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
       150444  + /* 281 */ "vtabarg ::=",
       150445  + /* 282 */ "vtabargtoken ::= ANY",
       150446  + /* 283 */ "vtabargtoken ::= lp anylist RP",
       150447  + /* 284 */ "lp ::= LP",
       150448  + /* 285 */ "with ::= WITH wqlist",
       150449  + /* 286 */ "with ::= WITH RECURSIVE wqlist",
       150450  + /* 287 */ "wqlist ::= nm eidlist_opt AS LP select RP",
       150451  + /* 288 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
       150452  + /* 289 */ "windowdefn_list ::= windowdefn",
       150453  + /* 290 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
       150454  + /* 291 */ "windowdefn ::= nm AS LP window RP",
       150455  + /* 292 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
       150456  + /* 293 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
       150457  + /* 294 */ "window ::= ORDER BY sortlist frame_opt",
       150458  + /* 295 */ "window ::= nm ORDER BY sortlist frame_opt",
       150459  + /* 296 */ "window ::= frame_opt",
       150460  + /* 297 */ "window ::= nm frame_opt",
       150461  + /* 298 */ "frame_opt ::=",
       150462  + /* 299 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
       150463  + /* 300 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
       150464  + /* 301 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
       150465  + /* 302 */ "frame_bound_s ::= frame_bound",
       150466  + /* 303 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
       150467  + /* 304 */ "frame_bound_e ::= frame_bound",
       150468  + /* 305 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
       150469  + /* 306 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
       150470  + /* 307 */ "frame_bound ::= CURRENT ROW",
       150471  + /* 308 */ "frame_exclude_opt ::=",
       150472  + /* 309 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
       150473  + /* 310 */ "frame_exclude ::= NO OTHERS",
       150474  + /* 311 */ "frame_exclude ::= CURRENT ROW",
       150475  + /* 312 */ "frame_exclude ::= GROUP|TIES",
       150476  + /* 313 */ "window_clause ::= WINDOW windowdefn_list",
       150477  + /* 314 */ "over_clause ::= filter_opt OVER LP window RP",
       150478  + /* 315 */ "over_clause ::= filter_opt OVER nm",
       150479  + /* 316 */ "filter_opt ::=",
       150480  + /* 317 */ "filter_opt ::= FILTER LP WHERE expr RP",
       150481  + /* 318 */ "input ::= cmdlist",
       150482  + /* 319 */ "cmdlist ::= cmdlist ecmd",
       150483  + /* 320 */ "cmdlist ::= ecmd",
       150484  + /* 321 */ "ecmd ::= SEMI",
       150485  + /* 322 */ "ecmd ::= cmdx SEMI",
       150486  + /* 323 */ "ecmd ::= explain cmdx",
       150487  + /* 324 */ "trans_opt ::=",
       150488  + /* 325 */ "trans_opt ::= TRANSACTION",
       150489  + /* 326 */ "trans_opt ::= TRANSACTION nm",
       150490  + /* 327 */ "savepoint_opt ::= SAVEPOINT",
       150491  + /* 328 */ "savepoint_opt ::=",
       150492  + /* 329 */ "cmd ::= create_table create_table_args",
       150493  + /* 330 */ "columnlist ::= columnlist COMMA columnname carglist",
       150494  + /* 331 */ "columnlist ::= columnname carglist",
       150495  + /* 332 */ "nm ::= ID|INDEXED",
       150496  + /* 333 */ "nm ::= STRING",
       150497  + /* 334 */ "nm ::= JOIN_KW",
       150498  + /* 335 */ "typetoken ::= typename",
       150499  + /* 336 */ "typename ::= ID|STRING",
       150500  + /* 337 */ "signed ::= plus_num",
       150501  + /* 338 */ "signed ::= minus_num",
       150502  + /* 339 */ "carglist ::= carglist ccons",
       150503  + /* 340 */ "carglist ::=",
       150504  + /* 341 */ "ccons ::= NULL onconf",
       150505  + /* 342 */ "conslist_opt ::= COMMA conslist",
       150506  + /* 343 */ "conslist ::= conslist tconscomma tcons",
       150507  + /* 344 */ "conslist ::= tcons",
       150508  + /* 345 */ "tconscomma ::=",
       150509  + /* 346 */ "defer_subclause_opt ::= defer_subclause",
       150510  + /* 347 */ "resolvetype ::= raisetype",
       150511  + /* 348 */ "selectnowith ::= oneselect",
       150512  + /* 349 */ "oneselect ::= values",
       150513  + /* 350 */ "sclp ::= selcollist COMMA",
       150514  + /* 351 */ "as ::= ID|STRING",
       150515  + /* 352 */ "expr ::= term",
       150516  + /* 353 */ "likeop ::= LIKE_KW|MATCH",
       150517  + /* 354 */ "exprlist ::= nexprlist",
       150518  + /* 355 */ "nmnum ::= plus_num",
       150519  + /* 356 */ "nmnum ::= nm",
       150520  + /* 357 */ "nmnum ::= ON",
       150521  + /* 358 */ "nmnum ::= DELETE",
       150522  + /* 359 */ "nmnum ::= DEFAULT",
       150523  + /* 360 */ "plus_num ::= INTEGER|FLOAT",
       150524  + /* 361 */ "foreach_clause ::=",
       150525  + /* 362 */ "foreach_clause ::= FOR EACH ROW",
       150526  + /* 363 */ "trnm ::= nm",
       150527  + /* 364 */ "tridxby ::=",
       150528  + /* 365 */ "database_kw_opt ::= DATABASE",
       150529  + /* 366 */ "database_kw_opt ::=",
       150530  + /* 367 */ "kwcolumn_opt ::=",
       150531  + /* 368 */ "kwcolumn_opt ::= COLUMNKW",
       150532  + /* 369 */ "vtabarglist ::= vtabarg",
       150533  + /* 370 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
       150534  + /* 371 */ "vtabarg ::= vtabarg vtabargtoken",
       150535  + /* 372 */ "anylist ::=",
       150536  + /* 373 */ "anylist ::= anylist LP anylist RP",
       150537  + /* 374 */ "anylist ::= anylist ANY",
       150538  + /* 375 */ "with ::=",
149963 150539   };
149964 150540   #endif /* NDEBUG */
149965 150541   
149966 150542   
149967 150543   #if YYSTACKDEPTH<=0
149968 150544   /*
149969 150545   ** Try to increase the size of the parser stack.  Return the number
................................................................................
150082 150658       **
150083 150659       ** Note: during a reduce, the only symbols destroyed are those
150084 150660       ** which appear on the RHS of the rule, but which are *not* used
150085 150661       ** inside the C code.
150086 150662       */
150087 150663   /********* Begin destructor definitions ***************************************/
150088 150664       case 195: /* select */
150089         -    case 227: /* selectnowith */
150090         -    case 228: /* oneselect */
150091         -    case 240: /* values */
150092         -{
150093         -sqlite3SelectDelete(pParse->db, (yypminor->yy457));
150094         -}
150095         -      break;
150096         -    case 205: /* term */
150097         -    case 206: /* expr */
150098         -    case 234: /* where_opt */
150099         -    case 236: /* having_opt */
150100         -    case 248: /* on_opt */
150101         -    case 263: /* case_operand */
150102         -    case 265: /* case_else */
150103         -    case 268: /* vinto */
150104         -    case 275: /* when_clause */
150105         -    case 280: /* key_opt */
150106         -    case 294: /* filter_opt */
150107         -{
150108         -sqlite3ExprDelete(pParse->db, (yypminor->yy524));
150109         -}
150110         -      break;
150111         -    case 210: /* eidlist_opt */
150112         -    case 219: /* sortlist */
150113         -    case 220: /* eidlist */
150114         -    case 232: /* selcollist */
150115         -    case 235: /* groupby_opt */
150116         -    case 237: /* orderby_opt */
150117         -    case 241: /* nexprlist */
150118         -    case 242: /* sclp */
150119         -    case 250: /* exprlist */
150120         -    case 254: /* setlist */
150121         -    case 262: /* paren_exprlist */
150122         -    case 264: /* case_exprlist */
150123         -    case 293: /* part_opt */
150124         -{
150125         -sqlite3ExprListDelete(pParse->db, (yypminor->yy434));
150126         -}
150127         -      break;
150128         -    case 226: /* fullname */
150129         -    case 233: /* from */
150130         -    case 244: /* seltablist */
150131         -    case 245: /* stl_prefix */
150132         -    case 251: /* xfullname */
150133         -{
150134         -sqlite3SrcListDelete(pParse->db, (yypminor->yy483));
150135         -}
150136         -      break;
150137         -    case 229: /* wqlist */
150138         -{
150139         -sqlite3WithDelete(pParse->db, (yypminor->yy59));
150140         -}
150141         -      break;
150142         -    case 239: /* window_clause */
150143         -    case 289: /* windowdefn_list */
150144         -{
150145         -sqlite3WindowListDelete(pParse->db, (yypminor->yy295));
150146         -}
150147         -      break;
150148         -    case 249: /* using_opt */
150149         -    case 252: /* idlist */
150150         -    case 256: /* idlist_opt */
150151         -{
150152         -sqlite3IdListDelete(pParse->db, (yypminor->yy62));
150153         -}
150154         -      break;
150155         -    case 258: /* over_clause */
150156         -    case 290: /* windowdefn */
150157         -    case 291: /* window */
150158         -    case 292: /* frame_opt */
150159         -{
150160         -sqlite3WindowDelete(pParse->db, (yypminor->yy295));
150161         -}
150162         -      break;
150163         -    case 271: /* trigger_cmd_list */
150164         -    case 276: /* trigger_cmd */
150165         -{
150166         -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy455));
150167         -}
150168         -      break;
150169         -    case 273: /* trigger_event */
150170         -{
150171         -sqlite3IdListDelete(pParse->db, (yypminor->yy90).b);
150172         -}
150173         -      break;
150174         -    case 296: /* frame_bound */
150175         -    case 297: /* frame_bound_s */
150176         -    case 298: /* frame_bound_e */
150177         -{
150178         -sqlite3ExprDelete(pParse->db, (yypminor->yy201).pExpr);
       150665  +    case 228: /* selectnowith */
       150666  +    case 229: /* oneselect */
       150667  +    case 241: /* values */
       150668  +{
       150669  +sqlite3SelectDelete(pParse->db, (yypminor->yy391));
       150670  +}
       150671  +      break;
       150672  +    case 206: /* term */
       150673  +    case 207: /* expr */
       150674  +    case 235: /* where_opt */
       150675  +    case 237: /* having_opt */
       150676  +    case 249: /* on_opt */
       150677  +    case 264: /* case_operand */
       150678  +    case 266: /* case_else */
       150679  +    case 269: /* vinto */
       150680  +    case 276: /* when_clause */
       150681  +    case 281: /* key_opt */
       150682  +    case 295: /* filter_opt */
       150683  +{
       150684  +sqlite3ExprDelete(pParse->db, (yypminor->yy102));
       150685  +}
       150686  +      break;
       150687  +    case 211: /* eidlist_opt */
       150688  +    case 220: /* sortlist */
       150689  +    case 221: /* eidlist */
       150690  +    case 233: /* selcollist */
       150691  +    case 236: /* groupby_opt */
       150692  +    case 238: /* orderby_opt */
       150693  +    case 242: /* nexprlist */
       150694  +    case 243: /* sclp */
       150695  +    case 251: /* exprlist */
       150696  +    case 255: /* setlist */
       150697  +    case 263: /* paren_exprlist */
       150698  +    case 265: /* case_exprlist */
       150699  +    case 294: /* part_opt */
       150700  +{
       150701  +sqlite3ExprListDelete(pParse->db, (yypminor->yy94));
       150702  +}
       150703  +      break;
       150704  +    case 227: /* fullname */
       150705  +    case 234: /* from */
       150706  +    case 245: /* seltablist */
       150707  +    case 246: /* stl_prefix */
       150708  +    case 252: /* xfullname */
       150709  +{
       150710  +sqlite3SrcListDelete(pParse->db, (yypminor->yy407));
       150711  +}
       150712  +      break;
       150713  +    case 230: /* wqlist */
       150714  +{
       150715  +sqlite3WithDelete(pParse->db, (yypminor->yy243));
       150716  +}
       150717  +      break;
       150718  +    case 240: /* window_clause */
       150719  +    case 290: /* windowdefn_list */
       150720  +{
       150721  +sqlite3WindowListDelete(pParse->db, (yypminor->yy379));
       150722  +}
       150723  +      break;
       150724  +    case 250: /* using_opt */
       150725  +    case 253: /* idlist */
       150726  +    case 257: /* idlist_opt */
       150727  +{
       150728  +sqlite3IdListDelete(pParse->db, (yypminor->yy76));
       150729  +}
       150730  +      break;
       150731  +    case 259: /* over_clause */
       150732  +    case 291: /* windowdefn */
       150733  +    case 292: /* window */
       150734  +    case 293: /* frame_opt */
       150735  +{
       150736  +sqlite3WindowDelete(pParse->db, (yypminor->yy379));
       150737  +}
       150738  +      break;
       150739  +    case 272: /* trigger_cmd_list */
       150740  +    case 277: /* trigger_cmd */
       150741  +{
       150742  +sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy11));
       150743  +}
       150744  +      break;
       150745  +    case 274: /* trigger_event */
       150746  +{
       150747  +sqlite3IdListDelete(pParse->db, (yypminor->yy298).b);
       150748  +}
       150749  +      break;
       150750  +    case 297: /* frame_bound */
       150751  +    case 298: /* frame_bound_s */
       150752  +    case 299: /* frame_bound_e */
       150753  +{
       150754  +sqlite3ExprDelete(pParse->db, (yypminor->yy389).pExpr);
150179 150755   }
150180 150756         break;
150181 150757   /********* End destructor definitions *****************************************/
150182 150758       default:  break;   /* If no destructor action specified: do nothing */
150183 150759     }
150184 150760   }
150185 150761   
................................................................................
150495 151071      194,  /* (22) table_options ::= WITHOUT nm */
150496 151072      196,  /* (23) columnname ::= nm typetoken */
150497 151073      198,  /* (24) typetoken ::= */
150498 151074      198,  /* (25) typetoken ::= typename LP signed RP */
150499 151075      198,  /* (26) typetoken ::= typename LP signed COMMA signed RP */
150500 151076      199,  /* (27) typename ::= typename ID|STRING */
150501 151077      203,  /* (28) scanpt ::= */
150502         -   204,  /* (29) ccons ::= CONSTRAINT nm */
150503         -   204,  /* (30) ccons ::= DEFAULT scanpt term scanpt */
150504         -   204,  /* (31) ccons ::= DEFAULT LP expr RP */
150505         -   204,  /* (32) ccons ::= DEFAULT PLUS term scanpt */
150506         -   204,  /* (33) ccons ::= DEFAULT MINUS term scanpt */
150507         -   204,  /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */
150508         -   204,  /* (35) ccons ::= NOT NULL onconf */
150509         -   204,  /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */
150510         -   204,  /* (37) ccons ::= UNIQUE onconf */
150511         -   204,  /* (38) ccons ::= CHECK LP expr RP */
150512         -   204,  /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */
150513         -   204,  /* (40) ccons ::= defer_subclause */
150514         -   204,  /* (41) ccons ::= COLLATE ID|STRING */
150515         -   209,  /* (42) autoinc ::= */
150516         -   209,  /* (43) autoinc ::= AUTOINCR */
150517         -   211,  /* (44) refargs ::= */
150518         -   211,  /* (45) refargs ::= refargs refarg */
150519         -   213,  /* (46) refarg ::= MATCH nm */
150520         -   213,  /* (47) refarg ::= ON INSERT refact */
150521         -   213,  /* (48) refarg ::= ON DELETE refact */
150522         -   213,  /* (49) refarg ::= ON UPDATE refact */
150523         -   214,  /* (50) refact ::= SET NULL */
150524         -   214,  /* (51) refact ::= SET DEFAULT */
150525         -   214,  /* (52) refact ::= CASCADE */
150526         -   214,  /* (53) refact ::= RESTRICT */
150527         -   214,  /* (54) refact ::= NO ACTION */
150528         -   212,  /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
150529         -   212,  /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
150530         -   215,  /* (57) init_deferred_pred_opt ::= */
150531         -   215,  /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */
150532         -   215,  /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
150533         -   193,  /* (60) conslist_opt ::= */
150534         -   217,  /* (61) tconscomma ::= COMMA */
150535         -   218,  /* (62) tcons ::= CONSTRAINT nm */
150536         -   218,  /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
150537         -   218,  /* (64) tcons ::= UNIQUE LP sortlist RP onconf */
150538         -   218,  /* (65) tcons ::= CHECK LP expr RP onconf */
150539         -   218,  /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
150540         -   221,  /* (67) defer_subclause_opt ::= */
150541         -   207,  /* (68) onconf ::= */
150542         -   207,  /* (69) onconf ::= ON CONFLICT resolvetype */
150543         -   222,  /* (70) orconf ::= */
150544         -   222,  /* (71) orconf ::= OR resolvetype */
150545         -   223,  /* (72) resolvetype ::= IGNORE */
150546         -   223,  /* (73) resolvetype ::= REPLACE */
150547         -   181,  /* (74) cmd ::= DROP TABLE ifexists fullname */
150548         -   225,  /* (75) ifexists ::= IF EXISTS */
150549         -   225,  /* (76) ifexists ::= */
150550         -   181,  /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
150551         -   181,  /* (78) cmd ::= DROP VIEW ifexists fullname */
150552         -   181,  /* (79) cmd ::= select */
150553         -   195,  /* (80) select ::= WITH wqlist selectnowith */
150554         -   195,  /* (81) select ::= WITH RECURSIVE wqlist selectnowith */
150555         -   195,  /* (82) select ::= selectnowith */
150556         -   227,  /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
150557         -   230,  /* (84) multiselect_op ::= UNION */
150558         -   230,  /* (85) multiselect_op ::= UNION ALL */
150559         -   230,  /* (86) multiselect_op ::= EXCEPT|INTERSECT */
150560         -   228,  /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
150561         -   228,  /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
150562         -   240,  /* (89) values ::= VALUES LP nexprlist RP */
150563         -   240,  /* (90) values ::= values COMMA LP nexprlist RP */
150564         -   231,  /* (91) distinct ::= DISTINCT */
150565         -   231,  /* (92) distinct ::= ALL */
150566         -   231,  /* (93) distinct ::= */
150567         -   242,  /* (94) sclp ::= */
150568         -   232,  /* (95) selcollist ::= sclp scanpt expr scanpt as */
150569         -   232,  /* (96) selcollist ::= sclp scanpt STAR */
150570         -   232,  /* (97) selcollist ::= sclp scanpt nm DOT STAR */
150571         -   243,  /* (98) as ::= AS nm */
150572         -   243,  /* (99) as ::= */
150573         -   233,  /* (100) from ::= */
150574         -   233,  /* (101) from ::= FROM seltablist */
150575         -   245,  /* (102) stl_prefix ::= seltablist joinop */
150576         -   245,  /* (103) stl_prefix ::= */
150577         -   244,  /* (104) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
150578         -   244,  /* (105) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
150579         -   244,  /* (106) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
150580         -   244,  /* (107) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
150581         -   191,  /* (108) dbnm ::= */
150582         -   191,  /* (109) dbnm ::= DOT nm */
150583         -   226,  /* (110) fullname ::= nm */
150584         -   226,  /* (111) fullname ::= nm DOT nm */
150585         -   251,  /* (112) xfullname ::= nm */
150586         -   251,  /* (113) xfullname ::= nm DOT nm */
150587         -   251,  /* (114) xfullname ::= nm DOT nm AS nm */
150588         -   251,  /* (115) xfullname ::= nm AS nm */
150589         -   246,  /* (116) joinop ::= COMMA|JOIN */
150590         -   246,  /* (117) joinop ::= JOIN_KW JOIN */
150591         -   246,  /* (118) joinop ::= JOIN_KW nm JOIN */
150592         -   246,  /* (119) joinop ::= JOIN_KW nm nm JOIN */
150593         -   248,  /* (120) on_opt ::= ON expr */
150594         -   248,  /* (121) on_opt ::= */
150595         -   247,  /* (122) indexed_opt ::= */
150596         -   247,  /* (123) indexed_opt ::= INDEXED BY nm */
150597         -   247,  /* (124) indexed_opt ::= NOT INDEXED */
150598         -   249,  /* (125) using_opt ::= USING LP idlist RP */
150599         -   249,  /* (126) using_opt ::= */
150600         -   237,  /* (127) orderby_opt ::= */
150601         -   237,  /* (128) orderby_opt ::= ORDER BY sortlist */
150602         -   219,  /* (129) sortlist ::= sortlist COMMA expr sortorder */
150603         -   219,  /* (130) sortlist ::= expr sortorder */
150604         -   208,  /* (131) sortorder ::= ASC */
150605         -   208,  /* (132) sortorder ::= DESC */
150606         -   208,  /* (133) sortorder ::= */
150607         -   235,  /* (134) groupby_opt ::= */
150608         -   235,  /* (135) groupby_opt ::= GROUP BY nexprlist */
150609         -   236,  /* (136) having_opt ::= */
150610         -   236,  /* (137) having_opt ::= HAVING expr */
150611         -   238,  /* (138) limit_opt ::= */
150612         -   238,  /* (139) limit_opt ::= LIMIT expr */
150613         -   238,  /* (140) limit_opt ::= LIMIT expr OFFSET expr */
150614         -   238,  /* (141) limit_opt ::= LIMIT expr COMMA expr */
150615         -   181,  /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
150616         -   234,  /* (143) where_opt ::= */
150617         -   234,  /* (144) where_opt ::= WHERE expr */
150618         -   181,  /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
150619         -   254,  /* (146) setlist ::= setlist COMMA nm EQ expr */
150620         -   254,  /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */
150621         -   254,  /* (148) setlist ::= nm EQ expr */
150622         -   254,  /* (149) setlist ::= LP idlist RP EQ expr */
150623         -   181,  /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
150624         -   181,  /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
150625         -   257,  /* (152) upsert ::= */
150626         -   257,  /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
150627         -   257,  /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
150628         -   257,  /* (155) upsert ::= ON CONFLICT DO NOTHING */
150629         -   255,  /* (156) insert_cmd ::= INSERT orconf */
150630         -   255,  /* (157) insert_cmd ::= REPLACE */
150631         -   256,  /* (158) idlist_opt ::= */
150632         -   256,  /* (159) idlist_opt ::= LP idlist RP */
150633         -   252,  /* (160) idlist ::= idlist COMMA nm */
150634         -   252,  /* (161) idlist ::= nm */
150635         -   206,  /* (162) expr ::= LP expr RP */
150636         -   206,  /* (163) expr ::= ID|INDEXED */
150637         -   206,  /* (164) expr ::= JOIN_KW */
150638         -   206,  /* (165) expr ::= nm DOT nm */
150639         -   206,  /* (166) expr ::= nm DOT nm DOT nm */
150640         -   205,  /* (167) term ::= NULL|FLOAT|BLOB */
150641         -   205,  /* (168) term ::= STRING */
150642         -   205,  /* (169) term ::= INTEGER */
150643         -   206,  /* (170) expr ::= VARIABLE */
150644         -   206,  /* (171) expr ::= expr COLLATE ID|STRING */
150645         -   206,  /* (172) expr ::= CAST LP expr AS typetoken RP */
150646         -   206,  /* (173) expr ::= ID|INDEXED LP distinct exprlist RP */
150647         -   206,  /* (174) expr ::= ID|INDEXED LP STAR RP */
150648         -   206,  /* (175) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
150649         -   206,  /* (176) expr ::= ID|INDEXED LP STAR RP over_clause */
150650         -   205,  /* (177) term ::= CTIME_KW */
150651         -   206,  /* (178) expr ::= LP nexprlist COMMA expr RP */
150652         -   206,  /* (179) expr ::= expr AND expr */
150653         -   206,  /* (180) expr ::= expr OR expr */
150654         -   206,  /* (181) expr ::= expr LT|GT|GE|LE expr */
150655         -   206,  /* (182) expr ::= expr EQ|NE expr */
150656         -   206,  /* (183) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
150657         -   206,  /* (184) expr ::= expr PLUS|MINUS expr */
150658         -   206,  /* (185) expr ::= expr STAR|SLASH|REM expr */
150659         -   206,  /* (186) expr ::= expr CONCAT expr */
150660         -   259,  /* (187) likeop ::= NOT LIKE_KW|MATCH */
150661         -   206,  /* (188) expr ::= expr likeop expr */
150662         -   206,  /* (189) expr ::= expr likeop expr ESCAPE expr */
150663         -   206,  /* (190) expr ::= expr ISNULL|NOTNULL */
150664         -   206,  /* (191) expr ::= expr NOT NULL */
150665         -   206,  /* (192) expr ::= expr IS expr */
150666         -   206,  /* (193) expr ::= expr IS NOT expr */
150667         -   206,  /* (194) expr ::= NOT expr */
150668         -   206,  /* (195) expr ::= BITNOT expr */
150669         -   206,  /* (196) expr ::= PLUS|MINUS expr */
150670         -   260,  /* (197) between_op ::= BETWEEN */
150671         -   260,  /* (198) between_op ::= NOT BETWEEN */
150672         -   206,  /* (199) expr ::= expr between_op expr AND expr */
150673         -   261,  /* (200) in_op ::= IN */
150674         -   261,  /* (201) in_op ::= NOT IN */
150675         -   206,  /* (202) expr ::= expr in_op LP exprlist RP */
150676         -   206,  /* (203) expr ::= LP select RP */
150677         -   206,  /* (204) expr ::= expr in_op LP select RP */
150678         -   206,  /* (205) expr ::= expr in_op nm dbnm paren_exprlist */
150679         -   206,  /* (206) expr ::= EXISTS LP select RP */
150680         -   206,  /* (207) expr ::= CASE case_operand case_exprlist case_else END */
150681         -   264,  /* (208) case_exprlist ::= case_exprlist WHEN expr THEN expr */
150682         -   264,  /* (209) case_exprlist ::= WHEN expr THEN expr */
150683         -   265,  /* (210) case_else ::= ELSE expr */
150684         -   265,  /* (211) case_else ::= */
150685         -   263,  /* (212) case_operand ::= expr */
150686         -   263,  /* (213) case_operand ::= */
150687         -   250,  /* (214) exprlist ::= */
150688         -   241,  /* (215) nexprlist ::= nexprlist COMMA expr */
150689         -   241,  /* (216) nexprlist ::= expr */
150690         -   262,  /* (217) paren_exprlist ::= */
150691         -   262,  /* (218) paren_exprlist ::= LP exprlist RP */
150692         -   181,  /* (219) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
150693         -   266,  /* (220) uniqueflag ::= UNIQUE */
150694         -   266,  /* (221) uniqueflag ::= */
150695         -   210,  /* (222) eidlist_opt ::= */
150696         -   210,  /* (223) eidlist_opt ::= LP eidlist RP */
150697         -   220,  /* (224) eidlist ::= eidlist COMMA nm collate sortorder */
150698         -   220,  /* (225) eidlist ::= nm collate sortorder */
150699         -   267,  /* (226) collate ::= */
150700         -   267,  /* (227) collate ::= COLLATE ID|STRING */
150701         -   181,  /* (228) cmd ::= DROP INDEX ifexists fullname */
150702         -   181,  /* (229) cmd ::= VACUUM vinto */
150703         -   181,  /* (230) cmd ::= VACUUM nm vinto */
150704         -   268,  /* (231) vinto ::= INTO expr */
150705         -   268,  /* (232) vinto ::= */
150706         -   181,  /* (233) cmd ::= PRAGMA nm dbnm */
150707         -   181,  /* (234) cmd ::= PRAGMA nm dbnm EQ nmnum */
150708         -   181,  /* (235) cmd ::= PRAGMA nm dbnm LP nmnum RP */
150709         -   181,  /* (236) cmd ::= PRAGMA nm dbnm EQ minus_num */
150710         -   181,  /* (237) cmd ::= PRAGMA nm dbnm LP minus_num RP */
150711         -   201,  /* (238) plus_num ::= PLUS INTEGER|FLOAT */
150712         -   202,  /* (239) minus_num ::= MINUS INTEGER|FLOAT */
150713         -   181,  /* (240) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
150714         -   270,  /* (241) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
150715         -   272,  /* (242) trigger_time ::= BEFORE|AFTER */
150716         -   272,  /* (243) trigger_time ::= INSTEAD OF */
150717         -   272,  /* (244) trigger_time ::= */
150718         -   273,  /* (245) trigger_event ::= DELETE|INSERT */
150719         -   273,  /* (246) trigger_event ::= UPDATE */
150720         -   273,  /* (247) trigger_event ::= UPDATE OF idlist */
150721         -   275,  /* (248) when_clause ::= */
150722         -   275,  /* (249) when_clause ::= WHEN expr */
150723         -   271,  /* (250) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
150724         -   271,  /* (251) trigger_cmd_list ::= trigger_cmd SEMI */
150725         -   277,  /* (252) trnm ::= nm DOT nm */
150726         -   278,  /* (253) tridxby ::= INDEXED BY nm */
150727         -   278,  /* (254) tridxby ::= NOT INDEXED */
150728         -   276,  /* (255) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
150729         -   276,  /* (256) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
150730         -   276,  /* (257) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
150731         -   276,  /* (258) trigger_cmd ::= scanpt select scanpt */
150732         -   206,  /* (259) expr ::= RAISE LP IGNORE RP */
150733         -   206,  /* (260) expr ::= RAISE LP raisetype COMMA nm RP */
150734         -   224,  /* (261) raisetype ::= ROLLBACK */
150735         -   224,  /* (262) raisetype ::= ABORT */
150736         -   224,  /* (263) raisetype ::= FAIL */
150737         -   181,  /* (264) cmd ::= DROP TRIGGER ifexists fullname */
150738         -   181,  /* (265) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
150739         -   181,  /* (266) cmd ::= DETACH database_kw_opt expr */
150740         -   280,  /* (267) key_opt ::= */
150741         -   280,  /* (268) key_opt ::= KEY expr */
150742         -   181,  /* (269) cmd ::= REINDEX */
150743         -   181,  /* (270) cmd ::= REINDEX nm dbnm */
150744         -   181,  /* (271) cmd ::= ANALYZE */
150745         -   181,  /* (272) cmd ::= ANALYZE nm dbnm */
150746         -   181,  /* (273) cmd ::= ALTER TABLE fullname RENAME TO nm */
150747         -   181,  /* (274) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
150748         -   281,  /* (275) add_column_fullname ::= fullname */
150749         -   181,  /* (276) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
150750         -   181,  /* (277) cmd ::= create_vtab */
150751         -   181,  /* (278) cmd ::= create_vtab LP vtabarglist RP */
150752         -   283,  /* (279) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
150753         -   285,  /* (280) vtabarg ::= */
150754         -   286,  /* (281) vtabargtoken ::= ANY */
150755         -   286,  /* (282) vtabargtoken ::= lp anylist RP */
150756         -   287,  /* (283) lp ::= LP */
150757         -   253,  /* (284) with ::= WITH wqlist */
150758         -   253,  /* (285) with ::= WITH RECURSIVE wqlist */
150759         -   229,  /* (286) wqlist ::= nm eidlist_opt AS LP select RP */
150760         -   229,  /* (287) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
150761         -   289,  /* (288) windowdefn_list ::= windowdefn */
150762         -   289,  /* (289) windowdefn_list ::= windowdefn_list COMMA windowdefn */
150763         -   290,  /* (290) windowdefn ::= nm AS LP window RP */
150764         -   291,  /* (291) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
150765         -   291,  /* (292) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
150766         -   291,  /* (293) window ::= ORDER BY sortlist frame_opt */
150767         -   291,  /* (294) window ::= nm ORDER BY sortlist frame_opt */
150768         -   291,  /* (295) window ::= frame_opt */
150769         -   291,  /* (296) window ::= nm frame_opt */
150770         -   292,  /* (297) frame_opt ::= */
150771         -   292,  /* (298) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
150772         -   292,  /* (299) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
150773         -   295,  /* (300) range_or_rows ::= RANGE|ROWS|GROUPS */
150774         -   297,  /* (301) frame_bound_s ::= frame_bound */
150775         -   297,  /* (302) frame_bound_s ::= UNBOUNDED PRECEDING */
150776         -   298,  /* (303) frame_bound_e ::= frame_bound */
150777         -   298,  /* (304) frame_bound_e ::= UNBOUNDED FOLLOWING */
150778         -   296,  /* (305) frame_bound ::= expr PRECEDING|FOLLOWING */
150779         -   296,  /* (306) frame_bound ::= CURRENT ROW */
150780         -   299,  /* (307) frame_exclude_opt ::= */
150781         -   299,  /* (308) frame_exclude_opt ::= EXCLUDE frame_exclude */
150782         -   300,  /* (309) frame_exclude ::= NO OTHERS */
150783         -   300,  /* (310) frame_exclude ::= CURRENT ROW */
150784         -   300,  /* (311) frame_exclude ::= GROUP|TIES */
150785         -   239,  /* (312) window_clause ::= WINDOW windowdefn_list */
150786         -   258,  /* (313) over_clause ::= filter_opt OVER LP window RP */
150787         -   258,  /* (314) over_clause ::= filter_opt OVER nm */
150788         -   294,  /* (315) filter_opt ::= */
150789         -   294,  /* (316) filter_opt ::= FILTER LP WHERE expr RP */
150790         -   176,  /* (317) input ::= cmdlist */
150791         -   177,  /* (318) cmdlist ::= cmdlist ecmd */
150792         -   177,  /* (319) cmdlist ::= ecmd */
150793         -   178,  /* (320) ecmd ::= SEMI */
150794         -   178,  /* (321) ecmd ::= cmdx SEMI */
150795         -   178,  /* (322) ecmd ::= explain cmdx */
150796         -   183,  /* (323) trans_opt ::= */
150797         -   183,  /* (324) trans_opt ::= TRANSACTION */
150798         -   183,  /* (325) trans_opt ::= TRANSACTION nm */
150799         -   185,  /* (326) savepoint_opt ::= SAVEPOINT */
150800         -   185,  /* (327) savepoint_opt ::= */
150801         -   181,  /* (328) cmd ::= create_table create_table_args */
150802         -   192,  /* (329) columnlist ::= columnlist COMMA columnname carglist */
150803         -   192,  /* (330) columnlist ::= columnname carglist */
150804         -   184,  /* (331) nm ::= ID|INDEXED */
150805         -   184,  /* (332) nm ::= STRING */
150806         -   184,  /* (333) nm ::= JOIN_KW */
150807         -   198,  /* (334) typetoken ::= typename */
150808         -   199,  /* (335) typename ::= ID|STRING */
150809         -   200,  /* (336) signed ::= plus_num */
150810         -   200,  /* (337) signed ::= minus_num */
150811         -   197,  /* (338) carglist ::= carglist ccons */
150812         -   197,  /* (339) carglist ::= */
150813         -   204,  /* (340) ccons ::= NULL onconf */
150814         -   193,  /* (341) conslist_opt ::= COMMA conslist */
150815         -   216,  /* (342) conslist ::= conslist tconscomma tcons */
150816         -   216,  /* (343) conslist ::= tcons */
150817         -   217,  /* (344) tconscomma ::= */
150818         -   221,  /* (345) defer_subclause_opt ::= defer_subclause */
150819         -   223,  /* (346) resolvetype ::= raisetype */
150820         -   227,  /* (347) selectnowith ::= oneselect */
150821         -   228,  /* (348) oneselect ::= values */
150822         -   242,  /* (349) sclp ::= selcollist COMMA */
150823         -   243,  /* (350) as ::= ID|STRING */
150824         -   206,  /* (351) expr ::= term */
150825         -   259,  /* (352) likeop ::= LIKE_KW|MATCH */
150826         -   250,  /* (353) exprlist ::= nexprlist */
150827         -   269,  /* (354) nmnum ::= plus_num */
150828         -   269,  /* (355) nmnum ::= nm */
150829         -   269,  /* (356) nmnum ::= ON */
150830         -   269,  /* (357) nmnum ::= DELETE */
150831         -   269,  /* (358) nmnum ::= DEFAULT */
150832         -   201,  /* (359) plus_num ::= INTEGER|FLOAT */
150833         -   274,  /* (360) foreach_clause ::= */
150834         -   274,  /* (361) foreach_clause ::= FOR EACH ROW */
150835         -   277,  /* (362) trnm ::= nm */
150836         -   278,  /* (363) tridxby ::= */
150837         -   279,  /* (364) database_kw_opt ::= DATABASE */
150838         -   279,  /* (365) database_kw_opt ::= */
150839         -   282,  /* (366) kwcolumn_opt ::= */
150840         -   282,  /* (367) kwcolumn_opt ::= COLUMNKW */
150841         -   284,  /* (368) vtabarglist ::= vtabarg */
150842         -   284,  /* (369) vtabarglist ::= vtabarglist COMMA vtabarg */
150843         -   285,  /* (370) vtabarg ::= vtabarg vtabargtoken */
150844         -   288,  /* (371) anylist ::= */
150845         -   288,  /* (372) anylist ::= anylist LP anylist RP */
150846         -   288,  /* (373) anylist ::= anylist ANY */
150847         -   253,  /* (374) with ::= */
       151078  +   204,  /* (29) scantok ::= */
       151079  +   205,  /* (30) ccons ::= CONSTRAINT nm */
       151080  +   205,  /* (31) ccons ::= DEFAULT scantok term */
       151081  +   205,  /* (32) ccons ::= DEFAULT LP expr RP */
       151082  +   205,  /* (33) ccons ::= DEFAULT PLUS scantok term */
       151083  +   205,  /* (34) ccons ::= DEFAULT MINUS scantok term */
       151084  +   205,  /* (35) ccons ::= DEFAULT scantok ID|INDEXED */
       151085  +   205,  /* (36) ccons ::= NOT NULL onconf */
       151086  +   205,  /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */
       151087  +   205,  /* (38) ccons ::= UNIQUE onconf */
       151088  +   205,  /* (39) ccons ::= CHECK LP expr RP */
       151089  +   205,  /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */
       151090  +   205,  /* (41) ccons ::= defer_subclause */
       151091  +   205,  /* (42) ccons ::= COLLATE ID|STRING */
       151092  +   210,  /* (43) autoinc ::= */
       151093  +   210,  /* (44) autoinc ::= AUTOINCR */
       151094  +   212,  /* (45) refargs ::= */
       151095  +   212,  /* (46) refargs ::= refargs refarg */
       151096  +   214,  /* (47) refarg ::= MATCH nm */
       151097  +   214,  /* (48) refarg ::= ON INSERT refact */
       151098  +   214,  /* (49) refarg ::= ON DELETE refact */
       151099  +   214,  /* (50) refarg ::= ON UPDATE refact */
       151100  +   215,  /* (51) refact ::= SET NULL */
       151101  +   215,  /* (52) refact ::= SET DEFAULT */
       151102  +   215,  /* (53) refact ::= CASCADE */
       151103  +   215,  /* (54) refact ::= RESTRICT */
       151104  +   215,  /* (55) refact ::= NO ACTION */
       151105  +   213,  /* (56) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
       151106  +   213,  /* (57) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
       151107  +   216,  /* (58) init_deferred_pred_opt ::= */
       151108  +   216,  /* (59) init_deferred_pred_opt ::= INITIALLY DEFERRED */
       151109  +   216,  /* (60) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
       151110  +   193,  /* (61) conslist_opt ::= */
       151111  +   218,  /* (62) tconscomma ::= COMMA */
       151112  +   219,  /* (63) tcons ::= CONSTRAINT nm */
       151113  +   219,  /* (64) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
       151114  +   219,  /* (65) tcons ::= UNIQUE LP sortlist RP onconf */
       151115  +   219,  /* (66) tcons ::= CHECK LP expr RP onconf */
       151116  +   219,  /* (67) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
       151117  +   222,  /* (68) defer_subclause_opt ::= */
       151118  +   208,  /* (69) onconf ::= */
       151119  +   208,  /* (70) onconf ::= ON CONFLICT resolvetype */
       151120  +   223,  /* (71) orconf ::= */
       151121  +   223,  /* (72) orconf ::= OR resolvetype */
       151122  +   224,  /* (73) resolvetype ::= IGNORE */
       151123  +   224,  /* (74) resolvetype ::= REPLACE */
       151124  +   181,  /* (75) cmd ::= DROP TABLE ifexists fullname */
       151125  +   226,  /* (76) ifexists ::= IF EXISTS */
       151126  +   226,  /* (77) ifexists ::= */
       151127  +   181,  /* (78) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
       151128  +   181,  /* (79) cmd ::= DROP VIEW ifexists fullname */
       151129  +   181,  /* (80) cmd ::= select */
       151130  +   195,  /* (81) select ::= WITH wqlist selectnowith */
       151131  +   195,  /* (82) select ::= WITH RECURSIVE wqlist selectnowith */
       151132  +   195,  /* (83) select ::= selectnowith */
       151133  +   228,  /* (84) selectnowith ::= selectnowith multiselect_op oneselect */
       151134  +   231,  /* (85) multiselect_op ::= UNION */
       151135  +   231,  /* (86) multiselect_op ::= UNION ALL */
       151136  +   231,  /* (87) multiselect_op ::= EXCEPT|INTERSECT */
       151137  +   229,  /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
       151138  +   229,  /* (89) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
       151139  +   241,  /* (90) values ::= VALUES LP nexprlist RP */
       151140  +   241,  /* (91) values ::= values COMMA LP nexprlist RP */
       151141  +   232,  /* (92) distinct ::= DISTINCT */
       151142  +   232,  /* (93) distinct ::= ALL */
       151143  +   232,  /* (94) distinct ::= */
       151144  +   243,  /* (95) sclp ::= */
       151145  +   233,  /* (96) selcollist ::= sclp scanpt expr scanpt as */
       151146  +   233,  /* (97) selcollist ::= sclp scanpt STAR */
       151147  +   233,  /* (98) selcollist ::= sclp scanpt nm DOT STAR */
       151148  +   244,  /* (99) as ::= AS nm */
       151149  +   244,  /* (100) as ::= */
       151150  +   234,  /* (101) from ::= */
       151151  +   234,  /* (102) from ::= FROM seltablist */
       151152  +   246,  /* (103) stl_prefix ::= seltablist joinop */
       151153  +   246,  /* (104) stl_prefix ::= */
       151154  +   245,  /* (105) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
       151155  +   245,  /* (106) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
       151156  +   245,  /* (107) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
       151157  +   245,  /* (108) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
       151158  +   191,  /* (109) dbnm ::= */
       151159  +   191,  /* (110) dbnm ::= DOT nm */
       151160  +   227,  /* (111) fullname ::= nm */
       151161  +   227,  /* (112) fullname ::= nm DOT nm */
       151162  +   252,  /* (113) xfullname ::= nm */
       151163  +   252,  /* (114) xfullname ::= nm DOT nm */
       151164  +   252,  /* (115) xfullname ::= nm DOT nm AS nm */
       151165  +   252,  /* (116) xfullname ::= nm AS nm */
       151166  +   247,  /* (117) joinop ::= COMMA|JOIN */
       151167  +   247,  /* (118) joinop ::= JOIN_KW JOIN */
       151168  +   247,  /* (119) joinop ::= JOIN_KW nm JOIN */
       151169  +   247,  /* (120) joinop ::= JOIN_KW nm nm JOIN */
       151170  +   249,  /* (121) on_opt ::= ON expr */
       151171  +   249,  /* (122) on_opt ::= */
       151172  +   248,  /* (123) indexed_opt ::= */
       151173  +   248,  /* (124) indexed_opt ::= INDEXED BY nm */
       151174  +   248,  /* (125) indexed_opt ::= NOT INDEXED */
       151175  +   250,  /* (126) using_opt ::= USING LP idlist RP */
       151176  +   250,  /* (127) using_opt ::= */
       151177  +   238,  /* (128) orderby_opt ::= */
       151178  +   238,  /* (129) orderby_opt ::= ORDER BY sortlist */
       151179  +   220,  /* (130) sortlist ::= sortlist COMMA expr sortorder */
       151180  +   220,  /* (131) sortlist ::= expr sortorder */
       151181  +   209,  /* (132) sortorder ::= ASC */
       151182  +   209,  /* (133) sortorder ::= DESC */
       151183  +   209,  /* (134) sortorder ::= */
       151184  +   236,  /* (135) groupby_opt ::= */
       151185  +   236,  /* (136) groupby_opt ::= GROUP BY nexprlist */
       151186  +   237,  /* (137) having_opt ::= */
       151187  +   237,  /* (138) having_opt ::= HAVING expr */
       151188  +   239,  /* (139) limit_opt ::= */
       151189  +   239,  /* (140) limit_opt ::= LIMIT expr */
       151190  +   239,  /* (141) limit_opt ::= LIMIT expr OFFSET expr */
       151191  +   239,  /* (142) limit_opt ::= LIMIT expr COMMA expr */
       151192  +   181,  /* (143) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
       151193  +   235,  /* (144) where_opt ::= */
       151194  +   235,  /* (145) where_opt ::= WHERE expr */
       151195  +   181,  /* (146) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
       151196  +   255,  /* (147) setlist ::= setlist COMMA nm EQ expr */
       151197  +   255,  /* (148) setlist ::= setlist COMMA LP idlist RP EQ expr */
       151198  +   255,  /* (149) setlist ::= nm EQ expr */
       151199  +   255,  /* (150) setlist ::= LP idlist RP EQ expr */
       151200  +   181,  /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
       151201  +   181,  /* (152) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
       151202  +   258,  /* (153) upsert ::= */
       151203  +   258,  /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
       151204  +   258,  /* (155) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
       151205  +   258,  /* (156) upsert ::= ON CONFLICT DO NOTHING */
       151206  +   256,  /* (157) insert_cmd ::= INSERT orconf */
       151207  +   256,  /* (158) insert_cmd ::= REPLACE */
       151208  +   257,  /* (159) idlist_opt ::= */
       151209  +   257,  /* (160) idlist_opt ::= LP idlist RP */
       151210  +   253,  /* (161) idlist ::= idlist COMMA nm */
       151211  +   253,  /* (162) idlist ::= nm */
       151212  +   207,  /* (163) expr ::= LP expr RP */
       151213  +   207,  /* (164) expr ::= ID|INDEXED */
       151214  +   207,  /* (165) expr ::= JOIN_KW */
       151215  +   207,  /* (166) expr ::= nm DOT nm */
       151216  +   207,  /* (167) expr ::= nm DOT nm DOT nm */
       151217  +   206,  /* (168) term ::= NULL|FLOAT|BLOB */
       151218  +   206,  /* (169) term ::= STRING */
       151219  +   206,  /* (170) term ::= INTEGER */
       151220  +   207,  /* (171) expr ::= VARIABLE */
       151221  +   207,  /* (172) expr ::= expr COLLATE ID|STRING */
       151222  +   207,  /* (173) expr ::= CAST LP expr AS typetoken RP */
       151223  +   207,  /* (174) expr ::= ID|INDEXED LP distinct exprlist RP */
       151224  +   207,  /* (175) expr ::= ID|INDEXED LP STAR RP */
       151225  +   207,  /* (176) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
       151226  +   207,  /* (177) expr ::= ID|INDEXED LP STAR RP over_clause */
       151227  +   206,  /* (178) term ::= CTIME_KW */
       151228  +   207,  /* (179) expr ::= LP nexprlist COMMA expr RP */
       151229  +   207,  /* (180) expr ::= expr AND expr */
       151230  +   207,  /* (181) expr ::= expr OR expr */
       151231  +   207,  /* (182) expr ::= expr LT|GT|GE|LE expr */
       151232  +   207,  /* (183) expr ::= expr EQ|NE expr */
       151233  +   207,  /* (184) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
       151234  +   207,  /* (185) expr ::= expr PLUS|MINUS expr */
       151235  +   207,  /* (186) expr ::= expr STAR|SLASH|REM expr */
       151236  +   207,  /* (187) expr ::= expr CONCAT expr */
       151237  +   260,  /* (188) likeop ::= NOT LIKE_KW|MATCH */
       151238  +   207,  /* (189) expr ::= expr likeop expr */
       151239  +   207,  /* (190) expr ::= expr likeop expr ESCAPE expr */
       151240  +   207,  /* (191) expr ::= expr ISNULL|NOTNULL */
       151241  +   207,  /* (192) expr ::= expr NOT NULL */
       151242  +   207,  /* (193) expr ::= expr IS expr */
       151243  +   207,  /* (194) expr ::= expr IS NOT expr */
       151244  +   207,  /* (195) expr ::= NOT expr */
       151245  +   207,  /* (196) expr ::= BITNOT expr */
       151246  +   207,  /* (197) expr ::= PLUS|MINUS expr */
       151247  +   261,  /* (198) between_op ::= BETWEEN */
       151248  +   261,  /* (199) between_op ::= NOT BETWEEN */
       151249  +   207,  /* (200) expr ::= expr between_op expr AND expr */
       151250  +   262,  /* (201) in_op ::= IN */
       151251  +   262,  /* (202) in_op ::= NOT IN */
       151252  +   207,  /* (203) expr ::= expr in_op LP exprlist RP */
       151253  +   207,  /* (204) expr ::= LP select RP */
       151254  +   207,  /* (205) expr ::= expr in_op LP select RP */
       151255  +   207,  /* (206) expr ::= expr in_op nm dbnm paren_exprlist */
       151256  +   207,  /* (207) expr ::= EXISTS LP select RP */
       151257  +   207,  /* (208) expr ::= CASE case_operand case_exprlist case_else END */
       151258  +   265,  /* (209) case_exprlist ::= case_exprlist WHEN expr THEN expr */
       151259  +   265,  /* (210) case_exprlist ::= WHEN expr THEN expr */
       151260  +   266,  /* (211) case_else ::= ELSE expr */
       151261  +   266,  /* (212) case_else ::= */
       151262  +   264,  /* (213) case_operand ::= expr */
       151263  +   264,  /* (214) case_operand ::= */
       151264  +   251,  /* (215) exprlist ::= */
       151265  +   242,  /* (216) nexprlist ::= nexprlist COMMA expr */
       151266  +   242,  /* (217) nexprlist ::= expr */
       151267  +   263,  /* (218) paren_exprlist ::= */
       151268  +   263,  /* (219) paren_exprlist ::= LP exprlist RP */
       151269  +   181,  /* (220) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
       151270  +   267,  /* (221) uniqueflag ::= UNIQUE */
       151271  +   267,  /* (222) uniqueflag ::= */
       151272  +   211,  /* (223) eidlist_opt ::= */
       151273  +   211,  /* (224) eidlist_opt ::= LP eidlist RP */
       151274  +   221,  /* (225) eidlist ::= eidlist COMMA nm collate sortorder */
       151275  +   221,  /* (226) eidlist ::= nm collate sortorder */
       151276  +   268,  /* (227) collate ::= */
       151277  +   268,  /* (228) collate ::= COLLATE ID|STRING */
       151278  +   181,  /* (229) cmd ::= DROP INDEX ifexists fullname */
       151279  +   181,  /* (230) cmd ::= VACUUM vinto */
       151280  +   181,  /* (231) cmd ::= VACUUM nm vinto */
       151281  +   269,  /* (232) vinto ::= INTO expr */
       151282  +   269,  /* (233) vinto ::= */
       151283  +   181,  /* (234) cmd ::= PRAGMA nm dbnm */
       151284  +   181,  /* (235) cmd ::= PRAGMA nm dbnm EQ nmnum */
       151285  +   181,  /* (236) cmd ::= PRAGMA nm dbnm LP nmnum RP */
       151286  +   181,  /* (237) cmd ::= PRAGMA nm dbnm EQ minus_num */
       151287  +   181,  /* (238) cmd ::= PRAGMA nm dbnm LP minus_num RP */
       151288  +   201,  /* (239) plus_num ::= PLUS INTEGER|FLOAT */
       151289  +   202,  /* (240) minus_num ::= MINUS INTEGER|FLOAT */
       151290  +   181,  /* (241) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
       151291  +   271,  /* (242) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
       151292  +   273,  /* (243) trigger_time ::= BEFORE|AFTER */
       151293  +   273,  /* (244) trigger_time ::= INSTEAD OF */
       151294  +   273,  /* (245) trigger_time ::= */
       151295  +   274,  /* (246) trigger_event ::= DELETE|INSERT */
       151296  +   274,  /* (247) trigger_event ::= UPDATE */
       151297  +   274,  /* (248) trigger_event ::= UPDATE OF idlist */
       151298  +   276,  /* (249) when_clause ::= */
       151299  +   276,  /* (250) when_clause ::= WHEN expr */
       151300  +   272,  /* (251) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
       151301  +   272,  /* (252) trigger_cmd_list ::= trigger_cmd SEMI */
       151302  +   278,  /* (253) trnm ::= nm DOT nm */
       151303  +   279,  /* (254) tridxby ::= INDEXED BY nm */
       151304  +   279,  /* (255) tridxby ::= NOT INDEXED */
       151305  +   277,  /* (256) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
       151306  +   277,  /* (257) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
       151307  +   277,  /* (258) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
       151308  +   277,  /* (259) trigger_cmd ::= scanpt select scanpt */
       151309  +   207,  /* (260) expr ::= RAISE LP IGNORE RP */
       151310  +   207,  /* (261) expr ::= RAISE LP raisetype COMMA nm RP */
       151311  +   225,  /* (262) raisetype ::= ROLLBACK */
       151312  +   225,  /* (263) raisetype ::= ABORT */
       151313  +   225,  /* (264) raisetype ::= FAIL */
       151314  +   181,  /* (265) cmd ::= DROP TRIGGER ifexists fullname */
       151315  +   181,  /* (266) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
       151316  +   181,  /* (267) cmd ::= DETACH database_kw_opt expr */
       151317  +   281,  /* (268) key_opt ::= */
       151318  +   281,  /* (269) key_opt ::= KEY expr */
       151319  +   181,  /* (270) cmd ::= REINDEX */
       151320  +   181,  /* (271) cmd ::= REINDEX nm dbnm */
       151321  +   181,  /* (272) cmd ::= ANALYZE */
       151322  +   181,  /* (273) cmd ::= ANALYZE nm dbnm */
       151323  +   181,  /* (274) cmd ::= ALTER TABLE fullname RENAME TO nm */
       151324  +   181,  /* (275) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
       151325  +   282,  /* (276) add_column_fullname ::= fullname */
       151326  +   181,  /* (277) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
       151327  +   181,  /* (278) cmd ::= create_vtab */
       151328  +   181,  /* (279) cmd ::= create_vtab LP vtabarglist RP */
       151329  +   284,  /* (280) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
       151330  +   286,  /* (281) vtabarg ::= */
       151331  +   287,  /* (282) vtabargtoken ::= ANY */
       151332  +   287,  /* (283) vtabargtoken ::= lp anylist RP */
       151333  +   288,  /* (284) lp ::= LP */
       151334  +   254,  /* (285) with ::= WITH wqlist */
       151335  +   254,  /* (286) with ::= WITH RECURSIVE wqlist */
       151336  +   230,  /* (287) wqlist ::= nm eidlist_opt AS LP select RP */
       151337  +   230,  /* (288) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
       151338  +   290,  /* (289) windowdefn_list ::= windowdefn */
       151339  +   290,  /* (290) windowdefn_list ::= windowdefn_list COMMA windowdefn */
       151340  +   291,  /* (291) windowdefn ::= nm AS LP window RP */
       151341  +   292,  /* (292) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
       151342  +   292,  /* (293) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
       151343  +   292,  /* (294) window ::= ORDER BY sortlist frame_opt */
       151344  +   292,  /* (295) window ::= nm ORDER BY sortlist frame_opt */
       151345  +   292,  /* (296) window ::= frame_opt */
       151346  +   292,  /* (297) window ::= nm frame_opt */
       151347  +   293,  /* (298) frame_opt ::= */
       151348  +   293,  /* (299) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
       151349  +   293,  /* (300) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
       151350  +   296,  /* (301) range_or_rows ::= RANGE|ROWS|GROUPS */
       151351  +   298,  /* (302) frame_bound_s ::= frame_bound */
       151352  +   298,  /* (303) frame_bound_s ::= UNBOUNDED PRECEDING */
       151353  +   299,  /* (304) frame_bound_e ::= frame_bound */
       151354  +   299,  /* (305) frame_bound_e ::= UNBOUNDED FOLLOWING */
       151355  +   297,  /* (306) frame_bound ::= expr PRECEDING|FOLLOWING */
       151356  +   297,  /* (307) frame_bound ::= CURRENT ROW */
       151357  +   300,  /* (308) frame_exclude_opt ::= */
       151358  +   300,  /* (309) frame_exclude_opt ::= EXCLUDE frame_exclude */
       151359  +   301,  /* (310) frame_exclude ::= NO OTHERS */
       151360  +   301,  /* (311) frame_exclude ::= CURRENT ROW */
       151361  +   301,  /* (312) frame_exclude ::= GROUP|TIES */
       151362  +   240,  /* (313) window_clause ::= WINDOW windowdefn_list */
       151363  +   259,  /* (314) over_clause ::= filter_opt OVER LP window RP */
       151364  +   259,  /* (315) over_clause ::= filter_opt OVER nm */
       151365  +   295,  /* (316) filter_opt ::= */
       151366  +   295,  /* (317) filter_opt ::= FILTER LP WHERE expr RP */
       151367  +   176,  /* (318) input ::= cmdlist */
       151368  +   177,  /* (319) cmdlist ::= cmdlist ecmd */
       151369  +   177,  /* (320) cmdlist ::= ecmd */
       151370  +   178,  /* (321) ecmd ::= SEMI */
       151371  +   178,  /* (322) ecmd ::= cmdx SEMI */
       151372  +   178,  /* (323) ecmd ::= explain cmdx */
       151373  +   183,  /* (324) trans_opt ::= */
       151374  +   183,  /* (325) trans_opt ::= TRANSACTION */
       151375  +   183,  /* (326) trans_opt ::= TRANSACTION nm */
       151376  +   185,  /* (327) savepoint_opt ::= SAVEPOINT */
       151377  +   185,  /* (328) savepoint_opt ::= */
       151378  +   181,  /* (329) cmd ::= create_table create_table_args */
       151379  +   192,  /* (330) columnlist ::= columnlist COMMA columnname carglist */
       151380  +   192,  /* (331) columnlist ::= columnname carglist */
       151381  +   184,  /* (332) nm ::= ID|INDEXED */
       151382  +   184,  /* (333) nm ::= STRING */
       151383  +   184,  /* (334) nm ::= JOIN_KW */
       151384  +   198,  /* (335) typetoken ::= typename */
       151385  +   199,  /* (336) typename ::= ID|STRING */
       151386  +   200,  /* (337) signed ::= plus_num */
       151387  +   200,  /* (338) signed ::= minus_num */
       151388  +   197,  /* (339) carglist ::= carglist ccons */
       151389  +   197,  /* (340) carglist ::= */
       151390  +   205,  /* (341) ccons ::= NULL onconf */
       151391  +   193,  /* (342) conslist_opt ::= COMMA conslist */
       151392  +   217,  /* (343) conslist ::= conslist tconscomma tcons */
       151393  +   217,  /* (344) conslist ::= tcons */
       151394  +   218,  /* (345) tconscomma ::= */
       151395  +   222,  /* (346) defer_subclause_opt ::= defer_subclause */
       151396  +   224,  /* (347) resolvetype ::= raisetype */
       151397  +   228,  /* (348) selectnowith ::= oneselect */
       151398  +   229,  /* (349) oneselect ::= values */
       151399  +   243,  /* (350) sclp ::= selcollist COMMA */
       151400  +   244,  /* (351) as ::= ID|STRING */
       151401  +   207,  /* (352) expr ::= term */
       151402  +   260,  /* (353) likeop ::= LIKE_KW|MATCH */
       151403  +   251,  /* (354) exprlist ::= nexprlist */
       151404  +   270,  /* (355) nmnum ::= plus_num */
       151405  +   270,  /* (356) nmnum ::= nm */
       151406  +   270,  /* (357) nmnum ::= ON */
       151407  +   270,  /* (358) nmnum ::= DELETE */
       151408  +   270,  /* (359) nmnum ::= DEFAULT */
       151409  +   201,  /* (360) plus_num ::= INTEGER|FLOAT */
       151410  +   275,  /* (361) foreach_clause ::= */
       151411  +   275,  /* (362) foreach_clause ::= FOR EACH ROW */
       151412  +   278,  /* (363) trnm ::= nm */
       151413  +   279,  /* (364) tridxby ::= */
       151414  +   280,  /* (365) database_kw_opt ::= DATABASE */
       151415  +   280,  /* (366) database_kw_opt ::= */
       151416  +   283,  /* (367) kwcolumn_opt ::= */
       151417  +   283,  /* (368) kwcolumn_opt ::= COLUMNKW */
       151418  +   285,  /* (369) vtabarglist ::= vtabarg */
       151419  +   285,  /* (370) vtabarglist ::= vtabarglist COMMA vtabarg */
       151420  +   286,  /* (371) vtabarg ::= vtabarg vtabargtoken */
       151421  +   289,  /* (372) anylist ::= */
       151422  +   289,  /* (373) anylist ::= anylist LP anylist RP */
       151423  +   289,  /* (374) anylist ::= anylist ANY */
       151424  +   254,  /* (375) with ::= */
150848 151425   };
150849 151426   
150850 151427   /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
150851 151428   ** of symbols on the right-hand side of that rule. */
150852 151429   static const signed char yyRuleInfoNRhs[] = {
150853 151430      -1,  /* (0) explain ::= EXPLAIN */
150854 151431      -3,  /* (1) explain ::= EXPLAIN QUERY PLAN */
................................................................................
150875 151452      -2,  /* (22) table_options ::= WITHOUT nm */
150876 151453      -2,  /* (23) columnname ::= nm typetoken */
150877 151454       0,  /* (24) typetoken ::= */
150878 151455      -4,  /* (25) typetoken ::= typename LP signed RP */
150879 151456      -6,  /* (26) typetoken ::= typename LP signed COMMA signed RP */
150880 151457      -2,  /* (27) typename ::= typename ID|STRING */
150881 151458       0,  /* (28) scanpt ::= */
150882         -   -2,  /* (29) ccons ::= CONSTRAINT nm */
150883         -   -4,  /* (30) ccons ::= DEFAULT scanpt term scanpt */
150884         -   -4,  /* (31) ccons ::= DEFAULT LP expr RP */
150885         -   -4,  /* (32) ccons ::= DEFAULT PLUS term scanpt */
150886         -   -4,  /* (33) ccons ::= DEFAULT MINUS term scanpt */
150887         -   -3,  /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */
150888         -   -3,  /* (35) ccons ::= NOT NULL onconf */
150889         -   -5,  /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */
150890         -   -2,  /* (37) ccons ::= UNIQUE onconf */
150891         -   -4,  /* (38) ccons ::= CHECK LP expr RP */
150892         -   -4,  /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */
150893         -   -1,  /* (40) ccons ::= defer_subclause */
150894         -   -2,  /* (41) ccons ::= COLLATE ID|STRING */
150895         -    0,  /* (42) autoinc ::= */
150896         -   -1,  /* (43) autoinc ::= AUTOINCR */
150897         -    0,  /* (44) refargs ::= */
150898         -   -2,  /* (45) refargs ::= refargs refarg */
150899         -   -2,  /* (46) refarg ::= MATCH nm */
150900         -   -3,  /* (47) refarg ::= ON INSERT refact */
150901         -   -3,  /* (48) refarg ::= ON DELETE refact */
150902         -   -3,  /* (49) refarg ::= ON UPDATE refact */
150903         -   -2,  /* (50) refact ::= SET NULL */
150904         -   -2,  /* (51) refact ::= SET DEFAULT */
150905         -   -1,  /* (52) refact ::= CASCADE */
150906         -   -1,  /* (53) refact ::= RESTRICT */
150907         -   -2,  /* (54) refact ::= NO ACTION */
150908         -   -3,  /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
150909         -   -2,  /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
150910         -    0,  /* (57) init_deferred_pred_opt ::= */
150911         -   -2,  /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */
150912         -   -2,  /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
150913         -    0,  /* (60) conslist_opt ::= */
150914         -   -1,  /* (61) tconscomma ::= COMMA */
150915         -   -2,  /* (62) tcons ::= CONSTRAINT nm */
150916         -   -7,  /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
150917         -   -5,  /* (64) tcons ::= UNIQUE LP sortlist RP onconf */
150918         -   -5,  /* (65) tcons ::= CHECK LP expr RP onconf */
150919         -  -10,  /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
150920         -    0,  /* (67) defer_subclause_opt ::= */
150921         -    0,  /* (68) onconf ::= */
150922         -   -3,  /* (69) onconf ::= ON CONFLICT resolvetype */
150923         -    0,  /* (70) orconf ::= */
150924         -   -2,  /* (71) orconf ::= OR resolvetype */
150925         -   -1,  /* (72) resolvetype ::= IGNORE */
150926         -   -1,  /* (73) resolvetype ::= REPLACE */
150927         -   -4,  /* (74) cmd ::= DROP TABLE ifexists fullname */
150928         -   -2,  /* (75) ifexists ::= IF EXISTS */
150929         -    0,  /* (76) ifexists ::= */
150930         -   -9,  /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
150931         -   -4,  /* (78) cmd ::= DROP VIEW ifexists fullname */
150932         -   -1,  /* (79) cmd ::= select */
150933         -   -3,  /* (80) select ::= WITH wqlist selectnowith */
150934         -   -4,  /* (81) select ::= WITH RECURSIVE wqlist selectnowith */
150935         -   -1,  /* (82) select ::= selectnowith */
150936         -   -3,  /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
150937         -   -1,  /* (84) multiselect_op ::= UNION */
150938         -   -2,  /* (85) multiselect_op ::= UNION ALL */
150939         -   -1,  /* (86) multiselect_op ::= EXCEPT|INTERSECT */
150940         -   -9,  /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
150941         -  -10,  /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
150942         -   -4,  /* (89) values ::= VALUES LP nexprlist RP */
150943         -   -5,  /* (90) values ::= values COMMA LP nexprlist RP */
150944         -   -1,  /* (91) distinct ::= DISTINCT */
150945         -   -1,  /* (92) distinct ::= ALL */
150946         -    0,  /* (93) distinct ::= */
150947         -    0,  /* (94) sclp ::= */
150948         -   -5,  /* (95) selcollist ::= sclp scanpt expr scanpt as */
150949         -   -3,  /* (96) selcollist ::= sclp scanpt STAR */
150950         -   -5,  /* (97) selcollist ::= sclp scanpt nm DOT STAR */
150951         -   -2,  /* (98) as ::= AS nm */
150952         -    0,  /* (99) as ::= */
150953         -    0,  /* (100) from ::= */
150954         -   -2,  /* (101) from ::= FROM seltablist */
150955         -   -2,  /* (102) stl_prefix ::= seltablist joinop */
150956         -    0,  /* (103) stl_prefix ::= */
150957         -   -7,  /* (104) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
150958         -   -9,  /* (105) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
150959         -   -7,  /* (106) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
150960         -   -7,  /* (107) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
150961         -    0,  /* (108) dbnm ::= */
150962         -   -2,  /* (109) dbnm ::= DOT nm */
150963         -   -1,  /* (110) fullname ::= nm */
150964         -   -3,  /* (111) fullname ::= nm DOT nm */
150965         -   -1,  /* (112) xfullname ::= nm */
150966         -   -3,  /* (113) xfullname ::= nm DOT nm */
150967         -   -5,  /* (114) xfullname ::= nm DOT nm AS nm */
150968         -   -3,  /* (115) xfullname ::= nm AS nm */
150969         -   -1,  /* (116) joinop ::= COMMA|JOIN */
150970         -   -2,  /* (117) joinop ::= JOIN_KW JOIN */
150971         -   -3,  /* (118) joinop ::= JOIN_KW nm JOIN */
150972         -   -4,  /* (119) joinop ::= JOIN_KW nm nm JOIN */
150973         -   -2,  /* (120) on_opt ::= ON expr */
150974         -    0,  /* (121) on_opt ::= */
150975         -    0,  /* (122) indexed_opt ::= */
150976         -   -3,  /* (123) indexed_opt ::= INDEXED BY nm */
150977         -   -2,  /* (124) indexed_opt ::= NOT INDEXED */
150978         -   -4,  /* (125) using_opt ::= USING LP idlist RP */
150979         -    0,  /* (126) using_opt ::= */
150980         -    0,  /* (127) orderby_opt ::= */
150981         -   -3,  /* (128) orderby_opt ::= ORDER BY sortlist */
150982         -   -4,  /* (129) sortlist ::= sortlist COMMA expr sortorder */
150983         -   -2,  /* (130) sortlist ::= expr sortorder */
150984         -   -1,  /* (131) sortorder ::= ASC */
150985         -   -1,  /* (132) sortorder ::= DESC */
150986         -    0,  /* (133) sortorder ::= */
150987         -    0,  /* (134) groupby_opt ::= */
150988         -   -3,  /* (135) groupby_opt ::= GROUP BY nexprlist */
150989         -    0,  /* (136) having_opt ::= */
150990         -   -2,  /* (137) having_opt ::= HAVING expr */
150991         -    0,  /* (138) limit_opt ::= */
150992         -   -2,  /* (139) limit_opt ::= LIMIT expr */
150993         -   -4,  /* (140) limit_opt ::= LIMIT expr OFFSET expr */
150994         -   -4,  /* (141) limit_opt ::= LIMIT expr COMMA expr */
150995         -   -6,  /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
150996         -    0,  /* (143) where_opt ::= */
150997         -   -2,  /* (144) where_opt ::= WHERE expr */
150998         -   -8,  /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
150999         -   -5,  /* (146) setlist ::= setlist COMMA nm EQ expr */
151000         -   -7,  /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */
151001         -   -3,  /* (148) setlist ::= nm EQ expr */
151002         -   -5,  /* (149) setlist ::= LP idlist RP EQ expr */
151003         -   -7,  /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
151004         -   -7,  /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
151005         -    0,  /* (152) upsert ::= */
151006         -  -11,  /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
151007         -   -8,  /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
151008         -   -4,  /* (155) upsert ::= ON CONFLICT DO NOTHING */
151009         -   -2,  /* (156) insert_cmd ::= INSERT orconf */
151010         -   -1,  /* (157) insert_cmd ::= REPLACE */
151011         -    0,  /* (158) idlist_opt ::= */
151012         -   -3,  /* (159) idlist_opt ::= LP idlist RP */
151013         -   -3,  /* (160) idlist ::= idlist COMMA nm */
151014         -   -1,  /* (161) idlist ::= nm */
151015         -   -3,  /* (162) expr ::= LP expr RP */
151016         -   -1,  /* (163) expr ::= ID|INDEXED */
151017         -   -1,  /* (164) expr ::= JOIN_KW */
151018         -   -3,  /* (165) expr ::= nm DOT nm */
151019         -   -5,  /* (166) expr ::= nm DOT nm DOT nm */
151020         -   -1,  /* (167) term ::= NULL|FLOAT|BLOB */
151021         -   -1,  /* (168) term ::= STRING */
151022         -   -1,  /* (169) term ::= INTEGER */
151023         -   -1,  /* (170) expr ::= VARIABLE */
151024         -   -3,  /* (171) expr ::= expr COLLATE ID|STRING */
151025         -   -6,  /* (172) expr ::= CAST LP expr AS typetoken RP */
151026         -   -5,  /* (173) expr ::= ID|INDEXED LP distinct exprlist RP */
151027         -   -4,  /* (174) expr ::= ID|INDEXED LP STAR RP */
151028         -   -6,  /* (175) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
151029         -   -5,  /* (176) expr ::= ID|INDEXED LP STAR RP over_clause */
151030         -   -1,  /* (177) term ::= CTIME_KW */
151031         -   -5,  /* (178) expr ::= LP nexprlist COMMA expr RP */
151032         -   -3,  /* (179) expr ::= expr AND expr */
151033         -   -3,  /* (180) expr ::= expr OR expr */
151034         -   -3,  /* (181) expr ::= expr LT|GT|GE|LE expr */
151035         -   -3,  /* (182) expr ::= expr EQ|NE expr */
151036         -   -3,  /* (183) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
151037         -   -3,  /* (184) expr ::= expr PLUS|MINUS expr */
151038         -   -3,  /* (185) expr ::= expr STAR|SLASH|REM expr */
151039         -   -3,  /* (186) expr ::= expr CONCAT expr */
151040         -   -2,  /* (187) likeop ::= NOT LIKE_KW|MATCH */
151041         -   -3,  /* (188) expr ::= expr likeop expr */
151042         -   -5,  /* (189) expr ::= expr likeop expr ESCAPE expr */
151043         -   -2,  /* (190) expr ::= expr ISNULL|NOTNULL */
151044         -   -3,  /* (191) expr ::= expr NOT NULL */
151045         -   -3,  /* (192) expr ::= expr IS expr */
151046         -   -4,  /* (193) expr ::= expr IS NOT expr */
151047         -   -2,  /* (194) expr ::= NOT expr */
151048         -   -2,  /* (195) expr ::= BITNOT expr */
151049         -   -2,  /* (196) expr ::= PLUS|MINUS expr */
151050         -   -1,  /* (197) between_op ::= BETWEEN */
151051         -   -2,  /* (198) between_op ::= NOT BETWEEN */
151052         -   -5,  /* (199) expr ::= expr between_op expr AND expr */
151053         -   -1,  /* (200) in_op ::= IN */
151054         -   -2,  /* (201) in_op ::= NOT IN */
151055         -   -5,  /* (202) expr ::= expr in_op LP exprlist RP */
151056         -   -3,  /* (203) expr ::= LP select RP */
151057         -   -5,  /* (204) expr ::= expr in_op LP select RP */
151058         -   -5,  /* (205) expr ::= expr in_op nm dbnm paren_exprlist */
151059         -   -4,  /* (206) expr ::= EXISTS LP select RP */
151060         -   -5,  /* (207) expr ::= CASE case_operand case_exprlist case_else END */
151061         -   -5,  /* (208) case_exprlist ::= case_exprlist WHEN expr THEN expr */
151062         -   -4,  /* (209) case_exprlist ::= WHEN expr THEN expr */
151063         -   -2,  /* (210) case_else ::= ELSE expr */
151064         -    0,  /* (211) case_else ::= */
151065         -   -1,  /* (212) case_operand ::= expr */
151066         -    0,  /* (213) case_operand ::= */
151067         -    0,  /* (214) exprlist ::= */
151068         -   -3,  /* (215) nexprlist ::= nexprlist COMMA expr */
151069         -   -1,  /* (216) nexprlist ::= expr */
151070         -    0,  /* (217) paren_exprlist ::= */
151071         -   -3,  /* (218) paren_exprlist ::= LP exprlist RP */
151072         -  -12,  /* (219) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
151073         -   -1,  /* (220) uniqueflag ::= UNIQUE */
151074         -    0,  /* (221) uniqueflag ::= */
151075         -    0,  /* (222) eidlist_opt ::= */
151076         -   -3,  /* (223) eidlist_opt ::= LP eidlist RP */
151077         -   -5,  /* (224) eidlist ::= eidlist COMMA nm collate sortorder */
151078         -   -3,  /* (225) eidlist ::= nm collate sortorder */
151079         -    0,  /* (226) collate ::= */
151080         -   -2,  /* (227) collate ::= COLLATE ID|STRING */
151081         -   -4,  /* (228) cmd ::= DROP INDEX ifexists fullname */
151082         -   -2,  /* (229) cmd ::= VACUUM vinto */
151083         -   -3,  /* (230) cmd ::= VACUUM nm vinto */
151084         -   -2,  /* (231) vinto ::= INTO expr */
151085         -    0,  /* (232) vinto ::= */
151086         -   -3,  /* (233) cmd ::= PRAGMA nm dbnm */
151087         -   -5,  /* (234) cmd ::= PRAGMA nm dbnm EQ nmnum */
151088         -   -6,  /* (235) cmd ::= PRAGMA nm dbnm LP nmnum RP */
151089         -   -5,  /* (236) cmd ::= PRAGMA nm dbnm EQ minus_num */
151090         -   -6,  /* (237) cmd ::= PRAGMA nm dbnm LP minus_num RP */
151091         -   -2,  /* (238) plus_num ::= PLUS INTEGER|FLOAT */
151092         -   -2,  /* (239) minus_num ::= MINUS INTEGER|FLOAT */
151093         -   -5,  /* (240) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
151094         -  -11,  /* (241) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
151095         -   -1,  /* (242) trigger_time ::= BEFORE|AFTER */
151096         -   -2,  /* (243) trigger_time ::= INSTEAD OF */
151097         -    0,  /* (244) trigger_time ::= */
151098         -   -1,  /* (245) trigger_event ::= DELETE|INSERT */
151099         -   -1,  /* (246) trigger_event ::= UPDATE */
151100         -   -3,  /* (247) trigger_event ::= UPDATE OF idlist */
151101         -    0,  /* (248) when_clause ::= */
151102         -   -2,  /* (249) when_clause ::= WHEN expr */
151103         -   -3,  /* (250) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
151104         -   -2,  /* (251) trigger_cmd_list ::= trigger_cmd SEMI */
151105         -   -3,  /* (252) trnm ::= nm DOT nm */
151106         -   -3,  /* (253) tridxby ::= INDEXED BY nm */
151107         -   -2,  /* (254) tridxby ::= NOT INDEXED */
151108         -   -8,  /* (255) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
151109         -   -8,  /* (256) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
151110         -   -6,  /* (257) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
151111         -   -3,  /* (258) trigger_cmd ::= scanpt select scanpt */
151112         -   -4,  /* (259) expr ::= RAISE LP IGNORE RP */
151113         -   -6,  /* (260) expr ::= RAISE LP raisetype COMMA nm RP */
151114         -   -1,  /* (261) raisetype ::= ROLLBACK */
151115         -   -1,  /* (262) raisetype ::= ABORT */
151116         -   -1,  /* (263) raisetype ::= FAIL */
151117         -   -4,  /* (264) cmd ::= DROP TRIGGER ifexists fullname */
151118         -   -6,  /* (265) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
151119         -   -3,  /* (266) cmd ::= DETACH database_kw_opt expr */
151120         -    0,  /* (267) key_opt ::= */
151121         -   -2,  /* (268) key_opt ::= KEY expr */
151122         -   -1,  /* (269) cmd ::= REINDEX */
151123         -   -3,  /* (270) cmd ::= REINDEX nm dbnm */
151124         -   -1,  /* (271) cmd ::= ANALYZE */
151125         -   -3,  /* (272) cmd ::= ANALYZE nm dbnm */
151126         -   -6,  /* (273) cmd ::= ALTER TABLE fullname RENAME TO nm */
151127         -   -7,  /* (274) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
151128         -   -1,  /* (275) add_column_fullname ::= fullname */
151129         -   -8,  /* (276) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
151130         -   -1,  /* (277) cmd ::= create_vtab */
151131         -   -4,  /* (278) cmd ::= create_vtab LP vtabarglist RP */
151132         -   -8,  /* (279) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
151133         -    0,  /* (280) vtabarg ::= */
151134         -   -1,  /* (281) vtabargtoken ::= ANY */
151135         -   -3,  /* (282) vtabargtoken ::= lp anylist RP */
151136         -   -1,  /* (283) lp ::= LP */
151137         -   -2,  /* (284) with ::= WITH wqlist */
151138         -   -3,  /* (285) with ::= WITH RECURSIVE wqlist */
151139         -   -6,  /* (286) wqlist ::= nm eidlist_opt AS LP select RP */
151140         -   -8,  /* (287) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
151141         -   -1,  /* (288) windowdefn_list ::= windowdefn */
151142         -   -3,  /* (289) windowdefn_list ::= windowdefn_list COMMA windowdefn */
151143         -   -5,  /* (290) windowdefn ::= nm AS LP window RP */
151144         -   -5,  /* (291) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
151145         -   -6,  /* (292) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
151146         -   -4,  /* (293) window ::= ORDER BY sortlist frame_opt */
151147         -   -5,  /* (294) window ::= nm ORDER BY sortlist frame_opt */
151148         -   -1,  /* (295) window ::= frame_opt */
151149         -   -2,  /* (296) window ::= nm frame_opt */
151150         -    0,  /* (297) frame_opt ::= */
151151         -   -3,  /* (298) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
151152         -   -6,  /* (299) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
151153         -   -1,  /* (300) range_or_rows ::= RANGE|ROWS|GROUPS */
151154         -   -1,  /* (301) frame_bound_s ::= frame_bound */
151155         -   -2,  /* (302) frame_bound_s ::= UNBOUNDED PRECEDING */
151156         -   -1,  /* (303) frame_bound_e ::= frame_bound */
151157         -   -2,  /* (304) frame_bound_e ::= UNBOUNDED FOLLOWING */
151158         -   -2,  /* (305) frame_bound ::= expr PRECEDING|FOLLOWING */
151159         -   -2,  /* (306) frame_bound ::= CURRENT ROW */
151160         -    0,  /* (307) frame_exclude_opt ::= */
151161         -   -2,  /* (308) frame_exclude_opt ::= EXCLUDE frame_exclude */
151162         -   -2,  /* (309) frame_exclude ::= NO OTHERS */
151163         -   -2,  /* (310) frame_exclude ::= CURRENT ROW */
151164         -   -1,  /* (311) frame_exclude ::= GROUP|TIES */
151165         -   -2,  /* (312) window_clause ::= WINDOW windowdefn_list */
151166         -   -5,  /* (313) over_clause ::= filter_opt OVER LP window RP */
151167         -   -3,  /* (314) over_clause ::= filter_opt OVER nm */
151168         -    0,  /* (315) filter_opt ::= */
151169         -   -5,  /* (316) filter_opt ::= FILTER LP WHERE expr RP */
151170         -   -1,  /* (317) input ::= cmdlist */
151171         -   -2,  /* (318) cmdlist ::= cmdlist ecmd */
151172         -   -1,  /* (319) cmdlist ::= ecmd */
151173         -   -1,  /* (320) ecmd ::= SEMI */
151174         -   -2,  /* (321) ecmd ::= cmdx SEMI */
151175         -   -2,  /* (322) ecmd ::= explain cmdx */
151176         -    0,  /* (323) trans_opt ::= */
151177         -   -1,  /* (324) trans_opt ::= TRANSACTION */
151178         -   -2,  /* (325) trans_opt ::= TRANSACTION nm */
151179         -   -1,  /* (326) savepoint_opt ::= SAVEPOINT */
151180         -    0,  /* (327) savepoint_opt ::= */
151181         -   -2,  /* (328) cmd ::= create_table create_table_args */
151182         -   -4,  /* (329) columnlist ::= columnlist COMMA columnname carglist */
151183         -   -2,  /* (330) columnlist ::= columnname carglist */
151184         -   -1,  /* (331) nm ::= ID|INDEXED */
151185         -   -1,  /* (332) nm ::= STRING */
151186         -   -1,  /* (333) nm ::= JOIN_KW */
151187         -   -1,  /* (334) typetoken ::= typename */
151188         -   -1,  /* (335) typename ::= ID|STRING */
151189         -   -1,  /* (336) signed ::= plus_num */
151190         -   -1,  /* (337) signed ::= minus_num */
151191         -   -2,  /* (338) carglist ::= carglist ccons */
151192         -    0,  /* (339) carglist ::= */
151193         -   -2,  /* (340) ccons ::= NULL onconf */
151194         -   -2,  /* (341) conslist_opt ::= COMMA conslist */
151195         -   -3,  /* (342) conslist ::= conslist tconscomma tcons */
151196         -   -1,  /* (343) conslist ::= tcons */
151197         -    0,  /* (344) tconscomma ::= */
151198         -   -1,  /* (345) defer_subclause_opt ::= defer_subclause */
151199         -   -1,  /* (346) resolvetype ::= raisetype */
151200         -   -1,  /* (347) selectnowith ::= oneselect */
151201         -   -1,  /* (348) oneselect ::= values */
151202         -   -2,  /* (349) sclp ::= selcollist COMMA */
151203         -   -1,  /* (350) as ::= ID|STRING */
151204         -   -1,  /* (351) expr ::= term */
151205         -   -1,  /* (352) likeop ::= LIKE_KW|MATCH */
151206         -   -1,  /* (353) exprlist ::= nexprlist */
151207         -   -1,  /* (354) nmnum ::= plus_num */
151208         -   -1,  /* (355) nmnum ::= nm */
151209         -   -1,  /* (356) nmnum ::= ON */
151210         -   -1,  /* (357) nmnum ::= DELETE */
151211         -   -1,  /* (358) nmnum ::= DEFAULT */
151212         -   -1,  /* (359) plus_num ::= INTEGER|FLOAT */
151213         -    0,  /* (360) foreach_clause ::= */
151214         -   -3,  /* (361) foreach_clause ::= FOR EACH ROW */
151215         -   -1,  /* (362) trnm ::= nm */
151216         -    0,  /* (363) tridxby ::= */
151217         -   -1,  /* (364) database_kw_opt ::= DATABASE */
151218         -    0,  /* (365) database_kw_opt ::= */
151219         -    0,  /* (366) kwcolumn_opt ::= */
151220         -   -1,  /* (367) kwcolumn_opt ::= COLUMNKW */
151221         -   -1,  /* (368) vtabarglist ::= vtabarg */
151222         -   -3,  /* (369) vtabarglist ::= vtabarglist COMMA vtabarg */
151223         -   -2,  /* (370) vtabarg ::= vtabarg vtabargtoken */
151224         -    0,  /* (371) anylist ::= */
151225         -   -4,  /* (372) anylist ::= anylist LP anylist RP */
151226         -   -2,  /* (373) anylist ::= anylist ANY */
151227         -    0,  /* (374) with ::= */
       151459  +    0,  /* (29) scantok ::= */
       151460  +   -2,  /* (30) ccons ::= CONSTRAINT nm */
       151461  +   -3,  /* (31) ccons ::= DEFAULT scantok term */
       151462  +   -4,  /* (32) ccons ::= DEFAULT LP expr RP */
       151463  +   -4,  /* (33) ccons ::= DEFAULT PLUS scantok term */
       151464  +   -4,  /* (34) ccons ::= DEFAULT MINUS scantok term */
       151465  +   -3,  /* (35) ccons ::= DEFAULT scantok ID|INDEXED */
       151466  +   -3,  /* (36) ccons ::= NOT NULL onconf */
       151467  +   -5,  /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */
       151468  +   -2,  /* (38) ccons ::= UNIQUE onconf */
       151469  +   -4,  /* (39) ccons ::= CHECK LP expr RP */
       151470  +   -4,  /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */
       151471  +   -1,  /* (41) ccons ::= defer_subclause */
       151472  +   -2,  /* (42) ccons ::= COLLATE ID|STRING */
       151473  +    0,  /* (43) autoinc ::= */
       151474  +   -1,  /* (44) autoinc ::= AUTOINCR */
       151475  +    0,  /* (45) refargs ::= */
       151476  +   -2,  /* (46) refargs ::= refargs refarg */
       151477  +   -2,  /* (47) refarg ::= MATCH nm */
       151478  +   -3,  /* (48) refarg ::= ON INSERT refact */
       151479  +   -3,  /* (49) refarg ::= ON DELETE refact */
       151480  +   -3,  /* (50) refarg ::= ON UPDATE refact */
       151481  +   -2,  /* (51) refact ::= SET NULL */
       151482  +   -2,  /* (52) refact ::= SET DEFAULT */
       151483  +   -1,  /* (53) refact ::= CASCADE */
       151484  +   -1,  /* (54) refact ::= RESTRICT */
       151485  +   -2,  /* (55) refact ::= NO ACTION */
       151486  +   -3,  /* (56) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
       151487  +   -2,  /* (57) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
       151488  +    0,  /* (58) init_deferred_pred_opt ::= */
       151489  +   -2,  /* (59) init_deferred_pred_opt ::= INITIALLY DEFERRED */
       151490  +   -2,  /* (60) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
       151491  +    0,  /* (61) conslist_opt ::= */
       151492  +   -1,  /* (62) tconscomma ::= COMMA */
       151493  +   -2,  /* (63) tcons ::= CONSTRAINT nm */
       151494  +   -7,  /* (64) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
       151495  +   -5,  /* (65) tcons ::= UNIQUE LP sortlist RP onconf */
       151496  +   -5,  /* (66) tcons ::= CHECK LP expr RP onconf */
       151497  +  -10,  /* (67) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
       151498  +    0,  /* (68) defer_subclause_opt ::= */
       151499  +    0,  /* (69) onconf ::= */
       151500  +   -3,  /* (70) onconf ::= ON CONFLICT resolvetype */
       151501  +    0,  /* (71) orconf ::= */
       151502  +   -2,  /* (72) orconf ::= OR resolvetype */
       151503  +   -1,  /* (73) resolvetype ::= IGNORE */
       151504  +   -1,  /* (74) resolvetype ::= REPLACE */
       151505  +   -4,  /* (75) cmd ::= DROP TABLE ifexists fullname */
       151506  +   -2,  /* (76) ifexists ::= IF EXISTS */
       151507  +    0,  /* (77) ifexists ::= */
       151508  +   -9,  /* (78) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
       151509  +   -4,  /* (79) cmd ::= DROP VIEW ifexists fullname */
       151510  +   -1,  /* (80) cmd ::= select */
       151511  +   -3,  /* (81) select ::= WITH wqlist selectnowith */
       151512  +   -4,  /* (82) select ::= WITH RECURSIVE wqlist selectnowith */
       151513  +   -1,  /* (83) select ::= selectnowith */
       151514  +   -3,  /* (84) selectnowith ::= selectnowith multiselect_op oneselect */
       151515  +   -1,  /* (85) multiselect_op ::= UNION */
       151516  +   -2,  /* (86) multiselect_op ::= UNION ALL */
       151517  +   -1,  /* (87) multiselect_op ::= EXCEPT|INTERSECT */
       151518  +   -9,  /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
       151519  +  -10,  /* (89) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
       151520  +   -4,  /* (90) values ::= VALUES LP nexprlist RP */
       151521  +   -5,  /* (91) values ::= values COMMA LP nexprlist RP */
       151522  +   -1,  /* (92) distinct ::= DISTINCT */
       151523  +   -1,  /* (93) distinct ::= ALL */
       151524  +    0,  /* (94) distinct ::= */
       151525  +    0,  /* (95) sclp ::= */
       151526  +   -5,  /* (96) selcollist ::= sclp scanpt expr scanpt as */
       151527  +   -3,  /* (97) selcollist ::= sclp scanpt STAR */
       151528  +   -5,  /* (98) selcollist ::= sclp scanpt nm DOT STAR */
       151529  +   -2,  /* (99) as ::= AS nm */
       151530  +    0,  /* (100) as ::= */
       151531  +    0,  /* (101) from ::= */
       151532  +   -2,  /* (102) from ::= FROM seltablist */
       151533  +   -2,  /* (103) stl_prefix ::= seltablist joinop */
       151534  +    0,  /* (104) stl_prefix ::= */
       151535  +   -7,  /* (105) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
       151536  +   -9,  /* (106) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
       151537  +   -7,  /* (107) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
       151538  +   -7,  /* (108) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
       151539  +    0,  /* (109) dbnm ::= */
       151540  +   -2,  /* (110) dbnm ::= DOT nm */
       151541  +   -1,  /* (111) fullname ::= nm */
       151542  +   -3,  /* (112) fullname ::= nm DOT nm */
       151543  +   -1,  /* (113) xfullname ::= nm */
       151544  +   -3,  /* (114) xfullname ::= nm DOT nm */
       151545  +   -5,  /* (115) xfullname ::= nm DOT nm AS nm */
       151546  +   -3,  /* (116) xfullname ::= nm AS nm */
       151547  +   -1,  /* (117) joinop ::= COMMA|JOIN */
       151548  +   -2,  /* (118) joinop ::= JOIN_KW JOIN */
       151549  +   -3,  /* (119) joinop ::= JOIN_KW nm JOIN */
       151550  +   -4,  /* (120) joinop ::= JOIN_KW nm nm JOIN */
       151551  +   -2,  /* (121) on_opt ::= ON expr */
       151552  +    0,  /* (122) on_opt ::= */
       151553  +    0,  /* (123) indexed_opt ::= */
       151554  +   -3,  /* (124) indexed_opt ::= INDEXED BY nm */
       151555  +   -2,  /* (125) indexed_opt ::= NOT INDEXED */
       151556  +   -4,  /* (126) using_opt ::= USING LP idlist RP */
       151557  +    0,  /* (127) using_opt ::= */
       151558  +    0,  /* (128) orderby_opt ::= */
       151559  +   -3,  /* (129) orderby_opt ::= ORDER BY sortlist */
       151560  +   -4,  /* (130) sortlist ::= sortlist COMMA expr sortorder */
       151561  +   -2,  /* (131) sortlist ::= expr sortorder */
       151562  +   -1,  /* (132) sortorder ::= ASC */
       151563  +   -1,  /* (133) sortorder ::= DESC */
       151564  +    0,  /* (134) sortorder ::= */
       151565  +    0,  /* (135) groupby_opt ::= */
       151566  +   -3,  /* (136) groupby_opt ::= GROUP BY nexprlist */
       151567  +    0,  /* (137) having_opt ::= */
       151568  +   -2,  /* (138) having_opt ::= HAVING expr */
       151569  +    0,  /* (139) limit_opt ::= */
       151570  +   -2,  /* (140) limit_opt ::= LIMIT expr */
       151571  +   -4,  /* (141) limit_opt ::= LIMIT expr OFFSET expr */
       151572  +   -4,  /* (142) limit_opt ::= LIMIT expr COMMA expr */
       151573  +   -6,  /* (143) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
       151574  +    0,  /* (144) where_opt ::= */
       151575  +   -2,  /* (145) where_opt ::= WHERE expr */
       151576  +   -8,  /* (146) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
       151577  +   -5,  /* (147) setlist ::= setlist COMMA nm EQ expr */
       151578  +   -7,  /* (148) setlist ::= setlist COMMA LP idlist RP EQ expr */
       151579  +   -3,  /* (149) setlist ::= nm EQ expr */
       151580  +   -5,  /* (150) setlist ::= LP idlist RP EQ expr */
       151581  +   -7,  /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
       151582  +   -7,  /* (152) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
       151583  +    0,  /* (153) upsert ::= */
       151584  +  -11,  /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
       151585  +   -8,  /* (155) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
       151586  +   -4,  /* (156) upsert ::= ON CONFLICT DO NOTHING */
       151587  +   -2,  /* (157) insert_cmd ::= INSERT orconf */
       151588  +   -1,  /* (158) insert_cmd ::= REPLACE */
       151589  +    0,  /* (159) idlist_opt ::= */
       151590  +   -3,  /* (160) idlist_opt ::= LP idlist RP */
       151591  +   -3,  /* (161) idlist ::= idlist COMMA nm */
       151592  +   -1,  /* (162) idlist ::= nm */
       151593  +   -3,  /* (163) expr ::= LP expr RP */
       151594  +   -1,  /* (164) expr ::= ID|INDEXED */
       151595  +   -1,  /* (165) expr ::= JOIN_KW */
       151596  +   -3,  /* (166) expr ::= nm DOT nm */
       151597  +   -5,  /* (167) expr ::= nm DOT nm DOT nm */
       151598  +   -1,  /* (168) term ::= NULL|FLOAT|BLOB */
       151599  +   -1,  /* (169) term ::= STRING */
       151600  +   -1,  /* (170) term ::= INTEGER */
       151601  +   -1,  /* (171) expr ::= VARIABLE */
       151602  +   -3,  /* (172) expr ::= expr COLLATE ID|STRING */
       151603  +   -6,  /* (173) expr ::= CAST LP expr AS typetoken RP */
       151604  +   -5,  /* (174) expr ::= ID|INDEXED LP distinct exprlist RP */
       151605  +   -4,  /* (175) expr ::= ID|INDEXED LP STAR RP */
       151606  +   -6,  /* (176) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
       151607  +   -5,  /* (177) expr ::= ID|INDEXED LP STAR RP over_clause */
       151608  +   -1,  /* (178) term ::= CTIME_KW */
       151609  +   -5,  /* (179) expr ::= LP nexprlist COMMA expr RP */
       151610  +   -3,  /* (180) expr ::= expr AND expr */
       151611  +   -3,  /* (181) expr ::= expr OR expr */
       151612  +   -3,  /* (182) expr ::= expr LT|GT|GE|LE expr */
       151613  +   -3,  /* (183) expr ::= expr EQ|NE expr */
       151614  +   -3,  /* (184) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
       151615  +   -3,  /* (185) expr ::= expr PLUS|MINUS expr */
       151616  +   -3,  /* (186) expr ::= expr STAR|SLASH|REM expr */
       151617  +   -3,  /* (187) expr ::= expr CONCAT expr */
       151618  +   -2,  /* (188) likeop ::= NOT LIKE_KW|MATCH */
       151619  +   -3,  /* (189) expr ::= expr likeop expr */
       151620  +   -5,  /* (190) expr ::= expr likeop expr ESCAPE expr */
       151621  +   -2,  /* (191) expr ::= expr ISNULL|NOTNULL */
       151622  +   -3,  /* (192) expr ::= expr NOT NULL */
       151623  +   -3,  /* (193) expr ::= expr IS expr */
       151624  +   -4,  /* (194) expr ::= expr IS NOT expr */
       151625  +   -2,  /* (195) expr ::= NOT expr */
       151626  +   -2,  /* (196) expr ::= BITNOT expr */
       151627  +   -2,  /* (197) expr ::= PLUS|MINUS expr */
       151628  +   -1,  /* (198) between_op ::= BETWEEN */
       151629  +   -2,  /* (199) between_op ::= NOT BETWEEN */
       151630  +   -5,  /* (200) expr ::= expr between_op expr AND expr */
       151631  +   -1,  /* (201) in_op ::= IN */
       151632  +   -2,  /* (202) in_op ::= NOT IN */
       151633  +   -5,  /* (203) expr ::= expr in_op LP exprlist RP */
       151634  +   -3,  /* (204) expr ::= LP select RP */
       151635  +   -5,  /* (205) expr ::= expr in_op LP select RP */
       151636  +   -5,  /* (206) expr ::= expr in_op nm dbnm paren_exprlist */
       151637  +   -4,  /* (207) expr ::= EXISTS LP select RP */
       151638  +   -5,  /* (208) expr ::= CASE case_operand case_exprlist case_else END */
       151639  +   -5,  /* (209) case_exprlist ::= case_exprlist WHEN expr THEN expr */
       151640  +   -4,  /* (210) case_exprlist ::= WHEN expr THEN expr */
       151641  +   -2,  /* (211) case_else ::= ELSE expr */
       151642  +    0,  /* (212) case_else ::= */
       151643  +   -1,  /* (213) case_operand ::= expr */
       151644  +    0,  /* (214) case_operand ::= */
       151645  +    0,  /* (215) exprlist ::= */
       151646  +   -3,  /* (216) nexprlist ::= nexprlist COMMA expr */
       151647  +   -1,  /* (217) nexprlist ::= expr */
       151648  +    0,  /* (218) paren_exprlist ::= */
       151649  +   -3,  /* (219) paren_exprlist ::= LP exprlist RP */
       151650  +  -12,  /* (220) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
       151651  +   -1,  /* (221) uniqueflag ::= UNIQUE */
       151652  +    0,  /* (222) uniqueflag ::= */
       151653  +    0,  /* (223) eidlist_opt ::= */
       151654  +   -3,  /* (224) eidlist_opt ::= LP eidlist RP */
       151655  +   -5,  /* (225) eidlist ::= eidlist COMMA nm collate sortorder */
       151656  +   -3,  /* (226) eidlist ::= nm collate sortorder */
       151657  +    0,  /* (227) collate ::= */
       151658  +   -2,  /* (228) collate ::= COLLATE ID|STRING */
       151659  +   -4,  /* (229) cmd ::= DROP INDEX ifexists fullname */
       151660  +   -2,  /* (230) cmd ::= VACUUM vinto */
       151661  +   -3,  /* (231) cmd ::= VACUUM nm vinto */
       151662  +   -2,  /* (232) vinto ::= INTO expr */
       151663  +    0,  /* (233) vinto ::= */
       151664  +   -3,  /* (234) cmd ::= PRAGMA nm dbnm */
       151665  +   -5,  /* (235) cmd ::= PRAGMA nm dbnm EQ nmnum */
       151666  +   -6,  /* (236) cmd ::= PRAGMA nm dbnm LP nmnum RP */
       151667  +   -5,  /* (237) cmd ::= PRAGMA nm dbnm EQ minus_num */
       151668  +   -6,  /* (238) cmd ::= PRAGMA nm dbnm LP minus_num RP */
       151669  +   -2,  /* (239) plus_num ::= PLUS INTEGER|FLOAT */
       151670  +   -2,  /* (240) minus_num ::= MINUS INTEGER|FLOAT */
       151671  +   -5,  /* (241) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
       151672  +  -11,  /* (242) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
       151673  +   -1,  /* (243) trigger_time ::= BEFORE|AFTER */
       151674  +   -2,  /* (244) trigger_time ::= INSTEAD OF */
       151675  +    0,  /* (245) trigger_time ::= */
       151676  +   -1,  /* (246) trigger_event ::= DELETE|INSERT */
       151677  +   -1,  /* (247) trigger_event ::= UPDATE */
       151678  +   -3,  /* (248) trigger_event ::= UPDATE OF idlist */
       151679  +    0,  /* (249) when_clause ::= */
       151680  +   -2,  /* (250) when_clause ::= WHEN expr */
       151681  +   -3,  /* (251) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
       151682  +   -2,  /* (252) trigger_cmd_list ::= trigger_cmd SEMI */
       151683  +   -3,  /* (253) trnm ::= nm DOT nm */
       151684  +   -3,  /* (254) tridxby ::= INDEXED BY nm */
       151685  +   -2,  /* (255) tridxby ::= NOT INDEXED */
       151686  +   -8,  /* (256) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
       151687  +   -8,  /* (257) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
       151688  +   -6,  /* (258) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
       151689  +   -3,  /* (259) trigger_cmd ::= scanpt select scanpt */
       151690  +   -4,  /* (260) expr ::= RAISE LP IGNORE RP */
       151691  +   -6,  /* (261) expr ::= RAISE LP raisetype COMMA nm RP */
       151692  +   -1,  /* (262) raisetype ::= ROLLBACK */
       151693  +   -1,  /* (263) raisetype ::= ABORT */
       151694  +   -1,  /* (264) raisetype ::= FAIL */
       151695  +   -4,  /* (265) cmd ::= DROP TRIGGER ifexists fullname */
       151696  +   -6,  /* (266) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
       151697  +   -3,  /* (267) cmd ::= DETACH database_kw_opt expr */
       151698  +    0,  /* (268) key_opt ::= */
       151699  +   -2,  /* (269) key_opt ::= KEY expr */
       151700  +   -1,  /* (270) cmd ::= REINDEX */
       151701  +   -3,  /* (271) cmd ::= REINDEX nm dbnm */
       151702  +   -1,  /* (272) cmd ::= ANALYZE */
       151703  +   -3,  /* (273) cmd ::= ANALYZE nm dbnm */
       151704  +   -6,  /* (274) cmd ::= ALTER TABLE fullname RENAME TO nm */
       151705  +   -7,  /* (275) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
       151706  +   -1,  /* (276) add_column_fullname ::= fullname */
       151707  +   -8,  /* (277) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
       151708  +   -1,  /* (278) cmd ::= create_vtab */
       151709  +   -4,  /* (279) cmd ::= create_vtab LP vtabarglist RP */
       151710  +   -8,  /* (280) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
       151711  +    0,  /* (281) vtabarg ::= */
       151712  +   -1,  /* (282) vtabargtoken ::= ANY */
       151713  +   -3,  /* (283) vtabargtoken ::= lp anylist RP */
       151714  +   -1,  /* (284) lp ::= LP */
       151715  +   -2,  /* (285) with ::= WITH wqlist */
       151716  +   -3,  /* (286) with ::= WITH RECURSIVE wqlist */
       151717  +   -6,  /* (287) wqlist ::= nm eidlist_opt AS LP select RP */
       151718  +   -8,  /* (288) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
       151719  +   -1,  /* (289) windowdefn_list ::= windowdefn */
       151720  +   -3,  /* (290) windowdefn_list ::= windowdefn_list COMMA windowdefn */
       151721  +   -5,  /* (291) windowdefn ::= nm AS LP window RP */
       151722  +   -5,  /* (292) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
       151723  +   -6,  /* (293) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
       151724  +   -4,  /* (294) window ::= ORDER BY sortlist frame_opt */
       151725  +   -5,  /* (295) window ::= nm ORDER BY sortlist frame_opt */
       151726  +   -1,  /* (296) window ::= frame_opt */
       151727  +   -2,  /* (297) window ::= nm frame_opt */
       151728  +    0,  /* (298) frame_opt ::= */
       151729  +   -3,  /* (299) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
       151730  +   -6,  /* (300) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
       151731  +   -1,  /* (301) range_or_rows ::= RANGE|ROWS|GROUPS */
       151732  +   -1,  /* (302) frame_bound_s ::= frame_bound */
       151733  +   -2,  /* (303) frame_bound_s ::= UNBOUNDED PRECEDING */
       151734  +   -1,  /* (304) frame_bound_e ::= frame_bound */
       151735  +   -2,  /* (305) frame_bound_e ::= UNBOUNDED FOLLOWING */
       151736  +   -2,  /* (306) frame_bound ::= expr PRECEDING|FOLLOWING */
       151737  +   -2,  /* (307) frame_bound ::= CURRENT ROW */
       151738  +    0,  /* (308) frame_exclude_opt ::= */
       151739  +   -2,  /* (309) frame_exclude_opt ::= EXCLUDE frame_exclude */
       151740  +   -2,  /* (310) frame_exclude ::= NO OTHERS */
       151741  +   -2,  /* (311) frame_exclude ::= CURRENT ROW */
       151742  +   -1,  /* (312) frame_exclude ::= GROUP|TIES */
       151743  +   -2,  /* (313) window_clause ::= WINDOW windowdefn_list */
       151744  +   -5,  /* (314) over_clause ::= filter_opt OVER LP window RP */
       151745  +   -3,  /* (315) over_clause ::= filter_opt OVER nm */
       151746  +    0,  /* (316) filter_opt ::= */
       151747  +   -5,  /* (317) filter_opt ::= FILTER LP WHERE expr RP */
       151748  +   -1,  /* (318) input ::= cmdlist */
       151749  +   -2,  /* (319) cmdlist ::= cmdlist ecmd */
       151750  +   -1,  /* (320) cmdlist ::= ecmd */
       151751  +   -1,  /* (321) ecmd ::= SEMI */
       151752  +   -2,  /* (322) ecmd ::= cmdx SEMI */
       151753  +   -2,  /* (323) ecmd ::= explain cmdx */
       151754  +    0,  /* (324) trans_opt ::= */
       151755  +   -1,  /* (325) trans_opt ::= TRANSACTION */
       151756  +   -2,  /* (326) trans_opt ::= TRANSACTION nm */
       151757  +   -1,  /* (327) savepoint_opt ::= SAVEPOINT */
       151758  +    0,  /* (328) savepoint_opt ::= */
       151759  +   -2,  /* (329) cmd ::= create_table create_table_args */
       151760  +   -4,  /* (330) columnlist ::= columnlist COMMA columnname carglist */
       151761  +   -2,  /* (331) columnlist ::= columnname carglist */
       151762  +   -1,  /* (332) nm ::= ID|INDEXED */
       151763  +   -1,  /* (333) nm ::= STRING */
       151764  +   -1,  /* (334) nm ::= JOIN_KW */
       151765  +   -1,  /* (335) typetoken ::= typename */
       151766  +   -1,  /* (336) typename ::= ID|STRING */
       151767  +   -1,  /* (337) signed ::= plus_num */
       151768  +   -1,  /* (338) signed ::= minus_num */
       151769  +   -2,  /* (339) carglist ::= carglist ccons */
       151770  +    0,  /* (340) carglist ::= */
       151771  +   -2,  /* (341) ccons ::= NULL onconf */
       151772  +   -2,  /* (342) conslist_opt ::= COMMA conslist */
       151773  +   -3,  /* (343) conslist ::= conslist tconscomma tcons */
       151774  +   -1,  /* (344) conslist ::= tcons */
       151775  +    0,  /* (345) tconscomma ::= */
       151776  +   -1,  /* (346) defer_subclause_opt ::= defer_subclause */
       151777  +   -1,  /* (347) resolvetype ::= raisetype */
       151778  +   -1,  /* (348) selectnowith ::= oneselect */
       151779  +   -1,  /* (349) oneselect ::= values */
       151780  +   -2,  /* (350) sclp ::= selcollist COMMA */
       151781  +   -1,  /* (351) as ::= ID|STRING */
       151782  +   -1,  /* (352) expr ::= term */
       151783  +   -1,  /* (353) likeop ::= LIKE_KW|MATCH */
       151784  +   -1,  /* (354) exprlist ::= nexprlist */
       151785  +   -1,  /* (355) nmnum ::= plus_num */
       151786  +   -1,  /* (356) nmnum ::= nm */
       151787  +   -1,  /* (357) nmnum ::= ON */
       151788  +   -1,  /* (358) nmnum ::= DELETE */
       151789  +   -1,  /* (359) nmnum ::= DEFAULT */
       151790  +   -1,  /* (360) plus_num ::= INTEGER|FLOAT */
       151791  +    0,  /* (361) foreach_clause ::= */
       151792  +   -3,  /* (362) foreach_clause ::= FOR EACH ROW */
       151793  +   -1,  /* (363) trnm ::= nm */
       151794  +    0,  /* (364) tridxby ::= */
       151795  +   -1,  /* (365) database_kw_opt ::= DATABASE */
       151796  +    0,  /* (366) database_kw_opt ::= */
       151797  +    0,  /* (367) kwcolumn_opt ::= */
       151798  +   -1,  /* (368) kwcolumn_opt ::= COLUMNKW */
       151799  +   -1,  /* (369) vtabarglist ::= vtabarg */
       151800  +   -3,  /* (370) vtabarglist ::= vtabarglist COMMA vtabarg */
       151801  +   -2,  /* (371) vtabarg ::= vtabarg vtabargtoken */
       151802  +    0,  /* (372) anylist ::= */
       151803  +   -4,  /* (373) anylist ::= anylist LP anylist RP */
       151804  +   -2,  /* (374) anylist ::= anylist ANY */
       151805  +    0,  /* (375) with ::= */
151228 151806   };
151229 151807   
151230 151808   static void yy_accept(yyParser*);  /* Forward Declaration */
151231 151809   
151232 151810   /*
151233 151811   ** Perform a reduce action and the shift that must immediately
151234 151812   ** follow the reduce.
................................................................................
151317 151895         case 1: /* explain ::= EXPLAIN QUERY PLAN */
151318 151896   { pParse->explain = 2; }
151319 151897           break;
151320 151898         case 2: /* cmdx ::= cmd */
151321 151899   { sqlite3FinishCoding(pParse); }
151322 151900           break;
151323 151901         case 3: /* cmd ::= BEGIN transtype trans_opt */
151324         -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy494);}
       151902  +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy100);}
151325 151903           break;
151326 151904         case 4: /* transtype ::= */
151327         -{yymsp[1].minor.yy494 = TK_DEFERRED;}
       151905  +{yymsp[1].minor.yy100 = TK_DEFERRED;}
151328 151906           break;
151329 151907         case 5: /* transtype ::= DEFERRED */
151330 151908         case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
151331 151909         case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
151332         -      case 300: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==300);
151333         -{yymsp[0].minor.yy494 = yymsp[0].major; /*A-overwrites-X*/}
       151910  +      case 301: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==301);
       151911  +{yymsp[0].minor.yy100 = yymsp[0].major; /*A-overwrites-X*/}
151334 151912           break;
151335 151913         case 8: /* cmd ::= COMMIT|END trans_opt */
151336 151914         case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
151337 151915   {sqlite3EndTransaction(pParse,yymsp[-1].major);}
151338 151916           break;
151339 151917         case 10: /* cmd ::= SAVEPOINT nm */
151340 151918   {
................................................................................
151349 151927         case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
151350 151928   {
151351 151929     sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
151352 151930   }
151353 151931           break;
151354 151932         case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
151355 151933   {
151356         -   sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy494,0,0,yymsp[-2].minor.yy494);
       151934  +   sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy100,0,0,yymsp[-2].minor.yy100);
151357 151935   }
151358 151936           break;
151359 151937         case 14: /* createkw ::= CREATE */
151360 151938   {disableLookaside(pParse);}
151361 151939           break;
151362 151940         case 15: /* ifnotexists ::= */
151363 151941         case 18: /* temp ::= */ yytestcase(yyruleno==18);
151364 151942         case 21: /* table_options ::= */ yytestcase(yyruleno==21);
151365         -      case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
151366         -      case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
151367         -      case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
151368         -      case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
151369         -      case 93: /* distinct ::= */ yytestcase(yyruleno==93);
151370         -      case 226: /* collate ::= */ yytestcase(yyruleno==226);
151371         -{yymsp[1].minor.yy494 = 0;}
       151943  +      case 43: /* autoinc ::= */ yytestcase(yyruleno==43);
       151944  +      case 58: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==58);
       151945  +      case 68: /* defer_subclause_opt ::= */ yytestcase(yyruleno==68);
       151946  +      case 77: /* ifexists ::= */ yytestcase(yyruleno==77);
       151947  +      case 94: /* distinct ::= */ yytestcase(yyruleno==94);
       151948  +      case 227: /* collate ::= */ yytestcase(yyruleno==227);
       151949  +{yymsp[1].minor.yy100 = 0;}
151372 151950           break;
151373 151951         case 16: /* ifnotexists ::= IF NOT EXISTS */
151374         -{yymsp[-2].minor.yy494 = 1;}
       151952  +{yymsp[-2].minor.yy100 = 1;}
151375 151953           break;
151376 151954         case 17: /* temp ::= TEMP */
151377         -      case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43);
151378         -{yymsp[0].minor.yy494 = 1;}
       151955  +      case 44: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==44);
       151956  +{yymsp[0].minor.yy100 = 1;}
151379 151957           break;
151380 151958         case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
151381 151959   {
151382         -  sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy494,0);
       151960  +  sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy100,0);
151383 151961   }
151384 151962           break;
151385 151963         case 20: /* create_table_args ::= AS select */
151386 151964   {
151387         -  sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy457);
151388         -  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy457);
       151965  +  sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy391);
       151966  +  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy391);
151389 151967   }
151390 151968           break;
151391 151969         case 22: /* table_options ::= WITHOUT nm */
151392 151970   {
151393 151971     if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
151394         -    yymsp[-1].minor.yy494 = TF_WithoutRowid | TF_NoVisibleRowid;
       151972  +    yymsp[-1].minor.yy100 = TF_WithoutRowid | TF_NoVisibleRowid;
151395 151973     }else{
151396         -    yymsp[-1].minor.yy494 = 0;
       151974  +    yymsp[-1].minor.yy100 = 0;
151397 151975       sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
151398 151976     }
151399 151977   }
151400 151978           break;
151401 151979         case 23: /* columnname ::= nm typetoken */
151402 151980   {sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
151403 151981           break;
151404 151982         case 24: /* typetoken ::= */
151405         -      case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60);
151406         -      case 99: /* as ::= */ yytestcase(yyruleno==99);
       151983  +      case 61: /* conslist_opt ::= */ yytestcase(yyruleno==61);
       151984  +      case 100: /* as ::= */ yytestcase(yyruleno==100);
151407 151985   {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
151408 151986           break;
151409 151987         case 25: /* typetoken ::= typename LP signed RP */
151410 151988   {
151411 151989     yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
151412 151990   }
151413 151991           break;
................................................................................
151418 151996           break;
151419 151997         case 27: /* typename ::= typename ID|STRING */
151420 151998   {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
151421 151999           break;
151422 152000         case 28: /* scanpt ::= */
151423 152001   {
151424 152002     assert( yyLookahead!=YYNOCODE );
151425         -  yymsp[1].minor.yy294 = yyLookaheadToken.z;
       152003  +  yymsp[1].minor.yy528 = yyLookaheadToken.z;
151426 152004   }
151427 152005           break;
151428         -      case 29: /* ccons ::= CONSTRAINT nm */
151429         -      case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62);
       152006  +      case 29: /* scantok ::= */
       152007  +{
       152008  +  assert( yyLookahead!=YYNOCODE );
       152009  +  yymsp[1].minor.yy0 = yyLookaheadToken;
       152010  +}
       152011  +        break;
       152012  +      case 30: /* ccons ::= CONSTRAINT nm */
       152013  +      case 63: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==63);
151430 152014   {pParse->constraintName = yymsp[0].minor.yy0;}
151431 152015           break;
151432         -      case 30: /* ccons ::= DEFAULT scanpt term scanpt */
151433         -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy524,yymsp[-2].minor.yy294,yymsp[0].minor.yy294);}
       152016  +      case 31: /* ccons ::= DEFAULT scantok term */
       152017  +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy102,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
151434 152018           break;
151435         -      case 31: /* ccons ::= DEFAULT LP expr RP */
151436         -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy524,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
       152019  +      case 32: /* ccons ::= DEFAULT LP expr RP */
       152020  +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy102,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
151437 152021           break;
151438         -      case 32: /* ccons ::= DEFAULT PLUS term scanpt */
151439         -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy524,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy294);}
       152022  +      case 33: /* ccons ::= DEFAULT PLUS scantok term */
       152023  +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy102,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
151440 152024           break;
151441         -      case 33: /* ccons ::= DEFAULT MINUS term scanpt */
       152025  +      case 34: /* ccons ::= DEFAULT MINUS scantok term */
151442 152026   {
151443         -  Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[-1].minor.yy524, 0);
151444         -  sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy294);
       152027  +  Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy102, 0);
       152028  +  sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
151445 152029   }
151446 152030           break;
151447         -      case 34: /* ccons ::= DEFAULT scanpt ID|INDEXED */
       152031  +      case 35: /* ccons ::= DEFAULT scantok ID|INDEXED */
151448 152032   {
151449 152033     Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0);
151450 152034     if( p ){
151451 152035       sqlite3ExprIdToTrueFalse(p);
151452 152036       testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) );
151453 152037     }
151454 152038       sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
151455 152039   }
151456 152040           break;
151457         -      case 35: /* ccons ::= NOT NULL onconf */
151458         -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy494);}
       152041  +      case 36: /* ccons ::= NOT NULL onconf */
       152042  +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy100);}
151459 152043           break;
151460         -      case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
151461         -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy494,yymsp[0].minor.yy494,yymsp[-2].minor.yy494);}
       152044  +      case 37: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
       152045  +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy100,yymsp[0].minor.yy100,yymsp[-2].minor.yy100);}
151462 152046           break;
151463         -      case 37: /* ccons ::= UNIQUE onconf */
151464         -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy494,0,0,0,0,
       152047  +      case 38: /* ccons ::= UNIQUE onconf */
       152048  +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy100,0,0,0,0,
151465 152049                                      SQLITE_IDXTYPE_UNIQUE);}
151466 152050           break;
151467         -      case 38: /* ccons ::= CHECK LP expr RP */
151468         -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy524);}
       152051  +      case 39: /* ccons ::= CHECK LP expr RP */
       152052  +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy102);}
151469 152053           break;
151470         -      case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */
151471         -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy434,yymsp[0].minor.yy494);}
       152054  +      case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */
       152055  +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy94,yymsp[0].minor.yy100);}
151472 152056           break;
151473         -      case 40: /* ccons ::= defer_subclause */
151474         -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy494);}
       152057  +      case 41: /* ccons ::= defer_subclause */
       152058  +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy100);}
151475 152059           break;
151476         -      case 41: /* ccons ::= COLLATE ID|STRING */
       152060  +      case 42: /* ccons ::= COLLATE ID|STRING */
151477 152061   {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
151478 152062           break;
151479         -      case 44: /* refargs ::= */
151480         -{ yymsp[1].minor.yy494 = OE_None*0x0101; /* EV: R-19803-45884 */}
151481         -        break;
151482         -      case 45: /* refargs ::= refargs refarg */
151483         -{ yymsp[-1].minor.yy494 = (yymsp[-1].minor.yy494 & ~yymsp[0].minor.yy355.mask) | yymsp[0].minor.yy355.value; }
151484         -        break;
151485         -      case 46: /* refarg ::= MATCH nm */
151486         -{ yymsp[-1].minor.yy355.value = 0;     yymsp[-1].minor.yy355.mask = 0x000000; }
151487         -        break;
151488         -      case 47: /* refarg ::= ON INSERT refact */
151489         -{ yymsp[-2].minor.yy355.value = 0;     yymsp[-2].minor.yy355.mask = 0x000000; }
151490         -        break;
151491         -      case 48: /* refarg ::= ON DELETE refact */
151492         -{ yymsp[-2].minor.yy355.value = yymsp[0].minor.yy494;     yymsp[-2].minor.yy355.mask = 0x0000ff; }
151493         -        break;
151494         -      case 49: /* refarg ::= ON UPDATE refact */
151495         -{ yymsp[-2].minor.yy355.value = yymsp[0].minor.yy494<<8;  yymsp[-2].minor.yy355.mask = 0x00ff00; }
151496         -        break;
151497         -      case 50: /* refact ::= SET NULL */
151498         -{ yymsp[-1].minor.yy494 = OE_SetNull;  /* EV: R-33326-45252 */}
151499         -        break;
151500         -      case 51: /* refact ::= SET DEFAULT */
151501         -{ yymsp[-1].minor.yy494 = OE_SetDflt;  /* EV: R-33326-45252 */}
151502         -        break;
151503         -      case 52: /* refact ::= CASCADE */
151504         -{ yymsp[0].minor.yy494 = OE_Cascade;  /* EV: R-33326-45252 */}
151505         -        break;
151506         -      case 53: /* refact ::= RESTRICT */
151507         -{ yymsp[0].minor.yy494 = OE_Restrict; /* EV: R-33326-45252 */}
151508         -        break;
151509         -      case 54: /* refact ::= NO ACTION */
151510         -{ yymsp[-1].minor.yy494 = OE_None;     /* EV: R-33326-45252 */}
151511         -        break;
151512         -      case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
151513         -{yymsp[-2].minor.yy494 = 0;}
151514         -        break;
151515         -      case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
151516         -      case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
151517         -      case 156: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==156);
151518         -{yymsp[-1].minor.yy494 = yymsp[0].minor.yy494;}
151519         -        break;
151520         -      case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
151521         -      case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
151522         -      case 198: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==198);
151523         -      case 201: /* in_op ::= NOT IN */ yytestcase(yyruleno==201);
151524         -      case 227: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==227);
151525         -{yymsp[-1].minor.yy494 = 1;}
151526         -        break;
151527         -      case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
151528         -{yymsp[-1].minor.yy494 = 0;}
151529         -        break;
151530         -      case 61: /* tconscomma ::= COMMA */
       152063  +      case 45: /* refargs ::= */
       152064  +{ yymsp[1].minor.yy100 = OE_None*0x0101; /* EV: R-19803-45884 */}
       152065  +        break;
       152066  +      case 46: /* refargs ::= refargs refarg */
       152067  +{ yymsp[-1].minor.yy100 = (yymsp[-1].minor.yy100 & ~yymsp[0].minor.yy199.mask) | yymsp[0].minor.yy199.value; }
       152068  +        break;
       152069  +      case 47: /* refarg ::= MATCH nm */
       152070  +{ yymsp[-1].minor.yy199.value = 0;     yymsp[-1].minor.yy199.mask = 0x000000; }
       152071  +        break;
       152072  +      case 48: /* refarg ::= ON INSERT refact */
       152073  +{ yymsp[-2].minor.yy199.value = 0;     yymsp[-2].minor.yy199.mask = 0x000000; }
       152074  +        break;
       152075  +      case 49: /* refarg ::= ON DELETE refact */
       152076  +{ yymsp[-2].minor.yy199.value = yymsp[0].minor.yy100;     yymsp[-2].minor.yy199.mask = 0x0000ff; }
       152077  +        break;
       152078  +      case 50: /* refarg ::= ON UPDATE refact */
       152079  +{ yymsp[-2].minor.yy199.value = yymsp[0].minor.yy100<<8;  yymsp[-2].minor.yy199.mask = 0x00ff00; }
       152080  +        break;
       152081  +      case 51: /* refact ::= SET NULL */
       152082  +{ yymsp[-1].minor.yy100 = OE_SetNull;  /* EV: R-33326-45252 */}
       152083  +        break;
       152084  +      case 52: /* refact ::= SET DEFAULT */
       152085  +{ yymsp[-1].minor.yy100 = OE_SetDflt;  /* EV: R-33326-45252 */}
       152086  +        break;
       152087  +      case 53: /* refact ::= CASCADE */
       152088  +{ yymsp[0].minor.yy100 = OE_Cascade;  /* EV: R-33326-45252 */}
       152089  +        break;
       152090  +      case 54: /* refact ::= RESTRICT */
       152091  +{ yymsp[0].minor.yy100 = OE_Restrict; /* EV: R-33326-45252 */}
       152092  +        break;
       152093  +      case 55: /* refact ::= NO ACTION */
       152094  +{ yymsp[-1].minor.yy100 = OE_None;     /* EV: R-33326-45252 */}
       152095  +        break;
       152096  +      case 56: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
       152097  +{yymsp[-2].minor.yy100 = 0;}
       152098  +        break;
       152099  +      case 57: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
       152100  +      case 72: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==72);
       152101  +      case 157: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==157);
       152102  +{yymsp[-1].minor.yy100 = yymsp[0].minor.yy100;}
       152103  +        break;
       152104  +      case 59: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
       152105  +      case 76: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==76);
       152106  +      case 199: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==199);
       152107  +      case 202: /* in_op ::= NOT IN */ yytestcase(yyruleno==202);
       152108  +      case 228: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==228);
       152109  +{yymsp[-1].minor.yy100 = 1;}
       152110  +        break;
       152111  +      case 60: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
       152112  +{yymsp[-1].minor.yy100 = 0;}
       152113  +        break;
       152114  +      case 62: /* tconscomma ::= COMMA */
151531 152115   {pParse->constraintName.n = 0;}
151532 152116           break;
151533         -      case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
151534         -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy434,yymsp[0].minor.yy494,yymsp[-2].minor.yy494,0);}
       152117  +      case 64: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
       152118  +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy94,yymsp[0].minor.yy100,yymsp[-2].minor.yy100,0);}
151535 152119           break;
151536         -      case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */
151537         -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy434,yymsp[0].minor.yy494,0,0,0,0,
       152120  +      case 65: /* tcons ::= UNIQUE LP sortlist RP onconf */
       152121  +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy94,yymsp[0].minor.yy100,0,0,0,0,
151538 152122                                          SQLITE_IDXTYPE_UNIQUE);}
151539 152123           break;
151540         -      case 65: /* tcons ::= CHECK LP expr RP onconf */
151541         -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy524);}
151542         -        break;
151543         -      case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
151544         -{
151545         -    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy434, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy434, yymsp[-1].minor.yy494);
151546         -    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy494);
151547         -}
151548         -        break;
151549         -      case 68: /* onconf ::= */
151550         -      case 70: /* orconf ::= */ yytestcase(yyruleno==70);
151551         -{yymsp[1].minor.yy494 = OE_Default;}
151552         -        break;
151553         -      case 69: /* onconf ::= ON CONFLICT resolvetype */
151554         -{yymsp[-2].minor.yy494 = yymsp[0].minor.yy494;}
151555         -        break;
151556         -      case 72: /* resolvetype ::= IGNORE */
151557         -{yymsp[0].minor.yy494 = OE_Ignore;}
151558         -        break;
151559         -      case 73: /* resolvetype ::= REPLACE */
151560         -      case 157: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==157);
151561         -{yymsp[0].minor.yy494 = OE_Replace;}
151562         -        break;
151563         -      case 74: /* cmd ::= DROP TABLE ifexists fullname */
151564         -{
151565         -  sqlite3DropTable(pParse, yymsp[0].minor.yy483, 0, yymsp[-1].minor.yy494);
151566         -}
151567         -        break;
151568         -      case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
151569         -{
151570         -  sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy434, yymsp[0].minor.yy457, yymsp[-7].minor.yy494, yymsp[-5].minor.yy494);
151571         -}
151572         -        break;
151573         -      case 78: /* cmd ::= DROP VIEW ifexists fullname */
151574         -{
151575         -  sqlite3DropTable(pParse, yymsp[0].minor.yy483, 1, yymsp[-1].minor.yy494);
151576         -}
151577         -        break;
151578         -      case 79: /* cmd ::= select */
       152124  +      case 66: /* tcons ::= CHECK LP expr RP onconf */
       152125  +{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy102);}
       152126  +        break;
       152127  +      case 67: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
       152128  +{
       152129  +    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy94, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy94, yymsp[-1].minor.yy100);
       152130  +    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy100);
       152131  +}
       152132  +        break;
       152133  +      case 69: /* onconf ::= */
       152134  +      case 71: /* orconf ::= */ yytestcase(yyruleno==71);
       152135  +{yymsp[1].minor.yy100 = OE_Default;}
       152136  +        break;
       152137  +      case 70: /* onconf ::= ON CONFLICT resolvetype */
       152138  +{yymsp[-2].minor.yy100 = yymsp[0].minor.yy100;}
       152139  +        break;
       152140  +      case 73: /* resolvetype ::= IGNORE */
       152141  +{yymsp[0].minor.yy100 = OE_Ignore;}
       152142  +        break;
       152143  +      case 74: /* resolvetype ::= REPLACE */
       152144  +      case 158: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==158);
       152145  +{yymsp[0].minor.yy100 = OE_Replace;}
       152146  +        break;
       152147  +      case 75: /* cmd ::= DROP TABLE ifexists fullname */
       152148  +{
       152149  +  sqlite3DropTable(pParse, yymsp[0].minor.yy407, 0, yymsp[-1].minor.yy100);
       152150  +}
       152151  +        break;
       152152  +      case 78: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
       152153  +{
       152154  +  sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy94, yymsp[0].minor.yy391, yymsp[-7].minor.yy100, yymsp[-5].minor.yy100);
       152155  +}
       152156  +        break;
       152157  +      case 79: /* cmd ::= DROP VIEW ifexists fullname */
       152158  +{
       152159  +  sqlite3DropTable(pParse, yymsp[0].minor.yy407, 1, yymsp[-1].minor.yy100);
       152160  +}
       152161  +        break;
       152162  +      case 80: /* cmd ::= select */
151579 152163   {
151580 152164     SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
151581         -  sqlite3Select(pParse, yymsp[0].minor.yy457, &dest);
151582         -  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy457);
       152165  +  sqlite3Select(pParse, yymsp[0].minor.yy391, &dest);
       152166  +  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy391);
151583 152167   }
151584 152168           break;
151585         -      case 80: /* select ::= WITH wqlist selectnowith */
       152169  +      case 81: /* select ::= WITH wqlist selectnowith */
151586 152170   {
151587         -  Select *p = yymsp[0].minor.yy457;
       152171  +  Select *p = yymsp[0].minor.yy391;
151588 152172     if( p ){
151589         -    p->pWith = yymsp[-1].minor.yy59;
       152173  +    p->pWith = yymsp[-1].minor.yy243;
151590 152174       parserDoubleLinkSelect(pParse, p);
151591 152175     }else{
151592         -    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy59);
       152176  +    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy243);
151593 152177     }
151594         -  yymsp[-2].minor.yy457 = p;
       152178  +  yymsp[-2].minor.yy391 = p;
151595 152179   }
151596 152180           break;
151597         -      case 81: /* select ::= WITH RECURSIVE wqlist selectnowith */
       152181  +      case 82: /* select ::= WITH RECURSIVE wqlist selectnowith */
151598 152182   {
151599         -  Select *p = yymsp[0].minor.yy457;
       152183  +  Select *p = yymsp[0].minor.yy391;
151600 152184     if( p ){
151601         -    p->pWith = yymsp[-1].minor.yy59;
       152185  +    p->pWith = yymsp[-1].minor.yy243;
151602 152186       parserDoubleLinkSelect(pParse, p);
151603 152187     }else{
151604         -    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy59);
       152188  +    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy243);
151605 152189     }
151606         -  yymsp[-3].minor.yy457 = p;
       152190  +  yymsp[-3].minor.yy391 = p;
151607 152191   }
151608 152192           break;
151609         -      case 82: /* select ::= selectnowith */
       152193  +      case 83: /* select ::= selectnowith */
151610 152194   {
151611         -  Select *p = yymsp[0].minor.yy457;
       152195  +  Select *p = yymsp[0].minor.yy391;
151612 152196     if( p ){
151613 152197       parserDoubleLinkSelect(pParse, p);
151614 152198     }
151615         -  yymsp[0].minor.yy457 = p; /*A-overwrites-X*/
       152199  +  yymsp[0].minor.yy391 = p; /*A-overwrites-X*/
151616 152200   }
151617 152201           break;
151618         -      case 83: /* selectnowith ::= selectnowith multiselect_op oneselect */
       152202  +      case 84: /* selectnowith ::= selectnowith multiselect_op oneselect */
151619 152203   {
151620         -  Select *pRhs = yymsp[0].minor.yy457;
151621         -  Select *pLhs = yymsp[-2].minor.yy457;
       152204  +  Select *pRhs = yymsp[0].minor.yy391;
       152205  +  Select *pLhs = yymsp[-2].minor.yy391;
151622 152206     if( pRhs && pRhs->pPrior ){
151623 152207       SrcList *pFrom;
151624 152208       Token x;
151625 152209       x.n = 0;
151626 152210       parserDoubleLinkSelect(pParse, pRhs);
151627 152211       pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
151628 152212       pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
151629 152213     }
151630 152214     if( pRhs ){
151631         -    pRhs->op = (u8)yymsp[-1].minor.yy494;
       152215  +    pRhs->op = (u8)yymsp[-1].minor.yy100;
151632 152216       pRhs->pPrior = pLhs;
151633 152217       if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
151634 152218       pRhs->selFlags &= ~SF_MultiValue;
151635         -    if( yymsp[-1].minor.yy494!=TK_ALL ) pParse->hasCompound = 1;
       152219  +    if( yymsp[-1].minor.yy100!=TK_ALL ) pParse->hasCompound = 1;
151636 152220     }else{
151637 152221       sqlite3SelectDelete(pParse->db, pLhs);
151638 152222     }
151639         -  yymsp[-2].minor.yy457 = pRhs;
151640         -}
151641         -        break;
151642         -      case 84: /* multiselect_op ::= UNION */
151643         -      case 86: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==86);
151644         -{yymsp[0].minor.yy494 = yymsp[0].major; /*A-overwrites-OP*/}
151645         -        break;
151646         -      case 85: /* multiselect_op ::= UNION ALL */
151647         -{yymsp[-1].minor.yy494 = TK_ALL;}
151648         -        break;
151649         -      case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
151650         -{
151651         -  yymsp[-8].minor.yy457 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy434,yymsp[-5].minor.yy483,yymsp[-4].minor.yy524,yymsp[-3].minor.yy434,yymsp[-2].minor.yy524,yymsp[-1].minor.yy434,yymsp[-7].minor.yy494,yymsp[0].minor.yy524);
151652         -}
151653         -        break;
151654         -      case 88: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
151655         -{
151656         -  yymsp[-9].minor.yy457 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy434,yymsp[-6].minor.yy483,yymsp[-5].minor.yy524,yymsp[-4].minor.yy434,yymsp[-3].minor.yy524,yymsp[-1].minor.yy434,yymsp[-8].minor.yy494,yymsp[0].minor.yy524);
151657         -  if( yymsp[-9].minor.yy457 ){
151658         -    yymsp[-9].minor.yy457->pWinDefn = yymsp[-2].minor.yy295;
151659         -  }else{
151660         -    sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy295);
151661         -  }
151662         -}
151663         -        break;
151664         -      case 89: /* values ::= VALUES LP nexprlist RP */
151665         -{
151666         -  yymsp[-3].minor.yy457 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy434,0,0,0,0,0,SF_Values,0);
151667         -}
151668         -        break;
151669         -      case 90: /* values ::= values COMMA LP nexprlist RP */
151670         -{
151671         -  Select *pRight, *pLeft = yymsp[-4].minor.yy457;
151672         -  pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy434,0,0,0,0,0,SF_Values|SF_MultiValue,0);
       152223  +  yymsp[-2].minor.yy391 = pRhs;
       152224  +}
       152225  +        break;
       152226  +      case 85: /* multiselect_op ::= UNION */
       152227  +      case 87: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==87);
       152228  +{yymsp[0].minor.yy100 = yymsp[0].major; /*A-overwrites-OP*/}
       152229  +        break;
       152230  +      case 86: /* multiselect_op ::= UNION ALL */
       152231  +{yymsp[-1].minor.yy100 = TK_ALL;}
       152232  +        break;
       152233  +      case 88: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
       152234  +{
       152235  +  yymsp[-8].minor.yy391 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy94,yymsp[-5].minor.yy407,yymsp[-4].minor.yy102,yymsp[-3].minor.yy94,yymsp[-2].minor.yy102,yymsp[-1].minor.yy94,yymsp[-7].minor.yy100,yymsp[0].minor.yy102);
       152236  +}
       152237  +        break;
       152238  +      case 89: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
       152239  +{
       152240  +  yymsp[-9].minor.yy391 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy94,yymsp[-6].minor.yy407,yymsp[-5].minor.yy102,yymsp[-4].minor.yy94,yymsp[-3].minor.yy102,yymsp[-1].minor.yy94,yymsp[-8].minor.yy100,yymsp[0].minor.yy102);
       152241  +  if( yymsp[-9].minor.yy391 ){
       152242  +    yymsp[-9].minor.yy391->pWinDefn = yymsp[-2].minor.yy379;
       152243  +  }else{