System.Data.SQLite

Check-in [fe3c97a1d8]
Login

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

Overview
Comment:Update SQLite core library to the 3.29.0 release.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fe3c97a1d8a0df6c559ed0fb3796acb597bc2365
User & Date: mistachkin 2019-07-13 18:28:09.856
Context
2019-07-13
18:31
Pickup the SQLite core library 3.29.0 docs from upstream. check-in: 4deb290d23 user: mistachkin tags: trunk
18:28
Update SQLite core library to the 3.29.0 release. check-in: fe3c97a1d8 user: mistachkin tags: trunk
2019-06-29
16:10
Rename a variable in the build batch tool. check-in: 22b5e0f49a user: mistachkin tags: trunk
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to SQLite.Interop/props/sqlite3.props.
1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
19
20











-
-
+
+







<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * sqlite3.props -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup Label="UserMacros">
    <SQLITE_MANIFEST_VERSION>3.28.0.0</SQLITE_MANIFEST_VERSION>
    <SQLITE_RC_VERSION>3,28,0,0</SQLITE_RC_VERSION>
    <SQLITE_MANIFEST_VERSION>3.29.0.0</SQLITE_MANIFEST_VERSION>
    <SQLITE_RC_VERSION>3,29,0,0</SQLITE_RC_VERSION>
    <SQLITE_COMMON_DEFINES>_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT4=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1;SQLITE_ENABLE_MEMORY_MANAGEMENT=1;SQLITE_ENABLE_API_ARMOR=1;SQLITE_ENABLE_DBSTAT_VTAB=1;SQLITE_ENABLE_STMTVTAB=1</SQLITE_COMMON_DEFINES>
    <SQLITE_EXTRA_DEFINES>SQLITE_PLACEHOLDER=1;SQLITE_HAS_CODEC=1</SQLITE_EXTRA_DEFINES>
    <SQLITE_WINCE_200X_DEFINES>SQLITE_OMIT_WAL=1</SQLITE_WINCE_200X_DEFINES>
    <SQLITE_WINCE_2013_DEFINES>HAVE_ERRNO_H=1;SQLITE_MSVC_LOCALTIME_API=1</SQLITE_WINCE_2013_DEFINES>
    <SQLITE_DEBUG_DEFINES>SQLITE_DEBUG=1;SQLITE_MEMDEBUG=1;SQLITE_ENABLE_EXPENSIVE_ASSERT=1</SQLITE_DEBUG_DEFINES>
    <SQLITE_RELEASE_DEFINES>SQLITE_WIN32_MALLOC=1</SQLITE_RELEASE_DEFINES>
    <SQLITE_DISABLE_WARNINGS>4055;4100;4127;4146;4210;4232;4244;4245;4267;4306;4389;4701;4703;4706</SQLITE_DISABLE_WARNINGS>
Changes to SQLite.Interop/props/sqlite3.vsprops.
10
11
12
13
14
15
16
17

18
19
20
21
22

23
24
25
26
27
28
29
10
11
12
13
14
15
16

17
18
19
20
21

22
23
24
25
26
27
28
29







-
+




-
+







<VisualStudioPropertySheet
	ProjectType="Visual C++"
	Version="8.00"
	Name="sqlite3"
	>
	<UserMacro
		Name="SQLITE_MANIFEST_VERSION"
		Value="3.28.0.0"
		Value="3.29.0.0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_RC_VERSION"
		Value="3,28,0,0"
		Value="3,29,0,0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_COMMON_DEFINES"
		Value="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT4=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1;SQLITE_ENABLE_MEMORY_MANAGEMENT=1;SQLITE_ENABLE_API_ARMOR=1;SQLITE_ENABLE_DBSTAT_VTAB=1;SQLITE_ENABLE_STMTVTAB=1"
		PerformEnvironmentSet="true"
	/>
Changes to SQLite.Interop/src/core/sqlite3.c.
1
2
3

4
5
6
7
8
9
10
1
2

3
4
5
6
7
8
9
10


-
+







/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
** version 3.28.0.  By combining all the individual C code files into this
** version 3.29.0.  By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation
** unit.  This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately.  Performance improvements
** of 5% or more are commonly seen when SQLite is compiled as a single
** translation unit.
**
** This file is all you need to compile SQLite.  To use SQLite in other
35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49







-
+







**
*************************************************************************
**
** This file implements routines used to report what compile-time options
** SQLite was built with.
*/

#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS /* IMP: R-16824-07538 */

/*
** Include the configuration header output by 'configure' if we're using the
** autoconf-based build
*/
#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H)
#include "config.h"
884
885
886
887
888
889
890





891
892
893
894
895
896
897
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902







+
+
+
+
+







#pragma warning(disable : 4244)
#pragma warning(disable : 4305)
#pragma warning(disable : 4306)
#pragma warning(disable : 4702)
#pragma warning(disable : 4706)
#endif /* defined(_MSC_VER) */

#if defined(_MSC_VER) && !defined(_WIN64)
#undef SQLITE_4_BYTE_ALIGNED_MALLOC
#define SQLITE_4_BYTE_ALIGNED_MALLOC
#endif /* defined(_MSC_VER) && !defined(_WIN64) */

#endif /* SQLITE_MSVC_H */

/************** End of msvc.h ************************************************/
/************** Continuing where we left off in sqliteInt.h ******************/

/*
** Special setup for VxWorks
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167



1168
1169
1170
1171
1172
1173
1174
1163
1164
1165
1166
1167
1168
1169



1170
1171
1172
1173
1174
1175
1176
1177
1178
1179







-
-
-
+
+
+







** been edited in any way since it was last checked in, then the last
** four hexadecimal digits of the hash may be modified.
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION        "3.28.0"
#define SQLITE_VERSION_NUMBER 3028000
#define SQLITE_SOURCE_ID      "2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f83156b50"
#define SQLITE_VERSION        "3.29.0"
#define SQLITE_VERSION_NUMBER 3029000
#define SQLITE_SOURCE_ID      "2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6"

/*
** CAPI3REF: Run-Time Library Version Numbers
** KEYWORDS: sqlite3_version sqlite3_sourceid
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
2331
2332
2333
2334
2335
2336
2337
2338
2339








2340
2341
2342
2343
2344
2345
2346
2336
2337
2338
2339
2340
2341
2342


2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357







-
-
+
+
+
+
+
+
+
+







** element will be valid after xOpen returns regardless of the success
** or failure of the xOpen call.
**
** [[sqlite3_vfs.xAccess]]
** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
** to test whether a file is at least readable.   The file can be a
** directory.
** to test whether a file is at least readable.  The SQLITE_ACCESS_READ
** flag is never actually used and is not implemented in the built-in
** VFSes of SQLite.  The file is named by the second argument and can be a
** directory. The xAccess method returns [SQLITE_OK] on success or some
** non-zero error code if there is an I/O error or if the name of
** the file given in the second argument is illegal.  If SQLITE_OK
** is returned, then non-zero or zero is written into *pResOut to indicate
** whether or not the file is accessible.  
**
** ^SQLite will always allocate at least mxPathname+1 bytes for the
** output buffer xFullPathname.  The exact size of the output buffer
** is also passed as a parameter to both  methods. If the output buffer
** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
** handled as a fatal error by SQLite, vfs implementations should endeavor
** to prevent this by setting mxPathname to a sufficiently large value.
3233
3234
3235
3236
3237
3238
3239

3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254




























3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268



3269

3270
3271
3272
3273
3274
3275
3276
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311

3312
3313
3314
3315
3316
3317
3318
3319







+















+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+














+
+
+
-
+







** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the
** "defensive" flag for a database connection.  When the defensive
** flag is enabled, language features that allow ordinary SQL to 
** deliberately corrupt the database file are disabled.  The disabled
** features include but are not limited to the following:
** <ul>
** <li> The [PRAGMA writable_schema=ON] statement.
** <li> The [PRAGMA journal_mode=OFF] statement.
** <li> Writes to the [sqlite_dbpage] virtual table.
** <li> Direct writes to [shadow tables].
** </ul>
** </dd>
**
** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt>
** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the
** "writable_schema" flag. This has the same effect and is logically equivalent
** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF].
** The first argument to this setting is an integer which is 0 to disable 
** the writable_schema, positive to enable writable_schema, or negative to
** leave the setting unchanged. The second parameter is a pointer to an
** integer into which is written 0 or 1 to indicate whether the writable_schema
** is enabled or disabled following this call.
** </dd>
**
** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt>
** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
** the legacy behavior of the [ALTER TABLE RENAME] command such it
** behaves as it did prior to [version 3.24.0] (2018-06-04).  See the
** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for
** additional information. This feature can also be turned on and off
** using the [PRAGMA legacy_alter_table] statement.
** </dd>
**
** [[SQLITE_DBCONFIG_DQS_DML]]
** <dt>SQLITE_DBCONFIG_DQS_DML</td>
** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
** the legacy [double-quoted string literal] misfeature for DML statement
** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
** default value of this setting is determined by the [-DSQLITE_DQS]
** compile-time option.
** </dd>
**
** [[SQLITE_DBCONFIG_DQS_DDL]]
** <dt>SQLITE_DBCONFIG_DQS_DDL</td>
** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates
** the legacy [double-quoted string literal] misfeature for DDL statements,
** such as CREATE TABLE and CREATE INDEX. The
** default value of this setting is determined by the [-DSQLITE_DQS]
** compile-time option.
** </dd>
** </dl>
*/
#define SQLITE_DBCONFIG_MAINDBNAME            1000 /* const char* */
#define SQLITE_DBCONFIG_LOOKASIDE             1001 /* void* int int */
#define SQLITE_DBCONFIG_ENABLE_FKEY           1002 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_TRIGGER        1003 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE      1006 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_QPSG           1007 /* int int* */
#define SQLITE_DBCONFIG_TRIGGER_EQP           1008 /* int int* */
#define SQLITE_DBCONFIG_RESET_DATABASE        1009 /* int int* */
#define SQLITE_DBCONFIG_DEFENSIVE             1010 /* int int* */
#define SQLITE_DBCONFIG_WRITABLE_SCHEMA       1011 /* int int* */
#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE    1012 /* int int* */
#define SQLITE_DBCONFIG_DQS_DML               1013 /* int int* */
#define SQLITE_DBCONFIG_DQS_DDL               1014 /* int int* */
#define SQLITE_DBCONFIG_MAX                   1011 /* Largest DBCONFIG */
#define SQLITE_DBCONFIG_MAX                   1014 /* Largest DBCONFIG */

/*
** CAPI3REF: Enable Or Disable Extended Result Codes
** METHOD: sqlite3
**
** ^The sqlite3_extended_result_codes() routine enables or disables the
** [extended result codes] feature of SQLite. ^The extended result
8354
8355
8356
8357
8358
8359
8360

8361

8362
8363
8364
8365
8366
8367
8368
8397
8398
8399
8400
8401
8402
8403
8404

8405
8406
8407
8408
8409
8410
8411
8412







+
-
+







#define SQLITE_TESTCTRL_NEVER_CORRUPT           20
#define SQLITE_TESTCTRL_VDBE_COVERAGE           21
#define SQLITE_TESTCTRL_BYTEORDER               22
#define SQLITE_TESTCTRL_ISINIT                  23
#define SQLITE_TESTCTRL_SORTER_MMAP             24
#define SQLITE_TESTCTRL_IMPOSTER                25
#define SQLITE_TESTCTRL_PARSER_COVERAGE         26
#define SQLITE_TESTCTRL_RESULT_INTREAL          27
#define SQLITE_TESTCTRL_LAST                    26  /* Largest TESTCTRL */
#define SQLITE_TESTCTRL_LAST                    27  /* Largest TESTCTRL */

/*
** CAPI3REF: SQL Keyword Checking
**
** These routines provide access to the set of SQL language keywords 
** recognized by SQLite.  Applications can uses these routines to determine
** whether or not a specific identifier needs to be escaped (for example,
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958




13959
13960


13961
13962
13963
13964
13965
13966
13967
13992
13993
13994
13995
13996
13997
13998




13999
14000
14001
14002
14003

14004
14005
14006
14007
14008
14009
14010
14011
14012







-
-
-
-
+
+
+
+

-
+
+







**
** For best performance, an attempt is made to guess at the byte-order
** using C-preprocessor macros.  If that is unsuccessful, or if
** -DSQLITE_BYTEORDER=0 is set, then byte-order is determined
** at run-time.
*/
#ifndef SQLITE_BYTEORDER
# if defined(i386)     || defined(__i386__)   || defined(_M_IX86) ||    \
     defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)  ||    \
     defined(_M_AMD64) || defined(_M_ARM)     || defined(__x86)   ||    \
     defined(__arm__)  || defined(_M_ARM64)
# if defined(i386)      || defined(__i386__)      || defined(_M_IX86) ||    \
     defined(__x86_64)  || defined(__x86_64__)    || defined(_M_X64)  ||    \
     defined(_M_AMD64)  || defined(_M_ARM)        || defined(__x86)   ||    \
     defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
#   define SQLITE_BYTEORDER    1234
# elif defined(sparc)    || defined(__ppc__)
# elif defined(sparc)     || defined(__ppc__) || \
       defined(__ARMEB__) || defined(__AARCH64EB__)
#   define SQLITE_BYTEORDER    4321
# else
#   define SQLITE_BYTEORDER 0
# endif
#endif
#if SQLITE_BYTEORDER==4321
# define SQLITE_BIGENDIAN    1
16466
16467
16468
16469
16470
16471
16472


16473
16474
16475
16476
16477
16478
16479
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526







+
+







#define SQLITE_Fts3Tokenizer  0x00400000  /* Enable fts3_tokenizer(2) */
#define SQLITE_EnableQPSG     0x00800000  /* Query Planner Stability Guarantee*/
#define SQLITE_TriggerEQP     0x01000000  /* Show trigger EXPLAIN QUERY PLAN */
#define SQLITE_ResetDatabase  0x02000000  /* Reset the database */
#define SQLITE_LegacyAlter    0x04000000  /* Legacy ALTER TABLE behaviour */
#define SQLITE_NoSchemaError  0x08000000  /* Do not report schema parse errors*/
#define SQLITE_Defensive      0x10000000  /* Input SQL is likely hostile */
#define SQLITE_DqsDDL         0x20000000  /* dbl-quoted strings allowed in DDL*/
#define SQLITE_DqsDML         0x40000000  /* dbl-quoted strings allowed in DML*/

/* Flags used only if debugging */
#define HI(X)  ((u64)(X)<<32)
#ifdef SQLITE_DEBUG
#define SQLITE_SqlTrace       HI(0x0001)  /* Debug print SQL as it executes */
#define SQLITE_VdbeListing    HI(0x0002)  /* Debug listings of VDBE progs */
#define SQLITE_VdbeTrace      HI(0x0004)  /* True to trace VDBE execution */
17172
17173
17174
17175
17176
17177
17178

17179
17180
17181
17182
17183
17184
17185
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233







+







  unsigned bUnordered:1;   /* Use this index for == or IN queries only */
  unsigned uniqNotNull:1;  /* True if UNIQUE and NOT NULL for all columns */
  unsigned isResized:1;    /* True if resizeIndexObject() has been called */
  unsigned isCovering:1;   /* True if this is a covering index */
  unsigned noSkipScan:1;   /* Do not try to use skip-scan if true */
  unsigned hasStat1:1;     /* aiRowLogEst values come from sqlite_stat1 */
  unsigned bNoQuery:1;     /* Do not use this index to optimize queries */
  unsigned bAscKeyBug:1;   /* True if the bba7b69f9849b5bf bug applies */
#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
  int nSample;             /* Number of elements in aSample[] */
  int nSampleCol;          /* Size of IndexSample.anEq[] and so on */
  tRowcnt *aAvgEq;         /* Average nEq values for keys not in aSample */
  IndexSample *aSample;    /* Samples of the left-most key */
  tRowcnt *aiRowEst;       /* Non-logarithmic stat1 data for this index */
  tRowcnt nRowEst0;        /* Non-logarithmic number of rows in the index */
17399
17400
17401
17402
17403
17404
17405
17406

17407
17408
17409
17410
17411
17412
17413
17447
17448
17449
17450
17451
17452
17453

17454
17455
17456
17457
17458
17459
17460
17461







-
+







                         ** EP_Unlikely:  134217728 times likelihood
                         ** TK_SELECT: 1st register of result vector */
  ynVar iColumn;         /* TK_COLUMN: column index.  -1 for rowid.
                         ** TK_VARIABLE: variable number (always >= 1).
                         ** TK_SELECT_COLUMN: column of the result vector */
  i16 iAgg;              /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
  i16 iRightJoinTable;   /* If EP_FromJoin, the right table of the join */
  u8 op2;                /* TK_REGISTER: original value of Expr.op
  u8 op2;                /* TK_REGISTER/TK_TRUTH: original value of Expr.op
                         ** TK_COLUMN: the value of p5 for OP_Column
                         ** TK_AGG_FUNCTION: nesting depth */
  AggInfo *pAggInfo;     /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
  union {
    Table *pTab;           /* TK_COLUMN: Table containing column. Can be NULL
                           ** for a column of an index on an expression */
    Window *pWin;          /* TK_FUNCTION: Window definition for the func */
17433
17434
17435
17436
17437
17438
17439
17440

17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455


17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470


17471
17472
17473
17474
17475
17476
17477
17481
17482
17483
17484
17485
17486
17487

17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529







-
+















+
+















+
+







#define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
#define EP_DblQuoted 0x000040 /* token.z was originally in "..." */
#define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */
#define EP_Collate   0x000100 /* Tree contains a TK_COLLATE operator */
#define EP_Generic   0x000200 /* Ignore COLLATE or affinity on this tree */
#define EP_IntValue  0x000400 /* Integer value contained in u.iValue */
#define EP_xIsSelect 0x000800 /* x.pSelect is valid (otherwise x.pList is) */
#define EP_Skip      0x001000 /* COLLATE, AS, or UNLIKELY */
#define EP_Skip      0x001000 /* Operator does not contribute to affinity */
#define EP_Reduced   0x002000 /* Expr struct EXPR_REDUCEDSIZE bytes only */
#define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */
#define EP_Win       0x008000 /* Contains window functions */
#define EP_MemToken  0x010000 /* Need to sqlite3DbFree() Expr.zToken */
#define EP_NoReduce  0x020000 /* Cannot EXPRDUP_REDUCE this Expr */
#define EP_Unlikely  0x040000 /* unlikely() or likelihood() function */
#define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */
#define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */
#define EP_Subquery  0x200000 /* Tree contains a TK_SELECT operator */
#define EP_Alias     0x400000 /* Is an alias for a result set column */
#define EP_Leaf      0x800000 /* Expr.pLeft, .pRight, .u.pSelect all NULL */
#define EP_WinFunc  0x1000000 /* TK_FUNCTION with Expr.y.pWin set */
#define EP_Subrtn   0x2000000 /* Uses Expr.y.sub. TK_IN, _SELECT, or _EXISTS */
#define EP_Quoted   0x4000000 /* TK_ID was originally quoted */
#define EP_Static   0x8000000 /* Held in memory not obtained from malloc() */
#define EP_IsTrue  0x10000000 /* Always has boolean value of TRUE */
#define EP_IsFalse 0x20000000 /* Always has boolean value of FALSE */

/*
** The EP_Propagate mask is a set of properties that automatically propagate
** upwards into parent nodes.
*/
#define EP_Propagate (EP_Collate|EP_Subquery|EP_HasFunc)

/*
** These macros can be used to test, set, or clear bits in the
** Expr.flags field.
*/
#define ExprHasProperty(E,P)     (((E)->flags&(P))!=0)
#define ExprHasAllProperty(E,P)  (((E)->flags&(P))==(P))
#define ExprSetProperty(E,P)     (E)->flags|=(P)
#define ExprClearProperty(E,P)   (E)->flags&=~(P)
#define ExprAlwaysTrue(E)   (((E)->flags&(EP_FromJoin|EP_IsTrue))==EP_IsTrue)
#define ExprAlwaysFalse(E)  (((E)->flags&(EP_FromJoin|EP_IsFalse))==EP_IsFalse)

/* The ExprSetVVAProperty() macro is used for Verification, Validation,
** and Accreditation only.  It works like ExprSetProperty() during VVA
** processes but is a no-op for delivery.
*/
#ifdef SQLITE_DEBUG
# define ExprSetVVAProperty(E,P)  (E)->flags|=(P)
17680
17681
17682
17683
17684
17685
17686
17687

17688
17689
17690
17691
17692
17693
17694
17732
17733
17734
17735
17736
17737
17738

17739
17740
17741
17742
17743
17744
17745
17746







-
+







    ExprList *pEList;    /* Optional list of result-set columns */
    AggInfo *pAggInfo;   /* Information about aggregates at this level */
    Upsert *pUpsert;     /* ON CONFLICT clause information from an upsert */
  } uNC;
  NameContext *pNext;  /* Next outer name context.  NULL for outermost */
  int nRef;            /* Number of names resolved by this context */
  int nErr;            /* Number of errors encountered while resolving names */
  u16 ncFlags;         /* Zero or more NC_* flags defined below */
  int ncFlags;         /* Zero or more NC_* flags defined below */
  Select *pWinSelect;  /* SELECT statement for any window functions */
};

/*
** Allowed values for the NameContext, ncFlags field.
**
** Value constraints (all checked via assert()):
17707
17708
17709
17710
17711
17712
17713

17714
17715
17716
17717
17718
17719
17720
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773







+







#define NC_UEList    0x0080  /* True if uNC.pEList is used */
#define NC_UAggInfo  0x0100  /* True if uNC.pAggInfo is used */
#define NC_UUpsert   0x0200  /* True if uNC.pUpsert is used */
#define NC_MinMaxAgg 0x1000  /* min/max aggregates seen.  See note above */
#define NC_Complex   0x2000  /* True if a function or subquery seen */
#define NC_AllowWin  0x4000  /* Window functions are allowed here */
#define NC_HasWin    0x8000  /* One or more window functions seen */
#define NC_IsDDL    0x10000  /* Resolving names in a CREATE statement */

/*
** An instance of the following object describes a single ON CONFLICT
** clause in an upsert.
**
** The pUpsertTarget field is only set if the ON CONFLICT clause includes
** conflict-target clause.  (In "ON CONFLICT(a,b)" the "(a,b)" is the
18713
18714
18715
18716
18717
18718
18719



18720
18721

18722
18723
18724
18725
18726
18727
18728
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785







+
+
+


+







#if defined(SQLITE_ENABLE_MULTITHREADED_CHECKS) && !defined(SQLITE_MUTEX_OMIT)
SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex*);
#else
# define sqlite3MutexWarnOnContention(x)
#endif

#ifndef SQLITE_OMIT_FLOATING_POINT
# define EXP754 (((u64)0x7ff)<<52)
# define MAN754 ((((u64)1)<<52)-1)
# define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0)
SQLITE_PRIVATE   int sqlite3IsNaN(double);
#else
# define IsNaN(X)         0
# define sqlite3IsNaN(X)  0
#endif

/*
** An instance of the following structure holds information about SQL
** functions arguments that are the parameters to the printf() function.
*/
18773
18774
18775
18776
18777
18778
18779
18780


18781
18782
18783

18784
18785
18786
18787
18788
18789
18790
18830
18831
18832
18833
18834
18835
18836

18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
18848
18849







-
+
+



+







SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
#endif
SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);
SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*);
SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr*);
SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int);
SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*);
SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse*, Expr*);
SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int);
SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int);
SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*);
SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*);
SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList*);
19085
19086
19087
19088
19089
19090
19091

19092
19093
19094
19095
19096
19097
19098
19144
19145
19146
19147
19148
19149
19150
19151
19152
19153
19154
19155
19156
19157
19158







+







SQLITE_PRIVATE void sqlite3Detach(Parse*, Expr*);
SQLITE_PRIVATE void sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*);
SQLITE_PRIVATE int sqlite3FixSrcList(DbFixer*, SrcList*);
SQLITE_PRIVATE int sqlite3FixSelect(DbFixer*, Select*);
SQLITE_PRIVATE int sqlite3FixExpr(DbFixer*, Expr*);
SQLITE_PRIVATE int sqlite3FixExprList(DbFixer*, ExprList*);
SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
SQLITE_PRIVATE int sqlite3RealSameAsInt(double,sqlite3_int64);
SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
SQLITE_PRIVATE int sqlite3Atoi(const char*);
#ifndef SQLITE_OMIT_UTF16
SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar);
#endif
SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
19186
19187
19188
19189
19190
19191
19192



19193
19194
19195
19196
19197
19198
19199
19246
19247
19248
19249
19250
19251
19252
19253
19254
19255
19256
19257
19258
19259
19260
19261
19262







+
+
+








SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8);
SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8);
SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
                        void(*)(void*));
SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*);
SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
#ifndef SQLITE_UNTESTABLE
SQLITE_PRIVATE void sqlite3ResultIntReal(sqlite3_context*);
#endif
SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
#ifndef SQLITE_OMIT_UTF16
SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
#endif
SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
#ifndef SQLITE_AMALGAMATION
19748
19749
19750
19751
19752
19753
19754
19755

19756







19757
19758
19759
19760
19761
19762
19763
19811
19812
19813
19814
19815
19816
19817

19818
19819
19820
19821
19822
19823
19824
19825
19826
19827
19828
19829
19830
19831
19832
19833







-
+

+
+
+
+
+
+
+







# endif
#endif

/* EVIDENCE-OF: R-38720-18127 The default setting is determined by the
** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if
** that compile-time option is omitted.
*/
#ifndef SQLITE_ALLOW_COVERING_INDEX_SCAN
#if !defined(SQLITE_ALLOW_COVERING_INDEX_SCAN)
# define SQLITE_ALLOW_COVERING_INDEX_SCAN 1
#else
# if !SQLITE_ALLOW_COVERING_INDEX_SCAN 
#   error "Compile-time disabling of covering index scan using the\
 -DSQLITE_ALLOW_COVERING_INDEX_SCAN=0 option is deprecated.\
 Contact SQLite developers if this is a problem for you, and\
 delete this #error macro to continue with your build."
# endif
#endif

/* The minimum PMA size is set to this value multiplied by the database
** page size in bytes.
*/
#ifndef SQLITE_SORTER_PMASZ
# define SQLITE_SORTER_PMASZ 250
20176
20177
20178
20179
20180
20181
20182

20183
20184


20185
20186
20187
20188

20189
20190
20191
20192
20193
20194
20195
20246
20247
20248
20249
20250
20251
20252
20253


20254
20255

20256
20257

20258
20259
20260
20261
20262
20263
20264
20265







+
-
-
+
+
-


-
+







** flags may coexist with the MEM_Str flag.
*/
#define MEM_Null      0x0001   /* Value is NULL (or a pointer) */
#define MEM_Str       0x0002   /* Value is a string */
#define MEM_Int       0x0004   /* Value is an integer */
#define MEM_Real      0x0008   /* Value is a real number */
#define MEM_Blob      0x0010   /* Value is a BLOB */
#define MEM_IntReal   0x0020   /* MEM_Int that stringifies like MEM_Real */
#define MEM_AffMask   0x001f   /* Mask of affinity bits */
#define MEM_FromBind  0x0020   /* Value originates from sqlite3_bind() */
#define MEM_AffMask   0x003f   /* Mask of affinity bits */
#define MEM_FromBind  0x0040   /* Value originates from sqlite3_bind() */
/* Available          0x0040   */
#define MEM_Undefined 0x0080   /* Value is undefined */
#define MEM_Cleared   0x0100   /* NULL set by OP_Null, not from data */
#define MEM_TypeMask  0xc1df   /* Mask of type bits */
#define MEM_TypeMask  0xc1bf   /* Mask of type bits */


/* Whenever Mem contains a valid string or blob representation, one of
** the following flags must be set to determine the memory management
** policy for Mem.z.  The MEM_Term flag tells us whether or not the
** string is \000 or \u0000 terminated
*/
21301
21302
21303
21304
21305
21306
21307
21308

21309
21310
21311
21312
21313
21314
21315
21371
21372
21373
21374
21375
21376
21377

21378
21379
21380
21381
21382
21383
21384
21385







-
+







  double r;
  if( parseYyyyMmDd(zDate,p)==0 ){
    return 0;
  }else if( parseHhMmSs(zDate, p)==0 ){
    return 0;
  }else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){
    return setDateTimeToCurrent(context, p);
  }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8) ){
  }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8)>0 ){
    setRawDateNumber(p, r);
    return 0;
  }
  return 1;
}

/* The julian day number for 9999-12-31 23:59:59.999 is 5373484.4999999.
21635
21636
21637
21638
21639
21640
21641
21642

21643
21644
21645
21646
21647
21648
21649
21705
21706
21707
21708
21709
21710
21711

21712
21713
21714
21715
21716
21717
21718
21719







-
+







      **    weekday N
      **
      ** Move the date to the same time on the next occurrence of
      ** weekday N where 0==Sunday, 1==Monday, and so forth.  If the
      ** date is already on the appropriate weekday, this is a no-op.
      */
      if( sqlite3_strnicmp(z, "weekday ", 8)==0
               && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8)
               && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8)>0
               && (n=(int)r)==r && n>=0 && r<7 ){
        sqlite3_int64 Z;
        computeYMD_HMS(p);
        p->validTZ = 0;
        p->validJD = 0;
        computeJD(p);
        Z = ((p->iJD + 129600000)/86400000) % 7;
21694
21695
21696
21697
21698
21699
21700
21701

21702
21703
21704
21705
21706
21707
21708
21764
21765
21766
21767
21768
21769
21770

21771
21772
21773
21774
21775
21776
21777
21778







-
+







    case '6':
    case '7':
    case '8':
    case '9': {
      double rRounder;
      int i;
      for(n=1; z[n] && z[n]!=':' && !sqlite3Isspace(z[n]); n++){}
      if( !sqlite3AtoF(z, &r, n, SQLITE_UTF8) ){
      if( sqlite3AtoF(z, &r, n, SQLITE_UTF8)<=0 ){
        rc = 1;
        break;
      }
      if( z[n]==':' ){
        /* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the
        ** specified number of hours, minutes, seconds, and fractional seconds
        ** to the time.  The ".FFF" may be omitted.  The ":SS.FFF" may be
27327
27328
27329
27330
27331
27332
27333






27334
27335
27336
27337
27338
27339
27340
27397
27398
27399
27400
27401
27402
27403
27404
27405
27406
27407
27408
27409
27410
27411
27412
27413
27414
27415
27416







+
+
+
+
+
+








  /* All the rest are undocumented and are for internal use only */
  {  'T',  0, 0, etTOKEN,      0,  0 },
  {  'S',  0, 0, etSRCLIST,    0,  0 },
  {  'r', 10, 1, etORDINAL,    0,  0 },
};

/* Floating point constants used for rounding */
static const double arRound[] = {
  5.0e-01, 5.0e-02, 5.0e-03, 5.0e-04, 5.0e-05,
  5.0e-06, 5.0e-07, 5.0e-08, 5.0e-09, 5.0e-10,
};

/*
** If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point
** conversions will work.
*/
#ifndef SQLITE_OMIT_FLOATING_POINT
/*
** "*val" is a double such that 0.1 <= *val < 10.0
27745
27746
27747
27748
27749
27750
27751
27752
27753












27754
27755
27756
27757
27758
27759
27760
27821
27822
27823
27824
27825
27826
27827


27828
27829
27830
27831
27832
27833
27834
27835
27836
27837
27838
27839
27840
27841
27842
27843
27844
27845
27846







-
-
+
+
+
+
+
+
+
+
+
+
+
+







          realvalue = -realvalue;
          prefix = '-';
        }else{
          prefix = flag_prefix;
        }
        if( xtype==etGENERIC && precision>0 ) precision--;
        testcase( precision>0xfff );
        for(idx=precision&0xfff, rounder=0.5; idx>0; idx--, rounder*=0.1){}
        if( xtype==etFLOAT ) realvalue += rounder;
        idx = precision & 0xfff;
        rounder = arRound[idx%10];
        while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
        if( xtype==etFLOAT ){
          double rx = (double)realvalue;
          sqlite3_uint64 u;
          int ex;
          memcpy(&u, &rx, sizeof(u));
          ex = -1023 + (int)((u>>52)&0x7ff);
          if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
          realvalue += rounder;
        }
        /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
        exp = 0;
        if( sqlite3IsNaN((double)realvalue) ){
          bufpt = "NaN";
          length = 3;
          break;
        }
29026
29027
29028
29029
29030
29031
29032
29033

29034
29035
29036
29037
29038
29039
29040
29112
29113
29114
29115
29116
29117
29118

29119
29120
29121
29122
29123
29124
29125
29126







-
+







    case TK_TRUTH: {
      int x;
      const char *azOp[] = {
         "IS-FALSE", "IS-TRUE", "IS-NOT-FALSE", "IS-NOT-TRUE"
      };
      assert( pExpr->op2==TK_IS || pExpr->op2==TK_ISNOT );
      assert( pExpr->pRight );
      assert( pExpr->pRight->op==TK_TRUEFALSE );
      assert( sqlite3ExprSkipCollate(pExpr->pRight)->op==TK_TRUEFALSE );
      x = (pExpr->op2==TK_ISNOT)*2 + sqlite3ExprTruthValue(pExpr->pRight);
      zUniOp = azOp[x];
      break;
    }

    case TK_SPAN: {
      sqlite3TreeViewLine(pView, "SPAN %Q", pExpr->u.zToken);
30208
30209
30210
30211
30212
30213
30214
30215
30216

30217
30218
30219
30220
30221
30222
30223
30224
30294
30295
30296
30297
30298
30299
30300


30301

30302
30303
30304
30305
30306
30307
30308







-
-
+
-







**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
*/
/* #include "sqliteInt.h" */
/* #include <stdarg.h> */
#if HAVE_ISNAN || SQLITE_HAVE_ISNAN
# include <math.h>
#include <math.h>
#endif

/*
** Routine needed to support the testcase() macro.
*/
#ifdef SQLITE_COVERAGE_TEST
SQLITE_PRIVATE void sqlite3Coverage(int x){
  static unsigned dummy = 0;
30251
30252
30253
30254
30255
30256
30257
30258
30259
30260
30261
30262
30263
30264
30265
30266
30267
30268
30269
30270
30271
30272
30273
30274
30275
30276
30277
30278
30279
30280
30281
30282
30283
30284
30285
30286
30287
30288
30289
30290
30291
30292
30293


30294
30295
30296
30297
30298

30299
30300
30301
30302
30303
30304
30305
30335
30336
30337
30338
30339
30340
30341



30342
30343































30344
30345





30346
30347
30348
30349
30350
30351
30352
30353







-
-
-


-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
+







  return xCallback ? xCallback(iTest) : SQLITE_OK;
}
#endif

#ifndef SQLITE_OMIT_FLOATING_POINT
/*
** Return true if the floating point value is Not a Number (NaN).
**
** Use the math library isnan() function if compiled with SQLITE_HAVE_ISNAN.
** Otherwise, we have our own implementation that works on most systems.
*/
SQLITE_PRIVATE int sqlite3IsNaN(double x){
  int rc;   /* The value return */
#if !SQLITE_HAVE_ISNAN && !HAVE_ISNAN
  /*
  ** Systems that support the isnan() library function should probably
  ** make use of it by compiling with -DSQLITE_HAVE_ISNAN.  But we have
  ** found that many systems do not have a working isnan() function so
  ** this implementation is provided as an alternative.
  **
  ** This NaN test sometimes fails if compiled on GCC with -ffast-math.
  ** On the other hand, the use of -ffast-math comes with the following
  ** warning:
  **
  **      This option [-ffast-math] should never be turned on by any
  **      -O option since it can result in incorrect output for programs
  **      which depend on an exact implementation of IEEE or ISO 
  **      rules/specifications for math functions.
  **
  ** Under MSVC, this NaN test may fail if compiled with a floating-
  ** point precision mode other than /fp:precise.  From the MSDN 
  ** documentation:
  **
  **      The compiler [with /fp:precise] will properly handle comparisons 
  **      involving NaN. For example, x != x evaluates to true if x is NaN 
  **      ...
  */
#ifdef __FAST_MATH__
# error SQLite will not work correctly with the -ffast-math option of GCC.
#endif
  volatile double y = x;
  volatile double z = y;
  rc = (y!=z);
  u64 y;
  memcpy(&y,&x,sizeof(y));
#else  /* if HAVE_ISNAN */
  rc = isnan(x);
#endif /* HAVE_ISNAN */
  testcase( rc );
  return rc;
  return IsNaN(y);
}
#endif /* SQLITE_OMIT_FLOATING_POINT */

/*
** Compute a string length that is limited to what can be stored in
** lower 30 bits of a 32-bit signed integer.
**
30513
30514
30515
30516
30517
30518
30519
30520

30521
30522
30523





30524
30525



30526
30527
30528
30529
30530
30531
30532
30561
30562
30563
30564
30565
30566
30567

30568
30569
30570
30571
30572
30573
30574
30575
30576


30577
30578
30579
30580
30581
30582
30583
30584
30585
30586







-
+



+
+
+
+
+
-
-
+
+
+







  }else if( zRight==0 ){
    return 1;
  }
  return sqlite3StrICmp(zLeft, zRight);
}
SQLITE_PRIVATE int sqlite3StrICmp(const char *zLeft, const char *zRight){
  unsigned char *a, *b;
  int c;
  int c, x;
  a = (unsigned char *)zLeft;
  b = (unsigned char *)zRight;
  for(;;){
    c = *a;
    x = *b;
    if( c==x ){
      if( c==0 ) break;
    }else{
    c = (int)UpperToLower[*a] - (int)UpperToLower[*b];
    if( c || *a==0 ) break;
      c = (int)UpperToLower[c] - (int)UpperToLower[x];
      if( c ) break;
    }
    a++;
    b++;
  }
  return c;
}
SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){
  register unsigned char *a, *b;
30546
30547
30548
30549
30550
30551
30552
30553
30554
30555
30556
30557
30558
30559
30560
30561









30562
30563
30564
30565
30566
30567
30568
30600
30601
30602
30603
30604
30605
30606









30607
30608
30609
30610
30611
30612
30613
30614
30615
30616
30617
30618
30619
30620
30621
30622







-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+







** E==2 results in 100.  E==50 results in 1.0e50.
**
** This routine only works for values of E between 1 and 341.
*/
static LONGDOUBLE_TYPE sqlite3Pow10(int E){
#if defined(_MSC_VER)
  static const LONGDOUBLE_TYPE x[] = {
    1.0e+001,
    1.0e+002,
    1.0e+004,
    1.0e+008,
    1.0e+016,
    1.0e+032,
    1.0e+064,
    1.0e+128,
    1.0e+256
    1.0e+001L,
    1.0e+002L,
    1.0e+004L,
    1.0e+008L,
    1.0e+016L,
    1.0e+032L,
    1.0e+064L,
    1.0e+128L,
    1.0e+256L
  };
  LONGDOUBLE_TYPE r = 1.0;
  int i;
  assert( E>=0 && E<=307 );
  for(i=0; E!=0; i++, E >>=1){
    if( E & 1 ) r *= x[i];
  }
30584
30585
30586
30587
30588
30589
30590
30591
30592









30593
30594
30595
30596
30597
30598
30599
30638
30639
30640
30641
30642
30643
30644


30645
30646
30647
30648
30649
30650
30651
30652
30653
30654
30655
30656
30657
30658
30659
30660







-
-
+
+
+
+
+
+
+
+
+







** The string z[] is an text representation of a real number.
** Convert this string to a double and write it into *pResult.
**
** The string z[] is length bytes in length (bytes, not characters) and
** uses the encoding enc.  The string is not necessarily zero-terminated.
**
** Return TRUE if the result is a valid real number (or integer) and FALSE
** if the string is empty or contains extraneous text.  Valid numbers
** are in one of these formats:
** if the string is empty or contains extraneous text.  More specifically
** return
**      1          =>  The input string is a pure integer
**      2 or more  =>  The input has a decimal point or eNNN clause
**      0 or less  =>  The input string is not a valid number
**     -1          =>  Not a valid number, but has a valid prefix which 
**                     includes a decimal point and/or an eNNN clause
**
** Valid numbers are in one of these formats:
**
**    [+-]digits[E[+-]digits]
**    [+-]digits.[digits][E[+-]digits]
**    [+-].digits[E[+-]digits]
**
** Leading and trailing whitespace is ignored for the purpose of determining
** validity.
30610
30611
30612
30613
30614
30615
30616
30617
30618


30619
30620
30621
30622
30623
30624
30625
30626
30627
30628


30629
30630

30631
30632
30633
30634
30635
30636
30637
30638
30639
30640
30641
30642
30643
30644
30645
30646
30647
30648

30649
30650

30651
30652
30653
30654
30655






30656
30657
30658
30659
30660

30661
30662
30663
30664
30665
30666

30667
30668

30669
30670
30671
30672
30673
30674
30675
30676

30677
30678
30679
30680
30681
30682
30683
30671
30672
30673
30674
30675
30676
30677


30678
30679
30680
30681
30682
30683
30684
30685
30686
30687
30688
30689
30690
30691
30692

30693
30694
30695
30696
30697
30698
30699
30700
30701
30702
30703
30704
30705
30706
30707
30708
30709
30710

30711
30712

30713





30714
30715
30716
30717
30718
30719
30720
30721
30722
30723
30724
30725
30726
30727
30728
30729
30730
30731
30732
30733

30734
30735
30736
30737
30738
30739
30740
30741
30742
30743
30744
30745
30746
30747
30748
30749
30750







-
-
+
+










+
+

-
+

















-
+

-
+
-
-
-
-
-
+
+
+
+
+
+





+






+

-
+








+







  int sign = 1;    /* sign of significand */
  i64 s = 0;       /* significand */
  int d = 0;       /* adjust exponent for shifting decimal point */
  int esign = 1;   /* sign of exponent */
  int e = 0;       /* exponent */
  int eValid = 1;  /* True exponent is either not used or is well-formed */
  double result;
  int nDigits = 0;
  int nonNum = 0;  /* True if input contains UTF16 with high byte non-zero */
  int nDigit = 0;  /* Number of digits processed */
  int eType = 1;   /* 1: pure integer,  2+: fractional  -1 or less: bad UTF16 */

  assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
  *pResult = 0.0;   /* Default return value, in case of an error */

  if( enc==SQLITE_UTF8 ){
    incr = 1;
  }else{
    int i;
    incr = 2;
    assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
    testcase( enc==SQLITE_UTF16LE );
    testcase( enc==SQLITE_UTF16BE );
    for(i=3-enc; i<length && z[i]==0; i+=2){}
    nonNum = i<length;
    if( i<length ) eType = -100;
    zEnd = &z[i^1];
    z += (enc&1);
  }

  /* skip leading spaces */
  while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;
  if( z>=zEnd ) return 0;

  /* get sign of significand */
  if( *z=='-' ){
    sign = -1;
    z+=incr;
  }else if( *z=='+' ){
    z+=incr;
  }

  /* copy max significant digits to significand */
  while( z<zEnd && sqlite3Isdigit(*z) && s<((LARGEST_INT64-9)/10) ){
  while( z<zEnd && sqlite3Isdigit(*z) ){
    s = s*10 + (*z - '0');
    z+=incr; nDigits++;
    z+=incr; nDigit++;
  }

  /* skip non-significant significand digits
  ** (increase exponent by d to shift decimal left) */
  while( z<zEnd && sqlite3Isdigit(*z) ){ z+=incr; nDigits++; d++; }
    if( s>=((LARGEST_INT64-9)/10) ){
      /* skip non-significant significand digits
      ** (increase exponent by d to shift decimal left) */
      while( z<zEnd && sqlite3Isdigit(*z) ){ z+=incr; d++; }
    }
  }
  if( z>=zEnd ) goto do_atof_calc;

  /* if decimal point is present */
  if( *z=='.' ){
    z+=incr;
    eType++;
    /* copy digits from after decimal to significand
    ** (decrease exponent by d to shift decimal right) */
    while( z<zEnd && sqlite3Isdigit(*z) ){
      if( s<((LARGEST_INT64-9)/10) ){
        s = s*10 + (*z - '0');
        d--;
        nDigit++;
      }
      z+=incr; nDigits++;
      z+=incr;
    }
  }
  if( z>=zEnd ) goto do_atof_calc;

  /* if exponent is present */
  if( *z=='e' || *z=='E' ){
    z+=incr;
    eValid = 0;
    eType++;

    /* This branch is needed to avoid a (harmless) buffer overread.  The 
    ** special comment alerts the mutation tester that the correct answer
    ** is obtained even if the branch is omitted */
    if( z>=zEnd ) goto do_atof_calc;              /*PREVENTS-HARMLESS-OVERREAD*/

    /* get sign of exponent */
30768
30769
30770
30771
30772
30773
30774
30775







30776
30777
30778
30779
30780
30781
30782
30835
30836
30837
30838
30839
30840
30841

30842
30843
30844
30845
30846
30847
30848
30849
30850
30851
30852
30853
30854
30855







-
+
+
+
+
+
+
+







    }
  }

  /* store the result */
  *pResult = result;

  /* return true if number and no extra non-whitespace chracters after */
  return z==zEnd && nDigits>0 && eValid && nonNum==0;
  if( z==zEnd && nDigit>0 && eValid && eType>0 ){
    return eType;
  }else if( eType>=2 && (eType==3 || eValid) && nDigit>0 ){
    return -1;
  }else{
    return 0;
  }
#else
  return !sqlite3Atoi64(z, pResult, length, enc);
#endif /* SQLITE_OMIT_FLOATING_POINT */
}

/*
** Compare the 19-character string zNum against the text representation
30811
30812
30813
30814
30815
30816
30817

30818
30819
30820
30821
30822
30823
30824
30884
30885
30886
30887
30888
30889
30890
30891
30892
30893
30894
30895
30896
30897
30898







+








/*
** Convert zNum to a 64-bit signed integer.  zNum must be decimal. This
** routine does *not* accept hexadecimal notation.
**
** Returns:
**
**    -1    Not even a prefix of the input text looks like an integer
**     0    Successful transformation.  Fits in a 64-bit signed integer.
**     1    Excess non-space text after the integer value
**     2    Integer too large for a 64-bit signed integer or is malformed
**     3    Special case of 9223372036854775808
**
** length is the number of bytes in the string (bytes, not characters).
** The string is not necessarily zero-terminated.  The encoding is
30870
30871
30872
30873
30874
30875
30876
30877
30878



30879
30880
30881
30882
30883
30884
30885
30886
30944
30945
30946
30947
30948
30949
30950


30951
30952
30953

30954
30955
30956
30957
30958
30959
30960







-
-
+
+
+
-







    *pNum = neg ? SMALLEST_INT64 : LARGEST_INT64;
  }else if( neg ){
    *pNum = -(i64)u;
  }else{
    *pNum = (i64)u;
  }
  rc = 0;
  if( (i==0 && zStart==zNum)     /* No digits */
   || nonNum                     /* UTF16 with high-order bytes non-zero */
  if( i==0 && zStart==zNum ){    /* No digits */
    rc = -1;
  }else if( nonNum ){            /* UTF16 with high-order bytes non-zero */
  ){
    rc = 1;
  }else if( &zNum[i]<zEnd ){     /* Extra bytes at the end */
    int jj = i;
    do{
      if( !sqlite3Isspace(zNum[jj]) ){
        rc = 1;          /* Extra non-space text after the integer */
        break;
31103
31104
31105
31106
31107
31108
31109

31110

31111
31112
31113
31114
31115
31116
31117

31118
31119
31120
31121
31122
31123
31124
31125
31126

31127
31128
31129
31130
31131
31132
31133
31134
31135



31136
31137
31138
31139
31140
31141
31142
31177
31178
31179
31180
31181
31182
31183
31184

31185




31186
31187

31188









31189
31190
31191
31192
31193
31194
31195
31196


31197
31198
31199
31200
31201
31202
31203
31204
31205
31206







+
-
+
-
-
-
-


-
+
-
-
-
-
-
-
-
-
-
+







-
-
+
+
+







/*
** Read a 64-bit variable-length integer from memory starting at p[0].
** Return the number of bytes read.  The value is stored in *v.
*/
SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
  u32 a,b,s;

  if( ((signed char*)p)[0]>=0 ){
  a = *p;
    *v = *p;
  /* a: p0 (unmasked) */
  if (!(a&0x80))
  {
    *v = a;
    return 1;
  }

  if( ((signed char*)p)[1]>=0 ){
  p++;
  b = *p;
  /* b: p1 (unmasked) */
  if (!(b&0x80))
  {
    a &= 0x7f;
    a = a<<7;
    a |= b;
    *v = a;
    *v = ((u32)(p[0]&0x7f)<<7) | p[1];
    return 2;
  }

  /* Verify that constants are precomputed correctly */
  assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );
  assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) );

  p++;
  a = a<<14;
  a = ((u32)p[0])<<14;
  b = p[1];
  p += 2;
  a |= *p;
  /* a: p0<<14 | p2 (unmasked) */
  if (!(a&0x80))
  {
    a &= SLOT_2_0;
    b &= 0x7f;
    b = b<<7;
47998
47999
48000
48001
48002
48003
48004
48005
48006
48007




48008
48009
48010
48011
48012
48013
48014
48062
48063
48064
48065
48066
48067
48068



48069
48070
48071
48072
48073
48074
48075
48076
48077
48078
48079







-
-
-
+
+
+
+







*/
static int numberOfCachePages(PCache *p){
  if( p->szCache>=0 ){
    /* IMPLEMENTATION-OF: R-42059-47211 If the argument N is positive then the
    ** suggested cache size is set to N. */
    return p->szCache;
  }else{
    /* IMPLEMENTATION-OF: R-61436-13639 If the argument N is negative, then
    ** the number of cache pages is adjusted to use approximately abs(N*1024)
    ** bytes of memory. */
    /* IMPLEMANTATION-OF: R-59858-46238 If the argument N is negative, then the
    ** number of cache pages is adjusted to be a number of pages that would
    ** use approximately abs(N*1024) bytes of memory based on the current
    ** page size. */
    return (int)((-1024*(i64)p->szCache)/(p->szPage+p->szExtra));
  }
}

/*************************************************** General Interfaces ******
**
** Initialize and shutdown the page cache subsystem. Neither of these 
49416
49417
49418
49419
49420
49421
49422

49423
49424
49425
49426
49427
49428
49429
49430
49431
49432
49433
49434
49435
49436
49437
49438
49439
49481
49482
49483
49484
49485
49486
49487
49488
49489
49490
49491
49492
49493
49494
49495
49496
49497

49498
49499
49500
49501
49502
49503
49504







+









-







  if( pCache ){
    if( pcache1.separateCache ){
      pGroup = (PGroup*)&pCache[1];
      pGroup->mxPinned = 10;
    }else{
      pGroup = &pcache1.grp;
    }
    pcache1EnterMutex(pGroup);
    if( pGroup->lru.isAnchor==0 ){
      pGroup->lru.isAnchor = 1;
      pGroup->lru.pLruPrev = pGroup->lru.pLruNext = &pGroup->lru;
    }
    pCache->pGroup = pGroup;
    pCache->szPage = szPage;
    pCache->szExtra = szExtra;
    pCache->szAlloc = szPage + szExtra + ROUND8(sizeof(PgHdr1));
    pCache->bPurgeable = (bPurgeable ? 1 : 0);
    pcache1EnterMutex(pGroup);
    pcache1ResizeHash(pCache);
    if( bPurgeable ){
      pCache->nMin = 10;
      pGroup->nMinPage += pCache->nMin;
      pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;
      pCache->pnPurgeable = &pGroup->nPurgeable;
    }else{
61218
61219
61220
61221
61222
61223
61224
61225
61226



61227
61228
61229
61230
61231
61232
61233
61234
61283
61284
61285
61286
61287
61288
61289


61290
61291
61292

61293
61294
61295
61296
61297
61298
61299







-
-
+
+
+
-








    rc = walHashGet(pWal, iHash, &sLoc);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    nCollide = HASHTABLE_NSLOT;
    for(iKey=walHash(pgno); sLoc.aHash[iKey]; iKey=walNextHash(iKey)){
      u32 iFrame = sLoc.aHash[iKey] + sLoc.iZero;
      if( iFrame<=iLast && iFrame>=pWal->minFrame
      u32 iH = sLoc.aHash[iKey];
      u32 iFrame = iH + sLoc.iZero;
      if( iFrame<=iLast && iFrame>=pWal->minFrame && sLoc.aPgno[iH]==pgno ){
       && sLoc.aPgno[sLoc.aHash[iKey]]==pgno ){
        assert( iFrame>iRead || CORRUPT_DB );
        iRead = iFrame;
      }
      if( (nCollide--)==0 ){
        return SQLITE_CORRUPT_BKPT;
      }
    }
64812
64813
64814
64815
64816
64817
64818
64819

64820
64821
64822
64823
64824
64825
64826
64877
64878
64879
64880
64881
64882
64883

64884
64885
64886
64887
64888
64889
64890
64891







-
+







  assert( gap<=65536 );
  /* EVIDENCE-OF: R-29356-02391 If the database uses a 65536-byte page size
  ** and the reserved space is zero (the usual value for reserved space)
  ** then the cell content offset of an empty page wants to be 65536.
  ** However, that integer is too large to be stored in a 2-byte unsigned
  ** integer, so a value of 0 is used in its place. */
  top = get2byte(&data[hdr+5]);
  assert( top<=(int)pPage->pBt->usableSize ); /* Prevent by getAndInitPage() */
  assert( top<=(int)pPage->pBt->usableSize ); /* by btreeComputeFreeSpace() */
  if( gap>top ){
    if( top==0 && pPage->pBt->usableSize==65536 ){
      top = 65536;
    }else{
      return SQLITE_CORRUPT_PAGE(pPage);
    }
  }
65109
65110
65111
65112
65113
65114
65115
65116

65117
65118
65119
65120
65121
65122
65123
65174
65175
65176
65177
65178
65179
65180

65181
65182
65183
65184
65185
65186
65187
65188







-
+







  /* At this point, nFree contains the sum of the offset to the start
  ** of the cell-content area plus the number of free bytes within
  ** the cell-content area. If this is greater than the usable-size
  ** of the page, then the page must be corrupted. This check also
  ** serves to verify that the offset to the start of the cell-content
  ** area, according to the page header, lies within the page.
  */
  if( nFree>usableSize ){
  if( nFree>usableSize || nFree<iCellFirst ){
    return SQLITE_CORRUPT_PAGE(pPage);
  }
  pPage->nFree = (u16)(nFree - iCellFirst);
  return SQLITE_OK;
}

/*
67336
67337
67338
67339
67340
67341
67342












67343
67344
67345
67346
67347
67348
67349
67401
67402
67403
67404
67405
67406
67407
67408
67409
67410
67411
67412
67413
67414
67415
67416
67417
67418
67419
67420
67421
67422
67423
67424
67425
67426







+
+
+
+
+
+
+
+
+
+
+
+







      }
      btreeReleaseAllCursorPages(p);
    }
    sqlite3BtreeLeave(pBtree);
  }
  return rc;
}

/*
** Set the pBt->nPage field correctly, according to the current
** state of the database.  Assume pBt->pPage1 is valid.
*/
static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){
  int nPage = get4byte(&pPage1->aData[28]);
  testcase( nPage==0 );
  if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);
  testcase( pBt->nPage!=nPage );
  pBt->nPage = nPage;
}

/*
** Rollback the transaction in progress.
**
** If tripCode is not SQLITE_OK then cursors will be invalidated (tripped).
** Only write cursors are tripped if writeOnly is true but all cursors are
** tripped if writeOnly is false.  Any attempt to use
67382
67383
67384
67385
67386
67387
67388
67389
67390
67391
67392
67393

67394
67395
67396
67397
67398
67399
67400
67459
67460
67461
67462
67463
67464
67465





67466
67467
67468
67469
67470
67471
67472
67473







-
-
-
-
-
+







      rc = rc2;
    }

    /* The rollback may have destroyed the pPage1->aData value.  So
    ** call btreeGetPage() on page 1 again to make
    ** sure pPage1->aData is set correctly. */
    if( btreeGetPage(pBt, 1, &pPage1, 0)==SQLITE_OK ){
      int nPage = get4byte(28+(u8*)pPage1->aData);
      testcase( nPage==0 );
      if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);
      testcase( pBt->nPage!=nPage );
      pBt->nPage = nPage;
      btreeSetNPage(pBt, pPage1);
      releasePageOne(pPage1);
    }
    assert( countValidCursors(pBt, 1)==0 );
    pBt->inTransaction = TRANS_READ;
    btreeClearHasContent(pBt);
  }

67466
67467
67468
67469
67470
67471
67472
67473

67474
67475
67476


67477
67478

67479
67480
67481
67482
67483
67484
67485
67539
67540
67541
67542
67543
67544
67545

67546
67547


67548
67549


67550
67551
67552
67553
67554
67555
67556
67557







-
+

-
-
+
+
-
-
+







      rc = sqlite3PagerSavepoint(pBt->pPager, op, iSavepoint);
    }
    if( rc==SQLITE_OK ){
      if( iSavepoint<0 && (pBt->btsFlags & BTS_INITIALLY_EMPTY)!=0 ){
        pBt->nPage = 0;
      }
      rc = newDatabase(pBt);
      pBt->nPage = get4byte(28 + pBt->pPage1->aData);
      btreeSetNPage(pBt, pBt->pPage1);

      /* The database size was written into the offset 28 of the header
      ** when the transaction started, so we know that the value at offset
      /* pBt->nPage might be zero if the database was corrupt when 
      ** the transaction was started. Otherwise, it must be at least 1.  */
      ** 28 is nonzero. */
      assert( pBt->nPage>0 );
      assert( CORRUPT_DB || pBt->nPage>0 );
    }
    sqlite3BtreeLeave(p);
  }
  return rc;
}

/*
68479
68480
68481
68482
68483
68484
68485

68486
68487
68488
68489
68490
68491
68492
68551
68552
68553
68554
68555
68556
68557
68558
68559
68560
68561
68562
68563
68564
68565







+







    int ii;
    for(ii=0; ii<pCur->iPage; ii++){
      assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell );
    }
    assert( pCur->ix==pCur->pPage->nCell-1 );
    assert( pCur->pPage->leaf );
#endif
    *pRes = 0;
    return SQLITE_OK;
  }

  rc = moveToRoot(pCur);
  if( rc==SQLITE_OK ){
    assert( pCur->eState==CURSOR_VALID );
    *pRes = 0;
68700
68701
68702
68703
68704
68705
68706

68707
68708
68709
68710
68711
68712
68713
68714
68715
68716
68717

68718
68719
68720
68721
68722
68723

68724
68725
68726
68727
68728
68729
68730
68773
68774
68775
68776
68777
68778
68779
68780
68781
68782
68783
68784
68785
68786
68787
68788
68789
68790

68791
68792
68793
68794
68795
68796
68797
68798
68799
68800
68801
68802
68803
68804
68805







+










-
+






+







          **
          ** If the record is corrupt, the xRecordCompare routine may read
          ** up to two varints past the end of the buffer. An extra 18 
          ** bytes of padding is allocated at the end of the buffer in
          ** case this happens.  */
          void *pCellKey;
          u8 * const pCellBody = pCell - pPage->childPtrSize;
          const int nOverrun = 18;  /* Size of the overrun padding */
          pPage->xParseCell(pPage, pCellBody, &pCur->info);
          nCell = (int)pCur->info.nKey;
          testcase( nCell<0 );   /* True if key size is 2^32 or more */
          testcase( nCell==0 );  /* Invalid key size:  0x80 0x80 0x00 */
          testcase( nCell==1 );  /* Invalid key size:  0x80 0x80 0x01 */
          testcase( nCell==2 );  /* Minimum legal index key size */
          if( nCell<2 || nCell/pCur->pBt->usableSize>pCur->pBt->nPage ){
            rc = SQLITE_CORRUPT_PAGE(pPage);
            goto moveto_finish;
          }
          pCellKey = sqlite3Malloc( nCell+18 );
          pCellKey = sqlite3Malloc( nCell+nOverrun );
          if( pCellKey==0 ){
            rc = SQLITE_NOMEM_BKPT;
            goto moveto_finish;
          }
          pCur->ix = (u16)idx;
          rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 0);
          memset(((u8*)pCellKey)+nCell,0,nOverrun); /* Fix uninit warnings */
          pCur->curFlags &= ~BTCF_ValidOvfl;
          if( rc ){
            sqlite3_free(pCellKey);
            goto moveto_finish;
          }
          c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey);
          sqlite3_free(pCellKey);
70821
70822
70823
70824
70825
70826
70827

70828
70829
70830
70831
70832
70833
70834
70896
70897
70898
70899
70900
70901
70902
70903
70904
70905
70906
70907
70908
70909
70910







+







  for(i=0; i<nOld; i++){
    MemPage *pOld = apOld[i];
    int limit = pOld->nCell;
    u8 *aData = pOld->aData;
    u16 maskPage = pOld->maskPage;
    u8 *piCell = aData + pOld->cellOffset;
    u8 *piEnd;
    VVA_ONLY( int nCellAtStart = b.nCell; )

    /* Verify that all sibling pages are of the same "type" (table-leaf,
    ** table-interior, index-leaf, or index-interior).
    */
    if( pOld->aData[0]!=apOld[0]->aData[0] ){
      rc = SQLITE_CORRUPT_BKPT;
      goto balance_cleanup;
70849
70850
70851
70852
70853
70854
70855




70856
70857
70858
70859
70860
70861
70862
70863
70864
70865
70866
70867
70868
70869
70870
70871
70872
70873
70874

70875
70876
70877
70878
70879
70880
70881
70925
70926
70927
70928
70929
70930
70931
70932
70933
70934
70935
70936
70937
70938
70939
70940
70941
70942
70943
70944
70945
70946
70947
70948
70949
70950
70951
70952
70953
70954
70955
70956
70957
70958
70959
70960
70961
70962







+
+
+
+



















+







    ** This must be done in advance.  Once the balance starts, the cell
    ** offset section of the btree page will be overwritten and we will no
    ** long be able to find the cells if a pointer to each cell is not saved
    ** first.
    */
    memset(&b.szCell[b.nCell], 0, sizeof(b.szCell[0])*(limit+pOld->nOverflow));
    if( pOld->nOverflow>0 ){
      if( limit<pOld->aiOvfl[0] ){
        rc = SQLITE_CORRUPT_BKPT;
        goto balance_cleanup;
      }
      limit = pOld->aiOvfl[0];
      for(j=0; j<limit; j++){
        b.apCell[b.nCell] = aData + (maskPage & get2byteAligned(piCell));
        piCell += 2;
        b.nCell++;
      }
      for(k=0; k<pOld->nOverflow; k++){
        assert( k==0 || pOld->aiOvfl[k-1]+1==pOld->aiOvfl[k] );/* NOTE 1 */
        b.apCell[b.nCell] = pOld->apOvfl[k];
        b.nCell++;
      }
    }
    piEnd = aData + pOld->cellOffset + 2*pOld->nCell;
    while( piCell<piEnd ){
      assert( b.nCell<nMaxCells );
      b.apCell[b.nCell] = aData + (maskPage & get2byteAligned(piCell));
      piCell += 2;
      b.nCell++;
    }
    assert( (b.nCell-nCellAtStart)==(pOld->nCell+pOld->nOverflow) );

    cntOld[i] = b.nCell;
    if( i<nOld-1 && !leafData){
      u16 sz = (u16)szNew[i];
      u8 *pTemp;
      assert( b.nCell<nMaxCells );
      b.szCell[b.nCell] = sz;
71168
71169
71170
71171
71172
71173
71174

71175
71176
71177
71178
71179
71180
71181
71249
71250
71251
71252
71253
71254
71255
71256
71257
71258
71259
71260
71261
71262
71263







+







    int iOld = 0;

    for(i=0; i<b.nCell; i++){
      u8 *pCell = b.apCell[i];
      while( i==cntOldNext ){
        iOld++;
        assert( iOld<nNew || iOld<nOld );
        assert( iOld>=0 && iOld<NB );
        pOld = iOld<nNew ? apNew[iOld] : apOld[iOld];
        cntOldNext += pOld->nCell + pOld->nOverflow + !leafData;
      }
      if( i==cntNew[iNew] ){
        pNew = apNew[++iNew];
        if( !leafData ) continue;
      }
73888
73889
73890
73891
73892
73893
73894
73895

73896
73897
73898
73899
73900
73901
73902
73970
73971
73972
73973
73974
73975
73976

73977
73978
73979
73980
73981
73982
73983
73984







-
+







  ** between source and destination.  If there is a difference, try to
  ** fix the destination to agree with the source.  If that is not possible,
  ** then the backup cannot proceed.
  */
  if( nSrcReserve!=nDestReserve ){
    u32 newPgsz = nSrcPgsz;
    rc = sqlite3PagerSetPagesize(pDestPager, &newPgsz, nSrcReserve);
    if( rc==SQLITE_OK && newPgsz!=nSrcPgsz ) rc = SQLITE_READONLY;
    if( rc==SQLITE_OK && newPgsz!=(u32)nSrcPgsz ) rc = SQLITE_READONLY;
  }
#endif

  /* This loop runs once for each destination page spanned by the source 
  ** page. For each iteration, variable iOff is set to the byte offset
  ** of the destination page.
  */
74435
74436
74437
74438
74439
74440
74441





74442
74443
74444
74445
74446
74447
74448
74449
74450
74451
74452
74453
74454
74455
74456
74457
74458
74459
74460
74461
74462


74463
74464
74465
74466
74467
74468
74469
74517
74518
74519
74520
74521
74522
74523
74524
74525
74526
74527
74528
74529
74530
74531
74532
74533
74534
74535
74536
74537
74538
74539
74540
74541
74542
74543
74544
74545
74546
74547


74548
74549
74550
74551
74552
74553
74554
74555
74556







+
+
+
+
+



















-
-
+
+







** stores a single value in the VDBE.  Mem is an opaque structure visible
** only within the VDBE.  Interface routines refer to a Mem using the
** name sqlite_value
*/
/* #include "sqliteInt.h" */
/* #include "vdbeInt.h" */

/* True if X is a power of two.  0 is considered a power of two here.
** In other words, return true if X has at most one bit set.
*/
#define ISPOWEROF2(X)  (((X)&((X)-1))==0)

#ifdef SQLITE_DEBUG
/*
** Check invariants on a Mem object.
**
** This routine is intended for use inside of assert() statements, like
** this:    assert( sqlite3VdbeCheckMemInvariants(pMem) );
*/
SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem *p){
  /* If MEM_Dyn is set then Mem.xDel!=0.  
  ** Mem.xDel might not be initialized if MEM_Dyn is clear.
  */
  assert( (p->flags & MEM_Dyn)==0 || p->xDel!=0 );

  /* MEM_Dyn may only be set if Mem.szMalloc==0.  In this way we
  ** ensure that if Mem.szMalloc>0 then it is safe to do
  ** Mem.z = Mem.zMalloc without having to check Mem.flags&MEM_Dyn.
  ** That saves a few cycles in inner loops. */
  assert( (p->flags & MEM_Dyn)==0 || p->szMalloc==0 );

  /* Cannot be both MEM_Int and MEM_Real at the same time */
  assert( (p->flags & (MEM_Int|MEM_Real))!=(MEM_Int|MEM_Real) );
  /* Cannot have more than one of MEM_Int, MEM_Real, or MEM_IntReal */
  assert( ISPOWEROF2(p->flags & (MEM_Int|MEM_Real|MEM_IntReal)) );

  if( p->flags & MEM_Null ){
    /* Cannot be both MEM_Null and some other type */
    assert( (p->flags & (MEM_Int|MEM_Real|MEM_Str|MEM_Blob|MEM_Agg))==0 );

    /* If MEM_Null is set, then either the value is a pure NULL (the usual
    ** case) or it is a pointer set using sqlite3_bind_pointer() or
74508
74509
74510
74511
74512
74513
74514
74515



















74516
74517


74518


74519
74520
74521
74522
74523
74524
74525
74526
74527
74528
74529
74530
74531
74532
74533
74534
74535
74536

74537
74538
74539
74540
74541
74542
74543
74544








74545


74546


74547
74548
74549
74550
74551
74552
74553
74595
74596
74597
74598
74599
74600
74601
74602
74603
74604
74605
74606
74607
74608
74609
74610
74611
74612
74613
74614
74615
74616
74617
74618
74619
74620
74621
74622
74623
74624
74625

74626
74627
74628
74629
74630
74631
74632
74633
74634
74635
74636
74637
74638
74639
74640
74641
74642
74643
74644

74645
74646
74647
74648
74649




74650
74651
74652
74653
74654
74655
74656
74657

74658
74659
74660
74661
74662
74663
74664
74665
74666
74667
74668
74669








+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


+
+
-
+
+

















-
+




-
-
-
-
+
+
+
+
+
+
+
+
-
+
+

+
+







      ((p->flags&MEM_Ephem)!=0 ? 1 : 0) +
      ((p->flags&MEM_Static)!=0 ? 1 : 0) == 1
    );
  }
  return 1;
}
#endif

/*
** Render a Mem object which is one of MEM_Int, MEM_Real, or MEM_IntReal
** into a buffer.
*/
static void vdbeMemRenderNum(int sz, char *zBuf, Mem *p){
  StrAccum acc;
  assert( p->flags & (MEM_Int|MEM_Real|MEM_IntReal) );
  sqlite3StrAccumInit(&acc, 0, zBuf, sz, 0);
  if( p->flags & MEM_Int ){
    sqlite3_str_appendf(&acc, "%lld", p->u.i);
  }else if( p->flags & MEM_IntReal ){
    sqlite3_str_appendf(&acc, "%!.15g", (double)p->u.i);
  }else{
    sqlite3_str_appendf(&acc, "%!.15g", p->u.r);
  }
  assert( acc.zText==zBuf && acc.mxAlloc<=0 );
  zBuf[acc.nChar] = 0; /* Fast version of sqlite3StrAccumFinish(&acc) */
}

#ifdef SQLITE_DEBUG
/*
** Validity checks on pMem.  pMem holds a string.
**
** Check that string value of pMem agrees with its integer or real value.
** (1) Check that string value of pMem agrees with its integer or real value.
** (2) Check that the string is correctly zero terminated
**
** A single int or real value always converts to the same strings.  But
** many different strings can be converted into the same int or real.
** If a table contains a numeric value and an index is based on the
** corresponding string value, then it is important that the string be
** derived from the numeric value, not the other way around, to ensure
** that the index and table are consistent.  See ticket
** https://www.sqlite.org/src/info/343634942dd54ab (2018-01-31) for
** an example.
**
** This routine looks at pMem to verify that if it has both a numeric
** representation and a string representation then the string rep has
** been derived from the numeric and not the other way around.  It returns
** true if everything is ok and false if there is a problem.
**
** This routine is for use inside of assert() statements only.
*/
SQLITE_PRIVATE int sqlite3VdbeMemConsistentDualRep(Mem *p){
SQLITE_PRIVATE int sqlite3VdbeMemValidStrRep(Mem *p){
  char zBuf[100];
  char *z;
  int i, j, incr;
  if( (p->flags & MEM_Str)==0 ) return 1;
  if( (p->flags & (MEM_Int|MEM_Real))==0 ) return 1;
  if( p->flags & MEM_Int ){
    sqlite3_snprintf(sizeof(zBuf),zBuf,"%lld",p->u.i);
  }else{
  if( p->flags & MEM_Term ){
    /* Insure that the string is properly zero-terminated.  Pay particular
    ** attention to the case where p->n is odd */
    if( p->szMalloc>0 && p->z==p->zMalloc ){
      assert( p->enc==SQLITE_UTF8 || p->szMalloc >= ((p->n+1)&~1)+2 );
      assert( p->enc!=SQLITE_UTF8 || p->szMalloc >= p->n+1 );
    }
    assert( p->z[p->n]==0 );
    sqlite3_snprintf(sizeof(zBuf),zBuf,"%!.15g",p->u.r);
    assert( p->enc==SQLITE_UTF8 || p->z[(p->n+1)&~1]==0 );
    assert( p->enc==SQLITE_UTF8 || p->z[((p->n+1)&~1)+1]==0 );
  }
  if( (p->flags & (MEM_Int|MEM_Real|MEM_IntReal))==0 ) return 1;
  vdbeMemRenderNum(sizeof(zBuf), zBuf, p);
  z = p->z;
  i = j = 0;
  incr = 1;
  if( p->enc!=SQLITE_UTF8 ){
    incr = 2;
    if( p->enc==SQLITE_UTF16BE ) z++;
  }
74651
74652
74653
74654
74655
74656
74657
74658
74659


74660
74661
74662
74663
74664
74665
74666
74667
74668
74669
74670
74671
74672

74673
74674
74675
74676
74677
74678





74679
74680
74681

74682
74683
74684
74685

74686
74687
74688
74689
74690
74691
74692
74767
74768
74769
74770
74771
74772
74773


74774
74775
74776
74777
74778
74779
74780
74781
74782
74783
74784
74785
74786
74787

74788
74789
74790
74791
74792
74793
74794
74795
74796
74797
74798
74799
74800
74801

74802
74803
74804
74805
74806
74807
74808
74809
74810
74811
74812
74813
74814







-
-
+
+












-
+






+
+
+
+
+


-
+




+







/*
** Change the pMem->zMalloc allocation to be at least szNew bytes.
** If pMem->zMalloc already meets or exceeds the requested size, this
** routine is a no-op.
**
** Any prior string or blob content in the pMem object may be discarded.
** The pMem->xDel destructor is called, if it exists.  Though MEM_Str
** and MEM_Blob values may be discarded, MEM_Int, MEM_Real, and MEM_Null
** values are preserved.
** and MEM_Blob values may be discarded, MEM_Int, MEM_Real, MEM_IntReal,
** and MEM_Null values are preserved.
**
** Return SQLITE_OK on success or an error code (probably SQLITE_NOMEM)
** if unable to complete the resizing.
*/
SQLITE_PRIVATE int sqlite3VdbeMemClearAndResize(Mem *pMem, int szNew){
  assert( CORRUPT_DB || szNew>0 );
  assert( (pMem->flags & MEM_Dyn)==0 || pMem->szMalloc==0 );
  if( pMem->szMalloc<szNew ){
    return sqlite3VdbeMemGrow(pMem, szNew, 0);
  }
  assert( (pMem->flags & MEM_Dyn)==0 );
  pMem->z = pMem->zMalloc;
  pMem->flags &= (MEM_Null|MEM_Int|MEM_Real);
  pMem->flags &= (MEM_Null|MEM_Int|MEM_Real|MEM_IntReal);
  return SQLITE_OK;
}

/*
** It is already known that pMem contains an unterminated string.
** Add the zero terminator.
**
** Three bytes of zero are added.  In this way, there is guaranteed
** to be a double-zero byte at an even byte boundary in order to
** terminate a UTF16 string, even if the initial size of the buffer
** is an odd number of bytes.
*/
static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){
  if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){
  if( sqlite3VdbeMemGrow(pMem, pMem->n+3, 1) ){
    return SQLITE_NOMEM_BKPT;
  }
  pMem->z[pMem->n] = 0;
  pMem->z[pMem->n+1] = 0;
  pMem->z[pMem->n+2] = 0;
  pMem->flags |= MEM_Term;
  return SQLITE_OK;
}

/*
** Change pMem so that its MEM_Str or MEM_Blob value is stored in
** MEM.zMalloc, where it can be safely written.
74752
74753
74754
74755
74756
74757
74758
74759
74760
74761



74762
74763
74764


74765
74766
74767
74768
74769
74770
74771
74772
74773
74774
74775
74776
74777
74778
74779



74780
74781
74782
74783
74784
74785
74786
74787
74788
74789
74790
74791
74792
74793
74794
74795
74796

74797
74798
74799
74800
74801
74802
74803
74804
74805

74806
74807
74808
74809
74810
74811
74812
74874
74875
74876
74877
74878
74879
74880



74881
74882
74883
74884


74885
74886
74887
74888
74889
74890
74891
74892
74893
74894

74895
74896
74897



74898
74899
74900
74901
74902
74903
74904
74905
74906
74907
74908
74909








74910




74911
74912
74913
74914

74915
74916
74917
74918
74919
74920
74921
74922







-
-
-
+
+
+

-
-
+
+








-



-
-
-
+
+
+









-
-
-
-
-
-
-
-
+
-
-
-
-




-
+







    return SQLITE_OK;   /* Nothing to do */
  }else{
    return vdbeMemAddTerminator(pMem);
  }
}

/*
** Add MEM_Str to the set of representations for the given Mem.  Numbers
** are converted using sqlite3_snprintf().  Converting a BLOB to a string
** is a no-op.
** Add MEM_Str to the set of representations for the given Mem.  This
** routine is only called if pMem is a number of some kind, not a NULL
** or a BLOB.
**
** Existing representations MEM_Int and MEM_Real are invalidated if
** bForce is true but are retained if bForce is false.
** Existing representations MEM_Int, MEM_Real, or MEM_IntReal are invalidated
** if bForce is true but are retained if bForce is false.
**
** A MEM_Null value will never be passed to this function. This function is
** used for converting values to text for returning to the user (i.e. via
** sqlite3_value_text()), or for ensuring that values to be used as btree
** keys are strings. In the former case a NULL pointer is returned the
** user and the latter is an internal programming error.
*/
SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){
  int fg = pMem->flags;
  const int nByte = 32;

  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  assert( !(fg&MEM_Zero) );
  assert( !(fg&(MEM_Str|MEM_Blob)) );
  assert( fg&(MEM_Int|MEM_Real) );
  assert( !(pMem->flags&MEM_Zero) );
  assert( !(pMem->flags&(MEM_Str|MEM_Blob)) );
  assert( pMem->flags&(MEM_Int|MEM_Real|MEM_IntReal) );
  assert( !sqlite3VdbeMemIsRowSet(pMem) );
  assert( EIGHT_BYTE_ALIGNMENT(pMem) );


  if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){
    pMem->enc = 0;
    return SQLITE_NOMEM_BKPT;
  }

  /* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8
  ** string representation of the value. Then, if the required encoding
  ** is UTF-16le or UTF-16be do a translation.
  ** 
  ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.
  */
  if( fg & MEM_Int ){
    sqlite3_snprintf(nByte, pMem->z, "%lld", pMem->u.i);
  vdbeMemRenderNum(nByte, pMem->z, pMem);
  }else{
    assert( fg & MEM_Real );
    sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->u.r);
  }
  assert( pMem->z!=0 );
  pMem->n = sqlite3Strlen30NN(pMem->z);
  pMem->enc = SQLITE_UTF8;
  pMem->flags |= MEM_Str|MEM_Term;
  if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real);
  if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal);
  sqlite3VdbeChangeEncoding(pMem, enc);
  return SQLITE_OK;
}

/*
** Memory cell pMem contains the context of an aggregate function.
** This routine calls the finalize method for that function.  The
74972
74973
74974
74975
74976
74977
74978

74979

74980
74981
74982
74983
74984
74985
74986
75082
75083
75084
75085
75086
75087
75088
75089

75090
75091
75092
75093
75094
75095
75096
75097







+
-
+







  return value;
}
SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){
  int flags;
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  assert( EIGHT_BYTE_ALIGNMENT(pMem) );
  flags = pMem->flags;
  if( flags & (MEM_Int|MEM_IntReal) ){
  if( flags & MEM_Int ){
    testcase( flags & MEM_IntReal );
    return pMem->u.i;
  }else if( flags & MEM_Real ){
    return doubleToInt64(pMem->u.r);
  }else if( flags & (MEM_Str|MEM_Blob) ){
    assert( pMem->z || pMem->n==0 );
    return memIntValue(pMem);
  }else{
75001
75002
75003
75004
75005
75006
75007
75008


75009
75010
75011
75012
75013
75014
75015
75016
75017
75018
75019
75020
75021
75022
75023


75024
75025
75026
75027
75028
75029
75030
75112
75113
75114
75115
75116
75117
75118

75119
75120
75121
75122
75123
75124
75125
75126
75127
75128
75129
75130
75131
75132
75133
75134

75135
75136
75137
75138
75139
75140
75141
75142
75143







-
+
+














-
+
+







  return val;
}
SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  assert( EIGHT_BYTE_ALIGNMENT(pMem) );
  if( pMem->flags & MEM_Real ){
    return pMem->u.r;
  }else if( pMem->flags & MEM_Int ){
  }else if( pMem->flags & (MEM_Int|MEM_IntReal) ){
    testcase( pMem->flags & MEM_IntReal );
    return (double)pMem->u.i;
  }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
    return memRealValue(pMem);
  }else{
    /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */
    return (double)0;
  }
}

/*
** Return 1 if pMem represents true, and return 0 if pMem represents false.
** Return the value ifNull if pMem is NULL.  
*/
SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem *pMem, int ifNull){
  if( pMem->flags & MEM_Int ) return pMem->u.i!=0;
  testcase( pMem->flags & MEM_IntReal );
  if( pMem->flags & (MEM_Int|MEM_IntReal) ) return pMem->u.i!=0;
  if( pMem->flags & MEM_Null ) return ifNull;
  return sqlite3VdbeRealValue(pMem)!=0.0;
}

/*
** The MEM structure is already a MEM_Real.  Try to also make it a
** MEM_Int if we can.
75078
75079
75080
75081
75082
75083
75084


75085
75086
75087
75088
75089
75090

75091

75092


75093
75094
75095
75096

75097
75098
75099
75100
75101
75102
75103




75104

75105

75106
75107
75108
75109
75110
75111
75112
75113
75114
75115
75116
75117
75118
75119
75120










75121
75122

75123
75124
75125
75126
75127
75128
75129
75191
75192
75193
75194
75195
75196
75197
75198
75199
75200
75201
75202
75203
75204

75205
75206
75207

75208
75209
75210
75211
75212

75213
75214
75215
75216
75217
75218
75219
75220
75221
75222
75223
75224

75225
75226
75227
75228
75229













75230
75231
75232
75233
75234
75235
75236
75237
75238
75239


75240
75241
75242
75243
75244
75245
75246
75247







+
+





-
+

+
-
+
+



-
+







+
+
+
+
-
+

+


-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+







  pMem->u.r = sqlite3VdbeRealValue(pMem);
  MemSetTypeFlag(pMem, MEM_Real);
  return SQLITE_OK;
}

/* Compare a floating point value to an integer.  Return true if the two
** values are the same within the precision of the floating point value.
**
** This function assumes that i was obtained by assignment from r1.
**
** For some versions of GCC on 32-bit machines, if you do the more obvious
** comparison of "r1==(double)i" you sometimes get an answer of false even
** though the r1 and (double)i values are bit-for-bit the same.
*/
static int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){
SQLITE_PRIVATE int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){
  double r2 = (double)i;
  return r1==0.0
  return memcmp(&r1, &r2, sizeof(r1))==0;
      || (memcmp(&r1, &r2, sizeof(r1))==0
          && i >= -2251799813685248LL && i < 2251799813685248LL);
}

/*
** Convert pMem so that it has types MEM_Real or MEM_Int or both.
** Convert pMem so that it has type MEM_Real or MEM_Int.
** Invalidate any prior representations.
**
** Every effort is made to force the conversion, even if the input
** is a string that does not look completely like a number.  Convert
** as much of the string as we can and ignore the rest.
*/
SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){
  testcase( pMem->flags & MEM_Int );
  testcase( pMem->flags & MEM_Real );
  testcase( pMem->flags & MEM_IntReal );
  testcase( pMem->flags & MEM_Null );
  if( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))==0 ){
  if( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Null))==0 ){
    int rc;
    sqlite3_int64 ix;
    assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 );
    assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
    rc = sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc);
    if( rc==0 ){
      MemSetTypeFlag(pMem, MEM_Int);
    }else{
      i64 i = pMem->u.i;
      sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc);
      if( rc==1 && sqlite3RealSameAsInt(pMem->u.r, i) ){
        pMem->u.i = i;
        MemSetTypeFlag(pMem, MEM_Int);
      }else{
        MemSetTypeFlag(pMem, MEM_Real);
      }
    }
    rc = sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc);
    if( ((rc==0 || rc==1) && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1)
     || sqlite3RealSameAsInt(pMem->u.r, (ix = (i64)pMem->u.r))
    ){
      pMem->u.i = ix;
      MemSetTypeFlag(pMem, MEM_Int);
    }else{
      MemSetTypeFlag(pMem, MEM_Real);
    }
  }
  }
  assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))!=0 );
  assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Null))!=0 );
  pMem->flags &= ~(MEM_Str|MEM_Blob|MEM_Zero);
  return SQLITE_OK;
}

/*
** Cast the datatype of the value in pMem according to the affinity
** "aff".  Casting is different from applying affinity in that a cast
75158
75159
75160
75161
75162
75163
75164
75165

75166
75167
75168
75169
75170
75171
75172
75276
75277
75278
75279
75280
75281
75282

75283
75284
75285
75286
75287
75288
75289
75290







-
+







    }
    default: {
      assert( aff==SQLITE_AFF_TEXT );
      assert( MEM_Str==(MEM_Blob>>3) );
      pMem->flags |= (pMem->flags&MEM_Blob)>>3;
      sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding);
      assert( pMem->flags & MEM_Str || pMem->db->mallocFailed );
      pMem->flags &= ~(MEM_Int|MEM_Real|MEM_Blob|MEM_Zero);
      pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal|MEM_Blob|MEM_Zero);
      break;
    }
  }
}

/*
** Initialize bulk memory to be a consistent Mem object.
75342
75343
75344
75345
75346
75347
75348
75349

75350
75351
75352
75353
75354
75355
75356
75460
75461
75462
75463
75464
75465
75466

75467
75468
75469
75470
75471
75472
75473
75474







-
+







      /* If pX is marked as a shallow copy of pMem, then verify that
      ** no significant changes have been made to pX since the OP_SCopy.
      ** A significant change would indicated a missed call to this
      ** function for pX.  Minor changes, such as adding or removing a
      ** dual type, are allowed, as long as the underlying value is the
      ** same. */
      u16 mFlags = pMem->flags & pX->flags & pX->mScopyFlags;
      assert( (mFlags&MEM_Int)==0 || pMem->u.i==pX->u.i );
      assert( (mFlags&(MEM_Int|MEM_IntReal))==0 || pMem->u.i==pX->u.i );
      assert( (mFlags&MEM_Real)==0 || pMem->u.r==pX->u.r );
      assert( (mFlags&MEM_Str)==0  || (pMem->n==pX->n && pMem->z==pX->z) );
      assert( (mFlags&MEM_Blob)==0  || sqlite3BlobCompare(pMem,pX)==0 );
      
      /* pMem is the register that is changing.  But also mark pX as
      ** undefined so that we can quickly detect the shallow-copy error */
      pX->flags = MEM_Undefined;
75617
75618
75619
75620
75621
75622
75623
75624

75625
75626
75627
75628
75629
75630
75631
75735
75736
75737
75738
75739
75740
75741

75742
75743
75744
75745
75746
75747
75748
75749







-
+







  }else{
    sqlite3VdbeMemStringify(pVal, enc, 0);
    assert( 0==(1&SQLITE_PTR_TO_INT(pVal->z)) );
  }
  assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0
              || pVal->db->mallocFailed );
  if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){
    assert( sqlite3VdbeMemConsistentDualRep(pVal) );
    assert( sqlite3VdbeMemValidStrRep(pVal) );
    return pVal->z;
  }else{
    return 0;
  }
}

/* This function is only available internally, it is not part of the
75640
75641
75642
75643
75644
75645
75646
75647

75648
75649
75650
75651
75652
75653
75654
75758
75759
75760
75761
75762
75763
75764

75765
75766
75767
75768
75769
75770
75771
75772







-
+







*/
SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){
  if( !pVal ) return 0;
  assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );
  assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );
  assert( !sqlite3VdbeMemIsRowSet(pVal) );
  if( (pVal->flags&(MEM_Str|MEM_Term))==(MEM_Str|MEM_Term) && pVal->enc==enc ){
    assert( sqlite3VdbeMemConsistentDualRep(pVal) );
    assert( sqlite3VdbeMemValidStrRep(pVal) );
    return pVal->z;
  }
  if( pVal->flags&MEM_Null ){
    return 0;
  }
  return valueToText(pVal, enc);
}
75905
75906
75907
75908
75909
75910
75911

75912





75913
75914
75915
75916
75917
75918
75919
76023
76024
76025
76026
76027
76028
76029
76030

76031
76032
76033
76034
76035
76036
76037
76038
76039
76040
76041
76042







+
-
+
+
+
+
+







      sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);
    }
    if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){
      sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8);
    }else{
      sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8);
    }
    assert( (pVal->flags & MEM_IntReal)==0 );
    if( pVal->flags & (MEM_Int|MEM_Real) ) pVal->flags &= ~MEM_Str;
    if( pVal->flags & (MEM_Int|MEM_IntReal|MEM_Real) ){
      testcase( pVal->flags & MEM_Int );
      testcase( pVal->flags & MEM_Real );
      pVal->flags &= ~MEM_Str;
    }
    if( enc!=SQLITE_UTF8 ){
      rc = sqlite3VdbeChangeEncoding(pVal, enc);
    }
  }else if( op==TK_UMINUS ) {
    /* This branch happens for multiple negative signs.  Ex: -(-5) */
    if( SQLITE_OK==valueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal,pCtx) 
     && pVal!=0
75928
75929
75930
75931
75932
75933
75934
75935

75936
75937
75938
75939
75940
75941
75942
76051
76052
76053
76054
76055
76056
76057

76058
76059
76060
76061
76062
76063
76064
76065







-
+







        pVal->u.i = -pVal->u.i;
      }
      sqlite3ValueApplyAffinity(pVal, affinity, enc);
    }
  }else if( op==TK_NULL ){
    pVal = valueNew(db, pCtx);
    if( pVal==0 ) goto no_mem;
    sqlite3VdbeMemNumerify(pVal);
    sqlite3VdbeMemSetNull(pVal);
  }
#ifndef SQLITE_OMIT_BLOB_LITERAL
  else if( op==TK_BLOB ){
    int nVal;
    assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' );
    assert( pExpr->u.zToken[1]=='\'' );
    pVal = valueNew(db, pCtx);
76940
76941
76942
76943
76944
76945
76946

76947
76948
76949
76950
76951
76952
76953
76954
76955
76956
76957
76958
76959
76960
76961
76962
76963
76964








76965
76966
76967
76968
76969
76970
76971
76972
76973
76974
76975
76976
76977
76978
76979
76980


76981
76982
76983
76984
76985
76986
76987
77063
77064
77065
77066
77067
77068
77069
77070
77071
77072
77073
77074
77075
77076
77077
77078
77079
77080
77081
77082
77083
77084
77085
77086
77087
77088
77089
77090
77091
77092
77093
77094
77095
77096
77097
77098
77099
77100
77101
77102
77103
77104
77105
77106
77107
77108
77109
77110
77111

77112
77113
77114
77115
77116
77117
77118
77119
77120







+


















+
+
+
+
+
+
+
+















-
+
+







**
**   assert( sqlite3VdbeAssertMayAbort(pParse->pVdbe, pParse->mayAbort) );
*/
SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
  int hasAbort = 0;
  int hasFkCounter = 0;
  int hasCreateTable = 0;
  int hasCreateIndex = 0;
  int hasInitCoroutine = 0;
  Op *pOp;
  VdbeOpIter sIter;
  memset(&sIter, 0, sizeof(sIter));
  sIter.v = v;

  while( (pOp = opIterNext(&sIter))!=0 ){
    int opcode = pOp->opcode;
    if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename 
     || opcode==OP_VDestroy
     || (opcode==OP_Function0 && pOp->p4.pFunc->funcFlags&SQLITE_FUNC_INTERNAL)
     || ((opcode==OP_Halt || opcode==OP_HaltIfNull) 
      && ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort))
    ){
      hasAbort = 1;
      break;
    }
    if( opcode==OP_CreateBtree && pOp->p3==BTREE_INTKEY ) hasCreateTable = 1;
    if( mayAbort ){
      /* hasCreateIndex may also be set for some DELETE statements that use
      ** OP_Clear. So this routine may end up returning true in the case 
      ** where a "DELETE FROM tbl" has a statement-journal but does not
      ** require one. This is not so bad - it is an inefficiency, not a bug. */
      if( opcode==OP_CreateBtree && pOp->p3==BTREE_BLOBKEY ) hasCreateIndex = 1;
      if( opcode==OP_Clear ) hasCreateIndex = 1;
    }
    if( opcode==OP_InitCoroutine ) hasInitCoroutine = 1;
#ifndef SQLITE_OMIT_FOREIGN_KEY
    if( opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1 ){
      hasFkCounter = 1;
    }
#endif
  }
  sqlite3DbFree(v->db, sIter.apSub);

  /* Return true if hasAbort==mayAbort. Or if a malloc failure occurred.
  ** If malloc failed, then the while() loop above may not have iterated
  ** through all opcodes and hasAbort may be set incorrectly. Return
  ** true for this case to prevent the assert() in the callers frame
  ** from failing.  */
  return ( v->db->mallocFailed || hasAbort==mayAbort || hasFkCounter
              || (hasCreateTable && hasInitCoroutine) );
        || (hasCreateTable && hasInitCoroutine) || hasCreateIndex
  );
}
#endif /* SQLITE_DEBUG - the sqlite3AssertMayAbort() function */

#ifdef SQLITE_DEBUG
/*
** Increment the nWrite counter in the VDBE if the cursor is not an
** ephemeral cursor, or if the cursor argument is NULL.
77845
77846
77847
77848
77849
77850
77851
77852

77853
77854
77855
77856
77857
77858
77859
77978
77979
77980
77981
77982
77983
77984

77985
77986
77987
77988
77989
77990
77991
77992







-
+







      sqlite3_str_appendf(&x, "%.16g", *pOp->p4.pReal);
      break;
    }
    case P4_MEM: {
      Mem *pMem = pOp->p4.pMem;
      if( pMem->flags & MEM_Str ){
        zP4 = pMem->z;
      }else if( pMem->flags & MEM_Int ){
      }else if( pMem->flags & (MEM_Int|MEM_IntReal) ){
        sqlite3_str_appendf(&x, "%lld", pMem->u.i);
      }else if( pMem->flags & MEM_Real ){
        sqlite3_str_appendf(&x, "%.16g", pMem->u.r);
      }else if( pMem->flags & MEM_Null ){
        zP4 = "NULL";
      }else{
        assert( pMem->flags & MEM_Blob );
79207
79208
79209
79210
79211
79212
79213
79214

79215
79216
79217
79218
79219
79220
79221
79340
79341
79342
79343
79344
79345
79346

79347
79348
79349
79350
79351
79352
79353
79354







-
+







          db->autoCommit = 1;
          p->nChange = 0;
        }
      }
    }

    /* Check for immediate foreign key violations. */
    if( p->rc==SQLITE_OK ){
    if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){
      sqlite3VdbeCheckFk(p, 0);
    }
  
    /* If the auto-commit flag is set and this is the only active writer 
    ** VM, then we do either a commit or rollback of the current transaction. 
    **
    ** Note: This block also runs if one of the special errors handled 
79733
79734
79735
79736
79737
79738
79739


79740
79741
79742
79743
79744
79745
79746
79747
79748
79749
79750

79751
79752
79753
79754


79755
79756
79757
79758
79759
79760
79761
79762
79763
79764
79765
79766
79767
79768
79769
79770
79771
79772
79773









79774
79775
79776
79777
79778
79779
79780
79866
79867
79868
79869
79870
79871
79872
79873
79874
79875
79876
79877
79878
79879
79880
79881
79882
79883
79884

79885
79886
79887
79888
79889
79890
79891
79892
79893
79894
79895
79896
79897
79898
79899
79900
79901
79902
79903
79904
79905
79906
79907
79908
79909
79910
79911
79912
79913
79914
79915
79916
79917
79918
79919
79920
79921
79922
79923
79924
79925
79926







+
+










-
+




+
+



















+
+
+
+
+
+
+
+
+







**
** The 8 and 9 types were added in 3.3.0, file format 4.  Prior versions
** of SQLite will not understand those serial types.
*/

/*
** Return the serial-type for the value stored in pMem.
**
** This routine might convert a large MEM_IntReal value into MEM_Real.
*/
SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format, u32 *pLen){
  int flags = pMem->flags;
  u32 n;

  assert( pLen!=0 );
  if( flags&MEM_Null ){
    *pLen = 0;
    return 0;
  }
  if( flags&MEM_Int ){
  if( flags&(MEM_Int|MEM_IntReal) ){
    /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */
#   define MAX_6BYTE ((((i64)0x00008000)<<32)-1)
    i64 i = pMem->u.i;
    u64 u;
    testcase( flags & MEM_Int );
    testcase( flags & MEM_IntReal );
    if( i<0 ){
      u = ~i;
    }else{
      u = i;
    }
    if( u<=127 ){
      if( (i&1)==i && file_format>=4 ){
        *pLen = 0;
        return 8+(u32)u;
      }else{
        *pLen = 1;
        return 1;
      }
    }
    if( u<=32767 ){ *pLen = 2; return 2; }
    if( u<=8388607 ){ *pLen = 3; return 3; }
    if( u<=2147483647 ){ *pLen = 4; return 4; }
    if( u<=MAX_6BYTE ){ *pLen = 6; return 5; }
    *pLen = 8;
    if( flags&MEM_IntReal ){
      /* If the value is IntReal and is going to take up 8 bytes to store
      ** as an integer, then we might as well make it an 8-byte floating
      ** point value */
      pMem->u.r = (double)pMem->u.i;
      pMem->flags &= ~MEM_IntReal;
      pMem->flags |= MEM_Real;
      return 7;
    }
    return 6;
  }
  if( flags&MEM_Real ){
    *pLen = 8;
    return 7;
  }
  assert( pMem->db->mallocFailed || flags&(MEM_Str|MEM_Blob) );
79940
79941
79942
79943
79944
79945
79946
79947

79948
79949
79950
79951
79952
79953
79954
80086
80087
80088
80089
80090
80091
80092

80093
80094
80095
80096
80097
80098
80099
80100







-
+







** and store the result in pMem.  Return the number of bytes read.
**
** This function is implemented as two separate routines for performance.
** The few cases that require local variables are broken out into a separate
** routine so that in most cases the overhead of moving the stack pointer
** is avoided.
*/ 
static u32 SQLITE_NOINLINE serialGet(
static u32 serialGet(
  const unsigned char *buf,     /* Buffer to deserialize from */
  u32 serial_type,              /* Serial type to deserialize */
  Mem *pMem                     /* Memory cell to write value into */
){
  u64 x = FOUR_BYTE_UINT(buf);
  u32 y = FOUR_BYTE_UINT(buf+4);
  x = (x<<32) + y;
79972
79973
79974
79975
79976
79977
79978
79979

79980
79981
79982
79983
79984
79985
79986
80118
80119
80120
80121
80122
80123
80124

80125
80126
80127
80128
80129
80130
80131
80132







-
+







    u64 t2 = t1;
    swapMixedEndianFloat(t2);
    assert( sizeof(r1)==sizeof(t2) && memcmp(&r1, &t2, sizeof(r1))==0 );
#endif
    assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 );
    swapMixedEndianFloat(x);
    memcpy(&pMem->u.r, &x, sizeof(x));
    pMem->flags = sqlite3IsNaN(pMem->u.r) ? MEM_Null : MEM_Real;
    pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real;
  }
  return 8;
}
SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
  const unsigned char *buf,     /* Buffer to deserialize from */
  u32 serial_type,              /* Serial type to deserialize */
  Mem *pMem                     /* Memory cell to write value into */
80422
80423
80424
80425
80426
80427
80428
80429
80430







80431
80432
80433
80434
80435
80436
80437
80438
80439

80440


80441
80442




80443
80444
80445
80446
80447

80448


80449
80450
80451
80452
80453
80454
80455
80568
80569
80570
80571
80572
80573
80574


80575
80576
80577
80578
80579
80580
80581
80582
80583
80584
80585
80586
80587
80588
80589
80590
80591

80592
80593
80594
80595
80596
80597
80598
80599
80600
80601
80602
80603
80604
80605

80606
80607
80608
80609
80610
80611
80612
80613
80614







-
-
+
+
+
+
+
+
+









+
-
+
+


+
+
+
+





+
-
+
+







  */
  if( combined_flags&MEM_Null ){
    return (f2&MEM_Null) - (f1&MEM_Null);
  }

  /* At least one of the two values is a number
  */
  if( combined_flags&(MEM_Int|MEM_Real) ){
    if( (f1 & f2 & MEM_Int)!=0 ){
  if( combined_flags&(MEM_Int|MEM_Real|MEM_IntReal) ){
    testcase( combined_flags & MEM_Int );
    testcase( combined_flags & MEM_Real );
    testcase( combined_flags & MEM_IntReal );
    if( (f1 & f2 & (MEM_Int|MEM_IntReal))!=0 ){
      testcase( f1 & f2 & MEM_Int );
      testcase( f1 & f2 & MEM_IntReal );
      if( pMem1->u.i < pMem2->u.i ) return -1;
      if( pMem1->u.i > pMem2->u.i ) return +1;
      return 0;
    }
    if( (f1 & f2 & MEM_Real)!=0 ){
      if( pMem1->u.r < pMem2->u.r ) return -1;
      if( pMem1->u.r > pMem2->u.r ) return +1;
      return 0;
    }
    if( (f1&(MEM_Int|MEM_IntReal))!=0 ){
    if( (f1&MEM_Int)!=0 ){
      testcase( f1 & MEM_Int );
      testcase( f1 & MEM_IntReal );
      if( (f2&MEM_Real)!=0 ){
        return sqlite3IntFloatCompare(pMem1->u.i, pMem2->u.r);
      }else if( (f2&(MEM_Int|MEM_IntReal))!=0 ){
        if( pMem1->u.i < pMem2->u.i ) return -1;
        if( pMem1->u.i > pMem2->u.i ) return +1;
        return 0;
      }else{
        return -1;
      }
    }
    if( (f1&MEM_Real)!=0 ){
      if( (f2&(MEM_Int|MEM_IntReal))!=0 ){
      if( (f2&MEM_Int)!=0 ){
        testcase( f2 & MEM_Int );
        testcase( f2 & MEM_IntReal );
        return -sqlite3IntFloatCompare(pMem2->u.i, pMem1->u.r);
      }else{
        return -1;
      }
    }
    return +1;
  }
80590
80591
80592
80593
80594
80595
80596

80597


80598
80599
80600
80601
80602
80603
80604
80749
80750
80751
80752
80753
80754
80755
80756

80757
80758
80759
80760
80761
80762
80763
80764
80765







+
-
+
+







  assert( pPKey2->pKeyInfo->aSortOrder!=0 );
  assert( pPKey2->pKeyInfo->nKeyField>0 );
  assert( idx1<=szHdr1 || CORRUPT_DB );
  do{
    u32 serial_type;

    /* RHS is an integer */
    if( pRhs->flags & (MEM_Int|MEM_IntReal) ){
    if( pRhs->flags & MEM_Int ){
      testcase( pRhs->flags & MEM_Int );
      testcase( pRhs->flags & MEM_IntReal );
      serial_type = aKey1[idx1];
      testcase( serial_type==12 );
      if( serial_type>=10 ){
        rc = +1;
      }else if( serial_type==0 ){
        rc = -1;
      }else if( serial_type==7 ){
80935
80936
80937
80938
80939
80940
80941

80942


80943
80944
80945
80946
80947
80948
80949
81096
81097
81098
81099
81100
81101
81102
81103

81104
81105
81106
81107
81108
81109
81110
81111
81112







+
-
+
+







    }
    if( (flags & MEM_Int) ){
      return vdbeRecordCompareInt;
    }
    testcase( flags & MEM_Real );
    testcase( flags & MEM_Null );
    testcase( flags & MEM_Blob );
    if( (flags & (MEM_Real|MEM_IntReal|MEM_Null|MEM_Blob))==0
    if( (flags & (MEM_Real|MEM_Null|MEM_Blob))==0 && p->pKeyInfo->aColl[0]==0 ){
     && p->pKeyInfo->aColl[0]==0
    ){
      assert( flags & MEM_Str );
      return vdbeRecordCompareString;
    }
  }

  return sqlite3VdbeRecordCompare;
}
81525
81526
81527
81528
81529
81530
81531
81532
81533
81534
81535
81536
81537
81538
81539
81540
81541
81542
81543
81544
81545
81546
81547
81548
81549
81550
81551
81552
81553
81554
81555
81556
81557
81558
81559
81560
81561
81562
81563
































































81564















81565
81566
81567
81568
81569
81570
81571
81688
81689
81690
81691
81692
81693
81694
































81695
81696
81697
81698
81699
81700
81701
81702
81703
81704
81705
81706
81707
81708
81709
81710
81711
81712
81713
81714
81715
81716
81717
81718
81719
81720
81721
81722
81723
81724
81725
81726
81727
81728
81729
81730
81731
81732
81733
81734
81735
81736
81737
81738
81739
81740
81741
81742
81743
81744
81745
81746
81747
81748
81749
81750
81751
81752
81753
81754
81755
81756
81757
81758
81759
81760
81761
81762
81763
81764
81765
81766
81767
81768
81769
81770
81771
81772
81773
81774
81775
81776
81777
81778
81779
81780
81781







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







#endif /* SQLITE_OMIT_UTF16 */
/* EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five
** fundamental datatypes: 64-bit signed integer 64-bit IEEE floating
** point number string BLOB NULL
*/
SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){
  static const u8 aType[] = {
     SQLITE_BLOB,     /* 0x00 */
     SQLITE_NULL,     /* 0x01 */
     SQLITE_TEXT,     /* 0x02 */
     SQLITE_NULL,     /* 0x03 */
     SQLITE_INTEGER,  /* 0x04 */
     SQLITE_NULL,     /* 0x05 */
     SQLITE_INTEGER,  /* 0x06 */
     SQLITE_NULL,     /* 0x07 */
     SQLITE_FLOAT,    /* 0x08 */
     SQLITE_NULL,     /* 0x09 */
     SQLITE_FLOAT,    /* 0x0a */
     SQLITE_NULL,     /* 0x0b */
     SQLITE_INTEGER,  /* 0x0c */
     SQLITE_NULL,     /* 0x0d */
     SQLITE_INTEGER,  /* 0x0e */
     SQLITE_NULL,     /* 0x0f */
     SQLITE_BLOB,     /* 0x10 */
     SQLITE_NULL,     /* 0x11 */
     SQLITE_TEXT,     /* 0x12 */
     SQLITE_NULL,     /* 0x13 */
     SQLITE_INTEGER,  /* 0x14 */
     SQLITE_NULL,     /* 0x15 */
     SQLITE_INTEGER,  /* 0x16 */
     SQLITE_NULL,     /* 0x17 */
     SQLITE_FLOAT,    /* 0x18 */
     SQLITE_NULL,     /* 0x19 */
     SQLITE_FLOAT,    /* 0x1a */
     SQLITE_NULL,     /* 0x1b */
     SQLITE_INTEGER,  /* 0x1c */
     SQLITE_NULL,     /* 0x1d */
     SQLITE_INTEGER,  /* 0x1e */
     SQLITE_NULL,     /* 0x1f */
     SQLITE_BLOB,     /* 0x00 (not possible) */
     SQLITE_NULL,     /* 0x01 NULL */
     SQLITE_TEXT,     /* 0x02 TEXT */
     SQLITE_NULL,     /* 0x03 (not possible) */
     SQLITE_INTEGER,  /* 0x04 INTEGER */
     SQLITE_NULL,     /* 0x05 (not possible) */
     SQLITE_INTEGER,  /* 0x06 INTEGER + TEXT */
     SQLITE_NULL,     /* 0x07 (not possible) */
     SQLITE_FLOAT,    /* 0x08 FLOAT */
     SQLITE_NULL,     /* 0x09 (not possible) */
     SQLITE_FLOAT,    /* 0x0a FLOAT + TEXT */
     SQLITE_NULL,     /* 0x0b (not possible) */
     SQLITE_INTEGER,  /* 0x0c (not possible) */
     SQLITE_NULL,     /* 0x0d (not possible) */
     SQLITE_INTEGER,  /* 0x0e (not possible) */
     SQLITE_NULL,     /* 0x0f (not possible) */
     SQLITE_BLOB,     /* 0x10 BLOB */
     SQLITE_NULL,     /* 0x11 (not possible) */
     SQLITE_TEXT,     /* 0x12 (not possible) */
     SQLITE_NULL,     /* 0x13 (not possible) */
     SQLITE_INTEGER,  /* 0x14 INTEGER + BLOB */
     SQLITE_NULL,     /* 0x15 (not possible) */
     SQLITE_INTEGER,  /* 0x16 (not possible) */
     SQLITE_NULL,     /* 0x17 (not possible) */
     SQLITE_FLOAT,    /* 0x18 FLOAT + BLOB */
     SQLITE_NULL,     /* 0x19 (not possible) */
     SQLITE_FLOAT,    /* 0x1a (not possible) */
     SQLITE_NULL,     /* 0x1b (not possible) */
     SQLITE_INTEGER,  /* 0x1c (not possible) */
     SQLITE_NULL,     /* 0x1d (not possible) */
     SQLITE_INTEGER,  /* 0x1e (not possible) */
     SQLITE_NULL,     /* 0x1f (not possible) */
     SQLITE_FLOAT,    /* 0x20 INTREAL */
     SQLITE_NULL,     /* 0x21 (not possible) */
     SQLITE_TEXT,     /* 0x22 INTREAL + TEXT */
     SQLITE_NULL,     /* 0x23 (not possible) */
     SQLITE_FLOAT,    /* 0x24 (not possible) */
     SQLITE_NULL,     /* 0x25 (not possible) */
     SQLITE_FLOAT,    /* 0x26 (not possible) */
     SQLITE_NULL,     /* 0x27 (not possible) */
     SQLITE_FLOAT,    /* 0x28 (not possible) */
     SQLITE_NULL,     /* 0x29 (not possible) */
     SQLITE_FLOAT,    /* 0x2a (not possible) */
     SQLITE_NULL,     /* 0x2b (not possible) */
     SQLITE_FLOAT,    /* 0x2c (not possible) */
     SQLITE_NULL,     /* 0x2d (not possible) */
     SQLITE_FLOAT,    /* 0x2e (not possible) */
     SQLITE_NULL,     /* 0x2f (not possible) */
     SQLITE_BLOB,     /* 0x30 (not possible) */
     SQLITE_NULL,     /* 0x31 (not possible) */
     SQLITE_TEXT,     /* 0x32 (not possible) */
     SQLITE_NULL,     /* 0x33 (not possible) */
     SQLITE_FLOAT,    /* 0x34 (not possible) */
     SQLITE_NULL,     /* 0x35 (not possible) */
     SQLITE_FLOAT,    /* 0x36 (not possible) */
     SQLITE_NULL,     /* 0x37 (not possible) */
     SQLITE_FLOAT,    /* 0x38 (not possible) */
     SQLITE_NULL,     /* 0x39 (not possible) */
     SQLITE_FLOAT,    /* 0x3a (not possible) */
     SQLITE_NULL,     /* 0x3b (not possible) */
     SQLITE_FLOAT,    /* 0x3c (not possible) */
     SQLITE_NULL,     /* 0x3d (not possible) */
     SQLITE_FLOAT,    /* 0x3e (not possible) */
     SQLITE_NULL,     /* 0x3f (not possible) */
  };
#ifdef SQLITE_DEBUG
  {
    int eType = SQLITE_BLOB;
    if( pVal->flags & MEM_Null ){
      eType = SQLITE_NULL;
    }else if( pVal->flags & (MEM_Real|MEM_IntReal) ){
      eType = SQLITE_FLOAT;
    }else if( pVal->flags & MEM_Int ){
      eType = SQLITE_INTEGER;
    }else if( pVal->flags & MEM_Str ){
      eType = SQLITE_TEXT;
    }
    assert( eType == aType[pVal->flags&MEM_AffMask] );
  }
#endif
  return aType[pVal->flags&MEM_AffMask];
}

/* Return true if a parameter to xUpdate represents an unchanged column */
SQLITE_API int sqlite3_value_nochange(sqlite3_value *pVal){
  return (pVal->flags&(MEM_Null|MEM_Zero))==(MEM_Null|MEM_Zero);
}
81806
81807
81808
81809
81810
81811
81812















81813
81814
81815
81816
81817
81818
81819
82016
82017
82018
82019
82020
82021
82022
82023
82024
82025
82026
82027
82028
82029
82030
82031
82032
82033
82034
82035
82036
82037
82038
82039
82040
82041
82042
82043
82044







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







/* An SQLITE_NOMEM error. */
SQLITE_API void sqlite3_result_error_nomem(sqlite3_context *pCtx){
  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
  sqlite3VdbeMemSetNull(pCtx->pOut);
  pCtx->isError = SQLITE_NOMEM_BKPT;
  sqlite3OomFault(pCtx->pOut->db);
}

#ifndef SQLITE_UNTESTABLE
/* Force the INT64 value currently stored as the result to be
** a MEM_IntReal value.  See the SQLITE_TESTCTRL_RESULT_INTREAL
** test-control.
*/
SQLITE_PRIVATE void sqlite3ResultIntReal(sqlite3_context *pCtx){ 
  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
  if( pCtx->pOut->flags & MEM_Int ){
    pCtx->pOut->flags &= ~MEM_Int;
    pCtx->pOut->flags |= MEM_IntReal;
  }
}
#endif


/*
** This function is called after a transaction has been committed. It 
** invokes callbacks registered with sqlite3_wal_hook() as required.
*/
static int doWalCallbacks(sqlite3 *db){
  int rc = SQLITE_OK;
83093
83094
83095
83096
83097
83098
83099

83100


83101
83102
83103
83104
83105
83106
83107
83318
83319
83320
83321
83322
83323
83324
83325

83326
83327
83328
83329
83330
83331
83332
83333
83334







+
-
+
+








  pMem = *ppValue = &p->pUnpacked->aMem[iIdx];
  if( iIdx==p->pTab->iPKey ){
    sqlite3VdbeMemSetInt64(pMem, p->iKey1);
  }else if( iIdx>=p->pUnpacked->nField ){
    *ppValue = (sqlite3_value *)columnNullValue();
  }else if( p->pTab->aCol[iIdx].affinity==SQLITE_AFF_REAL ){
    if( pMem->flags & (MEM_Int|MEM_IntReal) ){
    if( pMem->flags & MEM_Int ){
      testcase( pMem->flags & MEM_Int );
      testcase( pMem->flags & MEM_IntReal );
      sqlite3VdbeMemRealify(pMem);
    }
  }

 preupdate_old_out:
  sqlite3Error(db, rc);
  return sqlite3ApiExit(db, rc);
83412
83413
83414
83415
83416
83417
83418
83419

83420
83421
83422
83423
83424
83425
83426
83639
83640
83641
83642
83643
83644
83645

83646
83647
83648
83649
83650
83651
83652
83653







-
+







      }
      zRawSql += nToken;
      nextIndex = idx + 1;
      assert( idx>0 && idx<=p->nVar );
      pVar = &p->aVar[idx-1];
      if( pVar->flags & MEM_Null ){
        sqlite3_str_append(&out, "NULL", 4);
      }else if( pVar->flags & MEM_Int ){
      }else if( pVar->flags & (MEM_Int|MEM_IntReal) ){
        sqlite3_str_appendf(&out, "%lld", pVar->u.i);
      }else if( pVar->flags & MEM_Real ){
        sqlite3_str_appendf(&out, "%!.15g", pVar->u.r);
      }else if( pVar->flags & MEM_Str ){
        int nOut;  /* Number of bytes of the string text to include in output */
#ifndef SQLITE_OMIT_UTF16
        u8 enc = ENC(db);
83674
83675
83676
83677
83678
83679
83680
83681
83682
83683
83684
83685
83686
83687
83688
83689
83690
83691
83692
83693
83694
83695
83901
83902
83903
83904
83905
83906
83907








83908
83909
83910
83911
83912
83913
83914







-
-
-
-
-
-
-
-







      if( (mNever&0x08)!=0 && (I&0x05)!=0) I |= 0x05; /*NO_TEST*/
    }
    sqlite3GlobalConfig.xVdbeBranch(sqlite3GlobalConfig.pVdbeBranchArg,
                                    iSrcLine&0xffffff, I, M);
  }
#endif

/*
** Convert the given register into a string if it isn't one
** already. Return non-zero if a malloc() fails.
*/
#define Stringify(P, enc) \
   if(((P)->flags&(MEM_Str|MEM_Blob))==0 && sqlite3VdbeMemStringify(P,enc,0)) \
     { goto no_mem; }

/*
** An ephemeral string value (signified by the MEM_Ephem flag) contains
** a pointer to a dynamically allocated string where some other entity
** is responsible for deallocating that string.  Because the register
** does not control the string, it might be deleted without the register
** knowing it.
**
83743
83744
83745
83746
83747
83748
83749
83750

83751
83752
83753
83754
83755
83756
83757
83758
83759
83760
83761
83762
83763
83764
83765
83766
83767
83768















83769
83770
83771
83772
83773
83774
83775
83776
83777
83778
83779
83780
83781
83782
83783
83784
83785
83786
83787
83788

83789
83790
83791
83792




83793
83794
83795
83796
83797
83798
83799
83962
83963
83964
83965
83966
83967
83968

83969
83970
83971
83972
83973
83974
83975
83976
83977
83978
83979
83980
83981
83982
83983
83984
83985
83986
83987
83988
83989
83990
83991
83992
83993
83994
83995
83996
83997
83998
83999
84000
84001
84002
84003
84004
84005
84006
84007
84008
84009
84010
84011
84012
84013
84014
84015
84016
84017
84018
84019
84020

84021
84022




84023
84024
84025
84026
84027
84028
84029
84030
84031
84032
84033







-
+


















+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


















-

+
-
-
-
-
+
+
+
+








  assert( iCur>=0 && iCur<p->nCursor );
  if( p->apCsr[iCur] ){ /*OPTIMIZATION-IF-FALSE*/
    /* Before calling sqlite3VdbeFreeCursor(), ensure the isEphemeral flag
    ** is clear. Otherwise, if this is an ephemeral cursor created by 
    ** OP_OpenDup, the cursor will not be closed and will still be part
    ** of a BtShared.pCursor list.  */
    p->apCsr[iCur]->isEphemeral = 0;
    if( p->apCsr[iCur]->pBtx==0 ) p->apCsr[iCur]->isEphemeral = 0;
    sqlite3VdbeFreeCursor(p, p->apCsr[iCur]);
    p->apCsr[iCur] = 0;
  }
  if( SQLITE_OK==sqlite3VdbeMemClearAndResize(pMem, nByte) ){
    p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z;
    memset(pCx, 0, offsetof(VdbeCursor,pAltCursor));
    pCx->eCurType = eCurType;
    pCx->iDb = iDb;
    pCx->nField = nField;
    pCx->aOffset = &pCx->aType[nField];
    if( eCurType==CURTYPE_BTREE ){
      pCx->uc.pCursor = (BtCursor*)
          &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField];
      sqlite3BtreeCursorZero(pCx->uc.pCursor);
    }
  }
  return pCx;
}

/*
** The string in pRec is known to look like an integer and to have a
** floating point value of rValue.  Return true and set *piValue to the
** integer value if the string is in range to be an integer.  Otherwise,
** return false.
*/
static int alsoAnInt(Mem *pRec, double rValue, i64 *piValue){
  i64 iValue = (double)rValue;
  if( sqlite3RealSameAsInt(rValue,iValue) ){
    *piValue = iValue;
    return 1;
  }
  return 0==sqlite3Atoi64(pRec->z, piValue, pRec->n, pRec->enc);
}

/*
** Try to convert a value into a numeric representation if we can
** do so without loss of information.  In other words, if the string
** looks like a number, convert it into a number.  If it does not
** look like a number, leave it alone.
**
** If the bTryForInt flag is true, then extra effort is made to give
** an integer representation.  Strings that look like floating point
** values but which have no fractional component (example: '48.00')
** will have a MEM_Int representation when bTryForInt is true.
**
** If bTryForInt is false, then if the input string contains a decimal
** point or exponential notation, the result is only MEM_Real, even
** if there is an exact integer representation of the quantity.
*/
static void applyNumericAffinity(Mem *pRec, int bTryForInt){
  double rValue;
  i64 iValue;
  u8 enc = pRec->enc;
  int rc;
  assert( (pRec->flags & (MEM_Str|MEM_Int|MEM_Real))==MEM_Str );
  if( sqlite3AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return;
  if( 0==sqlite3Atoi64(pRec->z, &iValue, pRec->n, enc) ){
    pRec->u.i = iValue;
  assert( (pRec->flags & (MEM_Str|MEM_Int|MEM_Real|MEM_IntReal))==MEM_Str );
  rc = sqlite3AtoF(pRec->z, &rValue, pRec->n, enc);
  if( rc<=0 ) return;
  if( rc==1 && alsoAnInt(pRec, rValue, &pRec->u.i) ){
    pRec->flags |= MEM_Int;
  }else{
    pRec->u.r = rValue;
    pRec->flags |= MEM_Real;
    if( bTryForInt ) sqlite3VdbeIntegerAffinity(pRec);
  }
  /* TEXT->NUMERIC is many->one.  Hence, it is important to invalidate the
83839
83840
83841
83842
83843
83844
83845
83846




83847
83848
83849
83850

83851
83852
83853
83854
83855
83856
83857
84073
84074
84075
84076
84077
84078
84079

84080
84081
84082
84083
84084
84085
84086

84087
84088
84089
84090
84091
84092
84093
84094







-
+
+
+
+



-
+







  }else if( affinity==SQLITE_AFF_TEXT ){
    /* Only attempt the conversion to TEXT if there is an integer or real
    ** representation (blob and NULL do not get converted) but no string
    ** representation.  It would be harmless to repeat the conversion if 
    ** there is already a string rep, but it is pointless to waste those
    ** CPU cycles. */
    if( 0==(pRec->flags&MEM_Str) ){ /*OPTIMIZATION-IF-FALSE*/
      if( (pRec->flags&(MEM_Real|MEM_Int)) ){
      if( (pRec->flags&(MEM_Real|MEM_Int|MEM_IntReal)) ){
        testcase( pRec->flags & MEM_Int );
        testcase( pRec->flags & MEM_Real );
        testcase( pRec->flags & MEM_IntReal );
        sqlite3VdbeMemStringify(pRec, enc, 1);
      }
    }
    pRec->flags &= ~(MEM_Real|MEM_Int);
    pRec->flags &= ~(MEM_Real|MEM_Int|MEM_IntReal);
  }
}

/*
** Try to convert the type of a function argument or a result column
** into a numeric representation.  Use either INTEGER or REAL whichever
** is appropriate.  But only do the conversion if it is possible without
83882
83883
83884
83885
83886
83887
83888


83889

83890
83891
83892
83893
83894
83895










83896
83897
83898
83899
83900
83901
83902
83903
83904
83905
83906
83907
83908
83909
83910





83911
83912


83913
83914
83915
83916
83917
83918
83919
84119
84120
84121
84122
84123
84124
84125
84126
84127

84128
84129
84130




84131
84132
84133
84134
84135
84136
84137
84138
84139
84140
84141
84142
84143
84144
84145
84146
84147
84148
84149
84150
84151
84152
84153


84154
84155
84156
84157
84158
84159
84160
84161
84162
84163
84164
84165
84166
84167
84168
84169







+
+
-
+


-
-
-
-
+
+
+
+
+
+
+
+
+
+













-
-
+
+
+
+
+


+
+







/*
** pMem currently only holds a string type (or maybe a BLOB that we can
** interpret as a string if we want to).  Compute its corresponding
** numeric type, if has one.  Set the pMem->u.r and pMem->u.i fields
** accordingly.
*/
static u16 SQLITE_NOINLINE computeNumericType(Mem *pMem){
  int rc;
  sqlite3_int64 ix;
  assert( (pMem->flags & (MEM_Int|MEM_Real))==0 );
  assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal))==0 );
  assert( (pMem->flags & (MEM_Str|MEM_Blob))!=0 );
  ExpandBlob(pMem);
  if( sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc)==0 ){
    return 0;
  }
  if( sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc)==0 ){
  rc = sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc);
  if( rc<=0 ){
    if( rc==0 && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)<=1 ){
      pMem->u.i = ix;
      return MEM_Int;
    }else{
      return MEM_Real;
    }
  }else if( rc==1 && sqlite3Atoi64(pMem->z, &ix, pMem->n, pMem->enc)==0 ){
    pMem->u.i = ix;
    return MEM_Int;
  }
  return MEM_Real;
}

/*
** Return the numeric type for pMem, either MEM_Int or MEM_Real or both or
** none.  
**
** Unlike applyNumericAffinity(), this routine does not modify pMem->flags.
** But it does set pMem->u.r and pMem->u.i appropriately.
*/
static u16 numericType(Mem *pMem){
  if( pMem->flags & (MEM_Int|MEM_Real) ){
    return pMem->flags & (MEM_Int|MEM_Real);
  if( pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal) ){
    testcase( pMem->flags & MEM_Int );
    testcase( pMem->flags & MEM_Real );
    testcase( pMem->flags & MEM_IntReal );
    return pMem->flags & (MEM_Int|MEM_Real|MEM_IntReal);
  }
  if( pMem->flags & (MEM_Str|MEM_Blob) ){
    testcase( pMem->flags & MEM_Str );
    testcase( pMem->flags & MEM_Blob );
    return computeNumericType(pMem);
  }
  return 0;
}

#ifdef SQLITE_DEBUG
/*
84001
84002
84003
84004
84005
84006
84007


84008
84009
84010
84011
84012
84013
84014
84251
84252
84253
84254
84255
84256
84257
84258
84259
84260
84261
84262
84263
84264
84265
84266







+
+







static void memTracePrint(Mem *p){
  if( p->flags & MEM_Undefined ){
    printf(" undefined");
  }else if( p->flags & MEM_Null ){
    printf(p->flags & MEM_Zero ? " NULL-nochng" : " NULL");
  }else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){
    printf(" si:%lld", p->u.i);
  }else if( (p->flags & (MEM_IntReal))!=0 ){
    printf(" ir:%lld", p->u.i);
  }else if( p->flags & MEM_Int ){
    printf(" i:%lld", p->u.i);
#ifndef SQLITE_OMIT_FLOATING_POINT
  }else if( p->flags & MEM_Real ){
    printf(" r:%g", p->u.r);
#endif
  }else if( sqlite3VdbeMemIsRowSet(p) ){
85031
85032
85033
85034
85035
85036
85037
85038



85039
85040
85041
85042


85043



85044

85045
85046
85047




85048
85049
85050











85051
85052
85053
85054
85055

85056
85057
85058
85059
85060


85061
85062


85063
85064

85065
85066
85067
85068
85069
85070
85071
85283
85284
85285
85286
85287
85288
85289

85290
85291
85292
85293
85294
85295
85296
85297
85298
85299
85300
85301
85302

85303
85304
85305
85306
85307
85308
85309
85310



85311
85312
85313
85314
85315
85316
85317
85318
85319
85320
85321
85322
85323
85324
85325

85326
85327
85328
85329
85330
85331
85332
85333
85334
85335
85336
85337
85338
85339
85340
85341
85342
85343
85344
85345
85346
85347







-
+
+
+




+
+

+
+
+
-
+



+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+




-
+





+
+


+
+


+







**   P3 = P2 || P1
**
** It is illegal for P1 and P3 to be the same register. Sometimes,
** if P3 is the same register as P2, the implementation is able
** to avoid a memcpy().
*/
case OP_Concat: {           /* same as TK_CONCAT, in1, in2, out3 */
  i64 nByte;
  i64 nByte;          /* Total size of the output string or blob */
  u16 flags1;         /* Initial flags for P1 */
  u16 flags2;         /* Initial flags for P2 */

  pIn1 = &aMem[pOp->p1];
  pIn2 = &aMem[pOp->p2];
  pOut = &aMem[pOp->p3];
  testcase( pIn1==pIn2 );
  testcase( pOut==pIn2 );
  assert( pIn1!=pOut );
  flags1 = pIn1->flags;
  testcase( flags1 & MEM_Null );
  testcase( pIn2->flags & MEM_Null );
  if( (pIn1->flags | pIn2->flags) & MEM_Null ){
  if( (flags1 | pIn2->flags) & MEM_Null ){
    sqlite3VdbeMemSetNull(pOut);
    break;
  }
  if( (flags1 & (MEM_Str|MEM_Blob))==0 ){
    if( sqlite3VdbeMemStringify(pIn1,encoding,0) ) goto no_mem;
    flags1 = pIn1->flags & ~MEM_Str;
  }else if( (flags1 & MEM_Zero)!=0 ){
  if( ExpandBlob(pIn1) || ExpandBlob(pIn2) ) goto no_mem;
  Stringify(pIn1, encoding);
  Stringify(pIn2, encoding);
    if( sqlite3VdbeMemExpandBlob(pIn1) ) goto no_mem;
    flags1 = pIn1->flags & ~MEM_Str;
  }
  flags2 = pIn2->flags;
  if( (flags2 & (MEM_Str|MEM_Blob))==0 ){
    if( sqlite3VdbeMemStringify(pIn2,encoding,0) ) goto no_mem;
    flags2 = pIn2->flags & ~MEM_Str;
  }else if( (flags2 & MEM_Zero)!=0 ){
    if( sqlite3VdbeMemExpandBlob(pIn2) ) goto no_mem;
    flags2 = pIn2->flags & ~MEM_Str;
  }
  nByte = pIn1->n + pIn2->n;
  if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){
    goto too_big;
  }
  if( sqlite3VdbeMemGrow(pOut, (int)nByte+2, pOut==pIn2) ){
  if( sqlite3VdbeMemGrow(pOut, (int)nByte+3, pOut==pIn2) ){
    goto no_mem;
  }
  MemSetTypeFlag(pOut, MEM_Str);
  if( pOut!=pIn2 ){
    memcpy(pOut->z, pIn2->z, pIn2->n);
    assert( (pIn2->flags & MEM_Dyn) == (flags2 & MEM_Dyn) );
    pIn2->flags = flags2;
  }
  memcpy(&pOut->z[pIn2->n], pIn1->z, pIn1->n);
  assert( (pIn1->flags & MEM_Dyn) == (flags1 & MEM_Dyn) );
  pIn1->flags = flags1;
  pOut->z[nByte]=0;
  pOut->z[nByte+1] = 0;
  pOut->z[nByte+2] = 0;
  pOut->flags |= MEM_Term;
  pOut->n = (int)nByte;
  pOut->enc = encoding;
  UPDATE_MAX_BLOBSIZE(pOut);
  break;
}

85108
85109
85110
85111
85112
85113
85114
85115
85116
85117
85118
85119
85120
85121
85122
85123
85124
85125
85126
85127
85128
85129
85130
85131
85132
85133
85134
85135
85136
85137
85138
85139
85140
85384
85385
85386
85387
85388
85389
85390

85391
85392
85393
85394
85395
85396
85397
85398
85399
85400
85401
85402
85403
85404
85405
85406
85407

85408
85409
85410
85411
85412
85413
85414







-

















-







** If either operand is NULL, the result is NULL.
*/
case OP_Add:                   /* same as TK_PLUS, in1, in2, out3 */
case OP_Subtract:              /* same as TK_MINUS, in1, in2, out3 */
case OP_Multiply:              /* same as TK_STAR, in1, in2, out3 */
case OP_Divide:                /* same as TK_SLASH, in1, in2, out3 */
case OP_Remainder: {           /* same as TK_REM, in1, in2, out3 */
  char bIntint;   /* Started out as two integer operands */
  u16 flags;      /* Combined MEM_* flags from both inputs */
  u16 type1;      /* Numeric type of left operand */
  u16 type2;      /* Numeric type of right operand */
  i64 iA;         /* Integer value of left operand */
  i64 iB;         /* Integer value of right operand */
  double rA;      /* Real value of left operand */
  double rB;      /* Real value of right operand */

  pIn1 = &aMem[pOp->p1];
  type1 = numericType(pIn1);
  pIn2 = &aMem[pOp->p2];
  type2 = numericType(pIn2);
  pOut = &aMem[pOp->p3];
  flags = pIn1->flags | pIn2->flags;
  if( (type1 & type2 & MEM_Int)!=0 ){
    iA = pIn1->u.i;
    iB = pIn2->u.i;
    bIntint = 1;
    switch( pOp->opcode ){
      case OP_Add:       if( sqlite3AddInt64(&iB,iA) ) goto fp_math;  break;
      case OP_Subtract:  if( sqlite3SubInt64(&iB,iA) ) goto fp_math;  break;
      case OP_Multiply:  if( sqlite3MulInt64(&iB,iA) ) goto fp_math;  break;
      case OP_Divide: {
        if( iA==0 ) goto arithmetic_result_is_null;
        if( iA==-1 && iB==SMALLEST_INT64 ) goto fp_math;
85149
85150
85151
85152
85153
85154
85155
85156
85157
85158
85159
85160
85161
85162
85163
85423
85424
85425
85426
85427
85428
85429

85430
85431
85432
85433
85434
85435
85436







-







      }
    }
    pOut->u.i = iB;
    MemSetTypeFlag(pOut, MEM_Int);
  }else if( (flags & MEM_Null)!=0 ){
    goto arithmetic_result_is_null;
  }else{
    bIntint = 0;
fp_math:
    rA = sqlite3VdbeRealValue(pIn1);
    rB = sqlite3VdbeRealValue(pIn2);
    switch( pOp->opcode ){
      case OP_Add:         rB += rA;       break;
      case OP_Subtract:    rB -= rA;       break;
      case OP_Multiply:    rB *= rA;       break;
85181
85182
85183
85184
85185
85186
85187
85188
85189
85190
85191
85192
85193
85194
85195
85196
85197
85454
85455
85456
85457
85458
85459
85460



85461
85462
85463
85464
85465
85466
85467







-
-
-







    MemSetTypeFlag(pOut, MEM_Int);
#else
    if( sqlite3IsNaN(rB) ){
      goto arithmetic_result_is_null;
    }
    pOut->u.r = rB;
    MemSetTypeFlag(pOut, MEM_Real);
    if( ((type1|type2)&MEM_Real)==0 && !bIntint ){
      sqlite3VdbeIntegerAffinity(pOut);
    }
#endif
  }
  break;

arithmetic_result_is_null:
  sqlite3VdbeMemSetNull(pOut);
  break;
85352
85353
85354
85355
85356
85357
85358

85359


85360
85361
85362
85363
85364
85365
85366
85622
85623
85624
85625
85626
85627
85628
85629

85630
85631
85632
85633
85634
85635
85636
85637
85638







+
-
+
+







** This opcode is used when extracting information from a column that
** has REAL affinity.  Such column values may still be stored as
** integers, for space efficiency, but after extraction we want them
** to have only a real value.
*/
case OP_RealAffinity: {                  /* in1 */
  pIn1 = &aMem[pOp->p1];
  if( pIn1->flags & (MEM_Int|MEM_IntReal) ){
  if( pIn1->flags & MEM_Int ){
    testcase( pIn1->flags & MEM_Int );
    testcase( pIn1->flags & MEM_IntReal );
    sqlite3VdbeMemRealify(pIn1);
  }
  break;
}
#endif

#ifndef SQLITE_OMIT_CAST
85544
85545
85546
85547
85548
85549
85550
85551

85552
85553
85554
85555
85556
85557
85558
85559
85560
85561

85562
85563
85564
85565
85566
85567
85568
85569
85570
85571
85572
85573
85574

85575
85576

85577
85578
85579
85580
85581
85582

85583
85584

85585
85586
85587
85588
85589
85590
85591
85816
85817
85818
85819
85820
85821
85822

85823
85824
85825
85826
85827
85828
85829
85830
85831
85832

85833
85834
85835
85836
85837
85838
85839
85840
85841
85842
85843
85844
85845

85846
85847
85848
85849
85850
85851
85852
85853
85854

85855
85856
85857
85858
85859
85860
85861
85862
85863
85864
85865







-
+









-
+












-
+


+





-
+


+







      break;
    }
  }else{
    /* Neither operand is NULL.  Do a comparison. */
    affinity = pOp->p5 & SQLITE_AFF_MASK;
    if( affinity>=SQLITE_AFF_NUMERIC ){
      if( (flags1 | flags3)&MEM_Str ){
        if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
        if( (flags1 & (MEM_Int|MEM_IntReal|MEM_Real|MEM_Str))==MEM_Str ){
          applyNumericAffinity(pIn1,0);
          assert( flags3==pIn3->flags );
          /* testcase( flags3!=pIn3->flags );
          ** this used to be possible with pIn1==pIn3, but not since
          ** the column cache was removed.  The following assignment
          ** is essentially a no-op.  But, it provides defense-in-depth
          ** in case our analysis is incorrect, so it is left in. */
          flags3 = pIn3->flags;
        }
        if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
        if( (flags3 & (MEM_Int|MEM_IntReal|MEM_Real|MEM_Str))==MEM_Str ){
          applyNumericAffinity(pIn3,0);
        }
      }
      /* Handle the common case of integer comparison here, as an
      ** optimization, to avoid a call to sqlite3MemCompare() */
      if( (pIn1->flags & pIn3->flags & MEM_Int)!=0 ){
        if( pIn3->u.i > pIn1->u.i ){ res = +1; goto compare_op; }
        if( pIn3->u.i < pIn1->u.i ){ res = -1; goto compare_op; }
        res = 0;
        goto compare_op;
      }
    }else if( affinity==SQLITE_AFF_TEXT ){
      if( (flags1 & MEM_Str)==0 && (flags1 & (MEM_Int|MEM_Real))!=0 ){
      if( (flags1 & MEM_Str)==0 && (flags1&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){
        testcase( pIn1->flags & MEM_Int );
        testcase( pIn1->flags & MEM_Real );
        testcase( pIn1->flags & MEM_IntReal );
        sqlite3VdbeMemStringify(pIn1, encoding, 1);
        testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) );
        flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);
        assert( pIn1!=pIn3 );
      }
      if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){
      if( (flags3 & MEM_Str)==0 && (flags3&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){
        testcase( pIn3->flags & MEM_Int );
        testcase( pIn3->flags & MEM_Real );
        testcase( pIn3->flags & MEM_IntReal );
        sqlite3VdbeMemStringify(pIn3, encoding, 1);
        testcase( (flags3&MEM_Dyn) != (pIn3->flags&MEM_Dyn) );
        flags3 = (pIn3->flags & ~MEM_TypeMask) | (flags3 & MEM_TypeMask);
      }
    }
    assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 );
    res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl);
86333
86334
86335
86336
86337
86338
86339
86340

86341
86342
86343










86344
86345

86346
86347
86348
86349
86350
86351
86352
86353
86354
86355
86356
86357
86358
86359
86360
86361
86362
86363
86364
86365
86366
86367
86368
86369
86370
86371
86372
86373
86374
86375
86376
86377
86378
86379
86380
86381


86382
86383
86384
86385
86386
86387
86388
86607
86608
86609
86610
86611
86612
86613

86614
86615
86616

86617
86618
86619
86620
86621
86622
86623
86624
86625
86626
86627

86628
86629
86630
86631
86632
86633
86634
86635
86636
86637
86638
86639
86640
86641
86642
86643
86644
86645
86646
86647
86648

86649
86650
86651
86652
86653
86654
86655
86656
86657
86658
86659
86660


86661
86662
86663
86664
86665
86666
86667
86668
86669
86670







-
+


-
+
+
+
+
+
+
+
+
+
+

-
+




















-












-
-

+
+







  const char *zAffinity;   /* The affinity to be applied */

  zAffinity = pOp->p4.z;
  assert( zAffinity!=0 );
  assert( pOp->p2>0 );
  assert( zAffinity[pOp->p2]==0 );
  pIn1 = &aMem[pOp->p1];
  do{
  while( 1 /*edit-by-break*/ ){
    assert( pIn1 <= &p->aMem[(p->nMem+1 - p->nCursor)] );
    assert( memIsValid(pIn1) );
    applyAffinity(pIn1, *(zAffinity++), encoding);
    applyAffinity(pIn1, zAffinity[0], encoding);
    if( zAffinity[0]==SQLITE_AFF_REAL && (pIn1->flags & MEM_Int)!=0 ){
      /* When applying REAL affinity, if the result is still MEM_Int, 
      ** indicate that REAL is actually desired */
      pIn1->flags |= MEM_IntReal;
      pIn1->flags &= ~MEM_Int;
    }
    REGISTER_TRACE((int)(pIn1-aMem), pIn1);
    zAffinity++;
    if( zAffinity[0]==0 ) break;
    pIn1++;
  }while( zAffinity[0] );
  }
  break;
}

/* Opcode: MakeRecord P1 P2 P3 P4 *
** Synopsis: r[P3]=mkrec(r[P1@P2])
**
** Convert P2 registers beginning with P1 into the [record format]
** use as a data record in a database table or as a key
** in an index.  The OP_Column opcode can decode the record later.
**
** P4 may be a string that is P2 characters long.  The N-th character of the
** string indicates the column affinity that should be used for the N-th
** field of the index key.
**
** The mapping from character to affinity is given by the SQLITE_AFF_
** macros defined in sqliteInt.h.
**
** If P4 is NULL then all index fields have the affinity BLOB.
*/
case OP_MakeRecord: {
  u8 *zNewRecord;        /* A buffer to hold the data for the new record */
  Mem *pRec;             /* The new record */
  u64 nData;             /* Number of bytes of data space */
  int nHdr;              /* Number of bytes of header space */
  i64 nByte;             /* Data space required for this record */
  i64 nZero;             /* Number of zero bytes at the end of the record */
  int nVarint;           /* Number of bytes in a varint */
  u32 serial_type;       /* Type field */
  Mem *pData0;           /* First field to be combined into the record */
  Mem *pLast;            /* Last field of the record */
  int nField;            /* Number of fields in the record */
  char *zAffinity;       /* The affinity string for the record */
  int file_format;       /* File format to use for encoding */
  int i;                 /* Space used in zNewRecord[] header */
  int j;                 /* Space used in zNewRecord[] content */
  u32 len;               /* Length of a field */
  u8 *zHdr;              /* Where to write next byte of the header */
  u8 *zPayload;          /* Where to write next byte of the payload */

  /* Assuming the record contains N fields, the record format looks
  ** like this:
  **
  ** ------------------------------------------------------------------------
  ** | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 | 
  ** ------------------------------------------------------------------------
86413
86414
86415
86416
86417
86418
86419
86420








86421
86422
86423
86424
86425
86426
86427
86695
86696
86697
86698
86699
86700
86701

86702
86703
86704
86705
86706
86707
86708
86709
86710
86711
86712
86713
86714
86715
86716







-
+
+
+
+
+
+
+
+








  /* Apply the requested affinity to all inputs
  */
  assert( pData0<=pLast );
  if( zAffinity ){
    pRec = pData0;
    do{
      applyAffinity(pRec++, *(zAffinity++), encoding);
      applyAffinity(pRec, zAffinity[0], encoding);
      if( zAffinity[0]==SQLITE_AFF_REAL && (pRec->flags & MEM_Int) ){
        pRec->flags |= MEM_IntReal;
        pRec->flags &= ~(MEM_Int);
      }
      REGISTER_TRACE((int)(pRec-aMem), pRec);
      zAffinity++;
      pRec++;
      assert( zAffinity[0]==0 || pRec<=pLast );
    }while( zAffinity[0] );
  }

#ifdef SQLITE_ENABLE_NULL_TRIM
  /* NULLs can be safely trimmed from the end of the record, as long as
  ** as the schema format is 2 or more and none of the omitted columns
86501
86502
86503
86504
86505
86506
86507







86508


86509
86510
86511

86512
86513
86514
86515
86516
86517
86518
86519

86520
86521
86522

86523
86524
86525


86526
86527
86528
86529
86530
86531
86532
86533
86534
86535
86536
86537
86538
86539
86540
86541
86542
86790
86791
86792
86793
86794
86795
86796
86797
86798
86799
86800
86801
86802
86803

86804
86805
86806
86807

86808

86809
86810
86811
86812
86813
86814

86815
86816
86817

86818
86819


86820
86821
86822
86823






86824

86825
86826
86827
86828
86829
86830
86831







+
+
+
+
+
+
+
-
+
+


-
+
-






-
+


-
+

-
-
+
+


-
-
-
-
-
-

-







    if( nByte+nZero>db->aLimit[SQLITE_LIMIT_LENGTH] ){
      goto too_big;
    }
    if( sqlite3VdbeMemClearAndResize(pOut, (int)nByte) ){
      goto no_mem;
    }
  }
  pOut->n = (int)nByte;
  pOut->flags = MEM_Blob;
  if( nZero ){
    pOut->u.nZero = nZero;
    pOut->flags |= MEM_Zero;
  }
  UPDATE_MAX_BLOBSIZE(pOut);
  zNewRecord = (u8 *)pOut->z;
  zHdr = (u8 *)pOut->z;
  zPayload = zHdr + nHdr;

  /* Write the record */
  i = putVarint32(zNewRecord, nHdr);
  zHdr += putVarint32(zHdr, nHdr);
  j = nHdr;
  assert( pData0<=pLast );
  pRec = pData0;
  do{
    serial_type = pRec->uTemp;
    /* EVIDENCE-OF: R-06529-47362 Following the size varint are one or more
    ** additional varints, one per column. */
    i += putVarint32(&zNewRecord[i], serial_type);            /* serial type */
    zHdr += putVarint32(zHdr, serial_type);            /* serial type */
    /* EVIDENCE-OF: R-64536-51728 The values for each column in the record
    ** immediately follow the header. */
    j += sqlite3VdbeSerialPut(&zNewRecord[j], pRec, serial_type); /* content */
    zPayload += sqlite3VdbeSerialPut(zPayload, pRec, serial_type); /* content */
  }while( (++pRec)<=pLast );
  assert( i==nHdr );
  assert( j==nByte );
  assert( nHdr==(int)(zHdr - (u8*)pOut->z) );
  assert( nByte==(int)(zPayload - (u8*)pOut->z) );

  assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
  pOut->n = (int)nByte;
  pOut->flags = MEM_Blob;
  if( nZero ){
    pOut->u.nZero = nZero;
    pOut->flags |= MEM_Zero;
  }
  REGISTER_TRACE(pOp->p3, pOut);
  UPDATE_MAX_BLOBSIZE(pOut);
  break;
}

/* Opcode: Count P1 P2 * * *
** Synopsis: r[P2]=count()
**
** Store the number of entries (an integer value) in the table or index 
86558
86559
86560
86561
86562
86563
86564
86565
86566



86567
86568
86569
86570
86571
86572
86573
86847
86848
86849
86850
86851
86852
86853


86854
86855
86856
86857
86858
86859
86860
86861
86862
86863







-
-
+
+
+







  break;
}
#endif

/* Opcode: Savepoint P1 * * P4 *
**
** Open, release or rollback the savepoint named by parameter P4, depending
** on the value of P1. To open a new savepoint, P1==0. To release (commit) an
** existing savepoint, P1==1, or to rollback an existing savepoint P1==2.
** on the value of P1. To open a new savepoint set P1==0 (SAVEPOINT_BEGIN).
** To release (commit) an existing savepoint set P1==1 (SAVEPOINT_RELEASE).
** To rollback an existing savepoint set P1==2 (SAVEPOINT_ROLLBACK).
*/
case OP_Savepoint: {
  int p1;                         /* Value of P1 operand */
  char *zName;                    /* Name of savepoint */
  int nName;
  Savepoint *pNew;
  Savepoint *pSavepoint;
86627
86628
86629
86630
86631
86632
86633

86634
86635
86636
86637
86638
86639
86640
86917
86918
86919
86920
86921
86922
86923
86924
86925
86926
86927
86928
86929
86930
86931







+







        pNew->pNext = db->pSavepoint;
        db->pSavepoint = pNew;
        pNew->nDeferredCons = db->nDeferredCons;
        pNew->nDeferredImmCons = db->nDeferredImmCons;
      }
    }
  }else{
    assert( p1==SAVEPOINT_RELEASE || p1==SAVEPOINT_ROLLBACK );
    iSavepoint = 0;

    /* Find the named savepoint. If there is no such savepoint, then an
    ** an error is returned to the user.  */
    for(
      pSavepoint = db->pSavepoint; 
      pSavepoint && sqlite3StrICmp(pSavepoint->zName, zName);
86680
86681
86682
86683
86684
86685
86686

86687
86688
86689
86690
86691
86692
86693
86971
86972
86973
86974
86975
86976
86977
86978
86979
86980
86981
86982
86983
86984
86985







+







          for(ii=0; ii<db->nDb; ii++){
            rc = sqlite3BtreeTripAllCursors(db->aDb[ii].pBt,
                                       SQLITE_ABORT_ROLLBACK,
                                       isSchemaChange==0);
            if( rc!=SQLITE_OK ) goto abort_due_to_error;
          }
        }else{
          assert( p1==SAVEPOINT_RELEASE );
          isSchemaChange = 0;
        }
        for(ii=0; ii<db->nDb; ii++){
          rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint);
          if( rc!=SQLITE_OK ){
            goto abort_due_to_error;
          }
86716
86717
86718
86719
86720
86721
86722

86723
86724
86725
86726
86727
86728
86729
87008
87009
87010
87011
87012
87013
87014
87015
87016
87017
87018
87019
87020
87021
87022







+







        assert( pSavepoint==db->pSavepoint );
        db->pSavepoint = pSavepoint->pNext;
        sqlite3DbFree(db, pSavepoint);
        if( !isTransaction ){
          db->nSavepoint--;
        }
      }else{
        assert( p1==SAVEPOINT_ROLLBACK );
        db->nDeferredCons = pSavepoint->nDeferredCons;
        db->nDeferredImmCons = pSavepoint->nDeferredImmCons;
      }

      if( !isTransaction || p1==SAVEPOINT_ROLLBACK ){
        rc = sqlite3VtabSavepoint(db, p1, iSavepoint);
        if( rc!=SQLITE_OK ) goto abort_due_to_error;
87254
87255
87256
87257
87258
87259
87260




87261


87262
87263
87264
87265
87266
87267
87268
87269
87270
87271
87272
87547
87548
87549
87550
87551
87552
87553
87554
87555
87556
87557

87558
87559
87560
87561
87562

87563
87564
87565
87566
87567
87568
87569







+
+
+
+
-
+
+



-







      SQLITE_OPEN_TRANSIENT_DB;
  assert( pOp->p1>=0 );
  assert( pOp->p2>=0 );
  pCx = p->apCsr[pOp->p1];
  if( pCx ){
    /* If the ephermeral table is already open, erase all existing content
    ** so that the table is empty again, rather than creating a new table. */
    assert( pCx->isEphemeral );
    pCx->seqCount = 0;
    pCx->cacheStatus = CACHE_STALE;
    if( pCx->pBtx ){
    rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0);
      rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0);
    }
  }else{
    pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE);
    if( pCx==0 ) goto no_mem;
    pCx->nullRow = 1;
    pCx->isEphemeral = 1;
    rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx, 
                          BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5,
                          vfsFlags);
    if( rc==SQLITE_OK ){
      rc = sqlite3BtreeBeginTrans(pCx->pBtx, 1, 0);
    }
87294
87295
87296
87297
87298
87299
87300

87301
87302
87303
87304
87305
87306
87307
87591
87592
87593
87594
87595
87596
87597
87598
87599
87600
87601
87602
87603
87604
87605







+







                                0, pCx->uc.pCursor);
        pCx->isTable = 1;
      }
    }
    pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
  }
  if( rc ) goto abort_due_to_error;
  pCx->nullRow = 1;
  break;
}

/* Opcode: SorterOpen P1 P2 P3 P4 *
**
** This opcode works like OP_OpenEphemeral except that it opens
** a transient index that is specifically designed to sort large
87522
87523
87524
87525
87526
87527
87528


87529
87530
87531
87532
87533
87534
87535
87536
87537
87538

87539
87540
87541
87542
87543
87544
87545

87546
87547

87548
87549
87550
87551








87552
87553
87554
87555
87556
87557
87558
87820
87821
87822
87823
87824
87825
87826
87827
87828
87829
87830
87831
87832
87833
87834
87835
87836
87837

87838
87839
87840
87841
87842
87843
87844

87845
87846

87847




87848
87849
87850
87851
87852
87853
87854
87855
87856
87857
87858
87859
87860
87861
87862







+
+









-
+






-
+

-
+
-
-
-
-
+
+
+
+
+
+
+
+







  oc = pOp->opcode;
  eqOnly = 0;
  pC->nullRow = 0;
#ifdef SQLITE_DEBUG
  pC->seekOp = pOp->opcode;
#endif

  pC->deferredMoveto = 0;
  pC->cacheStatus = CACHE_STALE;
  if( pC->isTable ){
    /* The BTREE_SEEK_EQ flag is only set on index cursors */
    assert( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ)==0
              || CORRUPT_DB );

    /* The input value in P3 might be of any type: integer, real, string,
    ** blob, or NULL.  But it needs to be an integer before we can do
    ** the seek, so convert it. */
    pIn3 = &aMem[pOp->p3];
    if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
    if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_IntReal|MEM_Str))==MEM_Str ){
      applyNumericAffinity(pIn3, 0);
    }
    iKey = sqlite3VdbeIntValue(pIn3);

    /* If the P3 value could not be converted into an integer without
    ** loss of information, then special processing is required... */
    if( (pIn3->flags & MEM_Int)==0 ){
    if( (pIn3->flags & (MEM_Int|MEM_IntReal))==0 ){
      if( (pIn3->flags & MEM_Real)==0 ){
        /* If the P3 value cannot be converted into any kind of a number,
        if( (pIn3->flags & MEM_Null) || oc>=OP_SeekGE ){
        ** then the seek is not possible, so jump to P2 */
        VdbeBranchTaken(1,2); goto jump_to_p2;
        break;
      }
          VdbeBranchTaken(1,2); goto jump_to_p2;
          break;
        }else{
          rc = sqlite3BtreeLast(pC->uc.pCursor, &res);
          if( rc!=SQLITE_OK ) goto abort_due_to_error;
          goto seek_not_found;
        }
      }else

      /* If the approximation iKey is larger than the actual real search
      ** term, substitute >= for > and < for <=. e.g. if the search term
      ** is 4.9 and the integer approximation 5:
      **
      **        (x >  4.9)    ->     (x >= 5)
      **        (x <= 4.9)    ->     (x <  5)
87568
87569
87570
87571
87572
87573
87574
87575

87576
87577
87578
87579
87580
87581
87582
87872
87873
87874
87875
87876
87877
87878

87879
87880
87881
87882
87883
87884
87885
87886







-
+







      ** term, substitute <= for < and > for >=.  */
      else if( pIn3->u.r>(double)iKey ){
        assert( OP_SeekLE==(OP_SeekLT+1) );
        assert( OP_SeekGT==(OP_SeekGE+1) );
        assert( (OP_SeekLT & 0x0001)==(OP_SeekGE & 0x0001) );
        if( (oc & 0x0001)==(OP_SeekLT & 0x0001) ) oc++;
      }
    } 
    }
    rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)iKey, 0, &res);
    pC->movetoTarget = iKey;  /* Used by OP_Delete */
    if( rc!=SQLITE_OK ){
      goto abort_due_to_error;
    }
  }else{
    /* For a cursor with the BTREE_SEEK_EQ hint, only the OP_SeekGE and
87622
87623
87624
87625
87626
87627
87628
87629
87630
87631
87632
87633
87634
87635
87636
87637
87926
87927
87928
87929
87930
87931
87932


87933
87934
87935
87936
87937
87938
87939







-
-







      goto abort_due_to_error;
    }
    if( eqOnly && r.eqSeen==0 ){
      assert( res!=0 );
      goto seek_not_found;
    }
  }
  pC->deferredMoveto = 0;
  pC->cacheStatus = CACHE_STALE;
#ifdef SQLITE_TEST
  sqlite3_search_count++;
#endif
  if( oc>=OP_SeekGE ){  assert( oc==OP_SeekGE || oc==OP_SeekGT );
    if( res<0 || (res==0 && oc==OP_SeekGT) ){
      res = 0;
      rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
87923
87924
87925
87926
87927
87928
87929


87930

87931
87932
87933
87934
87935
87936
87937
88225
88226
88227
88228
88229
88230
88231
88232
88233

88234
88235
88236
88237
88238
88239
88240
88241







+
+
-
+







case OP_SeekRowid: {        /* jump, in3 */
  VdbeCursor *pC;
  BtCursor *pCrsr;
  int res;
  u64 iKey;

  pIn3 = &aMem[pOp->p3];
  testcase( pIn3->flags & MEM_Int );
  testcase( pIn3->flags & MEM_IntReal );
  if( (pIn3->flags & MEM_Int)==0 ){
  if( (pIn3->flags & (MEM_Int|MEM_IntReal))==0 ){
    /* Make sure pIn3->u.i contains a valid integer representation of
    ** the key value, but do not change the datatype of the register, as
    ** other parts of the perpared statement might be depending on the
    ** current datatype. */
    u16 origFlags = pIn3->flags;
    int isNotInt;
    applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding);
88298
88299
88300
88301
88302
88303
88304
88305

88306
88307
88308
88309
88310
88311
88312
88602
88603
88604
88605
88606
88607
88608

88609
88610
88611
88612
88613
88614
88615
88616







-
+








#ifdef SQLITE_DEBUG
  if( pOp->p4type==P4_TABLE && HasRowid(pOp->p4.pTab) && pOp->p5==0 ){
    /* If p5 is zero, the seek operation that positioned the cursor prior to
    ** OP_Delete will have also set the pC->movetoTarget field to the rowid of
    ** the row that is being deleted */
    i64 iKey = sqlite3BtreeIntegerKey(pC->uc.pCursor);
    assert( pC->movetoTarget==iKey );
    assert( CORRUPT_DB || pC->movetoTarget==iKey );
  }
#endif

  /* If the update-hook or pre-update-hook will be invoked, set zDb to
  ** the name of the db to pass as to it. Also set local pTab to a copy
  ** of p4.pTab. Finally, if p5 is true, indicating that this cursor was
  ** last moved with OP_Next or OP_Prev, not Seek or NotFound, set 
95256
95257
95258
95259
95260
95261
95262

















95263
95264
95265
95266
95267
95268
95269
95560
95561
95562
95563
95564
95565
95566
95567
95568
95569
95570
95571
95572
95573
95574
95575
95576
95577
95578
95579
95580
95581
95582
95583
95584
95585
95586
95587
95588
95589
95590







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







  }
  zSpan += n+1;
  if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){
    return 0;
  }
  return 1;
}

/*
** Return TRUE if the double-quoted string  mis-feature should be supported.
*/
static int areDoubleQuotedStringsEnabled(sqlite3 *db, NameContext *pTopNC){
  if( db->init.busy ) return 1;  /* Always support for legacy schemas */
  if( pTopNC->ncFlags & NC_IsDDL ){
    /* Currently parsing a DDL statement */
    if( sqlite3WritableSchema(db) && (db->flags & SQLITE_DqsDML)!=0 ){
      return 1;
    }
    return (db->flags & SQLITE_DqsDDL)!=0;
  }else{
    /* Currently parsing a DML statement */
    return (db->flags & SQLITE_DqsDML)!=0;
  }
}

/*
** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up
** that name in the set of source tables in pSrcList and make the pExpr 
** expression node refer back to that source column.  The following changes
** are made to pExpr:
**
95585
95586
95587
95588
95589
95590
95591
95592



95593
95594
95595
95596
95597
95598
95599
95906
95907
95908
95909
95910
95911
95912

95913
95914
95915
95916
95917
95918
95919
95920
95921
95922







-
+
+
+







  ** pExpr.
  **
  ** Because no reference was made to outer contexts, the pNC->nRef
  ** fields are not changed in any context.
  */
  if( cnt==0 && zTab==0 ){
    assert( pExpr->op==TK_ID );
    if( ExprHasProperty(pExpr,EP_DblQuoted) ){
    if( ExprHasProperty(pExpr,EP_DblQuoted)
     && areDoubleQuotedStringsEnabled(db, pTopNC)
    ){
      /* If a double-quoted identifier does not match any known column name,
      ** then treat it as a string.
      **
      ** This hack was added in the early days of SQLite in a misguided attempt
      ** to be compatible with MySQL 3.x, which used double-quotes for strings.
      ** I now sorely regret putting in this hack. The effect of this hack is
      ** that misspelled identifier names are silently converted into strings
95854
95855
95856
95857
95858
95859
95860
95861

95862
95863
95864
95865
95866
95867
95868
96177
96178
96179
96180
96181
96182
96183

96184
96185
96186
96187
96188
96189
96190
96191







-
+







          no_such_func = 1;
        }else{
          wrong_num_args = 1;
        }
      }else{
        is_agg = pDef->xFinalize!=0;
        if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){
          ExprSetProperty(pExpr, EP_Unlikely|EP_Skip);
          ExprSetProperty(pExpr, EP_Unlikely);
          if( n==2 ){
            pExpr->iTable = exprProbability(pList->a[1].pExpr);
            if( pExpr->iTable<0 ){
              sqlite3ErrorMsg(pParse,
                "second argument to likelihood() must be a "
                "constant between 0.0 and 1.0");
              pNC->nErr++;
95975
95976
95977
95978
95979
95980
95981

95982


95983
95984
95985
95986
95987
95988
95989
96298
96299
96300
96301
96302
96303
96304
96305

96306
96307
96308
96309
96310
96311
96312
96313
96314







+
-
+
+







        }
      }
      sqlite3WalkExprList(pWalker, pList);
      if( is_agg ){
#ifndef SQLITE_OMIT_WINDOWFUNC
        if( pExpr->y.pWin ){
          Select *pSel = pNC->pWinSelect;
          if( IN_RENAME_OBJECT==0 ){
          sqlite3WindowUpdate(pParse, pSel->pWinDefn, pExpr->y.pWin, pDef);
            sqlite3WindowUpdate(pParse, pSel->pWinDefn, pExpr->y.pWin, pDef);
          }
          sqlite3WalkExprList(pWalker, pExpr->y.pWin->pPartition);
          sqlite3WalkExprList(pWalker, pExpr->y.pWin->pOrderBy);
          sqlite3WalkExpr(pWalker, pExpr->y.pWin->pFilter);
          if( 0==pSel->pWin 
           || 0==sqlite3WindowCompare(pParse, pSel->pWin, pExpr->y.pWin) 
          ){
            pExpr->y.pWin->pNextWin = pSel->pWin;
96035
96036
96037
96038
96039
96040
96041
96042

96043
96044
96045
96046

96047
96048
96049
96050
96051
96052
96053
96360
96361
96362
96363
96364
96365
96366

96367
96368
96369
96370

96371
96372
96373
96374
96375
96376
96377
96378







-
+



-
+







    }
    case TK_VARIABLE: {
      notValid(pParse, pNC, "parameters", NC_IsCheck|NC_PartIdx|NC_IdxExpr);
      break;
    }
    case TK_IS:
    case TK_ISNOT: {
      Expr *pRight;
      Expr *pRight = sqlite3ExprSkipCollate(pExpr->pRight);
      assert( !ExprHasProperty(pExpr, EP_Reduced) );
      /* Handle special cases of "x IS TRUE", "x IS FALSE", "x IS NOT TRUE",
      ** and "x IS NOT FALSE". */
      if( (pRight = pExpr->pRight)->op==TK_ID ){
      if( pRight->op==TK_ID ){
        int rc = resolveExprStep(pWalker, pRight);
        if( rc==WRC_Abort ) return WRC_Abort;
        if( pRight->op==TK_TRUEFALSE ){
          pExpr->op2 = pExpr->op;
          pExpr->op = TK_TRUTH;
          return WRC_Continue;
        }
96761
96762
96763
96764
96765
96766
96767
96768

96769
96770
96771
96772
96773
96774
96775
97086
97087
97088
97089
97090
97091
97092

97093
97094
97095
97096
97097
97098
97099
97100







-
+







** An error message is left in pParse if anything is amiss.  The number
** if errors is returned.
*/
SQLITE_PRIVATE int sqlite3ResolveExprNames( 
  NameContext *pNC,       /* Namespace to resolve expressions in. */
  Expr *pExpr             /* The expression to be analyzed. */
){
  u16 savedHasAgg;
  int savedHasAgg;
  Walker w;

  if( pExpr==0 ) return SQLITE_OK;
  savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin);
  pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin);
  w.pParse = pNC->pParse;
  w.xExprCallback = resolveExprStep;
96875
96876
96877
96878
96879
96880
96881
96882

96883
96884
96885
96886
96887
96888
96889
97200
97201
97202
97203
97204
97205
97206

97207
97208
97209
97210
97211
97212
97213
97214







-
+







    sSrc.nSrc = 1;
    sSrc.a[0].zName = pTab->zName;
    sSrc.a[0].pTab = pTab;
    sSrc.a[0].iCursor = -1;
  }
  sNC.pParse = pParse;
  sNC.pSrcList = &sSrc;
  sNC.ncFlags = type;
  sNC.ncFlags = type | NC_IsDDL;
  if( (rc = sqlite3ResolveExprNames(&sNC, pExpr))!=SQLITE_OK ) return rc;
  if( pList ) rc = sqlite3ResolveExprListNames(&sNC, pList);
  return rc;
}

/************** End of resolve.c *********************************************/
/************** Begin file expr.c ********************************************/
96929
96930
96931
96932
96933
96934
96935
96936
96937





96938
96939
96940
96941
96942
96943
96944
97254
97255
97256
97257
97258
97259
97260

97261
97262
97263
97264
97265
97266
97267
97268
97269
97270
97271
97272
97273







-

+
+
+
+
+







** CREATE TABLE t1(a);
** SELECT * FROM t1 WHERE a;
** SELECT a AS b FROM t1 WHERE b;
** SELECT * FROM t1 WHERE (select a from t1);
*/
SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr){
  int op;
  pExpr = sqlite3ExprSkipCollate(pExpr);
  if( pExpr->flags & EP_Generic ) return 0;
  while( ExprHasProperty(pExpr, EP_Skip) ){
    assert( pExpr->op==TK_COLLATE );
    pExpr = pExpr->pLeft;
    assert( pExpr!=0 );
  }
  op = pExpr->op;
  if( op==TK_SELECT ){
    assert( pExpr->flags&EP_xIsSelect );
    return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr);
  }
  if( op==TK_REGISTER ) op = pExpr->op2;
#ifndef SQLITE_OMIT_CAST
96991
96992
96993
96994
96995
96996
96997
96998

96999
97000
97001
97002
97003
97004
97005
97320
97321
97322
97323
97324
97325
97326

97327
97328
97329
97330
97331
97332
97333
97334







-
+







}

/*
** Skip over any TK_COLLATE operators and any unlikely()
** or likelihood() function at the root of an expression.
*/
SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr *pExpr){
  while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){
  while( pExpr && ExprHasProperty(pExpr, EP_Skip|EP_Unlikely) ){
    if( ExprHasProperty(pExpr, EP_Unlikely) ){
      assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
      assert( pExpr->x.pList->nExpr>0 );
      assert( pExpr->op==TK_FUNCTION );
      pExpr = pExpr->x.pList->a[0].pExpr;
    }else{
      assert( pExpr->op==TK_COLLATE );
97658
97659
97660
97661
97662
97663
97664
97665

97666
97667
97668
97669
97670
97671
97672
97987
97988
97989
97990
97991
97992
97993

97994
97995
97996
97997
97998
97999
98000
98001







-
+







  pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra);
  if( pNew ){
    memset(pNew, 0, sizeof(Expr));
    pNew->op = (u8)op;
    pNew->iAgg = -1;
    if( pToken ){
      if( nExtra==0 ){
        pNew->flags |= EP_IntValue|EP_Leaf;
        pNew->flags |= EP_IntValue|EP_Leaf|(iValue?EP_IsTrue:EP_IsFalse);
        pNew->u.iValue = iValue;
      }else{
        pNew->u.zToken = (char*)&pNew[1];
        assert( pToken->z!=0 || pToken->n==0 );
        if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
        pNew->u.zToken[pToken->n] = 0;
        if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
97735
97736
97737
97738
97739
97740
97741
97742
97743
97744
97745
97746
97747
97748
97749
97750





97751
97752
97753
97754
97755



97756
97757
97758
97759
97760
97761
97762
97763
97764
97765
97766
97767
97768
97769
97770
97771
97772
97773
97774
97775
97776
97777
97778
97779
97780
97781
97782
97783
97784
97785
97786
97787
97788
97789
97790
97791
97792
97793
97794
97795
97796
97797
97798
97799
97800
97801
97802
97803
97804
97805
97806
97807
97808
97809
97810
97811
97812



97813
97814
97815
97816
97817
97818



97819
97820
97821
97822
97823

97824
97825
97826
97827
97828
97829
97830
98064
98065
98066
98067
98068
98069
98070









98071
98072
98073
98074
98075

98076


98077
98078
98079
98080
98081
98082
98083
98084
98085
98086
98087
98088
98089
98090
98091
98092
98093
98094
98095
98096
98097
98098
98099
98100



























98101
98102
98103
98104
98105
98106
98107
98108


98109
98110
98111
98112
98113
98114



98115
98116
98117
98118
98119



98120
98121
98122
98123
98124
98125
98126
98127







-
-
-
-
-
-
-
-
-
+
+
+
+
+
-

-
-

+
+
+




















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-








-
-
+
+
+



-
-
-
+
+
+


-
-
-
+







SQLITE_PRIVATE Expr *sqlite3PExpr(
  Parse *pParse,          /* Parsing context */
  int op,                 /* Expression opcode */
  Expr *pLeft,            /* Left operand */
  Expr *pRight            /* Right operand */
){
  Expr *p;
  if( op==TK_AND && pParse->nErr==0 && !IN_RENAME_OBJECT ){
    /* Take advantage of short-circuit false optimization for AND */
    p = sqlite3ExprAnd(pParse->db, pLeft, pRight);
  }else{
    p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr));
    if( p ){
      memset(p, 0, sizeof(Expr));
      p->op = op & 0xff;
      p->iAgg = -1;
  p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr));
  if( p ){
    memset(p, 0, sizeof(Expr));
    p->op = op & 0xff;
    p->iAgg = -1;
    }
    sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight);
  }
  if( p ) {
    sqlite3ExprCheckHeight(pParse, p->nHeight);
  }else{
    sqlite3ExprDelete(pParse->db, pLeft);
    sqlite3ExprDelete(pParse->db, pRight);
  }
  return p;
}

/*
** Add pSelect to the Expr.x.pSelect field.  Or, if pExpr is NULL (due
** do a memory allocation failure) then delete the pSelect object.
*/
SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse *pParse, Expr *pExpr, Select *pSelect){
  if( pExpr ){
    pExpr->x.pSelect = pSelect;
    ExprSetProperty(pExpr, EP_xIsSelect|EP_Subquery);
    sqlite3ExprSetHeightAndFlags(pParse, pExpr);
  }else{
    assert( pParse->db->mallocFailed );
    sqlite3SelectDelete(pParse->db, pSelect);
  }
}


/*
** If the expression is always either TRUE or FALSE (respectively),
** then return 1.  If one cannot determine the truth value of the
** expression at compile-time return 0.
**
** This is an optimization.  If is OK to return 0 here even if
** the expression really is always false or false (a false negative).
** But it is a bug to return 1 if the expression might have different
** boolean values in different circumstances (a false positive.)
**
** Note that if the expression is part of conditional for a
** LEFT JOIN, then we cannot determine at compile-time whether or not
** is it true or false, so always return 0.
*/
static int exprAlwaysTrue(Expr *p){
  int v = 0;
  if( ExprHasProperty(p, EP_FromJoin) ) return 0;
  if( !sqlite3ExprIsInteger(p, &v) ) return 0;
  return v!=0;
}
static int exprAlwaysFalse(Expr *p){
  int v = 0;
  if( ExprHasProperty(p, EP_FromJoin) ) return 0;
  if( !sqlite3ExprIsInteger(p, &v) ) return 0;
  return v==0;
}

/*
** Join two expressions using an AND operator.  If either expression is
** NULL, then just return the other expression.
**
** If one side or the other of the AND is known to be false, then instead
** of returning an AND expression, just return a constant expression with
** a value of false.
*/
SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){
  if( pLeft==0 ){
SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){
  sqlite3 *db = pParse->db;
  if( pLeft==0  ){
    return pRight;
  }else if( pRight==0 ){
    return pLeft;
  }else if( exprAlwaysFalse(pLeft) || exprAlwaysFalse(pRight) ){
    sqlite3ExprDelete(db, pLeft);
    sqlite3ExprDelete(db, pRight);
  }else if( ExprAlwaysFalse(pLeft) || ExprAlwaysFalse(pRight) ){
    sqlite3ExprUnmapAndDelete(pParse, pLeft);
    sqlite3ExprUnmapAndDelete(pParse, pRight);
    return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0);
  }else{
    Expr *pNew = sqlite3ExprAlloc(db, TK_AND, 0, 0);
    sqlite3ExprAttachSubtrees(db, pNew, pLeft, pRight);
    return pNew;
    return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
  }
}

/*
** Construct a new expression node for a function with multiple
** arguments.
*/
97972
97973
97974
97975
97976
97977
97978












97979
97980
97981
97982
97983
97984
97985
98269
98270
98271
98272
98273
98274
98275
98276
98277
98278
98279
98280
98281
98282
98283
98284
98285
98286
98287
98288
98289
98290
98291
98292
98293
98294







+
+
+
+
+
+
+
+
+
+
+
+







  if( !ExprHasProperty(p, EP_Static) ){
    sqlite3DbFreeNN(db, p);
  }
}
SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){
  if( p ) sqlite3ExprDeleteNN(db, p);
}

/* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the
** expression.
*/
SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse *pParse, Expr *p){
  if( p ){
    if( IN_RENAME_OBJECT ){
      sqlite3RenameExprUnmap(pParse, p);
    }
    sqlite3ExprDeleteNN(pParse->db, p);
  }
}

/*
** Return the number of bytes allocated for the expression structure 
** passed as the first argument. This is always one of EXPR_FULLSIZE,
** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE.
*/
static int exprStructSize(Expr *p){
98555
98556
98557
98558
98559
98560
98561
98562
98563

98564
98565
98566
98567
98568
98569
98570
98571
98572
98864
98865
98866
98867
98868
98869
98870


98871


98872
98873
98874
98875
98876
98877
98878







-
-
+
-
-








    /* Remember the size of the LHS in iTable so that we can check that
    ** the RHS and LHS sizes match during code generation. */
    pFirst->iTable = pColumns->nId;
  }

vector_append_error:
  if( IN_RENAME_OBJECT ){
    sqlite3RenameExprUnmap(pParse, pExpr);
  sqlite3ExprUnmapAndDelete(pParse, pExpr);
  }
  sqlite3ExprDelete(db, pExpr);
  sqlite3IdListDelete(db, pColumns);
  return pList;
}

/*
** Set the sort order for the last element on the given ExprList.
*/
98706
98707
98708
98709
98710
98711
98712

98713
98714
98715
98716
98717
98718
98719
98720
98721
98722

98723
98724
98725
98726
98727



























98728
98729
98730
98731
98732
98733
98734
99012
99013
99014
99015
99016
99017
99018
99019
99020
99021
99022
99023
99024
99025
99026
99027
99028
99029
99030
99031
99032
99033
99034
99035
99036
99037
99038
99039
99040
99041
99042
99043
99044
99045
99046
99047
99048
99049
99050
99051
99052
99053
99054
99055
99056
99057
99058
99059
99060
99061
99062
99063
99064
99065
99066
99067
99068
99069







+










+





+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr *pExpr){
  assert( pExpr->op==TK_ID || pExpr->op==TK_STRING );
  if( !ExprHasProperty(pExpr, EP_Quoted)
   && (sqlite3StrICmp(pExpr->u.zToken, "true")==0
       || sqlite3StrICmp(pExpr->u.zToken, "false")==0)
  ){
    pExpr->op = TK_TRUEFALSE;
    ExprSetProperty(pExpr, pExpr->u.zToken[4]==0 ? EP_IsTrue : EP_IsFalse);
    return 1;
  }
  return 0;
}

/*
** The argument must be a TK_TRUEFALSE Expr node.  Return 1 if it is TRUE
** and 0 if it is FALSE.
*/
SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr *pExpr){
  pExpr = sqlite3ExprSkipCollate((Expr*)pExpr);
  assert( pExpr->op==TK_TRUEFALSE );
  assert( sqlite3StrICmp(pExpr->u.zToken,"true")==0
       || sqlite3StrICmp(pExpr->u.zToken,"false")==0 );
  return pExpr->u.zToken[4]==0;
}

/*
** If pExpr is an AND or OR expression, try to simplify it by eliminating
** terms that are always true or false.  Return the simplified expression.
** Or return the original expression if no simplification is possible.
**
** Examples:
**
**     (x<10) AND true                =>   (x<10)
**     (x<10) AND false               =>   false
**     (x<10) AND (y=22 OR false)     =>   (x<10) AND (y=22)
**     (x<10) AND (y=22 OR true)      =>   (x<10)
**     (y=22) OR true                 =>   true
*/
SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){
  assert( pExpr!=0 );
  if( pExpr->op==TK_AND || pExpr->op==TK_OR ){
    Expr *pRight = sqlite3ExprSimplifiedAndOr(pExpr->pRight);
    Expr *pLeft = sqlite3ExprSimplifiedAndOr(pExpr->pLeft);
    if( ExprAlwaysTrue(pLeft) || ExprAlwaysFalse(pRight) ){
      pExpr = pExpr->op==TK_AND ? pRight : pLeft;
    }else if( ExprAlwaysTrue(pRight) || ExprAlwaysFalse(pLeft) ){
      pExpr = pExpr->op==TK_AND ? pLeft : pRight;
    }
  }
  return pExpr;
}


/*
** These routines are Walker callbacks used to check expressions to
** see if they are "constant" for some definition of constant.  The
** Walker.eCode value determines the type of "constant" we are looking
** for.
98966
98967
98968
98969
98970
98971
98972
98973

98974
98975
98976
98977
98978
98979
98980
99301
99302
99303
99304
99305
99306
99307

99308
99309
99310
99311
99312
99313
99314
99315







-
+







** If the expression p codes a constant integer that is small enough
** to fit in a 32-bit integer, return 1 and put the value of the integer
** in *pValue.  If the expression is not an integer or if it is too big
** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.
*/
SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){
  int rc = 0;
  if( p==0 ) return 0;  /* Can only happen following on OOM */
  if( NEVER(p==0) ) return 0;  /* Used to only happen following on OOM */

  /* If an expression is an integer literal that fits in a signed 32-bit
  ** integer, then the EP_IntValue flag will have already been set */
  assert( p->op!=TK_INTEGER || (p->flags & EP_IntValue)!=0
           || sqlite3GetInt32(p->u.zToken, &rc)==0 );

  if( p->flags & EP_IntValue ){
99695
99696
99697
99698
99699
99700
99701

99702
99703
99704
99705
99706
99707
99708
100030
100031
100032
100033
100034
100035
100036
100037
100038
100039
100040
100041
100042
100043
100044







+







      /* If the expression is not constant then we will need to
      ** disable the test that was generated above that makes sure
      ** this code only executes once.  Because for a non-constant
      ** expression we need to rerun this code each time.
      */
      if( addrOnce && !sqlite3ExprIsConstant(pE2) ){
        sqlite3VdbeChangeToNoop(v, addrOnce);
        ExprClearProperty(pExpr, EP_Subrtn);
        addrOnce = 0;
      }

      /* Evaluate the expression and insert it into the temp table */
      r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
      sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
      sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1);
100261
100262
100263
100264
100265
100266
100267
100268


100269
100270
100271
100272
100273
100274
100275
100597
100598
100599
100600
100601
100602
100603

100604
100605
100606
100607
100608
100609
100610
100611
100612







-
+
+







}

/*
** Convert a scalar expression node to a TK_REGISTER referencing
** register iReg.  The caller must ensure that iReg already contains
** the correct value for the expression.
*/
static void exprToRegister(Expr *p, int iReg){
static void exprToRegister(Expr *pExpr, int iReg){
  Expr *p = sqlite3ExprSkipCollate(pExpr);
  p->op2 = p->op;
  p->op = TK_REGISTER;
  p->iTable = iReg;
  ExprClearProperty(p, EP_Skip);
}

/*
101313
101314
101315
101316
101317
101318
101319
101320
101321
101322
101323
101324
101325












101326
101327

101328
101329
101330
101331




101332
101333
101334
101335
101336
101337
101338
101650
101651
101652
101653
101654
101655
101656






101657
101658
101659
101660
101661
101662
101663
101664
101665
101666
101667
101668


101669




101670
101671
101672
101673
101674
101675
101676
101677
101678
101679
101680







-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
+
+
+
+







  int r1, r2;

  assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );
  if( NEVER(v==0) )     return;  /* Existence of VDBE checked by caller */
  if( NEVER(pExpr==0) ) return;  /* No way this can happen */
  op = pExpr->op;
  switch( op ){
    case TK_AND: {
      int d2 = sqlite3VdbeMakeLabel(pParse);
      testcase( jumpIfNull==0 );
      sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL);
      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
      sqlite3VdbeResolveLabel(v, d2);
    case TK_AND:
    case TK_OR: {
      Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
      if( pAlt!=pExpr ){
        sqlite3ExprIfTrue(pParse, pAlt, dest, jumpIfNull);
      }else if( op==TK_AND ){
        int d2 = sqlite3VdbeMakeLabel(pParse);
        testcase( jumpIfNull==0 );
        sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,
                           jumpIfNull^SQLITE_JUMPIFNULL);
        sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
        sqlite3VdbeResolveLabel(v, d2);
      break;
    }
      }else{
    case TK_OR: {
      testcase( jumpIfNull==0 );
      sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
        testcase( jumpIfNull==0 );
        sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
        sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
      }
      break;
    }
    case TK_NOT: {
      testcase( jumpIfNull==0 );
      sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
      break;
    }
101410
101411
101412
101413
101414
101415
101416
101417

101418
101419

101420
101421
101422
101423
101424
101425
101426
101752
101753
101754
101755
101756
101757
101758

101759
101760

101761
101762
101763
101764
101765
101766
101767
101768







-
+

-
+







      sqlite3VdbeGoto(v, dest);
      sqlite3VdbeResolveLabel(v, destIfFalse);
      break;
    }
#endif
    default: {
    default_expr:
      if( exprAlwaysTrue(pExpr) ){
      if( ExprAlwaysTrue(pExpr) ){
        sqlite3VdbeGoto(v, dest);
      }else if( exprAlwaysFalse(pExpr) ){
      }else if( ExprAlwaysFalse(pExpr) ){
        /* No-op */
      }else{
        r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);
        sqlite3VdbeAddOp3(v, OP_If, r1, dest, jumpIfNull!=0);
        VdbeCoverage(v);
        testcase( regFree1==0 );
        testcase( jumpIfNull==0 );
101480
101481
101482
101483
101484
101485
101486
101487
101488
101489
101490









101491
101492

101493
101494
101495
101496
101497
101498







101499
101500
101501
101502
101503
101504
101505
101822
101823
101824
101825
101826
101827
101828




101829
101830
101831
101832
101833
101834
101835
101836
101837


101838






101839
101840
101841
101842
101843
101844
101845
101846
101847
101848
101849
101850
101851
101852







-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+







  assert( pExpr->op!=TK_EQ || op==OP_Ne );
  assert( pExpr->op!=TK_LT || op==OP_Ge );
  assert( pExpr->op!=TK_LE || op==OP_Gt );
  assert( pExpr->op!=TK_GT || op==OP_Le );
  assert( pExpr->op!=TK_GE || op==OP_Lt );

  switch( pExpr->op ){
    case TK_AND: {
      testcase( jumpIfNull==0 );
      sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
    case TK_AND:
    case TK_OR: {
      Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
      if( pAlt!=pExpr ){
        sqlite3ExprIfFalse(pParse, pAlt, dest, jumpIfNull);
      }else if( pExpr->op==TK_AND ){
        testcase( jumpIfNull==0 );
        sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
        sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
      break;
    }
      }else{
    case TK_OR: {
      int d2 = sqlite3VdbeMakeLabel(pParse);
      testcase( jumpIfNull==0 );
      sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL);
      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
      sqlite3VdbeResolveLabel(v, d2);
        int d2 = sqlite3VdbeMakeLabel(pParse);
        testcase( jumpIfNull==0 );
        sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2,
                          jumpIfNull^SQLITE_JUMPIFNULL);
        sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
        sqlite3VdbeResolveLabel(v, d2);
      }
      break;
    }
    case TK_NOT: {
      testcase( jumpIfNull==0 );
      sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
      break;
    }
101580
101581
101582
101583
101584
101585
101586
101587

101588
101589

101590
101591
101592
101593
101594
101595
101596
101927
101928
101929
101930
101931
101932
101933

101934
101935

101936
101937
101938
101939
101940
101941
101942
101943







-
+

-
+







        sqlite3VdbeResolveLabel(v, destIfNull);
      }
      break;
    }
#endif
    default: {
    default_expr: 
      if( exprAlwaysFalse(pExpr) ){
      if( ExprAlwaysFalse(pExpr) ){
        sqlite3VdbeGoto(v, dest);
      }else if( exprAlwaysTrue(pExpr) ){
      }else if( ExprAlwaysTrue(pExpr) ){
        /* no-op */
      }else{
        r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);
        sqlite3VdbeAddOp3(v, OP_IfNot, r1, dest, jumpIfNull!=0);
        VdbeCoverage(v);
        testcase( regFree1==0 );
        testcase( jumpIfNull==0 );
101738
101739
101740
101741
101742
101743
101744

101745
101746
101747
101748
101749
101750
101751
102085
102086
102087
102088
102089
102090
102091
102092
102093
102094
102095
102096
102097
102098
102099







+







    if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2;
    if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
    if( pA->op!=TK_STRING
     && pA->op!=TK_TRUEFALSE
     && (combinedFlags & EP_Reduced)==0
    ){
      if( pA->iColumn!=pB->iColumn ) return 2;
      if( pA->op2!=pB->op2 ) return 2;
      if( pA->iTable!=pB->iTable 
       && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
    }
  }
  return 0;
}

101784
101785
101786
101787
101788
101789
101790






































































101791
101792
101793
101794
101795
101796
101797
102132
102133
102134
102135
102136
102137
102138
102139
102140
102141
102142
102143
102144
102145
102146
102147
102148
102149
102150
102151
102152
102153
102154
102155
102156
102157
102158
102159
102160
102161
102162
102163
102164
102165
102166
102167
102168
102169
102170
102171
102172
102173
102174
102175
102176
102177
102178
102179
102180
102181
102182
102183
102184
102185
102186
102187
102188
102189
102190
102191
102192
102193
102194
102195
102196
102197
102198
102199
102200
102201
102202
102203
102204
102205
102206
102207
102208
102209
102210
102211
102212
102213
102214
102215







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







*/
SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
  return sqlite3ExprCompare(0,
             sqlite3ExprSkipCollate(pA),
             sqlite3ExprSkipCollate(pB),
             iTab);
}

/*
** Return non-zero if Expr p can only be true if pNN is not NULL.
*/
static int exprImpliesNotNull(
  Parse *pParse,      /* Parsing context */
  Expr *p,            /* The expression to be checked */
  Expr *pNN,          /* The expression that is NOT NULL */
  int iTab,           /* Table being evaluated */
  int seenNot         /* True if p is an operand of NOT */
){
  assert( p );
  assert( pNN );
  if( sqlite3ExprCompare(pParse, p, pNN, iTab)==0 ) return 1;
  switch( p->op ){
    case TK_IN: {
      if( seenNot && ExprHasProperty(p, EP_xIsSelect) ) return 0;
      assert( ExprHasProperty(p,EP_xIsSelect)
           || (p->x.pList!=0 && p->x.pList->nExpr>0) );
      return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot);
    }
    case TK_BETWEEN: {
      ExprList *pList = p->x.pList;
      assert( pList!=0 );
      assert( pList->nExpr==2 );
      if( seenNot ) return 0;
      if( exprImpliesNotNull(pParse, pList->a[0].pExpr, pNN, iTab, seenNot)
       || exprImpliesNotNull(pParse, pList->a[1].pExpr, pNN, iTab, seenNot)
      ){
        return 1;
      }
      return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot);
    }
    case TK_EQ:
    case TK_NE:
    case TK_LT:
    case TK_LE:
    case TK_GT:
    case TK_GE:
    case TK_PLUS:
    case TK_MINUS:
    case TK_STAR:
    case TK_REM:
    case TK_BITAND:
    case TK_BITOR:
    case TK_SLASH:
    case TK_LSHIFT:
    case TK_RSHIFT: 
    case TK_CONCAT: {
      if( exprImpliesNotNull(pParse, p->pRight, pNN, iTab, seenNot) ) return 1;
      /* Fall thru into the next case */
    }
    case TK_SPAN:
    case TK_COLLATE:
    case TK_BITNOT:
    case TK_UPLUS:
    case TK_UMINUS: {
      return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot);
    }
    case TK_TRUTH: {
      if( seenNot ) return 0;
      if( p->op2!=TK_IS ) return 0;
      return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot);
    }
    case TK_NOT: {
      return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, 1);
    }
  }
  return 0;
}

/*
** Return true if we can prove the pE2 will always be true if pE1 is
** true.  Return false if we cannot complete the proof or if pE2 might
** be false.  Examples:
**
**     pE1: x==5       pE2: x==5             Result: true
101820
101821
101822
101823
101824
101825
101826
101827
101828
101829
101830




101831
101832
101833
101834
101835
101836
101837
102238
102239
102240
102241
102242
102243
102244




102245
102246
102247
102248
102249
102250
102251
102252
102253
102254
102255







-
-
-
-
+
+
+
+







  }
  if( pE2->op==TK_OR
   && (sqlite3ExprImpliesExpr(pParse, pE1, pE2->pLeft, iTab)
             || sqlite3ExprImpliesExpr(pParse, pE1, pE2->pRight, iTab) )
  ){
    return 1;
  }
  if( pE2->op==TK_NOTNULL && pE1->op!=TK_ISNULL && pE1->op!=TK_IS ){
    Expr *pX = sqlite3ExprSkipCollate(pE1->pLeft);
    testcase( pX!=pE1->pLeft );
    if( sqlite3ExprCompare(pParse, pX, pE2->pLeft, iTab)==0 ) return 1;
  if( pE2->op==TK_NOTNULL
   && exprImpliesNotNull(pParse, pE1, pE2->pLeft, iTab, 0)
  ){
    return 1;
  }
  return 0;
}

/*
** This is the Expr node callback for sqlite3ExprImpliesNotNullRow().
** If the expression node requires that the table at pWalker->iCur
102397
102398
102399
102400
102401
102402
102403
102404

102405
102406
102407
102408
102409
102410
102411
102412
102413
102414
102415

102416
102417
102418
102419
102420
102421
102422
102815
102816
102817
102818
102819
102820
102821

102822
102823
102824
102825
102826
102827
102828
102829
102830
102831
102832

102833
102834
102835
102836
102837
102838
102839
102840







-
+










-
+







** statement to ensure that the operation has not rendered any schema
** objects unusable.
*/
static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){
  sqlite3NestedParse(pParse, 
      "SELECT 1 "
      "FROM \"%w\".%s "
      "WHERE name NOT LIKE 'sqlite_%%'"
      "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
      " AND sql NOT LIKE 'create virtual%%'"
      " AND sqlite_rename_test(%Q, sql, type, name, %d)=NULL ",
      zDb, MASTER_NAME, 
      zDb, bTemp
  );

  if( bTemp==0 ){
    sqlite3NestedParse(pParse, 
        "SELECT 1 "
        "FROM temp.%s "
        "WHERE name NOT LIKE 'sqlite_%%'"
        "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
        " AND sql NOT LIKE 'create virtual%%'"
        " AND sqlite_rename_test(%Q, sql, type, name, 1)=NULL ",
        MASTER_NAME, zDb 
    );
  }
}

102529
102530
102531
102532
102533
102534
102535
102536

102537
102538
102539
102540
102541
102542
102543
102544
102545
102546

102547

102548
102549
102550
102551
102552
102553
102554
102947
102948
102949
102950
102951
102952
102953

102954
102955
102956
102957
102958
102959
102960
102961
102962
102963
102964
102965

102966
102967
102968
102969
102970
102971
102972
102973







-
+










+
-
+








  /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in
  ** the schema to use the new table name.  */
  sqlite3NestedParse(pParse, 
      "UPDATE \"%w\".%s SET "
      "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) "
      "WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)"
      "AND   name NOT LIKE 'sqlite_%%'"
      "AND   name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
      , zDb, MASTER_NAME, zDb, zTabName, zName, (iDb==1), zTabName
  );

  /* Update the tbl_name and name columns of the sqlite_master table
  ** as required.  */
  sqlite3NestedParse(pParse,
      "UPDATE %Q.%s SET "
          "tbl_name = %Q, "
          "name = CASE "
            "WHEN type='table' THEN %Q "
            "WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' "
            "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN "
            "     AND type='index' THEN "
             "'sqlite_autoindex_' || %Q || substr(name,%d+18) "
            "ELSE name END "
      "WHERE tbl_name=%Q COLLATE nocase AND "
          "(type='table' OR type='index' OR type='trigger');", 
      zDb, MASTER_NAME, 
      zName, zName, zName, 
      nTabName, zTabName
102914
102915
102916
102917
102918
102919
102920
102921


102922
102923
102924
102925
102926
102927
102928
103333
103334
103335
103336
103337
103338
103339

103340
103341
103342
103343
103344
103345
103346
103347
103348







-
+
+







  zNew = sqlite3NameFromToken(db, pNew);
  if( !zNew ) goto exit_rename_column;
  assert( pNew->n>0 );
  bQuote = sqlite3Isquote(pNew->z[0]);
  sqlite3NestedParse(pParse, 
      "UPDATE \"%w\".%s SET "
      "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) "
      "WHERE name NOT LIKE 'sqlite_%%' AND (type != 'index' OR tbl_name = %Q)"
      "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' "
      " AND (type != 'index' OR tbl_name = %Q)"
      " AND sql NOT LIKE 'create virtual%%'",
      zDb, MASTER_NAME, 
      zDb, pTab->zName, iCol, zNew, bQuote, iSchema==1,
      pTab->zName
  );

  sqlite3NestedParse(pParse, 
103067
103068
103069
103070
103071
103072
103073























103074
103075
103076
103077
103078
103079
103080
103081
103082

103083
103084
103085
103086
103087
103088
103089
103487
103488
103489
103490
103491
103492
103493
103494
103495
103496
103497
103498
103499
103500
103501
103502
103503
103504
103505
103506
103507
103508
103509
103510
103511
103512
103513
103514
103515
103516
103517
103518
103519
103520
103521
103522
103523
103524
103525
103526
103527
103528
103529
103530
103531
103532
103533







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+









+







** Walker callback used by sqlite3RenameExprUnmap().
*/
static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){
  Parse *pParse = pWalker->pParse;
  sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr);
  return WRC_Continue;
}

/*
** Walker callback used by sqlite3RenameExprUnmap().
*/
static int renameUnmapSelectCb(Walker *pWalker, Select *p){
  Parse *pParse = pWalker->pParse;
  int i;
  if( ALWAYS(p->pEList) ){
    ExprList *pList = p->pEList;
    for(i=0; i<pList->nExpr; i++){
      if( pList->a[i].zName ){
        sqlite3RenameTokenRemap(pParse, 0, (void*)pList->a[i].zName);
      }
    }
  }
  if( ALWAYS(p->pSrc) ){  /* Every Select as a SrcList, even if it is empty */
    SrcList *pSrc = p->pSrc;
    for(i=0; i<pSrc->nSrc; i++){
      sqlite3RenameTokenRemap(pParse, 0, (void*)pSrc->a[i].zName);
    }
  }
  return WRC_Continue;
}

/*
** Remove all nodes that are part of expression pExpr from the rename list.
*/
SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){
  Walker sWalker;
  memset(&sWalker, 0, sizeof(Walker));
  sWalker.pParse = pParse;
  sWalker.xExprCallback = renameUnmapExprCb;
  sWalker.xSelectCallback = renameUnmapSelectCb;
  sqlite3WalkExpr(&sWalker, pExpr);
}

/*
** Remove all nodes that are part of expression-list pEList from the 
** rename list.
*/
107455
107456
107457
107458
107459
107460
107461
107462
107463






107464
107465

107466
107467
107468
107469
107470
107471
107472
107899
107900
107901
107902
107903
107904
107905


107906
107907
107908
107909
107910
107911
107912

107913
107914
107915
107916
107917
107918
107919
107920







-
-
+
+
+
+
+
+

-
+







** used by the Table object.
*/
static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){
  Index *pIndex, *pNext;

#ifdef SQLITE_DEBUG
  /* Record the number of outstanding lookaside allocations in schema Tables
  ** prior to doing any free() operations.  Since schema Tables do not use
  ** lookaside, this number should not change. */
  ** prior to doing any free() operations. Since schema Tables do not use
  ** lookaside, this number should not change. 
  **
  ** If malloc has already failed, it may be that it failed while allocating
  ** a Table object that was going to be marked ephemeral. So do not check
  ** that no lookaside memory is used in this case either. */
  int nLookaside = 0;
  if( db && (pTable->tabFlags & TF_Ephemeral)==0 ){
  if( db && !db->mallocFailed && (pTable->tabFlags & TF_Ephemeral)==0 ){
    nLookaside = sqlite3LookasideUsed(db, 0);
  }
#endif

  /* Delete all indices associated with this table. */
  for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
    pNext = pIndex->pNext;
108166
108167
108168
108169
108170
108171
108172
108173

108174
108175
108176
108177
108178
108179
108180
108614
108615
108616
108617
108618
108619
108620

108621
108622
108623
108624
108625
108626
108627
108628







-
+







**     CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim)
**     CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC);
**
** This is goofy.  But to preserve backwards compatibility we continue to
** accept it.  This routine does the necessary conversion.  It converts
** the expression given in its argument from a TK_STRING into a TK_ID
** if the expression is just a TK_STRING with an optional COLLATE clause.
** If the epxression is anything other than TK_STRING, the expression is
** If the expression is anything other than TK_STRING, the expression is
** unchanged.
*/
static void sqlite3StringToId(Expr *p){
  if( p->op==TK_STRING ){
    p->op = TK_ID;
  }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){
    p->pLeft->op = TK_ID;
108563
108564
108565
108566
108567
108568
108569
108570



108571
108572
108573








































108574
108575
108576
108577
108578
108579
108580
109011
109012
109013
109014
109015
109016
109017

109018
109019
109020
109021
109022

109023
109024
109025
109026
109027
109028
109029
109030
109031
109032
109033
109034
109035
109036
109037
109038
109039
109040
109041
109042
109043
109044
109045
109046
109047
109048
109049
109050
109051
109052
109053
109054
109055
109056
109057
109058
109059
109060
109061
109062
109063
109064
109065
109066
109067
109068
109069







-
+
+
+


-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







    i16 x = pIdx->aiColumn[i];
    assert( x<pIdx->pTable->nCol );
    wIndex += x<0 ? 1 : aCol[pIdx->aiColumn[i]].szEst;
  }
  pIdx->szIdxRow = sqlite3LogEst(wIndex*4);
}

/* Return true if value x is found any of the first nCol entries of aiCol[]
/* Return true if column number x is any of the first nCol entries of aiCol[].
** This is used to determine if the column number x appears in any of the
** first nCol entries of an index.
*/
static int hasColumn(const i16 *aiCol, int nCol, int x){
  while( nCol-- > 0 ) if( x==*(aiCol++) ) return 1;
  while( nCol-- > 0 ){
    assert( aiCol[0]>=0 );
    if( x==*(aiCol++) ){
      return 1;
    }
  }
  return 0;
}

/*
** Return true if any of the first nKey entries of index pIdx exactly
** match the iCol-th entry of pPk.  pPk is always a WITHOUT ROWID
** PRIMARY KEY index.  pIdx is an index on the same table.  pIdx may
** or may not be the same index as pPk.
**
** The first nKey entries of pIdx are guaranteed to be ordinary columns,
** not a rowid or expression.
**
** This routine differs from hasColumn() in that both the column and the
** collating sequence must match for this routine, but for hasColumn() only
** the column name must match.
*/
static int isDupColumn(Index *pIdx, int nKey, Index *pPk, int iCol){
  int i, j;
  assert( nKey<=pIdx->nColumn );
  assert( iCol<MAX(pPk->nColumn,pPk->nKeyCol) );
  assert( pPk->idxType==SQLITE_IDXTYPE_PRIMARYKEY );
  assert( pPk->pTable->tabFlags & TF_WithoutRowid );
  assert( pPk->pTable==pIdx->pTable );
  testcase( pPk==pIdx );
  j = pPk->aiColumn[iCol];
  assert( j!=XN_ROWID && j!=XN_EXPR );
  for(i=0; i<nKey; i++){
    assert( pIdx->aiColumn[i]>=0 || j>=0 );
    if( pIdx->aiColumn[i]==j 
     && sqlite3StrICmp(pIdx->azColl[i], pPk->azColl[iCol])==0
    ){
      return 1;
    }
  }
  return 0;
}

/* Recompute the colNotIdxed field of the Index.
**
** colNotIdxed is a bitmask that has a 0 bit representing each indexed
** columns that are within the first 63 columns of the table.  The
108655
108656
108657
108658
108659
108660
108661



108662
108663

108664
108665
108666
108667
108668
108669
108670
108671
108672
108673
108674
108675
108676
108677
108678
108679

108680
108681

108682
108683
108684
108685
108686
108687
108688
109144
109145
109146
109147
109148
109149
109150
109151
109152
109153
109154
109155
109156
109157
109158
109159
109160

109161
109162
109163
109164
109165
109166
109167
109168
109169
109170

109171
109172
109173
109174
109175
109176
109177
109178
109179
109180
109181







+
+
+


+




-










-
+


+







  if( pTab->iPKey>=0 ){
    ExprList *pList;
    Token ipkToken;
    sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName);
    pList = sqlite3ExprListAppend(pParse, 0, 
                  sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0));
    if( pList==0 ) return;
    if( IN_RENAME_OBJECT ){
      sqlite3RenameTokenRemap(pParse, pList->a[0].pExpr, &pTab->iPKey);
    }
    pList->a[0].sortOrder = pParse->iPkSortOrder;
    assert( pParse->pNewTable==pTab );
    pTab->iPKey = -1;
    sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0,
                       SQLITE_IDXTYPE_PRIMARYKEY);
    if( db->mallocFailed || pParse->nErr ) return;
    pPk = sqlite3PrimaryKeyIndex(pTab);
    pTab->iPKey = -1;
  }else{
    pPk = sqlite3PrimaryKeyIndex(pTab);
    assert( pPk!=0 );

    /*
    ** Remove all redundant columns from the PRIMARY KEY.  For example, change
    ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)".  Later
    ** code assumes the PRIMARY KEY contains no repeated columns.
    */
    for(i=j=1; i<pPk->nKeyCol; i++){
      if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){
      if( isDupColumn(pPk, j, pPk, i) ){
        pPk->nColumn--;
      }else{
        testcase( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) );
        pPk->aiColumn[j++] = pPk->aiColumn[i];
      }
    }
    pPk->nKeyCol = j;
  }
  assert( pPk!=0 );
  pPk->isCovering = 1;
108704
108705
108706
108707
108708
108709
108710

108711



108712
108713
108714
108715
108716
108717
108718
108719

108720

108721
108722




108723
108724
108725
108726
108727
108728
108729
109197
109198
109199
109200
109201
109202
109203
109204

109205
109206
109207
109208
109209
109210
109211
109212
109213
109214
109215
109216

109217
109218
109219
109220
109221
109222
109223
109224
109225
109226
109227
109228
109229
109230







+
-
+
+
+








+
-
+


+
+
+
+







  /* Update the in-memory representation of all UNIQUE indices by converting
  ** the final rowid column into one or more columns of the PRIMARY KEY.
  */
  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    int n;
    if( IsPrimaryKeyIndex(pIdx) ) continue;
    for(i=n=0; i<nPk; i++){
      if( !isDupColumn(pIdx, pIdx->nKeyCol, pPk, i) ){
      if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++;
        testcase( hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) );
        n++;
      }
    }
    if( n==0 ){
      /* This index is a superset of the primary key */
      pIdx->nColumn = pIdx->nKeyCol;
      continue;
    }
    if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return;
    for(i=0, j=pIdx->nKeyCol; i<nPk; i++){
      if( !isDupColumn(pIdx, pIdx->nKeyCol, pPk, i) ){
      if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){
        testcase( hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) );
        pIdx->aiColumn[j] = pPk->aiColumn[i];
        pIdx->azColl[j] = pPk->azColl[i];
        if( pPk->aSortOrder[i] ){
          /* See ticket https://www.sqlite.org/src/info/bba7b69f9849b5bf */
          pIdx->bAscKeyBug = 1;
        }
        j++;
      }
    }
    assert( pIdx->nColumn>=pIdx->nKeyCol+n );
    assert( pIdx->nColumn>=j );
  }

109834
109835
109836
109837
109838
109839
109840








109841
109842
109843








109844


109845
109846
109847
109848
109849
109850
109851
110335
110336
110337
110338
110339
110340
110341
110342
110343
110344
110345
110346
110347
110348
110349
110350
110351
110352
110353
110354
110355
110356
110357
110358
110359
110360

110361
110362
110363
110364
110365
110366
110367
110368
110369







+
+
+
+
+
+
+
+



+
+
+
+
+
+
+
+
-
+
+







    addr2 = sqlite3VdbeCurrentAddr(v);
    sqlite3VdbeVerifyAbortable(v, OE_Abort);
    sqlite3VdbeAddOp4Int(v, OP_SorterCompare, iSorter, j2, regRecord,
                         pIndex->nKeyCol); VdbeCoverage(v);
    sqlite3UniqueConstraint(pParse, OE_Abort, pIndex);
    sqlite3VdbeJumpHere(v, j2);
  }else{
    /* Most CREATE INDEX and REINDEX statements that are not UNIQUE can not
    ** abort. The exception is if one of the indexed expressions contains a
    ** user function that throws an exception when it is evaluated. But the
    ** overhead of adding a statement journal to a CREATE INDEX statement is
    ** very small (since most of the pages written do not contain content that
    ** needs to be restored if the statement aborts), so we call 
    ** sqlite3MayAbort() for all CREATE INDEX statements.  */
    sqlite3MayAbort(pParse);
    addr2 = sqlite3VdbeCurrentAddr(v);
  }
  sqlite3VdbeAddOp3(v, OP_SorterData, iSorter, regRecord, iIdx);
  if( !pIndex->bAscKeyBug ){
    /* This OP_SeekEnd opcode makes index insert for a REINDEX go much
    ** faster by avoiding unnecessary seeks.  But the optimization does
    ** not work for UNIQUE constraint indexes on WITHOUT ROWID tables
    ** with DESC primary keys, since those indexes have there keys in
    ** a different order from the main table.
    ** See ticket: https://www.sqlite.org/src/info/bba7b69f9849b5bf
    */
  sqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx);
    sqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx);
  }
  sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord);
  sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
  sqlite3ReleaseTempReg(pParse, regRecord);
  sqlite3VdbeAddOp2(v, OP_SorterNext, iSorter, addr2); VdbeCoverage(v);
  sqlite3VdbeJumpHere(v, addr1);

  sqlite3VdbeAddOp1(v, OP_Close, iTab);
110229
110230
110231
110232
110233
110234
110235
110236

110237
110238

110239
110240
110241
110242
110243
110244
110245
110747
110748
110749
110750
110751
110752
110753

110754
110755
110756
110757
110758
110759
110760
110761
110762
110763
110764







-
+


+







  ** tables (when pPk!=0) this will be the declared PRIMARY KEY.  For
  ** normal tables (when pPk==0) this will be the rowid.
  */
  if( pPk ){
    for(j=0; j<pPk->nKeyCol; j++){
      int x = pPk->aiColumn[j];
      assert( x>=0 );
      if( hasColumn(pIndex->aiColumn, pIndex->nKeyCol, x) ){
      if( isDupColumn(pIndex, pIndex->nKeyCol, pPk, j) ){
        pIndex->nColumn--; 
      }else{
        testcase( hasColumn(pIndex->aiColumn,pIndex->nKeyCol,x) );
        pIndex->aiColumn[i] = x;
        pIndex->azColl[i] = pPk->azColl[j];
        pIndex->aSortOrder[i] = pPk->aSortOrder[j];
        i++;
      }
    }
    assert( i==pIndex->nColumn );
113002
113003
113004
113005
113006
113007
113008

113009
113010
113011
113012
113013
113014
113015
113521
113522
113523
113524
113525
113526
113527
113528
113529
113530
113531
113532
113533
113534
113535







+







** This file contains the C-language implementations for many of the SQL
** functions of SQLite.  (Some function, and in particular the date and
** time functions, are implemented separately.)
*/
/* #include "sqliteInt.h" */
/* #include <stdlib.h> */
/* #include <assert.h> */
/* #include <math.h> */
/* #include "vdbeInt.h" */

/*
** Return the collating function associated with a function.
*/
static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){
  VdbeOp *pOp;
113372
113373
113374
113375
113376
113377
113378
113379
113380
113381
113382




113383
113384
113385
113386
113387
113388
113389
113892
113893
113894
113895
113896
113897
113898




113899
113900
113901
113902
113903
113904
113905
113906
113907
113908
113909







-
-
-
-
+
+
+
+







  }
  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
  r = sqlite3_value_double(argv[0]);
  /* If Y==0 and X will fit in a 64-bit int,
  ** handle the rounding directly,
  ** otherwise use printf.
  */
  if( n==0 && r>=0 && r<LARGEST_INT64-1 ){
    r = (double)((sqlite_int64)(r+0.5));
  }else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){
    r = -(double)((sqlite_int64)((-r)+0.5));
  if( r<-4503599627370496.0 || r>+4503599627370496.0 ){
    /* The value has no fractional part so there is nothing to round */
  }else if( n==0 ){  
    r = (double)((sqlite_int64)(r+(r<0?-0.5:+0.5)));
  }else{
    zBuf = sqlite3_mprintf("%.*f",n,r);
    if( zBuf==0 ){
      sqlite3_result_error_nomem(context);
      return;
    }
    sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8);
113829
113830
113831
113832
113833
113834
113835
113836
113837
113838
113839
113840
113841
113842
113843
113844
113845
113846
113847
113848
113849
113850
113851
113852
113853
113854
113855
113856
113857
113858
113859
113860
113861
113862
113863
113864
113865


113866
113867
113868
113869
113870
113871
113872
114349
114350
114351
114352
114353
114354
114355


114356
114357
114358
114359
114360
114361
114362
114363
114364
114365
114366


114367
114368
114369
114370
114371
114372
114373
114374
114375
114376
114377
114378
114379
114380
114381
114382
114383
114384
114385
114386
114387
114388
114389
114390







-
-











-
-















+
+







#ifdef SQLITE_TEST
    sqlite3_like_count++;
#endif
    sqlite3_result_int(context, 0);
    return;
  }
#endif
  zB = sqlite3_value_text(argv[0]);
  zA = sqlite3_value_text(argv[1]);

  /* Limit the length of the LIKE or GLOB pattern to avoid problems
  ** of deep recursion and N*N behavior in patternCompare().
  */
  nPat = sqlite3_value_bytes(argv[0]);
  testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] );
  testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]+1 );
  if( nPat > db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ){
    sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1);
    return;
  }
  assert( zB==sqlite3_value_text(argv[0]) );  /* Encoding did not change */

  if( argc==3 ){
    /* The escape character string must consist of a single UTF-8 character.
    ** Otherwise, return an error.
    */
    const unsigned char *zEsc = sqlite3_value_text(argv[2]);
    if( zEsc==0 ) return;
    if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){
      sqlite3_result_error(context, 
          "ESCAPE expression must be a single character", -1);
      return;
    }
    escape = sqlite3Utf8Read(&zEsc);
  }else{
    escape = pInfo->matchSet;
  }
  zB = sqlite3_value_text(argv[0]);
  zA = sqlite3_value_text(argv[1]);
  if( zA && zB ){
#ifdef SQLITE_TEST
    sqlite3_like_count++;
#endif
    sqlite3_result_int(context,
                      patternCompare(zB, zA, pInfo, escape)==SQLITE_MATCH);
  }
114784
114785
114786
114787
114788
114789
114790
114791
114792
114793
114794
114795
114796
114797
114798
114799
114800
114801
114802
114803
114804
114805
114806

114807
114808

114809
114810
114811

114812
114813

114814
114815

114816
114817
114818
114819

114820
114821
114822

114823
114824
114825
114826
114827
114828
114829
114830
115302
115303
115304
115305
115306
115307
115308
















115309
115310

115311
115312
115313
115314
115315
115316
115317
115318
115319
115320
115321
115322
115323
115324

115325



115326

115327
115328
115329
115330
115331
115332
115333







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+

-
+



+


+


+



-
+
-
-
-
+
-







  assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );
  if( rc==SQLITE_NOMEM ){
    sqlite3OomFault(db);
  }
}

/*
** Set the LIKEOPT flag on the 2-argument function with the given name.
*/
static void setLikeOptFlag(sqlite3 *db, const char *zName, u8 flagVal){
  FuncDef *pDef;
  pDef = sqlite3FindFunction(db, zName, 2, SQLITE_UTF8, 0);
  if( ALWAYS(pDef) ){
    pDef->funcFlags |= flagVal;
  }
  pDef = sqlite3FindFunction(db, zName, 3, SQLITE_UTF8, 0);
  if( pDef ){
    pDef->funcFlags |= flagVal;
  }
}

/*
** Register the built-in LIKE and GLOB functions.  The caseSensitive
** Re-register the built-in LIKE functions.  The caseSensitive
** parameter determines whether or not the LIKE operator is case
** sensitive.  GLOB is always case sensitive.
** sensitive.
*/
SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){
  struct compareInfo *pInfo;
  int flags;
  if( caseSensitive ){
    pInfo = (struct compareInfo*)&likeInfoAlt;
    flags = SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE;
  }else{
    pInfo = (struct compareInfo*)&likeInfoNorm;
    flags = SQLITE_FUNC_LIKE;
  }
  sqlite3CreateFunc(db, "like", 2, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0, 0, 0);
  sqlite3CreateFunc(db, "like", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0, 0, 0);
  sqlite3CreateFunc(db, "glob", 2, SQLITE_UTF8, 
  sqlite3FindFunction(db, "like", 2, SQLITE_UTF8, 0)->funcFlags |= flags;
      (struct compareInfo*)&globInfo, likeFunc, 0, 0, 0, 0, 0);
  setLikeOptFlag(db, "glob", SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE);
  setLikeOptFlag(db, "like", 
  sqlite3FindFunction(db, "like", 3, SQLITE_UTF8, 0)->funcFlags |= flags;
      caseSensitive ? (SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE) : SQLITE_FUNC_LIKE);
}

/*
** pExpr points to an expression which implements a function.  If
** it is appropriate to apply the LIKE optimization to that function
** then set aWc[0] through aWc[2] to the wildcard characters and the
** escape character and then return TRUE.  If the function is not a 
115606
115607
115608
115609
115610
115611
115612
115613

115614
115615
115616
115617
115618
115619
115620
116109
116110
116111
116112
116113
116114
116115

116116
116117
116118
116119
116120
116121
116122
116123







-
+







    iCol = pIdx ? pIdx->aiColumn[i] : -1;
    pLeft = exprTableRegister(pParse, pTab, regData, iCol);
    iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;
    assert( iCol>=0 );
    zCol = pFKey->pFrom->aCol[iCol].zName;
    pRight = sqlite3Expr(db, TK_ID, zCol);
    pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight);
    pWhere = sqlite3ExprAnd(db, pWhere, pEq);
    pWhere = sqlite3ExprAnd(pParse, pWhere, pEq);
  }

  /* If the child table is the same as the parent table, then add terms
  ** to the WHERE clause that prevent this entry from being scanned.
  ** The added WHERE clause terms are like this:
  **
  **     $current_rowid!=rowid
115640
115641
115642
115643
115644
115645
115646
115647

115648
115649
115650
115651

115652
115653
115654
115655
115656
115657
115658
116143
116144
116145
116146
116147
116148
116149

116150
116151
116152
116153

116154
116155
116156
116157
116158
116159
116160
116161







-
+



-
+







      assert( pIdx!=0 );
      for(i=0; i<pIdx->nKeyCol; i++){
        i16 iCol = pIdx->aiColumn[i];
        assert( iCol>=0 );
        pLeft = exprTableRegister(pParse, pTab, regData, iCol);
        pRight = sqlite3Expr(db, TK_ID, pTab->aCol[iCol].zName);
        pEq = sqlite3PExpr(pParse, TK_IS, pLeft, pRight);
        pAll = sqlite3ExprAnd(db, pAll, pEq);
        pAll = sqlite3ExprAnd(pParse, pAll, pEq);
      }
      pNe = sqlite3PExpr(pParse, TK_NOT, pAll, 0);
    }
    pWhere = sqlite3ExprAnd(db, pWhere, pNe);
    pWhere = sqlite3ExprAnd(pParse, pWhere, pNe);
  }

  /* Resolve the references in the WHERE clause. */
  memset(&sNameContext, 0, sizeof(NameContext));
  sNameContext.pSrcList = pSrc;
  sNameContext.pParse = pParse;
  sqlite3ResolveExprNames(&sNameContext, pWhere);
116250
116251
116252
116253
116254
116255
116256
116257

116258
116259
116260
116261
116262
116263
116264
116265
116266
116267
116268
116269
116270
116271
116272
116273

116274
116275
116276
116277
116278
116279
116280
116753
116754
116755
116756
116757
116758
116759

116760
116761
116762
116763
116764
116765
116766
116767
116768
116769
116770
116771
116772
116773
116774
116775

116776
116777
116778
116779
116780
116781
116782
116783







-
+















-
+







      ** parent table are used for the comparison. */
      pEq = sqlite3PExpr(pParse, TK_EQ,
          sqlite3PExpr(pParse, TK_DOT, 
            sqlite3ExprAlloc(db, TK_ID, &tOld, 0),
            sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)),
          sqlite3ExprAlloc(db, TK_ID, &tFromCol, 0)
      );
      pWhere = sqlite3ExprAnd(db, pWhere, pEq);
      pWhere = sqlite3ExprAnd(pParse, pWhere, pEq);

      /* For ON UPDATE, construct the next term of the WHEN clause.
      ** The final WHEN clause will be like this:
      **
      **    WHEN NOT(old.col1 IS new.col1 AND ... AND old.colN IS new.colN)
      */
      if( pChanges ){
        pEq = sqlite3PExpr(pParse, TK_IS,
            sqlite3PExpr(pParse, TK_DOT, 
              sqlite3ExprAlloc(db, TK_ID, &tOld, 0),
              sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)),
            sqlite3PExpr(pParse, TK_DOT, 
              sqlite3ExprAlloc(db, TK_ID, &tNew, 0),
              sqlite3ExprAlloc(db, TK_ID, &tToCol, 0))
            );
        pWhen = sqlite3ExprAnd(db, pWhen, pEq);
        pWhen = sqlite3ExprAnd(pParse, pWhen, pEq);
      }
  
      if( action!=OE_Restrict && (action!=OE_Cascade || pChanges) ){
        Expr *pNew;
        if( action==OE_Cascade ){
          pNew = sqlite3PExpr(pParse, TK_DOT, 
            sqlite3ExprAlloc(db, TK_ID, &tNew, 0),
117263
117264
117265
117266
117267
117268
117269
117270

117271
117272
117273
117274
117275
117276
117277
117278

117279
117280
117281
117282
117283
117284
117285
117766
117767
117768
117769
117770
117771
117772

117773
117774
117775
117776
117777
117778
117779
117780
117781
117782
117783
117784
117785
117786
117787
117788
117789







-
+








+







  }

  /* If this is not a view, open the table and and all indices */
  if( !isView ){
    int nIdx;
    nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, -1, 0,
                                      &iDataCur, &iIdxCur);
    aRegIdx = sqlite3DbMallocRawNN(db, sizeof(int)*(nIdx+1));
    aRegIdx = sqlite3DbMallocRawNN(db, sizeof(int)*(nIdx+2));
    if( aRegIdx==0 ){
      goto insert_cleanup;
    }
    for(i=0, pIdx=pTab->pIndex; i<nIdx; pIdx=pIdx->pNext, i++){
      assert( pIdx );
      aRegIdx[i] = ++pParse->nMem;
      pParse->nMem += pIdx->nColumn;
    }
    aRegIdx[i] = ++pParse->nMem;  /* Register to store the table record */
  }
#ifndef SQLITE_OMIT_UPSERT
  if( pUpsert ){
    if( IsVirtual(pTab) ){
      sqlite3ErrorMsg(pParse, "UPSERT not implemented for virtual table \"%s\"",
              pTab->zName);
      goto insert_cleanup;
117674
117675
117676
117677
117678
117679
117680








117681
117682
117683
117684
117685
117686
117687
118178
118179
118180
118181
118182
118183
118184
118185
118186
118187
118188
118189
118190
118191
118192
118193
118194
118195
118196
118197
118198
118199







+
+
+
+
+
+
+
+







** value for either the rowid column or its INTEGER PRIMARY KEY alias.
**
** The code generated by this routine will store new index entries into
** registers identified by aRegIdx[].  No index entry is created for
** indices where aRegIdx[i]==0.  The order of indices in aRegIdx[] is
** the same as the order of indices on the linked list of indices
** at pTab->pIndex.
**
** (2019-05-07) The generated code also creates a new record for the
** main table, if pTab is a rowid table, and stores that record in the
** register identified by aRegIdx[nIdx] - in other words in the first
** entry of aRegIdx[] past the last index.  It is important that the
** record be generated during constraint checks to avoid affinity changes
** to the register content that occur after constraint checks but before
** the new record is inserted.
**
** The caller must have already opened writeable cursors on the main
** table and all applicable indices (that is to say, all indices for which
** aRegIdx[] is not zero).  iDataCur is the cursor for the main table when
** inserting or updating a rowid table, or the cursor for the PRIMARY KEY
** index when operating on a WITHOUT ROWID table.  iIdxCur is the cursor
** for the first index in the pTab->pIndex list.  Cursors for other indices
117865
117866
117867
117868
117869
117870
117871
117872

117873
117874
117875
117876
117877
117878
117879
118377
118378
118379
118380
118381
118382
118383

118384
118385
118386
118387
118388
118389
118390
118391







-
+







      sqlite3VdbeVerifyAbortable(v, onError);
      sqlite3ExprIfTrue(pParse, pExpr, allOk, SQLITE_JUMPIFNULL);
      if( onError==OE_Ignore ){
        sqlite3VdbeGoto(v, ignoreDest);
      }else{
        char *zName = pCheck->a[i].zName;
        if( zName==0 ) zName = pTab->zName;
        if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */
        if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-26383-51744 */
        sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK,
                              onError, zName, P4_TRANSIENT,
                              P5_ConstraintCheck);
      }
      sqlite3VdbeResolveLabel(v, allOk);
    }
    pParse->iSelfTab = 0;
118293
118294
118295
118296
118297
118298
118299










118300
118301
118302
118303
118304
118305
118306
118805
118806
118807
118808
118809
118810
118811
118812
118813
118814
118815
118816
118817
118818
118819
118820
118821
118822
118823
118824
118825
118826
118827
118828







+
+
+
+
+
+
+
+
+
+








  /* If the IPK constraint is a REPLACE, run it last */
  if( ipkTop ){
    sqlite3VdbeGoto(v, ipkTop);
    VdbeComment((v, "Do IPK REPLACE"));
    sqlite3VdbeJumpHere(v, ipkBottom);
  }

  /* Generate the table record */
  if( HasRowid(pTab) ){
    int regRec = aRegIdx[ix];
    sqlite3VdbeAddOp3(v, OP_MakeRecord, regNewData+1, pTab->nCol, regRec);
    sqlite3SetMakeRecordP5(v, pTab);
    if( !bAffinityDone ){
      sqlite3TableAffinity(v, pTab, 0);
    }
  }

  *pbMayReplace = seenReplace;
  VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace));
}

#ifdef SQLITE_ENABLE_NULL_TRIM
/*
118343
118344
118345
118346
118347
118348
118349
118350
118351
118352
118353
118354
118355
118356
118357
118358
118359
118360
118361
118362
118363
118364
118365
118366
118367
118368
118369
118370
118371
118372
118865
118866
118867
118868
118869
118870
118871


118872

118873
118874
118875
118876
118877
118878
118879
118880
118881
118882
118883

118884
118885
118886
118887
118888
118889
118890







-
-

-











-







  int update_flags,   /* True for UPDATE, False for INSERT */
  int appendBias,     /* True if this is likely to be an append */
  int useSeekResult   /* True to set the USESEEKRESULT flag on OP_[Idx]Insert */
){
  Vdbe *v;            /* Prepared statements under construction */
  Index *pIdx;        /* An index being inserted or updated */
  u8 pik_flags;       /* flag values passed to the btree insert */
  int regData;        /* Content registers (after the rowid) */
  int regRec;         /* Register holding assembled record for the table */
  int i;              /* Loop counter */
  u8 bAffinityDone = 0; /* True if OP_Affinity has been run already */

  assert( update_flags==0
       || update_flags==OPFLAG_ISUPDATE
       || update_flags==(OPFLAG_ISUPDATE|OPFLAG_SAVEPOSITION)
  );

  v = sqlite3GetVdbe(pParse);
  assert( v!=0 );
  assert( pTab->pSelect==0 );  /* This table is not a VIEW */
  for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
    if( aRegIdx[i]==0 ) continue;
    bAffinityDone = 1;
    if( pIdx->pPartIdxWhere ){
      sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
      VdbeCoverage(v);
    }
    pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
    if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
      assert( pParse->nested==0 );
118386
118387
118388
118389
118390
118391
118392
118393
118394
118395
118396
118397
118398
118399
118400
118401
118402
118403
118404
118405
118406
118407
118408
118409
118410
118411
118412

118413
118414
118415
118416
118417
118418
118419
118904
118905
118906
118907
118908
118909
118910







118911
118912
118913
118914
118915
118916
118917
118918
118919
118920
118921
118922

118923
118924
118925
118926
118927
118928
118929
118930







-
-
-
-
-
-
-












-
+







    }
    sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
                         aRegIdx[i]+1,
                         pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn);
    sqlite3VdbeChangeP5(v, pik_flags);
  }
  if( !HasRowid(pTab) ) return;
  regData = regNewData + 1;
  regRec = sqlite3GetTempReg(pParse);
  sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);
  sqlite3SetMakeRecordP5(v, pTab);
  if( !bAffinityDone ){
    sqlite3TableAffinity(v, pTab, 0);
  }
  if( pParse->nested ){
    pik_flags = 0;
  }else{
    pik_flags = OPFLAG_NCHANGE;
    pik_flags |= (update_flags?update_flags:OPFLAG_LASTROWID);
  }
  if( appendBias ){
    pik_flags |= OPFLAG_APPEND;
  }
  if( useSeekResult ){
    pik_flags |= OPFLAG_USESEEKRESULT;
  }
  sqlite3VdbeAddOp3(v, OP_Insert, iDataCur, regRec, regNewData);
  sqlite3VdbeAddOp3(v, OP_Insert, iDataCur, aRegIdx[i], regNewData);
  if( !pParse->nested ){
    sqlite3VdbeAppendP4(v, pTab, P4_TABLE);
  }
  sqlite3VdbeChangeP5(v, pik_flags);
}

/*
120591
120592
120593
120594
120595
120596
120597
120598
120599
120600
120601



120602
120603
120604
120605
120606
120607
120608
121102
121103
121104
121105
121106
121107
121108




121109
121110
121111
121112
121113
121114
121115
121116
121117
121118







-
-
-
-
+
+
+







#define PragTyp_TABLE_INFO                    34
#define PragTyp_TEMP_STORE                    35
#define PragTyp_TEMP_STORE_DIRECTORY          36
#define PragTyp_THREADS                       37
#define PragTyp_WAL_AUTOCHECKPOINT            38
#define PragTyp_WAL_CHECKPOINT                39
#define PragTyp_ACTIVATE_EXTENSIONS           40
#define PragTyp_HEXKEY                        41
#define PragTyp_KEY                           42
#define PragTyp_LOCK_STATUS                   43
#define PragTyp_STATS                         44
#define PragTyp_KEY                           41
#define PragTyp_LOCK_STATUS                   42
#define PragTyp_STATS                         43

/* Property flags associated with various pragma. */
#define PragFlg_NeedSchema 0x01 /* Force schema load before running */
#define PragFlg_NoColumns  0x02 /* OP_ResultRow called with zero columns */
#define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
#define PragFlg_ReadOnly   0x08 /* Read-only HEADER_VALUE */
#define PragFlg_Result0    0x10 /* Acts as query when no argument */
120723
120724
120725
120726
120727
120728
120729

120730
120731
120732
120733
120734

120735
120736
120737
120738
120739
120740
120741
121233
121234
121235
121236
121237
121238
121239
121240
121241
121242
121243
121244
121245
121246
121247
121248
121249
121250
121251
121252
121253







+





+







#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 {/* zName:     */ "cache_spill",
  /* ePragTyp:  */ PragTyp_CACHE_SPILL,
  /* ePragFlg:  */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
  /* ColNames:  */ 0, 0,
  /* iArg:      */ 0 },
#endif
#if !defined(SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA)
 {/* zName:     */ "case_sensitive_like",
  /* ePragTyp:  */ PragTyp_CASE_SENSITIVE_LIKE,
  /* ePragFlg:  */ PragFlg_NoColumns,
  /* ColNames:  */ 0, 0,
  /* iArg:      */ 0 },
#endif
 {/* zName:     */ "cell_size_check",
  /* ePragTyp:  */ PragTyp_FLAG,
  /* ePragFlg:  */ PragFlg_Result0|PragFlg_NoColumns1,
  /* ColNames:  */ 0, 0,
  /* iArg:      */ SQLITE_CellSizeCk },
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 {/* zName:     */ "checkpoint_fullfsync",
120865
120866
120867
120868
120869
120870
120871
120872

120873
120874
120875
120876
120877

120878
120879
120880
120881
120882
120883
120884
121377
121378
121379
121380
121381
121382
121383

121384
121385
121386
121387
121388

121389
121390
121391
121392
121393
121394
121395
121396







-
+




-
+







  /* ePragFlg:  */ PragFlg_Result0,
  /* ColNames:  */ 41, 2,
  /* iArg:      */ 0 },
#endif
#endif
#if defined(SQLITE_HAS_CODEC)
 {/* zName:     */ "hexkey",
  /* ePragTyp:  */ PragTyp_HEXKEY,
  /* ePragTyp:  */ PragTyp_KEY,
  /* ePragFlg:  */ 0,
  /* ColNames:  */ 0, 0,
  /* iArg:      */ 2 },
 {/* zName:     */ "hexrekey",
  /* ePragTyp:  */ PragTyp_HEXKEY,
  /* ePragTyp:  */ PragTyp_KEY,
  /* ePragFlg:  */ 0,
  /* ColNames:  */ 0, 0,
  /* iArg:      */ 3 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
#if !defined(SQLITE_OMIT_CHECK)
 {/* zName:     */ "ignore_check_constraints",
121831
121832
121833
121834
121835
121836
121837





121838
121839
121840
121841
121842
121843
121844
122343
122344
122345
122346
122347
122348
122349
122350
122351
122352
122353
122354
122355
122356
122357
122358
122359
122360
122361







+
+
+
+
+







        if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break;
      }
      if( !zMode ){
        /* If the "=MODE" part does not match any known journal mode,
        ** then do a query */
        eMode = PAGER_JOURNALMODE_QUERY;
      }
      if( eMode==PAGER_JOURNALMODE_OFF && (db->flags & SQLITE_Defensive)!=0 ){
        /* Do not allow journal-mode "OFF" in defensive since the database
        ** can become corrupted using ordinary SQL when the journal is off */
        eMode = PAGER_JOURNALMODE_QUERY;
      }
    }
    if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){
      /* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */
      iDb = 0;
      pId2->n = 1;
    }
    for(ii=db->nDb-1; ii>=0; ii--){
122608
122609
122610
122611
122612
122613
122614

122615
122616
122617
122618
122619
122620
122621
122622
122623

122624
122625
122626
122627
122628
122629
122630
123125
123126
123127
123128
123129
123130
123131
123132
123133
123134
123135
123136
123137
123138
123139
123140
123141
123142
123143
123144
123145
123146
123147
123148
123149







+









+







      sqlite3VdbeJumpHere(v, addrTop);
    }
  }
  break;
#endif /* !defined(SQLITE_OMIT_TRIGGER) */
#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */

#ifndef SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA
  /* Reinstall the LIKE and GLOB functions.  The variant of LIKE
  ** used will be case sensitive or not depending on the RHS.
  */
  case PragTyp_CASE_SENSITIVE_LIKE: {
    if( zRight ){
      sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0));
    }
  }
  break;
#endif /* SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA */

#ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX
# define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100
#endif

#ifndef SQLITE_OMIT_INTEGRITY_CHECK
  /*    PRAGMA integrity_check
123310
123311
123312
123313
123314
123315
123316


123317
123318


123319
123320
123321
123322
123323
123324
123325
123326
123327
123328
123329


123330
123331
123332
123333
123334









123335
123336

123337
123338






123339
123340
123341
123342
123343
123344
123345
123829
123830
123831
123832
123833
123834
123835
123836
123837


123838
123839











123840
123841





123842
123843
123844
123845
123846
123847
123848
123849
123850
123851

123852
123853

123854
123855
123856
123857
123858
123859
123860
123861
123862
123863
123864
123865
123866







+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
+

-
+
+
+
+
+
+







  **  hexkey        2
  **  hexrekey      3
  **  textkey       4
  **  textrekey     5
  */
  case PragTyp_KEY: {
    if( zRight ){
      char zBuf[40];
      const char *zKey = zRight;
      int n = pPragma->iArg<4 ? sqlite3Strlen30(zRight) : -1;
      if( (pPragma->iArg & 1)==0 ){
      int n;
      if( pPragma->iArg==2 || pPragma->iArg==3 ){
        sqlite3_key_v2(db, zDb, zRight, n);
      }else{
        sqlite3_rekey_v2(db, zDb, zRight, n);
      }
    }
    break;
  }
  case PragTyp_HEXKEY: {
    if( zRight ){
      u8 iByte;
      int i;
        u8 iByte;
        int i;
      char zKey[40];
      for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zRight[i]); i++){
        iByte = (iByte<<4) + sqlite3HexToInt(zRight[i]);
        if( (i&1)!=0 ) zKey[i/2] = iByte;
      }
        for(i=0, iByte=0; i<sizeof(zBuf)*2 && sqlite3Isxdigit(zRight[i]); i++){
          iByte = (iByte<<4) + sqlite3HexToInt(zRight[i]);
          if( (i&1)!=0 ) zBuf[i/2] = iByte;
        }
        zKey = zBuf;
        n = i/2;
      }else{
        n = pPragma->iArg<4 ? sqlite3Strlen30(zRight) : -1;
      }
      if( (pPragma->iArg & 1)==0 ){
        sqlite3_key_v2(db, zDb, zKey, i/2);
        rc = sqlite3_key_v2(db, zDb, zKey, n);
      }else{
        sqlite3_rekey_v2(db, zDb, zKey, i/2);
        rc = sqlite3_rekey_v2(db, zDb, zKey, n);
      }
      if( rc==SQLITE_OK && n!=0 ){
        sqlite3VdbeSetNumCols(v, 1);
        sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "ok", SQLITE_STATIC);
        returnSingleText(v, "ok");
      }
    }
    break;
  }
#endif
#if defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD)
  case PragTyp_ACTIVATE_EXTENSIONS: if( zRight ){
124972
124973
124974
124975
124976
124977
124978
124979

124980
124981
124982
124983
124984
124985
124986
125493
125494
125495
125496
125497
125498
125499

125500
125501
125502
125503
125504
125505
125506
125507







-
+







  pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2);
  if( pEq && isOuterJoin ){
    ExprSetProperty(pEq, EP_FromJoin);
    assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) );
    ExprSetVVAProperty(pEq, EP_NoReduce);
    pEq->iRightJoinTable = (i16)pE2->iTable;
  }
  *ppWhere = sqlite3ExprAnd(db, *ppWhere, pEq);
  *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq);
}

/*
** Set the EP_FromJoin property on all terms of the given expression.
** And set the Expr.iRightJoinTable to iTable for every term in the
** expression.
**
125106
125107
125108
125109
125110
125111
125112
125113

125114
125115
125116
125117
125118
125119
125120
125627
125628
125629
125630
125631
125632
125633

125634
125635
125636
125637
125638
125639
125640
125641







-
+







    }

    /* Add the ON clause to the end of the WHERE clause, connected by
    ** an AND operator.
    */
    if( pRight->pOn ){
      if( isOuter ) setJoinExpr(pRight->pOn, pRight->iCursor);
      p->pWhere = sqlite3ExprAnd(pParse->db, p->pWhere, pRight->pOn);
      p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pRight->pOn);
      pRight->pOn = 0;
    }

    /* Create extra terms on the WHERE clause for each column named
    ** in the USING clause.  Example: If the two tables to be joined are 
    ** A and B and the USING clause names X, Y, and Z, then add this
    ** to the WHERE clause:    A.X=B.X AND A.Y=B.Y AND A.Z=B.Z
126713
126714
126715
126716
126717
126718
126719
126720
126721
126722
126723
126724
126725
126726
126727
126728
126729
127234
127235
127236
127237
127238
127239
127240



127241
127242
127243
127244
127245
127246
127247







-
-
-







  db->flags = savedFlags;
  if( pParse->nErr ) return 0;
  while( pSelect->pPrior ) pSelect = pSelect->pPrior;
  pTab = sqlite3DbMallocZero(db, sizeof(Table) );
  if( pTab==0 ){
    return 0;
  }
  /* The sqlite3ResultSetOfSelect() is only used n contexts where lookaside
  ** is disabled */
  assert( db->lookaside.bDisable );
  pTab->nTabRef = 1;
  pTab->zName = 0;
  pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
  sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);
  sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSelect);
  pTab->iPKey = -1;
  if( db->mallocFailed ){
127157
127158
127159
127160
127161
127162
127163

127164
127165
127166
127167
127168
127169
127170
127675
127676
127677
127678
127679
127680
127681
127682
127683
127684
127685
127686
127687
127688
127689







+







  sqlite3 *db;          /* Database connection */

  /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs.  Only
  ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.
  */
  assert( p && p->pPrior );  /* Calling function guarantees this much */
  assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION );
  assert( p->selFlags & SF_Compound );
  db = pParse->db;
  pPrior = p->pPrior;
  dest = *pDest;
  if( pPrior->pOrderBy || pPrior->pLimit ){
    sqlite3ErrorMsg(pParse,"%s clause should come after %s not before",
      pPrior->pOrderBy!=0 ? "ORDER BY" : "LIMIT", selectOpName(p->op));
    rc = 1;
128651
128652
128653
128654
128655
128656
128657
128658

128659
128660
128661
128662
128663
128664
128665
128666
128667
128668
128669
128670


128671
128672


128673
128674
128675
128676
128677
128678
128679
129170
129171
129172
129173
129174
129175
129176

129177
129178
129179
129180
129181
129182
129183
129184
129185
129186
129187


129188
129189


129190
129191
129192
129193
129194
129195
129196
129197
129198







-
+










-
-
+
+
-
-
+
+







      pSub->pOrderBy = 0;
    }
    pWhere = pSub->pWhere;
    pSub->pWhere = 0;
    if( isLeftJoin>0 ){
      setJoinExpr(pWhere, iNewParent);
    }
    pParent->pWhere = sqlite3ExprAnd(db, pWhere, pParent->pWhere);
    pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere);
    if( db->mallocFailed==0 ){
      SubstContext x;
      x.pParse = pParse;
      x.iTable = iParent;
      x.iNewTable = iNewParent;
      x.isLeftJoin = isLeftJoin;
      x.pEList = pSub->pEList;
      substSelect(&x, pParent, 0);
    }
  
    /* The flattened query is distinct if either the inner or the
    ** outer query is distinct. 
    /* The flattened query is a compound if either the inner or the
    ** outer query is a compound. */
    */
    pParent->selFlags |= pSub->selFlags & SF_Distinct;
    pParent->selFlags |= pSub->selFlags & SF_Compound;
    assert( (pSub->selFlags & SF_Distinct)==0 ); /* restriction (17b) */
  
    /*
    ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;
    **
    ** One is tempted to try to add a and b to combine the limits.  But this
    ** does not work if either limit is negative.
    */
128986
128987
128988
128989
128990
128991
128992
128993

128994
128995

128996
128997
128998
128999
129000
129001
129002
129505
129506
129507
129508
129509
129510
129511

129512
129513

129514
129515
129516
129517
129518
129519
129520
129521







-
+

-
+







      x.pParse = pParse;
      x.iTable = iCursor;
      x.iNewTable = iCursor;
      x.isLeftJoin = 0;
      x.pEList = pSubq->pEList;
      pNew = substExpr(&x, pNew);
      if( pSubq->selFlags & SF_Aggregate ){
        pSubq->pHaving = sqlite3ExprAnd(pParse->db, pSubq->pHaving, pNew);
        pSubq->pHaving = sqlite3ExprAnd(pParse, pSubq->pHaving, pNew);
      }else{
        pSubq->pWhere = sqlite3ExprAnd(pParse->db, pSubq->pWhere, pNew);
        pSubq->pWhere = sqlite3ExprAnd(pParse, pSubq->pWhere, pNew);
      }
      pSubq = pSubq->pPrior;
    }
  }
  return nChng;
}
#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
129414
129415
129416
129417
129418
129419
129420
129421

129422
129423
129424
129425
129426
129427
129428
129933
129934
129935
129936
129937
129938
129939

129940
129941
129942
129943
129944
129945
129946
129947







-
+







  }
  while( pSel->pPrior ){ pSel = pSel->pPrior; }
  sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol);
  pTab->iPKey = -1;
  pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
  pTab->tabFlags |= TF_Ephemeral;

  return SQLITE_OK;
  return pParse->nErr ? SQLITE_ERROR : SQLITE_OK;
}

/*
** This routine is a Walker callback for "expanding" a SELECT statement.
** "Expanding" means to do the following:
**
**    (1)  Make sure VDBE cursor numbers have been assigned to every
129460
129461
129462
129463
129464
129465
129466




129467
129468
129469
129470
129471
129472
129473
129979
129980
129981
129982
129983
129984
129985
129986
129987
129988
129989
129990
129991
129992
129993
129994
129995
129996







+
+
+
+







  if( db->mallocFailed  ){
    return WRC_Abort;
  }
  assert( p->pSrc!=0 );
  if( (selFlags & SF_Expanded)!=0 ){
    return WRC_Prune;
  }
  if( pWalker->eCode ){
    /* Renumber selId because it has been copied from a view */
    p->selId = ++pParse->nSelect;
  }
  pTabList = p->pSrc;
  pEList = p->pEList;
  sqlite3WithPush(pParse, p->pWith, 0);

  /* Make sure cursor numbers have been assigned to all entries in
  ** the FROM clause of the SELECT statement.
  */
129509
129510
129511
129512
129513
129514
129515

129516
129517
129518
129519
129520

129521

129522
129523
129524
129525
129526
129527
129528
130032
130033
130034
130035
130036
130037
130038
130039
130040
130041
130042
130043
130044
130045
130046
130047
130048
130049
130050
130051
130052
130053
130054







+





+

+







      pTab->nTabRef++;
      if( !IsVirtual(pTab) && cannotBeFunction(pParse, pFrom) ){
        return WRC_Abort;
      }
#if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE)
      if( IsVirtual(pTab) || pTab->pSelect ){
        i16 nCol;
        u8 eCodeOrig = pWalker->eCode;
        if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort;
        assert( pFrom->pSelect==0 );
        pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0);
        nCol = pTab->nCol;
        pTab->nCol = -1;
        pWalker->eCode = 1;  /* Turn on Select.selId renumbering */
        sqlite3WalkSelect(pWalker, pFrom->pSelect);
        pWalker->eCode = eCodeOrig;
        pTab->nCol = nCol;
      }
#endif
    }

    /* Locate the index named by the INDEXED BY clause, if any. */
    if( sqlite3IndexedByLookup(pParse, pFrom) ){
129764
129765
129766
129767
129768
129769
129770

129771
129772
129773
129774
129775
129776
129777
130290
130291
130292
130293
130294
130295
130296
130297
130298
130299
130300
130301
130302
130303
130304







+







  if( OK_IF_ALWAYS_TRUE(pParse->hasCompound) ){
    w.xSelectCallback = convertCompoundSelectToSubquery;
    w.xSelectCallback2 = 0;
    sqlite3WalkSelect(&w, pSelect);
  }
  w.xSelectCallback = selectExpander;
  w.xSelectCallback2 = selectPopWith;
  w.eCode = 0;
  sqlite3WalkSelect(&w, pSelect);
}


#ifndef SQLITE_OMIT_SUBQUERY
/*
** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo()
130035
130036
130037
130038
130039
130040
130041
130042

130043
130044
130045
130046
130047
130048
130049
130562
130563
130564
130565
130566
130567
130568

130569
130570
130571
130572
130573
130574
130575
130576







-
+







    Select *pS = pWalker->u.pSelect;
    if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){
      sqlite3 *db = pWalker->pParse->db;
      Expr *pNew = sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[1], 0);
      if( pNew ){
        Expr *pWhere = pS->pWhere;
        SWAP(Expr, *pNew, *pExpr);
        pNew = sqlite3ExprAnd(db, pWhere, pNew);
        pNew = sqlite3ExprAnd(pWalker->pParse, pWhere, pNew);
        pS->pWhere = pNew;
        pWalker->eCode = 1;
      }
    }
    return WRC_Prune;
  }
  return WRC_Continue;
130090
130091
130092
130093
130094
130095
130096

130097


130098
130099
130100

130101
130102
130103
130104
130105



130106
130107
130108
130109
130110
130111
130112
130617
130618
130619
130620
130621
130622
130623
130624

130625
130626
130627
130628

130629
130630
130631
130632
130633

130634
130635
130636
130637
130638
130639
130640
130641
130642
130643







+
-
+
+


-
+




-
+
+
+







){
  struct SrcList_item *pItem;
  for(pItem = pTabList->a; pItem<pThis; pItem++){
    Select *pS1;
    if( pItem->pSelect==0 ) continue;
    if( pItem->fg.viaCoroutine ) continue;
    if( pItem->zName==0 ) continue;
    assert( pItem->pTab!=0 );
    if( sqlite3_stricmp(pItem->zDatabase, pThis->zDatabase)!=0 ) continue;
    assert( pThis->pTab!=0 );
    if( pItem->pTab->pSchema!=pThis->pTab->pSchema ) continue;
    if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue;
    pS1 = pItem->pSelect;
    if( pThis->pSelect->selId!=pS1->selId ){
    if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){
      /* The query flattener left two different CTE tables with identical
      ** names in the same FROM clause. */
      continue;
    }
    if( sqlite3ExprCompare(0, pThis->pSelect->pWhere, pS1->pWhere, -1) ){
    if( sqlite3ExprCompare(0, pThis->pSelect->pWhere, pS1->pWhere, -1)
     || sqlite3ExprCompare(0, pThis->pSelect->pHaving, pS1->pHaving, -1) 
    ){
      /* The view was modified by some other optimization such as
      ** pushDownWhereTerms() */
      continue;
    }
    return pItem;
  }
  return 0;
130123
130124
130125
130126
130127
130128
130129
130130


130131
130132
130133
130134
130135
130136
130137
130138
130139
130140


130141
130142
130143
130144
130145
130146
130147
130654
130655
130656
130657
130658
130659
130660

130661
130662
130663
130664
130665
130666
130667
130668
130669
130670
130671
130672
130673
130674
130675
130676
130677
130678
130679
130680
130681







-
+
+










+
+







**    SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2)
**
** The transformation only works if all of the following are true:
**
**   *  The subquery is a UNION ALL of two or more terms
**   *  The subquery does not have a LIMIT clause
**   *  There is no WHERE or GROUP BY or HAVING clauses on the subqueries
**   *  The outer query is a simple count(*)
**   *  The outer query is a simple count(*) with no WHERE clause or other
**      extraneous syntax.
**
** Return TRUE if the optimization is undertaken.
*/
static int countOfViewOptimization(Parse *pParse, Select *p){
  Select *pSub, *pPrior;
  Expr *pExpr;
  Expr *pCount;
  sqlite3 *db;
  if( (p->selFlags & SF_Aggregate)==0 ) return 0;   /* This is an aggregate */
  if( p->pEList->nExpr!=1 ) return 0;               /* Single result column */
  if( p->pWhere ) return 0;
  if( p->pGroupBy ) return 0;
  pExpr = p->pEList->a[0].pExpr;
  if( pExpr->op!=TK_AGG_FUNCTION ) return 0;        /* Result is an aggregate */
  if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0;  /* Is count() */
  if( pExpr->x.pList!=0 ) return 0;                 /* Must be count(*) */
  if( p->pSrc->nSrc!=1 ) return 0;                  /* One table in FROM  */
  pSub = p->pSrc->a[0].pSelect;
  if( pSub==0 ) return 0;                           /* The FROM is a subquery */
132784
132785
132786
132787
132788
132789
132790

132791
132792
132793
132794
132795

132796
132797
132798
132799
132800
132801
132802
133318
133319
133320
133321
133322
133323
133324
133325
133326
133327
133328
133329

133330
133331
133332
133333
133334
133335
133336
133337







+




-
+







  Table *pTab;           /* The table to be updated */
  int addrTop = 0;       /* VDBE instruction address of the start of the loop */
  WhereInfo *pWInfo;     /* Information about the WHERE clause */
  Vdbe *v;               /* The virtual database engine */
  Index *pIdx;           /* For looping over indices */
  Index *pPk;            /* The PRIMARY KEY index for WITHOUT ROWID tables */
  int nIdx;              /* Number of indices that need updating */
  int nAllIdx;           /* Total number of indexes */
  int iBaseCur;          /* Base cursor number */
  int iDataCur;          /* Cursor for the canonical data btree */
  int iIdxCur;           /* Cursor for the first index */
  sqlite3 *db;           /* The database structure */
  int *aRegIdx = 0;      /* First register in array assigned to each index */
  int *aRegIdx = 0;      /* Registers for to each index and the main table */
  int *aXRef = 0;        /* aXRef[i] is the index in pChanges->a[] of the
                         ** an expression for the i-th column of the table.
                         ** aXRef[i]==-1 if the i-th column is not changed. */
  u8 *aToOpen;           /* 1 for tables and indices to be opened */
  u8 chngPk;             /* PRIMARY KEY changed in a WITHOUT ROWID table */
  u8 chngRowid;          /* Rowid changed in a normal table */
  u8 chngKey;            /* Either chngPk or chngRowid */
132902
132903
132904
132905
132906
132907
132908
132909

132910
132911
132912

132913
132914
132915
132916
132917
132918
132919
133437
133438
133439
133440
133441
133442
133443

133444
133445
133446

133447
133448
133449
133450
133451
133452
133453
133454







-
+


-
+







    pParse->nTab = iBaseCur;
  }
  pTabList->a[0].iCursor = iDataCur;

  /* Allocate space for aXRef[], aRegIdx[], and aToOpen[].  
  ** Initialize aXRef[] and aToOpen[] to their default values.
  */
  aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx) + nIdx+2 );
  aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx+1) + nIdx+2 );
  if( aXRef==0 ) goto update_cleanup;
  aRegIdx = aXRef+pTab->nCol;
  aToOpen = (u8*)(aRegIdx+nIdx);
  aToOpen = (u8*)(aRegIdx+nIdx+1);
  memset(aToOpen, 1, nIdx+1);
  aToOpen[nIdx+1] = 0;
  for(i=0; i<pTab->nCol; i++) aXRef[i] = -1;

  /* Initialize the name-context */
  memset(&sNC, 0, sizeof(sNC));
  sNC.pParse = pParse;
132984
132985
132986
132987
132988
132989
132990
132991

132992
132993
132994
132995
132996
132997
132998
132999
133000
133001
133002
133003
133004
133005
133006
133007
133008
133009
133010
133011
133012


133013

133014
133015
133016
133017
133018
133019
133020
133021
133022
133023
133024
133025
133026
133027






133028

133029
133030
133031
133032
133033
133034
133035
133519
133520
133521
133522
133523
133524
133525

133526
133527
133528
133529
133530
133531
133532
133533
133534
133535
133536
133537
133538
133539
133540
133541
133542
133543
133544
133545


133546
133547
133548
133549
133550
133551
133552
133553
133554
133555
133556
133557
133558
133559
133560
133561
133562
133563
133564
133565
133566
133567
133568
133569

133570
133571
133572
133573
133574
133575
133576
133577







-
+



















-
-
+
+

+














+
+
+
+
+
+
-
+







  hasFK = sqlite3FkRequired(pParse, pTab, aXRef, chngKey);

  /* There is one entry in the aRegIdx[] array for each index on the table
  ** being updated.  Fill in aRegIdx[] with a register number that will hold
  ** the key for accessing each index.
  */
  if( onError==OE_Replace ) bReplace = 1;
  for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
  for(nAllIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nAllIdx++){
    int reg;
    if( chngKey || hasFK>1 || pIdx==pPk
     || indexWhereClauseMightChange(pIdx,aXRef,chngRowid)
    ){
      reg = ++pParse->nMem;
      pParse->nMem += pIdx->nColumn;
    }else{
      reg = 0;
      for(i=0; i<pIdx->nKeyCol; i++){
        if( indexColumnIsBeingUpdated(pIdx, i, aXRef, chngRowid) ){
          reg = ++pParse->nMem;
          pParse->nMem += pIdx->nColumn;
          if( onError==OE_Default && pIdx->onError==OE_Replace ){
            bReplace = 1;
          }
          break;
        }
      }
    }
    if( reg==0 ) aToOpen[j+1] = 0;
    aRegIdx[j] = reg;
    if( reg==0 ) aToOpen[nAllIdx+1] = 0;
    aRegIdx[nAllIdx] = reg;
  }
  aRegIdx[nAllIdx] = ++pParse->nMem;  /* Register storing the table record */
  if( bReplace ){
    /* If REPLACE conflict resolution might be invoked, open cursors on all 
    ** indexes in case they are needed to delete records.  */
    memset(aToOpen, 1, nIdx+1);
  }

  /* Begin generating code. */
  v = sqlite3GetVdbe(pParse);
  if( v==0 ) goto update_cleanup;
  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
  sqlite3BeginWriteOperation(pParse, pTrigger || hasFK, iDb);

  /* Allocate required registers. */
  if( !IsVirtual(pTab) ){
    /* For now, regRowSet and aRegIdx[nAllIdx] share the same register.
    ** If regRowSet turns out to be needed, then aRegIdx[nAllIdx] will be
    ** reallocated.  aRegIdx[nAllIdx] is the register in which the main
    ** table record is written.  regRowSet holds the RowSet for the
    ** two-pass update algorithm. */
    assert( aRegIdx[nAllIdx]==pParse->nMem );
    regRowSet = ++pParse->nMem;
    regRowSet = aRegIdx[nAllIdx];
    regOldRowid = regNewRowid = ++pParse->nMem;
    if( chngPk || pTrigger || hasFK ){
      regOld = pParse->nMem + 1;
      pParse->nMem += pTab->nCol;
    }
    if( chngKey || pTrigger || hasFK ){
      regNewRowid = ++pParse->nMem;
133151
133152
133153
133154
133155
133156
133157


133158
133159
133160
133161
133162
133163
133164
133693
133694
133695
133696
133697
133698
133699
133700
133701
133702
133703
133704
133705
133706
133707
133708







+
+








  if( HasRowid(pTab) ){
    /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF
    ** mode, write the rowid into the FIFO. In either of the one-pass modes,
    ** leave it in register regOldRowid.  */
    sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid);
    if( eOnePass==ONEPASS_OFF ){
      /* We need to use regRowSet, so reallocate aRegIdx[nAllIdx] */
      aRegIdx[nAllIdx] = ++pParse->nMem;
      sqlite3VdbeAddOp2(v, OP_RowSetAdd, regRowSet, regOldRowid);
    }
  }else{
    /* Read the PK of the current row into an array of registers. In
    ** ONEPASS_OFF mode, serialize the array into a record and store it in
    ** the ephemeral table. Or, in ONEPASS_SINGLE or MULTI mode, change
    ** the OP_OpenEphemeral instruction to a Noop (the ephemeral table 
133982
133983
133984
133985
133986
133987
133988

133989
133990
133991
133992
133993
133994
133995
134526
134527
134528
134529
134530
134531
134532
134533
134534
134535
134536
134537
134538
134539
134540







+







** transient would cause the database file to appear to be deleted
** following reboot.
*/
SQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse, Token *pNm, Expr *pInto){
  Vdbe *v = sqlite3GetVdbe(pParse);
  int iDb = 0;
  if( v==0 ) goto build_vacuum_end;
  if( pParse->nErr ) goto build_vacuum_end;
  if( pNm ){
#ifndef SQLITE_BUG_COMPATIBLE_20160819
    /* Default behavior:  Report an error if the argument to VACUUM is
    ** not recognized */
    iDb = sqlite3TwoPartName(pParse, pNm, pNm, &pNm);
    if( iDb<0 ) goto build_vacuum_end;
#else
135134
135135
135136
135137
135138
135139
135140

135141
135142
135143
135144
135145
135146
135147
135148

135149
135150
135151
135152
135153
135154
135155
135679
135680
135681
135682
135683
135684
135685
135686
135687
135688
135689
135690
135691
135692
135693
135694
135695
135696
135697
135698
135699
135700
135701
135702







+








+







      if( p->pVtab->nRef>0 ){
        return SQLITE_LOCKED;
      }
    }
    p = vtabDisconnectAll(db, pTab);
    xDestroy = p->pMod->pModule->xDestroy;
    assert( xDestroy!=0 );  /* Checked before the virtual table is created */
    pTab->nTabRef++;
    rc = xDestroy(p->pVtab);
    /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */
    if( rc==SQLITE_OK ){
      assert( pTab->pVTable==p && p->pNext==0 );
      p->pVtab = 0;
      pTab->pVTable = 0;
      sqlite3VtabUnlock(p);
    }
    sqlite3DeleteTable(db, pTab);
  }

  return rc;
}

/*
** This function invokes either the xRollback or xCommit method
135584
135585
135586
135587
135588
135589
135590


135591
135592
135593
135594
135595
135596
135597
136131
136132
136133
136134
136135
136136
136137
136138
136139
136140
136141
136142
136143
136144
136145
136146







+
+







**
*************************************************************************
**
** This file contains structure and macro definitions for the query
** planner logic in "where.c".  These definitions are broken out into
** a separate source file for easier editing.
*/
#ifndef SQLITE_WHEREINT_H
#define SQLITE_WHEREINT_H

/*
** Trace output macros
*/
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
/***/ extern int sqlite3WhereTrace;
#endif
136154
136155
136156
136157
136158
136159
136160


136161
136162
136163
136164
136165
136166
136167
136703
136704
136705
136706
136707
136708
136709
136710
136711
136712
136713
136714
136715
136716
136717
136718







+
+







#define WHERE_ONEROW       0x00001000  /* Selects no more than one row */
#define WHERE_MULTI_OR     0x00002000  /* OR using multiple indices */
#define WHERE_AUTO_INDEX   0x00004000  /* Uses an ephemeral index */
#define WHERE_SKIPSCAN     0x00008000  /* Uses the skip-scan algorithm */
#define WHERE_UNQ_WANTED   0x00010000  /* WHERE_ONEROW would have been helpful*/
#define WHERE_PARTIALIDX   0x00020000  /* The automatic index is partial */
#define WHERE_IN_EARLYOUT  0x00040000  /* Perhaps quit IN loops early */

#endif /* !defined(SQLITE_WHEREINT_H) */

/************** End of whereInt.h ********************************************/
/************** Continuing where we left off in wherecode.c ******************/

#ifndef SQLITE_OMIT_EXPLAIN

/*
137137
137138
137139
137140
137141
137142
137143
137144

137145
137146
137147
137148
137149
137150
137151
137688
137689
137690
137691
137692
137693
137694

137695
137696
137697
137698
137699
137700
137701
137702







-
+







      sWalker.eCode = 0;
      sWalker.xExprCallback = codeCursorHintCheckExpr;
      sqlite3WalkExpr(&sWalker, pTerm->pExpr);
      if( sWalker.eCode ) continue;
    }

    /* If we survive all prior tests, that means this term is worth hinting */
    pExpr = sqlite3ExprAnd(db, pExpr, sqlite3ExprDup(db, pTerm->pExpr, 0));
    pExpr = sqlite3ExprAnd(pParse, pExpr, sqlite3ExprDup(db, pTerm->pExpr, 0));
  }
  if( pExpr!=0 ){
    sWalker.xExprCallback = codeCursorHintFixExpr;
    sqlite3WalkExpr(&sWalker, pExpr);
    sqlite3VdbeAddOp4(v, OP_CursorHint, 
                      (sHint.pIdx ? sHint.iIdxCur : sHint.iTabCur), 0, 0,
                      (const char*)pExpr, P4_EXPR);
138102
138103
138104
138105
138106
138107
138108
138109

138110
138111
138112
138113
138114
138115
138116
138653
138654
138655
138656
138657
138658
138659

138660
138661
138662
138663
138664
138665
138666
138667







-
+







        if( &pWC->a[iTerm] == pTerm ) continue;
        testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );
        testcase( pWC->a[iTerm].wtFlags & TERM_CODED );
        if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue;
        if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
        testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
        pExpr = sqlite3ExprDup(db, pExpr, 0);
        pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr);
        pAndExpr = sqlite3ExprAnd(pParse, pAndExpr, pExpr);
      }
      if( pAndExpr ){
        /* The extra 0x10000 bit on the opcode is masked off and does not
        ** become part of the new Expr.op.  However, it does make the
        ** op==TK_AND comparison inside of sqlite3PExpr() false, and this
        ** prevents sqlite3PExpr() from implementing AND short-circuit 
        ** optimization, which we do not want here. */
138253
138254
138255
138256
138257
138258
138259
138260

138261
138262
138263
138264
138265
138266
138267
138804
138805
138806
138807
138808
138809
138810

138811
138812
138813
138814
138815
138816
138817
138818







-
+







      pAndExpr->pLeft = 0;
      sqlite3ExprDelete(db, pAndExpr);
    }
    sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v));
    sqlite3VdbeGoto(v, pLevel->addrBrk);
    sqlite3VdbeResolveLabel(v, iLoopBody);

    if( pWInfo->nLevel>1 ) sqlite3StackFree(db, pOrTab);
    if( pWInfo->nLevel>1 ){ sqlite3StackFree(db, pOrTab); }
    if( !untestedTerms ) disableTerm(pLevel, pTerm);
  }else
#endif /* SQLITE_OMIT_OR_OPTIMIZATION */

  {
    /* Case 6:  There is no usable index.  We must do a complete
    **          scan of the entire table.
138686
138687
138688
138689
138690
138691
138692

138693
138694
138695
138696



138697
138698
138699

138700


138701

138702
138703
138704



138705
138706
138707
138708
138709
138710
138711
138712
138713













138714
138715
138716
138717
138718
138719
138720
139237
139238
139239
139240
139241
139242
139243
139244
139245



139246
139247
139248



139249
139250
139251
139252

139253



139254
139255
139256
139257








139258
139259
139260
139261
139262
139263
139264
139265
139266
139267
139268
139269
139270
139271
139272
139273
139274
139275
139276
139277







+

-
-
-
+
+
+
-
-
-
+

+
+
-
+
-
-
-
+
+
+

-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+







        char *zNew = pPrefix->u.zToken;
        zNew[cnt] = 0;
        for(iFrom=iTo=0; iFrom<cnt; iFrom++){
          if( zNew[iFrom]==wc[3] ) iFrom++;
          zNew[iTo++] = zNew[iFrom];
        }
        zNew[iTo] = 0;
        assert( iTo>0 );

        /* If the RHS begins with a digit or a minus sign, then the LHS must be
        ** an ordinary column (not a virtual table column) with TEXT affinity.
        ** Otherwise the LHS might be numeric and "lhs >= rhs" would be false
        /* If the LHS is not an ordinary column with TEXT affinity, then the
        ** pattern prefix boundaries (both the start and end boundaries) must
        ** not look like a number.  Otherwise the pattern might be treated as
        ** even though "lhs LIKE rhs" is true.  But if the RHS does not start
        ** with a digit or '-', then "lhs LIKE rhs" will always be false if
        ** the LHS is numeric and so the optimization still works.
        ** a number, which will invalidate the LIKE optimization.
        **
        ** Getting this right has been a persistent source of bugs in the
        ** LIKE optimization.  See, for example:
        ** 2018-09-10 ticket c94369cae9b561b1f996d0054bfab11389f9d033
        **    2018-09-10 https://sqlite.org/src/info/c94369cae9b561b1
        ** The RHS pattern must not be '/%' because the termination condition
        ** will then become "x<'0'" and if the affinity is numeric, will then
        ** be converted into "x<0", which is incorrect.
        **    2019-05-02 https://sqlite.org/src/info/b043a54c3de54b28
        **    2019-06-10 https://sqlite.org/src/info/fd76310a5e843e07
        **    2019-06-14 https://sqlite.org/src/info/ce8717f0885af975
        */
        if( sqlite3Isdigit(zNew[0])
         || zNew[0]=='-'
         || (zNew[0]+1=='0' && iTo==1)
        ){
          if( pLeft->op!=TK_COLUMN 
           || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT 
           || IsVirtual(pLeft->y.pTab)  /* Value might be numeric */
          ){
        if( pLeft->op!=TK_COLUMN 
         || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT 
         || IsVirtual(pLeft->y.pTab)  /* Value might be numeric */
        ){
          int isNum;
          double rDummy;
          isNum = sqlite3AtoF(zNew, &rDummy, iTo, SQLITE_UTF8);
          if( isNum<=0 ){
            zNew[iTo-1]++;
            isNum = sqlite3AtoF(zNew, &rDummy, iTo, SQLITE_UTF8);
            zNew[iTo-1]--;
          }
          if( isNum>0 ){
            sqlite3ExprDelete(db, pPrefix);
            sqlite3ValueFree(pVal);
            return 0;
          }
        }
      }
      *ppPrefix = pPrefix;
140593
140594
140595
140596
140597
140598
140599
140600
140601
140602
140603




140604
140605
140606
140607
140608
140609
140610

140611
140612
140613
140614
140615
140616
140617
140618
140619
140620
140621
140622
140623
140624

140625
140626
140627


140628
140629
140630
140631
140632
140633
140634
140635
141150
141151
141152
141153
141154
141155
141156




141157
141158
141159
141160
141161
141162
141163
141164
141165
141166

141167
141168
141169
141170
141171
141172
141173
141174
141175
141176
141177
141178
141179
141180

141181



141182
141183

141184
141185
141186
141187
141188
141189
141190







-
-
-
-
+
+
+
+






-
+













-
+
-
-
-
+
+
-







/*
** Convert OP_Column opcodes to OP_Copy in previously generated code.
**
** This routine runs over generated VDBE code and translates OP_Column
** opcodes into OP_Copy when the table is being accessed via co-routine 
** instead of via table lookup.
**
** If the bIncrRowid parameter is 0, then any OP_Rowid instructions on
** cursor iTabCur are transformed into OP_Null. Or, if bIncrRowid is non-zero,
** then each OP_Rowid is transformed into an instruction to increment the
** value stored in its output register.
** If the iAutoidxCur is not zero, then any OP_Rowid instructions on
** cursor iTabCur are transformed into OP_Sequence opcode for the
** iAutoidxCur cursor, in order to generate unique rowids for the
** automatic index being generated.
*/
static void translateColumnToCopy(
  Parse *pParse,      /* Parsing context */
  int iStart,         /* Translate from this opcode to the end */
  int iTabCur,        /* OP_Column/OP_Rowid references to this table */
  int iRegister,      /* The first column is in this register */
  int bIncrRowid      /* If non-zero, transform OP_rowid to OP_AddImm(1) */
  int iAutoidxCur     /* If non-zero, cursor of autoindex being generated */
){
  Vdbe *v = pParse->pVdbe;
  VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart);
  int iEnd = sqlite3VdbeCurrentAddr(v);
  if( pParse->db->mallocFailed ) return;
  for(; iStart<iEnd; iStart++, pOp++){
    if( pOp->p1!=iTabCur ) continue;
    if( pOp->opcode==OP_Column ){
      pOp->opcode = OP_Copy;
      pOp->p1 = pOp->p2 + iRegister;
      pOp->p2 = pOp->p3;
      pOp->p3 = 0;
    }else if( pOp->opcode==OP_Rowid ){
      if( bIncrRowid ){
      if( iAutoidxCur ){
        /* Increment the value stored in the P2 operand of the OP_Rowid. */
        pOp->opcode = OP_AddImm;
        pOp->p1 = pOp->p2;
        pOp->opcode = OP_Sequence;
        pOp->p1 = iAutoidxCur;
        pOp->p2 = 1;
      }else{
        pOp->opcode = OP_Null;
        pOp->p1 = 0;
        pOp->p3 = 0;
      }
    }
  }
140768
140769
140770
140771
140772
140773
140774
140775

140776
140777
140778
140779
140780
140781
140782
141323
141324
141325
141326
141327
141328
141329

141330
141331
141332
141333
141334
141335
141336
141337







-
+







    assert( !ExprHasProperty(pExpr, EP_FromJoin)    /* prereq always non-zero */
         || pExpr->iRightJoinTable!=pSrc->iCursor   /*   for the right-hand   */
         || pLoop->prereq!=0 );                     /*   table of a LEFT JOIN */
    if( pLoop->prereq==0
     && (pTerm->wtFlags & TERM_VIRTUAL)==0
     && !ExprHasProperty(pExpr, EP_FromJoin)
     && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
      pPartial = sqlite3ExprAnd(pParse->db, pPartial,
      pPartial = sqlite3ExprAnd(pParse, pPartial,
                                sqlite3ExprDup(pParse->db, pExpr, 0));
    }
    if( termCanDriveIndex(pTerm, pSrc, notReady) ){
      int iCol = pTerm->u.leftColumn;
      Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
      testcase( iCol==BMS );
      testcase( iCol==BMS-1 );
140895
140896
140897
140898
140899
140900
140901

140902
140903

140904
140905
140906
140907
140908
140909
140910
141450
141451
141452
141453
141454
141455
141456
141457
141458

141459
141460
141461
141462
141463
141464
141465
141466







+

-
+







  );
  sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
  sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
  if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
  if( pTabItem->fg.viaCoroutine ){
    sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
    testcase( pParse->db->mallocFailed );
    assert( pLevel->iIdxCur>0 );
    translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
                          pTabItem->regResult, 1);
                          pTabItem->regResult, pLevel->iIdxCur);
    sqlite3VdbeGoto(v, addrTop);
    pTabItem->fg.viaCoroutine = 0;
  }else{
    sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
  }
  sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
  sqlite3VdbeJumpHere(v, addrTop);
146141
146142
146143
146144
146145
146146
146147

146148
146149
146150
146151
146152
146153
146154
146697
146698
146699
146700
146701
146702
146703
146704
146705
146706
146707
146708
146709
146710
146711







+







** selectWindowRewriteExprCb() by selectWindowRewriteEList().
*/
typedef struct WindowRewrite WindowRewrite;
struct WindowRewrite {
  Window *pWin;
  SrcList *pSrc;
  ExprList *pSub;
  Table *pTab;
  Select *pSubSelect;             /* Current sub-select, if any */
};

/*
** Callback function used by selectWindowRewriteEList(). If necessary,
** this function appends to the output expression-list and updates 
** expression (*ppExpr) in place.
146201
146202
146203
146204
146205
146206
146207

146208
146209
146210
146211
146212
146213
146214
146758
146759
146760
146761
146762
146763
146764
146765
146766
146767
146768
146769
146770
146771
146772







+







        sqlite3ExprDelete(pParse->db, pExpr);
        ExprClearProperty(pExpr, EP_Static);
        memset(pExpr, 0, sizeof(Expr));

        pExpr->op = TK_COLUMN;
        pExpr->iColumn = p->pSub->nExpr-1;
        pExpr->iTable = p->pWin->iEphCsr;
        pExpr->y.pTab = p->pTab;
      }

      break;
    }

    default: /* no-op */
      break;
146244
146245
146246
146247
146248
146249
146250

146251
146252
146253
146254
146255
146256
146257
146258
146259
146260
146261

146262
146263
146264
146265
146266
146267
146268
146269
146270
146271
146272
146273
146274
146275
146276
146277
146278
146279
146280


146281
146282
146283
146284
146285
146286




146287
146288
146289
146290
146291
146292
146293
146802
146803
146804
146805
146806
146807
146808
146809
146810
146811
146812
146813
146814
146815
146816
146817
146818
146819
146820
146821
146822
146823
146824
146825
146826
146827
146828
146829
146830
146831
146832
146833
146834
146835
146836
146837
146838
146839

146840
146841
146842
146843
146844
146845
146846
146847
146848
146849
146850
146851
146852
146853
146854
146855
146856
146857
146858







+











+


















-
+
+






+
+
+
+







** appending the new one.
*/
static void selectWindowRewriteEList(
  Parse *pParse, 
  Window *pWin,
  SrcList *pSrc,
  ExprList *pEList,               /* Rewrite expressions in this list */
  Table *pTab,
  ExprList **ppSub                /* IN/OUT: Sub-select expression-list */
){
  Walker sWalker;
  WindowRewrite sRewrite;

  memset(&sWalker, 0, sizeof(Walker));
  memset(&sRewrite, 0, sizeof(WindowRewrite));

  sRewrite.pSub = *ppSub;
  sRewrite.pWin = pWin;
  sRewrite.pSrc = pSrc;
  sRewrite.pTab = pTab;

  sWalker.pParse = pParse;
  sWalker.xExprCallback = selectWindowRewriteExprCb;
  sWalker.xSelectCallback = selectWindowRewriteSelectCb;
  sWalker.u.pRewrite = &sRewrite;

  (void)sqlite3WalkExprList(&sWalker, pEList);

  *ppSub = sRewrite.pSub;
}

/*
** Append a copy of each expression in expression-list pAppend to
** expression list pList. Return a pointer to the result list.
*/
static ExprList *exprListAppendList(
  Parse *pParse,          /* Parsing context */
  ExprList *pList,        /* List to which to append. Might be NULL */
  ExprList *pAppend       /* List of values to append. Might be NULL */
  ExprList *pAppend,      /* List of values to append. Might be NULL */
  int bIntToNull
){
  if( pAppend ){
    int i;
    int nInit = pList ? pList->nExpr : 0;
    for(i=0; i<pAppend->nExpr; i++){
      Expr *pDup = sqlite3ExprDup(pParse->db, pAppend->a[i].pExpr, 0);
      if( bIntToNull && pDup && pDup->op==TK_INTEGER ){
        pDup->op = TK_NULL;
        pDup->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse);
      }
      pList = sqlite3ExprListAppend(pParse, pList, pDup);
      if( pList ) pList->a[nInit+i].sortOrder = pAppend->a[i].sortOrder;
    }
  }
  return pList;
}

146309
146310
146311
146312
146313
146314
146315






146316
146317
146318
146319
146320

146321
146322
146323
146324
146325
146326

146327
146328
146329
146330
146331
146332
146333
146334
146335
146336
146337
146338
146339
146340
146341


146342
146343
146344
146345
146346
146347
146348


146349
146350
146351
146352
146353
146354
146355
146356

146357
146358
146359
146360
146361
146362
146363
146874
146875
146876
146877
146878
146879
146880
146881
146882
146883
146884
146885
146886
146887
146888
146889
146890
146891
146892
146893
146894
146895
146896
146897

146898
146899
146900
146901
146902
146903
146904
146905
146906
146907
146908
146909
146910
146911


146912
146913
146914
146915
146916
146917
146918


146919
146920
146921
146922
146923
146924
146925
146926
146927

146928
146929
146930
146931
146932
146933
146934
146935







+
+
+
+
+
+





+





-
+













-
-
+
+





-
-
+
+







-
+







    ExprList *pGroupBy = p->pGroupBy;
    Expr *pHaving = p->pHaving;
    ExprList *pSort = 0;

    ExprList *pSublist = 0;       /* Expression list for sub-query */
    Window *pMWin = p->pWin;      /* Master window object */
    Window *pWin;                 /* Window object iterator */
    Table *pTab;

    pTab = sqlite3DbMallocZero(db, sizeof(Table));
    if( pTab==0 ){
      return SQLITE_NOMEM;
    }

    p->pSrc = 0;
    p->pWhere = 0;
    p->pGroupBy = 0;
    p->pHaving = 0;
    p->selFlags &= ~SF_Aggregate;

    /* Create the ORDER BY clause for the sub-select. This is the concatenation
    ** of the window PARTITION and ORDER BY clauses. Then, if this makes it
    ** redundant, remove the ORDER BY from the parent SELECT.  */
    pSort = sqlite3ExprListDup(db, pMWin->pPartition, 0);
    pSort = exprListAppendList(pParse, pSort, pMWin->pOrderBy);
    pSort = exprListAppendList(pParse, pSort, pMWin->pOrderBy, 1);
    if( pSort && p->pOrderBy ){
      if( sqlite3ExprListCompare(pSort, p->pOrderBy, -1)==0 ){
        sqlite3ExprListDelete(db, p->pOrderBy);
        p->pOrderBy = 0;
      }
    }

    /* Assign a cursor number for the ephemeral table used to buffer rows.
    ** The OpenEphemeral instruction is coded later, after it is known how
    ** many columns the table will have.  */
    pMWin->iEphCsr = pParse->nTab++;
    pParse->nTab += 3;

    selectWindowRewriteEList(pParse, pMWin, pSrc, p->pEList, &pSublist);
    selectWindowRewriteEList(pParse, pMWin, pSrc, p->pOrderBy, &pSublist);
    selectWindowRewriteEList(pParse, pMWin, pSrc, p->pEList, pTab, &pSublist);
    selectWindowRewriteEList(pParse, pMWin, pSrc, p->pOrderBy, pTab, &pSublist);
    pMWin->nBufferCol = (pSublist ? pSublist->nExpr : 0);

    /* Append the PARTITION BY and ORDER BY expressions to the to the 
    ** sub-select expression list. They are required to figure out where 
    ** boundaries for partitions and sets of peer rows lie.  */
    pSublist = exprListAppendList(pParse, pSublist, pMWin->pPartition);
    pSublist = exprListAppendList(pParse, pSublist, pMWin->pOrderBy);
    pSublist = exprListAppendList(pParse, pSublist, pMWin->pPartition, 0);
    pSublist = exprListAppendList(pParse, pSublist, pMWin->pOrderBy, 0);

    /* Append the arguments passed to each window function to the
    ** sub-select expression list. Also allocate two registers for each
    ** window function - one for the accumulator, another for interim
    ** results.  */
    for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
      pWin->iArgCol = (pSublist ? pSublist->nExpr : 0);
      pSublist = exprListAppendList(pParse, pSublist, pWin->pOwner->x.pList);
      pSublist = exprListAppendList(pParse, pSublist, pWin->pOwner->x.pList, 0);
      if( pWin->pFilter ){
        Expr *pFilter = sqlite3ExprDup(db, pWin->pFilter, 0);
        pSublist = sqlite3ExprListAppend(pParse, pSublist, pFilter);
      }
      pWin->regAccum = ++pParse->nMem;
      pWin->regResult = ++pParse->nMem;
      sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum);
146376
146377
146378
146379
146380
146381
146382

146383
146384

146385


146386
146387

146388
146389


146390

146391
146392
146393
146394
146395
146396
146397
146398
146399
146400

146401
146402
146403
146404
146405
146406
146407
146948
146949
146950
146951
146952
146953
146954
146955
146956
146957
146958

146959
146960
146961
146962
146963


146964
146965

146966
146967

146968
146969
146970
146971
146972
146973
146974
146975
146976
146977
146978
146979
146980
146981
146982
146983







+


+
-
+
+


+
-
-
+
+
-
+

-








+







    }

    pSub = sqlite3SelectNew(
        pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
    );
    p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
    if( p->pSrc ){
      Table *pTab2;
      p->pSrc->a[0].pSelect = pSub;
      sqlite3SrcListAssignCursors(pParse, p->pSrc);
      pSub->selFlags |= SF_Expanded;
      if( sqlite3ExpandSubquery(pParse, &p->pSrc->a[0]) ){
      pTab2 = sqlite3ResultSetOfSelect(pParse, pSub);
      if( pTab2==0 ){
        rc = SQLITE_NOMEM;
      }else{
        memcpy(pTab, pTab2, sizeof(Table));
        pSub->selFlags |= SF_Expanded;
        p->selFlags &= ~SF_Aggregate;
        pTab->tabFlags |= TF_Ephemeral;
        p->pSrc->a[0].pTab = pTab;
        sqlite3SelectPrep(pParse, pSub, 0);
        pTab = pTab2;
      }

      sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pMWin->iEphCsr, pSublist->nExpr);
      sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+1, pMWin->iEphCsr);
      sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+2, pMWin->iEphCsr);
      sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+3, pMWin->iEphCsr);
    }else{
      sqlite3SelectDelete(db, pSub);
    }
    if( db->mallocFailed ) rc = SQLITE_NOMEM;
    sqlite3DbFree(db, pTab);
  }

  return rc;
}

/*
** Free the Window object passed as the second argument.
148361
148362
148363
148364
148365
148366
148367
148368

148369
148370
148371
148372
148373
148374
148375
148376
148377
148378
148379
148380
148381
148382
148383












148384
148385
148386
148387


148388
148389

148390
148391
148392
148393
148394
148395
148396
148397
148398
148399
148400
148401
148402
148403
148404
148405
148406


148407
148408
148409


148410
148411
148412
148413
148414
148415

148416
148417
148418
148419
148420
148421
148422
148937
148938
148939
148940
148941
148942
148943

148944
148945
148946
148947
148948
148949
148950









148951
148952
148953
148954
148955
148956
148957
148958
148959
148960
148961
148962




148963
148964


148965
148966
148967
148968
148969
148970
148971
148972
148973
148974
148975
148976
148977
148978
148979
148980


148981
148982
148983


148984
148985
148986
148987
148988
148989
148990

148991
148992
148993
148994
148995
148996
148997
148998







-
+






-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
-
-
+















-
-
+
+

-
-
+
+





-
+







**    YY_MAX_REDUCE      Maximum value for reduce actions
*/
#ifndef INTERFACE
# define INTERFACE 1
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
#define YYNOCODE 301
#define YYNOCODE 302
#define YYACTIONTYPE unsigned short int
#define YYWILDCARD 95
#define sqlite3ParserTOKENTYPE Token
typedef union {
  int yyinit;
  sqlite3ParserTOKENTYPE yy0;
  With* yy59;
  IdList* yy62;
  struct TrigEvent yy90;
  Upsert* yy136;
  struct FrameBound yy201;
  u8 yy238;
  const char* yy294;
  Window* yy295;
  struct {int value; int mask;} yy355;
  TriggerStep* yy11;
  IdList* yy76;
  ExprList* yy94;
  Upsert* yy95;
  int yy100;
  Expr* yy102;
  struct {int value; int mask;} yy199;
  u8 yy218;
  With* yy243;
  struct TrigEvent yy298;
  Window* yy379;
  struct FrameBound yy389;
  ExprList* yy434;
  TriggerStep* yy455;
  Select* yy457;
  SrcList* yy483;
  Select* yy391;
  SrcList* yy407;
  int yy494;
  Expr* yy524;
  const char* yy528;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
#endif
#define sqlite3ParserARG_SDECL
#define sqlite3ParserARG_PDECL
#define sqlite3ParserARG_PARAM
#define sqlite3ParserARG_FETCH
#define sqlite3ParserARG_STORE
#define sqlite3ParserCTX_SDECL Parse *pParse;
#define sqlite3ParserCTX_PDECL ,Parse *pParse
#define sqlite3ParserCTX_PARAM ,pParse
#define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
#define YYFALLBACK 1
#define YYNSTATE             541
#define YYNRULE              375
#define YYNSTATE             540
#define YYNRULE              376
#define YYNTOKEN             176
#define YY_MAX_SHIFT         540
#define YY_MIN_SHIFTREDUCE   784
#define YY_MAX_SHIFT         539
#define YY_MIN_SHIFTREDUCE   783
#define YY_MAX_SHIFTREDUCE   1158
#define YY_ERROR_ACTION      1159
#define YY_ACCEPT_ACTION     1160
#define YY_NO_ACTION         1161
#define YY_MIN_REDUCE        1162
#define YY_MAX_REDUCE        1536
#define YY_MAX_REDUCE        1537
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))

/* Define the yytestcase() macro to be a no-op if is not already defined
** otherwise.
**
** Applications can choose to define yytestcase() in the %include section
148477
148478
148479
148480
148481
148482
148483
148484
148485
148486
148487
148488
148489
148490
148491
148492
148493
148494
148495
148496
148497














148498
148499
148500
148501
148502




148503
148504
148505
148506
148507




148508
148509
148510
148511
148512




148513
148514

148515
148516
148517
148518
148519




148520
148521

148522
148523
148524
148525
148526
148527
148528
148529
148530
148531
148532
148533
148534
148535
148536
148537
148538
148539
148540


















148541
148542
148543
148544
148545
148546
148547
148548
148549
148550









148551
148552
148553
148554
148555
148556
148557
148558
148559
148560
148561
148562
148563
148564
148565
148566
148567
148568
148569


















148570
148571
148572
148573
148574
148575
148576
148577
148578
148579









148580
148581

148582
148583
148584


148585
148586

148587
148588
148589
148590
148591
148592
148593
148594
148595
148596









148597
148598

148599
148600
148601
148602
148603
148604
148605
148606
148607
148608
148609
148610
148611
148612
148613














148614
148615
148616
148617
148618
148619
148620
148621
148622
148623









148624
148625

148626
148627
148628
148629
148630
148631
148632
148633
148634
148635
148636
148637
148638
148639
148640
148641
148642
148643
148644
148645
148646
148647
148648
148649
148650
148651
148652
148653
148654
148655
148656
148657
148658
148659
148660
148661
148662
148663





































148664
148665

148666
148667

148668
148669

148670
148671
148672
148673



148674
148675
148676
148677
148678
148679
148680
148681
148682
148683
148684










148685
148686
148687
148688

148689
148690
148691
148692
148693
148694
148695

148696
148697
148698

148699
148700
148701
148702
148703
148704
148705
148706
148707
148708
148709
148710
148711
148712
148713













148714
148715
148716
148717
148718
148719




148720
148721
148722
148723
148724




148725
148726
148727
148728
148729




148730
148731

148732
148733
148734
148735
148736




148737
148738

148739
148740
148741
148742
148743
148744
148745
148746
148747
148748
148749
148750
148751
148752
148753
148754
148755
148756
148757


















148758
148759
148760
148761
148762
148763
148764
148765
148766
148767









148768
148769
148770
148771
148772




148773
148774
148775
148776
148777
148778
148779
148780
148781
148782
148783
148784
148785
148786













148787
148788
148789
148790
148791
148792
148793
148794
148795
148796









148797
148798

148799
148800
148801


148802
148803

148804
148805
148806
148807
148808
148809
148810
148811
148812
148813









148814
148815

148816
148817
148818
148819
148820
148821
148822
148823
148824
148825
148826
148827
148828
148829
148830














148831
148832
148833
148834
148835
148836





148837
148838
148839
148840



148841
148842

148843
148844
148845
148846
148847
148848
148849
148850
148851
148852
148853
148854
148855
148856
148857
148858
148859
148860
148861
148862
148863
148864
148865
148866
148867
148868
148869
148870
148871
148872
148873
148874
148875
148876
148877
148878
148879
148880
148881
148882
148883
148884
148885
148886
148887
148888
148889
148890
148891
148892
148893
148894
148895
148896
148897
148898
148899
148900
148901
148902
148903
148904
148905
148906
148907
148908
148909
148910
148911
148912
148913
148914
148915
148916
148917










































































148918
148919

148920
148921
148922
148923
148924


148925
148926
148927


148928
148929
148930
148931
148932
148933
148934
148935
148936
148937
148938
148939
148940
148941
148942
148943
148944
148945
148946
148947
148948
148949
148950
148951
148952
148953
148954
148955
148956
148957
148958
148959
























148960
148961
148962
148963
148964
148965
148966
148967
148968
148969
148970
148971
148972
148973
148974
148975
148976
















148977
148978
148979
148980
148981



148982
148983
148984
148985
148986
148987
148988
148989
148990
148991
148992
148993
148994
148995
148996
148997
148998
148999
149000
149001
149002
149003
149004
149005
149006
149007
149008
149009
149010
149011
149012
149013
149014
149015
149016
149017
149018
149019
149020
149021







































149022
149023
149024
149025
149026
149027
149028
149029
149030
149031








149032
149033
149034
149035
149036
149037
149038
149039




149040
149041
149042
149043


149044
149045

149046
149047
149048
149049
149050
149051
149052
149053
149054
149055
149056
149057
149058
149059
149060
149061
149062
149063
















149064
149065
149066


149067
149068
149069


149070
149071
149072
149073

149074
149075

149076
149077

149078
149079
149080
149081
149082
149083
149084
149085
149053
149054
149055
149056
149057
149058
149059














149060
149061
149062
149063
149064
149065
149066
149067
149068
149069
149070
149071
149072
149073
149074




149075
149076
149077
149078
149079




149080
149081
149082
149083
149084




149085
149086
149087
149088
149089

149090
149091




149092
149093
149094
149095
149096

149097
149098


















149099
149100
149101
149102
149103
149104
149105
149106
149107
149108
149109
149110
149111
149112
149113
149114
149115
149116
149117









149118
149119
149120
149121
149122
149123
149124
149125
149126
149127


















149128
149129
149130
149131
149132
149133
149134
149135
149136
149137
149138
149139
149140
149141
149142
149143
149144
149145
149146









149147
149148
149149
149150
149151
149152
149153
149154
149155
149156

149157
149158


149159
149160
149161

149162
149163









149164
149165
149166
149167
149168
149169
149170
149171
149172
149173

149174
149175














149176
149177
149178
149179
149180
149181
149182
149183
149184
149185
149186
149187
149188
149189
149190









149191
149192
149193
149194
149195
149196
149197
149198
149199
149200

149201
149202





































149203
149204
149205
149206
149207
149208
149209
149210
149211
149212
149213
149214
149215
149216
149217
149218
149219
149220
149221
149222
149223
149224
149225
149226
149227
149228
149229
149230
149231
149232
149233
149234
149235
149236
149237
149238
149239
149240

149241
149242

149243
149244

149245
149246



149247
149248
149249
149250










149251
149252
149253
149254
149255
149256
149257
149258
149259
149260
149261
149262
149263

149264
149265
149266
149267
149268
149269
149270

149271
149272
149273

149274
149275
149276













149277
149278
149279
149280
149281
149282
149283
149284
149285
149286
149287
149288
149289
149290
149291




149292
149293
149294
149295
149296




149297
149298
149299
149300
149301




149302
149303
149304
149305
149306

149307
149308




149309
149310
149311
149312
149313

149314
149315


















149316
149317
149318
149319
149320
149321
149322
149323
149324
149325
149326
149327
149328
149329
149330
149331
149332
149333
149334









149335
149336
149337
149338
149339
149340
149341
149342
149343
149344




149345
149346
149347
149348
149349













149350
149351
149352
149353
149354
149355
149356
149357
149358
149359
149360
149361
149362
149363









149364
149365
149366
149367
149368
149369
149370
149371
149372
149373

149374
149375


149376
149377
149378

149379
149380









149381
149382
149383
149384
149385
149386
149387
149388
149389
149390

149391
149392














149393
149394
149395
149396
149397
149398
149399
149400
149401
149402
149403
149404
149405
149406
149407





149408
149409
149410
149411
149412
149413



149414
149415
149416
149417

149418
149419










































































149420
149421
149422
149423
149424
149425
149426
149427
149428
149429
149430
149431
149432
149433
149434
149435
149436
149437
149438
149439
149440
149441
149442
149443
149444
149445
149446
149447
149448
149449
149450
149451
149452
149453
149454
149455
149456
149457
149458
149459
149460
149461
149462
149463
149464
149465
149466
149467
149468
149469
149470
149471
149472
149473
149474
149475
149476
149477
149478
149479
149480
149481
149482
149483
149484
149485
149486
149487
149488
149489
149490
149491
149492
149493
149494

149495
149496
149497
149498


149499
149500
149501


149502
149503
149504
149505
149506
149507
149508
149509
149510
149511
























149512
149513
149514
149515
149516
149517
149518
149519
149520
149521
149522
149523
149524
149525
149526
149527
149528
149529
149530
149531
149532
149533
149534
149535
149536
















149537
149538
149539
149540
149541
149542
149543
149544
149545
149546
149547
149548
149549
149550
149551
149552

149553



149554
149555
149556
149557







































149558
149559
149560
149561
149562
149563
149564
149565
149566
149567
149568
149569
149570
149571
149572
149573
149574
149575
149576
149577
149578
149579
149580
149581
149582
149583
149584
149585
149586
149587
149588
149589
149590
149591
149592
149593
149594
149595
149596
149597
149598








149599
149600
149601
149602
149603
149604
149605
149606
149607
149608
149609
149610




149611
149612
149613
149614
149615
149616


149617
149618
149619

149620
149621
149622
















149623
149624
149625
149626
149627
149628
149629
149630
149631
149632
149633
149634
149635
149636
149637
149638
149639


149640
149641
149642


149643
149644
149645
149646
149647

149648
149649

149650
149651

149652

149653
149654
149655
149656
149657
149658
149659







-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
+
+
+
+

-
-
-
-
+
+
+
+

-
-
-
-
+
+
+
+

-
+

-
-
-
-
+
+
+
+

-
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
+

-
-
+
+

-
+

-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
+

-
+

-
+

-
-
-
+
+
+

-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+



-
+






-
+


-
+


-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+


-
-
-
-
+
+
+
+

-
-
-
-
+
+
+
+

-
-
-
-
+
+
+
+

-
+

-
-
-
-
+
+
+
+

-
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
-
-
-
+
+
+
+

-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
+

-
-
+
+

-
+

-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
-
+
+
+
+
+

-
-
-
+
+
+

-
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
+



-
-
+
+

-
-
+
+








-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-

-
-
-
+
+
+

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+




-
-
-
-
+
+
+
+


-
-
+
+

-
+


-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
+
+

-
-
+
+



-
+

-
+

-
+
-







**  yy_reduce_ofst[]   For each state, the offset into yy_action for
**                     shifting non-terminals after a reduce.
**  yy_default[]       Default action for each state.
**
*********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (2142)
static const YYACTIONTYPE yy_action[] = {
 /*     0 */   535, 1323,  112,  109,  209,  112,  109,  209, 1160,    1,
 /*    10 */     1,  540,    2, 1164,  535, 1292, 1228, 1207,  289,  384,
 /*    20 */   134,   42,   42, 1427,  382, 1228,    9, 1241,  242,  492,
 /*    30 */  1291,  915,  373,  379, 1026,   70,   70,  427, 1026,  916,
 /*    40 */   529,  529,  529,  119,  120,  110, 1136, 1136,  981,  984,
 /*    50 */   974,  974,  117,  117,  118,  118,  118,  118,  380,  264,
 /*    60 */   264,  264,  264, 1134,  264,  264,  112,  109,  209,  397,
 /*    70 */   454,  517,  532,  491,  532, 1233, 1233,  532,  239,  206,
 /*    80 */   493,  112,  109,  209,  464,  219,  118,  118,  118,  118,
 /*    90 */   111,  393,  440,  444,   16,   16,  116,  116,  116,  116,
 /*   100 */   115,  115,  114,  114,  114,  113,  415,  971,  971,  982,
 /*   110 */   985,  235, 1463,  351, 1134,  419,  384,  116,  116,  116,
 /*   120 */   116,  115,  115,  114,  114,  114,  113,  415,  116,  116,
 /*   130 */   116,  116,  115,  115,  114,  114,  114,  113,  415,  961,
 /*     0 */   112,  109,  209,  112,  109,  209, 1160,    1,    1,  539,
 /*    10 */     2, 1164,  490, 1193, 1293,  534,  289, 1196,  134,  383,
 /*    20 */  1485, 1428, 1164, 1229, 1208, 1242, 1195,  289,  491,  134,
 /*    30 */   373,  915, 1229,  443,   16,   16, 1242,   70,   70,  916,
 /*    40 */   242, 1292,  296,  119,  120,  110, 1136, 1136,  981,  984,
 /*    50 */   974,  974,  117,  117,  118,  118,  118,  118,  264,  264,
 /*    60 */   190,  264,  264,  264,  264,  112,  109,  209,  362,  264,
 /*    70 */   264,  531,  376,  497,  531, 1134,  531, 1501,  239,  206,
 /*    80 */   338,    9,  531,  242,  219, 1203,  118,  118,  118,  118,
 /*    90 */   111,  439,  112,  109,  209,  219,  116,  116,  116,  116,
 /*   100 */   115,  115,  114,  114,  114,  113,  414,  115,  115,  114,
 /*   110 */   114,  114,  113,  414,  418,   12,  383,  400, 1134,  114,
 /*   120 */   114,  114,  113,  414, 1115,  418, 1134, 1392,  116,  116,
 /*   130 */   116,  116,  115,  115,  114,  114,  114,  113,  414,  961,
 /*   140 */   119,  120,  110, 1136, 1136,  981,  984,  974,  974,  117,
 /*   150 */   117,  118,  118,  118,  118,  952,  415,  941,  298,  951,
 /*   160 */   941, 1480,  540,    2, 1164, 1115,  535, 1458,  160,  289,
 /*   170 */     6,  134, 1504,  389,  406,  975,  338, 1024, 1241,  337,
 /*   180 */  1089, 1476, 1089,  118,  118,  118,  118,   42,   42,  329,
 /*   150 */   117,  118,  118,  118,  118,  952,  534,  414,  941,  951,
 /*   160 */  1481,  539,    2, 1164, 1505,  534,  160,  175,  289, 1134,
 /*   170 */   134,  434,  312,  297, 1115, 1116, 1117, 1242,   70,   70,
 /*   180 */  1089,  338, 1089,  118,  118,  118,  118,   42,   42,  448,
 /*   190 */   951,  951,  953,  116,  116,  116,  116,  115,  115,  114,
 /*   200 */   114,  114,  113,  415,  311,  430,  299,  311,  881,  160,
 /*   210 */   264,  264,  401,  384,  324, 1115, 1116, 1117,  288,  526,
 /*   220 */    96,  159, 1441,  532,  141,  116,  116,  116,  116,  115,
 /*   230 */   115,  114,  114,  114,  113,  415,  219,  119,  120,  110,
 /*   200 */   114,  114,  113,  414, 1115,  311,  264,  264,   82,  441,
 /*   210 */   264,  264,  190,  383,  284,   12,  288,  525,  407,  531,
 /*   220 */    96,  159,  458,  531,  371,  116,  116,  116,  116,  115,
 /*   230 */   115,  114,  114,  114,  113,  414,  219,  119,  120,  110,
 /*   240 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
 /*   250 */   118,  118,  115,  115,  114,  114,  114,  113,  415,  288,
 /*   260 */   526,  403,  533,  121,  870,  870,  419,  250,  267,  336,
 /*   270 */   475,  331,  474,  236,  160,  319, 1084,  322, 1465,  329,
 /*   280 */   350,   12,  535,  384,  502, 1115, 1084,  435,  312, 1084,
 /*   250 */   118,  118,  511, 1477, 1115, 1116, 1117,  113,  414,  534,
 /*   260 */   528,  528,  528,  121,  534, 1427,  418,  116,  116,  116,
 /*   270 */   116,  115,  115,  114,  114,  114,  113,  414, 1464,  351,
 /*   280 */   270,   42,   42,  383,  187, 1115,   70,   70,  533,  433,
 /*   290 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
 /*   300 */   415,  535,  836,   42,   42,  138,  426,  119,  120,  110,
 /*   300 */   414,  534, 1339,  405,  159,  411,  410,  119,  120,  110,
 /*   310 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
 /*   320 */   118,  118,   70,   70,  288,  526,  412,  411,  480, 1457,
 /*   330 */   335,   79,    6,  473, 1140, 1115, 1116, 1117,  501, 1142,
 /*   340 */   334,  837,  811, 1484,  512, 1164,  534, 1141,  123,  187,
 /*   350 */   289,  384,  134,  448,  434, 1115,   80,  349,  498, 1241,
 /*   320 */   118,  118,  285,   42,   42,  349,  411,  410,  514,  479,
 /*   330 */  1458,   79, 1084,    6, 1140, 1115, 1116, 1117,  480, 1142,
 /*   340 */   501, 1115, 1084,  123,  238, 1084,  136, 1141, 1234, 1234,
 /*   350 */  1143,  383, 1143, 1115,  167,  426,   80,  447,  512, 1451,
 /*   360 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
 /*   370 */   415, 1143, 1115, 1143,  459,  119,  120,  110, 1136, 1136,
 /*   370 */   414, 1143, 1466, 1143,  350,  119,  120,  110, 1136, 1136,
 /*   380 */   981,  984,  974,  974,  117,  117,  118,  118,  118,  118,
 /*   390 */   404,  264,  264,  811, 1463,  506,  368, 1156,  535,  114,
 /*   400 */   114,  114,  113,  415,  532, 1115, 1116, 1117,  231,  518,
 /*   410 */  1500,  472,  469,  468,  175,  497,  422,  219, 1202,   70,
 /*   420 */    70,  467, 1115, 1116, 1117,  176,  201,  200,  116,  116,
 /*   430 */   116,  116,  115,  115,  114,  114,  114,  113,  415,  535,
 /*   440 */  1115,  264,  264,  435,  312, 1115,  273,  419,  384,  513,
 /*   450 */  1450, 1115,  326, 1084,  532,  517,   82, 1084,  167,  388,
 /*   460 */    69,   69, 1115, 1084,  519,  509, 1084, 1084,   12, 1157,
 /*   470 */  1084,  420,  119,  120,  110, 1136, 1136,  981,  984,  974,
 /*   480 */   974,  117,  117,  118,  118,  118,  118,  258,  258,  535,
 /*   490 */  1115, 1116, 1117, 1045,  535, 1115, 1116, 1117, 1323,  535,
 /*   500 */   532, 1115, 1116, 1117,  296,  483, 1211,  818, 1046,  448,
 /*   510 */    70,   70, 1115, 1116, 1117,   50,   50,  448,  356,  500,
 /*   520 */    70,   70,  207, 1047,   32,  116,  116,  116,  116,  115,
 /*   530 */   115,  114,  114,  114,  113,  415,  453,  264,  264, 1115,
 /*   540 */   450,  449,  961,  508,  856,  384,  517,    5,  900,  822,
 /*   550 */   532,  484,  181, 1115,  857,  516,  517,  818,  952,  507,
 /*   560 */     3, 1115,  951, 1231, 1231,  482,  398, 1115, 1095,  119,
 /*   390 */   402, 1115, 1116, 1117,  500,  534,  250,  267,  336,  474,
 /*   400 */   331,  473,  236, 1115, 1116, 1117,  231, 1115,  329,  471,
 /*   410 */   468,  467,  509, 1458, 1464,  505,    6,   70,   70,  466,
 /*   420 */   181,  380,  379,  534,  971,  971,  982,  985,  116,  116,
 /*   430 */   116,  116,  115,  115,  114,  114,  114,  113,  414, 1115,
 /*   440 */   412,  412,  412,  496, 1115,   69,   69,  235,  383,  288,
 /*   450 */   525,  273,  326,  516,  337,  458, 1084, 1115, 1116, 1117,
 /*   460 */  1232, 1232,  492,  160,  508,  441, 1084, 1067, 1531, 1084,
 /*   470 */   207, 1531,  119,  120,  110, 1136, 1136,  981,  984,  974,
 /*   480 */   974,  117,  117,  118,  118,  118,  118,  881,  534, 1115,
 /*   490 */  1116, 1117,  975,  534, 1115, 1116, 1117,  534,  421,  534,
 /*   500 */   141,  534,  176,  356,  517, 1119,   32,  511,  482,  388,
 /*   510 */    70,   70,  818,  288,  525,   70,   70,  441,  499,   50,
 /*   520 */    50,   70,   70,   70,   70,  116,  116,  116,  116,  115,
 /*   530 */   115,  114,  114,  114,  113,  414,  274,  264,  264, 1115,
 /*   540 */  1065,  264,  264, 1115,  355,  383,  409,  961, 1439,  822,
 /*   550 */   531,  516,  190,  419,  531,  483, 1119,  516,  337,  516,
 /*   560 */   518, 1115,  818,  952,  382,  458,  515,  951,  481,  119,
 /*   570 */   120,  110, 1136, 1136,  981,  984,  974,  974,  117,  117,
 /*   580 */   118,  118,  118,  118, 1115,  535,  238, 1115, 1391, 1115,
 /*   590 */  1116, 1117,  159,  951,  951,  953,  231, 1115,  259,  472,
 /*   600 */   469,  468,  310, 1115, 1116, 1117,   13,   13,  297,  467,
 /*   610 */   276, 1115, 1116, 1117,  412,  411, 1095, 1115, 1116, 1117,
 /*   620 */   395,  355,  116,  116,  116,  116,  115,  115,  114,  114,
 /*   630 */   114,  113,  415,  208, 1115, 1116, 1117, 1115, 1116, 1117,
 /*   640 */   264,  264,  384,  337,  902,  393,  815, 1115, 1116, 1117,
 /*   650 */   413,  413,  413,  532,  112,  109,  209,  309,  900, 1143,
 /*   660 */   535, 1143,  535,  393,  901, 1210,  119,  120,  110, 1136,
 /*   580 */   118,  118,  118,  118, 1338,  278, 1045,  278,  275, 1115,
 /*   590 */  1116, 1117,  259, 1115, 1116, 1117,  534,    5,  951,  951,
 /*   600 */   953, 1046,  231,    3,  143,  471,  468,  467, 1391,  463,
 /*   610 */  1115, 1115, 1116, 1117, 1452,  466, 1047,  836,   70,   70,
 /*   620 */   480,  534,  116,  116,  116,  116,  115,  115,  114,  114,
 /*   630 */   114,  113,  414,   95, 1115,  287,  235,  856,  902,  420,
 /*   640 */  1115,  534,  383,   13,   13,  381,  815,  857,  472,  112,
 /*   650 */   109,  209, 1115,  337,  413,  309,  837,  394, 1436,  534,
 /*   660 */  1115, 1116, 1117,   54,   54,  291,  119,  120,  110, 1136,
 /*   670 */  1136,  981,  984,  974,  974,  117,  117,  118,  118,  118,
 /*   680 */   118,   13,   13,   13,   13,  265,  265,  535,  143,  264,
 /*   690 */   264,  288,  526,  535, 1119,  400,  535,  402,  532,  510,
 /*   700 */  1457,  512,  532,    6,  113,  415, 1067, 1530,   70,   70,
 /*   710 */  1530,  535,  271,  535,   70,   70,  535,   13,   13,  116,
 /*   720 */   116,  116,  116,  115,  115,  114,  114,  114,  113,  415,
 /*   730 */   272,  277,   13,   13,   13,   13,  535,   13,   13,  384,
 /*   740 */   535,  304,  425, 1100,  284, 1119,  184,  801,  185,  338,
 /*   750 */   285,  514, 1532,  369, 1239, 1438, 1182,   70,   70,  425,
 /*   760 */   424,   70,   70,  119,  120,  110, 1136, 1136,  981,  984,
 /*   770 */   974,  974,  117,  117,  118,  118,  118,  118,  190, 1065,
 /*   780 */  1067, 1531,  442,  107, 1531,  408,  264,  264,  264,  264,
 /*   790 */   383, 1396,  261,  410,   95,  900,  485,  414,  421,  532,
 /*   800 */  1045,  532,  301, 1133,  303,  488,  433, 1451, 1396, 1398,
 /*   810 */   278,  535,  278,  520, 1435, 1046,  116,  116,  116,  116,
 /*   820 */   115,  115,  114,  114,  114,  113,  415,  425,  264,  264,
 /*   830 */  1047,  190,   54,   54,  535,  291,  384,  264,  264,  362,
 /*   840 */   962,  532, 1004,  376, 1084,  264,  264, 1029, 1029,  456,
 /*   850 */   532,  523,  270, 1065, 1084,   55,   55, 1084,  532,  442,
 /*   680 */   118,   13,   13, 1084, 1115, 1116, 1117,  901,  264,  264,
 /*   690 */  1115, 1116, 1117, 1084,  292,  399, 1084,  800,  388,  140,
 /*   700 */   295,  531, 1115, 1116, 1117,  403,  447,  532,  534,  870,
 /*   710 */   870,  534, 1240,  534,  329,  534, 1185,  389,  534,  116,
 /*   720 */   116,  116,  116,  115,  115,  114,  114,  114,  113,  414,
 /*   730 */    13,   13, 1024,   13,   13,   13,   13,   13,   13,  383,
 /*   740 */    13,   13,  424, 1100,  401,  264,  264,  277,  160,  184,
 /*   750 */  1182,  185, 1533,  369,  513,  484,  432,  487,  531,  424,
 /*   760 */   423, 1397,  941,  119,  120,  110, 1136, 1136,  981,  984,
 /*   770 */   974,  974,  117,  117,  118,  118,  118,  118, 1397, 1399,
 /*   780 */   425,  519,  392,  264,  264, 1029, 1029,  455,  264,  264,
 /*   790 */   264,  264, 1004,  304,  261, 1278,  531,  900,  288,  525,
 /*   800 */   310,  531,  493,  531, 1067, 1532,  458,  387, 1532,  311,
 /*   810 */   429,  299,  534,  107,  264,  264,  116,  116,  116,  116,
 /*   820 */   115,  115,  114,  114,  114,  113,  414,  531,  424, 1384,
 /*   830 */   507,  258,  258, 1246,   55,   55,  383, 1277,  265,  265,
 /*   840 */   962,  324,  434,  312,  531,  531,  506, 1397, 1026, 1241,
 /*   850 */   298,  531, 1026,  445,  301, 1095,  303,  534,  368, 1156,
 /*   860 */   119,  120,  110, 1136, 1136,  981,  984,  974,  974,  117,
 /*   870 */   117,  118,  118,  118,  118,  535, 1396,  190,  302, 1383,
 /*   880 */   208,  535,  789,  790,  791,  535,  515,  535, 1323,  371,
 /*   890 */   337,  234,  233,  232,  459,  515,   15,   15,  459,  477,
 /*   900 */   459,  459,   44,   44,  136,  900,   56,   56,   57,   57,
 /*   910 */  1185,  390,  197,  116,  116,  116,  116,  115,  115,  114,
 /*   920 */   114,  114,  113,  415,  535,  876,  535,  442,  535,  274,
 /*   930 */   875, 1323,  357,  384,  353,  140, 1426,  946, 1455, 1323,
 /*   940 */  1390,    6, 1240, 1236,  292,   58,   58,   59,   59,   60,
 /*   950 */    60,  535, 1456,  384,  535,    6,  399,  119,  120,  110,
 /*   870 */   117,  118,  118,  118,  118, 1045,  534, 1065,  534,   15,
 /*   880 */    15, 1084,  208, 1324,  453,  452,  534, 1324,  534,  449,
 /*   890 */  1046, 1084,  494,  458, 1084,  234,  233,  232,   44,   44,
 /*   900 */    56,   56,  319, 1095,  322, 1047,  534,  900,   57,   57,
 /*   910 */    58,   58,  534,  116,  116,  116,  116,  115,  115,  114,
 /*   920 */   114,  114,  113,  414,  534,  514,  522,  534,   59,   59,
 /*   930 */   302, 1157,  534,  383,   60,   60, 1237,  946,  788,  789,
 /*   940 */   790, 1459, 1456,  446,    6,    6,   61,   61, 1212,   45,
 /*   950 */    45,  534,  396,  383,   46,   46,  397,  119,  120,  110,
 /*   960 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
 /*   970 */   118,  118,   61,   61,  535,   45,   45,  119,  120,  110,
 /*   970 */   118,  118,  428,   48,   48,  534,  392,  119,  120,  110,
 /*   980 */  1136, 1136,  981,  984,  974,  974,  117,  117,  118,  118,
 /*   990 */   118,  118, 1477,  479,  202,   46,   46,  275,   95,  455,
 /*  1000 */   535,  212,  535,  337,  535, 1454,  535,  409,    6,  242,
 /*   990 */   118,  118, 1324,  368, 1066,  447,  825,   49,   49,  534,
 /*  1000 */   458,  357,  534,  353,  534,  138,  534,  337, 1478,  478,
 /*  1010 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
 /*  1020 */   415,   48,   48,   49,   49,   62,   62,   63,   63,  535,
 /*  1020 */   414,   62,   62,  392,   63,   63,   64,   64,   14,   14,
 /*  1030 */   116,  116,  116,  116,  115,  115,  114,  114,  114,  113,
 /*  1040 */   415,  535,  459,  535, 1134,  535, 1151,  535,  142,  535,
 /*  1050 */    64,   64,  535, 1338,  535,  494,  535,  446,  535, 1264,
 /*  1060 */   535, 1337,   14,   14,   65,   65,  125,  125,   66,   66,
 /*  1070 */    51,   51,  535,   67,   67,   68,   68,   52,   52,  147,
 /*  1080 */   147,  148,  148, 1453,  317,   98,    6,  535, 1245,  481,
 /*  1090 */   535,  827,  535,   75,   75, 1134,  102,  481,  100,  535,
 /*  1100 */   532,  535,  368, 1066, 1503,  384,  535,  845,   53,   53,
 /*  1110 */    93,   71,   71,  126,  126,  295,  528,  390,  288,  526,
 /*  1120 */    72,   72,  127,  127,  139,  384,   38,  128,  128,  119,
 /*  1040 */   414,  534,  810,  317,  271,  534, 1457,  825,  534,    6,
 /*  1050 */   534, 1324,  534,  142,  534, 1442,  534,  212,  534, 1324,
 /*  1060 */   534,  398,  305,   65,   65,  534, 1157,  125,  125,  476,
 /*  1070 */    66,   66,   51,   51,   67,   67,   68,   68,   52,   52,
 /*  1080 */   147,  147,  148,  148,  534,   98,  534,   75,   75,  276,
 /*  1090 */   534,  272,  534,  810,  534,  876,  534,  527,  389,  534,
 /*  1100 */   875,  534, 1151,  202,  534,  383,   53,   53,   71,   71,
 /*  1110 */   288,  525,  126,  126,   72,   72,  127,  127,  128,  128,
 /*  1120 */   454,  124,  124,  146,  146,  383,  145,  145,  408,  119,
 /*  1130 */   120,  110, 1136, 1136,  981,  984,  974,  974,  117,  117,
 /*  1140 */   118,  118,  118,  118,  535,  495,  535,  447,  535,  119,
 /*  1140 */   118,  118,  118,  118,  534,  900,  534,   95,  534,  119,
 /*  1150 */   120,  110, 1136, 1136,  981,  984,  974,  974,  117,  117,
 /*  1160 */   118,  118,  118,  118,  235,  124,  124,  146,  146,  145,
 /*  1170 */   145,  287,  535, 1277,  535, 1157,  535,  391,  161,  263,
 /*  1180 */   206,  381,  116,  116,  116,  116,  115,  115,  114,  114,
 /*  1190 */   114,  113,  415,  132,  132,  131,  131,  129,  129,  535,
 /*  1200 */    30,  535,  116,  116,  116,  116,  115,  115,  114,  114,
 /*  1210 */   114,  113,  415,  535,  216, 1062, 1276,  535,  370,  535,
 /*  1220 */   130,  130,   74,   74,  535,  915,  389,  876,   17,  437,
 /*  1230 */   429,   31,  875,  916,   76,   76,  266,  101,   73,   73,
 /*  1240 */    43,   43,  835,  834,  308,   47,   47,   95,  825,  943,
 /*  1250 */   441,  938,  241,  241,  305,  443,  313,  384,  241,   95,
 /*  1260 */   842,  843,  193,  465, 1209,  327,  237,  436,   95, 1011,
 /*  1270 */  1007,  909,  873,  237,  241,  107, 1023,  384, 1023,  955,
 /*  1280 */  1415,  119,  120,  110, 1136, 1136,  981,  984,  974,  974,
 /*  1290 */   117,  117,  118,  118,  118,  118, 1022,  809, 1022,  825,
 /*  1160 */   118,  118,  118,  118,  390,  161,  132,  132,  131,  131,
 /*  1170 */   129,  129,  534,  915,  534, 1455,  534, 1454,    6, 1416,
 /*  1180 */     6,  916,  116,  116,  116,  116,  115,  115,  114,  114,
 /*  1190 */   114,  113,  414, 1415,  130,  130,   74,   74,   76,   76,
 /*  1200 */   534,   30,  116,  116,  116,  116,  115,  115,  114,  114,
 /*  1210 */   114,  113,  414,  534,  263,  206,  534, 1133, 1504,   93,
 /*  1220 */   876,  845,   73,   73,  102,  875,  100,  139,   17,   38,
 /*  1230 */   208, 1062,   31,  450,  370,   43,   43,  101,   47,   47,
 /*  1240 */   827,  216,  436,  308,  943,  440,   95,  241,  241,  442,
 /*  1250 */   313,  464,  241,   95,  237,  900,  327,  383,  266,   95,
 /*  1260 */   835,  834,  193,  335,  938,  314, 1011,  435,  842,  843,
 /*  1270 */   955, 1007,  909,  334,  237,  241,  873,  383, 1023,  107,
 /*  1280 */  1023,  119,  120,  110, 1136, 1136,  981,  984,  974,  974,
 /*  1290 */   117,  117,  118,  118,  118,  118, 1022,  808, 1022, 1274,
 /*  1300 */   137,  119,  108,  110, 1136, 1136,  981,  984,  974,  974,
 /*  1310 */   117,  117,  118,  118,  118,  118,  874, 1414,  451,  107,
 /*  1320 */  1011,  314, 1273,  318,  218,  321,  323,  325, 1224, 1208,
 /*  1330 */   955,  330,  339,  340,  116,  116,  116,  116,  115,  115,
 /*  1340 */   114,  114,  114,  113,  415, 1285, 1322, 1260, 1493, 1470,
 /*  1350 */  1271,  283,  521, 1328,  116,  116,  116,  116,  115,  115,
 /*  1360 */   114,  114,  114,  113,  415, 1191, 1184, 1173, 1172, 1174,
 /*  1370 */   522, 1487,  211,  460,  384,  256,  199,  367, 1257,  342,
 /*  1380 */   195,  470,  307,  344,   11,  333,  525,  445, 1307, 1315,
 /*  1390 */   375,  203, 1207, 1151,  384,  346, 1387,  188,  360,  120,
 /*  1310 */   117,  117,  118,  118,  118,  118,  874, 1011,  318,  107,
 /*  1320 */   321,  955,  323,  325, 1225, 1211,  197, 1210, 1209,  330,
 /*  1330 */   339, 1265,  340,  283,  116,  116,  116,  116,  115,  115,
 /*  1340 */   114,  114,  114,  113,  414, 1286, 1323, 1261, 1471, 1272,
 /*  1350 */   520,  218,  521, 1329,  116,  116,  116,  116,  115,  115,
 /*  1360 */   114,  114,  114,  113,  414, 1192, 1184, 1173, 1172, 1174,
 /*  1370 */  1494, 1488,  459,  256,  383, 1258,  342,  199,  367,  344,
 /*  1380 */   211,  195,  307,  444,   11,  346,  469,  333, 1308, 1316,
 /*  1390 */   375,  427,  203,  360,  383, 1388,  188, 1387,  189,  120,
 /*  1400 */   110, 1136, 1136,  981,  984,  974,  974,  117,  117,  118,
 /*  1410 */   118,  118,  118, 1386,  428, 1490,  245,  300,  348, 1148,
 /*  1410 */   118,  118,  118, 1208, 1151,  300,  348, 1491,  245, 1148,
 /*  1420 */   110, 1136, 1136,  981,  984,  974,  974,  117,  117,  118,
 /*  1430 */   118,  118,  118,  189,  198, 1434, 1432,   78,   81,  163,
 /*  1440 */    82,  392,  439, 1392,  173,  105,  527,   35,    4,  157,
 /*  1450 */  1312,  116,  116,  116,  116,  115,  115,  114,  114,  114,
 /*  1460 */   113,  415,  530,  165,   93, 1304,  431,  432,  168,  463,
 /*  1470 */   221,  116,  116,  116,  116,  115,  115,  114,  114,  114,
 /*  1480 */   113,  415,  169,  452,  170,  416,  171,  374,  372,  438,
 /*  1490 */    36, 1318,  177,  225, 1381,   87,  458,  524, 1403,  316,
 /*  1500 */   257,  105,  527,  227,    4,  182,  461,  160,  320,  228,
 /*  1510 */   377, 1175,  476,  229, 1227, 1226,  405, 1225,  530, 1218,
 /*  1520 */   961,  378, 1199, 1198,  827,  332,  103,  103, 1197,  407,
 /*  1530 */     8, 1217, 1502,  104,  487,  416,  537,  536,  281,  282,
 /*  1540 */   951,  416,  490, 1268,  496,   92,  341,  243, 1269,  343,
 /*  1550 */   244, 1267,  122,  524,  345, 1461,  515,  288,  526,   10,
 /*  1560 */   354, 1266, 1460,  352,  504, 1250,   99, 1367,   94,  503,
 /*  1570 */   499,  951,  951,  953,  954,   27,  961,  347, 1249,  194,
 /*  1580 */   251,  358,  103,  103,  359, 1181,   34,  538, 1110,  104,
 /*  1590 */   255,  416,  537,  536,  286,  252,  951,  254,  539,  149,
 /*  1600 */  1170, 1419, 1165, 1420, 1418,  150, 1417,  135,  279,  785,
 /*  1610 */   151,  417, 1195,  196,  290,  210,  386, 1194,  269,  387,
 /*  1620 */   162, 1021,  133,   77, 1192, 1019,  935,  951,  951,  953,
 /*  1630 */   954,   27, 1479, 1104,  418,  164,  153,  268,  217,  166,
 /*  1640 */   859,  306,  366,  366,  365,  253,  363,  220, 1035,  798,
 /*  1650 */   172,  939,  105,  527,  155,    4,  394,  174,  396,  156,
 /*  1660 */    83, 1038,  213,   84,  294,   85,   86,  223,  222,  530,
 /*  1670 */  1034,  144,  293,   18,  224,  315,  241, 1027, 1145,  178,
 /*  1680 */   457,  226,  179,   37,  800,  334,  462,  230,  328,  466,
 /*  1690 */   180,  471,  416,   88,   19,   20,   89,  280,  838,  158,
 /*  1700 */   191,   90,  215,  478,  524, 1097,  204,  192,  987,   91,
 /*  1710 */   152, 1070,   39,  154, 1071,  504,  486,   40,  489,  205,
 /*  1720 */   505,  260,  105,  527,  214,    4,  908,  961,  262,  183,
 /*  1730 */   240,   21,  903,  103,  103,  107,   22, 1086,   23,  530,
 /*  1740 */   104, 1088,  416,  537,  536,   24, 1093,  951,   25, 1074,
 /*  1750 */  1090, 1094,    7,   33,  511,  186,   26, 1002,  385,   95,
 /*  1760 */   988,  986,  416,  288,  526,  990, 1044,  246, 1043,  247,
 /*  1770 */   991,   28,   41,  106,  524,  956,  810,   29,  951,  951,
 /*  1780 */   953,  954,   27,  531,  361,  504,  423,  248,  869,  249,
 /*  1790 */   503, 1495,  364, 1105, 1161, 1494, 1161,  961, 1161, 1161,
 /*  1430 */   118,  118,  118,  198, 1435, 1433,  524,   78,  391,  163,
 /*  1440 */    82, 1393,  438,  173,   81,  105,  526, 1313,    4,   35,
 /*  1450 */   157,  116,  116,  116,  116,  115,  115,  114,  114,  114,
 /*  1460 */   113,  414,  529,  165,   93,  430, 1305,  168,  169,  431,
 /*  1470 */   462,  116,  116,  116,  116,  115,  115,  114,  114,  114,
 /*  1480 */   113,  414,  170,  171,  221,  415,  372,  437, 1319,  177,
 /*  1490 */   374,   36,  451,  225, 1382,   87,  457,  523,  257, 1404,
 /*  1500 */   316,  105,  526,  227,    4,  182,  460,  160,  320,  228,
 /*  1510 */   377, 1175,  475,  229, 1228,  404, 1227, 1226,  529,  827,
 /*  1520 */   961, 1219,  378, 1200, 1199,  406,  103,  103, 1218,  332,
 /*  1530 */     8,  281, 1198,  104, 1503,  415,  536,  535,  486,  282,
 /*  1540 */   951,  415,  489,  495,   92,  244, 1269,  341,  243,  122,
 /*  1550 */  1270,  343,  514,  523, 1268, 1462,   10,  288,  525,  345,
 /*  1560 */  1461,  354,   99,  352,  503,   94, 1267,  347, 1251,  502,
 /*  1570 */   498,  951,  951,  953,  954,   27,  961, 1250,  194,  358,
 /*  1580 */   251,  359,  103,  103, 1181,   34,  537, 1110,  252,  104,
 /*  1590 */   254,  415,  536,  535,  255, 1368,  951, 1420,  286,  538,
 /*  1600 */  1170, 1165, 1421,  135, 1419, 1418,  149,  150,  279,  784,
 /*  1610 */   416,  196,  151,  290,  210,  200,   77,  385,  269,  386,
 /*  1620 */   133,  162,  935, 1021,  201, 1019,  153,  951,  951,  953,
 /*  1630 */   954,   27, 1480, 1104,  417,  164,  217,  268,  859,  166,
 /*  1640 */   306, 1035,  366,  366,  365,  253,  363,  220,  172,  797,
 /*  1650 */   939,  155,  105,  526,  393,    4,  395,  174,  156,   83,
 /*  1660 */  1038,   84,  213,   85,  294,  222,   86,  223, 1034,  529,
 /*  1670 */   144,   18,  293,  224,  315,  456,  241, 1027, 1145,  178,
 /*  1680 */   226,  179,   37,  799,  334,  461,  230,  465,  470,  838,
 /*  1690 */   180,   88,  415,   19,  280,  328,   20,   89,   90,  158,
 /*  1700 */   191,  477,  215, 1097,  523,  204,  192,  987,   91, 1070,
 /*  1710 */   152,   39,  485,  154, 1071,  503,   40,  488,  205,  260,
 /*  1720 */   504,  262,  105,  526,  214,    4,  908,  961,  183,  240,
 /*  1730 */   903,  107, 1086,  103,  103,   21,   22, 1088,   23,  529,
 /*  1740 */   104,   24,  415,  536,  535, 1090, 1093,  951, 1094,   25,
 /*  1750 */  1074,   33,    7,   26,  510, 1002,  247,  186,  384,   95,
 /*  1760 */   988,  986,  415,  288,  525,  990, 1044,  246, 1043,  991,
 /*  1770 */    28,   41,  530,  956,  523,  809,  106,   29,  951,  951,
 /*  1780 */   953,  954,   27,  869,  361,  503,  422,  248,  364, 1105,
 /*  1790 */   502,  249, 1161, 1496, 1495, 1161, 1161,  961, 1161, 1161,
 /*  1800 */  1161, 1161, 1161,  103,  103, 1161, 1161, 1161, 1161, 1161,
 /*  1810 */   104, 1161,  416,  537,  536, 1104,  418,  951, 1161,  268,
 /*  1810 */   104, 1161,  415,  536,  535, 1104,  417,  951, 1161,  268,
 /*  1820 */  1161, 1161, 1161, 1161,  366,  366,  365,  253,  363, 1161,
 /*  1830 */  1161,  798, 1161, 1161, 1161, 1161,  105,  527, 1161,    4,
 /*  1830 */  1161,  797, 1161, 1161, 1161, 1161,  105,  526, 1161,    4,
 /*  1840 */  1161, 1161, 1161, 1161,  213, 1161,  294, 1161,  951,  951,
 /*  1850 */   953,  954,   27,  530,  293, 1161, 1161, 1161, 1161, 1161,
 /*  1850 */   953,  954,   27,  529,  293, 1161, 1161, 1161, 1161, 1161,
 /*  1860 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
 /*  1870 */  1161, 1161, 1161, 1161, 1161, 1161,  416, 1161, 1161, 1161,
 /*  1880 */  1161, 1161, 1161, 1161,  215, 1161, 1161, 1161,  524, 1161,
 /*  1890 */  1161, 1161,  152, 1161, 1161,  154,  105,  527, 1161,    4,
 /*  1870 */  1161, 1161, 1161, 1161, 1161, 1161,  415, 1161, 1161, 1161,
 /*  1880 */  1161, 1161, 1161, 1161,  215, 1161, 1161, 1161,  523, 1161,
 /*  1890 */  1161, 1161,  152, 1161, 1161,  154,  105,  526, 1161,    4,
 /*  1900 */  1161, 1161, 1161, 1161, 1161, 1161,  214, 1161, 1161, 1161,
 /*  1910 */  1161,  961, 1161,  530, 1161, 1161, 1161,  103,  103,  880,
 /*  1920 */  1161, 1161, 1161, 1161,  104, 1161,  416,  537,  536, 1161,
 /*  1930 */  1161,  951, 1161, 1161, 1161, 1161,  416, 1161, 1161, 1161,
 /*  1940 */   385, 1161, 1161, 1161, 1161,  288,  526, 1161,  524, 1161,
 /*  1950 */  1161, 1161, 1161, 1161, 1161, 1161,   97,  527, 1161,    4,
 /*  1960 */  1161, 1161,  951,  951,  953,  954,   27, 1161,  423, 1161,
 /*  1970 */  1161,  961, 1161,  530, 1161, 1161, 1161,  103,  103, 1161,
 /*  1980 */  1161, 1161, 1161, 1161,  104, 1161,  416,  537,  536, 1161,
 /*  1990 */  1161,  951,  268, 1161, 1161, 1161,  416,  366,  366,  365,
 /*  2000 */   253,  363, 1161, 1161,  798, 1161, 1161, 1161,  524, 1161,
 /*  1910 */  1161,  961, 1161,  529, 1161, 1161, 1161,  103,  103,  880,
 /*  1920 */  1161, 1161, 1161, 1161,  104, 1161,  415,  536,  535, 1161,
 /*  1930 */  1161,  951, 1161, 1161, 1161, 1161,  415, 1161, 1161, 1161,
 /*  1940 */   384, 1161, 1161, 1161, 1161,  288,  525, 1161,  523, 1161,
 /*  1950 */  1161, 1161, 1161, 1161, 1161, 1161,   97,  526, 1161,    4,
 /*  1960 */  1161, 1161,  951,  951,  953,  954,   27, 1161,  422, 1161,
 /*  1970 */  1161,  961, 1161,  529, 1161, 1161, 1161,  103,  103, 1161,
 /*  1980 */  1161, 1161, 1161, 1161,  104, 1161,  415,  536,  535, 1161,
 /*  1990 */  1161,  951,  268, 1161, 1161, 1161,  415,  366,  366,  365,
 /*  2000 */   253,  363, 1161, 1161,  797, 1161, 1161, 1161,  523, 1161,
 /*  2010 */  1161, 1161, 1161, 1161, 1161, 1161, 1161,  213, 1161,  294,
 /*  2020 */  1161, 1161,  951,  951,  953,  954,   27,  293, 1161, 1161,
 /*  2030 */  1161,  961, 1161, 1161, 1161, 1161, 1161,  103,  103, 1161,
 /*  2040 */  1161, 1161, 1161, 1161,  104, 1161,  416,  537,  536, 1161,
 /*  2040 */  1161, 1161, 1161, 1161,  104, 1161,  415,  536,  535, 1161,
 /*  2050 */  1161,  951, 1161, 1161, 1161, 1161, 1161,  215, 1161, 1161,
 /*  2060 */  1161, 1161, 1161, 1161, 1161,  152, 1161, 1161,  154, 1161,
 /*  2070 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,  214,
 /*  2080 */  1161, 1161,  951,  951,  953,  954,   27, 1161, 1161, 1161,
 /*  2090 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
 /*  2100 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
 /*  2110 */  1161, 1161, 1161,  385, 1161, 1161, 1161, 1161,  288,  526,
 /*  2110 */  1161, 1161, 1161,  384, 1161, 1161, 1161, 1161,  288,  525,
 /*  2120 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
 /*  2130 */  1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161,
 /*  2140 */  1161,  423,
 /*  2140 */  1161,  422,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */   184,  184,  259,  260,  261,  259,  260,  261,  176,  177,
 /*    10 */   178,  179,  180,  181,  184,  208,  212,  213,  186,   19,
 /*    20 */   188,  205,  206,  280,  205,  221,   22,  195,   24,  195,
 /*    30 */   208,   31,  195,  205,   29,  205,  206,  255,   33,   39,
 /*    40 */   200,  201,  202,   43,   44,   45,   46,   47,   48,   49,
 /*    50 */    50,   51,   52,   53,   54,   55,   56,   57,  205,  227,
 /*    60 */   228,  227,  228,   59,  227,  228,  259,  260,  261,  252,
 /*    70 */    65,  241,  240,  184,  240,  223,  224,  240,  244,  245,
 /*    80 */   250,  259,  260,  261,   19,  253,   54,   55,   56,   57,
 /*    90 */    58,  184,  255,  184,  205,  206,   96,   97,   98,   99,
 /*   100 */   100,  101,  102,  103,  104,  105,  106,   46,   47,   48,
 /*   110 */    49,   46,  296,  297,  110,  283,   19,   96,   97,   98,
 /*   120 */    99,  100,  101,  102,  103,  104,  105,  106,   96,   97,
 /*     0 */   260,  261,  262,  260,  261,  262,  176,  177,  178,  179,
 /*    10 */   180,  181,  184,  206,  209,  184,  186,  206,  188,   19,
 /*    20 */   179,  281,  181,  213,  214,  195,  206,  186,  195,  188,
 /*    30 */   195,   31,  222,  184,  206,  207,  195,  206,  207,   39,
 /*    40 */    24,  209,  184,   43,   44,   45,   46,   47,   48,   49,
 /*    50 */    50,   51,   52,   53,   54,   55,   56,   57,  228,  229,
 /*    60 */   184,  228,  229,  228,  229,  260,  261,  262,  192,  228,
 /*    70 */   229,  241,  196,  242,  241,   59,  241,  205,  245,  246,
 /*    80 */   184,   22,  241,   24,  254,  213,   54,   55,   56,   57,
 /*    90 */    58,  256,  260,  261,  262,  254,   96,   97,   98,   99,
 /*   100 */   100,  101,  102,  103,  104,  105,  106,  100,  101,  102,
 /*   110 */   103,  104,  105,  106,  284,  203,   19,  221,   59,  102,
 /*   120 */   103,  104,  105,  106,   59,  284,  110,  269,   96,   97,
 /*   130 */    98,   99,  100,  101,  102,  103,  104,  105,  106,   94,
 /*   140 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
 /*   150 */    53,   54,   55,   56,   57,  110,  106,   73,  251,  114,
 /*   160 */    73,  178,  179,  180,  181,   59,  184,  292,   81,  186,
 /*   170 */   295,  188,  218,  108,   19,  114,  184,   11,  195,  184,
 /*   180 */    83,  184,   85,   54,   55,   56,   57,  205,  206,  124,
 /*   150 */    53,   54,   55,   56,   57,  110,  184,  106,   73,  114,
 /*   160 */   178,  179,  180,  181,  219,  184,   81,   22,  186,  110,
 /*   170 */   188,  121,  122,  195,  109,  110,  111,  195,  206,  207,
 /*   180 */    83,  184,   85,   54,   55,   56,   57,  206,  207,  277,
 /*   190 */   145,  146,  147,   96,   97,   98,   99,  100,  101,  102,
 /*   200 */   103,  104,  105,  106,  120,  121,  122,  120,  102,   81,
 /*   210 */   227,  228,  220,   19,   16,  109,  110,  111,  131,  132,
 /*   220 */    26,  184,  184,  240,  229,   96,   97,   98,   99,  100,
 /*   230 */   101,  102,  103,  104,  105,  106,  253,   43,   44,   45,
 /*   200 */   103,  104,  105,  106,   59,  120,  228,  229,  143,  184,
 /*   210 */   228,  229,  184,   19,  242,  203,  131,  132,  221,  241,
 /*   220 */    26,  184,  184,  241,  196,   96,   97,   98,   99,  100,
 /*   230 */   101,  102,  103,  104,  105,  106,  254,   43,   44,   45,
 /*   240 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
 /*   250 */    56,   57,  100,  101,  102,  103,  104,  105,  106,  131,
 /*   260 */   132,  106,  127,   69,  129,  130,  283,  112,  113,  114,
 /*   270 */   115,  116,  117,  118,   81,   77,   76,   79,  296,  124,
 /*   280 */   298,  203,  184,   19,   84,   59,   86,  121,  122,   89,
 /*   250 */    56,   57,  184,  184,  109,  110,  111,  105,  106,  184,
 /*   260 */   200,  201,  202,   69,  184,  227,  284,   96,   97,   98,
 /*   270 */    99,  100,  101,  102,  103,  104,  105,  106,  297,  298,
 /*   280 */   255,  206,  207,   19,  272,   59,  206,  207,  184,  277,
 /*   290 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
 /*   300 */   106,  184,   35,  205,  206,   22,  113,   43,   44,   45,
 /*   300 */   106,  184,  259,   19,  184,  100,  101,   43,   44,   45,
 /*   310 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
 /*   320 */    56,   57,  205,  206,  131,  132,  100,  101,  291,  292,
 /*   330 */   114,   67,  295,   66,  108,  109,  110,  111,  138,  113,
 /*   340 */   124,   74,   59,  179,  184,  181,  184,  121,   22,  271,
 /*   350 */   186,   19,  188,  184,  276,   59,   24,  184,  241,  195,
 /*   320 */    56,   57,  242,  206,  207,  184,  100,  101,  138,  292,
 /*   330 */   293,   67,   76,  296,  108,  109,  110,  111,  295,  113,
 /*   340 */    84,   59,   86,   22,   26,   89,  156,  121,  224,  225,
 /*   350 */   145,   19,  147,   59,   72,  256,   24,  184,  290,  291,
 /*   360 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
 /*   370 */   106,  145,   59,  147,  184,   43,   44,   45,   46,   47,
 /*   370 */   106,  145,  297,  147,  299,   43,   44,   45,   46,   47,
 /*   380 */    48,   49,   50,   51,   52,   53,   54,   55,   56,   57,
 /*   390 */   123,  227,  228,  110,  296,  297,   22,   23,  184,  102,
 /*   400 */   103,  104,  105,  106,  240,  109,  110,  111,  112,  195,
 /*   410 */   204,  115,  116,  117,   22,  184,  226,  253,  212,  205,
 /*   420 */   206,  125,  109,  110,  111,   22,  100,  101,   96,   97,
 /*   430 */    98,   99,  100,  101,  102,  103,  104,  105,  106,  184,
 /*   440 */    59,  227,  228,  121,  122,   59,  277,  283,   19,  289,
 /*   450 */   290,   59,   23,   76,  240,  241,  143,   76,   72,  189,
 /*   460 */   205,  206,   59,   86,  250,   84,   89,   86,  203,   95,
 /*   470 */    89,  281,   43,   44,   45,   46,   47,   48,   49,   50,
 /*   480 */    51,   52,   53,   54,   55,   56,   57,  227,  228,  184,
 /*   490 */   109,  110,  111,   12,  184,  109,  110,  111,  184,  184,
 /*   500 */   240,  109,  110,  111,  184,  195,  214,   59,   27,  184,
 /*   510 */   205,  206,  109,  110,  111,  205,  206,  184,  263,  138,
 /*   520 */   205,  206,  184,   42,   22,   96,   97,   98,   99,  100,
 /*   530 */   101,  102,  103,  104,  105,  106,  266,  227,  228,   59,
 /*   540 */   270,  276,   94,   66,   63,   19,  241,   22,   26,   23,
 /*   550 */   240,  241,   72,   59,   73,  250,  241,  109,  110,   82,
 /*   560 */    22,   59,  114,  223,  224,  250,  252,   59,   91,   43,
 /*   390 */   106,  109,  110,  111,  138,  184,  112,  113,  114,  115,
 /*   400 */   116,  117,  118,  109,  110,  111,  112,   59,  124,  115,
 /*   410 */   116,  117,  292,  293,  297,  298,  296,  206,  207,  125,
 /*   420 */    72,  100,  101,  184,   46,   47,   48,   49,   96,   97,
 /*   430 */    98,   99,  100,  101,  102,  103,  104,  105,  106,   59,
 /*   440 */   200,  201,  202,  184,   59,  206,  207,   46,   19,  131,
 /*   450 */   132,  278,   23,  242,  184,  184,   76,  109,  110,  111,
 /*   460 */   224,  225,  251,   81,   84,  184,   86,   22,   23,   89,
 /*   470 */   184,   26,   43,   44,   45,   46,   47,   48,   49,   50,
 /*   480 */    51,   52,   53,   54,   55,   56,   57,  102,  184,  109,
 /*   490 */   110,  111,  114,  184,  109,  110,  111,  184,  227,  184,
 /*   500 */   230,  184,   22,  264,  195,   59,   22,  184,  195,  108,
 /*   510 */   206,  207,   59,  131,  132,  206,  207,  184,  138,  206,
 /*   520 */   207,  206,  207,  206,  207,   96,   97,   98,   99,  100,
 /*   530 */   101,  102,  103,  104,  105,  106,  255,  228,  229,   59,
 /*   540 */    95,  228,  229,   59,  184,   19,  242,   94,  184,   23,
 /*   550 */   241,  242,  184,  282,  241,  242,  110,  242,  184,  242,
 /*   560 */   251,   59,  109,  110,  196,  184,  251,  114,  251,   43,
 /*   570 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,
 /*   580 */    54,   55,   56,   57,   59,  184,   26,   59,  268,  109,
 /*   590 */   110,  111,  184,  145,  146,  147,  112,   59,  203,  115,
 /*   600 */   116,  117,  277,  109,  110,  111,  205,  206,  195,  125,
 /*   610 */   277,  109,  110,  111,  100,  101,  139,  109,  110,  111,
 /*   620 */   219,  184,   96,   97,   98,   99,  100,  101,  102,  103,
 /*   630 */   104,  105,  106,  111,  109,  110,  111,  109,  110,  111,
 /*   640 */   227,  228,   19,  184,  136,  184,   23,  109,  110,  111,
 /*   650 */   200,  201,  202,  240,  259,  260,  261,  195,  136,  145,
 /*   660 */   184,  147,  184,  184,  136,  214,   43,   44,   45,   46,
 /*   580 */    54,   55,   56,   57,  259,  217,   12,  219,  255,  109,
 /*   590 */   110,  111,  203,  109,  110,  111,  184,   22,  145,  146,
 /*   600 */   147,   27,  112,   22,  230,  115,  116,  117,  227,   19,
 /*   610 */    59,  109,  110,  111,  291,  125,   42,   35,  206,  207,
 /*   620 */   295,  184,   96,   97,   98,   99,  100,  101,  102,  103,
 /*   630 */   104,  105,  106,   26,   59,  233,   46,   63,  136,  184,
 /*   640 */    59,  184,   19,  206,  207,  243,   23,   73,   66,  260,
 /*   650 */   261,  262,   59,  184,  242,  195,   74,  220,  184,  184,
 /*   660 */   109,  110,  111,  206,  207,  184,   43,   44,   45,   46,
 /*   670 */    47,   48,   49,   50,   51,   52,   53,   54,   55,   56,
 /*   680 */    57,  205,  206,  205,  206,  227,  228,  184,  229,  227,
 /*   690 */   228,  131,  132,  184,   59,  219,  184,  219,  240,  291,
 /*   700 */   292,  184,  240,  295,  105,  106,   22,   23,  205,  206,
 /*   710 */    26,  184,  251,  184,  205,  206,  184,  205,  206,   96,
 /*   680 */    57,  206,  207,   76,  109,  110,  111,  136,  228,  229,
 /*   690 */   109,  110,  111,   86,  184,  220,   89,   21,  108,  230,
 /*   700 */   184,  241,  109,  110,  111,  123,  184,  127,  184,  129,
 /*   710 */   130,  184,  195,  184,  124,  184,  198,  199,  184,   96,
 /*   720 */    97,   98,   99,  100,  101,  102,  103,  104,  105,  106,
 /*   730 */   251,  219,  205,  206,  205,  206,  184,  205,  206,   19,
 /*   740 */   184,   16,  184,   23,  241,  110,  219,   21,  219,  184,
 /*   750 */   241,  219,  286,  287,  195,  184,  195,  205,  206,  201,
 /*   760 */   202,  205,  206,   43,   44,   45,   46,   47,   48,   49,
 /*   770 */    50,   51,   52,   53,   54,   55,   56,   57,  184,   95,
 /*   780 */    22,   23,  184,   26,   26,  220,  227,  228,  227,  228,
 /*   790 */   196,  184,   23,  241,   26,   26,  195,  241,  184,  240,
 /*   800 */    12,  240,   77,   26,   79,  195,   80,  290,  201,  202,
 /*   810 */   216,  184,  218,  195,  184,   27,   96,   97,   98,   99,
 /*   820 */   100,  101,  102,  103,  104,  105,  106,  269,  227,  228,
 /*   830 */    42,  184,  205,  206,  184,  184,   19,  227,  228,  192,
 /*   840 */    23,  240,  116,  196,   76,  227,  228,  120,  121,  122,
 /*   850 */   240,   63,  254,   95,   86,  205,  206,   89,  240,  184,
 /*   730 */   206,  207,   11,  206,  207,  206,  207,  206,  207,   19,
 /*   740 */   206,  207,  184,   23,  220,  228,  229,  220,   81,  220,
 /*   750 */   195,  220,  287,  288,  220,  195,   80,  195,  241,  201,
 /*   760 */   202,  184,   73,   43,   44,   45,   46,   47,   48,   49,
 /*   770 */    50,   51,   52,   53,   54,   55,   56,   57,  201,  202,
 /*   780 */   113,  195,  184,  228,  229,  120,  121,  122,  228,  229,
 /*   790 */   228,  229,  116,   16,   23,  184,  241,   26,  131,  132,
 /*   800 */   278,  241,   19,  241,   22,   23,  184,  189,   26,  120,
 /*   810 */   121,  122,  184,   26,  228,  229,   96,   97,   98,   99,
 /*   820 */   100,  101,  102,  103,  104,  105,  106,  241,  270,  153,
 /*   830 */    66,  228,  229,  229,  206,  207,   19,  184,  228,  229,
 /*   840 */    23,   16,  121,  122,  241,  241,   82,  270,   29,  227,
 /*   850 */   252,  241,   33,   19,   77,   91,   79,  184,   22,   23,
 /*   860 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
 /*   870 */    53,   54,   55,   56,   57,  184,  269,  184,  153,  153,
 /*   880 */   111,  184,    7,    8,    9,  184,  138,  184,  184,  196,
 /*   890 */   184,  120,  121,  122,  184,  138,  205,  206,  184,  102,
 /*   900 */   184,  184,  205,  206,  156,  136,  205,  206,  205,  206,
 /*   910 */   198,  199,  135,   96,   97,   98,   99,  100,  101,  102,
 /*   920 */   103,  104,  105,  106,  184,  128,  184,  184,  184,  254,
 /*   930 */   133,  184,  237,   19,  239,  229,  226,   23,  292,  184,
 /*   940 */   226,  295,  226,  226,  184,  205,  206,  205,  206,  205,
 /*   950 */   206,  184,  292,   19,  184,  295,  252,   43,   44,   45,
 /*   870 */    53,   54,   55,   56,   57,   12,  184,   95,  184,  206,
 /*   880 */   207,   76,  111,  184,   65,  267,  184,  184,  184,  271,
 /*   890 */    27,   86,  109,  184,   89,  120,  121,  122,  206,  207,
 /*   900 */   206,  207,   77,  139,   79,   42,  184,  136,  206,  207,
 /*   910 */   206,  207,  184,   96,   97,   98,   99,  100,  101,  102,
 /*   920 */   103,  104,  105,  106,  184,  138,   63,  184,  206,  207,
 /*   930 */   153,   95,  184,   19,  206,  207,  227,   23,    7,    8,
 /*   940 */     9,  293,  293,  109,  296,  296,  206,  207,  215,  206,
 /*   950 */   207,  184,  253,   19,  206,  207,  253,   43,   44,   45,
 /*   960 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
 /*   970 */    56,   57,  205,  206,  184,  205,  206,   43,   44,   45,
 /*   970 */    56,   57,  184,  206,  207,  184,  184,   43,   44,   45,
 /*   980 */    46,   47,   48,   49,   50,   51,   52,   53,   54,   55,
 /*   990 */    56,   57,  157,  158,   26,  205,  206,  254,   26,  252,
 /*  1000 */   184,   15,  184,  184,  184,  292,  184,  252,  295,   24,
 /*   990 */    56,   57,  184,   22,   23,  184,   59,  206,  207,  184,
 /*  1000 */   184,  238,  184,  240,  184,   22,  184,  184,  157,  158,
 /*  1010 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
 /*  1020 */   106,  205,  206,  205,  206,  205,  206,  205,  206,  184,
 /*  1020 */   106,  206,  207,  184,  206,  207,  206,  207,  206,  207,
 /*  1030 */    96,   97,   98,   99,  100,  101,  102,  103,  104,  105,
 /*  1040 */   106,  184,  184,  184,   59,  184,   60,  184,  229,  184,
 /*  1050 */   205,  206,  184,  258,  184,   19,  184,   19,  184,  246,
 /*  1060 */   184,  258,  205,  206,  205,  206,  205,  206,  205,  206,
 /*  1070 */   205,  206,  184,  205,  206,  205,  206,  205,  206,  205,
 /*  1080 */   206,  205,  206,  292,  226,  151,  295,  184,  228,  294,
 /*  1090 */   184,  119,  184,  205,  206,  110,  150,  294,  152,  184,
 /*  1100 */   240,  184,   22,   23,   23,   19,  184,   26,  205,  206,
 /*  1110 */   142,  205,  206,  205,  206,  184,  198,  199,  131,  132,
 /*  1120 */   205,  206,  205,  206,   22,   19,   24,  205,  206,   43,
 /*  1040 */   106,  184,   59,  227,  252,  184,  293,  110,  184,  296,
 /*  1050 */   184,  184,  184,  230,  184,  184,  184,   15,  184,  184,
 /*  1060 */   184,  253,  184,  206,  207,  184,   95,  206,  207,  102,
 /*  1070 */   206,  207,  206,  207,  206,  207,  206,  207,  206,  207,
 /*  1080 */   206,  207,  206,  207,  184,  151,  184,  206,  207,  278,
 /*  1090 */   184,  252,  184,  110,  184,  128,  184,  198,  199,  184,
 /*  1100 */   133,  184,   60,   26,  184,   19,  206,  207,  206,  207,
 /*  1110 */   131,  132,  206,  207,  206,  207,  206,  207,  206,  207,
 /*  1120 */   253,  206,  207,  206,  207,   19,  206,  207,  253,   43,
 /*  1130 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,
 /*  1140 */    54,   55,   56,   57,  184,  109,  184,  109,  184,   43,
 /*  1140 */    54,   55,   56,   57,  184,   26,  184,   26,  184,   43,
 /*  1150 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,
 /*  1160 */    54,   55,   56,   57,   46,  205,  206,  205,  206,  205,
 /*  1170 */   206,  232,  184,  184,  184,   95,  184,  284,  285,  244,
 /*  1180 */   245,  242,   96,   97,   98,   99,  100,  101,  102,  103,
 /*  1190 */   104,  105,  106,  205,  206,  205,  206,  205,  206,  184,
 /*  1200 */    22,  184,   96,   97,   98,   99,  100,  101,  102,  103,
 /*  1210 */   104,  105,  106,  184,   24,   23,  184,  184,   26,  184,
 /*  1220 */   205,  206,  205,  206,  184,   31,  108,  128,   22,  122,
 /*  1230 */   184,   53,  133,   39,  205,  206,   22,  151,  205,  206,
 /*  1240 */   205,  206,  113,  114,   23,  205,  206,   26,   59,   23,
 /*  1250 */    23,  144,   26,   26,  184,   23,   23,   19,   26,   26,
 /*  1260 */     7,    8,   24,   23,  214,   23,   26,   61,   26,   59,
 /*  1270 */    23,   23,   23,   26,   26,   26,  145,   19,  147,   59,
 /*  1280 */   184,   43,   44,   45,   46,   47,   48,   49,   50,   51,
 /*  1290 */    52,   53,   54,   55,   56,   57,  145,   23,  147,  110,
 /*  1160 */    54,   55,   56,   57,  285,  286,  206,  207,  206,  207,
 /*  1170 */   206,  207,  184,   31,  184,  293,  184,  293,  296,  184,
 /*  1180 */   296,   39,   96,   97,   98,   99,  100,  101,  102,  103,
 /*  1190 */   104,  105,  106,  184,  206,  207,  206,  207,  206,  207,
 /*  1200 */   184,   22,   96,   97,   98,   99,  100,  101,  102,  103,
 /*  1210 */   104,  105,  106,  184,  245,  246,  184,   26,   23,  142,
 /*  1220 */   128,   26,  206,  207,  150,  133,  152,   22,   22,   24,
 /*  1230 */   111,   23,   53,  184,   26,  206,  207,  151,  206,  207,
 /*  1240 */   119,   24,  122,   23,   23,   23,   26,   26,   26,   23,
 /*  1250 */    23,   23,   26,   26,   26,  136,   23,   19,   22,   26,
 /*  1260 */   113,  114,   24,  114,  144,  184,   59,   61,    7,    8,
 /*  1270 */    59,   23,   23,  124,   26,   26,   23,   19,  145,   26,
 /*  1280 */   147,   43,   44,   45,   46,   47,   48,   49,   50,   51,
 /*  1290 */    52,   53,   54,   55,   56,   57,  145,   23,  147,  184,
 /*  1300 */    26,   43,   44,   45,   46,   47,   48,   49,   50,   51,
 /*  1310 */    52,   53,   54,   55,   56,   57,   23,  184,  184,   26,
 /*  1320 */   110,  184,  184,  184,  134,  184,  184,  184,  184,  184,
 /*  1330 */   110,  184,  184,  184,   96,   97,   98,   99,  100,  101,
 /*  1340 */   102,  103,  104,  105,  106,  184,  184,  184,  134,  300,
 /*  1350 */   184,  243,  184,  184,   96,   97,   98,   99,  100,  101,
 /*  1310 */    52,   53,   54,   55,   56,   57,   23,  110,  184,   26,
 /*  1320 */   184,  110,  184,  184,  184,  215,  135,  215,  184,  184,
 /*  1330 */   184,  247,  184,  244,   96,   97,   98,   99,  100,  101,
 /*  1340 */   102,  103,  104,  105,  106,  184,  184,  184,  301,  184,
 /*  1350 */   184,  134,  225,  184,   96,   97,   98,   99,  100,  101,
 /*  1360 */   102,  103,  104,  105,  106,  184,  184,  184,  184,  184,
 /*  1370 */   224,  184,  282,  273,   19,  272,  203,  182,  243,  243,
 /*  1380 */   230,  209,  278,  243,  231,  208,  265,  278,  234,  234,
 /*  1390 */   234,  217,  213,   60,   19,  243,  208,  237,  233,   44,
 /*  1370 */   134,  184,  274,  273,   19,  244,  244,  204,  182,  244,
 /*  1380 */   283,  231,  279,  279,  232,  244,  210,  209,  235,  235,
 /*  1390 */   235,  248,  218,  234,   19,  209,  238,  209,  238,   44,
 /*  1400 */    45,   46,   47,   48,   49,   50,   51,   52,   53,   54,
 /*  1410 */    55,   56,   57,  208,  247,  187,  134,  247,  247,   38,
 /*  1410 */    55,   56,   57,  214,   60,  248,  248,  187,  134,   38,
 /*  1420 */    45,   46,   47,   48,   49,   50,   51,   52,   53,   54,
 /*  1430 */    55,   56,   57,  237,  231,  191,  191,  279,  279,  282,
 /*  1440 */   143,  191,  108,  268,   22,   19,   20,  256,   22,   43,
 /*  1450 */   257,   96,   97,   98,   99,  100,  101,  102,  103,  104,
 /*  1460 */   105,  106,   36,  222,  142,  234,   18,  191,  225,   18,
 /*  1470 */   190,   96,   97,   98,   99,  100,  101,  102,  103,  104,
 /*  1480 */   105,  106,  225,  191,  225,   59,  225,  257,  234,  234,
 /*  1490 */   256,  222,  222,  190,  234,  150,   62,   71,  275,  274,
 /*  1500 */   191,   19,   20,  190,   22,   22,  210,   81,  191,  190,
 /*  1510 */   210,  191,  108,  190,  207,  207,   64,  207,   36,  215,
 /*  1520 */    94,  210,  207,  209,  119,  207,  100,  101,  207,  106,
 /*  1530 */    48,  215,  207,  107,  210,  109,  110,  111,  267,  267,
 /*  1540 */   114,   59,  210,  249,  137,  108,  248,  191,  249,  248,
 /*  1550 */    88,  249,  141,   71,  248,  299,  138,  131,  132,   22,
 /*  1560 */   191,  249,  299,  237,   82,  238,  150,  262,  140,   87,
 /*  1570 */   139,  145,  146,  147,  148,  149,   94,  248,  238,  236,
 /*  1580 */    25,  235,  100,  101,  234,  194,   26,  193,   13,  107,
 /*  1590 */     6,  109,  110,  111,  264,  185,  114,  185,  183,  197,
 /*  1600 */   183,  203,  183,  203,  203,  197,  203,  211,  211,    4,
 /*  1610 */   197,    3,  203,   22,  155,   15,  288,  203,   93,  288,
 /*  1620 */   285,   23,   16,  203,  203,   23,  132,  145,  146,  147,
 /*  1630 */   148,  149,    0,    1,    2,  143,  123,    5,   24,  135,
 /*  1640 */    20,   16,   10,   11,   12,   13,   14,  137,    1,   17,
 /*  1650 */   135,  144,   19,   20,  123,   22,   61,  143,   37,  123,
 /*  1660 */    53,  109,   30,   53,   32,   53,   53,  134,   34,   36,
 /*  1670 */     1,    5,   40,   22,  108,  153,   26,   68,   75,   68,
 /*  1680 */    41,  134,  108,   24,   20,  124,   19,  118,   23,   67,
 /*  1690 */    22,   67,   59,   22,   22,   22,   22,   67,   28,   37,
 /*  1700 */    23,  142,   70,   22,   71,   23,  157,   23,   23,   26,
 /*  1710 */    78,   23,   22,   81,   23,   82,   24,   22,   24,  134,
 /*  1720 */    87,   23,   19,   20,   92,   22,  109,   94,   23,   22,
 /*  1730 */    34,   34,  136,  100,  101,   26,   34,   85,   34,   36,
 /*  1740 */   107,   83,  109,  110,  111,   34,   90,  114,   34,   23,
 /*  1750 */    75,   75,   44,   22,   24,   26,   34,   23,  126,   26,
 /*  1760 */    23,   23,   59,  131,  132,   23,   23,   26,   23,   22,
 /*  1770 */    11,   22,   22,   22,   71,   23,   23,   22,  145,  146,
 /*  1780 */   147,  148,  149,   26,   23,   82,  154,  134,  128,  134,
 /*  1790 */    87,  134,   15,    1,  301,  134,  301,   94,  301,  301,
 /*  1800 */   301,  301,  301,  100,  101,  301,  301,  301,  301,  301,
 /*  1810 */   107,  301,  109,  110,  111,    1,    2,  114,  301,    5,
 /*  1820 */   301,  301,  301,  301,   10,   11,   12,   13,   14,  301,
 /*  1830 */   301,   17,  301,  301,  301,  301,   19,   20,  301,   22,
 /*  1840 */   301,  301,  301,  301,   30,  301,   32,  301,  145,  146,
 /*  1850 */   147,  148,  149,   36,   40,  301,  301,  301,  301,  301,
 /*  1860 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
 /*  1870 */   301,  301,  301,  301,  301,  301,   59,  301,  301,  301,
 /*  1880 */   301,  301,  301,  301,   70,  301,  301,  301,   71,  301,
 /*  1890 */   301,  301,   78,  301,  301,   81,   19,   20,  301,   22,
 /*  1900 */   301,  301,  301,  301,  301,  301,   92,  301,  301,  301,
 /*  1910 */   301,   94,  301,   36,  301,  301,  301,  100,  101,  102,
 /*  1920 */   301,  301,  301,  301,  107,  301,  109,  110,  111,  301,
 /*  1930 */   301,  114,  301,  301,  301,  301,   59,  301,  301,  301,
 /*  1940 */   126,  301,  301,  301,  301,  131,  132,  301,   71,  301,
 /*  1950 */   301,  301,  301,  301,  301,  301,   19,   20,  301,   22,
 /*  1960 */   301,  301,  145,  146,  147,  148,  149,  301,  154,  301,
 /*  1970 */   301,   94,  301,   36,  301,  301,  301,  100,  101,  301,
 /*  1980 */   301,  301,  301,  301,  107,  301,  109,  110,  111,  301,
 /*  1990 */   301,  114,    5,  301,  301,  301,   59,   10,   11,   12,
 /*  2000 */    13,   14,  301,  301,   17,  301,  301,  301,   71,  301,
 /*  2010 */   301,  301,  301,  301,  301,  301,  301,   30,  301,   32,
 /*  2020 */   301,  301,  145,  146,  147,  148,  149,   40,  301,  301,
 /*  2030 */   301,   94,  301,  301,  301,  301,  301,  100,  101,  301,
 /*  2040 */   301,  301,  301,  301,  107,  301,  109,  110,  111,  301,
 /*  2050 */   301,  114,  301,  301,  301,  301,  301,   70,  301,  301,
 /*  2060 */   301,  301,  301,  301,  301,   78,  301,  301,   81,  301,
 /*  2070 */   301,  301,  301,  301,  301,  301,  301,  301,  301,   92,
 /*  2080 */   301,  301,  145,  146,  147,  148,  149,  301,  301,  301,
 /*  2090 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
 /*  2100 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
 /*  2110 */   301,  301,  301,  126,  301,  301,  301,  301,  131,  132,
 /*  2120 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
 /*  2130 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
 /*  2140 */   301,  154,  301,  301,  301,  301,  301,  301,  301,  301,
 /*  2150 */   301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
 /*  2160 */   301,  301,  301,  301,  301,  301,  301,  301,  301,
 /*  1430 */    55,   56,   57,  232,  191,  191,  266,  280,  191,  283,
 /*  1440 */   143,  269,  108,   22,  280,   19,   20,  258,   22,  257,
 /*  1450 */    43,   96,   97,   98,   99,  100,  101,  102,  103,  104,
 /*  1460 */   105,  106,   36,  223,  142,   18,  235,  226,  226,  191,
 /*  1470 */    18,   96,   97,   98,   99,  100,  101,  102,  103,  104,
 /*  1480 */   105,  106,  226,  226,  190,   59,  235,  235,  223,  223,
 /*  1490 */   258,  257,  191,  190,  235,  150,   62,   71,  191,  276,
 /*  1500 */   275,   19,   20,  190,   22,   22,  211,   81,  191,  190,
 /*  1510 */   211,  191,  108,  190,  208,   64,  208,  208,   36,  119,
 /*  1520 */    94,  216,  211,  208,  210,  106,  100,  101,  216,  208,
 /*  1530 */    48,  268,  208,  107,  208,  109,  110,  111,  211,  268,
 /*  1540 */   114,   59,  211,  137,  108,   88,  250,  249,  191,  141,
 /*  1550 */   250,  249,  138,   71,  250,  300,   22,  131,  132,  249,
 /*  1560 */   300,  191,  150,  238,   82,  140,  250,  249,  239,   87,
 /*  1570 */   139,  145,  146,  147,  148,  149,   94,  239,  237,  236,
 /*  1580 */    25,  235,  100,  101,  194,   26,  193,   13,  185,  107,
 /*  1590 */   185,  109,  110,  111,    6,  263,  114,  203,  265,  183,
 /*  1600 */   183,  183,  203,  212,  203,  203,  197,  197,  212,    4,
 /*  1610 */     3,   22,  197,  155,   15,  204,  203,  289,   93,  289,
 /*  1620 */    16,  286,  132,   23,  204,   23,  123,  145,  146,  147,
 /*  1630 */   148,  149,    0,    1,    2,  143,   24,    5,   20,  135,
 /*  1640 */    16,    1,   10,   11,   12,   13,   14,  137,  135,   17,
 /*  1650 */   144,  123,   19,   20,   61,   22,   37,  143,  123,   53,
 /*  1660 */   109,   53,   30,   53,   32,   34,   53,  134,    1,   36,
 /*  1670 */     5,   22,   40,  108,  153,   41,   26,   68,   75,   68,
 /*  1680 */   134,  108,   24,   20,  124,   19,  118,   67,   67,   28,
 /*  1690 */    22,   22,   59,   22,   67,   23,   22,   22,  142,   37,
 /*  1700 */    23,   22,   70,   23,   71,  157,   23,   23,   26,   23,
 /*  1710 */    78,   22,   24,   81,   23,   82,   22,   24,  134,   23,
 /*  1720 */    87,   23,   19,   20,   92,   22,  109,   94,   22,   34,
 /*  1730 */   136,   26,   85,  100,  101,   34,   34,   83,   34,   36,
 /*  1740 */   107,   34,  109,  110,  111,   75,   90,  114,   75,   34,
 /*  1750 */    23,   22,   44,   34,   24,   23,   22,   26,  126,   26,
 /*  1760 */    23,   23,   59,  131,  132,   23,   23,   26,   23,   11,
 /*  1770 */    22,   22,   26,   23,   71,   23,   22,   22,  145,  146,
 /*  1780 */   147,  148,  149,  128,   23,   82,  154,  134,   15,    1,
 /*  1790 */    87,  134,  302,  134,  134,  302,  302,   94,  302,  302,
 /*  1800 */   302,  302,  302,  100,  101,  302,  302,  302,  302,  302,
 /*  1810 */   107,  302,  109,  110,  111,    1,    2,  114,  302,    5,
 /*  1820 */   302,  302,  302,  302,   10,   11,   12,   13,   14,  302,
 /*  1830 */   302,   17,  302,  302,  302,  302,   19,   20,  302,   22,
 /*  1840 */   302,  302,  302,  302,   30,  302,   32,  302,  145,  146,
 /*  1850 */   147,  148,  149,   36,   40,  302,  302,  302,  302,  302,
 /*  1860 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
 /*  1870 */   302,  302,  302,  302,  302,  302,   59,  302,  302,  302,
 /*  1880 */   302,  302,  302,  302,   70,  302,  302,  302,   71,  302,
 /*  1890 */   302,  302,   78,  302,  302,   81,   19,   20,  302,   22,
 /*  1900 */   302,  302,  302,  302,  302,  302,   92,  302,  302,  302,
 /*  1910 */   302,   94,  302,   36,  302,  302,  302,  100,  101,  102,
 /*  1920 */   302,  302,  302,  302,  107,  302,  109,  110,  111,  302,
 /*  1930 */   302,  114,  302,  302,  302,  302,   59,  302,  302,  302,
 /*  1940 */   126,  302,  302,  302,  302,  131,  132,  302,   71,  302,
 /*  1950 */   302,  302,  302,  302,  302,  302,   19,   20,  302,   22,
 /*  1960 */   302,  302,  145,  146,  147,  148,  149,  302,  154,  302,
 /*  1970 */   302,   94,  302,   36,  302,  302,  302,  100,  101,  302,
 /*  1980 */   302,  302,  302,  302,  107,  302,  109,  110,  111,  302,
 /*  1990 */   302,  114,    5,  302,  302,  302,   59,   10,   11,   12,
 /*  2000 */    13,   14,  302,  302,   17,  302,  302,  302,   71,  302,
 /*  2010 */   302,  302,  302,  302,  302,  302,  302,   30,  302,   32,
 /*  2020 */   302,  302,  145,  146,  147,  148,  149,   40,  302,  302,
 /*  2030 */   302,   94,  302,  302,  302,  302,  302,  100,  101,  302,
 /*  2040 */   302,  302,  302,  302,  107,  302,  109,  110,  111,  302,
 /*  2050 */   302,  114,  302,  302,  302,  302,  302,   70,  302,  302,
 /*  2060 */   302,  302,  302,  302,  302,   78,  302,  302,   81,  302,
 /*  2070 */   302,  302,  302,  302,  302,  302,  302,  302,  302,   92,
 /*  2080 */   302,  302,  145,  146,  147,  148,  149,  302,  302,  302,
 /*  2090 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
 /*  2100 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
 /*  2110 */   302,  302,  302,  126,  302,  302,  302,  302,  131,  132,
 /*  2120 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
 /*  2130 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
 /*  2140 */   302,  154,  302,  302,  302,  302,  302,  302,  302,  302,
 /*  2150 */   302,  302,  302,  302,  302,  302,  302,  302,  302,  302,
 /*  2160 */   302,  302,  302,  302,  302,  302,  302,  302,  302,
};
#define YY_SHIFT_COUNT    (540)
#define YY_SHIFT_COUNT    (539)
#define YY_SHIFT_MIN      (0)
#define YY_SHIFT_MAX      (1987)
static const unsigned short int yy_shift_ofst[] = {
 /*     0 */  1814, 1632, 1987, 1426, 1426,  128, 1482, 1633, 1703, 1877,
 /*    10 */  1877, 1877,   87,    0,    0,  264, 1106, 1877, 1877, 1877,
 /*     0 */  1814, 1632, 1987, 1426, 1426,  382, 1482, 1633, 1703, 1877,
 /*    10 */  1877, 1877,   85,    0,    0,  264, 1106, 1877, 1877, 1877,
 /*    20 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
 /*    30 */   226,  226,  381,  381,  296,  193,  128,  128,  128,  128,
 /*    40 */   128,  128,   97,  194,  332,  429,  526,  623,  720,  817,
 /*    30 */   226,  226,  380,  380,  294,  667,  382,  382,  382,  382,
 /*    40 */   382,  382,   97,  194,  332,  429,  526,  623,  720,  817,
 /*    50 */   914,  934, 1086, 1238, 1106, 1106, 1106, 1106, 1106, 1106,
 /*    60 */  1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106,
 /*    70 */  1106, 1106, 1258, 1106, 1355, 1375, 1375, 1817, 1877, 1877,
 /*    80 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
 /*    90 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
 /*   100 */  1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
 /*   110 */  1937, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877,
 /*   120 */  1877, 1877, 1877, 1877,   32,  129,  129,  129,  129,  129,
 /*   130 */    21,  152,  297,  494,  726,   65,  494,  514,  514,  494,
 /*   140 */   560,  560,  560,  560,  322,  599,   50, 2142, 2142,  155,
 /*   150 */   155,  155,  313,  392,  386,  392,  392,  481,  481,  200,
 /*   160 */   480,  684,  758,  494,  494,  494,  494,  494,  494,  494,
 /*   170 */   494,  494,  494,  494,  494,  494,  494,  494,  494,  494,
 /*   180 */   494,  494,  494,  494,  768,  768,  494,  166,  377,  377,
 /*   190 */   635,  835,  835,  635,  748,  987, 2142, 2142, 2142,  448,
 /*   200 */    45,   45,  403,  484,  502,  106,  525,  508,  528,  538,
 /*   210 */   494,  494,  494,  494,  494,  494,  494,  494,  494,   84,
 /*   220 */   494,  494,  494,  494,  494,  494,  494,  494,  494,  494,
 /*   230 */   494,  494,  267,  267,  267,  494,  494,  494,  494,  769,
 /*   240 */   494,  494,  494,    4,  477,  494,  494,  788,  494,  494,
 /*   250 */   494,  494,  494,  494,  494,  494,  727,    5,  135,  985,
 /*   260 */   985,  985,  985,  522,  135,  135,  797,  326,  875,  986,
 /*   270 */   968, 1036, 1036, 1038,  968,  968, 1038,  972, 1081, 1118,
 /*   280 */  1194, 1194, 1194, 1036,  757,  757,  946,  777, 1099, 1102,
 /*   290 */  1333, 1282, 1282, 1381, 1381, 1282, 1297, 1334, 1422, 1406,
 /*   300 */  1322, 1448, 1448, 1448, 1448, 1282, 1451, 1322, 1322, 1334,
 /*   310 */  1422, 1406, 1406, 1322, 1282, 1451, 1345, 1434, 1282, 1451,
 /*   320 */  1483, 1282, 1451, 1282, 1451, 1483, 1404, 1404, 1404, 1452,
 /*   330 */  1483, 1404, 1405, 1404, 1452, 1404, 1404, 1483, 1423, 1423,
 /*   340 */  1483, 1407, 1437, 1407, 1437, 1407, 1437, 1407, 1437, 1282,
 /*   350 */  1462, 1462, 1411, 1418, 1537, 1282, 1416, 1411, 1428, 1431,
 /*   360 */  1322, 1555, 1560, 1575, 1575, 1584, 1584, 1584, 2142, 2142,
 /*   130 */   171,    7,   17,  593,  676,  590,  593,  205,  205,  593,
 /*   140 */   318,  318,  318,  318,   50,  152,   51, 2142, 2142,  284,
 /*   150 */   284,  284,   65,  145,  282,  145,  145,  574,  574,  256,
 /*   160 */   348,  445,  782,  593,  593,  593,  593,  593,  593,  593,
 /*   170 */   593,  593,  593,  593,  593,  593,  593,  593,  593,  593,
 /*   180 */   593,  593,  593,  593,  607,  607,  593,  721,  805,  805,
 /*   190 */   446,  851,  851,  446,  190,  979, 2142, 2142, 2142,  453,
 /*   200 */    45,   45,  480,  490,  484,  385,  575,  502,  551,  581,
 /*   210 */   593,  593,  593,  593,  593,  593,  593,  593,  593,  689,
 /*   220 */   593,  593,  593,  593,  593,  593,  593,  593,  593,  593,
 /*   230 */   593,  593,  582,  582,  582,  593,  593,  593,  593,  771,
 /*   240 */   593,  593,  593,   59,  764,  593,  593,  863,  593,  593,
 /*   250 */   593,  593,  593,  593,  593,  593,  665,  819,  580,   16,
 /*   260 */    16,   16,   16, 1119,  580,  580,  967,  321,  931, 1042,
 /*   270 */  1077,  783,  783,  834, 1077, 1077,  834, 1121, 1195,  401,
 /*   280 */  1142, 1142, 1142,  783,  787,  787, 1074, 1191, 1092, 1205,
 /*   290 */  1354, 1284, 1284, 1381, 1381, 1284, 1297, 1334, 1421, 1407,
 /*   300 */  1322, 1447, 1447, 1447, 1447, 1284, 1452, 1322, 1322, 1334,
 /*   310 */  1421, 1407, 1407, 1322, 1284, 1452, 1345, 1434, 1284, 1452,
 /*   320 */  1483, 1284, 1452, 1284, 1452, 1483, 1404, 1404, 1404, 1451,
 /*   330 */  1483, 1404, 1400, 1404, 1451, 1404, 1404, 1483, 1419, 1419,
 /*   340 */  1483, 1406, 1436, 1406, 1436, 1406, 1436, 1406, 1436, 1284,
 /*   350 */  1457, 1457, 1408, 1414, 1534, 1284, 1412, 1408, 1425, 1431,
 /*   360 */  1322, 1555, 1559, 1574, 1574, 1588, 1588, 1588, 2142, 2142,
 /*   370 */  2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142,
 /*   380 */  2142, 2142, 2142, 2142,   61,  725,  374, 1080,  198,  771,
 /*   390 */   283, 1192, 1178, 1190, 1107, 1221, 1206, 1226, 1227, 1232,
 /*   400 */  1233, 1240, 1242, 1189, 1129, 1253,  216, 1210, 1247, 1248,
 /*   410 */  1249, 1131, 1151, 1274, 1293, 1220, 1214, 1605, 1608, 1591,
 /*   420 */  1459, 1600, 1525, 1606, 1598, 1602, 1494, 1492, 1513, 1614,
 /*   430 */  1504, 1620, 1510, 1625, 1647, 1515, 1507, 1531, 1595, 1621,
 /*   440 */  1514, 1607, 1610, 1612, 1613, 1536, 1552, 1634, 1533, 1669,
 /*   450 */  1666, 1651, 1566, 1522, 1609, 1650, 1611, 1603, 1639, 1547,
 /*   460 */  1574, 1659, 1664, 1667, 1561, 1569, 1668, 1622, 1671, 1672,
 /*   470 */  1665, 1673, 1624, 1670, 1674, 1630, 1662, 1677, 1559, 1681,
 /*   480 */  1682, 1549, 1684, 1685, 1683, 1688, 1690, 1692, 1691, 1695,
 /*   490 */  1694, 1585, 1698, 1705, 1617, 1696, 1707, 1596, 1709, 1697,
 /*   500 */  1702, 1704, 1711, 1652, 1675, 1658, 1708, 1676, 1656, 1714,
 /*   510 */  1726, 1731, 1730, 1729, 1733, 1722, 1734, 1709, 1737, 1738,
 /*   520 */  1742, 1743, 1741, 1745, 1747, 1759, 1749, 1750, 1752, 1753,
 /*   530 */  1751, 1755, 1757, 1660, 1653, 1655, 1657, 1661, 1761, 1777,
 /*   380 */  2142, 2142, 2142,  378,  777,  836,  971,  825,  775,  983,
 /*   390 */  1208, 1179, 1217, 1120, 1220, 1206, 1221, 1222, 1226, 1227,
 /*   400 */  1228, 1233,  937, 1147, 1261, 1149, 1207, 1248, 1249, 1253,
 /*   410 */  1133, 1151, 1274, 1293, 1211, 1236, 1605, 1607, 1589, 1458,
 /*   420 */  1599, 1525, 1604, 1600, 1602, 1490, 1492, 1503, 1612, 1504,
 /*   430 */  1618, 1510, 1624, 1640, 1513, 1506, 1528, 1593, 1619, 1514,
 /*   440 */  1606, 1608, 1610, 1613, 1535, 1551, 1631, 1533, 1667, 1665,
 /*   450 */  1649, 1565, 1521, 1609, 1650, 1611, 1603, 1634, 1546, 1573,
 /*   460 */  1658, 1663, 1666, 1560, 1568, 1668, 1620, 1669, 1671, 1672,
 /*   470 */  1674, 1621, 1661, 1675, 1627, 1662, 1677, 1556, 1679, 1680,
 /*   480 */  1548, 1683, 1684, 1682, 1686, 1689, 1688, 1691, 1694, 1693,
 /*   490 */  1584, 1696, 1698, 1617, 1695, 1706, 1594, 1705, 1701, 1702,
 /*   500 */  1704, 1707, 1647, 1670, 1654, 1708, 1673, 1656, 1715, 1727,
 /*   510 */  1729, 1730, 1731, 1733, 1719, 1732, 1705, 1737, 1738, 1742,
 /*   520 */  1743, 1741, 1745, 1734, 1758, 1748, 1749, 1750, 1752, 1754,
 /*   530 */  1755, 1746, 1655, 1653, 1657, 1659, 1660, 1761, 1773, 1788,
 /*   540 */  1792,
};
#define YY_REDUCE_COUNT (383)
#define YY_REDUCE_MIN   (-257)
#define YY_REDUCE_MAX   (1421)
#define YY_REDUCE_COUNT (382)
#define YY_REDUCE_MIN   (-260)
#define YY_REDUCE_MAX   (1420)
static const short yy_reduce_ofst[] = {
 /*     0 */  -168,  -17,  164,  214,  310, -166, -184,  -18,   98, -170,
 /*    10 */   305,  315, -163, -193, -178, -257,  395,  401,  476,  478,
 /*    20 */   512,  117,  527,  529,  503,  509,  532,  255,  552,  556,
 /*    30 */   558,  607,   37,  408,  594,  413,  462,  559,  561,  601,
 /*    40 */   610,  618, -254, -254, -254, -254, -254, -254, -254, -254,
 /*    50 */  -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,
 /*    60 */  -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,
 /*    70 */  -254, -254, -254, -254, -254, -254, -254, -111,  627,  650,
 /*    80 */   691,  697,  701,  703,  740,  742,  744,  767,  770,  790,
 /*    90 */   816,  818,  820,  822,  845,  857,  859,  861,  863,  865,
 /*   100 */   868,  870,  872,  874,  876,  888,  903,  906,  908,  915,
 /*   110 */   917,  922,  960,  962,  964,  988,  990,  992, 1015, 1017,
 /*   120 */  1029, 1033, 1035, 1040, -254, -254, -254, -254, -254, -254,
 /*   130 */  -254, -254, -254,  190,  270, -196,  160, -160,  450,  647,
 /*   140 */   260,  458,  260,  458,   78, -254, -254, -254, -254,  206,
 /*   150 */   206,  206,  320,  598,   -5,  675,  743, -148,  340, -125,
 /*   160 */   459,  466,  466,  693,  -93,  461,  479,  706,  710,  714,
 /*   170 */   716,  717,  169, -183,  325,  314,  704,  333,  747,  858,
 /*   180 */    -8,  819,  565,  755,  646,  660,  517,  265,  713,  791,
 /*   190 */   712,  795,  803,  918,  695,  860,  893,  935,  939, -181,
 /*   200 */  -172, -147,  -91,  -46,   -3,  162,  173,  231,  338,  437,
 /*   210 */   571,  614,  630,  651,  760,  931,  989, 1032, 1046, -218,
 /*   220 */    38, 1070, 1096, 1133, 1134, 1137, 1138, 1139, 1141, 1142,
 /*   230 */  1143, 1144,  292,  451, 1050, 1145, 1147, 1148, 1149,  813,
 /*   240 */  1161, 1162, 1163, 1108, 1049, 1166, 1168, 1146, 1169,  162,
 /*   250 */  1181, 1182, 1183, 1184, 1185, 1187, 1100, 1103, 1150, 1135,
 /*   260 */  1136, 1140, 1152,  813, 1150, 1150, 1153, 1173, 1195, 1090,
 /*   270 */  1154, 1167, 1170, 1104, 1155, 1156, 1109, 1172, 1174, 1179,
 /*   280 */  1177, 1188, 1205, 1171, 1160, 1196, 1121, 1165, 1203, 1228,
 /*   290 */  1157, 1244, 1245, 1158, 1159, 1250, 1175, 1193, 1191, 1241,
 /*   300 */  1231, 1243, 1257, 1259, 1261, 1276, 1280, 1254, 1255, 1230,
 /*   310 */  1234, 1269, 1270, 1260, 1292, 1303, 1223, 1225, 1309, 1313,
 /*   320 */  1296, 1317, 1319, 1320, 1323, 1300, 1307, 1308, 1310, 1304,
 /*   330 */  1311, 1315, 1314, 1318, 1316, 1321, 1325, 1324, 1271, 1272,
 /*   340 */  1332, 1294, 1298, 1299, 1301, 1302, 1306, 1312, 1329, 1356,
 /*   350 */  1256, 1263, 1327, 1326, 1305, 1369, 1330, 1340, 1343, 1346,
 /*   360 */  1350, 1391, 1394, 1410, 1412, 1415, 1417, 1419, 1328, 1331,
 /*   370 */  1335, 1402, 1398, 1400, 1401, 1403, 1408, 1396, 1397, 1409,
 /*   380 */  1414, 1420, 1421, 1413,
 /*     0 */  -170,  -18, -159,  309,  313, -167,  -19,   75,  117,  211,
 /*    10 */   315,  317, -165, -195, -168, -260,  389,  437,  475,  524,
 /*    20 */   527, -169,  529,  531,  -28,   80,  534,  239,  304,  412,
 /*    30 */   558,  577,   37,  120,  368,  -22,  460,  517,  555,  560,
 /*    40 */   562,  586, -257, -257, -257, -257, -257, -257, -257, -257,
 /*    50 */  -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,
 /*    60 */  -257, -257, -257, -257, -257, -257, -257, -257, -257, -257,
 /*    70 */  -257, -257, -257, -257, -257, -257, -257, -172,  457,  628,
 /*    80 */   673,  692,  694,  702,  704,  722,  728,  740,  743,  748,
 /*    90 */   767,  791,  815,  818,  820,  822,  857,  861,  864,  866,
 /*   100 */   868,  870,  872,  874,  876,  881,  900,  902,  906,  908,
 /*   110 */   910,  912,  915,  917,  920,  960,  962,  964,  988,  990,
 /*   120 */   992, 1016, 1029, 1032, -257, -257, -257, -257, -257, -257,
 /*   130 */  -257, -257, -257,  271,  618, -190,   68,   60,  240, -124,
 /*   140 */   603,  610,  603,  610,   12, -257, -257, -257, -257, -128,
 /*   150 */  -128, -128, -142,   25,  270,  281,  333,  124,  236,  648,
 /*   160 */   374,  465,  465,   28,  598,  792,  839,  469,   38,  381,
 /*   170 */   622,  709,  173,  699,  522,  703,  808,  811,  867,  816,
 /*   180 */  -104,  823,   -3,  875,  649,  753,  323,  -88,  882,  884,
 /*   190 */   518,   43,  325,  899,  763,  604,  879,  969,  402, -193,
 /*   200 */  -189, -180, -151,  -55,   69,  104,  141,  259,  286,  360,
 /*   210 */   364,  455,  474,  481,  510,  516,  611,  653,  788,   99,
 /*   220 */   871,  878,  995, 1009, 1049, 1081, 1115, 1134, 1136, 1138,
 /*   230 */  1139, 1140,  733, 1110, 1112, 1144, 1145, 1146, 1148, 1084,
 /*   240 */  1161, 1162, 1163, 1089, 1047, 1165, 1166, 1127, 1169,  104,
 /*   250 */  1181, 1182, 1183, 1184, 1185, 1187, 1098, 1100, 1150, 1131,
 /*   260 */  1132, 1135, 1141, 1084, 1150, 1150, 1152, 1173, 1196, 1097,
 /*   270 */  1153, 1143, 1167, 1103, 1154, 1155, 1104, 1176, 1174, 1199,
 /*   280 */  1178, 1186, 1188, 1168, 1158, 1160, 1170, 1159, 1201, 1230,
 /*   290 */  1156, 1243, 1244, 1157, 1164, 1247, 1172, 1189, 1192, 1240,
 /*   300 */  1231, 1241, 1242, 1256, 1257, 1278, 1294, 1251, 1252, 1232,
 /*   310 */  1234, 1265, 1266, 1259, 1301, 1303, 1223, 1225, 1307, 1313,
 /*   320 */  1295, 1317, 1319, 1320, 1323, 1299, 1306, 1308, 1309, 1305,
 /*   330 */  1311, 1315, 1314, 1321, 1312, 1324, 1326, 1327, 1263, 1271,
 /*   340 */  1331, 1296, 1298, 1300, 1302, 1304, 1310, 1316, 1318, 1357,
 /*   350 */  1255, 1260, 1329, 1325, 1332, 1370, 1333, 1338, 1341, 1343,
 /*   360 */  1346, 1390, 1393, 1403, 1405, 1416, 1417, 1418, 1328, 1330,
 /*   370 */  1335, 1409, 1394, 1399, 1401, 1402, 1410, 1391, 1396, 1411,
 /*   380 */  1420, 1413, 1415,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */  1536, 1536, 1536, 1376, 1159, 1265, 1159, 1159, 1159, 1376,
 /*    10 */  1376, 1376, 1159, 1295, 1295, 1429, 1190, 1159, 1159, 1159,
 /*    20 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1375, 1159, 1159,
 /*    30 */  1159, 1159, 1459, 1459, 1159, 1159, 1159, 1159, 1159, 1159,
 /*    40 */  1159, 1159, 1159, 1301, 1159, 1159, 1159, 1159, 1159, 1377,
 /*    50 */  1378, 1159, 1159, 1159, 1428, 1430, 1393, 1311, 1310, 1309,
 /*    60 */  1308, 1411, 1282, 1306, 1299, 1303, 1371, 1372, 1370, 1374,
 /*    70 */  1378, 1377, 1159, 1302, 1342, 1356, 1341, 1159, 1159, 1159,
 /*     0 */  1537, 1537, 1537, 1377, 1159, 1266, 1159, 1159, 1159, 1377,
 /*    10 */  1377, 1377, 1159, 1296, 1296, 1430, 1190, 1159, 1159, 1159,
 /*    20 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1376, 1159, 1159,
 /*    30 */  1159, 1159, 1460, 1460, 1159, 1159, 1159, 1159, 1159, 1159,
 /*    40 */  1159, 1159, 1159, 1302, 1159, 1159, 1159, 1159, 1159, 1378,
 /*    50 */  1379, 1159, 1159, 1159, 1429, 1431, 1394, 1312, 1311, 1310,
 /*    60 */  1309, 1412, 1283, 1307, 1300, 1304, 1372, 1373, 1371, 1375,
 /*    70 */  1379, 1378, 1159, 1303, 1343, 1357, 1342, 1159, 1159, 1159,
 /*    80 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*    90 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   100 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   110 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   120 */  1159, 1159, 1159, 1159, 1350, 1355, 1361, 1354, 1351, 1344,
 /*   130 */  1343, 1345, 1346, 1159, 1180, 1229, 1159, 1159, 1159, 1159,
 /*   140 */  1447, 1446, 1159, 1159, 1190, 1347, 1348, 1358, 1357, 1436,
 /*   150 */  1492, 1491, 1394, 1159, 1159, 1159, 1159, 1159, 1159, 1459,
 /*   120 */  1159, 1159, 1159, 1159, 1351, 1356, 1362, 1355, 1352, 1345,
 /*   130 */  1344, 1346, 1347, 1159, 1180, 1230, 1159, 1159, 1159, 1159,
 /*   140 */  1448, 1447, 1159, 1159, 1190, 1348, 1349, 1359, 1358, 1437,
 /*   150 */  1493, 1492, 1395, 1159, 1159, 1159, 1159, 1159, 1159, 1460,
 /*   160 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   170 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   180 */  1159, 1159, 1159, 1159, 1459, 1459, 1159, 1190, 1459, 1459,
 /*   190 */  1186, 1336, 1335, 1186, 1289, 1159, 1442, 1265, 1256, 1159,
 /*   180 */  1159, 1159, 1159, 1159, 1460, 1460, 1159, 1190, 1460, 1460,
 /*   190 */  1186, 1337, 1336, 1186, 1290, 1159, 1443, 1266, 1257, 1159,
 /*   200 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   210 */  1159, 1159, 1159, 1433, 1431, 1159, 1159, 1159, 1159, 1159,
 /*   210 */  1159, 1159, 1159, 1434, 1432, 1159, 1159, 1159, 1159, 1159,
 /*   220 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   230 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   240 */  1159, 1159, 1159, 1261, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   250 */  1159, 1159, 1159, 1159, 1159, 1486, 1159, 1406, 1243, 1261,
 /*   260 */  1261, 1261, 1261, 1263, 1244, 1242, 1255, 1190, 1166, 1528,
 /*   270 */  1305, 1284, 1284, 1525, 1305, 1305, 1525, 1204, 1506, 1201,
 /*   280 */  1295, 1295, 1295, 1284, 1289, 1289, 1373, 1262, 1255, 1159,
 /*   290 */  1528, 1270, 1270, 1527, 1527, 1270, 1394, 1314, 1320, 1232,
 /*   300 */  1305, 1238, 1238, 1238, 1238, 1270, 1177, 1305, 1305, 1314,
 /*   310 */  1320, 1232, 1232, 1305, 1270, 1177, 1410, 1522, 1270, 1177,
 /*   320 */  1384, 1270, 1177, 1270, 1177, 1384, 1230, 1230, 1230, 1219,
 /*   330 */  1384, 1230, 1204, 1230, 1219, 1230, 1230, 1384, 1388, 1388,
 /*   340 */  1384, 1288, 1283, 1288, 1283, 1288, 1283, 1288, 1283, 1270,
 /*   350 */  1469, 1469, 1300, 1289, 1379, 1270, 1159, 1300, 1298, 1296,
 /*   360 */  1305, 1183, 1222, 1489, 1489, 1485, 1485, 1485, 1533, 1533,
 /*   370 */  1442, 1501, 1190, 1190, 1190, 1190, 1501, 1206, 1206, 1190,
 /*   380 */  1190, 1190, 1190, 1501, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   390 */  1496, 1159, 1395, 1274, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   240 */  1159, 1159, 1159, 1262, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   250 */  1159, 1159, 1159, 1159, 1159, 1487, 1159, 1407, 1244, 1262,
 /*   260 */  1262, 1262, 1262, 1264, 1245, 1243, 1256, 1191, 1166, 1529,
 /*   270 */  1306, 1285, 1285, 1526, 1306, 1306, 1526, 1205, 1507, 1202,
 /*   280 */  1296, 1296, 1296, 1285, 1290, 1290, 1374, 1263, 1256, 1159,
 /*   290 */  1529, 1271, 1271, 1528, 1528, 1271, 1395, 1315, 1321, 1233,
 /*   300 */  1306, 1239, 1239, 1239, 1239, 1271, 1177, 1306, 1306, 1315,
 /*   310 */  1321, 1233, 1233, 1306, 1271, 1177, 1411, 1523, 1271, 1177,
 /*   320 */  1385, 1271, 1177, 1271, 1177, 1385, 1231, 1231, 1231, 1220,
 /*   330 */  1385, 1231, 1205, 1231, 1220, 1231, 1231, 1385, 1389, 1389,
 /*   340 */  1385, 1289, 1284, 1289, 1284, 1289, 1284, 1289, 1284, 1271,
 /*   350 */  1470, 1470, 1301, 1290, 1380, 1271, 1159, 1301, 1299, 1297,
 /*   360 */  1306, 1183, 1223, 1490, 1490, 1486, 1486, 1486, 1534, 1534,
 /*   370 */  1443, 1502, 1190, 1190, 1190, 1190, 1502, 1207, 1207, 1191,
 /*   380 */  1191, 1190, 1502, 1159, 1159, 1159, 1159, 1159, 1159, 1497,
 /*   390 */  1159, 1396, 1275, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   400 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   410 */  1159, 1159, 1159, 1159, 1159, 1159, 1325, 1159, 1162, 1439,
 /*   420 */  1159, 1159, 1437, 1159, 1159, 1159, 1159, 1159, 1159, 1275,
 /*   410 */  1159, 1159, 1159, 1159, 1159, 1326, 1159, 1162, 1440, 1159,
 /*   420 */  1159, 1438, 1159, 1159, 1159, 1159, 1159, 1159, 1276, 1159,
 /*   430 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   440 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1524, 1159,
 /*   450 */  1159, 1159, 1159, 1159, 1159, 1409, 1408, 1159, 1159, 1272,
 /*   440 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1525, 1159, 1159,
 /*   450 */  1159, 1159, 1159, 1159, 1410, 1409, 1159, 1159, 1273, 1159,
 /*   460 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   470 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   480 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   490 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1297, 1159,
 /*   490 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1298, 1159, 1159,
 /*   500 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   510 */  1159, 1159, 1159, 1474, 1290, 1159, 1159, 1515, 1159, 1159,
 /*   510 */  1159, 1159, 1475, 1291, 1159, 1159, 1516, 1159, 1159, 1159,
 /*   520 */  1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159,
 /*   530 */  1159, 1159, 1510, 1246, 1327, 1159, 1326, 1330, 1159, 1171,
 /*   530 */  1159, 1511, 1247, 1328, 1159, 1327, 1331, 1159, 1171, 1159,
 /*   540 */  1159,
};
/********** End of lemon-generated parsing tables *****************************/

/* The next table maps tokens (terminal symbols) into fallback tokens.  
** If a construct like the following:
** 
**      %fallback ID X Y Z.
149477
149478
149479
149480
149481
149482
149483
149484
149485
149486
149487
149488
149489
149490
149491
149492
149493
149494
149495
149496
149497
149498
149499
149500
149501
149502
149503
149504
149505
149506
149507
149508
149509
149510
149511
149512
149513
149514
149515
149516
149517
149518
149519
149520
149521
149522
149523
149524
149525
149526
149527
149528
149529
149530
149531
149532
149533
149534
149535
149536
149537
149538
149539
149540
149541
149542
149543
149544
149545
149546
149547
149548
149549
149550
149551
149552
149553
149554
149555
149556
149557
149558
149559
149560
149561
149562
149563
149564
149565
149566
149567
149568
149569
149570
149571
149572
149573
149574
149575
149576
149577
149578
149579
149580


































































































149581
149582
149583
149584
149585
149586
149587
150051
150052
150053
150054
150055
150056
150057

































































































150058
150059
150060
150061
150062
150063
150064
150065
150066
150067
150068
150069
150070
150071
150072
150073
150074
150075
150076
150077
150078
150079
150080
150081
150082
150083
150084
150085
150086
150087
150088
150089
150090
150091
150092
150093
150094
150095
150096
150097
150098
150099
150100
150101
150102
150103
150104
150105
150106
150107
150108
150109
150110
150111
150112
150113
150114
150115
150116
150117
150118
150119
150120
150121
150122
150123
150124
150125
150126
150127
150128
150129
150130
150131
150132
150133
150134
150135
150136
150137
150138
150139
150140
150141
150142
150143
150144
150145
150146
150147
150148
150149
150150
150151
150152
150153
150154
150155
150156
150157
150158
150159
150160
150161
150162







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







  /*  197 */ "carglist",
  /*  198 */ "typetoken",
  /*  199 */ "typename",
  /*  200 */ "signed",
  /*  201 */ "plus_num",
  /*  202 */ "minus_num",
  /*  203 */ "scanpt",
  /*  204 */ "ccons",
  /*  205 */ "term",
  /*  206 */ "expr",
  /*  207 */ "onconf",
  /*  208 */ "sortorder",
  /*  209 */ "autoinc",
  /*  210 */ "eidlist_opt",
  /*  211 */ "refargs",
  /*  212 */ "defer_subclause",
  /*  213 */ "refarg",
  /*  214 */ "refact",
  /*  215 */ "init_deferred_pred_opt",
  /*  216 */ "conslist",
  /*  217 */ "tconscomma",
  /*  218 */ "tcons",
  /*  219 */ "sortlist",
  /*  220 */ "eidlist",
  /*  221 */ "defer_subclause_opt",
  /*  222 */ "orconf",
  /*  223 */ "resolvetype",
  /*  224 */ "raisetype",
  /*  225 */ "ifexists",
  /*  226 */ "fullname",
  /*  227 */ "selectnowith",
  /*  228 */ "oneselect",
  /*  229 */ "wqlist",
  /*  230 */ "multiselect_op",
  /*  231 */ "distinct",
  /*  232 */ "selcollist",
  /*  233 */ "from",
  /*  234 */ "where_opt",
  /*  235 */ "groupby_opt",
  /*  236 */ "having_opt",
  /*  237 */ "orderby_opt",
  /*  238 */ "limit_opt",
  /*  239 */ "window_clause",
  /*  240 */ "values",
  /*  241 */ "nexprlist",
  /*  242 */ "sclp",
  /*  243 */ "as",
  /*  244 */ "seltablist",
  /*  245 */ "stl_prefix",
  /*  246 */ "joinop",
  /*  247 */ "indexed_opt",
  /*  248 */ "on_opt",
  /*  249 */ "using_opt",
  /*  250 */ "exprlist",
  /*  251 */ "xfullname",
  /*  252 */ "idlist",
  /*  253 */ "with",
  /*  254 */ "setlist",
  /*  255 */ "insert_cmd",
  /*  256 */ "idlist_opt",
  /*  257 */ "upsert",
  /*  258 */ "over_clause",
  /*  259 */ "likeop",
  /*  260 */ "between_op",
  /*  261 */ "in_op",
  /*  262 */ "paren_exprlist",
  /*  263 */ "case_operand",
  /*  264 */ "case_exprlist",
  /*  265 */ "case_else",
  /*  266 */ "uniqueflag",
  /*  267 */ "collate",
  /*  268 */ "vinto",
  /*  269 */ "nmnum",
  /*  270 */ "trigger_decl",
  /*  271 */ "trigger_cmd_list",
  /*  272 */ "trigger_time",
  /*  273 */ "trigger_event",
  /*  274 */ "foreach_clause",
  /*  275 */ "when_clause",
  /*  276 */ "trigger_cmd",
  /*  277 */ "trnm",
  /*  278 */ "tridxby",
  /*  279 */ "database_kw_opt",
  /*  280 */ "key_opt",
  /*  281 */ "add_column_fullname",
  /*  282 */ "kwcolumn_opt",
  /*  283 */ "create_vtab",
  /*  284 */ "vtabarglist",
  /*  285 */ "vtabarg",
  /*  286 */ "vtabargtoken",
  /*  287 */ "lp",
  /*  288 */ "anylist",
  /*  289 */ "windowdefn_list",
  /*  290 */ "windowdefn",
  /*  291 */ "window",
  /*  292 */ "frame_opt",
  /*  293 */ "part_opt",
  /*  294 */ "filter_opt",
  /*  295 */ "range_or_rows",
  /*  296 */ "frame_bound",
  /*  297 */ "frame_bound_s",
  /*  298 */ "frame_bound_e",
  /*  299 */ "frame_exclude_opt",
  /*  300 */ "frame_exclude",
  /*  204 */ "scantok",
  /*  205 */ "ccons",
  /*  206 */ "term",
  /*  207 */ "expr",
  /*  208 */ "onconf",
  /*  209 */ "sortorder",
  /*  210 */ "autoinc",
  /*  211 */ "eidlist_opt",
  /*  212 */ "refargs",
  /*  213 */ "defer_subclause",
  /*  214 */ "refarg",
  /*  215 */ "refact",
  /*  216 */ "init_deferred_pred_opt",
  /*  217 */ "conslist",
  /*  218 */ "tconscomma",
  /*  219 */ "tcons",
  /*  220 */ "sortlist",
  /*  221 */ "eidlist",
  /*  222 */ "defer_subclause_opt",
  /*  223 */ "orconf",
  /*  224 */ "resolvetype",
  /*  225 */ "raisetype",
  /*  226 */ "ifexists",
  /*  227 */ "fullname",
  /*  228 */ "selectnowith",
  /*  229 */ "oneselect",
  /*  230 */ "wqlist",
  /*  231 */ "multiselect_op",
  /*  232 */ "distinct",
  /*  233 */ "selcollist",
  /*  234 */ "from",
  /*  235 */ "where_opt",
  /*  236 */ "groupby_opt",
  /*  237 */ "having_opt",
  /*  238 */ "orderby_opt",
  /*  239 */ "limit_opt",
  /*  240 */ "window_clause",
  /*  241 */ "values",
  /*  242 */ "nexprlist",
  /*  243 */ "sclp",
  /*  244 */ "as",
  /*  245 */ "seltablist",
  /*  246 */ "stl_prefix",
  /*  247 */ "joinop",
  /*  248 */ "indexed_opt",
  /*  249 */ "on_opt",
  /*  250 */ "using_opt",
  /*  251 */ "exprlist",
  /*  252 */ "xfullname",
  /*  253 */ "idlist",
  /*  254 */ "with",
  /*  255 */ "setlist",
  /*  256 */ "insert_cmd",
  /*  257 */ "idlist_opt",
  /*  258 */ "upsert",
  /*  259 */ "over_clause",
  /*  260 */ "likeop",
  /*  261 */ "between_op",
  /*  262 */ "in_op",
  /*  263 */ "paren_exprlist",
  /*  264 */ "case_operand",
  /*  265 */ "case_exprlist",
  /*  266 */ "case_else",
  /*  267 */ "uniqueflag",
  /*  268 */ "collate",
  /*  269 */ "vinto",
  /*  270 */ "nmnum",
  /*  271 */ "trigger_decl",
  /*  272 */ "trigger_cmd_list",
  /*  273 */ "trigger_time",
  /*  274 */ "trigger_event",
  /*  275 */ "foreach_clause",
  /*  276 */ "when_clause",
  /*  277 */ "trigger_cmd",
  /*  278 */ "trnm",
  /*  279 */ "tridxby",
  /*  280 */ "database_kw_opt",
  /*  281 */ "key_opt",
  /*  282 */ "add_column_fullname",
  /*  283 */ "kwcolumn_opt",
  /*  284 */ "create_vtab",
  /*  285 */ "vtabarglist",
  /*  286 */ "vtabarg",
  /*  287 */ "vtabargtoken",
  /*  288 */ "lp",
  /*  289 */ "anylist",
  /*  290 */ "windowdefn_list",
  /*  291 */ "windowdefn",
  /*  292 */ "window",
  /*  293 */ "frame_opt",
  /*  294 */ "part_opt",
  /*  295 */ "filter_opt",
  /*  296 */ "range_or_rows",
  /*  297 */ "frame_bound",
  /*  298 */ "frame_bound_s",
  /*  299 */ "frame_bound_e",
  /*  300 */ "frame_exclude_opt",
  /*  301 */ "frame_exclude",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */

#ifndef NDEBUG
/* For tracing reduce actions, the names of all rules are required.
*/
static const char *const yyRuleName[] = {
149610
149611
149612
149613
149614
149615
149616
149617
149618
149619
149620
149621
149622
149623
149624
149625
149626
149627
149628
149629














149630
149631
149632
149633
149634
149635
149636
149637








149638
149639
149640
149641
149642
149643
149644
149645
149646
149647
149648
149649
149650
149651
149652
149653
149654
149655
149656
149657
149658
149659
149660
149661
149662
149663
149664
149665
149666
149667
149668
149669
149670
149671
149672
149673
149674
149675
149676
149677
149678









































149679
149680
149681
149682
149683
149684
149685
149686
149687
149688
149689
149690
149691
149692
149693
149694
149695

















149696
149697
149698
149699
149700
149701
149702
149703
149704
149705
149706
149707
149708
149709
149710
149711
149712
149713
149714
149715
149716
149717
149718
149719
149720
149721
149722
149723
149724
149725
149726
149727
149728
149729
149730
149731
149732
149733
149734
149735
149736
149737
149738
149739
149740
149741
149742
149743
149744
149745
149746
149747
149748
149749






















































149750
149751
149752
149753
149754
149755
149756
149757
149758
149759
149760
149761
149762
149763
149764
149765
149766

















149767
149768
149769
149770
149771
149772
149773
149774
149775









149776
149777
149778
149779
149780
149781
149782
149783
149784
149785
149786
149787
149788
149789
149790
149791
149792
149793
149794
149795
149796
149797
149798
149799
149800
149801
149802
149803
149804
149805
149806
149807
149808
149809


































149810
149811
149812
149813
149814
149815
149816
149817
149818









149819
149820
149821
149822
149823
149824
149825
149826
149827
149828
149829











149830
149831
149832
149833
149834
149835
149836
149837
149838
149839
149840
149841
149842
149843
149844
149845
149846
149847
149848
149849
149850
149851
149852
149853
149854

























149855
149856
149857
149858
149859
149860
149861
149862
149863
149864
149865
149866
149867
149868
149869
149870
149871
149872
149873
149874
149875





















149876
149877
149878
149879
149880
149881
149882
149883
149884
149885
149886
149887
149888
149889
149890
149891
149892
149893
149894



















149895
149896
149897
149898
149899
149900
149901
149902
149903
149904
149905
149906
149907













149908
149909
149910
149911
149912
149913
149914
149915
149916
149917
149918











149919
149920
149921
149922
149923
149924
149925
149926
149927
149928
149929
149930
149931
149932
149933
149934
149935
149936
149937
149938
149939
149940
149941























149942
149943
149944
149945
149946
149947
149948
149949
149950
149951
149952
149953
149954
149955
149956
149957
149958
149959
149960
149961
149962





















149963
149964
149965
149966
149967
149968
149969
150185
150186
150187
150188
150189
150190
150191













150192
150193
150194
150195
150196
150197
150198
150199
150200
150201
150202
150203
150204
150205








150206
150207
150208
150209
150210
150211
150212
150213









































150214
150215
150216
150217
150218
150219
150220
150221
150222
150223
150224
150225
150226
150227
150228
150229
150230
150231
150232
150233
150234
150235
150236
150237
150238
150239
150240
150241
150242
150243
150244
150245
150246
150247
150248
150249
150250
150251
150252
150253
150254

















150255
150256
150257
150258
150259
150260
150261
150262
150263
150264
150265
150266
150267
150268
150269
150270
150271






















































150272
150273
150274
150275
150276
150277
150278
150279
150280
150281
150282
150283
150284
150285
150286
150287
150288
150289
150290
150291
150292
150293
150294
150295
150296
150297
150298
150299
150300
150301
150302
150303
150304
150305
150306
150307
150308
150309
150310
150311
150312
150313
150314
150315
150316
150317
150318
150319
150320
150321
150322
150323
150324
150325

















150326
150327
150328
150329
150330
150331
150332
150333
150334
150335
150336
150337
150338
150339
150340
150341
150342









150343
150344
150345
150346
150347
150348
150349
150350
150351


































150352
150353
150354
150355
150356
150357
150358
150359
150360
150361
150362
150363
150364
150365
150366
150367
150368
150369
150370
150371
150372
150373
150374
150375
150376
150377
150378
150379
150380
150381
150382
150383
150384
150385









150386
150387
150388
150389
150390
150391
150392
150393
150394











150395
150396
150397
150398
150399
150400
150401
150402
150403
150404
150405

























150406
150407
150408
150409
150410
150411
150412
150413
150414
150415
150416
150417
150418
150419
150420
150421
150422
150423
150424
150425
150426
150427
150428
150429
150430





















150431
150432
150433
150434
150435
150436
150437
150438
150439
150440
150441
150442
150443
150444
150445
150446
150447
150448
150449
150450
150451



















150452
150453
150454
150455
150456
150457
150458
150459
150460
150461
150462
150463
150464
150465
150466
150467
150468
150469
150470













150471
150472
150473
150474
150475
150476
150477
150478
150479
150480
150481
150482
150483











150484
150485
150486
150487
150488
150489
150490
150491
150492
150493
150494























150495
150496
150497
150498
150499
150500
150501
150502
150503
150504
150505
150506
150507
150508
150509
150510
150511
150512
150513
150514
150515
150516
150517





















150518
150519
150520
150521
150522
150523
150524
150525
150526
150527
150528
150529
150530
150531
150532
150533
150534
150535
150536
150537
150538
150539
150540
150541
150542
150543
150544
150545







-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







 /*  22 */ "table_options ::= WITHOUT nm",
 /*  23 */ "columnname ::= nm typetoken",
 /*  24 */ "typetoken ::=",
 /*  25 */ "typetoken ::= typename LP signed RP",
 /*  26 */ "typetoken ::= typename LP signed COMMA signed RP",
 /*  27 */ "typename ::= typename ID|STRING",
 /*  28 */ "scanpt ::=",
 /*  29 */ "ccons ::= CONSTRAINT nm",
 /*  30 */ "ccons ::= DEFAULT scanpt term scanpt",
 /*  31 */ "ccons ::= DEFAULT LP expr RP",
 /*  32 */ "ccons ::= DEFAULT PLUS term scanpt",
 /*  33 */ "ccons ::= DEFAULT MINUS term scanpt",
 /*  34 */ "ccons ::= DEFAULT scanpt ID|INDEXED",
 /*  35 */ "ccons ::= NOT NULL onconf",
 /*  36 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
 /*  37 */ "ccons ::= UNIQUE onconf",
 /*  38 */ "ccons ::= CHECK LP expr RP",
 /*  39 */ "ccons ::= REFERENCES nm eidlist_opt refargs",
 /*  40 */ "ccons ::= defer_subclause",
 /*  41 */ "ccons ::= COLLATE ID|STRING",
 /*  29 */ "scantok ::=",
 /*  30 */ "ccons ::= CONSTRAINT nm",
 /*  31 */ "ccons ::= DEFAULT scantok term",
 /*  32 */ "ccons ::= DEFAULT LP expr RP",
 /*  33 */ "ccons ::= DEFAULT PLUS scantok term",
 /*  34 */ "ccons ::= DEFAULT MINUS scantok term",
 /*  35 */ "ccons ::= DEFAULT scantok ID|INDEXED",
 /*  36 */ "ccons ::= NOT NULL onconf",
 /*  37 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
 /*  38 */ "ccons ::= UNIQUE onconf",
 /*  39 */ "ccons ::= CHECK LP expr RP",
 /*  40 */ "ccons ::= REFERENCES nm eidlist_opt refargs",
 /*  41 */ "ccons ::= defer_subclause",
 /*  42 */ "ccons ::= COLLATE ID|STRING",
 /*  42 */ "autoinc ::=",
 /*  43 */ "autoinc ::= AUTOINCR",
 /*  44 */ "refargs ::=",
 /*  45 */ "refargs ::= refargs refarg",
 /*  46 */ "refarg ::= MATCH nm",
 /*  47 */ "refarg ::= ON INSERT refact",
 /*  48 */ "refarg ::= ON DELETE refact",
 /*  49 */ "refarg ::= ON UPDATE refact",
 /*  43 */ "autoinc ::=",
 /*  44 */ "autoinc ::= AUTOINCR",
 /*  45 */ "refargs ::=",
 /*  46 */ "refargs ::= refargs refarg",
 /*  47 */ "refarg ::= MATCH nm",
 /*  48 */ "refarg ::= ON INSERT refact",
 /*  49 */ "refarg ::= ON DELETE refact",
 /*  50 */ "refarg ::= ON UPDATE refact",
 /*  50 */ "refact ::= SET NULL",
 /*  51 */ "refact ::= SET DEFAULT",
 /*  52 */ "refact ::= CASCADE",
 /*  53 */ "refact ::= RESTRICT",
 /*  54 */ "refact ::= NO ACTION",
 /*  55 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
 /*  56 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
 /*  57 */ "init_deferred_pred_opt ::=",
 /*  58 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
 /*  59 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
 /*  60 */ "conslist_opt ::=",
 /*  61 */ "tconscomma ::= COMMA",
 /*  62 */ "tcons ::= CONSTRAINT nm",
 /*  63 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf",
 /*  64 */ "tcons ::= UNIQUE LP sortlist RP onconf",
 /*  65 */ "tcons ::= CHECK LP expr RP onconf",
 /*  66 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt",
 /*  67 */ "defer_subclause_opt ::=",
 /*  68 */ "onconf ::=",
 /*  69 */ "onconf ::= ON CONFLICT resolvetype",
 /*  70 */ "orconf ::=",
 /*  71 */ "orconf ::= OR resolvetype",
 /*  72 */ "resolvetype ::= IGNORE",
 /*  73 */ "resolvetype ::= REPLACE",
 /*  74 */ "cmd ::= DROP TABLE ifexists fullname",
 /*  75 */ "ifexists ::= IF EXISTS",
 /*  76 */ "ifexists ::=",
 /*  77 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select",
 /*  78 */ "cmd ::= DROP VIEW ifexists fullname",
 /*  79 */ "cmd ::= select",
 /*  80 */ "select ::= WITH wqlist selectnowith",
 /*  81 */ "select ::= WITH RECURSIVE wqlist selectnowith",
 /*  82 */ "select ::= selectnowith",
 /*  83 */ "selectnowith ::= selectnowith multiselect_op oneselect",
 /*  84 */ "multiselect_op ::= UNION",
 /*  85 */ "multiselect_op ::= UNION ALL",
 /*  86 */ "multiselect_op ::= EXCEPT|INTERSECT",
 /*  87 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
 /*  88 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt",
 /*  89 */ "values ::= VALUES LP nexprlist RP",
 /*  90 */ "values ::= values COMMA LP nexprlist RP",
 /*  51 */ "refact ::= SET NULL",
 /*  52 */ "refact ::= SET DEFAULT",
 /*  53 */ "refact ::= CASCADE",
 /*  54 */ "refact ::= RESTRICT",
 /*  55 */ "refact ::= NO ACTION",
 /*  56 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
 /*  57 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
 /*  58 */ "init_deferred_pred_opt ::=",
 /*  59 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
 /*  60 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
 /*  61 */ "conslist_opt ::=",
 /*  62 */ "tconscomma ::= COMMA",
 /*  63 */ "tcons ::= CONSTRAINT nm",
 /*  64 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf",
 /*  65 */ "tcons ::= UNIQUE LP sortlist RP onconf",
 /*  66 */ "tcons ::= CHECK LP expr RP onconf",
 /*  67 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt",
 /*  68 */ "defer_subclause_opt ::=",
 /*  69 */ "onconf ::=",
 /*  70 */ "onconf ::= ON CONFLICT resolvetype",
 /*  71 */ "orconf ::=",
 /*  72 */ "orconf ::= OR resolvetype",
 /*  73 */ "resolvetype ::= IGNORE",
 /*  74 */ "resolvetype ::= REPLACE",
 /*  75 */ "cmd ::= DROP TABLE ifexists fullname",
 /*  76 */ "ifexists ::= IF EXISTS",
 /*  77 */ "ifexists ::=",
 /*  78 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select",
 /*  79 */ "cmd ::= DROP VIEW ifexists fullname",
 /*  80 */ "cmd ::= select",
 /*  81 */ "select ::= WITH wqlist selectnowith",
 /*  82 */ "select ::= WITH RECURSIVE wqlist selectnowith",
 /*  83 */ "select ::= selectnowith",
 /*  84 */ "selectnowith ::= selectnowith multiselect_op oneselect",
 /*  85 */ "multiselect_op ::= UNION",
 /*  86 */ "multiselect_op ::= UNION ALL",
 /*  87 */ "multiselect_op ::= EXCEPT|INTERSECT",
 /*  88 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
 /*  89 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt",
 /*  90 */ "values ::= VALUES LP nexprlist RP",
 /*  91 */ "values ::= values COMMA LP nexprlist RP",
 /*  91 */ "distinct ::= DISTINCT",
 /*  92 */ "distinct ::= ALL",
 /*  93 */ "distinct ::=",
 /*  94 */ "sclp ::=",
 /*  95 */ "selcollist ::= sclp scanpt expr scanpt as",
 /*  96 */ "selcollist ::= sclp scanpt STAR",
 /*  97 */ "selcollist ::= sclp scanpt nm DOT STAR",
 /*  98 */ "as ::= AS nm",
 /*  99 */ "as ::=",
 /* 100 */ "from ::=",
 /* 101 */ "from ::= FROM seltablist",
 /* 102 */ "stl_prefix ::= seltablist joinop",
 /* 103 */ "stl_prefix ::=",
 /* 104 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
 /* 105 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
 /* 106 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
 /* 107 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
 /*  92 */ "distinct ::= DISTINCT",
 /*  93 */ "distinct ::= ALL",
 /*  94 */ "distinct ::=",
 /*  95 */ "sclp ::=",
 /*  96 */ "selcollist ::= sclp scanpt expr scanpt as",
 /*  97 */ "selcollist ::= sclp scanpt STAR",
 /*  98 */ "selcollist ::= sclp scanpt nm DOT STAR",
 /*  99 */ "as ::= AS nm",
 /* 100 */ "as ::=",
 /* 101 */ "from ::=",
 /* 102 */ "from ::= FROM seltablist",
 /* 103 */ "stl_prefix ::= seltablist joinop",
 /* 104 */ "stl_prefix ::=",
 /* 105 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
 /* 106 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
 /* 107 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
 /* 108 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
 /* 108 */ "dbnm ::=",
 /* 109 */ "dbnm ::= DOT nm",
 /* 110 */ "fullname ::= nm",
 /* 111 */ "fullname ::= nm DOT nm",
 /* 112 */ "xfullname ::= nm",
 /* 113 */ "xfullname ::= nm DOT nm",
 /* 114 */ "xfullname ::= nm DOT nm AS nm",
 /* 115 */ "xfullname ::= nm AS nm",
 /* 116 */ "joinop ::= COMMA|JOIN",
 /* 117 */ "joinop ::= JOIN_KW JOIN",
 /* 118 */ "joinop ::= JOIN_KW nm JOIN",
 /* 119 */ "joinop ::= JOIN_KW nm nm JOIN",
 /* 120 */ "on_opt ::= ON expr",
 /* 121 */ "on_opt ::=",
 /* 122 */ "indexed_opt ::=",
 /* 123 */ "indexed_opt ::= INDEXED BY nm",
 /* 124 */ "indexed_opt ::= NOT INDEXED",
 /* 125 */ "using_opt ::= USING LP idlist RP",
 /* 126 */ "using_opt ::=",
 /* 127 */ "orderby_opt ::=",
 /* 128 */ "orderby_opt ::= ORDER BY sortlist",
 /* 129 */ "sortlist ::= sortlist COMMA expr sortorder",
 /* 130 */ "sortlist ::= expr sortorder",
 /* 131 */ "sortorder ::= ASC",
 /* 132 */ "sortorder ::= DESC",
 /* 133 */ "sortorder ::=",
 /* 134 */ "groupby_opt ::=",
 /* 135 */ "groupby_opt ::= GROUP BY nexprlist",
 /* 136 */ "having_opt ::=",
 /* 137 */ "having_opt ::= HAVING expr",
 /* 138 */ "limit_opt ::=",
 /* 139 */ "limit_opt ::= LIMIT expr",
 /* 140 */ "limit_opt ::= LIMIT expr OFFSET expr",
 /* 141 */ "limit_opt ::= LIMIT expr COMMA expr",
 /* 142 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
 /* 143 */ "where_opt ::=",
 /* 144 */ "where_opt ::= WHERE expr",
 /* 145 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
 /* 146 */ "setlist ::= setlist COMMA nm EQ expr",
 /* 147 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
 /* 148 */ "setlist ::= nm EQ expr",
 /* 149 */ "setlist ::= LP idlist RP EQ expr",
 /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
 /* 151 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
 /* 152 */ "upsert ::=",
 /* 153 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
 /* 154 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
 /* 155 */ "upsert ::= ON CONFLICT DO NOTHING",
 /* 156 */ "insert_cmd ::= INSERT orconf",
 /* 157 */ "insert_cmd ::= REPLACE",
 /* 158 */ "idlist_opt ::=",
 /* 159 */ "idlist_opt ::= LP idlist RP",
 /* 160 */ "idlist ::= idlist COMMA nm",
 /* 161 */ "idlist ::= nm",
 /* 109 */ "dbnm ::=",
 /* 110 */ "dbnm ::= DOT nm",
 /* 111 */ "fullname ::= nm",
 /* 112 */ "fullname ::= nm DOT nm",
 /* 113 */ "xfullname ::= nm",
 /* 114 */ "xfullname ::= nm DOT nm",
 /* 115 */ "xfullname ::= nm DOT nm AS nm",
 /* 116 */ "xfullname ::= nm AS nm",
 /* 117 */ "joinop ::= COMMA|JOIN",
 /* 118 */ "joinop ::= JOIN_KW JOIN",
 /* 119 */ "joinop ::= JOIN_KW nm JOIN",
 /* 120 */ "joinop ::= JOIN_KW nm nm JOIN",
 /* 121 */ "on_opt ::= ON expr",
 /* 122 */ "on_opt ::=",
 /* 123 */ "indexed_opt ::=",
 /* 124 */ "indexed_opt ::= INDEXED BY nm",
 /* 125 */ "indexed_opt ::= NOT INDEXED",
 /* 126 */ "using_opt ::= USING LP idlist RP",
 /* 127 */ "using_opt ::=",
 /* 128 */ "orderby_opt ::=",
 /* 129 */ "orderby_opt ::= ORDER BY sortlist",
 /* 130 */ "sortlist ::= sortlist COMMA expr sortorder",
 /* 131 */ "sortlist ::= expr sortorder",
 /* 132 */ "sortorder ::= ASC",
 /* 133 */ "sortorder ::= DESC",
 /* 134 */ "sortorder ::=",
 /* 135 */ "groupby_opt ::=",
 /* 136 */ "groupby_opt ::= GROUP BY nexprlist",
 /* 137 */ "having_opt ::=",
 /* 138 */ "having_opt ::= HAVING expr",
 /* 139 */ "limit_opt ::=",
 /* 140 */ "limit_opt ::= LIMIT expr",
 /* 141 */ "limit_opt ::= LIMIT expr OFFSET expr",
 /* 142 */ "limit_opt ::= LIMIT expr COMMA expr",
 /* 143 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
 /* 144 */ "where_opt ::=",
 /* 145 */ "where_opt ::= WHERE expr",
 /* 146 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
 /* 147 */ "setlist ::= setlist COMMA nm EQ expr",
 /* 148 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
 /* 149 */ "setlist ::= nm EQ expr",
 /* 150 */ "setlist ::= LP idlist RP EQ expr",
 /* 151 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
 /* 152 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
 /* 153 */ "upsert ::=",
 /* 154 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
 /* 155 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
 /* 156 */ "upsert ::= ON CONFLICT DO NOTHING",
 /* 157 */ "insert_cmd ::= INSERT orconf",
 /* 158 */ "insert_cmd ::= REPLACE",
 /* 159 */ "idlist_opt ::=",
 /* 160 */ "idlist_opt ::= LP idlist RP",
 /* 161 */ "idlist ::= idlist COMMA nm",
 /* 162 */ "idlist ::= nm",
 /* 162 */ "expr ::= LP expr RP",
 /* 163 */ "expr ::= ID|INDEXED",
 /* 164 */ "expr ::= JOIN_KW",
 /* 165 */ "expr ::= nm DOT nm",
 /* 166 */ "expr ::= nm DOT nm DOT nm",
 /* 167 */ "term ::= NULL|FLOAT|BLOB",
 /* 168 */ "term ::= STRING",
 /* 169 */ "term ::= INTEGER",
 /* 170 */ "expr ::= VARIABLE",
 /* 171 */ "expr ::= expr COLLATE ID|STRING",
 /* 172 */ "expr ::= CAST LP expr AS typetoken RP",
 /* 173 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
 /* 174 */ "expr ::= ID|INDEXED LP STAR RP",
 /* 175 */ "expr ::= ID|INDEXED LP distinct exprlist RP over_clause",
 /* 176 */ "expr ::= ID|INDEXED LP STAR RP over_clause",
 /* 177 */ "term ::= CTIME_KW",
 /* 178 */ "expr ::= LP nexprlist COMMA expr RP",
 /* 163 */ "expr ::= LP expr RP",
 /* 164 */ "expr ::= ID|INDEXED",
 /* 165 */ "expr ::= JOIN_KW",
 /* 166 */ "expr ::= nm DOT nm",
 /* 167 */ "expr ::= nm DOT nm DOT nm",
 /* 168 */ "term ::= NULL|FLOAT|BLOB",
 /* 169 */ "term ::= STRING",
 /* 170 */ "term ::= INTEGER",
 /* 171 */ "expr ::= VARIABLE",
 /* 172 */ "expr ::= expr COLLATE ID|STRING",
 /* 173 */ "expr ::= CAST LP expr AS typetoken RP",
 /* 174 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
 /* 175 */ "expr ::= ID|INDEXED LP STAR RP",
 /* 176 */ "expr ::= ID|INDEXED LP distinct exprlist RP over_clause",
 /* 177 */ "expr ::= ID|INDEXED LP STAR RP over_clause",
 /* 178 */ "term ::= CTIME_KW",
 /* 179 */ "expr ::= LP nexprlist COMMA expr RP",
 /* 179 */ "expr ::= expr AND expr",
 /* 180 */ "expr ::= expr OR expr",
 /* 181 */ "expr ::= expr LT|GT|GE|LE expr",
 /* 182 */ "expr ::= expr EQ|NE expr",
 /* 183 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
 /* 184 */ "expr ::= expr PLUS|MINUS expr",
 /* 185 */ "expr ::= expr STAR|SLASH|REM expr",
 /* 186 */ "expr ::= expr CONCAT expr",
 /* 187 */ "likeop ::= NOT LIKE_KW|MATCH",
 /* 180 */ "expr ::= expr AND expr",
 /* 181 */ "expr ::= expr OR expr",
 /* 182 */ "expr ::= expr LT|GT|GE|LE expr",
 /* 183 */ "expr ::= expr EQ|NE expr",
 /* 184 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
 /* 185 */ "expr ::= expr PLUS|MINUS expr",
 /* 186 */ "expr ::= expr STAR|SLASH|REM expr",
 /* 187 */ "expr ::= expr CONCAT expr",
 /* 188 */ "likeop ::= NOT LIKE_KW|MATCH",
 /* 188 */ "expr ::= expr likeop expr",
 /* 189 */ "expr ::= expr likeop expr ESCAPE expr",
 /* 190 */ "expr ::= expr ISNULL|NOTNULL",
 /* 191 */ "expr ::= expr NOT NULL",
 /* 192 */ "expr ::= expr IS expr",
 /* 193 */ "expr ::= expr IS NOT expr",
 /* 194 */ "expr ::= NOT expr",
 /* 195 */ "expr ::= BITNOT expr",
 /* 196 */ "expr ::= PLUS|MINUS expr",
 /* 197 */ "between_op ::= BETWEEN",
 /* 198 */ "between_op ::= NOT BETWEEN",
 /* 199 */ "expr ::= expr between_op expr AND expr",
 /* 200 */ "in_op ::= IN",
 /* 201 */ "in_op ::= NOT IN",
 /* 202 */ "expr ::= expr in_op LP exprlist RP",
 /* 203 */ "expr ::= LP select RP",
 /* 204 */ "expr ::= expr in_op LP select RP",
 /* 205 */ "expr ::= expr in_op nm dbnm paren_exprlist",
 /* 206 */ "expr ::= EXISTS LP select RP",
 /* 207 */ "expr ::= CASE case_operand case_exprlist case_else END",
 /* 208 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
 /* 209 */ "case_exprlist ::= WHEN expr THEN expr",
 /* 210 */ "case_else ::= ELSE expr",
 /* 211 */ "case_else ::=",
 /* 212 */ "case_operand ::= expr",
 /* 213 */ "case_operand ::=",
 /* 214 */ "exprlist ::=",
 /* 215 */ "nexprlist ::= nexprlist COMMA expr",
 /* 216 */ "nexprlist ::= expr",
 /* 217 */ "paren_exprlist ::=",
 /* 218 */ "paren_exprlist ::= LP exprlist RP",
 /* 219 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
 /* 220 */ "uniqueflag ::= UNIQUE",
 /* 221 */ "uniqueflag ::=",
 /* 189 */ "expr ::= expr likeop expr",
 /* 190 */ "expr ::= expr likeop expr ESCAPE expr",
 /* 191 */ "expr ::= expr ISNULL|NOTNULL",
 /* 192 */ "expr ::= expr NOT NULL",
 /* 193 */ "expr ::= expr IS expr",
 /* 194 */ "expr ::= expr IS NOT expr",
 /* 195 */ "expr ::= NOT expr",
 /* 196 */ "expr ::= BITNOT expr",
 /* 197 */ "expr ::= PLUS|MINUS expr",
 /* 198 */ "between_op ::= BETWEEN",
 /* 199 */ "between_op ::= NOT BETWEEN",
 /* 200 */ "expr ::= expr between_op expr AND expr",
 /* 201 */ "in_op ::= IN",
 /* 202 */ "in_op ::= NOT IN",
 /* 203 */ "expr ::= expr in_op LP exprlist RP",
 /* 204 */ "expr ::= LP select RP",
 /* 205 */ "expr ::= expr in_op LP select RP",
 /* 206 */ "expr ::= expr in_op nm dbnm paren_exprlist",
 /* 207 */ "expr ::= EXISTS LP select RP",
 /* 208 */ "expr ::= CASE case_operand case_exprlist case_else END",
 /* 209 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
 /* 210 */ "case_exprlist ::= WHEN expr THEN expr",
 /* 211 */ "case_else ::= ELSE expr",
 /* 212 */ "case_else ::=",
 /* 213 */ "case_operand ::= expr",
 /* 214 */ "case_operand ::=",
 /* 215 */ "exprlist ::=",
 /* 216 */ "nexprlist ::= nexprlist COMMA expr",
 /* 217 */ "nexprlist ::= expr",
 /* 218 */ "paren_exprlist ::=",
 /* 219 */ "paren_exprlist ::= LP exprlist RP",
 /* 220 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
 /* 221 */ "uniqueflag ::= UNIQUE",
 /* 222 */ "uniqueflag ::=",
 /* 222 */ "eidlist_opt ::=",
 /* 223 */ "eidlist_opt ::= LP eidlist RP",
 /* 224 */ "eidlist ::= eidlist COMMA nm collate sortorder",
 /* 225 */ "eidlist ::= nm collate sortorder",
 /* 226 */ "collate ::=",
 /* 227 */ "collate ::= COLLATE ID|STRING",
 /* 228 */ "cmd ::= DROP INDEX ifexists fullname",
 /* 229 */ "cmd ::= VACUUM vinto",
 /* 230 */ "cmd ::= VACUUM nm vinto",
 /* 223 */ "eidlist_opt ::=",
 /* 224 */ "eidlist_opt ::= LP eidlist RP",
 /* 225 */ "eidlist ::= eidlist COMMA nm collate sortorder",
 /* 226 */ "eidlist ::= nm collate sortorder",
 /* 227 */ "collate ::=",
 /* 228 */ "collate ::= COLLATE ID|STRING",
 /* 229 */ "cmd ::= DROP INDEX ifexists fullname",
 /* 230 */ "cmd ::= VACUUM vinto",
 /* 231 */ "cmd ::= VACUUM nm vinto",
 /* 231 */ "vinto ::= INTO expr",
 /* 232 */ "vinto ::=",
 /* 233 */ "cmd ::= PRAGMA nm dbnm",
 /* 234 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
 /* 235 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
 /* 236 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
 /* 237 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
 /* 238 */ "plus_num ::= PLUS INTEGER|FLOAT",
 /* 239 */ "minus_num ::= MINUS INTEGER|FLOAT",
 /* 240 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
 /* 241 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
 /* 232 */ "vinto ::= INTO expr",
 /* 233 */ "vinto ::=",
 /* 234 */ "cmd ::= PRAGMA nm dbnm",
 /* 235 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
 /* 236 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
 /* 237 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
 /* 238 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
 /* 239 */ "plus_num ::= PLUS INTEGER|FLOAT",
 /* 240 */ "minus_num ::= MINUS INTEGER|FLOAT",
 /* 241 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
 /* 242 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
 /* 242 */ "trigger_time ::= BEFORE|AFTER",
 /* 243 */ "trigger_time ::= INSTEAD OF",
 /* 244 */ "trigger_time ::=",
 /* 245 */ "trigger_event ::= DELETE|INSERT",
 /* 246 */ "trigger_event ::= UPDATE",
 /* 247 */ "trigger_event ::= UPDATE OF idlist",
 /* 248 */ "when_clause ::=",
 /* 249 */ "when_clause ::= WHEN expr",
 /* 250 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
 /* 251 */ "trigger_cmd_list ::= trigger_cmd SEMI",
 /* 252 */ "trnm ::= nm DOT nm",
 /* 253 */ "tridxby ::= INDEXED BY nm",
 /* 254 */ "tridxby ::= NOT INDEXED",
 /* 255 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
 /* 256 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
 /* 257 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
 /* 258 */ "trigger_cmd ::= scanpt select scanpt",
 /* 259 */ "expr ::= RAISE LP IGNORE RP",
 /* 260 */ "expr ::= RAISE LP raisetype COMMA nm RP",
 /* 261 */ "raisetype ::= ROLLBACK",
 /* 262 */ "raisetype ::= ABORT",
 /* 263 */ "raisetype ::= FAIL",
 /* 264 */ "cmd ::= DROP TRIGGER ifexists fullname",
 /* 265 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
 /* 266 */ "cmd ::= DETACH database_kw_opt expr",
 /* 243 */ "trigger_time ::= BEFORE|AFTER",
 /* 244 */ "trigger_time ::= INSTEAD OF",
 /* 245 */ "trigger_time ::=",
 /* 246 */ "trigger_event ::= DELETE|INSERT",
 /* 247 */ "trigger_event ::= UPDATE",
 /* 248 */ "trigger_event ::= UPDATE OF idlist",
 /* 249 */ "when_clause ::=",
 /* 250 */ "when_clause ::= WHEN expr",
 /* 251 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
 /* 252 */ "trigger_cmd_list ::= trigger_cmd SEMI",
 /* 253 */ "trnm ::= nm DOT nm",
 /* 254 */ "tridxby ::= INDEXED BY nm",
 /* 255 */ "tridxby ::= NOT INDEXED",
 /* 256 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
 /* 257 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
 /* 258 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
 /* 259 */ "trigger_cmd ::= scanpt select scanpt",
 /* 260 */ "expr ::= RAISE LP IGNORE RP",
 /* 261 */ "expr ::= RAISE LP raisetype COMMA nm RP",
 /* 262 */ "raisetype ::= ROLLBACK",
 /* 263 */ "raisetype ::= ABORT",
 /* 264 */ "raisetype ::= FAIL",
 /* 265 */ "cmd ::= DROP TRIGGER ifexists fullname",
 /* 266 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
 /* 267 */ "cmd ::= DETACH database_kw_opt expr",
 /* 267 */ "key_opt ::=",
 /* 268 */ "key_opt ::= KEY expr",
 /* 269 */ "cmd ::= REINDEX",
 /* 270 */ "cmd ::= REINDEX nm dbnm",
 /* 271 */ "cmd ::= ANALYZE",
 /* 272 */ "cmd ::= ANALYZE nm dbnm",
 /* 273 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
 /* 274 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
 /* 275 */ "add_column_fullname ::= fullname",
 /* 276 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
 /* 277 */ "cmd ::= create_vtab",
 /* 278 */ "cmd ::= create_vtab LP vtabarglist RP",
 /* 279 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
 /* 280 */ "vtabarg ::=",
 /* 281 */ "vtabargtoken ::= ANY",
 /* 282 */ "vtabargtoken ::= lp anylist RP",
 /* 283 */ "lp ::= LP",
 /* 284 */ "with ::= WITH wqlist",
 /* 285 */ "with ::= WITH RECURSIVE wqlist",
 /* 286 */ "wqlist ::= nm eidlist_opt AS LP select RP",
 /* 287 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
 /* 268 */ "key_opt ::=",
 /* 269 */ "key_opt ::= KEY expr",
 /* 270 */ "cmd ::= REINDEX",
 /* 271 */ "cmd ::= REINDEX nm dbnm",
 /* 272 */ "cmd ::= ANALYZE",
 /* 273 */ "cmd ::= ANALYZE nm dbnm",
 /* 274 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
 /* 275 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
 /* 276 */ "add_column_fullname ::= fullname",
 /* 277 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
 /* 278 */ "cmd ::= create_vtab",
 /* 279 */ "cmd ::= create_vtab LP vtabarglist RP",
 /* 280 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
 /* 281 */ "vtabarg ::=",
 /* 282 */ "vtabargtoken ::= ANY",
 /* 283 */ "vtabargtoken ::= lp anylist RP",
 /* 284 */ "lp ::= LP",
 /* 285 */ "with ::= WITH wqlist",
 /* 286 */ "with ::= WITH RECURSIVE wqlist",
 /* 287 */ "wqlist ::= nm eidlist_opt AS LP select RP",
 /* 288 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
 /* 288 */ "windowdefn_list ::= windowdefn",
 /* 289 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
 /* 290 */ "windowdefn ::= nm AS LP window RP",
 /* 291 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
 /* 292 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
 /* 293 */ "window ::= ORDER BY sortlist frame_opt",
 /* 294 */ "window ::= nm ORDER BY sortlist frame_opt",
 /* 295 */ "window ::= frame_opt",
 /* 296 */ "window ::= nm frame_opt",
 /* 297 */ "frame_opt ::=",
 /* 298 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
 /* 299 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
 /* 300 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
 /* 301 */ "frame_bound_s ::= frame_bound",
 /* 302 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
 /* 303 */ "frame_bound_e ::= frame_bound",
 /* 304 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
 /* 305 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
 /* 306 */ "frame_bound ::= CURRENT ROW",
 /* 289 */ "windowdefn_list ::= windowdefn",
 /* 290 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
 /* 291 */ "windowdefn ::= nm AS LP window RP",
 /* 292 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
 /* 293 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
 /* 294 */ "window ::= ORDER BY sortlist frame_opt",
 /* 295 */ "window ::= nm ORDER BY sortlist frame_opt",
 /* 296 */ "window ::= frame_opt",
 /* 297 */ "window ::= nm frame_opt",
 /* 298 */ "frame_opt ::=",
 /* 299 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
 /* 300 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
 /* 301 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
 /* 302 */ "frame_bound_s ::= frame_bound",
 /* 303 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
 /* 304 */ "frame_bound_e ::= frame_bound",
 /* 305 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
 /* 306 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
 /* 307 */ "frame_bound ::= CURRENT ROW",
 /* 307 */ "frame_exclude_opt ::=",
 /* 308 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
 /* 309 */ "frame_exclude ::= NO OTHERS",
 /* 310 */ "frame_exclude ::= CURRENT ROW",
 /* 311 */ "frame_exclude ::= GROUP|TIES",
 /* 312 */ "window_clause ::= WINDOW windowdefn_list",
 /* 313 */ "over_clause ::= filter_opt OVER LP window RP",
 /* 314 */ "over_clause ::= filter_opt OVER nm",
 /* 315 */ "filter_opt ::=",
 /* 316 */ "filter_opt ::= FILTER LP WHERE expr RP",
 /* 317 */ "input ::= cmdlist",
 /* 318 */ "cmdlist ::= cmdlist ecmd",
 /* 319 */ "cmdlist ::= ecmd",
 /* 308 */ "frame_exclude_opt ::=",
 /* 309 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
 /* 310 */ "frame_exclude ::= NO OTHERS",
 /* 311 */ "frame_exclude ::= CURRENT ROW",
 /* 312 */ "frame_exclude ::= GROUP|TIES",
 /* 313 */ "window_clause ::= WINDOW windowdefn_list",
 /* 314 */ "over_clause ::= filter_opt OVER LP window RP",
 /* 315 */ "over_clause ::= filter_opt OVER nm",
 /* 316 */ "filter_opt ::=",
 /* 317 */ "filter_opt ::= FILTER LP WHERE expr RP",
 /* 318 */ "input ::= cmdlist",
 /* 319 */ "cmdlist ::= cmdlist ecmd",
 /* 320 */ "cmdlist ::= ecmd",
 /* 320 */ "ecmd ::= SEMI",
 /* 321 */ "ecmd ::= cmdx SEMI",
 /* 322 */ "ecmd ::= explain cmdx",
 /* 323 */ "trans_opt ::=",
 /* 324 */ "trans_opt ::= TRANSACTION",
 /* 325 */ "trans_opt ::= TRANSACTION nm",
 /* 326 */ "savepoint_opt ::= SAVEPOINT",
 /* 327 */ "savepoint_opt ::=",
 /* 328 */ "cmd ::= create_table create_table_args",
 /* 329 */ "columnlist ::= columnlist COMMA columnname carglist",
 /* 330 */ "columnlist ::= columnname carglist",
 /* 321 */ "ecmd ::= SEMI",
 /* 322 */ "ecmd ::= cmdx SEMI",
 /* 323 */ "ecmd ::= explain cmdx",
 /* 324 */ "trans_opt ::=",
 /* 325 */ "trans_opt ::= TRANSACTION",
 /* 326 */ "trans_opt ::= TRANSACTION nm",
 /* 327 */ "savepoint_opt ::= SAVEPOINT",
 /* 328 */ "savepoint_opt ::=",
 /* 329 */ "cmd ::= create_table create_table_args",
 /* 330 */ "columnlist ::= columnlist COMMA columnname carglist",
 /* 331 */ "columnlist ::= columnname carglist",
 /* 331 */ "nm ::= ID|INDEXED",
 /* 332 */ "nm ::= STRING",
 /* 333 */ "nm ::= JOIN_KW",
 /* 334 */ "typetoken ::= typename",
 /* 335 */ "typename ::= ID|STRING",
 /* 336 */ "signed ::= plus_num",
 /* 337 */ "signed ::= minus_num",
 /* 338 */ "carglist ::= carglist ccons",
 /* 339 */ "carglist ::=",
 /* 340 */ "ccons ::= NULL onconf",
 /* 341 */ "conslist_opt ::= COMMA conslist",
 /* 342 */ "conslist ::= conslist tconscomma tcons",
 /* 343 */ "conslist ::= tcons",
 /* 344 */ "tconscomma ::=",
 /* 345 */ "defer_subclause_opt ::= defer_subclause",
 /* 346 */ "resolvetype ::= raisetype",
 /* 347 */ "selectnowith ::= oneselect",
 /* 348 */ "oneselect ::= values",
 /* 349 */ "sclp ::= selcollist COMMA",
 /* 350 */ "as ::= ID|STRING",
 /* 351 */ "expr ::= term",
 /* 352 */ "likeop ::= LIKE_KW|MATCH",
 /* 353 */ "exprlist ::= nexprlist",
 /* 332 */ "nm ::= ID|INDEXED",
 /* 333 */ "nm ::= STRING",
 /* 334 */ "nm ::= JOIN_KW",
 /* 335 */ "typetoken ::= typename",
 /* 336 */ "typename ::= ID|STRING",
 /* 337 */ "signed ::= plus_num",
 /* 338 */ "signed ::= minus_num",
 /* 339 */ "carglist ::= carglist ccons",
 /* 340 */ "carglist ::=",
 /* 341 */ "ccons ::= NULL onconf",
 /* 342 */ "conslist_opt ::= COMMA conslist",
 /* 343 */ "conslist ::= conslist tconscomma tcons",
 /* 344 */ "conslist ::= tcons",
 /* 345 */ "tconscomma ::=",
 /* 346 */ "defer_subclause_opt ::= defer_subclause",
 /* 347 */ "resolvetype ::= raisetype",
 /* 348 */ "selectnowith ::= oneselect",
 /* 349 */ "oneselect ::= values",
 /* 350 */ "sclp ::= selcollist COMMA",
 /* 351 */ "as ::= ID|STRING",
 /* 352 */ "expr ::= term",
 /* 353 */ "likeop ::= LIKE_KW|MATCH",
 /* 354 */ "exprlist ::= nexprlist",
 /* 354 */ "nmnum ::= plus_num",
 /* 355 */ "nmnum ::= nm",
 /* 356 */ "nmnum ::= ON",
 /* 357 */ "nmnum ::= DELETE",
 /* 358 */ "nmnum ::= DEFAULT",
 /* 359 */ "plus_num ::= INTEGER|FLOAT",
 /* 360 */ "foreach_clause ::=",
 /* 361 */ "foreach_clause ::= FOR EACH ROW",
 /* 362 */ "trnm ::= nm",
 /* 363 */ "tridxby ::=",
 /* 364 */ "database_kw_opt ::= DATABASE",
 /* 365 */ "database_kw_opt ::=",
 /* 366 */ "kwcolumn_opt ::=",
 /* 367 */ "kwcolumn_opt ::= COLUMNKW",
 /* 368 */ "vtabarglist ::= vtabarg",
 /* 369 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
 /* 370 */ "vtabarg ::= vtabarg vtabargtoken",
 /* 371 */ "anylist ::=",
 /* 372 */ "anylist ::= anylist LP anylist RP",
 /* 373 */ "anylist ::= anylist ANY",
 /* 374 */ "with ::=",
 /* 355 */ "nmnum ::= plus_num",
 /* 356 */ "nmnum ::= nm",
 /* 357 */ "nmnum ::= ON",
 /* 358 */ "nmnum ::= DELETE",
 /* 359 */ "nmnum ::= DEFAULT",
 /* 360 */ "plus_num ::= INTEGER|FLOAT",
 /* 361 */ "foreach_clause ::=",
 /* 362 */ "foreach_clause ::= FOR EACH ROW",
 /* 363 */ "trnm ::= nm",
 /* 364 */ "tridxby ::=",
 /* 365 */ "database_kw_opt ::= DATABASE",
 /* 366 */ "database_kw_opt ::=",
 /* 367 */ "kwcolumn_opt ::=",
 /* 368 */ "kwcolumn_opt ::= COLUMNKW",
 /* 369 */ "vtabarglist ::= vtabarg",
 /* 370 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
 /* 371 */ "vtabarg ::= vtabarg vtabargtoken",
 /* 372 */ "anylist ::=",
 /* 373 */ "anylist ::= anylist LP anylist RP",
 /* 374 */ "anylist ::= anylist ANY",
 /* 375 */ "with ::=",
};
#endif /* NDEBUG */


#if YYSTACKDEPTH<=0
/*
** Try to increase the size of the parser stack.  Return the number
150082
150083
150084
150085
150086
150087
150088
150089
150090
150091



150092
150093

150094
150095
150096
150097
150098
150099
150100
150101
150102
150103
150104
150105
150106











150107
150108

150109
150110
150111
150112
150113
150114
150115
150116
150117
150118
150119
150120
150121
150122
150123













150124
150125

150126
150127
150128
150129
150130
150131
150132





150133
150134

150135
150136
150137

150138
150139

150140
150141
150142
150143


150144
150145

150146
150147
150148
150149
150150



150151
150152

150153
150154
150155

150156
150157
150158



150159
150160

150161
150162
150163
150164


150165
150166

150167
150168
150169

150170
150171

150172
150173
150174
150175
150176



150177
150178

150179
150180
150181
150182
150183
150184
150185
150658
150659
150660
150661
150662
150663
150664



150665
150666
150667
150668

150669
150670
150671











150672
150673
150674
150675
150676
150677
150678
150679
150680
150681
150682
150683

150684
150685
150686













150687
150688
150689
150690
150691
150692
150693
150694
150695
150696
150697
150698
150699
150700

150701
150702
150703





150704
150705
150706
150707
150708
150709

150710
150711
150712

150713
150714

150715
150716
150717


150718
150719
150720

150721
150722
150723



150724
150725
150726
150727

150728
150729
150730

150731



150732
150733
150734
150735

150736
150737
150738


150739
150740
150741

150742
150743
150744

150745
150746

150747
150748
150749



150750
150751
150752
150753

150754
150755
150756
150757
150758
150759
150760
150761







-
-
-
+
+
+

-
+


-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+

-
+


-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+

-
+


-
-
-
-
-
+
+
+
+
+

-
+


-
+

-
+


-
-
+
+

-
+


-
-
-
+
+
+

-
+


-
+
-
-
-
+
+
+

-
+


-
-
+
+

-
+


-
+

-
+


-
-
-
+
+
+

-
+







    **
    ** Note: during a reduce, the only symbols destroyed are those
    ** which appear on the RHS of the rule, but which are *not* used
    ** inside the C code.
    */
/********* Begin destructor definitions ***************************************/
    case 195: /* select */
    case 227: /* selectnowith */
    case 228: /* oneselect */
    case 240: /* values */
    case 228: /* selectnowith */
    case 229: /* oneselect */
    case 241: /* values */
{
sqlite3SelectDelete(pParse->db, (yypminor->yy457));
sqlite3SelectDelete(pParse->db, (yypminor->yy391));
}
      break;
    case 205: /* term */
    case 206: /* expr */
    case 234: /* where_opt */
    case 236: /* having_opt */
    case 248: /* on_opt */
    case 263: /* case_operand */
    case 265: /* case_else */
    case 268: /* vinto */
    case 275: /* when_clause */
    case 280: /* key_opt */
    case 294: /* filter_opt */
    case 206: /* term */
    case 207: /* expr */
    case 235: /* where_opt */
    case 237: /* having_opt */
    case 249: /* on_opt */
    case 264: /* case_operand */
    case 266: /* case_else */
    case 269: /* vinto */
    case 276: /* when_clause */
    case 281: /* key_opt */
    case 295: /* filter_opt */
{
sqlite3ExprDelete(pParse->db, (yypminor->yy524));
sqlite3ExprDelete(pParse->db, (yypminor->yy102));
}
      break;
    case 210: /* eidlist_opt */
    case 219: /* sortlist */
    case 220: /* eidlist */
    case 232: /* selcollist */
    case 235: /* groupby_opt */
    case 237: /* orderby_opt */
    case 241: /* nexprlist */
    case 242: /* sclp */
    case 250: /* exprlist */
    case 254: /* setlist */
    case 262: /* paren_exprlist */
    case 264: /* case_exprlist */
    case 293: /* part_opt */
    case 211: /* eidlist_opt */
    case 220: /* sortlist */
    case 221: /* eidlist */
    case 233: /* selcollist */
    case 236: /* groupby_opt */
    case 238: /* orderby_opt */
    case 242: /* nexprlist */
    case 243: /* sclp */
    case 251: /* exprlist */
    case 255: /* setlist */
    case 263: /* paren_exprlist */
    case 265: /* case_exprlist */
    case 294: /* part_opt */
{
sqlite3ExprListDelete(pParse->db, (yypminor->yy434));
sqlite3ExprListDelete(pParse->db, (yypminor->yy94));
}
      break;
    case 226: /* fullname */
    case 233: /* from */
    case 244: /* seltablist */
    case 245: /* stl_prefix */
    case 251: /* xfullname */
    case 227: /* fullname */
    case 234: /* from */
    case 245: /* seltablist */
    case 246: /* stl_prefix */
    case 252: /* xfullname */
{
sqlite3SrcListDelete(pParse->db, (yypminor->yy483));
sqlite3SrcListDelete(pParse->db, (yypminor->yy407));
}
      break;
    case 229: /* wqlist */
    case 230: /* wqlist */
{
sqlite3WithDelete(pParse->db, (yypminor->yy59));
sqlite3WithDelete(pParse->db, (yypminor->yy243));
}
      break;
    case 239: /* window_clause */
    case 289: /* windowdefn_list */
    case 240: /* window_clause */
    case 290: /* windowdefn_list */
{
sqlite3WindowListDelete(pParse->db, (yypminor->yy295));
sqlite3WindowListDelete(pParse->db, (yypminor->yy379));
}
      break;
    case 249: /* using_opt */
    case 252: /* idlist */
    case 256: /* idlist_opt */
    case 250: /* using_opt */
    case 253: /* idlist */
    case 257: /* idlist_opt */
{
sqlite3IdListDelete(pParse->db, (yypminor->yy62));
sqlite3IdListDelete(pParse->db, (yypminor->yy76));
}
      break;
    case 258: /* over_clause */
    case 259: /* over_clause */
    case 290: /* windowdefn */
    case 291: /* window */
    case 292: /* frame_opt */
    case 291: /* windowdefn */
    case 292: /* window */
    case 293: /* frame_opt */
{
sqlite3WindowDelete(pParse->db, (yypminor->yy295));
sqlite3WindowDelete(pParse->db, (yypminor->yy379));
}
      break;
    case 271: /* trigger_cmd_list */
    case 276: /* trigger_cmd */
    case 272: /* trigger_cmd_list */
    case 277: /* trigger_cmd */
{
sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy455));
sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy11));
}
      break;
    case 273: /* trigger_event */
    case 274: /* trigger_event */
{
sqlite3IdListDelete(pParse->db, (yypminor->yy90).b);
sqlite3IdListDelete(pParse->db, (yypminor->yy298).b);
}
      break;
    case 296: /* frame_bound */
    case 297: /* frame_bound_s */
    case 298: /* frame_bound_e */
    case 297: /* frame_bound */
    case 298: /* frame_bound_s */
    case 299: /* frame_bound_e */
{
sqlite3ExprDelete(pParse->db, (yypminor->yy201).pExpr);
sqlite3ExprDelete(pParse->db, (yypminor->yy389).pExpr);
}
      break;
/********* End destructor definitions *****************************************/
    default:  break;   /* If no destructor action specified: do nothing */
  }
}

150495
150496
150497
150498
150499
150500
150501

150502
150503
150504
150505
150506
150507
150508
150509
150510
150511
150512
150513
150514
150515
150516
150517
150518
150519
150520
150521
150522
150523
150524
150525
150526
150527
150528
150529
150530
150531
150532
150533
150534
150535
150536
150537
150538
150539
150540
150541
150542
150543
150544
150545
150546
150547
150548
150549
150550
150551
150552
150553
150554
150555
150556
150557
150558
150559
150560
150561
150562
150563






























































150564
150565
150566
150567
150568
150569
150570
150571
150572
150573
150574
150575
150576
150577
150578
150579
150580
150581
150582
150583
150584
150585
150586
150587
150588
150589
150590
150591
150592
150593
150594
150595
150596
150597
150598
150599
150600
150601
150602
150603
150604
150605
150606
150607
150608
150609
150610
150611
150612
150613
150614
150615
150616
150617
150618
150619
150620
150621
150622
150623
150624
150625
150626
150627
150628
150629
150630
150631
150632
150633
150634
150635
150636
150637
150638
150639
150640
150641
150642
150643
150644
150645
150646
150647
150648
150649
150650
150651
150652
150653
150654
150655
150656
150657
150658
150659
150660
150661
150662
150663
150664
150665
150666
150667
150668
150669
150670
150671
150672
150673
150674
150675
150676
150677
150678
150679
150680
150681
150682
150683
150684
150685
150686
150687
150688
150689
150690
150691
150692
150693
150694



































































































































150695
150696
150697
150698
150699
150700
150701
150702
150703
150704
150705











150706
150707
150708
150709
150710
150711
150712
150713
150714
150715










150716
150717
150718
150719
150720
150721
150722
150723
150724
150725
150726
150727
150728
150729
150730
150731
150732
150733
150734
150735
150736
150737
150738
150739
150740
150741


























150742
150743
150744
150745
150746
150747
150748
150749
150750
150751
150752
150753
150754
150755
150756
150757
150758
150759
150760
150761
150762
150763
150764
150765
150766
150767
150768
150769
150770
150771
150772
150773
150774
150775
150776
150777
150778
150779
150780
150781
150782
150783
150784
150785
150786
150787
150788
150789
150790

















































150791
150792
150793
150794
150795
150796
150797
150798
150799
150800
150801
150802
150803













150804
150805
150806
150807
150808
150809
150810
150811
150812
150813
150814
150815
150816
150817
150818
150819
150820
150821
150822
150823
150824
150825
150826
150827
150828
150829
150830
150831
150832
150833
150834
150835
150836
150837
150838
150839
150840
150841
150842
150843
150844
150845
150846
150847












































150848
150849
150850
150851
150852
150853
150854
151071
151072
151073
151074
151075
151076
151077
151078






























































151079
151080
151081
151082
151083
151084
151085
151086
151087
151088
151089
151090
151091
151092
151093
151094
151095
151096
151097
151098
151099
151100
151101
151102
151103
151104
151105
151106
151107
151108
151109
151110
151111
151112
151113
151114
151115
151116
151117
151118
151119
151120
151121
151122
151123
151124
151125
151126
151127
151128
151129
151130
151131
151132
151133
151134
151135
151136
151137
151138
151139
151140



































































































































151141
151142
151143
151144
151145
151146
151147
151148
151149
151150
151151
151152
151153
151154
151155
151156
151157
151158
151159
151160
151161
151162
151163
151164
151165
151166
151167
151168
151169
151170
151171
151172
151173
151174
151175
151176
151177
151178
151179
151180
151181
151182
151183
151184
151185
151186
151187
151188
151189
151190
151191
151192
151193
151194
151195
151196
151197
151198
151199
151200
151201
151202
151203
151204
151205
151206
151207
151208
151209
151210
151211
151212
151213
151214
151215
151216
151217
151218
151219
151220
151221
151222
151223
151224
151225
151226
151227
151228
151229
151230
151231
151232
151233
151234
151235
151236
151237
151238
151239
151240
151241
151242
151243
151244
151245
151246
151247
151248
151249
151250
151251
151252
151253
151254
151255
151256
151257
151258
151259
151260
151261
151262
151263
151264
151265
151266
151267
151268
151269
151270
151271











151272
151273
151274
151275
151276
151277
151278
151279
151280
151281
151282










151283
151284
151285
151286
151287
151288
151289
151290
151291
151292


























151293
151294
151295
151296
151297
151298
151299
151300
151301
151302
151303
151304
151305
151306
151307
151308
151309
151310
151311
151312
151313
151314
151315
151316
151317
151318

















































151319
151320
151321
151322
151323
151324
151325
151326
151327
151328
151329
151330
151331
151332
151333
151334
151335
151336
151337
151338
151339
151340
151341
151342
151343
151344
151345
151346
151347
151348
151349
151350
151351
151352
151353
151354
151355
151356
151357
151358
151359
151360
151361
151362
151363
151364
151365
151366
151367













151368
151369
151370
151371
151372
151373
151374
151375
151376
151377
151378
151379
151380












































151381
151382
151383
151384
151385
151386
151387
151388
151389
151390
151391
151392
151393
151394
151395
151396
151397
151398
151399
151400
151401
151402
151403
151404
151405
151406
151407
151408
151409
151410
151411
151412
151413
151414
151415
151416
151417
151418
151419
151420
151421
151422
151423
151424
151425
151426
151427
151428
151429
151430
151431







+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







   194,  /* (22) table_options ::= WITHOUT nm */
   196,  /* (23) columnname ::= nm typetoken */
   198,  /* (24) typetoken ::= */
   198,  /* (25) typetoken ::= typename LP signed RP */
   198,  /* (26) typetoken ::= typename LP signed COMMA signed RP */
   199,  /* (27) typename ::= typename ID|STRING */
   203,  /* (28) scanpt ::= */
   204,  /* (29) scantok ::= */
   204,  /* (29) ccons ::= CONSTRAINT nm */
   204,  /* (30) ccons ::= DEFAULT scanpt term scanpt */
   204,  /* (31) ccons ::= DEFAULT LP expr RP */
   204,  /* (32) ccons ::= DEFAULT PLUS term scanpt */
   204,  /* (33) ccons ::= DEFAULT MINUS term scanpt */
   204,  /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */
   204,  /* (35) ccons ::= NOT NULL onconf */
   204,  /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */
   204,  /* (37) ccons ::= UNIQUE onconf */
   204,  /* (38) ccons ::= CHECK LP expr RP */
   204,  /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */
   204,  /* (40) ccons ::= defer_subclause */
   204,  /* (41) ccons ::= COLLATE ID|STRING */
   209,  /* (42) autoinc ::= */
   209,  /* (43) autoinc ::= AUTOINCR */
   211,  /* (44) refargs ::= */
   211,  /* (45) refargs ::= refargs refarg */
   213,  /* (46) refarg ::= MATCH nm */
   213,  /* (47) refarg ::= ON INSERT refact */
   213,  /* (48) refarg ::= ON DELETE refact */
   213,  /* (49) refarg ::= ON UPDATE refact */
   214,  /* (50) refact ::= SET NULL */
   214,  /* (51) refact ::= SET DEFAULT */
   214,  /* (52) refact ::= CASCADE */
   214,  /* (53) refact ::= RESTRICT */
   214,  /* (54) refact ::= NO ACTION */
   212,  /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
   212,  /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
   215,  /* (57) init_deferred_pred_opt ::= */
   215,  /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */
   215,  /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
   193,  /* (60) conslist_opt ::= */
   217,  /* (61) tconscomma ::= COMMA */
   218,  /* (62) tcons ::= CONSTRAINT nm */
   218,  /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
   218,  /* (64) tcons ::= UNIQUE LP sortlist RP onconf */
   218,  /* (65) tcons ::= CHECK LP expr RP onconf */
   218,  /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
   221,  /* (67) defer_subclause_opt ::= */
   207,  /* (68) onconf ::= */
   207,  /* (69) onconf ::= ON CONFLICT resolvetype */
   222,  /* (70) orconf ::= */
   222,  /* (71) orconf ::= OR resolvetype */
   223,  /* (72) resolvetype ::= IGNORE */
   223,  /* (73) resolvetype ::= REPLACE */
   181,  /* (74) cmd ::= DROP TABLE ifexists fullname */
   225,  /* (75) ifexists ::= IF EXISTS */
   225,  /* (76) ifexists ::= */
   181,  /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
   181,  /* (78) cmd ::= DROP VIEW ifexists fullname */
   181,  /* (79) cmd ::= select */
   195,  /* (80) select ::= WITH wqlist selectnowith */
   195,  /* (81) select ::= WITH RECURSIVE wqlist selectnowith */
   195,  /* (82) select ::= selectnowith */
   227,  /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
   230,  /* (84) multiselect_op ::= UNION */
   230,  /* (85) multiselect_op ::= UNION ALL */
   230,  /* (86) multiselect_op ::= EXCEPT|INTERSECT */
   228,  /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
   228,  /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
   240,  /* (89) values ::= VALUES LP nexprlist RP */
   240,  /* (90) values ::= values COMMA LP nexprlist RP */
   205,  /* (30) ccons ::= CONSTRAINT nm */
   205,  /* (31) ccons ::= DEFAULT scantok term */
   205,  /* (32) ccons ::= DEFAULT LP expr RP */
   205,  /* (33) ccons ::= DEFAULT PLUS scantok term */
   205,  /* (34) ccons ::= DEFAULT MINUS scantok term */
   205,  /* (35) ccons ::= DEFAULT scantok ID|INDEXED */
   205,  /* (36) ccons ::= NOT NULL onconf */
   205,  /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */
   205,  /* (38) ccons ::= UNIQUE onconf */
   205,  /* (39) ccons ::= CHECK LP expr RP */
   205,  /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */
   205,  /* (41) ccons ::= defer_subclause */
   205,  /* (42) ccons ::= COLLATE ID|STRING */
   210,  /* (43) autoinc ::= */
   210,  /* (44) autoinc ::= AUTOINCR */
   212,  /* (45) refargs ::= */
   212,  /* (46) refargs ::= refargs refarg */
   214,  /* (47) refarg ::= MATCH nm */
   214,  /* (48) refarg ::= ON INSERT refact */
   214,  /* (49) refarg ::= ON DELETE refact */
   214,  /* (50) refarg ::= ON UPDATE refact */
   215,  /* (51) refact ::= SET NULL */
   215,  /* (52) refact ::= SET DEFAULT */
   215,  /* (53) refact ::= CASCADE */
   215,  /* (54) refact ::= RESTRICT */
   215,  /* (55) refact ::= NO ACTION */
   213,  /* (56) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
   213,  /* (57) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
   216,  /* (58) init_deferred_pred_opt ::= */
   216,  /* (59) init_deferred_pred_opt ::= INITIALLY DEFERRED */
   216,  /* (60) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
   193,  /* (61) conslist_opt ::= */
   218,  /* (62) tconscomma ::= COMMA */
   219,  /* (63) tcons ::= CONSTRAINT nm */
   219,  /* (64) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
   219,  /* (65) tcons ::= UNIQUE LP sortlist RP onconf */
   219,  /* (66) tcons ::= CHECK LP expr RP onconf */
   219,  /* (67) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
   222,  /* (68) defer_subclause_opt ::= */
   208,  /* (69) onconf ::= */
   208,  /* (70) onconf ::= ON CONFLICT resolvetype */
   223,  /* (71) orconf ::= */
   223,  /* (72) orconf ::= OR resolvetype */
   224,  /* (73) resolvetype ::= IGNORE */
   224,  /* (74) resolvetype ::= REPLACE */
   181,  /* (75) cmd ::= DROP TABLE ifexists fullname */
   226,  /* (76) ifexists ::= IF EXISTS */
   226,  /* (77) ifexists ::= */
   181,  /* (78) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
   181,  /* (79) cmd ::= DROP VIEW ifexists fullname */
   181,  /* (80) cmd ::= select */
   195,  /* (81) select ::= WITH wqlist selectnowith */
   195,  /* (82) select ::= WITH RECURSIVE wqlist selectnowith */
   195,  /* (83) select ::= selectnowith */
   228,  /* (84) selectnowith ::= selectnowith multiselect_op oneselect */
   231,  /* (85) multiselect_op ::= UNION */
   231,  /* (86) multiselect_op ::= UNION ALL */
   231,  /* (87) multiselect_op ::= EXCEPT|INTERSECT */
   229,  /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
   229,  /* (89) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
   241,  /* (90) values ::= VALUES LP nexprlist RP */
   241,  /* (91) values ::= values COMMA LP nexprlist RP */
   231,  /* (91) distinct ::= DISTINCT */
   231,  /* (92) distinct ::= ALL */
   231,  /* (93) distinct ::= */
   242,  /* (94) sclp ::= */
   232,  /* (95) selcollist ::= sclp scanpt expr scanpt as */
   232,  /* (96) selcollist ::= sclp scanpt STAR */
   232,  /* (97) selcollist ::= sclp scanpt nm DOT STAR */
   243,  /* (98) as ::= AS nm */
   243,  /* (99) as ::= */
   233,  /* (100) from ::= */
   233,  /* (101) from ::= FROM seltablist */
   245,  /* (102) stl_prefix ::= seltablist joinop */
   245,  /* (103) stl_prefix ::= */
   244,  /* (104) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
   244,  /* (105) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
   244,  /* (106) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
   244,  /* (107) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
   191,  /* (108) dbnm ::= */
   191,  /* (109) dbnm ::= DOT nm */
   226,  /* (110) fullname ::= nm */
   226,  /* (111) fullname ::= nm DOT nm */
   251,  /* (112) xfullname ::= nm */
   251,  /* (113) xfullname ::= nm DOT nm */
   251,  /* (114) xfullname ::= nm DOT nm AS nm */
   251,  /* (115) xfullname ::= nm AS nm */
   246,  /* (116) joinop ::= COMMA|JOIN */
   246,  /* (117) joinop ::= JOIN_KW JOIN */
   246,  /* (118) joinop ::= JOIN_KW nm JOIN */
   246,  /* (119) joinop ::= JOIN_KW nm nm JOIN */
   248,  /* (120) on_opt ::= ON expr */
   248,  /* (121) on_opt ::= */
   247,  /* (122) indexed_opt ::= */
   247,  /* (123) indexed_opt ::= INDEXED BY nm */
   247,  /* (124) indexed_opt ::= NOT INDEXED */
   249,  /* (125) using_opt ::= USING LP idlist RP */
   249,  /* (126) using_opt ::= */
   237,  /* (127) orderby_opt ::= */
   237,  /* (128) orderby_opt ::= ORDER BY sortlist */
   219,  /* (129) sortlist ::= sortlist COMMA expr sortorder */
   219,  /* (130) sortlist ::= expr sortorder */
   208,  /* (131) sortorder ::= ASC */
   208,  /* (132) sortorder ::= DESC */
   208,  /* (133) sortorder ::= */
   235,  /* (134) groupby_opt ::= */
   235,  /* (135) groupby_opt ::= GROUP BY nexprlist */
   236,  /* (136) having_opt ::= */
   236,  /* (137) having_opt ::= HAVING expr */
   238,  /* (138) limit_opt ::= */
   238,  /* (139) limit_opt ::= LIMIT expr */
   238,  /* (140) limit_opt ::= LIMIT expr OFFSET expr */
   238,  /* (141) limit_opt ::= LIMIT expr COMMA expr */
   181,  /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
   234,  /* (143) where_opt ::= */
   234,  /* (144) where_opt ::= WHERE expr */
   181,  /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
   254,  /* (146) setlist ::= setlist COMMA nm EQ expr */
   254,  /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */
   254,  /* (148) setlist ::= nm EQ expr */
   254,  /* (149) setlist ::= LP idlist RP EQ expr */
   181,  /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
   181,  /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
   257,  /* (152) upsert ::= */
   257,  /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
   257,  /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
   257,  /* (155) upsert ::= ON CONFLICT DO NOTHING */
   255,  /* (156) insert_cmd ::= INSERT orconf */
   255,  /* (157) insert_cmd ::= REPLACE */
   256,  /* (158) idlist_opt ::= */
   256,  /* (159) idlist_opt ::= LP idlist RP */
   252,  /* (160) idlist ::= idlist COMMA nm */
   252,  /* (161) idlist ::= nm */
   206,  /* (162) expr ::= LP expr RP */
   206,  /* (163) expr ::= ID|INDEXED */
   206,  /* (164) expr ::= JOIN_KW */
   206,  /* (165) expr ::= nm DOT nm */
   206,  /* (166) expr ::= nm DOT nm DOT nm */
   205,  /* (167) term ::= NULL|FLOAT|BLOB */
   205,  /* (168) term ::= STRING */
   205,  /* (169) term ::= INTEGER */
   206,  /* (170) expr ::= VARIABLE */
   206,  /* (171) expr ::= expr COLLATE ID|STRING */
   206,  /* (172) expr ::= CAST LP expr AS typetoken RP */
   206,  /* (173) expr ::= ID|INDEXED LP distinct exprlist RP */
   206,  /* (174) expr ::= ID|INDEXED LP STAR RP */
   206,  /* (175) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
   206,  /* (176) expr ::= ID|INDEXED LP STAR RP over_clause */
   205,  /* (177) term ::= CTIME_KW */
   206,  /* (178) expr ::= LP nexprlist COMMA expr RP */
   206,  /* (179) expr ::= expr AND expr */
   206,  /* (180) expr ::= expr OR expr */
   206,  /* (181) expr ::= expr LT|GT|GE|LE expr */
   206,  /* (182) expr ::= expr EQ|NE expr */
   206,  /* (183) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
   206,  /* (184) expr ::= expr PLUS|MINUS expr */
   206,  /* (185) expr ::= expr STAR|SLASH|REM expr */
   206,  /* (186) expr ::= expr CONCAT expr */
   259,  /* (187) likeop ::= NOT LIKE_KW|MATCH */
   206,  /* (188) expr ::= expr likeop expr */
   206,  /* (189) expr ::= expr likeop expr ESCAPE expr */
   206,  /* (190) expr ::= expr ISNULL|NOTNULL */
   206,  /* (191) expr ::= expr NOT NULL */
   206,  /* (192) expr ::= expr IS expr */
   206,  /* (193) expr ::= expr IS NOT expr */
   206,  /* (194) expr ::= NOT expr */
   206,  /* (195) expr ::= BITNOT expr */
   206,  /* (196) expr ::= PLUS|MINUS expr */
   260,  /* (197) between_op ::= BETWEEN */
   260,  /* (198) between_op ::= NOT BETWEEN */
   206,  /* (199) expr ::= expr between_op expr AND expr */
   261,  /* (200) in_op ::= IN */
   261,  /* (201) in_op ::= NOT IN */
   206,  /* (202) expr ::= expr in_op LP exprlist RP */
   206,  /* (203) expr ::= LP select RP */
   206,  /* (204) expr ::= expr in_op LP select RP */
   206,  /* (205) expr ::= expr in_op nm dbnm paren_exprlist */
   206,  /* (206) expr ::= EXISTS LP select RP */
   206,  /* (207) expr ::= CASE case_operand case_exprlist case_else END */
   264,  /* (208) case_exprlist ::= case_exprlist WHEN expr THEN expr */
   264,  /* (209) case_exprlist ::= WHEN expr THEN expr */
   265,  /* (210) case_else ::= ELSE expr */
   265,  /* (211) case_else ::= */
   263,  /* (212) case_operand ::= expr */
   263,  /* (213) case_operand ::= */
   250,  /* (214) exprlist ::= */
   241,  /* (215) nexprlist ::= nexprlist COMMA expr */
   241,  /* (216) nexprlist ::= expr */
   262,  /* (217) paren_exprlist ::= */
   262,  /* (218) paren_exprlist ::= LP exprlist RP */
   181,  /* (219) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
   266,  /* (220) uniqueflag ::= UNIQUE */
   266,  /* (221) uniqueflag ::= */
   232,  /* (92) distinct ::= DISTINCT */
   232,  /* (93) distinct ::= ALL */
   232,  /* (94) distinct ::= */
   243,  /* (95) sclp ::= */
   233,  /* (96) selcollist ::= sclp scanpt expr scanpt as */
   233,  /* (97) selcollist ::= sclp scanpt STAR */
   233,  /* (98) selcollist ::= sclp scanpt nm DOT STAR */
   244,  /* (99) as ::= AS nm */
   244,  /* (100) as ::= */
   234,  /* (101) from ::= */
   234,  /* (102) from ::= FROM seltablist */
   246,  /* (103) stl_prefix ::= seltablist joinop */
   246,  /* (104) stl_prefix ::= */
   245,  /* (105) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
   245,  /* (106) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
   245,  /* (107) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
   245,  /* (108) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
   191,  /* (109) dbnm ::= */
   191,  /* (110) dbnm ::= DOT nm */
   227,  /* (111) fullname ::= nm */
   227,  /* (112) fullname ::= nm DOT nm */
   252,  /* (113) xfullname ::= nm */
   252,  /* (114) xfullname ::= nm DOT nm */
   252,  /* (115) xfullname ::= nm DOT nm AS nm */
   252,  /* (116) xfullname ::= nm AS nm */
   247,  /* (117) joinop ::= COMMA|JOIN */
   247,  /* (118) joinop ::= JOIN_KW JOIN */
   247,  /* (119) joinop ::= JOIN_KW nm JOIN */
   247,  /* (120) joinop ::= JOIN_KW nm nm JOIN */
   249,  /* (121) on_opt ::= ON expr */
   249,  /* (122) on_opt ::= */
   248,  /* (123) indexed_opt ::= */
   248,  /* (124) indexed_opt ::= INDEXED BY nm */
   248,  /* (125) indexed_opt ::= NOT INDEXED */
   250,  /* (126) using_opt ::= USING LP idlist RP */
   250,  /* (127) using_opt ::= */
   238,  /* (128) orderby_opt ::= */
   238,  /* (129) orderby_opt ::= ORDER BY sortlist */
   220,  /* (130) sortlist ::= sortlist COMMA expr sortorder */
   220,  /* (131) sortlist ::= expr sortorder */
   209,  /* (132) sortorder ::= ASC */
   209,  /* (133) sortorder ::= DESC */
   209,  /* (134) sortorder ::= */
   236,  /* (135) groupby_opt ::= */
   236,  /* (136) groupby_opt ::= GROUP BY nexprlist */
   237,  /* (137) having_opt ::= */
   237,  /* (138) having_opt ::= HAVING expr */
   239,  /* (139) limit_opt ::= */
   239,  /* (140) limit_opt ::= LIMIT expr */
   239,  /* (141) limit_opt ::= LIMIT expr OFFSET expr */
   239,  /* (142) limit_opt ::= LIMIT expr COMMA expr */
   181,  /* (143) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
   235,  /* (144) where_opt ::= */
   235,  /* (145) where_opt ::= WHERE expr */
   181,  /* (146) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
   255,  /* (147) setlist ::= setlist COMMA nm EQ expr */
   255,  /* (148) setlist ::= setlist COMMA LP idlist RP EQ expr */
   255,  /* (149) setlist ::= nm EQ expr */
   255,  /* (150) setlist ::= LP idlist RP EQ expr */
   181,  /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
   181,  /* (152) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
   258,  /* (153) upsert ::= */
   258,  /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
   258,  /* (155) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
   258,  /* (156) upsert ::= ON CONFLICT DO NOTHING */
   256,  /* (157) insert_cmd ::= INSERT orconf */
   256,  /* (158) insert_cmd ::= REPLACE */
   257,  /* (159) idlist_opt ::= */
   257,  /* (160) idlist_opt ::= LP idlist RP */
   253,  /* (161) idlist ::= idlist COMMA nm */
   253,  /* (162) idlist ::= nm */
   207,  /* (163) expr ::= LP expr RP */
   207,  /* (164) expr ::= ID|INDEXED */
   207,  /* (165) expr ::= JOIN_KW */
   207,  /* (166) expr ::= nm DOT nm */
   207,  /* (167) expr ::= nm DOT nm DOT nm */
   206,  /* (168) term ::= NULL|FLOAT|BLOB */
   206,  /* (169) term ::= STRING */
   206,  /* (170) term ::= INTEGER */
   207,  /* (171) expr ::= VARIABLE */
   207,  /* (172) expr ::= expr COLLATE ID|STRING */
   207,  /* (173) expr ::= CAST LP expr AS typetoken RP */
   207,  /* (174) expr ::= ID|INDEXED LP distinct exprlist RP */
   207,  /* (175) expr ::= ID|INDEXED LP STAR RP */
   207,  /* (176) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
   207,  /* (177) expr ::= ID|INDEXED LP STAR RP over_clause */
   206,  /* (178) term ::= CTIME_KW */
   207,  /* (179) expr ::= LP nexprlist COMMA expr RP */
   207,  /* (180) expr ::= expr AND expr */
   207,  /* (181) expr ::= expr OR expr */
   207,  /* (182) expr ::= expr LT|GT|GE|LE expr */
   207,  /* (183) expr ::= expr EQ|NE expr */
   207,  /* (184) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
   207,  /* (185) expr ::= expr PLUS|MINUS expr */
   207,  /* (186) expr ::= expr STAR|SLASH|REM expr */
   207,  /* (187) expr ::= expr CONCAT expr */
   260,  /* (188) likeop ::= NOT LIKE_KW|MATCH */
   207,  /* (189) expr ::= expr likeop expr */
   207,  /* (190) expr ::= expr likeop expr ESCAPE expr */
   207,  /* (191) expr ::= expr ISNULL|NOTNULL */
   207,  /* (192) expr ::= expr NOT NULL */
   207,  /* (193) expr ::= expr IS expr */
   207,  /* (194) expr ::= expr IS NOT expr */
   207,  /* (195) expr ::= NOT expr */
   207,  /* (196) expr ::= BITNOT expr */
   207,  /* (197) expr ::= PLUS|MINUS expr */
   261,  /* (198) between_op ::= BETWEEN */
   261,  /* (199) between_op ::= NOT BETWEEN */
   207,  /* (200) expr ::= expr between_op expr AND expr */
   262,  /* (201) in_op ::= IN */
   262,  /* (202) in_op ::= NOT IN */
   207,  /* (203) expr ::= expr in_op LP exprlist RP */
   207,  /* (204) expr ::= LP select RP */
   207,  /* (205) expr ::= expr in_op LP select RP */
   207,  /* (206) expr ::= expr in_op nm dbnm paren_exprlist */
   207,  /* (207) expr ::= EXISTS LP select RP */
   207,  /* (208) expr ::= CASE case_operand case_exprlist case_else END */
   265,  /* (209) case_exprlist ::= case_exprlist WHEN expr THEN expr */
   265,  /* (210) case_exprlist ::= WHEN expr THEN expr */
   266,  /* (211) case_else ::= ELSE expr */
   266,  /* (212) case_else ::= */
   264,  /* (213) case_operand ::= expr */
   264,  /* (214) case_operand ::= */
   251,  /* (215) exprlist ::= */
   242,  /* (216) nexprlist ::= nexprlist COMMA expr */
   242,  /* (217) nexprlist ::= expr */
   263,  /* (218) paren_exprlist ::= */
   263,  /* (219) paren_exprlist ::= LP exprlist RP */
   181,  /* (220) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
   267,  /* (221) uniqueflag ::= UNIQUE */
   267,  /* (222) uniqueflag ::= */
   210,  /* (222) eidlist_opt ::= */
   210,  /* (223) eidlist_opt ::= LP eidlist RP */
   220,  /* (224) eidlist ::= eidlist COMMA nm collate sortorder */
   220,  /* (225) eidlist ::= nm collate sortorder */
   267,  /* (226) collate ::= */
   267,  /* (227) collate ::= COLLATE ID|STRING */
   181,  /* (228) cmd ::= DROP INDEX ifexists fullname */
   181,  /* (229) cmd ::= VACUUM vinto */
   181,  /* (230) cmd ::= VACUUM nm vinto */
   268,  /* (231) vinto ::= INTO expr */
   268,  /* (232) vinto ::= */
   211,  /* (223) eidlist_opt ::= */
   211,  /* (224) eidlist_opt ::= LP eidlist RP */
   221,  /* (225) eidlist ::= eidlist COMMA nm collate sortorder */
   221,  /* (226) eidlist ::= nm collate sortorder */
   268,  /* (227) collate ::= */
   268,  /* (228) collate ::= COLLATE ID|STRING */
   181,  /* (229) cmd ::= DROP INDEX ifexists fullname */
   181,  /* (230) cmd ::= VACUUM vinto */
   181,  /* (231) cmd ::= VACUUM nm vinto */
   269,  /* (232) vinto ::= INTO expr */
   269,  /* (233) vinto ::= */
   181,  /* (233) cmd ::= PRAGMA nm dbnm */
   181,  /* (234) cmd ::= PRAGMA nm dbnm EQ nmnum */
   181,  /* (235) cmd ::= PRAGMA nm dbnm LP nmnum RP */
   181,  /* (236) cmd ::= PRAGMA nm dbnm EQ minus_num */
   181,  /* (237) cmd ::= PRAGMA nm dbnm LP minus_num RP */
   201,  /* (238) plus_num ::= PLUS INTEGER|FLOAT */
   202,  /* (239) minus_num ::= MINUS INTEGER|FLOAT */
   181,  /* (240) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
   270,  /* (241) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
   272,  /* (242) trigger_time ::= BEFORE|AFTER */
   181,  /* (234) cmd ::= PRAGMA nm dbnm */
   181,  /* (235) cmd ::= PRAGMA nm dbnm EQ nmnum */
   181,  /* (236) cmd ::= PRAGMA nm dbnm LP nmnum RP */
   181,  /* (237) cmd ::= PRAGMA nm dbnm EQ minus_num */
   181,  /* (238) cmd ::= PRAGMA nm dbnm LP minus_num RP */
   201,  /* (239) plus_num ::= PLUS INTEGER|FLOAT */
   202,  /* (240) minus_num ::= MINUS INTEGER|FLOAT */
   181,  /* (241) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
   271,  /* (242) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
   273,  /* (243) trigger_time ::= BEFORE|AFTER */
   272,  /* (243) trigger_time ::= INSTEAD OF */
   272,  /* (244) trigger_time ::= */
   273,  /* (245) trigger_event ::= DELETE|INSERT */
   273,  /* (246) trigger_event ::= UPDATE */
   273,  /* (247) trigger_event ::= UPDATE OF idlist */
   275,  /* (248) when_clause ::= */
   275,  /* (249) when_clause ::= WHEN expr */
   271,  /* (250) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
   271,  /* (251) trigger_cmd_list ::= trigger_cmd SEMI */
   277,  /* (252) trnm ::= nm DOT nm */
   278,  /* (253) tridxby ::= INDEXED BY nm */
   278,  /* (254) tridxby ::= NOT INDEXED */
   276,  /* (255) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
   276,  /* (256) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
   276,  /* (257) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
   276,  /* (258) trigger_cmd ::= scanpt select scanpt */
   206,  /* (259) expr ::= RAISE LP IGNORE RP */
   206,  /* (260) expr ::= RAISE LP raisetype COMMA nm RP */
   224,  /* (261) raisetype ::= ROLLBACK */
   224,  /* (262) raisetype ::= ABORT */
   224,  /* (263) raisetype ::= FAIL */
   181,  /* (264) cmd ::= DROP TRIGGER ifexists fullname */
   181,  /* (265) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
   181,  /* (266) cmd ::= DETACH database_kw_opt expr */
   280,  /* (267) key_opt ::= */
   280,  /* (268) key_opt ::= KEY expr */
   273,  /* (244) trigger_time ::= INSTEAD OF */
   273,  /* (245) trigger_time ::= */
   274,  /* (246) trigger_event ::= DELETE|INSERT */
   274,  /* (247) trigger_event ::= UPDATE */
   274,  /* (248) trigger_event ::= UPDATE OF idlist */
   276,  /* (249) when_clause ::= */
   276,  /* (250) when_clause ::= WHEN expr */
   272,  /* (251) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
   272,  /* (252) trigger_cmd_list ::= trigger_cmd SEMI */
   278,  /* (253) trnm ::= nm DOT nm */
   279,  /* (254) tridxby ::= INDEXED BY nm */
   279,  /* (255) tridxby ::= NOT INDEXED */
   277,  /* (256) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
   277,  /* (257) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
   277,  /* (258) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
   277,  /* (259) trigger_cmd ::= scanpt select scanpt */
   207,  /* (260) expr ::= RAISE LP IGNORE RP */
   207,  /* (261) expr ::= RAISE LP raisetype COMMA nm RP */
   225,  /* (262) raisetype ::= ROLLBACK */
   225,  /* (263) raisetype ::= ABORT */
   225,  /* (264) raisetype ::= FAIL */
   181,  /* (265) cmd ::= DROP TRIGGER ifexists fullname */
   181,  /* (266) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
   181,  /* (267) cmd ::= DETACH database_kw_opt expr */
   281,  /* (268) key_opt ::= */
   281,  /* (269) key_opt ::= KEY expr */
   181,  /* (269) cmd ::= REINDEX */
   181,  /* (270) cmd ::= REINDEX nm dbnm */
   181,  /* (271) cmd ::= ANALYZE */
   181,  /* (272) cmd ::= ANALYZE nm dbnm */
   181,  /* (273) cmd ::= ALTER TABLE fullname RENAME TO nm */
   181,  /* (274) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
   281,  /* (275) add_column_fullname ::= fullname */
   181,  /* (276) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
   181,  /* (277) cmd ::= create_vtab */
   181,  /* (278) cmd ::= create_vtab LP vtabarglist RP */
   283,  /* (279) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
   285,  /* (280) vtabarg ::= */
   286,  /* (281) vtabargtoken ::= ANY */
   286,  /* (282) vtabargtoken ::= lp anylist RP */
   287,  /* (283) lp ::= LP */
   253,  /* (284) with ::= WITH wqlist */
   253,  /* (285) with ::= WITH RECURSIVE wqlist */
   229,  /* (286) wqlist ::= nm eidlist_opt AS LP select RP */
   229,  /* (287) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
   289,  /* (288) windowdefn_list ::= windowdefn */
   289,  /* (289) windowdefn_list ::= windowdefn_list COMMA windowdefn */
   290,  /* (290) windowdefn ::= nm AS LP window RP */
   291,  /* (291) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
   291,  /* (292) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
   291,  /* (293) window ::= ORDER BY sortlist frame_opt */
   291,  /* (294) window ::= nm ORDER BY sortlist frame_opt */
   291,  /* (295) window ::= frame_opt */
   291,  /* (296) window ::= nm frame_opt */
   292,  /* (297) frame_opt ::= */
   292,  /* (298) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
   292,  /* (299) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
   295,  /* (300) range_or_rows ::= RANGE|ROWS|GROUPS */
   297,  /* (301) frame_bound_s ::= frame_bound */
   297,  /* (302) frame_bound_s ::= UNBOUNDED PRECEDING */
   298,  /* (303) frame_bound_e ::= frame_bound */
   298,  /* (304) frame_bound_e ::= UNBOUNDED FOLLOWING */
   296,  /* (305) frame_bound ::= expr PRECEDING|FOLLOWING */
   296,  /* (306) frame_bound ::= CURRENT ROW */
   299,  /* (307) frame_exclude_opt ::= */
   299,  /* (308) frame_exclude_opt ::= EXCLUDE frame_exclude */
   300,  /* (309) frame_exclude ::= NO OTHERS */
   300,  /* (310) frame_exclude ::= CURRENT ROW */
   300,  /* (311) frame_exclude ::= GROUP|TIES */
   239,  /* (312) window_clause ::= WINDOW windowdefn_list */
   258,  /* (313) over_clause ::= filter_opt OVER LP window RP */
   258,  /* (314) over_clause ::= filter_opt OVER nm */
   294,  /* (315) filter_opt ::= */
   294,  /* (316) filter_opt ::= FILTER LP WHERE expr RP */
   176,  /* (317) input ::= cmdlist */
   181,  /* (270) cmd ::= REINDEX */
   181,  /* (271) cmd ::= REINDEX nm dbnm */
   181,  /* (272) cmd ::= ANALYZE */
   181,  /* (273) cmd ::= ANALYZE nm dbnm */
   181,  /* (274) cmd ::= ALTER TABLE fullname RENAME TO nm */
   181,  /* (275) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
   282,  /* (276) add_column_fullname ::= fullname */
   181,  /* (277) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
   181,  /* (278) cmd ::= create_vtab */
   181,  /* (279) cmd ::= create_vtab LP vtabarglist RP */
   284,  /* (280) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
   286,  /* (281) vtabarg ::= */
   287,  /* (282) vtabargtoken ::= ANY */
   287,  /* (283) vtabargtoken ::= lp anylist RP */
   288,  /* (284) lp ::= LP */
   254,  /* (285) with ::= WITH wqlist */
   254,  /* (286) with ::= WITH RECURSIVE wqlist */
   230,  /* (287) wqlist ::= nm eidlist_opt AS LP select RP */
   230,  /* (288) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
   290,  /* (289) windowdefn_list ::= windowdefn */
   290,  /* (290) windowdefn_list ::= windowdefn_list COMMA windowdefn */
   291,  /* (291) windowdefn ::= nm AS LP window RP */
   292,  /* (292) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
   292,  /* (293) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
   292,  /* (294) window ::= ORDER BY sortlist frame_opt */
   292,  /* (295) window ::= nm ORDER BY sortlist frame_opt */
   292,  /* (296) window ::= frame_opt */
   292,  /* (297) window ::= nm frame_opt */
   293,  /* (298) frame_opt ::= */
   293,  /* (299) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
   293,  /* (300) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
   296,  /* (301) range_or_rows ::= RANGE|ROWS|GROUPS */
   298,  /* (302) frame_bound_s ::= frame_bound */
   298,  /* (303) frame_bound_s ::= UNBOUNDED PRECEDING */
   299,  /* (304) frame_bound_e ::= frame_bound */
   299,  /* (305) frame_bound_e ::= UNBOUNDED FOLLOWING */
   297,  /* (306) frame_bound ::= expr PRECEDING|FOLLOWING */
   297,  /* (307) frame_bound ::= CURRENT ROW */
   300,  /* (308) frame_exclude_opt ::= */
   300,  /* (309) frame_exclude_opt ::= EXCLUDE frame_exclude */
   301,  /* (310) frame_exclude ::= NO OTHERS */
   301,  /* (311) frame_exclude ::= CURRENT ROW */
   301,  /* (312) frame_exclude ::= GROUP|TIES */
   240,  /* (313) window_clause ::= WINDOW windowdefn_list */
   259,  /* (314) over_clause ::= filter_opt OVER LP window RP */
   259,  /* (315) over_clause ::= filter_opt OVER nm */
   295,  /* (316) filter_opt ::= */
   295,  /* (317) filter_opt ::= FILTER LP WHERE expr RP */
   176,  /* (318) input ::= cmdlist */
   177,  /* (318) cmdlist ::= cmdlist ecmd */
   177,  /* (319) cmdlist ::= ecmd */
   178,  /* (320) ecmd ::= SEMI */
   178,  /* (321) ecmd ::= cmdx SEMI */
   178,  /* (322) ecmd ::= explain cmdx */
   183,  /* (323) trans_opt ::= */
   183,  /* (324) trans_opt ::= TRANSACTION */
   183,  /* (325) trans_opt ::= TRANSACTION nm */
   185,  /* (326) savepoint_opt ::= SAVEPOINT */
   185,  /* (327) savepoint_opt ::= */
   181,  /* (328) cmd ::= create_table create_table_args */
   192,  /* (329) columnlist ::= columnlist COMMA columnname carglist */
   192,  /* (330) columnlist ::= columnname carglist */
   177,  /* (319) cmdlist ::= cmdlist ecmd */
   177,  /* (320) cmdlist ::= ecmd */
   178,  /* (321) ecmd ::= SEMI */
   178,  /* (322) ecmd ::= cmdx SEMI */
   178,  /* (323) ecmd ::= explain cmdx */
   183,  /* (324) trans_opt ::= */
   183,  /* (325) trans_opt ::= TRANSACTION */
   183,  /* (326) trans_opt ::= TRANSACTION nm */
   185,  /* (327) savepoint_opt ::= SAVEPOINT */
   185,  /* (328) savepoint_opt ::= */
   181,  /* (329) cmd ::= create_table create_table_args */
   192,  /* (330) columnlist ::= columnlist COMMA columnname carglist */
   192,  /* (331) columnlist ::= columnname carglist */
   184,  /* (331) nm ::= ID|INDEXED */
   184,  /* (332) nm ::= STRING */
   184,  /* (333) nm ::= JOIN_KW */
   198,  /* (334) typetoken ::= typename */
   199,  /* (335) typename ::= ID|STRING */
   200,  /* (336) signed ::= plus_num */
   200,  /* (337) signed ::= minus_num */
   197,  /* (338) carglist ::= carglist ccons */
   197,  /* (339) carglist ::= */
   204,  /* (340) ccons ::= NULL onconf */
   193,  /* (341) conslist_opt ::= COMMA conslist */
   216,  /* (342) conslist ::= conslist tconscomma tcons */
   216,  /* (343) conslist ::= tcons */
   217,  /* (344) tconscomma ::= */
   221,  /* (345) defer_subclause_opt ::= defer_subclause */
   223,  /* (346) resolvetype ::= raisetype */
   227,  /* (347) selectnowith ::= oneselect */
   228,  /* (348) oneselect ::= values */
   242,  /* (349) sclp ::= selcollist COMMA */
   243,  /* (350) as ::= ID|STRING */
   206,  /* (351) expr ::= term */
   259,  /* (352) likeop ::= LIKE_KW|MATCH */
   250,  /* (353) exprlist ::= nexprlist */
   269,  /* (354) nmnum ::= plus_num */
   269,  /* (355) nmnum ::= nm */
   269,  /* (356) nmnum ::= ON */
   269,  /* (357) nmnum ::= DELETE */
   269,  /* (358) nmnum ::= DEFAULT */
   201,  /* (359) plus_num ::= INTEGER|FLOAT */
   274,  /* (360) foreach_clause ::= */
   274,  /* (361) foreach_clause ::= FOR EACH ROW */
   277,  /* (362) trnm ::= nm */
   278,  /* (363) tridxby ::= */
   279,  /* (364) database_kw_opt ::= DATABASE */
   279,  /* (365) database_kw_opt ::= */
   282,  /* (366) kwcolumn_opt ::= */
   282,  /* (367) kwcolumn_opt ::= COLUMNKW */
   284,  /* (368) vtabarglist ::= vtabarg */
   284,  /* (369) vtabarglist ::= vtabarglist COMMA vtabarg */
   285,  /* (370) vtabarg ::= vtabarg vtabargtoken */
   288,  /* (371) anylist ::= */
   288,  /* (372) anylist ::= anylist LP anylist RP */
   288,  /* (373) anylist ::= anylist ANY */
   253,  /* (374) with ::= */
   184,  /* (332) nm ::= ID|INDEXED */
   184,  /* (333) nm ::= STRING */
   184,  /* (334) nm ::= JOIN_KW */
   198,  /* (335) typetoken ::= typename */
   199,  /* (336) typename ::= ID|STRING */
   200,  /* (337) signed ::= plus_num */
   200,  /* (338) signed ::= minus_num */
   197,  /* (339) carglist ::= carglist ccons */
   197,  /* (340) carglist ::= */
   205,  /* (341) ccons ::= NULL onconf */
   193,  /* (342) conslist_opt ::= COMMA conslist */
   217,  /* (343) conslist ::= conslist tconscomma tcons */
   217,  /* (344) conslist ::= tcons */
   218,  /* (345) tconscomma ::= */
   222,  /* (346) defer_subclause_opt ::= defer_subclause */
   224,  /* (347) resolvetype ::= raisetype */
   228,  /* (348) selectnowith ::= oneselect */
   229,  /* (349) oneselect ::= values */
   243,  /* (350) sclp ::= selcollist COMMA */
   244,  /* (351) as ::= ID|STRING */
   207,  /* (352) expr ::= term */
   260,  /* (353) likeop ::= LIKE_KW|MATCH */
   251,  /* (354) exprlist ::= nexprlist */
   270,  /* (355) nmnum ::= plus_num */
   270,  /* (356) nmnum ::= nm */
   270,  /* (357) nmnum ::= ON */
   270,  /* (358) nmnum ::= DELETE */
   270,  /* (359) nmnum ::= DEFAULT */
   201,  /* (360) plus_num ::= INTEGER|FLOAT */
   275,  /* (361) foreach_clause ::= */
   275,  /* (362) foreach_clause ::= FOR EACH ROW */
   278,  /* (363) trnm ::= nm */
   279,  /* (364) tridxby ::= */
   280,  /* (365) database_kw_opt ::= DATABASE */
   280,  /* (366) database_kw_opt ::= */
   283,  /* (367) kwcolumn_opt ::= */
   283,  /* (368) kwcolumn_opt ::= COLUMNKW */
   285,  /* (369) vtabarglist ::= vtabarg */
   285,  /* (370) vtabarglist ::= vtabarglist COMMA vtabarg */
   286,  /* (371) vtabarg ::= vtabarg vtabargtoken */
   289,  /* (372) anylist ::= */
   289,  /* (373) anylist ::= anylist LP anylist RP */
   289,  /* (374) anylist ::= anylist ANY */
   254,  /* (375) with ::= */
};

/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
** of symbols on the right-hand side of that rule. */
static const signed char yyRuleInfoNRhs[] = {
   -1,  /* (0) explain ::= EXPLAIN */
   -3,  /* (1) explain ::= EXPLAIN QUERY PLAN */
150875
150876
150877
150878
150879
150880
150881
150882
150883
150884
150885
150886
150887
150888
150889
150890
150891
150892
150893
150894
150895
150896
150897
150898
150899
150900
150901
150902
150903
150904
150905
150906
150907
150908
150909
150910
150911
150912
150913
150914
150915
150916
150917
150918
150919
150920
150921
150922
150923
150924
150925
150926
150927
150928
150929
150930
150931
150932
150933
150934
150935
150936
150937
150938
150939
150940
150941
150942
150943































































150944
150945
150946
150947
150948
150949
150950
150951
150952
150953
150954
150955
150956
150957
150958
150959
150960
150961
150962
150963
150964
150965
150966
150967
150968
150969
150970
150971
150972
150973
150974
150975
150976
150977
150978
150979
150980
150981
150982
150983
150984
150985
150986
150987
150988
150989
150990
150991
150992
150993
150994
150995
150996
150997
150998
150999
151000
151001
151002
151003
151004
151005
151006
151007
151008
151009
151010
151011
151012
151013
151014
151015
151016
151017
151018
151019
151020
151021
151022
151023
151024
151025
151026
151027
151028
151029
151030
151031
























































































151032
151033
151034
151035
151036
151037
151038
151039
151040
151041
151042
151043
151044
151045
151046
151047
151048
151049
151050
151051
151052
151053
151054
151055
151056
151057
151058
151059
151060
151061
151062
151063
151064
151065
151066
151067
151068
151069
151070
151071
151072
151073
151074











































151075
151076
151077
151078
151079
151080
151081
151082
151083
151084
151085
151086
151087
151088
151089
151090
151091
151092
151093
151094
151095
151096
151097
151098
151099
151100
151101
151102
151103
151104
151105
151106
151107
151108
151109
151110
151111
151112
151113
151114
151115
151116
151117
151118
151119
151120
151121
151122
151123
151124
151125
151126
151127
151128
151129
151130
151131
151132
151133
151134
151135
151136
151137
151138
151139
151140
151141
151142
151143
151144
151145
151146
151147
151148
151149
151150
151151
151152
151153
151154
151155
151156
151157
151158
151159
151160
151161























































































151162
151163
151164
151165
151166
151167
151168
151169
151170
151171
151172
151173
151174
151175
151176
151177
151178
151179
151180
151181
151182
151183






















151184
151185
151186
151187
151188
151189
151190
151191
151192
151193
151194
151195
151196
151197
151198
151199
151200
151201
151202
151203
151204
151205
151206























151207
151208
151209
151210
151211
151212
151213
151214
151215
151216
151217
151218
151219
151220
151221
151222
151223
151224
151225
151226
151227





















151228
151229
151230
151231
151232
151233
151234
151452
151453
151454
151455
151456
151457
151458






























































151459
151460
151461
151462
151463
151464
151465
151466
151467
151468
151469
151470
151471
151472
151473
151474
151475
151476
151477
151478
151479
151480
151481
151482
151483
151484
151485
151486
151487
151488
151489
151490
151491
151492
151493
151494
151495
151496
151497
151498
151499
151500
151501
151502
151503
151504
151505
151506
151507
151508
151509
151510
151511
151512
151513
151514
151515
151516
151517
151518
151519
151520
151521
























































































151522
151523
151524
151525
151526
151527
151528
151529
151530
151531
151532
151533
151534
151535
151536
151537
151538
151539
151540
151541
151542
151543
151544
151545
151546
151547
151548
151549
151550
151551
151552
151553
151554
151555
151556
151557
151558
151559
151560
151561
151562
151563
151564
151565
151566
151567
151568
151569
151570
151571
151572
151573
151574
151575
151576
151577
151578
151579
151580
151581
151582
151583
151584
151585
151586
151587
151588
151589
151590
151591
151592
151593
151594
151595
151596
151597
151598
151599
151600
151601
151602
151603
151604
151605
151606
151607
151608
151609











































151610
151611
151612
151613
151614
151615
151616
151617
151618
151619
151620
151621
151622
151623
151624
151625
151626
151627
151628
151629
151630
151631
151632
151633
151634
151635
151636
151637
151638
151639
151640
151641
151642
151643
151644
151645
151646
151647
151648
151649
151650
151651
151652























































































151653
151654
151655
151656
151657
151658
151659
151660
151661
151662
151663
151664
151665
151666
151667
151668
151669
151670
151671
151672
151673
151674
151675
151676
151677
151678
151679
151680
151681
151682
151683
151684
151685
151686
151687
151688
151689
151690
151691
151692
151693
151694
151695
151696
151697
151698
151699
151700
151701
151702
151703
151704
151705
151706
151707
151708
151709
151710
151711
151712
151713
151714
151715
151716
151717
151718
151719
151720
151721
151722
151723
151724
151725
151726
151727
151728
151729
151730
151731
151732
151733
151734
151735
151736
151737
151738
151739






















151740
151741
151742
151743
151744
151745
151746
151747
151748
151749
151750
151751
151752
151753
151754
151755
151756
151757
151758
151759
151760
151761























151762
151763
151764
151765
151766
151767
151768
151769
151770
151771
151772
151773
151774
151775
151776
151777
151778
151779
151780
151781
151782
151783
151784





















151785
151786
151787
151788
151789
151790
151791
151792
151793
151794
151795
151796
151797
151798
151799
151800
151801
151802
151803
151804
151805
151806
151807
151808
151809
151810
151811
151812







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







   -2,  /* (22) table_options ::= WITHOUT nm */
   -2,  /* (23) columnname ::= nm typetoken */
    0,  /* (24) typetoken ::= */
   -4,  /* (25) typetoken ::= typename LP signed RP */
   -6,  /* (26) typetoken ::= typename LP signed COMMA signed RP */
   -2,  /* (27) typename ::= typename ID|STRING */
    0,  /* (28) scanpt ::= */
   -2,  /* (29) ccons ::= CONSTRAINT nm */
   -4,  /* (30) ccons ::= DEFAULT scanpt term scanpt */
   -4,  /* (31) ccons ::= DEFAULT LP expr RP */
   -4,  /* (32) ccons ::= DEFAULT PLUS term scanpt */
   -4,  /* (33) ccons ::= DEFAULT MINUS term scanpt */
   -3,  /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */
   -3,  /* (35) ccons ::= NOT NULL onconf */
   -5,  /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */
   -2,  /* (37) ccons ::= UNIQUE onconf */
   -4,  /* (38) ccons ::= CHECK LP expr RP */
   -4,  /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */
   -1,  /* (40) ccons ::= defer_subclause */
   -2,  /* (41) ccons ::= COLLATE ID|STRING */
    0,  /* (42) autoinc ::= */
   -1,  /* (43) autoinc ::= AUTOINCR */
    0,  /* (44) refargs ::= */
   -2,  /* (45) refargs ::= refargs refarg */
   -2,  /* (46) refarg ::= MATCH nm */
   -3,  /* (47) refarg ::= ON INSERT refact */
   -3,  /* (48) refarg ::= ON DELETE refact */
   -3,  /* (49) refarg ::= ON UPDATE refact */
   -2,  /* (50) refact ::= SET NULL */
   -2,  /* (51) refact ::= SET DEFAULT */
   -1,  /* (52) refact ::= CASCADE */
   -1,  /* (53) refact ::= RESTRICT */
   -2,  /* (54) refact ::= NO ACTION */
   -3,  /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
   -2,  /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
    0,  /* (57) init_deferred_pred_opt ::= */
   -2,  /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */
   -2,  /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
    0,  /* (60) conslist_opt ::= */
   -1,  /* (61) tconscomma ::= COMMA */
   -2,  /* (62) tcons ::= CONSTRAINT nm */
   -7,  /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
   -5,  /* (64) tcons ::= UNIQUE LP sortlist RP onconf */
   -5,  /* (65) tcons ::= CHECK LP expr RP onconf */
  -10,  /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
    0,  /* (67) defer_subclause_opt ::= */
    0,  /* (68) onconf ::= */
   -3,  /* (69) onconf ::= ON CONFLICT resolvetype */
    0,  /* (70) orconf ::= */
   -2,  /* (71) orconf ::= OR resolvetype */
   -1,  /* (72) resolvetype ::= IGNORE */
   -1,  /* (73) resolvetype ::= REPLACE */
   -4,  /* (74) cmd ::= DROP TABLE ifexists fullname */
   -2,  /* (75) ifexists ::= IF EXISTS */
    0,  /* (76) ifexists ::= */
   -9,  /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
   -4,  /* (78) cmd ::= DROP VIEW ifexists fullname */
   -1,  /* (79) cmd ::= select */
   -3,  /* (80) select ::= WITH wqlist selectnowith */
   -4,  /* (81) select ::= WITH RECURSIVE wqlist selectnowith */
   -1,  /* (82) select ::= selectnowith */
   -3,  /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
   -1,  /* (84) multiselect_op ::= UNION */
   -2,  /* (85) multiselect_op ::= UNION ALL */
   -1,  /* (86) multiselect_op ::= EXCEPT|INTERSECT */
   -9,  /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
  -10,  /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
   -4,  /* (89) values ::= VALUES LP nexprlist RP */
   -5,  /* (90) values ::= values COMMA LP nexprlist RP */
    0,  /* (29) scantok ::= */
   -2,  /* (30) ccons ::= CONSTRAINT nm */
   -3,  /* (31) ccons ::= DEFAULT scantok term */
   -4,  /* (32) ccons ::= DEFAULT LP expr RP */
   -4,  /* (33) ccons ::= DEFAULT PLUS scantok term */
   -4,  /* (34) ccons ::= DEFAULT MINUS scantok term */
   -3,  /* (35) ccons ::= DEFAULT scantok ID|INDEXED */
   -3,  /* (36) ccons ::= NOT NULL onconf */
   -5,  /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */
   -2,  /* (38) ccons ::= UNIQUE onconf */
   -4,  /* (39) ccons ::= CHECK LP expr RP */
   -4,  /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */
   -1,  /* (41) ccons ::= defer_subclause */
   -2,  /* (42) ccons ::= COLLATE ID|STRING */
    0,  /* (43) autoinc ::= */
   -1,  /* (44) autoinc ::= AUTOINCR */
    0,  /* (45) refargs ::= */
   -2,  /* (46) refargs ::= refargs refarg */
   -2,  /* (47) refarg ::= MATCH nm */
   -3,  /* (48) refarg ::= ON INSERT refact */
   -3,  /* (49) refarg ::= ON DELETE refact */
   -3,  /* (50) refarg ::= ON UPDATE refact */
   -2,  /* (51) refact ::= SET NULL */
   -2,  /* (52) refact ::= SET DEFAULT */
   -1,  /* (53) refact ::= CASCADE */
   -1,  /* (54) refact ::= RESTRICT */
   -2,  /* (55) refact ::= NO ACTION */
   -3,  /* (56) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
   -2,  /* (57) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
    0,  /* (58) init_deferred_pred_opt ::= */
   -2,  /* (59) init_deferred_pred_opt ::= INITIALLY DEFERRED */
   -2,  /* (60) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
    0,  /* (61) conslist_opt ::= */
   -1,  /* (62) tconscomma ::= COMMA */
   -2,  /* (63) tcons ::= CONSTRAINT nm */
   -7,  /* (64) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
   -5,  /* (65) tcons ::= UNIQUE LP sortlist RP onconf */
   -5,  /* (66) tcons ::= CHECK LP expr RP onconf */
  -10,  /* (67) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
    0,  /* (68) defer_subclause_opt ::= */
    0,  /* (69) onconf ::= */
   -3,  /* (70) onconf ::= ON CONFLICT resolvetype */
    0,  /* (71) orconf ::= */
   -2,  /* (72) orconf ::= OR resolvetype */
   -1,  /* (73) resolvetype ::= IGNORE */
   -1,  /* (74) resolvetype ::= REPLACE */
   -4,  /* (75) cmd ::= DROP TABLE ifexists fullname */
   -2,  /* (76) ifexists ::= IF EXISTS */
    0,  /* (77) ifexists ::= */
   -9,  /* (78) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
   -4,  /* (79) cmd ::= DROP VIEW ifexists fullname */
   -1,  /* (80) cmd ::= select */
   -3,  /* (81) select ::= WITH wqlist selectnowith */
   -4,  /* (82) select ::= WITH RECURSIVE wqlist selectnowith */
   -1,  /* (83) select ::= selectnowith */
   -3,  /* (84) selectnowith ::= selectnowith multiselect_op oneselect */
   -1,  /* (85) multiselect_op ::= UNION */
   -2,  /* (86) multiselect_op ::= UNION ALL */
   -1,  /* (87) multiselect_op ::= EXCEPT|INTERSECT */
   -9,  /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
  -10,  /* (89) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
   -4,  /* (90) values ::= VALUES LP nexprlist RP */
   -5,  /* (91) values ::= values COMMA LP nexprlist RP */
   -1,  /* (91) distinct ::= DISTINCT */
   -1,  /* (92) distinct ::= ALL */
    0,  /* (93) distinct ::= */
    0,  /* (94) sclp ::= */
   -5,  /* (95) selcollist ::= sclp scanpt expr scanpt as */
   -3,  /* (96) selcollist ::= sclp scanpt STAR */
   -5,  /* (97) selcollist ::= sclp scanpt nm DOT STAR */
   -2,  /* (98) as ::= AS nm */
    0,  /* (99) as ::= */
    0,  /* (100) from ::= */
   -2,  /* (101) from ::= FROM seltablist */
   -2,  /* (102) stl_prefix ::= seltablist joinop */
    0,  /* (103) stl_prefix ::= */
   -7,  /* (104) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
   -9,  /* (105) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
   -7,  /* (106) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
   -7,  /* (107) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
    0,  /* (108) dbnm ::= */
   -2,  /* (109) dbnm ::= DOT nm */
   -1,  /* (110) fullname ::= nm */
   -3,  /* (111) fullname ::= nm DOT nm */
   -1,  /* (112) xfullname ::= nm */
   -3,  /* (113) xfullname ::= nm DOT nm */
   -5,  /* (114) xfullname ::= nm DOT nm AS nm */
   -3,  /* (115) xfullname ::= nm AS nm */
   -1,  /* (116) joinop ::= COMMA|JOIN */
   -2,  /* (117) joinop ::= JOIN_KW JOIN */
   -3,  /* (118) joinop ::= JOIN_KW nm JOIN */
   -4,  /* (119) joinop ::= JOIN_KW nm nm JOIN */
   -2,  /* (120) on_opt ::= ON expr */
    0,  /* (121) on_opt ::= */
    0,  /* (122) indexed_opt ::= */
   -3,  /* (123) indexed_opt ::= INDEXED BY nm */
   -2,  /* (124) indexed_opt ::= NOT INDEXED */
   -4,  /* (125) using_opt ::= USING LP idlist RP */
    0,  /* (126) using_opt ::= */
    0,  /* (127) orderby_opt ::= */
   -3,  /* (128) orderby_opt ::= ORDER BY sortlist */
   -4,  /* (129) sortlist ::= sortlist COMMA expr sortorder */
   -2,  /* (130) sortlist ::= expr sortorder */
   -1,  /* (131) sortorder ::= ASC */
   -1,  /* (132) sortorder ::= DESC */
    0,  /* (133) sortorder ::= */
    0,  /* (134) groupby_opt ::= */
   -3,  /* (135) groupby_opt ::= GROUP BY nexprlist */
    0,  /* (136) having_opt ::= */
   -2,  /* (137) having_opt ::= HAVING expr */
    0,  /* (138) limit_opt ::= */
   -2,  /* (139) limit_opt ::= LIMIT expr */
   -4,  /* (140) limit_opt ::= LIMIT expr OFFSET expr */
   -4,  /* (141) limit_opt ::= LIMIT expr COMMA expr */
   -6,  /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
    0,  /* (143) where_opt ::= */
   -2,  /* (144) where_opt ::= WHERE expr */
   -8,  /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
   -5,  /* (146) setlist ::= setlist COMMA nm EQ expr */
   -7,  /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */
   -3,  /* (148) setlist ::= nm EQ expr */
   -5,  /* (149) setlist ::= LP idlist RP EQ expr */
   -7,  /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
   -7,  /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
    0,  /* (152) upsert ::= */
  -11,  /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
   -8,  /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
   -4,  /* (155) upsert ::= ON CONFLICT DO NOTHING */
   -2,  /* (156) insert_cmd ::= INSERT orconf */
   -1,  /* (157) insert_cmd ::= REPLACE */
    0,  /* (158) idlist_opt ::= */
   -3,  /* (159) idlist_opt ::= LP idlist RP */
   -3,  /* (160) idlist ::= idlist COMMA nm */
   -1,  /* (161) idlist ::= nm */
   -3,  /* (162) expr ::= LP expr RP */
   -1,  /* (163) expr ::= ID|INDEXED */
   -1,  /* (164) expr ::= JOIN_KW */
   -3,  /* (165) expr ::= nm DOT nm */
   -5,  /* (166) expr ::= nm DOT nm DOT nm */
   -1,  /* (167) term ::= NULL|FLOAT|BLOB */
   -1,  /* (168) term ::= STRING */
   -1,  /* (169) term ::= INTEGER */
   -1,  /* (170) expr ::= VARIABLE */
   -3,  /* (171) expr ::= expr COLLATE ID|STRING */
   -6,  /* (172) expr ::= CAST LP expr AS typetoken RP */
   -5,  /* (173) expr ::= ID|INDEXED LP distinct exprlist RP */
   -4,  /* (174) expr ::= ID|INDEXED LP STAR RP */
   -6,  /* (175) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
   -5,  /* (176) expr ::= ID|INDEXED LP STAR RP over_clause */
   -1,  /* (177) term ::= CTIME_KW */
   -5,  /* (178) expr ::= LP nexprlist COMMA expr RP */
   -1,  /* (92) distinct ::= DISTINCT */
   -1,  /* (93) distinct ::= ALL */
    0,  /* (94) distinct ::= */
    0,  /* (95) sclp ::= */
   -5,  /* (96) selcollist ::= sclp scanpt expr scanpt as */
   -3,  /* (97) selcollist ::= sclp scanpt STAR */
   -5,  /* (98) selcollist ::= sclp scanpt nm DOT STAR */
   -2,  /* (99) as ::= AS nm */
    0,  /* (100) as ::= */
    0,  /* (101) from ::= */
   -2,  /* (102) from ::= FROM seltablist */
   -2,  /* (103) stl_prefix ::= seltablist joinop */
    0,  /* (104) stl_prefix ::= */
   -7,  /* (105) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
   -9,  /* (106) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
   -7,  /* (107) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
   -7,  /* (108) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
    0,  /* (109) dbnm ::= */
   -2,  /* (110) dbnm ::= DOT nm */
   -1,  /* (111) fullname ::= nm */
   -3,  /* (112) fullname ::= nm DOT nm */
   -1,  /* (113) xfullname ::= nm */
   -3,  /* (114) xfullname ::= nm DOT nm */
   -5,  /* (115) xfullname ::= nm DOT nm AS nm */
   -3,  /* (116) xfullname ::= nm AS nm */
   -1,  /* (117) joinop ::= COMMA|JOIN */
   -2,  /* (118) joinop ::= JOIN_KW JOIN */
   -3,  /* (119) joinop ::= JOIN_KW nm JOIN */
   -4,  /* (120) joinop ::= JOIN_KW nm nm JOIN */
   -2,  /* (121) on_opt ::= ON expr */
    0,  /* (122) on_opt ::= */
    0,  /* (123) indexed_opt ::= */
   -3,  /* (124) indexed_opt ::= INDEXED BY nm */
   -2,  /* (125) indexed_opt ::= NOT INDEXED */
   -4,  /* (126) using_opt ::= USING LP idlist RP */
    0,  /* (127) using_opt ::= */
    0,  /* (128) orderby_opt ::= */
   -3,  /* (129) orderby_opt ::= ORDER BY sortlist */
   -4,  /* (130) sortlist ::= sortlist COMMA expr sortorder */
   -2,  /* (131) sortlist ::= expr sortorder */
   -1,  /* (132) sortorder ::= ASC */
   -1,  /* (133) sortorder ::= DESC */
    0,  /* (134) sortorder ::= */
    0,  /* (135) groupby_opt ::= */
   -3,  /* (136) groupby_opt ::= GROUP BY nexprlist */
    0,  /* (137) having_opt ::= */
   -2,  /* (138) having_opt ::= HAVING expr */
    0,  /* (139) limit_opt ::= */
   -2,  /* (140) limit_opt ::= LIMIT expr */
   -4,  /* (141) limit_opt ::= LIMIT expr OFFSET expr */
   -4,  /* (142) limit_opt ::= LIMIT expr COMMA expr */
   -6,  /* (143) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
    0,  /* (144) where_opt ::= */
   -2,  /* (145) where_opt ::= WHERE expr */
   -8,  /* (146) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
   -5,  /* (147) setlist ::= setlist COMMA nm EQ expr */
   -7,  /* (148) setlist ::= setlist COMMA LP idlist RP EQ expr */
   -3,  /* (149) setlist ::= nm EQ expr */
   -5,  /* (150) setlist ::= LP idlist RP EQ expr */
   -7,  /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
   -7,  /* (152) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
    0,  /* (153) upsert ::= */
  -11,  /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
   -8,  /* (155) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
   -4,  /* (156) upsert ::= ON CONFLICT DO NOTHING */
   -2,  /* (157) insert_cmd ::= INSERT orconf */
   -1,  /* (158) insert_cmd ::= REPLACE */
    0,  /* (159) idlist_opt ::= */
   -3,  /* (160) idlist_opt ::= LP idlist RP */
   -3,  /* (161) idlist ::= idlist COMMA nm */
   -1,  /* (162) idlist ::= nm */
   -3,  /* (163) expr ::= LP expr RP */
   -1,  /* (164) expr ::= ID|INDEXED */
   -1,  /* (165) expr ::= JOIN_KW */
   -3,  /* (166) expr ::= nm DOT nm */
   -5,  /* (167) expr ::= nm DOT nm DOT nm */
   -1,  /* (168) term ::= NULL|FLOAT|BLOB */
   -1,  /* (169) term ::= STRING */
   -1,  /* (170) term ::= INTEGER */
   -1,  /* (171) expr ::= VARIABLE */
   -3,  /* (172) expr ::= expr COLLATE ID|STRING */
   -6,  /* (173) expr ::= CAST LP expr AS typetoken RP */
   -5,  /* (174) expr ::= ID|INDEXED LP distinct exprlist RP */
   -4,  /* (175) expr ::= ID|INDEXED LP STAR RP */
   -6,  /* (176) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
   -5,  /* (177) expr ::= ID|INDEXED LP STAR RP over_clause */
   -1,  /* (178) term ::= CTIME_KW */
   -5,  /* (179) expr ::= LP nexprlist COMMA expr RP */
   -3,  /* (179) expr ::= expr AND expr */
   -3,  /* (180) expr ::= expr OR expr */
   -3,  /* (181) expr ::= expr LT|GT|GE|LE expr */
   -3,  /* (182) expr ::= expr EQ|NE expr */
   -3,  /* (183) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
   -3,  /* (184) expr ::= expr PLUS|MINUS expr */
   -3,  /* (185) expr ::= expr STAR|SLASH|REM expr */
   -3,  /* (186) expr ::= expr CONCAT expr */
   -2,  /* (187) likeop ::= NOT LIKE_KW|MATCH */
   -3,  /* (188) expr ::= expr likeop expr */
   -5,  /* (189) expr ::= expr likeop expr ESCAPE expr */
   -2,  /* (190) expr ::= expr ISNULL|NOTNULL */
   -3,  /* (191) expr ::= expr NOT NULL */
   -3,  /* (192) expr ::= expr IS expr */
   -4,  /* (193) expr ::= expr IS NOT expr */
   -2,  /* (194) expr ::= NOT expr */
   -2,  /* (195) expr ::= BITNOT expr */
   -2,  /* (196) expr ::= PLUS|MINUS expr */
   -1,  /* (197) between_op ::= BETWEEN */
   -2,  /* (198) between_op ::= NOT BETWEEN */
   -5,  /* (199) expr ::= expr between_op expr AND expr */
   -1,  /* (200) in_op ::= IN */
   -2,  /* (201) in_op ::= NOT IN */
   -5,  /* (202) expr ::= expr in_op LP exprlist RP */
   -3,  /* (203) expr ::= LP select RP */
   -5,  /* (204) expr ::= expr in_op LP select RP */
   -5,  /* (205) expr ::= expr in_op nm dbnm paren_exprlist */
   -4,  /* (206) expr ::= EXISTS LP select RP */
   -5,  /* (207) expr ::= CASE case_operand case_exprlist case_else END */
   -5,  /* (208) case_exprlist ::= case_exprlist WHEN expr THEN expr */
   -4,  /* (209) case_exprlist ::= WHEN expr THEN expr */
   -2,  /* (210) case_else ::= ELSE expr */
    0,  /* (211) case_else ::= */
   -1,  /* (212) case_operand ::= expr */
    0,  /* (213) case_operand ::= */
    0,  /* (214) exprlist ::= */
   -3,  /* (215) nexprlist ::= nexprlist COMMA expr */
   -1,  /* (216) nexprlist ::= expr */
    0,  /* (217) paren_exprlist ::= */
   -3,  /* (218) paren_exprlist ::= LP exprlist RP */
  -12,  /* (219) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
   -1,  /* (220) uniqueflag ::= UNIQUE */
    0,  /* (221) uniqueflag ::= */
   -3,  /* (180) expr ::= expr AND expr */
   -3,  /* (181) expr ::= expr OR expr */
   -3,  /* (182) expr ::= expr LT|GT|GE|LE expr */
   -3,  /* (183) expr ::= expr EQ|NE expr */
   -3,  /* (184) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
   -3,  /* (185) expr ::= expr PLUS|MINUS expr */
   -3,  /* (186) expr ::= expr STAR|SLASH|REM expr */
   -3,  /* (187) expr ::= expr CONCAT expr */
   -2,  /* (188) likeop ::= NOT LIKE_KW|MATCH */
   -3,  /* (189) expr ::= expr likeop expr */
   -5,  /* (190) expr ::= expr likeop expr ESCAPE expr */
   -2,  /* (191) expr ::= expr ISNULL|NOTNULL */
   -3,  /* (192) expr ::= expr NOT NULL */
   -3,  /* (193) expr ::= expr IS expr */
   -4,  /* (194) expr ::= expr IS NOT expr */
   -2,  /* (195) expr ::= NOT expr */
   -2,  /* (196) expr ::= BITNOT expr */
   -2,  /* (197) expr ::= PLUS|MINUS expr */
   -1,  /* (198) between_op ::= BETWEEN */
   -2,  /* (199) between_op ::= NOT BETWEEN */
   -5,  /* (200) expr ::= expr between_op expr AND expr */
   -1,  /* (201) in_op ::= IN */
   -2,  /* (202) in_op ::= NOT IN */
   -5,  /* (203) expr ::= expr in_op LP exprlist RP */
   -3,  /* (204) expr ::= LP select RP */
   -5,  /* (205) expr ::= expr in_op LP select RP */
   -5,  /* (206) expr ::= expr in_op nm dbnm paren_exprlist */
   -4,  /* (207) expr ::= EXISTS LP select RP */
   -5,  /* (208) expr ::= CASE case_operand case_exprlist case_else END */
   -5,  /* (209) case_exprlist ::= case_exprlist WHEN expr THEN expr */
   -4,  /* (210) case_exprlist ::= WHEN expr THEN expr */
   -2,  /* (211) case_else ::= ELSE expr */
    0,  /* (212) case_else ::= */
   -1,  /* (213) case_operand ::= expr */
    0,  /* (214) case_operand ::= */
    0,  /* (215) exprlist ::= */
   -3,  /* (216) nexprlist ::= nexprlist COMMA expr */
   -1,  /* (217) nexprlist ::= expr */
    0,  /* (218) paren_exprlist ::= */
   -3,  /* (219) paren_exprlist ::= LP exprlist RP */
  -12,  /* (220) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
   -1,  /* (221) uniqueflag ::= UNIQUE */
    0,  /* (222) uniqueflag ::= */
    0,  /* (222) eidlist_opt ::= */
   -3,  /* (223) eidlist_opt ::= LP eidlist RP */
   -5,  /* (224) eidlist ::= eidlist COMMA nm collate sortorder */
   -3,  /* (225) eidlist ::= nm collate sortorder */
    0,  /* (226) collate ::= */
   -2,  /* (227) collate ::= COLLATE ID|STRING */
   -4,  /* (228) cmd ::= DROP INDEX ifexists fullname */
   -2,  /* (229) cmd ::= VACUUM vinto */
   -3,  /* (230) cmd ::= VACUUM nm vinto */
   -2,  /* (231) vinto ::= INTO expr */
    0,  /* (232) vinto ::= */
   -3,  /* (233) cmd ::= PRAGMA nm dbnm */
   -5,  /* (234) cmd ::= PRAGMA nm dbnm EQ nmnum */
   -6,  /* (235) cmd ::= PRAGMA nm dbnm LP nmnum RP */
   -5,  /* (236) cmd ::= PRAGMA nm dbnm EQ minus_num */
   -6,  /* (237) cmd ::= PRAGMA nm dbnm LP minus_num RP */
   -2,  /* (238) plus_num ::= PLUS INTEGER|FLOAT */
   -2,  /* (239) minus_num ::= MINUS INTEGER|FLOAT */
   -5,  /* (240) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
  -11,  /* (241) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
   -1,  /* (242) trigger_time ::= BEFORE|AFTER */
   -2,  /* (243) trigger_time ::= INSTEAD OF */
    0,  /* (244) trigger_time ::= */
   -1,  /* (245) trigger_event ::= DELETE|INSERT */
   -1,  /* (246) trigger_event ::= UPDATE */
   -3,  /* (247) trigger_event ::= UPDATE OF idlist */
    0,  /* (248) when_clause ::= */
   -2,  /* (249) when_clause ::= WHEN expr */
   -3,  /* (250) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
   -2,  /* (251) trigger_cmd_list ::= trigger_cmd SEMI */
   -3,  /* (252) trnm ::= nm DOT nm */
   -3,  /* (253) tridxby ::= INDEXED BY nm */
   -2,  /* (254) tridxby ::= NOT INDEXED */
   -8,  /* (255) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
   -8,  /* (256) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
   -6,  /* (257) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
   -3,  /* (258) trigger_cmd ::= scanpt select scanpt */
   -4,  /* (259) expr ::= RAISE LP IGNORE RP */
   -6,  /* (260) expr ::= RAISE LP raisetype COMMA nm RP */
   -1,  /* (261) raisetype ::= ROLLBACK */
   -1,  /* (262) raisetype ::= ABORT */
   -1,  /* (263) raisetype ::= FAIL */
   -4,  /* (264) cmd ::= DROP TRIGGER ifexists fullname */
   -6,  /* (265) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
   -3,  /* (266) cmd ::= DETACH database_kw_opt expr */
    0,  /* (267) key_opt ::= */
   -2,  /* (268) key_opt ::= KEY expr */
   -1,  /* (269) cmd ::= REINDEX */
   -3,  /* (270) cmd ::= REINDEX nm dbnm */
   -1,  /* (271) cmd ::= ANALYZE */
   -3,  /* (272) cmd ::= ANALYZE nm dbnm */
   -6,  /* (273) cmd ::= ALTER TABLE fullname RENAME TO nm */
   -7,  /* (274) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
   -1,  /* (275) add_column_fullname ::= fullname */
   -8,  /* (276) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
   -1,  /* (277) cmd ::= create_vtab */
   -4,  /* (278) cmd ::= create_vtab LP vtabarglist RP */
   -8,  /* (279) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
    0,  /* (280) vtabarg ::= */
   -1,  /* (281) vtabargtoken ::= ANY */
   -3,  /* (282) vtabargtoken ::= lp anylist RP */
   -1,  /* (283) lp ::= LP */
   -2,  /* (284) with ::= WITH wqlist */
   -3,  /* (285) with ::= WITH RECURSIVE wqlist */
   -6,  /* (286) wqlist ::= nm eidlist_opt AS LP select RP */
   -8,  /* (287) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
   -1,  /* (288) windowdefn_list ::= windowdefn */
   -3,  /* (289) windowdefn_list ::= windowdefn_list COMMA windowdefn */
   -5,  /* (290) windowdefn ::= nm AS LP window RP */
   -5,  /* (291) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
   -6,  /* (292) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
   -4,  /* (293) window ::= ORDER BY sortlist frame_opt */
   -5,  /* (294) window ::= nm ORDER BY sortlist frame_opt */
   -1,  /* (295) window ::= frame_opt */
   -2,  /* (296) window ::= nm frame_opt */
    0,  /* (297) frame_opt ::= */
   -3,  /* (298) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
   -6,  /* (299) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
   -1,  /* (300) range_or_rows ::= RANGE|ROWS|GROUPS */
   -1,  /* (301) frame_bound_s ::= frame_bound */
   -2,  /* (302) frame_bound_s ::= UNBOUNDED PRECEDING */
   -1,  /* (303) frame_bound_e ::= frame_bound */
   -2,  /* (304) frame_bound_e ::= UNBOUNDED FOLLOWING */
   -2,  /* (305) frame_bound ::= expr PRECEDING|FOLLOWING */
   -2,  /* (306) frame_bound ::= CURRENT ROW */
    0,  /* (307) frame_exclude_opt ::= */
   -2,  /* (308) frame_exclude_opt ::= EXCLUDE frame_exclude */
    0,  /* (223) eidlist_opt ::= */
   -3,  /* (224) eidlist_opt ::= LP eidlist RP */
   -5,  /* (225) eidlist ::= eidlist COMMA nm collate sortorder */
   -3,  /* (226) eidlist ::= nm collate sortorder */
    0,  /* (227) collate ::= */
   -2,  /* (228) collate ::= COLLATE ID|STRING */
   -4,  /* (229) cmd ::= DROP INDEX ifexists fullname */
   -2,  /* (230) cmd ::= VACUUM vinto */
   -3,  /* (231) cmd ::= VACUUM nm vinto */
   -2,  /* (232) vinto ::= INTO expr */
    0,  /* (233) vinto ::= */
   -3,  /* (234) cmd ::= PRAGMA nm dbnm */
   -5,  /* (235) cmd ::= PRAGMA nm dbnm EQ nmnum */
   -6,  /* (236) cmd ::= PRAGMA nm dbnm LP nmnum RP */
   -5,  /* (237) cmd ::= PRAGMA nm dbnm EQ minus_num */
   -6,  /* (238) cmd ::= PRAGMA nm dbnm LP minus_num RP */
   -2,  /* (239) plus_num ::= PLUS INTEGER|FLOAT */
   -2,  /* (240) minus_num ::= MINUS INTEGER|FLOAT */
   -5,  /* (241) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
  -11,  /* (242) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
   -1,  /* (243) trigger_time ::= BEFORE|AFTER */
   -2,  /* (244) trigger_time ::= INSTEAD OF */
    0,  /* (245) trigger_time ::= */
   -1,  /* (246) trigger_event ::= DELETE|INSERT */
   -1,  /* (247) trigger_event ::= UPDATE */
   -3,  /* (248) trigger_event ::= UPDATE OF idlist */
    0,  /* (249) when_clause ::= */
   -2,  /* (250) when_clause ::= WHEN expr */
   -3,  /* (251) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
   -2,  /* (252) trigger_cmd_list ::= trigger_cmd SEMI */
   -3,  /* (253) trnm ::= nm DOT nm */
   -3,  /* (254) tridxby ::= INDEXED BY nm */
   -2,  /* (255) tridxby ::= NOT INDEXED */
   -8,  /* (256) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
   -8,  /* (257) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
   -6,  /* (258) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
   -3,  /* (259) trigger_cmd ::= scanpt select scanpt */
   -4,  /* (260) expr ::= RAISE LP IGNORE RP */
   -6,  /* (261) expr ::= RAISE LP raisetype COMMA nm RP */
   -1,  /* (262) raisetype ::= ROLLBACK */
   -1,  /* (263) raisetype ::= ABORT */
   -1,  /* (264) raisetype ::= FAIL */
   -4,  /* (265) cmd ::= DROP TRIGGER ifexists fullname */
   -6,  /* (266) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
   -3,  /* (267) cmd ::= DETACH database_kw_opt expr */
    0,  /* (268) key_opt ::= */
   -2,  /* (269) key_opt ::= KEY expr */
   -1,  /* (270) cmd ::= REINDEX */
   -3,  /* (271) cmd ::= REINDEX nm dbnm */
   -1,  /* (272) cmd ::= ANALYZE */
   -3,  /* (273) cmd ::= ANALYZE nm dbnm */
   -6,  /* (274) cmd ::= ALTER TABLE fullname RENAME TO nm */
   -7,  /* (275) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
   -1,  /* (276) add_column_fullname ::= fullname */
   -8,  /* (277) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
   -1,  /* (278) cmd ::= create_vtab */
   -4,  /* (279) cmd ::= create_vtab LP vtabarglist RP */
   -8,  /* (280) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
    0,  /* (281) vtabarg ::= */
   -1,  /* (282) vtabargtoken ::= ANY */
   -3,  /* (283) vtabargtoken ::= lp anylist RP */
   -1,  /* (284) lp ::= LP */
   -2,  /* (285) with ::= WITH wqlist */
   -3,  /* (286) with ::= WITH RECURSIVE wqlist */
   -6,  /* (287) wqlist ::= nm eidlist_opt AS LP select RP */
   -8,  /* (288) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
   -1,  /* (289) windowdefn_list ::= windowdefn */
   -3,  /* (290) windowdefn_list ::= windowdefn_list COMMA windowdefn */
   -5,  /* (291) windowdefn ::= nm AS LP window RP */
   -5,  /* (292) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
   -6,  /* (293) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
   -4,  /* (294) window ::= ORDER BY sortlist frame_opt */
   -5,  /* (295) window ::= nm ORDER BY sortlist frame_opt */
   -1,  /* (296) window ::= frame_opt */
   -2,  /* (297) window ::= nm frame_opt */
    0,  /* (298) frame_opt ::= */
   -3,  /* (299) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
   -6,  /* (300) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
   -1,  /* (301) range_or_rows ::= RANGE|ROWS|GROUPS */
   -1,  /* (302) frame_bound_s ::= frame_bound */
   -2,  /* (303) frame_bound_s ::= UNBOUNDED PRECEDING */
   -1,  /* (304) frame_bound_e ::= frame_bound */
   -2,  /* (305) frame_bound_e ::= UNBOUNDED FOLLOWING */
   -2,  /* (306) frame_bound ::= expr PRECEDING|FOLLOWING */
   -2,  /* (307) frame_bound ::= CURRENT ROW */
    0,  /* (308) frame_exclude_opt ::= */
   -2,  /* (309) frame_exclude_opt ::= EXCLUDE frame_exclude */
   -2,  /* (309) frame_exclude ::= NO OTHERS */
   -2,  /* (310) frame_exclude ::= CURRENT ROW */
   -1,  /* (311) frame_exclude ::= GROUP|TIES */
   -2,  /* (312) window_clause ::= WINDOW windowdefn_list */
   -5,  /* (313) over_clause ::= filter_opt OVER LP window RP */
   -3,  /* (314) over_clause ::= filter_opt OVER nm */
    0,  /* (315) filter_opt ::= */
   -5,  /* (316) filter_opt ::= FILTER LP WHERE expr RP */
   -1,  /* (317) input ::= cmdlist */
   -2,  /* (318) cmdlist ::= cmdlist ecmd */
   -1,  /* (319) cmdlist ::= ecmd */
   -1,  /* (320) ecmd ::= SEMI */
   -2,  /* (321) ecmd ::= cmdx SEMI */
   -2,  /* (322) ecmd ::= explain cmdx */
    0,  /* (323) trans_opt ::= */
   -1,  /* (324) trans_opt ::= TRANSACTION */
   -2,  /* (325) trans_opt ::= TRANSACTION nm */
   -1,  /* (326) savepoint_opt ::= SAVEPOINT */
    0,  /* (327) savepoint_opt ::= */
   -2,  /* (328) cmd ::= create_table create_table_args */
   -4,  /* (329) columnlist ::= columnlist COMMA columnname carglist */
   -2,  /* (330) columnlist ::= columnname carglist */
   -2,  /* (310) frame_exclude ::= NO OTHERS */
   -2,  /* (311) frame_exclude ::= CURRENT ROW */
   -1,  /* (312) frame_exclude ::= GROUP|TIES */
   -2,  /* (313) window_clause ::= WINDOW windowdefn_list */
   -5,  /* (314) over_clause ::= filter_opt OVER LP window RP */
   -3,  /* (315) over_clause ::= filter_opt OVER nm */
    0,  /* (316) filter_opt ::= */
   -5,  /* (317) filter_opt ::= FILTER LP WHERE expr RP */
   -1,  /* (318) input ::= cmdlist */
   -2,  /* (319) cmdlist ::= cmdlist ecmd */
   -1,  /* (320) cmdlist ::= ecmd */
   -1,  /* (321) ecmd ::= SEMI */
   -2,  /* (322) ecmd ::= cmdx SEMI */
   -2,  /* (323) ecmd ::= explain cmdx */
    0,  /* (324) trans_opt ::= */
   -1,  /* (325) trans_opt ::= TRANSACTION */
   -2,  /* (326) trans_opt ::= TRANSACTION nm */
   -1,  /* (327) savepoint_opt ::= SAVEPOINT */
    0,  /* (328) savepoint_opt ::= */
   -2,  /* (329) cmd ::= create_table create_table_args */
   -4,  /* (330) columnlist ::= columnlist COMMA columnname carglist */
   -2,  /* (331) columnlist ::= columnname carglist */
   -1,  /* (331) nm ::= ID|INDEXED */
   -1,  /* (332) nm ::= STRING */
   -1,  /* (333) nm ::= JOIN_KW */
   -1,  /* (334) typetoken ::= typename */
   -1,  /* (335) typename ::= ID|STRING */
   -1,  /* (336) signed ::= plus_num */
   -1,  /* (337) signed ::= minus_num */
   -2,  /* (338) carglist ::= carglist ccons */
    0,  /* (339) carglist ::= */
   -2,  /* (340) ccons ::= NULL onconf */
   -2,  /* (341) conslist_opt ::= COMMA conslist */
   -3,  /* (342) conslist ::= conslist tconscomma tcons */
   -1,  /* (343) conslist ::= tcons */
    0,  /* (344) tconscomma ::= */
   -1,  /* (345) defer_subclause_opt ::= defer_subclause */
   -1,  /* (346) resolvetype ::= raisetype */
   -1,  /* (347) selectnowith ::= oneselect */
   -1,  /* (348) oneselect ::= values */
   -2,  /* (349) sclp ::= selcollist COMMA */
   -1,  /* (350) as ::= ID|STRING */
   -1,  /* (351) expr ::= term */
   -1,  /* (352) likeop ::= LIKE_KW|MATCH */
   -1,  /* (353) exprlist ::= nexprlist */
   -1,  /* (332) nm ::= ID|INDEXED */
   -1,  /* (333) nm ::= STRING */
   -1,  /* (334) nm ::= JOIN_KW */
   -1,  /* (335) typetoken ::= typename */
   -1,  /* (336) typename ::= ID|STRING */
   -1,  /* (337) signed ::= plus_num */
   -1,  /* (338) signed ::= minus_num */
   -2,  /* (339) carglist ::= carglist ccons */
    0,  /* (340) carglist ::= */
   -2,  /* (341) ccons ::= NULL onconf */
   -2,  /* (342) conslist_opt ::= COMMA conslist */
   -3,  /* (343) conslist ::= conslist tconscomma tcons */
   -1,  /* (344) conslist ::= tcons */
    0,  /* (345) tconscomma ::= */
   -1,  /* (346) defer_subclause_opt ::= defer_subclause */
   -1,  /* (347) resolvetype ::= raisetype */
   -1,  /* (348) selectnowith ::= oneselect */
   -1,  /* (349) oneselect ::= values */
   -2,  /* (350) sclp ::= selcollist COMMA */
   -1,  /* (351) as ::= ID|STRING */
   -1,  /* (352) expr ::= term */
   -1,  /* (353) likeop ::= LIKE_KW|MATCH */
   -1,  /* (354) exprlist ::= nexprlist */
   -1,  /* (354) nmnum ::= plus_num */
   -1,  /* (355) nmnum ::= nm */
   -1,  /* (356) nmnum ::= ON */
   -1,  /* (357) nmnum ::= DELETE */
   -1,  /* (358) nmnum ::= DEFAULT */
   -1,  /* (359) plus_num ::= INTEGER|FLOAT */
    0,  /* (360) foreach_clause ::= */
   -3,  /* (361) foreach_clause ::= FOR EACH ROW */
   -1,  /* (362) trnm ::= nm */
    0,  /* (363) tridxby ::= */
   -1,  /* (364) database_kw_opt ::= DATABASE */
    0,  /* (365) database_kw_opt ::= */
    0,  /* (366) kwcolumn_opt ::= */
   -1,  /* (367) kwcolumn_opt ::= COLUMNKW */
   -1,  /* (368) vtabarglist ::= vtabarg */
   -3,  /* (369) vtabarglist ::= vtabarglist COMMA vtabarg */
   -2,  /* (370) vtabarg ::= vtabarg vtabargtoken */
    0,  /* (371) anylist ::= */
   -4,  /* (372) anylist ::= anylist LP anylist RP */
   -2,  /* (373) anylist ::= anylist ANY */
    0,  /* (374) with ::= */
   -1,  /* (355) nmnum ::= plus_num */
   -1,  /* (356) nmnum ::= nm */
   -1,  /* (357) nmnum ::= ON */
   -1,  /* (358) nmnum ::= DELETE */
   -1,  /* (359) nmnum ::= DEFAULT */
   -1,  /* (360) plus_num ::= INTEGER|FLOAT */
    0,  /* (361) foreach_clause ::= */
   -3,  /* (362) foreach_clause ::= FOR EACH ROW */
   -1,  /* (363) trnm ::= nm */
    0,  /* (364) tridxby ::= */
   -1,  /* (365) database_kw_opt ::= DATABASE */
    0,  /* (366) database_kw_opt ::= */
    0,  /* (367) kwcolumn_opt ::= */
   -1,  /* (368) kwcolumn_opt ::= COLUMNKW */
   -1,  /* (369) vtabarglist ::= vtabarg */
   -3,  /* (370) vtabarglist ::= vtabarglist COMMA vtabarg */
   -2,  /* (371) vtabarg ::= vtabarg vtabargtoken */
    0,  /* (372) anylist ::= */
   -4,  /* (373) anylist ::= anylist LP anylist RP */
   -2,  /* (374) anylist ::= anylist ANY */
    0,  /* (375) with ::= */
};

static void yy_accept(yyParser*);  /* Forward Declaration */

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
151317
151318
151319
151320
151321
151322
151323
151324

151325
151326
151327

151328
151329
151330
151331
151332
151333


151334
151335
151336
151337
151338
151339
151340
151895
151896
151897
151898
151899
151900
151901

151902
151903
151904

151905
151906
151907
151908
151909


151910
151911
151912
151913
151914
151915
151916
151917
151918







-
+


-
+




-
-
+
+







      case 1: /* explain ::= EXPLAIN QUERY PLAN */
{ pParse->explain = 2; }
        break;
      case 2: /* cmdx ::= cmd */
{ sqlite3FinishCoding(pParse); }
        break;
      case 3: /* cmd ::= BEGIN transtype trans_opt */
{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy494);}
{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy100);}
        break;
      case 4: /* transtype ::= */
{yymsp[1].minor.yy494 = TK_DEFERRED;}
{yymsp[1].minor.yy100 = TK_DEFERRED;}
        break;
      case 5: /* transtype ::= DEFERRED */
      case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
      case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
      case 300: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==300);
{yymsp[0].minor.yy494 = yymsp[0].major; /*A-overwrites-X*/}
      case 301: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==301);
{yymsp[0].minor.yy100 = yymsp[0].major; /*A-overwrites-X*/}
        break;
      case 8: /* cmd ::= COMMIT|END trans_opt */
      case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
{sqlite3EndTransaction(pParse,yymsp[-1].major);}
        break;
      case 10: /* cmd ::= SAVEPOINT nm */
{
151349
151350
151351
151352
151353
151354
151355
151356

151357
151358
151359
151360
151361
151362
151363
151364
151365
151366
151367
151368
151369
151370
151371







151372
151373
151374

151375
151376
151377
151378


151379
151380
151381
151382

151383
151384
151385
151386
151387
151388


151389
151390
151391
151392
151393
151394

151395
151396

151397
151398
151399
151400
151401
151402
151403
151404
151405
151406


151407
151408
151409
151410
151411
151412
151413
151414
151415
151416
151417
151418
151419
151420
151421
151422
151423
151424
151425

151426
151427






151428
151429


151430
151431
151432
151433


151434
151435
151436


151437
151438
151439


151440
151441

151442
151443
151444


151445
151446
151447

151448
151449
151450
151451
151452
151453
151454
151455
151456
151457
151458


151459
151460
151461


151462
151463
151464


151465
151466
151467
151468


151469
151470
151471


151472
151473
151474


151475
151476

151477
151478
151479
151480


151481
151482
151483


151484
151485
151486


151487
151488
151489


151490
151491
151492


151493
151494
151495


151496
151497
151498


151499
151500
151501


151502
151503
151504


151505
151506
151507


151508
151509
151510


151511
151512
151513


151514
151515
151516
151517



151518
151519
151520
151521
151522
151523
151524
151525








151526
151527
151528


151529
151530

151531
151532
151533
151534


151535
151536
151537


151538
151539
151540
151541


151542
151543

151544
151545
151546


151547
151548
151549
151550
151551



151552
151553
151554


151555
151556
151557


151558
151559
151560
151561



151562
151563

151564
151565

151566
151567
151568

151569
151570

151571
151572
151573

151574
151575

151576
151577
151578

151579
151580
151581
151582


151583
151584
151585

151586
151587

151588
151589

151590
151591
151592

151593
151594

151595
151596
151597

151598
151599

151600
151601

151602
151603
151604

151605
151606

151607
151608
151609

151610
151611

151612
151613
151614
151615

151616
151617
151618

151619
151620
151621


151622
151623
151624
151625
151626
151627
151628
151629
151630
151631

151632
151633
151634
151635

151636
151637
151638
151639

151640
151641
151642
151643
151644



151645
151646
151647


151648
151649

151650
151651

151652
151653
151654

151655
151656
151657
151658



151659
151660

151661
151662
151663
151664

151665
151666

151667
151668
151669

151670
151671
151672


151673
151674
151675
151676
151677

151678
151679

151680
151681
151682
151683
151684


151685
151686
151687


151688
151689
151690
151691
151692
151693
151694
151695







151696
151697

151698
151699
151700
151701



151702
151703
151704

151705
151706
151707

151708
151709
151710

151711
151712
151713
151714
151715

151716
151717
151718
151719
151720
151721




151722
151723
151724
151725


151726
151727

151728
151729
151730


151731
151732
151733

151734
151735

151736
151737
151738
151739


151740
151741

151742
151743
151744


151745
151746
151747

151748
151749
151750


151751
151752
151753

151754
151755

151756
151757
151758

151759
151760
151761
151762
151763
151764
151765
151766







151767
151768
151769
151770
151771
151772
151773
151774
151775
151776
151777
151778
151779

151780
151781
151782
151783
151784



151785
151786
151787
151788
151789


151790
151791
151792

151793
151794
151795


151796
151797

151798
151799

151800
151801
151802


151803
151804

151805
151806
151807


151808
151809
151810


151811
151812

151813
151814
151815


151816
151817
151818

151819
151820
151821


151822
151823
151824
151825


151826
151827
151828


151829
151830
151831


151832
151833
151834


151835
151836
151837
151838
151839
151840
151841






151842
151843
151844
151845
151846
151847
151848
151849
151850








151851
151852

151853
151854
151855

151856
151857
151858
151859


151860
151861
151862
151863



151864
151865
151866
151867



151868
151869

151870
151871
151872


151873
151874
151875

151876
151877
151878


151879
151880
151881
151882


151883
151884
151885


151886
151887
151888


151889
151890
151891


151892
151893
151894


151895
151896
151897


151898
151899

151900
151901
151902


151903
151904
151905

151906
151907
151908
151909



151910
151911
151912

151913
151914
151915


151916
151917
151918

151919
151920

151921
151922
151923

151924
151925
151926


151927
151928

151929
151930

151931
151932

151933
151934
151935

151936
151937

151938
151939
151940

151941
151942

151943
151944
151945
151946


151947
151948
151949


151950
151951
151952


151953
151954
151955


151956
151957
151958


151959
151960
151961


151962
151963
151964


151965
151966
151967


151968
151969
151970
151971



151972
151973

151974
151975
151976
151977
151978
151979
151980
151981

151982
151983

151984
151985

151986
151987
151988
151989
151990
151991
151992
151993
151994
151995

151996
151997

151998
151999
152000
152001



152002
152003

152004
152005

152006
152007

152008
152009

152010
152011
152012
152013
152014


152015
152016
152017
152018
152019
152020
152021
152022
152023

152024
152025
152026


152027
152028
152029
152030
152031

152032
152033

152034
152035
152036

152037
152038
152039


152040
152041
152042

152043
152044

152045
152046

152047
152048

152049
152050

152051
152052

152053
152054

152055
152056
152057


152058
152059

152060
152061

152062
152063
152064


152065
152066

152067
152068

152069
152070

152071
152072

152073
152074

152075
152076
152077
152078
152079




152080
152081
152082
152083
152084
152085
152086
152087
152088
152089
152090
152091
152092
152093











152094
152095

152096
152097
152098

152099
152100
152101
152102
152103
152104
152105
152106
152107





152108
152109
152110

152111
152112
152113
152114
152115
152116
152117
152118
152119
152120






152121
152122
152123
152124


152125
152126
152127


152128
152129

152130
152131
152132


152133
152134
152135

152136
152137
152138


152139
152140
152141
152142
152143



152144
152145

152146
152147

152148
152149
152150
152151
152152
152153



152154
152155

152156
152157
152158
152159
152160
152161





152162
152163
152164
152165

152166
152167
152168

152169
152170

152171
152172
152173
152174
152175
152176
152177
152178
152179
152180
152181


152182
152183

152184
152185
152186
152187
152188
152189
152190
152191
152192
152193
152194
152195
152196
152197
152198
152199
152200
152201
152202



152203
152204
152205
152206
152207
152208
152209

152210
152211
152212
152213
152214




152215
152216

152217
152218

152219
152220
152221
152222

152223
152224
152225


152226
152227
152228

152229
152230
152231
152232



152233
152234
152235

152236
152237
152238
152239
152240
152241
152242




152243
152244
152245

152246
152247
152248
152249


152250
152251
152252

152253
152254
152255
152256
152257




152258
152259
152260


152261
152262
152263
152264

152265
152266
152267


152268
152269
152270

152271
152272
152273


152274
152275
152276
152277


152278
152279
152280


152281
152282
152283


152284
152285
152286
152287



152288
152289

152290
152291
152292
152293


152294
152295
152296
152297
152298
152299
152300
152301



152302
152303
152304


152305
152306

152307
152308

152309
152310
152311

152312
152313

152314
152315
152316
152317


152318
152319
152320


152321
152322
152323


152324
152325

152326
152327
152328

152329
152330
152331

152332
152333
152334

152335
152336
152337

152338
152339
152340

152341
152342
152343
152344
152345

152346
152347
152348

152349
152350

152351
152352
152353
152354
152355


152356
152357
152358


152359
152360
152361


152362
152363
152364
152365



152366
152367
152368


152369
152370
152371
152372
152373




152374
152375
152376
152377



152378
152379

152380
152381
152382
152383



152384
152385
152386

152387
152388
152389


152390
152391
152392

152393
152394
152395
152396
152397
152398
152399
152400

152401
152402
152403
152404
152405
152406
152407

152408
152409
152410
152411
152412
152413
152414
152415
152416



152417
152418

152419
152420

152421
152422

152423
152424
152425
152426



152427
152428
152429
152430



152431
152432

152433
152434
152435
152436



152437
152438
152439
152440

152441
152442
152443
152444



152445
152446
152447
152448
152449


152450
152451
152452


152453
152454

152455
152456

152457
152458
152459

152460
152461

152462
152463
152464

152465
152466

152467
152468
152469

152470
152471
152472

152473
152474
152475

152476
152477
152478

152479
152480
152481

152482
152483

152484
152485
152486

152487
152488
152489
152490
152491
152492

152493
152494
152495

152496
152497
152498

152499
152500

152501
152502
152503

152504
152505
152506

152507
152508
152509

152510
152511

152512
152513
152514

152515
152516
152517
152518
152519



152520
152521
152522
152523
152524



152525
152526

152527
152528

152529
152530
152531

152532
152533

152534
152535
152536
152537
152538



152539
152540

152541
152542
152543
152544
152545




152546
152547

152548
152549

152550
152551
152552


152553
152554

152555
152556

152557
152558

152559
152560

152561
152562
152563

152564
152565

152566
152567

152568
152569

152570
152571

152572
152573
152574

152575
152576

152577
152578

152579
152580

152581
152582

152583
152584

152585
152586

152587
152588

152589
152590

152591
152592

152593
152594

152595
152596
152597

152598
152599

152600
152601

152602
152603

152604
152605

152606
152607

152608
152609
152610
152611
152612




152613
152614
152615
152616
152617
152618





152619
152620
152621
152622



152623
152624
152625


152626
152627
152628


152629
152630
152631
152632



152633
152634
152635


152636
152637
152638


152639
152640

152641
152642
152643
152644



152645
152646

152647
152648

152649
152650
152651
152652
152653




152654
152655

152656
152657
152658

152659
152660
152661


152662
152663
152664
152665
152666
152667
152668
152669
152670
152671
152672
152673
152674
152675
152676
152677
152678
152679
152680
152681
152682
152683
152684
152685
152686
152687
152688
152689
152690
152691
152692
152693
152694
152695
152696
152697
152698
152699
152700
152701
152702
152703
152704
152705
152706
152707
152708
152709
152710
152711
152712
152713
152714
152715
152716
152717
152718
152719
152720
152721


























































152722
152723
152724
152725
152726
152727
152728
151927
151928
151929
151930
151931
151932
151933

151934
151935
151936
151937
151938
151939
151940
151941
151942







151943
151944
151945
151946
151947
151948
151949
151950
151951

151952
151953
151954


151955
151956
151957
151958
151959

151960
151961
151962
151963
151964


151965
151966
151967
151968
151969
151970
151971

151972
151973

151974
151975
151976
151977
151978
151979
151980
151981
151982


151983
151984
151985
151986
151987
151988
151989
151990
151991
151992
151993
151994
151995
151996
151997
151998
151999
152000
152001
152002

152003
152004
152005
152006
152007
152008
152009
152010
152011


152012
152013
152014
152015


152016
152017
152018


152019
152020
152021


152022
152023
152024

152025
152026


152027
152028
152029
152030

152031
152032
152033
152034
152035
152036
152037
152038
152039
152040


152041
152042
152043


152044
152045
152046


152047
152048
152049
152050


152051
152052
152053


152054
152055
152056


152057
152058
152059

152060
152061
152062


152063
152064
152065


152066
152067
152068


152069
152070
152071


152072
152073
152074


152075
152076
152077


152078
152079
152080


152081
152082
152083


152084
152085
152086


152087
152088
152089


152090
152091
152092


152093
152094
152095


152096
152097
152098



152099
152100
152101








152102
152103
152104
152105
152106
152107
152108
152109
152110


152111
152112
152113

152114
152115
152116


152117
152118
152119


152120
152121
152122
152123


152124
152125
152126

152127
152128


152129
152130
152131
152132



152133
152134
152135
152136


152137
152138
152139


152140
152141
152142



152143
152144
152145
152146

152147
152148

152149
152150
152151

152152
152153

152154
152155
152156

152157
152158

152159
152160
152161

152162
152163
152164


152165
152166
152167
152168

152169
152170

152171
152172

152173
152174
152175

152176
152177

152178
152179
152180

152181
152182

152183
152184

152185
152186
152187

152188
152189

152190
152191
152192

152193
152194

152195
152196
152197
152198

152199
152200
152201

152202
152203


152204
152205
152206
152207
152208
152209
152210
152211
152212
152213
152214

152215
152216
152217
152218

152219
152220
152221
152222

152223
152224
152225



152226
152227
152228
152229


152230
152231
152232

152233
152234

152235
152236
152237

152238
152239



152240
152241
152242
152243

152244
152245
152246
152247

152248
152249

152250
152251
152252

152253
152254


152255
152256
152257
152258
152259
152260

152261
152262

152263
152264
152265
152266


152267
152268
152269


152270
152271
152272







152273
152274
152275
152276
152277
152278
152279
152280

152281
152282



152283
152284
152285
152286
152287

152288
152289
152290

152291
152292
152293

152294
152295
152296
152297
152298

152299
152300
152301




152302
152303
152304
152305
152306
152307


152308
152309
152310

152311
152312


152313
152314
152315
152316

152317
152318

152319
152320
152321


152322
152323
152324

152325
152326


152327
152328
152329
152330

152331
152332


152333
152334
152335
152336

152337
152338

152339
152340
152341

152342
152343







152344
152345
152346
152347
152348
152349
152350
152351
152352
152353
152354
152355
152356
152357
152358
152359
152360
152361
152362

152363
152364
152365



152366
152367
152368
152369
152370
152371


152372
152373
152374
152375

152376
152377


152378
152379
152380

152381
152382

152383
152384


152385
152386
152387

152388
152389


152390
152391
152392


152393
152394
152395

152396
152397


152398
152399
152400
152401

152402
152403


152404
152405
152406
152407


152408
152409
152410


152411
152412
152413


152414
152415
152416


152417
152418
152419






152420
152421
152422
152423
152424
152425
152426








152427
152428
152429
152430
152431
152432
152433
152434
152435

152436
152437
152438

152439
152440
152441


152442
152443
152444



152445
152446
152447
152448



152449
152450
152451
152452

152453
152454


152455
152456
152457
152458

152459
152460


152461
152462
152463
152464


152465
152466
152467


152468
152469
152470


152471
152472
152473


152474
152475
152476


152477
152478
152479


152480
152481
152482

152483
152484


152485
152486
152487
152488

152489
152490



152491
152492
152493
152494
152495

152496
152497


152498
152499
152500
152501

152502
152503

152504
152505
152506

152507
152508


152509
152510
152511

152512
152513

152514
152515

152516
152517
152518

152519
152520

152521
152522
152523

152524
152525

152526
152527
152528


152529
152530
152531


152532
152533
152534


152535
152536
152537


152538
152539
152540


152541
152542
152543


152544
152545
152546


152547
152548
152549


152550
152551
152552



152553
152554
152555
152556

152557
152558
152559
152560
152561
152562
152563
152564

152565
152566

152567
152568

152569
152570
152571
152572
152573
152574
152575
152576
152577
152578

152579
152580

152581
152582



152583
152584
152585
152586

152587
152588

152589
152590

152591
152592

152593
152594
152595
152596


152597
152598
152599
152600
152601
152602
152603
152604
152605
152606

152607
152608


152609
152610
152611
152612
152613
152614

152615
152616

152617
152618
152619

152620
152621


152622
152623
152624
152625

152626
152627

152628
152629

152630
152631

152632
152633

152634
152635

152636
152637

152638
152639


152640
152641
152642

152643
152644

152645
152646


152647
152648
152649

152650
152651

152652
152653

152654
152655

152656
152657

152658
152659




152660
152661
152662
152663
152664
152665
152666
152667
152668









152669
152670
152671
152672
152673
152674
152675
152676
152677
152678
152679
152680

152681
152682
152683

152684
152685
152686
152687
152688





152689
152690
152691
152692
152693
152694
152695

152696
152697
152698
152699
152700






152701
152702
152703
152704
152705
152706
152707
152708


152709
152710
152711


152712
152713
152714

152715
152716


152717
152718
152719
152720

152721
152722


152723
152724
152725
152726



152727
152728
152729
152730

152731
152732

152733
152734
152735
152736



152737
152738
152739
152740

152741
152742





152743
152744
152745
152746
152747
152748
152749
152750

152751
152752
152753

152754
152755

152756
152757
152758
152759
152760
152761
152762
152763
152764



152765
152766


152767
152768
152769
152770
152771
152772
152773
152774
152775
152776
152777
152778
152779
152780
152781
152782
152783



152784
152785
152786
152787
152788
152789
152790
152791
152792

152793
152794




152795
152796
152797
152798
152799

152800
152801

152802
152803
152804
152805

152806
152807


152808
152809
152810
152811

152812
152813



152814
152815
152816
152817
152818

152819
152820
152821
152822




152823
152824
152825
152826
152827
152828

152829
152830
152831


152832
152833
152834
152835

152836
152837




152838
152839
152840
152841
152842


152843
152844
152845
152846
152847

152848
152849


152850
152851
152852
152853

152854
152855


152856
152857
152858
152859


152860
152861
152862


152863
152864
152865


152866
152867
152868



152869
152870
152871
152872

152873
152874
152875


152876
152877
152878
152879
152880
152881
152882



152883
152884
152885
152886


152887
152888
152889

152890
152891

152892
152893
152894

152895
152896

152897
152898
152899


152900
152901
152902


152903
152904
152905


152906
152907
152908

152909
152910
152911

152912
152913
152914

152915
152916
152917

152918
152919
152920

152921
152922
152923

152924
152925
152926
152927
152928

152929
152930
152931

152932
152933

152934
152935
152936
152937


152938
152939
152940


152941
152942
152943


152944
152945
152946



152947
152948
152949
152950


152951
152952
152953




152954
152955
152956
152957
152958



152959
152960
152961
152962

152963
152964



152965
152966
152967
152968
152969

152970
152971


152972
152973
152974
152975

152976
152977
152978
152979
152980
152981
152982
152983

152984
152985
152986
152987
152988
152989
152990

152991
152992
152993
152994
152995
152996
152997



152998
152999
153000
153001

153002
153003

153004
153005

153006
153007



153008
153009
153010
153011



153012
153013
153014
153015

153016
153017



153018
153019
153020
153021
153022
153023

153024
153025



153026
153027
153028
153029
153030
153031


153032
153033
153034


153035
153036
153037

153038
153039

153040
153041
153042

153043
153044

153045
153046
153047

153048
153049

153050
153051
153052

153053
153054
153055

153056
153057
153058

153059
153060
153061

153062
153063
153064

153065
153066

153067
153068
153069

153070
153071
153072
153073
153074
153075

153076
153077
153078

153079
153080
153081

153082
153083

153084
153085
153086

153087
153088
153089

153090
153091
153092

153093
153094

153095
153096
153097

153098
153099
153100



153101
153102
153103
153104
153105



153106
153107
153108
153109

153110
153111

153112
153113
153114

153115
153116

153117
153118
153119



153120
153121
153122
153123

153124
153125




153126
153127
153128
153129
153130

153131
153132

153133
153134


153135
153136
153137

153138
153139

153140
153141

153142
153143

153144
153145
153146

153147
153148

153149
153150

153151
153152

153153
153154

153155
153156
153157

153158
153159

153160
153161

153162
153163

153164
153165

153166
153167

153168
153169

153170
153171

153172
153173

153174
153175

153176
153177

153178
153179
153180

153181
153182

153183
153184

153185
153186

153187
153188

153189
153190

153191
153192




153193
153194
153195
153196
153197





153198
153199
153200
153201
153202
153203



153204
153205
153206
153207


153208
153209
153210


153211
153212
153213



153214
153215
153216
153217


153218
153219
153220


153221
153222
153223

153224
153225



153226
153227
153228
153229

153230
153231

153232
153233




153234
153235
153236
153237
153238

153239
153240
153241

153242
153243


153244
153245
153246
153247


























































153248
153249
153250
153251
153252
153253
153254
153255
153256
153257
153258
153259
153260
153261
153262
153263
153264
153265
153266
153267
153268
153269
153270
153271
153272
153273
153274
153275
153276
153277
153278
153279
153280
153281
153282
153283
153284
153285
153286
153287
153288
153289
153290
153291
153292
153293
153294
153295
153296
153297
153298
153299
153300
153301
153302
153303
153304
153305
153306
153307
153308
153309
153310
153311
153312







-
+








-
-
-
-
-
-
-
+
+
+
+
+
+
+


-
+


-
-
+
+



-
+




-
-
+
+





-
+

-
+








-
-
+
+


















-
+


+
+
+
+
+
+
-
-
+
+


-
-
+
+

-
-
+
+

-
-
+
+

-
+

-
-
+
+


-
+









-
-
+
+

-
-
+
+

-
-
+
+


-
-
+
+

-
-
+
+

-
-
+
+

-
+


-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+

-
-
+
+

-
+


-
-
+
+

-
-
+
+


-
-
+
+

-
+

-
-
+
+


-
-
-
+
+
+

-
-
+
+

-
-
+
+

-
-
-
+
+
+

-
+

-
+


-
+

-
+


-
+

-
+


-
+


-
-
+
+


-
+

-
+

-
+


-
+

-
+


-
+

-
+

-
+


-
+

-
+


-
+

-
+



-
+


-
+

-
-
+
+









-
+



-
+



-
+


-
-
-
+
+
+

-
-
+
+

-
+

-
+


-
+

-
-
-
+
+
+

-
+



-
+

-
+


-
+

-
-
+
+




-
+

-
+



-
-
+
+

-
-
+
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+

-
+

-
-
-
+
+
+


-
+


-
+


-
+




-
+


-
-
-
-
+
+
+
+


-
-
+
+

-
+

-
-
+
+


-
+

-
+


-
-
+
+

-
+

-
-
+
+


-
+

-
-
+
+


-
+

-
+


-
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+












-
+


-
-
-
+
+
+



-
-
+
+


-
+

-
-
+
+

-
+

-
+

-
-
+
+

-
+

-
-
+
+

-
-
+
+

-
+

-
-
+
+


-
+

-
-
+
+


-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
-
-
-
-
+
+
+
+
+
+

-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+

-
+


-
+


-
-
+
+

-
-
-
+
+
+

-
-
-
+
+
+

-
+

-
-
+
+


-
+

-
-
+
+


-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
+

-
-
+
+


-
+

-
-
-
+
+
+


-
+

-
-
+
+


-
+

-
+


-
+

-
-
+
+

-
+

-
+

-
+


-
+

-
+


-
+

-
+


-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
-
+
+
+

-
+







-
+

-
+

-
+









-
+

-
+

-
-
-
+
+
+

-
+

-
+

-
+

-
+



-
-
+
+








-
+

-
-
+
+




-
+

-
+


-
+

-
-
+
+


-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
-
+
+

-
+

-
+

-
-
+
+

-
+

-
+

-
+

-
+

-
+

-
-
-
-
+
+
+
+





-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+

-
+


-
+




-
-
-
-
-
+
+
+
+
+


-
+




-
-
-
-
-
-
+
+
+
+
+
+


-
-
+
+

-
-
+
+

-
+

-
-
+
+


-
+

-
-
+
+


-
-
-
+
+
+

-
+

-
+



-
-
-
+
+
+

-
+

-
-
-
-
-
+
+
+
+
+



-
+


-
+

-
+








-
-
-
+
+
-
-
+
















-
-
-
+
+
+






-
+

-
-
-
-
+
+
+
+

-
+

-
+



-
+

-
-
+
+


-
+

-
-
-
+
+
+


-
+



-
-
-
-
+
+
+
+


-
+


-
-
+
+


-
+

-
-
-
-
+
+
+
+

-
-
+
+



-
+

-
-
+
+


-
+

-
-
+
+


-
-
+
+

-
-
+
+

-
-
+
+

-
-
-
+
+
+

-
+


-
-
+
+





-
-
-
+
+
+

-
-
+
+

-
+

-
+


-
+

-
+


-
-
+
+

-
-
+
+

-
-
+
+

-
+


-
+


-
+


-
+


-
+


-
+




-
+


-
+

-
+



-
-
+
+

-
-
+
+

-
-
+
+

-
-
-
+
+
+

-
-
+
+

-
-
-
-
+
+
+
+

-
-
-
+
+
+

-
+

-
-
-
+
+
+


-
+

-
-
+
+


-
+







-
+






-
+






-
-
-
+
+
+

-
+

-
+

-
+

-
-
-
+
+
+

-
-
-
+
+
+

-
+

-
-
-
+
+
+



-
+

-
-
-
+
+
+



-
-
+
+

-
-
+
+

-
+

-
+


-
+

-
+


-
+

-
+


-
+


-
+


-
+


-
+


-
+

-
+


-
+





-
+


-
+


-
+

-
+


-
+


-
+


-
+

-
+


-
+


-
-
-
+
+
+


-
-
-
+
+
+

-
+

-
+


-
+

-
+


-
-
-
+
+
+

-
+

-
-
-
-
+
+
+
+

-
+

-
+

-
-
+
+

-
+

-
+

-
+

-
+


-
+

-
+

-
+

-
+

-
+


-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+


-
+

-
+

-
+

-
+

-
+

-
+

-
-
-
-
+
+
+
+

-
-
-
-
-
+
+
+
+
+

-
-
-
+
+
+

-
-
+
+

-
-
+
+

-
-
-
+
+
+

-
-
+
+

-
-
+
+

-
+

-
-
-
+
+
+

-
+

-
+

-
-
-
-
+
+
+
+

-
+


-
+

-
-
+
+


-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







      case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
{
  sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
}
        break;
      case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
{
   sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy494,0,0,yymsp[-2].minor.yy494);
   sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy100,0,0,yymsp[-2].minor.yy100);
}
        break;
      case 14: /* createkw ::= CREATE */
{disableLookaside(pParse);}
        break;
      case 15: /* ifnotexists ::= */
      case 18: /* temp ::= */ yytestcase(yyruleno==18);
      case 21: /* table_options ::= */ yytestcase(yyruleno==21);
      case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
      case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
      case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
      case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
      case 93: /* distinct ::= */ yytestcase(yyruleno==93);
      case 226: /* collate ::= */ yytestcase(yyruleno==226);
{yymsp[1].minor.yy494 = 0;}
      case 43: /* autoinc ::= */ yytestcase(yyruleno==43);
      case 58: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==58);
      case 68: /* defer_subclause_opt ::= */ yytestcase(yyruleno==68);
      case 77: /* ifexists ::= */ yytestcase(yyruleno==77);
      case 94: /* distinct ::= */ yytestcase(yyruleno==94);
      case 227: /* collate ::= */ yytestcase(yyruleno==227);
{yymsp[1].minor.yy100 = 0;}
        break;
      case 16: /* ifnotexists ::= IF NOT EXISTS */
{yymsp[-2].minor.yy494 = 1;}
{yymsp[-2].minor.yy100 = 1;}
        break;
      case 17: /* temp ::= TEMP */
      case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43);
{yymsp[0].minor.yy494 = 1;}
      case 44: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==44);
{yymsp[0].minor.yy100 = 1;}
        break;
      case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
{
  sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy494,0);
  sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy100,0);
}
        break;
      case 20: /* create_table_args ::= AS select */
{
  sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy457);
  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy457);
  sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy391);
  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy391);
}
        break;
      case 22: /* table_options ::= WITHOUT nm */
{
  if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
    yymsp[-1].minor.yy494 = TF_WithoutRowid | TF_NoVisibleRowid;
    yymsp[-1].minor.yy100 = TF_WithoutRowid | TF_NoVisibleRowid;
  }else{
    yymsp[-1].minor.yy494 = 0;
    yymsp[-1].minor.yy100 = 0;
    sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
  }
}
        break;
      case 23: /* columnname ::= nm typetoken */
{sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
        break;
      case 24: /* typetoken ::= */
      case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60);
      case 99: /* as ::= */ yytestcase(yyruleno==99);
      case 61: /* conslist_opt ::= */ yytestcase(yyruleno==61);
      case 100: /* as ::= */ yytestcase(yyruleno==100);
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
        break;
      case 25: /* typetoken ::= typename LP signed RP */
{
  yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
}
        break;
      case 26: /* typetoken ::= typename LP signed COMMA signed RP */
{
  yymsp[-5].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);
}
        break;
      case 27: /* typename ::= typename ID|STRING */
{yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
        break;
      case 28: /* scanpt ::= */
{
  assert( yyLookahead!=YYNOCODE );
  yymsp[1].minor.yy294 = yyLookaheadToken.z;
  yymsp[1].minor.yy528 = yyLookaheadToken.z;
}
        break;
      case 29: /* scantok ::= */
{
  assert( yyLookahead!=YYNOCODE );
  yymsp[1].minor.yy0 = yyLookaheadToken;
}
        break;
      case 29: /* ccons ::= CONSTRAINT nm */
      case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62);
      case 30: /* ccons ::= CONSTRAINT nm */
      case 63: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==63);
{pParse->constraintName = yymsp[0].minor.yy0;}
        break;
      case 30: /* ccons ::= DEFAULT scanpt term scanpt */
{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy524,yymsp[-2].minor.yy294,yymsp[0].minor.yy294);}
      case 31: /* ccons ::= DEFAULT scantok term */
{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy102,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
        break;
      case 31: /* ccons ::= DEFAULT LP expr RP */
{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy524,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
      case 32: /* ccons ::= DEFAULT LP expr RP */
{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy102,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
        break;
      case 32: /* ccons ::= DEFAULT PLUS term scanpt */
{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy524,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy294);}
      case 33: /* ccons ::= DEFAULT PLUS scantok term */
{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy102,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
        break;
      case 33: /* ccons ::= DEFAULT MINUS term scanpt */
      case 34: /* ccons ::= DEFAULT MINUS scantok term */
{
  Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[-1].minor.yy524, 0);
  sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy294);
  Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy102, 0);
  sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
}
        break;
      case 34: /* ccons ::= DEFAULT scanpt ID|INDEXED */
      case 35: /* ccons ::= DEFAULT scantok ID|INDEXED */
{
  Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0);
  if( p ){
    sqlite3ExprIdToTrueFalse(p);
    testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) );
  }
    sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
}
        break;
      case 35: /* ccons ::= NOT NULL onconf */
{sqlite3AddNotNull(pParse, yymsp[0].minor.yy494);}
      case 36: /* ccons ::= NOT NULL onconf */
{sqlite3AddNotNull(pParse, yymsp[0].minor.yy100);}
        break;
      case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy494,yymsp[0].minor.yy494,yymsp[-2].minor.yy494);}
      case 37: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy100,yymsp[0].minor.yy100,yymsp[-2].minor.yy100);}
        break;
      case 37: /* ccons ::= UNIQUE onconf */
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy494,0,0,0,0,
      case 38: /* ccons ::= UNIQUE onconf */
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy100,0,0,0,0,
                                   SQLITE_IDXTYPE_UNIQUE);}
        break;
      case 38: /* ccons ::= CHECK LP expr RP */
{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy524);}
      case 39: /* ccons ::= CHECK LP expr RP */
{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy102);}
        break;
      case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */
{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy434,yymsp[0].minor.yy494);}
      case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */
{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy94,yymsp[0].minor.yy100);}
        break;
      case 40: /* ccons ::= defer_subclause */
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy494);}
      case 41: /* ccons ::= defer_subclause */
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy100);}
        break;
      case 41: /* ccons ::= COLLATE ID|STRING */
      case 42: /* ccons ::= COLLATE ID|STRING */
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
        break;
      case 44: /* refargs ::= */
{ yymsp[1].minor.yy494 = OE_None*0x0101; /* EV: R-19803-45884 */}
      case 45: /* refargs ::= */
{ yymsp[1].minor.yy100 = OE_None*0x0101; /* EV: R-19803-45884 */}
        break;
      case 45: /* refargs ::= refargs refarg */
{ yymsp[-1].minor.yy494 = (yymsp[-1].minor.yy494 & ~yymsp[0].minor.yy355.mask) | yymsp[0].minor.yy355.value; }
      case 46: /* refargs ::= refargs refarg */
{ yymsp[-1].minor.yy100 = (yymsp[-1].minor.yy100 & ~yymsp[0].minor.yy199.mask) | yymsp[0].minor.yy199.value; }
        break;
      case 46: /* refarg ::= MATCH nm */
{ yymsp[-1].minor.yy355.value = 0;     yymsp[-1].minor.yy355.mask = 0x000000; }
      case 47: /* refarg ::= MATCH nm */
{ yymsp[-1].minor.yy199.value = 0;     yymsp[-1].minor.yy199.mask = 0x000000; }
        break;
      case 47: /* refarg ::= ON INSERT refact */
{ yymsp[-2].minor.yy355.value = 0;     yymsp[-2].minor.yy355.mask = 0x000000; }
      case 48: /* refarg ::= ON INSERT refact */
{ yymsp[-2].minor.yy199.value = 0;     yymsp[-2].minor.yy199.mask = 0x000000; }
        break;
      case 48: /* refarg ::= ON DELETE refact */
{ yymsp[-2].minor.yy355.value = yymsp[0].minor.yy494;     yymsp[-2].minor.yy355.mask = 0x0000ff; }
      case 49: /* refarg ::= ON DELETE refact */
{ yymsp[-2].minor.yy199.value = yymsp[0].minor.yy100;     yymsp[-2].minor.yy199.mask = 0x0000ff; }
        break;
      case 49: /* refarg ::= ON UPDATE refact */
{ yymsp[-2].minor.yy355.value = yymsp[0].minor.yy494<<8;  yymsp[-2].minor.yy355.mask = 0x00ff00; }
      case 50: /* refarg ::= ON UPDATE refact */
{ yymsp[-2].minor.yy199.value = yymsp[0].minor.yy100<<8;  yymsp[-2].minor.yy199.mask = 0x00ff00; }
        break;
      case 50: /* refact ::= SET NULL */
{ yymsp[-1].minor.yy494 = OE_SetNull;  /* EV: R-33326-45252 */}
      case 51: /* refact ::= SET NULL */
{ yymsp[-1].minor.yy100 = OE_SetNull;  /* EV: R-33326-45252 */}
        break;
      case 51: /* refact ::= SET DEFAULT */
{ yymsp[-1].minor.yy494 = OE_SetDflt;  /* EV: R-33326-45252 */}
      case 52: /* refact ::= SET DEFAULT */
{ yymsp[-1].minor.yy100 = OE_SetDflt;  /* EV: R-33326-45252 */}
        break;
      case 52: /* refact ::= CASCADE */
{ yymsp[0].minor.yy494 = OE_Cascade;  /* EV: R-33326-45252 */}
      case 53: /* refact ::= CASCADE */
{ yymsp[0].minor.yy100 = OE_Cascade;  /* EV: R-33326-45252 */}
        break;
      case 53: /* refact ::= RESTRICT */
{ yymsp[0].minor.yy494 = OE_Restrict; /* EV: R-33326-45252 */}
      case 54: /* refact ::= RESTRICT */
{ yymsp[0].minor.yy100 = OE_Restrict; /* EV: R-33326-45252 */}
        break;
      case 54: /* refact ::= NO ACTION */
{ yymsp[-1].minor.yy494 = OE_None;     /* EV: R-33326-45252 */}
      case 55: /* refact ::= NO ACTION */
{ yymsp[-1].minor.yy100 = OE_None;     /* EV: R-33326-45252 */}
        break;
      case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
{yymsp[-2].minor.yy494 = 0;}
      case 56: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
{yymsp[-2].minor.yy100 = 0;}
        break;
      case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
      case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
      case 156: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==156);
      case 57: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
      case 72: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==72);
      case 157: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==157);
{yymsp[-1].minor.yy494 = yymsp[0].minor.yy494;}
        break;
      case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
      case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
      case 198: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==198);
      case 201: /* in_op ::= NOT IN */ yytestcase(yyruleno==201);
      case 227: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==227);
{yymsp[-1].minor.yy494 = 1;}
{yymsp[-1].minor.yy100 = yymsp[0].minor.yy100;}
        break;
      case 59: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
      case 76: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==76);
      case 199: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==199);
      case 202: /* in_op ::= NOT IN */ yytestcase(yyruleno==202);
      case 228: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==228);
{yymsp[-1].minor.yy100 = 1;}
        break;
      case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
{yymsp[-1].minor.yy494 = 0;}
      case 60: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
{yymsp[-1].minor.yy100 = 0;}
        break;
      case 61: /* tconscomma ::= COMMA */
      case 62: /* tconscomma ::= COMMA */
{pParse->constraintName.n = 0;}
        break;
      case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy434,yymsp[0].minor.yy494,yymsp[-2].minor.yy494,0);}
      case 64: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy94,yymsp[0].minor.yy100,yymsp[-2].minor.yy100,0);}
        break;
      case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy434,yymsp[0].minor.yy494,0,0,0,0,
      case 65: /* tcons ::= UNIQUE LP sortlist RP onconf */
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy94,yymsp[0].minor.yy100,0,0,0,0,
                                       SQLITE_IDXTYPE_UNIQUE);}
        break;
      case 65: /* tcons ::= CHECK LP expr RP onconf */
{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy524);}
      case 66: /* tcons ::= CHECK LP expr RP onconf */
{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy102);}
        break;
      case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
      case 67: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
{
    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy434, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy434, yymsp[-1].minor.yy494);
    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy494);
    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy94, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy94, yymsp[-1].minor.yy100);
    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy100);
}
        break;
      case 68: /* onconf ::= */
      case 70: /* orconf ::= */ yytestcase(yyruleno==70);
{yymsp[1].minor.yy494 = OE_Default;}
      case 69: /* onconf ::= */
      case 71: /* orconf ::= */ yytestcase(yyruleno==71);
{yymsp[1].minor.yy100 = OE_Default;}
        break;
      case 69: /* onconf ::= ON CONFLICT resolvetype */
{yymsp[-2].minor.yy494 = yymsp[0].minor.yy494;}
      case 70: /* onconf ::= ON CONFLICT resolvetype */
{yymsp[-2].minor.yy100 = yymsp[0].minor.yy100;}
        break;
      case 72: /* resolvetype ::= IGNORE */
{yymsp[0].minor.yy494 = OE_Ignore;}
      case 73: /* resolvetype ::= IGNORE */
{yymsp[0].minor.yy100 = OE_Ignore;}
        break;
      case 73: /* resolvetype ::= REPLACE */
      case 157: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==157);
{yymsp[0].minor.yy494 = OE_Replace;}
      case 74: /* resolvetype ::= REPLACE */
      case 158: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==158);
{yymsp[0].minor.yy100 = OE_Replace;}
        break;
      case 74: /* cmd ::= DROP TABLE ifexists fullname */
      case 75: /* cmd ::= DROP TABLE ifexists fullname */
{
  sqlite3DropTable(pParse, yymsp[0].minor.yy483, 0, yymsp[-1].minor.yy494);
  sqlite3DropTable(pParse, yymsp[0].minor.yy407, 0, yymsp[-1].minor.yy100);
}
        break;
      case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
      case 78: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
{
  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);
  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);
}
        break;
      case 78: /* cmd ::= DROP VIEW ifexists fullname */
      case 79: /* cmd ::= DROP VIEW ifexists fullname */
{
  sqlite3DropTable(pParse, yymsp[0].minor.yy483, 1, yymsp[-1].minor.yy494);
  sqlite3DropTable(pParse, yymsp[0].minor.yy407, 1, yymsp[-1].minor.yy100);
}
        break;
      case 79: /* cmd ::= select */
      case 80: /* cmd ::= select */
{
  SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
  sqlite3Select(pParse, yymsp[0].minor.yy457, &dest);
  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy457);
  sqlite3Select(pParse, yymsp[0].minor.yy391, &dest);
  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy391);
}
        break;
      case 80: /* select ::= WITH wqlist selectnowith */
      case 81: /* select ::= WITH wqlist selectnowith */
{
  Select *p = yymsp[0].minor.yy457;
  Select *p = yymsp[0].minor.yy391;
  if( p ){
    p->pWith = yymsp[-1].minor.yy59;
    p->pWith = yymsp[-1].minor.yy243;
    parserDoubleLinkSelect(pParse, p);
  }else{
    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy59);
    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy243);
  }
  yymsp[-2].minor.yy457 = p;
  yymsp[-2].minor.yy391 = p;
}
        break;
      case 81: /* select ::= WITH RECURSIVE wqlist selectnowith */
      case 82: /* select ::= WITH RECURSIVE wqlist selectnowith */
{
  Select *p = yymsp[0].minor.yy457;
  Select *p = yymsp[0].minor.yy391;
  if( p ){
    p->pWith = yymsp[-1].minor.yy59;
    p->pWith = yymsp[-1].minor.yy243;
    parserDoubleLinkSelect(pParse, p);
  }else{
    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy59);
    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy243);
  }
  yymsp[-3].minor.yy457 = p;
  yymsp[-3].minor.yy391 = p;
}
        break;
      case 82: /* select ::= selectnowith */
      case 83: /* select ::= selectnowith */
{
  Select *p = yymsp[0].minor.yy457;
  Select *p = yymsp[0].minor.yy391;
  if( p ){
    parserDoubleLinkSelect(pParse, p);
  }
  yymsp[0].minor.yy457 = p; /*A-overwrites-X*/
  yymsp[0].minor.yy391 = p; /*A-overwrites-X*/
}
        break;
      case 83: /* selectnowith ::= selectnowith multiselect_op oneselect */
      case 84: /* selectnowith ::= selectnowith multiselect_op oneselect */
{
  Select *pRhs = yymsp[0].minor.yy457;
  Select *pLhs = yymsp[-2].minor.yy457;
  Select *pRhs = yymsp[0].minor.yy391;
  Select *pLhs = yymsp[-2].minor.yy391;
  if( pRhs && pRhs->pPrior ){
    SrcList *pFrom;
    Token x;
    x.n = 0;
    parserDoubleLinkSelect(pParse, pRhs);
    pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
    pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
  }
  if( pRhs ){
    pRhs->op = (u8)yymsp[-1].minor.yy494;
    pRhs->op = (u8)yymsp[-1].minor.yy100;
    pRhs->pPrior = pLhs;
    if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
    pRhs->selFlags &= ~SF_MultiValue;
    if( yymsp[-1].minor.yy494!=TK_ALL ) pParse->hasCompound = 1;
    if( yymsp[-1].minor.yy100!=TK_ALL ) pParse->hasCompound = 1;
  }else{
    sqlite3SelectDelete(pParse->db, pLhs);
  }
  yymsp[-2].minor.yy457 = pRhs;
  yymsp[-2].minor.yy391 = pRhs;
}
        break;
      case 84: /* multiselect_op ::= UNION */
      case 86: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==86);
{yymsp[0].minor.yy494 = yymsp[0].major; /*A-overwrites-OP*/}
      case 85: /* multiselect_op ::= UNION */
      case 87: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==87);
{yymsp[0].minor.yy100 = yymsp[0].major; /*A-overwrites-OP*/}
        break;
      case 85: /* multiselect_op ::= UNION ALL */
{yymsp[-1].minor.yy494 = TK_ALL;}
      case 86: /* multiselect_op ::= UNION ALL */
{yymsp[-1].minor.yy100 = TK_ALL;}
        break;
      case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
      case 88: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
{
  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);
  yymsp[-8].minor.yy391 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy94,yymsp[-5].minor.yy407,yymsp[-4].minor.yy102,yymsp[-3].minor.yy94,yymsp[-2].minor.yy102,yymsp[-1].minor.yy94,yymsp[-7].minor.yy100,yymsp[0].minor.yy102);
}
        break;
      case 88: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
      case 89: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
{
  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);
  if( yymsp[-9].minor.yy457 ){
    yymsp[-9].minor.yy457->pWinDefn = yymsp[-2].minor.yy295;
  yymsp[-9].minor.yy391 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy94,yymsp[-6].minor.yy407,yymsp[-5].minor.yy102,yymsp[-4].minor.yy94,yymsp[-3].minor.yy102,yymsp[-1].minor.yy94,yymsp[-8].minor.yy100,yymsp[0].minor.yy102);
  if( yymsp[-9].minor.yy391 ){
    yymsp[-9].minor.yy391->pWinDefn = yymsp[-2].minor.yy379;
  }else{
    sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy295);
    sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy379);
  }
}
        break;
      case 89: /* values ::= VALUES LP nexprlist RP */
      case 90: /* values ::= VALUES LP nexprlist RP */
{
  yymsp[-3].minor.yy457 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy434,0,0,0,0,0,SF_Values,0);
  yymsp[-3].minor.yy391 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy94,0,0,0,0,0,SF_Values,0);
}
        break;
      case 90: /* values ::= values COMMA LP nexprlist RP */
      case 91: /* values ::= values COMMA LP nexprlist RP */
{
  Select *pRight, *pLeft = yymsp[-4].minor.yy457;
  pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy434,0,0,0,0,0,SF_Values|SF_MultiValue,0);
  Select *pRight, *pLeft = yymsp[-4].minor.yy391;
  pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy94,0,0,0,0,0,SF_Values|SF_MultiValue,0);
  if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
  if( pRight ){
    pRight->op = TK_ALL;
    pRight->pPrior = pLeft;
    yymsp[-4].minor.yy457 = pRight;
    yymsp[-4].minor.yy391 = pRight;
  }else{
    yymsp[-4].minor.yy457 = pLeft;
    yymsp[-4].minor.yy391 = pLeft;
  }
}
        break;
      case 91: /* distinct ::= DISTINCT */
{yymsp[0].minor.yy494 = SF_Distinct;}
      case 92: /* distinct ::= DISTINCT */
{yymsp[0].minor.yy100 = SF_Distinct;}
        break;
      case 92: /* distinct ::= ALL */
{yymsp[0].minor.yy494 = SF_All;}
      case 93: /* distinct ::= ALL */
{yymsp[0].minor.yy100 = SF_All;}
        break;
      case 94: /* sclp ::= */
      case 127: /* orderby_opt ::= */ yytestcase(yyruleno==127);
      case 134: /* groupby_opt ::= */ yytestcase(yyruleno==134);
      case 214: /* exprlist ::= */ yytestcase(yyruleno==214);
      case 217: /* paren_exprlist ::= */ yytestcase(yyruleno==217);
      case 222: /* eidlist_opt ::= */ yytestcase(yyruleno==222);
{yymsp[1].minor.yy434 = 0;}
      case 95: /* sclp ::= */
      case 128: /* orderby_opt ::= */ yytestcase(yyruleno==128);
      case 135: /* groupby_opt ::= */ yytestcase(yyruleno==135);
      case 215: /* exprlist ::= */ yytestcase(yyruleno==215);
      case 218: /* paren_exprlist ::= */ yytestcase(yyruleno==218);
      case 223: /* eidlist_opt ::= */ yytestcase(yyruleno==223);
{yymsp[1].minor.yy94 = 0;}
        break;
      case 95: /* selcollist ::= sclp scanpt expr scanpt as */
      case 96: /* selcollist ::= sclp scanpt expr scanpt as */
{
   yymsp[-4].minor.yy434 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy434, yymsp[-2].minor.yy524);
   if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy434, &yymsp[0].minor.yy0, 1);
   sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy434,yymsp[-3].minor.yy294,yymsp[-1].minor.yy294);
   yymsp[-4].minor.yy94 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy94, yymsp[-2].minor.yy102);
   if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy94, &yymsp[0].minor.yy0, 1);
   sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy94,yymsp[-3].minor.yy528,yymsp[-1].minor.yy528);
}
        break;
      case 96: /* selcollist ::= sclp scanpt STAR */
      case 97: /* selcollist ::= sclp scanpt STAR */
{
  Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
  yymsp[-2].minor.yy434 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy434, p);
  yymsp[-2].minor.yy94 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy94, p);
}
        break;
      case 97: /* selcollist ::= sclp scanpt nm DOT STAR */
      case 98: /* selcollist ::= sclp scanpt nm DOT STAR */
{
  Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
  Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
  Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
  yymsp[-4].minor.yy434 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy434, pDot);
  yymsp[-4].minor.yy94 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy94, pDot);
}
        break;
      case 98: /* as ::= AS nm */
      case 109: /* dbnm ::= DOT nm */ yytestcase(yyruleno==109);
      case 238: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==238);
      case 239: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==239);
      case 99: /* as ::= AS nm */
      case 110: /* dbnm ::= DOT nm */ yytestcase(yyruleno==110);
      case 239: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==239);
      case 240: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==240);
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
        break;
      case 100: /* from ::= */
{yymsp[1].minor.yy483 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy483));}
      case 101: /* from ::= */
{yymsp[1].minor.yy407 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy407));}
        break;
      case 101: /* from ::= FROM seltablist */
      case 102: /* from ::= FROM seltablist */
{
  yymsp[-1].minor.yy483 = yymsp[0].minor.yy483;
  sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy483);
  yymsp[-1].minor.yy407 = yymsp[0].minor.yy407;
  sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy407);
}
        break;
      case 102: /* stl_prefix ::= seltablist joinop */
      case 103: /* stl_prefix ::= seltablist joinop */
{
   if( ALWAYS(yymsp[-1].minor.yy483 && yymsp[-1].minor.yy483->nSrc>0) ) yymsp[-1].minor.yy483->a[yymsp[-1].minor.yy483->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy494;
   if( ALWAYS(yymsp[-1].minor.yy407 && yymsp[-1].minor.yy407->nSrc>0) ) yymsp[-1].minor.yy407->a[yymsp[-1].minor.yy407->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy100;
}
        break;
      case 103: /* stl_prefix ::= */
{yymsp[1].minor.yy483 = 0;}
      case 104: /* stl_prefix ::= */
{yymsp[1].minor.yy407 = 0;}
        break;
      case 104: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
      case 105: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
{
  yymsp[-6].minor.yy483 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy483,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy524,yymsp[0].minor.yy62);
  sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy483, &yymsp[-2].minor.yy0);
  yymsp[-6].minor.yy407 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy407,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy102,yymsp[0].minor.yy76);
  sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy407, &yymsp[-2].minor.yy0);
}
        break;
      case 105: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
      case 106: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
{
  yymsp[-8].minor.yy483 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy483,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy524,yymsp[0].minor.yy62);
  sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy483, yymsp[-4].minor.yy434);
  yymsp[-8].minor.yy407 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy407,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy102,yymsp[0].minor.yy76);
  sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy407, yymsp[-4].minor.yy94);
}
        break;
      case 106: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
      case 107: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
{
    yymsp[-6].minor.yy483 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy483,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy457,yymsp[-1].minor.yy524,yymsp[0].minor.yy62);
    yymsp[-6].minor.yy407 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy407,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy391,yymsp[-1].minor.yy102,yymsp[0].minor.yy76);
  }
        break;
      case 107: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
      case 108: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
{
    if( yymsp[-6].minor.yy483==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy524==0 && yymsp[0].minor.yy62==0 ){
      yymsp[-6].minor.yy483 = yymsp[-4].minor.yy483;
    }else if( yymsp[-4].minor.yy483->nSrc==1 ){
      yymsp[-6].minor.yy483 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy483,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy524,yymsp[0].minor.yy62);
      if( yymsp[-6].minor.yy483 ){
        struct SrcList_item *pNew = &yymsp[-6].minor.yy483->a[yymsp[-6].minor.yy483->nSrc-1];
        struct SrcList_item *pOld = yymsp[-4].minor.yy483->a;
    if( yymsp[-6].minor.yy407==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy102==0 && yymsp[0].minor.yy76==0 ){
      yymsp[-6].minor.yy407 = yymsp[-4].minor.yy407;
    }else if( yymsp[-4].minor.yy407->nSrc==1 ){
      yymsp[-6].minor.yy407 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy407,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy102,yymsp[0].minor.yy76);
      if( yymsp[-6].minor.yy407 ){
        struct SrcList_item *pNew = &yymsp[-6].minor.yy407->a[yymsp[-6].minor.yy407->nSrc-1];
        struct SrcList_item *pOld = yymsp[-4].minor.yy407->a;
        pNew->zName = pOld->zName;
        pNew->zDatabase = pOld->zDatabase;
        pNew->pSelect = pOld->pSelect;
        if( pOld->fg.isTabFunc ){
          pNew->u1.pFuncArg = pOld->u1.pFuncArg;
          pOld->u1.pFuncArg = 0;
          pOld->fg.isTabFunc = 0;
          pNew->fg.isTabFunc = 1;
        }
        pOld->zName = pOld->zDatabase = 0;
        pOld->pSelect = 0;
      }
      sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy483);
      sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy407);
    }else{
      Select *pSubquery;
      sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy483);
      pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy483,0,0,0,0,SF_NestedFrom,0);
      yymsp[-6].minor.yy483 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy483,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy524,yymsp[0].minor.yy62);
      sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy407);
      pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy407,0,0,0,0,SF_NestedFrom,0);
      yymsp[-6].minor.yy407 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy407,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy102,yymsp[0].minor.yy76);
    }
  }
        break;
      case 108: /* dbnm ::= */
      case 122: /* indexed_opt ::= */ yytestcase(yyruleno==122);
      case 109: /* dbnm ::= */
      case 123: /* indexed_opt ::= */ yytestcase(yyruleno==123);
{yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
        break;
      case 110: /* fullname ::= nm */
      case 111: /* fullname ::= nm */
{
  yylhsminor.yy483 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
  if( IN_RENAME_OBJECT && yylhsminor.yy483 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy483->a[0].zName, &yymsp[0].minor.yy0);
  yylhsminor.yy407 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
  if( IN_RENAME_OBJECT && yylhsminor.yy407 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy407->a[0].zName, &yymsp[0].minor.yy0);
}
  yymsp[0].minor.yy483 = yylhsminor.yy483;
  yymsp[0].minor.yy407 = yylhsminor.yy407;
        break;
      case 111: /* fullname ::= nm DOT nm */
      case 112: /* fullname ::= nm DOT nm */
{
  yylhsminor.yy483 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
  if( IN_RENAME_OBJECT && yylhsminor.yy483 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy483->a[0].zName, &yymsp[0].minor.yy0);
  yylhsminor.yy407 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
  if( IN_RENAME_OBJECT && yylhsminor.yy407 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy407->a[0].zName, &yymsp[0].minor.yy0);
}
  yymsp[-2].minor.yy483 = yylhsminor.yy483;
  yymsp[-2].minor.yy407 = yylhsminor.yy407;
        break;
      case 112: /* xfullname ::= nm */
{yymsp[0].minor.yy483 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
      case 113: /* xfullname ::= nm */
{yymsp[0].minor.yy407 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
        break;
      case 113: /* xfullname ::= nm DOT nm */
{yymsp[-2].minor.yy483 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
      case 114: /* xfullname ::= nm DOT nm */
{yymsp[-2].minor.yy407 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
        break;
      case 114: /* xfullname ::= nm DOT nm AS nm */
      case 115: /* xfullname ::= nm DOT nm AS nm */
{
   yymsp[-4].minor.yy483 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
   if( yymsp[-4].minor.yy483 ) yymsp[-4].minor.yy483->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
   yymsp[-4].minor.yy407 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
   if( yymsp[-4].minor.yy407 ) yymsp[-4].minor.yy407->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
}
        break;
      case 115: /* xfullname ::= nm AS nm */
      case 116: /* xfullname ::= nm AS nm */
{  
   yymsp[-2].minor.yy483 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
   if( yymsp[-2].minor.yy483 ) yymsp[-2].minor.yy483->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
   yymsp[-2].minor.yy407 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
   if( yymsp[-2].minor.yy407 ) yymsp[-2].minor.yy407->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
}
        break;
      case 116: /* joinop ::= COMMA|JOIN */
{ yymsp[0].minor.yy494 = JT_INNER; }
      case 117: /* joinop ::= COMMA|JOIN */
{ yymsp[0].minor.yy100 = JT_INNER; }
        break;
      case 117: /* joinop ::= JOIN_KW JOIN */
{yymsp[-1].minor.yy494 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0);  /*X-overwrites-A*/}
      case 118: /* joinop ::= JOIN_KW JOIN */
{yymsp[-1].minor.yy100 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0);  /*X-overwrites-A*/}
        break;
      case 118: /* joinop ::= JOIN_KW nm JOIN */
{yymsp[-2].minor.yy494 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
      case 119: /* joinop ::= JOIN_KW nm JOIN */
{yymsp[-2].minor.yy100 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
        break;
      case 119: /* joinop ::= JOIN_KW nm nm JOIN */
{yymsp[-3].minor.yy494 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
      case 120: /* joinop ::= JOIN_KW nm nm JOIN */
{yymsp[-3].minor.yy100 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
        break;
      case 120: /* on_opt ::= ON expr */
      case 137: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==137);
      case 144: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==144);
      case 210: /* case_else ::= ELSE expr */ yytestcase(yyruleno==210);
      case 231: /* vinto ::= INTO expr */ yytestcase(yyruleno==231);
{yymsp[-1].minor.yy524 = yymsp[0].minor.yy524;}
      case 121: /* on_opt ::= ON expr */
      case 138: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==138);
      case 145: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==145);
      case 211: /* case_else ::= ELSE expr */ yytestcase(yyruleno==211);
      case 232: /* vinto ::= INTO expr */ yytestcase(yyruleno==232);
{yymsp[-1].minor.yy102 = yymsp[0].minor.yy102;}
        break;
      case 121: /* on_opt ::= */
      case 136: /* having_opt ::= */ yytestcase(yyruleno==136);
      case 138: /* limit_opt ::= */ yytestcase(yyruleno==138);
      case 143: /* where_opt ::= */ yytestcase(yyruleno==143);
      case 211: /* case_else ::= */ yytestcase(yyruleno==211);
      case 213: /* case_operand ::= */ yytestcase(yyruleno==213);
      case 232: /* vinto ::= */ yytestcase(yyruleno==232);
{yymsp[1].minor.yy524 = 0;}
      case 122: /* on_opt ::= */
      case 137: /* having_opt ::= */ yytestcase(yyruleno==137);
      case 139: /* limit_opt ::= */ yytestcase(yyruleno==139);
      case 144: /* where_opt ::= */ yytestcase(yyruleno==144);
      case 212: /* case_else ::= */ yytestcase(yyruleno==212);
      case 214: /* case_operand ::= */ yytestcase(yyruleno==214);
      case 233: /* vinto ::= */ yytestcase(yyruleno==233);
{yymsp[1].minor.yy102 = 0;}
        break;
      case 123: /* indexed_opt ::= INDEXED BY nm */
      case 124: /* indexed_opt ::= INDEXED BY nm */
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
        break;
      case 124: /* indexed_opt ::= NOT INDEXED */
      case 125: /* indexed_opt ::= NOT INDEXED */
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
        break;
      case 125: /* using_opt ::= USING LP idlist RP */
{yymsp[-3].minor.yy62 = yymsp[-1].minor.yy62;}
      case 126: /* using_opt ::= USING LP idlist RP */
{yymsp[-3].minor.yy76 = yymsp[-1].minor.yy76;}
        break;
      case 126: /* using_opt ::= */
      case 158: /* idlist_opt ::= */ yytestcase(yyruleno==158);
{yymsp[1].minor.yy62 = 0;}
      case 127: /* using_opt ::= */
      case 159: /* idlist_opt ::= */ yytestcase(yyruleno==159);
{yymsp[1].minor.yy76 = 0;}
        break;
      case 128: /* orderby_opt ::= ORDER BY sortlist */
      case 135: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==135);
{yymsp[-2].minor.yy434 = yymsp[0].minor.yy434;}
      case 129: /* orderby_opt ::= ORDER BY sortlist */
      case 136: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==136);
{yymsp[-2].minor.yy94 = yymsp[0].minor.yy94;}
        break;
      case 129: /* sortlist ::= sortlist COMMA expr sortorder */
      case 130: /* sortlist ::= sortlist COMMA expr sortorder */
{
  yymsp[-3].minor.yy434 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy434,yymsp[-1].minor.yy524);
  sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy434,yymsp[0].minor.yy494);
  yymsp[-3].minor.yy94 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy94,yymsp[-1].minor.yy102);
  sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy94,yymsp[0].minor.yy100);
}
        break;
      case 130: /* sortlist ::= expr sortorder */
      case 131: /* sortlist ::= expr sortorder */
{
  yymsp[-1].minor.yy434 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy524); /*A-overwrites-Y*/
  sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy434,yymsp[0].minor.yy494);
  yymsp[-1].minor.yy94 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy102); /*A-overwrites-Y*/
  sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy94,yymsp[0].minor.yy100);
}
        break;
      case 131: /* sortorder ::= ASC */
{yymsp[0].minor.yy494 = SQLITE_SO_ASC;}
      case 132: /* sortorder ::= ASC */
{yymsp[0].minor.yy100 = SQLITE_SO_ASC;}
        break;
      case 132: /* sortorder ::= DESC */
{yymsp[0].minor.yy494 = SQLITE_SO_DESC;}
      case 133: /* sortorder ::= DESC */
{yymsp[0].minor.yy100 = SQLITE_SO_DESC;}
        break;
      case 133: /* sortorder ::= */
{yymsp[1].minor.yy494 = SQLITE_SO_UNDEFINED;}
      case 134: /* sortorder ::= */
{yymsp[1].minor.yy100 = SQLITE_SO_UNDEFINED;}
        break;
      case 139: /* limit_opt ::= LIMIT expr */
{yymsp[-1].minor.yy524 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy524,0);}
      case 140: /* limit_opt ::= LIMIT expr */
{yymsp[-1].minor.yy102 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy102,0);}
        break;
      case 140: /* limit_opt ::= LIMIT expr OFFSET expr */
{yymsp[-3].minor.yy524 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy524,yymsp[0].minor.yy524);}
      case 141: /* limit_opt ::= LIMIT expr OFFSET expr */
{yymsp[-3].minor.yy102 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy102,yymsp[0].minor.yy102);}
        break;
      case 141: /* limit_opt ::= LIMIT expr COMMA expr */
{yymsp[-3].minor.yy524 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy524,yymsp[-2].minor.yy524);}
      case 142: /* limit_opt ::= LIMIT expr COMMA expr */
{yymsp[-3].minor.yy102 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy102,yymsp[-2].minor.yy102);}
        break;
      case 142: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
      case 143: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
{
  sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy483, &yymsp[-1].minor.yy0);
  sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy483,yymsp[0].minor.yy524,0,0);
  sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy407, &yymsp[-1].minor.yy0);
  sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy407,yymsp[0].minor.yy102,0,0);
}
        break;
      case 145: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
      case 146: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
{
  sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy483, &yymsp[-3].minor.yy0);
  sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy434,"set list"); 
  sqlite3Update(pParse,yymsp[-4].minor.yy483,yymsp[-1].minor.yy434,yymsp[0].minor.yy524,yymsp[-5].minor.yy494,0,0,0);
  sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy407, &yymsp[-3].minor.yy0);
  sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy94,"set list"); 
  sqlite3Update(pParse,yymsp[-4].minor.yy407,yymsp[-1].minor.yy94,yymsp[0].minor.yy102,yymsp[-5].minor.yy100,0,0,0);
}
        break;
      case 146: /* setlist ::= setlist COMMA nm EQ expr */
      case 147: /* setlist ::= setlist COMMA nm EQ expr */
{
  yymsp[-4].minor.yy434 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy434, yymsp[0].minor.yy524);
  sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy434, &yymsp[-2].minor.yy0, 1);
  yymsp[-4].minor.yy94 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy94, yymsp[0].minor.yy102);
  sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy94, &yymsp[-2].minor.yy0, 1);
}
        break;
      case 147: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
      case 148: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
{
  yymsp[-6].minor.yy434 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy434, yymsp[-3].minor.yy62, yymsp[0].minor.yy524);
  yymsp[-6].minor.yy94 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy94, yymsp[-3].minor.yy76, yymsp[0].minor.yy102);
}
        break;
      case 148: /* setlist ::= nm EQ expr */
      case 149: /* setlist ::= nm EQ expr */
{
  yylhsminor.yy434 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy524);
  sqlite3ExprListSetName(pParse, yylhsminor.yy434, &yymsp[-2].minor.yy0, 1);
  yylhsminor.yy94 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy102);
  sqlite3ExprListSetName(pParse, yylhsminor.yy94, &yymsp[-2].minor.yy0, 1);
}
  yymsp[-2].minor.yy434 = yylhsminor.yy434;
  yymsp[-2].minor.yy94 = yylhsminor.yy94;
        break;
      case 149: /* setlist ::= LP idlist RP EQ expr */
      case 150: /* setlist ::= LP idlist RP EQ expr */
{
  yymsp[-4].minor.yy434 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy62, yymsp[0].minor.yy524);
  yymsp[-4].minor.yy94 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy76, yymsp[0].minor.yy102);
}
        break;
      case 150: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
      case 151: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
{
  sqlite3Insert(pParse, yymsp[-3].minor.yy483, yymsp[-1].minor.yy457, yymsp[-2].minor.yy62, yymsp[-5].minor.yy494, yymsp[0].minor.yy136);
  sqlite3Insert(pParse, yymsp[-3].minor.yy407, yymsp[-1].minor.yy391, yymsp[-2].minor.yy76, yymsp[-5].minor.yy100, yymsp[0].minor.yy95);
}
        break;
      case 151: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
      case 152: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
{
  sqlite3Insert(pParse, yymsp[-3].minor.yy483, 0, yymsp[-2].minor.yy62, yymsp[-5].minor.yy494, 0);
  sqlite3Insert(pParse, yymsp[-3].minor.yy407, 0, yymsp[-2].minor.yy76, yymsp[-5].minor.yy100, 0);
}
        break;
      case 152: /* upsert ::= */
{ yymsp[1].minor.yy136 = 0; }
      case 153: /* upsert ::= */
{ yymsp[1].minor.yy95 = 0; }
        break;
      case 153: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
{ yymsp[-10].minor.yy136 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy434,yymsp[-5].minor.yy524,yymsp[-1].minor.yy434,yymsp[0].minor.yy524);}
      case 154: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
{ yymsp[-10].minor.yy95 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy94,yymsp[-5].minor.yy102,yymsp[-1].minor.yy94,yymsp[0].minor.yy102);}
        break;
      case 154: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
{ yymsp[-7].minor.yy136 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy434,yymsp[-2].minor.yy524,0,0); }
      case 155: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
{ yymsp[-7].minor.yy95 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy94,yymsp[-2].minor.yy102,0,0); }
        break;
      case 155: /* upsert ::= ON CONFLICT DO NOTHING */
{ yymsp[-3].minor.yy136 = sqlite3UpsertNew(pParse->db,0,0,0,0); }
      case 156: /* upsert ::= ON CONFLICT DO NOTHING */
{ yymsp[-3].minor.yy95 = sqlite3UpsertNew(pParse->db,0,0,0,0); }
        break;
      case 159: /* idlist_opt ::= LP idlist RP */
{yymsp[-2].minor.yy62 = yymsp[-1].minor.yy62;}
      case 160: /* idlist_opt ::= LP idlist RP */
{yymsp[-2].minor.yy76 = yymsp[-1].minor.yy76;}
        break;
      case 160: /* idlist ::= idlist COMMA nm */
{yymsp[-2].minor.yy62 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy62,&yymsp[0].minor.yy0);}
      case 161: /* idlist ::= idlist COMMA nm */
{yymsp[-2].minor.yy76 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy76,&yymsp[0].minor.yy0);}
        break;
      case 161: /* idlist ::= nm */
{yymsp[0].minor.yy62 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
      case 162: /* idlist ::= nm */
{yymsp[0].minor.yy76 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
        break;
      case 162: /* expr ::= LP expr RP */
{yymsp[-2].minor.yy524 = yymsp[-1].minor.yy524;}
      case 163: /* expr ::= LP expr RP */
{yymsp[-2].minor.yy102 = yymsp[-1].minor.yy102;}
        break;
      case 163: /* expr ::= ID|INDEXED */
      case 164: /* expr ::= JOIN_KW */ yytestcase(yyruleno==164);
{yymsp[0].minor.yy524=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
      case 164: /* expr ::= ID|INDEXED */
      case 165: /* expr ::= JOIN_KW */ yytestcase(yyruleno==165);
{yymsp[0].minor.yy102=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
        break;
      case 165: /* expr ::= nm DOT nm */
      case 166: /* expr ::= nm DOT nm */
{
  Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
  Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
  if( IN_RENAME_OBJECT ){
    sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
    sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0);
  }
  yylhsminor.yy524 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
  yylhsminor.yy102 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
}
  yymsp[-2].minor.yy524 = yylhsminor.yy524;
  yymsp[-2].minor.yy102 = yylhsminor.yy102;
        break;
      case 166: /* expr ::= nm DOT nm DOT nm */
      case 167: /* expr ::= nm DOT nm DOT nm */
{
  Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
  Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
  Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
  Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
  if( IN_RENAME_OBJECT ){
    sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0);
    sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0);
  }
  yylhsminor.yy524 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
  yylhsminor.yy102 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
}
  yymsp[-4].minor.yy524 = yylhsminor.yy524;
  yymsp[-4].minor.yy102 = yylhsminor.yy102;
        break;
      case 167: /* term ::= NULL|FLOAT|BLOB */
      case 168: /* term ::= STRING */ yytestcase(yyruleno==168);
{yymsp[0].minor.yy524=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
      case 168: /* term ::= NULL|FLOAT|BLOB */
      case 169: /* term ::= STRING */ yytestcase(yyruleno==169);
{yymsp[0].minor.yy102=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
        break;
      case 169: /* term ::= INTEGER */
      case 170: /* term ::= INTEGER */
{
  yylhsminor.yy524 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
  yylhsminor.yy102 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
}
  yymsp[0].minor.yy524 = yylhsminor.yy524;
  yymsp[0].minor.yy102 = yylhsminor.yy102;
        break;
      case 170: /* expr ::= VARIABLE */
      case 171: /* expr ::= VARIABLE */
{
  if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
    u32 n = yymsp[0].minor.yy0.n;
    yymsp[0].minor.yy524 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
    sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy524, n);
    yymsp[0].minor.yy102 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
    sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy102, n);
  }else{
    /* When doing a nested parse, one can include terms in an expression
    ** that look like this:   #1 #2 ...  These terms refer to registers
    ** in the virtual machine.  #N is the N-th register. */
    Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
    assert( t.n>=2 );
    if( pParse->nested==0 ){
      sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
      yymsp[0].minor.yy524 = 0;
      yymsp[0].minor.yy102 = 0;
    }else{
      yymsp[0].minor.yy524 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
      if( yymsp[0].minor.yy524 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy524->iTable);
      yymsp[0].minor.yy102 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
      if( yymsp[0].minor.yy102 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy102->iTable);
    }
  }
}
        break;
      case 171: /* expr ::= expr COLLATE ID|STRING */
      case 172: /* expr ::= expr COLLATE ID|STRING */
{
  yymsp[-2].minor.yy524 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy524, &yymsp[0].minor.yy0, 1);
  yymsp[-2].minor.yy102 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy102, &yymsp[0].minor.yy0, 1);
}
        break;
      case 172: /* expr ::= CAST LP expr AS typetoken RP */
      case 173: /* expr ::= CAST LP expr AS typetoken RP */
{
  yymsp[-5].minor.yy524 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
  sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy524, yymsp[-3].minor.yy524, 0);
  yymsp[-5].minor.yy102 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
  sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy102, yymsp[-3].minor.yy102, 0);
}
        break;
      case 173: /* expr ::= ID|INDEXED LP distinct exprlist RP */
      case 174: /* expr ::= ID|INDEXED LP distinct exprlist RP */
{
  yylhsminor.yy524 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy434, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy494);
  yylhsminor.yy102 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy94, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy100);
}
  yymsp[-4].minor.yy524 = yylhsminor.yy524;
  yymsp[-4].minor.yy102 = yylhsminor.yy102;
        break;
      case 174: /* expr ::= ID|INDEXED LP STAR RP */
      case 175: /* expr ::= ID|INDEXED LP STAR RP */
{
  yylhsminor.yy524 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
  yylhsminor.yy102 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
}
  yymsp[-3].minor.yy524 = yylhsminor.yy524;
  yymsp[-3].minor.yy102 = yylhsminor.yy102;
        break;
      case 175: /* expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
      case 176: /* expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
{
  yylhsminor.yy524 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy434, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy494);
  sqlite3WindowAttach(pParse, yylhsminor.yy524, yymsp[0].minor.yy295);
  yylhsminor.yy102 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy94, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy100);
  sqlite3WindowAttach(pParse, yylhsminor.yy102, yymsp[0].minor.yy379);
}
  yymsp[-5].minor.yy524 = yylhsminor.yy524;
  yymsp[-5].minor.yy102 = yylhsminor.yy102;
        break;
      case 176: /* expr ::= ID|INDEXED LP STAR RP over_clause */
      case 177: /* expr ::= ID|INDEXED LP STAR RP over_clause */
{
  yylhsminor.yy524 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
  sqlite3WindowAttach(pParse, yylhsminor.yy524, yymsp[0].minor.yy295);
  yylhsminor.yy102 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
  sqlite3WindowAttach(pParse, yylhsminor.yy102, yymsp[0].minor.yy379);
}
  yymsp[-4].minor.yy524 = yylhsminor.yy524;
  yymsp[-4].minor.yy102 = yylhsminor.yy102;
        break;
      case 177: /* term ::= CTIME_KW */
      case 178: /* term ::= CTIME_KW */
{
  yylhsminor.yy524 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
  yylhsminor.yy102 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
}
  yymsp[0].minor.yy524 = yylhsminor.yy524;
  yymsp[0].minor.yy102 = yylhsminor.yy102;
        break;
      case 178: /* expr ::= LP nexprlist COMMA expr RP */
      case 179: /* expr ::= LP nexprlist COMMA expr RP */
{
  ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy434, yymsp[-1].minor.yy524);
  yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
  if( yymsp[-4].minor.yy524 ){
    yymsp[-4].minor.yy524->x.pList = pList;
  ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy94, yymsp[-1].minor.yy102);
  yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
  if( yymsp[-4].minor.yy102 ){
    yymsp[-4].minor.yy102->x.pList = pList;
  }else{
    sqlite3ExprListDelete(pParse->db, pList);
  }
}
        break;
      case 179: /* expr ::= expr AND expr */
      case 180: /* expr ::= expr OR expr */ yytestcase(yyruleno==180);
      case 181: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==181);
      case 182: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==182);
      case 183: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==183);
      case 184: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==184);
      case 185: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==185);
      case 186: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==186);
{yymsp[-2].minor.yy524=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy524,yymsp[0].minor.yy524);}
      case 180: /* expr ::= expr AND expr */
{yymsp[-2].minor.yy102=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy102,yymsp[0].minor.yy102);}
        break;
      case 181: /* expr ::= expr OR expr */
      case 182: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==182);
      case 183: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==183);
      case 184: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==184);
      case 185: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==185);
      case 186: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==186);
      case 187: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==187);
{yymsp[-2].minor.yy102=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy102,yymsp[0].minor.yy102);}
        break;
      case 187: /* likeop ::= NOT LIKE_KW|MATCH */
      case 188: /* likeop ::= NOT LIKE_KW|MATCH */
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
        break;
      case 188: /* expr ::= expr likeop expr */
      case 189: /* expr ::= expr likeop expr */
{
  ExprList *pList;
  int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
  yymsp[-1].minor.yy0.n &= 0x7fffffff;
  pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy524);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy524);
  yymsp[-2].minor.yy524 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
  if( bNot ) yymsp[-2].minor.yy524 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy524, 0);
  if( yymsp[-2].minor.yy524 ) yymsp[-2].minor.yy524->flags |= EP_InfixFunc;
  pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy102);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy102);
  yymsp[-2].minor.yy102 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
  if( bNot ) yymsp[-2].minor.yy102 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy102, 0);
  if( yymsp[-2].minor.yy102 ) yymsp[-2].minor.yy102->flags |= EP_InfixFunc;
}
        break;
      case 189: /* expr ::= expr likeop expr ESCAPE expr */
      case 190: /* expr ::= expr likeop expr ESCAPE expr */
{
  ExprList *pList;
  int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
  yymsp[-3].minor.yy0.n &= 0x7fffffff;
  pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy524);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy524);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy524);
  yymsp[-4].minor.yy524 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
  if( bNot ) yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy524, 0);
  if( yymsp[-4].minor.yy524 ) yymsp[-4].minor.yy524->flags |= EP_InfixFunc;
  pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy102);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy102);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy102);
  yymsp[-4].minor.yy102 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
  if( bNot ) yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy102, 0);
  if( yymsp[-4].minor.yy102 ) yymsp[-4].minor.yy102->flags |= EP_InfixFunc;
}
        break;
      case 190: /* expr ::= expr ISNULL|NOTNULL */
{yymsp[-1].minor.yy524 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy524,0);}
      case 191: /* expr ::= expr ISNULL|NOTNULL */
{yymsp[-1].minor.yy102 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy102,0);}
        break;
      case 191: /* expr ::= expr NOT NULL */
{yymsp[-2].minor.yy524 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy524,0);}
      case 192: /* expr ::= expr NOT NULL */
{yymsp[-2].minor.yy102 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy102,0);}
        break;
      case 192: /* expr ::= expr IS expr */
      case 193: /* expr ::= expr IS expr */
{
  yymsp[-2].minor.yy524 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy524,yymsp[0].minor.yy524);
  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy524, yymsp[-2].minor.yy524, TK_ISNULL);
  yymsp[-2].minor.yy102 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy102,yymsp[0].minor.yy102);
  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy102, yymsp[-2].minor.yy102, TK_ISNULL);
}
        break;
      case 193: /* expr ::= expr IS NOT expr */
      case 194: /* expr ::= expr IS NOT expr */
{
  yymsp[-3].minor.yy524 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy524,yymsp[0].minor.yy524);
  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy524, yymsp[-3].minor.yy524, TK_NOTNULL);
  yymsp[-3].minor.yy102 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy102,yymsp[0].minor.yy102);
  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy102, yymsp[-3].minor.yy102, TK_NOTNULL);
}
        break;
      case 194: /* expr ::= NOT expr */
      case 195: /* expr ::= BITNOT expr */ yytestcase(yyruleno==195);
{yymsp[-1].minor.yy524 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy524, 0);/*A-overwrites-B*/}
      case 195: /* expr ::= NOT expr */
      case 196: /* expr ::= BITNOT expr */ yytestcase(yyruleno==196);
{yymsp[-1].minor.yy102 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy102, 0);/*A-overwrites-B*/}
        break;
      case 196: /* expr ::= PLUS|MINUS expr */
      case 197: /* expr ::= PLUS|MINUS expr */
{
  yymsp[-1].minor.yy524 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy524, 0);
  yymsp[-1].minor.yy102 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy102, 0);
  /*A-overwrites-B*/
}
        break;
      case 197: /* between_op ::= BETWEEN */
      case 200: /* in_op ::= IN */ yytestcase(yyruleno==200);
{yymsp[0].minor.yy494 = 0;}
      case 198: /* between_op ::= BETWEEN */
      case 201: /* in_op ::= IN */ yytestcase(yyruleno==201);
{yymsp[0].minor.yy100 = 0;}
        break;
      case 199: /* expr ::= expr between_op expr AND expr */
      case 200: /* expr ::= expr between_op expr AND expr */
{
  ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy524);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy524);
  yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy524, 0);
  if( yymsp[-4].minor.yy524 ){
    yymsp[-4].minor.yy524->x.pList = pList;
  ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy102);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy102);
  yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy102, 0);
  if( yymsp[-4].minor.yy102 ){
    yymsp[-4].minor.yy102->x.pList = pList;
  }else{
    sqlite3ExprListDelete(pParse->db, pList);
  } 
  if( yymsp[-3].minor.yy494 ) yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy524, 0);
  if( yymsp[-3].minor.yy100 ) yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy102, 0);
}
        break;
      case 202: /* expr ::= expr in_op LP exprlist RP */
      case 203: /* expr ::= expr in_op LP exprlist RP */
{
    if( yymsp[-1].minor.yy434==0 ){
    if( yymsp[-1].minor.yy94==0 ){
      /* Expressions of the form
      **
      **      expr1 IN ()
      **      expr1 NOT IN ()
      **
      ** simplify to constants 0 (false) and 1 (true), respectively,
      ** regardless of the value of expr1.
      */
      if( IN_RENAME_OBJECT==0 ){
        sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy524);
        yymsp[-4].minor.yy524 = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[yymsp[-3].minor.yy494],1);
      sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy102);
      yymsp[-4].minor.yy102 = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[yymsp[-3].minor.yy100],1);
      }
    }else if( yymsp[-1].minor.yy434->nExpr==1 ){
    }else if( yymsp[-1].minor.yy94->nExpr==1 ){
      /* Expressions of the form:
      **
      **      expr1 IN (?1)
      **      expr1 NOT IN (?2)
      **
      ** with exactly one value on the RHS can be simplified to something
      ** like this:
      **
      **      expr1 == ?1
      **      expr1 <> ?2
      **
      ** But, the RHS of the == or <> is marked with the EP_Generic flag
      ** so that it may not contribute to the computation of comparison
      ** affinity or the collating sequence to use for comparison.  Otherwise,
      ** the semantics would be subtly different from IN or NOT IN.
      */
      Expr *pRHS = yymsp[-1].minor.yy434->a[0].pExpr;
      yymsp[-1].minor.yy434->a[0].pExpr = 0;
      sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy434);
      Expr *pRHS = yymsp[-1].minor.yy94->a[0].pExpr;
      yymsp[-1].minor.yy94->a[0].pExpr = 0;
      sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy94);
      /* pRHS cannot be NULL because a malloc error would have been detected
      ** before now and control would have never reached this point */
      if( ALWAYS(pRHS) ){
        pRHS->flags &= ~EP_Collate;
        pRHS->flags |= EP_Generic;
      }
      yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, yymsp[-3].minor.yy494 ? TK_NE : TK_EQ, yymsp[-4].minor.yy524, pRHS);
      yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, yymsp[-3].minor.yy100 ? TK_NE : TK_EQ, yymsp[-4].minor.yy102, pRHS);
    }else{
      yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy524, 0);
      if( yymsp[-4].minor.yy524 ){
        yymsp[-4].minor.yy524->x.pList = yymsp[-1].minor.yy434;
        sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy524);
      yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy102, 0);
      if( yymsp[-4].minor.yy102 ){
        yymsp[-4].minor.yy102->x.pList = yymsp[-1].minor.yy94;
        sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy102);
      }else{
        sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy434);
        sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy94);
      }
      if( yymsp[-3].minor.yy494 ) yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy524, 0);
      if( yymsp[-3].minor.yy100 ) yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy102, 0);
    }
  }
        break;
      case 203: /* expr ::= LP select RP */
      case 204: /* expr ::= LP select RP */
{
    yymsp[-2].minor.yy524 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy524, yymsp[-1].minor.yy457);
    yymsp[-2].minor.yy102 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy102, yymsp[-1].minor.yy391);
  }
        break;
      case 204: /* expr ::= expr in_op LP select RP */
      case 205: /* expr ::= expr in_op LP select RP */
{
    yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy524, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy524, yymsp[-1].minor.yy457);
    if( yymsp[-3].minor.yy494 ) yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy524, 0);
    yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy102, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy102, yymsp[-1].minor.yy391);
    if( yymsp[-3].minor.yy100 ) yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy102, 0);
  }
        break;
      case 205: /* expr ::= expr in_op nm dbnm paren_exprlist */
      case 206: /* expr ::= expr in_op nm dbnm paren_exprlist */
{
    SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
    Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
    if( yymsp[0].minor.yy434 )  sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy434);
    yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy524, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy524, pSelect);
    if( yymsp[-3].minor.yy494 ) yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy524, 0);
    if( yymsp[0].minor.yy94 )  sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy94);
    yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy102, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy102, pSelect);
    if( yymsp[-3].minor.yy100 ) yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy102, 0);
  }
        break;
      case 206: /* expr ::= EXISTS LP select RP */
      case 207: /* expr ::= EXISTS LP select RP */
{
    Expr *p;
    p = yymsp[-3].minor.yy524 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
    sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy457);
    p = yymsp[-3].minor.yy102 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
    sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy391);
  }
        break;
      case 207: /* expr ::= CASE case_operand case_exprlist case_else END */
      case 208: /* expr ::= CASE case_operand case_exprlist case_else END */
{
  yymsp[-4].minor.yy524 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy524, 0);
  if( yymsp[-4].minor.yy524 ){
    yymsp[-4].minor.yy524->x.pList = yymsp[-1].minor.yy524 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy434,yymsp[-1].minor.yy524) : yymsp[-2].minor.yy434;
    sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy524);
  yymsp[-4].minor.yy102 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy102, 0);
  if( yymsp[-4].minor.yy102 ){
    yymsp[-4].minor.yy102->x.pList = yymsp[-1].minor.yy102 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy94,yymsp[-1].minor.yy102) : yymsp[-2].minor.yy94;
    sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy102);
  }else{
    sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy434);
    sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy524);
    sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy94);
    sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy102);
  }
}
        break;
      case 208: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
      case 209: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
{
  yymsp[-4].minor.yy434 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy434, yymsp[-2].minor.yy524);
  yymsp[-4].minor.yy434 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy434, yymsp[0].minor.yy524);
  yymsp[-4].minor.yy94 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy94, yymsp[-2].minor.yy102);
  yymsp[-4].minor.yy94 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy94, yymsp[0].minor.yy102);
}
        break;
      case 209: /* case_exprlist ::= WHEN expr THEN expr */
      case 210: /* case_exprlist ::= WHEN expr THEN expr */
{
  yymsp[-3].minor.yy434 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy524);
  yymsp[-3].minor.yy434 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy434, yymsp[0].minor.yy524);
  yymsp[-3].minor.yy94 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy102);
  yymsp[-3].minor.yy94 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy94, yymsp[0].minor.yy102);
}
        break;
      case 212: /* case_operand ::= expr */
{yymsp[0].minor.yy524 = yymsp[0].minor.yy524; /*A-overwrites-X*/}
      case 213: /* case_operand ::= expr */
{yymsp[0].minor.yy102 = yymsp[0].minor.yy102; /*A-overwrites-X*/}
        break;
      case 215: /* nexprlist ::= nexprlist COMMA expr */
{yymsp[-2].minor.yy434 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy434,yymsp[0].minor.yy524);}
      case 216: /* nexprlist ::= nexprlist COMMA expr */
{yymsp[-2].minor.yy94 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy94,yymsp[0].minor.yy102);}
        break;
      case 216: /* nexprlist ::= expr */
{yymsp[0].minor.yy434 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy524); /*A-overwrites-Y*/}
      case 217: /* nexprlist ::= expr */
{yymsp[0].minor.yy94 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy102); /*A-overwrites-Y*/}
        break;
      case 218: /* paren_exprlist ::= LP exprlist RP */
      case 223: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==223);
{yymsp[-2].minor.yy434 = yymsp[-1].minor.yy434;}
      case 219: /* paren_exprlist ::= LP exprlist RP */
      case 224: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==224);
{yymsp[-2].minor.yy94 = yymsp[-1].minor.yy94;}
        break;
      case 219: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
      case 220: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
{
  sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, 
                     sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy434, yymsp[-10].minor.yy494,
                      &yymsp[-11].minor.yy0, yymsp[0].minor.yy524, SQLITE_SO_ASC, yymsp[-8].minor.yy494, SQLITE_IDXTYPE_APPDEF);
                     sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy94, yymsp[-10].minor.yy100,
                      &yymsp[-11].minor.yy0, yymsp[0].minor.yy102, SQLITE_SO_ASC, yymsp[-8].minor.yy100, SQLITE_IDXTYPE_APPDEF);
  if( IN_RENAME_OBJECT && pParse->pNewIndex ){
    sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
  }
}
        break;
      case 220: /* uniqueflag ::= UNIQUE */
      case 262: /* raisetype ::= ABORT */ yytestcase(yyruleno==262);
{yymsp[0].minor.yy494 = OE_Abort;}
      case 221: /* uniqueflag ::= UNIQUE */
      case 263: /* raisetype ::= ABORT */ yytestcase(yyruleno==263);
{yymsp[0].minor.yy100 = OE_Abort;}
        break;
      case 221: /* uniqueflag ::= */
{yymsp[1].minor.yy494 = OE_None;}
      case 222: /* uniqueflag ::= */
{yymsp[1].minor.yy100 = OE_None;}
        break;
      case 224: /* eidlist ::= eidlist COMMA nm collate sortorder */
      case 225: /* eidlist ::= eidlist COMMA nm collate sortorder */
{
  yymsp[-4].minor.yy434 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy434, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy494, yymsp[0].minor.yy494);
  yymsp[-4].minor.yy94 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy94, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy100, yymsp[0].minor.yy100);
}
        break;
      case 225: /* eidlist ::= nm collate sortorder */
      case 226: /* eidlist ::= nm collate sortorder */
{
  yymsp[-2].minor.yy434 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy494, yymsp[0].minor.yy494); /*A-overwrites-Y*/
  yymsp[-2].minor.yy94 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy100, yymsp[0].minor.yy100); /*A-overwrites-Y*/
}
        break;
      case 228: /* cmd ::= DROP INDEX ifexists fullname */
{sqlite3DropIndex(pParse, yymsp[0].minor.yy483, yymsp[-1].minor.yy494);}
      case 229: /* cmd ::= DROP INDEX ifexists fullname */
{sqlite3DropIndex(pParse, yymsp[0].minor.yy407, yymsp[-1].minor.yy100);}
        break;
      case 229: /* cmd ::= VACUUM vinto */
{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy524);}
      case 230: /* cmd ::= VACUUM vinto */
{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy102);}
        break;
      case 230: /* cmd ::= VACUUM nm vinto */
{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy524);}
      case 231: /* cmd ::= VACUUM nm vinto */
{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy102);}
        break;
      case 233: /* cmd ::= PRAGMA nm dbnm */
      case 234: /* cmd ::= PRAGMA nm dbnm */
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
        break;
      case 234: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
      case 235: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
        break;
      case 235: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
      case 236: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
        break;
      case 236: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
      case 237: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
        break;
      case 237: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
      case 238: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
        break;
      case 240: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
      case 241: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
{
  Token all;
  all.z = yymsp[-3].minor.yy0.z;
  all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
  sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy455, &all);
  sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy11, &all);
}
        break;
      case 241: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
      case 242: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
{
  sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy494, yymsp[-4].minor.yy90.a, yymsp[-4].minor.yy90.b, yymsp[-2].minor.yy483, yymsp[0].minor.yy524, yymsp[-10].minor.yy494, yymsp[-8].minor.yy494);
  sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy100, yymsp[-4].minor.yy298.a, yymsp[-4].minor.yy298.b, yymsp[-2].minor.yy407, yymsp[0].minor.yy102, yymsp[-10].minor.yy100, yymsp[-8].minor.yy100);
  yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
}
        break;
      case 242: /* trigger_time ::= BEFORE|AFTER */
{ yymsp[0].minor.yy494 = yymsp[0].major; /*A-overwrites-X*/ }
      case 243: /* trigger_time ::= BEFORE|AFTER */
{ yymsp[0].minor.yy100 = yymsp[0].major; /*A-overwrites-X*/ }
        break;
      case 243: /* trigger_time ::= INSTEAD OF */
{ yymsp[-1].minor.yy494 = TK_INSTEAD;}
      case 244: /* trigger_time ::= INSTEAD OF */
{ yymsp[-1].minor.yy100 = TK_INSTEAD;}
        break;
      case 244: /* trigger_time ::= */
{ yymsp[1].minor.yy494 = TK_BEFORE; }
      case 245: /* trigger_time ::= */
{ yymsp[1].minor.yy100 = TK_BEFORE; }
        break;
      case 245: /* trigger_event ::= DELETE|INSERT */
      case 246: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==246);
{yymsp[0].minor.yy90.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy90.b = 0;}
      case 246: /* trigger_event ::= DELETE|INSERT */
      case 247: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==247);
{yymsp[0].minor.yy298.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy298.b = 0;}
        break;
      case 247: /* trigger_event ::= UPDATE OF idlist */
{yymsp[-2].minor.yy90.a = TK_UPDATE; yymsp[-2].minor.yy90.b = yymsp[0].minor.yy62;}
      case 248: /* trigger_event ::= UPDATE OF idlist */
{yymsp[-2].minor.yy298.a = TK_UPDATE; yymsp[-2].minor.yy298.b = yymsp[0].minor.yy76;}
        break;
      case 248: /* when_clause ::= */
      case 267: /* key_opt ::= */ yytestcase(yyruleno==267);
      case 315: /* filter_opt ::= */ yytestcase(yyruleno==315);
{ yymsp[1].minor.yy524 = 0; }
      case 249: /* when_clause ::= */
      case 268: /* key_opt ::= */ yytestcase(yyruleno==268);
      case 316: /* filter_opt ::= */ yytestcase(yyruleno==316);
{ yymsp[1].minor.yy102 = 0; }
        break;
      case 249: /* when_clause ::= WHEN expr */
      case 268: /* key_opt ::= KEY expr */ yytestcase(yyruleno==268);
{ yymsp[-1].minor.yy524 = yymsp[0].minor.yy524; }
      case 250: /* when_clause ::= WHEN expr */
      case 269: /* key_opt ::= KEY expr */ yytestcase(yyruleno==269);
{ yymsp[-1].minor.yy102 = yymsp[0].minor.yy102; }
        break;
      case 250: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
      case 251: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
{
  assert( yymsp[-2].minor.yy455!=0 );
  yymsp[-2].minor.yy455->pLast->pNext = yymsp[-1].minor.yy455;
  yymsp[-2].minor.yy455->pLast = yymsp[-1].minor.yy455;
  assert( yymsp[-2].minor.yy11!=0 );
  yymsp[-2].minor.yy11->pLast->pNext = yymsp[-1].minor.yy11;
  yymsp[-2].minor.yy11->pLast = yymsp[-1].minor.yy11;
}
        break;
      case 251: /* trigger_cmd_list ::= trigger_cmd SEMI */
      case 252: /* trigger_cmd_list ::= trigger_cmd SEMI */
{ 
  assert( yymsp[-1].minor.yy455!=0 );
  yymsp[-1].minor.yy455->pLast = yymsp[-1].minor.yy455;
  assert( yymsp[-1].minor.yy11!=0 );
  yymsp[-1].minor.yy11->pLast = yymsp[-1].minor.yy11;
}
        break;
      case 252: /* trnm ::= nm DOT nm */
      case 253: /* trnm ::= nm DOT nm */
{
  yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
  sqlite3ErrorMsg(pParse, 
        "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
        "statements within triggers");
}
        break;
      case 253: /* tridxby ::= INDEXED BY nm */
      case 254: /* tridxby ::= INDEXED BY nm */
{
  sqlite3ErrorMsg(pParse,
        "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
        "within triggers");
}
        break;
      case 254: /* tridxby ::= NOT INDEXED */
      case 255: /* tridxby ::= NOT INDEXED */
{
  sqlite3ErrorMsg(pParse,
        "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
        "within triggers");
}
        break;
      case 255: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
{yylhsminor.yy455 = sqlite3TriggerUpdateStep(pParse, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy434, yymsp[-1].minor.yy524, yymsp[-6].minor.yy494, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy294);}
  yymsp[-7].minor.yy455 = yylhsminor.yy455;
      case 256: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
{yylhsminor.yy11 = sqlite3TriggerUpdateStep(pParse, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy94, yymsp[-1].minor.yy102, yymsp[-6].minor.yy100, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy528);}
  yymsp[-7].minor.yy11 = yylhsminor.yy11;
        break;
      case 256: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
      case 257: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
{
   yylhsminor.yy455 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy62,yymsp[-2].minor.yy457,yymsp[-6].minor.yy494,yymsp[-1].minor.yy136,yymsp[-7].minor.yy294,yymsp[0].minor.yy294);/*yylhsminor.yy455-overwrites-yymsp[-6].minor.yy494*/
   yylhsminor.yy11 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy76,yymsp[-2].minor.yy391,yymsp[-6].minor.yy100,yymsp[-1].minor.yy95,yymsp[-7].minor.yy528,yymsp[0].minor.yy528);/*yylhsminor.yy11-overwrites-yymsp[-6].minor.yy100*/
}
  yymsp[-7].minor.yy455 = yylhsminor.yy455;
  yymsp[-7].minor.yy11 = yylhsminor.yy11;
        break;
      case 257: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
{yylhsminor.yy455 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy524, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy294);}
  yymsp[-5].minor.yy455 = yylhsminor.yy455;
      case 258: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
{yylhsminor.yy11 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy102, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy528);}
  yymsp[-5].minor.yy11 = yylhsminor.yy11;
        break;
      case 258: /* trigger_cmd ::= scanpt select scanpt */
{yylhsminor.yy455 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy457, yymsp[-2].minor.yy294, yymsp[0].minor.yy294); /*yylhsminor.yy455-overwrites-yymsp[-1].minor.yy457*/}
  yymsp[-2].minor.yy455 = yylhsminor.yy455;
      case 259: /* trigger_cmd ::= scanpt select scanpt */
{yylhsminor.yy11 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy391, yymsp[-2].minor.yy528, yymsp[0].minor.yy528); /*yylhsminor.yy11-overwrites-yymsp[-1].minor.yy391*/}
  yymsp[-2].minor.yy11 = yylhsminor.yy11;
        break;
      case 259: /* expr ::= RAISE LP IGNORE RP */
      case 260: /* expr ::= RAISE LP IGNORE RP */
{
  yymsp[-3].minor.yy524 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); 
  if( yymsp[-3].minor.yy524 ){
    yymsp[-3].minor.yy524->affinity = OE_Ignore;
  yymsp[-3].minor.yy102 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); 
  if( yymsp[-3].minor.yy102 ){
    yymsp[-3].minor.yy102->affinity = OE_Ignore;
  }
}
        break;
      case 260: /* expr ::= RAISE LP raisetype COMMA nm RP */
      case 261: /* expr ::= RAISE LP raisetype COMMA nm RP */
{
  yymsp[-5].minor.yy524 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); 
  if( yymsp[-5].minor.yy524 ) {
    yymsp[-5].minor.yy524->affinity = (char)yymsp[-3].minor.yy494;
  yymsp[-5].minor.yy102 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); 
  if( yymsp[-5].minor.yy102 ) {
    yymsp[-5].minor.yy102->affinity = (char)yymsp[-3].minor.yy100;
  }
}
        break;
      case 261: /* raisetype ::= ROLLBACK */
{yymsp[0].minor.yy494 = OE_Rollback;}
      case 262: /* raisetype ::= ROLLBACK */
{yymsp[0].minor.yy100 = OE_Rollback;}
        break;
      case 263: /* raisetype ::= FAIL */
{yymsp[0].minor.yy494 = OE_Fail;}
      case 264: /* raisetype ::= FAIL */
{yymsp[0].minor.yy100 = OE_Fail;}
        break;
      case 264: /* cmd ::= DROP TRIGGER ifexists fullname */
      case 265: /* cmd ::= DROP TRIGGER ifexists fullname */
{
  sqlite3DropTrigger(pParse,yymsp[0].minor.yy483,yymsp[-1].minor.yy494);
  sqlite3DropTrigger(pParse,yymsp[0].minor.yy407,yymsp[-1].minor.yy100);
}
        break;
      case 265: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
      case 266: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
{
  sqlite3Attach(pParse, yymsp[-3].minor.yy524, yymsp[-1].minor.yy524, yymsp[0].minor.yy524);
  sqlite3Attach(pParse, yymsp[-3].minor.yy102, yymsp[-1].minor.yy102, yymsp[0].minor.yy102);
}
        break;
      case 266: /* cmd ::= DETACH database_kw_opt expr */
      case 267: /* cmd ::= DETACH database_kw_opt expr */
{
  sqlite3Detach(pParse, yymsp[0].minor.yy524);
  sqlite3Detach(pParse, yymsp[0].minor.yy102);
}
        break;
      case 269: /* cmd ::= REINDEX */
      case 270: /* cmd ::= REINDEX */
{sqlite3Reindex(pParse, 0, 0);}
        break;
      case 270: /* cmd ::= REINDEX nm dbnm */
      case 271: /* cmd ::= REINDEX nm dbnm */
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
        break;
      case 271: /* cmd ::= ANALYZE */
      case 272: /* cmd ::= ANALYZE */
{sqlite3Analyze(pParse, 0, 0);}
        break;
      case 272: /* cmd ::= ANALYZE nm dbnm */
      case 273: /* cmd ::= ANALYZE nm dbnm */
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
        break;
      case 273: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
      case 274: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
{
  sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy483,&yymsp[0].minor.yy0);
  sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy407,&yymsp[0].minor.yy0);
}
        break;
      case 274: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
      case 275: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
{
  yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
  sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
}
        break;
      case 275: /* add_column_fullname ::= fullname */
      case 276: /* add_column_fullname ::= fullname */
{
  disableLookaside(pParse);
  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy483);
  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy407);
}
        break;
      case 276: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
      case 277: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
{
  sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy483, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
  sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy407, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
        break;
      case 277: /* cmd ::= create_vtab */
      case 278: /* cmd ::= create_vtab */
{sqlite3VtabFinishParse(pParse,0);}
        break;
      case 278: /* cmd ::= create_vtab LP vtabarglist RP */
      case 279: /* cmd ::= create_vtab LP vtabarglist RP */
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
        break;
      case 279: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
      case 280: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
{
    sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy494);
    sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy100);
}
        break;
      case 280: /* vtabarg ::= */
      case 281: /* vtabarg ::= */
{sqlite3VtabArgInit(pParse);}
        break;
      case 281: /* vtabargtoken ::= ANY */
      case 282: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==282);
      case 283: /* lp ::= LP */ yytestcase(yyruleno==283);
      case 282: /* vtabargtoken ::= ANY */
      case 283: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==283);
      case 284: /* lp ::= LP */ yytestcase(yyruleno==284);
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
        break;
      case 284: /* with ::= WITH wqlist */
      case 285: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==285);
{ sqlite3WithPush(pParse, yymsp[0].minor.yy59, 1); }
      case 285: /* with ::= WITH wqlist */
      case 286: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==286);
{ sqlite3WithPush(pParse, yymsp[0].minor.yy243, 1); }
        break;
      case 286: /* wqlist ::= nm eidlist_opt AS LP select RP */
      case 287: /* wqlist ::= nm eidlist_opt AS LP select RP */
{
  yymsp[-5].minor.yy59 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy434, yymsp[-1].minor.yy457); /*A-overwrites-X*/
  yymsp[-5].minor.yy243 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy94, yymsp[-1].minor.yy391); /*A-overwrites-X*/
}
        break;
      case 287: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
      case 288: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
{
  yymsp[-7].minor.yy59 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy59, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy434, yymsp[-1].minor.yy457);
  yymsp[-7].minor.yy243 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy243, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy94, yymsp[-1].minor.yy391);
}
        break;
      case 288: /* windowdefn_list ::= windowdefn */
{ yylhsminor.yy295 = yymsp[0].minor.yy295; }
  yymsp[0].minor.yy295 = yylhsminor.yy295;
      case 289: /* windowdefn_list ::= windowdefn */
{ yylhsminor.yy379 = yymsp[0].minor.yy379; }
  yymsp[0].minor.yy379 = yylhsminor.yy379;
        break;
      case 289: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
      case 290: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
{
  assert( yymsp[0].minor.yy295!=0 );
  sqlite3WindowChain(pParse, yymsp[0].minor.yy295, yymsp[-2].minor.yy295);
  yymsp[0].minor.yy295->pNextWin = yymsp[-2].minor.yy295;
  yylhsminor.yy295 = yymsp[0].minor.yy295;
  assert( yymsp[0].minor.yy379!=0 );
  sqlite3WindowChain(pParse, yymsp[0].minor.yy379, yymsp[-2].minor.yy379);
  yymsp[0].minor.yy379->pNextWin = yymsp[-2].minor.yy379;
  yylhsminor.yy379 = yymsp[0].minor.yy379;
}
  yymsp[-2].minor.yy295 = yylhsminor.yy295;
  yymsp[-2].minor.yy379 = yylhsminor.yy379;
        break;
      case 290: /* windowdefn ::= nm AS LP window RP */
      case 291: /* windowdefn ::= nm AS LP window RP */
{
  if( ALWAYS(yymsp[-1].minor.yy295) ){
    yymsp[-1].minor.yy295->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
  if( ALWAYS(yymsp[-1].minor.yy379) ){
    yymsp[-1].minor.yy379->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
  }
  yylhsminor.yy295 = yymsp[-1].minor.yy295;
  yylhsminor.yy379 = yymsp[-1].minor.yy379;
}
  yymsp[-4].minor.yy295 = yylhsminor.yy295;
  yymsp[-4].minor.yy379 = yylhsminor.yy379;
        break;
      case 291: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
      case 292: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
{
  yymsp[-4].minor.yy295 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy295, yymsp[-2].minor.yy434, yymsp[-1].minor.yy434, 0);
  yymsp[-4].minor.yy379 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy379, yymsp[-2].minor.yy94, yymsp[-1].minor.yy94, 0);
}
        break;
      case 292: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
      case 293: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
{
  yylhsminor.yy295 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy295, yymsp[-2].minor.yy434, yymsp[-1].minor.yy434, &yymsp[-5].minor.yy0);
  yylhsminor.yy379 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy379, yymsp[-2].minor.yy94, yymsp[-1].minor.yy94, &yymsp[-5].minor.yy0);
}
  yymsp[-5].minor.yy295 = yylhsminor.yy295;
  yymsp[-5].minor.yy379 = yylhsminor.yy379;
        break;
      case 293: /* window ::= ORDER BY sortlist frame_opt */
      case 294: /* window ::= ORDER BY sortlist frame_opt */
{
  yymsp[-3].minor.yy295 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy295, 0, yymsp[-1].minor.yy434, 0);
  yymsp[-3].minor.yy379 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy379, 0, yymsp[-1].minor.yy94, 0);
}
        break;
      case 294: /* window ::= nm ORDER BY sortlist frame_opt */
      case 295: /* window ::= nm ORDER BY sortlist frame_opt */
{
  yylhsminor.yy295 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy295, 0, yymsp[-1].minor.yy434, &yymsp[-4].minor.yy0);
  yylhsminor.yy379 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy379, 0, yymsp[-1].minor.yy94, &yymsp[-4].minor.yy0);
}
  yymsp[-4].minor.yy295 = yylhsminor.yy295;
  yymsp[-4].minor.yy379 = yylhsminor.yy379;
        break;
      case 295: /* window ::= frame_opt */
      case 296: /* window ::= frame_opt */
{
  yylhsminor.yy295 = yymsp[0].minor.yy295;
  yylhsminor.yy379 = yymsp[0].minor.yy379;
}
  yymsp[0].minor.yy295 = yylhsminor.yy295;
  yymsp[0].minor.yy379 = yylhsminor.yy379;
        break;
      case 296: /* window ::= nm frame_opt */
      case 297: /* window ::= nm frame_opt */
{
  yylhsminor.yy295 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy295, 0, 0, &yymsp[-1].minor.yy0);
  yylhsminor.yy379 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy379, 0, 0, &yymsp[-1].minor.yy0);
}
  yymsp[-1].minor.yy295 = yylhsminor.yy295;
  yymsp[-1].minor.yy379 = yylhsminor.yy379;
        break;
      case 297: /* frame_opt ::= */
      case 298: /* frame_opt ::= */
{ 
  yymsp[1].minor.yy295 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
  yymsp[1].minor.yy379 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
}
        break;
      case 298: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
      case 299: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
{ 
  yylhsminor.yy295 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy494, yymsp[-1].minor.yy201.eType, yymsp[-1].minor.yy201.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy238);
  yylhsminor.yy379 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy100, yymsp[-1].minor.yy389.eType, yymsp[-1].minor.yy389.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy218);
}
  yymsp[-2].minor.yy295 = yylhsminor.yy295;
  yymsp[-2].minor.yy379 = yylhsminor.yy379;
        break;
      case 299: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
      case 300: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
{ 
  yylhsminor.yy295 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy494, yymsp[-3].minor.yy201.eType, yymsp[-3].minor.yy201.pExpr, yymsp[-1].minor.yy201.eType, yymsp[-1].minor.yy201.pExpr, yymsp[0].minor.yy238);
  yylhsminor.yy379 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy100, yymsp[-3].minor.yy389.eType, yymsp[-3].minor.yy389.pExpr, yymsp[-1].minor.yy389.eType, yymsp[-1].minor.yy389.pExpr, yymsp[0].minor.yy218);
}
  yymsp[-5].minor.yy295 = yylhsminor.yy295;
  yymsp[-5].minor.yy379 = yylhsminor.yy379;
        break;
      case 301: /* frame_bound_s ::= frame_bound */
      case 303: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==303);
{yylhsminor.yy201 = yymsp[0].minor.yy201;}
  yymsp[0].minor.yy201 = yylhsminor.yy201;
      case 302: /* frame_bound_s ::= frame_bound */
      case 304: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==304);
{yylhsminor.yy389 = yymsp[0].minor.yy389;}
  yymsp[0].minor.yy389 = yylhsminor.yy389;
        break;
      case 302: /* frame_bound_s ::= UNBOUNDED PRECEDING */
      case 304: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==304);
      case 306: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==306);
{yylhsminor.yy201.eType = yymsp[-1].major; yylhsminor.yy201.pExpr = 0;}
  yymsp[-1].minor.yy201 = yylhsminor.yy201;
      case 303: /* frame_bound_s ::= UNBOUNDED PRECEDING */
      case 305: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==305);
      case 307: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==307);
{yylhsminor.yy389.eType = yymsp[-1].major; yylhsminor.yy389.pExpr = 0;}
  yymsp[-1].minor.yy389 = yylhsminor.yy389;
        break;
      case 305: /* frame_bound ::= expr PRECEDING|FOLLOWING */
{yylhsminor.yy201.eType = yymsp[0].major; yylhsminor.yy201.pExpr = yymsp[-1].minor.yy524;}
  yymsp[-1].minor.yy201 = yylhsminor.yy201;
      case 306: /* frame_bound ::= expr PRECEDING|FOLLOWING */
{yylhsminor.yy389.eType = yymsp[0].major; yylhsminor.yy389.pExpr = yymsp[-1].minor.yy102;}
  yymsp[-1].minor.yy389 = yylhsminor.yy389;
        break;
      case 307: /* frame_exclude_opt ::= */
{yymsp[1].minor.yy238 = 0;}
      case 308: /* frame_exclude_opt ::= */
{yymsp[1].minor.yy218 = 0;}
        break;
      case 308: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
{yymsp[-1].minor.yy238 = yymsp[0].minor.yy238;}
      case 309: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
{yymsp[-1].minor.yy218 = yymsp[0].minor.yy218;}
        break;
      case 309: /* frame_exclude ::= NO OTHERS */
      case 310: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==310);
{yymsp[-1].minor.yy238 = yymsp[-1].major; /*A-overwrites-X*/}
      case 310: /* frame_exclude ::= NO OTHERS */
      case 311: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==311);
{yymsp[-1].minor.yy218 = yymsp[-1].major; /*A-overwrites-X*/}
        break;
      case 311: /* frame_exclude ::= GROUP|TIES */
{yymsp[0].minor.yy238 = yymsp[0].major; /*A-overwrites-X*/}
      case 312: /* frame_exclude ::= GROUP|TIES */
{yymsp[0].minor.yy218 = yymsp[0].major; /*A-overwrites-X*/}
        break;
      case 312: /* window_clause ::= WINDOW windowdefn_list */
{ yymsp[-1].minor.yy295 = yymsp[0].minor.yy295; }
      case 313: /* window_clause ::= WINDOW windowdefn_list */
{ yymsp[-1].minor.yy379 = yymsp[0].minor.yy379; }
        break;
      case 313: /* over_clause ::= filter_opt OVER LP window RP */
      case 314: /* over_clause ::= filter_opt OVER LP window RP */
{
  yylhsminor.yy295 = yymsp[-1].minor.yy295;
  assert( yylhsminor.yy295!=0 );
  yylhsminor.yy295->pFilter = yymsp[-4].minor.yy524;
  yylhsminor.yy379 = yymsp[-1].minor.yy379;
  assert( yylhsminor.yy379!=0 );
  yylhsminor.yy379->pFilter = yymsp[-4].minor.yy102;
}
  yymsp[-4].minor.yy295 = yylhsminor.yy295;
  yymsp[-4].minor.yy379 = yylhsminor.yy379;
        break;
      case 314: /* over_clause ::= filter_opt OVER nm */
      case 315: /* over_clause ::= filter_opt OVER nm */
{
  yylhsminor.yy295 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( yylhsminor.yy295 ){
    yylhsminor.yy295->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
    yylhsminor.yy295->pFilter = yymsp[-2].minor.yy524;
  yylhsminor.yy379 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( yylhsminor.yy379 ){
    yylhsminor.yy379->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
    yylhsminor.yy379->pFilter = yymsp[-2].minor.yy102;
  }else{
    sqlite3ExprDelete(pParse->db, yymsp[-2].minor.yy524);
    sqlite3ExprDelete(pParse->db, yymsp[-2].minor.yy102);
  }
}
  yymsp[-2].minor.yy295 = yylhsminor.yy295;
  yymsp[-2].minor.yy379 = yylhsminor.yy379;
        break;
      case 316: /* filter_opt ::= FILTER LP WHERE expr RP */
{ yymsp[-4].minor.yy524 = yymsp[-1].minor.yy524; }
      case 317: /* filter_opt ::= FILTER LP WHERE expr RP */
{ yymsp[-4].minor.yy102 = yymsp[-1].minor.yy102; }
        break;
      default:
      /* (317) input ::= cmdlist */ yytestcase(yyruleno==317);
      /* (318) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==318);
      /* (319) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=319);
      /* (320) ecmd ::= SEMI */ yytestcase(yyruleno==320);
      /* (321) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==321);
      /* (322) ecmd ::= explain cmdx */ yytestcase(yyruleno==322);
      /* (323) trans_opt ::= */ yytestcase(yyruleno==323);
      /* (324) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==324);
      /* (325) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==325);
      /* (326) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==326);
      /* (327) savepoint_opt ::= */ yytestcase(yyruleno==327);
      /* (328) cmd ::= create_table create_table_args */ yytestcase(yyruleno==328);
      /* (329) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==329);
      /* (330) columnlist ::= columnname carglist */ yytestcase(yyruleno==330);
      /* (331) nm ::= ID|INDEXED */ yytestcase(yyruleno==331);
      /* (332) nm ::= STRING */ yytestcase(yyruleno==332);
      /* (333) nm ::= JOIN_KW */ yytestcase(yyruleno==333);
      /* (334) typetoken ::= typename */ yytestcase(yyruleno==334);
      /* (335) typename ::= ID|STRING */ yytestcase(yyruleno==335);
      /* (336) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=336);
      /* (337) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=337);
      /* (338) carglist ::= carglist ccons */ yytestcase(yyruleno==338);
      /* (339) carglist ::= */ yytestcase(yyruleno==339);
      /* (340) ccons ::= NULL onconf */ yytestcase(yyruleno==340);
      /* (341) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==341);
      /* (342) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==342);
      /* (343) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=343);
      /* (344) tconscomma ::= */ yytestcase(yyruleno==344);
      /* (345) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=345);
      /* (346) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=346);
      /* (347) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=347);
      /* (348) oneselect ::= values */ yytestcase(yyruleno==348);
      /* (349) sclp ::= selcollist COMMA */ yytestcase(yyruleno==349);
      /* (350) as ::= ID|STRING */ yytestcase(yyruleno==350);
      /* (351) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=351);
      /* (352) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==352);
      /* (353) exprlist ::= nexprlist */ yytestcase(yyruleno==353);
      /* (354) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=354);
      /* (355) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=355);
      /* (356) nmnum ::= ON */ yytestcase(yyruleno==356);
      /* (357) nmnum ::= DELETE */ yytestcase(yyruleno==357);
      /* (358) nmnum ::= DEFAULT */ yytestcase(yyruleno==358);
      /* (359) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==359);
      /* (360) foreach_clause ::= */ yytestcase(yyruleno==360);
      /* (361) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==361);
      /* (362) trnm ::= nm */ yytestcase(yyruleno==362);
      /* (363) tridxby ::= */ yytestcase(yyruleno==363);
      /* (364) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==364);
      /* (365) database_kw_opt ::= */ yytestcase(yyruleno==365);
      /* (366) kwcolumn_opt ::= */ yytestcase(yyruleno==366);
      /* (367) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==367);
      /* (368) vtabarglist ::= vtabarg */ yytestcase(yyruleno==368);
      /* (369) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==369);
      /* (370) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==370);
      /* (371) anylist ::= */ yytestcase(yyruleno==371);
      /* (372) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==372);
      /* (373) anylist ::= anylist ANY */ yytestcase(yyruleno==373);
      /* (374) with ::= */ yytestcase(yyruleno==374);
      /* (318) input ::= cmdlist */ yytestcase(yyruleno==318);
      /* (319) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==319);
      /* (320) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=320);
      /* (321) ecmd ::= SEMI */ yytestcase(yyruleno==321);
      /* (322) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==322);
      /* (323) ecmd ::= explain cmdx */ yytestcase(yyruleno==323);
      /* (324) trans_opt ::= */ yytestcase(yyruleno==324);
      /* (325) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==325);
      /* (326) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==326);
      /* (327) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==327);
      /* (328) savepoint_opt ::= */ yytestcase(yyruleno==328);
      /* (329) cmd ::= create_table create_table_args */ yytestcase(yyruleno==329);
      /* (330) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==330);
      /* (331) columnlist ::= columnname carglist */ yytestcase(yyruleno==331);
      /* (332) nm ::= ID|INDEXED */ yytestcase(yyruleno==332);
      /* (333) nm ::= STRING */ yytestcase(yyruleno==333);
      /* (334) nm ::= JOIN_KW */ yytestcase(yyruleno==334);
      /* (335) typetoken ::= typename */ yytestcase(yyruleno==335);
      /* (336) typename ::= ID|STRING */ yytestcase(yyruleno==336);
      /* (337) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=337);
      /* (338) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=338);
      /* (339) carglist ::= carglist ccons */ yytestcase(yyruleno==339);
      /* (340) carglist ::= */ yytestcase(yyruleno==340);
      /* (341) ccons ::= NULL onconf */ yytestcase(yyruleno==341);
      /* (342) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==342);
      /* (343) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==343);
      /* (344) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=344);
      /* (345) tconscomma ::= */ yytestcase(yyruleno==345);
      /* (346) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=346);
      /* (347) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=347);
      /* (348) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=348);
      /* (349) oneselect ::= values */ yytestcase(yyruleno==349);
      /* (350) sclp ::= selcollist COMMA */ yytestcase(yyruleno==350);
      /* (351) as ::= ID|STRING */ yytestcase(yyruleno==351);
      /* (352) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=352);
      /* (353) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==353);
      /* (354) exprlist ::= nexprlist */ yytestcase(yyruleno==354);
      /* (355) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=355);
      /* (356) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=356);
      /* (357) nmnum ::= ON */ yytestcase(yyruleno==357);
      /* (358) nmnum ::= DELETE */ yytestcase(yyruleno==358);
      /* (359) nmnum ::= DEFAULT */ yytestcase(yyruleno==359);
      /* (360) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==360);
      /* (361) foreach_clause ::= */ yytestcase(yyruleno==361);
      /* (362) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==362);
      /* (363) trnm ::= nm */ yytestcase(yyruleno==363);
      /* (364) tridxby ::= */ yytestcase(yyruleno==364);
      /* (365) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==365);
      /* (366) database_kw_opt ::= */ yytestcase(yyruleno==366);
      /* (367) kwcolumn_opt ::= */ yytestcase(yyruleno==367);
      /* (368) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==368);
      /* (369) vtabarglist ::= vtabarg */ yytestcase(yyruleno==369);
      /* (370) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==370);
      /* (371) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==371);
      /* (372) anylist ::= */ yytestcase(yyruleno==372);
      /* (373) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==373);
      /* (374) anylist ::= anylist ANY */ yytestcase(yyruleno==374);
      /* (375) with ::= */ yytestcase(yyruleno==375);
        break;
/********** End reduce actions ************************************************/
  };
  assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
  yygoto = yyRuleInfoLhs[yyruleno];
  yysize = yyRuleInfoNRhs[yyruleno];
  yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);
155456
155457
155458
155459
155460
155461
155462



155463
155464
155465
155466
155467
155468
155469
156040
156041
156042
156043
156044
156045
156046
156047
156048
156049
156050
156051
156052
156053
156054
156055
156056







+
+
+







        { SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE,      SQLITE_NoCkptOnClose  },
        { SQLITE_DBCONFIG_ENABLE_QPSG,           SQLITE_EnableQPSG     },
        { SQLITE_DBCONFIG_TRIGGER_EQP,           SQLITE_TriggerEQP     },
        { SQLITE_DBCONFIG_RESET_DATABASE,        SQLITE_ResetDatabase  },
        { SQLITE_DBCONFIG_DEFENSIVE,             SQLITE_Defensive      },
        { SQLITE_DBCONFIG_WRITABLE_SCHEMA,       SQLITE_WriteSchema|
                                                 SQLITE_NoSchemaError  },
        { SQLITE_DBCONFIG_LEGACY_ALTER_TABLE,    SQLITE_LegacyAlter    },
        { SQLITE_DBCONFIG_DQS_DDL,               SQLITE_DqsDDL         },
        { SQLITE_DBCONFIG_DQS_DML,               SQLITE_DqsDML         },
      };
      unsigned int i;
      rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
      for(i=0; i<ArraySize(aFlagOp); i++){
        if( aFlagOp[i].op==op ){
          int onoff = va_arg(ap, int);
          int *pRes = va_arg(ap, int*);
155486
155487
155488
155489
155490
155491
155492
155493
155494
155495
155496
155497
155498
155499
155500
155501
155502
155503
155504
155505
155506
155507
155508
155509
155510

155511
155512
155513
155514

155515
155516
155517
155518
155519
155520
155521
155522
155523
155524
155525
155526
155527
155528
155529
155530
155531
155532
155533
155534
155535



















155536
155537
155538
155539
155540
155541
155542

155543
155544

155545
155546
155547
155548
155549
155550
155551
156073
156074
156075
156076
156077
156078
156079









156080
156081
156082



156083
156084

156085
156086
156087
156088
156089
156090
156091
156092
156093
156094
156095
156096
156097














156098
156099
156100
156101
156102
156103
156104
156105
156106
156107
156108
156109
156110
156111
156112
156113
156114
156115
156116
156117
156118
156119
156120
156121
156122

156123


156124
156125
156126
156127
156128
156129
156130
156131







-
-
-
-
-
-
-
-
-



-
-
-


-
+




+







-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+






-
+
-
-
+







      break;
    }
  }
  va_end(ap);
  return rc;
}


/*
** Return true if the buffer z[0..n-1] contains all spaces.
*/
static int allSpaces(const char *z, int n){
  while( n>0 && z[n-1]==' ' ){ n--; }
  return n==0;
}

/*
** This is the default collating function named "BINARY" which is always
** available.
**
** If the padFlag argument is not NULL then space padding at the end
** of strings is ignored.  This implements the RTRIM collation.
*/
static int binCollFunc(
  void *padFlag,
  void *NotUsed,
  int nKey1, const void *pKey1,
  int nKey2, const void *pKey2
){
  int rc, n;
  UNUSED_PARAMETER(NotUsed);
  n = nKey1<nKey2 ? nKey1 : nKey2;
  /* EVIDENCE-OF: R-65033-28449 The built-in BINARY collation compares
  ** strings byte by byte using the memcmp() function from the standard C
  ** library. */
  assert( pKey1 && pKey2 );
  rc = memcmp(pKey1, pKey2, n);
  if( rc==0 ){
    if( padFlag
     && allSpaces(((char*)pKey1)+n, nKey1-n)
     && allSpaces(((char*)pKey2)+n, nKey2-n)
    ){
      /* EVIDENCE-OF: R-31624-24737 RTRIM is like BINARY except that extra
      ** spaces at the end of either string do not change the result. In other
      ** words, strings will compare equal to one another as long as they
      ** differ only in the number of spaces at the end.
      */
    }else{
      rc = nKey1 - nKey2;
    }
  }
  return rc;
    rc = nKey1 - nKey2;
  }
  return rc;
}

/*
** This is the collating function named "RTRIM" which is always
** available.  Ignore trailing spaces.
*/
static int rtrimCollFunc(
  void *pUser,
  int nKey1, const void *pKey1,
  int nKey2, const void *pKey2
){
  const u8 *pK1 = (const u8*)pKey1;
  const u8 *pK2 = (const u8*)pKey2;
  while( nKey1 && pK1[nKey1-1]==' ' ) nKey1--;
  while( nKey2 && pK2[nKey2-1]==' ' ) nKey2--;
  return binCollFunc(pUser, nKey1, pKey1, nKey2, pKey2);
}

/*
** Return true if CollSeq is the default built-in BINARY.
*/
SQLITE_PRIVATE int sqlite3IsBinary(const CollSeq *p){
  assert( p==0 || p->xCmp!=binCollFunc || p->pUser!=0
  assert( p==0 || p->xCmp!=binCollFunc || strcmp(p->zName,"BINARY")==0 );
            || strcmp(p->zName,"BINARY")==0 );
  return p==0 || (p->xCmp==binCollFunc && p->pUser==0);
  return p==0 || p->xCmp==binCollFunc;
}

/*
** Another built-in collating sequence: NOCASE. 
**
** This collating sequence is intended to be used for "case independent
** comparison". SQLite's knowledge of upper and lower case equivalents
157688
157689
157690
157691
157692
157693
157694
157695





























157696
157697
157698
157699
157700
157701
157702
158268
158269
158270
158271
158272
158273
158274

158275
158276
158277
158278
158279
158280
158281
158282
158283
158284
158285
158286
158287
158288
158289
158290
158291
158292
158293
158294
158295
158296
158297
158298
158299
158300
158301
158302
158303
158304
158305
158306
158307
158308
158309
158310







-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







  memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));
  db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS;
  db->autoCommit = 1;
  db->nextAutovac = -1;
  db->szMmap = sqlite3GlobalConfig.szMmap;
  db->nextPagesize = 0;
  db->nMaxSorterMmap = 0x7FFFFFFF;
  db->flags |= SQLITE_ShortColNames | SQLITE_EnableTrigger | SQLITE_CacheSpill
  db->flags |= SQLITE_ShortColNames
                 | SQLITE_EnableTrigger
                 | SQLITE_CacheSpill

/* The SQLITE_DQS compile-time option determines the default settings
** for SQLITE_DBCONFIG_DQS_DDL and SQLITE_DBCONFIG_DQS_DML.
**
**    SQLITE_DQS     SQLITE_DBCONFIG_DQS_DDL    SQLITE_DBCONFIG_DQS_DML
**    ----------     -----------------------    -----------------------
**     undefined               on                          on   
**         3                   on                          on
**         2                   on                         off
**         1                  off                          on
**         0                  off                         off
**
** Legacy behavior is 3 (double-quoted string literals are allowed anywhere)
** and so that is the default.  But developers are encouranged to use
** -DSQLITE_DQS=0 (best) or -DSQLITE_DQS=1 (second choice) if possible.
*/
#if !defined(SQLITE_DQS)
# define SQLITE_DQS 3
#endif
#if (SQLITE_DQS&1)==1
                 | SQLITE_DqsDML
#endif
#if (SQLITE_DQS&2)==2
                 | SQLITE_DqsDDL
#endif

#if !defined(SQLITE_DEFAULT_AUTOMATIC_INDEX) || SQLITE_DEFAULT_AUTOMATIC_INDEX
                 | SQLITE_AutoIndex
#endif
#if SQLITE_DEFAULT_CKPTFULLFSYNC
                 | SQLITE_CkptFullFSync
#endif
#if SQLITE_DEFAULT_FILE_FORMAT<4
157739
157740
157741
157742
157743
157744
157745
157746

157747
157748
157749
157750
157751
157752
157753
158347
158348
158349
158350
158351
158352
158353

158354
158355
158356
158357
158358
158359
158360
158361







-
+







  ** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating
  ** functions:
  */
  createCollation(db, sqlite3StrBINARY, SQLITE_UTF8, 0, binCollFunc, 0);
  createCollation(db, sqlite3StrBINARY, SQLITE_UTF16BE, 0, binCollFunc, 0);
  createCollation(db, sqlite3StrBINARY, SQLITE_UTF16LE, 0, binCollFunc, 0);
  createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);
  createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
  createCollation(db, "RTRIM", SQLITE_UTF8, 0, rtrimCollFunc, 0);
  if( db->mallocFailed ){
    goto opendb_out;
  }
  /* EVIDENCE-OF: R-08308-17224 The default collating function for all
  ** strings is BINARY. 
  */
  db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, sqlite3StrBINARY, 0);
158715
158716
158717
158718
158719
158720
158721
















158722
158723
158724
158725
158726
158727
158728
159323
159324
159325
159326
159327
159328
159329
159330
159331
159332
159333
159334
159335
159336
159337
159338
159339
159340
159341
159342
159343
159344
159345
159346
159347
159348
159349
159350
159351
159352







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







    */
    case SQLITE_TESTCTRL_PARSER_COVERAGE: {
      FILE *out = va_arg(ap, FILE*);
      if( sqlite3ParserCoverage(out) ) rc = SQLITE_ERROR;
      break;
    }
#endif /* defined(YYCOVERAGE) */

    /*  sqlite3_test_control(SQLITE_TESTCTRL_RESULT_INTREAL, sqlite3_context*);
    **
    ** This test-control causes the most recent sqlite3_result_int64() value
    ** to be interpreted as a MEM_IntReal instead of as an MEM_Int.  Normally,
    ** MEM_IntReal values only arise during an INSERT operation of integer
    ** values into a REAL column, so they can be challenging to test.  This
    ** test-control enables us to write an intreal() SQL function that can
    ** inject an intreal() value at arbitrary places in an SQL statement,
    ** for testing purposes.
    */
    case SQLITE_TESTCTRL_RESULT_INTREAL: {
      sqlite3_context *pCtx = va_arg(ap, sqlite3_context*);
      sqlite3ResultIntReal(pCtx);
      break;
    }
  }
  va_end(ap);
#endif /* SQLITE_UNTESTABLE */
  return rc;
}

/*
172993
172994
172995
172996
172997
172998
172999
173000

173001
173002
173003
173004
173005
173006
173007

173008
173009
173010
173011
173012
173013
173014
173617
173618
173619
173620
173621
173622
173623

173624
173625
173626
173627
173628
173629
173630

173631
173632
173633
173634
173635
173636
173637
173638







-
+






-
+







    if( iCol==iCurrent ){
      nList = (int)(p - pList);
      break;
    }

    nList -= (int)(p - pList);
    pList = p;
    if( nList==0 ){
    if( nList<=0 ){
      break;
    }
    p = &pList[1];
    p += fts3GetVarint32(p, &iCurrent);
  }

  if( bZero && &pList[nList]!=pEnd ){
  if( bZero && (pEnd - &pList[nList])>0){
    memset(&pList[nList], 0, pEnd - &pList[nList]);
  }
  *ppList = pList;
  *pnList = nList;
}

/*
174128
174129
174130
174131
174132
174133
174134
174135

174136
174137
174138
174139
174140
174141
174142
174143
174144
174145
174146
174147
174148
174149
174150
174151
174152
174153
174154

174155
174156
174157
174158
174159
174160
174161
174752
174753
174754
174755
174756
174757
174758

174759
174760
174761
174762
174763
174764
174765
174766
174767
174768
174769
174770
174771
174772
174773
174774
174775
174776
174777

174778
174779
174780
174781
174782
174783
174784
174785







-
+


















-
+







    p->aNode = 0;
  }else{
    if( bFirst==0 ){
      p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nPrefix);
    }
    p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nSuffix);

    if( nPrefix>p->iOff || nSuffix>p->nNode-p->iOff ){
    if( nPrefix>p->term.n || nSuffix>p->nNode-p->iOff || nSuffix==0 ){
      return FTS_CORRUPT_VTAB;
    }
    blobGrowBuffer(&p->term, nPrefix+nSuffix, &rc);
    if( rc==SQLITE_OK ){
      memcpy(&p->term.a[nPrefix], &p->aNode[p->iOff], nSuffix);
      p->term.n = nPrefix+nSuffix;
      p->iOff += nSuffix;
      if( p->iChild==0 ){
        p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &p->nDoclist);
        if( (p->nNode-p->iOff)<p->nDoclist ){
          return FTS_CORRUPT_VTAB;
        }
        p->aDoclist = &p->aNode[p->iOff];
        p->iOff += p->nDoclist;
      }
    }
  }

  assert( p->iOff<=p->nNode );
  assert_fts3_nc( p->iOff<=p->nNode );
  return rc;
}

/*
** Release all dynamic resources held by node-reader object *p.
*/
static void nodeReaderRelease(NodeReader *p){
174308
174309
174310
174311
174312
174313
174314
174315

174316
174317
174318
174319
174320
174321
174322
174932
174933
174934
174935
174936
174937
174938

174939
174940
174941
174942
174943
174944
174945
174946







-
+







  int bFirst = (pPrev->n==0);     /* True if this is the first term written */
  int nPrefix;                    /* Size of term prefix in bytes */
  int nSuffix;                    /* Size of term suffix in bytes */

  /* Node must have already been started. There must be a doclist for a
  ** leaf node, and there must not be a doclist for an internal node.  */
  assert( pNode->n>0 );
  assert( (pNode->a[0]=='\0')==(aDoclist!=0) );
  assert_fts3_nc( (pNode->a[0]=='\0')==(aDoclist!=0) );

  blobGrowBuffer(pPrev, nTerm, &rc);
  if( rc!=SQLITE_OK ) return rc;

  nPrefix = fts3PrefixCompress(pPrev->a, pPrev->n, zTerm, nTerm);
  nSuffix = nTerm - nPrefix;
  memcpy(pPrev->a, zTerm, nTerm);
174524
174525
174526
174527
174528
174529
174530
174531

174532
174533
174534
174535
174536
174537
174538
175148
175149
175150
175151
175152
175153
175154

175155
175156
175157
175158
175159
175160
175161
175162







-
+







static int fts3TermCmp(
  const char *zLhs, int nLhs,     /* LHS of comparison */
  const char *zRhs, int nRhs      /* RHS of comparison */
){
  int nCmp = MIN(nLhs, nRhs);
  int res;

  res = memcmp(zLhs, zRhs, nCmp);
  res = (nCmp ? memcmp(zLhs, zRhs, nCmp) : 0);
  if( res==0 ) res = nLhs - nRhs;

  return res;
}


/*
174656
174657
174658
174659
174660
174661
174662
174663



174664
174665
174666

174667
174668
174669
174670
174671
174672
174673

174674
174675
174676
174677
174678
174679
174680
174681
174682
174683
174684
174685
174686
174687
174688
174689
174690





















174691
174692
174693
174694
174695
174696
174697
175280
175281
175282
175283
175284
175285
175286

175287
175288
175289
175290
175291
175292
175293
175294
175295
175296
175297
175298
175299
175300
175301

















175302
175303
175304
175305
175306
175307
175308
175309
175310
175311
175312
175313
175314
175315
175316
175317
175318
175319
175320
175321
175322
175323
175324
175325
175326
175327
175328
175329







-
+
+
+



+







+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








      for(i=nHeight+1; i<FTS_MAX_APPENDABLE_HEIGHT; i++){
        pWriter->aNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst;
      }

      pNode = &pWriter->aNodeWriter[nHeight];
      pNode->iBlock = pWriter->iStart + pWriter->nLeafEst*nHeight;
      blobGrowBuffer(&pNode->block, MAX(nRoot, p->nNodeSize), &rc);
      blobGrowBuffer(&pNode->block, 
          MAX(nRoot, p->nNodeSize)+FTS3_NODE_PADDING, &rc
      );
      if( rc==SQLITE_OK ){
        memcpy(pNode->block.a, aRoot, nRoot);
        pNode->block.n = nRoot;
        memset(&pNode->block.a[nRoot], 0, FTS3_NODE_PADDING);
      }

      for(i=nHeight; i>=0 && rc==SQLITE_OK; i--){
        NodeReader reader;
        pNode = &pWriter->aNodeWriter[i];

        rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n);
        if( reader.aNode ){
        while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
        blobGrowBuffer(&pNode->key, reader.term.n, &rc);
        if( rc==SQLITE_OK ){
          memcpy(pNode->key.a, reader.term.a, reader.term.n);
          pNode->key.n = reader.term.n;
          if( i>0 ){
            char *aBlock = 0;
            int nBlock = 0;
            pNode = &pWriter->aNodeWriter[i-1];
            pNode->iBlock = reader.iChild;
            rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock, 0);
            blobGrowBuffer(&pNode->block, MAX(nBlock, p->nNodeSize), &rc);
            if( rc==SQLITE_OK ){
              memcpy(pNode->block.a, aBlock, nBlock);
              pNode->block.n = nBlock;
            }
            sqlite3_free(aBlock);
          while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
          blobGrowBuffer(&pNode->key, reader.term.n, &rc);
          if( rc==SQLITE_OK ){
            memcpy(pNode->key.a, reader.term.a, reader.term.n);
            pNode->key.n = reader.term.n;
            if( i>0 ){
              char *aBlock = 0;
              int nBlock = 0;
              pNode = &pWriter->aNodeWriter[i-1];
              pNode->iBlock = reader.iChild;
              rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock, 0);
              blobGrowBuffer(&pNode->block, 
                  MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc
              );
              if( rc==SQLITE_OK ){
                memcpy(pNode->block.a, aBlock, nBlock);
                pNode->block.n = nBlock;
                memset(&pNode->block.a[nBlock], 0, FTS3_NODE_PADDING);
              }
              sqlite3_free(aBlock);
            }
          }
        }
        nodeReaderRelease(&reader);
      }
    }

    rc2 = sqlite3_reset(pSelect);
174926
174927
174928
174929
174930
174931
174932



174933

174934
174935
174936
174937
174938
174939
174940
175558
175559
175560
175561
175562
175563
175564
175565
175566
175567

175568
175569
175570
175571
175572
175573
175574
175575







+
+
+
-
+







  const char *zTerm,              /* Omit all terms smaller than this */
  int nTerm,                      /* Size of zTerm in bytes */
  sqlite3_int64 *piBlock          /* OUT: Block number in next layer down */
){
  NodeReader reader;              /* Reader object */
  Blob prev = {0, 0, 0};          /* Previous term written to new node */
  int rc = SQLITE_OK;             /* Return code */
  int bLeaf;                       /* True for a leaf node */

  if( nNode<1 ) return FTS_CORRUPT_VTAB;
  int bLeaf = aNode[0]=='\0';     /* True for a leaf node */
  bLeaf = aNode[0]=='\0';

  /* Allocate required output space */
  blobGrowBuffer(pNew, nNode, &rc);
  if( rc!=SQLITE_OK ) return rc;
  pNew->n = 0;

  /* Populate new node buffer */
179728
179729
179730
179731
179732
179733
179734
179735

179736
179737
179738
179739
179740
179741
179742
180363
180364
180365
180366
180367
180368
180369

180370
180371
180372
180373
180374
180375
180376
180377







-
+







      pRoot = &pParse->aNode[iRoot];
      j = 1;
    }
    if( pApnd ){
      u32 iStart, iLabel;
      JsonNode *pNode;
      iStart = jsonParseAddNode(pParse, JSON_OBJECT, 2, 0);
      iLabel = jsonParseAddNode(pParse, JSON_STRING, i, zPath);
      iLabel = jsonParseAddNode(pParse, JSON_STRING, nKey, zKey);
      zPath += i;
      pNode = jsonLookupAppend(pParse, zPath, pApnd, pzErr);
      if( pParse->oom ) return 0;
      if( pNode ){
        pRoot = &pParse->aNode[iRoot];
        pRoot->u.iAppend = iStart - iRoot;
        pRoot->jnFlags |= JNODE_APPEND;
181212
181213
181214
181215
181216
181217
181218
181219
181220
181221
181222
181223
181224
181225
181226
181227
181228
181229


181230








181231
181232
181233
181234
181235
181236
181237
181847
181848
181849
181850
181851
181852
181853




181854
181855
181856
181857
181858
181859
181860
181861
181862
181863
181864
181865
181866
181867
181868
181869
181870
181871
181872
181873
181874
181875
181876
181877
181878







-
-
-
-







+
+

+
+
+
+
+
+
+
+







#ifndef SQLITE_CORE
/*   #include "sqlite3ext.h" */
  SQLITE_EXTENSION_INIT1
#else
/*   #include "sqlite3.h" */
#endif

/* #include <string.h> */
/* #include <assert.h> */
/* #include <stdio.h> */

#ifndef SQLITE_AMALGAMATION
#include "sqlite3rtree.h"
typedef sqlite3_int64 i64;
typedef sqlite3_uint64 u64;
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
# define NDEBUG 1
#endif
#if defined(NDEBUG) && defined(SQLITE_DEBUG)
# undef NDEBUG
#endif
#endif

/* #include <string.h> */
/* #include <stdio.h> */
/* #include <assert.h> */

/*  The following macro is used to suppress compiler warnings.
*/
#ifndef UNUSED_PARAMETER
# define UNUSED_PARAMETER(x) (void)(x)
#endif

189788
189789
189790
189791
189792
189793
189794

189795

189796
189797
189798
189799
189800
189801
189802
190429
190430
190431
190432
190433
190434
190435
190436

190437
190438
190439
190440
190441
190442
190443
190444







+
-
+







  sqlite3rbu *p = sqlite3_user_data(pCtx);
  const char *zIn;
  assert( argc==1 || argc==2 );

  zIn = (const char*)sqlite3_value_text(argv[0]);
  if( zIn ){
    if( rbuIsVacuum(p) ){
      assert( argc==2 );
      if( argc==1 || 0==sqlite3_value_int(argv[1]) ){
      if( 0==sqlite3_value_int(argv[1]) ){
        sqlite3_result_text(pCtx, zIn, -1, SQLITE_STATIC);
      }
    }else{
      if( strlen(zIn)>4 && memcmp("data", zIn, 4)==0 ){
        int i;
        for(i=4; zIn[i]>='0' && zIn[i]<='9'; i++);
        if( zIn[i]=='_' && zIn[i+1] ){
190239
190240
190241
190242
190243
190244
190245

190246

190247
190248
190249
190250
190251
190252
190253
190881
190882
190883
190884
190885
190886
190887
190888

190889
190890
190891
190892
190893
190894
190895
190896







+
-
+








        if( i!=iOrder ){
          SWAP(int, pIter->aiSrcOrder[i], pIter->aiSrcOrder[iOrder]);
          SWAP(char*, pIter->azTblCol[i], pIter->azTblCol[iOrder]);
        }

        pIter->azTblType[iOrder] = rbuStrndup(zType, &p->rc);
        assert( iPk>=0 );
        pIter->abTblPk[iOrder] = (iPk!=0);
        pIter->abTblPk[iOrder] = (u8)iPk;
        pIter->abNotNull[iOrder] = (u8)bNotNull || (iPk!=0);
        iOrder++;
      }
    }

    rbuFinalize(p, pStmt);
    rbuObjIterCacheIndexedCols(p, pIter);
190273
190274
190275
190276
190277
190278
190279















































































































































































































190280
190281
190282
190283
190284
190285
190286
190916
190917
190918
190919
190920
190921
190922
190923
190924
190925
190926
190927
190928
190929
190930
190931
190932
190933
190934
190935
190936
190937
190938
190939
190940
190941
190942
190943
190944
190945
190946
190947
190948
190949
190950
190951
190952
190953
190954
190955
190956
190957
190958
190959
190960
190961
190962
190963
190964
190965
190966
190967
190968
190969
190970
190971
190972
190973
190974
190975
190976
190977
190978
190979
190980
190981
190982
190983
190984
190985
190986
190987
190988
190989
190990
190991
190992
190993
190994
190995
190996
190997
190998
190999
191000
191001
191002
191003
191004
191005
191006
191007
191008
191009
191010
191011
191012
191013
191014
191015
191016
191017
191018
191019
191020
191021
191022
191023
191024
191025
191026
191027
191028
191029
191030
191031
191032
191033
191034
191035
191036
191037
191038
191039
191040
191041
191042
191043
191044
191045
191046
191047
191048
191049
191050
191051
191052
191053
191054
191055
191056
191057
191058
191059
191060
191061
191062
191063
191064
191065
191066
191067
191068
191069
191070
191071
191072
191073
191074
191075
191076
191077
191078
191079
191080
191081
191082
191083
191084
191085
191086
191087
191088
191089
191090
191091
191092
191093
191094
191095
191096
191097
191098
191099
191100
191101
191102
191103
191104
191105
191106
191107
191108
191109
191110
191111
191112
191113
191114
191115
191116
191117
191118
191119
191120
191121
191122
191123
191124
191125
191126
191127
191128
191129
191130
191131
191132
191133
191134
191135
191136







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







  for(i=0; i<pIter->nTblCol; i++){
    const char *z = pIter->azTblCol[i];
    zList = rbuMPrintf(p, "%z%s\"%w\"", zList, zSep, z);
    zSep = ", ";
  }
  return zList;
}

/*
** Return a comma separated list of the quoted PRIMARY KEY column names,
** in order, for the current table. Before each column name, add the text
** zPre. After each column name, add the zPost text. Use zSeparator as
** the separator text (usually ", ").
*/
static char *rbuObjIterGetPkList(
  sqlite3rbu *p,                  /* RBU object */
  RbuObjIter *pIter,              /* Object iterator for column names */
  const char *zPre,               /* Before each quoted column name */
  const char *zSeparator,         /* Separator to use between columns */
  const char *zPost               /* After each quoted column name */
){
  int iPk = 1;
  char *zRet = 0;
  const char *zSep = "";
  while( 1 ){
    int i;
    for(i=0; i<pIter->nTblCol; i++){
      if( (int)pIter->abTblPk[i]==iPk ){
        const char *zCol = pIter->azTblCol[i];
        zRet = rbuMPrintf(p, "%z%s%s\"%w\"%s", zRet, zSep, zPre, zCol, zPost);
        zSep = zSeparator;
        break;
      }
    }
    if( i==pIter->nTblCol ) break;
    iPk++;
  }
  return zRet;
}

/*
** This function is called as part of restarting an RBU vacuum within 
** stage 1 of the process (while the *-oal file is being built) while
** updating a table (not an index). The table may be a rowid table or
** a WITHOUT ROWID table. It queries the target database to find the 
** largest key that has already been written to the target table and
** constructs a WHERE clause that can be used to extract the remaining
** rows from the source table. For a rowid table, the WHERE clause
** is of the form:
**
**     "WHERE _rowid_ > ?"
**
** and for WITHOUT ROWID tables:
**
**     "WHERE (key1, key2) > (?, ?)"
**
** Instead of "?" placeholders, the actual WHERE clauses created by
** this function contain literal SQL values.
*/
static char *rbuVacuumTableStart(
  sqlite3rbu *p,                  /* RBU handle */
  RbuObjIter *pIter,              /* RBU iterator object */
  int bRowid,                     /* True for a rowid table */
  const char *zWrite              /* Target table name prefix */
){
  sqlite3_stmt *pMax = 0;
  char *zRet = 0;
  if( bRowid ){
    p->rc = prepareFreeAndCollectError(p->dbMain, &pMax, &p->zErrmsg, 
        sqlite3_mprintf(
          "SELECT max(_rowid_) FROM \"%s%w\"", zWrite, pIter->zTbl
        )
    );
    if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pMax) ){
      sqlite3_int64 iMax = sqlite3_column_int64(pMax, 0);
      zRet = rbuMPrintf(p, " WHERE _rowid_ > %lld ", iMax);
    }
    rbuFinalize(p, pMax);
  }else{
    char *zOrder = rbuObjIterGetPkList(p, pIter, "", ", ", " DESC");
    char *zSelect = rbuObjIterGetPkList(p, pIter, "quote(", "||','||", ")");
    char *zList = rbuObjIterGetPkList(p, pIter, "", ", ", "");

    if( p->rc==SQLITE_OK ){
      p->rc = prepareFreeAndCollectError(p->dbMain, &pMax, &p->zErrmsg, 
          sqlite3_mprintf(
            "SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1", 
                zSelect, zWrite, pIter->zTbl, zOrder
          )
      );
      if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pMax) ){
        const char *zVal = (const char*)sqlite3_column_text(pMax, 0);
        zRet = rbuMPrintf(p, " WHERE (%s) > (%s) ", zList, zVal);
      }
      rbuFinalize(p, pMax);
    }

    sqlite3_free(zOrder);
    sqlite3_free(zSelect);
    sqlite3_free(zList);
  }
  return zRet;
}

/*
** This function is called as part of restating an RBU vacuum when the
** current operation is writing content to an index. If possible, it
** queries the target index b-tree for the largest key already written to
** it, then composes and returns an expression that can be used in a WHERE 
** clause to select the remaining required rows from the source table. 
** It is only possible to return such an expression if:
**
**   * The index contains no DESC columns, and
**   * The last key written to the index before the operation was 
**     suspended does not contain any NULL values.
**
** The expression is of the form:
**
**   (index-field1, index-field2, ...) > (?, ?, ...)
**
** except that the "?" placeholders are replaced with literal values.
**
** If the expression cannot be created, NULL is returned. In this case,
** the caller has to use an OFFSET clause to extract only the required 
** rows from the sourct table, just as it does for an RBU update operation.
*/
char *rbuVacuumIndexStart(
  sqlite3rbu *p,                  /* RBU handle */
  RbuObjIter *pIter               /* RBU iterator object */
){
  char *zOrder = 0;
  char *zLhs = 0;
  char *zSelect = 0;
  char *zVector = 0;
  char *zRet = 0;
  int bFailed = 0;
  const char *zSep = "";
  int iCol = 0;
  sqlite3_stmt *pXInfo = 0;

  p->rc = prepareFreeAndCollectError(p->dbMain, &pXInfo, &p->zErrmsg,
      sqlite3_mprintf("PRAGMA main.index_xinfo = %Q", pIter->zIdx)
  );
  while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXInfo) ){
    int iCid = sqlite3_column_int(pXInfo, 1);
    const char *zCollate = (const char*)sqlite3_column_text(pXInfo, 4);
    const char *zCol;
    if( sqlite3_column_int(pXInfo, 3) ){
      bFailed = 1;
      break;
    }

    if( iCid<0 ){
      if( pIter->eType==RBU_PK_IPK ){
        int i;
        for(i=0; pIter->abTblPk[i]==0; i++);
        assert( i<pIter->nTblCol );
        zCol = pIter->azTblCol[i];
      }else{
        zCol = "_rowid_";
      }
    }else{
      zCol = pIter->azTblCol[iCid];
    }

    zLhs = rbuMPrintf(p, "%z%s \"%w\" COLLATE %Q",
        zLhs, zSep, zCol, zCollate
        );
    zOrder = rbuMPrintf(p, "%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC",
        zOrder, zSep, iCol, zCol, zCollate
        );
    zSelect = rbuMPrintf(p, "%z%s quote(\"rbu_imp_%d%w\")",
        zSelect, zSep, iCol, zCol
        );
    zSep = ", ";
    iCol++;
  }
  rbuFinalize(p, pXInfo);
  if( bFailed ) goto index_start_out;

  if( p->rc==SQLITE_OK ){
    sqlite3_stmt *pSel = 0;

    p->rc = prepareFreeAndCollectError(p->dbMain, &pSel, &p->zErrmsg,
        sqlite3_mprintf("SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1",
          zSelect, pIter->zTbl, zOrder
        )
    );
    if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSel) ){
      zSep = "";
      for(iCol=0; iCol<pIter->nCol; iCol++){
        const char *zQuoted = (const char*)sqlite3_column_text(pSel, iCol);
        if( zQuoted[0]=='N' ){
          bFailed = 1;
          break;
        }
        zVector = rbuMPrintf(p, "%z%s%s", zVector, zSep, zQuoted);
        zSep = ", ";
      }

      if( !bFailed ){
        zRet = rbuMPrintf(p, "(%s) > (%s)", zLhs, zVector);
      }
    }
    rbuFinalize(p, pSel);
  }

 index_start_out:
  sqlite3_free(zOrder);
  sqlite3_free(zSelect);
  sqlite3_free(zVector);
  sqlite3_free(zLhs);
  return zRet;
}

/*
** This function is used to create a SELECT list (the list of SQL 
** expressions that follows a SELECT keyword) for a SELECT statement 
** used to read from an data_xxx or rbu_tmp_xxx table while updating the 
** index object currently indicated by the iterator object passed as the 
** second argument. A "PRAGMA index_xinfo = <idxname>" statement is used 
190950
190951
190952
190953
190954
190955
190956









190957
190958

190959
190960


190961

190962

190963
190964
190965
190966
190967
190968
190969
191800
191801
191802
191803
191804
191805
191806
191807
191808
191809
191810
191811
191812
191813
191814
191815
191816

191817
191818
191819
191820
191821

191822
191823
191824
191825
191826
191827
191828
191829
191830
191831







+
+
+
+
+
+
+
+
+

-
+


+
+
-
+

+







        );
      }

      /* Create the SELECT statement to read keys in sorted order */
      if( p->rc==SQLITE_OK ){
        char *zSql;
        if( rbuIsVacuum(p) ){
          char *zStart = 0;
          if( nOffset ){
            zStart = rbuVacuumIndexStart(p, pIter);
            if( zStart ){
              sqlite3_free(zLimit);
              zLimit = 0;
            }
          }

          zSql = sqlite3_mprintf(
              "SELECT %s, 0 AS rbu_control FROM '%q' %s ORDER BY %s%s",
              "SELECT %s, 0 AS rbu_control FROM '%q' %s %s %s ORDER BY %s%s",
              zCollist, 
              pIter->zDataTbl,
              zPart, 
              (zStart ? (zPart ? "AND" : "WHERE") : ""), zStart,
              zPart, zCollist, zLimit
              zCollist, zLimit
          );
          sqlite3_free(zStart);
        }else

        if( pIter->eType==RBU_PK_EXTERNAL || pIter->eType==RBU_PK_NONE ){
          zSql = sqlite3_mprintf(
              "SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' %s ORDER BY %s%s",
              zCollist, p->zStateDb, pIter->zDataTbl,
              zPart, zCollist, zLimit
190978
190979
190980
190981
190982
190983
190984

190985




190986
190987
190988
190989
190990
190991
190992
191840
191841
191842
191843
191844
191845
191846
191847

191848
191849
191850
191851
191852
191853
191854
191855
191856
191857
191858







+
-
+
+
+
+







              zCollist, p->zStateDb, pIter->zDataTbl, zPart,
              zCollist, pIter->zDataTbl, 
              zPart,
              (zPart ? "AND" : "WHERE"),
              zCollist, zLimit
          );
        }
        if( p->rc==SQLITE_OK ){
        p->rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pSelect, pz, zSql);
          p->rc = prepareFreeAndCollectError(p->dbRbu,&pIter->pSelect,pz,zSql);
        }else{
          sqlite3_free(zSql);
        }
      }

      sqlite3_free(zImposterCols);
      sqlite3_free(zImposterPK);
      sqlite3_free(zWhere);
      sqlite3_free(zBind);
      sqlite3_free(zPart);
191078
191079
191080
191081
191082
191083
191084


191085
191086
191087

















191088
191089
191090
191091
191092
191093
191094
191095
191096














191097
191098
191099
191100
191101
191102
191103
191944
191945
191946
191947
191948
191949
191950
191951
191952
191953
191954
191955
191956
191957
191958
191959
191960
191961
191962
191963
191964
191965
191966
191967
191968
191969
191970
191971
191972









191973
191974
191975
191976
191977
191978
191979
191980
191981
191982
191983
191984
191985
191986
191987
191988
191989
191990
191991
191992
191993







+
+



+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+








        rbuObjIterPrepareTmpInsert(p, pIter, zCollist, zRbuRowid);
      }

      /* Create the SELECT statement to read keys from data_xxx */
      if( p->rc==SQLITE_OK ){
        const char *zRbuRowid = "";
        char *zStart = 0;
        char *zOrder = 0;
        if( bRbuRowid ){
          zRbuRowid = rbuIsVacuum(p) ? ",_rowid_ " : ",rbu_rowid";
        }

        if( rbuIsVacuum(p) ){
          if( nOffset ){
            zStart = rbuVacuumTableStart(p, pIter, bRbuRowid, zWrite);
            if( zStart ){
              sqlite3_free(zLimit);
              zLimit = 0;
            }
          }
          if( bRbuRowid ){
            zOrder = rbuMPrintf(p, "_rowid_");
          }else{
            zOrder = rbuObjIterGetPkList(p, pIter, "", ", ", "");
          }
        }

        if( p->rc==SQLITE_OK ){
        p->rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pSelect, pz,
            sqlite3_mprintf(
              "SELECT %s,%s rbu_control%s FROM '%q'%s", 
              zCollist, 
              (rbuIsVacuum(p) ? "0 AS " : ""),
              zRbuRowid,
              pIter->zDataTbl, zLimit
            )
        );
          p->rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pSelect, pz,
              sqlite3_mprintf(
                "SELECT %s,%s rbu_control%s FROM '%q'%s %s %s %s",
                zCollist, 
                (rbuIsVacuum(p) ? "0 AS " : ""),
                zRbuRowid,
                pIter->zDataTbl, (zStart ? zStart : ""), 
                (zOrder ? "ORDER BY" : ""), zOrder,
                zLimit
              )
          );
        }
        sqlite3_free(zStart);
        sqlite3_free(zOrder);
      }

      sqlite3_free(zWhere);
      sqlite3_free(zOldlist);
      sqlite3_free(zNewlist);
      sqlite3_free(zBindings);
    }
193316
193317
193318
193319
193320
193321
193322
193323
193324

193325
193326
193327
193328
193329
193330
193331
193332
194206
194207
194208
194209
194210
194211
194212


194213

194214
194215
194216
194217
194218
194219
194220







-
-
+
-







      rc = xControl(p->pReal, SQLITE_FCNTL_ZIPVFS, &dummy);
      if( rc==SQLITE_OK ){
        rc = SQLITE_ERROR;
        pRbu->zErrmsg = sqlite3_mprintf("rbu/zipvfs setup error");
      }else if( rc==SQLITE_NOTFOUND ){
        pRbu->pTargetFd = p;
        p->pRbu = pRbu;
        if( p->openFlags & SQLITE_OPEN_MAIN_DB ){
          rbuMainlistAdd(p);
        rbuMainlistAdd(p);
        }
        if( p->pWalFd ) p->pWalFd->pRbu = pRbu;
        rc = SQLITE_OK;
      }
    }
    return rc;
  }
  else if( op==SQLITE_FCNTL_RBUCNT ){
193381
193382
193383
193384
193385
193386
193387
193388
193389

193390
193391
193392
193393
193394
193395
193396
193397
193398
194269
194270
194271
194272
194273
194274
194275


194276


194277
194278
194279
194280
194281
194282
194283







-
-
+
-
-







    /* Magic number 1 is the WAL_CKPT_LOCK lock. Preventing SQLite from
    ** taking this lock also prevents any checkpoints from occurring. 
    ** todo: really, it's not clear why this might occur, as 
    ** wal_autocheckpoint ought to be turned off.  */
    if( ofst==WAL_LOCK_CKPT && n==1 ) rc = SQLITE_BUSY;
  }else{
    int bCapture = 0;
    if( n==1 && (flags & SQLITE_SHM_EXCLUSIVE)
     && pRbu && pRbu->eStage==RBU_STAGE_CAPTURE
    if( pRbu && pRbu->eStage==RBU_STAGE_CAPTURE ){
     && (ofst==WAL_LOCK_WRITE || ofst==WAL_LOCK_CKPT || ofst==WAL_LOCK_READ0)
    ){
      bCapture = 1;
    }

    if( bCapture==0 || 0==(flags & SQLITE_SHM_UNLOCK) ){
      rc = p->pReal->pMethods->xShmLock(p->pReal, ofst, n, flags);
      if( bCapture && rc==SQLITE_OK ){
        pRbu->mLock |= (1 << ofst);
193417
193418
193419
193420
193421
193422
193423
193424

193425
193426
193427
193428
193429
193430
193431
193432
193433
193434
193435
















193436
193437

193438
193439
193440
193441
193442
193443
193444
194302
194303
194304
194305
194306
194307
194308

194309











194310
194311
194312
194313
194314
194315
194316
194317
194318
194319
194320
194321
194322
194323
194324
194325


194326
194327
194328
194329
194330
194331
194332
194333







-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+







  int rc = SQLITE_OK;
  int eStage = (p->pRbu ? p->pRbu->eStage : 0);

  /* If not in RBU_STAGE_OAL, allow this call to pass through. Or, if this
  ** rbu is in the RBU_STAGE_OAL state, use heap memory for *-shm space 
  ** instead of a file on disk.  */
  assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) );
  if( eStage==RBU_STAGE_OAL || eStage==RBU_STAGE_MOVE ){
  if( eStage==RBU_STAGE_OAL ){
    if( iRegion<=p->nShm ){
      sqlite3_int64 nByte = (iRegion+1) * sizeof(char*);
      char **apNew = (char**)sqlite3_realloc64(p->apShm, nByte);
      if( apNew==0 ){
        rc = SQLITE_NOMEM;
      }else{
        memset(&apNew[p->nShm], 0, sizeof(char*) * (1 + iRegion - p->nShm));
        p->apShm = apNew;
        p->nShm = iRegion+1;
      }
    }
    sqlite3_int64 nByte = (iRegion+1) * sizeof(char*);
    char **apNew = (char**)sqlite3_realloc64(p->apShm, nByte);

    /* This is an RBU connection that uses its own heap memory for the
    ** pages of the *-shm file. Since no other process can have run
    ** recovery, the connection must request *-shm pages in order
    ** from start to finish.  */
    assert( iRegion==p->nShm );
    if( apNew==0 ){
      rc = SQLITE_NOMEM;
    }else{
      memset(&apNew[p->nShm], 0, sizeof(char*) * (1 + iRegion - p->nShm));
      p->apShm = apNew;
      p->nShm = iRegion+1;
    }


    if( rc==SQLITE_OK && p->apShm[iRegion]==0 ){
    if( rc==SQLITE_OK ){
      char *pNew = (char*)sqlite3_malloc64(szRegion);
      if( pNew==0 ){
        rc = SQLITE_NOMEM;
      }else{
        memset(pNew, 0, szRegion);
        p->apShm[iRegion] = pNew;
      }
193659
193660
193661
193662
193663
193664
193665
193666


193667
193668
193669
193670
193671
193672
193673
194548
194549
194550
194551
194552
194553
194554

194555
194556
194557
194558
194559
194560
194561
194562
194563







-
+
+







  **   b) if the *-wal file does not exist, claim that it does anyway,
  **      causing SQLite to call xOpen() to open it. This call will also
  **      be intercepted (see the rbuVfsOpen() function) and the *-oal
  **      file opened instead.
  */
  if( rc==SQLITE_OK && flags==SQLITE_ACCESS_EXISTS ){
    rbu_file *pDb = rbuFindMaindb(pRbuVfs, zPath, 1);
    if( pDb && pDb->pRbu && pDb->pRbu->eStage==RBU_STAGE_OAL ){
    if( pDb && pDb->pRbu->eStage==RBU_STAGE_OAL ){
      assert( pDb->pRbu );
      if( *pResOut ){
        rc = SQLITE_CANTOPEN;
      }else{
        sqlite3_int64 sz = 0;
        rc = rbuVfsFileSize(&pDb->base, &sz);
        *pResOut = (sz>0);
      }
196652
196653
196654
196655
196656
196657
196658

196659


196660
196661
196662
196663
196664
196665
196666
197542
197543
197544
197545
197546
197547
197548
197549

197550
197551
197552
197553
197554
197555
197556
197557
197558







+
-
+
+







            if( sqlite3_stricmp(azCol[i], pTo->azCol[i]) ) bMismatch = 1;
            if( abPK[i] ) bHasPk = 1;
          }
        }
      }
      sqlite3_free((char*)azCol);
      if( bMismatch ){
        if( pzErrMsg ){
        *pzErrMsg = sqlite3_mprintf("table schemas do not match");
          *pzErrMsg = sqlite3_mprintf("table schemas do not match");
        }
        rc = SQLITE_SCHEMA;
      }
      if( bHasPk==0 ){
        /* Ignore tables with no primary keys */
        goto diff_out;
      }
    }
196858
196859
196860
196861
196862
196863
196864
196865

196866
196867
196868
196869
196870
196871
196872
197750
197751
197752
197753
197754
197755
197756

197757
197758
197759
197760
197761
197762
197763
197764







-
+







** Ensure that there is room in the buffer to append nByte bytes of data.
** If not, use sqlite3_realloc() to grow the buffer so that there is.
**
** If successful, return zero. Otherwise, if an OOM condition is encountered,
** set *pRc to SQLITE_NOMEM and return non-zero.
*/
static int sessionBufferGrow(SessionBuffer *p, size_t nByte, int *pRc){
  if( *pRc==SQLITE_OK && p->nAlloc-p->nBuf<nByte ){
  if( *pRc==SQLITE_OK && (size_t)(p->nAlloc-p->nBuf)<nByte ){
    u8 *aNew;
    i64 nNew = p->nAlloc ? p->nAlloc : 128;
    do {
      nNew = nNew*2;
    }while( (nNew-p->nBuf)<nByte );

    aNew = (u8 *)sqlite3_realloc64(p->aBuf, nNew);
204283
204284
204285
204286
204287
204288
204289
204290





204291
204292
204293





204294
204295
204296
204297
204298
204299
204300
205175
205176
205177
205178
205179
205180
205181

205182
205183
205184
205185
205186
205187
205188
205189
205190
205191
205192
205193
205194
205195
205196
205197
205198
205199
205200
205201







-
+
+
+
+
+



+
+
+
+
+







    /* EOF */
    *piOff = -1;
    return 1;  
  }else{
    i64 iOff = *piOff;
    int iVal;
    fts5FastGetVarint32(a, i, iVal);
    if( iVal==1 ){
    if( iVal<=1 ){
      if( iVal==0 ){
        *pi = i;
        return 0;
      }
      fts5FastGetVarint32(a, i, iVal);
      iOff = ((i64)iVal) << 32;
      fts5FastGetVarint32(a, i, iVal);
      if( iVal<2 ){
        /* This is a corrupt record. So stop parsing it here. */
        *piOff = -1;
        return 1;
      }
    }
    *piOff = iOff + ((iVal-2) & 0x7FFFFFFF);
    *pi = i;
    return 0;
  }
}

209869
209870
209871
209872
209873
209874
209875
209876

209877
209878
209879
209880
209881
209882
209883
210770
210771
210772
210773
210774
210775
210776

210777
210778
210779
210780
210781
210782
210783
210784







-
+







  Fts5Data *pData;

  pData = fts5DataRead(p, FTS5_STRUCTURE_ROWID);
  if( p->rc==SQLITE_OK ){
    /* TODO: Do we need this if the leaf-index is appended? Probably... */
    memset(&pData->p[pData->nn], 0, FTS5_DATA_PADDING);
    p->rc = fts5StructureDecode(pData->p, pData->nn, &iCookie, &pRet);
    if( p->rc==SQLITE_OK && pConfig->iCookie!=iCookie ){
    if( p->rc==SQLITE_OK && (pConfig->pgsz==0 || pConfig->iCookie!=iCookie) ){
      p->rc = sqlite3Fts5ConfigLoad(pConfig, iCookie);
    }
    fts5DataRelease(pData);
    if( p->rc!=SQLITE_OK ){
      fts5StructureRelease(pRet);
      pRet = 0;
    }
213830
213831
213832
213833
213834
213835
213836
213837
213838








213839
213840
213841
213842
213843
213844
213845
213846
213847
213848

213849
213850
213851
213852
213853
213854
213855

213856
213857
213858
213859
213860
213861
213862
214731
214732
214733
214734
214735
214736
214737


214738
214739
214740
214741
214742
214743
214744
214745
214746
214747
214748
214749
214750
214751
214752
214753
214754
214755
214756
214757
214758
214759
214760
214761
214762
214763
214764
214765
214766
214767
214768
214769
214770
214771







-
-
+
+
+
+
+
+
+
+










+







+







    Fts5Buffer tmp = {0, 0, 0};

    /* The maximum size of the output is equal to the sum of the two 
    ** input sizes + 1 varint (9 bytes). The extra varint is because if the
    ** first rowid in one input is a large negative number, and the first in
    ** the other a non-negative number, the delta for the non-negative
    ** number will be larger on disk than the literal integer value
    ** was.  */
    if( sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n + 9) ) return;
    ** was.  
    **
    ** Or, if the input position-lists are corrupt, then the output might
    ** include up to 2 extra 10-byte positions created by interpreting -1
    ** (the value PoslistNext64() uses for EOF) as a position and appending
    ** it to the output. This can happen at most once for each input 
    ** position-list, hence two 10 byte paddings.  */
    if( sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n + 9+10+10) ) return;
    fts5DoclistIterInit(p1, &i1);
    fts5DoclistIterInit(p2, &i2);

    while( 1 ){
      if( i1.iRowid<i2.iRowid ){
        /* Copy entry from i1 */
        fts5MergeAppendDocid(&out, iLastRowid, i1.iRowid);
        fts5BufferSafeAppendBlob(&out, i1.aPoslist, i1.nPoslist+i1.nSize);
        fts5DoclistIterNext(&i1);
        if( i1.aPoslist==0 ) break;
        assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
      }
      else if( i2.iRowid!=i1.iRowid ){
        /* Copy entry from i2 */
        fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
        fts5BufferSafeAppendBlob(&out, i2.aPoslist, i2.nPoslist+i2.nSize);
        fts5DoclistIterNext(&i2);
        if( i2.aPoslist==0 ) break;
        assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
      }
      else{
        /* Merge the two position lists. */ 
        i64 iPos1 = 0;
        i64 iPos2 = 0;
        int iOff1 = 0;
        int iOff2 = 0;
213872
213873
213874
213875
213876
213877
213878
213879

213880
213881
213882
213883
213884
213885
213886
213887
213888
213889
213890
213891
213892
213893
213894
213895
214781
214782
214783
214784
214785
214786
214787

214788
214789
214790
214791
214792
214793
214794
214795
214796

214797
214798
214799
214800
214801
214802
214803







-
+








-







        fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
        fts5BufferZero(&tmp);
        sqlite3Fts5BufferSize(&p->rc, &tmp, i1.nPoslist + i2.nPoslist);
        if( p->rc ) break;

        sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
        sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
        assert( iPos1>=0 && iPos2>=0 );
        assert_nc( iPos1>=0 && iPos2>=0 );

        if( iPos1<iPos2 ){
          sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
          sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
        }else{
          sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
          sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
        }

        if( iPos1>=0 && iPos2>=0 ){
          while( 1 ){
            if( iPos1<iPos2 ){
              if( iPos1!=iPrev ){
                sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
              }
              sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
213906
213907
213908
213909
213910
213911
213912
213913

213914
213915
213916
213917
213918
213919
213920
213921
213922
213923
213924
213925
213926
213927

213928

213929
213930
213931
213932
213933
213934
213935
213936
213937
213938
213939
213940

213941
213942
213943
213944
213945
213946
213947
214814
214815
214816
214817
214818
214819
214820

214821
214822
214823
214824
214825
214826
214827
214828
214829
214830
214831
214832
214833
214834

214835
214836
214837
214838
214839
214840
214841
214842
214843
214844
214845
214846
214847
214848

214849
214850
214851
214852
214853
214854
214855
214856







-
+













-
+

+











-
+







        if( iPos1>=0 ){
          if( iPos1!=iPrev ){
            sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
          }
          aCopy = &a1[iOff1];
          nCopy = i1.nPoslist - iOff1;
        }else{
          assert( iPos2>=0 && iPos2!=iPrev );
          assert_nc( iPos2>=0 && iPos2!=iPrev );
          sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
          aCopy = &a2[iOff2];
          nCopy = i2.nPoslist - iOff2;
        }
        if( nCopy>0 ){
          fts5BufferSafeAppendBlob(&tmp, aCopy, nCopy);
        }

        /* WRITEPOSLISTSIZE */
        fts5BufferSafeAppendVarint(&out, tmp.n * 2);
        fts5BufferSafeAppendBlob(&out, tmp.p, tmp.n);
        fts5DoclistIterNext(&i1);
        fts5DoclistIterNext(&i2);
        assert( out.n<=(p1->n+p2->n+9) );
        assert_nc( out.n<=(p1->n+p2->n+9) );
        if( i1.aPoslist==0 || i2.aPoslist==0 ) break;
        assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
      }
    }

    if( i1.aPoslist ){
      fts5MergeAppendDocid(&out, iLastRowid, i1.iRowid);
      fts5BufferSafeAppendBlob(&out, i1.aPoslist, i1.aEof - i1.aPoslist);
    }
    else if( i2.aPoslist ){
      fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
      fts5BufferSafeAppendBlob(&out, i2.aPoslist, i2.aEof - i2.aPoslist);
    }
    assert( out.n<=(p1->n+p2->n+9) );
    assert_nc( out.n<=(p1->n+p2->n+9) );

    fts5BufferSet(&p->rc, p1, out.n, out.p);
    fts5BufferFree(&tmp);
    fts5BufferFree(&out);
  }
}

218099
218100
218101
218102
218103
218104
218105
218106

218107
218108
218109
218110
218111
218112
218113
219008
219009
219010
219011
219012
219013
219014

219015
219016
219017
219018
219019
219020
219021
219022







-
+







static void fts5SourceIdFunc(
  sqlite3_context *pCtx,          /* Function call context */
  int nArg,                       /* Number of args */
  sqlite3_value **apUnused        /* Function arguments */
){
  assert( nArg==0 );
  UNUSED_PARAM2(nArg, apUnused);
  sqlite3_result_text(pCtx, "fts5: 2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f83156b50", -1, SQLITE_TRANSIENT);
  sqlite3_result_text(pCtx, "fts5: 2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6", -1, SQLITE_TRANSIENT);
}

/*
** Return true if zName is the extension on one of the shadow tables used
** by this module.
*/
static int fts5ShadowName(const char *zName){
222358
222359
222360
222361
222362
222363
222364
222365
222366




222367
222368
222369
222370
222371
222372
222373
223267
223268
223269
223270
223271
223272
223273


223274
223275
223276
223277
223278
223279
223280
223281
223282
223283
223284







-
-
+
+
+
+







          if( sqlite3Fts5IterEof(pCsr->pIter) ) break;
        }
      }
    }
  }

  if( rc==SQLITE_OK && pCsr->bEof==0 && pTab->eType==FTS5_VOCAB_COL ){
    while( pCsr->aDoc[pCsr->iCol]==0 ) pCsr->iCol++;
    assert( pCsr->iCol<pCsr->pFts5->pConfig->nCol );
    for(/* noop */; pCsr->iCol<nCol && pCsr->aDoc[pCsr->iCol]==0; pCsr->iCol++);
    if( pCsr->iCol==nCol ){
      rc = FTS5_CORRUPT;
    }
  }
  return rc;
}

/*
** This is the xFilter implementation for the virtual table.
*/
222863
222864
222865
222866
222867
222868
222869
222870

222871
222872

222873
222874
222875
222876
223774
223775
223776
223777
223778
223779
223780

223781
223782

223783
223784
223785
223786
223787







-
+

-
+




#endif
  return rc;
}
#endif /* SQLITE_CORE */
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */

/************** End of stmt.c ************************************************/
#if __LINE__!=222870
#if __LINE__!=223781
#undef SQLITE_SOURCE_ID
#define SQLITE_SOURCE_ID      "2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f8315alt2"
#define SQLITE_SOURCE_ID      "2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88alt2"
#endif
/* Return the source-id for this library */
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
/************************** End of sqlite3.c ******************************/
Changes to SQLite.Interop/src/core/sqlite3.h.
119
120
121
122
123
124
125
126
127
128



129
130
131
132
133
134
135
119
120
121
122
123
124
125



126
127
128
129
130
131
132
133
134
135







-
-
-
+
+
+







** been edited in any way since it was last checked in, then the last
** four hexadecimal digits of the hash may be modified.
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION        "3.28.0"
#define SQLITE_VERSION_NUMBER 3028000
#define SQLITE_SOURCE_ID      "2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f83156b50"
#define SQLITE_VERSION        "3.29.0"
#define SQLITE_VERSION_NUMBER 3029000
#define SQLITE_SOURCE_ID      "2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6"

/*
** CAPI3REF: Run-Time Library Version Numbers
** KEYWORDS: sqlite3_version sqlite3_sourceid
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
1292
1293
1294
1295
1296
1297
1298
1299
1300








1301
1302
1303
1304
1305
1306
1307
1292
1293
1294
1295
1296
1297
1298


1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313







-
-
+
+
+
+
+
+
+
+







** element will be valid after xOpen returns regardless of the success
** or failure of the xOpen call.
**
** [[sqlite3_vfs.xAccess]]
** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
** to test whether a file is at least readable.   The file can be a
** directory.
** to test whether a file is at least readable.  The SQLITE_ACCESS_READ
** flag is never actually used and is not implemented in the built-in
** VFSes of SQLite.  The file is named by the second argument and can be a
** directory. The xAccess method returns [SQLITE_OK] on success or some
** non-zero error code if there is an I/O error or if the name of
** the file given in the second argument is illegal.  If SQLITE_OK
** is returned, then non-zero or zero is written into *pResOut to indicate
** whether or not the file is accessible.  
**
** ^SQLite will always allocate at least mxPathname+1 bytes for the
** output buffer xFullPathname.  The exact size of the output buffer
** is also passed as a parameter to both  methods. If the output buffer
** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
** handled as a fatal error by SQLite, vfs implementations should endeavor
** to prevent this by setting mxPathname to a sufficiently large value.
2194
2195
2196
2197
2198
2199
2200

2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215




























2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229



2230

2231
2232
2233
2234
2235
2236
2237
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267

2268
2269
2270
2271
2272
2273
2274
2275







+















+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+














+
+
+
-
+







** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the
** "defensive" flag for a database connection.  When the defensive
** flag is enabled, language features that allow ordinary SQL to 
** deliberately corrupt the database file are disabled.  The disabled
** features include but are not limited to the following:
** <ul>
** <li> The [PRAGMA writable_schema=ON] statement.
** <li> The [PRAGMA journal_mode=OFF] statement.
** <li> Writes to the [sqlite_dbpage] virtual table.
** <li> Direct writes to [shadow tables].
** </ul>
** </dd>
**
** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt>
** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the
** "writable_schema" flag. This has the same effect and is logically equivalent
** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF].
** The first argument to this setting is an integer which is 0 to disable 
** the writable_schema, positive to enable writable_schema, or negative to
** leave the setting unchanged. The second parameter is a pointer to an
** integer into which is written 0 or 1 to indicate whether the writable_schema
** is enabled or disabled following this call.
** </dd>
**
** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt>
** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
** the legacy behavior of the [ALTER TABLE RENAME] command such it
** behaves as it did prior to [version 3.24.0] (2018-06-04).  See the
** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for
** additional information. This feature can also be turned on and off
** using the [PRAGMA legacy_alter_table] statement.
** </dd>
**
** [[SQLITE_DBCONFIG_DQS_DML]]
** <dt>SQLITE_DBCONFIG_DQS_DML</td>
** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
** the legacy [double-quoted string literal] misfeature for DML statement
** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
** default value of this setting is determined by the [-DSQLITE_DQS]
** compile-time option.
** </dd>
**
** [[SQLITE_DBCONFIG_DQS_DDL]]
** <dt>SQLITE_DBCONFIG_DQS_DDL</td>
** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates
** the legacy [double-quoted string literal] misfeature for DDL statements,
** such as CREATE TABLE and CREATE INDEX. The
** default value of this setting is determined by the [-DSQLITE_DQS]
** compile-time option.
** </dd>
** </dl>
*/
#define SQLITE_DBCONFIG_MAINDBNAME            1000 /* const char* */
#define SQLITE_DBCONFIG_LOOKASIDE             1001 /* void* int int */
#define SQLITE_DBCONFIG_ENABLE_FKEY           1002 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_TRIGGER        1003 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE      1006 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_QPSG           1007 /* int int* */
#define SQLITE_DBCONFIG_TRIGGER_EQP           1008 /* int int* */
#define SQLITE_DBCONFIG_RESET_DATABASE        1009 /* int int* */
#define SQLITE_DBCONFIG_DEFENSIVE             1010 /* int int* */
#define SQLITE_DBCONFIG_WRITABLE_SCHEMA       1011 /* int int* */
#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE    1012 /* int int* */
#define SQLITE_DBCONFIG_DQS_DML               1013 /* int int* */
#define SQLITE_DBCONFIG_DQS_DDL               1014 /* int int* */
#define SQLITE_DBCONFIG_MAX                   1011 /* Largest DBCONFIG */
#define SQLITE_DBCONFIG_MAX                   1014 /* Largest DBCONFIG */

/*
** CAPI3REF: Enable Or Disable Extended Result Codes
** METHOD: sqlite3
**
** ^The sqlite3_extended_result_codes() routine enables or disables the
** [extended result codes] feature of SQLite. ^The extended result
7315
7316
7317
7318
7319
7320
7321

7322

7323
7324
7325
7326
7327
7328
7329
7353
7354
7355
7356
7357
7358
7359
7360

7361
7362
7363
7364
7365
7366
7367
7368







+
-
+







#define SQLITE_TESTCTRL_NEVER_CORRUPT           20
#define SQLITE_TESTCTRL_VDBE_COVERAGE           21
#define SQLITE_TESTCTRL_BYTEORDER               22
#define SQLITE_TESTCTRL_ISINIT                  23
#define SQLITE_TESTCTRL_SORTER_MMAP             24
#define SQLITE_TESTCTRL_IMPOSTER                25
#define SQLITE_TESTCTRL_PARSER_COVERAGE         26
#define SQLITE_TESTCTRL_RESULT_INTREAL          27
#define SQLITE_TESTCTRL_LAST                    26  /* Largest TESTCTRL */
#define SQLITE_TESTCTRL_LAST                    27  /* Largest TESTCTRL */

/*
** CAPI3REF: SQL Keyword Checking
**
** These routines provide access to the set of SQL language keywords 
** recognized by SQLite.  Applications can uses these routines to determine
** whether or not a specific identifier needs to be escaped (for example,
Changes to SQLite.Interop/src/ext/fts5.c.
3856
3857
3858
3859
3860
3861
3862
3863





3864
3865
3866





3867
3868
3869
3870
3871
3872
3873
3856
3857
3858
3859
3860
3861
3862

3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882







-
+
+
+
+
+



+
+
+
+
+







    /* EOF */
    *piOff = -1;
    return 1;  
  }else{
    i64 iOff = *piOff;
    int iVal;
    fts5FastGetVarint32(a, i, iVal);
    if( iVal==1 ){
    if( iVal<=1 ){
      if( iVal==0 ){
        *pi = i;
        return 0;
      }
      fts5FastGetVarint32(a, i, iVal);
      iOff = ((i64)iVal) << 32;
      fts5FastGetVarint32(a, i, iVal);
      if( iVal<2 ){
        /* This is a corrupt record. So stop parsing it here. */
        *piOff = -1;
        return 1;
      }
    }
    *piOff = iOff + ((iVal-2) & 0x7FFFFFFF);
    *pi = i;
    return 0;
  }
}

9446
9447
9448
9449
9450
9451
9452
9453

9454
9455
9456
9457
9458
9459
9460
9455
9456
9457
9458
9459
9460
9461

9462
9463
9464
9465
9466
9467
9468
9469







-
+







  Fts5Data *pData;

  pData = fts5DataRead(p, FTS5_STRUCTURE_ROWID);
  if( p->rc==SQLITE_OK ){
    /* TODO: Do we need this if the leaf-index is appended? Probably... */
    memset(&pData->p[pData->nn], 0, FTS5_DATA_PADDING);
    p->rc = fts5StructureDecode(pData->p, pData->nn, &iCookie, &pRet);
    if( p->rc==SQLITE_OK && pConfig->iCookie!=iCookie ){
    if( p->rc==SQLITE_OK && (pConfig->pgsz==0 || pConfig->iCookie!=iCookie) ){
      p->rc = sqlite3Fts5ConfigLoad(pConfig, iCookie);
    }
    fts5DataRelease(pData);
    if( p->rc!=SQLITE_OK ){
      fts5StructureRelease(pRet);
      pRet = 0;
    }
13407
13408
13409
13410
13411
13412
13413
13414
13415








13416
13417
13418
13419
13420
13421
13422
13423
13424
13425

13426
13427
13428
13429
13430
13431
13432

13433
13434
13435
13436
13437
13438
13439
13416
13417
13418
13419
13420
13421
13422


13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456







-
-
+
+
+
+
+
+
+
+










+







+







    Fts5Buffer tmp = {0, 0, 0};

    /* The maximum size of the output is equal to the sum of the two 
    ** input sizes + 1 varint (9 bytes). The extra varint is because if the
    ** first rowid in one input is a large negative number, and the first in
    ** the other a non-negative number, the delta for the non-negative
    ** number will be larger on disk than the literal integer value
    ** was.  */
    if( sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n + 9) ) return;
    ** was.  
    **
    ** Or, if the input position-lists are corrupt, then the output might
    ** include up to 2 extra 10-byte positions created by interpreting -1
    ** (the value PoslistNext64() uses for EOF) as a position and appending
    ** it to the output. This can happen at most once for each input 
    ** position-list, hence two 10 byte paddings.  */
    if( sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n + 9+10+10) ) return;
    fts5DoclistIterInit(p1, &i1);
    fts5DoclistIterInit(p2, &i2);

    while( 1 ){
      if( i1.iRowid<i2.iRowid ){
        /* Copy entry from i1 */
        fts5MergeAppendDocid(&out, iLastRowid, i1.iRowid);
        fts5BufferSafeAppendBlob(&out, i1.aPoslist, i1.nPoslist+i1.nSize);
        fts5DoclistIterNext(&i1);
        if( i1.aPoslist==0 ) break;
        assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
      }
      else if( i2.iRowid!=i1.iRowid ){
        /* Copy entry from i2 */
        fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
        fts5BufferSafeAppendBlob(&out, i2.aPoslist, i2.nPoslist+i2.nSize);
        fts5DoclistIterNext(&i2);
        if( i2.aPoslist==0 ) break;
        assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
      }
      else{
        /* Merge the two position lists. */ 
        i64 iPos1 = 0;
        i64 iPos2 = 0;
        int iOff1 = 0;
        int iOff2 = 0;
13449
13450
13451
13452
13453
13454
13455
13456

13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13466
13467
13468
13469
13470
13471
13472

13473
13474
13475
13476
13477
13478
13479
13480
13481

13482
13483
13484
13485
13486
13487
13488







-
+








-







        fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
        fts5BufferZero(&tmp);
        sqlite3Fts5BufferSize(&p->rc, &tmp, i1.nPoslist + i2.nPoslist);
        if( p->rc ) break;

        sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
        sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
        assert( iPos1>=0 && iPos2>=0 );
        assert_nc( iPos1>=0 && iPos2>=0 );

        if( iPos1<iPos2 ){
          sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
          sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
        }else{
          sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
          sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
        }

        if( iPos1>=0 && iPos2>=0 ){
          while( 1 ){
            if( iPos1<iPos2 ){
              if( iPos1!=iPrev ){
                sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
              }
              sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
13483
13484
13485
13486
13487
13488
13489
13490

13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504

13505

13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517

13518
13519
13520
13521
13522
13523
13524
13499
13500
13501
13502
13503
13504
13505

13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519

13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533

13534
13535
13536
13537
13538
13539
13540
13541







-
+













-
+

+











-
+







        if( iPos1>=0 ){
          if( iPos1!=iPrev ){
            sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
          }
          aCopy = &a1[iOff1];
          nCopy = i1.nPoslist - iOff1;
        }else{
          assert( iPos2>=0 && iPos2!=iPrev );
          assert_nc( iPos2>=0 && iPos2!=iPrev );
          sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
          aCopy = &a2[iOff2];
          nCopy = i2.nPoslist - iOff2;
        }
        if( nCopy>0 ){
          fts5BufferSafeAppendBlob(&tmp, aCopy, nCopy);
        }

        /* WRITEPOSLISTSIZE */
        fts5BufferSafeAppendVarint(&out, tmp.n * 2);
        fts5BufferSafeAppendBlob(&out, tmp.p, tmp.n);
        fts5DoclistIterNext(&i1);
        fts5DoclistIterNext(&i2);
        assert( out.n<=(p1->n+p2->n+9) );
        assert_nc( out.n<=(p1->n+p2->n+9) );
        if( i1.aPoslist==0 || i2.aPoslist==0 ) break;
        assert( out.n<=((i1.aPoslist-p1->p) + (i2.aPoslist-p2->p)+9+10+10) );
      }
    }

    if( i1.aPoslist ){
      fts5MergeAppendDocid(&out, iLastRowid, i1.iRowid);
      fts5BufferSafeAppendBlob(&out, i1.aPoslist, i1.aEof - i1.aPoslist);
    }
    else if( i2.aPoslist ){
      fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
      fts5BufferSafeAppendBlob(&out, i2.aPoslist, i2.aEof - i2.aPoslist);
    }
    assert( out.n<=(p1->n+p2->n+9) );
    assert_nc( out.n<=(p1->n+p2->n+9) );

    fts5BufferSet(&p->rc, p1, out.n, out.p);
    fts5BufferFree(&tmp);
    fts5BufferFree(&out);
  }
}

17677
17678
17679
17680
17681
17682
17683
17684

17685
17686
17687
17688
17689
17690
17691
17694
17695
17696
17697
17698
17699
17700

17701
17702
17703
17704
17705
17706
17707
17708







-
+







static void fts5SourceIdFunc(
  sqlite3_context *pCtx,          /* Function call context */
  int nArg,                       /* Number of args */
  sqlite3_value **apUnused        /* Function arguments */
){
  assert( nArg==0 );
  UNUSED_PARAM2(nArg, apUnused);
  sqlite3_result_text(pCtx, "fts5: 2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f83156b50", -1, SQLITE_TRANSIENT);
  sqlite3_result_text(pCtx, "fts5: 2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6", -1, SQLITE_TRANSIENT);
}

/*
** Return true if zName is the extension on one of the shadow tables used
** by this module.
*/
static int fts5ShadowName(const char *zName){
21941
21942
21943
21944
21945
21946
21947
21948
21949




21950
21951
21952
21953
21954
21955
21956
21958
21959
21960
21961
21962
21963
21964


21965
21966
21967
21968
21969
21970
21971
21972
21973
21974
21975







-
-
+
+
+
+







          if( sqlite3Fts5IterEof(pCsr->pIter) ) break;
        }
      }
    }
  }

  if( rc==SQLITE_OK && pCsr->bEof==0 && pTab->eType==FTS5_VOCAB_COL ){
    while( pCsr->aDoc[pCsr->iCol]==0 ) pCsr->iCol++;
    assert( pCsr->iCol<pCsr->pFts5->pConfig->nCol );
    for(/* noop */; pCsr->iCol<nCol && pCsr->aDoc[pCsr->iCol]==0; pCsr->iCol++);
    if( pCsr->iCol==nCol ){
      rc = FTS5_CORRUPT;
    }
  }
  return rc;
}

/*
** This is the xFilter implementation for the virtual table.
*/
Changes to SQLite.Interop/src/ext/json1.c.
1119
1120
1121
1122
1123
1124
1125
1126

1127
1128
1129
1130
1131
1132
1133
1119
1120
1121
1122
1123
1124
1125

1126
1127
1128
1129
1130
1131
1132
1133







-
+







      pRoot = &pParse->aNode[iRoot];
      j = 1;
    }
    if( pApnd ){
      u32 iStart, iLabel;
      JsonNode *pNode;
      iStart = jsonParseAddNode(pParse, JSON_OBJECT, 2, 0);
      iLabel = jsonParseAddNode(pParse, JSON_STRING, i, zPath);
      iLabel = jsonParseAddNode(pParse, JSON_STRING, nKey, zKey);
      zPath += i;
      pNode = jsonLookupAppend(pParse, zPath, pApnd, pzErr);
      if( pParse->oom ) return 0;
      if( pNode ){
        pRoot = &pParse->aNode[iRoot];
        pRoot->u.iAppend = iStart - iRoot;
        pRoot->jnFlags |= JNODE_APPEND;