sqllogictest
Check-in [bf409a4f2c]
Not logged in

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

Overview
Comment:Update the built-in SQLite to the first 3.29.0 beta.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bf409a4f2ccd5ab5636dacd536ad1b162d23c0a9
User & Date: drh 2019-07-08 20:51:42
Context
2019-09-28
19:29
Update the built-in SQLite to the first 3.30.0 beta. Leaf check-in: 0b85555747 user: drh tags: trunk
2019-07-08
20:51
Update the built-in SQLite to the first 3.29.0 beta. check-in: bf409a4f2c user: drh tags: trunk
2019-04-15
14:24
Update the built-in SQLite to the 3.28.0 beta. check-in: 865a75877d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/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-15 13:59:08 734192d876e0489cb34e454aaa4a9c6858145791a49959b31dee2917a8e41a7d"
         1170  +#define SQLITE_VERSION        "3.29.0"
         1171  +#define SQLITE_VERSION_NUMBER 3029000
         1172  +#define SQLITE_SOURCE_ID      "2019-07-08 13:45:02 8fb0c6d5a38e77aa4c5f394fb8af1b0c7c6a4790e932aabc213a3078ee9acaf6"
  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 >= -2251799813685248 && i < 2251799813685248);
 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 
................................................................................
 93545  93849     }
 93546  93850   
 93547  93851     if( pSorter->list.aMemory ){
 93548  93852       int nMin = pSorter->iMemory + nReq;
 93549  93853   
 93550  93854       if( nMin>pSorter->nMemory ){
 93551  93855         u8 *aNew;
 93552         -      int iListOff = (u8*)pSorter->list.pList - pSorter->list.aMemory;
 93553  93856         sqlite3_int64 nNew = 2 * (sqlite3_int64)pSorter->nMemory;
        93857  +      int iListOff = -1;
        93858  +      if( pSorter->list.pList ){
        93859  +        iListOff = (u8*)pSorter->list.pList - pSorter->list.aMemory;
        93860  +      }
 93554  93861         while( nNew < nMin ) nNew = nNew*2;
 93555  93862         if( nNew > pSorter->mxPmaSize ) nNew = pSorter->mxPmaSize;
 93556  93863         if( nNew < nMin ) nNew = nMin;
 93557         -
 93558  93864         aNew = sqlite3Realloc(pSorter->list.aMemory, nNew);
 93559  93865         if( !aNew ) return SQLITE_NOMEM_BKPT;
 93560         -      pSorter->list.pList = (SorterRecord*)&aNew[iListOff];
        93866  +      if( iListOff>=0 ){
        93867  +        pSorter->list.pList = (SorterRecord*)&aNew[iListOff];
        93868  +      }
 93561  93869         pSorter->list.aMemory = aNew;
 93562  93870         pSorter->nMemory = nNew;
 93563  93871       }
 93564  93872   
 93565  93873       pNew = (SorterRecord*)&pSorter->list.aMemory[pSorter->iMemory];
 93566  93874       pSorter->iMemory += ROUND8(nReq);
 93567  93875       if( pSorter->list.pList ){
................................................................................
 95252  95560     }
 95253  95561     zSpan += n+1;
 95254  95562     if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){
 95255  95563       return 0;
 95256  95564     }
 95257  95565     return 1;
 95258  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  +}
 95259  95584   
 95260  95585   /*
 95261  95586   ** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up
 95262  95587   ** that name in the set of source tables in pSrcList and make the pExpr 
 95263  95588   ** expression node refer back to that source column.  The following changes
 95264  95589   ** are made to pExpr:
 95265  95590   **
................................................................................
 95581  95906     ** pExpr.
 95582  95907     **
 95583  95908     ** Because no reference was made to outer contexts, the pNC->nRef
 95584  95909     ** fields are not changed in any context.
 95585  95910     */
 95586  95911     if( cnt==0 && zTab==0 ){
 95587  95912       assert( pExpr->op==TK_ID );
 95588         -    if( ExprHasProperty(pExpr,EP_DblQuoted) ){
        95913  +    if( ExprHasProperty(pExpr,EP_DblQuoted)
        95914  +     && areDoubleQuotedStringsEnabled(db, pTopNC)
        95915  +    ){
 95589  95916         /* If a double-quoted identifier does not match any known column name,
 95590  95917         ** then treat it as a string.
 95591  95918         **
 95592  95919         ** This hack was added in the early days of SQLite in a misguided attempt
 95593  95920         ** to be compatible with MySQL 3.x, which used double-quotes for strings.
 95594  95921         ** I now sorely regret putting in this hack. The effect of this hack is
 95595  95922         ** that misspelled identifier names are silently converted into strings
................................................................................
 95850  96177             no_such_func = 1;
 95851  96178           }else{
 95852  96179             wrong_num_args = 1;
 95853  96180           }
 95854  96181         }else{
 95855  96182           is_agg = pDef->xFinalize!=0;
 95856  96183           if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){
 95857         -          ExprSetProperty(pExpr, EP_Unlikely|EP_Skip);
        96184  +          ExprSetProperty(pExpr, EP_Unlikely);
 95858  96185             if( n==2 ){
 95859  96186               pExpr->iTable = exprProbability(pList->a[1].pExpr);
 95860  96187               if( pExpr->iTable<0 ){
 95861  96188                 sqlite3ErrorMsg(pParse,
 95862  96189                   "second argument to likelihood() must be a "
 95863  96190                   "constant between 0.0 and 1.0");
 95864  96191                 pNC->nErr++;
................................................................................
 95971  96298           }
 95972  96299         }
 95973  96300         sqlite3WalkExprList(pWalker, pList);
 95974  96301         if( is_agg ){
 95975  96302   #ifndef SQLITE_OMIT_WINDOWFUNC
 95976  96303           if( pExpr->y.pWin ){
 95977  96304             Select *pSel = pNC->pWinSelect;
 95978         -          sqlite3WindowUpdate(pParse, pSel->pWinDefn, pExpr->y.pWin, pDef);
        96305  +          if( IN_RENAME_OBJECT==0 ){
        96306  +            sqlite3WindowUpdate(pParse, pSel->pWinDefn, pExpr->y.pWin, pDef);
        96307  +          }
 95979  96308             sqlite3WalkExprList(pWalker, pExpr->y.pWin->pPartition);
 95980  96309             sqlite3WalkExprList(pWalker, pExpr->y.pWin->pOrderBy);
 95981  96310             sqlite3WalkExpr(pWalker, pExpr->y.pWin->pFilter);
 95982  96311             if( 0==pSel->pWin 
 95983  96312              || 0==sqlite3WindowCompare(pParse, pSel->pWin, pExpr->y.pWin) 
 95984  96313             ){
 95985  96314               pExpr->y.pWin->pNextWin = pSel->pWin;
................................................................................
 96031  96360       }
 96032  96361       case TK_VARIABLE: {
 96033  96362         notValid(pParse, pNC, "parameters", NC_IsCheck|NC_PartIdx|NC_IdxExpr);
 96034  96363         break;
 96035  96364       }
 96036  96365       case TK_IS:
 96037  96366       case TK_ISNOT: {
 96038         -      Expr *pRight;
        96367  +      Expr *pRight = sqlite3ExprSkipCollate(pExpr->pRight);
 96039  96368         assert( !ExprHasProperty(pExpr, EP_Reduced) );
 96040  96369         /* Handle special cases of "x IS TRUE", "x IS FALSE", "x IS NOT TRUE",
 96041  96370         ** and "x IS NOT FALSE". */
 96042         -      if( (pRight = pExpr->pRight)->op==TK_ID ){
        96371  +      if( pRight->op==TK_ID ){
 96043  96372           int rc = resolveExprStep(pWalker, pRight);
 96044  96373           if( rc==WRC_Abort ) return WRC_Abort;
 96045  96374           if( pRight->op==TK_TRUEFALSE ){
 96046  96375             pExpr->op2 = pExpr->op;
 96047  96376             pExpr->op = TK_TRUTH;
 96048  96377             return WRC_Continue;
 96049  96378           }
................................................................................
 96757  97086   ** An error message is left in pParse if anything is amiss.  The number
 96758  97087   ** if errors is returned.
 96759  97088   */
 96760  97089   SQLITE_PRIVATE int sqlite3ResolveExprNames( 
 96761  97090     NameContext *pNC,       /* Namespace to resolve expressions in. */
 96762  97091     Expr *pExpr             /* The expression to be analyzed. */
 96763  97092   ){
 96764         -  u16 savedHasAgg;
        97093  +  int savedHasAgg;
 96765  97094     Walker w;
 96766  97095   
 96767  97096     if( pExpr==0 ) return SQLITE_OK;
 96768  97097     savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin);
 96769  97098     pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin);
 96770  97099     w.pParse = pNC->pParse;
 96771  97100     w.xExprCallback = resolveExprStep;
................................................................................
 96871  97200       sSrc.nSrc = 1;
 96872  97201       sSrc.a[0].zName = pTab->zName;
 96873  97202       sSrc.a[0].pTab = pTab;
 96874  97203       sSrc.a[0].iCursor = -1;
 96875  97204     }
 96876  97205     sNC.pParse = pParse;
 96877  97206     sNC.pSrcList = &sSrc;
 96878         -  sNC.ncFlags = type;
        97207  +  sNC.ncFlags = type | NC_IsDDL;
 96879  97208     if( (rc = sqlite3ResolveExprNames(&sNC, pExpr))!=SQLITE_OK ) return rc;
 96880  97209     if( pList ) rc = sqlite3ResolveExprListNames(&sNC, pList);
 96881  97210     return rc;
 96882  97211   }
 96883  97212   
 96884  97213   /************** End of resolve.c *********************************************/
 96885  97214   /************** Begin file expr.c ********************************************/
................................................................................
 96925  97254   ** CREATE TABLE t1(a);
 96926  97255   ** SELECT * FROM t1 WHERE a;
 96927  97256   ** SELECT a AS b FROM t1 WHERE b;
 96928  97257   ** SELECT * FROM t1 WHERE (select a from t1);
 96929  97258   */
 96930  97259   SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr){
 96931  97260     int op;
 96932         -  pExpr = sqlite3ExprSkipCollate(pExpr);
 96933  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  +  }
 96934  97267     op = pExpr->op;
 96935  97268     if( op==TK_SELECT ){
 96936  97269       assert( pExpr->flags&EP_xIsSelect );
 96937  97270       return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr);
 96938  97271     }
 96939  97272     if( op==TK_REGISTER ) op = pExpr->op2;
 96940  97273   #ifndef SQLITE_OMIT_CAST
................................................................................
 96987  97320   }
 96988  97321   
 96989  97322   /*
 96990  97323   ** Skip over any TK_COLLATE operators and any unlikely()
 96991  97324   ** or likelihood() function at the root of an expression.
 96992  97325   */
 96993  97326   SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr *pExpr){
 96994         -  while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){
        97327  +  while( pExpr && ExprHasProperty(pExpr, EP_Skip|EP_Unlikely) ){
 96995  97328       if( ExprHasProperty(pExpr, EP_Unlikely) ){
 96996  97329         assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
 96997  97330         assert( pExpr->x.pList->nExpr>0 );
 96998  97331         assert( pExpr->op==TK_FUNCTION );
 96999  97332         pExpr = pExpr->x.pList->a[0].pExpr;
 97000  97333       }else{
 97001  97334         assert( pExpr->op==TK_COLLATE );
................................................................................
 97654  97987     pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra);
 97655  97988     if( pNew ){
 97656  97989       memset(pNew, 0, sizeof(Expr));
 97657  97990       pNew->op = (u8)op;
 97658  97991       pNew->iAgg = -1;
 97659  97992       if( pToken ){
 97660  97993         if( nExtra==0 ){
 97661         -        pNew->flags |= EP_IntValue|EP_Leaf;
        97994  +        pNew->flags |= EP_IntValue|EP_Leaf|(iValue?EP_IsTrue:EP_IsFalse);
 97662  97995           pNew->u.iValue = iValue;
 97663  97996         }else{
 97664  97997           pNew->u.zToken = (char*)&pNew[1];
 97665  97998           assert( pToken->z!=0 || pToken->n==0 );
 97666  97999           if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
 97667  98000           pNew->u.zToken[pToken->n] = 0;
 97668  98001           if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
................................................................................
 97731  98064   SQLITE_PRIVATE Expr *sqlite3PExpr(
 97732  98065     Parse *pParse,          /* Parsing context */
 97733  98066     int op,                 /* Expression opcode */
 97734  98067     Expr *pLeft,            /* Left operand */
 97735  98068     Expr *pRight            /* Right operand */
 97736  98069   ){
 97737  98070     Expr *p;
 97738         -  if( op==TK_AND && pParse->nErr==0 && !IN_RENAME_OBJECT ){
 97739         -    /* Take advantage of short-circuit false optimization for AND */
 97740         -    p = sqlite3ExprAnd(pParse->db, pLeft, pRight);
 97741         -  }else{
 97742         -    p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr));
 97743         -    if( p ){
 97744         -      memset(p, 0, sizeof(Expr));
 97745         -      p->op = op & 0xff;
 97746         -      p->iAgg = -1;
 97747         -    }
        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;
 97748  98076       sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight);
 97749         -  }
 97750         -  if( p ) {
 97751  98077       sqlite3ExprCheckHeight(pParse, p->nHeight);
        98078  +  }else{
        98079  +    sqlite3ExprDelete(pParse->db, pLeft);
        98080  +    sqlite3ExprDelete(pParse->db, pRight);
 97752  98081     }
 97753  98082     return p;
 97754  98083   }
 97755  98084   
 97756  98085   /*
 97757  98086   ** Add pSelect to the Expr.x.pSelect field.  Or, if pExpr is NULL (due
 97758  98087   ** do a memory allocation failure) then delete the pSelect object.
................................................................................
 97765  98094     }else{
 97766  98095       assert( pParse->db->mallocFailed );
 97767  98096       sqlite3SelectDelete(pParse->db, pSelect);
 97768  98097     }
 97769  98098   }
 97770  98099   
 97771  98100   
 97772         -/*
 97773         -** If the expression is always either TRUE or FALSE (respectively),
 97774         -** then return 1.  If one cannot determine the truth value of the
 97775         -** expression at compile-time return 0.
 97776         -**
 97777         -** This is an optimization.  If is OK to return 0 here even if
 97778         -** the expression really is always false or false (a false negative).
 97779         -** But it is a bug to return 1 if the expression might have different
 97780         -** boolean values in different circumstances (a false positive.)
 97781         -**
 97782         -** Note that if the expression is part of conditional for a
 97783         -** LEFT JOIN, then we cannot determine at compile-time whether or not
 97784         -** is it true or false, so always return 0.
 97785         -*/
 97786         -static int exprAlwaysTrue(Expr *p){
 97787         -  int v = 0;
 97788         -  if( ExprHasProperty(p, EP_FromJoin) ) return 0;
 97789         -  if( !sqlite3ExprIsInteger(p, &v) ) return 0;
 97790         -  return v!=0;
 97791         -}
 97792         -static int exprAlwaysFalse(Expr *p){
 97793         -  int v = 0;
 97794         -  if( ExprHasProperty(p, EP_FromJoin) ) return 0;
 97795         -  if( !sqlite3ExprIsInteger(p, &v) ) return 0;
 97796         -  return v==0;
 97797         -}
 97798         -
 97799  98101   /*
 97800  98102   ** Join two expressions using an AND operator.  If either expression is
 97801  98103   ** NULL, then just return the other expression.
 97802  98104   **
 97803  98105   ** If one side or the other of the AND is known to be false, then instead
 97804  98106   ** of returning an AND expression, just return a constant expression with
 97805  98107   ** a value of false.
 97806  98108   */
 97807         -SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){
 97808         -  if( pLeft==0 ){
        98109  +SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){
        98110  +  sqlite3 *db = pParse->db;
        98111  +  if( pLeft==0  ){
 97809  98112       return pRight;
 97810  98113     }else if( pRight==0 ){
 97811  98114       return pLeft;
 97812         -  }else if( exprAlwaysFalse(pLeft) || exprAlwaysFalse(pRight) ){
 97813         -    sqlite3ExprDelete(db, pLeft);
 97814         -    sqlite3ExprDelete(db, pRight);
        98115  +  }else if( ExprAlwaysFalse(pLeft) || ExprAlwaysFalse(pRight) ){
        98116  +    sqlite3ExprUnmapAndDelete(pParse, pLeft);
        98117  +    sqlite3ExprUnmapAndDelete(pParse, pRight);
 97815  98118       return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0);
 97816  98119     }else{
 97817         -    Expr *pNew = sqlite3ExprAlloc(db, TK_AND, 0, 0);
 97818         -    sqlite3ExprAttachSubtrees(db, pNew, pLeft, pRight);
 97819         -    return pNew;
        98120  +    return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
 97820  98121     }
 97821  98122   }
 97822  98123   
 97823  98124   /*
 97824  98125   ** Construct a new expression node for a function with multiple
 97825  98126   ** arguments.
 97826  98127   */
................................................................................
 97968  98269     if( !ExprHasProperty(p, EP_Static) ){
 97969  98270       sqlite3DbFreeNN(db, p);
 97970  98271     }
 97971  98272   }
 97972  98273   SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){
 97973  98274     if( p ) sqlite3ExprDeleteNN(db, p);
 97974  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  +}
 97975  98288   
 97976  98289   /*
 97977  98290   ** Return the number of bytes allocated for the expression structure 
 97978  98291   ** passed as the first argument. This is always one of EXPR_FULLSIZE,
 97979  98292   ** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE.
 97980  98293   */
 97981  98294   static int exprStructSize(Expr *p){
................................................................................
 98551  98864   
 98552  98865       /* Remember the size of the LHS in iTable so that we can check that
 98553  98866       ** the RHS and LHS sizes match during code generation. */
 98554  98867       pFirst->iTable = pColumns->nId;
 98555  98868     }
 98556  98869   
 98557  98870   vector_append_error:
 98558         -  if( IN_RENAME_OBJECT ){
 98559         -    sqlite3RenameExprUnmap(pParse, pExpr);
 98560         -  }
 98561         -  sqlite3ExprDelete(db, pExpr);
        98871  +  sqlite3ExprUnmapAndDelete(pParse, pExpr);
 98562  98872     sqlite3IdListDelete(db, pColumns);
 98563  98873     return pList;
 98564  98874   }
 98565  98875   
 98566  98876   /*
 98567  98877   ** Set the sort order for the last element on the given ExprList.
 98568  98878   */
................................................................................
 98702  99012   SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr *pExpr){
 98703  99013     assert( pExpr->op==TK_ID || pExpr->op==TK_STRING );
 98704  99014     if( !ExprHasProperty(pExpr, EP_Quoted)
 98705  99015      && (sqlite3StrICmp(pExpr->u.zToken, "true")==0
 98706  99016          || sqlite3StrICmp(pExpr->u.zToken, "false")==0)
 98707  99017     ){
 98708  99018       pExpr->op = TK_TRUEFALSE;
        99019  +    ExprSetProperty(pExpr, pExpr->u.zToken[4]==0 ? EP_IsTrue : EP_IsFalse);
 98709  99020       return 1;
 98710  99021     }
 98711  99022     return 0;
 98712  99023   }
 98713  99024   
 98714  99025   /*
 98715  99026   ** The argument must be a TK_TRUEFALSE Expr node.  Return 1 if it is TRUE
 98716  99027   ** and 0 if it is FALSE.
 98717  99028   */
 98718  99029   SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr *pExpr){
        99030  +  pExpr = sqlite3ExprSkipCollate((Expr*)pExpr);
 98719  99031     assert( pExpr->op==TK_TRUEFALSE );
 98720  99032     assert( sqlite3StrICmp(pExpr->u.zToken,"true")==0
 98721  99033          || sqlite3StrICmp(pExpr->u.zToken,"false")==0 );
 98722  99034     return pExpr->u.zToken[4]==0;
 98723  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  +}
 98724  99063   
 98725  99064   
 98726  99065   /*
 98727  99066   ** These routines are Walker callbacks used to check expressions to
 98728  99067   ** see if they are "constant" for some definition of constant.  The
 98729  99068   ** Walker.eCode value determines the type of "constant" we are looking
 98730  99069   ** for.
................................................................................
 98962  99301   ** If the expression p codes a constant integer that is small enough
 98963  99302   ** to fit in a 32-bit integer, return 1 and put the value of the integer
 98964  99303   ** in *pValue.  If the expression is not an integer or if it is too big
 98965  99304   ** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.
 98966  99305   */
 98967  99306   SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){
 98968  99307     int rc = 0;
 98969         -  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 */
 98970  99309   
 98971  99310     /* If an expression is an integer literal that fits in a signed 32-bit
 98972  99311     ** integer, then the EP_IntValue flag will have already been set */
 98973  99312     assert( p->op!=TK_INTEGER || (p->flags & EP_IntValue)!=0
 98974  99313              || sqlite3GetInt32(p->u.zToken, &rc)==0 );
 98975  99314   
 98976  99315     if( p->flags & EP_IntValue ){
................................................................................
 99691 100030         /* If the expression is not constant then we will need to
 99692 100031         ** disable the test that was generated above that makes sure
 99693 100032         ** this code only executes once.  Because for a non-constant
 99694 100033         ** expression we need to rerun this code each time.
 99695 100034         */
 99696 100035         if( addrOnce && !sqlite3ExprIsConstant(pE2) ){
 99697 100036           sqlite3VdbeChangeToNoop(v, addrOnce);
       100037  +        ExprClearProperty(pExpr, EP_Subrtn);
 99698 100038           addrOnce = 0;
 99699 100039         }
 99700 100040   
 99701 100041         /* Evaluate the expression and insert it into the temp table */
 99702 100042         r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
 99703 100043         sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
 99704 100044         sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1);
................................................................................
100257 100597   }
100258 100598   
100259 100599   /*
100260 100600   ** Convert a scalar expression node to a TK_REGISTER referencing
100261 100601   ** register iReg.  The caller must ensure that iReg already contains
100262 100602   ** the correct value for the expression.
100263 100603   */
100264         -static void exprToRegister(Expr *p, int iReg){
       100604  +static void exprToRegister(Expr *pExpr, int iReg){
       100605  +  Expr *p = sqlite3ExprSkipCollate(pExpr);
100265 100606     p->op2 = p->op;
100266 100607     p->op = TK_REGISTER;
100267 100608     p->iTable = iReg;
100268 100609     ExprClearProperty(p, EP_Skip);
100269 100610   }
100270 100611   
100271 100612   /*
................................................................................
101309 101650     int r1, r2;
101310 101651   
101311 101652     assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );
101312 101653     if( NEVER(v==0) )     return;  /* Existence of VDBE checked by caller */
101313 101654     if( NEVER(pExpr==0) ) return;  /* No way this can happen */
101314 101655     op = pExpr->op;
101315 101656     switch( op ){
101316         -    case TK_AND: {
101317         -      int d2 = sqlite3VdbeMakeLabel(pParse);
101318         -      testcase( jumpIfNull==0 );
101319         -      sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL);
101320         -      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
101321         -      sqlite3VdbeResolveLabel(v, d2);
101322         -      break;
101323         -    }
       101657  +    case TK_AND:
101324 101658       case TK_OR: {
101325         -      testcase( jumpIfNull==0 );
101326         -      sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
101327         -      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  +      }
101328 101674         break;
101329 101675       }
101330 101676       case TK_NOT: {
101331 101677         testcase( jumpIfNull==0 );
101332 101678         sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
101333 101679         break;
101334 101680       }
................................................................................
101406 101752         sqlite3VdbeGoto(v, dest);
101407 101753         sqlite3VdbeResolveLabel(v, destIfFalse);
101408 101754         break;
101409 101755       }
101410 101756   #endif
101411 101757       default: {
101412 101758       default_expr:
101413         -      if( exprAlwaysTrue(pExpr) ){
       101759  +      if( ExprAlwaysTrue(pExpr) ){
101414 101760           sqlite3VdbeGoto(v, dest);
101415         -      }else if( exprAlwaysFalse(pExpr) ){
       101761  +      }else if( ExprAlwaysFalse(pExpr) ){
101416 101762           /* No-op */
101417 101763         }else{
101418 101764           r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);
101419 101765           sqlite3VdbeAddOp3(v, OP_If, r1, dest, jumpIfNull!=0);
101420 101766           VdbeCoverage(v);
101421 101767           testcase( regFree1==0 );
101422 101768           testcase( jumpIfNull==0 );
................................................................................
101476 101822     assert( pExpr->op!=TK_EQ || op==OP_Ne );
101477 101823     assert( pExpr->op!=TK_LT || op==OP_Ge );
101478 101824     assert( pExpr->op!=TK_LE || op==OP_Gt );
101479 101825     assert( pExpr->op!=TK_GT || op==OP_Le );
101480 101826     assert( pExpr->op!=TK_GE || op==OP_Lt );
101481 101827   
101482 101828     switch( pExpr->op ){
101483         -    case TK_AND: {
101484         -      testcase( jumpIfNull==0 );
101485         -      sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
101486         -      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
101487         -      break;
101488         -    }
       101829  +    case TK_AND:
101489 101830       case TK_OR: {
101490         -      int d2 = sqlite3VdbeMakeLabel(pParse);
101491         -      testcase( jumpIfNull==0 );
101492         -      sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL);
101493         -      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
101494         -      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  +      }
101495 101846         break;
101496 101847       }
101497 101848       case TK_NOT: {
101498 101849         testcase( jumpIfNull==0 );
101499 101850         sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
101500 101851         break;
101501 101852       }
................................................................................
101576 101927           sqlite3VdbeResolveLabel(v, destIfNull);
101577 101928         }
101578 101929         break;
101579 101930       }
101580 101931   #endif
101581 101932       default: {
101582 101933       default_expr: 
101583         -      if( exprAlwaysFalse(pExpr) ){
       101934  +      if( ExprAlwaysFalse(pExpr) ){
101584 101935           sqlite3VdbeGoto(v, dest);
101585         -      }else if( exprAlwaysTrue(pExpr) ){
       101936  +      }else if( ExprAlwaysTrue(pExpr) ){
101586 101937           /* no-op */
101587 101938         }else{
101588 101939           r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);
101589 101940           sqlite3VdbeAddOp3(v, OP_IfNot, r1, dest, jumpIfNull!=0);
101590 101941           VdbeCoverage(v);
101591 101942           testcase( regFree1==0 );
101592 101943           testcase( jumpIfNull==0 );
................................................................................
101734 102085       if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2;
101735 102086       if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
101736 102087       if( pA->op!=TK_STRING
101737 102088        && pA->op!=TK_TRUEFALSE
101738 102089        && (combinedFlags & EP_Reduced)==0
101739 102090       ){
101740 102091         if( pA->iColumn!=pB->iColumn ) return 2;
       102092  +      if( pA->op2!=pB->op2 ) return 2;
101741 102093         if( pA->iTable!=pB->iTable 
101742 102094          && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
101743 102095       }
101744 102096     }
101745 102097     return 0;
101746 102098   }
101747 102099   
................................................................................
101780 102132   */
101781 102133   SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
101782 102134     return sqlite3ExprCompare(0,
101783 102135                sqlite3ExprSkipCollate(pA),
101784 102136                sqlite3ExprSkipCollate(pB),
101785 102137                iTab);
101786 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  +}
101787 102209   
101788 102210   /*
101789 102211   ** Return true if we can prove the pE2 will always be true if pE1 is
101790 102212   ** true.  Return false if we cannot complete the proof or if pE2 might
101791 102213   ** be false.  Examples:
101792 102214   **
101793 102215   **     pE1: x==5       pE2: x==5             Result: true
................................................................................
101816 102238     }
101817 102239     if( pE2->op==TK_OR
101818 102240      && (sqlite3ExprImpliesExpr(pParse, pE1, pE2->pLeft, iTab)
101819 102241                || sqlite3ExprImpliesExpr(pParse, pE1, pE2->pRight, iTab) )
101820 102242     ){
101821 102243       return 1;
101822 102244     }
101823         -  if( pE2->op==TK_NOTNULL && pE1->op!=TK_ISNULL && pE1->op!=TK_IS ){
101824         -    Expr *pX = sqlite3ExprSkipCollate(pE1->pLeft);
101825         -    testcase( pX!=pE1->pLeft );
101826         -    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;
101827 102249     }
101828 102250     return 0;
101829 102251   }
101830 102252   
101831 102253   /*
101832 102254   ** This is the Expr node callback for sqlite3ExprImpliesNotNullRow().
101833 102255   ** If the expression node requires that the table at pWalker->iCur
................................................................................
102393 102815   ** statement to ensure that the operation has not rendered any schema
102394 102816   ** objects unusable.
102395 102817   */
102396 102818   static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){
102397 102819     sqlite3NestedParse(pParse, 
102398 102820         "SELECT 1 "
102399 102821         "FROM \"%w\".%s "
102400         -      "WHERE name NOT LIKE 'sqlite_%%'"
       102822  +      "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
102401 102823         " AND sql NOT LIKE 'create virtual%%'"
102402 102824         " AND sqlite_rename_test(%Q, sql, type, name, %d)=NULL ",
102403 102825         zDb, MASTER_NAME, 
102404 102826         zDb, bTemp
102405 102827     );
102406 102828   
102407 102829     if( bTemp==0 ){
102408 102830       sqlite3NestedParse(pParse, 
102409 102831           "SELECT 1 "
102410 102832           "FROM temp.%s "
102411         -        "WHERE name NOT LIKE 'sqlite_%%'"
       102833  +        "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
102412 102834           " AND sql NOT LIKE 'create virtual%%'"
102413 102835           " AND sqlite_rename_test(%Q, sql, type, name, 1)=NULL ",
102414 102836           MASTER_NAME, zDb 
102415 102837       );
102416 102838     }
102417 102839   }
102418 102840   
................................................................................
102525 102947   
102526 102948     /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in
102527 102949     ** the schema to use the new table name.  */
102528 102950     sqlite3NestedParse(pParse, 
102529 102951         "UPDATE \"%w\".%s SET "
102530 102952         "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) "
102531 102953         "WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)"
102532         -      "AND   name NOT LIKE 'sqlite_%%'"
       102954  +      "AND   name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
102533 102955         , zDb, MASTER_NAME, zDb, zTabName, zName, (iDb==1), zTabName
102534 102956     );
102535 102957   
102536 102958     /* Update the tbl_name and name columns of the sqlite_master table
102537 102959     ** as required.  */
102538 102960     sqlite3NestedParse(pParse,
102539 102961         "UPDATE %Q.%s SET "
102540 102962             "tbl_name = %Q, "
102541 102963             "name = CASE "
102542 102964               "WHEN type='table' THEN %Q "
102543         -            "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN "
       102965  +            "WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' "
       102966  +            "     AND type='index' THEN "
102544 102967                "'sqlite_autoindex_' || %Q || substr(name,%d+18) "
102545 102968               "ELSE name END "
102546 102969         "WHERE tbl_name=%Q COLLATE nocase AND "
102547 102970             "(type='table' OR type='index' OR type='trigger');", 
102548 102971         zDb, MASTER_NAME, 
102549 102972         zName, zName, zName, 
102550 102973         nTabName, zTabName
................................................................................
102910 103333     zNew = sqlite3NameFromToken(db, pNew);
102911 103334     if( !zNew ) goto exit_rename_column;
102912 103335     assert( pNew->n>0 );
102913 103336     bQuote = sqlite3Isquote(pNew->z[0]);
102914 103337     sqlite3NestedParse(pParse, 
102915 103338         "UPDATE \"%w\".%s SET "
102916 103339         "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) "
102917         -      "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)"
102918 103342         " AND sql NOT LIKE 'create virtual%%'",
102919 103343         zDb, MASTER_NAME, 
102920 103344         zDb, pTab->zName, iCol, zNew, bQuote, iSchema==1,
102921 103345         pTab->zName
102922 103346     );
102923 103347   
102924 103348     sqlite3NestedParse(pParse, 
................................................................................
103063 103487   ** Walker callback used by sqlite3RenameExprUnmap().
103064 103488   */
103065 103489   static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){
103066 103490     Parse *pParse = pWalker->pParse;
103067 103491     sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr);
103068 103492     return WRC_Continue;
103069 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  +}
103070 103517   
103071 103518   /*
103072 103519   ** Remove all nodes that are part of expression pExpr from the rename list.
103073 103520   */
103074 103521   SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){
103075 103522     Walker sWalker;
103076 103523     memset(&sWalker, 0, sizeof(Walker));
103077 103524     sWalker.pParse = pParse;
103078 103525     sWalker.xExprCallback = renameUnmapExprCb;
       103526  +  sWalker.xSelectCallback = renameUnmapSelectCb;
103079 103527     sqlite3WalkExpr(&sWalker, pExpr);
103080 103528   }
103081 103529   
103082 103530   /*
103083 103531   ** Remove all nodes that are part of expression-list pEList from the 
103084 103532   ** rename list.
103085 103533   */
................................................................................
106164 106612       if( !REOPEN_AS_MEMDB(db) ){
106165 106613         rc = sqlite3Init(db, &zErrDyn);
106166 106614       }
106167 106615       sqlite3BtreeLeaveAll(db);
106168 106616       assert( zErrDyn==0 || rc!=SQLITE_OK );
106169 106617     }
106170 106618   #ifdef SQLITE_USER_AUTHENTICATION
106171         -  if( rc==SQLITE_OK ){
       106619  +  if( rc==SQLITE_OK && !REOPEN_AS_MEMDB(db) ){
106172 106620       u8 newAuth = 0;
106173 106621       rc = sqlite3UserAuthCheckLogin(db, zName, &newAuth);
106174 106622       if( newAuth<db->auth.authLevel ){
106175 106623         rc = SQLITE_AUTH_USER;
106176 106624       }
106177 106625     }
106178 106626   #endif
................................................................................
107451 107899   ** used by the Table object.
107452 107900   */
107453 107901   static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){
107454 107902     Index *pIndex, *pNext;
107455 107903   
107456 107904   #ifdef SQLITE_DEBUG
107457 107905     /* Record the number of outstanding lookaside allocations in schema Tables
107458         -  ** prior to doing any free() operations.  Since schema Tables do not use
107459         -  ** 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. */
107460 107912     int nLookaside = 0;
107461         -  if( db && (pTable->tabFlags & TF_Ephemeral)==0 ){
       107913  +  if( db && !db->mallocFailed && (pTable->tabFlags & TF_Ephemeral)==0 ){
107462 107914       nLookaside = sqlite3LookasideUsed(db, 0);
107463 107915     }
107464 107916   #endif
107465 107917   
107466 107918     /* Delete all indices associated with this table. */
107467 107919     for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
107468 107920       pNext = pIndex->pNext;
................................................................................
108162 108614   **     CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim)
108163 108615   **     CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC);
108164 108616   **
108165 108617   ** This is goofy.  But to preserve backwards compatibility we continue to
108166 108618   ** accept it.  This routine does the necessary conversion.  It converts
108167 108619   ** the expression given in its argument from a TK_STRING into a TK_ID
108168 108620   ** if the expression is just a TK_STRING with an optional COLLATE clause.
108169         -** 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
108170 108622   ** unchanged.
108171 108623   */
108172 108624   static void sqlite3StringToId(Expr *p){
108173 108625     if( p->op==TK_STRING ){
108174 108626       p->op = TK_ID;
108175 108627     }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){
108176 108628       p->pLeft->op = TK_ID;
................................................................................
108559 109011       i16 x = pIdx->aiColumn[i];
108560 109012       assert( x<pIdx->pTable->nCol );
108561 109013       wIndex += x<0 ? 1 : aCol[pIdx->aiColumn[i]].szEst;
108562 109014     }
108563 109015     pIdx->szIdxRow = sqlite3LogEst(wIndex*4);
108564 109016   }
108565 109017   
108566         -/* 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.
108567 109021   */
108568 109022   static int hasColumn(const i16 *aiCol, int nCol, int x){
108569         -  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  +  }
108570 109063     return 0;
108571 109064   }
108572 109065   
108573 109066   /* Recompute the colNotIdxed field of the Index.
108574 109067   **
108575 109068   ** colNotIdxed is a bitmask that has a 0 bit representing each indexed
108576 109069   ** columns that are within the first 63 columns of the table.  The
................................................................................
108651 109144     if( pTab->iPKey>=0 ){
108652 109145       ExprList *pList;
108653 109146       Token ipkToken;
108654 109147       sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName);
108655 109148       pList = sqlite3ExprListAppend(pParse, 0, 
108656 109149                     sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0));
108657 109150       if( pList==0 ) return;
       109151  +    if( IN_RENAME_OBJECT ){
       109152  +      sqlite3RenameTokenRemap(pParse, pList->a[0].pExpr, &pTab->iPKey);
       109153  +    }
108658 109154       pList->a[0].sortOrder = pParse->iPkSortOrder;
108659 109155       assert( pParse->pNewTable==pTab );
       109156  +    pTab->iPKey = -1;
108660 109157       sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0,
108661 109158                          SQLITE_IDXTYPE_PRIMARYKEY);
108662 109159       if( db->mallocFailed || pParse->nErr ) return;
108663 109160       pPk = sqlite3PrimaryKeyIndex(pTab);
108664         -    pTab->iPKey = -1;
108665 109161     }else{
108666 109162       pPk = sqlite3PrimaryKeyIndex(pTab);
108667 109163       assert( pPk!=0 );
108668 109164   
108669 109165       /*
108670 109166       ** Remove all redundant columns from the PRIMARY KEY.  For example, change
108671 109167       ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)".  Later
108672 109168       ** code assumes the PRIMARY KEY contains no repeated columns.
108673 109169       */
108674 109170       for(i=j=1; i<pPk->nKeyCol; i++){
108675         -      if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){
       109171  +      if( isDupColumn(pPk, j, pPk, i) ){
108676 109172           pPk->nColumn--;
108677 109173         }else{
       109174  +        testcase( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) );
108678 109175           pPk->aiColumn[j++] = pPk->aiColumn[i];
108679 109176         }
108680 109177       }
108681 109178       pPk->nKeyCol = j;
108682 109179     }
108683 109180     assert( pPk!=0 );
108684 109181     pPk->isCovering = 1;
................................................................................
108700 109197     /* Update the in-memory representation of all UNIQUE indices by converting
108701 109198     ** the final rowid column into one or more columns of the PRIMARY KEY.
108702 109199     */
108703 109200     for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
108704 109201       int n;
108705 109202       if( IsPrimaryKeyIndex(pIdx) ) continue;
108706 109203       for(i=n=0; i<nPk; i++){
108707         -      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  +      }
108708 109208       }
108709 109209       if( n==0 ){
108710 109210         /* This index is a superset of the primary key */
108711 109211         pIdx->nColumn = pIdx->nKeyCol;
108712 109212         continue;
108713 109213       }
108714 109214       if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return;
108715 109215       for(i=0, j=pIdx->nKeyCol; i<nPk; i++){
108716         -      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]) );
108717 109218           pIdx->aiColumn[j] = pPk->aiColumn[i];
108718 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  +        }
108719 109224           j++;
108720 109225         }
108721 109226       }
108722 109227       assert( pIdx->nColumn>=pIdx->nKeyCol+n );
108723 109228       assert( pIdx->nColumn>=j );
108724 109229     }
108725 109230   
................................................................................
109830 110335       addr2 = sqlite3VdbeCurrentAddr(v);
109831 110336       sqlite3VdbeVerifyAbortable(v, OE_Abort);
109832 110337       sqlite3VdbeAddOp4Int(v, OP_SorterCompare, iSorter, j2, regRecord,
109833 110338                            pIndex->nKeyCol); VdbeCoverage(v);
109834 110339       sqlite3UniqueConstraint(pParse, OE_Abort, pIndex);
109835 110340       sqlite3VdbeJumpHere(v, j2);
109836 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);
109837 110350       addr2 = sqlite3VdbeCurrentAddr(v);
109838 110351     }
109839 110352     sqlite3VdbeAddOp3(v, OP_SorterData, iSorter, regRecord, iIdx);
109840         -  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  +  }
109841 110363     sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord);
109842 110364     sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
109843 110365     sqlite3ReleaseTempReg(pParse, regRecord);
109844 110366     sqlite3VdbeAddOp2(v, OP_SorterNext, iSorter, addr2); VdbeCoverage(v);
109845 110367     sqlite3VdbeJumpHere(v, addr1);
109846 110368   
109847 110369     sqlite3VdbeAddOp1(v, OP_Close, iTab);
................................................................................
110225 110747     ** tables (when pPk!=0) this will be the declared PRIMARY KEY.  For
110226 110748     ** normal tables (when pPk==0) this will be the rowid.
110227 110749     */
110228 110750     if( pPk ){
110229 110751       for(j=0; j<pPk->nKeyCol; j++){
110230 110752         int x = pPk->aiColumn[j];
110231 110753         assert( x>=0 );
110232         -      if( hasColumn(pIndex->aiColumn, pIndex->nKeyCol, x) ){
       110754  +      if( isDupColumn(pIndex, pIndex->nKeyCol, pPk, j) ){
110233 110755           pIndex->nColumn--; 
110234 110756         }else{
       110757  +        testcase( hasColumn(pIndex->aiColumn,pIndex->nKeyCol,x) );
110235 110758           pIndex->aiColumn[i] = x;
110236 110759           pIndex->azColl[i] = pPk->azColl[j];
110237 110760           pIndex->aSortOrder[i] = pPk->aSortOrder[j];
110238 110761           i++;
110239 110762         }
110240 110763       }
110241 110764       assert( i==pIndex->nColumn );
................................................................................
112998 113521   ** This file contains the C-language implementations for many of the SQL
112999 113522   ** functions of SQLite.  (Some function, and in particular the date and
113000 113523   ** time functions, are implemented separately.)
113001 113524   */
113002 113525   /* #include "sqliteInt.h" */
113003 113526   /* #include <stdlib.h> */
113004 113527   /* #include <assert.h> */
       113528  +/* #include <math.h> */
113005 113529   /* #include "vdbeInt.h" */
113006 113530   
113007 113531   /*
113008 113532   ** Return the collating function associated with a function.
113009 113533   */
113010 113534   static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){
113011 113535     VdbeOp *pOp;
................................................................................
113368 113892     }
113369 113893     if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
113370 113894     r = sqlite3_value_double(argv[0]);
113371 113895     /* If Y==0 and X will fit in a 64-bit int,
113372 113896     ** handle the rounding directly,
113373 113897     ** otherwise use printf.
113374 113898     */
113375         -  if( n==0 && r>=0 && r<LARGEST_INT64-1 ){
113376         -    r = (double)((sqlite_int64)(r+0.5));
113377         -  }else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){
113378         -    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)));
113379 113903     }else{
113380 113904       zBuf = sqlite3_mprintf("%.*f",n,r);
113381 113905       if( zBuf==0 ){
113382 113906         sqlite3_result_error_nomem(context);
113383 113907         return;
113384 113908       }
113385 113909       sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8);
................................................................................
113825 114349   #ifdef SQLITE_TEST
113826 114350       sqlite3_like_count++;
113827 114351   #endif
113828 114352       sqlite3_result_int(context, 0);
113829 114353       return;
113830 114354     }
113831 114355   #endif
113832         -  zB = sqlite3_value_text(argv[0]);
113833         -  zA = sqlite3_value_text(argv[1]);
113834 114356   
113835 114357     /* Limit the length of the LIKE or GLOB pattern to avoid problems
113836 114358     ** of deep recursion and N*N behavior in patternCompare().
113837 114359     */
113838 114360     nPat = sqlite3_value_bytes(argv[0]);
113839 114361     testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] );
113840 114362     testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]+1 );
113841 114363     if( nPat > db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ){
113842 114364       sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1);
113843 114365       return;
113844 114366     }
113845         -  assert( zB==sqlite3_value_text(argv[0]) );  /* Encoding did not change */
113846         -
113847 114367     if( argc==3 ){
113848 114368       /* The escape character string must consist of a single UTF-8 character.
113849 114369       ** Otherwise, return an error.
113850 114370       */
113851 114371       const unsigned char *zEsc = sqlite3_value_text(argv[2]);
113852 114372       if( zEsc==0 ) return;
113853 114373       if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){
................................................................................
113855 114375             "ESCAPE expression must be a single character", -1);
113856 114376         return;
113857 114377       }
113858 114378       escape = sqlite3Utf8Read(&zEsc);
113859 114379     }else{
113860 114380       escape = pInfo->matchSet;
113861 114381     }
       114382  +  zB = sqlite3_value_text(argv[0]);
       114383  +  zA = sqlite3_value_text(argv[1]);
113862 114384     if( zA && zB ){
113863 114385   #ifdef SQLITE_TEST
113864 114386       sqlite3_like_count++;
113865 114387   #endif
113866 114388       sqlite3_result_int(context,
113867 114389                         patternCompare(zB, zA, pInfo, escape)==SQLITE_MATCH);
113868 114390     }
................................................................................
114780 115302     assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );
114781 115303     if( rc==SQLITE_NOMEM ){
114782 115304       sqlite3OomFault(db);
114783 115305     }
114784 115306   }
114785 115307   
114786 115308   /*
114787         -** Set the LIKEOPT flag on the 2-argument function with the given name.
114788         -*/
114789         -static void setLikeOptFlag(sqlite3 *db, const char *zName, u8 flagVal){
114790         -  FuncDef *pDef;
114791         -  pDef = sqlite3FindFunction(db, zName, 2, SQLITE_UTF8, 0);
114792         -  if( ALWAYS(pDef) ){
114793         -    pDef->funcFlags |= flagVal;
114794         -  }
114795         -  pDef = sqlite3FindFunction(db, zName, 3, SQLITE_UTF8, 0);
114796         -  if( pDef ){
114797         -    pDef->funcFlags |= flagVal;
114798         -  }
114799         -}
114800         -
114801         -/*
114802         -** Register the built-in LIKE and GLOB functions.  The caseSensitive
       115309  +** Re-register the built-in LIKE functions.  The caseSensitive
114803 115310   ** parameter determines whether or not the LIKE operator is case
114804         -** sensitive.  GLOB is always case sensitive.
       115311  +** sensitive.
114805 115312   */
114806 115313   SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){
114807 115314     struct compareInfo *pInfo;
       115315  +  int flags;
114808 115316     if( caseSensitive ){
114809 115317       pInfo = (struct compareInfo*)&likeInfoAlt;
       115318  +    flags = SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE;
114810 115319     }else{
114811 115320       pInfo = (struct compareInfo*)&likeInfoNorm;
       115321  +    flags = SQLITE_FUNC_LIKE;
114812 115322     }
114813 115323     sqlite3CreateFunc(db, "like", 2, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0, 0, 0);
114814 115324     sqlite3CreateFunc(db, "like", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0, 0, 0);
114815         -  sqlite3CreateFunc(db, "glob", 2, SQLITE_UTF8, 
114816         -      (struct compareInfo*)&globInfo, likeFunc, 0, 0, 0, 0, 0);
114817         -  setLikeOptFlag(db, "glob", SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE);
114818         -  setLikeOptFlag(db, "like", 
114819         -      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;
114820 115327   }
114821 115328   
114822 115329   /*
114823 115330   ** pExpr points to an expression which implements a function.  If
114824 115331   ** it is appropriate to apply the LIKE optimization to that function
114825 115332   ** then set aWc[0] through aWc[2] to the wildcard characters and the
114826 115333   ** escape character and then return TRUE.  If the function is not a 
................................................................................
115602 116109       iCol = pIdx ? pIdx->aiColumn[i] : -1;
115603 116110       pLeft = exprTableRegister(pParse, pTab, regData, iCol);
115604 116111       iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;
115605 116112       assert( iCol>=0 );
115606 116113       zCol = pFKey->pFrom->aCol[iCol].zName;
115607 116114       pRight = sqlite3Expr(db, TK_ID, zCol);
115608 116115       pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight);
115609         -    pWhere = sqlite3ExprAnd(db, pWhere, pEq);
       116116  +    pWhere = sqlite3ExprAnd(pParse, pWhere, pEq);
115610 116117     }
115611 116118   
115612 116119     /* If the child table is the same as the parent table, then add terms
115613 116120     ** to the WHERE clause that prevent this entry from being scanned.
115614 116121     ** The added WHERE clause terms are like this:
115615 116122     **
115616 116123     **     $current_rowid!=rowid
................................................................................
115636 116143         assert( pIdx!=0 );
115637 116144         for(i=0; i<pIdx->nKeyCol; i++){
115638 116145           i16 iCol = pIdx->aiColumn[i];
115639 116146           assert( iCol>=0 );
115640 116147           pLeft = exprTableRegister(pParse, pTab, regData, iCol);
115641 116148           pRight = sqlite3Expr(db, TK_ID, pTab->aCol[iCol].zName);
115642 116149           pEq = sqlite3PExpr(pParse, TK_IS, pLeft, pRight);
115643         -        pAll = sqlite3ExprAnd(db, pAll, pEq);
       116150  +        pAll = sqlite3ExprAnd(pParse, pAll, pEq);
115644 116151         }
115645 116152         pNe = sqlite3PExpr(pParse, TK_NOT, pAll, 0);
115646 116153       }
115647         -    pWhere = sqlite3ExprAnd(db, pWhere, pNe);
       116154  +    pWhere = sqlite3ExprAnd(pParse, pWhere, pNe);
115648 116155     }
115649 116156   
115650 116157     /* Resolve the references in the WHERE clause. */
115651 116158     memset(&sNameContext, 0, sizeof(NameContext));
115652 116159     sNameContext.pSrcList = pSrc;
115653 116160     sNameContext.pParse = pParse;
115654 116161     sqlite3ResolveExprNames(&sNameContext, pWhere);
................................................................................
116246 116753         ** parent table are used for the comparison. */
116247 116754         pEq = sqlite3PExpr(pParse, TK_EQ,
116248 116755             sqlite3PExpr(pParse, TK_DOT, 
116249 116756               sqlite3ExprAlloc(db, TK_ID, &tOld, 0),
116250 116757               sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)),
116251 116758             sqlite3ExprAlloc(db, TK_ID, &tFromCol, 0)
116252 116759         );
116253         -      pWhere = sqlite3ExprAnd(db, pWhere, pEq);
       116760  +      pWhere = sqlite3ExprAnd(pParse, pWhere, pEq);
116254 116761   
116255 116762         /* For ON UPDATE, construct the next term of the WHEN clause.
116256 116763         ** The final WHEN clause will be like this:
116257 116764         **
116258 116765         **    WHEN NOT(old.col1 IS new.col1 AND ... AND old.colN IS new.colN)
116259 116766         */
116260 116767         if( pChanges ){
................................................................................
116262 116769               sqlite3PExpr(pParse, TK_DOT, 
116263 116770                 sqlite3ExprAlloc(db, TK_ID, &tOld, 0),
116264 116771                 sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)),
116265 116772               sqlite3PExpr(pParse, TK_DOT, 
116266 116773                 sqlite3ExprAlloc(db, TK_ID, &tNew, 0),
116267 116774                 sqlite3ExprAlloc(db, TK_ID, &tToCol, 0))
116268 116775               );
116269         -        pWhen = sqlite3ExprAnd(db, pWhen, pEq);
       116776  +        pWhen = sqlite3ExprAnd(pParse, pWhen, pEq);
116270 116777         }
116271 116778     
116272 116779         if( action!=OE_Restrict && (action!=OE_Cascade || pChanges) ){
116273 116780           Expr *pNew;
116274 116781           if( action==OE_Cascade ){
116275 116782             pNew = sqlite3PExpr(pParse, TK_DOT, 
116276 116783               sqlite3ExprAlloc(db, TK_ID, &tNew, 0),
................................................................................
117259 117766     }
117260 117767   
117261 117768     /* If this is not a view, open the table and and all indices */
117262 117769     if( !isView ){
117263 117770       int nIdx;
117264 117771       nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, -1, 0,
117265 117772                                         &iDataCur, &iIdxCur);
117266         -    aRegIdx = sqlite3DbMallocRawNN(db, sizeof(int)*(nIdx+1));
       117773  +    aRegIdx = sqlite3DbMallocRawNN(db, sizeof(int)*(nIdx+2));
117267 117774       if( aRegIdx==0 ){
117268 117775         goto insert_cleanup;
117269 117776       }
117270 117777       for(i=0, pIdx=pTab->pIndex; i<nIdx; pIdx=pIdx->pNext, i++){
117271 117778         assert( pIdx );
117272 117779         aRegIdx[i] = ++pParse->nMem;
117273 117780         pParse->nMem += pIdx->nColumn;
117274 117781       }
       117782  +    aRegIdx[i] = ++pParse->nMem;  /* Register to store the table record */
117275 117783     }
117276 117784   #ifndef SQLITE_OMIT_UPSERT
117277 117785     if( pUpsert ){
117278 117786       if( IsVirtual(pTab) ){
117279 117787         sqlite3ErrorMsg(pParse, "UPSERT not implemented for virtual table \"%s\"",
117280 117788                 pTab->zName);
117281 117789         goto insert_cleanup;
................................................................................
117670 118178   ** value for either the rowid column or its INTEGER PRIMARY KEY alias.
117671 118179   **
117672 118180   ** The code generated by this routine will store new index entries into
117673 118181   ** registers identified by aRegIdx[].  No index entry is created for
117674 118182   ** indices where aRegIdx[i]==0.  The order of indices in aRegIdx[] is
117675 118183   ** the same as the order of indices on the linked list of indices
117676 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.
117677 118193   **
117678 118194   ** The caller must have already opened writeable cursors on the main
117679 118195   ** table and all applicable indices (that is to say, all indices for which
117680 118196   ** aRegIdx[] is not zero).  iDataCur is the cursor for the main table when
117681 118197   ** inserting or updating a rowid table, or the cursor for the PRIMARY KEY
117682 118198   ** index when operating on a WITHOUT ROWID table.  iIdxCur is the cursor
117683 118199   ** for the first index in the pTab->pIndex list.  Cursors for other indices
................................................................................
117861 118377         sqlite3VdbeVerifyAbortable(v, onError);
117862 118378         sqlite3ExprIfTrue(pParse, pExpr, allOk, SQLITE_JUMPIFNULL);
117863 118379         if( onError==OE_Ignore ){
117864 118380           sqlite3VdbeGoto(v, ignoreDest);
117865 118381         }else{
117866 118382           char *zName = pCheck->a[i].zName;
117867 118383           if( zName==0 ) zName = pTab->zName;
117868         -        if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */
       118384  +        if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-26383-51744 */
117869 118385           sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK,
117870 118386                                 onError, zName, P4_TRANSIENT,
117871 118387                                 P5_ConstraintCheck);
117872 118388         }
117873 118389         sqlite3VdbeResolveLabel(v, allOk);
117874 118390       }
117875 118391       pParse->iSelfTab = 0;
................................................................................
118289 118805   
118290 118806     /* If the IPK constraint is a REPLACE, run it last */
118291 118807     if( ipkTop ){
118292 118808       sqlite3VdbeGoto(v, ipkTop);
118293 118809       VdbeComment((v, "Do IPK REPLACE"));
118294 118810       sqlite3VdbeJumpHere(v, ipkBottom);
118295 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  +  }
118296 118822   
118297 118823     *pbMayReplace = seenReplace;
118298 118824     VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace));
118299 118825   }
118300 118826   
118301 118827   #ifdef SQLITE_ENABLE_NULL_TRIM
118302 118828   /*
................................................................................
118339 118865     int update_flags,   /* True for UPDATE, False for INSERT */
118340 118866     int appendBias,     /* True if this is likely to be an append */
118341 118867     int useSeekResult   /* True to set the USESEEKRESULT flag on OP_[Idx]Insert */
118342 118868   ){
118343 118869     Vdbe *v;            /* Prepared statements under construction */
118344 118870     Index *pIdx;        /* An index being inserted or updated */
118345 118871     u8 pik_flags;       /* flag values passed to the btree insert */
118346         -  int regData;        /* Content registers (after the rowid) */
118347         -  int regRec;         /* Register holding assembled record for the table */
118348 118872     int i;              /* Loop counter */
118349         -  u8 bAffinityDone = 0; /* True if OP_Affinity has been run already */
118350 118873   
118351 118874     assert( update_flags==0
118352 118875          || update_flags==OPFLAG_ISUPDATE
118353 118876          || update_flags==(OPFLAG_ISUPDATE|OPFLAG_SAVEPOSITION)
118354 118877     );
118355 118878   
118356 118879     v = sqlite3GetVdbe(pParse);
118357 118880     assert( v!=0 );
118358 118881     assert( pTab->pSelect==0 );  /* This table is not a VIEW */
118359 118882     for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
118360 118883       if( aRegIdx[i]==0 ) continue;
118361         -    bAffinityDone = 1;
118362 118884       if( pIdx->pPartIdxWhere ){
118363 118885         sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
118364 118886         VdbeCoverage(v);
118365 118887       }
118366 118888       pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
118367 118889       if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
118368 118890         assert( pParse->nested==0 );
................................................................................
118382 118904       }
118383 118905       sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
118384 118906                            aRegIdx[i]+1,
118385 118907                            pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn);
118386 118908       sqlite3VdbeChangeP5(v, pik_flags);
118387 118909     }
118388 118910     if( !HasRowid(pTab) ) return;
118389         -  regData = regNewData + 1;
118390         -  regRec = sqlite3GetTempReg(pParse);
118391         -  sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);
118392         -  sqlite3SetMakeRecordP5(v, pTab);
118393         -  if( !bAffinityDone ){
118394         -    sqlite3TableAffinity(v, pTab, 0);
118395         -  }
118396 118911     if( pParse->nested ){
118397 118912       pik_flags = 0;
118398 118913     }else{
118399 118914       pik_flags = OPFLAG_NCHANGE;
118400 118915       pik_flags |= (update_flags?update_flags:OPFLAG_LASTROWID);
118401 118916     }
118402 118917     if( appendBias ){
118403 118918       pik_flags |= OPFLAG_APPEND;
118404 118919     }
118405 118920     if( useSeekResult ){
118406 118921       pik_flags |= OPFLAG_USESEEKRESULT;
118407 118922     }
118408         -  sqlite3VdbeAddOp3(v, OP_Insert, iDataCur, regRec, regNewData);
       118923  +  sqlite3VdbeAddOp3(v, OP_Insert, iDataCur, aRegIdx[i], regNewData);
118409 118924     if( !pParse->nested ){
118410 118925       sqlite3VdbeAppendP4(v, pTab, P4_TABLE);
118411 118926     }
118412 118927     sqlite3VdbeChangeP5(v, pik_flags);
118413 118928   }
118414 118929   
118415 118930   /*
................................................................................
120587 121102   #define PragTyp_TABLE_INFO                    34
120588 121103   #define PragTyp_TEMP_STORE                    35
120589 121104   #define PragTyp_TEMP_STORE_DIRECTORY          36
120590 121105   #define PragTyp_THREADS                       37
120591 121106   #define PragTyp_WAL_AUTOCHECKPOINT            38
120592 121107   #define PragTyp_WAL_CHECKPOINT                39
120593 121108   #define PragTyp_ACTIVATE_EXTENSIONS           40
120594         -#define PragTyp_HEXKEY                        41
120595         -#define PragTyp_KEY                           42
120596         -#define PragTyp_LOCK_STATUS                   43
120597         -#define PragTyp_STATS                         44
       121109  +#define PragTyp_KEY                           41
       121110  +#define PragTyp_LOCK_STATUS                   42
       121111  +#define PragTyp_STATS                         43
120598 121112   
120599 121113   /* Property flags associated with various pragma. */
120600 121114   #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
120601 121115   #define PragFlg_NoColumns  0x02 /* OP_ResultRow called with zero columns */
120602 121116   #define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
120603 121117   #define PragFlg_ReadOnly   0x08 /* Read-only HEADER_VALUE */
120604 121118   #define PragFlg_Result0    0x10 /* Acts as query when no argument */
................................................................................
120719 121233   #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
120720 121234    {/* zName:     */ "cache_spill",
120721 121235     /* ePragTyp:  */ PragTyp_CACHE_SPILL,
120722 121236     /* ePragFlg:  */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
120723 121237     /* ColNames:  */ 0, 0,
120724 121238     /* iArg:      */ 0 },
120725 121239   #endif
       121240  +#if !defined(SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA)
120726 121241    {/* zName:     */ "case_sensitive_like",
120727 121242     /* ePragTyp:  */ PragTyp_CASE_SENSITIVE_LIKE,
120728 121243     /* ePragFlg:  */ PragFlg_NoColumns,
120729 121244     /* ColNames:  */ 0, 0,
120730 121245     /* iArg:      */ 0 },
       121246  +#endif
120731 121247    {/* zName:     */ "cell_size_check",
120732 121248     /* ePragTyp:  */ PragTyp_FLAG,
120733 121249     /* ePragFlg:  */ PragFlg_Result0|PragFlg_NoColumns1,
120734 121250     /* ColNames:  */ 0, 0,
120735 121251     /* iArg:      */ SQLITE_CellSizeCk },
120736 121252   #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
120737 121253    {/* zName:     */ "checkpoint_fullfsync",
................................................................................
120861 121377     /* ePragFlg:  */ PragFlg_Result0,
120862 121378     /* ColNames:  */ 41, 2,
120863 121379     /* iArg:      */ 0 },
120864 121380   #endif
120865 121381   #endif
120866 121382   #if defined(SQLITE_HAS_CODEC)
120867 121383    {/* zName:     */ "hexkey",
120868         -  /* ePragTyp:  */ PragTyp_HEXKEY,
       121384  +  /* ePragTyp:  */ PragTyp_KEY,
120869 121385     /* ePragFlg:  */ 0,
120870 121386     /* ColNames:  */ 0, 0,
120871 121387     /* iArg:      */ 2 },
120872 121388    {/* zName:     */ "hexrekey",
120873         -  /* ePragTyp:  */ PragTyp_HEXKEY,
       121389  +  /* ePragTyp:  */ PragTyp_KEY,
120874 121390     /* ePragFlg:  */ 0,
120875 121391     /* ColNames:  */ 0, 0,
120876 121392     /* iArg:      */ 3 },
120877 121393   #endif
120878 121394   #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
120879 121395   #if !defined(SQLITE_OMIT_CHECK)
120880 121396    {/* zName:     */ "ignore_check_constraints",
................................................................................
121827 122343           if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break;
121828 122344         }
121829 122345         if( !zMode ){
121830 122346           /* If the "=MODE" part does not match any known journal mode,
121831 122347           ** then do a query */
121832 122348           eMode = PAGER_JOURNALMODE_QUERY;
121833 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  +      }
121834 122355       }
121835 122356       if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){
121836 122357         /* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */
121837 122358         iDb = 0;
121838 122359         pId2->n = 1;
121839 122360       }
121840 122361       for(ii=db->nDb-1; ii>=0; ii--){
................................................................................
122604 123125         sqlite3VdbeJumpHere(v, addrTop);
122605 123126       }
122606 123127     }
122607 123128     break;
122608 123129   #endif /* !defined(SQLITE_OMIT_TRIGGER) */
122609 123130   #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
122610 123131   
       123132  +#ifndef SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA
122611 123133     /* Reinstall the LIKE and GLOB functions.  The variant of LIKE
122612 123134     ** used will be case sensitive or not depending on the RHS.
122613 123135     */
122614 123136     case PragTyp_CASE_SENSITIVE_LIKE: {
122615 123137       if( zRight ){
122616 123138         sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0));
122617 123139       }
122618 123140     }
122619 123141     break;
       123142  +#endif /* SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA */
122620 123143   
122621 123144   #ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX
122622 123145   # define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100
122623 123146   #endif
122624 123147   
122625 123148   #ifndef SQLITE_OMIT_INTEGRITY_CHECK
122626 123149     /*    PRAGMA integrity_check
................................................................................
123306 123829     **  hexkey        2
123307 123830     **  hexrekey      3
123308 123831     **  textkey       4
123309 123832     **  textrekey     5
123310 123833     */
123311 123834     case PragTyp_KEY: {
123312 123835       if( zRight ){
123313         -      int n = pPragma->iArg<4 ? sqlite3Strlen30(zRight) : -1;
123314         -      if( (pPragma->iArg & 1)==0 ){
123315         -        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;
123316 123848         }else{
123317         -        sqlite3_rekey_v2(db, zDb, zRight, n);
123318         -      }
123319         -    }
123320         -    break;
123321         -  }
123322         -  case PragTyp_HEXKEY: {
123323         -    if( zRight ){
123324         -      u8 iByte;
123325         -      int i;
123326         -      char zKey[40];
123327         -      for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zRight[i]); i++){
123328         -        iByte = (iByte<<4) + sqlite3HexToInt(zRight[i]);
123329         -        if( (i&1)!=0 ) zKey[i/2] = iByte;
       123849  +        n = pPragma->iArg<4 ? sqlite3Strlen30(zRight) : -1;
123330 123850         }
123331 123851         if( (pPragma->iArg & 1)==0 ){
123332         -        sqlite3_key_v2(db, zDb, zKey, i/2);
       123852  +        rc = sqlite3_key_v2(db, zDb, zKey, n);
123333 123853         }else{
123334         -        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");
123335 123860         }
123336 123861       }
123337 123862       break;
123338 123863     }
123339 123864   #endif
123340 123865   #if defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD)
123341 123866     case PragTyp_ACTIVATE_EXTENSIONS: if( zRight ){
................................................................................
124968 125493     pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2);
124969 125494     if( pEq && isOuterJoin ){
124970 125495       ExprSetProperty(pEq, EP_FromJoin);
124971 125496       assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) );
124972 125497       ExprSetVVAProperty(pEq, EP_NoReduce);
124973 125498       pEq->iRightJoinTable = (i16)pE2->iTable;
124974 125499     }
124975         -  *ppWhere = sqlite3ExprAnd(db, *ppWhere, pEq);
       125500  +  *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq);
124976 125501   }
124977 125502   
124978 125503   /*
124979 125504   ** Set the EP_FromJoin property on all terms of the given expression.
124980 125505   ** And set the Expr.iRightJoinTable to iTable for every term in the
124981 125506   ** expression.
124982 125507   **
................................................................................
125102 125627       }
125103 125628   
125104 125629       /* Add the ON clause to the end of the WHERE clause, connected by
125105 125630       ** an AND operator.
125106 125631       */
125107 125632       if( pRight->pOn ){
125108 125633         if( isOuter ) setJoinExpr(pRight->pOn, pRight->iCursor);
125109         -      p->pWhere = sqlite3ExprAnd(pParse->db, p->pWhere, pRight->pOn);
       125634  +      p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pRight->pOn);
125110 125635         pRight->pOn = 0;
125111 125636       }
125112 125637   
125113 125638       /* Create extra terms on the WHERE clause for each column named
125114 125639       ** in the USING clause.  Example: If the two tables to be joined are 
125115 125640       ** A and B and the USING clause names X, Y, and Z, then add this
125116 125641       ** to the WHERE clause:    A.X=B.X AND A.Y=B.Y AND A.Z=B.Z
................................................................................
126709 127234     db->flags = savedFlags;
126710 127235     if( pParse->nErr ) return 0;
126711 127236     while( pSelect->pPrior ) pSelect = pSelect->pPrior;
126712 127237     pTab = sqlite3DbMallocZero(db, sizeof(Table) );
126713 127238     if( pTab==0 ){
126714 127239       return 0;
126715 127240     }
126716         -  /* The sqlite3ResultSetOfSelect() is only used n contexts where lookaside
126717         -  ** is disabled */
126718         -  assert( db->lookaside.bDisable );
126719 127241     pTab->nTabRef = 1;
126720 127242     pTab->zName = 0;
126721 127243     pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
126722 127244     sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);
126723 127245     sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSelect);
126724 127246     pTab->iPKey = -1;
126725 127247     if( db->mallocFailed ){
................................................................................
127153 127675     sqlite3 *db;          /* Database connection */
127154 127676   
127155 127677     /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs.  Only
127156 127678     ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.
127157 127679     */
127158 127680     assert( p && p->pPrior );  /* Calling function guarantees this much */
127159 127681     assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION );
       127682  +  assert( p->selFlags & SF_Compound );
127160 127683     db = pParse->db;
127161 127684     pPrior = p->pPrior;
127162 127685     dest = *pDest;
127163 127686     if( pPrior->pOrderBy || pPrior->pLimit ){
127164 127687       sqlite3ErrorMsg(pParse,"%s clause should come after %s not before",
127165 127688         pPrior->pOrderBy!=0 ? "ORDER BY" : "LIMIT", selectOpName(p->op));
127166 127689       rc = 1;
................................................................................
128647 129170         pSub->pOrderBy = 0;
128648 129171       }
128649 129172       pWhere = pSub->pWhere;
128650 129173       pSub->pWhere = 0;
128651 129174       if( isLeftJoin>0 ){
128652 129175         setJoinExpr(pWhere, iNewParent);
128653 129176       }
128654         -    pParent->pWhere = sqlite3ExprAnd(db, pWhere, pParent->pWhere);
       129177  +    pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere);
128655 129178       if( db->mallocFailed==0 ){
128656 129179         SubstContext x;
128657 129180         x.pParse = pParse;
128658 129181         x.iTable = iParent;
128659 129182         x.iNewTable = iNewParent;
128660 129183         x.isLeftJoin = isLeftJoin;
128661 129184         x.pEList = pSub->pEList;
128662 129185         substSelect(&x, pParent, 0);
128663 129186       }
128664 129187     
128665         -    /* The flattened query is distinct if either the inner or the
128666         -    ** outer query is distinct. 
128667         -    */
128668         -    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) */
128669 129192     
128670 129193       /*
128671 129194       ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;
128672 129195       **
128673 129196       ** One is tempted to try to add a and b to combine the limits.  But this
128674 129197       ** does not work if either limit is negative.
128675 129198       */
................................................................................
128982 129505         x.pParse = pParse;
128983 129506         x.iTable = iCursor;
128984 129507         x.iNewTable = iCursor;
128985 129508         x.isLeftJoin = 0;
128986 129509         x.pEList = pSubq->pEList;
128987 129510         pNew = substExpr(&x, pNew);
128988 129511         if( pSubq->selFlags & SF_Aggregate ){
128989         -        pSubq->pHaving = sqlite3ExprAnd(pParse->db, pSubq->pHaving, pNew);
       129512  +        pSubq->pHaving = sqlite3ExprAnd(pParse, pSubq->pHaving, pNew);
128990 129513         }else{
128991         -        pSubq->pWhere = sqlite3ExprAnd(pParse->db, pSubq->pWhere, pNew);
       129514  +        pSubq->pWhere = sqlite3ExprAnd(pParse, pSubq->pWhere, pNew);
128992 129515         }
128993 129516         pSubq = pSubq->pPrior;
128994 129517       }
128995 129518     }
128996 129519     return nChng;
128997 129520   }
128998 129521   #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
................................................................................
129410 129933     }
129411 129934     while( pSel->pPrior ){ pSel = pSel->pPrior; }
129412 129935     sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol);
129413 129936     pTab->iPKey = -1;
129414 129937     pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
129415 129938     pTab->tabFlags |= TF_Ephemeral;
129416 129939   
129417         -  return SQLITE_OK;
       129940  +  return pParse->nErr ? SQLITE_ERROR : SQLITE_OK;
129418 129941   }
129419 129942   
129420 129943   /*
129421 129944   ** This routine is a Walker callback for "expanding" a SELECT statement.
129422 129945   ** "Expanding" means to do the following:
129423 129946   **
129424 129947   **    (1)  Make sure VDBE cursor numbers have been assigned to every
................................................................................
129456 129979     if( db->mallocFailed  ){
129457 129980       return WRC_Abort;
129458 129981     }
129459 129982     assert( p->pSrc!=0 );
129460 129983     if( (selFlags & SF_Expanded)!=0 ){
129461 129984       return WRC_Prune;
129462 129985     }
       129986  +  if( pWalker->eCode ){
       129987  +    /* Renumber selId because it has been copied from a view */
       129988  +    p->selId = ++pParse->nSelect;
       129989  +  }
129463 129990     pTabList = p->pSrc;
129464 129991     pEList = p->pEList;
129465 129992     sqlite3WithPush(pParse, p->pWith, 0);
129466 129993   
129467 129994     /* Make sure cursor numbers have been assigned to all entries in
129468 129995     ** the FROM clause of the SELECT statement.
129469 129996     */
................................................................................
129505 130032         pTab->nTabRef++;
129506 130033         if( !IsVirtual(pTab) && cannotBeFunction(pParse, pFrom) ){
129507 130034           return WRC_Abort;
129508 130035         }
129509 130036   #if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE)
129510 130037         if( IsVirtual(pTab) || pTab->pSelect ){
129511 130038           i16 nCol;
       130039  +        u8 eCodeOrig = pWalker->eCode;
129512 130040           if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort;
129513 130041           assert( pFrom->pSelect==0 );
129514 130042           pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0);
129515 130043           nCol = pTab->nCol;
129516 130044           pTab->nCol = -1;
       130045  +        pWalker->eCode = 1;  /* Turn on Select.selId renumbering */
129517 130046           sqlite3WalkSelect(pWalker, pFrom->pSelect);
       130047  +        pWalker->eCode = eCodeOrig;
129518 130048           pTab->nCol = nCol;
129519 130049         }
129520 130050   #endif
129521 130051       }
129522 130052   
129523 130053       /* Locate the index named by the INDEXED BY clause, if any. */
129524 130054       if( sqlite3IndexedByLookup(pParse, pFrom) ){
................................................................................
129760 130290     if( OK_IF_ALWAYS_TRUE(pParse->hasCompound) ){
129761 130291       w.xSelectCallback = convertCompoundSelectToSubquery;
129762 130292       w.xSelectCallback2 = 0;
129763 130293       sqlite3WalkSelect(&w, pSelect);
129764 130294     }
129765 130295     w.xSelectCallback = selectExpander;
129766 130296     w.xSelectCallback2 = selectPopWith;
       130297  +  w.eCode = 0;
129767 130298     sqlite3WalkSelect(&w, pSelect);
129768 130299   }
129769 130300   
129770 130301   
129771 130302   #ifndef SQLITE_OMIT_SUBQUERY
129772 130303   /*
129773 130304   ** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo()
................................................................................
130031 130562       Select *pS = pWalker->u.pSelect;
130032 130563       if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){
130033 130564         sqlite3 *db = pWalker->pParse->db;
130034 130565         Expr *pNew = sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[1], 0);
130035 130566         if( pNew ){
130036 130567           Expr *pWhere = pS->pWhere;
130037 130568           SWAP(Expr, *pNew, *pExpr);
130038         -        pNew = sqlite3ExprAnd(db, pWhere, pNew);
       130569  +        pNew = sqlite3ExprAnd(pWalker->pParse, pWhere, pNew);
130039 130570           pS->pWhere = pNew;
130040 130571           pWalker->eCode = 1;
130041 130572         }
130042 130573       }
130043 130574       return WRC_Prune;
130044 130575     }
130045 130576     return WRC_Continue;
................................................................................
130086 130617   ){
130087 130618     struct SrcList_item *pItem;
130088 130619     for(pItem = pTabList->a; pItem<pThis; pItem++){
130089 130620       Select *pS1;
130090 130621       if( pItem->pSelect==0 ) continue;
130091 130622       if( pItem->fg.viaCoroutine ) continue;
130092 130623       if( pItem->zName==0 ) continue;
130093         -    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;
130094 130627       if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue;
130095 130628       pS1 = pItem->pSelect;
130096         -    if( pThis->pSelect->selId!=pS1->selId ){
       130629  +    if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){
130097 130630         /* The query flattener left two different CTE tables with identical
130098 130631         ** names in the same FROM clause. */
130099 130632         continue;
130100 130633       }
130101         -    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  +    ){
130102 130637         /* The view was modified by some other optimization such as
130103 130638         ** pushDownWhereTerms() */
130104 130639         continue;
130105 130640       }
130106 130641       return pItem;
130107 130642     }
130108 130643     return 0;
................................................................................
130119 130654   **    SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2)
130120 130655   **
130121 130656   ** The transformation only works if all of the following are true:
130122 130657   **
130123 130658   **   *  The subquery is a UNION ALL of two or more terms
130124 130659   **   *  The subquery does not have a LIMIT clause
130125 130660   **   *  There is no WHERE or GROUP BY or HAVING clauses on the subqueries
130126         -**   *  The outer query is a simple count(*)
       130661  +**   *  The outer query is a simple count(*) with no WHERE clause or other
       130662  +**      extraneous syntax.
130127 130663   **
130128 130664   ** Return TRUE if the optimization is undertaken.
130129 130665   */
130130 130666   static int countOfViewOptimization(Parse *pParse, Select *p){
130131 130667     Select *pSub, *pPrior;
130132 130668     Expr *pExpr;
130133 130669     Expr *pCount;
130134 130670     sqlite3 *db;
130135 130671     if( (p->selFlags & SF_Aggregate)==0 ) return 0;   /* This is an aggregate */
130136 130672     if( p->pEList->nExpr!=1 ) return 0;               /* Single result column */
       130673  +  if( p->pWhere ) return 0;
       130674  +  if( p->pGroupBy ) return 0;
130137 130675     pExpr = p->pEList->a[0].pExpr;
130138 130676     if( pExpr->op!=TK_AGG_FUNCTION ) return 0;        /* Result is an aggregate */
130139 130677     if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0;  /* Is count() */
130140 130678     if( pExpr->x.pList!=0 ) return 0;                 /* Must be count(*) */
130141 130679     if( p->pSrc->nSrc!=1 ) return 0;                  /* One table in FROM  */
130142 130680     pSub = p->pSrc->a[0].pSelect;
130143 130681     if( pSub==0 ) return 0;                           /* The FROM is a subquery */
................................................................................
132780 133318     Table *pTab;           /* The table to be updated */
132781 133319     int addrTop = 0;       /* VDBE instruction address of the start of the loop */
132782 133320     WhereInfo *pWInfo;     /* Information about the WHERE clause */
132783 133321     Vdbe *v;               /* The virtual database engine */
132784 133322     Index *pIdx;           /* For looping over indices */
132785 133323     Index *pPk;            /* The PRIMARY KEY index for WITHOUT ROWID tables */
132786 133324     int nIdx;              /* Number of indices that need updating */
       133325  +  int nAllIdx;           /* Total number of indexes */
132787 133326     int iBaseCur;          /* Base cursor number */
132788 133327     int iDataCur;          /* Cursor for the canonical data btree */
132789 133328     int iIdxCur;           /* Cursor for the first index */
132790 133329     sqlite3 *db;           /* The database structure */
132791         -  int *aRegIdx = 0;      /* First register in array assigned to each index */
       133330  +  int *aRegIdx = 0;      /* Registers for to each index and the main table */
132792 133331     int *aXRef = 0;        /* aXRef[i] is the index in pChanges->a[] of the
132793 133332                            ** an expression for the i-th column of the table.
132794 133333                            ** aXRef[i]==-1 if the i-th column is not changed. */
132795 133334     u8 *aToOpen;           /* 1 for tables and indices to be opened */
132796 133335     u8 chngPk;             /* PRIMARY KEY changed in a WITHOUT ROWID table */
132797 133336     u8 chngRowid;          /* Rowid changed in a normal table */
132798 133337     u8 chngKey;            /* Either chngPk or chngRowid */
................................................................................
132898 133437       pParse->nTab = iBaseCur;
132899 133438     }
132900 133439     pTabList->a[0].iCursor = iDataCur;
132901 133440   
132902 133441     /* Allocate space for aXRef[], aRegIdx[], and aToOpen[].  
132903 133442     ** Initialize aXRef[] and aToOpen[] to their default values.
132904 133443     */
132905         -  aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx) + nIdx+2 );
       133444  +  aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx+1) + nIdx+2 );
132906 133445     if( aXRef==0 ) goto update_cleanup;
132907 133446     aRegIdx = aXRef+pTab->nCol;
132908         -  aToOpen = (u8*)(aRegIdx+nIdx);
       133447  +  aToOpen = (u8*)(aRegIdx+nIdx+1);
132909 133448     memset(aToOpen, 1, nIdx+1);
132910 133449     aToOpen[nIdx+1] = 0;
132911 133450     for(i=0; i<pTab->nCol; i++) aXRef[i] = -1;
132912 133451   
132913 133452     /* Initialize the name-context */
132914 133453     memset(&sNC, 0, sizeof(sNC));
132915 133454     sNC.pParse = pParse;
................................................................................
132980 133519     hasFK = sqlite3FkRequired(pParse, pTab, aXRef, chngKey);
132981 133520   
132982 133521     /* There is one entry in the aRegIdx[] array for each index on the table
132983 133522     ** being updated.  Fill in aRegIdx[] with a register number that will hold
132984 133523     ** the key for accessing each index.
132985 133524     */
132986 133525     if( onError==OE_Replace ) bReplace = 1;
132987         -  for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
       133526  +  for(nAllIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nAllIdx++){
132988 133527       int reg;
132989 133528       if( chngKey || hasFK>1 || pIdx==pPk
132990 133529        || indexWhereClauseMightChange(pIdx,aXRef,chngRowid)
132991 133530       ){
132992 133531         reg = ++pParse->nMem;
132993 133532         pParse->nMem += pIdx->nColumn;
132994 133533       }else{
................................................................................
133000 133539             if( onError==OE_Default && pIdx->onError==OE_Replace ){
133001 133540               bReplace = 1;
133002 133541             }
133003 133542             break;
133004 133543           }
133005 133544         }
133006 133545       }
133007         -    if( reg==0 ) aToOpen[j+1] = 0;
133008         -    aRegIdx[j] = reg;
       133546  +    if( reg==0 ) aToOpen[nAllIdx+1] = 0;
       133547  +    aRegIdx[nAllIdx] = reg;
133009 133548     }
       133549  +  aRegIdx[nAllIdx] = ++pParse->nMem;  /* Register storing the table record */
133010 133550     if( bReplace ){
133011 133551       /* If REPLACE conflict resolution might be invoked, open cursors on all 
133012 133552       ** indexes in case they are needed to delete records.  */
133013 133553       memset(aToOpen, 1, nIdx+1);
133014 133554     }
133015 133555   
133016 133556     /* Begin generating code. */
................................................................................
133017 133557     v = sqlite3GetVdbe(pParse);
133018 133558     if( v==0 ) goto update_cleanup;
133019 133559     if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
133020 133560     sqlite3BeginWriteOperation(pParse, pTrigger || hasFK, iDb);
133021 133561   
133022 133562     /* Allocate required registers. */
133023 133563     if( !IsVirtual(pTab) ){
133024         -    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];
133025 133571       regOldRowid = regNewRowid = ++pParse->nMem;
133026 133572       if( chngPk || pTrigger || hasFK ){
133027 133573         regOld = pParse->nMem + 1;
133028 133574         pParse->nMem += pTab->nCol;
133029 133575       }
133030 133576       if( chngKey || pTrigger || hasFK ){
133031 133577         regNewRowid = ++pParse->nMem;
................................................................................
133147 133693   
133148 133694     if( HasRowid(pTab) ){
133149 133695       /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF
133150 133696       ** mode, write the rowid into the FIFO. In either of the one-pass modes,
133151 133697       ** leave it in register regOldRowid.  */
133152 133698       sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid);
133153 133699       if( eOnePass==ONEPASS_OFF ){
       133700  +      /* We need to use regRowSet, so reallocate aRegIdx[nAllIdx] */
       133701  +      aRegIdx[nAllIdx] = ++pParse->nMem;
133154 133702         sqlite3VdbeAddOp2(v, OP_RowSetAdd, regRowSet, regOldRowid);
133155 133703       }
133156 133704     }else{
133157 133705       /* Read the PK of the current row into an array of registers. In
133158 133706       ** ONEPASS_OFF mode, serialize the array into a record and store it in
133159 133707       ** the ephemeral table. Or, in ONEPASS_SINGLE or MULTI mode, change
133160 133708       ** the OP_OpenEphemeral instruction to a Noop (the ephemeral table 
................................................................................
133978 134526   ** transient would cause the database file to appear to be deleted
133979 134527   ** following reboot.
133980 134528   */
133981 134529   SQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse, Token *pNm, Expr *pInto){
133982 134530     Vdbe *v = sqlite3GetVdbe(pParse);
133983 134531     int iDb = 0;
133984 134532     if( v==0 ) goto build_vacuum_end;
       134533  +  if( pParse->nErr ) goto build_vacuum_end;
133985 134534     if( pNm ){
133986 134535   #ifndef SQLITE_BUG_COMPATIBLE_20160819
133987 134536       /* Default behavior:  Report an error if the argument to VACUUM is
133988 134537       ** not recognized */
133989 134538       iDb = sqlite3TwoPartName(pParse, pNm, pNm, &pNm);
133990 134539       if( iDb<0 ) goto build_vacuum_end;
133991 134540   #else
................................................................................
135130 135679         if( p->pVtab->nRef>0 ){
135131 135680           return SQLITE_LOCKED;
135132 135681         }
135133 135682       }
135134 135683       p = vtabDisconnectAll(db, pTab);
135135 135684       xDestroy = p->pMod->pModule->xDestroy;
135136 135685       assert( xDestroy!=0 );  /* Checked before the virtual table is created */
       135686  +    pTab->nTabRef++;
135137 135687       rc = xDestroy(p->pVtab);
135138 135688       /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */
135139 135689       if( rc==SQLITE_OK ){
135140 135690         assert( pTab->pVTable==p && p->pNext==0 );
135141 135691         p->pVtab = 0;
135142 135692         pTab->pVTable = 0;
135143 135693         sqlite3VtabUnlock(p);
135144 135694       }
       135695  +    sqlite3DeleteTable(db, pTab);
135145 135696     }
135146 135697   
135147 135698     return rc;
135148 135699   }
135149 135700   
135150 135701   /*
135151 135702   ** This function invokes either the xRollback or xCommit method
................................................................................
135580 136131   **
135581 136132   *************************************************************************
135582 136133   **
135583 136134   ** This file contains structure and macro definitions for the query
135584 136135   ** planner logic in "where.c".  These definitions are broken out into
135585 136136   ** a separate source file for easier editing.
135586 136137   */
       136138  +#ifndef SQLITE_WHEREINT_H
       136139  +#define SQLITE_WHEREINT_H
135587 136140   
135588 136141   /*
135589 136142   ** Trace output macros
135590 136143   */
135591 136144   #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
135592 136145   /***/ extern int sqlite3WhereTrace;
135593 136146   #endif
................................................................................
136150 136703   #define WHERE_ONEROW       0x00001000  /* Selects no more than one row */
136151 136704   #define WHERE_MULTI_OR     0x00002000  /* OR using multiple indices */
136152 136705   #define WHERE_AUTO_INDEX   0x00004000  /* Uses an ephemeral index */
136153 136706   #define WHERE_SKIPSCAN     0x00008000  /* Uses the skip-scan algorithm */
136154 136707   #define WHERE_UNQ_WANTED   0x00010000  /* WHERE_ONEROW would have been helpful*/
136155 136708   #define WHERE_PARTIALIDX   0x00020000  /* The automatic index is partial */
136156 136709   #define WHERE_IN_EARLYOUT  0x00040000  /* Perhaps quit IN loops early */
       136710  +
       136711  +#endif /* !defined(SQLITE_WHEREINT_H) */
136157 136712   
136158 136713   /************** End of whereInt.h ********************************************/
136159 136714   /************** Continuing where we left off in wherecode.c ******************/
136160 136715   
136161 136716   #ifndef SQLITE_OMIT_EXPLAIN
136162 136717   
136163 136718   /*
................................................................................
137133 137688         sWalker.eCode = 0;
137134 137689         sWalker.xExprCallback = codeCursorHintCheckExpr;
137135 137690         sqlite3WalkExpr(&sWalker, pTerm->pExpr);
137136 137691         if( sWalker.eCode ) continue;
137137 137692       }
137138 137693   
137139 137694       /* If we survive all prior tests, that means this term is worth hinting */
137140         -    pExpr = sqlite3ExprAnd(db, pExpr, sqlite3ExprDup(db, pTerm->pExpr, 0));
       137695  +    pExpr = sqlite3ExprAnd(pParse, pExpr, sqlite3ExprDup(db, pTerm->pExpr, 0));
137141 137696     }
137142 137697     if( pExpr!=0 ){
137143 137698       sWalker.xExprCallback = codeCursorHintFixExpr;
137144 137699       sqlite3WalkExpr(&sWalker, pExpr);
137145 137700       sqlite3VdbeAddOp4(v, OP_CursorHint, 
137146 137701                         (sHint.pIdx ? sHint.iIdxCur : sHint.iTabCur), 0, 0,
137147 137702                         (const char*)pExpr, P4_EXPR);
................................................................................
138098 138653           if( &pWC->a[iTerm] == pTerm ) continue;
138099 138654           testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );
138100 138655           testcase( pWC->a[iTerm].wtFlags & TERM_CODED );
138101 138656           if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue;
138102 138657           if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
138103 138658           testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
138104 138659           pExpr = sqlite3ExprDup(db, pExpr, 0);
138105         -        pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr);
       138660  +        pAndExpr = sqlite3ExprAnd(pParse, pAndExpr, pExpr);
138106 138661         }
138107 138662         if( pAndExpr ){
138108 138663           /* The extra 0x10000 bit on the opcode is masked off and does not
138109 138664           ** become part of the new Expr.op.  However, it does make the
138110 138665           ** op==TK_AND comparison inside of sqlite3PExpr() false, and this
138111 138666           ** prevents sqlite3PExpr() from implementing AND short-circuit 
138112 138667           ** optimization, which we do not want here. */
................................................................................
138249 138804         pAndExpr->pLeft = 0;
138250 138805         sqlite3ExprDelete(db, pAndExpr);
138251 138806       }
138252 138807       sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v));
138253 138808       sqlite3VdbeGoto(v, pLevel->addrBrk);
138254 138809       sqlite3VdbeResolveLabel(v, iLoopBody);
138255 138810   
138256         -    if( pWInfo->nLevel>1 ) sqlite3StackFree(db, pOrTab);
       138811  +    if( pWInfo->nLevel>1 ){ sqlite3StackFree(db, pOrTab); }
138257 138812       if( !untestedTerms ) disableTerm(pLevel, pTerm);
138258 138813     }else
138259 138814   #endif /* SQLITE_OMIT_OR_OPTIMIZATION */
138260 138815   
138261 138816     {
138262 138817       /* Case 6:  There is no usable index.  We must do a complete
138263 138818       **          scan of the entire table.
................................................................................
138682 139237           char *zNew = pPrefix->u.zToken;
138683 139238           zNew[cnt] = 0;
138684 139239           for(iFrom=iTo=0; iFrom<cnt; iFrom++){
138685 139240             if( zNew[iFrom]==wc[3] ) iFrom++;
138686 139241             zNew[iTo++] = zNew[iFrom];
138687 139242           }
138688 139243           zNew[iTo] = 0;
138689         -
138690         -        /* If the RHS begins with a digit or a minus sign, then the LHS must be
138691         -        ** an ordinary column (not a virtual table column) with TEXT affinity.
138692         -        ** Otherwise the LHS might be numeric and "lhs >= rhs" would be false
138693         -        ** even though "lhs LIKE rhs" is true.  But if the RHS does not start
138694         -        ** with a digit or '-', then "lhs LIKE rhs" will always be false if
138695         -        ** the LHS is numeric and so the optimization still works.
138696         -        **
138697         -        ** 2018-09-10 ticket c94369cae9b561b1f996d0054bfab11389f9d033
138698         -        ** The RHS pattern must not be '/%' because the termination condition
138699         -        ** will then become "x<'0'" and if the affinity is numeric, will then
138700         -        ** be converted into "x<0", which is incorrect.
138701         -        */
138702         -        if( sqlite3Isdigit(zNew[0])
138703         -         || zNew[0]=='-'
138704         -         || (zNew[0]+1=='0' && iTo==1)
138705         -        ){
138706         -          if( pLeft->op!=TK_COLUMN 
138707         -           || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT 
138708         -           || IsVirtual(pLeft->y.pTab)  /* Value might be numeric */
138709         -          ){
       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 ){
138710 139271               sqlite3ExprDelete(db, pPrefix);
138711 139272               sqlite3ValueFree(pVal);
138712 139273               return 0;
138713 139274             }
138714 139275           }
138715 139276         }
138716 139277         *ppPrefix = pPrefix;
................................................................................
140589 141150   /*
140590 141151   ** Convert OP_Column opcodes to OP_Copy in previously generated code.
140591 141152   **
140592 141153   ** This routine runs over generated VDBE code and translates OP_Column
140593 141154   ** opcodes into OP_Copy when the table is being accessed via co-routine 
140594 141155   ** instead of via table lookup.
140595 141156   **
140596         -** If the bIncrRowid parameter is 0, then any OP_Rowid instructions on
140597         -** cursor iTabCur are transformed into OP_Null. Or, if bIncrRowid is non-zero,
140598         -** then each OP_Rowid is transformed into an instruction to increment the
140599         -** 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.
140600 141161   */
140601 141162   static void translateColumnToCopy(
140602 141163     Parse *pParse,      /* Parsing context */
140603 141164     int iStart,         /* Translate from this opcode to the end */
140604 141165     int iTabCur,        /* OP_Column/OP_Rowid references to this table */
140605 141166     int iRegister,      /* The first column is in this register */
140606         -  int bIncrRowid      /* If non-zero, transform OP_rowid to OP_AddImm(1) */
       141167  +  int iAutoidxCur     /* If non-zero, cursor of autoindex being generated */
140607 141168   ){
140608 141169     Vdbe *v = pParse->pVdbe;
140609 141170     VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart);
140610 141171     int iEnd = sqlite3VdbeCurrentAddr(v);
140611 141172     if( pParse->db->mallocFailed ) return;
140612 141173     for(; iStart<iEnd; iStart++, pOp++){
140613 141174       if( pOp->p1!=iTabCur ) continue;
140614 141175       if( pOp->opcode==OP_Column ){
140615 141176         pOp->opcode = OP_Copy;
140616 141177         pOp->p1 = pOp->p2 + iRegister;
140617 141178         pOp->p2 = pOp->p3;
140618 141179         pOp->p3 = 0;
140619 141180       }else if( pOp->opcode==OP_Rowid ){
140620         -      if( bIncrRowid ){
140621         -        /* Increment the value stored in the P2 operand of the OP_Rowid. */
140622         -        pOp->opcode = OP_AddImm;
140623         -        pOp->p1 = pOp->p2;
140624         -        pOp->p2 = 1;
       141181  +      if( iAutoidxCur ){
       141182  +        pOp->opcode = OP_Sequence;
       141183  +        pOp->p1 = iAutoidxCur;
140625 141184         }else{
140626 141185           pOp->opcode = OP_Null;
140627 141186           pOp->p1 = 0;
140628 141187           pOp->p3 = 0;
140629 141188         }
140630 141189       }
140631 141190     }
................................................................................
140764 141323       assert( !ExprHasProperty(pExpr, EP_FromJoin)    /* prereq always non-zero */
140765 141324            || pExpr->iRightJoinTable!=pSrc->iCursor   /*   for the right-hand   */
140766 141325            || pLoop->prereq!=0 );                     /*   table of a LEFT JOIN */
140767 141326       if( pLoop->prereq==0
140768 141327        && (pTerm->wtFlags & TERM_VIRTUAL)==0
140769 141328        && !ExprHasProperty(pExpr, EP_FromJoin)
140770 141329        && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
140771         -      pPartial = sqlite3ExprAnd(pParse->db, pPartial,
       141330  +      pPartial = sqlite3ExprAnd(pParse, pPartial,
140772 141331                                   sqlite3ExprDup(pParse->db, pExpr, 0));
140773 141332       }
140774 141333       if( termCanDriveIndex(pTerm, pSrc, notReady) ){
140775 141334         int iCol = pTerm->u.leftColumn;
140776 141335         Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
140777 141336         testcase( iCol==BMS );
140778 141337         testcase( iCol==BMS-1 );
................................................................................
140891 141450     );
140892 141451     sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
140893 141452     sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
140894 141453     if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
140895 141454     if( pTabItem->fg.viaCoroutine ){
140896 141455       sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
140897 141456       testcase( pParse->db->mallocFailed );
       141457  +    assert( pLevel->iIdxCur>0 );
140898 141458       translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
140899         -                          pTabItem->regResult, 1);
       141459  +                          pTabItem->regResult, pLevel->iIdxCur);
140900 141460       sqlite3VdbeGoto(v, addrTop);
140901 141461       pTabItem->fg.viaCoroutine = 0;
140902 141462     }else{
140903 141463       sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
140904 141464     }
140905 141465     sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
140906 141466     sqlite3VdbeJumpHere(v, addrTop);
................................................................................
146137 146697   ** selectWindowRewriteExprCb() by selectWindowRewriteEList().
146138 146698   */
146139 146699   typedef struct WindowRewrite WindowRewrite;
146140 146700   struct WindowRewrite {
146141 146701     Window *pWin;
146142 146702     SrcList *pSrc;
146143 146703     ExprList *pSub;
       146704  +  Table *pTab;
146144 146705     Select *pSubSelect;             /* Current sub-select, if any */
146145 146706   };
146146 146707   
146147 146708   /*
146148 146709   ** Callback function used by selectWindowRewriteEList(). If necessary,
146149 146710   ** this function appends to the output expression-list and updates 
146150 146711   ** expression (*ppExpr) in place.
................................................................................
146197 146758           sqlite3ExprDelete(pParse->db, pExpr);
146198 146759           ExprClearProperty(pExpr, EP_Static);
146199 146760           memset(pExpr, 0, sizeof(Expr));
146200 146761   
146201 146762           pExpr->op = TK_COLUMN;
146202 146763           pExpr->iColumn = p->pSub->nExpr-1;
146203 146764           pExpr->iTable = p->pWin->iEphCsr;
       146765  +        pExpr->y.pTab = p->pTab;
146204 146766         }
146205 146767   
146206 146768         break;
146207 146769       }
146208 146770   
146209 146771       default: /* no-op */
146210 146772         break;
................................................................................
146240 146802   ** appending the new one.
146241 146803   */
146242 146804   static void selectWindowRewriteEList(
146243 146805     Parse *pParse, 
146244 146806     Window *pWin,
146245 146807     SrcList *pSrc,
146246 146808     ExprList *pEList,               /* Rewrite expressions in this list */
       146809  +  Table *pTab,
146247 146810     ExprList **ppSub                /* IN/OUT: Sub-select expression-list */
146248 146811   ){
146249 146812     Walker sWalker;
146250 146813     WindowRewrite sRewrite;
146251 146814   
146252 146815     memset(&sWalker, 0, sizeof(Walker));
146253 146816     memset(&sRewrite, 0, sizeof(WindowRewrite));
146254 146817   
146255 146818     sRewrite.pSub = *ppSub;
146256 146819     sRewrite.pWin = pWin;
146257 146820     sRewrite.pSrc = pSrc;
       146821  +  sRewrite.pTab = pTab;
146258 146822   
146259 146823     sWalker.pParse = pParse;
146260 146824     sWalker.xExprCallback = selectWindowRewriteExprCb;
146261 146825     sWalker.xSelectCallback = selectWindowRewriteSelectCb;
146262 146826     sWalker.u.pRewrite = &sRewrite;
146263 146827   
146264 146828     (void)sqlite3WalkExprList(&sWalker, pEList);
................................................................................
146269 146833   /*
146270 146834   ** Append a copy of each expression in expression-list pAppend to
146271 146835   ** expression list pList. Return a pointer to the result list.
146272 146836   */
146273 146837   static ExprList *exprListAppendList(
146274 146838     Parse *pParse,          /* Parsing context */
146275 146839     ExprList *pList,        /* List to which to append. Might be NULL */
146276         -  ExprList *pAppend       /* List of values to append. Might be NULL */
       146840  +  ExprList *pAppend,      /* List of values to append. Might be NULL */
       146841  +  int bIntToNull
146277 146842   ){
146278 146843     if( pAppend ){
146279 146844       int i;
146280 146845       int nInit = pList ? pList->nExpr : 0;
146281 146846       for(i=0; i<pAppend->nExpr; i++){
146282 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  +      }
146283 146852         pList = sqlite3ExprListAppend(pParse, pList, pDup);
146284 146853         if( pList ) pList->a[nInit+i].sortOrder = pAppend->a[i].sortOrder;
146285 146854       }
146286 146855     }
146287 146856     return pList;
146288 146857   }
146289 146858   
................................................................................
146305 146874       ExprList *pGroupBy = p->pGroupBy;
146306 146875       Expr *pHaving = p->pHaving;
146307 146876       ExprList *pSort = 0;
146308 146877   
146309 146878       ExprList *pSublist = 0;       /* Expression list for sub-query */
146310 146879       Window *pMWin = p->pWin;      /* Master window object */
146311 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  +    }
146312 146887   
146313 146888       p->pSrc = 0;
146314 146889       p->pWhere = 0;
146315 146890       p->pGroupBy = 0;
146316 146891       p->pHaving = 0;
       146892  +    p->selFlags &= ~SF_Aggregate;
146317 146893   
146318 146894       /* Create the ORDER BY clause for the sub-select. This is the concatenation
146319 146895       ** of the window PARTITION and ORDER BY clauses. Then, if this makes it
146320 146896       ** redundant, remove the ORDER BY from the parent SELECT.  */
146321 146897       pSort = sqlite3ExprListDup(db, pMWin->pPartition, 0);
146322         -    pSort = exprListAppendList(pParse, pSort, pMWin->pOrderBy);
       146898  +    pSort = exprListAppendList(pParse, pSort, pMWin->pOrderBy, 1);
146323 146899       if( pSort && p->pOrderBy ){
146324 146900         if( sqlite3ExprListCompare(pSort, p->pOrderBy, -1)==0 ){
146325 146901           sqlite3ExprListDelete(db, p->pOrderBy);
146326 146902           p->pOrderBy = 0;
146327 146903         }
146328 146904       }
146329 146905   
146330 146906       /* Assign a cursor number for the ephemeral table used to buffer rows.
146331 146907       ** The OpenEphemeral instruction is coded later, after it is known how
146332 146908       ** many columns the table will have.  */
146333 146909       pMWin->iEphCsr = pParse->nTab++;
146334 146910       pParse->nTab += 3;
146335 146911   
146336         -    selectWindowRewriteEList(pParse, pMWin, pSrc, p->pEList, &pSublist);
146337         -    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);
146338 146914       pMWin->nBufferCol = (pSublist ? pSublist->nExpr : 0);
146339 146915   
146340 146916       /* Append the PARTITION BY and ORDER BY expressions to the to the 
146341 146917       ** sub-select expression list. They are required to figure out where 
146342 146918       ** boundaries for partitions and sets of peer rows lie.  */
146343         -    pSublist = exprListAppendList(pParse, pSublist, pMWin->pPartition);
146344         -    pSublist = exprListAppendList(pParse, pSublist, pMWin->pOrderBy);
       146919  +    pSublist = exprListAppendList(pParse, pSublist, pMWin->pPartition, 0);
       146920  +    pSublist = exprListAppendList(pParse, pSublist, pMWin->pOrderBy, 0);
146345 146921   
146346 146922       /* Append the arguments passed to each window function to the
146347 146923       ** sub-select expression list. Also allocate two registers for each
146348 146924       ** window function - one for the accumulator, another for interim
146349 146925       ** results.  */
146350 146926       for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
146351 146927         pWin->iArgCol = (pSublist ? pSublist->nExpr : 0);
146352         -      pSublist = exprListAppendList(pParse, pSublist, pWin->pOwner->x.pList);
       146928  +      pSublist = exprListAppendList(pParse, pSublist, pWin->pOwner->x.pList, 0);
146353 146929         if( pWin->pFilter ){
146354 146930           Expr *pFilter = sqlite3ExprDup(db, pWin->pFilter, 0);
146355 146931           pSublist = sqlite3ExprListAppend(pParse, pSublist, pFilter);
146356 146932         }
146357 146933         pWin->regAccum = ++pParse->nMem;
146358 146934         pWin->regResult = ++pParse->nMem;
146359 146935         sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum);
................................................................................
146372 146948       }
146373 146949   
146374 146950       pSub = sqlite3SelectNew(
146375 146951           pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
146376 146952       );
146377 146953       p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
146378 146954       if( p->pSrc ){
       146955  +      Table *pTab2;
146379 146956         p->pSrc->a[0].pSelect = pSub;
146380 146957         sqlite3SrcListAssignCursors(pParse, p->pSrc);
146381         -      if( sqlite3ExpandSubquery(pParse, &p->pSrc->a[0]) ){
       146958  +      pSub->selFlags |= SF_Expanded;
       146959  +      pTab2 = sqlite3ResultSetOfSelect(pParse, pSub);
       146960  +      if( pTab2==0 ){
146382 146961           rc = SQLITE_NOMEM;
146383 146962         }else{
146384         -        pSub->selFlags |= SF_Expanded;
146385         -        p->selFlags &= ~SF_Aggregate;
146386         -        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;
146387 146967         }
146388         -
146389 146968         sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pMWin->iEphCsr, pSublist->nExpr);
146390 146969         sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+1, pMWin->iEphCsr);
146391 146970         sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+2, pMWin->iEphCsr);
146392 146971         sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+3, pMWin->iEphCsr);
146393 146972       }else{
146394 146973         sqlite3SelectDelete(db, pSub);
146395 146974       }
146396 146975       if( db->mallocFailed ) rc = SQLITE_NOMEM;
       146976  +    sqlite3DbFree(db, pTab);
146397 146977     }
146398 146978   
146399 146979     return rc;
146400 146980   }
146401 146981   
146402 146982   /*
146403 146983   ** Free the Window object passed as the second argument.
................................................................................
148357 148937   **    YY_MAX_REDUCE      Maximum value for reduce actions
148358 148938   */
148359 148939   #ifndef INTERFACE
148360 148940   # define INTERFACE 1
148361 148941   #endif
148362 148942   /************* Begin control #defines *****************************************/
148363 148943   #define YYCODETYPE unsigned short int
148364         -#define YYNOCODE 301
       148944  +#define YYNOCODE 302
148365 148945   #define YYACTIONTYPE unsigned short int
148366 148946   #define YYWILDCARD 95
148367 148947   #define sqlite3ParserTOKENTYPE Token
148368 148948   typedef union {
148369 148949     int yyinit;
148370 148950     sqlite3ParserTOKENTYPE yy0;
148371         -  With* yy59;
148372         -  IdList* yy62;
148373         -  struct TrigEvent yy90;
148374         -  Upsert* yy136;
148375         -  struct FrameBound yy201;
148376         -  u8 yy238;
148377         -  const char* yy294;
148378         -  Window* yy295;
148379         -  struct {int value; int mask;} yy355;
148380         -  ExprList* yy434;
148381         -  TriggerStep* yy455;
148382         -  Select* yy457;
148383         -  SrcList* yy483;
148384         -  int yy494;
148385         -  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;
148386 148966   } YYMINORTYPE;
148387 148967   #ifndef YYSTACKDEPTH
148388 148968   #define YYSTACKDEPTH 100
148389 148969   #endif
148390 148970   #define sqlite3ParserARG_SDECL
148391 148971   #define sqlite3ParserARG_PDECL
148392 148972   #define sqlite3ParserARG_PARAM
................................................................................
148394 148974   #define sqlite3ParserARG_STORE
148395 148975   #define sqlite3ParserCTX_SDECL Parse *pParse;
148396 148976   #define sqlite3ParserCTX_PDECL ,Parse *pParse
148397 148977   #define sqlite3ParserCTX_PARAM ,pParse
148398 148978   #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
148399 148979   #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
148400 148980   #define YYFALLBACK 1
148401         -#define YYNSTATE             541
148402         -#define YYNRULE              375
       148981  +#define YYNSTATE             540
       148982  +#define YYNRULE              376
148403 148983   #define YYNTOKEN             176
148404         -#define YY_MAX_SHIFT         540
148405         -#define YY_MIN_SHIFTREDUCE   784
       148984  +#define YY_MAX_SHIFT         539
       148985  +#define YY_MIN_SHIFTREDUCE   783
148406 148986   #define YY_MAX_SHIFTREDUCE   1158
148407 148987   #define YY_ERROR_ACTION      1159
148408 148988   #define YY_ACCEPT_ACTION     1160
148409 148989   #define YY_NO_ACTION         1161
148410 148990   #define YY_MIN_REDUCE        1162
148411         -#define YY_MAX_REDUCE        1536
       148991  +#define YY_MAX_REDUCE        1537
148412 148992   /************* End control #defines *******************************************/
148413 148993   #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
148414 148994   
148415 148995   /* Define the yytestcase() macro to be a no-op if is not already defined
148416 148996   ** otherwise.
148417 148997   **
148418 148998   ** Applications can choose to define yytestcase() in the %include section
................................................................................
148473 149053   **  yy_reduce_ofst[]   For each state, the offset into yy_action for
148474 149054   **                     shifting non-terminals after a reduce.
148475 149055   **  yy_default[]       Default action for each state.
148476 149056   **
148477 149057   *********** Begin parsing tables **********************************************/
148478 149058   #define YY_ACTTAB_COUNT (2142)
148479 149059   static const YYACTIONTYPE yy_action[] = {
148480         - /*     0 */   535, 1323,  112,  109,  209,  112,  109,  209, 1160,    1,
148481         - /*    10 */     1,  540,    2, 1164,  535, 1292, 1228, 1207,  289,  384,
148482         - /*    20 */   134,   42,   42, 1427,  382, 1228,    9, 1241,  242,  492,
148483         - /*    30 */  1291,  915,  373,  379, 1026,   70,   70,  427, 1026,  916,
148484         - /*    40 */   529,  529,  529,  119,  120,  110, 1136, 1136,  981,  984,
148485         - /*    50 */   974,  974,  117,  117,  118,  118,  118,  118,  380,  264,
148486         - /*    60 */   264,  264,  264, 1134,  264,  264,  112,  109,  209,  397,
148487         - /*    70 */   454,  517,  532,  491,  532, 1233, 1233,  532,  239,  206,
148488         - /*    80 */   493,  112,  109,  209,  464,  219,  118,  118,  118,  118,
148489         - /*    90 */   111,  393,  440,  444,   16,   16,  116,  116,  116,  116,
148490         - /*   100 */   115,  115,  114,  114,  114,  113,  415,  971,  971,  982,
148491         - /*   110 */   985,  235, 1463,  351, 1134,  419,  384,  116,  116,  116,
148492         - /*   120 */   116,  115,  115,  114,  114,  114,  113,  415,  116,  116,
148493         - /*   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,
148494 149074    /*   140 */   119,  120,  110, 1136, 1136,  981,  984,  974,  974,  117,
148495         - /*   150 */   117,  118,  118,  118,  118,  952,  415,  941,  298,  951,
148496         - /*   160 */   941, 1480,  540,    2, 1164, 1115,  535, 1458,  160,  289,
148497         - /*   170 */     6,  134, 1504,  389,  406,  975,  338, 1024, 1241,  337,
148498         - /*   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,
148499 149079    /*   190 */   951,  951,  953,  116,  116,  116,  116,  115,  115,  114,
148500         - /*   200 */   114,  114,  113,  415,  311,  430,  299,  311,  881,  160,
148501         - /*   210 */   264,  264,  401,  384,  324, 1115, 1116, 1117,  288,  526,
148502         - /*   220 */    96,  159, 1441,  532,  141,  116,  116,  116,  116,  115,
148503         - /*   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,
148504 149084    /*   240 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
148505         - /*   250 */   118,  118,  115,  115,  114,  114,  114,  113,  415,  288,
148506         - /*   260 */   526,  403,  533,  121,  870,  870,  419,  250,  267,  336,
148507         - /*   270 */   475,  331,  474,  236,  160,  319, 1084,  322, 1465,  329,
148508         - /*   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,
148509 149089    /*   290 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
148510         - /*   300 */   415,  535,  836,   42,   42,  138,  426,  119,  120,  110,
       149090  + /*   300 */   414,  534, 1339,  405,  159,  411,  410,  119,  120,  110,
148511 149091    /*   310 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
148512         - /*   320 */   118,  118,   70,   70,  288,  526,  412,  411,  480, 1457,
148513         - /*   330 */   335,   79,    6,  473, 1140, 1115, 1116, 1117,  501, 1142,
148514         - /*   340 */   334,  837,  811, 1484,  512, 1164,  534, 1141,  123,  187,
148515         - /*   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,
148516 149096    /*   360 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
148517         - /*   370 */   415, 1143, 1115, 1143,  459,  119,  120,  110, 1136, 1136,
       149097  + /*   370 */   414, 1143, 1466, 1143,  350,  119,  120,  110, 1136, 1136,
148518 149098    /*   380 */   981,  984,  974,  974,  117,  117,  118,  118,  118,  118,
148519         - /*   390 */   404,  264,  264,  811, 1463,  506,  368, 1156,  535,  114,
148520         - /*   400 */   114,  114,  113,  415,  532, 1115, 1116, 1117,  231,  518,
148521         - /*   410 */  1500,  472,  469,  468,  175,  497,  422,  219, 1202,   70,
148522         - /*   420 */    70,  467, 1115, 1116, 1117,  176,  201,  200,  116,  116,
148523         - /*   430 */   116,  116,  115,  115,  114,  114,  114,  113,  415,  535,
148524         - /*   440 */  1115,  264,  264,  435,  312, 1115,  273,  419,  384,  513,
148525         - /*   450 */  1450, 1115,  326, 1084,  532,  517,   82, 1084,  167,  388,
148526         - /*   460 */    69,   69, 1115, 1084,  519,  509, 1084, 1084,   12, 1157,
148527         - /*   470 */  1084,  420,  119,  120,  110, 1136, 1136,  981,  984,  974,
148528         - /*   480 */   974,  117,  117,  118,  118,  118,  118,  258,  258,  535,
148529         - /*   490 */  1115, 1116, 1117, 1045,  535, 1115, 1116, 1117, 1323,  535,
148530         - /*   500 */   532, 1115, 1116, 1117,  296,  483, 1211,  818, 1046,  448,
148531         - /*   510 */    70,   70, 1115, 1116, 1117,   50,   50,  448,  356,  500,
148532         - /*   520 */    70,   70,  207, 1047,   32,  116,  116,  116,  116,  115,
148533         - /*   530 */   115,  114,  114,  114,  113,  415,  453,  264,  264, 1115,
148534         - /*   540 */   450,  449,  961,  508,  856,  384,  517,    5,  900,  822,
148535         - /*   550 */   532,  484,  181, 1115,  857,  516,  517,  818,  952,  507,
148536         - /*   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,
148537 149117    /*   570 */   120,  110, 1136, 1136,  981,  984,  974,  974,  117,  117,
148538         - /*   580 */   118,  118,  118,  118, 1115,  535,  238, 1115, 1391, 1115,
148539         - /*   590 */  1116, 1117,  159,  951,  951,  953,  231, 1115,  259,  472,
148540         - /*   600 */   469,  468,  310, 1115, 1116, 1117,   13,   13,  297,  467,
148541         - /*   610 */   276, 1115, 1116, 1117,  412,  411, 1095, 1115, 1116, 1117,
148542         - /*   620 */   395,  355,  116,  116,  116,  116,  115,  115,  114,  114,
148543         - /*   630 */   114,  113,  415,  208, 1115, 1116, 1117, 1115, 1116, 1117,
148544         - /*   640 */   264,  264,  384,  337,  902,  393,  815, 1115, 1116, 1117,
148545         - /*   650 */   413,  413,  413,  532,  112,  109,  209,  309,  900, 1143,
148546         - /*   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,
148547 149127    /*   670 */  1136,  981,  984,  974,  974,  117,  117,  118,  118,  118,
148548         - /*   680 */   118,   13,   13,   13,   13,  265,  265,  535,  143,  264,
148549         - /*   690 */   264,  288,  526,  535, 1119,  400,  535,  402,  532,  510,
148550         - /*   700 */  1457,  512,  532,    6,  113,  415, 1067, 1530,   70,   70,
148551         - /*   710 */  1530,  535,  271,  535,   70,   70,  535,   13,   13,  116,
148552         - /*   720 */   116,  116,  116,  115,  115,  114,  114,  114,  113,  415,
148553         - /*   730 */   272,  277,   13,   13,   13,   13,  535,   13,   13,  384,
148554         - /*   740 */   535,  304,  425, 1100,  284, 1119,  184,  801,  185,  338,
148555         - /*   750 */   285,  514, 1532,  369, 1239, 1438, 1182,   70,   70,  425,
148556         - /*   760 */   424,   70,   70,  119,  120,  110, 1136, 1136,  981,  984,
148557         - /*   770 */   974,  974,  117,  117,  118,  118,  118,  118,  190, 1065,
148558         - /*   780 */  1067, 1531,  442,  107, 1531,  408,  264,  264,  264,  264,
148559         - /*   790 */   383, 1396,  261,  410,   95,  900,  485,  414,  421,  532,
148560         - /*   800 */  1045,  532,  301, 1133,  303,  488,  433, 1451, 1396, 1398,
148561         - /*   810 */   278,  535,  278,  520, 1435, 1046,  116,  116,  116,  116,
148562         - /*   820 */   115,  115,  114,  114,  114,  113,  415,  425,  264,  264,
148563         - /*   830 */  1047,  190,   54,   54,  535,  291,  384,  264,  264,  362,
148564         - /*   840 */   962,  532, 1004,  376, 1084,  264,  264, 1029, 1029,  456,
148565         - /*   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,
148566 149146    /*   860 */   119,  120,  110, 1136, 1136,  981,  984,  974,  974,  117,
148567         - /*   870 */   117,  118,  118,  118,  118,  535, 1396,  190,  302, 1383,
148568         - /*   880 */   208,  535,  789,  790,  791,  535,  515,  535, 1323,  371,
148569         - /*   890 */   337,  234,  233,  232,  459,  515,   15,   15,  459,  477,
148570         - /*   900 */   459,  459,   44,   44,  136,  900,   56,   56,   57,   57,
148571         - /*   910 */  1185,  390,  197,  116,  116,  116,  116,  115,  115,  114,
148572         - /*   920 */   114,  114,  113,  415,  535,  876,  535,  442,  535,  274,
148573         - /*   930 */   875, 1323,  357,  384,  353,  140, 1426,  946, 1455, 1323,
148574         - /*   940 */  1390,    6, 1240, 1236,  292,   58,   58,   59,   59,   60,
148575         - /*   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,
148576 149156    /*   960 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
148577         - /*   970 */   118,  118,   61,   61,  535,   45,   45,  119,  120,  110,
       149157  + /*   970 */   118,  118,  428,   48,   48,  534,  392,  119,  120,  110,
148578 149158    /*   980 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
148579         - /*   990 */   118,  118, 1477,  479,  202,   46,   46,  275,   95,  455,
148580         - /*  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,
148581 149161    /*  1010 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
148582         - /*  1020 */   415,   48,   48,   49,   49,   62,   62,   63,   63,  535,
       149162  + /*  1020 */   414,   62,   62,  392,   63,   63,   64,   64,   14,   14,
148583 149163    /*  1030 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
148584         - /*  1040 */   415,  535,  459,  535, 1134,  535, 1151,  535,  142,  535,
148585         - /*  1050 */    64,   64,  535, 1338,  535,  494,  535,  446,  535, 1264,
148586         - /*  1060 */   535, 1337,   14,   14,   65,   65,  125,  125,   66,   66,
148587         - /*  1070 */    51,   51,  535,   67,   67,   68,   68,   52,   52,  147,
148588         - /*  1080 */   147,  148,  148, 1453,  317,   98,    6,  535, 1245,  481,
148589         - /*  1090 */   535,  827,  535,   75,   75, 1134,  102,  481,  100,  535,
148590         - /*  1100 */   532,  535,  368, 1066, 1503,  384,  535,  845,   53,   53,
148591         - /*  1110 */    93,   71,   71,  126,  126,  295,  528,  390,  288,  526,
148592         - /*  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,
148593 149173    /*  1130 */   120,  110, 1136, 1136,  981,  984,  974,  974,  117,  117,
148594         - /*  1140 */   118,  118,  118,  118,  535,  495,  535,  447,  535,  119,
       149174  + /*  1140 */   118,  118,  118,  118,  534,  900,  534,   95,  534,  119,
148595 149175    /*  1150 */   120,  110, 1136, 1136,  981,  984,  974,  974,  117,  117,
148596         - /*  1160 */   118,  118,  118,  118,  235,  124,  124,  146,  146,  145,
148597         - /*  1170 */   145,  287,  535, 1277,  535, 1157,  535,  391,  161,  263,
148598         - /*  1180 */   206,  381,  116,  116,  116,  116,  115,  115,  114,  114,
148599         - /*  1190 */   114,  113,  415,  132,  132,  131,  131,  129,  129,  535,
148600         - /*  1200 */    30,  535,  116,  116,  116,  116,  115,  115,  114,  114,
148601         - /*  1210 */   114,  113,  415,  535,  216, 1062, 1276,  535,  370,  535,
148602         - /*  1220 */   130,  130,   74,   74,  535,  915,  389,  876,   17,  437,
148603         - /*  1230 */   429,   31,  875,  916,   76,   76,  266,  101,   73,   73,
148604         - /*  1240 */    43,   43,  835,  834,  308,   47,   47,   95,  825,  943,
148605         - /*  1250 */   441,  938,  241,  241,  305,  443,  313,  384,  241,   95,
148606         - /*  1260 */   842,  843,  193,  465, 1209,  327,  237,  436,   95, 1011,
148607         - /*  1270 */  1007,  909,  873,  237,  241,  107, 1023,  384, 1023,  955,
148608         - /*  1280 */  1415,  119,  120,  110, 1136, 1136,  981,  984,  974,  974,
148609         - /*  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,
148610 149190    /*  1300 */   137,  119,  108,  110, 1136, 1136,  981,  984,  974,  974,
148611         - /*  1310 */   117,  117,  118,  118,  118,  118,  874, 1414,  451,  107,
148612         - /*  1320 */  1011,  314, 1273,  318,  218,  321,  323,  325, 1224, 1208,
148613         - /*  1330 */   955,  330,  339,  340,  116,  116,  116,  116,  115,  115,
148614         - /*  1340 */   114,  114,  114,  113,  415, 1285, 1322, 1260, 1493, 1470,
148615         - /*  1350 */  1271,  283,  521, 1328,  116,  116,  116,  116,  115,  115,
148616         - /*  1360 */   114,  114,  114,  113,  415, 1191, 1184, 1173, 1172, 1174,
148617         - /*  1370 */   522, 1487,  211,  460,  384,  256,  199,  367, 1257,  342,
148618         - /*  1380 */   195,  470,  307,  344,   11,  333,  525,  445, 1307, 1315,
148619         - /*  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,
148620 149200    /*  1400 */   110, 1136, 1136,  981,  984,  974,  974,  117,  117,  118,
148621         - /*  1410 */   118,  118,  118, 1386,  428, 1490,  245,  300,  348, 1148,
       149201  + /*  1410 */   118,  118,  118, 1208, 1151,  300,  348, 1491,  245, 1148,
148622 149202    /*  1420 */   110, 1136, 1136,  981,  984,  974,  974,  117,  117,  118,
148623         - /*  1430 */   118,  118,  118,  189,  198, 1434, 1432,   78,   81,  163,
148624         - /*  1440 */    82,  392,  439, 1392,  173,  105,  527,   35,    4,  157,
148625         - /*  1450 */  1312,  116,  116,  116,  116,  115,  115,  114,  114,  114,
148626         - /*  1460 */   113,  415,  530,  165,   93, 1304,  431,  432,  168,  463,
148627         - /*  1470 */   221,  116,  116,  116,  116,  115,  115,  114,  114,  114,
148628         - /*  1480 */   113,  415,  169,  452,  170,  416,  171,  374,  372,  438,
148629         - /*  1490 */    36, 1318,  177,  225, 1381,   87,  458,  524, 1403,  316,
148630         - /*  1500 */   257,  105,  527,  227,    4,  182,  461,  160,  320,  228,
148631         - /*  1510 */   377, 1175,  476,  229, 1227, 1226,  405, 1225,  530, 1218,
148632         - /*  1520 */   961,  378, 1199, 1198,  827,  332,  103,  103, 1197,  407,
148633         - /*  1530 */     8, 1217, 1502,  104,  487,  416,  537,  536,  281,  282,
148634         - /*  1540 */   951,  416,  490, 1268,  496,   92,  341,  243, 1269,  343,
148635         - /*  1550 */   244, 1267,  122,  524,  345, 1461,  515,  288,  526,   10,
148636         - /*  1560 */   354, 1266, 1460,  352,  504, 1250,   99, 1367,   94,  503,
148637         - /*  1570 */   499,  951,  951,  953,  954,   27,  961,  347, 1249,  194,
148638         - /*  1580 */   251,  358,  103,  103,  359, 1181,   34,  538, 1110,  104,
148639         - /*  1590 */   255,  416,  537,  536,  286,  252,  951,  254,  539,  149,
148640         - /*  1600 */  1170, 1419, 1165, 1420, 1418,  150, 1417,  135,  279,  785,
148641         - /*  1610 */   151,  417, 1195,  196,  290,  210,  386, 1194,  269,  387,
148642         - /*  1620 */   162, 1021,  133,   77, 1192, 1019,  935,  951,  951,  953,
148643         - /*  1630 */   954,   27, 1479, 1104,  418,  164,  153,  268,  217,  166,
148644         - /*  1640 */   859,  306,  366,  366,  365,  253,  363,  220, 1035,  798,
148645         - /*  1650 */   172,  939,  105,  527,  155,    4,  394,  174,  396,  156,
148646         - /*  1660 */    83, 1038,  213,   84,  294,   85,   86,  223,  222,  530,
148647         - /*  1670 */  1034,  144,  293,   18,  224,  315,  241, 1027, 1145,  178,
148648         - /*  1680 */   457,  226,  179,   37,  800,  334,  462,  230,  328,  466,
148649         - /*  1690 */   180,  471,  416,   88,   19,   20,   89,  280,  838,  158,
148650         - /*  1700 */   191,   90,  215,  478,  524, 1097,  204,  192,  987,   91,
148651         - /*  1710 */   152, 1070,   39,  154, 1071,  504,  486,   40,  489,  205,
148652         - /*  1720 */   505,  260,  105,  527,  214,    4,  908,  961,  262,  183,
148653         - /*  1730 */   240,   21,  903,  103,  103,  107,   22, 1086,   23,  530,
148654         - /*  1740 */   104, 1088,  416,  537,  536,   24, 1093,  951,   25, 1074,
148655         - /*  1750 */  1090, 1094,    7,   33,  511,  186,   26, 1002,  385,   95,
148656         - /*  1760 */   988,  986,  416,  288,  526,  990, 1044,  246, 1043,  247,
148657         - /*  1770 */   991,   28,   41,  106,  524,  956,  810,   29,  951,  951,
148658         - /*  1780 */   953,  954,   27,  531,  361,  504,  423,  248,  869,  249,
148659         - /*  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,
148660 149240    /*  1800 */  1161, 1161, 1161,  103,  103, 1161, 1161, 1161, 1161, 1161,
148661         - /*  1810 */   104, 1161,  416,  537,  536, 1104,  418,  951, 1161,  268,
       149241  + /*  1810 */   104, 1161,  415,  536,  535, 1104,  417,  951, 1161,  268,
148662 149242    /*  1820 */  1161, 1161, 1161, 1161,  366,  366,  365,  253,  363, 1161,
148663         - /*  1830 */  1161,  798, 1161, 1161, 1161, 1161,  105,  527, 1161,    4,
       149243  + /*  1830 */  1161,  797, 1161, 1161, 1161, 1161,  105,  526, 1161,    4,
148664 149244    /*  1840 */  1161, 1161, 1161, 1161,  213, 1161,  294, 1161,  951,  951,
148665         - /*  1850 */   953,  954,   27,  530,  293, 1161, 1161, 1161, 1161, 1161,
       149245  + /*  1850 */   953,  954,   27,  529,  293, 1161, 1161, 1161, 1161, 1161,
148666 149246    /*  1860 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
148667         - /*  1870 */  1161, 1161, 1161, 1161, 1161, 1161,  416, 1161, 1161, 1161,
148668         - /*  1880 */  1161, 1161, 1161, 1161,  215, 1161, 1161, 1161,  524, 1161,
148669         - /*  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,
148670 149250    /*  1900 */  1161, 1161, 1161, 1161, 1161, 1161,  214, 1161, 1161, 1161,
148671         - /*  1910 */  1161,  961, 1161,  530, 1161, 1161, 1161,  103,  103,  880,
148672         - /*  1920 */  1161, 1161, 1161, 1161,  104, 1161,  416,  537,  536, 1161,
148673         - /*  1930 */  1161,  951, 1161, 1161, 1161, 1161,  416, 1161, 1161, 1161,
148674         - /*  1940 */   385, 1161, 1161, 1161, 1161,  288,  526, 1161,  524, 1161,
148675         - /*  1950 */  1161, 1161, 1161, 1161, 1161, 1161,   97,  527, 1161,    4,
148676         - /*  1960 */  1161, 1161,  951,  951,  953,  954,   27, 1161,  423, 1161,
148677         - /*  1970 */  1161,  961, 1161,  530, 1161, 1161, 1161,  103,  103, 1161,
148678         - /*  1980 */  1161, 1161, 1161, 1161,  104, 1161,  416,  537,  536, 1161,
148679         - /*  1990 */  1161,  951,  268, 1161, 1161, 1161,  416,  366,  366,  365,
148680         - /*  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,
148681 149261    /*  2010 */  1161, 1161, 1161, 1161, 1161, 1161, 1161,  213, 1161,  294,
148682 149262    /*  2020 */  1161, 1161,  951,  951,  953,  954,   27,  293, 1161, 1161,
148683 149263    /*  2030 */  1161,  961, 1161, 1161, 1161, 1161, 1161,  103,  103, 1161,
148684         - /*  2040 */  1161, 1161, 1161, 1161,  104, 1161,  416,  537,  536, 1161,
       149264  + /*  2040 */  1161, 1161, 1161, 1161,  104, 1161,  415,  536,  535, 1161,
148685 149265    /*  2050 */  1161,  951, 1161, 1161, 1161, 1161, 1161,  215, 1161, 1161,
148686 149266    /*  2060 */  1161, 1161, 1161, 1161, 1161,  152, 1161, 1161,  154, 1161,
148687 149267    /*  2070 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,  214,
148688 149268    /*  2080 */  1161, 1161,  951,  951,  953,  954,   27, 1161, 1161, 1161,
148689 149269    /*  2090 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
148690 149270    /*  2100 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
148691         - /*  2110 */  1161, 1161, 1161,  385, 1161, 1161, 1161, 1161,  288,  526,
       149271  + /*  2110 */  1161, 1161, 1161,  384, 1161, 1161, 1161, 1161,  288,  525,
148692 149272    /*  2120 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
148693 149273    /*  2130 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
148694         - /*  2140 */  1161,  423,
       149274  + /*  2140 */  1161,  422,
148695 149275   };
148696 149276   static const YYCODETYPE yy_lookahead[] = {
148697         - /*     0 */   184,  184,  259,  260,  261,  259,  260,  261,  176,  177,
148698         - /*    10 */   178,  179,  180,  181,  184,  208,  212,  213,  186,   19,
148699         - /*    20 */   188,  205,  206,  280,  205,  221,   22,  195,   24,  195,
148700         - /*    30 */   208,   31,  195,  205,   29,  205,  206,  255,   33,   39,
148701         - /*    40 */   200,  201,  202,   43,   44,   45,   46,   47,   48,   49,
148702         - /*    50 */    50,   51,   52,   53,   54,   55,   56,   57,  205,  227,
148703         - /*    60 */   228,  227,  228,   59,  227,  228,  259,  260,  261,  252,
148704         - /*    70 */    65,  241,  240,  184,  240,  223,  224,  240,  244,  245,
148705         - /*    80 */   250,  259,  260,  261,   19,  253,   54,   55,   56,   57,
148706         - /*    90 */    58,  184,  255,  184,  205,  206,   96,   97,   98,   99,
148707         - /*   100 */   100,  101,  102,  103,  104,  105,  106,   46,   47,   48,
148708         - /*   110 */    49,   46,  296,  297,  110,  283,   19,   96,   97,   98,
148709         - /*   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,
148710 149290    /*   130 */    98,   99,  100,  101,  102,  103,  104,  105,  106,   94,
148711 149291    /*   140 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
148712         - /*   150 */    53,   54,   55,   56,   57,  110,  106,   73,  251,  114,
148713         - /*   160 */    73,  178,  179,  180,  181,   59,  184,  292,   81,  186,
148714         - /*   170 */   295,  188,  218,  108,   19,  114,  184,   11,  195,  184,
148715         - /*   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,
148716 149296    /*   190 */   145,  146,  147,   96,   97,   98,   99,  100,  101,  102,
148717         - /*   200 */   103,  104,  105,  106,  120,  121,  122,  120,  102,   81,
148718         - /*   210 */   227,  228,  220,   19,   16,  109,  110,  111,  131,  132,
148719         - /*   220 */    26,  184,  184,  240,  229,   96,   97,   98,   99,  100,
148720         - /*   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,
148721 149301    /*   240 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
148722         - /*   250 */    56,   57,  100,  101,  102,  103,  104,  105,  106,  131,
148723         - /*   260 */   132,  106,  127,   69,  129,  130,  283,  112,  113,  114,
148724         - /*   270 */   115,  116,  117,  118,   81,   77,   76,   79,  296,  124,
148725         - /*   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,
148726 149306    /*   290 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
148727         - /*   300 */   106,  184,   35,  205,  206,   22,  113,   43,   44,   45,
       149307  + /*   300 */   106,  184,  259,   19,  184,  100,  101,   43,   44,   45,
148728 149308    /*   310 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
148729         - /*   320 */    56,   57,  205,  206,  131,  132,  100,  101,  291,  292,
148730         - /*   330 */   114,   67,  295,   66,  108,  109,  110,  111,  138,  113,
148731         - /*   340 */   124,   74,   59,  179,  184,  181,  184,  121,   22,  271,
148732         - /*   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,
148733 149313    /*   360 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
148734         - /*   370 */   106,  145,   59,  147,  184,   43,   44,   45,   46,   47,
       149314  + /*   370 */   106,  145,  297,  147,  299,   43,   44,   45,   46,   47,
148735 149315    /*   380 */    48,   49,   50,   51,   52,   53,   54,   55,   56,   57,
148736         - /*   390 */   123,  227,  228,  110,  296,  297,   22,   23,  184,  102,
148737         - /*   400 */   103,  104,  105,  106,  240,  109,  110,  111,  112,  195,
148738         - /*   410 */   204,  115,  116,  117,   22,  184,  226,  253,  212,  205,
148739         - /*   420 */   206,  125,  109,  110,  111,   22,  100,  101,   96,   97,
148740         - /*   430 */    98,   99,  100,  101,  102,  103,  104,  105,  106,  184,
148741         - /*   440 */    59,  227,  228,  121,  122,   59,  277,  283,   19,  289,
148742         - /*   450 */   290,   59,   23,   76,  240,  241,  143,   76,   72,  189,
148743         - /*   460 */   205,  206,   59,   86,  250,   84,   89,   86,  203,   95,
148744         - /*   470 */    89,  281,   43,   44,   45,   46,   47,   48,   49,   50,
148745         - /*   480 */    51,   52,   53,   54,   55,   56,   57,  227,  228,  184,
148746         - /*   490 */   109,  110,  111,   12,  184,  109,  110,  111,  184,  184,
148747         - /*   500 */   240,  109,  110,  111,  184,  195,  214,   59,   27,  184,
148748         - /*   510 */   205,  206,  109,  110,  111,  205,  206,  184,  263,  138,
148749         - /*   520 */   205,  206,  184,   42,   22,   96,   97,   98,   99,  100,
148750         - /*   530 */   101,  102,  103,  104,  105,  106,  266,  227,  228,   59,
148751         - /*   540 */   270,  276,   94,   66,   63,   19,  241,   22,   26,   23,
148752         - /*   550 */   240,  241,   72,   59,   73,  250,  241,  109,  110,   82,
148753         - /*   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,
148754 149334    /*   570 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,
148755         - /*   580 */    54,   55,   56,   57,   59,  184,   26,   59,  268,  109,
148756         - /*   590 */   110,  111,  184,  145,  146,  147,  112,   59,  203,  115,
148757         - /*   600 */   116,  117,  277,  109,  110,  111,  205,  206,  195,  125,
148758         - /*   610 */   277,  109,  110,  111,  100,  101,  139,  109,  110,  111,
148759         - /*   620 */   219,  184,   96,   97,   98,   99,  100,  101,  102,  103,
148760         - /*   630 */   104,  105,  106,  111,  109,  110,  111,  109,  110,  111,
148761         - /*   640 */   227,  228,   19,  184,  136,  184,   23,  109,  110,  111,
148762         - /*   650 */   200,  201,  202,  240,  259,  260,  261,  195,  136,  145,
148763         - /*   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,
148764 149344    /*   670 */    47,   48,   49,   50,   51,   52,   53,   54,   55,   56,
148765         - /*   680 */    57,  205,  206,  205,  206,  227,  228,  184,  229,  227,
148766         - /*   690 */   228,  131,  132,  184,   59,  219,  184,  219,  240,  291,
148767         - /*   700 */   292,  184,  240,  295,  105,  106,   22,   23,  205,  206,
148768         - /*   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,
148769 149349    /*   720 */    97,   98,   99,  100,  101,  102,  103,  104,  105,  106,
148770         - /*   730 */   251,  219,  205,  206,  205,  206,  184,  205,  206,   19,
148771         - /*   740 */   184,   16,  184,   23,  241,  110,  219,   21,  219,  184,
148772         - /*   750 */   241,  219,  286,  287,  195,  184,  195,  205,  206,  201,
148773         - /*   760 */   202,  205,  206,   43,   44,   45,   46,   47,   48,   49,
148774         - /*   770 */    50,   51,   52,   53,   54,   55,   56,   57,  184,   95,
148775         - /*   780 */    22,   23,  184,   26,   26,  220,  227,  228,  227,  228,
148776         - /*   790 */   196,  184,   23,  241,   26,   26,  195,  241,  184,  240,
148777         - /*   800 */    12,  240,   77,   26,   79,  195,   80,  290,  201,  202,
148778         - /*   810 */   216,  184,  218,  195,  184,   27,   96,   97,   98,   99,
148779         - /*   820 */   100,  101,  102,  103,  104,  105,  106,  269,  227,  228,
148780         - /*   830 */    42,  184,  205,  206,  184,  184,   19,  227,  228,  192,
148781         - /*   840 */    23,  240,  116,  196,   76,  227,  228,  120,  121,  122,
148782         - /*   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,
148783 149363    /*   860 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
148784         - /*   870 */    53,   54,   55,   56,   57,  184,  269,  184,  153,  153,
148785         - /*   880 */   111,  184,    7,    8,    9,  184,  138,  184,  184,  196,
148786         - /*   890 */   184,  120,  121,  122,  184,  138,  205,  206,  184,  102,
148787         - /*   900 */   184,  184,  205,  206,  156,  136,  205,  206,  205,  206,
148788         - /*   910 */   198,  199,  135,   96,   97,   98,   99,  100,  101,  102,
148789         - /*   920 */   103,  104,  105,  106,  184,  128,  184,  184,  184,  254,
148790         - /*   930 */   133,  184,  237,   19,  239,  229,  226,   23,  292,  184,
148791         - /*   940 */   226,  295,  226,  226,  184,  205,  206,  205,  206,  205,
148792         - /*   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,
148793 149373    /*   960 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
148794         - /*   970 */    56,   57,  205,  206,  184,  205,  206,   43,   44,   45,
       149374  + /*   970 */    56,   57,  184,  206,  207,  184,  184,   43,   44,   45,
148795 149375    /*   980 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
148796         - /*   990 */    56,   57,  157,  158,   26,  205,  206,  254,   26,  252,
148797         - /*  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,
148798 149378    /*  1010 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
148799         - /*  1020 */   106,  205,  206,  205,  206,  205,  206,  205,  206,  184,
       149379  + /*  1020 */   106,  206,  207,  184,  206,  207,  206,  207,  206,  207,
148800 149380    /*  1030 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
148801         - /*  1040 */   106,  184,  184,  184,   59,  184,   60,  184,  229,  184,
148802         - /*  1050 */   205,  206,  184,  258,  184,   19,  184,   19,  184,  246,
148803         - /*  1060 */   184,  258,  205,  206,  205,  206,  205,  206,  205,  206,
148804         - /*  1070 */   205,  206,  184,  205,  206,  205,  206,  205,  206,  205,
148805         - /*  1080 */   206,  205,  206,  292,  226,  151,  295,  184,  228,  294,
148806         - /*  1090 */   184,  119,  184,  205,  206,  110,  150,  294,  152,  184,
148807         - /*  1100 */   240,  184,   22,   23,   23,   19,  184,   26,  205,  206,
148808         - /*  1110 */   142,  205,  206,  205,  206,  184,  198,  199,  131,  132,
148809         - /*  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,
148810 149390    /*  1130 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,
148811         - /*  1140 */    54,   55,   56,   57,  184,  109,  184,  109,  184,   43,
       149391  + /*  1140 */    54,   55,   56,   57,  184,   26,  184,   26,  184,   43,
148812 149392    /*  1150 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,
148813         - /*  1160 */    54,   55,   56,   57,   46,  205,  206,  205,  206,  205,
148814         - /*  1170 */   206,  232,  184,  184,  184,   95,  184,  284,  285,  244,
148815         - /*  1180 */   245,  242,   96,   97,   98,   99,  100,  101,  102,  103,
148816         - /*  1190 */   104,  105,  106,  205,  206,  205,  206,  205,  206,  184,
148817         - /*  1200 */    22,  184,   96,   97,   98,   99,  100,  101,  102,  103,
148818         - /*  1210 */   104,  105,  106,  184,   24,   23,  184,  184,   26,  184,
148819         - /*  1220 */   205,  206,  205,  206,  184,   31,  108,  128,   22,  122,
148820         - /*  1230 */   184,   53,  133,   39,  205,  206,   22,  151,  205,  206,
148821         - /*  1240 */   205,  206,  113,  114,   23,  205,  206,   26,   59,   23,
148822         - /*  1250 */    23,  144,   26,   26,  184,   23,   23,   19,   26,   26,
148823         - /*  1260 */     7,    8,   24,   23,  214,   23,   26,   61,   26,   59,
148824         - /*  1270 */    23,   23,   23,   26,   26,   26,  145,   19,  147,   59,
148825         - /*  1280 */   184,   43,   44,   45,   46,   47,   48,   49,   50,   51,
148826         - /*  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,
148827 149407    /*  1300 */    26,   43,   44,   45,   46,   47,   48,   49,   50,   51,
148828         - /*  1310 */    52,   53,   54,   55,   56,   57,   23,  184,  184,   26,
148829         - /*  1320 */   110,  184,  184,  184,  134,  184,  184,  184,  184,  184,
148830         - /*  1330 */   110,  184,  184,  184,   96,   97,   98,   99,  100,  101,
148831         - /*  1340 */   102,  103,  104,  105,  106,  184,  184,  184,  134,  300,
148832         - /*  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,
148833 149413    /*  1360 */   102,  103,  104,  105,  106,  184,  184,  184,  184,  184,
148834         - /*  1370 */   224,  184,  282,  273,   19,  272,  203,  182,  243,  243,
148835         - /*  1380 */   230,  209,  278,  243,  231,  208,  265,  278,  234,  234,
148836         - /*  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,
148837 149417    /*  1400 */    45,   46,   47,   48,   49,   50,   51,   52,   53,   54,
148838         - /*  1410 */    55,   56,   57,  208,  247,  187,  134,  247,  247,   38,
       149418  + /*  1410 */    55,   56,   57,  214,   60,  248,  248,  187,  134,   38,
148839 149419    /*  1420 */    45,   46,   47,   48,   49,   50,   51,   52,   53,   54,
148840         - /*  1430 */    55,   56,   57,  237,  231,  191,  191,  279,  279,  282,
148841         - /*  1440 */   143,  191,  108,  268,   22,   19,   20,  256,   22,   43,
148842         - /*  1450 */   257,   96,   97,   98,   99,  100,  101,  102,  103,  104,
148843         - /*  1460 */   105,  106,   36,  222,  142,  234,   18,  191,  225,   18,
148844         - /*  1470 */   190,   96,   97,   98,   99,  100,  101,  102,  103,  104,
148845         - /*  1480 */   105,  106,  225,  191,  225,   59,  225,  257,  234,  234,
148846         - /*  1490 */   256,  222,  222,  190,  234,  150,   62,   71,  275,  274,
148847         - /*  1500 */   191,   19,   20,  190,   22,   22,  210,   81,  191,  190,
148848         - /*  1510 */   210,  191,  108,  190,  207,  207,   64,  207,   36,  215,
148849         - /*  1520 */    94,  210,  207,  209,  119,  207,  100,  101,  207,  106,
148850         - /*  1530 */    48,  215,  207,  107,  210,  109,  110,  111,  267,  267,
148851         - /*  1540 */   114,   59,  210,  249,  137,  108,  248,  191,  249,  248,
148852         - /*  1550 */    88,  249,  141,   71,  248,  299,  138,  131,  132,   22,
148853         - /*  1560 */   191,  249,  299,  237,   82,  238,  150,  262,  140,   87,
148854         - /*  1570 */   139,  145,  146,  147,  148,  149,   94,  248,  238,  236,
148855         - /*  1580 */    25,  235,  100,  101,  234,  194,   26,  193,   13,  107,
148856         - /*  1590 */     6,  109,  110,  111,  264,  185,  114,  185,  183,  197,
148857         - /*  1600 */   183,  203,  183,  203,  203,  197,  203,  211,  211,    4,
148858         - /*  1610 */   197,    3,  203,   22,  155,   15,  288,  203,   93,  288,
148859         - /*  1620 */   285,   23,   16,  203,  203,   23,  132,  145,  146,  147,
148860         - /*  1630 */   148,  149,    0,    1,    2,  143,  123,    5,   24,  135,
148861         - /*  1640 */    20,   16,   10,   11,   12,   13,   14,  137,    1,   17,
148862         - /*  1650 */   135,  144,   19,   20,  123,   22,   61,  143,   37,  123,
148863         - /*  1660 */    53,  109,   30,   53,   32,   53,   53,  134,   34,   36,
148864         - /*  1670 */     1,    5,   40,   22,  108,  153,   26,   68,   75,   68,
148865         - /*  1680 */    41,  134,  108,   24,   20,  124,   19,  118,   23,   67,
148866         - /*  1690 */    22,   67,   59,   22,   22,   22,   22,   67,   28,   37,
148867         - /*  1700 */    23,  142,   70,   22,   71,   23,  157,   23,   23,   26,
148868         - /*  1710 */    78,   23,   22,   81,   23,   82,   24,   22,   24,  134,
148869         - /*  1720 */    87,   23,   19,   20,   92,   22,  109,   94,   23,   22,
148870         - /*  1730 */    34,   34,  136,  100,  101,   26,   34,   85,   34,   36,
148871         - /*  1740 */   107,   83,  109,  110,  111,   34,   90,  114,   34,   23,
148872         - /*  1750 */    75,   75,   44,   22,   24,   26,   34,   23,  126,   26,
148873         - /*  1760 */    23,   23,   59,  131,  132,   23,   23,   26,   23,   22,
148874         - /*  1770 */    11,   22,   22,   22,   71,   23,   23,   22,  145,  146,
148875         - /*  1780 */   147,  148,  149,   26,   23,   82,  154,  134,  128,  134,
148876         - /*  1790 */    87,  134,   15,    1,  301,  134,  301,   94,  301,  301,
148877         - /*  1800 */   301,  301,  301,  100,  101,  301,  301,  301,  301,  301,
148878         - /*  1810 */   107,  301,  109,  110,  111,    1,    2,  114,  301,    5,
148879         - /*  1820 */   301,  301,  301,  301,   10,   11,   12,   13,   14,  301,
148880         - /*  1830 */   301,   17,  301,  301,  301,  301,   19,   20,  301,   22,
148881         - /*  1840 */   301,  301,  301,  301,   30,  301,   32,  301,  145,  146,
148882         - /*  1850 */   147,  148,  149,   36,   40,  301,  301,  301,  301,  301,
148883         - /*  1860 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148884         - /*  1870 */   301,  301,  301,  301,  301,  301,   59,  301,  301,  301,
148885         - /*  1880 */   301,  301,  301,  301,   70,  301,  301,  301,   71,  301,
148886         - /*  1890 */   301,  301,   78,  301,  301,   81,   19,   20,  301,   22,
148887         - /*  1900 */   301,  301,  301,  301,  301,  301,   92,  301,  301,  301,
148888         - /*  1910 */   301,   94,  301,   36,  301,  301,  301,  100,  101,  102,
148889         - /*  1920 */   301,  301,  301,  301,  107,  301,  109,  110,  111,  301,
148890         - /*  1930 */   301,  114,  301,  301,  301,  301,   59,  301,  301,  301,
148891         - /*  1940 */   126,  301,  301,  301,  301,  131,  132,  301,   71,  301,
148892         - /*  1950 */   301,  301,  301,  301,  301,  301,   19,   20,  301,   22,
148893         - /*  1960 */   301,  301,  145,  146,  147,  148,  149,  301,  154,  301,
148894         - /*  1970 */   301,   94,  301,   36,  301,  301,  301,  100,  101,  301,
148895         - /*  1980 */   301,  301,  301,  301,  107,  301,  109,  110,  111,  301,
148896         - /*  1990 */   301,  114,    5,  301,  301,  301,   59,   10,   11,   12,
148897         - /*  2000 */    13,   14,  301,  301,   17,  301,  301,  301,   71,  301,
148898         - /*  2010 */   301,  301,  301,  301,  301,  301,  301,   30,  301,   32,
148899         - /*  2020 */   301,  301,  145,  146,  147,  148,  149,   40,  301,  301,
148900         - /*  2030 */   301,   94,  301,  301,  301,  301,  301,  100,  101,  301,
148901         - /*  2040 */   301,  301,  301,  301,  107,  301,  109,  110,  111,  301,
148902         - /*  2050 */   301,  114,  301,  301,  301,  301,  301,   70,  301,  301,
148903         - /*  2060 */   301,  301,  301,  301,  301,   78,  301,  301,   81,  301,
148904         - /*  2070 */   301,  301,  301,  301,  301,  301,  301,  301,  301,   92,
148905         - /*  2080 */   301,  301,  145,  146,  147,  148,  149,  301,  301,  301,
148906         - /*  2090 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148907         - /*  2100 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148908         - /*  2110 */   301,  301,  301,  126,  301,  301,  301,  301,  131,  132,
148909         - /*  2120 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148910         - /*  2130 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148911         - /*  2140 */   301,  154,  301,  301,  301,  301,  301,  301,  301,  301,
148912         - /*  2150 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
148913         - /*  2160 */   301,  301,  301,  301,  301,  301,  301,  301,  301,
148914         -};
148915         -#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)
148916 149496   #define YY_SHIFT_MIN      (0)
148917 149497   #define YY_SHIFT_MAX      (1987)
148918 149498   static const unsigned short int yy_shift_ofst[] = {
148919         - /*     0 */  1814, 1632, 1987, 1426, 1426,  128, 1482, 1633, 1703, 1877,
148920         - /*    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,
148921 149501    /*    20 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
148922         - /*    30 */   226,  226,  381,  381,  296,  193,  128,  128,  128,  128,
148923         - /*    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,
148924 149504    /*    50 */   914,  934, 1086, 1238, 1106, 1106, 1106, 1106, 1106, 1106,
148925 149505    /*    60 */  1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
148926 149506    /*    70 */  1106, 1106, 1258, 1106, 1355, 1375, 1375, 1817, 1877, 1877,
148927 149507    /*    80 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
148928 149508    /*    90 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
148929 149509    /*   100 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
148930 149510    /*   110 */  1937, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
148931 149511    /*   120 */  1877, 1877, 1877, 1877,   32,  129,  129,  129,  129,  129,
148932         - /*   130 */    21,  152,  297,  494,  726,   65,  494,  514,  514,  494,
148933         - /*   140 */   560,  560,  560,  560,  322,  599,   50, 2142, 2142,  155,
148934         - /*   150 */   155,  155,  313,  392,  386,  392,  392,  481,  481,  200,
148935         - /*   160 */   480,  684,  758,  494,  494,  494,  494,  494,  494,  494,
148936         - /*   170 */   494,  494,  494,  494,  494,  494,  494,  494,  494,  494,
148937         - /*   180 */   494,  494,  494,  494,  768,  768,  494,  166,  377,  377,
148938         - /*   190 */   635,  835,  835,  635,  748,  987, 2142, 2142, 2142,  448,
148939         - /*   200 */    45,   45,  403,  484,  502,  106,  525,  508,  528,  538,
148940         - /*   210 */   494,  494,  494,  494,  494,  494,  494,  494,  494,   84,
148941         - /*   220 */   494,  494,  494,  494,  494,  494,  494,  494,  494,  494,
148942         - /*   230 */   494,  494,  267,  267,  267,  494,  494,  494,  494,  769,
148943         - /*   240 */   494,  494,  494,    4,  477,  494,  494,  788,  494,  494,
148944         - /*   250 */   494,  494,  494,  494,  494,  494,  727,    5,  135,  985,
148945         - /*   260 */   985,  985,  985,  522,  135,  135,  797,  326,  875,  986,
148946         - /*   270 */   968, 1036, 1036, 1038,  968,  968, 1038,  972, 1081, 1118,
148947         - /*   280 */  1194, 1194, 1194, 1036,  757,  757,  946,  777, 1099, 1102,
148948         - /*   290 */  1333, 1282, 1282, 1381, 1381, 1282, 1297, 1334, 1422, 1406,
148949         - /*   300 */  1322, 1448, 1448, 1448, 1448, 1282, 1451, 1322, 1322, 1334,
148950         - /*   310 */  1422, 1406, 1406, 1322, 1282, 1451, 1345, 1434, 1282, 1451,
148951         - /*   320 */  1483, 1282, 1451, 1282, 1451, 1483, 1404, 1404, 1404, 1452,
148952         - /*   330 */  1483, 1404, 1405, 1404, 1452, 1404, 1404, 1483, 1423, 1423,
148953         - /*   340 */  1483, 1407, 1437, 1407, 1437, 1407, 1437, 1407, 1437, 1282,
148954         - /*   350 */  1462, 1462, 1411, 1418, 1537, 1282, 1416, 1411, 1428, 1431,
148955         - /*   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,
148956 149536    /*   370 */  2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
148957         - /*   380 */  2142, 2142, 2142, 2142,   61,  725,  374, 1080,  198,  771,
148958         - /*   390 */   283, 1192, 1178, 1190, 1107, 1221, 1206, 1226, 1227, 1232,
148959         - /*   400 */  1233, 1240, 1242, 1189, 1129, 1253,  216, 1210, 1247, 1248,
148960         - /*   410 */  1249, 1131, 1151, 1274, 1293, 1220, 1214, 1605, 1608, 1591,
148961         - /*   420 */  1459, 1600, 1525, 1606, 1598, 1602, 1494, 1492, 1513, 1614,
148962         - /*   430 */  1504, 1620, 1510, 1625, 1647, 1515, 1507, 1531, 1595, 1621,
148963         - /*   440 */  1514, 1607, 1610, 1612, 1613, 1536, 1552, 1634, 1533, 1669,
148964         - /*   450 */  1666, 1651, 1566, 1522, 1609, 1650, 1611, 1603, 1639, 1547,
148965         - /*   460 */  1574, 1659, 1664, 1667, 1561, 1569, 1668, 1622, 1671, 1672,
148966         - /*   470 */  1665, 1673, 1624, 1670, 1674, 1630, 1662, 1677, 1559, 1681,
148967         - /*   480 */  1682, 1549, 1684, 1685, 1683, 1688, 1690, 1692, 1691, 1695,
148968         - /*   490 */  1694, 1585, 1698, 1705, 1617, 1696, 1707, 1596, 1709, 1697,
148969         - /*   500 */  1702, 1704, 1711, 1652, 1675, 1658, 1708, 1676, 1656, 1714,
148970         - /*   510 */  1726, 1731, 1730, 1729, 1733, 1722, 1734, 1709, 1737, 1738,
148971         - /*   520 */  1742, 1743, 1741, 1745, 1747, 1759, 1749, 1750, 1752, 1753,
148972         - /*   530 */  1751, 1755, 1757, 1660, 1653, 1655, 1657, 1661, 1761, 1777,
148973         - /*   540 */  1792,
148974         -};
148975         -#define YY_REDUCE_COUNT (383)
148976         -#define YY_REDUCE_MIN   (-257)
148977         -#define YY_REDUCE_MAX   (1421)
148978         -static const short yy_reduce_ofst[] = {
148979         - /*     0 */  -168,  -17,  164,  214,  310, -166, -184,  -18,   98, -170,
148980         - /*    10 */   305,  315, -163, -193, -178, -257,  395,  401,  476,  478,
148981         - /*    20 */   512,  117,  527,  529,  503,  509,  532,  255,  552,  556,
148982         - /*    30 */   558,  607,   37,  408,  594,  413,  462,  559,  561,  601,
148983         - /*    40 */   610,  618, -254, -254, -254, -254, -254, -254, -254, -254,
148984         - /*    50 */  -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,
148985         - /*    60 */  -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,
148986         - /*    70 */  -254, -254, -254, -254, -254, -254, -254, -111,  627,  650,
148987         - /*    80 */   691,  697,  701,  703,  740,  742,  744,  767,  770,  790,
148988         - /*    90 */   816,  818,  820,  822,  845,  857,  859,  861,  863,  865,
148989         - /*   100 */   868,  870,  872,  874,  876,  888,  903,  906,  908,  915,
148990         - /*   110 */   917,  922,  960,  962,  964,  988,  990,  992, 1015, 1017,
148991         - /*   120 */  1029, 1033, 1035, 1040, -254, -254, -254, -254, -254, -254,
148992         - /*   130 */  -254, -254, -254,  190,  270, -196,  160, -160,  450,  647,
148993         - /*   140 */   260,  458,  260,  458,   78, -254, -254, -254, -254,  206,
148994         - /*   150 */   206,  206,  320,  598,   -5,  675,  743, -148,  340, -125,
148995         - /*   160 */   459,  466,  466,  693,  -93,  461,  479,  706,  710,  714,
148996         - /*   170 */   716,  717,  169, -183,  325,  314,  704,  333,  747,  858,
148997         - /*   180 */    -8,  819,  565,  755,  646,  660,  517,  265,  713,  791,
148998         - /*   190 */   712,  795,  803,  918,  695,  860,  893,  935,  939, -181,
148999         - /*   200 */  -172, -147,  -91,  -46,   -3,  162,  173,  231,  338,  437,
149000         - /*   210 */   571,  614,  630,  651,  760,  931,  989, 1032, 1046, -218,
149001         - /*   220 */    38, 1070, 1096, 1133, 1134, 1137, 1138, 1139, 1141, 1142,
149002         - /*   230 */  1143, 1144,  292,  451, 1050, 1145, 1147, 1148, 1149,  813,
149003         - /*   240 */  1161, 1162, 1163, 1108, 1049, 1166, 1168, 1146, 1169,  162,
149004         - /*   250 */  1181, 1182, 1183, 1184, 1185, 1187, 1100, 1103, 1150, 1135,
149005         - /*   260 */  1136, 1140, 1152,  813, 1150, 1150, 1153, 1173, 1195, 1090,
149006         - /*   270 */  1154, 1167, 1170, 1104, 1155, 1156, 1109, 1172, 1174, 1179,
149007         - /*   280 */  1177, 1188, 1205, 1171, 1160, 1196, 1121, 1165, 1203, 1228,
149008         - /*   290 */  1157, 1244, 1245, 1158, 1159, 1250, 1175, 1193, 1191, 1241,
149009         - /*   300 */  1231, 1243, 1257, 1259, 1261, 1276, 1280, 1254, 1255, 1230,
149010         - /*   310 */  1234, 1269, 1270, 1260, 1292, 1303, 1223, 1225, 1309, 1313,
149011         - /*   320 */  1296, 1317, 1319, 1320, 1323, 1300, 1307, 1308, 1310, 1304,
149012         - /*   330 */  1311, 1315, 1314, 1318, 1316, 1321, 1325, 1324, 1271, 1272,
149013         - /*   340 */  1332, 1294, 1298, 1299, 1301, 1302, 1306, 1312, 1329, 1356,
149014         - /*   350 */  1256, 1263, 1327, 1326, 1305, 1369, 1330, 1340, 1343, 1346,
149015         - /*   360 */  1350, 1391, 1394, 1410, 1412, 1415, 1417, 1419, 1328, 1331,
149016         - /*   370 */  1335, 1402, 1398, 1400, 1401, 1403, 1408, 1396, 1397, 1409,
149017         - /*   380 */  1414, 1420, 1421, 1413,
       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)
       149557  +static const short yy_reduce_ofst[] = {
       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,
149018 149597   };
149019 149598   static const YYACTIONTYPE yy_default[] = {
149020         - /*     0 */  1536, 1536, 1536, 1376, 1159, 1265, 1159, 1159, 1159, 1376,
149021         - /*    10 */  1376, 1376, 1159, 1295, 1295, 1429, 1190, 1159, 1159, 1159,
149022         - /*    20 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1375, 1159, 1159,
149023         - /*    30 */  1159, 1159, 1459, 1459, 1159, 1159, 1159, 1159, 1159, 1159,
149024         - /*    40 */  1159, 1159, 1159, 1301, 1159, 1159, 1159, 1159, 1159, 1377,
149025         - /*    50 */  1378, 1159, 1159, 1159, 1428, 1430, 1393, 1311, 1310, 1309,
149026         - /*    60 */  1308, 1411, 1282, 1306, 1299, 1303, 1371, 1372, 1370, 1374,
149027         - /*    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,
149028 149607    /*    80 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149029 149608    /*    90 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149030 149609    /*   100 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149031 149610    /*   110 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149032         - /*   120 */  1159, 1159, 1159, 1159, 1350, 1355, 1361, 1354, 1351, 1344,
149033         - /*   130 */  1343, 1345, 1346, 1159, 1180, 1229, 1159, 1159, 1159, 1159,
149034         - /*   140 */  1447, 1446, 1159, 1159, 1190, 1347, 1348, 1358, 1357, 1436,
149035         - /*   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,
149036 149615    /*   160 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149037 149616    /*   170 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149038         - /*   180 */  1159, 1159, 1159, 1159, 1459, 1459, 1159, 1190, 1459, 1459,
149039         - /*   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,
149040 149619    /*   200 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149041         - /*   210 */  1159, 1159, 1159, 1433, 1431, 1159, 1159, 1159, 1159, 1159,
       149620  + /*   210 */  1159, 1159, 1159, 1434, 1432, 1159, 1159, 1159, 1159, 1159,
149042 149621    /*   220 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149043 149622    /*   230 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149044         - /*   240 */  1159, 1159, 1159, 1261, 1159, 1159, 1159, 1159, 1159, 1159,
149045         - /*   250 */  1159, 1159, 1159, 1159, 1159, 1486, 1159, 1406, 1243, 1261,
149046         - /*   260 */  1261, 1261, 1261, 1263, 1244, 1242, 1255, 1190, 1166, 1528,
149047         - /*   270 */  1305, 1284, 1284, 1525, 1305, 1305, 1525, 1204, 1506, 1201,
149048         - /*   280 */  1295, 1295, 1295, 1284, 1289, 1289, 1373, 1262, 1255, 1159,
149049         - /*   290 */  1528, 1270, 1270, 1527, 1527, 1270, 1394, 1314, 1320, 1232,
149050         - /*   300 */  1305, 1238, 1238, 1238, 1238, 1270, 1177, 1305, 1305, 1314,
149051         - /*   310 */  1320, 1232, 1232, 1305, 1270, 1177, 1410, 1522, 1270, 1177,
149052         - /*   320 */  1384, 1270, 1177, 1270, 1177, 1384, 1230, 1230, 1230, 1219,
149053         - /*   330 */  1384, 1230, 1204, 1230, 1219, 1230, 1230, 1384, 1388, 1388,
149054         - /*   340 */  1384, 1288, 1283, 1288, 1283, 1288, 1283, 1288, 1283, 1270,
149055         - /*   350 */  1469, 1469, 1300, 1289, 1379, 1270, 1159, 1300, 1298, 1296,
149056         - /*   360 */  1305, 1183, 1222, 1489, 1489, 1485, 1485, 1485, 1533, 1533,
149057         - /*   370 */  1442, 1501, 1190, 1190, 1190, 1190, 1501, 1206, 1206, 1190,
149058         - /*   380 */  1190, 1190, 1190, 1501, 1159, 1159, 1159, 1159, 1159, 1159,
149059         - /*   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,
149060 149639    /*   400 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149061         - /*   410 */  1159, 1159, 1159, 1159, 1159, 1159, 1325, 1159, 1162, 1439,
149062         - /*   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,
149063 149642    /*   430 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149064         - /*   440 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1524, 1159,
149065         - /*   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,
149066 149645    /*   460 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149067 149646    /*   470 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149068 149647    /*   480 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149069         - /*   490 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1297, 1159,
       149648  + /*   490 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1298, 1159, 1159,
149070 149649    /*   500 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149071         - /*   510 */  1159, 1159, 1159, 1474, 1290, 1159, 1159, 1515, 1159, 1159,
       149650  + /*   510 */  1159, 1159, 1475, 1291, 1159, 1159, 1516, 1159, 1159, 1159,
149072 149651    /*   520 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
149073         - /*   530 */  1159, 1159, 1510, 1246, 1327, 1159, 1326, 1330, 1159, 1171,
149074         - /*   540 */  1159,
       149652  + /*   530 */  1159, 1511, 1247, 1328, 1159, 1327, 1331, 1159, 1171, 1159,
149075 149653   };
149076 149654   /********** End of lemon-generated parsing tables *****************************/
149077 149655   
149078 149656   /* The next table maps tokens (terminal symbols) into fallback tokens.  
149079 149657   ** If a construct like the following:
149080 149658   ** 
149081 149659   **      %fallback ID X Y Z.
................................................................................
149473 150051     /*  197 */ "carglist",
149474 150052     /*  198 */ "typetoken",
149475 150053     /*  199 */ "typename",
149476 150054     /*  200 */ "signed",
149477 150055     /*  201 */ "plus_num",
149478 150056     /*  202 */ "minus_num",
149479 150057     /*  203 */ "scanpt",
149480         -  /*  204 */ "ccons",
149481         -  /*  205 */ "term",
149482         -  /*  206 */ "expr",
149483         -  /*  207 */ "onconf",
149484         -  /*  208 */ "sortorder",
149485         -  /*  209 */ "autoinc",
149486         -  /*  210 */ "eidlist_opt",
149487         -  /*  211 */ "refargs",
149488         -  /*  212 */ "defer_subclause",
149489         -  /*  213 */ "refarg",
149490         -  /*  214 */ "refact",
149491         -  /*  215 */ "init_deferred_pred_opt",
149492         -  /*  216 */ "conslist",
149493         -  /*  217 */ "tconscomma",
149494         -  /*  218 */ "tcons",
149495         -  /*  219 */ "sortlist",
149496         -  /*  220 */ "eidlist",
149497         -  /*  221 */ "defer_subclause_opt",
149498         -  /*  222 */ "orconf",
149499         -  /*  223 */ "resolvetype",
149500         -  /*  224 */ "raisetype",
149501         -  /*  225 */ "ifexists",
149502         -  /*  226 */ "fullname",
149503         -  /*  227 */ "selectnowith",
149504         -  /*  228 */ "oneselect",
149505         -  /*  229 */ "wqlist",
149506         -  /*  230 */ "multiselect_op",
149507         -  /*  231 */ "distinct",
149508         -  /*  232 */ "selcollist",
149509         -  /*  233 */ "from",
149510         -  /*  234 */ "where_opt",
149511         -  /*  235 */ "groupby_opt",
149512         -  /*  236 */ "having_opt",
149513         -  /*  237 */ "orderby_opt",
149514         -  /*  238 */ "limit_opt",
149515         -  /*  239 */ "window_clause",
149516         -  /*  240 */ "values",
149517         -  /*  241 */ "nexprlist",
149518         -  /*  242 */ "sclp",
149519         -  /*  243 */ "as",
149520         -  /*  244 */ "seltablist",
149521         -  /*  245 */ "stl_prefix",
149522         -  /*  246 */ "joinop",
149523         -  /*  247 */ "indexed_opt",
149524         -  /*  248 */ "on_opt",
149525         -  /*  249 */ "using_opt",
149526         -  /*  250 */ "exprlist",
149527         -  /*  251 */ "xfullname",
149528         -  /*  252 */ "idlist",
149529         -  /*  253 */ "with",
149530         -  /*  254 */ "setlist",
149531         -  /*  255 */ "insert_cmd",
149532         -  /*  256 */ "idlist_opt",
149533         -  /*  257 */ "upsert",
149534         -  /*  258 */ "over_clause",
149535         -  /*  259 */ "likeop",
149536         -  /*  260 */ "between_op",
149537         -  /*  261 */ "in_op",
149538         -  /*  262 */ "paren_exprlist",
149539         -  /*  263 */ "case_operand",
149540         -  /*  264 */ "case_exprlist",
149541         -  /*  265 */ "case_else",
149542         -  /*  266 */ "uniqueflag",
149543         -  /*  267 */ "collate",
149544         -  /*  268 */ "vinto",
149545         -  /*  269 */ "nmnum",
149546         -  /*  270 */ "trigger_decl",
149547         -  /*  271 */ "trigger_cmd_list",
149548         -  /*  272 */ "trigger_time",
149549         -  /*  273 */ "trigger_event",
149550         -  /*  274 */ "foreach_clause",
149551         -  /*  275 */ "when_clause",
149552         -  /*  276 */ "trigger_cmd",
149553         -  /*  277 */ "trnm",
149554         -  /*  278 */ "tridxby",
149555         -  /*  279 */ "database_kw_opt",
149556         -  /*  280 */ "key_opt",
149557         -  /*  281 */ "add_column_fullname",
149558         -  /*  282 */ "kwcolumn_opt",
149559         -  /*  283 */ "create_vtab",
149560         -  /*  284 */ "vtabarglist",
149561         -  /*  285 */ "vtabarg",
149562         -  /*  286 */ "vtabargtoken",
149563         -  /*  287 */ "lp",
149564         -  /*  288 */ "anylist",
149565         -  /*  289 */ "windowdefn_list",
149566         -  /*  290 */ "windowdefn",
149567         -  /*  291 */ "window",
149568         -  /*  292 */ "frame_opt",
149569         -  /*  293 */ "part_opt",
149570         -  /*  294 */ "filter_opt",
149571         -  /*  295 */ "range_or_rows",
149572         -  /*  296 */ "frame_bound",
149573         -  /*  297 */ "frame_bound_s",
149574         -  /*  298 */ "frame_bound_e",
149575         -  /*  299 */ "frame_exclude_opt",
149576         -  /*  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",
149577 150156   };
149578 150157   #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
149579 150158   
149580 150159   #ifndef NDEBUG
149581 150160   /* For tracing reduce actions, the names of all rules are required.
149582 150161   */
149583 150162   static const char *const yyRuleName[] = {
................................................................................
149606 150185    /*  22 */ "table_options ::= WITHOUT nm",
149607 150186    /*  23 */ "columnname ::= nm typetoken",
149608 150187    /*  24 */ "typetoken ::=",
149609 150188    /*  25 */ "typetoken ::= typename LP signed RP",
149610 150189    /*  26 */ "typetoken ::= typename LP signed COMMA signed RP",
149611 150190    /*  27 */ "typename ::= typename ID|STRING",
149612 150191    /*  28 */ "scanpt ::=",
149613         - /*  29 */ "ccons ::= CONSTRAINT nm",
149614         - /*  30 */ "ccons ::= DEFAULT scanpt term scanpt",
149615         - /*  31 */ "ccons ::= DEFAULT LP expr RP",
149616         - /*  32 */ "ccons ::= DEFAULT PLUS term scanpt",
149617         - /*  33 */ "ccons ::= DEFAULT MINUS term scanpt",
149618         - /*  34 */ "ccons ::= DEFAULT scanpt ID|INDEXED",
149619         - /*  35 */ "ccons ::= NOT NULL onconf",
149620         - /*  36 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
149621         - /*  37 */ "ccons ::= UNIQUE onconf",
149622         - /*  38 */ "ccons ::= CHECK LP expr RP",
149623         - /*  39 */ "ccons ::= REFERENCES nm eidlist_opt refargs",
149624         - /*  40 */ "ccons ::= defer_subclause",
149625         - /*  41 */ "ccons ::= COLLATE ID|STRING",
149626         - /*  42 */ "autoinc ::=",
149627         - /*  43 */ "autoinc ::= AUTOINCR",
149628         - /*  44 */ "refargs ::=",
149629         - /*  45 */ "refargs ::= refargs refarg",
149630         - /*  46 */ "refarg ::= MATCH nm",
149631         - /*  47 */ "refarg ::= ON INSERT refact",
149632         - /*  48 */ "refarg ::= ON DELETE refact",
149633         - /*  49 */ "refarg ::= ON UPDATE refact",
149634         - /*  50 */ "refact ::= SET NULL",
149635         - /*  51 */ "refact ::= SET DEFAULT",
149636         - /*  52 */ "refact ::= CASCADE",
149637         - /*  53 */ "refact ::= RESTRICT",
149638         - /*  54 */ "refact ::= NO ACTION",
149639         - /*  55 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
149640         - /*  56 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
149641         - /*  57 */ "init_deferred_pred_opt ::=",
149642         - /*  58 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
149643         - /*  59 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
149644         - /*  60 */ "conslist_opt ::=",
149645         - /*  61 */ "tconscomma ::= COMMA",
149646         - /*  62 */ "tcons ::= CONSTRAINT nm",
149647         - /*  63 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf",
149648         - /*  64 */ "tcons ::= UNIQUE LP sortlist RP onconf",
149649         - /*  65 */ "tcons ::= CHECK LP expr RP onconf",
149650         - /*  66 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt",
149651         - /*  67 */ "defer_subclause_opt ::=",
149652         - /*  68 */ "onconf ::=",
149653         - /*  69 */ "onconf ::= ON CONFLICT resolvetype",
149654         - /*  70 */ "orconf ::=",
149655         - /*  71 */ "orconf ::= OR resolvetype",
149656         - /*  72 */ "resolvetype ::= IGNORE",
149657         - /*  73 */ "resolvetype ::= REPLACE",
149658         - /*  74 */ "cmd ::= DROP TABLE ifexists fullname",
149659         - /*  75 */ "ifexists ::= IF EXISTS",
149660         - /*  76 */ "ifexists ::=",
149661         - /*  77 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select",
149662         - /*  78 */ "cmd ::= DROP VIEW ifexists fullname",
149663         - /*  79 */ "cmd ::= select",
149664         - /*  80 */ "select ::= WITH wqlist selectnowith",
149665         - /*  81 */ "select ::= WITH RECURSIVE wqlist selectnowith",
149666         - /*  82 */ "select ::= selectnowith",
149667         - /*  83 */ "selectnowith ::= selectnowith multiselect_op oneselect",
149668         - /*  84 */ "multiselect_op ::= UNION",
149669         - /*  85 */ "multiselect_op ::= UNION ALL",
149670         - /*  86 */ "multiselect_op ::= EXCEPT|INTERSECT",
149671         - /*  87 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
149672         - /*  88 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt",
149673         - /*  89 */ "values ::= VALUES LP nexprlist RP",
149674         - /*  90 */ "values ::= values COMMA LP nexprlist RP",
149675         - /*  91 */ "distinct ::= DISTINCT",
149676         - /*  92 */ "distinct ::= ALL",
149677         - /*  93 */ "distinct ::=",
149678         - /*  94 */ "sclp ::=",
149679         - /*  95 */ "selcollist ::= sclp scanpt expr scanpt as",
149680         - /*  96 */ "selcollist ::= sclp scanpt STAR",
149681         - /*  97 */ "selcollist ::= sclp scanpt nm DOT STAR",
149682         - /*  98 */ "as ::= AS nm",
149683         - /*  99 */ "as ::=",
149684         - /* 100 */ "from ::=",
149685         - /* 101 */ "from ::= FROM seltablist",
149686         - /* 102 */ "stl_prefix ::= seltablist joinop",
149687         - /* 103 */ "stl_prefix ::=",
149688         - /* 104 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
149689         - /* 105 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
149690         - /* 106 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
149691         - /* 107 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
149692         - /* 108 */ "dbnm ::=",
149693         - /* 109 */ "dbnm ::= DOT nm",
149694         - /* 110 */ "fullname ::= nm",
149695         - /* 111 */ "fullname ::= nm DOT nm",
149696         - /* 112 */ "xfullname ::= nm",
149697         - /* 113 */ "xfullname ::= nm DOT nm",
149698         - /* 114 */ "xfullname ::= nm DOT nm AS nm",
149699         - /* 115 */ "xfullname ::= nm AS nm",
149700         - /* 116 */ "joinop ::= COMMA|JOIN",
149701         - /* 117 */ "joinop ::= JOIN_KW JOIN",
149702         - /* 118 */ "joinop ::= JOIN_KW nm JOIN",
149703         - /* 119 */ "joinop ::= JOIN_KW nm nm JOIN",
149704         - /* 120 */ "on_opt ::= ON expr",
149705         - /* 121 */ "on_opt ::=",
149706         - /* 122 */ "indexed_opt ::=",
149707         - /* 123 */ "indexed_opt ::= INDEXED BY nm",
149708         - /* 124 */ "indexed_opt ::= NOT INDEXED",
149709         - /* 125 */ "using_opt ::= USING LP idlist RP",
149710         - /* 126 */ "using_opt ::=",
149711         - /* 127 */ "orderby_opt ::=",
149712         - /* 128 */ "orderby_opt ::= ORDER BY sortlist",
149713         - /* 129 */ "sortlist ::= sortlist COMMA expr sortorder",
149714         - /* 130 */ "sortlist ::= expr sortorder",
149715         - /* 131 */ "sortorder ::= ASC",
149716         - /* 132 */ "sortorder ::= DESC",
149717         - /* 133 */ "sortorder ::=",
149718         - /* 134 */ "groupby_opt ::=",
149719         - /* 135 */ "groupby_opt ::= GROUP BY nexprlist",
149720         - /* 136 */ "having_opt ::=",
149721         - /* 137 */ "having_opt ::= HAVING expr",
149722         - /* 138 */ "limit_opt ::=",
149723         - /* 139 */ "limit_opt ::= LIMIT expr",
149724         - /* 140 */ "limit_opt ::= LIMIT expr OFFSET expr",
149725         - /* 141 */ "limit_opt ::= LIMIT expr COMMA expr",
149726         - /* 142 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
149727         - /* 143 */ "where_opt ::=",
149728         - /* 144 */ "where_opt ::= WHERE expr",
149729         - /* 145 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
149730         - /* 146 */ "setlist ::= setlist COMMA nm EQ expr",
149731         - /* 147 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
149732         - /* 148 */ "setlist ::= nm EQ expr",
149733         - /* 149 */ "setlist ::= LP idlist RP EQ expr",
149734         - /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
149735         - /* 151 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
149736         - /* 152 */ "upsert ::=",
149737         - /* 153 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
149738         - /* 154 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
149739         - /* 155 */ "upsert ::= ON CONFLICT DO NOTHING",
149740         - /* 156 */ "insert_cmd ::= INSERT orconf",
149741         - /* 157 */ "insert_cmd ::= REPLACE",
149742         - /* 158 */ "idlist_opt ::=",
149743         - /* 159 */ "idlist_opt ::= LP idlist RP",
149744         - /* 160 */ "idlist ::= idlist COMMA nm",
149745         - /* 161 */ "idlist ::= nm",
149746         - /* 162 */ "expr ::= LP expr RP",
149747         - /* 163 */ "expr ::= ID|INDEXED",
149748         - /* 164 */ "expr ::= JOIN_KW",
149749         - /* 165 */ "expr ::= nm DOT nm",
149750         - /* 166 */ "expr ::= nm DOT nm DOT nm",
149751         - /* 167 */ "term ::= NULL|FLOAT|BLOB",
149752         - /* 168 */ "term ::= STRING",
149753         - /* 169 */ "term ::= INTEGER",
149754         - /* 170 */ "expr ::= VARIABLE",
149755         - /* 171 */ "expr ::= expr COLLATE ID|STRING",
149756         - /* 172 */ "expr ::= CAST LP expr AS typetoken RP",
149757         - /* 173 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
149758         - /* 174 */ "expr ::= ID|INDEXED LP STAR RP",
149759         - /* 175 */ "expr ::= ID|INDEXED LP distinct exprlist RP over_clause",
149760         - /* 176 */ "expr ::= ID|INDEXED LP STAR RP over_clause",
149761         - /* 177 */ "term ::= CTIME_KW",
149762         - /* 178 */ "expr ::= LP nexprlist COMMA expr RP",
149763         - /* 179 */ "expr ::= expr AND expr",
149764         - /* 180 */ "expr ::= expr OR expr",
149765         - /* 181 */ "expr ::= expr LT|GT|GE|LE expr",
149766         - /* 182 */ "expr ::= expr EQ|NE expr",
149767         - /* 183 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
149768         - /* 184 */ "expr ::= expr PLUS|MINUS expr",
149769         - /* 185 */ "expr ::= expr STAR|SLASH|REM expr",
149770         - /* 186 */ "expr ::= expr CONCAT expr",
149771         - /* 187 */ "likeop ::= NOT LIKE_KW|MATCH",
149772         - /* 188 */ "expr ::= expr likeop expr",
149773         - /* 189 */ "expr ::= expr likeop expr ESCAPE expr",
149774         - /* 190 */ "expr ::= expr ISNULL|NOTNULL",
149775         - /* 191 */ "expr ::= expr NOT NULL",
149776         - /* 192 */ "expr ::= expr IS expr",
149777         - /* 193 */ "expr ::= expr IS NOT expr",
149778         - /* 194 */ "expr ::= NOT expr",
149779         - /* 195 */ "expr ::= BITNOT expr",
149780         - /* 196 */ "expr ::= PLUS|MINUS expr",
149781         - /* 197 */ "between_op ::= BETWEEN",
149782         - /* 198 */ "between_op ::= NOT BETWEEN",
149783         - /* 199 */ "expr ::= expr between_op expr AND expr",
149784         - /* 200 */ "in_op ::= IN",
149785         - /* 201 */ "in_op ::= NOT IN",
149786         - /* 202 */ "expr ::= expr in_op LP exprlist RP",
149787         - /* 203 */ "expr ::= LP select RP",
149788         - /* 204 */ "expr ::= expr in_op LP select RP",
149789         - /* 205 */ "expr ::= expr in_op nm dbnm paren_exprlist",
149790         - /* 206 */ "expr ::= EXISTS LP select RP",
149791         - /* 207 */ "expr ::= CASE case_operand case_exprlist case_else END",
149792         - /* 208 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
149793         - /* 209 */ "case_exprlist ::= WHEN expr THEN expr",
149794         - /* 210 */ "case_else ::= ELSE expr",
149795         - /* 211 */ "case_else ::=",
149796         - /* 212 */ "case_operand ::= expr",
149797         - /* 213 */ "case_operand ::=",
149798         - /* 214 */ "exprlist ::=",
149799         - /* 215 */ "nexprlist ::= nexprlist COMMA expr",
149800         - /* 216 */ "nexprlist ::= expr",
149801         - /* 217 */ "paren_exprlist ::=",
149802         - /* 218 */ "paren_exprlist ::= LP exprlist RP",
149803         - /* 219 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
149804         - /* 220 */ "uniqueflag ::= UNIQUE",
149805         - /* 221 */ "uniqueflag ::=",
149806         - /* 222 */ "eidlist_opt ::=",
149807         - /* 223 */ "eidlist_opt ::= LP eidlist RP",
149808         - /* 224 */ "eidlist ::= eidlist COMMA nm collate sortorder",
149809         - /* 225 */ "eidlist ::= nm collate sortorder",
149810         - /* 226 */ "collate ::=",
149811         - /* 227 */ "collate ::= COLLATE ID|STRING",
149812         - /* 228 */ "cmd ::= DROP INDEX ifexists fullname",
149813         - /* 229 */ "cmd ::= VACUUM vinto",
149814         - /* 230 */ "cmd ::= VACUUM nm vinto",
149815         - /* 231 */ "vinto ::= INTO expr",
149816         - /* 232 */ "vinto ::=",
149817         - /* 233 */ "cmd ::= PRAGMA nm dbnm",
149818         - /* 234 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
149819         - /* 235 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
149820         - /* 236 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
149821         - /* 237 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
149822         - /* 238 */ "plus_num ::= PLUS INTEGER|FLOAT",
149823         - /* 239 */ "minus_num ::= MINUS INTEGER|FLOAT",
149824         - /* 240 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
149825         - /* 241 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
149826         - /* 242 */ "trigger_time ::= BEFORE|AFTER",
149827         - /* 243 */ "trigger_time ::= INSTEAD OF",
149828         - /* 244 */ "trigger_time ::=",
149829         - /* 245 */ "trigger_event ::= DELETE|INSERT",
149830         - /* 246 */ "trigger_event ::= UPDATE",
149831         - /* 247 */ "trigger_event ::= UPDATE OF idlist",
149832         - /* 248 */ "when_clause ::=",
149833         - /* 249 */ "when_clause ::= WHEN expr",
149834         - /* 250 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
149835         - /* 251 */ "trigger_cmd_list ::= trigger_cmd SEMI",
149836         - /* 252 */ "trnm ::= nm DOT nm",
149837         - /* 253 */ "tridxby ::= INDEXED BY nm",
149838         - /* 254 */ "tridxby ::= NOT INDEXED",
149839         - /* 255 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
149840         - /* 256 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
149841         - /* 257 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
149842         - /* 258 */ "trigger_cmd ::= scanpt select scanpt",
149843         - /* 259 */ "expr ::= RAISE LP IGNORE RP",
149844         - /* 260 */ "expr ::= RAISE LP raisetype COMMA nm RP",
149845         - /* 261 */ "raisetype ::= ROLLBACK",
149846         - /* 262 */ "raisetype ::= ABORT",
149847         - /* 263 */ "raisetype ::= FAIL",
149848         - /* 264 */ "cmd ::= DROP TRIGGER ifexists fullname",
149849         - /* 265 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
149850         - /* 266 */ "cmd ::= DETACH database_kw_opt expr",
149851         - /* 267 */ "key_opt ::=",
149852         - /* 268 */ "key_opt ::= KEY expr",
149853         - /* 269 */ "cmd ::= REINDEX",
149854         - /* 270 */ "cmd ::= REINDEX nm dbnm",
149855         - /* 271 */ "cmd ::= ANALYZE",
149856         - /* 272 */ "cmd ::= ANALYZE nm dbnm",
149857         - /* 273 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
149858         - /* 274 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
149859         - /* 275 */ "add_column_fullname ::= fullname",
149860         - /* 276 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
149861         - /* 277 */ "cmd ::= create_vtab",
149862         - /* 278 */ "cmd ::= create_vtab LP vtabarglist RP",
149863         - /* 279 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
149864         - /* 280 */ "vtabarg ::=",
149865         - /* 281 */ "vtabargtoken ::= ANY",
149866         - /* 282 */ "vtabargtoken ::= lp anylist RP",
149867         - /* 283 */ "lp ::= LP",
149868         - /* 284 */ "with ::= WITH wqlist",
149869         - /* 285 */ "with ::= WITH RECURSIVE wqlist",
149870         - /* 286 */ "wqlist ::= nm eidlist_opt AS LP select RP",
149871         - /* 287 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
149872         - /* 288 */ "windowdefn_list ::= windowdefn",
149873         - /* 289 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
149874         - /* 290 */ "windowdefn ::= nm AS LP window RP",
149875         - /* 291 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
149876         - /* 292 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
149877         - /* 293 */ "window ::= ORDER BY sortlist frame_opt",
149878         - /* 294 */ "window ::= nm ORDER BY sortlist frame_opt",
149879         - /* 295 */ "window ::= frame_opt",
149880         - /* 296 */ "window ::= nm frame_opt",
149881         - /* 297 */ "frame_opt ::=",
149882         - /* 298 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
149883         - /* 299 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
149884         - /* 300 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
149885         - /* 301 */ "frame_bound_s ::= frame_bound",
149886         - /* 302 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
149887         - /* 303 */ "frame_bound_e ::= frame_bound",
149888         - /* 304 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
149889         - /* 305 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
149890         - /* 306 */ "frame_bound ::= CURRENT ROW",
149891         - /* 307 */ "frame_exclude_opt ::=",
149892         - /* 308 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
149893         - /* 309 */ "frame_exclude ::= NO OTHERS",
149894         - /* 310 */ "frame_exclude ::= CURRENT ROW",
149895         - /* 311 */ "frame_exclude ::= GROUP|TIES",
149896         - /* 312 */ "window_clause ::= WINDOW windowdefn_list",
149897         - /* 313 */ "over_clause ::= filter_opt OVER LP window RP",
149898         - /* 314 */ "over_clause ::= filter_opt OVER nm",
149899         - /* 315 */ "filter_opt ::=",
149900         - /* 316 */ "filter_opt ::= FILTER LP WHERE expr RP",
149901         - /* 317 */ "input ::= cmdlist",
149902         - /* 318 */ "cmdlist ::= cmdlist ecmd",
149903         - /* 319 */ "cmdlist ::= ecmd",
149904         - /* 320 */ "ecmd ::= SEMI",
149905         - /* 321 */ "ecmd ::= cmdx SEMI",
149906         - /* 322 */ "ecmd ::= explain cmdx",
149907         - /* 323 */ "trans_opt ::=",
149908         - /* 324 */ "trans_opt ::= TRANSACTION",
149909         - /* 325 */ "trans_opt ::= TRANSACTION nm",
149910         - /* 326 */ "savepoint_opt ::= SAVEPOINT",
149911         - /* 327 */ "savepoint_opt ::=",
149912         - /* 328 */ "cmd ::= create_table create_table_args",
149913         - /* 329 */ "columnlist ::= columnlist COMMA columnname carglist",
149914         - /* 330 */ "columnlist ::= columnname carglist",
149915         - /* 331 */ "nm ::= ID|INDEXED",
149916         - /* 332 */ "nm ::= STRING",
149917         - /* 333 */ "nm ::= JOIN_KW",
149918         - /* 334 */ "typetoken ::= typename",
149919         - /* 335 */ "typename ::= ID|STRING",
149920         - /* 336 */ "signed ::= plus_num",
149921         - /* 337 */ "signed ::= minus_num",
149922         - /* 338 */ "carglist ::= carglist ccons",
149923         - /* 339 */ "carglist ::=",
149924         - /* 340 */ "ccons ::= NULL onconf",
149925         - /* 341 */ "conslist_opt ::= COMMA conslist",
149926         - /* 342 */ "conslist ::= conslist tconscomma tcons",
149927         - /* 343 */ "conslist ::= tcons",
149928         - /* 344 */ "tconscomma ::=",
149929         - /* 345 */ "defer_subclause_opt ::= defer_subclause",
149930         - /* 346 */ "resolvetype ::= raisetype",
149931         - /* 347 */ "selectnowith ::= oneselect",
149932         - /* 348 */ "oneselect ::= values",
149933         - /* 349 */ "sclp ::= selcollist COMMA",
149934         - /* 350 */ "as ::= ID|STRING",
149935         - /* 351 */ "expr ::= term",
149936         - /* 352 */ "likeop ::= LIKE_KW|MATCH",
149937         - /* 353 */ "exprlist ::= nexprlist",
149938         - /* 354 */ "nmnum ::= plus_num",
149939         - /* 355 */ "nmnum ::= nm",
149940         - /* 356 */ "nmnum ::= ON",
149941         - /* 357 */ "nmnum ::= DELETE",
149942         - /* 358 */ "nmnum ::= DEFAULT",
149943         - /* 359 */ "plus_num ::= INTEGER|FLOAT",
149944         - /* 360 */ "foreach_clause ::=",
149945         - /* 361 */ "foreach_clause ::= FOR EACH ROW",
149946         - /* 362 */ "trnm ::= nm",
149947         - /* 363 */ "tridxby ::=",
149948         - /* 364 */ "database_kw_opt ::= DATABASE",
149949         - /* 365 */ "database_kw_opt ::=",
149950         - /* 366 */ "kwcolumn_opt ::=",
149951         - /* 367 */ "kwcolumn_opt ::= COLUMNKW",
149952         - /* 368 */ "vtabarglist ::= vtabarg",
149953         - /* 369 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
149954         - /* 370 */ "vtabarg ::= vtabarg vtabargtoken",
149955         - /* 371 */ "anylist ::=",
149956         - /* 372 */ "anylist ::= anylist LP anylist RP",
149957         - /* 373 */ "anylist ::= anylist ANY",
149958         - /* 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 ::=",
149959 150539   };
149960 150540   #endif /* NDEBUG */
149961 150541   
149962 150542   
149963 150543   #if YYSTACKDEPTH<=0
149964 150544   /*
149965 150545   ** Try to increase the size of the parser stack.  Return the number
................................................................................
150078 150658       **
150079 150659       ** Note: during a reduce, the only symbols destroyed are those
150080 150660       ** which appear on the RHS of the rule, but which are *not* used
150081 150661       ** inside the C code.
150082 150662       */
150083 150663   /********* Begin destructor definitions ***************************************/
150084 150664       case 195: /* select */
150085         -    case 227: /* selectnowith */
150086         -    case 228: /* oneselect */
150087         -    case 240: /* values */
150088         -{
150089         -sqlite3SelectDelete(pParse->db, (yypminor->yy457));
150090         -}
150091         -      break;
150092         -    case 205: /* term */
150093         -    case 206: /* expr */
150094         -    case 234: /* where_opt */
150095         -    case 236: /* having_opt */
150096         -    case 248: /* on_opt */
150097         -    case 263: /* case_operand */
150098         -    case 265: /* case_else */
150099         -    case 268: /* vinto */
150100         -    case 275: /* when_clause */
150101         -    case 280: /* key_opt */
150102         -    case 294: /* filter_opt */
150103         -{
150104         -sqlite3ExprDelete(pParse->db, (yypminor->yy524));
150105         -}
150106         -      break;
150107         -    case 210: /* eidlist_opt */
150108         -    case 219: /* sortlist */
150109         -    case 220: /* eidlist */
150110         -    case 232: /* selcollist */
150111         -    case 235: /* groupby_opt */
150112         -    case 237: /* orderby_opt */
150113         -    case 241: /* nexprlist */
150114         -    case 242: /* sclp */
150115         -    case 250: /* exprlist */
150116         -    case 254: /* setlist */
150117         -    case 262: /* paren_exprlist */
150118         -    case 264: /* case_exprlist */
150119         -    case 293: /* part_opt */
150120         -{
150121         -sqlite3ExprListDelete(pParse->db, (yypminor->yy434));
150122         -}
150123         -      break;
150124         -    case 226: /* fullname */
150125         -    case 233: /* from */
150126         -    case 244: /* seltablist */
150127         -    case 245: /* stl_prefix */
150128         -    case 251: /* xfullname */
150129         -{
150130         -sqlite3SrcListDelete(pParse->db, (yypminor->yy483));
150131         -}
150132         -      break;
150133         -    case 229: /* wqlist */
150134         -{
150135         -sqlite3WithDelete(pParse->db, (yypminor->yy59));
150136         -}
150137         -      break;
150138         -    case 239: /* window_clause */
150139         -    case 289: /* windowdefn_list */
150140         -{
150141         -sqlite3WindowListDelete(pParse->db, (yypminor->yy295));
150142         -}
150143         -      break;
150144         -    case 249: /* using_opt */
150145         -    case 252: /* idlist */
150146         -    case 256: /* idlist_opt */
150147         -{
150148         -sqlite3IdListDelete(pParse->db, (yypminor->yy62));
150149         -}
150150         -      break;
150151         -    case 258: /* over_clause */
150152         -    case 290: /* windowdefn */
150153         -    case 291: /* window */
150154         -    case 292: /* frame_opt */
150155         -{
150156         -sqlite3WindowDelete(pParse->db, (yypminor->yy295));
150157         -}
150158         -      break;
150159         -    case 271: /* trigger_cmd_list */
150160         -    case 276: /* trigger_cmd */
150161         -{
150162         -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy455));
150163         -}
150164         -      break;
150165         -    case 273: /* trigger_event */
150166         -{
150167         -sqlite3IdListDelete(pParse->db, (yypminor->yy90).b);
150168         -}
150169         -      break;
150170         -    case 296: /* frame_bound */
150171         -    case 297: /* frame_bound_s */
150172         -    case 298: /* frame_bound_e */
150173         -{
150174         -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);
150175 150755   }
150176 150756         break;
150177 150757   /********* End destructor definitions *****************************************/
150178 150758       default:  break;   /* If no destructor action specified: do nothing */
150179 150759     }
150180 150760   }
150181 150761   
................................................................................
150491 151071      194,  /* (22) table_options ::= WITHOUT nm */
150492 151072      196,  /* (23) columnname ::= nm typetoken */
150493 151073      198,  /* (24) typetoken ::= */
150494 151074      198,  /* (25) typetoken ::= typename LP signed RP */
150495 151075      198,  /* (26) typetoken ::= typename LP signed COMMA signed RP */
150496 151076      199,  /* (27) typename ::= typename ID|STRING */
150497 151077      203,  /* (28) scanpt ::= */
150498         -   204,  /* (29) ccons ::= CONSTRAINT nm */
150499         -   204,  /* (30) ccons ::= DEFAULT scanpt term scanpt */
150500         -   204,  /* (31) ccons ::= DEFAULT LP expr RP */
150501         -   204,  /* (32) ccons ::= DEFAULT PLUS term scanpt */
150502         -   204,  /* (33) ccons ::= DEFAULT MINUS term scanpt */
150503         -   204,  /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */
150504         -   204,  /* (35) ccons ::= NOT NULL onconf */
150505         -   204,  /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */
150506         -   204,  /* (37) ccons ::= UNIQUE onconf */
150507         -   204,  /* (38) ccons ::= CHECK LP expr RP */
150508         -   204,  /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */
150509         -   204,  /* (40) ccons ::= defer_subclause */
150510         -   204,  /* (41) ccons ::= COLLATE ID|STRING */
150511         -   209,  /* (42) autoinc ::= */
150512         -   209,  /* (43) autoinc ::= AUTOINCR */
150513         -   211,  /* (44) refargs ::= */
150514         -   211,  /* (45) refargs ::= refargs refarg */
150515         -   213,  /* (46) refarg ::= MATCH nm */
150516         -   213,  /* (47) refarg ::= ON INSERT refact */
150517         -   213,  /* (48) refarg ::= ON DELETE refact */
150518         -   213,  /* (49) refarg ::= ON UPDATE refact */
150519         -   214,  /* (50) refact ::= SET NULL */
150520         -   214,  /* (51) refact ::= SET DEFAULT */
150521         -   214,  /* (52) refact ::= CASCADE */
150522         -   214,  /* (53) refact ::= RESTRICT */
150523         -   214,  /* (54) refact ::= NO ACTION */
150524         -   212,  /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
150525         -   212,  /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
150526         -   215,  /* (57) init_deferred_pred_opt ::= */
150527         -   215,  /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */
150528         -   215,  /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
150529         -   193,  /* (60) conslist_opt ::= */
150530         -   217,  /* (61) tconscomma ::= COMMA */
150531         -   218,  /* (62) tcons ::= CONSTRAINT nm */
150532         -   218,  /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
150533         -   218,  /* (64) tcons ::= UNIQUE LP sortlist RP onconf */
150534         -   218,  /* (65) tcons ::= CHECK LP expr RP onconf */
150535         -   218,  /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
150536         -   221,  /* (67) defer_subclause_opt ::= */
150537         -   207,  /* (68) onconf ::= */
150538         -   207,  /* (69) onconf ::= ON CONFLICT resolvetype */
150539         -   222,  /* (70) orconf ::= */
150540         -   222,  /* (71) orconf ::= OR resolvetype */
150541         -   223,  /* (72) resolvetype ::= IGNORE */
150542         -   223,  /* (73) resolvetype ::= REPLACE */
150543         -   181,  /* (74) cmd ::= DROP TABLE ifexists fullname */
150544         -   225,  /* (75) ifexists ::= IF EXISTS */
150545         -   225,  /* (76) ifexists ::= */
150546         -   181,  /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
150547         -   181,  /* (78) cmd ::= DROP VIEW ifexists fullname */
150548         -   181,  /* (79) cmd ::= select */
150549         -   195,  /* (80) select ::= WITH wqlist selectnowith */
150550         -   195,  /* (81) select ::= WITH RECURSIVE wqlist selectnowith */
150551         -   195,  /* (82) select ::= selectnowith */
150552         -   227,  /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
150553         -   230,  /* (84) multiselect_op ::= UNION */
150554         -   230,  /* (85) multiselect_op ::= UNION ALL */
150555         -   230,  /* (86) multiselect_op ::= EXCEPT|INTERSECT */
150556         -   228,  /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
150557         -   228,  /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
150558         -   240,  /* (89) values ::= VALUES LP nexprlist RP */
150559         -   240,  /* (90) values ::= values COMMA LP nexprlist RP */
150560         -   231,  /* (91) distinct ::= DISTINCT */
150561         -   231,  /* (92) distinct ::= ALL */
150562         -   231,  /* (93) distinct ::= */
150563         -   242,  /* (94) sclp ::= */
150564         -   232,  /* (95) selcollist ::= sclp scanpt expr scanpt as */
150565         -   232,  /* (96) selcollist ::= sclp scanpt STAR */
150566         -   232,  /* (97) selcollist ::= sclp scanpt nm DOT STAR */
150567         -   243,  /* (98) as ::= AS nm */
150568         -   243,  /* (99) as ::= */
150569         -   233,  /* (100) from ::= */
150570         -   233,  /* (101) from ::= FROM seltablist */
150571         -   245,  /* (102) stl_prefix ::= seltablist joinop */
150572         -   245,  /* (103) stl_prefix ::= */
150573         -   244,  /* (104) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
150574         -   244,  /* (105) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
150575         -   244,  /* (106) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
150576         -   244,  /* (107) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
150577         -   191,  /* (108) dbnm ::= */
150578         -   191,  /* (109) dbnm ::= DOT nm */
150579         -   226,  /* (110) fullname ::= nm */
150580         -   226,  /* (111) fullname ::= nm DOT nm */
150581         -   251,  /* (112) xfullname ::= nm */
150582         -   251,  /* (113) xfullname ::= nm DOT nm */
150583         -   251,  /* (114) xfullname ::= nm DOT nm AS nm */
150584         -   251,  /* (115) xfullname ::= nm AS nm */
150585         -   246,  /* (116) joinop ::= COMMA|JOIN */
150586         -   246,  /* (117) joinop ::= JOIN_KW JOIN */
150587         -   246,  /* (118) joinop ::= JOIN_KW nm JOIN */
150588         -   246,  /* (119) joinop ::= JOIN_KW nm nm JOIN */
150589         -   248,  /* (120) on_opt ::= ON expr */
150590         -   248,  /* (121) on_opt ::= */
150591         -   247,  /* (122) indexed_opt ::= */
150592         -   247,  /* (123) indexed_opt ::= INDEXED BY nm */
150593         -   247,  /* (124) indexed_opt ::= NOT INDEXED */
150594         -   249,  /* (125) using_opt ::= USING LP idlist RP */
150595         -   249,  /* (126) using_opt ::= */
150596         -   237,  /* (127) orderby_opt ::= */
150597         -   237,  /* (128) orderby_opt ::= ORDER BY sortlist */
150598         -   219,  /* (129) sortlist ::= sortlist COMMA expr sortorder */
150599         -   219,  /* (130) sortlist ::= expr sortorder */
150600         -   208,  /* (131) sortorder ::= ASC */
150601         -   208,  /* (132) sortorder ::= DESC */
150602         -   208,  /* (133) sortorder ::= */
150603         -   235,  /* (134) groupby_opt ::= */
150604         -   235,  /* (135) groupby_opt ::= GROUP BY nexprlist */
150605         -   236,  /* (136) having_opt ::= */
150606         -   236,  /* (137) having_opt ::= HAVING expr */
150607         -   238,  /* (138) limit_opt ::= */
150608         -   238,  /* (139) limit_opt ::= LIMIT expr */
150609         -   238,  /* (140) limit_opt ::= LIMIT expr OFFSET expr */
150610         -   238,  /* (141) limit_opt ::= LIMIT expr COMMA expr */
150611         -   181,  /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
150612         -   234,  /* (143) where_opt ::= */
150613         -   234,  /* (144) where_opt ::= WHERE expr */
150614         -   181,  /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
150615         -   254,  /* (146) setlist ::= setlist COMMA nm EQ expr */
150616         -   254,  /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */
150617         -   254,  /* (148) setlist ::= nm EQ expr */
150618         -   254,  /* (149) setlist ::= LP idlist RP EQ expr */
150619         -   181,  /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
150620         -   181,  /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
150621         -   257,  /* (152) upsert ::= */
150622         -   257,  /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
150623         -   257,  /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
150624         -   257,  /* (155) upsert ::= ON CONFLICT DO NOTHING */
150625         -   255,  /* (156) insert_cmd ::= INSERT orconf */
150626         -   255,  /* (157) insert_cmd ::= REPLACE */
150627         -   256,  /* (158) idlist_opt ::= */
150628         -   256,  /* (159) idlist_opt ::= LP idlist RP */
150629         -   252,  /* (160) idlist ::= idlist COMMA nm */
150630         -   252,  /* (161) idlist ::= nm */
150631         -   206,  /* (162) expr ::= LP expr RP */
150632         -   206,  /* (163) expr ::= ID|INDEXED */
150633         -   206,  /* (164) expr ::= JOIN_KW */
150634         -   206,  /* (165) expr ::= nm DOT nm */
150635         -   206,  /* (166) expr ::= nm DOT nm DOT nm */
150636         -   205,  /* (167) term ::= NULL|FLOAT|BLOB */
150637         -   205,  /* (168) term ::= STRING */
150638         -   205,  /* (169) term ::= INTEGER */
150639         -   206,  /* (170) expr ::= VARIABLE */
150640         -   206,  /* (171) expr ::= expr COLLATE ID|STRING */
150641         -   206,  /* (172) expr ::= CAST LP expr AS typetoken RP */
150642         -   206,  /* (173) expr ::= ID|INDEXED LP distinct exprlist RP */
150643         -   206,  /* (174) expr ::= ID|INDEXED LP STAR RP */
150644         -   206,  /* (175) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
150645         -   206,  /* (176) expr ::= ID|INDEXED LP STAR RP over_clause */
150646         -   205,  /* (177) term ::= CTIME_KW */
150647         -   206,  /* (178) expr ::= LP nexprlist COMMA expr RP */
150648         -   206,  /* (179) expr ::= expr AND expr */
150649         -   206,  /* (180) expr ::= expr OR expr */
150650         -   206,  /* (181) expr ::= expr LT|GT|GE|LE expr */
150651         -   206,  /* (182) expr ::= expr EQ|NE expr */
150652         -   206,  /* (183) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
150653         -   206,  /* (184) expr ::= expr PLUS|MINUS expr */
150654         -   206,  /* (185) expr ::= expr STAR|SLASH|REM expr */
150655         -   206,  /* (186) expr ::= expr CONCAT expr */
150656         -   259,  /* (187) likeop ::= NOT LIKE_KW|MATCH */
150657         -   206,  /* (188) expr ::= expr likeop expr */
150658         -   206,  /* (189) expr ::= expr likeop expr ESCAPE expr */
150659         -   206,  /* (190) expr ::= expr ISNULL|NOTNULL */
150660         -   206,  /* (191) expr ::= expr NOT NULL */
150661         -   206,  /* (192) expr ::= expr IS expr */
150662         -   206,  /* (193) expr ::= expr IS NOT expr */
150663         -   206,  /* (194) expr ::= NOT expr */
150664         -   206,  /* (195) expr ::= BITNOT expr */
150665         -   206,  /* (196) expr ::= PLUS|MINUS expr */
150666         -   260,  /* (197) between_op ::= BETWEEN */
150667         -   260,  /* (198) between_op ::= NOT BETWEEN */
150668         -   206,  /* (199) expr ::= expr between_op expr AND expr */
150669         -   261,  /* (200) in_op ::= IN */
150670         -   261,  /* (201) in_op ::= NOT IN */
150671         -   206,  /* (202) expr ::= expr in_op LP exprlist RP */
150672         -   206,  /* (203) expr ::= LP select RP */
150673         -   206,  /* (204) expr ::= expr in_op LP select RP */
150674         -   206,  /* (205) expr ::= expr in_op nm dbnm paren_exprlist */
150675         -   206,  /* (206) expr ::= EXISTS LP select RP */
150676         -   206,  /* (207) expr ::= CASE case_operand case_exprlist case_else END */
150677         -   264,  /* (208) case_exprlist ::= case_exprlist WHEN expr THEN expr */
150678         -   264,  /* (209) case_exprlist ::= WHEN expr THEN expr */
150679         -   265,  /* (210) case_else ::= ELSE expr */
150680         -   265,  /* (211) case_else ::= */
150681         -   263,  /* (212) case_operand ::= expr */
150682         -   263,  /* (213) case_operand ::= */
150683         -   250,  /* (214) exprlist ::= */
150684         -   241,  /* (215) nexprlist ::= nexprlist COMMA expr */
150685         -   241,  /* (216) nexprlist ::= expr */
150686         -   262,  /* (217) paren_exprlist ::= */
150687         -   262,  /* (218) paren_exprlist ::= LP exprlist RP */
150688         -   181,  /* (219) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
150689         -   266,  /* (220) uniqueflag ::= UNIQUE */
150690         -   266,  /* (221) uniqueflag ::= */
150691         -   210,  /* (222) eidlist_opt ::= */
150692         -   210,  /* (223) eidlist_opt ::= LP eidlist RP */
150693         -   220,  /* (224) eidlist ::= eidlist COMMA nm collate sortorder */
150694         -   220,  /* (225) eidlist ::= nm collate sortorder */
150695         -   267,  /* (226) collate ::= */
150696         -   267,  /* (227) collate ::= COLLATE ID|STRING */
150697         -   181,  /* (228) cmd ::= DROP INDEX ifexists fullname */
150698         -   181,  /* (229) cmd ::= VACUUM vinto */
150699         -   181,  /* (230) cmd ::= VACUUM nm vinto */
150700         -   268,  /* (231) vinto ::= INTO expr */
150701         -   268,  /* (232) vinto ::= */
150702         -   181,  /* (233) cmd ::= PRAGMA nm dbnm */
150703         -   181,  /* (234) cmd ::= PRAGMA nm dbnm EQ nmnum */
150704         -   181,  /* (235) cmd ::= PRAGMA nm dbnm LP nmnum RP */
150705         -   181,  /* (236) cmd ::= PRAGMA nm dbnm EQ minus_num */
150706         -   181,  /* (237) cmd ::= PRAGMA nm dbnm LP minus_num RP */
150707         -   201,  /* (238) plus_num ::= PLUS INTEGER|FLOAT */
150708         -   202,  /* (239) minus_num ::= MINUS INTEGER|FLOAT */
150709         -   181,  /* (240) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
150710         -   270,  /* (241) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
150711         -   272,  /* (242) trigger_time ::= BEFORE|AFTER */
150712         -   272,  /* (243) trigger_time ::= INSTEAD OF */
150713         -   272,  /* (244) trigger_time ::= */
150714         -   273,  /* (245) trigger_event ::= DELETE|INSERT */
150715         -   273,  /* (246) trigger_event ::= UPDATE */
150716         -   273,  /* (247) trigger_event ::= UPDATE OF idlist */
150717         -   275,  /* (248) when_clause ::= */
150718         -   275,  /* (249) when_clause ::= WHEN expr */
150719         -   271,  /* (250) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
150720         -   271,  /* (251) trigger_cmd_list ::= trigger_cmd SEMI */
150721         -   277,  /* (252) trnm ::= nm DOT nm */
150722         -   278,  /* (253) tridxby ::= INDEXED BY nm */
150723         -   278,  /* (254) tridxby ::= NOT INDEXED */
150724         -   276,  /* (255) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
150725         -   276,  /* (256) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
150726         -   276,  /* (257) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
150727         -   276,  /* (258) trigger_cmd ::= scanpt select scanpt */
150728         -   206,  /* (259) expr ::= RAISE LP IGNORE RP */
150729         -   206,  /* (260) expr ::= RAISE LP raisetype COMMA nm RP */
150730         -   224,  /* (261) raisetype ::= ROLLBACK */
150731         -   224,  /* (262) raisetype ::= ABORT */
150732         -   224,  /* (263) raisetype ::= FAIL */
150733         -   181,  /* (264) cmd ::= DROP TRIGGER ifexists fullname */
150734         -   181,  /* (265) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
150735         -   181,  /* (266) cmd ::= DETACH database_kw_opt expr */
150736         -   280,  /* (267) key_opt ::= */
150737         -   280,  /* (268) key_opt ::= KEY expr */
150738         -   181,  /* (269) cmd ::= REINDEX */
150739         -   181,  /* (270) cmd ::= REINDEX nm dbnm */
150740         -   181,  /* (271) cmd ::= ANALYZE */
150741         -   181,  /* (272) cmd ::= ANALYZE nm dbnm */
150742         -   181,  /* (273) cmd ::= ALTER TABLE fullname RENAME TO nm */
150743         -   181,  /* (274) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
150744         -   281,  /* (275) add_column_fullname ::= fullname */
150745         -   181,  /* (276) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
150746         -   181,  /* (277) cmd ::= create_vtab */
150747         -   181,  /* (278) cmd ::= create_vtab LP vtabarglist RP */
150748         -   283,  /* (279) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
150749         -   285,  /* (280) vtabarg ::= */
150750         -   286,  /* (281) vtabargtoken ::= ANY */
150751         -   286,  /* (282) vtabargtoken ::= lp anylist RP */
150752         -   287,  /* (283) lp ::= LP */
150753         -   253,  /* (284) with ::= WITH wqlist */
150754         -   253,  /* (285) with ::= WITH RECURSIVE wqlist */
150755         -   229,  /* (286) wqlist ::= nm eidlist_opt AS LP select RP */
150756         -   229,  /* (287) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
150757         -   289,  /* (288) windowdefn_list ::= windowdefn */
150758         -   289,  /* (289) windowdefn_list ::= windowdefn_list COMMA windowdefn */
150759         -   290,  /* (290) windowdefn ::= nm AS LP window RP */
150760         -   291,  /* (291) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
150761         -   291,  /* (292) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
150762         -   291,  /* (293) window ::= ORDER BY sortlist frame_opt */
150763         -   291,  /* (294) window ::= nm ORDER BY sortlist frame_opt */
150764         -   291,  /* (295) window ::= frame_opt */
150765         -   291,  /* (296) window ::= nm frame_opt */
150766         -   292,  /* (297) frame_opt ::= */
150767         -   292,  /* (298) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
150768         -   292,  /* (299) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
150769         -   295,  /* (300) range_or_rows ::= RANGE|ROWS|GROUPS */
150770         -   297,  /* (301) frame_bound_s ::= frame_bound */
150771         -   297,  /* (302) frame_bound_s ::= UNBOUNDED PRECEDING */
150772         -   298,  /* (303) frame_bound_e ::= frame_bound */
150773         -   298,  /* (304) frame_bound_e ::= UNBOUNDED FOLLOWING */
150774         -   296,  /* (305) frame_bound ::= expr PRECEDING|FOLLOWING */
150775         -   296,  /* (306) frame_bound ::= CURRENT ROW */
150776         -   299,  /* (307) frame_exclude_opt ::= */
150777         -   299,  /* (308) frame_exclude_opt ::= EXCLUDE frame_exclude */
150778         -   300,  /* (309) frame_exclude ::= NO OTHERS */
150779         -   300,  /* (310) frame_exclude ::= CURRENT ROW */
150780         -   300,  /* (311) frame_exclude ::= GROUP|TIES */
150781         -   239,  /* (312) window_clause ::= WINDOW windowdefn_list */
150782         -   258,  /* (313) over_clause ::= filter_opt OVER LP window RP */
150783         -   258,  /* (314) over_clause ::= filter_opt OVER nm */
150784         -   294,  /* (315) filter_opt ::= */
150785         -   294,  /* (316) filter_opt ::= FILTER LP WHERE expr RP */
150786         -   176,  /* (317) input ::= cmdlist */
150787         -   177,  /* (318) cmdlist ::= cmdlist ecmd */
150788         -   177,  /* (319) cmdlist ::= ecmd */
150789         -   178,  /* (320) ecmd ::= SEMI */
150790         -   178,  /* (321) ecmd ::= cmdx SEMI */
150791         -   178,  /* (322) ecmd ::= explain cmdx */
150792         -   183,  /* (323) trans_opt ::= */
150793         -   183,  /* (324) trans_opt ::= TRANSACTION */
150794         -   183,  /* (325) trans_opt ::= TRANSACTION nm */
150795         -   185,  /* (326) savepoint_opt ::= SAVEPOINT */
150796         -   185,  /* (327) savepoint_opt ::= */
150797         -   181,  /* (328) cmd ::= create_table create_table_args */
150798         -   192,  /* (329) columnlist ::= columnlist COMMA columnname carglist */
150799         -   192,  /* (330) columnlist ::= columnname carglist */
150800         -   184,  /* (331) nm ::= ID|INDEXED */
150801         -   184,  /* (332) nm ::= STRING */
150802         -   184,  /* (333) nm ::= JOIN_KW */
150803         -   198,  /* (334) typetoken ::= typename */
150804         -   199,  /* (335) typename ::= ID|STRING */
150805         -   200,  /* (336) signed ::= plus_num */
150806         -   200,  /* (337) signed ::= minus_num */
150807         -   197,  /* (338) carglist ::= carglist ccons */
150808         -   197,  /* (339) carglist ::= */
150809         -   204,  /* (340) ccons ::= NULL onconf */
150810         -   193,  /* (341) conslist_opt ::= COMMA conslist */
150811         -   216,  /* (342) conslist ::= conslist tconscomma tcons */
150812         -   216,  /* (343) conslist ::= tcons */
150813         -   217,  /* (344) tconscomma ::= */
150814         -   221,  /* (345) defer_subclause_opt ::= defer_subclause */
150815         -   223,  /* (346) resolvetype ::= raisetype */
150816         -   227,  /* (347) selectnowith ::= oneselect */
150817         -   228,  /* (348) oneselect ::= values */
150818         -   242,  /* (349) sclp ::= selcollist COMMA */
150819         -   243,  /* (350) as ::= ID|STRING */
150820         -   206,  /* (351) expr ::= term */
150821         -   259,  /* (352) likeop ::= LIKE_KW|MATCH */
150822         -   250,  /* (353) exprlist ::= nexprlist */
150823         -   269,  /* (354) nmnum ::= plus_num */
150824         -   269,  /* (355) nmnum ::= nm */
150825         -   269,  /* (356) nmnum ::= ON */
150826         -   269,  /* (357) nmnum ::= DELETE */
150827         -   269,  /* (358) nmnum ::= DEFAULT */
150828         -   201,  /* (359) plus_num ::= INTEGER|FLOAT */
150829         -   274,  /* (360) foreach_clause ::= */
150830         -   274,  /* (361) foreach_clause ::= FOR EACH ROW */
150831         -   277,  /* (362) trnm ::= nm */
150832         -   278,  /* (363) tridxby ::= */
150833         -   279,  /* (364) database_kw_opt ::= DATABASE */
150834         -   279,  /* (365) database_kw_opt ::= */
150835         -   282,  /* (366) kwcolumn_opt ::= */
150836         -   282,  /* (367) kwcolumn_opt ::= COLUMNKW */
150837         -   284,  /* (368) vtabarglist ::= vtabarg */
150838         -   284,  /* (369) vtabarglist ::= vtabarglist COMMA vtabarg */
150839         -   285,  /* (370) vtabarg ::= vtabarg vtabargtoken */
150840         -   288,  /* (371) anylist ::= */
150841         -   288,  /* (372) anylist ::= anylist LP anylist RP */
150842         -   288,  /* (373) anylist ::= anylist ANY */
150843         -   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 ::= */
150844 151425   };
150845 151426   
150846 151427   /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
150847 151428   ** of symbols on the right-hand side of that rule. */
150848 151429   static const signed char yyRuleInfoNRhs[] = {
150849 151430      -1,  /* (0) explain ::= EXPLAIN */
150850 151431      -3,  /* (1) explain ::= EXPLAIN QUERY PLAN */
................................................................................
150871 151452      -2,  /* (22) table_options ::= WITHOUT nm */
150872 151453      -2,  /* (23) columnname ::= nm typetoken */
150873 151454       0,  /* (24) typetoken ::= */
150874 151455      -4,  /* (25) typetoken ::= typename LP signed RP */
150875 151456      -6,  /* (26) typetoken ::= typename LP signed COMMA signed RP */
150876 151457      -2,  /* (27) typename ::= typename ID|STRING */
150877 151458       0,  /* (28) scanpt ::= */
150878         -   -2,  /* (29) ccons ::= CONSTRAINT nm */
150879         -   -4,  /* (30) ccons ::= DEFAULT scanpt term scanpt */
150880         -   -4,  /* (31) ccons ::= DEFAULT LP expr RP */
150881         -   -4,  /* (32) ccons ::= DEFAULT PLUS term scanpt */
150882         -   -4,  /* (33) ccons ::= DEFAULT MINUS term scanpt */
150883         -   -3,  /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */
150884         -   -3,  /* (35) ccons ::= NOT NULL onconf */
150885         -   -5,  /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */
150886         -   -2,  /* (37) ccons ::= UNIQUE onconf */
150887         -   -4,  /* (38) ccons ::= CHECK LP expr RP */
150888         -   -4,  /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */
150889         -   -1,  /* (40) ccons ::= defer_subclause */
150890         -   -2,  /* (41) ccons ::= COLLATE ID|STRING */
150891         -    0,  /* (42) autoinc ::= */
150892         -   -1,  /* (43) autoinc ::= AUTOINCR */
150893         -    0,  /* (44) refargs ::= */
150894         -   -2,  /* (45) refargs ::= refargs refarg */
150895         -   -2,  /* (46) refarg ::= MATCH nm */
150896         -   -3,  /* (47) refarg ::= ON INSERT refact */
150897         -   -3,  /* (48) refarg ::= ON DELETE refact */
150898         -   -3,  /* (49) refarg ::= ON UPDATE refact */
150899         -   -2,  /* (50) refact ::= SET NULL */
150900         -   -2,  /* (51) refact ::= SET DEFAULT */
150901         -   -1,  /* (52) refact ::= CASCADE */
150902         -   -1,  /* (53) refact ::= RESTRICT */
150903         -   -2,  /* (54) refact ::= NO ACTION */
150904         -   -3,  /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
150905         -   -2,  /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
150906         -    0,  /* (57) init_deferred_pred_opt ::= */
150907         -   -2,  /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */
150908         -   -2,  /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
150909         -    0,  /* (60) conslist_opt ::= */
150910         -   -1,  /* (61) tconscomma ::= COMMA */
150911         -   -2,  /* (62) tcons ::= CONSTRAINT nm */
150912         -   -7,  /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
150913         -   -5,  /* (64) tcons ::= UNIQUE LP sortlist RP onconf */
150914         -   -5,  /* (65) tcons ::= CHECK LP expr RP onconf */
150915         -  -10,  /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
150916         -    0,  /* (67) defer_subclause_opt ::= */
150917         -    0,  /* (68) onconf ::= */
150918         -   -3,  /* (69) onconf ::= ON CONFLICT resolvetype */
150919         -    0,  /* (70) orconf ::= */
150920         -   -2,  /* (71) orconf ::= OR resolvetype */
150921         -   -1,  /* (72) resolvetype ::= IGNORE */
150922         -   -1,  /* (73) resolvetype ::= REPLACE */
150923         -   -4,  /* (74) cmd ::= DROP TABLE ifexists fullname */
150924         -   -2,  /* (75) ifexists ::= IF EXISTS */
150925         -    0,  /* (76) ifexists ::= */
150926         -   -9,  /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
150927         -   -4,  /* (78) cmd ::= DROP VIEW ifexists fullname */
150928         -   -1,  /* (79) cmd ::= select */
150929         -   -3,  /* (80) select ::= WITH wqlist selectnowith */
150930         -   -4,  /* (81) select ::= WITH RECURSIVE wqlist selectnowith */
150931         -   -1,  /* (82) select ::= selectnowith */
150932         -   -3,  /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
150933         -   -1,  /* (84) multiselect_op ::= UNION */
150934         -   -2,  /* (85) multiselect_op ::= UNION ALL */
150935         -   -1,  /* (86) multiselect_op ::= EXCEPT|INTERSECT */
150936         -   -9,  /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
150937         -  -10,  /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
150938         -   -4,  /* (89) values ::= VALUES LP nexprlist RP */
150939         -   -5,  /* (90) values ::= values COMMA LP nexprlist RP */
150940         -   -1,  /* (91) distinct ::= DISTINCT */
150941         -   -1,  /* (92) distinct ::= ALL */
150942         -    0,  /* (93) distinct ::= */
150943         -    0,  /* (94) sclp ::= */
150944         -   -5,  /* (95) selcollist ::= sclp scanpt expr scanpt as */
150945         -   -3,  /* (96) selcollist ::= sclp scanpt STAR */
150946         -   -5,  /* (97) selcollist ::= sclp scanpt nm DOT STAR */
150947         -   -2,  /* (98) as ::= AS nm */
150948         -    0,  /* (99) as ::= */
150949         -    0,  /* (100) from ::= */
150950         -   -2,  /* (101) from ::= FROM seltablist */
150951         -   -2,  /* (102) stl_prefix ::= seltablist joinop */
150952         -    0,  /* (103) stl_prefix ::= */
150953         -   -7,  /* (104) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
150954         -   -9,  /* (105) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
150955         -   -7,  /* (106) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
150956         -   -7,  /* (107) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
150957         -    0,  /* (108) dbnm ::= */
150958         -   -2,  /* (109) dbnm ::= DOT nm */
150959         -   -1,  /* (110) fullname ::= nm */
150960         -   -3,  /* (111) fullname ::= nm DOT nm */
150961         -   -1,  /* (112) xfullname ::= nm */
150962         -   -3,  /* (113) xfullname ::= nm DOT nm */
150963         -   -5,  /* (114) xfullname ::= nm DOT nm AS nm */
150964         -   -3,  /* (115) xfullname ::= nm AS nm */
150965         -   -1,  /* (116) joinop ::= COMMA|JOIN */
150966         -   -2,  /* (117) joinop ::= JOIN_KW JOIN */
150967         -   -3,  /* (118) joinop ::= JOIN_KW nm JOIN */
150968         -   -4,  /* (119) joinop ::= JOIN_KW nm nm JOIN */
150969         -   -2,  /* (120) on_opt ::= ON expr */
150970         -    0,  /* (121) on_opt ::= */
150971         -    0,  /* (122) indexed_opt ::= */
150972         -   -3,  /* (123) indexed_opt ::= INDEXED BY nm */
150973         -   -2,  /* (124) indexed_opt ::= NOT INDEXED */
150974         -   -4,  /* (125) using_opt ::= USING LP idlist RP */
150975         -    0,  /* (126) using_opt ::= */
150976         -    0,  /* (127) orderby_opt ::= */
150977         -   -3,  /* (128) orderby_opt ::= ORDER BY sortlist */
150978         -   -4,  /* (129) sortlist ::= sortlist COMMA expr sortorder */
150979         -   -2,  /* (130) sortlist ::= expr sortorder */
150980         -   -1,  /* (131) sortorder ::= ASC */
150981         -   -1,  /* (132) sortorder ::= DESC */
150982         -    0,  /* (133) sortorder ::= */
150983         -    0,  /* (134) groupby_opt ::= */
150984         -   -3,  /* (135) groupby_opt ::= GROUP BY nexprlist */
150985         -    0,  /* (136) having_opt ::= */
150986         -   -2,  /* (137) having_opt ::= HAVING expr */
150987         -    0,  /* (138) limit_opt ::= */
150988         -   -2,  /* (139) limit_opt ::= LIMIT expr */
150989         -   -4,  /* (140) limit_opt ::= LIMIT expr OFFSET expr */
150990         -   -4,  /* (141) limit_opt ::= LIMIT expr COMMA expr */
150991         -   -6,  /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
150992         -    0,  /* (143) where_opt ::= */
150993         -   -2,  /* (144) where_opt ::= WHERE expr */
150994         -   -8,  /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
150995         -   -5,  /* (146) setlist ::= setlist COMMA nm EQ expr */
150996         -   -7,  /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */
150997         -   -3,  /* (148) setlist ::= nm EQ expr */
150998         -   -5,  /* (149) setlist ::= LP idlist RP EQ expr */
150999         -   -7,  /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
151000         -   -7,  /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
151001         -    0,  /* (152) upsert ::= */
151002         -  -11,  /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
151003         -   -8,  /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
151004         -   -4,  /* (155) upsert ::= ON CONFLICT DO NOTHING */
151005         -   -2,  /* (156) insert_cmd ::= INSERT orconf */
151006         -   -1,  /* (157) insert_cmd ::= REPLACE */
151007         -    0,  /* (158) idlist_opt ::= */
151008         -   -3,  /* (159) idlist_opt ::= LP idlist RP */
151009         -   -3,  /* (160) idlist ::= idlist COMMA nm */
151010         -   -1,  /* (161) idlist ::= nm */
151011         -   -3,  /* (162) expr ::= LP expr RP */
151012         -   -1,  /* (163) expr ::= ID|INDEXED */
151013         -   -1,  /* (164) expr ::= JOIN_KW */
151014         -   -3,  /* (165) expr ::= nm DOT nm */
151015         -   -5,  /* (166) expr ::= nm DOT nm DOT nm */
151016         -   -1,  /* (167) term ::= NULL|FLOAT|BLOB */
151017         -   -1,  /* (168) term ::= STRING */
151018         -   -1,  /* (169) term ::= INTEGER */
151019         -   -1,  /* (170) expr ::= VARIABLE */
151020         -   -3,  /* (171) expr ::= expr COLLATE ID|STRING */
151021         -   -6,  /* (172) expr ::= CAST LP expr AS typetoken RP */
151022         -   -5,  /* (173) expr ::= ID|INDEXED LP distinct exprlist RP */
151023         -   -4,  /* (174) expr ::= ID|INDEXED LP STAR RP */
151024         -   -6,  /* (175) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
151025         -   -5,  /* (176) expr ::= ID|INDEXED LP STAR RP over_clause */
151026         -   -1,  /* (177) term ::= CTIME_KW */
151027         -   -5,  /* (178) expr ::= LP nexprlist COMMA expr RP */
151028         -   -3,  /* (179) expr ::= expr AND expr */
151029         -   -3,  /* (180) expr ::= expr OR expr */
151030         -   -3,  /* (181) expr ::= expr LT|GT|GE|LE expr */
151031         -   -3,  /* (182) expr ::= expr EQ|NE expr */
151032         -   -3,  /* (183) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
151033         -   -3,  /* (184) expr ::= expr PLUS|MINUS expr */
151034         -   -3,  /* (185) expr ::= expr STAR|SLASH|REM expr */
151035         -   -3,  /* (186) expr ::= expr CONCAT expr */
151036         -   -2,  /* (187) likeop ::= NOT LIKE_KW|MATCH */
151037         -   -3,  /* (188) expr ::= expr likeop expr */
151038         -   -5,  /* (189) expr ::= expr likeop expr ESCAPE expr */
151039         -   -2,  /* (190) expr ::= expr ISNULL|NOTNULL */
151040         -   -3,  /* (191) expr ::= expr NOT NULL */
151041         -   -3,  /* (192) expr ::= expr IS expr */
151042         -   -4,  /* (193) expr ::= expr IS NOT expr */
151043         -   -2,  /* (194) expr ::= NOT expr */
151044         -   -2,  /* (195) expr ::= BITNOT expr */
151045         -   -2,  /* (196) expr ::= PLUS|MINUS expr */
151046         -   -1,  /* (197) between_op ::= BETWEEN */
151047         -   -2,  /* (198) between_op ::= NOT BETWEEN */
151048         -   -5,  /* (199) expr ::= expr between_op expr AND expr */
151049         -   -1,  /* (200) in_op ::= IN */
151050         -   -2,  /* (201) in_op ::= NOT IN */
151051         -   -5,  /* (202) expr ::= expr in_op LP exprlist RP */
151052         -   -3,  /* (203) expr ::= LP select RP */
151053         -   -5,  /* (204) expr ::= expr in_op LP select RP */
151054         -   -5,  /* (205) expr ::= expr in_op nm dbnm paren_exprlist */
151055         -   -4,  /* (206) expr ::= EXISTS LP select RP */
151056         -   -5,  /* (207) expr ::= CASE case_operand case_exprlist case_else END */
151057         -   -5,  /* (208) case_exprlist ::= case_exprlist WHEN expr THEN expr */
151058         -   -4,  /* (209) case_exprlist ::= WHEN expr THEN expr */
151059         -   -2,  /* (210) case_else ::= ELSE expr */
151060         -    0,  /* (211) case_else ::= */
151061         -   -1,  /* (212) case_operand ::= expr */
151062         -    0,  /* (213) case_operand ::= */
151063         -    0,  /* (214) exprlist ::= */
151064         -   -3,  /* (215) nexprlist ::= nexprlist COMMA expr */
151065         -   -1,  /* (216) nexprlist ::= expr */
151066         -    0,  /* (217) paren_exprlist ::= */
151067         -   -3,  /* (218) paren_exprlist ::= LP exprlist RP */
151068         -  -12,  /* (219) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
151069         -   -1,  /* (220) uniqueflag ::= UNIQUE */
151070         -    0,  /* (221) uniqueflag ::= */
151071         -    0,  /* (222) eidlist_opt ::= */
151072         -   -3,  /* (223) eidlist_opt ::= LP eidlist RP */
151073         -   -5,  /* (224) eidlist ::= eidlist COMMA nm collate sortorder */
151074         -   -3,  /* (225) eidlist ::= nm collate sortorder */
151075         -    0,  /* (226) collate ::= */
151076         -   -2,  /* (227) collate ::= COLLATE ID|STRING */
151077         -   -4,  /* (228) cmd ::= DROP INDEX ifexists fullname */
151078         -   -2,  /* (229) cmd ::= VACUUM vinto */
151079         -   -3,  /* (230) cmd ::= VACUUM nm vinto */
151080         -   -2,  /* (231) vinto ::= INTO expr */
151081         -    0,  /* (232) vinto ::= */
151082         -   -3,  /* (233) cmd ::= PRAGMA nm dbnm */
151083         -   -5,  /* (234) cmd ::= PRAGMA nm dbnm EQ nmnum */
151084         -   -6,  /* (235) cmd ::= PRAGMA nm dbnm LP nmnum RP */
151085         -   -5,  /* (236) cmd ::= PRAGMA nm dbnm EQ minus_num */
151086         -   -6,  /* (237) cmd ::= PRAGMA nm dbnm LP minus_num RP */
151087         -   -2,  /* (238) plus_num ::= PLUS INTEGER|FLOAT */
151088         -   -2,  /* (239) minus_num ::= MINUS INTEGER|FLOAT */
151089         -   -5,  /* (240) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
151090         -  -11,  /* (241) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
151091         -   -1,  /* (242) trigger_time ::= BEFORE|AFTER */
151092         -   -2,  /* (243) trigger_time ::= INSTEAD OF */
151093         -    0,  /* (244) trigger_time ::= */
151094         -   -1,  /* (245) trigger_event ::= DELETE|INSERT */
151095         -   -1,  /* (246) trigger_event ::= UPDATE */
151096         -   -3,  /* (247) trigger_event ::= UPDATE OF idlist */
151097         -    0,  /* (248) when_clause ::= */
151098         -   -2,  /* (249) when_clause ::= WHEN expr */
151099         -   -3,  /* (250) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
151100         -   -2,  /* (251) trigger_cmd_list ::= trigger_cmd SEMI */
151101         -   -3,  /* (252) trnm ::= nm DOT nm */
151102         -   -3,  /* (253) tridxby ::= INDEXED BY nm */
151103         -   -2,  /* (254) tridxby ::= NOT INDEXED */
151104         -   -8,  /* (255) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
151105         -   -8,  /* (256) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
151106         -   -6,  /* (257) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
151107         -   -3,  /* (258) trigger_cmd ::= scanpt select scanpt */
151108         -   -4,  /* (259) expr ::= RAISE LP IGNORE RP */
151109         -   -6,  /* (260) expr ::= RAISE LP raisetype COMMA nm RP */
151110         -   -1,  /* (261) raisetype ::= ROLLBACK */
151111         -   -1,  /* (262) raisetype ::= ABORT */
151112         -   -1,  /* (263) raisetype ::= FAIL */
151113         -   -4,  /* (264) cmd ::= DROP TRIGGER ifexists fullname */
151114         -   -6,  /* (265) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
151115         -   -3,  /* (266) cmd ::= DETACH database_kw_opt expr */
151116         -    0,  /* (267) key_opt ::= */
151117         -   -2,  /* (268) key_opt ::= KEY expr */
151118         -   -1,  /* (269) cmd ::= REINDEX */
151119         -   -3,  /* (270) cmd ::= REINDEX nm dbnm */
151120         -   -1,  /* (271) cmd ::= ANALYZE */
151121         -   -3,  /* (272) cmd ::= ANALYZE nm dbnm */
151122         -   -6,  /* (273) cmd ::= ALTER TABLE fullname RENAME TO nm */
151123         -   -7,  /* (274) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
151124         -   -1,  /* (275) add_column_fullname ::= fullname */
151125         -   -8,  /* (276) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
151126         -   -1,  /* (277) cmd ::= create_vtab */
151127         -   -4,  /* (278) cmd ::= create_vtab LP vtabarglist RP */
151128         -   -8,  /* (279) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
151129         -    0,  /* (280) vtabarg ::= */
151130         -   -1,  /* (281) vtabargtoken ::= ANY */
151131         -   -3,  /* (282) vtabargtoken ::= lp anylist RP */
151132         -   -1,  /* (283) lp ::= LP */
151133         -   -2,  /* (284) with ::= WITH wqlist */
151134         -   -3,  /* (285) with ::= WITH RECURSIVE wqlist */
151135         -   -6,  /* (286) wqlist ::= nm eidlist_opt AS LP select RP */
151136         -   -8,  /* (287) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
151137         -   -1,  /* (288) windowdefn_list ::= windowdefn */
151138         -   -3,  /* (289) windowdefn_list ::= windowdefn_list COMMA windowdefn */
151139         -   -5,  /* (290) windowdefn ::= nm AS LP window RP */
151140         -   -5,  /* (291) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
151141         -   -6,  /* (292) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
151142         -   -4,  /* (293) window ::= ORDER BY sortlist frame_opt */
151143         -   -5,  /* (294) window ::= nm ORDER BY sortlist frame_opt */
151144         -   -1,  /* (295) window ::= frame_opt */
151145         -   -2,  /* (296) window ::= nm frame_opt */
151146         -    0,  /* (297) frame_opt ::= */
151147         -   -3,  /* (298) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
151148         -   -6,  /* (299) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
151149         -   -1,  /* (300) range_or_rows ::= RANGE|ROWS|GROUPS */
151150         -   -1,  /* (301) frame_bound_s ::= frame_bound */
151151         -   -2,  /* (302) frame_bound_s ::= UNBOUNDED PRECEDING */
151152         -   -1,  /* (303) frame_bound_e ::= frame_bound */
151153         -   -2,  /* (304) frame_bound_e ::= UNBOUNDED FOLLOWING */
151154         -   -2,  /* (305) frame_bound ::= expr PRECEDING|FOLLOWING */
151155         -   -2,  /* (306) frame_bound ::= CURRENT ROW */
151156         -    0,  /* (307) frame_exclude_opt ::= */
151157         -   -2,  /* (308) frame_exclude_opt ::= EXCLUDE frame_exclude */
151158         -   -2,  /* (309) frame_exclude ::= NO OTHERS */
151159         -   -2,  /* (310) frame_exclude ::= CURRENT ROW */
151160         -   -1,  /* (311) frame_exclude ::= GROUP|TIES */
151161         -   -2,  /* (312) window_clause ::= WINDOW windowdefn_list */
151162         -   -5,  /* (313) over_clause ::= filter_opt OVER LP window RP */
151163         -   -3,  /* (314) over_clause ::= filter_opt OVER nm */
151164         -    0,  /* (315) filter_opt ::= */
151165         -   -5,  /* (316) filter_opt ::= FILTER LP WHERE expr RP */
151166         -   -1,  /* (317) input ::= cmdlist */
151167         -   -2,  /* (318) cmdlist ::= cmdlist ecmd */
151168         -   -1,  /* (319) cmdlist ::= ecmd */
151169         -   -1,  /* (320) ecmd ::= SEMI */
151170         -   -2,  /* (321) ecmd ::= cmdx SEMI */
151171         -   -2,  /* (322) ecmd ::= explain cmdx */
151172         -    0,  /* (323) trans_opt ::= */
151173         -   -1,  /* (324) trans_opt ::= TRANSACTION */
151174         -   -2,  /* (325) trans_opt ::= TRANSACTION nm */
151175         -   -1,  /* (326) savepoint_opt ::= SAVEPOINT */
151176         -    0,  /* (327) savepoint_opt ::= */
151177         -   -2,  /* (328) cmd ::= create_table create_table_args */
151178         -   -4,  /* (329) columnlist ::= columnlist COMMA columnname carglist */
151179         -   -2,  /* (330) columnlist ::= columnname carglist */
151180         -   -1,  /* (331) nm ::= ID|INDEXED */
151181         -   -1,  /* (332) nm ::= STRING */
151182         -   -1,  /* (333) nm ::= JOIN_KW */
151183         -   -1,  /* (334) typetoken ::= typename */
151184         -   -1,  /* (335) typename ::= ID|STRING */
151185         -   -1,  /* (336) signed ::= plus_num */
151186         -   -1,  /* (337) signed ::= minus_num */
151187         -   -2,  /* (338) carglist ::= carglist ccons */
151188         -    0,  /* (339) carglist ::= */
151189         -   -2,  /* (340) ccons ::= NULL onconf */
151190         -   -2,  /* (341) conslist_opt ::= COMMA conslist */
151191         -   -3,  /* (342) conslist ::= conslist tconscomma tcons */
151192         -   -1,  /* (343) conslist ::= tcons */
151193         -    0,  /* (344) tconscomma ::= */
151194         -   -1,  /* (345) defer_subclause_opt ::= defer_subclause */
151195         -   -1,  /* (346) resolvetype ::= raisetype */
151196         -   -1,  /* (347) selectnowith ::= oneselect */
151197         -   -1,  /* (348) oneselect ::= values */
151198         -   -2,  /* (349) sclp ::= selcollist COMMA */
151199         -   -1,  /* (350) as ::= ID|STRING */
151200         -   -1,  /* (351) expr ::= term */
151201         -   -1,  /* (352) likeop ::= LIKE_KW|MATCH */
151202         -   -1,  /* (353) exprlist ::= nexprlist */
151203         -   -1,  /* (354) nmnum ::= plus_num */
151204         -   -1,  /* (355) nmnum ::= nm */
151205         -   -1,  /* (356) nmnum ::= ON */
151206         -   -1,  /* (357) nmnum ::= DELETE */
151207         -   -1,  /* (358) nmnum ::= DEFAULT */
151208         -   -1,  /* (359) plus_num ::= INTEGER|FLOAT */
151209         -    0,  /* (360) foreach_clause ::= */
151210         -   -3,  /* (361) foreach_clause ::= FOR EACH ROW */
151211         -   -1,  /* (362) trnm ::= nm */
151212         -    0,  /* (363) tridxby ::= */
151213         -   -1,  /* (364) database_kw_opt ::= DATABASE */
151214         -    0,  /* (365) database_kw_opt ::= */
151215         -    0,  /* (366) kwcolumn_opt ::= */
151216         -   -1,  /* (367) kwcolumn_opt ::= COLUMNKW */
151217         -   -1,  /* (368) vtabarglist ::= vtabarg */
151218         -   -3,  /* (369) vtabarglist ::= vtabarglist COMMA vtabarg */
151219         -   -2,  /* (370) vtabarg ::= vtabarg vtabargtoken */
151220         -    0,  /* (371) anylist ::= */
151221         -   -4,  /* (372) anylist ::= anylist LP anylist RP */
151222         -   -2,  /* (373) anylist ::= anylist ANY */
151223         -    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 ::= */
151224 151806   };
151225 151807   
151226 151808   static void yy_accept(yyParser*);  /* Forward Declaration */
151227 151809   
151228 151810   /*
151229 151811   ** Perform a reduce action and the shift that must immediately
151230 151812   ** follow the reduce.
................................................................................
151313 151895         case 1: /* explain ::= EXPLAIN QUERY PLAN */
151314 151896   { pParse->explain = 2; }
151315 151897           break;
151316 151898         case 2: /* cmdx ::= cmd */
151317 151899   { sqlite3FinishCoding(pParse); }
151318 151900           break;
151319 151901         case 3: /* cmd ::= BEGIN transtype trans_opt */
151320         -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy494);}
       151902  +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy100);}
151321 151903           break;
151322 151904         case 4: /* transtype ::= */
151323         -{yymsp[1].minor.yy494 = TK_DEFERRED;}
       151905  +{yymsp[1].minor.yy100 = TK_DEFERRED;}
151324 151906           break;
151325 151907         case 5: /* transtype ::= DEFERRED */
151326 151908         case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
151327 151909         case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
151328         -      case 300: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==300);
151329         -{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*/}
151330 151912           break;
151331 151913         case 8: /* cmd ::= COMMIT|END trans_opt */
151332 151914         case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
151333 151915   {sqlite3EndTransaction(pParse,yymsp[-1].major);}
151334 151916           break;
151335 151917         case 10: /* cmd ::= SAVEPOINT nm */
151336 151918   {
................................................................................
151345 151927         case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
151346 151928   {
151347 151929     sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
151348 151930   }
151349 151931           break;
151350 151932         case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
151351 151933   {
151352         -   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);
151353 151935   }
151354 151936           break;
151355 151937         case 14: /* createkw ::= CREATE */
151356 151938   {disableLookaside(pParse);}
151357 151939           break;
151358 151940         case 15: /* ifnotexists ::= */
151359 151941         case 18: /* temp ::= */ yytestcase(yyruleno==18);
151360 151942         case 21: /* table_options ::= */ yytestcase(yyruleno==21);
151361         -      case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
151362         -      case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
151363         -      case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
151364         -      case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
151365         -      case 93: /* distinct ::= */ yytestcase(yyruleno==93);
151366         -      case 226: /* collate ::= */ yytestcase(yyruleno==226);
151367         -{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;}
151368 151950           break;
151369 151951         case 16: /* ifnotexists ::= IF NOT EXISTS */
151370         -{yymsp[-2].minor.yy494 = 1;}
       151952  +{yymsp[-2].minor.yy100 = 1;}
151371 151953           break;
151372 151954         case 17: /* temp ::= TEMP */
151373         -      case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43);
151374         -{yymsp[0].minor.yy494 = 1;}
       151955  +      case 44: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==44);
       151956  +{yymsp[0].minor.yy100 = 1;}
151375 151957           break;
151376 151958         case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
151377 151959   {
151378         -  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);
151379 151961   }
151380 151962           break;
151381 151963         case 20: /* create_table_args ::= AS select */
151382 151964   {
151383         -  sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy457);
151384         -  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);
151385 151967   }
151386 151968           break;
151387 151969         case 22: /* table_options ::= WITHOUT nm */
151388 151970   {
151389 151971     if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
151390         -    yymsp[-1].minor.yy494 = TF_WithoutRowid | TF_NoVisibleRowid;
       151972  +    yymsp[-1].minor.yy100 = TF_WithoutRowid | TF_NoVisibleRowid;
151391 151973     }else{
151392         -    yymsp[-1].minor.yy494 = 0;
       151974  +    yymsp[-1].minor.yy100 = 0;
151393 151975       sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
151394 151976     }
151395 151977   }
151396 151978           break;
151397 151979         case 23: /* columnname ::= nm typetoken */
151398 151980   {sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
151399 151981           break;
151400 151982         case 24: /* typetoken ::= */
151401         -      case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60);
151402         -      case 99: /* as ::= */ yytestcase(yyruleno==99);
       151983  +      case 61: /* conslist_opt ::= */ yytestcase(yyruleno==61);
       151984  +      case 100: /* as ::= */ yytestcase(yyruleno==100);
151403 151985   {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
151404 151986           break;
151405 151987         case 25: /* typetoken ::= typename LP signed RP */
151406 151988   {
151407 151989     yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
151408 151990   }
151409 151991           break;
................................................................................
151414 151996           break;
151415 151997         case 27: /* typename ::= typename ID|STRING */
151416 151998   {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
151417 151999           break;
151418 152000         case 28: /* scanpt ::= */
151419 152001   {
151420 152002     assert( yyLookahead!=YYNOCODE );
151421         -  yymsp[1].minor.yy294 = yyLookaheadToken.z;
       152003  +  yymsp[1].minor.yy528 = yyLookaheadToken.z;
151422 152004   }
151423 152005           break;
151424         -      case 29: /* ccons ::= CONSTRAINT nm */
151425         -      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);
151426 152014   {pParse->constraintName = yymsp[0].minor.yy0;}
151427 152015           break;
151428         -      case 30: /* ccons ::= DEFAULT scanpt term scanpt */
151429         -{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]);}
151430 152018           break;
151431         -      case 31: /* ccons ::= DEFAULT LP expr RP */
151432         -{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);}
151433 152021           break;
151434         -      case 32: /* ccons ::= DEFAULT PLUS term scanpt */
151435         -{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]);}
151436 152024           break;
151437         -      case 33: /* ccons ::= DEFAULT MINUS term scanpt */
       152025  +      case 34: /* ccons ::= DEFAULT MINUS scantok term */
151438 152026   {
151439         -  Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[-1].minor.yy524, 0);
151440         -  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]);
151441 152029   }
151442 152030           break;
151443         -      case 34: /* ccons ::= DEFAULT scanpt ID|INDEXED */
       152031  +      case 35: /* ccons ::= DEFAULT scantok ID|INDEXED */
151444 152032   {
151445 152033     Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0);
151446 152034     if( p ){
151447 152035       sqlite3ExprIdToTrueFalse(p);
151448 152036       testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) );
151449 152037     }
151450 152038       sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
151451 152039   }
151452 152040           break;
151453         -      case 35: /* ccons ::= NOT NULL onconf */
151454         -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy494);}
       152041  +      case 36: /* ccons ::= NOT NULL onconf */
       152042  +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy100);}
151455 152043           break;
151456         -      case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
151457         -{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);}
151458 152046           break;
151459         -      case 37: /* ccons ::= UNIQUE onconf */
151460         -{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,
151461 152049                                      SQLITE_IDXTYPE_UNIQUE);}
151462 152050           break;
151463         -      case 38: /* ccons ::= CHECK LP expr RP */
151464         -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy524);}
       152051  +      case 39: /* ccons ::= CHECK LP expr RP */
       152052  +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy102);}
151465 152053           break;
151466         -      case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */
151467         -{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);}
151468 152056           break;
151469         -      case 40: /* ccons ::= defer_subclause */
151470         -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy494);}
       152057  +      case 41: /* ccons ::= defer_subclause */
       152058  +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy100);}
151471 152059           break;
151472         -      case 41: /* ccons ::= COLLATE ID|STRING */
       152060  +      case 42: /* ccons ::= COLLATE ID|STRING */
151473 152061   {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
151474 152062           break;
151475         -      case 44: /* refargs ::= */
151476         -{ yymsp[1].minor.yy494 = OE_None*0x0101; /* EV: R-19803-45884 */}
151477         -        break;
151478         -      case 45: /* refargs ::= refargs refarg */
151479         -{ yymsp[-1].minor.yy494 = (yymsp[-1].minor.yy494 & ~yymsp[0].minor.yy355.mask) | yymsp[0].minor.yy355.value; }
151480         -        break;
151481         -      case 46: /* refarg ::= MATCH nm */
151482         -{ yymsp[-1].minor.yy355.value = 0;     yymsp[-1].minor.yy355.mask = 0x000000; }
151483         -        break;
151484         -      case 47: /* refarg ::= ON INSERT refact */
151485         -{ yymsp[-2].minor.yy355.value = 0;     yymsp[-2].minor.yy355.mask = 0x000000; }
151486         -        break;
151487         -      case 48: /* refarg ::= ON DELETE refact */
151488         -{ yymsp[-2].minor.yy355.value = yymsp[0].minor.yy494;     yymsp[-2].minor.yy355.mask = 0x0000ff; }
151489         -        break;
151490         -      case 49: /* refarg ::= ON UPDATE refact */
151491         -{ yymsp[-2].minor.yy355.value = yymsp[0].minor.yy494<<8;  yymsp[-2].minor.yy355.mask = 0x00ff00; }
151492         -        break;
151493         -      case 50: /* refact ::= SET NULL */
151494         -{ yymsp[-1].minor.yy494 = OE_SetNull;  /* EV: R-33326-45252 */}
151495         -        break;
151496         -      case 51: /* refact ::= SET DEFAULT */
151497         -{ yymsp[-1].minor.yy494 = OE_SetDflt;  /* EV: R-33326-45252 */}
151498         -        break;
151499         -      case 52: /* refact ::= CASCADE */
151500         -{ yymsp[0].minor.yy494 = OE_Cascade;  /* EV: R-33326-45252 */}
151501         -        break;
151502         -      case 53: /* refact ::= RESTRICT */
151503         -{ yymsp[0].minor.yy494 = OE_Restrict; /* EV: R-33326-45252 */}
151504         -        break;
151505         -      case 54: /* refact ::= NO ACTION */
151506         -{ yymsp[-1].minor.yy494 = OE_None;     /* EV: R-33326-45252 */}
151507         -        break;
151508         -      case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
151509         -{yymsp[-2].minor.yy494 = 0;}
151510         -        break;
151511         -      case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
151512         -      case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
151513         -      case 156: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==156);
151514         -{yymsp[-1].minor.yy494 = yymsp[0].minor.yy494;}
151515         -        break;
151516         -      case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
151517         -      case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
151518         -      case 198: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==198);
151519         -      case 201: /* in_op ::= NOT IN */ yytestcase(yyruleno==201);
151520         -      case 227: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==227);
151521         -{yymsp[-1].minor.yy494 = 1;}
151522         -        break;
151523         -      case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
151524         -{yymsp[-1].minor.yy494 = 0;}
151525         -        break;
151526         -      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 */
151527 152115   {pParse->constraintName.n = 0;}
151528 152116           break;
151529         -      case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
151530         -{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);}
151531 152119           break;
151532         -      case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */
151533         -{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,
151534 152122                                          SQLITE_IDXTYPE_UNIQUE);}
151535 152123           break;
151536         -      case 65: /* tcons ::= CHECK LP expr RP onconf */
151537         -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy524);}
151538         -        break;
151539         -      case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
151540         -{
151541         -    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy434, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy434, yymsp[-1].minor.yy494);
151542         -    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy494);
151543         -}
151544         -        break;
151545         -      case 68: /* onconf ::= */
151546         -      case 70: /* orconf ::= */ yytestcase(yyruleno==70);
151547         -{yymsp[1].minor.yy494 = OE_Default;}
151548         -        break;
151549         -      case 69: /* onconf ::= ON CONFLICT resolvetype */
151550         -{yymsp[-2].minor.yy494 = yymsp[0].minor.yy494;}
151551         -        break;
151552         -      case 72: /* resolvetype ::= IGNORE */
151553         -{yymsp[0].minor.yy494 = OE_Ignore;}
151554         -        break;
151555         -      case 73: /* resolvetype ::= REPLACE */
151556         -      case 157: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==157);
151557         -{yymsp[0].minor.yy494 = OE_Replace;}
151558         -        break;
151559         -      case 74: /* cmd ::= DROP TABLE ifexists fullname */
151560         -{
151561         -  sqlite3DropTable(pParse, yymsp[0].minor.yy483, 0, yymsp[-1].minor.yy494);
151562         -}
151563         -        break;
151564         -      case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
151565         -{
151566         -  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);
151567         -}
151568         -        break;
151569         -      case 78: /* cmd ::= DROP VIEW ifexists fullname */
151570         -{
151571         -  sqlite3DropTable(pParse, yymsp[0].minor.yy483, 1, yymsp[-1].minor.yy494);
151572         -}
151573         -        break;
151574         -      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 */
151575 152163   {
151576 152164     SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
151577         -  sqlite3Select(pParse, yymsp[0].minor.yy457, &dest);
151578         -  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy457);
       152165  +  sqlite3Select(pParse, yymsp[0].minor.yy391, &dest);
       152166  +  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy391);
151579 152167   }
151580 152168           break;
151581         -      case 80: /* select ::= WITH wqlist selectnowith */
       152169  +      case 81: /* select ::= WITH wqlist selectnowith */
151582 152170   {
151583         -  Select *p = yymsp[0].minor.yy457;
       152171  +  Select *p = yymsp[0].minor.yy391;
151584 152172     if( p ){
151585         -    p->pWith = yymsp[-1].minor.yy59;
       152173  +    p->pWith = yymsp[-1].minor.yy243;
151586 152174       parserDoubleLinkSelect(pParse, p);
151587 152175     }else{
151588         -    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy59);
       152176  +    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy243);
151589 152177     }
151590         -  yymsp[-2].minor.yy457 = p;
       152178  +  yymsp[-2].minor.yy391 = p;
151591 152179   }
151592 152180           break;
151593         -      case 81: /* select ::= WITH RECURSIVE wqlist selectnowith */
       152181  +      case 82: /* select ::= WITH RECURSIVE wqlist selectnowith */
151594 152182   {
151595         -  Select *p = yymsp[0].minor.yy457;
       152183  +  Select *p = yymsp[0].minor.yy391;
151596 152184     if( p ){
151597         -    p->pWith = yymsp[-1].minor.yy59;
       152185  +    p->pWith = yymsp[-1].minor.yy243;
151598 152186       parserDoubleLinkSelect(pParse, p);
151599 152187     }else{
151600         -    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy59);
       152188  +    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy243);
151601 152189     }
151602         -  yymsp[-3].minor.yy457 = p;
       152190  +  yymsp[-3].minor.yy391 = p;
151603 152191   }
151604 152192           break;
151605         -      case 82: /* select ::= selectnowith */
       152193  +      case 83: /* select ::= selectnowith */
151606 152194   {
151607         -  Select *p = yymsp[0].minor.yy457;
       152195  +  Select *p = yymsp[0].minor.yy391;
151608 152196     if( p ){
151609 152197       parserDoubleLinkSelect(pParse, p);
151610 152198     }
151611         -  yymsp[0].minor.yy457 = p; /*A-overwrites-X*/
       152199  +  yymsp[0].minor.yy391 = p; /*A-overwrites-X*/
151612 152200   }
151613 152201           break;
151614         -      case 83: /* selectnowith ::= selectnowith multiselect_op oneselect */
       152202  +      case 84: /* selectnowith ::= selectnowith multiselect_op oneselect */
151615 152203   {
151616         -  Select *pRhs = yymsp[0].minor.yy457;
151617         -  Select *pLhs = yymsp[-2].minor.yy457;
       152204  +  Select *pRhs = yymsp[0].minor.yy391;
       152205  +  Select *pLhs = yymsp[-2].minor.yy391;
151618 152206     if( pRhs && pRhs->pPrior ){
151619 152207       SrcList *pFrom;
151620 152208       Token x;
151621 152209       x.n = 0;
151622 152210       parserDoubleLinkSelect(pParse, pRhs);
151623 152211       pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
151624 152212       pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
151625 152213     }
151626 152214     if( pRhs ){
151627         -    pRhs->op = (u8)yymsp[-1].minor.yy494;
       152215  +    pRhs->op = (u8)yymsp[-1].minor.yy100;
151628 152216       pRhs->pPrior = pLhs;
151629 152217       if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
151630 152218       pRhs->selFlags &= ~SF_MultiValue;
151631         -    if( yymsp[-1].minor.yy494!=TK_ALL ) pParse->hasCompound = 1;
       152219  +    if( yymsp[-1].minor.yy100!=TK_ALL ) pParse->hasCompound = 1;
151632 152220     }else{
151633 152221       sqlite3SelectDelete(pParse->db, pLhs);
151634 152222     }
151635         -  yymsp[-2].minor.yy457 = pRhs;
151636         -}
151637         -        break;
151638         -      case 84: /* multiselect_op ::= UNION */
151639         -      case 86: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==86);
151640         -{yymsp[0].minor.yy494 = yymsp[0].major; /*A-overwrites-OP*/}
151641         -        break;
151642         -      case 85: /* multiselect_op ::= UNION ALL */
151643         -{yymsp[-1].minor.yy494 = TK_ALL;}
151644         -        break;
151645         -      case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
151646         -{
151647         -  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);
151648         -}
151649         -        break;
151650         -      case 88: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
151651         -{
151652         -  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);
151653         -