Fossil

Check-in [ea5465149f]
Login

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

Overview
Comment:Update the built-in SQLite to an early 3.35 version containing support for generalized upsert, math functions, and reduced memory usage for VACUUM of large blobs.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ea5465149ff5bc27a303bc7819689400bfaf18fcfb5ef7043063c6a622314a20
User & Date: drh 2020-12-15 14:21:11.874
Context
2020-12-16
14:28
Update to the latest SQLite 3.35 prerelease in order to fix harmless #ifdef errors and compiler warnings. check-in: c9b6be2f62 user: drh tags: trunk
2020-12-15
14:21
Update the built-in SQLite to an early 3.35 version containing support for generalized upsert, math functions, and reduced memory usage for VACUUM of large blobs. check-in: ea5465149f user: drh tags: trunk
01:13
Alternative to check-in [a098707051568156] for getting the --static option to ./configure working on pkg-config based systems. check-in: 6f9d265234 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/shell.c.
1420
1421
1422
1423
1424
1425
1426


1427

1428
1429
1430
1431
1432
1433
1434
** 384, or 512, to determine SHA3 hash variant that is computed.
*/
/* #include "sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#include <stdarg.h>


/* typedef sqlite3_uint64 u64; */


/******************************************************************************
** The Hash Engine
*/
/*
** Macros to determine whether the machine is big or little endian,
** and whether or not that determination is run-time or compile-time.







>
>

>







1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
** 384, or 512, to determine SHA3 hash variant that is computed.
*/
/* #include "sqlite3ext.h" */
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#include <stdarg.h>

#ifndef SQLITE_AMALGAMATION
/* typedef sqlite3_uint64 u64; */
#endif /* SQLITE_AMALGAMATION */

/******************************************************************************
** The Hash Engine
*/
/*
** Macros to determine whether the machine is big or little endian,
** and whether or not that determination is run-time or compile-time.
5559
5560
5561
5562
5563
5564
5565
5566

5567
5568
5569
5570
5571
5572
5573
** is a bitmask showing which constraints are available:
**
**    1:    start=VALUE
**    2:    stop=VALUE
**    4:    step=VALUE
**
** Also, if bit 8 is set, that means that the series should be output
** in descending order rather than in ascending order.

**
** This routine should initialize the cursor and position it so that it
** is pointing at the first row, or pointing off the end of the table
** (so that seriesEof() will return true) if the table is empty.
*/
static int seriesFilter(
  sqlite3_vtab_cursor *pVtabCursor, 







|
>







5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
** is a bitmask showing which constraints are available:
**
**    1:    start=VALUE
**    2:    stop=VALUE
**    4:    step=VALUE
**
** Also, if bit 8 is set, that means that the series should be output
** in descending order rather than in ascending order.  If bit 16 is
** set, then output must appear in ascending order.
**
** This routine should initialize the cursor and position it so that it
** is pointing at the first row, or pointing off the end of the table
** (so that seriesEof() will return true) if the table is empty.
*/
static int seriesFilter(
  sqlite3_vtab_cursor *pVtabCursor, 
5585
5586
5587
5588
5589
5590
5591
5592





5593
5594
5595
5596
5597
5598
5599
  if( idxNum & 2 ){
    pCur->mxValue = sqlite3_value_int64(argv[i++]);
  }else{
    pCur->mxValue = 0xffffffff;
  }
  if( idxNum & 4 ){
    pCur->iStep = sqlite3_value_int64(argv[i++]);
    if( pCur->iStep<1 ) pCur->iStep = 1;





  }else{
    pCur->iStep = 1;
  }
  for(i=0; i<argc; i++){
    if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
      /* If any of the constraints have a NULL value, then return no rows.
      ** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */







|
>
>
>
>
>







5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
  if( idxNum & 2 ){
    pCur->mxValue = sqlite3_value_int64(argv[i++]);
  }else{
    pCur->mxValue = 0xffffffff;
  }
  if( idxNum & 4 ){
    pCur->iStep = sqlite3_value_int64(argv[i++]);
    if( pCur->iStep==0 ){
      pCur->iStep = 1;
    }else if( pCur->iStep<0 ){
      pCur->iStep = -pCur->iStep;
      if( (idxNum & 16)==0 ) idxNum |= 8;
    }
  }else{
    pCur->iStep = 1;
  }
  for(i=0; i<argc; i++){
    if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
      /* If any of the constraints have a NULL value, then return no rows.
      ** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
5679
5680
5681
5682
5683
5684
5685
5686




5687
5688
5689
5690
5691
5692
5693
  }
  if( (idxNum & 3)==3 ){
    /* Both start= and stop= boundaries are available.  This is the 
    ** the preferred case */
    pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
    pIdxInfo->estimatedRows = 1000;
    if( pIdxInfo->nOrderBy==1 ){
      if( pIdxInfo->aOrderBy[0].desc ) idxNum |= 8;




      pIdxInfo->orderByConsumed = 1;
    }
  }else{
    /* If either boundary is missing, we have to generate a huge span
    ** of numbers.  Make this case very expensive so that the query
    ** planner will work hard to avoid it. */
    pIdxInfo->estimatedRows = 2147483647;







|
>
>
>
>







5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
  }
  if( (idxNum & 3)==3 ){
    /* Both start= and stop= boundaries are available.  This is the 
    ** the preferred case */
    pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
    pIdxInfo->estimatedRows = 1000;
    if( pIdxInfo->nOrderBy==1 ){
      if( pIdxInfo->aOrderBy[0].desc ){
        idxNum |= 8;
      }else{
        idxNum |= 16;
      }
      pIdxInfo->orderByConsumed = 1;
    }
  }else{
    /* If either boundary is missing, we have to generate a huge span
    ** of numbers.  Make this case very expensive so that the query
    ** planner will work hard to avoid it. */
    pIdxInfo->estimatedRows = 2147483647;
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
  int nTab = STRLEN(zTab);
  int nByte = sizeof(IdxTable) + nTab + 1;
  IdxTable *pNew = 0;
  int rc, rc2;
  char *pCsr = 0;
  int nPk = 0;

  rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_info=%Q", zTab);
  while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
    const char *zCol = (const char*)sqlite3_column_text(p1, 1);
    nByte += 1 + STRLEN(zCol);
    rc = sqlite3_table_column_metadata(
        db, "main", zTab, zCol, 0, &zCol, 0, 0, 0
    );
    nByte += 1 + STRLEN(zCol);







|







8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
  int nTab = STRLEN(zTab);
  int nByte = sizeof(IdxTable) + nTab + 1;
  IdxTable *pNew = 0;
  int rc, rc2;
  char *pCsr = 0;
  int nPk = 0;

  rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab);
  while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
    const char *zCol = (const char*)sqlite3_column_text(p1, 1);
    nByte += 1 + STRLEN(zCol);
    rc = sqlite3_table_column_metadata(
        db, "main", zTab, zCol, 0, &zCol, 0, 0, 0
    );
    nByte += 1 + STRLEN(zCol);
9964
9965
9966
9967
9968
9969
9970

9971
9972
9973
9974

9975
9976
9977
9978
9979
9980
9981
    );
  }

  idxFinalize(&rc, pAllIndex);
  idxFinalize(&rc, pIndexXInfo);
  idxFinalize(&rc, pWrite);


  for(i=0; i<pCtx->nSlot; i++){
    sqlite3_free(pCtx->aSlot[i].z);
  }
  sqlite3_free(pCtx);


  if( rc==SQLITE_OK ){
    rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0);
  }

  sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp."UNIQUE_TABLE_NAME,0,0,0);
  return rc;







>
|
|
|
|
>







9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
    );
  }

  idxFinalize(&rc, pAllIndex);
  idxFinalize(&rc, pIndexXInfo);
  idxFinalize(&rc, pWrite);

  if( pCtx ){
    for(i=0; i<pCtx->nSlot; i++){
      sqlite3_free(pCtx->aSlot[i].z);
    }
    sqlite3_free(pCtx);
  }

  if( rc==SQLITE_OK ){
    rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0);
  }

  sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp."UNIQUE_TABLE_NAME,0,0,0);
  return rc;
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920

12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
  p->nIndent = 0;
  p->iIndent = 0;
}

/*
** Disable and restore .wheretrace and .selecttrace settings.
*/
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
extern unsigned int sqlite3_unsupported_selecttrace;
static int savedSelectTrace;
#endif
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
extern int sqlite3WhereTrace;
static int savedWhereTrace;
#endif
static void disable_debug_trace_modes(void){
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)

  savedSelectTrace = sqlite3_unsupported_selecttrace;
  sqlite3_unsupported_selecttrace = 0;
#endif
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
  savedWhereTrace = sqlite3WhereTrace;
  sqlite3WhereTrace = 0;
#endif
}
static void restore_debug_trace_modes(void){
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
  sqlite3_unsupported_selecttrace = savedSelectTrace;
#endif
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
  sqlite3WhereTrace = savedWhereTrace;
#endif
}

/* Create the TEMP table used to store parameter bindings */
static void bind_table_init(ShellState *p){
  int wrSchema = 0;
  int defensiveMode = 0;
  sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, -1, &defensiveMode);







<
<
|
<
<
<
|
<

<
>
|
|
<
<
|
|
<


<
|
<
<
|
<







12919
12920
12921
12922
12923
12924
12925


12926



12927

12928

12929
12930
12931


12932
12933

12934
12935

12936


12937

12938
12939
12940
12941
12942
12943
12944
  p->nIndent = 0;
  p->iIndent = 0;
}

/*
** Disable and restore .wheretrace and .selecttrace settings.
*/


static unsigned int savedSelectTrace;



static unsigned int savedWhereTrace;

static void disable_debug_trace_modes(void){

  unsigned int zero = 0;
  sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 0, &savedSelectTrace);
  sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &zero);


  sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 2, &savedWhereTrace);
  sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &zero);

}
static void restore_debug_trace_modes(void){

  sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &savedSelectTrace);


  sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &savedWhereTrace);

}

/* Create the TEMP table used to store parameter bindings */
static void bind_table_init(ShellState *p){
  int wrSchema = 0;
  int defensiveMode = 0;
  sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, -1, &defensiveMode);
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
      raw_printf(p->out, "oomCounter = %d\n", oomCounter);
      raw_printf(p->out, "oomRepeat  = %d\n", oomRepeat);
    }
  }else
#endif /* SQLITE_DEBUG */

  if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
    char *zNewFilename;  /* Name of the database file to open */
    int iName = 1;       /* Index in azArg[] of the filename */
    int newFlag = 0;     /* True to delete file before opening */
    /* Close the existing database */
    session_close_all(p);
    close_db(p->db);
    p->db = 0;
    p->zDbFilename = 0;
    sqlite3_free(p->zFreeOnClose);
    p->zFreeOnClose = 0;
    p->openMode = SHELL_OPEN_UNSPEC;
    p->openFlags = 0;
    p->szMax = 0;
    /* Check for command-line arguments */
    for(iName=1; iName<nArg && azArg[iName][0]=='-'; iName++){
      const char *z = azArg[iName];
      if( optionMatch(z,"new") ){
        newFlag = 1;
#ifdef SQLITE_HAVE_ZLIB
      }else if( optionMatch(z, "zip") ){
        p->openMode = SHELL_OPEN_ZIPFILE;
#endif







|
|
|











|







18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
18732
18733
      raw_printf(p->out, "oomCounter = %d\n", oomCounter);
      raw_printf(p->out, "oomRepeat  = %d\n", oomRepeat);
    }
  }else
#endif /* SQLITE_DEBUG */

  if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
    char *zNewFilename = 0;  /* Name of the database file to open */
    int iName = 1;           /* Index in azArg[] of the filename */
    int newFlag = 0;         /* True to delete file before opening */
    /* Close the existing database */
    session_close_all(p);
    close_db(p->db);
    p->db = 0;
    p->zDbFilename = 0;
    sqlite3_free(p->zFreeOnClose);
    p->zFreeOnClose = 0;
    p->openMode = SHELL_OPEN_UNSPEC;
    p->openFlags = 0;
    p->szMax = 0;
    /* Check for command-line arguments */
    for(iName=1; iName<nArg; iName++){
      const char *z = azArg[iName];
      if( optionMatch(z,"new") ){
        newFlag = 1;
#ifdef SQLITE_HAVE_ZLIB
      }else if( optionMatch(z, "zip") ){
        p->openMode = SHELL_OPEN_ZIPFILE;
#endif
18743
18744
18745
18746
18747
18748
18749






18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
      }else if( optionMatch(z, "maxsize") && iName+1<nArg ){
        p->szMax = integerValue(azArg[++iName]);
#endif /* SQLITE_ENABLE_DESERIALIZE */
      }else if( z[0]=='-' ){
        utf8_printf(stderr, "unknown option: %s\n", z);
        rc = 1;
        goto meta_command_exit;






      }
    }
    /* If a filename is specified, try to open it first */
    zNewFilename = nArg>iName ? sqlite3_mprintf("%s", azArg[iName]) : 0;
    if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
      if( newFlag ) shellDeleteFile(zNewFilename);
      p->zDbFilename = zNewFilename;
      open_db(p, OPEN_DB_KEEPALIVE);
      if( p->db==0 ){
        utf8_printf(stderr, "Error: cannot open '%s'\n", zNewFilename);
        sqlite3_free(zNewFilename);







>
>
>
>
>
>



<







18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760

18761
18762
18763
18764
18765
18766
18767
      }else if( optionMatch(z, "maxsize") && iName+1<nArg ){
        p->szMax = integerValue(azArg[++iName]);
#endif /* SQLITE_ENABLE_DESERIALIZE */
      }else if( z[0]=='-' ){
        utf8_printf(stderr, "unknown option: %s\n", z);
        rc = 1;
        goto meta_command_exit;
      }else if( zNewFilename ){
        utf8_printf(stderr, "extra argument: \"%s\"\n", z);
        rc = 1;
        goto meta_command_exit;
      }else{
        zNewFilename = sqlite3_mprintf("%s", z);
      }
    }
    /* If a filename is specified, try to open it first */

    if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
      if( newFlag ) shellDeleteFile(zNewFilename);
      p->zDbFilename = zNewFilename;
      open_db(p, OPEN_DB_KEEPALIVE);
      if( p->db==0 ){
        utf8_printf(stderr, "Error: cannot open '%s'\n", zNewFilename);
        sqlite3_free(zNewFilename);
19269
19270
19271
19272
19273
19274
19275
19276
19277
19278

19279
19280
19281
19282
19283
19284
19285
19286
19287
      raw_printf(stderr,"Error: querying schema information\n");
      rc = 1;
    }else{
      rc = 0;
    }
  }else

#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
  if( c=='s' && n==11 && strncmp(azArg[0], "selecttrace", n)==0 ){
    sqlite3_unsupported_selecttrace = nArg>=2 ? (int)integerValue(azArg[1]) : 0xffff;

  }else
#endif

#if defined(SQLITE_ENABLE_SESSION)
  if( c=='s' && strncmp(azArg[0],"session",n)==0 && n>=3 ){
    OpenSession *pSession = &p->aSession[0];
    char **azCmd = &azArg[1];
    int iSes = 0;
    int nCmd = nArg - 1;







<

|
>

<







19276
19277
19278
19279
19280
19281
19282

19283
19284
19285
19286

19287
19288
19289
19290
19291
19292
19293
      raw_printf(stderr,"Error: querying schema information\n");
      rc = 1;
    }else{
      rc = 0;
    }
  }else


  if( c=='s' && n==11 && strncmp(azArg[0], "selecttrace", n)==0 ){
    unsigned int x = nArg>=2 ? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
    sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &x);
  }else


#if defined(SQLITE_ENABLE_SESSION)
  if( c=='s' && strncmp(azArg[0],"session",n)==0 && n>=3 ){
    OpenSession *pSession = &p->aSession[0];
    char **azCmd = &azArg[1];
    int iSes = 0;
    int nCmd = nArg - 1;
20328
20329
20330
20331
20332
20333
20334
20335
20336
20337

20338
20339
20340
20341
20342
20343
20344
20345
20346
      if( zVfsName ){
        utf8_printf(p->out, "%s\n", zVfsName);
        sqlite3_free(zVfsName);
      }
    }
  }else

#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
  if( c=='w' && strncmp(azArg[0], "wheretrace", n)==0 ){
    sqlite3WhereTrace = nArg>=2 ? booleanValue(azArg[1]) : 0xff;

  }else
#endif

  if( c=='w' && strncmp(azArg[0], "width", n)==0 ){
    int j;
    assert( nArg<=ArraySize(azArg) );
    p->nWidth = nArg-1;
    p->colWidth = realloc(p->colWidth, p->nWidth*sizeof(int)*2);
    if( p->colWidth==0 && p->nWidth>0 ) shell_out_of_memory();







<

|
>

<







20334
20335
20336
20337
20338
20339
20340

20341
20342
20343
20344

20345
20346
20347
20348
20349
20350
20351
      if( zVfsName ){
        utf8_printf(p->out, "%s\n", zVfsName);
        sqlite3_free(zVfsName);
      }
    }
  }else


  if( c=='w' && strncmp(azArg[0], "wheretrace", n)==0 ){
    unsigned int x = nArg>=2 ? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
    sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &x);
  }else


  if( c=='w' && strncmp(azArg[0], "width", n)==0 ){
    int j;
    assert( nArg<=ArraySize(azArg) );
    p->nWidth = nArg-1;
    p->colWidth = realloc(p->colWidth, p->nWidth*sizeof(int)*2);
    if( p->colWidth==0 && p->nWidth>0 ) shell_out_of_memory();
Changes to src/sqlite3.c.
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.34.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


|







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.35.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
279
280
281
282
283
284
285



286
287
288
289
290
291
292
  "ENABLE_JSON1",
#endif
#if SQLITE_ENABLE_LOAD_EXTENSION
  "ENABLE_LOAD_EXTENSION",
#endif
#ifdef SQLITE_ENABLE_LOCKING_STYLE
  "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),



#endif
#if SQLITE_ENABLE_MEMORY_MANAGEMENT
  "ENABLE_MEMORY_MANAGEMENT",
#endif
#if SQLITE_ENABLE_MEMSYS3
  "ENABLE_MEMSYS3",
#endif







>
>
>







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
  "ENABLE_JSON1",
#endif
#if SQLITE_ENABLE_LOAD_EXTENSION
  "ENABLE_LOAD_EXTENSION",
#endif
#ifdef SQLITE_ENABLE_LOCKING_STYLE
  "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
#endif
#if SQLITE_ENABLE_MATH_FUNCTIONS
  "ENABLE_MATH_FUNCTIONS"
#endif
#if SQLITE_ENABLE_MEMORY_MANAGEMENT
  "ENABLE_MEMORY_MANAGEMENT",
#endif
#if SQLITE_ENABLE_MEMSYS3
  "ENABLE_MEMSYS3",
#endif
986
987
988
989
990
991
992












993
994
995
996
997
998
999
#endif
#if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC)
# define MSVC_VERSION _MSC_VER
#else
# define MSVC_VERSION 0
#endif













/* Needed for various definitions... */
#if defined(__GNUC__) && !defined(_GNU_SOURCE)
# define _GNU_SOURCE
#endif

#if defined(__OpenBSD__) && !defined(_BSD_SOURCE)
# define _BSD_SOURCE







>
>
>
>
>
>
>
>
>
>
>
>







989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
#endif
#if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC)
# define MSVC_VERSION _MSC_VER
#else
# define MSVC_VERSION 0
#endif

/*
** Some C99 functions in "math.h" are only present for MSVC when its version
** is associated with Visual Studio 2013 or higher.
*/
#ifndef SQLITE_HAVE_C99_MATH_FUNCS
# if MSVC_VERSION==0 || MSVC_VERSION>=1800
#  define SQLITE_HAVE_C99_MATH_FUNCS (1)
# else
#  define SQLITE_HAVE_C99_MATH_FUNCS (0)
# endif
#endif

/* Needed for various definitions... */
#if defined(__GNUC__) && !defined(_GNU_SOURCE)
# define _GNU_SOURCE
#endif

#if defined(__OpenBSD__) && !defined(_BSD_SOURCE)
# define _BSD_SOURCE
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
** 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.34.0"
#define SQLITE_VERSION_NUMBER 3034000
#define SQLITE_SOURCE_ID      "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b"

/*
** 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







|
|
|







1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
** 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.35.0"
#define SQLITE_VERSION_NUMBER 3035000
#define SQLITE_SOURCE_ID      "2020-12-15 13:55:38 ea0a7f103a6f6a9e57d7377140ff9f372bf2b156f86f148291fb05a7030f2b36"

/*
** 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
8809
8810
8811
8812
8813
8814
8815

8816
8817
8818
8819
8820
8821
8822
8823
#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_PRNG_SEED               28
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS     29
#define SQLITE_TESTCTRL_SEEK_COUNT              30

#define SQLITE_TESTCTRL_LAST                    30  /* 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,







>
|







8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
#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_PRNG_SEED               28
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS     29
#define SQLITE_TESTCTRL_SEEK_COUNT              30
#define SQLITE_TESTCTRL_TRACEFLAGS              31
#define SQLITE_TESTCTRL_LAST                    31  /* 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,
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602

14603
14604
14605
14606
14607
14608
14609
14610
14611















14612
14613
14614
14615
14616
14617
14618
# define SQLITE_DEFAULT_MMAP_SIZE SQLITE_MAX_MMAP_SIZE
#endif

/*
** SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not
** the Select query generator tracing logic is turned on.
*/
#if defined(SQLITE_ENABLE_SELECTTRACE)
# define SELECTTRACE_ENABLED 1
#else
# define SELECTTRACE_ENABLED 0
#endif
#if defined(SQLITE_ENABLE_SELECTTRACE)

# define SELECTTRACE_ENABLED 1
# define SELECTTRACE(K,P,S,X)  \
  if(sqlite3_unsupported_selecttrace&(K))   \
    sqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\
    sqlite3DebugPrintf X
#else
# define SELECTTRACE(K,P,S,X)
# define SELECTTRACE_ENABLED 0
#endif
















/*
** An instance of the following structure is used to store the busy-handler
** callback for a given sqlite handle.
**
** The sqlite.busyHandler member of the sqlite struct contains the busy
** callback for the database handle. Each pager opened via the sqlite







|
<
|
<

|
>


|






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







14606
14607
14608
14609
14610
14611
14612
14613

14614

14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
# define SQLITE_DEFAULT_MMAP_SIZE SQLITE_MAX_MMAP_SIZE
#endif

/*
** SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not
** the Select query generator tracing logic is turned on.
*/
#if !defined(SQLITE_AMALGAMATION)

SQLITE_PRIVATE u32 sqlite3SelectTrace;

#endif
#if defined(SQLITE_DEBUG) \
    && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_SELECTTRACE))
# define SELECTTRACE_ENABLED 1
# define SELECTTRACE(K,P,S,X)  \
  if(sqlite3SelectTrace&(K))   \
    sqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\
    sqlite3DebugPrintf X
#else
# define SELECTTRACE(K,P,S,X)
# define SELECTTRACE_ENABLED 0
#endif

/*
** Macros for "wheretrace"
*/
#if !defined(SQLITE_AMAGAMATION)
SQLITE_PRIVATE u32 sqlite3WhereTrace;
#endif
#if defined(SQLITE_DEBUG) \
    && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))
# define WHERETRACE(K,X)  if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X
# define WHERETRACE_ENABLED 1
#else
# define WHERETRACE(K,X)
#endif


/*
** An instance of the following structure is used to store the busy-handler
** callback for a given sqlite handle.
**
** The sqlite.busyHandler member of the sqlite struct contains the busy
** callback for the database handle. Each pager opened via the sqlite
15314
15315
15316
15317
15318
15319
15320

15321
15322
15323
15324
15325
15326
15327
SQLITE_PRIVATE int sqlite3BtreeCursorRestore(BtCursor*, int*);
SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*, u8 flags);

/* Allowed flags for sqlite3BtreeDelete() and sqlite3BtreeInsert() */
#define BTREE_SAVEPOSITION 0x02  /* Leave cursor pointing at NEXT or PREV */
#define BTREE_AUXDELETE    0x04  /* not the primary delete operation */
#define BTREE_APPEND       0x08  /* Insert is likely an append */


/* An instance of the BtreePayload object describes the content of a single
** entry in either an index or table btree.
**
** Index btrees (used for indexes and also WITHOUT ROWID tables) contain
** an arbitrary key and no data.  These btrees have pKey,nKey set to the
** key and the pData,nData,nZero fields are uninitialized.  The aMem,nMem







>







15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
SQLITE_PRIVATE int sqlite3BtreeCursorRestore(BtCursor*, int*);
SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*, u8 flags);

/* Allowed flags for sqlite3BtreeDelete() and sqlite3BtreeInsert() */
#define BTREE_SAVEPOSITION 0x02  /* Leave cursor pointing at NEXT or PREV */
#define BTREE_AUXDELETE    0x04  /* not the primary delete operation */
#define BTREE_APPEND       0x08  /* Insert is likely an append */
#define BTREE_PREFORMAT    0x80  /* Insert is likely an append */

/* An instance of the BtreePayload object describes the content of a single
** entry in either an index or table btree.
**
** Index btrees (used for indexes and also WITHOUT ROWID tables) contain
** an arbitrary key and no data.  These btrees have pKey,nKey set to the
** key and the pData,nData,nZero fields are uninitialized.  The aMem,nMem
15412
15413
15414
15415
15416
15417
15418


15419
15420
15421
15422
15423
15424
15425
SQLITE_PRIVATE int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*);
#endif

#ifndef SQLITE_OMIT_WAL
SQLITE_PRIVATE   int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
#endif



/*
** If we are not using shared cache, then there is no need to
** use mutexes to access the BtShared structures.  So make the
** Enter and Leave procedures no-ops.
*/
#ifndef SQLITE_OMIT_SHARED_CACHE







>
>







15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
SQLITE_PRIVATE int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*);
#endif

#ifndef SQLITE_OMIT_WAL
SQLITE_PRIVATE   int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);
#endif

SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor*, BtCursor*, i64);

/*
** If we are not using shared cache, then there is no need to
** use mutexes to access the BtShared structures.  So make the
** Enter and Leave procedures no-ops.
*/
#ifndef SQLITE_OMIT_SHARED_CACHE
15755
15756
15757
15758
15759
15760
15761

15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789

15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
#define OP_Close         116
#define OP_ColumnsUsed   117
#define OP_SeekScan      118 /* synopsis: Scan-ahead up to P1 rows         */
#define OP_SeekHit       119 /* synopsis: set P2<=seekHit<=P3              */
#define OP_Sequence      120 /* synopsis: r[P2]=cursor[P1].ctr++           */
#define OP_NewRowid      121 /* synopsis: r[P2]=rowid                      */
#define OP_Insert        122 /* synopsis: intkey=r[P3] data=r[P2]          */

#define OP_Delete        123
#define OP_ResetCount    124
#define OP_SorterCompare 125 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
#define OP_SorterData    126 /* synopsis: r[P2]=data                       */
#define OP_RowData       127 /* synopsis: r[P2]=data                       */
#define OP_Rowid         128 /* synopsis: r[P2]=rowid                      */
#define OP_NullRow       129
#define OP_SeekEnd       130
#define OP_IdxInsert     131 /* synopsis: key=r[P2]                        */
#define OP_SorterInsert  132 /* synopsis: key=r[P2]                        */
#define OP_IdxDelete     133 /* synopsis: key=r[P2@P3]                     */
#define OP_DeferredSeek  134 /* synopsis: Move P3 to P1.rowid if needed    */
#define OP_IdxRowid      135 /* synopsis: r[P2]=rowid                      */
#define OP_FinishSeek    136
#define OP_Destroy       137
#define OP_Clear         138
#define OP_ResetSorter   139
#define OP_CreateBtree   140 /* synopsis: r[P2]=root iDb=P1 flags=P3       */
#define OP_SqlExec       141
#define OP_ParseSchema   142
#define OP_LoadAnalysis  143
#define OP_DropTable     144
#define OP_DropIndex     145
#define OP_DropTrigger   146
#define OP_IntegrityCk   147
#define OP_RowSetAdd     148 /* synopsis: rowset(P1)=r[P2]                 */
#define OP_Param         149
#define OP_Real          150 /* same as TK_FLOAT, synopsis: r[P2]=P4       */

#define OP_FkCounter     151 /* synopsis: fkctr[P1]+=P2                    */
#define OP_MemMax        152 /* synopsis: r[P1]=max(r[P1],r[P2])           */
#define OP_OffsetLimit   153 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
#define OP_AggInverse    154 /* synopsis: accum=r[P3] inverse(r[P2@P5])    */
#define OP_AggStep       155 /* synopsis: accum=r[P3] step(r[P2@P5])       */
#define OP_AggStep1      156 /* synopsis: accum=r[P3] step(r[P2@P5])       */
#define OP_AggValue      157 /* synopsis: r[P3]=value N=P2                 */
#define OP_AggFinal      158 /* synopsis: accum=r[P1] N=P2                 */
#define OP_Expire        159
#define OP_CursorLock    160
#define OP_CursorUnlock  161
#define OP_TableLock     162 /* synopsis: iDb=P1 root=P2 write=P3          */
#define OP_VBegin        163
#define OP_VCreate       164
#define OP_VDestroy      165
#define OP_VOpen         166
#define OP_VColumn       167 /* synopsis: r[P3]=vcolumn(P2)                */
#define OP_VRename       168
#define OP_Pagecount     169
#define OP_MaxPgcnt      170
#define OP_Trace         171
#define OP_CursorHint    172
#define OP_ReleaseReg    173 /* synopsis: release r[P1@P2] mask P3         */
#define OP_Noop          174
#define OP_Explain       175
#define OP_Abortable     176

/* Properties such as "out2" or "jump" that are specified in
** comments following the "case" for each opcode in the vdbe.c
** are encoded into bitvectors as follows:
*/
#define OPFLG_JUMP        0x01  /* jump:  P2 holds jmp target */
#define OPFLG_IN1         0x02  /* in1:   P1 is an input */







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<

>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821

15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
#define OP_Close         116
#define OP_ColumnsUsed   117
#define OP_SeekScan      118 /* synopsis: Scan-ahead up to P1 rows         */
#define OP_SeekHit       119 /* synopsis: set P2<=seekHit<=P3              */
#define OP_Sequence      120 /* synopsis: r[P2]=cursor[P1].ctr++           */
#define OP_NewRowid      121 /* synopsis: r[P2]=rowid                      */
#define OP_Insert        122 /* synopsis: intkey=r[P3] data=r[P2]          */
#define OP_RowCell       123
#define OP_Delete        124
#define OP_ResetCount    125
#define OP_SorterCompare 126 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
#define OP_SorterData    127 /* synopsis: r[P2]=data                       */
#define OP_RowData       128 /* synopsis: r[P2]=data                       */
#define OP_Rowid         129 /* synopsis: r[P2]=rowid                      */
#define OP_NullRow       130
#define OP_SeekEnd       131
#define OP_IdxInsert     132 /* synopsis: key=r[P2]                        */
#define OP_SorterInsert  133 /* synopsis: key=r[P2]                        */
#define OP_IdxDelete     134 /* synopsis: key=r[P2@P3]                     */
#define OP_DeferredSeek  135 /* synopsis: Move P3 to P1.rowid if needed    */
#define OP_IdxRowid      136 /* synopsis: r[P2]=rowid                      */
#define OP_FinishSeek    137
#define OP_Destroy       138
#define OP_Clear         139
#define OP_ResetSorter   140
#define OP_CreateBtree   141 /* synopsis: r[P2]=root iDb=P1 flags=P3       */
#define OP_SqlExec       142
#define OP_ParseSchema   143
#define OP_LoadAnalysis  144
#define OP_DropTable     145
#define OP_DropIndex     146
#define OP_DropTrigger   147
#define OP_IntegrityCk   148
#define OP_RowSetAdd     149 /* synopsis: rowset(P1)=r[P2]                 */

#define OP_Real          150 /* same as TK_FLOAT, synopsis: r[P2]=P4       */
#define OP_Param         151
#define OP_FkCounter     152 /* synopsis: fkctr[P1]+=P2                    */
#define OP_MemMax        153 /* synopsis: r[P1]=max(r[P1],r[P2])           */
#define OP_OffsetLimit   154 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
#define OP_AggInverse    155 /* synopsis: accum=r[P3] inverse(r[P2@P5])    */
#define OP_AggStep       156 /* synopsis: accum=r[P3] step(r[P2@P5])       */
#define OP_AggStep1      157 /* synopsis: accum=r[P3] step(r[P2@P5])       */
#define OP_AggValue      158 /* synopsis: r[P3]=value N=P2                 */
#define OP_AggFinal      159 /* synopsis: accum=r[P1] N=P2                 */
#define OP_Expire        160
#define OP_CursorLock    161
#define OP_CursorUnlock  162
#define OP_TableLock     163 /* synopsis: iDb=P1 root=P2 write=P3          */
#define OP_VBegin        164
#define OP_VCreate       165
#define OP_VDestroy      166
#define OP_VOpen         167
#define OP_VColumn       168 /* synopsis: r[P3]=vcolumn(P2)                */
#define OP_VRename       169
#define OP_Pagecount     170
#define OP_MaxPgcnt      171
#define OP_Trace         172
#define OP_CursorHint    173
#define OP_ReleaseReg    174 /* synopsis: release r[P1@P2] mask P3         */
#define OP_Noop          175
#define OP_Explain       176
#define OP_Abortable     177

/* Properties such as "out2" or "jump" that are specified in
** comments following the "case" for each opcode in the vdbe.c
** are encoded into bitvectors as follows:
*/
#define OPFLG_JUMP        0x01  /* jump:  P2 holds jmp target */
#define OPFLG_IN1         0x02  /* in1:   P1 is an input */
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
/*  72 */ 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\
/*  80 */ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x12,\
/*  88 */ 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
/*  96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0x26,\
/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00,\
/* 112 */ 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\
/* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
/* 128 */ 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\
/* 136 */ 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00,\
/* 152 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
/* 168 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
/* 176 */ 0x00,}

/* The sqlite3P2Values() routine is able to run faster if it knows
** the value of the largest JUMP opcode.  The smaller the maximum
** JUMP opcode the better, so the mkopcodeh.tcl script that
** generated this include file strives to group all JUMP opcodes
** together near the beginning of the list.
*/







|
|
|
|

|
|







15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
/*  72 */ 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\
/*  80 */ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x12,\
/*  88 */ 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
/*  96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0x26,\
/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00,\
/* 112 */ 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\
/* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
/* 128 */ 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,\
/* 136 */ 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00,\
/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10,\
/* 152 */ 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,\
/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
/* 168 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,\
/* 176 */ 0x00, 0x00,}

/* The sqlite3P2Values() routine is able to run faster if it knows
** the value of the largest JUMP opcode.  The smaller the maximum
** JUMP opcode the better, so the mkopcodeh.tcl script that
** generated this include file strives to group all JUMP opcodes
** together near the beginning of the list.
*/
17283
17284
17285
17286
17287
17288
17289



17290
17291
17292
17293
17294
17295
17296
**   DFUNCTION(zName, nArg, iArg, bNC, xFunc)
**     Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag and
**     adds the SQLITE_FUNC_SLOCHNG flag.  Used for date & time functions
**     and functions like sqlite_version() that can change, but not during
**     a single query.  The iArg is ignored.  The user-data is always set
**     to a NULL pointer.  The bNC parameter is not used.
**



**   PURE_DATE(zName, nArg, iArg, bNC, xFunc)
**     Used for "pure" date/time functions, this macro is like DFUNCTION
**     except that it does set the SQLITE_FUNC_CONSTANT flags.  iArg is
**     ignored and the user-data for these functions is set to an
**     arbitrary non-NULL pointer.  The bNC parameter is not used.
**
**   AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal)







>
>
>







17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
**   DFUNCTION(zName, nArg, iArg, bNC, xFunc)
**     Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag and
**     adds the SQLITE_FUNC_SLOCHNG flag.  Used for date & time functions
**     and functions like sqlite_version() that can change, but not during
**     a single query.  The iArg is ignored.  The user-data is always set
**     to a NULL pointer.  The bNC parameter is not used.
**
**   MFUNCTION(zName, nArg, xPtr, xFunc)
**     For math-library functions.  xPtr is an arbitrary pointer.
**
**   PURE_DATE(zName, nArg, iArg, bNC, xFunc)
**     Used for "pure" date/time functions, this macro is like DFUNCTION
**     except that it does set the SQLITE_FUNC_CONSTANT flags.  iArg is
**     ignored and the user-data for these functions is set to an
**     arbitrary non-NULL pointer.  The bNC parameter is not used.
**
**   AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal)
17318
17319
17320
17321
17322
17323
17324



17325
17326
17327
17328
17329
17330
17331
   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define VFUNCTION(zName, nArg, iArg, bNC, xFunc) \
  {nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \
  {nArg, SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }



#define INLINE_FUNC(zName, nArg, iArg, mFlags) \
  {nArg, SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
   SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
#define TEST_FUNC(zName, nArg, iArg, mFlags) \
  {nArg, SQLITE_UTF8|SQLITE_FUNC_INTERNAL|SQLITE_FUNC_TEST| \
         SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
   SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }







>
>
>







17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define VFUNCTION(zName, nArg, iArg, bNC, xFunc) \
  {nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \
  {nArg, SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define MFUNCTION(zName, nArg, xPtr, xFunc) \
  {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
   xPtr, 0, xFunc, 0, 0, 0, #zName, {0} }
#define INLINE_FUNC(zName, nArg, iArg, mFlags) \
  {nArg, SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
   SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
#define TEST_FUNC(zName, nArg, iArg, mFlags) \
  {nArg, SQLITE_UTF8|SQLITE_FUNC_INTERNAL|SQLITE_FUNC_TEST| \
         SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
   SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
17717
17718
17719
17720
17721
17722
17723


17724
17725
17726
17727

17728
17729
17730
17731



17732
17733
17734
17735
17736
17737
17738
17739
17740
** the operation in progress stops and returns an error code.  But prior
** changes due to the same operation are not backed out and no rollback
** occurs.  IGNORE means that the particular row that caused the constraint
** error is not inserted or updated.  Processing continues and no error
** is returned.  REPLACE means that preexisting database rows that caused
** a UNIQUE constraint violation are removed so that the new insert or
** update can proceed.  Processing continues and no error is reported.


**
** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys.
** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the
** same as ROLLBACK for DEFERRED keys.  SETNULL means that the foreign

** key is set to NULL.  CASCADE means that a DELETE or UPDATE of the
** referenced table row is propagated into the row that holds the
** foreign key.
**



** The following symbolic values are used to record which type
** of action to take.
*/
#define OE_None     0   /* There is no constraint to check */
#define OE_Rollback 1   /* Fail the operation and rollback the transaction */
#define OE_Abort    2   /* Back out changes but do no rollback transaction */
#define OE_Fail     3   /* Stop the operation but leave all prior changes */
#define OE_Ignore   4   /* Ignore the error. Do not do the INSERT or UPDATE */
#define OE_Replace  5   /* Delete existing record, then do INSERT or UPDATE */







>
>

|


>
|



>
>
>

|







17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
** the operation in progress stops and returns an error code.  But prior
** changes due to the same operation are not backed out and no rollback
** occurs.  IGNORE means that the particular row that caused the constraint
** error is not inserted or updated.  Processing continues and no error
** is returned.  REPLACE means that preexisting database rows that caused
** a UNIQUE constraint violation are removed so that the new insert or
** update can proceed.  Processing continues and no error is reported.
** UPDATE applies to insert operations only and means that the insert
** is omitted and the DO UPDATE clause of an upsert is run instead.
**
** RESTRICT, SETNULL, SETDFLT, and CASCADE actions apply only to foreign keys.
** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the
** same as ROLLBACK for DEFERRED keys.  SETNULL means that the foreign
** key is set to NULL.  SETDFLT means that the foreign key is set
** to its default value.  CASCADE means that a DELETE or UPDATE of the
** referenced table row is propagated into the row that holds the
** foreign key.
**
** The OE_Default value is a place holder that means to use whatever
** conflict resolution algorthm is required from context.
**
** The following symbolic values are used to record which type
** of conflict resolution action to take.
*/
#define OE_None     0   /* There is no constraint to check */
#define OE_Rollback 1   /* Fail the operation and rollback the transaction */
#define OE_Abort    2   /* Back out changes but do no rollback transaction */
#define OE_Fail     3   /* Stop the operation but leave all prior changes */
#define OE_Ignore   4   /* Ignore the error. Do not do the INSERT or UPDATE */
#define OE_Replace  5   /* Delete existing record, then do INSERT or UPDATE */
18480
18481
18482
18483
18484
18485
18486
18487
18488
18489
18490


18491



18492
18493
18494


18495
18496
18497
18498
18499
18500
18501
18502
**
** pUpsertSet is the list of column=expr terms of the UPDATE statement.
** The pUpsertSet field is NULL for a ON CONFLICT DO NOTHING.  The
** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the
** WHERE clause is omitted.
*/
struct Upsert {
  ExprList *pUpsertTarget;  /* Optional description of conflicting index */
  Expr *pUpsertTargetWhere; /* WHERE clause for partial index targets */
  ExprList *pUpsertSet;     /* The SET clause from an ON CONFLICT UPDATE */
  Expr *pUpsertWhere;       /* WHERE clause for the ON CONFLICT UPDATE */


  /* The fields above comprise the parse tree for the upsert clause.



  ** The fields below are used to transfer information from the INSERT
  ** processing down into the UPDATE processing while generating code.
  ** Upsert owns the memory allocated above, but not the memory below. */


  Index *pUpsertIdx;        /* Constraint that pUpsertTarget identifies */
  SrcList *pUpsertSrc;      /* Table to be updated */
  int regData;              /* First register holding array of VALUES */
  int iDataCur;             /* Index of the data cursor */
  int iIdxCur;              /* Index of the first index cursor */
};

/*







|



>
>
|
>
>
>
|
|
<
>
>
|







18526
18527
18528
18529
18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
18540
18541
18542
18543
18544

18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
**
** pUpsertSet is the list of column=expr terms of the UPDATE statement.
** The pUpsertSet field is NULL for a ON CONFLICT DO NOTHING.  The
** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the
** WHERE clause is omitted.
*/
struct Upsert {
  ExprList *pUpsertTarget;  /* Optional description of conflict target */
  Expr *pUpsertTargetWhere; /* WHERE clause for partial index targets */
  ExprList *pUpsertSet;     /* The SET clause from an ON CONFLICT UPDATE */
  Expr *pUpsertWhere;       /* WHERE clause for the ON CONFLICT UPDATE */
  Upsert *pNextUpsert;      /* Next ON CONFLICT clause in the list */
  u8 isDoUpdate;            /* True for DO UPDATE.  False for DO NOTHING */
  /* Above this point is the parse tree for the ON CONFLICT clauses.
  ** The next group of fields stores intermediate data. */
  void *pToFree;            /* Free memory when deleting the Upsert object */
  /* All fields above are owned by the Upsert object and must be freed
  ** when the Upsert is destroyed.  The fields below are used to transfer
  ** information from the INSERT processing down into the UPDATE processing

  ** while generating code.  The fields below are owned by the INSERT
  ** statement and will be freed by INSERT processing. */
  Index *pUpsertIdx;        /* UNIQUE constraint specified by pUpsertTarget */
  SrcList *pUpsertSrc;      /* Table to be updated */
  int regData;              /* First register holding array of VALUES */
  int iDataCur;             /* Index of the data cursor */
  int iIdxCur;              /* Index of the first index cursor */
};

/*
18930
18931
18932
18933
18934
18935
18936

18937
18938
18939
18940
18941
18942
18943
#define OPFLAG_SEEKEQ        0x02    /* OP_Open** cursor uses EQ seek only */
#define OPFLAG_FORDELETE     0x08    /* OP_Open should use BTREE_FORDELETE */
#define OPFLAG_P2ISREG       0x10    /* P2 to OP_Open** is a register number */
#define OPFLAG_PERMUTE       0x01    /* OP_Compare: use the permutation */
#define OPFLAG_SAVEPOSITION  0x02    /* OP_Delete/Insert: save cursor pos */
#define OPFLAG_AUXDELETE     0x04    /* OP_Delete: index in a DELETE op */
#define OPFLAG_NOCHNG_MAGIC  0x6d    /* OP_MakeRecord: serialtype 10 is ok */


/*
 * Each trigger present in the database schema is stored as an instance of
 * struct Trigger.
 *
 * Pointers to instances of struct Trigger are stored in two ways.
 * 1. In the "trigHash" hash table (part of the sqlite3* that represents the







>







18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995
18996
#define OPFLAG_SEEKEQ        0x02    /* OP_Open** cursor uses EQ seek only */
#define OPFLAG_FORDELETE     0x08    /* OP_Open should use BTREE_FORDELETE */
#define OPFLAG_P2ISREG       0x10    /* P2 to OP_Open** is a register number */
#define OPFLAG_PERMUTE       0x01    /* OP_Compare: use the permutation */
#define OPFLAG_SAVEPOSITION  0x02    /* OP_Delete/Insert: save cursor pos */
#define OPFLAG_AUXDELETE     0x04    /* OP_Delete: index in a DELETE op */
#define OPFLAG_NOCHNG_MAGIC  0x6d    /* OP_MakeRecord: serialtype 10 is ok */
#define OPFLAG_PREFORMAT     0x80    /* OP_Insert uses preformatted cell */

/*
 * Each trigger present in the database schema is stored as an instance of
 * struct Trigger.
 *
 * Pointers to instances of struct Trigger are stored in two ways.
 * 1. In the "trigHash" hash table (part of the sqlite3* that represents the
20027
20028
20029
20030
20031
20032
20033
20034
20035
20036
20037
20038
20039
20040
20041
#ifndef SQLITE_AMALGAMATION
SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[];
SQLITE_PRIVATE const char sqlite3StrBINARY[];
SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[];
SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[];
SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config;
SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions;
SQLITE_API extern u32 sqlite3_unsupported_selecttrace;
#ifndef SQLITE_OMIT_WSD
SQLITE_PRIVATE int sqlite3PendingByte;
#endif
#endif /* SQLITE_AMALGAMATION */
#ifdef VDBE_PROFILE
SQLITE_PRIVATE sqlite3_uint64 sqlite3NProfileCnt;
#endif







<







20080
20081
20082
20083
20084
20085
20086

20087
20088
20089
20090
20091
20092
20093
#ifndef SQLITE_AMALGAMATION
SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[];
SQLITE_PRIVATE const char sqlite3StrBINARY[];
SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[];
SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[];
SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config;
SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions;

#ifndef SQLITE_OMIT_WSD
SQLITE_PRIVATE int sqlite3PendingByte;
#endif
#endif /* SQLITE_AMALGAMATION */
#ifdef VDBE_PROFILE
SQLITE_PRIVATE sqlite3_uint64 sqlite3NProfileCnt;
#endif
20238
20239
20240
20241
20242
20243
20244
20245
20246
20247
20248
20249


20250
20251
20252
20253


20254
20255
20256
20257
20258
20259
20260
SQLITE_PRIVATE   void sqlite3WithDelete(sqlite3*,With*);
SQLITE_PRIVATE   void sqlite3WithPush(Parse*, With*, u8);
#else
#define sqlite3WithPush(x,y,z)
#define sqlite3WithDelete(x,y)
#endif
#ifndef SQLITE_OMIT_UPSERT
SQLITE_PRIVATE   Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*);
SQLITE_PRIVATE   void sqlite3UpsertDelete(sqlite3*,Upsert*);
SQLITE_PRIVATE   Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
SQLITE_PRIVATE   int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*);
SQLITE_PRIVATE   void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int);


#else
#define sqlite3UpsertNew(v,w,x,y,z) ((Upsert*)0)
#define sqlite3UpsertDelete(x,y)
#define sqlite3UpsertDup(x,y)       ((Upsert*)0)


#endif


/* Declarations for functions in fkey.c. All of these are replaced by
** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
** key functionality is available. If OMIT_TRIGGER is defined but
** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In







|




>
>

|

|
>
>







20290
20291
20292
20293
20294
20295
20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
20314
20315
20316
SQLITE_PRIVATE   void sqlite3WithDelete(sqlite3*,With*);
SQLITE_PRIVATE   void sqlite3WithPush(Parse*, With*, u8);
#else
#define sqlite3WithPush(x,y,z)
#define sqlite3WithDelete(x,y)
#endif
#ifndef SQLITE_OMIT_UPSERT
SQLITE_PRIVATE   Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*);
SQLITE_PRIVATE   void sqlite3UpsertDelete(sqlite3*,Upsert*);
SQLITE_PRIVATE   Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
SQLITE_PRIVATE   int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*);
SQLITE_PRIVATE   void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int);
SQLITE_PRIVATE   Upsert *sqlite3UpsertOfIndex(Upsert*,Index*);
SQLITE_PRIVATE   int sqlite3UpsertNextIsIPK(Upsert*);
#else
#define sqlite3UpsertNew(u,v,w,x,y,z) ((Upsert*)0)
#define sqlite3UpsertDelete(x,y)
#define sqlite3UpsertDup(x,y)         ((Upsert*)0)
#define sqlite3UpsertOfIndex(x,y)     ((Upsert*)0)
#define sqlite3UpsertNextIsIPK(x)     0
#endif


/* Declarations for functions in fkey.c. All of these are replaced by
** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
** key functionality is available. If OMIT_TRIGGER is defined but
** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In
20742
20743
20744
20745
20746
20747
20748
20749
20750
20751

20752
20753
20754
20755
20756
20757
20758
** and incorrect behavior.
*/
#ifndef SQLITE_OMIT_WSD
SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
#endif

/*
** Flags for select tracing and the ".selecttrace" macro of the CLI
*/
SQLITE_API u32 sqlite3_unsupported_selecttrace = 0;


/* #include "opcodes.h" */
/*
** Properties of opcodes.  The OPFLG_INITIALIZER macro is
** created by mkopcodeh.awk during compilation.  Data is obtained
** from the comments following the "case OP_xxxx:" statements in
** the vdbe.c file.







|

|
>







20798
20799
20800
20801
20802
20803
20804
20805
20806
20807
20808
20809
20810
20811
20812
20813
20814
20815
** and incorrect behavior.
*/
#ifndef SQLITE_OMIT_WSD
SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
#endif

/*
** Tracing flags set by SQLITE_TESTCTRL_TRACEFLAGS.
*/
SQLITE_PRIVATE u32 sqlite3SelectTrace = 0;
SQLITE_PRIVATE u32 sqlite3WhereTrace = 0;

/* #include "opcodes.h" */
/*
** Properties of opcodes.  The OPFLG_INITIALIZER macro is
** created by mkopcodeh.awk during compilation.  Data is obtained
** from the comments following the "case OP_xxxx:" statements in
** the vdbe.c file.
23168
23169
23170
23171
23172
23173
23174


23175
23176
23177
23178
23179
23180
23181
23182
23183
23184
23185





23186
23187
23188
23189
23190
23191
23192
** routine has no return value since the return value would be meaningless.
*/
SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
  if( id->pMethods==0 ) return SQLITE_NOTFOUND;
#ifdef SQLITE_TEST
  if( op!=SQLITE_FCNTL_COMMIT_PHASETWO
   && op!=SQLITE_FCNTL_LOCK_TIMEOUT


  ){
    /* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
    ** is using a regular VFS, it is called after the corresponding
    ** transaction has been committed. Injecting a fault at this point
    ** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM
    ** but the transaction is committed anyway.
    **
    ** The core must call OsFileControl() though, not OsFileControlHint(),
    ** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
    ** means the commit really has failed and an error should be returned
    ** to the user.  */





    DO_OS_MALLOC_TEST(id);
  }
#endif
  return id->pMethods->xFileControl(id, op, pArg);
}
SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){
  if( id->pMethods ) (void)id->pMethods->xFileControl(id, op, pArg);







>
>










|
>
>
>
>
>







23225
23226
23227
23228
23229
23230
23231
23232
23233
23234
23235
23236
23237
23238
23239
23240
23241
23242
23243
23244
23245
23246
23247
23248
23249
23250
23251
23252
23253
23254
23255
23256
** routine has no return value since the return value would be meaningless.
*/
SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
  if( id->pMethods==0 ) return SQLITE_NOTFOUND;
#ifdef SQLITE_TEST
  if( op!=SQLITE_FCNTL_COMMIT_PHASETWO
   && op!=SQLITE_FCNTL_LOCK_TIMEOUT
   && op!=SQLITE_FCNTL_CKPT_DONE
   && op!=SQLITE_FCNTL_CKPT_START
  ){
    /* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
    ** is using a regular VFS, it is called after the corresponding
    ** transaction has been committed. Injecting a fault at this point
    ** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM
    ** but the transaction is committed anyway.
    **
    ** The core must call OsFileControl() though, not OsFileControlHint(),
    ** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
    ** means the commit really has failed and an error should be returned
    ** to the user.
    **
    ** The CKPT_DONE and CKPT_START file-controls are write-only signals
    ** to the cksumvfs.  Their return code is meaningless and is ignored
    ** by the SQLite core, so there is no point in simulating OOMs for them.
    */
    DO_OS_MALLOC_TEST(id);
  }
#endif
  return id->pMethods->xFileControl(id, op, pArg);
}
SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){
  if( id->pMethods ) (void)id->pMethods->xFileControl(id, op, pArg);
33369
33370
33371
33372
33373
33374
33375

33376
33377
33378
33379
33380
33381
33382
33383
33384
33385
33386
33387
33388
33389
33390
33391
33392
33393
33394
33395
33396
33397
33398
33399
33400
33401
33402
33403

33404
33405
33406
33407
33408
33409
33410
33411
33412
33413
33414
33415
33416
33417
33418
33419
33420
33421
33422
33423
33424
33425
33426
33427
33428
33429
33430
33431
33432
33433
33434
33435
33436
    /* 116 */ "Close"            OpHelp(""),
    /* 117 */ "ColumnsUsed"      OpHelp(""),
    /* 118 */ "SeekScan"         OpHelp("Scan-ahead up to P1 rows"),
    /* 119 */ "SeekHit"          OpHelp("set P2<=seekHit<=P3"),
    /* 120 */ "Sequence"         OpHelp("r[P2]=cursor[P1].ctr++"),
    /* 121 */ "NewRowid"         OpHelp("r[P2]=rowid"),
    /* 122 */ "Insert"           OpHelp("intkey=r[P3] data=r[P2]"),

    /* 123 */ "Delete"           OpHelp(""),
    /* 124 */ "ResetCount"       OpHelp(""),
    /* 125 */ "SorterCompare"    OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
    /* 126 */ "SorterData"       OpHelp("r[P2]=data"),
    /* 127 */ "RowData"          OpHelp("r[P2]=data"),
    /* 128 */ "Rowid"            OpHelp("r[P2]=rowid"),
    /* 129 */ "NullRow"          OpHelp(""),
    /* 130 */ "SeekEnd"          OpHelp(""),
    /* 131 */ "IdxInsert"        OpHelp("key=r[P2]"),
    /* 132 */ "SorterInsert"     OpHelp("key=r[P2]"),
    /* 133 */ "IdxDelete"        OpHelp("key=r[P2@P3]"),
    /* 134 */ "DeferredSeek"     OpHelp("Move P3 to P1.rowid if needed"),
    /* 135 */ "IdxRowid"         OpHelp("r[P2]=rowid"),
    /* 136 */ "FinishSeek"       OpHelp(""),
    /* 137 */ "Destroy"          OpHelp(""),
    /* 138 */ "Clear"            OpHelp(""),
    /* 139 */ "ResetSorter"      OpHelp(""),
    /* 140 */ "CreateBtree"      OpHelp("r[P2]=root iDb=P1 flags=P3"),
    /* 141 */ "SqlExec"          OpHelp(""),
    /* 142 */ "ParseSchema"      OpHelp(""),
    /* 143 */ "LoadAnalysis"     OpHelp(""),
    /* 144 */ "DropTable"        OpHelp(""),
    /* 145 */ "DropIndex"        OpHelp(""),
    /* 146 */ "DropTrigger"      OpHelp(""),
    /* 147 */ "IntegrityCk"      OpHelp(""),
    /* 148 */ "RowSetAdd"        OpHelp("rowset(P1)=r[P2]"),
    /* 149 */ "Param"            OpHelp(""),
    /* 150 */ "Real"             OpHelp("r[P2]=P4"),

    /* 151 */ "FkCounter"        OpHelp("fkctr[P1]+=P2"),
    /* 152 */ "MemMax"           OpHelp("r[P1]=max(r[P1],r[P2])"),
    /* 153 */ "OffsetLimit"      OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
    /* 154 */ "AggInverse"       OpHelp("accum=r[P3] inverse(r[P2@P5])"),
    /* 155 */ "AggStep"          OpHelp("accum=r[P3] step(r[P2@P5])"),
    /* 156 */ "AggStep1"         OpHelp("accum=r[P3] step(r[P2@P5])"),
    /* 157 */ "AggValue"         OpHelp("r[P3]=value N=P2"),
    /* 158 */ "AggFinal"         OpHelp("accum=r[P1] N=P2"),
    /* 159 */ "Expire"           OpHelp(""),
    /* 160 */ "CursorLock"       OpHelp(""),
    /* 161 */ "CursorUnlock"     OpHelp(""),
    /* 162 */ "TableLock"        OpHelp("iDb=P1 root=P2 write=P3"),
    /* 163 */ "VBegin"           OpHelp(""),
    /* 164 */ "VCreate"          OpHelp(""),
    /* 165 */ "VDestroy"         OpHelp(""),
    /* 166 */ "VOpen"            OpHelp(""),
    /* 167 */ "VColumn"          OpHelp("r[P3]=vcolumn(P2)"),
    /* 168 */ "VRename"          OpHelp(""),
    /* 169 */ "Pagecount"        OpHelp(""),
    /* 170 */ "MaxPgcnt"         OpHelp(""),
    /* 171 */ "Trace"            OpHelp(""),
    /* 172 */ "CursorHint"       OpHelp(""),
    /* 173 */ "ReleaseReg"       OpHelp("release r[P1@P2] mask P3"),
    /* 174 */ "Noop"             OpHelp(""),
    /* 175 */ "Explain"          OpHelp(""),
    /* 176 */ "Abortable"        OpHelp(""),
  };
  return azName[i];
}
#endif

/************** End of opcodes.c *********************************************/
/************** Begin file os_unix.c *****************************************/







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<

>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







33433
33434
33435
33436
33437
33438
33439
33440
33441
33442
33443
33444
33445
33446
33447
33448
33449
33450
33451
33452
33453
33454
33455
33456
33457
33458
33459
33460
33461
33462
33463
33464
33465
33466

33467
33468
33469
33470
33471
33472
33473
33474
33475
33476
33477
33478
33479
33480
33481
33482
33483
33484
33485
33486
33487
33488
33489
33490
33491
33492
33493
33494
33495
33496
33497
33498
33499
33500
33501
    /* 116 */ "Close"            OpHelp(""),
    /* 117 */ "ColumnsUsed"      OpHelp(""),
    /* 118 */ "SeekScan"         OpHelp("Scan-ahead up to P1 rows"),
    /* 119 */ "SeekHit"          OpHelp("set P2<=seekHit<=P3"),
    /* 120 */ "Sequence"         OpHelp("r[P2]=cursor[P1].ctr++"),
    /* 121 */ "NewRowid"         OpHelp("r[P2]=rowid"),
    /* 122 */ "Insert"           OpHelp("intkey=r[P3] data=r[P2]"),
    /* 123 */ "RowCell"          OpHelp(""),
    /* 124 */ "Delete"           OpHelp(""),
    /* 125 */ "ResetCount"       OpHelp(""),
    /* 126 */ "SorterCompare"    OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
    /* 127 */ "SorterData"       OpHelp("r[P2]=data"),
    /* 128 */ "RowData"          OpHelp("r[P2]=data"),
    /* 129 */ "Rowid"            OpHelp("r[P2]=rowid"),
    /* 130 */ "NullRow"          OpHelp(""),
    /* 131 */ "SeekEnd"          OpHelp(""),
    /* 132 */ "IdxInsert"        OpHelp("key=r[P2]"),
    /* 133 */ "SorterInsert"     OpHelp("key=r[P2]"),
    /* 134 */ "IdxDelete"        OpHelp("key=r[P2@P3]"),
    /* 135 */ "DeferredSeek"     OpHelp("Move P3 to P1.rowid if needed"),
    /* 136 */ "IdxRowid"         OpHelp("r[P2]=rowid"),
    /* 137 */ "FinishSeek"       OpHelp(""),
    /* 138 */ "Destroy"          OpHelp(""),
    /* 139 */ "Clear"            OpHelp(""),
    /* 140 */ "ResetSorter"      OpHelp(""),
    /* 141 */ "CreateBtree"      OpHelp("r[P2]=root iDb=P1 flags=P3"),
    /* 142 */ "SqlExec"          OpHelp(""),
    /* 143 */ "ParseSchema"      OpHelp(""),
    /* 144 */ "LoadAnalysis"     OpHelp(""),
    /* 145 */ "DropTable"        OpHelp(""),
    /* 146 */ "DropIndex"        OpHelp(""),
    /* 147 */ "DropTrigger"      OpHelp(""),
    /* 148 */ "IntegrityCk"      OpHelp(""),
    /* 149 */ "RowSetAdd"        OpHelp("rowset(P1)=r[P2]"),

    /* 150 */ "Real"             OpHelp("r[P2]=P4"),
    /* 151 */ "Param"            OpHelp(""),
    /* 152 */ "FkCounter"        OpHelp("fkctr[P1]+=P2"),
    /* 153 */ "MemMax"           OpHelp("r[P1]=max(r[P1],r[P2])"),
    /* 154 */ "OffsetLimit"      OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
    /* 155 */ "AggInverse"       OpHelp("accum=r[P3] inverse(r[P2@P5])"),
    /* 156 */ "AggStep"          OpHelp("accum=r[P3] step(r[P2@P5])"),
    /* 157 */ "AggStep1"         OpHelp("accum=r[P3] step(r[P2@P5])"),
    /* 158 */ "AggValue"         OpHelp("r[P3]=value N=P2"),
    /* 159 */ "AggFinal"         OpHelp("accum=r[P1] N=P2"),
    /* 160 */ "Expire"           OpHelp(""),
    /* 161 */ "CursorLock"       OpHelp(""),
    /* 162 */ "CursorUnlock"     OpHelp(""),
    /* 163 */ "TableLock"        OpHelp("iDb=P1 root=P2 write=P3"),
    /* 164 */ "VBegin"           OpHelp(""),
    /* 165 */ "VCreate"          OpHelp(""),
    /* 166 */ "VDestroy"         OpHelp(""),
    /* 167 */ "VOpen"            OpHelp(""),
    /* 168 */ "VColumn"          OpHelp("r[P3]=vcolumn(P2)"),
    /* 169 */ "VRename"          OpHelp(""),
    /* 170 */ "Pagecount"        OpHelp(""),
    /* 171 */ "MaxPgcnt"         OpHelp(""),
    /* 172 */ "Trace"            OpHelp(""),
    /* 173 */ "CursorHint"       OpHelp(""),
    /* 174 */ "ReleaseReg"       OpHelp("release r[P1@P2] mask P3"),
    /* 175 */ "Noop"             OpHelp(""),
    /* 176 */ "Explain"          OpHelp(""),
    /* 177 */ "Abortable"        OpHelp(""),
  };
  return azName[i];
}
#endif

/************** End of opcodes.c *********************************************/
/************** Begin file os_unix.c *****************************************/
64145
64146
64147
64148
64149
64150
64151

64152
64153
64154
64155
64156
64157
64158
#ifndef SQLITE_OMIT_SHARED_CACHE
  int nRef;             /* Number of references to this structure */
  BtShared *pNext;      /* Next on a list of sharable BtShared structs */
  BtLock *pLock;        /* List of locks held on this shared-btree struct */
  Btree *pWriter;       /* Btree with currently open write transaction */
#endif
  u8 *pTmpSpace;        /* Temp space sufficient to hold a single cell */

};

/*
** Allowed values for BtShared.btsFlags
*/
#define BTS_READ_ONLY        0x0001   /* Underlying file is readonly */
#define BTS_PAGESIZE_FIXED   0x0002   /* Page size can no longer be changed */







>







64210
64211
64212
64213
64214
64215
64216
64217
64218
64219
64220
64221
64222
64223
64224
#ifndef SQLITE_OMIT_SHARED_CACHE
  int nRef;             /* Number of references to this structure */
  BtShared *pNext;      /* Next on a list of sharable BtShared structs */
  BtLock *pLock;        /* List of locks held on this shared-btree struct */
  Btree *pWriter;       /* Btree with currently open write transaction */
#endif
  u8 *pTmpSpace;        /* Temp space sufficient to hold a single cell */
  int nPreformatSize;   /* Size of last cell written by TransferRow() */
};

/*
** Allowed values for BtShared.btsFlags
*/
#define BTS_READ_ONLY        0x0001   /* Underlying file is readonly */
#define BTS_PAGESIZE_FIXED   0x0002   /* Page size can no longer be changed */
65857
65858
65859
65860
65861
65862
65863


















65864
65865
65866
65867
65868
65869
65870
  if( surplus <= maxLocal ){
    pInfo->nLocal = (u16)surplus;
  }else{
    pInfo->nLocal = (u16)minLocal;
  }
  pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
}



















/*
** The following routines are implementations of the MemPage.xParseCell()
** method.
**
** Parse a cell content block and fill in the CellInfo structure.
**







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







65923
65924
65925
65926
65927
65928
65929
65930
65931
65932
65933
65934
65935
65936
65937
65938
65939
65940
65941
65942
65943
65944
65945
65946
65947
65948
65949
65950
65951
65952
65953
65954
  if( surplus <= maxLocal ){
    pInfo->nLocal = (u16)surplus;
  }else{
    pInfo->nLocal = (u16)minLocal;
  }
  pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
}

/*
** Given a record with nPayload bytes of payload stored within btree
** page pPage, return the number of bytes of payload stored locally.
*/
static int btreePayloadToLocal(MemPage *pPage, i64 nPayload){
  int maxLocal;  /* Maximum amount of payload held locally */
  maxLocal = pPage->maxLocal;
  if( nPayload<=maxLocal ){
    return nPayload;
  }else{
    int minLocal;  /* Minimum amount of payload held locally */
    int surplus;   /* Overflow payload available for local storage */
    minLocal = pPage->minLocal;
    surplus = minLocal + (nPayload - minLocal)%(pPage->pBt->usableSize-4);
    return ( surplus <= maxLocal ) ? surplus : minLocal;
  }
}

/*
** The following routines are implementations of the MemPage.xParseCell()
** method.
**
** Parse a cell content block and fill in the CellInfo structure.
**
73375
73376
73377
73378
73379
73380
73381
73382

73383
73384
73385
73386
73387
73388
73389
73390
73391
73392
73393
73394
73395
73396
73397
73398
73399
73400
73401
73402
73403
73404
73405
73406
73407
  int idx;
  MemPage *pPage;
  Btree *p = pCur->pBtree;
  BtShared *pBt = p->pBt;
  unsigned char *oldCell;
  unsigned char *newCell = 0;

  assert( (flags & (BTREE_SAVEPOSITION|BTREE_APPEND))==flags );


  if( pCur->eState==CURSOR_FAULT ){
    assert( pCur->skipNext!=SQLITE_OK );
    return pCur->skipNext;
  }

  assert( cursorOwnsBtShared(pCur) );
  assert( (pCur->curFlags & BTCF_WriteFlag)!=0
              && pBt->inTransaction==TRANS_WRITE
              && (pBt->btsFlags & BTS_READ_ONLY)==0 );
  assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );

  /* Assert that the caller has been consistent. If this cursor was opened
  ** expecting an index b-tree, then the caller should be inserting blob
  ** keys with no associated data. If the cursor was opened expecting an
  ** intkey table, the caller should be inserting integer keys with a
  ** blob of associated data.  */
  assert( (pX->pKey==0)==(pCur->pKeyInfo==0) );

  /* Save the positions of any other cursors open on this table.
  **
  ** In some cases, the call to btreeMoveto() below is a no-op. For
  ** example, when inserting data into a table with auto-generated integer
  ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the
  ** integer key to use. It then calls this function to actually insert the







|
>

















|







73459
73460
73461
73462
73463
73464
73465
73466
73467
73468
73469
73470
73471
73472
73473
73474
73475
73476
73477
73478
73479
73480
73481
73482
73483
73484
73485
73486
73487
73488
73489
73490
73491
73492
  int idx;
  MemPage *pPage;
  Btree *p = pCur->pBtree;
  BtShared *pBt = p->pBt;
  unsigned char *oldCell;
  unsigned char *newCell = 0;

  assert( (flags & (BTREE_SAVEPOSITION|BTREE_APPEND|BTREE_PREFORMAT))==flags );
  assert( (flags & BTREE_PREFORMAT)==0 || seekResult || pCur->pKeyInfo==0 );

  if( pCur->eState==CURSOR_FAULT ){
    assert( pCur->skipNext!=SQLITE_OK );
    return pCur->skipNext;
  }

  assert( cursorOwnsBtShared(pCur) );
  assert( (pCur->curFlags & BTCF_WriteFlag)!=0
              && pBt->inTransaction==TRANS_WRITE
              && (pBt->btsFlags & BTS_READ_ONLY)==0 );
  assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );

  /* Assert that the caller has been consistent. If this cursor was opened
  ** expecting an index b-tree, then the caller should be inserting blob
  ** keys with no associated data. If the cursor was opened expecting an
  ** intkey table, the caller should be inserting integer keys with a
  ** blob of associated data.  */
  assert( (flags & BTREE_PREFORMAT) || (pX->pKey==0)==(pCur->pKeyInfo==0) );

  /* Save the positions of any other cursors open on this table.
  **
  ** In some cases, the call to btreeMoveto() below is a no-op. For
  ** example, when inserting data into a table with auto-generated integer
  ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the
  ** integer key to use. It then calls this function to actually insert the
73503
73504
73505
73506
73507
73508
73509
73510
73511
73512
73513
73514
73515
73516
73517
73518
73519
73520
73521
73522
73523
73524
73525
73526













73527

73528
73529
73530
73531
73532
73533
73534

  }
  assert( pCur->eState==CURSOR_VALID
       || (pCur->eState==CURSOR_INVALID && loc)
       || CORRUPT_DB );

  pPage = pCur->pPage;
  assert( pPage->intKey || pX->nKey>=0 );
  assert( pPage->leaf || !pPage->intKey );
  if( pPage->nFree<0 ){
    if( pCur->eState>CURSOR_INVALID ){
      rc = SQLITE_CORRUPT_BKPT;
    }else{
      rc = btreeComputeFreeSpace(pPage);
    }
    if( rc ) return rc;
  }

  TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
          pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
          loc==0 ? "overwrite" : "new entry"));
  assert( pPage->isInit );
  newCell = pBt->pTmpSpace;
  assert( newCell!=0 );













  rc = fillInCell(pPage, newCell, pX, &szNew);

  if( rc ) goto end_insert;
  assert( szNew==pPage->xCellSize(pPage, newCell) );
  assert( szNew <= MX_CELL_SIZE(pBt) );
  idx = pCur->ix;
  if( loc==0 ){
    CellInfo info;
    assert( idx<pPage->nCell );







|
















>
>
>
>
>
>
>
>
>
>
>
>
>
|
>







73588
73589
73590
73591
73592
73593
73594
73595
73596
73597
73598
73599
73600
73601
73602
73603
73604
73605
73606
73607
73608
73609
73610
73611
73612
73613
73614
73615
73616
73617
73618
73619
73620
73621
73622
73623
73624
73625
73626
73627
73628
73629
73630
73631
73632
73633

  }
  assert( pCur->eState==CURSOR_VALID
       || (pCur->eState==CURSOR_INVALID && loc)
       || CORRUPT_DB );

  pPage = pCur->pPage;
  assert( pPage->intKey || pX->nKey>=0 || (flags & BTREE_PREFORMAT) );
  assert( pPage->leaf || !pPage->intKey );
  if( pPage->nFree<0 ){
    if( pCur->eState>CURSOR_INVALID ){
      rc = SQLITE_CORRUPT_BKPT;
    }else{
      rc = btreeComputeFreeSpace(pPage);
    }
    if( rc ) return rc;
  }

  TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
          pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
          loc==0 ? "overwrite" : "new entry"));
  assert( pPage->isInit );
  newCell = pBt->pTmpSpace;
  assert( newCell!=0 );
  if( flags & BTREE_PREFORMAT ){
    rc = SQLITE_OK;
    szNew = pBt->nPreformatSize;
    if( szNew<4 ) szNew = 4;
    if( ISAUTOVACUUM && szNew>pPage->maxLocal ){
      CellInfo info;
      pPage->xParseCell(pPage, newCell, &info);
      if( info.nPayload!=info.nLocal ){
        Pgno ovfl = get4byte(&newCell[szNew-4]);
        ptrmapPut(pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, &rc);
      }
    }
  }else{
    rc = fillInCell(pPage, newCell, pX, &szNew);
  }
  if( rc ) goto end_insert;
  assert( szNew==pPage->xCellSize(pPage, newCell) );
  assert( szNew <= MX_CELL_SIZE(pBt) );
  idx = pCur->ix;
  if( loc==0 ){
    CellInfo info;
    assert( idx<pPage->nCell );
73624
73625
73626
73627
73628
73629
73630






































































































73631
73632
73633
73634
73635
73636
73637
      pCur->eState = CURSOR_REQUIRESEEK;
      pCur->nKey = pX->nKey;
    }
  }
  assert( pCur->iPage<0 || pCur->pPage->nOverflow==0 );

end_insert:






































































































  return rc;
}

/*
** Delete the entry that the cursor is pointing to.
**
** If the BTREE_SAVEPOSITION bit of the flags parameter is zero, then







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







73723
73724
73725
73726
73727
73728
73729
73730
73731
73732
73733
73734
73735
73736
73737
73738
73739
73740
73741
73742
73743
73744
73745
73746
73747
73748
73749
73750
73751
73752
73753
73754
73755
73756
73757
73758
73759
73760
73761
73762
73763
73764
73765
73766
73767
73768
73769
73770
73771
73772
73773
73774
73775
73776
73777
73778
73779
73780
73781
73782
73783
73784
73785
73786
73787
73788
73789
73790
73791
73792
73793
73794
73795
73796
73797
73798
73799
73800
73801
73802
73803
73804
73805
73806
73807
73808
73809
73810
73811
73812
73813
73814
73815
73816
73817
73818
73819
73820
73821
73822
73823
73824
73825
73826
73827
73828
73829
73830
73831
73832
73833
73834
73835
73836
73837
73838
      pCur->eState = CURSOR_REQUIRESEEK;
      pCur->nKey = pX->nKey;
    }
  }
  assert( pCur->iPage<0 || pCur->pPage->nOverflow==0 );

end_insert:
  return rc;
}

/*
** This function is used as part of copying the current row from cursor
** pSrc into cursor pDest. If the cursors are open on intkey tables, then
** parameter iKey is used as the rowid value when the record is copied
** into pDest. Otherwise, the record is copied verbatim.
**
** This function does not actually write the new value to cursor pDest.
** Instead, it creates and populates any required overflow pages and
** writes the data for the new cell into the BtShared.pTmpSpace buffer
** for the destination database. The size of the cell, in bytes, is left
** in BtShared.nPreformatSize. The caller completes the insertion by
** calling sqlite3BtreeInsert() with the BTREE_PREFORMAT flag specified.
**
** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
*/
SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){
  int rc = SQLITE_OK;
  BtShared *pBt = pDest->pBt;
  u8 *aOut = pBt->pTmpSpace;    /* Pointer to next output buffer */
  const u8 *aIn;                /* Pointer to next input buffer */
  int nIn;                      /* Size of input buffer aIn[] */
  int nRem;                     /* Bytes of data still to copy */

  getCellInfo(pSrc);
  aOut += putVarint32(aOut, pSrc->info.nPayload);
  if( pDest->pKeyInfo==0 ) aOut += putVarint(aOut, iKey);
  nIn = pSrc->info.nLocal;
  aIn = pSrc->info.pPayload;
  nRem = pSrc->info.nPayload;
  if( nIn==nRem && nIn<pDest->pPage->maxLocal ){
    memcpy(aOut, aIn, nIn);
    pBt->nPreformatSize = nIn + (aOut - pBt->pTmpSpace);
  }else{
    Pager *pSrcPager = pSrc->pBt->pPager;
    u8 *pPgnoOut = 0;
    Pgno ovflIn = 0;
    DbPage *pPageIn = 0;
    MemPage *pPageOut = 0;
    int nOut;                     /* Size of output buffer aOut[] */

    nOut = btreePayloadToLocal(pDest->pPage, pSrc->info.nPayload);
    pBt->nPreformatSize = nOut + (aOut - pBt->pTmpSpace);
    if( nOut<pSrc->info.nPayload ){
      pPgnoOut = &aOut[nOut];
      pBt->nPreformatSize += 4;
    }

    if( nRem>nIn ){
      ovflIn = get4byte(&pSrc->info.pPayload[nIn]);
    }

    do {
      nRem -= nOut;
      do{
        assert( nOut>0 );
        if( nIn>0 ){
          int nCopy = MIN(nOut, nIn);
          memcpy(aOut, aIn, nCopy);
          nOut -= nCopy;
          nIn -= nCopy;
          aOut += nCopy;
          aIn += nCopy;
        }
        if( nOut>0 ){
          sqlite3PagerUnref(pPageIn);
          pPageIn = 0;
          rc = sqlite3PagerGet(pSrcPager, ovflIn, &pPageIn, PAGER_GET_READONLY);
          if( rc==SQLITE_OK ){
            aIn = (const u8*)sqlite3PagerGetData(pPageIn);
            ovflIn = get4byte(aIn);
            aIn += 4;
            nIn = pSrc->pBt->usableSize - 4;
          }
        }
      }while( rc==SQLITE_OK && nOut>0 );

      if( rc==SQLITE_OK && nRem>0 ){
        Pgno pgnoNew;
        MemPage *pNew = 0;
        rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
        put4byte(pPgnoOut, pgnoNew);
        if( ISAUTOVACUUM && pPageOut ){
          ptrmapPut(pBt, pgnoNew, PTRMAP_OVERFLOW2, pPageOut->pgno, &rc);
        }
        releasePage(pPageOut);
        pPageOut = pNew;
        if( pPageOut ){
          pPgnoOut = pPageOut->aData;
          put4byte(pPgnoOut, 0);
          aOut = &pPgnoOut[4];
          nOut = MIN(pBt->usableSize - 4, nRem);
        }
      }
    }while( nRem>0 && rc==SQLITE_OK );

    releasePage(pPageOut);
    sqlite3PagerUnref(pPageIn);
  }

  return rc;
}

/*
** Delete the entry that the cursor is pointing to.
**
** If the BTREE_SAVEPOSITION bit of the flags parameter is zero, then
90699
90700
90701
90702
90703
90704
90705
90706

90707
90708
90709
90710
90711
90712
90713
90714
90715
90716
90717
90718
90719
90720
90721

























90722
90723
90724
90725
90726
90727
90728
  if( pData->flags & MEM_Zero ){
    x.nZero = pData->u.nZero;
  }else{
    x.nZero = 0;
  }
  x.pKey = 0;
  rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
      (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION)), seekResult

  );
  pC->deferredMoveto = 0;
  pC->cacheStatus = CACHE_STALE;

  /* Invoke the update-hook if required. */
  if( rc ) goto abort_due_to_error;
  if( pTab ){
    assert( db->xUpdateCallback!=0 );
    assert( pTab->aCol!=0 );
    db->xUpdateCallback(db->pUpdateArg,
           (pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT,
           zDb, pTab->zName, x.nKey);
  }
  break;
}


























/* Opcode: Delete P1 P2 P3 P4 P5
**
** Delete the record at which the P1 cursor is currently pointing.
**
** If the OPFLAG_SAVEPOSITION bit of the P5 parameter is set, then
** the cursor will be left pointing at  either the next or the previous







|
>















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







90900
90901
90902
90903
90904
90905
90906
90907
90908
90909
90910
90911
90912
90913
90914
90915
90916
90917
90918
90919
90920
90921
90922
90923
90924
90925
90926
90927
90928
90929
90930
90931
90932
90933
90934
90935
90936
90937
90938
90939
90940
90941
90942
90943
90944
90945
90946
90947
90948
90949
90950
90951
90952
90953
90954
90955
  if( pData->flags & MEM_Zero ){
    x.nZero = pData->u.nZero;
  }else{
    x.nZero = 0;
  }
  x.pKey = 0;
  rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
      (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION|OPFLAG_PREFORMAT)),
      seekResult
  );
  pC->deferredMoveto = 0;
  pC->cacheStatus = CACHE_STALE;

  /* Invoke the update-hook if required. */
  if( rc ) goto abort_due_to_error;
  if( pTab ){
    assert( db->xUpdateCallback!=0 );
    assert( pTab->aCol!=0 );
    db->xUpdateCallback(db->pUpdateArg,
           (pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT,
           zDb, pTab->zName, x.nKey);
  }
  break;
}

/* Opcode: RowCell P1 P2 P3 * *
**
** P1 and P2 are both open cursors. Both must be opened on the same type
** of table - intkey or index. This opcode is used as part of copying
** the current row from P2 into P1. If the cursors are opened on intkey
** tables, register P3 contains the rowid to use with the new record in
** P1. If they are opened on index tables, P3 is not used.
**
** This opcode must be followed by either an Insert or InsertIdx opcode
** with the OPFLAG_PREFORMAT flag set to complete the insert operation.
*/
case OP_RowCell: {
  VdbeCursor *pDest;              /* Cursor to write to */
  VdbeCursor *pSrc;               /* Cursor to read from */
  i64 iKey;                       /* Rowid value to insert with */
  assert( pOp[1].opcode==OP_Insert || pOp[1].opcode==OP_IdxInsert );
  assert( pOp[1].p5 & OPFLAG_PREFORMAT );
  pDest = p->apCsr[pOp->p1];
  pSrc = p->apCsr[pOp->p2];
  iKey = pOp->p3 ? aMem[pOp->p3].u.i : 0;
  rc = sqlite3BtreeTransferRow(pDest->uc.pCursor, pSrc->uc.pCursor, iKey);
  if( rc!=SQLITE_OK ) goto abort_due_to_error;
  break;
};

/* Opcode: Delete P1 P2 P3 P4 P5
**
** Delete the record at which the P1 cursor is currently pointing.
**
** If the OPFLAG_SAVEPOSITION bit of the P5 parameter is set, then
** the cursor will be left pointing at  either the next or the previous
91371
91372
91373
91374
91375
91376
91377
91378
91379
91380
91381
91382
91383
91384
91385
91386
91387
91388
91389
91390
91391
91392
91393
91394
91395
91396

  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  pC = p->apCsr[pOp->p1];
  sqlite3VdbeIncrWriteCounter(p, pC);
  assert( pC!=0 );
  assert( !isSorter(pC) );
  pIn2 = &aMem[pOp->p2];
  assert( pIn2->flags & MEM_Blob );
  if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
  assert( pC->eCurType==CURTYPE_BTREE );
  assert( pC->isTable==0 );
  rc = ExpandBlob(pIn2);
  if( rc ) goto abort_due_to_error;
  x.nKey = pIn2->n;
  x.pKey = pIn2->z;
  x.aMem = aMem + pOp->p3;
  x.nMem = (u16)pOp->p4.i;
  rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
       (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION)),
      ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)
      );
  assert( pC->deferredMoveto==0 );
  pC->cacheStatus = CACHE_STALE;
  if( rc) goto abort_due_to_error;
  break;
}







|










|







91598
91599
91600
91601
91602
91603
91604
91605
91606
91607
91608
91609
91610
91611
91612
91613
91614
91615
91616
91617
91618
91619
91620
91621
91622
91623

  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  pC = p->apCsr[pOp->p1];
  sqlite3VdbeIncrWriteCounter(p, pC);
  assert( pC!=0 );
  assert( !isSorter(pC) );
  pIn2 = &aMem[pOp->p2];
  assert( (pIn2->flags & MEM_Blob) || (pOp->p5 & OPFLAG_PREFORMAT) );
  if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
  assert( pC->eCurType==CURTYPE_BTREE );
  assert( pC->isTable==0 );
  rc = ExpandBlob(pIn2);
  if( rc ) goto abort_due_to_error;
  x.nKey = pIn2->n;
  x.pKey = pIn2->z;
  x.aMem = aMem + pOp->p3;
  x.nMem = (u16)pOp->p4.i;
  rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
       (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION|OPFLAG_PREFORMAT)),
      ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)
      );
  assert( pC->deferredMoveto==0 );
  pC->cacheStatus = CACHE_STALE;
  if( rc) goto abort_due_to_error;
  break;
}
119439
119440
119441
119442
119443
119444
119445



























































































































































































119446
119447
119448
119449
119450
119451
119452
    if( zEscape[0]==aWc[1] ) return 0;
    aWc[3] = zEscape[0];
  }

  *pIsNocase = (pDef->funcFlags & SQLITE_FUNC_CASE)==0;
  return 1;
}




























































































































































































/*
** All of the FuncDef structures in the aBuiltinFunc[] array above
** to the global function hash table.  This occurs at start-time (as
** a consequence of calling sqlite3_initialize()).
**
** After this routine runs







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







119666
119667
119668
119669
119670
119671
119672
119673
119674
119675
119676
119677
119678
119679
119680
119681
119682
119683
119684
119685
119686
119687
119688
119689
119690
119691
119692
119693
119694
119695
119696
119697
119698
119699
119700
119701
119702
119703
119704
119705
119706
119707
119708
119709
119710
119711
119712
119713
119714
119715
119716
119717
119718
119719
119720
119721
119722
119723
119724
119725
119726
119727
119728
119729
119730
119731
119732
119733
119734
119735
119736
119737
119738
119739
119740
119741
119742
119743
119744
119745
119746
119747
119748
119749
119750
119751
119752
119753
119754
119755
119756
119757
119758
119759
119760
119761
119762
119763
119764
119765
119766
119767
119768
119769
119770
119771
119772
119773
119774
119775
119776
119777
119778
119779
119780
119781
119782
119783
119784
119785
119786
119787
119788
119789
119790
119791
119792
119793
119794
119795
119796
119797
119798
119799
119800
119801
119802
119803
119804
119805
119806
119807
119808
119809
119810
119811
119812
119813
119814
119815
119816
119817
119818
119819
119820
119821
119822
119823
119824
119825
119826
119827
119828
119829
119830
119831
119832
119833
119834
119835
119836
119837
119838
119839
119840
119841
119842
119843
119844
119845
119846
119847
119848
119849
119850
119851
119852
119853
119854
119855
119856
119857
119858
119859
119860
119861
119862
119863
119864
119865
119866
    if( zEscape[0]==aWc[1] ) return 0;
    aWc[3] = zEscape[0];
  }

  *pIsNocase = (pDef->funcFlags & SQLITE_FUNC_CASE)==0;
  return 1;
}

/* Mathematical Constants */
#ifndef M_PI
# define M_PI   3.141592653589793238462643383279502884
#endif
#ifndef M_LN10
# define M_LN10 2.302585092994045684017991454684364208
#endif
#ifndef M_LN2
# define M_LN2  0.693147180559945309417232121458176568
#endif


/* Extra math functions that require linking with -lm
*/
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
/*
** Implementation SQL functions:
**
**   ceil(X)
**   ceiling(X)
**   floor(X)
**
** The sqlite3_user_data() pointer is a pointer to the libm implementation
** of the underlying C function.
*/
static void ceilingFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  assert( argc==1 );
  switch( sqlite3_value_numeric_type(argv[0]) ){
    case SQLITE_INTEGER: {
       sqlite3_result_int64(context, sqlite3_value_int64(argv[0]));
       break;
    }
    case SQLITE_FLOAT: {
       double (*x)(double) = (double(*)(double))sqlite3_user_data(context);
       sqlite3_result_double(context, x(sqlite3_value_double(argv[0])));
       break;
    }
    default: {
       break;
    }
  }
}

/*
** Implementation of SQL functions:
**
**   ln(X)       - natural logarithm
**   log(X)      - log X base 10
**   log10(X)    - log X base 10
**   log(B,X)    - log X base B
*/
static void logFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  double x, b, ans;
  assert( argc==1 || argc==2 );
  switch( sqlite3_value_numeric_type(argv[0]) ){
    case SQLITE_INTEGER:
    case SQLITE_FLOAT:
      x = sqlite3_value_double(argv[0]);
      if( x<0.0 ) return;
      break;
    default:
      return;
  }
  if( argc==2 ){
    switch( sqlite3_value_numeric_type(argv[0]) ){
      case SQLITE_INTEGER:
      case SQLITE_FLOAT:
        b = x;
        x = sqlite3_value_double(argv[1]);
        if( x<0.0 ) return;
        break;
     default:
        return;
    }
    ans = log(x)/log(b);
  }else{
    ans = log(x);
    switch( SQLITE_PTR_TO_INT(sqlite3_user_data(context)) ){
      case 1:
        /* Convert from natural logarithm to log base 10 */
        ans *= 1.0/M_LN10;
        break;
      case 2:
        /* Convert from natural logarithm to log base 2 */
        ans *= 1.0/M_LN2;
        break;
      default:
        break;
    }
  }
  sqlite3_result_double(context, ans);
}

/*
** Functions to converts degrees to radians and radians to degrees.
*/
static double degToRad(double x){ return x*(M_PI/180.0); }
static double radToDeg(double x){ return x*(180.0/M_PI); }

/*
** Implementation of 1-argument SQL math functions:
**
**   exp(X)  - Compute e to the X-th power
*/
static void math1Func(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int type0;
  double v0, ans;
  double (*x)(double);
  assert( argc==1 );
  type0 = sqlite3_value_numeric_type(argv[0]);
  if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
  v0 = sqlite3_value_double(argv[0]);
  x = (double(*)(double))sqlite3_user_data(context);
  ans = x(v0);
  sqlite3_result_double(context, ans);
}

/*
** Implementation of 2-argument SQL math functions:
**
**   power(X,Y)  - Compute X to the Y-th power
*/
static void math2Func(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int type0, type1;
  double v0, v1, ans;
  double (*x)(double,double);
  assert( argc==2 );
  type0 = sqlite3_value_numeric_type(argv[0]);
  if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
  type1 = sqlite3_value_numeric_type(argv[1]);
  if( type1!=SQLITE_INTEGER && type1!=SQLITE_FLOAT ) return;
  v0 = sqlite3_value_double(argv[0]);
  v1 = sqlite3_value_double(argv[1]);
  x = (double(*)(double,double))sqlite3_user_data(context);
  ans = x(v0, v1);
  sqlite3_result_double(context, ans);
}

/*
** Implementation of 2-argument SQL math functions:
**
**   power(X,Y)  - Compute X to the Y-th power
*/
static void piFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  assert( argc==0 );
  sqlite3_result_double(context, M_PI);
}

#endif /* SQLITE_ENABLE_MATH_FUNCTIONS */

/*
** Implementation of sign(X) function.
*/
static void signFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int type0;
  double x;
  assert( argc==1 );
  type0 = sqlite3_value_numeric_type(argv[0]);
  if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
  x = sqlite3_value_double(argv[0]);
  sqlite3_result_int(context, x<0.0 ? -1 : x>0.0 ? +1 : 0);
}

/*
** All of the FuncDef structures in the aBuiltinFunc[] array above
** to the global function hash table.  This occurs at start-time (as
** a consequence of calling sqlite3_initialize()).
**
** After this routine runs
119558
119559
119560
119561
119562
119563
119564





































119565
119566
119567
119568
119569
119570
119571
    LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE),
#endif
#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
    FUNCTION(unknown,           -1, 0, 0, unknownFunc      ),
#endif
    FUNCTION(coalesce,           1, 0, 0, 0                ),
    FUNCTION(coalesce,           0, 0, 0, 0                ),





































    INLINE_FUNC(coalesce,       -1, INLINEFUNC_coalesce, 0 ),
    INLINE_FUNC(iif,             3, INLINEFUNC_iif,      0 ),
  };
#ifndef SQLITE_OMIT_ALTERTABLE
  sqlite3AlterFunctions();
#endif
  sqlite3WindowFunctions();







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







119972
119973
119974
119975
119976
119977
119978
119979
119980
119981
119982
119983
119984
119985
119986
119987
119988
119989
119990
119991
119992
119993
119994
119995
119996
119997
119998
119999
120000
120001
120002
120003
120004
120005
120006
120007
120008
120009
120010
120011
120012
120013
120014
120015
120016
120017
120018
120019
120020
120021
120022
    LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE),
#endif
#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
    FUNCTION(unknown,           -1, 0, 0, unknownFunc      ),
#endif
    FUNCTION(coalesce,           1, 0, 0, 0                ),
    FUNCTION(coalesce,           0, 0, 0, 0                ),
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
    MFUNCTION(ceil,              1, ceil,      ceilingFunc ),
    MFUNCTION(ceiling,           1, ceil,      ceilingFunc ),
    MFUNCTION(floor,             1, floor,     ceilingFunc ),
#if SQLITE_HAVE_C99_MATH_FUNCS
    MFUNCTION(trunc,             1, trunc,     ceilingFunc ),
#endif
    FUNCTION(ln,                 1, 0, 0,      logFunc     ),
    FUNCTION(log,                1, 1, 0,      logFunc     ),
    FUNCTION(log10,              1, 1, 0,      logFunc     ),
    FUNCTION(log2,               1, 2, 0,      logFunc     ),
    FUNCTION(log,                2, 0, 0,      logFunc     ),
    MFUNCTION(exp,               1, exp,       math1Func   ),
    MFUNCTION(pow,               2, pow,       math2Func   ),
    MFUNCTION(power,             2, pow,       math2Func   ),
    MFUNCTION(mod,               2, fmod,      math2Func   ),
    MFUNCTION(acos,              1, acos,      math1Func   ),
    MFUNCTION(asin,              1, asin,      math1Func   ),
    MFUNCTION(atan,              1, atan,      math1Func   ),
    MFUNCTION(atan2,             2, atan2,     math2Func   ),
    MFUNCTION(cos,               1, cos,       math1Func   ),
    MFUNCTION(sin,               1, sin,       math1Func   ),
    MFUNCTION(tan,               1, tan,       math1Func   ),
    MFUNCTION(cosh,              1, cosh,      math1Func   ),
    MFUNCTION(sinh,              1, sinh,      math1Func   ),
    MFUNCTION(tanh,              1, tanh,      math1Func   ),
#if SQLITE_HAVE_C99_MATH_FUNCS
    MFUNCTION(acosh,             1, acosh,     math1Func   ),
    MFUNCTION(asinh,             1, asinh,     math1Func   ),
    MFUNCTION(atanh,             1, atanh,     math1Func   ),
#endif
    MFUNCTION(sqrt,              1, sqrt,      math1Func   ),
    MFUNCTION(radians,           1, degToRad,  math1Func   ),
    MFUNCTION(degrees,           1, radToDeg,  math1Func   ),
    FUNCTION(pi,                 0, 0, 0,      piFunc      ),
#endif /* SQLITE_ENABLE_MATH_FUNCTIONS */
    FUNCTION(sign,               1, 0, 0,      signFunc    ),
    INLINE_FUNC(coalesce,       -1, INLINEFUNC_coalesce, 0 ),
    INLINE_FUNC(iif,             3, INLINEFUNC_iif,      0 ),
  };
#ifndef SQLITE_OMIT_ALTERTABLE
  sqlite3AlterFunctions();
#endif
  sqlite3WindowFunctions();
122016
122017
122018
122019
122020
122021
122022

122023
122024
122025
122026
122027
122028
122029
122030
122031
122032
122033
122034
122035


122036
122037
122038
122039
122040
122041
122042


122043
122044
122045
122046
122047
122048
122049
      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;
    }
    if( pTab->pSelect ){
      sqlite3ErrorMsg(pParse, "cannot UPSERT a view");
      goto insert_cleanup;
    }
    if( sqlite3HasExplicitNulls(pParse, pUpsert->pUpsertTarget) ){
      goto insert_cleanup;
    }
    pTabList->a[0].iCursor = iDataCur;


    pUpsert->pUpsertSrc = pTabList;
    pUpsert->regData = regData;
    pUpsert->iDataCur = iDataCur;
    pUpsert->iIdxCur = iIdxCur;
    if( pUpsert->pUpsertTarget ){
      sqlite3UpsertAnalyzeTarget(pParse, pTabList, pUpsert);
    }


  }
#endif


  /* This is the top of the main insertion loop */
  if( useTempTable ){
    /* This block codes the top of loop only.  The complete loop is the







>













>
>
|
|
|
|
|
|
|
>
>







122467
122468
122469
122470
122471
122472
122473
122474
122475
122476
122477
122478
122479
122480
122481
122482
122483
122484
122485
122486
122487
122488
122489
122490
122491
122492
122493
122494
122495
122496
122497
122498
122499
122500
122501
122502
122503
122504
122505
      aRegIdx[i] = ++pParse->nMem;
      pParse->nMem += pIdx->nColumn;
    }
    aRegIdx[i] = ++pParse->nMem;  /* Register to store the table record */
  }
#ifndef SQLITE_OMIT_UPSERT
  if( pUpsert ){
    Upsert *pNx;
    if( IsVirtual(pTab) ){
      sqlite3ErrorMsg(pParse, "UPSERT not implemented for virtual table \"%s\"",
              pTab->zName);
      goto insert_cleanup;
    }
    if( pTab->pSelect ){
      sqlite3ErrorMsg(pParse, "cannot UPSERT a view");
      goto insert_cleanup;
    }
    if( sqlite3HasExplicitNulls(pParse, pUpsert->pUpsertTarget) ){
      goto insert_cleanup;
    }
    pTabList->a[0].iCursor = iDataCur;
    pNx = pUpsert;
    do{
      pNx->pUpsertSrc = pTabList;
      pNx->regData = regData;
      pNx->iDataCur = iDataCur;
      pNx->iIdxCur = iIdxCur;
      if( pNx->pUpsertTarget ){
        sqlite3UpsertAnalyzeTarget(pParse, pTabList, pNx);
      }
      pNx = pNx->pNextUpsert;
    }while( pNx!=0 );
  }
#endif


  /* This is the top of the main insertion loop */
  if( useTempTable ){
    /* This block codes the top of loop only.  The complete loop is the
122439
122440
122441
122442
122443
122444
122445
































































122446
122447
122448
122449
122450
122451
122452
  }
  testcase( w.eCode==0 );
  testcase( w.eCode==CKCNSTRNT_COLUMN );
  testcase( w.eCode==CKCNSTRNT_ROWID );
  testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
  return w.eCode!=0;
}

































































/*
** Generate code to do constraint checks prior to an INSERT or an UPDATE
** on table pTab.
**
** The regNewData parameter is the first register in a range that contains
** the data to be inserted or the data after the update.  There will be







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







122895
122896
122897
122898
122899
122900
122901
122902
122903
122904
122905
122906
122907
122908
122909
122910
122911
122912
122913
122914
122915
122916
122917
122918
122919
122920
122921
122922
122923
122924
122925
122926
122927
122928
122929
122930
122931
122932
122933
122934
122935
122936
122937
122938
122939
122940
122941
122942
122943
122944
122945
122946
122947
122948
122949
122950
122951
122952
122953
122954
122955
122956
122957
122958
122959
122960
122961
122962
122963
122964
122965
122966
122967
122968
122969
122970
122971
122972
  }
  testcase( w.eCode==0 );
  testcase( w.eCode==CKCNSTRNT_COLUMN );
  testcase( w.eCode==CKCNSTRNT_ROWID );
  testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
  return w.eCode!=0;
}

/*
** The sqlite3GenerateConstraintChecks() routine usually wants to visit
** the indexes of a table in the order provided in the Table->pIndex list.
** However, sometimes (rarely - when there is an upsert) it wants to visit
** the indexes in a different order.  The following data structures accomplish
** this.
**
** The IndexIterator object is used to walk through all of the indexes
** of a table in either Index.pNext order, or in some other order established
** by an array of IndexListTerm objects.
*/
typedef struct IndexListTerm IndexListTerm;
typedef struct IndexIterator IndexIterator;
struct IndexIterator {
  int eType;    /* 0 for Index.pNext list.  1 for an array of IndexListTerm */
  int i;        /* Index of the current item from the list */
  union {
    struct {    /* Use this object for eType==0: A Index.pNext list */
      Index *pIdx;   /* The current Index */
    } lx;
    struct {    /* Use this object for eType==1; Array of IndexListTerm */
      int nIdx;               /* Size of the array */
      IndexListTerm *aIdx;    /* Array of IndexListTerms */
    } ax;
  } u;
};

/* When IndexIterator.eType==1, then each index is an array of instances
** of the following object
*/
struct IndexListTerm {
  Index *p;  /* The index */
  int ix;    /* Which entry in the original Table.pIndex list is this index*/
};

/* Return the first index on the list */
static Index *indexIteratorFirst(IndexIterator *pIter, int *pIx){
  assert( pIter->i==0 );
  if( pIter->eType ){
    *pIx = pIter->u.ax.aIdx[0].ix;
    return pIter->u.ax.aIdx[0].p;
  }else{
    *pIx = 0;
    return pIter->u.lx.pIdx;
  }
}

/* Return the next index from the list.  Return NULL when out of indexes */
static Index *indexIteratorNext(IndexIterator *pIter, int *pIx){
  if( pIter->eType ){
    int i = ++pIter->i;
    if( i>=pIter->u.ax.nIdx ){
      *pIx = i;
      return 0;
    }
    *pIx = pIter->u.ax.aIdx[i].ix;
    return pIter->u.ax.aIdx[i].p;
  }else{
    ++(*pIx);
    pIter->u.lx.pIdx = pIter->u.lx.pIdx->pNext;
    return pIter->u.lx.pIdx;
  }
}

/*
** Generate code to do constraint checks prior to an INSERT or an UPDATE
** on table pTab.
**
** The regNewData parameter is the first register in a range that contains
** the data to be inserted or the data after the update.  There will be
122548
122549
122550
122551
122552
122553
122554
122555
122556
122557
122558
122559
122560
122561
122562
122563
122564
122565
122566
122567
122568
122569
122570
122571
122572
122573
122574
122575
122576

122577
122578
122579
122580
122581
122582
122583
  int ignoreDest,      /* Jump to this label on an OE_Ignore resolution */
  int *pbMayReplace,   /* OUT: Set to true if constraint may cause a replace */
  int *aiChng,         /* column i is unchanged if aiChng[i]<0 */
  Upsert *pUpsert      /* ON CONFLICT clauses, if any.  NULL otherwise */
){
  Vdbe *v;             /* VDBE under constrution */
  Index *pIdx;         /* Pointer to one of the indices */
  Index *pPk = 0;      /* The PRIMARY KEY index */
  sqlite3 *db;         /* Database connection */
  int i;               /* loop counter */
  int ix;              /* Index loop counter */
  int nCol;            /* Number of columns */
  int onError;         /* Conflict resolution strategy */
  int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
  int nPkField;        /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
  Index *pUpIdx = 0;   /* Index to which to apply the upsert */
  u8 isUpdate;         /* True if this is an UPDATE operation */
  u8 bAffinityDone = 0;  /* True if the OP_Affinity operation has been run */
  int upsertBypass = 0;  /* Address of Goto to bypass upsert subroutine */
  int upsertJump = 0;    /* Address of Goto that jumps into upsert subroutine */
  int ipkTop = 0;        /* Top of the IPK uniqueness check */
  int ipkBottom = 0;     /* OP_Goto at the end of the IPK uniqueness check */
  /* Variables associated with retesting uniqueness constraints after
  ** replace triggers fire have run */
  int regTrigCnt;       /* Register used to count replace trigger invocations */
  int addrRecheck = 0;  /* Jump here to recheck all uniqueness constraints */
  int lblRecheckOk = 0; /* Each recheck jumps to this label if it passes */
  Trigger *pTrigger;    /* List of DELETE triggers on the table pTab */
  int nReplaceTrig = 0; /* Number of replace triggers coded */


  isUpdate = regOldData!=0;
  db = pParse->db;
  v = pParse->pVdbe;
  assert( v!=0 );
  assert( pTab->pSelect==0 );  /* This table is not a VIEW */
  nCol = pTab->nCol;







|







|
|

|
|









>







123068
123069
123070
123071
123072
123073
123074
123075
123076
123077
123078
123079
123080
123081
123082
123083
123084
123085
123086
123087
123088
123089
123090
123091
123092
123093
123094
123095
123096
123097
123098
123099
123100
123101
123102
123103
123104
  int ignoreDest,      /* Jump to this label on an OE_Ignore resolution */
  int *pbMayReplace,   /* OUT: Set to true if constraint may cause a replace */
  int *aiChng,         /* column i is unchanged if aiChng[i]<0 */
  Upsert *pUpsert      /* ON CONFLICT clauses, if any.  NULL otherwise */
){
  Vdbe *v;             /* VDBE under constrution */
  Index *pIdx;         /* Pointer to one of the indices */
  Index *pPk = 0;      /* The PRIMARY KEY index for WITHOUT ROWID tables */
  sqlite3 *db;         /* Database connection */
  int i;               /* loop counter */
  int ix;              /* Index loop counter */
  int nCol;            /* Number of columns */
  int onError;         /* Conflict resolution strategy */
  int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
  int nPkField;        /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
  Upsert *pUpsertClause = 0;  /* The specific ON CONFLICT clause for pIdx */
  u8 isUpdate;           /* True if this is an UPDATE operation */
  u8 bAffinityDone = 0;  /* True if the OP_Affinity operation has been run */
  int upsertIpkReturn = 0; /* Address of Goto at end of IPK uniqueness check */
  int upsertIpkDelay = 0;  /* Address of Goto to bypass initial IPK check */
  int ipkTop = 0;        /* Top of the IPK uniqueness check */
  int ipkBottom = 0;     /* OP_Goto at the end of the IPK uniqueness check */
  /* Variables associated with retesting uniqueness constraints after
  ** replace triggers fire have run */
  int regTrigCnt;       /* Register used to count replace trigger invocations */
  int addrRecheck = 0;  /* Jump here to recheck all uniqueness constraints */
  int lblRecheckOk = 0; /* Each recheck jumps to this label if it passes */
  Trigger *pTrigger;    /* List of DELETE triggers on the table pTab */
  int nReplaceTrig = 0; /* Number of replace triggers coded */
  IndexIterator sIdxIter;  /* Index iterator */

  isUpdate = regOldData!=0;
  db = pParse->db;
  v = pParse->pVdbe;
  assert( v!=0 );
  assert( pTab->pSelect==0 );  /* This table is not a VIEW */
  nCol = pTab->nCol;
122767
122768
122769
122770
122771
122772
122773
122774



122775
122776



122777
122778
122779
122780
122781




122782

122783
122784










122785
122786

























122787
122788
122789
122790
122791
122792
122793
  **        default conflict resolution strategy
  **   (C)  Unique index that do use OE_Replace by default.
  **
  ** The ordering of (2) and (3) is accomplished by making sure the linked
  ** list of indexes attached to a table puts all OE_Replace indexes last
  ** in the list.  See sqlite3CreateIndex() for where that happens.
  */




  if( pUpsert ){
    if( pUpsert->pUpsertTarget==0 ){



      /* An ON CONFLICT DO NOTHING clause, without a constraint-target.
      ** Make all unique constraint resolution be OE_Ignore */
      assert( pUpsert->pUpsertSet==0 );
      overrideError = OE_Ignore;
      pUpsert = 0;




    }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){

      /* If the constraint-target uniqueness check must be run first.
      ** Jump to that uniqueness check now */










      upsertJump = sqlite3VdbeAddOp0(v, OP_Goto);
      VdbeComment((v, "UPSERT constraint goes first"));

























    }
  }

  /* Determine if it is possible that triggers (either explicitly coded
  ** triggers or FK resolution actions) might run as a result of deletes
  ** that happen when OE_Replace conflict resolution occurs. (Call these
  ** "replace triggers".)  If any replace triggers run, we will need to







|
>
>
>


>
>
>
|
|
<
|
|
>
>
>
>
|
>
|
|
>
>
>
>
>
>
>
>
>
>
|
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







123288
123289
123290
123291
123292
123293
123294
123295
123296
123297
123298
123299
123300
123301
123302
123303
123304
123305

123306
123307
123308
123309
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
123346
123347
123348
123349
123350
123351
123352
123353
123354
123355
123356
123357
123358
  **        default conflict resolution strategy
  **   (C)  Unique index that do use OE_Replace by default.
  **
  ** The ordering of (2) and (3) is accomplished by making sure the linked
  ** list of indexes attached to a table puts all OE_Replace indexes last
  ** in the list.  See sqlite3CreateIndex() for where that happens.
  */
  sIdxIter.eType = 0;
  sIdxIter.i = 0;
  sIdxIter.u.ax.aIdx = 0;  /* Silence harmless compiler warning */
  sIdxIter.u.lx.pIdx = pTab->pIndex;
  if( pUpsert ){
    if( pUpsert->pUpsertTarget==0 ){
      /* There is just on ON CONFLICT clause and it has no constraint-target */
      assert( pUpsert->pNextUpsert==0 );
      if( pUpsert->isDoUpdate==0 ){
        /* A single ON CONFLICT DO NOTHING clause, without a constraint-target.
        ** Make all unique constraint resolution be OE_Ignore */

        overrideError = OE_Ignore;
        pUpsert = 0;
      }else{
        /* A single ON CONFLICT DO UPDATE.  Make all resolutions OE_Update */
        overrideError = OE_Update;
      }
    }else if( pTab->pIndex!=0 ){
      /* Otherwise, we'll need to run the IndexListTerm array version of the
      ** iterator to ensure that all of the ON CONFLICT conditions are
      ** checked first and in order. */
      int nIdx, jj;
      u64 nByte;
      Upsert *pTerm;
      u8 *bUsed;
      for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
         assert( aRegIdx[nIdx]>0 );
      }
      sIdxIter.eType = 1;
      sIdxIter.u.ax.nIdx = nIdx;
      nByte = (sizeof(IndexListTerm)+1)*nIdx + nIdx;
      sIdxIter.u.ax.aIdx = sqlite3DbMallocZero(db, nByte);

      if( sIdxIter.u.ax.aIdx==0 ) return; /* OOM */
      bUsed = (u8*)&sIdxIter.u.ax.aIdx[nIdx];
      pUpsert->pToFree = sIdxIter.u.ax.aIdx;
      for(i=0, pTerm=pUpsert; pTerm; pTerm=pTerm->pNextUpsert){
        if( pTerm->pUpsertTarget==0 ) break;
        if( pTerm->pUpsertIdx==0 ) continue;  /* Skip ON CONFLICT for the IPK */
        jj = 0;
        pIdx = pTab->pIndex;
        while( ALWAYS(pIdx!=0) && pIdx!=pTerm->pUpsertIdx ){
           pIdx = pIdx->pNext;
           jj++;
        }
        if( bUsed[jj] ) continue; /* Duplicate ON CONFLICT clause ignored */
        bUsed[jj] = 1;
        sIdxIter.u.ax.aIdx[i].p = pIdx;
        sIdxIter.u.ax.aIdx[i].ix = jj;
        i++;
      }
      for(jj=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, jj++){
        if( bUsed[jj] ) continue;
        sIdxIter.u.ax.aIdx[i].p = pIdx;
        sIdxIter.u.ax.aIdx[i].ix = jj;
        i++;
      }
      assert( i==nIdx );
    }
  }

  /* Determine if it is possible that triggers (either explicitly coded
  ** triggers or FK resolution actions) might run as a result of deletes
  ** that happen when OE_Replace conflict resolution occurs. (Call these
  ** "replace triggers".)  If any replace triggers run, we will need to
122842
122843
122844
122845
122846
122847
122848
122849

122850

122851
122852
122853







122854
122855
122856
122857
122858
122859
122860
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }

    /* figure out whether or not upsert applies in this case */
    if( pUpsert && pUpsert->pUpsertIdx==0 ){

      if( pUpsert->pUpsertSet==0 ){

        onError = OE_Ignore;  /* DO NOTHING is the same as INSERT OR IGNORE */
      }else{
        onError = OE_Update;  /* DO UPDATE */







      }
    }

    /* If the response to a rowid conflict is REPLACE but the response
    ** to some other UNIQUE constraint is FAIL or IGNORE, then we need
    ** to defer the running of the rowid conflict checking until after
    ** the UNIQUE constraints have run.







|
>
|
>
|
|
|
>
>
>
>
>
>
>







123407
123408
123409
123410
123411
123412
123413
123414
123415
123416
123417
123418
123419
123420
123421
123422
123423
123424
123425
123426
123427
123428
123429
123430
123431
123432
123433
123434
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }

    /* figure out whether or not upsert applies in this case */
    if( pUpsert ){
      pUpsertClause = sqlite3UpsertOfIndex(pUpsert,0);
      if( pUpsertClause!=0 ){
        if( pUpsertClause->isDoUpdate==0 ){
          onError = OE_Ignore;  /* DO NOTHING is the same as INSERT OR IGNORE */
        }else{
          onError = OE_Update;  /* DO UPDATE */
        }
      }
      if( pUpsertClause!=pUpsert ){
        /* The first ON CONFLICT clause has a conflict target other than
        ** the IPK.  We have to jump ahead to that first ON CONFLICT clause
        ** and then come back here and deal with the IPK afterwards */
        upsertIpkDelay = sqlite3VdbeAddOp0(v, OP_Goto);
      }
    }

    /* If the response to a rowid conflict is REPLACE but the response
    ** to some other UNIQUE constraint is FAIL or IGNORE, then we need
    ** to defer the running of the rowid conflict checking until after
    ** the UNIQUE constraints have run.
122953
122954
122955
122956
122957
122958
122959


122960
122961
122962
122963
122964
122965
122966
122967
122968
122969
122970
122971
122972

122973


122974
122975
122976
122977
122978
122979
122980
122981
122982
122983
122984
122985
122986
122987
122988


122989
122990
122991
122992
122993
122994
122995
122996
      case OE_Ignore: {
        testcase( onError==OE_Ignore );
        sqlite3VdbeGoto(v, ignoreDest);
        break;
      }
    }
    sqlite3VdbeResolveLabel(v, addrRowidOk);


    if( ipkTop ){
      ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);
      sqlite3VdbeJumpHere(v, ipkTop-1);
    }
  }

  /* Test all UNIQUE constraints by creating entries for each UNIQUE
  ** index and making sure that duplicate entries do not already exist.
  ** Compute the revised record entries for indices as we go.
  **
  ** This loop also handles the case of the PRIMARY KEY index for a
  ** WITHOUT ROWID table.
  */

  for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){


    int regIdx;          /* Range of registers hold conent for pIdx */
    int regR;            /* Range of registers holding conflicting PK */
    int iThisCur;        /* Cursor for this UNIQUE index */
    int addrUniqueOk;    /* Jump here if the UNIQUE constraint is satisfied */
    int addrConflictCk;  /* First opcode in the conflict check logic */

    if( aRegIdx[ix]==0 ) continue;  /* Skip indices that do not change */
    if( pUpIdx==pIdx ){
      addrUniqueOk = upsertJump+1;
      upsertBypass = sqlite3VdbeGoto(v, 0);
      VdbeComment((v, "Skip upsert subroutine"));
      sqlite3VdbeJumpHere(v, upsertJump);
    }else{
      addrUniqueOk = sqlite3VdbeMakeLabel(pParse);
    }


    if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){
      sqlite3TableAffinity(v, pTab, regNewData+1);
      bAffinityDone = 1;
    }
    VdbeNoopComment((v, "prep index %s", pIdx->zName));
    iThisCur = iIdxCur+ix;









>
>
|












>
|
>
>







|
<
|
|
|
<
<
|
>
>
|







123527
123528
123529
123530
123531
123532
123533
123534
123535
123536
123537
123538
123539
123540
123541
123542
123543
123544
123545
123546
123547
123548
123549
123550
123551
123552
123553
123554
123555
123556
123557
123558
123559
123560

123561
123562
123563


123564
123565
123566
123567
123568
123569
123570
123571
123572
123573
123574
      case OE_Ignore: {
        testcase( onError==OE_Ignore );
        sqlite3VdbeGoto(v, ignoreDest);
        break;
      }
    }
    sqlite3VdbeResolveLabel(v, addrRowidOk);
    if( pUpsert && pUpsertClause!=pUpsert ){
      upsertIpkReturn = sqlite3VdbeAddOp0(v, OP_Goto);
    }else if( ipkTop ){
      ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);
      sqlite3VdbeJumpHere(v, ipkTop-1);
    }
  }

  /* Test all UNIQUE constraints by creating entries for each UNIQUE
  ** index and making sure that duplicate entries do not already exist.
  ** Compute the revised record entries for indices as we go.
  **
  ** This loop also handles the case of the PRIMARY KEY index for a
  ** WITHOUT ROWID table.
  */
  for(pIdx = indexIteratorFirst(&sIdxIter, &ix);
      pIdx;
      pIdx = indexIteratorNext(&sIdxIter, &ix)
  ){
    int regIdx;          /* Range of registers hold conent for pIdx */
    int regR;            /* Range of registers holding conflicting PK */
    int iThisCur;        /* Cursor for this UNIQUE index */
    int addrUniqueOk;    /* Jump here if the UNIQUE constraint is satisfied */
    int addrConflictCk;  /* First opcode in the conflict check logic */

    if( aRegIdx[ix]==0 ) continue;  /* Skip indices that do not change */
    if( pUpsert ){

      pUpsertClause = sqlite3UpsertOfIndex(pUpsert, pIdx);
      if( upsertIpkDelay && pUpsertClause==pUpsert ){
        sqlite3VdbeJumpHere(v, upsertIpkDelay);


      }
    }
    addrUniqueOk = sqlite3VdbeMakeLabel(pParse);
    if( bAffinityDone==0 ){
      sqlite3TableAffinity(v, pTab, regNewData+1);
      bAffinityDone = 1;
    }
    VdbeNoopComment((v, "prep index %s", pIdx->zName));
    iThisCur = iIdxCur+ix;


123053
123054
123055
123056
123057
123058
123059
123060
123061
123062
123063
123064
123065
123066
123067
123068
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }

    /* Figure out if the upsert clause applies to this index */
    if( pUpIdx==pIdx ){
      if( pUpsert->pUpsertSet==0 ){
        onError = OE_Ignore;  /* DO NOTHING is the same as INSERT OR IGNORE */
      }else{
        onError = OE_Update;  /* DO UPDATE */
      }
    }

    /* Collision detection may be omitted if all of the following are true:







|
|







123631
123632
123633
123634
123635
123636
123637
123638
123639
123640
123641
123642
123643
123644
123645
123646
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }

    /* Figure out if the upsert clause applies to this index */
    if( pUpsertClause ){
      if( pUpsertClause->isDoUpdate==0 ){
        onError = OE_Ignore;  /* DO NOTHING is the same as INSERT OR IGNORE */
      }else{
        onError = OE_Update;  /* DO UPDATE */
      }
    }

    /* Collision detection may be omitted if all of the following are true:
123092
123093
123094
123095
123096
123097
123098
123099
123100
123101
123102
123103
123104
123105
123106
    /* Check to see if the new index entry will be unique */
    sqlite3VdbeVerifyAbortable(v, onError);
    addrConflictCk =
      sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
                           regIdx, pIdx->nKeyCol); VdbeCoverage(v);

    /* Generate code to handle collisions */
    regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField);
    if( isUpdate || onError==OE_Replace ){
      if( HasRowid(pTab) ){
        sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
        /* Conflict only if the rowid of the existing index entry
        ** is different from old-rowid */
        if( isUpdate ){
          sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData);







|







123670
123671
123672
123673
123674
123675
123676
123677
123678
123679
123680
123681
123682
123683
123684
    /* Check to see if the new index entry will be unique */
    sqlite3VdbeVerifyAbortable(v, onError);
    addrConflictCk =
      sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
                           regIdx, pIdx->nKeyCol); VdbeCoverage(v);

    /* Generate code to handle collisions */
    regR = pIdx==pPk ? regIdx : sqlite3GetTempRange(pParse, nPkField);
    if( isUpdate || onError==OE_Replace ){
      if( HasRowid(pTab) ){
        sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
        /* Conflict only if the rowid of the existing index entry
        ** is different from old-rowid */
        if( isUpdate ){
          sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData);
123244
123245
123246
123247
123248
123249
123250


123251



123252
123253
123254
123255
123256
123257
123258
123259
123260
123261
123262
123263
123264

          sqlite3VdbeJumpHere(v, addrBypass); /* Terminate the recheck bypass */
        }
        seenReplace = 1;
        break;
      }
    }


    if( pUpIdx==pIdx ){



      sqlite3VdbeGoto(v, upsertJump+1);
      sqlite3VdbeJumpHere(v, upsertBypass);
    }else{
      sqlite3VdbeResolveLabel(v, addrUniqueOk);
    }
    if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
  }

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







>
>
|
>
>
>
|
|
|
<

<







123822
123823
123824
123825
123826
123827
123828
123829
123830
123831
123832
123833
123834
123835
123836
123837

123838

123839
123840
123841
123842
123843
123844
123845

          sqlite3VdbeJumpHere(v, addrBypass); /* Terminate the recheck bypass */
        }
        seenReplace = 1;
        break;
      }
    }
    sqlite3VdbeResolveLabel(v, addrUniqueOk);
    if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
    if( pUpsertClause
     && upsertIpkReturn
     && sqlite3UpsertNextIsIPK(pUpsertClause)
    ){
      sqlite3VdbeGoto(v, upsertIpkDelay+1);
      sqlite3VdbeJumpHere(v, upsertIpkReturn);
      upsertIpkReturn = 0;

    }

  }

  /* If the IPK constraint is a REPLACE, run it last */
  if( ipkTop ){
    sqlite3VdbeGoto(v, ipkTop);
    VdbeComment((v, "Do IPK REPLACE"));
    sqlite3VdbeJumpHere(v, ipkBottom);
123789
123790
123791
123792
123793
123794
123795

123796
123797
123798
123799
123800
123801
123802
  iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
  v = sqlite3GetVdbe(pParse);
  sqlite3CodeVerifySchema(pParse, iDbSrc);
  iSrc = pParse->nTab++;
  iDest = pParse->nTab++;
  regAutoinc = autoIncBegin(pParse, iDbDest, pDest);
  regData = sqlite3GetTempReg(pParse);

  regRowid = sqlite3GetTempReg(pParse);
  sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);
  assert( HasRowid(pDest) || destHasUniqueIdx );
  if( (db->mDbFlags & DBFLAG_Vacuum)==0 && (
      (pDest->iPKey<0 && pDest->pIndex!=0)          /* (1) */
   || destHasUniqueIdx                              /* (2) */
   || (onError!=OE_Abort && onError!=OE_Rollback)   /* (3) */







>







124370
124371
124372
124373
124374
124375
124376
124377
124378
124379
124380
124381
124382
124383
124384
  iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
  v = sqlite3GetVdbe(pParse);
  sqlite3CodeVerifySchema(pParse, iDbSrc);
  iSrc = pParse->nTab++;
  iDest = pParse->nTab++;
  regAutoinc = autoIncBegin(pParse, iDbDest, pDest);
  regData = sqlite3GetTempReg(pParse);
  sqlite3VdbeAddOp2(v, OP_Null, 0, regData);
  regRowid = sqlite3GetTempReg(pParse);
  sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);
  assert( HasRowid(pDest) || destHasUniqueIdx );
  if( (db->mDbFlags & DBFLAG_Vacuum)==0 && (
      (pDest->iPKey<0 && pDest->pIndex!=0)          /* (1) */
   || destHasUniqueIdx                              /* (2) */
   || (onError!=OE_Abort && onError!=OE_Rollback)   /* (3) */
123824
123825
123826
123827
123828
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
  }
  if( HasRowid(pSrc) ){
    u8 insFlags;
    sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
    emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);
    if( pDest->iPKey>=0 ){
      addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);

      sqlite3VdbeVerifyAbortable(v, onError);
      addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
      VdbeCoverage(v);
      sqlite3RowidConstraint(pParse, onError, pDest);
      sqlite3VdbeJumpHere(v, addr2);

      autoIncStep(pParse, regAutoinc, regRowid);
    }else if( pDest->pIndex==0 && !(db->mDbFlags & DBFLAG_VacuumInto) ){
      addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
    }else{
      addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
      assert( (pDest->tabFlags & TF_Autoincrement)==0 );
    }

    if( db->mDbFlags & DBFLAG_Vacuum ){
      sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
      insFlags = OPFLAG_APPEND|OPFLAG_USESEEKRESULT;
    }else{
      insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND;
    }


    sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);






    sqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid,
                      (char*)pDest, P4_TABLE);
    sqlite3VdbeChangeP5(v, insFlags);

    sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v);
    sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
  }else{
    sqlite3TableLock(pParse, iDbDest, pDest->tnum, 1, pDest->zName);
    sqlite3TableLock(pParse, iDbSrc, pSrc->tnum, 0, pSrc->zName);
  }







>
|
|
|
|
|
>







>


|

|

>
>
|
>
>
>
>
>
>

|

>







124406
124407
124408
124409
124410
124411
124412
124413
124414
124415
124416
124417
124418
124419
124420
124421
124422
124423
124424
124425
124426
124427
124428
124429
124430
124431
124432
124433
124434
124435
124436
124437
124438
124439
124440
124441
124442
124443
124444
124445
124446
124447
124448
124449
124450
124451
124452
124453
  }
  if( HasRowid(pSrc) ){
    u8 insFlags;
    sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
    emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);
    if( pDest->iPKey>=0 ){
      addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
      if( (db->mDbFlags & DBFLAG_Vacuum)==0 ){
        sqlite3VdbeVerifyAbortable(v, onError);
        addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
        VdbeCoverage(v);
        sqlite3RowidConstraint(pParse, onError, pDest);
        sqlite3VdbeJumpHere(v, addr2);
      }
      autoIncStep(pParse, regAutoinc, regRowid);
    }else if( pDest->pIndex==0 && !(db->mDbFlags & DBFLAG_VacuumInto) ){
      addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
    }else{
      addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
      assert( (pDest->tabFlags & TF_Autoincrement)==0 );
    }

    if( db->mDbFlags & DBFLAG_Vacuum ){
      sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
      insFlags = OPFLAG_APPEND|OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT;
    }else{
      insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND|OPFLAG_PREFORMAT;
    }
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
    if( db->xPreUpdateCallback ){
      sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
      insFlags &= ~OPFLAG_PREFORMAT;
    }else
#endif
    {
      sqlite3VdbeAddOp3(v, OP_RowCell, iDest, iSrc, regRowid);
    }
    sqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid,
        (char*)pDest, P4_TABLE);
    sqlite3VdbeChangeP5(v, insFlags);

    sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v);
    sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
  }else{
    sqlite3TableLock(pParse, iDbDest, pDest->tnum, 1, pDest->zName);
    sqlite3TableLock(pParse, iDbSrc, pSrc->tnum, 0, pSrc->zName);
  }
123887
123888
123889
123890
123891
123892
123893
123894
123895

123896
123897
123898
123899

123900

123901
123902
123903
123904
123905
123906
123907
      ** a VACUUM command. In that case keys may not be written in strictly
      ** sorted order.  */
      for(i=0; i<pSrcIdx->nColumn; i++){
        const char *zColl = pSrcIdx->azColl[i];
        if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
      }
      if( i==pSrcIdx->nColumn ){
        idxInsFlags = OPFLAG_USESEEKRESULT;
        sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);

      }
    }else if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
      idxInsFlags |= OPFLAG_NCHANGE;
    }

    sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);

    sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
    sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
    sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
    sqlite3VdbeJumpHere(v, addr1);
    sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
  }







|

>




>
|
>







124481
124482
124483
124484
124485
124486
124487
124488
124489
124490
124491
124492
124493
124494
124495
124496
124497
124498
124499
124500
124501
124502
124503
124504
      ** a VACUUM command. In that case keys may not be written in strictly
      ** sorted order.  */
      for(i=0; i<pSrcIdx->nColumn; i++){
        const char *zColl = pSrcIdx->azColl[i];
        if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
      }
      if( i==pSrcIdx->nColumn ){
        idxInsFlags = OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT;
        sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
        sqlite3VdbeAddOp3(v, OP_RowCell, iDest, iSrc, regData);
      }
    }else if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
      idxInsFlags |= OPFLAG_NCHANGE;
    }
    if( idxInsFlags!=(OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT) ){
      sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
    }
    sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
    sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
    sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
    sqlite3VdbeJumpHere(v, addr1);
    sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
  }
134007
134008
134009
134010
134011
134012
134013
134014
134015
134016
134017
134018
134019
134020
134021
  ** success.
  */
  sqlite3AggInfoPersistWalkerInit(&w, pParse);
  sqlite3WalkSelect(&w,pSub1);
  sqlite3SelectDelete(db, pSub1);

#if SELECTTRACE_ENABLED
  if( sqlite3_unsupported_selecttrace & 0x100 ){
    SELECTTRACE(0x100,pParse,p,("After flattening:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif

  return 1;
}







|







134604
134605
134606
134607
134608
134609
134610
134611
134612
134613
134614
134615
134616
134617
134618
  ** success.
  */
  sqlite3AggInfoPersistWalkerInit(&w, pParse);
  sqlite3WalkSelect(&w,pSub1);
  sqlite3SelectDelete(db, pSub1);

#if SELECTTRACE_ENABLED
  if( sqlite3SelectTrace & 0x100 ){
    SELECTTRACE(0x100,pParse,p,("After flattening:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif

  return 1;
}
135451
135452
135453
135454
135455
135456
135457
135458
135459
135460
135461
135462
135463
135464
135465
  Walker sWalker;
  memset(&sWalker, 0, sizeof(sWalker));
  sWalker.pParse = pParse;
  sWalker.xExprCallback = havingToWhereExprCb;
  sWalker.u.pSelect = p;
  sqlite3WalkExpr(&sWalker, p->pHaving);
#if SELECTTRACE_ENABLED
  if( sWalker.eCode && (sqlite3_unsupported_selecttrace & 0x100)!=0 ){
    SELECTTRACE(0x100,pParse,p,("Move HAVING terms into WHERE:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif
}

/*







|







136048
136049
136050
136051
136052
136053
136054
136055
136056
136057
136058
136059
136060
136061
136062
  Walker sWalker;
  memset(&sWalker, 0, sizeof(sWalker));
  sWalker.pParse = pParse;
  sWalker.xExprCallback = havingToWhereExprCb;
  sWalker.u.pSelect = p;
  sqlite3WalkExpr(&sWalker, p->pHaving);
#if SELECTTRACE_ENABLED
  if( sWalker.eCode && (sqlite3SelectTrace & 0x100)!=0 ){
    SELECTTRACE(0x100,pParse,p,("Move HAVING terms into WHERE:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif
}

/*
135573
135574
135575
135576
135577
135578
135579
135580
135581
135582
135583
135584
135585
135586
135587
    }
    pSub = pPrior;
  }
  p->pEList->a[0].pExpr = pExpr;
  p->selFlags &= ~SF_Aggregate;

#if SELECTTRACE_ENABLED
  if( sqlite3_unsupported_selecttrace & 0x400 ){
    SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif
  return 1;
}
#endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */







|







136170
136171
136172
136173
136174
136175
136176
136177
136178
136179
136180
136181
136182
136183
136184
    }
    pSub = pPrior;
  }
  p->pEList->a[0].pExpr = pExpr;
  p->selFlags &= ~SF_Aggregate;

#if SELECTTRACE_ENABLED
  if( sqlite3SelectTrace & 0x400 ){
    SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif
  return 1;
}
#endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */
135626
135627
135628
135629
135630
135631
135632
135633
135634
135635
135636
135637
135638
135639
135640
  v = sqlite3GetVdbe(pParse);
  if( p==0 || db->mallocFailed || pParse->nErr ){
    return 1;
  }
  if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
#if SELECTTRACE_ENABLED
  SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain));
  if( sqlite3_unsupported_selecttrace & 0x100 ){
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif

  assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistFifo );
  assert( p->pOrderBy==0 || pDest->eDest!=SRT_Fifo );
  assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistQueue );







|







136223
136224
136225
136226
136227
136228
136229
136230
136231
136232
136233
136234
136235
136236
136237
  v = sqlite3GetVdbe(pParse);
  if( p==0 || db->mallocFailed || pParse->nErr ){
    return 1;
  }
  if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
#if SELECTTRACE_ENABLED
  SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain));
  if( sqlite3SelectTrace & 0x100 ){
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif

  assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistFifo );
  assert( p->pOrderBy==0 || pDest->eDest!=SRT_Fifo );
  assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistQueue );
135651
135652
135653
135654
135655
135656
135657
135658
135659
135660
135661
135662
135663
135664
135665
  }
  sqlite3SelectPrep(pParse, p, 0);
  if( pParse->nErr || db->mallocFailed ){
    goto select_end;
  }
  assert( p->pEList!=0 );
#if SELECTTRACE_ENABLED
  if( sqlite3_unsupported_selecttrace & 0x104 ){
    SELECTTRACE(0x104,pParse,p, ("after name resolution:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif

  /* If the SF_UpdateFrom flag is set, then this function is being called
  ** as part of populating the temp table for an UPDATE...FROM statement.







|







136248
136249
136250
136251
136252
136253
136254
136255
136256
136257
136258
136259
136260
136261
136262
  }
  sqlite3SelectPrep(pParse, p, 0);
  if( pParse->nErr || db->mallocFailed ){
    goto select_end;
  }
  assert( p->pEList!=0 );
#if SELECTTRACE_ENABLED
  if( sqlite3SelectTrace & 0x104 ){
    SELECTTRACE(0x104,pParse,p, ("after name resolution:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif

  /* If the SF_UpdateFrom flag is set, then this function is being called
  ** as part of populating the temp table for an UPDATE...FROM statement.
135686
135687
135688
135689
135690
135691
135692
135693
135694
135695
135696
135697
135698
135699
135700
#ifndef SQLITE_OMIT_WINDOWFUNC
  rc = sqlite3WindowRewrite(pParse, p);
  if( rc ){
    assert( db->mallocFailed || pParse->nErr>0 );
    goto select_end;
  }
#if SELECTTRACE_ENABLED
  if( p->pWin && (sqlite3_unsupported_selecttrace & 0x108)!=0 ){
    SELECTTRACE(0x104,pParse,p, ("after window rewrite:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif
#endif /* SQLITE_OMIT_WINDOWFUNC */
  pTabList = p->pSrc;
  isAgg = (p->selFlags & SF_Aggregate)!=0;







|







136283
136284
136285
136286
136287
136288
136289
136290
136291
136292
136293
136294
136295
136296
136297
#ifndef SQLITE_OMIT_WINDOWFUNC
  rc = sqlite3WindowRewrite(pParse, p);
  if( rc ){
    assert( db->mallocFailed || pParse->nErr>0 );
    goto select_end;
  }
#if SELECTTRACE_ENABLED
  if( p->pWin && (sqlite3SelectTrace & 0x108)!=0 ){
    SELECTTRACE(0x104,pParse,p, ("after window rewrite:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif
#endif /* SQLITE_OMIT_WINDOWFUNC */
  pTabList = p->pSrc;
  isAgg = (p->selFlags & SF_Aggregate)!=0;
135793
135794
135795
135796
135797
135798
135799
135800
135801
135802
135803
135804
135805
135806
135807
135808
135809
135810
135811
135812
135813
135814
135815
135816
135817
135818
135819
135820
135821
135822
135823
135824
135825
135826
  /* Handle compound SELECT statements using the separate multiSelect()
  ** procedure.
  */
  if( p->pPrior ){
    rc = multiSelect(pParse, p, pDest);
#if SELECTTRACE_ENABLED
    SELECTTRACE(0x1,pParse,p,("end compound-select processing\n"));
    if( (sqlite3_unsupported_selecttrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
      sqlite3TreeViewSelect(0, p, 0);
    }
#endif
    if( p->pNext==0 ) ExplainQueryPlanPop(pParse);
    return rc;
  }
#endif

  /* Do the WHERE-clause constant propagation optimization if this is
  ** a join.  No need to speed time on this operation for non-join queries
  ** as the equivalent optimization will be handled by query planner in
  ** sqlite3WhereBegin().
  */
  if( pTabList->nSrc>1
   && OptimizationEnabled(db, SQLITE_PropagateConst)
   && propagateConstants(pParse, p)
  ){
#if SELECTTRACE_ENABLED
    if( sqlite3_unsupported_selecttrace & 0x100 ){
      SELECTTRACE(0x100,pParse,p,("After constant propagation:\n"));
      sqlite3TreeViewSelect(0, p, 0);
    }
#endif
  }else{
    SELECTTRACE(0x100,pParse,p,("Constant propagation not helpful\n"));
  }







|


















|







136390
136391
136392
136393
136394
136395
136396
136397
136398
136399
136400
136401
136402
136403
136404
136405
136406
136407
136408
136409
136410
136411
136412
136413
136414
136415
136416
136417
136418
136419
136420
136421
136422
136423
  /* Handle compound SELECT statements using the separate multiSelect()
  ** procedure.
  */
  if( p->pPrior ){
    rc = multiSelect(pParse, p, pDest);
#if SELECTTRACE_ENABLED
    SELECTTRACE(0x1,pParse,p,("end compound-select processing\n"));
    if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
      sqlite3TreeViewSelect(0, p, 0);
    }
#endif
    if( p->pNext==0 ) ExplainQueryPlanPop(pParse);
    return rc;
  }
#endif

  /* Do the WHERE-clause constant propagation optimization if this is
  ** a join.  No need to speed time on this operation for non-join queries
  ** as the equivalent optimization will be handled by query planner in
  ** sqlite3WhereBegin().
  */
  if( pTabList->nSrc>1
   && OptimizationEnabled(db, SQLITE_PropagateConst)
   && propagateConstants(pParse, p)
  ){
#if SELECTTRACE_ENABLED
    if( sqlite3SelectTrace & 0x100 ){
      SELECTTRACE(0x100,pParse,p,("After constant propagation:\n"));
      sqlite3TreeViewSelect(0, p, 0);
    }
#endif
  }else{
    SELECTTRACE(0x100,pParse,p,("Constant propagation not helpful\n"));
  }
135900
135901
135902
135903
135904
135905
135906
135907
135908
135909
135910
135911
135912
135913
135914
    ** inside the subquery.  This can help the subquery to run more efficiently.
    */
    if( OptimizationEnabled(db, SQLITE_PushDown)
     && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
                           (pItem->fg.jointype & JT_OUTER)!=0)
    ){
#if SELECTTRACE_ENABLED
      if( sqlite3_unsupported_selecttrace & 0x100 ){
        SELECTTRACE(0x100,pParse,p,
            ("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
        sqlite3TreeViewSelect(0, p, 0);
      }
#endif
    }else{
      SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));







|







136497
136498
136499
136500
136501
136502
136503
136504
136505
136506
136507
136508
136509
136510
136511
    ** inside the subquery.  This can help the subquery to run more efficiently.
    */
    if( OptimizationEnabled(db, SQLITE_PushDown)
     && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
                           (pItem->fg.jointype & JT_OUTER)!=0)
    ){
#if SELECTTRACE_ENABLED
      if( sqlite3SelectTrace & 0x100 ){
        SELECTTRACE(0x100,pParse,p,
            ("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
        sqlite3TreeViewSelect(0, p, 0);
      }
#endif
    }else{
      SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));
136000
136001
136002
136003
136004
136005
136006
136007
136008
136009
136010
136011
136012
136013
136014
  pEList = p->pEList;
  pWhere = p->pWhere;
  pGroupBy = p->pGroupBy;
  pHaving = p->pHaving;
  sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0;

#if SELECTTRACE_ENABLED
  if( sqlite3_unsupported_selecttrace & 0x400 ){
    SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif

  /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and
  ** if the select-list is the same as the ORDER BY list, then this query







|







136597
136598
136599
136600
136601
136602
136603
136604
136605
136606
136607
136608
136609
136610
136611
  pEList = p->pEList;
  pWhere = p->pWhere;
  pGroupBy = p->pGroupBy;
  pHaving = p->pHaving;
  sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0;

#if SELECTTRACE_ENABLED
  if( sqlite3SelectTrace & 0x400 ){
    SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif

  /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and
  ** if the select-list is the same as the ORDER BY list, then this query
136036
136037
136038
136039
136040
136041
136042
136043
136044
136045
136046
136047
136048
136049
136050
    p->selFlags |= SF_Aggregate;
    /* Notice that even thought SF_Distinct has been cleared from p->selFlags,
    ** the sDistinct.isTnct is still set.  Hence, isTnct represents the
    ** original setting of the SF_Distinct flag, not the current setting */
    assert( sDistinct.isTnct );

#if SELECTTRACE_ENABLED
    if( sqlite3_unsupported_selecttrace & 0x400 ){
      SELECTTRACE(0x400,pParse,p,("Transform DISTINCT into GROUP BY:\n"));
      sqlite3TreeViewSelect(0, p, 0);
    }
#endif
  }

  /* If there is an ORDER BY clause, then create an ephemeral index to







|







136633
136634
136635
136636
136637
136638
136639
136640
136641
136642
136643
136644
136645
136646
136647
    p->selFlags |= SF_Aggregate;
    /* Notice that even thought SF_Distinct has been cleared from p->selFlags,
    ** the sDistinct.isTnct is still set.  Hence, isTnct represents the
    ** original setting of the SF_Distinct flag, not the current setting */
    assert( sDistinct.isTnct );

#if SELECTTRACE_ENABLED
    if( sqlite3SelectTrace & 0x400 ){
      SELECTTRACE(0x400,pParse,p,("Transform DISTINCT into GROUP BY:\n"));
      sqlite3TreeViewSelect(0, p, 0);
    }
#endif
  }

  /* If there is an ORDER BY clause, then create an ephemeral index to
136284
136285
136286
136287
136288
136289
136290
136291
136292
136293
136294
136295
136296
136297
136298
      }
#endif
      sNC.ncFlags &= ~NC_InAggFunc;
    }
    pAggInfo->mxReg = pParse->nMem;
    if( db->mallocFailed ) goto select_end;
#if SELECTTRACE_ENABLED
    if( sqlite3_unsupported_selecttrace & 0x400 ){
      int ii;
      SELECTTRACE(0x400,pParse,p,("After aggregate analysis %p:\n", pAggInfo));
      sqlite3TreeViewSelect(0, p, 0);
      for(ii=0; ii<pAggInfo->nColumn; ii++){
        sqlite3DebugPrintf("agg-column[%d] iMem=%d\n",
            ii, pAggInfo->aCol[ii].iMem);
        sqlite3TreeViewExpr(0, pAggInfo->aCol[ii].pCExpr, 0);







|







136881
136882
136883
136884
136885
136886
136887
136888
136889
136890
136891
136892
136893
136894
136895
      }
#endif
      sNC.ncFlags &= ~NC_InAggFunc;
    }
    pAggInfo->mxReg = pParse->nMem;
    if( db->mallocFailed ) goto select_end;
#if SELECTTRACE_ENABLED
    if( sqlite3SelectTrace & 0x400 ){
      int ii;
      SELECTTRACE(0x400,pParse,p,("After aggregate analysis %p:\n", pAggInfo));
      sqlite3TreeViewSelect(0, p, 0);
      for(ii=0; ii<pAggInfo->nColumn; ii++){
        sqlite3DebugPrintf("agg-column[%d] iMem=%d\n",
            ii, pAggInfo->aCol[ii].iMem);
        sqlite3TreeViewExpr(0, pAggInfo->aCol[ii].pCExpr, 0);
136703
136704
136705
136706
136707
136708
136709
136710
136711
136712
136713
136714
136715
136716
136717
      assert( pExpr->iAgg==i );
    }
  }
#endif

#if SELECTTRACE_ENABLED
  SELECTTRACE(0x1,pParse,p,("end processing\n"));
  if( (sqlite3_unsupported_selecttrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif
  ExplainQueryPlanPop(pParse);
  return rc;
}








|







137300
137301
137302
137303
137304
137305
137306
137307
137308
137309
137310
137311
137312
137313
137314
      assert( pExpr->iAgg==i );
    }
  }
#endif

#if SELECTTRACE_ENABLED
  SELECTTRACE(0x1,pParse,p,("end processing\n"));
  if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
    sqlite3TreeViewSelect(0, p, 0);
  }
#endif
  ExplainQueryPlanPop(pParse);
  return rc;
}

139474
139475
139476
139477
139478
139479
139480
139481

139482
139483
139484
139485
139486

139487


139488


139489

139490
139491
139492
139493
139494
139495
139496
139497
139498
139499
139500

139501
139502
139503
139504
139505
139506
139507
139508
139509
139510
139511
139512

139513
139514
139515
139516
139517
139518
139519
139520

139521
139522
139523
139524
139525
139526

139527
139528
139529
139530
139531
139532
139533
139534
*/
/* #include "sqliteInt.h" */

#ifndef SQLITE_OMIT_UPSERT
/*
** Free a list of Upsert objects
*/
SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3 *db, Upsert *p){

  if( p ){
    sqlite3ExprListDelete(db, p->pUpsertTarget);
    sqlite3ExprDelete(db, p->pUpsertTargetWhere);
    sqlite3ExprListDelete(db, p->pUpsertSet);
    sqlite3ExprDelete(db, p->pUpsertWhere);

    sqlite3DbFree(db, p);


  }


}


/*
** Duplicate an Upsert object.
*/
SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3 *db, Upsert *p){
  if( p==0 ) return 0;
  return sqlite3UpsertNew(db,
           sqlite3ExprListDup(db, p->pUpsertTarget, 0),
           sqlite3ExprDup(db, p->pUpsertTargetWhere, 0),
           sqlite3ExprListDup(db, p->pUpsertSet, 0),
           sqlite3ExprDup(db, p->pUpsertWhere, 0)

         );
}

/*
** Create a new Upsert object.
*/
SQLITE_PRIVATE Upsert *sqlite3UpsertNew(
  sqlite3 *db,           /* Determines which memory allocator to use */
  ExprList *pTarget,     /* Target argument to ON CONFLICT, or NULL */
  Expr *pTargetWhere,    /* Optional WHERE clause on the target */
  ExprList *pSet,        /* UPDATE columns, or NULL for a DO NOTHING */
  Expr *pWhere           /* WHERE clause for the ON CONFLICT UPDATE */

){
  Upsert *pNew;
  pNew = sqlite3DbMallocRaw(db, sizeof(Upsert));
  if( pNew==0 ){
    sqlite3ExprListDelete(db, pTarget);
    sqlite3ExprDelete(db, pTargetWhere);
    sqlite3ExprListDelete(db, pSet);
    sqlite3ExprDelete(db, pWhere);

    return 0;
  }else{
    pNew->pUpsertTarget = pTarget;
    pNew->pUpsertTargetWhere = pTargetWhere;
    pNew->pUpsertSet = pSet;
    pNew->pUpsertWhere = pWhere;

    pNew->pUpsertIdx = 0;
  }
  return pNew;
}

/*
** Analyze the ON CONFLICT clause described by pUpsert.  Resolve all
** symbols in the conflict-target.







|
>
|




>

>
>
|
>
>

>










|
>











|
>


|





>






>
|







140071
140072
140073
140074
140075
140076
140077
140078
140079
140080
140081
140082
140083
140084
140085
140086
140087
140088
140089
140090
140091
140092
140093
140094
140095
140096
140097
140098
140099
140100
140101
140102
140103
140104
140105
140106
140107
140108
140109
140110
140111
140112
140113
140114
140115
140116
140117
140118
140119
140120
140121
140122
140123
140124
140125
140126
140127
140128
140129
140130
140131
140132
140133
140134
140135
140136
140137
140138
140139
140140
140141
140142
*/
/* #include "sqliteInt.h" */

#ifndef SQLITE_OMIT_UPSERT
/*
** Free a list of Upsert objects
*/
static void SQLITE_NOINLINE upsertDelete(sqlite3 *db, Upsert *p){
  do{
    Upsert *pNext = p->pNextUpsert;
    sqlite3ExprListDelete(db, p->pUpsertTarget);
    sqlite3ExprDelete(db, p->pUpsertTargetWhere);
    sqlite3ExprListDelete(db, p->pUpsertSet);
    sqlite3ExprDelete(db, p->pUpsertWhere);
    sqlite3DbFree(db, p->pToFree);
    sqlite3DbFree(db, p);
    p = pNext;
  }while( p );
}
SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3 *db, Upsert *p){
  if( p ) upsertDelete(db, p);
}


/*
** Duplicate an Upsert object.
*/
SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3 *db, Upsert *p){
  if( p==0 ) return 0;
  return sqlite3UpsertNew(db,
           sqlite3ExprListDup(db, p->pUpsertTarget, 0),
           sqlite3ExprDup(db, p->pUpsertTargetWhere, 0),
           sqlite3ExprListDup(db, p->pUpsertSet, 0),
           sqlite3ExprDup(db, p->pUpsertWhere, 0),
           sqlite3UpsertDup(db, p->pNextUpsert)
         );
}

/*
** Create a new Upsert object.
*/
SQLITE_PRIVATE Upsert *sqlite3UpsertNew(
  sqlite3 *db,           /* Determines which memory allocator to use */
  ExprList *pTarget,     /* Target argument to ON CONFLICT, or NULL */
  Expr *pTargetWhere,    /* Optional WHERE clause on the target */
  ExprList *pSet,        /* UPDATE columns, or NULL for a DO NOTHING */
  Expr *pWhere,          /* WHERE clause for the ON CONFLICT UPDATE */
  Upsert *pNext          /* Next ON CONFLICT clause in the list */
){
  Upsert *pNew;
  pNew = sqlite3DbMallocZero(db, sizeof(Upsert));
  if( pNew==0 ){
    sqlite3ExprListDelete(db, pTarget);
    sqlite3ExprDelete(db, pTargetWhere);
    sqlite3ExprListDelete(db, pSet);
    sqlite3ExprDelete(db, pWhere);
    sqlite3UpsertDelete(db, pNext);
    return 0;
  }else{
    pNew->pUpsertTarget = pTarget;
    pNew->pUpsertTargetWhere = pTargetWhere;
    pNew->pUpsertSet = pSet;
    pNew->pUpsertWhere = pWhere;
    pNew->isDoUpdate = pSet!=0;
    pNew->pNextUpsert = pNext;
  }
  return pNew;
}

/*
** Analyze the ON CONFLICT clause described by pUpsert.  Resolve all
** symbols in the conflict-target.
139545
139546
139547
139548
139549
139550
139551

139552
139553
139554
139555
139556
139557
139558
139559
139560
139561
139562
139563
139564


139565
139566
139567
139568
139569
139570
139571
139572
139573
139574
139575
139576
139577
139578
139579
139580
139581

139582
139583
139584
139585
139586
139587
139588
139589
139590
139591
139592
139593
139594
139595
139596
139597
139598
139599
139600
139601
139602
139603
139604
139605
139606
139607
139608
139609
139610
139611
139612
139613
139614
139615
139616
139617
139618
139619
139620
139621
139622
139623
139624
139625
139626
139627
139628
139629
139630
139631
139632
139633
139634
139635
139636
139637
139638
139639
139640
139641
139642







139643
139644
139645



































139646
139647
139648
139649
139650
139651
139652
  int rc;                 /* Result code */
  int iCursor;            /* Cursor used by pTab */
  Index *pIdx;            /* One of the indexes of pTab */
  ExprList *pTarget;      /* The conflict-target clause */
  Expr *pTerm;            /* One term of the conflict-target clause */
  NameContext sNC;        /* Context for resolving symbolic names */
  Expr sCol[2];           /* Index column converted into an Expr */


  assert( pTabList->nSrc==1 );
  assert( pTabList->a[0].pTab!=0 );
  assert( pUpsert!=0 );
  assert( pUpsert->pUpsertTarget!=0 );

  /* Resolve all symbolic names in the conflict-target clause, which
  ** includes both the list of columns and the optional partial-index
  ** WHERE clause.
  */
  memset(&sNC, 0, sizeof(sNC));
  sNC.pParse = pParse;
  sNC.pSrcList = pTabList;


  rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget);
  if( rc ) return rc;
  rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere);
  if( rc ) return rc;

  /* Check to see if the conflict target matches the rowid. */
  pTab = pTabList->a[0].pTab;
  pTarget = pUpsert->pUpsertTarget;
  iCursor = pTabList->a[0].iCursor;
  if( HasRowid(pTab)
   && pTarget->nExpr==1
   && (pTerm = pTarget->a[0].pExpr)->op==TK_COLUMN
   && pTerm->iColumn==XN_ROWID
  ){
    /* The conflict-target is the rowid of the primary table */
    assert( pUpsert->pUpsertIdx==0 );
    return SQLITE_OK;

  }

  /* Initialize sCol[0..1] to be an expression parse tree for a
  ** single column of an index.  The sCol[0] node will be the TK_COLLATE
  ** operator and sCol[1] will be the TK_COLUMN operator.  Code below
  ** will populate the specific collation and column number values
  ** prior to comparing against the conflict-target expression.
  */
  memset(sCol, 0, sizeof(sCol));
  sCol[0].op = TK_COLLATE;
  sCol[0].pLeft = &sCol[1];
  sCol[1].op = TK_COLUMN;
  sCol[1].iTable = pTabList->a[0].iCursor;

  /* Check for matches against other indexes */
  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    int ii, jj, nn;
    if( !IsUniqueIndex(pIdx) ) continue;
    if( pTarget->nExpr!=pIdx->nKeyCol ) continue;
    if( pIdx->pPartIdxWhere ){
      if( pUpsert->pUpsertTargetWhere==0 ) continue;
      if( sqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere,
                             pIdx->pPartIdxWhere, iCursor)!=0 ){
        continue;
      }
    }
    nn = pIdx->nKeyCol;
    for(ii=0; ii<nn; ii++){
      Expr *pExpr;
      sCol[0].u.zToken = (char*)pIdx->azColl[ii];
      if( pIdx->aiColumn[ii]==XN_EXPR ){
        assert( pIdx->aColExpr!=0 );
        assert( pIdx->aColExpr->nExpr>ii );
        pExpr = pIdx->aColExpr->a[ii].pExpr;
        if( pExpr->op!=TK_COLLATE ){
          sCol[0].pLeft = pExpr;
          pExpr = &sCol[0];
        }
      }else{
        sCol[0].pLeft = &sCol[1];
        sCol[1].iColumn = pIdx->aiColumn[ii];
        pExpr = &sCol[0];
      }
      for(jj=0; jj<nn; jj++){
        if( sqlite3ExprCompare(pParse, pTarget->a[jj].pExpr, pExpr,iCursor)<2 ){
          break;  /* Column ii of the index matches column jj of target */
        }
      }
      if( jj>=nn ){
        /* The target contains no match for column jj of the index */
        break;
      }
    }
    if( ii<nn ){
      /* Column ii of the index did not match any term of the conflict target.
      ** Continue the search with the next index. */
      continue;
    }
    pUpsert->pUpsertIdx = pIdx;
    return SQLITE_OK;
  }







  sqlite3ErrorMsg(pParse, "ON CONFLICT clause does not match any "
                          "PRIMARY KEY or UNIQUE constraint");
  return SQLITE_ERROR;



































}

/*
** Generate bytecode that does an UPDATE as part of an upsert.
**
** If pIdx is NULL, then the UNIQUE constraint that failed was the IPK.
** In this case parameter iCur is a cursor open on the table b-tree that







>













>
>
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
<
>
|

|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







140153
140154
140155
140156
140157
140158
140159
140160
140161
140162
140163
140164
140165
140166
140167
140168
140169
140170
140171
140172
140173
140174
140175
140176
140177
140178
140179
140180
140181
140182
140183
140184
140185
140186
140187
140188
140189
140190
140191

140192
140193
140194
140195
140196
140197
140198
140199
140200
140201
140202
140203
140204
140205
140206
140207
140208
140209
140210
140211
140212
140213
140214
140215
140216
140217
140218
140219
140220
140221
140222
140223
140224
140225
140226
140227
140228
140229
140230
140231
140232
140233
140234
140235
140236
140237
140238
140239
140240
140241
140242
140243
140244
140245
140246
140247
140248
140249
140250
140251
140252
140253
140254
140255
140256
140257
140258
140259
140260
140261
140262
140263
140264
140265
140266
140267
140268
140269
140270
140271
140272
140273
140274
140275
140276
140277
140278
140279
140280
140281
140282
140283
140284
140285
140286
140287
140288
140289
140290
140291
140292
140293
140294
140295
140296
140297
140298
140299
140300
140301
140302
140303
140304
140305
  int rc;                 /* Result code */
  int iCursor;            /* Cursor used by pTab */
  Index *pIdx;            /* One of the indexes of pTab */
  ExprList *pTarget;      /* The conflict-target clause */
  Expr *pTerm;            /* One term of the conflict-target clause */
  NameContext sNC;        /* Context for resolving symbolic names */
  Expr sCol[2];           /* Index column converted into an Expr */
  int nClause = 0;        /* Counter of ON CONFLICT clauses */

  assert( pTabList->nSrc==1 );
  assert( pTabList->a[0].pTab!=0 );
  assert( pUpsert!=0 );
  assert( pUpsert->pUpsertTarget!=0 );

  /* Resolve all symbolic names in the conflict-target clause, which
  ** includes both the list of columns and the optional partial-index
  ** WHERE clause.
  */
  memset(&sNC, 0, sizeof(sNC));
  sNC.pParse = pParse;
  sNC.pSrcList = pTabList;
  for(; pUpsert && pUpsert->pUpsertTarget;
        pUpsert=pUpsert->pNextUpsert, nClause++){
    rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget);
    if( rc ) return rc;
    rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere);
    if( rc ) return rc;

    /* Check to see if the conflict target matches the rowid. */
    pTab = pTabList->a[0].pTab;
    pTarget = pUpsert->pUpsertTarget;
    iCursor = pTabList->a[0].iCursor;
    if( HasRowid(pTab)
     && pTarget->nExpr==1
     && (pTerm = pTarget->a[0].pExpr)->op==TK_COLUMN
     && pTerm->iColumn==XN_ROWID
    ){
      /* The conflict-target is the rowid of the primary table */
      assert( pUpsert->pUpsertIdx==0 );

      continue;
    }

    /* Initialize sCol[0..1] to be an expression parse tree for a
    ** single column of an index.  The sCol[0] node will be the TK_COLLATE
    ** operator and sCol[1] will be the TK_COLUMN operator.  Code below
    ** will populate the specific collation and column number values
    ** prior to comparing against the conflict-target expression.
    */
    memset(sCol, 0, sizeof(sCol));
    sCol[0].op = TK_COLLATE;
    sCol[0].pLeft = &sCol[1];
    sCol[1].op = TK_COLUMN;
    sCol[1].iTable = pTabList->a[0].iCursor;

    /* Check for matches against other indexes */
    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
      int ii, jj, nn;
      if( !IsUniqueIndex(pIdx) ) continue;
      if( pTarget->nExpr!=pIdx->nKeyCol ) continue;
      if( pIdx->pPartIdxWhere ){
        if( pUpsert->pUpsertTargetWhere==0 ) continue;
        if( sqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere,
                               pIdx->pPartIdxWhere, iCursor)!=0 ){
          continue;
        }
      }
      nn = pIdx->nKeyCol;
      for(ii=0; ii<nn; ii++){
        Expr *pExpr;
        sCol[0].u.zToken = (char*)pIdx->azColl[ii];
        if( pIdx->aiColumn[ii]==XN_EXPR ){
          assert( pIdx->aColExpr!=0 );
          assert( pIdx->aColExpr->nExpr>ii );
          pExpr = pIdx->aColExpr->a[ii].pExpr;
          if( pExpr->op!=TK_COLLATE ){
            sCol[0].pLeft = pExpr;
            pExpr = &sCol[0];
          }
        }else{
          sCol[0].pLeft = &sCol[1];
          sCol[1].iColumn = pIdx->aiColumn[ii];
          pExpr = &sCol[0];
        }
        for(jj=0; jj<nn; jj++){
          if( sqlite3ExprCompare(pParse,pTarget->a[jj].pExpr,pExpr,iCursor)<2 ){
            break;  /* Column ii of the index matches column jj of target */
          }
        }
        if( jj>=nn ){
          /* The target contains no match for column jj of the index */
          break;
        }
      }
      if( ii<nn ){
        /* Column ii of the index did not match any term of the conflict target.
        ** Continue the search with the next index. */
        continue;
      }
      pUpsert->pUpsertIdx = pIdx;
      break;
    }
    if( pUpsert->pUpsertIdx==0 ){
      char zWhich[16];
      if( nClause==0 && pUpsert->pNextUpsert==0 ){
        zWhich[0] = 0;
      }else{
        sqlite3_snprintf(sizeof(zWhich),zWhich,"%r ", nClause+1);
      }
      sqlite3ErrorMsg(pParse, "%sON CONFLICT clause does not match any "
                              "PRIMARY KEY or UNIQUE constraint", zWhich);
      return SQLITE_ERROR;
    }
  }
  return SQLITE_OK;
}

/*
** Return true if pUpsert is the last ON CONFLICT clause with a
** conflict target, or if pUpsert is followed by another ON CONFLICT
** clause that targets the INTEGER PRIMARY KEY.
*/
SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert *pUpsert){
  Upsert *pNext;
  if( NEVER(pUpsert==0) ) return 0;
  pNext = pUpsert->pNextUpsert;
  if( pNext==0 ) return 1;
  if( pNext->pUpsertTarget==0 ) return 1;
  if( pNext->pUpsertIdx==0 ) return 1;
  return 0;
}

/*
** Given the list of ON CONFLICT clauses described by pUpsert, and
** a particular index pIdx, return a pointer to the particular ON CONFLICT
** clause that applies to the index.  Or, if the index is not subject to
** any ON CONFLICT clause, return NULL.
*/
SQLITE_PRIVATE Upsert *sqlite3UpsertOfIndex(Upsert *pUpsert, Index *pIdx){
  while(
      pUpsert
   && pUpsert->pUpsertTarget!=0
   && pUpsert->pUpsertIdx!=pIdx
  ){
     pUpsert = pUpsert->pNextUpsert;
  }
  return pUpsert;
}

/*
** Generate bytecode that does an UPDATE as part of an upsert.
**
** If pIdx is NULL, then the UNIQUE constraint that failed was the IPK.
** In this case parameter iCur is a cursor open on the table b-tree that
139662
139663
139664
139665
139666
139667
139668

139669
139670
139671
139672
139673


139674
139675
139676
139677
139678
139679
139680
  int iCur              /* Cursor for pIdx (or pTab if pIdx==NULL) */
){
  Vdbe *v = pParse->pVdbe;
  sqlite3 *db = pParse->db;
  SrcList *pSrc;            /* FROM clause for the UPDATE */
  int iDataCur;
  int i;


  assert( v!=0 );
  assert( pUpsert!=0 );
  VdbeNoopComment((v, "Begin DO UPDATE of UPSERT"));
  iDataCur = pUpsert->iDataCur;


  if( pIdx && iCur!=iDataCur ){
    if( HasRowid(pTab) ){
      int regRowid = sqlite3GetTempReg(pParse);
      sqlite3VdbeAddOp2(v, OP_IdxRowid, iCur, regRowid);
      sqlite3VdbeAddOp3(v, OP_SeekRowid, iDataCur, 0, regRowid);
      VdbeCoverage(v);
      sqlite3ReleaseTempReg(pParse, regRowid);







>



<

>
>







140315
140316
140317
140318
140319
140320
140321
140322
140323
140324
140325

140326
140327
140328
140329
140330
140331
140332
140333
140334
140335
  int iCur              /* Cursor for pIdx (or pTab if pIdx==NULL) */
){
  Vdbe *v = pParse->pVdbe;
  sqlite3 *db = pParse->db;
  SrcList *pSrc;            /* FROM clause for the UPDATE */
  int iDataCur;
  int i;
  Upsert *pTop = pUpsert;

  assert( v!=0 );
  assert( pUpsert!=0 );

  iDataCur = pUpsert->iDataCur;
  pUpsert = sqlite3UpsertOfIndex(pTop, pIdx);
  VdbeNoopComment((v, "Begin DO UPDATE of UPSERT"));
  if( pIdx && iCur!=iDataCur ){
    if( HasRowid(pTab) ){
      int regRowid = sqlite3GetTempReg(pParse);
      sqlite3VdbeAddOp2(v, OP_IdxRowid, iCur, regRowid);
      sqlite3VdbeAddOp3(v, OP_SeekRowid, iDataCur, 0, regRowid);
      VdbeCoverage(v);
      sqlite3ReleaseTempReg(pParse, regRowid);
139696
139697
139698
139699
139700
139701
139702
139703
139704
139705
139706
139707
139708
139709
139710
139711
139712
139713
139714
139715
139716
139717
139718
139719
139720
139721
139722
      VdbeCoverage(v);
      sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0,
            "corrupt database", P4_STATIC);
      sqlite3MayAbort(pParse);
      sqlite3VdbeJumpHere(v, i);
    }
  }
  /* pUpsert does not own pUpsertSrc - the outer INSERT statement does.  So
  ** we have to make a copy before passing it down into sqlite3Update() */
  pSrc = sqlite3SrcListDup(db, pUpsert->pUpsertSrc, 0);
  /* excluded.* columns of type REAL need to be converted to a hard real */
  for(i=0; i<pTab->nCol; i++){
    if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
      sqlite3VdbeAddOp1(v, OP_RealAffinity, pUpsert->regData+i);
    }
  }
  sqlite3Update(pParse, pSrc, pUpsert->pUpsertSet,
      pUpsert->pUpsertWhere, OE_Abort, 0, 0, pUpsert);
  pUpsert->pUpsertSet = 0;    /* Will have been deleted by sqlite3Update() */
  pUpsert->pUpsertWhere = 0;  /* Will have been deleted by sqlite3Update() */
  VdbeNoopComment((v, "End DO UPDATE of UPSERT"));
}

#endif /* SQLITE_OMIT_UPSERT */

/************** End of upsert.c **********************************************/
/************** Begin file vacuum.c ******************************************/







|
|
|



|


|
|
<
<







140351
140352
140353
140354
140355
140356
140357
140358
140359
140360
140361
140362
140363
140364
140365
140366
140367
140368


140369
140370
140371
140372
140373
140374
140375
      VdbeCoverage(v);
      sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0,
            "corrupt database", P4_STATIC);
      sqlite3MayAbort(pParse);
      sqlite3VdbeJumpHere(v, i);
    }
  }
  /* pUpsert does not own pTop->pUpsertSrc - the outer INSERT statement does.
  ** So we have to make a copy before passing it down into sqlite3Update() */
  pSrc = sqlite3SrcListDup(db, pTop->pUpsertSrc, 0);
  /* excluded.* columns of type REAL need to be converted to a hard real */
  for(i=0; i<pTab->nCol; i++){
    if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
      sqlite3VdbeAddOp1(v, OP_RealAffinity, pTop->regData+i);
    }
  }
  sqlite3Update(pParse, pSrc, sqlite3ExprListDup(db,pUpsert->pUpsertSet,0),
      sqlite3ExprDup(db,pUpsert->pUpsertWhere,0), OE_Abort, 0, 0, pUpsert);


  VdbeNoopComment((v, "End DO UPDATE of UPSERT"));
}

#endif /* SQLITE_OMIT_UPSERT */

/************** End of upsert.c **********************************************/
/************** Begin file vacuum.c ******************************************/
141485
141486
141487
141488
141489
141490
141491
141492
141493
141494
141495
141496
141497
141498
141499
141500
141501
141502
141503
141504
141505
141506
141507
141508
141509
141510
141511
** 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
#if defined(SQLITE_DEBUG) \
    && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))
# define WHERETRACE(K,X)  if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X
# define WHERETRACE_ENABLED 1
#else
# define WHERETRACE(K,X)
#endif

/* Forward references
*/
typedef struct WhereClause WhereClause;
typedef struct WhereMaskSet WhereMaskSet;
typedef struct WhereOrInfo WhereOrInfo;
typedef struct WhereAndInfo WhereAndInfo;







<
<
<
<
<
<
<
<
<
<
<
<
<







142138
142139
142140
142141
142142
142143
142144













142145
142146
142147
142148
142149
142150
142151
** 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















/* Forward references
*/
typedef struct WhereClause WhereClause;
typedef struct WhereMaskSet WhereMaskSet;
typedef struct WhereOrInfo WhereOrInfo;
typedef struct WhereAndInfo WhereAndInfo;
146217
146218
146219
146220
146221
146222
146223
146224
146225
146226
146227
146228
146229
146230
146231
146232
146233
146234
146235
146236
struct HiddenIndexInfo {
  WhereClause *pWC;   /* The Where clause being analyzed */
  Parse *pParse;      /* The parsing context */
};

/* Forward declaration of methods */
static int whereLoopResize(sqlite3*, WhereLoop*, int);

/* Test variable that can be set to enable WHERE tracing */
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
/***/ int sqlite3WhereTrace = 0;
#endif


/*
** Return the estimated number of output rows from a WHERE clause
*/
SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo *pWInfo){
  return pWInfo->nRowOut;
}







<
<
<
<
<
<







146857
146858
146859
146860
146861
146862
146863






146864
146865
146866
146867
146868
146869
146870
struct HiddenIndexInfo {
  WhereClause *pWC;   /* The Where clause being analyzed */
  Parse *pParse;      /* The parsing context */
};

/* Forward declaration of methods */
static int whereLoopResize(sqlite3*, WhereLoop*, int);







/*
** Return the estimated number of output rows from a WHERE clause
*/
SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo *pWInfo){
  return pWInfo->nRowOut;
}
155317
155318
155319
155320
155321
155322
155323
155324
155325
155326
155327
155328
155329
155330
155331
155332
155333
155334
155335
155336
155337
155338
155339
155340
155341
155342
#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             553
#define YYNRULE              385
#define YYNRULE_WITH_ACTION  325
#define YYNTOKEN             181
#define YY_MAX_SHIFT         552
#define YY_MIN_SHIFTREDUCE   803
#define YY_MAX_SHIFTREDUCE   1187
#define YY_ERROR_ACTION      1188
#define YY_ACCEPT_ACTION     1189
#define YY_NO_ACTION         1190
#define YY_MIN_REDUCE        1191
#define YY_MAX_REDUCE        1575
/************* 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







|
|
|

|
|
|
|
|
|
|
|







155951
155952
155953
155954
155955
155956
155957
155958
155959
155960
155961
155962
155963
155964
155965
155966
155967
155968
155969
155970
155971
155972
155973
155974
155975
155976
#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             558
#define YYNRULE              386
#define YYNRULE_WITH_ACTION  326
#define YYNTOKEN             181
#define YY_MAX_SHIFT         557
#define YY_MIN_SHIFTREDUCE   809
#define YY_MAX_SHIFTREDUCE   1194
#define YY_ERROR_ACTION      1195
#define YY_ACCEPT_ACTION     1196
#define YY_NO_ACTION         1197
#define YY_MIN_REDUCE        1198
#define YY_MAX_REDUCE        1583
/************* 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
155395
155396
155397
155398
155399
155400
155401
155402
155403
155404
155405
155406
155407
155408
155409
155410
155411
155412
155413
155414
155415
155416
155417
155418
155419
155420
155421
155422
155423
155424
155425
155426
155427
155428
155429
155430
155431
155432
155433
155434
155435
155436
155437
155438
155439
155440
155441
155442
155443
155444
155445
155446
155447
155448
155449
155450
155451
155452
155453
155454
155455
155456
155457
155458
155459
155460
155461
155462
155463
155464
155465
155466
155467
155468
155469
155470
155471
155472
155473
155474
155475
155476
155477
155478
155479
155480
155481
155482
155483
155484
155485
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
155552
155553
155554
155555
155556
155557
155558
155559
155560
155561
155562
155563
155564
155565
155566
155567
155568
155569
155570
155571
155572
155573
155574
155575
155576
155577
155578
155579
155580
155581
155582
155583
155584
155585
155586
155587
155588
155589
155590
155591
155592
155593
155594
155595
155596
155597
155598
155599
155600
155601
155602
155603
155604
155605
155606
155607
**  yy_shift_ofst[]    For each state, the offset into yy_action for
**                     shifting terminals.
**  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 (1962)
static const YYACTIONTYPE yy_action[] = {
 /*     0 */   546, 1222,  546,  451, 1260,  546, 1239,  546,  114,  111,
 /*    10 */   211,  546, 1537,  546, 1260,  523,  114,  111,  211,  392,
 /*    20 */  1232,  344,   42,   42,   42,   42, 1225,   42,   42,   71,
 /*    30 */    71,  937, 1224,   71,   71,   71,   71, 1462, 1493,  938,
 /*    40 */   820,  453,    6,  121,  122,  112, 1165, 1165, 1006, 1009,
 /*    50 */   999,  999,  119,  119,  120,  120,  120,  120, 1543,  392,
 /*    60 */  1358, 1517,  552,    2, 1193,  194,  528,  436,  143,  291,
 /*    70 */   528,  136,  528,  371,  261,  504,  272,  385, 1273,  527,
 /*    80 */   503,  493,  164,  121,  122,  112, 1165, 1165, 1006, 1009,
 /*    90 */   999,  999,  119,  119,  120,  120,  120,  120, 1358,  442,
 /*   100 */  1514,  118,  118,  118,  118,  117,  117,  116,  116,  116,
 /*   110 */   115,  424,  266,  266,  266,  266, 1498,  358, 1500,  435,
 /*   120 */   357, 1498,  517,  524, 1485,  543, 1114,  543, 1114,  392,
 /*   130 */   405,  241,  208,  114,  111,  211,   98,  290,  537,  221,
 /*   140 */  1029,  118,  118,  118,  118,  117,  117,  116,  116,  116,
 /*   150 */   115,  424, 1142,  121,  122,  112, 1165, 1165, 1006, 1009,
 /*   160 */   999,  999,  119,  119,  120,  120,  120,  120,  406,  428,
 /*   170 */   117,  117,  116,  116,  116,  115,  424, 1418,  468,  123,
 /*   180 */   118,  118,  118,  118,  117,  117,  116,  116,  116,  115,
 /*   190 */   424,  116,  116,  116,  115,  424,  540,  540,  540,  392,
 /*   200 */   505,  120,  120,  120,  120,  113, 1051, 1142, 1143, 1144,
 /*   210 */  1051,  118,  118,  118,  118,  117,  117,  116,  116,  116,
 /*   220 */   115,  424, 1461,  121,  122,  112, 1165, 1165, 1006, 1009,
 /*   230 */   999,  999,  119,  119,  120,  120,  120,  120,  392,  444,
 /*   240 */   316,   83,  463,   81,  359,  382, 1142,   80,  118,  118,
 /*   250 */   118,  118,  117,  117,  116,  116,  116,  115,  424,  179,
 /*   260 */   434,  424,  121,  122,  112, 1165, 1165, 1006, 1009,  999,
 /*   270 */   999,  119,  119,  120,  120,  120,  120,  434,  433,  266,
 /*   280 */   266,  118,  118,  118,  118,  117,  117,  116,  116,  116,
 /*   290 */   115,  424,  543, 1109,  903,  506, 1142,  114,  111,  211,
 /*   300 */  1431, 1142, 1143, 1144,  206,  491, 1109,  392,  449, 1109,
 /*   310 */   545,  330,  120,  120,  120,  120,  298, 1431, 1433,   17,
 /*   320 */   118,  118,  118,  118,  117,  117,  116,  116,  116,  115,
 /*   330 */   424,  121,  122,  112, 1165, 1165, 1006, 1009,  999,  999,
 /*   340 */   119,  119,  120,  120,  120,  120,  392, 1358,  434, 1142,
 /*   350 */   482, 1142, 1143, 1144,  996,  996, 1007, 1010,  445,  118,
 /*   360 */   118,  118,  118,  117,  117,  116,  116,  116,  115,  424,
 /*   370 */   121,  122,  112, 1165, 1165, 1006, 1009,  999,  999,  119,
 /*   380 */   119,  120,  120,  120,  120, 1054, 1054,  465, 1431,  118,
 /*   390 */   118,  118,  118,  117,  117,  116,  116,  116,  115,  424,
 /*   400 */  1142,  451,  546, 1426, 1142, 1143, 1144,  233,  966, 1142,
 /*   410 */   481,  478,  477,  171,  360,  392,  164,  407,  414,  842,
 /*   420 */   476,  164,  185,  334,   71,   71, 1243, 1000,  118,  118,
 /*   430 */   118,  118,  117,  117,  116,  116,  116,  115,  424,  121,
 /*   440 */   122,  112, 1165, 1165, 1006, 1009,  999,  999,  119,  119,
 /*   450 */   120,  120,  120,  120,  392, 1142, 1143, 1144,  835,   12,
 /*   460 */   314,  509,  163,  356, 1142, 1143, 1144,  114,  111,  211,
 /*   470 */   508,  290,  537,  546,  276,  180,  290,  537,  121,  122,
 /*   480 */   112, 1165, 1165, 1006, 1009,  999,  999,  119,  119,  120,
 /*   490 */   120,  120,  120,  345,  484,   71,   71,  118,  118,  118,
 /*   500 */   118,  117,  117,  116,  116,  116,  115,  424, 1142,  209,
 /*   510 */   411,  523, 1142, 1109, 1571,  378,  252,  269,  342,  487,
 /*   520 */   337,  486,  238,  392,  513,  364, 1109, 1127,  333, 1109,
 /*   530 */   191,  409,  286,   32,  457,  443,  118,  118,  118,  118,
 /*   540 */   117,  117,  116,  116,  116,  115,  424,  121,  122,  112,
 /*   550 */  1165, 1165, 1006, 1009,  999,  999,  119,  119,  120,  120,
 /*   560 */   120,  120,  392, 1142, 1143, 1144,  987, 1142, 1143, 1144,
 /*   570 */  1142,  233,  492, 1492,  481,  478,  477,    6,  163,  546,
 /*   580 */   512,  546,  115,  424,  476,    5,  121,  122,  112, 1165,
 /*   590 */  1165, 1006, 1009,  999,  999,  119,  119,  120,  120,  120,
 /*   600 */   120,   13,   13,   13,   13,  118,  118,  118,  118,  117,
 /*   610 */   117,  116,  116,  116,  115,  424,  403,  502,  408,  546,
 /*   620 */  1486,  544, 1142,  892,  892, 1142, 1143, 1144, 1473, 1142,
 /*   630 */   275,  392,  808,  809,  810,  971,  422,  422,  422,   16,
 /*   640 */    16,   55,   55, 1242,  118,  118,  118,  118,  117,  117,
 /*   650 */   116,  116,  116,  115,  424,  121,  122,  112, 1165, 1165,
 /*   660 */  1006, 1009,  999,  999,  119,  119,  120,  120,  120,  120,
 /*   670 */   392, 1189,    1,    1,  552,    2, 1193, 1142, 1143, 1144,
 /*   680 */   194,  291,  898,  136, 1142, 1143, 1144,  897,  521, 1492,
 /*   690 */  1273,    3,  380,    6,  121,  122,  112, 1165, 1165, 1006,
 /*   700 */  1009,  999,  999,  119,  119,  120,  120,  120,  120,  858,
 /*   710 */   546,  924,  546,  118,  118,  118,  118,  117,  117,  116,
 /*   720 */   116,  116,  115,  424,  266,  266, 1092, 1569, 1142,  551,
 /*   730 */  1569, 1193,   13,   13,   13,   13,  291,  543,  136,  392,
 /*   740 */   485,  421,  420,  966,  344, 1273,  468,  410,  859,  279,
 /*   750 */   140,  221,  118,  118,  118,  118,  117,  117,  116,  116,
 /*   760 */   116,  115,  424,  121,  122,  112, 1165, 1165, 1006, 1009,
 /*   770 */   999,  999,  119,  119,  120,  120,  120,  120,  546,  266,
 /*   780 */   266,  428,  392, 1142, 1143, 1144, 1172,  830, 1172,  468,
 /*   790 */   431,  145,  543, 1146,  401,  314,  439,  302,  838, 1490,
 /*   800 */    71,   71,  412,    6, 1090,  473,  221,  100,  112, 1165,
 /*   810 */  1165, 1006, 1009,  999,  999,  119,  119,  120,  120,  120,
 /*   820 */   120,  118,  118,  118,  118,  117,  117,  116,  116,  116,
 /*   830 */   115,  424,  237, 1425,  546,  451,  428,  287,  986,  546,
 /*   840 */   236,  235,  234,  830,   97,  529,  429, 1265, 1265, 1146,
 /*   850 */   494,  307,  430,  838,  977,  546,   71,   71,  976, 1241,
 /*   860 */   546,   51,   51,  300,  118,  118,  118,  118,  117,  117,
 /*   870 */   116,  116,  116,  115,  424,  194,  103,   70,   70,  266,
 /*   880 */   266,  546,   71,   71,  266,  266,   30,  391,  344,  976,
 /*   890 */   976,  978,  543,  528, 1109,  328,  392,  543,  495,  397,
 /*   900 */  1470,  195,  530,   13,   13, 1358,  240, 1109,  277,  280,
 /*   910 */  1109,  280,  304,  457,  306,  333,  392,   31,  188,  419,
 /*   920 */   121,  122,  112, 1165, 1165, 1006, 1009,  999,  999,  119,
 /*   930 */   119,  120,  120,  120,  120,  142,  392,  365,  457,  986,
 /*   940 */   121,  122,  112, 1165, 1165, 1006, 1009,  999,  999,  119,
 /*   950 */   119,  120,  120,  120,  120,  977,  323, 1142,  326,  976,
 /*   960 */   121,  110,  112, 1165, 1165, 1006, 1009,  999,  999,  119,
 /*   970 */   119,  120,  120,  120,  120,  464,  377, 1185,  118,  118,
 /*   980 */   118,  118,  117,  117,  116,  116,  116,  115,  424, 1142,
 /*   990 */   976,  976,  978,  305,    9,  366,  244,  362,  118,  118,
 /*  1000 */   118,  118,  117,  117,  116,  116,  116,  115,  424,  313,
 /*  1010 */   546,  344, 1142, 1143, 1144,  299,  290,  537,  118,  118,
 /*  1020 */   118,  118,  117,  117,  116,  116,  116,  115,  424, 1263,
 /*  1030 */  1263, 1163,   13,   13,  278,  421,  420,  468,  392,  923,
 /*  1040 */   260,  260,  289, 1169, 1142, 1143, 1144,  189, 1171,  266,
 /*  1050 */   266,  468,  390,  543, 1186,  546, 1170,  263,  144,  489,
 /*  1060 */   922,  546,  543,  122,  112, 1165, 1165, 1006, 1009,  999,
 /*  1070 */   999,  119,  119,  120,  120,  120,  120,   71,   71, 1142,
 /*  1080 */  1172, 1272, 1172,   13,   13,  898, 1070, 1163,  546,  468,
 /*  1090 */   897,  107,  538, 1491,    4, 1268, 1109,    6,  525, 1049,
 /*  1100 */    12, 1071, 1092, 1570,  312,  455, 1570,  520,  541, 1109,
 /*  1110 */    56,   56, 1109, 1489,  423, 1358, 1072,    6,  345,  285,
 /*  1120 */   118,  118,  118,  118,  117,  117,  116,  116,  116,  115,
 /*  1130 */   424,  425, 1271,  321, 1142, 1143, 1144,  878,  266,  266,
 /*  1140 */  1277,  107,  538,  535,    4, 1488,  293,  879, 1211,    6,
 /*  1150 */   210,  543,  543,  164,  294,  496,  416,  204,  541,  267,
 /*  1160 */   267, 1214,  398,  511,  499,  204,  266,  266,  396,  531,
 /*  1170 */     8,  986,  543,  519,  546,  922,  458,  105,  105,  543,
 /*  1180 */  1090,  425,  266,  266,  106,  417,  425,  548,  547,  266,
 /*  1190 */   266,  976,  518,  535, 1373,  543,   15,   15,  266,  266,
 /*  1200 */   456, 1120,  543,  266,  266, 1070, 1372,  515,  290,  537,
 /*  1210 */   546,  543,  514,   97,  444,  316,  543,  546,  922,  125,
 /*  1220 */  1071,  986,  976,  976,  978,  979,   27,  105,  105,  401,
 /*  1230 */   343, 1511,   44,   44,  106, 1072,  425,  548,  547,   57,
 /*  1240 */    57,  976,  343, 1511,  107,  538,  546,    4,  462,  401,
 /*  1250 */   214, 1120,  459,  297,  377, 1091,  534, 1309,  546,  539,
 /*  1260 */   398,  541,  290,  537,  104,  244,  102,  526,   58,   58,
 /*  1270 */   546,  199,  976,  976,  978,  979,   27, 1516, 1131,  427,
 /*  1280 */    59,   59,  270,  237,  425,  138,   95,  375,  375,  374,
 /*  1290 */   255,  372,   60,   60,  817, 1180,  535,  546,  273,  546,
 /*  1300 */  1163, 1308,  389,  388,  546,  438,  546,  215,  210,  296,
 /*  1310 */   515,  849,  546,  265,  208,  516, 1476,  295,  274,   61,
 /*  1320 */    61,   62,   62,  308,  986,  109,   45,   45,   46,   46,
 /*  1330 */   105,  105, 1186,  922,   47,   47,  341,  106,  546,  425,
 /*  1340 */   548,  547, 1542,  546,  976,  867,  340,  217,  546,  937,
 /*  1350 */   397,  107,  538,  218,    4,  156, 1163,  938,  158,  546,
 /*  1360 */    49,   49, 1162,  546,  268,   50,   50,  546,  541, 1450,
 /*  1370 */    63,   63,  546, 1449,  216,  976,  976,  978,  979,   27,
 /*  1380 */   446,   64,   64,  546,  460,   65,   65,  546,  318,   14,
 /*  1390 */    14,  425, 1305,  546,   66,   66, 1087,  546,  141,  379,
 /*  1400 */    38,  546,  963,  535,  322,  127,  127,  546,  393,   67,
 /*  1410 */    67,  546,  325,  290,  537,   52,   52,  515,  546,   68,
 /*  1420 */    68,  845,  514,   69,   69,  399,  165,  857,  856,   53,
 /*  1430 */    53,  986,  311,  151,  151,   97,  432,  105,  105,  327,
 /*  1440 */   152,  152,  526, 1048,  106, 1048,  425,  548,  547, 1131,
 /*  1450 */   427,  976, 1032,  270,  968,  239,  329,  243,  375,  375,
 /*  1460 */   374,  255,  372,  940,  941,  817, 1296,  546,  220,  546,
 /*  1470 */   107,  538,  546,    4,  546, 1256,  199,  845,  215, 1036,
 /*  1480 */   296, 1530,  976,  976,  978,  979,   27,  541,  295,   76,
 /*  1490 */    76,   54,   54,  980,   72,   72,  128,  128,  864,  865,
 /*  1500 */   107,  538,  546,    4, 1047,  546, 1047,  533,  469,  546,
 /*  1510 */   425,  546,  450, 1240,  546,  243,  546,  541,  217,  546,
 /*  1520 */   452,  197,  535,  243,   73,   73,  156,  129,  129,  158,
 /*  1530 */   336,  130,  130,  126,  126, 1036,  150,  150,  149,  149,
 /*  1540 */   425,  134,  134,  317,  474,  216,   97,  239,  331,  980,
 /*  1550 */   986,   97,  535,  346,  347,  546,  105,  105,  902,  931,
 /*  1560 */   546,  895,  243,  106,  109,  425,  548,  547,  546, 1505,
 /*  1570 */   976,  828,   99,  538,  139,    4,  546,  133,  133,  393,
 /*  1580 */   986, 1317,  131,  131,  290,  537,  105,  105, 1357,  541,
 /*  1590 */   132,  132, 1292,  106, 1303,  425,  548,  547,   75,   75,
 /*  1600 */   976,  976,  976,  978,  979,   27,  546,  432,  896, 1289,
 /*  1610 */   532,  109,  425, 1363,  546, 1221, 1213, 1202,  258,  546,
 /*  1620 */   349,  546, 1201,   11,  535, 1203, 1524,  351,   77,   77,
 /*  1630 */   376,  976,  976,  978,  979,   27,   74,   74,  353,  213,
 /*  1640 */   301,   43,   43,   48,   48,  437,  310,  201,  303, 1350,
 /*  1650 */   315,  355,  986,  454,  479, 1239,  339,  192,  105,  105,
 /*  1660 */  1422, 1421,  193,  536,  205,  106, 1527,  425,  548,  547,
 /*  1670 */  1180,  167,  976,  270,  247, 1469, 1467, 1177,  375,  375,
 /*  1680 */   374,  255,  372,  200,  369,  817,  400,   83,   79,   82,
 /*  1690 */  1427,  448,  177,   95, 1342,  161,  169, 1339,  215,  440,
 /*  1700 */   296,  172,  173,  976,  976,  978,  979,   27,  295,  174,
 /*  1710 */   175,  441,  472,  223, 1347,  383,   35,  381,   36,  461,
 /*  1720 */    88, 1353,  181,  447,  384, 1416,  227,  467,  259,  229,
 /*  1730 */   186,  488,  470,  324, 1250,  230,  231,  320,  217, 1204,
 /*  1740 */  1438, 1259,  386, 1258,  413,   90,  156,  849, 1541,  158,
 /*  1750 */   206,  415, 1540,  507, 1300, 1257,   94,  348, 1229, 1301,
 /*  1760 */   387, 1510, 1228,  338, 1227,  216,  350, 1539,  498,  283,
 /*  1770 */   284, 1249,  501, 1299,  352,  245,  246,  418, 1298,  354,
 /*  1780 */  1496, 1495,  124,   10,  526,  363,  101, 1324,  253,   96,
 /*  1790 */   510, 1210,   34,  549, 1137,  254,  256,  257,  166,  393,
 /*  1800 */   550, 1199, 1282,  361,  290,  537, 1281,  196,  367,  368,
 /*  1810 */  1194,  153, 1454,  137,  281, 1323, 1455,  804,  154,  426,
 /*  1820 */   198,  155, 1453, 1452,  292,  212,  202,  432, 1402,  203,
 /*  1830 */   271,  135,  288,   78, 1046, 1044,  960,  168,  157,  881,
 /*  1840 */   170,  219,  309,  222, 1060,  176,  964,  159,  402,   84,
 /*  1850 */   178,  404,   85,   86,   87,  160, 1063,  224,  394,  395,
 /*  1860 */   225, 1059,  146,   18,  226,  319,  243, 1174,  466,  228,
 /*  1870 */  1052,  182,  183,   37,  819,  471,  340,  232,  332,  483,
 /*  1880 */   184,   89,  162,   19,   20,  475,   91,  480,  847,  335,
 /*  1890 */   147,  860,  282,   92,  490,   93, 1125,  148, 1012, 1095,
 /*  1900 */    39,  497, 1096,   40,  500,  262,  207,  264,  930,  187,
 /*  1910 */   925,  109, 1111, 1115, 1113,    7, 1099,  242,   33, 1119,
 /*  1920 */    21,  522,   22,   23,   24, 1118,   25,  190,   97,   26,
 /*  1930 */  1027, 1013, 1011, 1015, 1069, 1016, 1068,  249,  248,   28,
 /*  1940 */    41,  891,  981,  829,  108,   29,  250,  542,  251,  370,
 /*  1950 */   373, 1133, 1132, 1190, 1190, 1190, 1190, 1190, 1190, 1190,
 /*  1960 */  1532, 1531,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */   189,  211,  189,  189,  218,  189,  220,  189,  267,  268,
 /*    10 */   269,  189,  210,  189,  228,  189,  267,  268,  269,   19,
 /*    20 */   218,  189,  211,  212,  211,  212,  211,  211,  212,  211,
 /*    30 */   212,   31,  211,  211,  212,  211,  212,  288,  300,   39,
 /*    40 */    21,  189,  304,   43,   44,   45,   46,   47,   48,   49,







|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







156029
156030
156031
156032
156033
156034
156035
156036
156037
156038
156039
156040
156041
156042
156043
156044
156045
156046
156047
156048
156049
156050
156051
156052
156053
156054
156055
156056
156057
156058
156059
156060
156061
156062
156063
156064
156065
156066
156067
156068
156069
156070
156071
156072
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
156132
156133
156134
156135
156136
156137
156138
156139
156140
156141
156142
156143
156144
156145
156146
156147
156148
156149
156150
156151
156152
156153
156154
156155
156156
156157
156158
156159
156160
156161
156162
156163
156164
156165
156166
156167
156168
156169
156170
156171
156172
156173
156174
156175
156176
156177
156178
156179
156180
156181
156182
156183
156184
156185
156186
156187
156188
156189
156190
156191
156192
156193
156194
156195
156196
156197
156198
156199
156200
156201
156202
156203
156204
156205
156206
156207
156208
156209
156210
156211
156212
156213
156214
156215
156216
156217
156218
156219
156220
156221
156222
156223
156224
156225
156226
156227
156228
156229
156230
156231
156232
156233
156234
156235
156236
156237
156238
156239
156240
156241
**  yy_shift_ofst[]    For each state, the offset into yy_action for
**                     shifting terminals.
**  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 (1968)
static const YYACTIONTYPE yy_action[] = {
 /*     0 */   551, 1229,  551,  456, 1267,  551, 1246,  551,  114,  111,
 /*    10 */   212,  551, 1545,  551, 1267,  528,  114,  111,  212,  396,
 /*    20 */  1239,  348,   42,   42,   42,   42, 1232,   42,   42,   71,
 /*    30 */    71,  943, 1231,   71,   71,   71,   71, 1470, 1501,  944,
 /*    40 */   826,  458,    6,  121,  122,  112, 1172, 1172, 1013, 1016,
 /*    50 */  1006, 1006,  119,  119,  120,  120,  120,  120, 1551,  396,
 /*    60 */  1366, 1525,  557,    2, 1200,  195,  533,  441,  143,  293,
 /*    70 */   533,  136,  533,  375,  262,  509,  273,  389, 1280,  532,
 /*    80 */   508,  498,  165,  121,  122,  112, 1172, 1172, 1013, 1016,
 /*    90 */  1006, 1006,  119,  119,  120,  120,  120,  120, 1366,  447,
 /*   100 */  1522,  118,  118,  118,  118,  117,  117,  116,  116,  116,
 /*   110 */   115,  429,  267,  267,  267,  267, 1506,  362, 1508,  440,
 /*   120 */   361, 1506,  522,  529, 1493,  548, 1121,  548, 1121,  396,
 /*   130 */   410,  242,  209,  114,  111,  212,   98,  292,  542,  222,
 /*   140 */  1036,  118,  118,  118,  118,  117,  117,  116,  116,  116,
 /*   150 */   115,  429, 1149,  121,  122,  112, 1172, 1172, 1013, 1016,
 /*   160 */  1006, 1006,  119,  119,  120,  120,  120,  120,  411,  433,
 /*   170 */   117,  117,  116,  116,  116,  115,  429, 1426,  473,  123,
 /*   180 */   118,  118,  118,  118,  117,  117,  116,  116,  116,  115,
 /*   190 */   429,  116,  116,  116,  115,  429,  545,  545,  545,  396,
 /*   200 */   510,  120,  120,  120,  120,  113, 1058, 1149, 1150, 1151,
 /*   210 */  1058,  118,  118,  118,  118,  117,  117,  116,  116,  116,
 /*   220 */   115,  429, 1469,  121,  122,  112, 1172, 1172, 1013, 1016,
 /*   230 */  1006, 1006,  119,  119,  120,  120,  120,  120,  396,  449,
 /*   240 */   320,   83,  468,   81,  363,  386, 1149,   80,  118,  118,
 /*   250 */   118,  118,  117,  117,  116,  116,  116,  115,  429,  180,
 /*   260 */   439,  429,  121,  122,  112, 1172, 1172, 1013, 1016, 1006,
 /*   270 */  1006,  119,  119,  120,  120,  120,  120,  439,  438,  267,
 /*   280 */   267,  118,  118,  118,  118,  117,  117,  116,  116,  116,
 /*   290 */   115,  429,  548, 1116,  909,  511, 1149,  114,  111,  212,
 /*   300 */  1439, 1149, 1150, 1151,  207,  496, 1116,  396,  454, 1116,
 /*   310 */   550,  334,  120,  120,  120,  120,  300, 1439, 1441,   17,
 /*   320 */   118,  118,  118,  118,  117,  117,  116,  116,  116,  115,
 /*   330 */   429,  121,  122,  112, 1172, 1172, 1013, 1016, 1006, 1006,
 /*   340 */   119,  119,  120,  120,  120,  120,  396, 1366,  439, 1149,
 /*   350 */   487, 1149, 1150, 1151, 1003, 1003, 1014, 1017,  406,  118,
 /*   360 */   118,  118,  118,  117,  117,  116,  116,  116,  115,  429,
 /*   370 */   121,  122,  112, 1172, 1172, 1013, 1016, 1006, 1006,  119,
 /*   380 */   119,  120,  120,  120,  120, 1061, 1061,  470, 1439,  118,
 /*   390 */   118,  118,  118,  117,  117,  116,  116,  116,  115,  429,
 /*   400 */  1149,  456,  551, 1434, 1149, 1150, 1151,  234,  973, 1149,
 /*   410 */   486,  483,  482,  172,  364,  396,  165,  412,  419,  848,
 /*   420 */   481,  165,  186,  338,   71,   71, 1250, 1007,  118,  118,
 /*   430 */   118,  118,  117,  117,  116,  116,  116,  115,  429,  121,
 /*   440 */   122,  112, 1172, 1172, 1013, 1016, 1006, 1006,  119,  119,
 /*   450 */   120,  120,  120,  120,  396, 1149, 1150, 1151,  841,   12,
 /*   460 */   318,  514,  164,  360, 1149, 1150, 1151,  114,  111,  212,
 /*   470 */   513,  292,  542,  551,  277,  181,  292,  542,  121,  122,
 /*   480 */   112, 1172, 1172, 1013, 1016, 1006, 1006,  119,  119,  120,
 /*   490 */   120,  120,  120,  349,  489,   71,   71,  118,  118,  118,
 /*   500 */   118,  117,  117,  116,  116,  116,  115,  429, 1149,  210,
 /*   510 */   416,  528, 1149, 1116, 1579,  382,  253,  270,  346,  492,
 /*   520 */   341,  491,  239,  396,  518,  368, 1116, 1134,  337, 1116,
 /*   530 */   192,  414,  288,   32,  462,  448,  118,  118,  118,  118,
 /*   540 */   117,  117,  116,  116,  116,  115,  429,  121,  122,  112,
 /*   550 */  1172, 1172, 1013, 1016, 1006, 1006,  119,  119,  120,  120,
 /*   560 */   120,  120,  396, 1149, 1150, 1151,  994, 1149, 1150, 1151,
 /*   570 */  1149,  234,  497, 1500,  486,  483,  482,    6,  164,  551,
 /*   580 */   517,  551,  115,  429,  481,    5,  121,  122,  112, 1172,
 /*   590 */  1172, 1013, 1016, 1006, 1006,  119,  119,  120,  120,  120,
 /*   600 */   120,   13,   13,   13,   13,  118,  118,  118,  118,  117,
 /*   610 */   117,  116,  116,  116,  115,  429,  408,  507,  413,  551,
 /*   620 */  1494,  549, 1149,  898,  898, 1149, 1150, 1151, 1481, 1149,
 /*   630 */   276,  396,  814,  815,  816,  978,  427,  427,  427,   16,
 /*   640 */    16,   55,   55, 1249,  118,  118,  118,  118,  117,  117,
 /*   650 */   116,  116,  116,  115,  429,  121,  122,  112, 1172, 1172,
 /*   660 */  1013, 1016, 1006, 1006,  119,  119,  120,  120,  120,  120,
 /*   670 */   396, 1196,    1,    1,  557,    2, 1200, 1149, 1150, 1151,
 /*   680 */   195,  293,  904,  136, 1149, 1150, 1151,  903,  526, 1500,
 /*   690 */  1280,    3,  384,    6,  121,  122,  112, 1172, 1172, 1013,
 /*   700 */  1016, 1006, 1006,  119,  119,  120,  120,  120,  120,  864,
 /*   710 */   551,  930,  551,  118,  118,  118,  118,  117,  117,  116,
 /*   720 */   116,  116,  115,  429,  267,  267, 1099, 1577, 1149,  556,
 /*   730 */  1577, 1200,   13,   13,   13,   13,  293,  548,  136,  396,
 /*   740 */   490,  426,  425,  973,  348, 1280,  473,  415,  865,  281,
 /*   750 */   140,  222,  118,  118,  118,  118,  117,  117,  116,  116,
 /*   760 */   116,  115,  429,  121,  122,  112, 1172, 1172, 1013, 1016,
 /*   770 */  1006, 1006,  119,  119,  120,  120,  120,  120,  551,  267,
 /*   780 */   267,  433,  396, 1149, 1150, 1151, 1179,  836, 1179,  473,
 /*   790 */   436,  145,  548, 1153,  405,  318,  444,  304,  844, 1498,
 /*   800 */    71,   71,  417,    6, 1097,  478,  222,  100,  112, 1172,
 /*   810 */  1172, 1013, 1016, 1006, 1006,  119,  119,  120,  120,  120,
 /*   820 */   120,  118,  118,  118,  118,  117,  117,  116,  116,  116,
 /*   830 */   115,  429,  238, 1433,  551,  456,  433,  289,  993,  551,
 /*   840 */   237,  236,  235,  836,   97,  534,  434, 1272, 1272, 1153,
 /*   850 */   499,  309,  435,  844,  984,  551,   71,   71,  983, 1248,
 /*   860 */   551,   51,   51,  302,  118,  118,  118,  118,  117,  117,
 /*   870 */   116,  116,  116,  115,  429,  195,  103,   70,   70,  267,
 /*   880 */   267,  551,   71,   71,  267,  267,   30,  395,  348,  983,
 /*   890 */   983,  985,  548,  533, 1116,  332,  396,  548,  500,  401,
 /*   900 */   460,  196,  535,   13,   13, 1366,  241, 1116,  278,  282,
 /*   910 */  1116,  282,  306,  462,  308,  337,  396,   31,  189,  424,
 /*   920 */   121,  122,  112, 1172, 1172, 1013, 1016, 1006, 1006,  119,
 /*   930 */   119,  120,  120,  120,  120,  142,  396,  369,  456,  993,
 /*   940 */   121,  122,  112, 1172, 1172, 1013, 1016, 1006, 1006,  119,
 /*   950 */   119,  120,  120,  120,  120,  984,  327, 1149,  330,  983,
 /*   960 */   121,  110,  112, 1172, 1172, 1013, 1016, 1006, 1006,  119,
 /*   970 */   119,  120,  120,  120,  120,  469,  381, 1192,  118,  118,
 /*   980 */   118,  118,  117,  117,  116,  116,  116,  115,  429, 1149,
 /*   990 */   983,  983,  985,  307,    9,  461,  245,  462,  118,  118,
 /*  1000 */   118,  118,  117,  117,  116,  116,  116,  115,  429,  317,
 /*  1010 */   551,  279, 1149, 1150, 1151,  301,  292,  542,  118,  118,
 /*  1020 */   118,  118,  117,  117,  116,  116,  116,  115,  429, 1270,
 /*  1030 */  1270, 1170,   13,   13,  531,  426,  425,  473,  396,  929,
 /*  1040 */   261,  261,   97, 1176, 1149, 1150, 1151,  190, 1178,  267,
 /*  1050 */   267,  473,  138,  548, 1193,  551, 1177,  264,  348,  494,
 /*  1060 */   928,  551,  548,  122,  112, 1172, 1172, 1013, 1016, 1006,
 /*  1070 */  1006,  119,  119,  120,  120,  120,  120,   71,   71, 1149,
 /*  1080 */  1179, 1279, 1179,   13,   13,  904, 1077, 1170,  551,  473,
 /*  1090 */   903,  107,  543,  280,    4, 1275, 1116,  450,  530, 1056,
 /*  1100 */    12, 1078, 1099, 1578,  316,  144, 1578,  525,  546, 1116,
 /*  1110 */    56,   56, 1116, 1499,  428, 1366, 1079,    6,  349,  970,
 /*  1120 */   118,  118,  118,  118,  117,  117,  116,  116,  116,  115,
 /*  1130 */   429,  430, 1278,  325, 1149, 1150, 1151,  884,  267,  267,
 /*  1140 */   855,  107,  543,  540,    4, 1497,  238,  885, 1218,    6,
 /*  1150 */   211,  548,  370,  165,  366,  501,  421, 1496,  546,  268,
 /*  1160 */   268,    6, 1550,  516,  504,  873,  267,  267,  400,  536,
 /*  1170 */     8,  993,  548,  524,  551,  928,  463,  105,  105,  548,
 /*  1180 */  1097,  430,  267,  267,  106,  422,  430,  553,  552,  267,
 /*  1190 */   267,  983,  523,  540, 1381,  548,   15,   15,  267,  267,
 /*  1200 */  1478, 1127,  548,  267,  267, 1077, 1380,  520,  292,  542,
 /*  1210 */   551,  548,  519,  401,  449,  320,  548,  551,  928,  125,
 /*  1220 */  1078,  993,  983,  983,  985,  986,   27,  105,  105,  405,
 /*  1230 */   347, 1519,   44,   44,  106, 1079,  430,  553,  552,   57,
 /*  1240 */    57,  983,  347, 1519,  107,  543,  551,    4,  467,  405,
 /*  1250 */   215, 1127,  464,  295,  381, 1098,  539,  296,  551, 1221,
 /*  1260 */   402,  546,  544,  402,  299,  245,  292,  542,   58,   58,
 /*  1270 */   551, 1284,  983,  983,  985,  986,   27, 1524, 1138,  432,
 /*  1280 */    59,   59,  271,  548,  430,  403,  166,  379,  379,  378,
 /*  1290 */   256,  376,   60,   60,  823, 1187,  540,  551,  274,  551,
 /*  1300 */  1170,  851,  393,  392,  551,  205,  551,  216,  211,  298,
 /*  1310 */   520, 1303,  551,  266,  209,  521, 1316,  297,  275,   61,
 /*  1320 */    61,   62,   62,  451,  993,  205,   45,   45,   46,   46,
 /*  1330 */   105,  105, 1193,  928,   47,   47,  291,  106,  551,  430,
 /*  1340 */   553,  552,  943,  551,  983,  313,  394,  218,  551,  109,
 /*  1350 */   944,  107,  543,  219,    4,  156, 1170,  851,  158,  551,
 /*  1360 */    49,   49,  104,  551,  102,   50,   50,  551,  546, 1315,
 /*  1370 */    63,   63,  551,  443,  217,  983,  983,  985,  986,   27,
 /*  1380 */  1484,   64,   64,  551,  310,   65,   65,  551, 1458,   14,
 /*  1390 */    14,  430, 1457,  551,   66,   66, 1094,  551, 1169,  383,
 /*  1400 */   141,  551,   38,  540,  269,  127,  127,  551,  397,   67,
 /*  1410 */    67,  551,  465,  292,  542,   52,   52,  520,  551,   68,
 /*  1420 */    68, 1043,  519,   69,   69,  315,   95,  322,   97,   53,
 /*  1430 */    53,  993,  975,  151,  151,  244,  437,  105,  105,  200,
 /*  1440 */   152,  152,  455, 1312,  106,  244,  430,  553,  552, 1138,
 /*  1450 */   432,  983,  457,  271,  321,  244,  326,   97,  379,  379,
 /*  1460 */   378,  256,  376,  863,  862,  823,  531,  551,  221,  551,
 /*  1470 */   107,  543,  551,    4,  551,  329,  479, 1043,  216,  240,
 /*  1480 */   298,  331,  983,  983,  985,  986,   27,  546,  297,   76,
 /*  1490 */    76,   54,   54,  333,   72,   72,  128,  128,  870,  871,
 /*  1500 */   107,  543,  551,    4, 1263,  551,  946,  947, 1247,  551,
 /*  1510 */   430,  551,  200, 1055,  551, 1055,  551,  546,  218,  551,
 /*  1520 */   335, 1538,  540,   97,   73,   73,  156,  129,  129,  158,
 /*  1530 */   340,  130,  130,  126,  126,  350,  150,  150,  149,  149,
 /*  1540 */   430,  134,  134,  345, 1039,  217,  937,  240,  901,  244,
 /*  1550 */   993,  109,  540,  344,  987,  551,  105,  105,  908,  351,
 /*  1560 */   551, 1513, 1054,  106, 1054,  430,  553,  552,  551, 1324,
 /*  1570 */   983,  834,   99,  543,  139,    4,  551,  133,  133,  397,
 /*  1580 */   993, 1365,  131,  131,  292,  542,  105,  105, 1299,  546,
 /*  1590 */   132,  132,  287,  106, 1310,  430,  553,  552,   75,   75,
 /*  1600 */   983,  983,  983,  985,  986,   27,  551,  437,  902,  537,
 /*  1610 */   987,  109,  430,  259,  551,  538, 1371, 1228,  474,  551,
 /*  1620 */   198,  551, 1220, 1209,  540, 1208, 1210, 1532,   77,   77,
 /*  1630 */   202,  983,  983,  985,  986,   27,   74,   74, 1296,  353,
 /*  1640 */   355,   43,   43,   48,   48,  357,   11,  380,  214,  343,
 /*  1650 */   303,  442,  993,  312,  305, 1360,  314,  484,  105,  105,
 /*  1660 */   459, 1246,  319,  206, 1430,  106, 1429,  430,  553,  552,
 /*  1670 */   359,  541,  983,  271, 1535, 1187,  168,  248,  379,  379,
 /*  1680 */   378,  256,  376,  201,  193,  823,  373,  194, 1477, 1475,
 /*  1690 */  1184,   79,  404,   82,   83,  453,  178,   95,  216, 1349,
 /*  1700 */   298,  162, 1435,  983,  983,  985,  986,   27,  297, 1354,
 /*  1710 */  1346,   35,  170,  445,  446,  477,  173,  174,  175,  176,
 /*  1720 */   385,  224, 1358, 1361, 1357,  466,  387,   36,  182,  452,
 /*  1730 */   388, 1424,  228,   88,  472,  260,  230, 1446,  218,  187,
 /*  1740 */   475,  328,  231,  390,  324, 1211,  156,  232,  493,  158,
 /*  1750 */   418,   90, 1257, 1266, 1549, 1265, 1264,  855, 1256,  207,
 /*  1760 */   420,  512, 1307, 1548,   94,  217,  352,  391, 1236, 1235,
 /*  1770 */   342, 1234, 1547, 1518,  354,  285,  503,  286,  506,  246,
 /*  1780 */   247, 1504, 1503,  423, 1308,  124,  531, 1306,  356,   10,
 /*  1790 */  1305,  367, 1331,  101,  290,   96,  254,  515, 1217,  397,
 /*  1800 */    34,  554, 1144,  255,  292,  542,  257,  372, 1289,  365,
 /*  1810 */   371,  358, 1288,  197,  258,  555, 1206, 1201, 1462,  153,
 /*  1820 */  1463, 1330, 1461,  154,  137,  283, 1460,  437,  155,  203,
 /*  1830 */   810,  204,   78,  431, 1410,  199,  294,  213,  272,  135,
 /*  1840 */  1053, 1051,  966,  157,  169,  220,  171,  887,  311,  223,
 /*  1850 */  1067,  177,  159,  160,  407,   84,  409,  179,   85,   86,
 /*  1860 */    87,  161, 1070,  225, 1066,  398,  167,  399,   18,  226,
 /*  1870 */   146,  227,  323,  244, 1181,  471,  229, 1059,  183,  184,
 /*  1880 */    37,  825,  344,  476,  233,  336,  488,  480,  185,   89,
 /*  1890 */    19,   20,  485,   92,  853,  339,   91,  163,  866,  147,
 /*  1900 */   284,  495,  502, 1132,  148, 1019,  936, 1102,   39,   93,
 /*  1910 */  1103,   40,  505,  263,  208,  265,  188,  931, 1122,  243,
 /*  1920 */  1126,  109,   33, 1120, 1118,   21, 1106,   22,  527, 1034,
 /*  1930 */    23,   24, 1125,   25,  191,   97,   26, 1020, 1018, 1022,
 /*  1940 */  1076,  250,    7, 1075,  249, 1023,   28,   41,  547,  988,
 /*  1950 */   835,  108,   29,  251,  252, 1540,  374,  897,  377, 1140,
 /*  1960 */  1139, 1197, 1197, 1197, 1197, 1197, 1197, 1539,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */   189,  211,  189,  189,  218,  189,  220,  189,  267,  268,
 /*    10 */   269,  189,  210,  189,  228,  189,  267,  268,  269,   19,
 /*    20 */   218,  189,  211,  212,  211,  212,  211,  211,  212,  211,
 /*    30 */   212,   31,  211,  211,  212,  211,  212,  288,  300,   39,
 /*    40 */    21,  189,  304,   43,   44,   45,   46,   47,   48,   49,
155686
155687
155688
155689
155690
155691
155692
155693
155694
155695
155696
155697
155698
155699
155700
155701
155702
155703
155704
155705
155706
155707
155708
155709
155710
155711
155712
155713
155714
155715
155716
155717
155718
155719
155720
155721
155722
155723
155724
155725
155726
155727
155728
155729
155730
155731
155732
155733
155734
155735
155736
155737
155738
155739
155740
155741
155742
155743
155744
155745
155746
155747
155748
155749
155750
155751
155752
155753
155754
155755
155756
155757
155758
155759
155760
155761
155762
155763
155764
155765
155766
155767
155768
155769
155770
155771
155772
155773
155774
155775
155776
155777
155778
155779
155780
155781
155782
155783
155784
155785
155786
155787

155788
155789
155790
155791
155792
155793
155794
155795
155796
155797
155798
155799
155800
155801
155802
155803
155804
155805
155806
155807
155808
155809
155810
155811
155812
155813
155814
155815
155816
155817
155818
155819
155820
155821
155822
155823
155824
155825
155826
155827
155828
155829
155830
155831
155832
155833
155834
155835
155836
155837
155838
155839
155840
155841
155842
155843
155844
155845
155846
155847
155848
155849
155850
155851
155852
155853
155854
155855
155856
155857
155858
155859
155860
155861
155862
155863
155864
155865
155866
155867
155868
155869
155870
155871
155872
155873
155874
155875
155876
155877
155878
155879
155880
155881
155882
155883
155884
155885
155886
155887
155888
155889
155890
155891
155892
155893
155894
155895
155896
155897
155898
155899
155900
155901
155902
155903
155904
155905
155906
155907
155908
155909
155910
155911
155912
155913
155914
155915
155916
155917
155918
155919
155920
155921
155922
155923
155924
155925
155926
155927
155928
155929
155930
155931
155932
155933
155934
155935
155936
155937
155938
155939
155940
155941
155942
155943
155944
155945
155946
155947
155948
155949
155950
155951
155952
155953
155954
155955
155956
155957
155958
155959
155960
155961
155962
155963
155964
155965
155966
155967
155968
155969
155970
155971
155972
155973
155974
155975
155976
155977
155978
155979
155980
155981
155982
155983
155984
155985
155986
155987
155988
 /*   830 */   110,  111,   46,  233,  189,  189,  291,  248,   99,  189,
 /*   840 */   125,  126,  127,  115,   26,  200,  289,  230,  231,  115,
 /*   850 */   200,   16,  189,  114,  115,  189,  211,  212,  119,  221,
 /*   860 */   189,  211,  212,  258,  101,  102,  103,  104,  105,  106,
 /*   870 */   107,  108,  109,  110,  111,  189,  156,  211,  212,  234,
 /*   880 */   235,  189,  211,  212,  234,  235,   22,  201,  189,  150,
 /*   890 */   151,  152,  247,  248,   76,   16,   19,  247,  248,  113,
 /*   900 */   189,   24,  257,  211,  212,  189,   26,   89,  262,  223,
 /*   910 */    92,  225,   77,  189,   79,  129,   19,   53,  226,  248,
 /*   920 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
 /*   930 */    53,   54,   55,   56,   57,  236,   19,  271,  189,   99,
 /*   940 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
 /*   950 */    53,   54,   55,   56,   57,  115,   77,   59,   79,  119,
 /*   960 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
 /*   970 */    53,   54,   55,   56,   57,  259,   22,   23,  101,  102,
 /*   980 */   103,  104,  105,  106,  107,  108,  109,  110,  111,   59,
 /*   990 */   150,  151,  152,  158,   22,  244,   24,  246,  101,  102,
 /*  1000 */   103,  104,  105,  106,  107,  108,  109,  110,  111,  285,
 /*  1010 */   189,  189,  114,  115,  116,  200,  136,  137,  101,  102,
 /*  1020 */   103,  104,  105,  106,  107,  108,  109,  110,  111,  230,
 /*  1030 */   231,   59,  211,  212,  285,  105,  106,  189,   19,  141,
 /*  1040 */   234,  235,  239,  113,  114,  115,  116,  226,  118,  234,
 /*  1050 */   235,  189,  249,  247,  100,  189,  126,   23,  236,  107,
 /*  1060 */    26,  189,  247,   44,   45,   46,   47,   48,   49,   50,
 /*  1070 */    51,   52,   53,   54,   55,   56,   57,  211,  212,   59,
 /*  1080 */   150,  233,  152,  211,  212,  133,   12,  115,  189,  189,
 /*  1090 */   138,   19,   20,  300,   22,  233,   76,  304,  226,   11,
 /*  1100 */   208,   27,   22,   23,  200,   19,   26,   87,   36,   89,
 /*  1110 */   211,  212,   92,  300,  248,  189,   42,  304,  189,  250,
 /*  1120 */   101,  102,  103,  104,  105,  106,  107,  108,  109,  110,
 /*  1130 */   111,   59,  200,  233,  114,  115,  116,   63,  234,  235,
 /*  1140 */   235,   19,   20,   71,   22,  300,  189,   73,  200,  304,
 /*  1150 */   116,  247,  247,   81,  189,  200,  227,   26,   36,  234,
 /*  1160 */   235,  203,  204,  143,  200,   26,  234,  235,  194,  200,
 /*  1170 */    48,   99,  247,   66,  189,  141,  284,  105,  106,  247,
 /*  1180 */   100,   59,  234,  235,  112,  259,  114,  115,  116,  234,
 /*  1190 */   235,  119,   85,   71,  266,  247,  211,  212,  234,  235,
 /*  1200 */   114,   94,  247,  234,  235,   12,  266,   85,  136,  137,
 /*  1210 */   189,  247,   90,   26,  126,  127,  247,  189,   26,   22,
 /*  1220 */    27,   99,  150,  151,  152,  153,  154,  105,  106,  189,
 /*  1230 */   302,  303,  211,  212,  112,   42,  114,  115,  116,  211,
 /*  1240 */   212,  119,  302,  303,   19,   20,  189,   22,  274,  189,
 /*  1250 */    15,  144,  278,  189,   22,   23,   63,  189,  189,  203,
 /*  1260 */   204,   36,  136,  137,  155,   24,  157,  143,  211,  212,
 /*  1270 */   189,  140,  150,  151,  152,  153,  154,    0,    1,    2,
 /*  1280 */   211,  212,    5,   46,   59,  161,  147,   10,   11,   12,
 /*  1290 */    13,   14,  211,  212,   17,   60,   71,  189,  258,  189,
 /*  1300 */    59,  189,  105,  106,  189,  189,  189,   30,  116,   32,
 /*  1310 */    85,  124,  189,  251,  252,   90,  189,   40,  258,  211,
 /*  1320 */   212,  211,  212,  189,   99,   26,  211,  212,  211,  212,
 /*  1330 */   105,  106,  100,  141,  211,  212,  119,  112,  189,  114,
 /*  1340 */   115,  116,   23,  189,  119,   26,  129,   70,  189,   31,
 /*  1350 */   113,   19,   20,   24,   22,   78,  115,   39,   81,  189,
 /*  1360 */   211,  212,   26,  189,   22,  211,  212,  189,   36,  189,
 /*  1370 */   211,  212,  189,  189,   97,  150,  151,  152,  153,  154,
 /*  1380 */   127,  211,  212,  189,  189,  211,  212,  189,  189,  211,
 /*  1390 */   212,   59,  189,  189,  211,  212,   23,  189,   22,   26,
 /*  1400 */    24,  189,  149,   71,  189,  211,  212,  189,  131,  211,
 /*  1410 */   212,  189,  189,  136,  137,  211,  212,   85,  189,  211,
 /*  1420 */   212,   59,   90,  211,  212,  292,  293,  118,  119,  211,
 /*  1430 */   212,   99,   23,  211,  212,   26,  159,  105,  106,  189,
 /*  1440 */   211,  212,  143,  150,  112,  152,  114,  115,  116,    1,
 /*  1450 */     2,  119,   23,    5,   23,   26,  189,   26,   10,   11,
 /*  1460 */    12,   13,   14,   83,   84,   17,  253,  189,  139,  189,
 /*  1470 */    19,   20,  189,   22,  189,  189,  140,  115,   30,   59,
 /*  1480 */    32,  139,  150,  151,  152,  153,  154,   36,   40,  211,
 /*  1490 */   212,  211,  212,   59,  211,  212,  211,  212,    7,    8,
 /*  1500 */    19,   20,  189,   22,  150,  189,  152,  231,  281,  189,
 /*  1510 */    59,  189,   23,  189,  189,   26,  189,   36,   70,  189,
 /*  1520 */    23,  237,   71,   26,  211,  212,   78,  211,  212,   81,
 /*  1530 */   189,  211,  212,  211,  212,  115,  211,  212,  211,  212,
 /*  1540 */    59,  211,  212,   23,   23,   97,   26,   26,   23,  115,
 /*  1550 */    99,   26,   71,  189,  189,  189,  105,  106,  107,   23,
 /*  1560 */   189,   23,   26,  112,   26,  114,  115,  116,  189,  309,
 /*  1570 */   119,   23,   19,   20,   26,   22,  189,  211,  212,  131,
 /*  1580 */    99,  189,  211,  212,  136,  137,  105,  106,  189,   36,
 /*  1590 */   211,  212,  189,  112,  189,  114,  115,  116,  211,  212,
 /*  1600 */   119,  150,  151,  152,  153,  154,  189,  159,   23,  250,
 /*  1610 */   189,   26,   59,  189,  189,  189,  189,  189,  280,  189,
 /*  1620 */   250,  189,  189,  238,   71,  189,  189,  250,  211,  212,
 /*  1630 */   187,  150,  151,  152,  153,  154,  211,  212,  250,  290,
 /*  1640 */   240,  211,  212,  211,  212,  254,  286,  209,  254,  241,
 /*  1650 */   240,  254,   99,  286,  215,  220,  214,  244,  105,  106,
 /*  1660 */   214,  214,  244,  273,  224,  112,  192,  114,  115,  116,
 /*  1670 */    60,  290,  119,    5,  139,  196,  196,   38,   10,   11,
 /*  1680 */    12,   13,   14,  238,  240,   17,  196,  148,  287,  287,
 /*  1690 */   276,  113,   22,  147,  241,   43,  229,  241,   30,   18,
 /*  1700 */    32,  232,  232,  150,  151,  152,  153,  154,   40,  232,
 /*  1710 */   232,  196,   18,  195,  265,  265,  264,  241,  264,  196,
 /*  1720 */   155,  229,  229,  241,  241,  241,  195,   62,  196,  195,
 /*  1730 */    22,  113,  216,  196,  222,  195,  195,  282,   70,  196,
 /*  1740 */   283,  213,  216,  213,   64,   22,   78,  124,  219,   81,
 /*  1750 */   162,  111,  219,  142,  256,  213,  113,  255,  213,  256,
 /*  1760 */   216,  303,  215,  213,  213,   97,  255,  213,  216,  275,
 /*  1770 */   275,  222,  216,  256,  255,  196,   91,   82,  256,  255,
 /*  1780 */   308,  308,  146,   22,  143,  196,  155,  260,   25,  145,
 /*  1790 */   144,  199,   26,  198,   13,  190,  190,    6,  293,  131,
 /*  1800 */   188,  188,  245,  244,  136,  137,  245,  243,  242,  241,
 /*  1810 */   188,  202,  208,  217,  217,  260,  208,    4,  202,    3,
 /*  1820 */    22,  202,  208,  208,  160,   15,  209,  159,  270,  209,
 /*  1830 */    98,   16,  272,  208,   23,   23,  137,  148,  128,   20,
 /*  1840 */   140,   24,   16,  142,    1,  140,  149,  128,   61,   53,

 /*  1850 */   148,   37,   53,   53,   53,  128,  114,   34,  296,  296,
 /*  1860 */   139,    1,    5,   22,  113,  158,   26,   75,   41,  139,
 /*  1870 */    68,   68,  113,   24,   20,   19,  129,  123,   23,   96,
 /*  1880 */    22,   22,   37,   22,   22,   67,   22,   67,   59,   24,
 /*  1890 */    23,   28,   67,  147,   22,   26,   23,   23,   23,   23,
 /*  1900 */    22,   24,   23,   22,   24,   23,  139,   23,  114,   22,
 /*  1910 */   141,   26,   88,   75,   86,   44,   23,   34,   22,   75,
 /*  1920 */    34,   24,   34,   34,   34,   93,   34,   26,   26,   34,
 /*  1930 */    23,   23,   23,   23,   23,   11,   23,   22,   26,   22,
 /*  1940 */    22,  133,   23,   23,   22,   22,  139,   26,  139,   23,
 /*  1950 */    15,    1,    1,  310,  310,  310,  310,  310,  310,  310,
 /*  1960 */   139,  139,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  1970 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  1980 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  1990 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2000 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2010 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2020 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2030 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2040 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2050 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2060 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2070 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2080 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2090 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2100 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2110 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2120 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2130 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2140 */   310,  310,  310,
};
#define YY_SHIFT_COUNT    (552)
#define YY_SHIFT_MIN      (0)
#define YY_SHIFT_MAX      (1951)
static const unsigned short int yy_shift_ofst[] = {
 /*     0 */  1448, 1277, 1668, 1072, 1072,  340, 1122, 1225, 1332, 1481,
 /*    10 */  1481, 1481,  335,    0,    0,  180,  897, 1481, 1481, 1481,
 /*    20 */  1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
 /*    30 */   930,  930, 1020, 1020,  290,    1,  340,  340,  340,  340,
 /*    40 */   340,  340,   40,  110,  219,  288,  327,  396,  435,  504,
 /*    50 */   543,  612,  651,  720,  877,  897,  897,  897,  897,  897,
 /*    60 */   897,  897,  897,  897,  897,  897,  897,  897,  897,  897,
 /*    70 */   897,  897,  897,  917,  897, 1019,  763,  763, 1451, 1481,
 /*    80 */  1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
 /*    90 */  1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
 /*   100 */  1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
 /*   110 */  1481, 1481, 1553, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
 /*   120 */  1481, 1481, 1481, 1481, 1481, 1481,  147,  258,  258,  258,
 /*   130 */   258,  258,   79,   65,   84,  449,   19,  786,  449,  636,
 /*   140 */   636,  449,  880,  880,  880,  880,  113,  142,  142,  472,
 /*   150 */   150, 1962, 1962,  399,  399,  399,   93,  237,  341,  237,
 /*   160 */   237, 1074, 1074,  437,  350,  704, 1080,  449,  449,  449,
 /*   170 */   449,  449,  449,  449,  449,  449,  449,  449,  449,  449,
 /*   180 */   449,  449,  449,  449,  449,  449,  449,  449,  818,  818,
 /*   190 */   449, 1088,  217,  217,  734,  734, 1124, 1126, 1962, 1962,
 /*   200 */  1962,  739,  840,  840,  453,  454,  511,  187,  563,  570,
 /*   210 */   898,  669,  449,  449,  449,  449,  449,  449,  449,  449,
 /*   220 */   449,  670,  449,  449,  449,  449,  449,  449,  449,  449,
 /*   230 */   449,  449,  449,  449,  674,  674,  674,  449,  449,  449,
 /*   240 */   449, 1034,  449,  449,  449,  972, 1107,  449,  449, 1193,
 /*   250 */   449,  449,  449,  449,  449,  449,  449,  449,  260,  177,
 /*   260 */   489, 1241, 1241, 1241, 1241, 1192,  489,  489,  952, 1197,
 /*   270 */   625, 1235, 1131,  181,  181, 1086, 1139, 1131, 1086, 1187,
 /*   280 */  1319, 1237, 1318, 1318, 1318,  181, 1299, 1299, 1109, 1336,
 /*   290 */   549, 1376, 1610, 1535, 1535, 1639, 1639, 1535, 1539, 1578,
 /*   300 */  1670, 1546, 1652, 1546, 1681, 1681, 1681, 1681, 1535, 1694,
 /*   310 */  1546, 1546, 1578, 1670, 1652, 1546, 1652, 1546, 1535, 1694,
 /*   320 */  1565, 1665, 1535, 1694, 1708, 1535, 1694, 1535, 1694, 1708,
 /*   330 */  1618, 1618, 1618, 1680, 1723, 1723, 1708, 1618, 1623, 1618,
 /*   340 */  1680, 1618, 1618, 1588, 1708, 1640, 1640, 1708, 1611, 1643,
 /*   350 */  1611, 1643, 1611, 1643, 1611, 1643, 1535, 1685, 1685, 1695,
 /*   360 */  1695, 1636, 1641, 1761, 1535, 1631, 1636, 1644, 1646, 1546,
 /*   370 */  1763, 1766, 1781, 1781, 1791, 1791, 1791, 1962, 1962, 1962,
 /*   380 */  1962, 1962, 1962, 1962, 1962, 1962, 1962, 1962, 1962, 1962,
 /*   390 */  1962, 1962,  308,  835,  954, 1232,  879,  715,  728, 1373,
 /*   400 */   864, 1329, 1253, 1409,  297, 1431, 1489, 1497, 1520, 1521,
 /*   410 */  1525, 1362, 1309, 1491, 1217, 1420, 1429, 1536, 1380, 1538,
 /*   420 */  1293, 1354, 1548, 1585, 1434, 1342, 1813, 1816, 1798, 1664,
 /*   430 */  1810, 1732, 1815, 1811, 1812, 1699, 1689, 1710, 1817, 1700,
 /*   440 */  1819, 1701, 1826, 1843, 1705, 1697, 1719, 1787, 1814, 1702,
 /*   450 */  1796, 1799, 1800, 1801, 1727, 1742, 1823, 1721, 1860, 1857,
 /*   460 */  1841, 1751, 1707, 1802, 1840, 1803, 1792, 1827, 1730, 1759,
 /*   470 */  1849, 1854, 1856, 1747, 1754, 1858, 1818, 1859, 1861, 1855,
 /*   480 */  1862, 1820, 1829, 1865, 1783, 1863, 1864, 1825, 1845, 1867,
 /*   490 */  1746, 1872, 1873, 1874, 1875, 1869, 1876, 1878, 1877, 1879,
 /*   500 */  1881, 1880, 1767, 1882, 1884, 1794, 1883, 1887, 1769, 1885,
 /*   510 */  1886, 1888, 1889, 1890, 1824, 1838, 1828, 1871, 1844, 1832,
 /*   520 */  1892, 1893, 1896, 1897, 1901, 1902, 1895, 1907, 1885, 1908,
 /*   530 */  1909, 1910, 1911, 1912, 1913, 1915, 1924, 1917, 1918, 1919,
 /*   540 */  1920, 1922, 1923, 1921, 1808, 1807, 1809, 1821, 1822, 1926,
 /*   550 */  1935, 1950, 1951,
};
#define YY_REDUCE_COUNT (391)
#define YY_REDUCE_MIN   (-262)
#define YY_REDUCE_MAX   (1625)
static const short yy_reduce_ofst[] = {
 /*     0 */   490, -122,  545,  645,  650, -120, -189, -187, -184, -182,
 /*    10 */  -178, -176,   45,   30,  200, -251, -134,  390,  392,  521,
 /*    20 */   523,  213,  692,  821,  284,  589,  872,  666,  671,  866,
 /*    30 */    71,  111,  273,  389,  686,  815,  904,  932,  948,  955,
 /*    40 */   964,  969, -259, -259, -259, -259, -259, -259, -259, -259,
 /*    50 */  -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,
 /*    60 */  -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,
 /*    70 */  -259, -259, -259, -259, -259, -259, -259, -259,  428,  430,
 /*    80 */   899,  985, 1021, 1028, 1057, 1069, 1081, 1108, 1110, 1115,
 /*    90 */  1117, 1123, 1149, 1154, 1159, 1170, 1174, 1178, 1183, 1194,
 /*   100 */  1198, 1204, 1208, 1212, 1218, 1222, 1229, 1278, 1280, 1283,
 /*   110 */  1285, 1313, 1316, 1320, 1322, 1325, 1327, 1330, 1366, 1371,
 /*   120 */  1379, 1387, 1417, 1425, 1430, 1432, -259, -259, -259, -259,
 /*   130 */  -259, -259, -259, -259, -259,  557,  974, -214, -174,   -9,
 /*   140 */   431, -124,  806,  925,  806,  925,  251,  928,  940, -259,
 /*   150 */  -259, -259, -259, -198, -198, -198,  127, -186, -168,  212,
 /*   160 */   646,  617,  799, -262,  555,  220,  220,  491,  605, 1040,
 /*   170 */  1060,  699,  -11,  600,  848,  862,  345, -129,  724,  -91,
 /*   180 */   158,  749,  716,  900,  304,  822,  929,  926,  499,  793,
 /*   190 */   322,  892,  813,  845,  958, 1056,  751,  905, 1133, 1062,
 /*   200 */   803, -210, -185, -179, -148, -167,  -89,  121,  274,  281,
 /*   210 */   320,  336,  439,  663,  711,  957,  965, 1064, 1068, 1112,
 /*   220 */  1116, -196, 1127, 1134, 1180, 1184, 1195, 1199, 1203, 1215,
 /*   230 */  1223, 1250, 1267, 1286,  205,  422,  638, 1324, 1341, 1364,
 /*   240 */  1365, 1213, 1392, 1399, 1403,  869, 1260, 1405, 1421, 1276,
 /*   250 */  1424,  121, 1426, 1427, 1428, 1433, 1436, 1437, 1227, 1338,
 /*   260 */  1284, 1359, 1370, 1377, 1388, 1213, 1284, 1284, 1385, 1438,
 /*   270 */  1443, 1349, 1400, 1391, 1394, 1360, 1408, 1410, 1367, 1439,
 /*   280 */  1440, 1435, 1442, 1446, 1447, 1397, 1413, 1418, 1390, 1444,
 /*   290 */  1445, 1474, 1381, 1479, 1480, 1401, 1402, 1490, 1414, 1449,
 /*   300 */  1452, 1453, 1467, 1456, 1469, 1470, 1477, 1478, 1515, 1518,
 /*   310 */  1476, 1482, 1450, 1454, 1492, 1483, 1493, 1484, 1523, 1531,
 /*   320 */  1457, 1455, 1532, 1534, 1516, 1537, 1540, 1543, 1541, 1526,
 /*   330 */  1528, 1530, 1542, 1512, 1529, 1533, 1544, 1545, 1547, 1550,
 /*   340 */  1549, 1551, 1554, 1458, 1552, 1494, 1495, 1556, 1498, 1502,
 /*   350 */  1503, 1511, 1517, 1519, 1522, 1524, 1579, 1472, 1473, 1527,
 /*   360 */  1555, 1557, 1559, 1558, 1589, 1560, 1561, 1564, 1566, 1568,
 /*   370 */  1592, 1595, 1605, 1606, 1612, 1613, 1622, 1562, 1563, 1505,
 /*   380 */  1609, 1604, 1608, 1614, 1615, 1616, 1596, 1597, 1617, 1620,
 /*   390 */  1625, 1619,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */  1575, 1575, 1575, 1411, 1188, 1297, 1188, 1188, 1188, 1411,
 /*    10 */  1411, 1411, 1188, 1327, 1327, 1464, 1219, 1188, 1188, 1188,
 /*    20 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1410, 1188, 1188,
 /*    30 */  1188, 1188, 1494, 1494, 1188, 1188, 1188, 1188, 1188, 1188,
 /*    40 */  1188, 1188, 1188, 1336, 1188, 1188, 1188, 1188, 1188, 1188,
 /*    50 */  1412, 1413, 1188, 1188, 1188, 1463, 1465, 1428, 1346, 1345,
 /*    60 */  1344, 1343, 1446, 1314, 1341, 1334, 1338, 1406, 1407, 1405,
 /*    70 */  1409, 1413, 1412, 1188, 1337, 1377, 1391, 1376, 1188, 1188,
 /*    80 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*    90 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   100 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   110 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   120 */  1188, 1188, 1188, 1188, 1188, 1188, 1385, 1390, 1396, 1389,
 /*   130 */  1386, 1379, 1378, 1380, 1381, 1188, 1209, 1261, 1188, 1188,
 /*   140 */  1188, 1188, 1482, 1481, 1188, 1188, 1219, 1371, 1370, 1382,
 /*   150 */  1383, 1393, 1392, 1471, 1529, 1528, 1429, 1188, 1188, 1188,
 /*   160 */  1188, 1188, 1188, 1494, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   170 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   180 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1494, 1494,
 /*   190 */  1188, 1219, 1494, 1494, 1215, 1215, 1321, 1188, 1477, 1297,
 /*   200 */  1288, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   210 */  1188, 1188, 1188, 1188, 1188, 1468, 1466, 1188, 1188, 1188,
 /*   220 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   230 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   240 */  1188, 1188, 1188, 1188, 1188, 1293, 1188, 1188, 1188, 1188,
 /*   250 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1523, 1188, 1441,
 /*   260 */  1275, 1293, 1293, 1293, 1293, 1295, 1276, 1274, 1287, 1220,
 /*   270 */  1195, 1567, 1294, 1316, 1316, 1564, 1340, 1294, 1564, 1236,
 /*   280 */  1545, 1231, 1327, 1327, 1327, 1316, 1321, 1321, 1408, 1294,
 /*   290 */  1287, 1188, 1567, 1302, 1302, 1566, 1566, 1302, 1429, 1349,
 /*   300 */  1355, 1340, 1264, 1340, 1270, 1270, 1270, 1270, 1302, 1206,
 /*   310 */  1340, 1340, 1349, 1355, 1264, 1340, 1264, 1340, 1302, 1206,
 /*   320 */  1445, 1561, 1302, 1206, 1419, 1302, 1206, 1302, 1206, 1419,
 /*   330 */  1262, 1262, 1262, 1251, 1188, 1188, 1419, 1262, 1236, 1262,
 /*   340 */  1251, 1262, 1262, 1512, 1419, 1423, 1423, 1419, 1320, 1315,
 /*   350 */  1320, 1315, 1320, 1315, 1320, 1315, 1302, 1504, 1504, 1330,
 /*   360 */  1330, 1335, 1321, 1414, 1302, 1188, 1335, 1333, 1331, 1340,
 /*   370 */  1212, 1254, 1526, 1526, 1522, 1522, 1522, 1572, 1572, 1477,
 /*   380 */  1538, 1219, 1219, 1219, 1219, 1538, 1238, 1238, 1220, 1220,
 /*   390 */  1219, 1538, 1188, 1188, 1188, 1188, 1188, 1188, 1533, 1188,
 /*   400 */  1430, 1306, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   410 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   420 */  1188, 1188, 1188, 1188, 1188, 1360, 1188, 1191, 1474, 1188,
 /*   430 */  1188, 1472, 1188, 1188, 1188, 1188, 1188, 1188, 1307, 1188,
 /*   440 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   450 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1563, 1188, 1188,
 /*   460 */  1188, 1188, 1188, 1188, 1444, 1443, 1188, 1188, 1304, 1188,
 /*   470 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   480 */  1188, 1188, 1234, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   490 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   500 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1332,
 /*   510 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   520 */  1188, 1188, 1188, 1188, 1509, 1322, 1188, 1188, 1554, 1188,
 /*   530 */  1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188, 1188,
 /*   540 */  1188, 1188, 1188, 1549, 1278, 1362, 1188, 1361, 1365, 1188,
 /*   550 */  1200, 1188, 1188,
};
/********** 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.







|








|

|

|
|
|



|
|
|


|
|
|



|
|




|
|
|

|
|
|
|
|
|
|

|
|
|

|
|
|

|
|
|
|
|
|
|
|
|
|
|


|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
<

















|

|

|
















|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|

|

















|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|


|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







156320
156321
156322
156323
156324
156325
156326
156327
156328
156329
156330
156331
156332
156333
156334
156335
156336
156337
156338
156339
156340
156341
156342
156343
156344
156345
156346
156347
156348
156349
156350
156351
156352
156353
156354
156355
156356
156357
156358
156359
156360
156361
156362
156363
156364
156365
156366
156367
156368
156369
156370
156371
156372
156373
156374
156375
156376
156377
156378
156379
156380
156381
156382
156383
156384
156385
156386
156387
156388
156389
156390
156391
156392
156393
156394
156395
156396
156397
156398
156399
156400
156401
156402
156403
156404
156405
156406
156407
156408
156409
156410
156411
156412
156413
156414
156415
156416
156417
156418
156419
156420
156421
156422
156423
156424
156425
156426
156427
156428
156429
156430
156431
156432
156433

156434
156435
156436
156437
156438
156439
156440
156441
156442
156443
156444
156445
156446
156447
156448
156449
156450
156451
156452
156453
156454
156455
156456
156457
156458
156459
156460
156461
156462
156463
156464
156465
156466
156467
156468
156469
156470
156471
156472
156473
156474
156475
156476
156477
156478
156479
156480
156481
156482
156483
156484
156485
156486
156487
156488
156489
156490
156491
156492
156493
156494
156495
156496
156497
156498
156499
156500
156501
156502
156503
156504
156505
156506
156507
156508
156509
156510
156511
156512
156513
156514
156515
156516
156517
156518
156519
156520
156521
156522
156523
156524
156525
156526
156527
156528
156529
156530
156531
156532
156533
156534
156535
156536
156537
156538
156539
156540
156541
156542
156543
156544
156545
156546
156547
156548
156549
156550
156551
156552
156553
156554
156555
156556
156557
156558
156559
156560
156561
156562
156563
156564
156565
156566
156567
156568
156569
156570
156571
156572
156573
156574
156575
156576
156577
156578
156579
156580
156581
156582
156583
156584
156585
156586
156587
156588
156589
156590
156591
156592
156593
156594
156595
156596
156597
156598
156599
156600
156601
156602
156603
156604
156605
156606
156607
156608
156609
156610
156611
156612
156613
156614
156615
156616
156617
156618
156619
156620
156621
156622
 /*   830 */   110,  111,   46,  233,  189,  189,  291,  248,   99,  189,
 /*   840 */   125,  126,  127,  115,   26,  200,  289,  230,  231,  115,
 /*   850 */   200,   16,  189,  114,  115,  189,  211,  212,  119,  221,
 /*   860 */   189,  211,  212,  258,  101,  102,  103,  104,  105,  106,
 /*   870 */   107,  108,  109,  110,  111,  189,  156,  211,  212,  234,
 /*   880 */   235,  189,  211,  212,  234,  235,   22,  201,  189,  150,
 /*   890 */   151,  152,  247,  248,   76,   16,   19,  247,  248,  113,
 /*   900 */    19,   24,  257,  211,  212,  189,   26,   89,  262,  223,
 /*   910 */    92,  225,   77,  189,   79,  129,   19,   53,  226,  248,
 /*   920 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
 /*   930 */    53,   54,   55,   56,   57,  236,   19,  271,  189,   99,
 /*   940 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
 /*   950 */    53,   54,   55,   56,   57,  115,   77,   59,   79,  119,
 /*   960 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,
 /*   970 */    53,   54,   55,   56,   57,  259,   22,   23,  101,  102,
 /*   980 */   103,  104,  105,  106,  107,  108,  109,  110,  111,   59,
 /*   990 */   150,  151,  152,  158,   22,  114,   24,  189,  101,  102,
 /*  1000 */   103,  104,  105,  106,  107,  108,  109,  110,  111,  285,
 /*  1010 */   189,  262,  114,  115,  116,  200,  136,  137,  101,  102,
 /*  1020 */   103,  104,  105,  106,  107,  108,  109,  110,  111,  230,
 /*  1030 */   231,   59,  211,  212,  143,  105,  106,  189,   19,  141,
 /*  1040 */   234,  235,   26,  113,  114,  115,  116,  226,  118,  234,
 /*  1050 */   235,  189,  161,  247,  100,  189,  126,   23,  189,  107,
 /*  1060 */    26,  189,  247,   44,   45,   46,   47,   48,   49,   50,
 /*  1070 */    51,   52,   53,   54,   55,   56,   57,  211,  212,   59,
 /*  1080 */   150,  233,  152,  211,  212,  133,   12,  115,  189,  189,
 /*  1090 */   138,   19,   20,  285,   22,  233,   76,  127,  226,   11,
 /*  1100 */   208,   27,   22,   23,  200,  236,   26,   87,   36,   89,
 /*  1110 */   211,  212,   92,  300,  248,  189,   42,  304,  189,  149,
 /*  1120 */   101,  102,  103,  104,  105,  106,  107,  108,  109,  110,
 /*  1130 */   111,   59,  200,  233,  114,  115,  116,   63,  234,  235,
 /*  1140 */   124,   19,   20,   71,   22,  300,   46,   73,  200,  304,
 /*  1150 */   116,  247,  244,   81,  246,  200,  227,  300,   36,  234,
 /*  1160 */   235,  304,   23,  143,  200,   26,  234,  235,  194,  200,
 /*  1170 */    48,   99,  247,   66,  189,  141,  284,  105,  106,  247,
 /*  1180 */   100,   59,  234,  235,  112,  259,  114,  115,  116,  234,
 /*  1190 */   235,  119,   85,   71,  266,  247,  211,  212,  234,  235,
 /*  1200 */   189,   94,  247,  234,  235,   12,  266,   85,  136,  137,
 /*  1210 */   189,  247,   90,  113,  126,  127,  247,  189,   26,   22,
 /*  1220 */    27,   99,  150,  151,  152,  153,  154,  105,  106,  189,
 /*  1230 */   302,  303,  211,  212,  112,   42,  114,  115,  116,  211,
 /*  1240 */   212,  119,  302,  303,   19,   20,  189,   22,  274,  189,
 /*  1250 */    15,  144,  278,  189,   22,   23,   63,  189,  189,  203,
 /*  1260 */   204,   36,  203,  204,  189,   24,  136,  137,  211,  212,
 /*  1270 */   189,  235,  150,  151,  152,  153,  154,    0,    1,    2,
 /*  1280 */   211,  212,    5,  247,   59,  292,  293,   10,   11,   12,
 /*  1290 */    13,   14,  211,  212,   17,   60,   71,  189,  258,  189,
 /*  1300 */    59,   59,  105,  106,  189,   26,  189,   30,  116,   32,
 /*  1310 */    85,  253,  189,  251,  252,   90,  189,   40,  258,  211,
 /*  1320 */   212,  211,  212,  127,   99,   26,  211,  212,  211,  212,
 /*  1330 */   105,  106,  100,  141,  211,  212,  239,  112,  189,  114,
 /*  1340 */   115,  116,   31,  189,  119,  149,  249,   70,  189,   26,
 /*  1350 */    39,   19,   20,   24,   22,   78,  115,  115,   81,  189,
 /*  1360 */   211,  212,  155,  189,  157,  211,  212,  189,   36,  189,
 /*  1370 */   211,  212,  189,  189,   97,  150,  151,  152,  153,  154,
 /*  1380 */   189,  211,  212,  189,  189,  211,  212,  189,  189,  211,
 /*  1390 */   212,   59,  189,  189,  211,  212,   23,  189,   26,   26,
 /*  1400 */    22,  189,   24,   71,   22,  211,  212,  189,  131,  211,
 /*  1410 */   212,  189,  189,  136,  137,  211,  212,   85,  189,  211,
 /*  1420 */   212,   59,   90,  211,  212,   23,  147,  189,   26,  211,
 /*  1430 */   212,   99,   23,  211,  212,   26,  159,  105,  106,  140,
 /*  1440 */   211,  212,   23,  189,  112,   26,  114,  115,  116,    1,
 /*  1450 */     2,  119,   23,    5,   23,   26,  189,   26,   10,   11,
 /*  1460 */    12,   13,   14,  118,  119,   17,  143,  189,  139,  189,
 /*  1470 */    19,   20,  189,   22,  189,  189,   23,  115,   30,   26,
 /*  1480 */    32,  189,  150,  151,  152,  153,  154,   36,   40,  211,
 /*  1490 */   212,  211,  212,  189,  211,  212,  211,  212,    7,    8,
 /*  1500 */    19,   20,  189,   22,  189,  189,   83,   84,  189,  189,
 /*  1510 */    59,  189,  140,  150,  189,  152,  189,   36,   70,  189,
 /*  1520 */    23,  139,   71,   26,  211,  212,   78,  211,  212,   81,
 /*  1530 */   189,  211,  212,  211,  212,  189,  211,  212,  211,  212,
 /*  1540 */    59,  211,  212,  119,   23,   97,   23,   26,   23,   26,
 /*  1550 */    99,   26,   71,  129,   59,  189,  105,  106,  107,  189,
 /*  1560 */   189,  309,  150,  112,  152,  114,  115,  116,  189,  189,
 /*  1570 */   119,   23,   19,   20,   26,   22,  189,  211,  212,  131,
 /*  1580 */    99,  189,  211,  212,  136,  137,  105,  106,  189,   36,
 /*  1590 */   211,  212,  250,  112,  189,  114,  115,  116,  211,  212,
 /*  1600 */   119,  150,  151,  152,  153,  154,  189,  159,   23,  189,
 /*  1610 */   115,   26,   59,  280,  189,  231,  189,  189,  281,  189,
 /*  1620 */   237,  189,  189,  189,   71,  189,  189,  189,  211,  212,
 /*  1630 */   209,  150,  151,  152,  153,  154,  211,  212,  250,  250,
 /*  1640 */   250,  211,  212,  211,  212,  250,  238,  187,  290,  214,
 /*  1650 */   240,  254,   99,  286,  254,  241,  241,  215,  105,  106,
 /*  1660 */   286,  220,  240,  224,  214,  112,  214,  114,  115,  116,
 /*  1670 */   254,  273,  119,    5,  192,   60,  290,  139,   10,   11,
 /*  1680 */    12,   13,   14,  238,  244,   17,  240,  244,  196,  196,
 /*  1690 */    38,  287,  196,  287,  148,  113,   22,  147,   30,  241,
 /*  1700 */    32,   43,  276,  150,  151,  152,  153,  154,   40,  265,
 /*  1710 */   241,  264,  229,   18,  196,   18,  232,  232,  232,  232,
 /*  1720 */   241,  195,  265,  229,  265,  196,  265,  264,  229,  241,
 /*  1730 */   241,  241,  195,  155,   62,  196,  195,  283,   70,   22,
 /*  1740 */   216,  196,  195,  216,  282,  196,   78,  195,  113,   81,
 /*  1750 */    64,   22,  222,  213,  219,  213,  213,  124,  222,  162,
 /*  1760 */   111,  142,  256,  219,  113,   97,  255,  216,  213,  215,
 /*  1770 */   213,  213,  213,  303,  255,  275,  216,  275,  216,  196,
 /*  1780 */    91,  308,  308,   82,  256,  146,  143,  256,  255,   22,
 /*  1790 */   256,  196,  260,  155,  272,  145,   25,  144,  199,  131,
 /*  1800 */    26,  198,   13,  190,  136,  137,  190,  241,  245,  244,
 /*  1810 */   242,  255,  245,  243,    6,  188,  188,  188,  208,  202,
 /*  1820 */   208,  260,  208,  202,  217,  217,  208,  159,  202,  209,
 /*  1830 */     4,  209,  208,    3,  270,   22,  160,   15,   98,   16,
 /*  1840 */    23,   23,  137,  128,  148,   24,  140,   20,   16,  142,
 /*  1850 */     1,  140,  128,  128,   61,   53,   37,  148,   53,   53,
 /*  1860 */    53,  128,  114,   34,    1,  296,  293,  296,   22,  139,
 /*  1870 */     5,  113,  158,   26,   75,   41,  139,   68,   68,  113,
 /*  1880 */    24,   20,  129,   19,  123,   23,   96,   67,   22,   22,
 /*  1890 */    22,   22,   67,  147,   59,   24,   22,   37,   28,   23,
 /*  1900 */    67,   22,   24,   23,   23,   23,  114,   23,   22,   26,
 /*  1910 */    23,   22,   24,   23,  139,   23,   22,  141,   75,   34,
 /*  1920 */    75,   26,   22,   86,   88,   34,   23,   34,   24,   23,
 /*  1930 */    34,   34,   93,   34,   26,   26,   34,   23,   23,   23,
 /*  1940 */    23,   22,   44,   23,   26,   11,   22,   22,   26,   23,
 /*  1950 */    23,   22,   22,  139,  139,  139,   23,  133,   15,    1,
 /*  1960 */     1,  310,  310,  310,  310,  310,  310,  139,  310,  310,

 /*  1970 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  1980 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  1990 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2000 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2010 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2020 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2030 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2040 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2050 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2060 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2070 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2080 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2090 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2100 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2110 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2120 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2130 */   310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
 /*  2140 */   310,  310,  310,  310,  310,  310,  310,  310,  310,
};
#define YY_SHIFT_COUNT    (557)
#define YY_SHIFT_MIN      (0)
#define YY_SHIFT_MAX      (1959)
static const unsigned short int yy_shift_ofst[] = {
 /*     0 */  1448, 1277, 1668, 1072, 1072,  340, 1122, 1225, 1332, 1481,
 /*    10 */  1481, 1481,  335,    0,    0,  180,  897, 1481, 1481, 1481,
 /*    20 */  1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
 /*    30 */   930,  930, 1020, 1020,  290,    1,  340,  340,  340,  340,
 /*    40 */   340,  340,   40,  110,  219,  288,  327,  396,  435,  504,
 /*    50 */   543,  612,  651,  720,  877,  897,  897,  897,  897,  897,
 /*    60 */   897,  897,  897,  897,  897,  897,  897,  897,  897,  897,
 /*    70 */   897,  897,  897,  917,  897, 1019,  763,  763, 1451, 1481,
 /*    80 */  1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
 /*    90 */  1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
 /*   100 */  1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
 /*   110 */  1481, 1481, 1553, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
 /*   120 */  1481, 1481, 1481, 1481, 1481, 1481,  147,  258,  258,  258,
 /*   130 */   258,  258,   79,   65,   84,  449,   19,  786,  449,  636,
 /*   140 */   636,  449,  880,  880,  880,  880,  113,  142,  142,  472,
 /*   150 */   150, 1968, 1968,  399,  399,  399,   93,  237,  341,  237,
 /*   160 */   237,  237, 1074, 1074,  437,  350,  704, 1080,  449,  449,
 /*   170 */   449,  449,  449,  449,  449,  449,  449,  449,  449,  449,
 /*   180 */   449,  449,  449,  449,  449,  449,  449,  449,  449,  818,
 /*   190 */   818,  449, 1088,  217,  217,  734,  734,  891, 1130, 1968,
 /*   200 */  1968, 1968,  739,  840,  840,  453,  454,  511,  187,  563,
 /*   210 */   570,  898,  669,  449,  449,  449,  449,  449,  449,  449,
 /*   220 */   449,  449,  670,  449,  449,  449,  449,  449,  449,  449,
 /*   230 */   449,  449,  449,  449,  449,  674,  674,  674,  449,  449,
 /*   240 */   449,  449, 1034,  449,  449,  449,  972, 1107,  449,  449,
 /*   250 */  1193,  449,  449,  449,  449,  449,  449,  449,  449,  260,
 /*   260 */   177,  489, 1241, 1241, 1241, 1241, 1192,  489,  489,  952,
 /*   270 */  1197,  625, 1235, 1299,  181,  181,  881, 1279, 1279, 1299,
 /*   280 */   881, 1016, 1139, 1100, 1311, 1311, 1311,  181, 1323, 1323,
 /*   290 */  1207, 1372,  549, 1378, 1615, 1538, 1538, 1652, 1652, 1538,
 /*   300 */  1546, 1582, 1674, 1550, 1658, 1550, 1695, 1695, 1695, 1695,
 /*   310 */  1538, 1697, 1550, 1582, 1582, 1550, 1582, 1674, 1658, 1550,
 /*   320 */  1658, 1550, 1538, 1697, 1578, 1672, 1538, 1697, 1717, 1538,
 /*   330 */  1697, 1538, 1697, 1717, 1635, 1635, 1635, 1686, 1729, 1729,
 /*   340 */  1717, 1635, 1633, 1635, 1686, 1635, 1635, 1597, 1717, 1649,
 /*   350 */  1649, 1717, 1619, 1651, 1619, 1651, 1619, 1651, 1619, 1651,
 /*   360 */  1538, 1689, 1689, 1701, 1701, 1639, 1643, 1767, 1538, 1638,
 /*   370 */  1639, 1650, 1653, 1550, 1771, 1774, 1789, 1789, 1808, 1808,
 /*   380 */  1808, 1968, 1968, 1968, 1968, 1968, 1968, 1968, 1968, 1968,
 /*   390 */  1968, 1968, 1968, 1968, 1968, 1968,  308,  835,  954, 1232,
 /*   400 */   879,  715,  728, 1373,  864, 1329,  970, 1196, 1402,  297,
 /*   410 */  1409, 1419, 1429, 1431, 1453, 1497, 1242, 1345, 1491, 1424,
 /*   420 */  1362, 1521, 1523, 1423, 1525, 1363, 1412, 1548, 1585, 1495,
 /*   430 */  1382, 1826, 1830, 1813, 1676, 1822, 1740, 1823, 1817, 1818,
 /*   440 */  1705, 1696, 1715, 1821, 1706, 1827, 1707, 1832, 1849, 1711,
 /*   450 */  1724, 1725, 1793, 1819, 1709, 1802, 1805, 1806, 1807, 1733,
 /*   460 */  1748, 1829, 1730, 1863, 1865, 1846, 1758, 1714, 1809, 1847,
 /*   470 */  1810, 1799, 1834, 1737, 1766, 1856, 1861, 1864, 1753, 1761,
 /*   480 */  1866, 1820, 1867, 1868, 1862, 1869, 1825, 1835, 1871, 1790,
 /*   490 */  1870, 1874, 1833, 1860, 1876, 1746, 1879, 1880, 1881, 1882,
 /*   500 */  1883, 1884, 1886, 1878, 1887, 1889, 1888, 1775, 1890, 1892,
 /*   510 */  1792, 1885, 1894, 1776, 1895, 1891, 1893, 1896, 1897, 1836,
 /*   520 */  1843, 1837, 1898, 1845, 1839, 1899, 1903, 1900, 1904, 1908,
 /*   530 */  1909, 1902, 1906, 1895, 1914, 1915, 1916, 1917, 1918, 1920,
 /*   540 */  1919, 1934, 1924, 1925, 1926, 1927, 1929, 1930, 1922, 1824,
 /*   550 */  1814, 1815, 1816, 1828, 1933, 1943, 1958, 1959,
};
#define YY_REDUCE_COUNT (395)
#define YY_REDUCE_MIN   (-262)
#define YY_REDUCE_MAX   (1629)
static const short yy_reduce_ofst[] = {
 /*     0 */   490, -122,  545,  645,  650, -120, -189, -187, -184, -182,
 /*    10 */  -178, -176,   45,   30,  200, -251, -134,  390,  392,  521,
 /*    20 */   523,  213,  692,  821,  284,  589,  872,  666,  671,  866,
 /*    30 */    71,  111,  273,  389,  686,  815,  904,  932,  948,  955,
 /*    40 */   964,  969, -259, -259, -259, -259, -259, -259, -259, -259,
 /*    50 */  -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,
 /*    60 */  -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,
 /*    70 */  -259, -259, -259, -259, -259, -259, -259, -259,  428,  430,
 /*    80 */   899,  985, 1021, 1028, 1057, 1069, 1081, 1108, 1110, 1115,
 /*    90 */  1117, 1123, 1149, 1154, 1159, 1170, 1174, 1178, 1183, 1194,
 /*   100 */  1198, 1204, 1208, 1212, 1218, 1222, 1229, 1278, 1280, 1283,
 /*   110 */  1285, 1313, 1316, 1320, 1322, 1325, 1327, 1330, 1366, 1371,
 /*   120 */  1379, 1387, 1417, 1425, 1430, 1432, -259, -259, -259, -259,
 /*   130 */  -259, -259, -259, -259, -259,  557,  974, -214, -174,   -9,
 /*   140 */   431, -124,  806,  925,  806,  925,  251,  928,  940, -259,
 /*   150 */  -259, -259, -259, -198, -198, -198,  127, -186, -168,  212,
 /*   160 */   646,  749,  617,  799, -262,  555,  220,  220,  491,  605,
 /*   170 */  1040, 1060,  699,  -11,  600,  848,  862,  345, -129,  724,
 /*   180 */   -91,  158,  808,  716,  900,  304,  869,  929,  926,  499,
 /*   190 */   813,  322,  892,  845,  857, 1056, 1059,  908, 1036,  993,
 /*   200 */  1062, 1097, -210, -185, -179, -148, -167,  -89,  121,  274,
 /*   210 */   281,  320,  336,  439,  663, 1011, 1064, 1068, 1075, 1127,
 /*   220 */  1180, 1184, -196, 1191, 1195, 1199, 1203, 1223, 1238, 1254,
 /*   230 */  1267, 1286, 1292, 1304, 1315,  205,  422,  638, 1319, 1341,
 /*   240 */  1346, 1370, 1058, 1380, 1392, 1399, 1342, 1252, 1405, 1420,
 /*   250 */  1384, 1427,  121, 1428, 1433, 1434, 1436, 1437, 1438, 1337,
 /*   260 */  1333, 1383, 1388, 1389, 1390, 1395, 1058, 1383, 1383, 1408,
 /*   270 */  1421, 1460, 1358, 1410, 1397, 1400, 1367, 1414, 1415, 1422,
 /*   280 */  1374, 1442, 1439, 1441, 1435, 1450, 1452, 1416, 1440, 1443,
 /*   290 */  1398, 1446, 1445, 1482, 1386, 1492, 1493, 1404, 1406, 1496,
 /*   300 */  1426, 1444, 1447, 1458, 1483, 1469, 1484, 1485, 1486, 1487,
 /*   310 */  1518, 1526, 1479, 1457, 1459, 1488, 1461, 1463, 1494, 1489,
 /*   320 */  1499, 1490, 1529, 1537, 1454, 1462, 1539, 1541, 1524, 1545,
 /*   330 */  1547, 1549, 1552, 1527, 1540, 1542, 1543, 1530, 1535, 1544,
 /*   340 */  1551, 1555, 1554, 1557, 1536, 1558, 1559, 1470, 1560, 1500,
 /*   350 */  1502, 1562, 1506, 1511, 1528, 1519, 1531, 1533, 1534, 1556,
 /*   360 */  1583, 1473, 1474, 1532, 1561, 1563, 1565, 1564, 1595, 1522,
 /*   370 */  1567, 1570, 1568, 1566, 1599, 1603, 1613, 1616, 1627, 1628,
 /*   380 */  1629, 1569, 1571, 1573, 1617, 1610, 1612, 1614, 1618, 1621,
 /*   390 */  1607, 1608, 1620, 1622, 1624, 1626,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */  1583, 1583, 1583, 1419, 1195, 1304, 1195, 1195, 1195, 1419,
 /*    10 */  1419, 1419, 1195, 1334, 1334, 1472, 1226, 1195, 1195, 1195,
 /*    20 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1418, 1195, 1195,
 /*    30 */  1195, 1195, 1502, 1502, 1195, 1195, 1195, 1195, 1195, 1195,
 /*    40 */  1195, 1195, 1195, 1343, 1195, 1195, 1195, 1195, 1195, 1195,
 /*    50 */  1420, 1421, 1195, 1195, 1195, 1471, 1473, 1436, 1353, 1352,
 /*    60 */  1351, 1350, 1454, 1321, 1348, 1341, 1345, 1414, 1415, 1413,
 /*    70 */  1417, 1421, 1420, 1195, 1344, 1385, 1399, 1384, 1195, 1195,
 /*    80 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*    90 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   100 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   110 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   120 */  1195, 1195, 1195, 1195, 1195, 1195, 1393, 1398, 1404, 1397,
 /*   130 */  1394, 1387, 1386, 1388, 1389, 1195, 1216, 1268, 1195, 1195,
 /*   140 */  1195, 1195, 1490, 1489, 1195, 1195, 1226, 1379, 1378, 1390,
 /*   150 */  1391, 1401, 1400, 1479, 1537, 1536, 1437, 1195, 1195, 1195,
 /*   160 */  1195, 1195, 1195, 1195, 1502, 1195, 1195, 1195, 1195, 1195,
 /*   170 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   180 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1502,
 /*   190 */  1502, 1195, 1226, 1502, 1502, 1222, 1222, 1328, 1195, 1485,
 /*   200 */  1304, 1295, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   210 */  1195, 1195, 1195, 1195, 1195, 1195, 1476, 1474, 1195, 1195,
 /*   220 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   230 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   240 */  1195, 1195, 1195, 1195, 1195, 1195, 1300, 1195, 1195, 1195,
 /*   250 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1531, 1195,
 /*   260 */  1449, 1282, 1300, 1300, 1300, 1300, 1302, 1283, 1281, 1294,
 /*   270 */  1227, 1202, 1575, 1301, 1323, 1323, 1572, 1347, 1347, 1301,
 /*   280 */  1572, 1243, 1553, 1238, 1334, 1334, 1334, 1323, 1328, 1328,
 /*   290 */  1416, 1301, 1294, 1195, 1575, 1309, 1309, 1574, 1574, 1309,
 /*   300 */  1437, 1356, 1363, 1347, 1271, 1347, 1277, 1277, 1277, 1277,
 /*   310 */  1309, 1213, 1347, 1356, 1356, 1347, 1356, 1363, 1271, 1347,
 /*   320 */  1271, 1347, 1309, 1213, 1453, 1569, 1309, 1213, 1427, 1309,
 /*   330 */  1213, 1309, 1213, 1427, 1269, 1269, 1269, 1258, 1195, 1195,
 /*   340 */  1427, 1269, 1243, 1269, 1258, 1269, 1269, 1520, 1427, 1431,
 /*   350 */  1431, 1427, 1327, 1322, 1327, 1322, 1327, 1322, 1327, 1322,
 /*   360 */  1309, 1512, 1512, 1337, 1337, 1342, 1328, 1422, 1309, 1195,
 /*   370 */  1342, 1340, 1338, 1347, 1219, 1261, 1534, 1534, 1530, 1530,
 /*   380 */  1530, 1580, 1580, 1485, 1546, 1226, 1226, 1226, 1226, 1546,
 /*   390 */  1245, 1245, 1227, 1227, 1226, 1546, 1195, 1195, 1195, 1195,
 /*   400 */  1195, 1195, 1541, 1195, 1438, 1313, 1195, 1195, 1195, 1195,
 /*   410 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   420 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   430 */  1368, 1195, 1198, 1482, 1195, 1195, 1480, 1195, 1195, 1195,
 /*   440 */  1195, 1195, 1195, 1314, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   450 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   460 */  1195, 1195, 1571, 1195, 1195, 1195, 1195, 1195, 1195, 1452,
 /*   470 */  1451, 1195, 1195, 1311, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   480 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1241, 1195, 1195,
 /*   490 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   500 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   510 */  1195, 1195, 1195, 1195, 1339, 1195, 1195, 1195, 1195, 1195,
 /*   520 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1517,
 /*   530 */  1329, 1195, 1195, 1562, 1195, 1195, 1195, 1195, 1195, 1195,
 /*   540 */  1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1557, 1285,
 /*   550 */  1370, 1195, 1369, 1373, 1195, 1207, 1195, 1195,
};
/********** 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.
156739
156740
156741
156742
156743
156744
156745
156746
156747
156748
156749
156750
156751
156752
156753
156754
156755
156756
156757
156758
156759
156760
156761
156762

156763
156764
156765
156766
156767
156768
156769
156770
156771
156772
156773
156774
156775
156776
156777
156778
156779
156780
156781
156782
156783
156784
156785
156786
156787
156788
156789

156790
156791
156792
156793
156794
156795
156796
156797
156798
156799
156800
156801
156802
156803
156804
156805
156806

156807
156808
156809
156810
156811
156812
156813
156814
156815
156816
156817
156818
156819
156820
156821
156822
156823
156824
156825
156826
156827
156828
156829
156830

156831
156832
156833
156834
156835
156836
156837
156838
156839
156840

156841
156842
156843
156844
156845
156846
156847
156848
156849
156850
156851
156852
156853
156854
156855
156856
156857
156858
156859
156860
156861
156862
156863
156864
156865

156866
156867
156868
156869
156870
156871
156872
156873
156874
156875
156876
156877
156878
156879
156880
156881
156882
156883
156884
156885
156886
156887
156888
156889

156890
156891
156892
156893
156894
156895
156896
156897
156898
156899
156900
156901
156902
156903
156904
156905
156906
156907
156908
156909
156910
156911
156912
156913
156914
156915
156916
156917
156918
156919
156920

156921
156922
156923
156924
156925
156926
156927
156928
156929
156930
156931
156932
156933
156934
156935
156936
156937
156938
156939
156940
156941
156942
156943
156944
156945
156946
156947
156948
156949
156950
156951
156952
156953
156954
156955

156956
156957
156958
156959
156960
156961
156962
156963
156964
156965
156966
156967
156968
156969
156970
156971
156972
156973
156974
156975
156976
156977
156978
 /* 152 */ "setlist ::= setlist COMMA nm EQ expr",
 /* 153 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
 /* 154 */ "setlist ::= nm EQ expr",
 /* 155 */ "setlist ::= LP idlist RP EQ expr",
 /* 156 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
 /* 157 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
 /* 158 */ "upsert ::=",
 /* 159 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
 /* 160 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
 /* 161 */ "upsert ::= ON CONFLICT DO NOTHING",
 /* 162 */ "insert_cmd ::= INSERT orconf",
 /* 163 */ "insert_cmd ::= REPLACE",
 /* 164 */ "idlist_opt ::=",
 /* 165 */ "idlist_opt ::= LP idlist RP",
 /* 166 */ "idlist ::= idlist COMMA nm",
 /* 167 */ "idlist ::= nm",
 /* 168 */ "expr ::= LP expr RP",
 /* 169 */ "expr ::= ID|INDEXED",
 /* 170 */ "expr ::= JOIN_KW",
 /* 171 */ "expr ::= nm DOT nm",
 /* 172 */ "expr ::= nm DOT nm DOT nm",
 /* 173 */ "term ::= NULL|FLOAT|BLOB",
 /* 174 */ "term ::= STRING",
 /* 175 */ "term ::= INTEGER",

 /* 176 */ "expr ::= VARIABLE",
 /* 177 */ "expr ::= expr COLLATE ID|STRING",
 /* 178 */ "expr ::= CAST LP expr AS typetoken RP",
 /* 179 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
 /* 180 */ "expr ::= ID|INDEXED LP STAR RP",
 /* 181 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
 /* 182 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
 /* 183 */ "term ::= CTIME_KW",
 /* 184 */ "expr ::= LP nexprlist COMMA expr RP",
 /* 185 */ "expr ::= expr AND expr",
 /* 186 */ "expr ::= expr OR expr",
 /* 187 */ "expr ::= expr LT|GT|GE|LE expr",
 /* 188 */ "expr ::= expr EQ|NE expr",
 /* 189 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
 /* 190 */ "expr ::= expr PLUS|MINUS expr",
 /* 191 */ "expr ::= expr STAR|SLASH|REM expr",
 /* 192 */ "expr ::= expr CONCAT expr",
 /* 193 */ "likeop ::= NOT LIKE_KW|MATCH",
 /* 194 */ "expr ::= expr likeop expr",
 /* 195 */ "expr ::= expr likeop expr ESCAPE expr",
 /* 196 */ "expr ::= expr ISNULL|NOTNULL",
 /* 197 */ "expr ::= expr NOT NULL",
 /* 198 */ "expr ::= expr IS expr",
 /* 199 */ "expr ::= expr IS NOT expr",
 /* 200 */ "expr ::= NOT expr",
 /* 201 */ "expr ::= BITNOT expr",
 /* 202 */ "expr ::= PLUS|MINUS expr",

 /* 203 */ "between_op ::= BETWEEN",
 /* 204 */ "between_op ::= NOT BETWEEN",
 /* 205 */ "expr ::= expr between_op expr AND expr",
 /* 206 */ "in_op ::= IN",
 /* 207 */ "in_op ::= NOT IN",
 /* 208 */ "expr ::= expr in_op LP exprlist RP",
 /* 209 */ "expr ::= LP select RP",
 /* 210 */ "expr ::= expr in_op LP select RP",
 /* 211 */ "expr ::= expr in_op nm dbnm paren_exprlist",
 /* 212 */ "expr ::= EXISTS LP select RP",
 /* 213 */ "expr ::= CASE case_operand case_exprlist case_else END",
 /* 214 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
 /* 215 */ "case_exprlist ::= WHEN expr THEN expr",
 /* 216 */ "case_else ::= ELSE expr",
 /* 217 */ "case_else ::=",
 /* 218 */ "case_operand ::= expr",
 /* 219 */ "case_operand ::=",

 /* 220 */ "exprlist ::=",
 /* 221 */ "nexprlist ::= nexprlist COMMA expr",
 /* 222 */ "nexprlist ::= expr",
 /* 223 */ "paren_exprlist ::=",
 /* 224 */ "paren_exprlist ::= LP exprlist RP",
 /* 225 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
 /* 226 */ "uniqueflag ::= UNIQUE",
 /* 227 */ "uniqueflag ::=",
 /* 228 */ "eidlist_opt ::=",
 /* 229 */ "eidlist_opt ::= LP eidlist RP",
 /* 230 */ "eidlist ::= eidlist COMMA nm collate sortorder",
 /* 231 */ "eidlist ::= nm collate sortorder",
 /* 232 */ "collate ::=",
 /* 233 */ "collate ::= COLLATE ID|STRING",
 /* 234 */ "cmd ::= DROP INDEX ifexists fullname",
 /* 235 */ "cmd ::= VACUUM vinto",
 /* 236 */ "cmd ::= VACUUM nm vinto",
 /* 237 */ "vinto ::= INTO expr",
 /* 238 */ "vinto ::=",
 /* 239 */ "cmd ::= PRAGMA nm dbnm",
 /* 240 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
 /* 241 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
 /* 242 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
 /* 243 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",

 /* 244 */ "plus_num ::= PLUS INTEGER|FLOAT",
 /* 245 */ "minus_num ::= MINUS INTEGER|FLOAT",
 /* 246 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
 /* 247 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
 /* 248 */ "trigger_time ::= BEFORE|AFTER",
 /* 249 */ "trigger_time ::= INSTEAD OF",
 /* 250 */ "trigger_time ::=",
 /* 251 */ "trigger_event ::= DELETE|INSERT",
 /* 252 */ "trigger_event ::= UPDATE",
 /* 253 */ "trigger_event ::= UPDATE OF idlist",

 /* 254 */ "when_clause ::=",
 /* 255 */ "when_clause ::= WHEN expr",
 /* 256 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
 /* 257 */ "trigger_cmd_list ::= trigger_cmd SEMI",
 /* 258 */ "trnm ::= nm DOT nm",
 /* 259 */ "tridxby ::= INDEXED BY nm",
 /* 260 */ "tridxby ::= NOT INDEXED",
 /* 261 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
 /* 262 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
 /* 263 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
 /* 264 */ "trigger_cmd ::= scanpt select scanpt",
 /* 265 */ "expr ::= RAISE LP IGNORE RP",
 /* 266 */ "expr ::= RAISE LP raisetype COMMA nm RP",
 /* 267 */ "raisetype ::= ROLLBACK",
 /* 268 */ "raisetype ::= ABORT",
 /* 269 */ "raisetype ::= FAIL",
 /* 270 */ "cmd ::= DROP TRIGGER ifexists fullname",
 /* 271 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
 /* 272 */ "cmd ::= DETACH database_kw_opt expr",
 /* 273 */ "key_opt ::=",
 /* 274 */ "key_opt ::= KEY expr",
 /* 275 */ "cmd ::= REINDEX",
 /* 276 */ "cmd ::= REINDEX nm dbnm",
 /* 277 */ "cmd ::= ANALYZE",
 /* 278 */ "cmd ::= ANALYZE nm dbnm",

 /* 279 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
 /* 280 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
 /* 281 */ "add_column_fullname ::= fullname",
 /* 282 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
 /* 283 */ "cmd ::= create_vtab",
 /* 284 */ "cmd ::= create_vtab LP vtabarglist RP",
 /* 285 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
 /* 286 */ "vtabarg ::=",
 /* 287 */ "vtabargtoken ::= ANY",
 /* 288 */ "vtabargtoken ::= lp anylist RP",
 /* 289 */ "lp ::= LP",
 /* 290 */ "with ::= WITH wqlist",
 /* 291 */ "with ::= WITH RECURSIVE wqlist",
 /* 292 */ "wqlist ::= nm eidlist_opt AS LP select RP",
 /* 293 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
 /* 294 */ "windowdefn_list ::= windowdefn",
 /* 295 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
 /* 296 */ "windowdefn ::= nm AS LP window RP",
 /* 297 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
 /* 298 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
 /* 299 */ "window ::= ORDER BY sortlist frame_opt",
 /* 300 */ "window ::= nm ORDER BY sortlist frame_opt",
 /* 301 */ "window ::= frame_opt",
 /* 302 */ "window ::= nm frame_opt",

 /* 303 */ "frame_opt ::=",
 /* 304 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
 /* 305 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
 /* 306 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
 /* 307 */ "frame_bound_s ::= frame_bound",
 /* 308 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
 /* 309 */ "frame_bound_e ::= frame_bound",
 /* 310 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
 /* 311 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
 /* 312 */ "frame_bound ::= CURRENT ROW",
 /* 313 */ "frame_exclude_opt ::=",
 /* 314 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
 /* 315 */ "frame_exclude ::= NO OTHERS",
 /* 316 */ "frame_exclude ::= CURRENT ROW",
 /* 317 */ "frame_exclude ::= GROUP|TIES",
 /* 318 */ "window_clause ::= WINDOW windowdefn_list",
 /* 319 */ "filter_over ::= filter_clause over_clause",
 /* 320 */ "filter_over ::= over_clause",
 /* 321 */ "filter_over ::= filter_clause",
 /* 322 */ "over_clause ::= OVER LP window RP",
 /* 323 */ "over_clause ::= OVER nm",
 /* 324 */ "filter_clause ::= FILTER LP WHERE expr RP",
 /* 325 */ "input ::= cmdlist",
 /* 326 */ "cmdlist ::= cmdlist ecmd",
 /* 327 */ "cmdlist ::= ecmd",
 /* 328 */ "ecmd ::= SEMI",
 /* 329 */ "ecmd ::= cmdx SEMI",
 /* 330 */ "ecmd ::= explain cmdx SEMI",
 /* 331 */ "trans_opt ::=",
 /* 332 */ "trans_opt ::= TRANSACTION",
 /* 333 */ "trans_opt ::= TRANSACTION nm",

 /* 334 */ "savepoint_opt ::= SAVEPOINT",
 /* 335 */ "savepoint_opt ::=",
 /* 336 */ "cmd ::= create_table create_table_args",
 /* 337 */ "columnlist ::= columnlist COMMA columnname carglist",
 /* 338 */ "columnlist ::= columnname carglist",
 /* 339 */ "nm ::= ID|INDEXED",
 /* 340 */ "nm ::= STRING",
 /* 341 */ "nm ::= JOIN_KW",
 /* 342 */ "typetoken ::= typename",
 /* 343 */ "typename ::= ID|STRING",
 /* 344 */ "signed ::= plus_num",
 /* 345 */ "signed ::= minus_num",
 /* 346 */ "carglist ::= carglist ccons",
 /* 347 */ "carglist ::=",
 /* 348 */ "ccons ::= NULL onconf",
 /* 349 */ "ccons ::= GENERATED ALWAYS AS generated",
 /* 350 */ "ccons ::= AS generated",
 /* 351 */ "conslist_opt ::= COMMA conslist",
 /* 352 */ "conslist ::= conslist tconscomma tcons",
 /* 353 */ "conslist ::= tcons",
 /* 354 */ "tconscomma ::=",
 /* 355 */ "defer_subclause_opt ::= defer_subclause",
 /* 356 */ "resolvetype ::= raisetype",
 /* 357 */ "selectnowith ::= oneselect",
 /* 358 */ "oneselect ::= values",
 /* 359 */ "sclp ::= selcollist COMMA",
 /* 360 */ "as ::= ID|STRING",
 /* 361 */ "expr ::= term",
 /* 362 */ "likeop ::= LIKE_KW|MATCH",
 /* 363 */ "exprlist ::= nexprlist",
 /* 364 */ "nmnum ::= plus_num",
 /* 365 */ "nmnum ::= nm",
 /* 366 */ "nmnum ::= ON",
 /* 367 */ "nmnum ::= DELETE",
 /* 368 */ "nmnum ::= DEFAULT",

 /* 369 */ "plus_num ::= INTEGER|FLOAT",
 /* 370 */ "foreach_clause ::=",
 /* 371 */ "foreach_clause ::= FOR EACH ROW",
 /* 372 */ "trnm ::= nm",
 /* 373 */ "tridxby ::=",
 /* 374 */ "database_kw_opt ::= DATABASE",
 /* 375 */ "database_kw_opt ::=",
 /* 376 */ "kwcolumn_opt ::=",
 /* 377 */ "kwcolumn_opt ::= COLUMNKW",
 /* 378 */ "vtabarglist ::= vtabarg",
 /* 379 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
 /* 380 */ "vtabarg ::= vtabarg vtabargtoken",
 /* 381 */ "anylist ::=",
 /* 382 */ "anylist ::= anylist LP anylist RP",
 /* 383 */ "anylist ::= anylist ANY",
 /* 384 */ "with ::=",
};
#endif /* NDEBUG */


#if YYSTACKDEPTH<=0
/*
** Try to increase the size of the parser stack.  Return the number







|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
|
>
|
|
|
|
<
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







157373
157374
157375
157376
157377
157378
157379
157380
157381
157382
157383
157384
157385
157386
157387
157388
157389
157390
157391
157392
157393
157394
157395
157396
157397
157398
157399
157400
157401
157402
157403
157404
157405
157406
157407
157408
157409
157410
157411
157412
157413
157414
157415

157416
157417
157418
157419
157420
157421
157422
157423
157424
157425
157426
157427
157428
157429
157430
157431
157432
157433
157434
157435
157436
157437

157438
157439
157440
157441
157442
157443
157444
157445
157446
157447
157448
157449
157450
157451
157452
157453
157454
157455
157456
157457
157458

157459
157460
157461
157462
157463
157464
157465
157466
157467
157468
157469

157470
157471
157472
157473
157474
157475
157476
157477
157478
157479
157480
157481
157482
157483
157484
157485
157486
157487
157488
157489
157490
157491
157492
157493
157494

157495
157496
157497
157498
157499
157500
157501
157502
157503
157504
157505
157506
157507
157508
157509
157510
157511
157512
157513
157514
157515
157516
157517
157518
157519
157520
157521
157522

157523
157524
157525
157526
157527
157528
157529
157530
157531
157532
157533
157534
157535
157536
157537
157538
157539
157540
157541
157542
157543
157544
157545
157546
157547
157548
157549

157550
157551
157552
157553
157554
157555
157556
157557
157558
157559
157560
157561
157562
157563
157564
157565
157566
157567
157568
157569
157570
157571
157572
157573
157574
157575
157576
157577
157578
157579
157580
157581
157582
157583
157584
157585

157586
157587
157588
157589
157590
157591
157592
157593
157594
157595
157596
157597
157598
157599
157600
157601
157602
157603
157604
157605
157606
157607
157608
157609
157610
157611
157612
157613
 /* 152 */ "setlist ::= setlist COMMA nm EQ expr",
 /* 153 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
 /* 154 */ "setlist ::= nm EQ expr",
 /* 155 */ "setlist ::= LP idlist RP EQ expr",
 /* 156 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
 /* 157 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
 /* 158 */ "upsert ::=",
 /* 159 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert",
 /* 160 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert",
 /* 161 */ "upsert ::= ON CONFLICT DO NOTHING",
 /* 162 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt",
 /* 163 */ "insert_cmd ::= INSERT orconf",
 /* 164 */ "insert_cmd ::= REPLACE",
 /* 165 */ "idlist_opt ::=",
 /* 166 */ "idlist_opt ::= LP idlist RP",
 /* 167 */ "idlist ::= idlist COMMA nm",
 /* 168 */ "idlist ::= nm",
 /* 169 */ "expr ::= LP expr RP",
 /* 170 */ "expr ::= ID|INDEXED",
 /* 171 */ "expr ::= JOIN_KW",
 /* 172 */ "expr ::= nm DOT nm",
 /* 173 */ "expr ::= nm DOT nm DOT nm",
 /* 174 */ "term ::= NULL|FLOAT|BLOB",
 /* 175 */ "term ::= STRING",
 /* 176 */ "term ::= INTEGER",
 /* 177 */ "expr ::= VARIABLE",
 /* 178 */ "expr ::= expr COLLATE ID|STRING",
 /* 179 */ "expr ::= CAST LP expr AS typetoken RP",
 /* 180 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
 /* 181 */ "expr ::= ID|INDEXED LP STAR RP",
 /* 182 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
 /* 183 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
 /* 184 */ "term ::= CTIME_KW",
 /* 185 */ "expr ::= LP nexprlist COMMA expr RP",
 /* 186 */ "expr ::= expr AND expr",
 /* 187 */ "expr ::= expr OR expr",
 /* 188 */ "expr ::= expr LT|GT|GE|LE expr",
 /* 189 */ "expr ::= expr EQ|NE expr",
 /* 190 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
 /* 191 */ "expr ::= expr PLUS|MINUS expr",
 /* 192 */ "expr ::= expr STAR|SLASH|REM expr",
 /* 193 */ "expr ::= expr CONCAT expr",
 /* 194 */ "likeop ::= NOT LIKE_KW|MATCH",

 /* 195 */ "expr ::= expr likeop expr",
 /* 196 */ "expr ::= expr likeop expr ESCAPE expr",
 /* 197 */ "expr ::= expr ISNULL|NOTNULL",
 /* 198 */ "expr ::= expr NOT NULL",
 /* 199 */ "expr ::= expr IS expr",
 /* 200 */ "expr ::= expr IS NOT expr",
 /* 201 */ "expr ::= NOT expr",
 /* 202 */ "expr ::= BITNOT expr",
 /* 203 */ "expr ::= PLUS|MINUS expr",
 /* 204 */ "between_op ::= BETWEEN",
 /* 205 */ "between_op ::= NOT BETWEEN",
 /* 206 */ "expr ::= expr between_op expr AND expr",
 /* 207 */ "in_op ::= IN",
 /* 208 */ "in_op ::= NOT IN",
 /* 209 */ "expr ::= expr in_op LP exprlist RP",
 /* 210 */ "expr ::= LP select RP",
 /* 211 */ "expr ::= expr in_op LP select RP",
 /* 212 */ "expr ::= expr in_op nm dbnm paren_exprlist",
 /* 213 */ "expr ::= EXISTS LP select RP",
 /* 214 */ "expr ::= CASE case_operand case_exprlist case_else END",
 /* 215 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
 /* 216 */ "case_exprlist ::= WHEN expr THEN expr",

 /* 217 */ "case_else ::= ELSE expr",
 /* 218 */ "case_else ::=",
 /* 219 */ "case_operand ::= expr",
 /* 220 */ "case_operand ::=",
 /* 221 */ "exprlist ::=",
 /* 222 */ "nexprlist ::= nexprlist COMMA expr",
 /* 223 */ "nexprlist ::= expr",
 /* 224 */ "paren_exprlist ::=",
 /* 225 */ "paren_exprlist ::= LP exprlist RP",
 /* 226 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
 /* 227 */ "uniqueflag ::= UNIQUE",
 /* 228 */ "uniqueflag ::=",
 /* 229 */ "eidlist_opt ::=",
 /* 230 */ "eidlist_opt ::= LP eidlist RP",
 /* 231 */ "eidlist ::= eidlist COMMA nm collate sortorder",
 /* 232 */ "eidlist ::= nm collate sortorder",
 /* 233 */ "collate ::=",
 /* 234 */ "collate ::= COLLATE ID|STRING",
 /* 235 */ "cmd ::= DROP INDEX ifexists fullname",
 /* 236 */ "cmd ::= VACUUM vinto",
 /* 237 */ "cmd ::= VACUUM nm vinto",

 /* 238 */ "vinto ::= INTO expr",
 /* 239 */ "vinto ::=",
 /* 240 */ "cmd ::= PRAGMA nm dbnm",
 /* 241 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
 /* 242 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
 /* 243 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
 /* 244 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
 /* 245 */ "plus_num ::= PLUS INTEGER|FLOAT",
 /* 246 */ "minus_num ::= MINUS INTEGER|FLOAT",
 /* 247 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
 /* 248 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",

 /* 249 */ "trigger_time ::= BEFORE|AFTER",
 /* 250 */ "trigger_time ::= INSTEAD OF",
 /* 251 */ "trigger_time ::=",
 /* 252 */ "trigger_event ::= DELETE|INSERT",
 /* 253 */ "trigger_event ::= UPDATE",
 /* 254 */ "trigger_event ::= UPDATE OF idlist",
 /* 255 */ "when_clause ::=",
 /* 256 */ "when_clause ::= WHEN expr",
 /* 257 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
 /* 258 */ "trigger_cmd_list ::= trigger_cmd SEMI",
 /* 259 */ "trnm ::= nm DOT nm",
 /* 260 */ "tridxby ::= INDEXED BY nm",
 /* 261 */ "tridxby ::= NOT INDEXED",
 /* 262 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
 /* 263 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
 /* 264 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
 /* 265 */ "trigger_cmd ::= scanpt select scanpt",
 /* 266 */ "expr ::= RAISE LP IGNORE RP",
 /* 267 */ "expr ::= RAISE LP raisetype COMMA nm RP",
 /* 268 */ "raisetype ::= ROLLBACK",
 /* 269 */ "raisetype ::= ABORT",
 /* 270 */ "raisetype ::= FAIL",
 /* 271 */ "cmd ::= DROP TRIGGER ifexists fullname",
 /* 272 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
 /* 273 */ "cmd ::= DETACH database_kw_opt expr",

 /* 274 */ "key_opt ::=",
 /* 275 */ "key_opt ::= KEY expr",
 /* 276 */ "cmd ::= REINDEX",
 /* 277 */ "cmd ::= REINDEX nm dbnm",
 /* 278 */ "cmd ::= ANALYZE",
 /* 279 */ "cmd ::= ANALYZE nm dbnm",
 /* 280 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
 /* 281 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
 /* 282 */ "add_column_fullname ::= fullname",
 /* 283 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
 /* 284 */ "cmd ::= create_vtab",
 /* 285 */ "cmd ::= create_vtab LP vtabarglist RP",
 /* 286 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
 /* 287 */ "vtabarg ::=",
 /* 288 */ "vtabargtoken ::= ANY",
 /* 289 */ "vtabargtoken ::= lp anylist RP",
 /* 290 */ "lp ::= LP",
 /* 291 */ "with ::= WITH wqlist",
 /* 292 */ "with ::= WITH RECURSIVE wqlist",
 /* 293 */ "wqlist ::= nm eidlist_opt AS LP select RP",
 /* 294 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
 /* 295 */ "windowdefn_list ::= windowdefn",
 /* 296 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
 /* 297 */ "windowdefn ::= nm AS LP window RP",
 /* 298 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
 /* 299 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
 /* 300 */ "window ::= ORDER BY sortlist frame_opt",
 /* 301 */ "window ::= nm ORDER BY sortlist frame_opt",

 /* 302 */ "window ::= frame_opt",
 /* 303 */ "window ::= nm frame_opt",
 /* 304 */ "frame_opt ::=",
 /* 305 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
 /* 306 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
 /* 307 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
 /* 308 */ "frame_bound_s ::= frame_bound",
 /* 309 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
 /* 310 */ "frame_bound_e ::= frame_bound",
 /* 311 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
 /* 312 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
 /* 313 */ "frame_bound ::= CURRENT ROW",
 /* 314 */ "frame_exclude_opt ::=",
 /* 315 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
 /* 316 */ "frame_exclude ::= NO OTHERS",
 /* 317 */ "frame_exclude ::= CURRENT ROW",
 /* 318 */ "frame_exclude ::= GROUP|TIES",
 /* 319 */ "window_clause ::= WINDOW windowdefn_list",
 /* 320 */ "filter_over ::= filter_clause over_clause",
 /* 321 */ "filter_over ::= over_clause",
 /* 322 */ "filter_over ::= filter_clause",
 /* 323 */ "over_clause ::= OVER LP window RP",
 /* 324 */ "over_clause ::= OVER nm",
 /* 325 */ "filter_clause ::= FILTER LP WHERE expr RP",
 /* 326 */ "input ::= cmdlist",
 /* 327 */ "cmdlist ::= cmdlist ecmd",
 /* 328 */ "cmdlist ::= ecmd",

 /* 329 */ "ecmd ::= SEMI",
 /* 330 */ "ecmd ::= cmdx SEMI",
 /* 331 */ "ecmd ::= explain cmdx SEMI",
 /* 332 */ "trans_opt ::=",
 /* 333 */ "trans_opt ::= TRANSACTION",
 /* 334 */ "trans_opt ::= TRANSACTION nm",
 /* 335 */ "savepoint_opt ::= SAVEPOINT",
 /* 336 */ "savepoint_opt ::=",
 /* 337 */ "cmd ::= create_table create_table_args",
 /* 338 */ "columnlist ::= columnlist COMMA columnname carglist",
 /* 339 */ "columnlist ::= columnname carglist",
 /* 340 */ "nm ::= ID|INDEXED",
 /* 341 */ "nm ::= STRING",
 /* 342 */ "nm ::= JOIN_KW",
 /* 343 */ "typetoken ::= typename",
 /* 344 */ "typename ::= ID|STRING",
 /* 345 */ "signed ::= plus_num",
 /* 346 */ "signed ::= minus_num",
 /* 347 */ "carglist ::= carglist ccons",
 /* 348 */ "carglist ::=",
 /* 349 */ "ccons ::= NULL onconf",
 /* 350 */ "ccons ::= GENERATED ALWAYS AS generated",
 /* 351 */ "ccons ::= AS generated",
 /* 352 */ "conslist_opt ::= COMMA conslist",
 /* 353 */ "conslist ::= conslist tconscomma tcons",
 /* 354 */ "conslist ::= tcons",
 /* 355 */ "tconscomma ::=",
 /* 356 */ "defer_subclause_opt ::= defer_subclause",
 /* 357 */ "resolvetype ::= raisetype",
 /* 358 */ "selectnowith ::= oneselect",
 /* 359 */ "oneselect ::= values",
 /* 360 */ "sclp ::= selcollist COMMA",
 /* 361 */ "as ::= ID|STRING",
 /* 362 */ "expr ::= term",
 /* 363 */ "likeop ::= LIKE_KW|MATCH",
 /* 364 */ "exprlist ::= nexprlist",

 /* 365 */ "nmnum ::= plus_num",
 /* 366 */ "nmnum ::= nm",
 /* 367 */ "nmnum ::= ON",
 /* 368 */ "nmnum ::= DELETE",
 /* 369 */ "nmnum ::= DEFAULT",
 /* 370 */ "plus_num ::= INTEGER|FLOAT",
 /* 371 */ "foreach_clause ::=",
 /* 372 */ "foreach_clause ::= FOR EACH ROW",
 /* 373 */ "trnm ::= nm",
 /* 374 */ "tridxby ::=",
 /* 375 */ "database_kw_opt ::= DATABASE",
 /* 376 */ "database_kw_opt ::=",
 /* 377 */ "kwcolumn_opt ::=",
 /* 378 */ "kwcolumn_opt ::= COLUMNKW",
 /* 379 */ "vtabarglist ::= vtabarg",
 /* 380 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
 /* 381 */ "vtabarg ::= vtabarg vtabargtoken",
 /* 382 */ "anylist ::=",
 /* 383 */ "anylist ::= anylist LP anylist RP",
 /* 384 */ "anylist ::= anylist ANY",
 /* 385 */ "with ::=",
};
#endif /* NDEBUG */


#if YYSTACKDEPTH<=0
/*
** Try to increase the size of the parser stack.  Return the number
157631
157632
157633
157634
157635
157636
157637
157638
157639
157640
157641
157642
157643
157644
157645
157646
157647
157648
157649
157650
157651
157652
157653
157654

157655
157656
157657
157658
157659
157660
157661
157662
157663
157664
157665
157666
157667

157668
157669
157670
157671
157672
157673
157674
157675
157676
157677
157678
157679
157680
157681

157682
157683
157684
157685
157686
157687
157688
157689
157690
157691
157692
157693
157694
157695
157696
157697
157698
157699
157700
157701
157702
157703
157704
157705
157706
157707
157708
157709
157710
157711
157712
157713
157714
157715
157716
157717
157718
157719
157720
157721
157722

157723
157724
157725
157726
157727
157728
157729
157730
157731
157732

157733
157734
157735
157736
157737
157738
157739
157740
157741
157742
157743
157744
157745
157746
157747
157748
157749
157750
157751
157752
157753
157754
157755
157756
157757

157758
157759
157760
157761
157762
157763
157764
157765
157766
157767
157768
157769
157770
157771
157772
157773
157774
157775
157776
157777
157778
157779
157780
157781

157782
157783
157784
157785
157786
157787
157788
157789
157790
157791
157792
157793
157794
157795
157796
157797
157798
157799
157800
157801
157802
157803
157804
157805
157806
157807
157808
157809
157810
157811
157812

157813
157814
157815
157816
157817
157818
157819
157820

157821
157822
157823
157824
157825
157826
157827
157828
157829
157830
157831
157832
157833
157834
157835
157836
157837
157838
157839
157840
157841
157842
157843
157844
157845
157846
157847

157848
157849
157850
157851
157852
157853
157854
157855
157856
157857
157858
157859
157860
157861
157862
157863
157864
157865
157866
157867
157868
157869
157870
   262,  /* (152) setlist ::= setlist COMMA nm EQ expr */
   262,  /* (153) setlist ::= setlist COMMA LP idlist RP EQ expr */
   262,  /* (154) setlist ::= nm EQ expr */
   262,  /* (155) setlist ::= LP idlist RP EQ expr */
   186,  /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
   186,  /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
   265,  /* (158) upsert ::= */
   265,  /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
   265,  /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
   265,  /* (161) upsert ::= ON CONFLICT DO NOTHING */
   263,  /* (162) insert_cmd ::= INSERT orconf */
   263,  /* (163) insert_cmd ::= REPLACE */
   264,  /* (164) idlist_opt ::= */
   264,  /* (165) idlist_opt ::= LP idlist RP */
   259,  /* (166) idlist ::= idlist COMMA nm */
   259,  /* (167) idlist ::= nm */
   212,  /* (168) expr ::= LP expr RP */
   212,  /* (169) expr ::= ID|INDEXED */
   212,  /* (170) expr ::= JOIN_KW */
   212,  /* (171) expr ::= nm DOT nm */
   212,  /* (172) expr ::= nm DOT nm DOT nm */
   211,  /* (173) term ::= NULL|FLOAT|BLOB */
   211,  /* (174) term ::= STRING */
   211,  /* (175) term ::= INTEGER */

   212,  /* (176) expr ::= VARIABLE */
   212,  /* (177) expr ::= expr COLLATE ID|STRING */
   212,  /* (178) expr ::= CAST LP expr AS typetoken RP */
   212,  /* (179) expr ::= ID|INDEXED LP distinct exprlist RP */
   212,  /* (180) expr ::= ID|INDEXED LP STAR RP */
   212,  /* (181) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
   212,  /* (182) expr ::= ID|INDEXED LP STAR RP filter_over */
   211,  /* (183) term ::= CTIME_KW */
   212,  /* (184) expr ::= LP nexprlist COMMA expr RP */
   212,  /* (185) expr ::= expr AND expr */
   212,  /* (186) expr ::= expr OR expr */
   212,  /* (187) expr ::= expr LT|GT|GE|LE expr */
   212,  /* (188) expr ::= expr EQ|NE expr */

   212,  /* (189) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
   212,  /* (190) expr ::= expr PLUS|MINUS expr */
   212,  /* (191) expr ::= expr STAR|SLASH|REM expr */
   212,  /* (192) expr ::= expr CONCAT expr */
   267,  /* (193) likeop ::= NOT LIKE_KW|MATCH */
   212,  /* (194) expr ::= expr likeop expr */
   212,  /* (195) expr ::= expr likeop expr ESCAPE expr */
   212,  /* (196) expr ::= expr ISNULL|NOTNULL */
   212,  /* (197) expr ::= expr NOT NULL */
   212,  /* (198) expr ::= expr IS expr */
   212,  /* (199) expr ::= expr IS NOT expr */
   212,  /* (200) expr ::= NOT expr */
   212,  /* (201) expr ::= BITNOT expr */
   212,  /* (202) expr ::= PLUS|MINUS expr */

   268,  /* (203) between_op ::= BETWEEN */
   268,  /* (204) between_op ::= NOT BETWEEN */
   212,  /* (205) expr ::= expr between_op expr AND expr */
   269,  /* (206) in_op ::= IN */
   269,  /* (207) in_op ::= NOT IN */
   212,  /* (208) expr ::= expr in_op LP exprlist RP */
   212,  /* (209) expr ::= LP select RP */
   212,  /* (210) expr ::= expr in_op LP select RP */
   212,  /* (211) expr ::= expr in_op nm dbnm paren_exprlist */
   212,  /* (212) expr ::= EXISTS LP select RP */
   212,  /* (213) expr ::= CASE case_operand case_exprlist case_else END */
   272,  /* (214) case_exprlist ::= case_exprlist WHEN expr THEN expr */
   272,  /* (215) case_exprlist ::= WHEN expr THEN expr */
   273,  /* (216) case_else ::= ELSE expr */
   273,  /* (217) case_else ::= */
   271,  /* (218) case_operand ::= expr */
   271,  /* (219) case_operand ::= */
   257,  /* (220) exprlist ::= */
   248,  /* (221) nexprlist ::= nexprlist COMMA expr */
   248,  /* (222) nexprlist ::= expr */
   270,  /* (223) paren_exprlist ::= */
   270,  /* (224) paren_exprlist ::= LP exprlist RP */
   186,  /* (225) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
   274,  /* (226) uniqueflag ::= UNIQUE */
   274,  /* (227) uniqueflag ::= */
   216,  /* (228) eidlist_opt ::= */
   216,  /* (229) eidlist_opt ::= LP eidlist RP */
   227,  /* (230) eidlist ::= eidlist COMMA nm collate sortorder */
   227,  /* (231) eidlist ::= nm collate sortorder */
   275,  /* (232) collate ::= */
   275,  /* (233) collate ::= COLLATE ID|STRING */
   186,  /* (234) cmd ::= DROP INDEX ifexists fullname */
   186,  /* (235) cmd ::= VACUUM vinto */
   186,  /* (236) cmd ::= VACUUM nm vinto */
   276,  /* (237) vinto ::= INTO expr */
   276,  /* (238) vinto ::= */
   186,  /* (239) cmd ::= PRAGMA nm dbnm */
   186,  /* (240) cmd ::= PRAGMA nm dbnm EQ nmnum */
   186,  /* (241) cmd ::= PRAGMA nm dbnm LP nmnum RP */
   186,  /* (242) cmd ::= PRAGMA nm dbnm EQ minus_num */
   186,  /* (243) cmd ::= PRAGMA nm dbnm LP minus_num RP */

   206,  /* (244) plus_num ::= PLUS INTEGER|FLOAT */
   207,  /* (245) minus_num ::= MINUS INTEGER|FLOAT */
   186,  /* (246) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
   278,  /* (247) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
   280,  /* (248) trigger_time ::= BEFORE|AFTER */
   280,  /* (249) trigger_time ::= INSTEAD OF */
   280,  /* (250) trigger_time ::= */
   281,  /* (251) trigger_event ::= DELETE|INSERT */
   281,  /* (252) trigger_event ::= UPDATE */
   281,  /* (253) trigger_event ::= UPDATE OF idlist */

   283,  /* (254) when_clause ::= */
   283,  /* (255) when_clause ::= WHEN expr */
   279,  /* (256) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
   279,  /* (257) trigger_cmd_list ::= trigger_cmd SEMI */
   285,  /* (258) trnm ::= nm DOT nm */
   286,  /* (259) tridxby ::= INDEXED BY nm */
   286,  /* (260) tridxby ::= NOT INDEXED */
   284,  /* (261) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
   284,  /* (262) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
   284,  /* (263) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
   284,  /* (264) trigger_cmd ::= scanpt select scanpt */
   212,  /* (265) expr ::= RAISE LP IGNORE RP */
   212,  /* (266) expr ::= RAISE LP raisetype COMMA nm RP */
   231,  /* (267) raisetype ::= ROLLBACK */
   231,  /* (268) raisetype ::= ABORT */
   231,  /* (269) raisetype ::= FAIL */
   186,  /* (270) cmd ::= DROP TRIGGER ifexists fullname */
   186,  /* (271) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
   186,  /* (272) cmd ::= DETACH database_kw_opt expr */
   288,  /* (273) key_opt ::= */
   288,  /* (274) key_opt ::= KEY expr */
   186,  /* (275) cmd ::= REINDEX */
   186,  /* (276) cmd ::= REINDEX nm dbnm */
   186,  /* (277) cmd ::= ANALYZE */
   186,  /* (278) cmd ::= ANALYZE nm dbnm */

   186,  /* (279) cmd ::= ALTER TABLE fullname RENAME TO nm */
   186,  /* (280) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
   289,  /* (281) add_column_fullname ::= fullname */
   186,  /* (282) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
   186,  /* (283) cmd ::= create_vtab */
   186,  /* (284) cmd ::= create_vtab LP vtabarglist RP */
   291,  /* (285) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
   293,  /* (286) vtabarg ::= */
   294,  /* (287) vtabargtoken ::= ANY */
   294,  /* (288) vtabargtoken ::= lp anylist RP */
   295,  /* (289) lp ::= LP */
   261,  /* (290) with ::= WITH wqlist */
   261,  /* (291) with ::= WITH RECURSIVE wqlist */
   236,  /* (292) wqlist ::= nm eidlist_opt AS LP select RP */
   236,  /* (293) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
   297,  /* (294) windowdefn_list ::= windowdefn */
   297,  /* (295) windowdefn_list ::= windowdefn_list COMMA windowdefn */
   298,  /* (296) windowdefn ::= nm AS LP window RP */
   299,  /* (297) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
   299,  /* (298) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
   299,  /* (299) window ::= ORDER BY sortlist frame_opt */
   299,  /* (300) window ::= nm ORDER BY sortlist frame_opt */
   299,  /* (301) window ::= frame_opt */
   299,  /* (302) window ::= nm frame_opt */

   300,  /* (303) frame_opt ::= */
   300,  /* (304) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
   300,  /* (305) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
   304,  /* (306) range_or_rows ::= RANGE|ROWS|GROUPS */
   306,  /* (307) frame_bound_s ::= frame_bound */
   306,  /* (308) frame_bound_s ::= UNBOUNDED PRECEDING */
   307,  /* (309) frame_bound_e ::= frame_bound */
   307,  /* (310) frame_bound_e ::= UNBOUNDED FOLLOWING */
   305,  /* (311) frame_bound ::= expr PRECEDING|FOLLOWING */
   305,  /* (312) frame_bound ::= CURRENT ROW */
   308,  /* (313) frame_exclude_opt ::= */
   308,  /* (314) frame_exclude_opt ::= EXCLUDE frame_exclude */
   309,  /* (315) frame_exclude ::= NO OTHERS */
   309,  /* (316) frame_exclude ::= CURRENT ROW */
   309,  /* (317) frame_exclude ::= GROUP|TIES */
   246,  /* (318) window_clause ::= WINDOW windowdefn_list */
   266,  /* (319) filter_over ::= filter_clause over_clause */
   266,  /* (320) filter_over ::= over_clause */
   266,  /* (321) filter_over ::= filter_clause */
   303,  /* (322) over_clause ::= OVER LP window RP */
   303,  /* (323) over_clause ::= OVER nm */
   302,  /* (324) filter_clause ::= FILTER LP WHERE expr RP */
   181,  /* (325) input ::= cmdlist */
   182,  /* (326) cmdlist ::= cmdlist ecmd */
   182,  /* (327) cmdlist ::= ecmd */
   183,  /* (328) ecmd ::= SEMI */
   183,  /* (329) ecmd ::= cmdx SEMI */
   183,  /* (330) ecmd ::= explain cmdx SEMI */
   188,  /* (331) trans_opt ::= */
   188,  /* (332) trans_opt ::= TRANSACTION */
   188,  /* (333) trans_opt ::= TRANSACTION nm */

   190,  /* (334) savepoint_opt ::= SAVEPOINT */
   190,  /* (335) savepoint_opt ::= */
   186,  /* (336) cmd ::= create_table create_table_args */
   197,  /* (337) columnlist ::= columnlist COMMA columnname carglist */
   197,  /* (338) columnlist ::= columnname carglist */
   189,  /* (339) nm ::= ID|INDEXED */
   189,  /* (340) nm ::= STRING */
   189,  /* (341) nm ::= JOIN_KW */

   203,  /* (342) typetoken ::= typename */
   204,  /* (343) typename ::= ID|STRING */
   205,  /* (344) signed ::= plus_num */
   205,  /* (345) signed ::= minus_num */
   202,  /* (346) carglist ::= carglist ccons */
   202,  /* (347) carglist ::= */
   210,  /* (348) ccons ::= NULL onconf */
   210,  /* (349) ccons ::= GENERATED ALWAYS AS generated */
   210,  /* (350) ccons ::= AS generated */
   198,  /* (351) conslist_opt ::= COMMA conslist */
   223,  /* (352) conslist ::= conslist tconscomma tcons */
   223,  /* (353) conslist ::= tcons */
   224,  /* (354) tconscomma ::= */
   228,  /* (355) defer_subclause_opt ::= defer_subclause */
   230,  /* (356) resolvetype ::= raisetype */
   234,  /* (357) selectnowith ::= oneselect */
   235,  /* (358) oneselect ::= values */
   249,  /* (359) sclp ::= selcollist COMMA */
   250,  /* (360) as ::= ID|STRING */
   212,  /* (361) expr ::= term */
   267,  /* (362) likeop ::= LIKE_KW|MATCH */
   257,  /* (363) exprlist ::= nexprlist */
   277,  /* (364) nmnum ::= plus_num */
   277,  /* (365) nmnum ::= nm */
   277,  /* (366) nmnum ::= ON */
   277,  /* (367) nmnum ::= DELETE */
   277,  /* (368) nmnum ::= DEFAULT */

   206,  /* (369) plus_num ::= INTEGER|FLOAT */
   282,  /* (370) foreach_clause ::= */
   282,  /* (371) foreach_clause ::= FOR EACH ROW */
   285,  /* (372) trnm ::= nm */
   286,  /* (373) tridxby ::= */
   287,  /* (374) database_kw_opt ::= DATABASE */
   287,  /* (375) database_kw_opt ::= */
   290,  /* (376) kwcolumn_opt ::= */
   290,  /* (377) kwcolumn_opt ::= COLUMNKW */
   292,  /* (378) vtabarglist ::= vtabarg */
   292,  /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */
   293,  /* (380) vtabarg ::= vtabarg vtabargtoken */
   296,  /* (381) anylist ::= */
   296,  /* (382) anylist ::= anylist LP anylist RP */
   296,  /* (383) anylist ::= anylist ANY */
   261,  /* (384) 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 */







|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<
|
|
|
|
>
|
|
|
|
|
<
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
|
>
|
|
|
|
<
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
|
|
>
|
|
|
|
|
<
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







158266
158267
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
158311
158312
158313
158314
158315
158316
158317
158318
158319
158320
158321
158322
158323
158324
158325
158326
158327
158328
158329
158330
158331
158332
158333
158334
158335
158336
158337
158338
158339
158340
158341
158342
158343
158344
158345
158346
158347
158348
158349
158350
158351

158352
158353
158354
158355
158356
158357
158358
158359
158360
158361
158362

158363
158364
158365
158366
158367
158368
158369
158370
158371
158372
158373
158374
158375
158376
158377
158378
158379
158380
158381
158382
158383
158384
158385
158386
158387

158388
158389
158390
158391
158392
158393
158394
158395
158396
158397
158398
158399
158400
158401
158402
158403
158404
158405
158406
158407
158408
158409
158410
158411
158412
158413
158414

158415
158416
158417
158418
158419
158420
158421
158422
158423
158424
158425
158426
158427
158428
158429
158430
158431
158432
158433
158434
158435
158436
158437
158438
158439
158440

158441
158442
158443
158444
158445
158446
158447
158448
158449
158450
158451
158452
158453

158454
158455
158456
158457
158458
158459
158460
158461
158462
158463
158464
158465
158466
158467
158468
158469
158470
158471
158472
158473
158474
158475
158476
158477
158478

158479
158480
158481
158482
158483
158484
158485
158486
158487
158488
158489
158490
158491
158492
158493
158494
158495
158496
158497
158498
158499
158500
158501
158502
158503
158504
158505
158506
   262,  /* (152) setlist ::= setlist COMMA nm EQ expr */
   262,  /* (153) setlist ::= setlist COMMA LP idlist RP EQ expr */
   262,  /* (154) setlist ::= nm EQ expr */
   262,  /* (155) setlist ::= LP idlist RP EQ expr */
   186,  /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
   186,  /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
   265,  /* (158) upsert ::= */
   265,  /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
   265,  /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
   265,  /* (161) upsert ::= ON CONFLICT DO NOTHING */
   265,  /* (162) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
   263,  /* (163) insert_cmd ::= INSERT orconf */
   263,  /* (164) insert_cmd ::= REPLACE */
   264,  /* (165) idlist_opt ::= */
   264,  /* (166) idlist_opt ::= LP idlist RP */
   259,  /* (167) idlist ::= idlist COMMA nm */
   259,  /* (168) idlist ::= nm */
   212,  /* (169) expr ::= LP expr RP */
   212,  /* (170) expr ::= ID|INDEXED */
   212,  /* (171) expr ::= JOIN_KW */
   212,  /* (172) expr ::= nm DOT nm */
   212,  /* (173) expr ::= nm DOT nm DOT nm */
   211,  /* (174) term ::= NULL|FLOAT|BLOB */
   211,  /* (175) term ::= STRING */
   211,  /* (176) term ::= INTEGER */
   212,  /* (177) expr ::= VARIABLE */
   212,  /* (178) expr ::= expr COLLATE ID|STRING */
   212,  /* (179) expr ::= CAST LP expr AS typetoken RP */
   212,  /* (180) expr ::= ID|INDEXED LP distinct exprlist RP */
   212,  /* (181) expr ::= ID|INDEXED LP STAR RP */
   212,  /* (182) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
   212,  /* (183) expr ::= ID|INDEXED LP STAR RP filter_over */
   211,  /* (184) term ::= CTIME_KW */

   212,  /* (185) expr ::= LP nexprlist COMMA expr RP */
   212,  /* (186) expr ::= expr AND expr */
   212,  /* (187) expr ::= expr OR expr */
   212,  /* (188) expr ::= expr LT|GT|GE|LE expr */
   212,  /* (189) expr ::= expr EQ|NE expr */
   212,  /* (190) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
   212,  /* (191) expr ::= expr PLUS|MINUS expr */
   212,  /* (192) expr ::= expr STAR|SLASH|REM expr */
   212,  /* (193) expr ::= expr CONCAT expr */
   267,  /* (194) likeop ::= NOT LIKE_KW|MATCH */

   212,  /* (195) expr ::= expr likeop expr */
   212,  /* (196) expr ::= expr likeop expr ESCAPE expr */
   212,  /* (197) expr ::= expr ISNULL|NOTNULL */
   212,  /* (198) expr ::= expr NOT NULL */
   212,  /* (199) expr ::= expr IS expr */
   212,  /* (200) expr ::= expr IS NOT expr */
   212,  /* (201) expr ::= NOT expr */
   212,  /* (202) expr ::= BITNOT expr */
   212,  /* (203) expr ::= PLUS|MINUS expr */
   268,  /* (204) between_op ::= BETWEEN */
   268,  /* (205) between_op ::= NOT BETWEEN */
   212,  /* (206) expr ::= expr between_op expr AND expr */
   269,  /* (207) in_op ::= IN */
   269,  /* (208) in_op ::= NOT IN */
   212,  /* (209) expr ::= expr in_op LP exprlist RP */
   212,  /* (210) expr ::= LP select RP */
   212,  /* (211) expr ::= expr in_op LP select RP */
   212,  /* (212) expr ::= expr in_op nm dbnm paren_exprlist */
   212,  /* (213) expr ::= EXISTS LP select RP */
   212,  /* (214) expr ::= CASE case_operand case_exprlist case_else END */
   272,  /* (215) case_exprlist ::= case_exprlist WHEN expr THEN expr */
   272,  /* (216) case_exprlist ::= WHEN expr THEN expr */
   273,  /* (217) case_else ::= ELSE expr */
   273,  /* (218) case_else ::= */
   271,  /* (219) case_operand ::= expr */
   271,  /* (220) case_operand ::= */
   257,  /* (221) exprlist ::= */
   248,  /* (222) nexprlist ::= nexprlist COMMA expr */
   248,  /* (223) nexprlist ::= expr */
   270,  /* (224) paren_exprlist ::= */
   270,  /* (225) paren_exprlist ::= LP exprlist RP */
   186,  /* (226) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
   274,  /* (227) uniqueflag ::= UNIQUE */
   274,  /* (228) uniqueflag ::= */
   216,  /* (229) eidlist_opt ::= */
   216,  /* (230) eidlist_opt ::= LP eidlist RP */
   227,  /* (231) eidlist ::= eidlist COMMA nm collate sortorder */
   227,  /* (232) eidlist ::= nm collate sortorder */
   275,  /* (233) collate ::= */
   275,  /* (234) collate ::= COLLATE ID|STRING */
   186,  /* (235) cmd ::= DROP INDEX ifexists fullname */
   186,  /* (236) cmd ::= VACUUM vinto */
   186,  /* (237) cmd ::= VACUUM nm vinto */

   276,  /* (238) vinto ::= INTO expr */
   276,  /* (239) vinto ::= */
   186,  /* (240) cmd ::= PRAGMA nm dbnm */
   186,  /* (241) cmd ::= PRAGMA nm dbnm EQ nmnum */
   186,  /* (242) cmd ::= PRAGMA nm dbnm LP nmnum RP */
   186,  /* (243) cmd ::= PRAGMA nm dbnm EQ minus_num */
   186,  /* (244) cmd ::= PRAGMA nm dbnm LP minus_num RP */
   206,  /* (245) plus_num ::= PLUS INTEGER|FLOAT */
   207,  /* (246) minus_num ::= MINUS INTEGER|FLOAT */
   186,  /* (247) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
   278,  /* (248) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */

   280,  /* (249) trigger_time ::= BEFORE|AFTER */
   280,  /* (250) trigger_time ::= INSTEAD OF */
   280,  /* (251) trigger_time ::= */
   281,  /* (252) trigger_event ::= DELETE|INSERT */
   281,  /* (253) trigger_event ::= UPDATE */
   281,  /* (254) trigger_event ::= UPDATE OF idlist */
   283,  /* (255) when_clause ::= */
   283,  /* (256) when_clause ::= WHEN expr */
   279,  /* (257) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
   279,  /* (258) trigger_cmd_list ::= trigger_cmd SEMI */
   285,  /* (259) trnm ::= nm DOT nm */
   286,  /* (260) tridxby ::= INDEXED BY nm */
   286,  /* (261) tridxby ::= NOT INDEXED */
   284,  /* (262) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
   284,  /* (263) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
   284,  /* (264) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
   284,  /* (265) trigger_cmd ::= scanpt select scanpt */
   212,  /* (266) expr ::= RAISE LP IGNORE RP */
   212,  /* (267) expr ::= RAISE LP raisetype COMMA nm RP */
   231,  /* (268) raisetype ::= ROLLBACK */
   231,  /* (269) raisetype ::= ABORT */
   231,  /* (270) raisetype ::= FAIL */
   186,  /* (271) cmd ::= DROP TRIGGER ifexists fullname */
   186,  /* (272) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
   186,  /* (273) cmd ::= DETACH database_kw_opt expr */

   288,  /* (274) key_opt ::= */
   288,  /* (275) key_opt ::= KEY expr */
   186,  /* (276) cmd ::= REINDEX */
   186,  /* (277) cmd ::= REINDEX nm dbnm */
   186,  /* (278) cmd ::= ANALYZE */
   186,  /* (279) cmd ::= ANALYZE nm dbnm */
   186,  /* (280) cmd ::= ALTER TABLE fullname RENAME TO nm */
   186,  /* (281) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
   289,  /* (282) add_column_fullname ::= fullname */
   186,  /* (283) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
   186,  /* (284) cmd ::= create_vtab */
   186,  /* (285) cmd ::= create_vtab LP vtabarglist RP */
   291,  /* (286) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
   293,  /* (287) vtabarg ::= */
   294,  /* (288) vtabargtoken ::= ANY */
   294,  /* (289) vtabargtoken ::= lp anylist RP */
   295,  /* (290) lp ::= LP */
   261,  /* (291) with ::= WITH wqlist */
   261,  /* (292) with ::= WITH RECURSIVE wqlist */
   236,  /* (293) wqlist ::= nm eidlist_opt AS LP select RP */
   236,  /* (294) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
   297,  /* (295) windowdefn_list ::= windowdefn */
   297,  /* (296) windowdefn_list ::= windowdefn_list COMMA windowdefn */
   298,  /* (297) windowdefn ::= nm AS LP window RP */
   299,  /* (298) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
   299,  /* (299) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
   299,  /* (300) window ::= ORDER BY sortlist frame_opt */

   299,  /* (301) window ::= nm ORDER BY sortlist frame_opt */
   299,  /* (302) window ::= frame_opt */
   299,  /* (303) window ::= nm frame_opt */
   300,  /* (304) frame_opt ::= */
   300,  /* (305) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
   300,  /* (306) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
   304,  /* (307) range_or_rows ::= RANGE|ROWS|GROUPS */
   306,  /* (308) frame_bound_s ::= frame_bound */
   306,  /* (309) frame_bound_s ::= UNBOUNDED PRECEDING */
   307,  /* (310) frame_bound_e ::= frame_bound */
   307,  /* (311) frame_bound_e ::= UNBOUNDED FOLLOWING */
   305,  /* (312) frame_bound ::= expr PRECEDING|FOLLOWING */
   305,  /* (313) frame_bound ::= CURRENT ROW */
   308,  /* (314) frame_exclude_opt ::= */
   308,  /* (315) frame_exclude_opt ::= EXCLUDE frame_exclude */
   309,  /* (316) frame_exclude ::= NO OTHERS */
   309,  /* (317) frame_exclude ::= CURRENT ROW */
   309,  /* (318) frame_exclude ::= GROUP|TIES */
   246,  /* (319) window_clause ::= WINDOW windowdefn_list */
   266,  /* (320) filter_over ::= filter_clause over_clause */
   266,  /* (321) filter_over ::= over_clause */
   266,  /* (322) filter_over ::= filter_clause */
   303,  /* (323) over_clause ::= OVER LP window RP */
   303,  /* (324) over_clause ::= OVER nm */
   302,  /* (325) filter_clause ::= FILTER LP WHERE expr RP */
   181,  /* (326) input ::= cmdlist */

   182,  /* (327) cmdlist ::= cmdlist ecmd */
   182,  /* (328) cmdlist ::= ecmd */
   183,  /* (329) ecmd ::= SEMI */
   183,  /* (330) ecmd ::= cmdx SEMI */
   183,  /* (331) ecmd ::= explain cmdx SEMI */
   188,  /* (332) trans_opt ::= */
   188,  /* (333) trans_opt ::= TRANSACTION */
   188,  /* (334) trans_opt ::= TRANSACTION nm */
   190,  /* (335) savepoint_opt ::= SAVEPOINT */
   190,  /* (336) savepoint_opt ::= */
   186,  /* (337) cmd ::= create_table create_table_args */
   197,  /* (338) columnlist ::= columnlist COMMA columnname carglist */
   197,  /* (339) columnlist ::= columnname carglist */

   189,  /* (340) nm ::= ID|INDEXED */
   189,  /* (341) nm ::= STRING */
   189,  /* (342) nm ::= JOIN_KW */
   203,  /* (343) typetoken ::= typename */
   204,  /* (344) typename ::= ID|STRING */
   205,  /* (345) signed ::= plus_num */
   205,  /* (346) signed ::= minus_num */
   202,  /* (347) carglist ::= carglist ccons */
   202,  /* (348) carglist ::= */
   210,  /* (349) ccons ::= NULL onconf */
   210,  /* (350) ccons ::= GENERATED ALWAYS AS generated */
   210,  /* (351) ccons ::= AS generated */
   198,  /* (352) conslist_opt ::= COMMA conslist */
   223,  /* (353) conslist ::= conslist tconscomma tcons */
   223,  /* (354) conslist ::= tcons */
   224,  /* (355) tconscomma ::= */
   228,  /* (356) defer_subclause_opt ::= defer_subclause */
   230,  /* (357) resolvetype ::= raisetype */
   234,  /* (358) selectnowith ::= oneselect */
   235,  /* (359) oneselect ::= values */
   249,  /* (360) sclp ::= selcollist COMMA */
   250,  /* (361) as ::= ID|STRING */
   212,  /* (362) expr ::= term */
   267,  /* (363) likeop ::= LIKE_KW|MATCH */
   257,  /* (364) exprlist ::= nexprlist */

   277,  /* (365) nmnum ::= plus_num */
   277,  /* (366) nmnum ::= nm */
   277,  /* (367) nmnum ::= ON */
   277,  /* (368) nmnum ::= DELETE */
   277,  /* (369) nmnum ::= DEFAULT */
   206,  /* (370) plus_num ::= INTEGER|FLOAT */
   282,  /* (371) foreach_clause ::= */
   282,  /* (372) foreach_clause ::= FOR EACH ROW */
   285,  /* (373) trnm ::= nm */
   286,  /* (374) tridxby ::= */
   287,  /* (375) database_kw_opt ::= DATABASE */
   287,  /* (376) database_kw_opt ::= */
   290,  /* (377) kwcolumn_opt ::= */
   290,  /* (378) kwcolumn_opt ::= COLUMNKW */
   292,  /* (379) vtabarglist ::= vtabarg */
   292,  /* (380) vtabarglist ::= vtabarglist COMMA vtabarg */
   293,  /* (381) vtabarg ::= vtabarg vtabargtoken */
   296,  /* (382) anylist ::= */
   296,  /* (383) anylist ::= anylist LP anylist RP */
   296,  /* (384) anylist ::= anylist ANY */
   261,  /* (385) 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 */
158021
158022
158023
158024
158025
158026
158027
158028
158029
158030

158031
158032
158033
158034
158035
158036
158037
158038
158039
158040
158041
158042
158043
158044
158045
158046
158047
158048
158049
158050
158051
158052
158053
158054
158055
158056
158057

158058
158059
158060
158061
158062
158063
158064
158065
158066
158067
158068
158069
158070
158071
158072
158073
158074
158075
158076
158077
158078
158079
158080
158081
158082
158083
158084
158085
158086
158087
158088
158089
158090
158091
158092
158093
158094
158095
158096
158097
158098
158099
158100
158101
158102
158103
158104
158105
158106
158107
158108
158109
158110
158111
158112
158113
158114
158115
158116
158117
158118
158119
158120
158121
158122
158123
158124
158125
158126
158127
158128
158129
158130
158131
158132
158133
158134
158135
158136
158137
158138
158139
158140
158141
158142
158143

158144
158145
158146
158147
158148
158149
158150
158151
158152
158153
158154
158155
158156
158157
158158
158159
158160
158161
158162
158163
158164
158165
158166
158167
158168
158169
158170
158171
158172
158173
158174
158175
158176
158177
158178
158179
158180
158181
158182
158183
158184
158185
158186
158187
158188
158189
158190
158191
158192
158193
158194
158195
158196
158197
158198
158199
158200
158201
158202
158203
158204
158205
158206
158207
158208
158209
158210

158211
158212
158213
158214
158215
158216
158217
158218
158219
158220
158221
158222
158223
158224
158225
158226
158227
158228
158229
158230
158231
158232
158233
158234
158235
158236
158237

158238
158239
158240
158241
158242
158243
158244
158245
158246
158247
158248
158249
158250
158251
158252
158253
158254
158255
158256
158257
158258
158259
158260
   -5,  /* (152) setlist ::= setlist COMMA nm EQ expr */
   -7,  /* (153) setlist ::= setlist COMMA LP idlist RP EQ expr */
   -3,  /* (154) setlist ::= nm EQ expr */
   -5,  /* (155) setlist ::= LP idlist RP EQ expr */
   -7,  /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
   -7,  /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
    0,  /* (158) upsert ::= */
  -11,  /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
   -8,  /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
   -4,  /* (161) upsert ::= ON CONFLICT DO NOTHING */

   -2,  /* (162) insert_cmd ::= INSERT orconf */
   -1,  /* (163) insert_cmd ::= REPLACE */
    0,  /* (164) idlist_opt ::= */
   -3,  /* (165) idlist_opt ::= LP idlist RP */
   -3,  /* (166) idlist ::= idlist COMMA nm */
   -1,  /* (167) idlist ::= nm */
   -3,  /* (168) expr ::= LP expr RP */
   -1,  /* (169) expr ::= ID|INDEXED */
   -1,  /* (170) expr ::= JOIN_KW */
   -3,  /* (171) expr ::= nm DOT nm */
   -5,  /* (172) expr ::= nm DOT nm DOT nm */
   -1,  /* (173) term ::= NULL|FLOAT|BLOB */
   -1,  /* (174) term ::= STRING */
   -1,  /* (175) term ::= INTEGER */
   -1,  /* (176) expr ::= VARIABLE */
   -3,  /* (177) expr ::= expr COLLATE ID|STRING */
   -6,  /* (178) expr ::= CAST LP expr AS typetoken RP */
   -5,  /* (179) expr ::= ID|INDEXED LP distinct exprlist RP */
   -4,  /* (180) expr ::= ID|INDEXED LP STAR RP */
   -6,  /* (181) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
   -5,  /* (182) expr ::= ID|INDEXED LP STAR RP filter_over */
   -1,  /* (183) term ::= CTIME_KW */
   -5,  /* (184) expr ::= LP nexprlist COMMA expr RP */
   -3,  /* (185) expr ::= expr AND expr */
   -3,  /* (186) expr ::= expr OR expr */
   -3,  /* (187) expr ::= expr LT|GT|GE|LE expr */
   -3,  /* (188) expr ::= expr EQ|NE expr */

   -3,  /* (189) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
   -3,  /* (190) expr ::= expr PLUS|MINUS expr */
   -3,  /* (191) expr ::= expr STAR|SLASH|REM expr */
   -3,  /* (192) expr ::= expr CONCAT expr */
   -2,  /* (193) likeop ::= NOT LIKE_KW|MATCH */
   -3,  /* (194) expr ::= expr likeop expr */
   -5,  /* (195) expr ::= expr likeop expr ESCAPE expr */
   -2,  /* (196) expr ::= expr ISNULL|NOTNULL */
   -3,  /* (197) expr ::= expr NOT NULL */
   -3,  /* (198) expr ::= expr IS expr */
   -4,  /* (199) expr ::= expr IS NOT expr */
   -2,  /* (200) expr ::= NOT expr */
   -2,  /* (201) expr ::= BITNOT expr */
   -2,  /* (202) expr ::= PLUS|MINUS expr */
   -1,  /* (203) between_op ::= BETWEEN */
   -2,  /* (204) between_op ::= NOT BETWEEN */
   -5,  /* (205) expr ::= expr between_op expr AND expr */
   -1,  /* (206) in_op ::= IN */
   -2,  /* (207) in_op ::= NOT IN */
   -5,  /* (208) expr ::= expr in_op LP exprlist RP */
   -3,  /* (209) expr ::= LP select RP */
   -5,  /* (210) expr ::= expr in_op LP select RP */
   -5,  /* (211) expr ::= expr in_op nm dbnm paren_exprlist */
   -4,  /* (212) expr ::= EXISTS LP select RP */
   -5,  /* (213) expr ::= CASE case_operand case_exprlist case_else END */
   -5,  /* (214) case_exprlist ::= case_exprlist WHEN expr THEN expr */
   -4,  /* (215) case_exprlist ::= WHEN expr THEN expr */
   -2,  /* (216) case_else ::= ELSE expr */
    0,  /* (217) case_else ::= */
   -1,  /* (218) case_operand ::= expr */
    0,  /* (219) case_operand ::= */
    0,  /* (220) exprlist ::= */
   -3,  /* (221) nexprlist ::= nexprlist COMMA expr */
   -1,  /* (222) nexprlist ::= expr */
    0,  /* (223) paren_exprlist ::= */
   -3,  /* (224) paren_exprlist ::= LP exprlist RP */
  -12,  /* (225) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
   -1,  /* (226) uniqueflag ::= UNIQUE */
    0,  /* (227) uniqueflag ::= */
    0,  /* (228) eidlist_opt ::= */
   -3,  /* (229) eidlist_opt ::= LP eidlist RP */
   -5,  /* (230) eidlist ::= eidlist COMMA nm collate sortorder */
   -3,  /* (231) eidlist ::= nm collate sortorder */
    0,  /* (232) collate ::= */
   -2,  /* (233) collate ::= COLLATE ID|STRING */
   -4,  /* (234) cmd ::= DROP INDEX ifexists fullname */
   -2,  /* (235) cmd ::= VACUUM vinto */
   -3,  /* (236) cmd ::= VACUUM nm vinto */
   -2,  /* (237) vinto ::= INTO expr */
    0,  /* (238) vinto ::= */
   -3,  /* (239) cmd ::= PRAGMA nm dbnm */
   -5,  /* (240) cmd ::= PRAGMA nm dbnm EQ nmnum */
   -6,  /* (241) cmd ::= PRAGMA nm dbnm LP nmnum RP */
   -5,  /* (242) cmd ::= PRAGMA nm dbnm EQ minus_num */
   -6,  /* (243) cmd ::= PRAGMA nm dbnm LP minus_num RP */
   -2,  /* (244) plus_num ::= PLUS INTEGER|FLOAT */
   -2,  /* (245) minus_num ::= MINUS INTEGER|FLOAT */
   -5,  /* (246) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
  -11,  /* (247) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
   -1,  /* (248) trigger_time ::= BEFORE|AFTER */
   -2,  /* (249) trigger_time ::= INSTEAD OF */
    0,  /* (250) trigger_time ::= */
   -1,  /* (251) trigger_event ::= DELETE|INSERT */
   -1,  /* (252) trigger_event ::= UPDATE */
   -3,  /* (253) trigger_event ::= UPDATE OF idlist */
    0,  /* (254) when_clause ::= */
   -2,  /* (255) when_clause ::= WHEN expr */
   -3,  /* (256) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
   -2,  /* (257) trigger_cmd_list ::= trigger_cmd SEMI */
   -3,  /* (258) trnm ::= nm DOT nm */
   -3,  /* (259) tridxby ::= INDEXED BY nm */
   -2,  /* (260) tridxby ::= NOT INDEXED */
   -9,  /* (261) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
   -8,  /* (262) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
   -6,  /* (263) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
   -3,  /* (264) trigger_cmd ::= scanpt select scanpt */
   -4,  /* (265) expr ::= RAISE LP IGNORE RP */
   -6,  /* (266) expr ::= RAISE LP raisetype COMMA nm RP */
   -1,  /* (267) raisetype ::= ROLLBACK */
   -1,  /* (268) raisetype ::= ABORT */
   -1,  /* (269) raisetype ::= FAIL */
   -4,  /* (270) cmd ::= DROP TRIGGER ifexists fullname */
   -6,  /* (271) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
   -3,  /* (272) cmd ::= DETACH database_kw_opt expr */
    0,  /* (273) key_opt ::= */
   -2,  /* (274) key_opt ::= KEY expr */

   -1,  /* (275) cmd ::= REINDEX */
   -3,  /* (276) cmd ::= REINDEX nm dbnm */
   -1,  /* (277) cmd ::= ANALYZE */
   -3,  /* (278) cmd ::= ANALYZE nm dbnm */
   -6,  /* (279) cmd ::= ALTER TABLE fullname RENAME TO nm */
   -7,  /* (280) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
   -1,  /* (281) add_column_fullname ::= fullname */
   -8,  /* (282) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
   -1,  /* (283) cmd ::= create_vtab */
   -4,  /* (284) cmd ::= create_vtab LP vtabarglist RP */
   -8,  /* (285) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
    0,  /* (286) vtabarg ::= */
   -1,  /* (287) vtabargtoken ::= ANY */
   -3,  /* (288) vtabargtoken ::= lp anylist RP */
   -1,  /* (289) lp ::= LP */
   -2,  /* (290) with ::= WITH wqlist */
   -3,  /* (291) with ::= WITH RECURSIVE wqlist */
   -6,  /* (292) wqlist ::= nm eidlist_opt AS LP select RP */
   -8,  /* (293) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
   -1,  /* (294) windowdefn_list ::= windowdefn */
   -3,  /* (295) windowdefn_list ::= windowdefn_list COMMA windowdefn */
   -5,  /* (296) windowdefn ::= nm AS LP window RP */
   -5,  /* (297) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
   -6,  /* (298) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
   -4,  /* (299) window ::= ORDER BY sortlist frame_opt */
   -5,  /* (300) window ::= nm ORDER BY sortlist frame_opt */
   -1,  /* (301) window ::= frame_opt */
   -2,  /* (302) window ::= nm frame_opt */
    0,  /* (303) frame_opt ::= */
   -3,  /* (304) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
   -6,  /* (305) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
   -1,  /* (306) range_or_rows ::= RANGE|ROWS|GROUPS */
   -1,  /* (307) frame_bound_s ::= frame_bound */
   -2,  /* (308) frame_bound_s ::= UNBOUNDED PRECEDING */
   -1,  /* (309) frame_bound_e ::= frame_bound */
   -2,  /* (310) frame_bound_e ::= UNBOUNDED FOLLOWING */
   -2,  /* (311) frame_bound ::= expr PRECEDING|FOLLOWING */
   -2,  /* (312) frame_bound ::= CURRENT ROW */
    0,  /* (313) frame_exclude_opt ::= */
   -2,  /* (314) frame_exclude_opt ::= EXCLUDE frame_exclude */
   -2,  /* (315) frame_exclude ::= NO OTHERS */
   -2,  /* (316) frame_exclude ::= CURRENT ROW */
   -1,  /* (317) frame_exclude ::= GROUP|TIES */
   -2,  /* (318) window_clause ::= WINDOW windowdefn_list */
   -2,  /* (319) filter_over ::= filter_clause over_clause */
   -1,  /* (320) filter_over ::= over_clause */
   -1,  /* (321) filter_over ::= filter_clause */
   -4,  /* (322) over_clause ::= OVER LP window RP */
   -2,  /* (323) over_clause ::= OVER nm */
   -5,  /* (324) filter_clause ::= FILTER LP WHERE expr RP */
   -1,  /* (325) input ::= cmdlist */
   -2,  /* (326) cmdlist ::= cmdlist ecmd */
   -1,  /* (327) cmdlist ::= ecmd */
   -1,  /* (328) ecmd ::= SEMI */
   -2,  /* (329) ecmd ::= cmdx SEMI */
   -3,  /* (330) ecmd ::= explain cmdx SEMI */
    0,  /* (331) trans_opt ::= */
   -1,  /* (332) trans_opt ::= TRANSACTION */
   -2,  /* (333) trans_opt ::= TRANSACTION nm */
   -1,  /* (334) savepoint_opt ::= SAVEPOINT */
    0,  /* (335) savepoint_opt ::= */
   -2,  /* (336) cmd ::= create_table create_table_args */
   -4,  /* (337) columnlist ::= columnlist COMMA columnname carglist */
   -2,  /* (338) columnlist ::= columnname carglist */
   -1,  /* (339) nm ::= ID|INDEXED */
   -1,  /* (340) nm ::= STRING */
   -1,  /* (341) nm ::= JOIN_KW */

   -1,  /* (342) typetoken ::= typename */
   -1,  /* (343) typename ::= ID|STRING */
   -1,  /* (344) signed ::= plus_num */
   -1,  /* (345) signed ::= minus_num */
   -2,  /* (346) carglist ::= carglist ccons */
    0,  /* (347) carglist ::= */
   -2,  /* (348) ccons ::= NULL onconf */
   -4,  /* (349) ccons ::= GENERATED ALWAYS AS generated */
   -2,  /* (350) ccons ::= AS generated */
   -2,  /* (351) conslist_opt ::= COMMA conslist */
   -3,  /* (352) conslist ::= conslist tconscomma tcons */
   -1,  /* (353) conslist ::= tcons */
    0,  /* (354) tconscomma ::= */
   -1,  /* (355) defer_subclause_opt ::= defer_subclause */
   -1,  /* (356) resolvetype ::= raisetype */
   -1,  /* (357) selectnowith ::= oneselect */
   -1,  /* (358) oneselect ::= values */
   -2,  /* (359) sclp ::= selcollist COMMA */
   -1,  /* (360) as ::= ID|STRING */
   -1,  /* (361) expr ::= term */
   -1,  /* (362) likeop ::= LIKE_KW|MATCH */
   -1,  /* (363) exprlist ::= nexprlist */
   -1,  /* (364) nmnum ::= plus_num */
   -1,  /* (365) nmnum ::= nm */
   -1,  /* (366) nmnum ::= ON */
   -1,  /* (367) nmnum ::= DELETE */
   -1,  /* (368) nmnum ::= DEFAULT */

   -1,  /* (369) plus_num ::= INTEGER|FLOAT */
    0,  /* (370) foreach_clause ::= */
   -3,  /* (371) foreach_clause ::= FOR EACH ROW */
   -1,  /* (372) trnm ::= nm */
    0,  /* (373) tridxby ::= */
   -1,  /* (374) database_kw_opt ::= DATABASE */
    0,  /* (375) database_kw_opt ::= */
    0,  /* (376) kwcolumn_opt ::= */
   -1,  /* (377) kwcolumn_opt ::= COLUMNKW */
   -1,  /* (378) vtabarglist ::= vtabarg */
   -3,  /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */
   -2,  /* (380) vtabarg ::= vtabarg vtabargtoken */
    0,  /* (381) anylist ::= */
   -4,  /* (382) anylist ::= anylist LP anylist RP */
   -2,  /* (383) anylist ::= anylist ANY */
    0,  /* (384) with ::= */
};

static void yy_accept(yyParser*);  /* Forward Declaration */

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.







|
|

>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







158657
158658
158659
158660
158661
158662
158663
158664
158665
158666
158667
158668
158669
158670
158671
158672
158673
158674
158675
158676
158677
158678
158679
158680
158681
158682
158683
158684
158685
158686
158687
158688
158689
158690

158691
158692
158693
158694
158695
158696
158697
158698
158699
158700
158701
158702
158703
158704
158705
158706
158707
158708
158709
158710
158711
158712
158713
158714
158715
158716
158717
158718
158719
158720
158721
158722
158723
158724
158725
158726
158727
158728
158729
158730
158731
158732
158733
158734
158735
158736
158737
158738
158739
158740
158741
158742
158743
158744
158745
158746
158747
158748
158749
158750
158751
158752
158753
158754
158755
158756
158757
158758
158759
158760
158761
158762
158763
158764
158765
158766
158767
158768
158769
158770
158771
158772
158773
158774
158775
158776
158777
158778

158779
158780
158781
158782
158783
158784
158785
158786
158787
158788
158789
158790
158791
158792
158793
158794
158795
158796
158797
158798
158799
158800
158801
158802
158803
158804
158805
158806
158807
158808
158809
158810
158811
158812
158813
158814
158815
158816
158817
158818
158819
158820
158821
158822
158823
158824
158825
158826
158827
158828
158829
158830
158831
158832
158833
158834
158835
158836
158837
158838
158839
158840
158841
158842
158843
158844

158845
158846
158847
158848
158849
158850
158851
158852
158853
158854
158855
158856
158857
158858
158859
158860
158861
158862
158863
158864
158865
158866
158867
158868
158869

158870
158871
158872
158873
158874
158875
158876
158877
158878
158879
158880
158881
158882
158883
158884
158885
158886
158887
158888
158889
158890
158891
158892
158893
158894
158895
158896
158897
   -5,  /* (152) setlist ::= setlist COMMA nm EQ expr */
   -7,  /* (153) setlist ::= setlist COMMA LP idlist RP EQ expr */
   -3,  /* (154) setlist ::= nm EQ expr */
   -5,  /* (155) setlist ::= LP idlist RP EQ expr */
   -7,  /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
   -7,  /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
    0,  /* (158) upsert ::= */
  -12,  /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
   -9,  /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
   -4,  /* (161) upsert ::= ON CONFLICT DO NOTHING */
   -7,  /* (162) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
   -2,  /* (163) insert_cmd ::= INSERT orconf */
   -1,  /* (164) insert_cmd ::= REPLACE */
    0,  /* (165) idlist_opt ::= */
   -3,  /* (166) idlist_opt ::= LP idlist RP */
   -3,  /* (167) idlist ::= idlist COMMA nm */
   -1,  /* (168) idlist ::= nm */
   -3,  /* (169) expr ::= LP expr RP */
   -1,  /* (170) expr ::= ID|INDEXED */
   -1,  /* (171) expr ::= JOIN_KW */
   -3,  /* (172) expr ::= nm DOT nm */
   -5,  /* (173) expr ::= nm DOT nm DOT nm */
   -1,  /* (174) term ::= NULL|FLOAT|BLOB */
   -1,  /* (175) term ::= STRING */
   -1,  /* (176) term ::= INTEGER */
   -1,  /* (177) expr ::= VARIABLE */
   -3,  /* (178) expr ::= expr COLLATE ID|STRING */
   -6,  /* (179) expr ::= CAST LP expr AS typetoken RP */
   -5,  /* (180) expr ::= ID|INDEXED LP distinct exprlist RP */
   -4,  /* (181) expr ::= ID|INDEXED LP STAR RP */
   -6,  /* (182) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
   -5,  /* (183) expr ::= ID|INDEXED LP STAR RP filter_over */
   -1,  /* (184) term ::= CTIME_KW */
   -5,  /* (185) expr ::= LP nexprlist COMMA expr RP */

   -3,  /* (186) expr ::= expr AND expr */
   -3,  /* (187) expr ::= expr OR expr */
   -3,  /* (188) expr ::= expr LT|GT|GE|LE expr */
   -3,  /* (189) expr ::= expr EQ|NE expr */
   -3,  /* (190) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
   -3,  /* (191) expr ::= expr PLUS|MINUS expr */
   -3,  /* (192) expr ::= expr STAR|SLASH|REM expr */
   -3,  /* (193) expr ::= expr CONCAT expr */
   -2,  /* (194) likeop ::= NOT LIKE_KW|MATCH */
   -3,  /* (195) expr ::= expr likeop expr */
   -5,  /* (196) expr ::= expr likeop expr ESCAPE expr */
   -2,  /* (197) expr ::= expr ISNULL|NOTNULL */
   -3,  /* (198) expr ::= expr NOT NULL */
   -3,  /* (199) expr ::= expr IS expr */
   -4,  /* (200) expr ::= expr IS NOT expr */
   -2,  /* (201) expr ::= NOT expr */
   -2,  /* (202) expr ::= BITNOT expr */
   -2,  /* (203) expr ::= PLUS|MINUS expr */
   -1,  /* (204) between_op ::= BETWEEN */
   -2,  /* (205) between_op ::= NOT BETWEEN */
   -5,  /* (206) expr ::= expr between_op expr AND expr */
   -1,  /* (207) in_op ::= IN */
   -2,  /* (208) in_op ::= NOT IN */
   -5,  /* (209) expr ::= expr in_op LP exprlist RP */
   -3,  /* (210) expr ::= LP select RP */
   -5,  /* (211) expr ::= expr in_op LP select RP */
   -5,  /* (212) expr ::= expr in_op nm dbnm paren_exprlist */
   -4,  /* (213) expr ::= EXISTS LP select RP */
   -5,  /* (214) expr ::= CASE case_operand case_exprlist case_else END */
   -5,  /* (215) case_exprlist ::= case_exprlist WHEN expr THEN expr */
   -4,  /* (216) case_exprlist ::= WHEN expr THEN expr */
   -2,  /* (217) case_else ::= ELSE expr */
    0,  /* (218) case_else ::= */
   -1,  /* (219) case_operand ::= expr */
    0,  /* (220) case_operand ::= */
    0,  /* (221) exprlist ::= */
   -3,  /* (222) nexprlist ::= nexprlist COMMA expr */
   -1,  /* (223) nexprlist ::= expr */
    0,  /* (224) paren_exprlist ::= */
   -3,  /* (225) paren_exprlist ::= LP exprlist RP */
  -12,  /* (226) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
   -1,  /* (227) uniqueflag ::= UNIQUE */
    0,  /* (228) uniqueflag ::= */
    0,  /* (229) eidlist_opt ::= */
   -3,  /* (230) eidlist_opt ::= LP eidlist RP */
   -5,  /* (231) eidlist ::= eidlist COMMA nm collate sortorder */
   -3,  /* (232) eidlist ::= nm collate sortorder */
    0,  /* (233) collate ::= */
   -2,  /* (234) collate ::= COLLATE ID|STRING */
   -4,  /* (235) cmd ::= DROP INDEX ifexists fullname */
   -2,  /* (236) cmd ::= VACUUM vinto */
   -3,  /* (237) cmd ::= VACUUM nm vinto */
   -2,  /* (238) vinto ::= INTO expr */
    0,  /* (239) vinto ::= */
   -3,  /* (240) cmd ::= PRAGMA nm dbnm */
   -5,  /* (241) cmd ::= PRAGMA nm dbnm EQ nmnum */
   -6,  /* (242) cmd ::= PRAGMA nm dbnm LP nmnum RP */
   -5,  /* (243) cmd ::= PRAGMA nm dbnm EQ minus_num */
   -6,  /* (244) cmd ::= PRAGMA nm dbnm LP minus_num RP */
   -2,  /* (245) plus_num ::= PLUS INTEGER|FLOAT */
   -2,  /* (246) minus_num ::= MINUS INTEGER|FLOAT */
   -5,  /* (247) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
  -11,  /* (248) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
   -1,  /* (249) trigger_time ::= BEFORE|AFTER */
   -2,  /* (250) trigger_time ::= INSTEAD OF */
    0,  /* (251) trigger_time ::= */
   -1,  /* (252) trigger_event ::= DELETE|INSERT */
   -1,  /* (253) trigger_event ::= UPDATE */
   -3,  /* (254) trigger_event ::= UPDATE OF idlist */
    0,  /* (255) when_clause ::= */
   -2,  /* (256) when_clause ::= WHEN expr */
   -3,  /* (257) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
   -2,  /* (258) trigger_cmd_list ::= trigger_cmd SEMI */
   -3,  /* (259) trnm ::= nm DOT nm */
   -3,  /* (260) tridxby ::= INDEXED BY nm */
   -2,  /* (261) tridxby ::= NOT INDEXED */
   -9,  /* (262) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
   -8,  /* (263) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
   -6,  /* (264) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
   -3,  /* (265) trigger_cmd ::= scanpt select scanpt */
   -4,  /* (266) expr ::= RAISE LP IGNORE RP */
   -6,  /* (267) expr ::= RAISE LP raisetype COMMA nm RP */
   -1,  /* (268) raisetype ::= ROLLBACK */
   -1,  /* (269) raisetype ::= ABORT */
   -1,  /* (270) raisetype ::= FAIL */
   -4,  /* (271) cmd ::= DROP TRIGGER ifexists fullname */
   -6,  /* (272) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
   -3,  /* (273) cmd ::= DETACH database_kw_opt expr */

    0,  /* (274) key_opt ::= */
   -2,  /* (275) key_opt ::= KEY expr */
   -1,  /* (276) cmd ::= REINDEX */
   -3,  /* (277) cmd ::= REINDEX nm dbnm */
   -1,  /* (278) cmd ::= ANALYZE */
   -3,  /* (279) cmd ::= ANALYZE nm dbnm */
   -6,  /* (280) cmd ::= ALTER TABLE fullname RENAME TO nm */
   -7,  /* (281) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
   -1,  /* (282) add_column_fullname ::= fullname */
   -8,  /* (283) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
   -1,  /* (284) cmd ::= create_vtab */
   -4,  /* (285) cmd ::= create_vtab LP vtabarglist RP */
   -8,  /* (286) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
    0,  /* (287) vtabarg ::= */
   -1,  /* (288) vtabargtoken ::= ANY */
   -3,  /* (289) vtabargtoken ::= lp anylist RP */
   -1,  /* (290) lp ::= LP */
   -2,  /* (291) with ::= WITH wqlist */
   -3,  /* (292) with ::= WITH RECURSIVE wqlist */
   -6,  /* (293) wqlist ::= nm eidlist_opt AS LP select RP */
   -8,  /* (294) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
   -1,  /* (295) windowdefn_list ::= windowdefn */
   -3,  /* (296) windowdefn_list ::= windowdefn_list COMMA windowdefn */
   -5,  /* (297) windowdefn ::= nm AS LP window RP */
   -5,  /* (298) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
   -6,  /* (299) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
   -4,  /* (300) window ::= ORDER BY sortlist frame_opt */
   -5,  /* (301) window ::= nm ORDER BY sortlist frame_opt */
   -1,  /* (302) window ::= frame_opt */
   -2,  /* (303) window ::= nm frame_opt */
    0,  /* (304) frame_opt ::= */
   -3,  /* (305) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
   -6,  /* (306) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
   -1,  /* (307) range_or_rows ::= RANGE|ROWS|GROUPS */
   -1,  /* (308) frame_bound_s ::= frame_bound */
   -2,  /* (309) frame_bound_s ::= UNBOUNDED PRECEDING */
   -1,  /* (310) frame_bound_e ::= frame_bound */
   -2,  /* (311) frame_bound_e ::= UNBOUNDED FOLLOWING */
   -2,  /* (312) frame_bound ::= expr PRECEDING|FOLLOWING */
   -2,  /* (313) frame_bound ::= CURRENT ROW */
    0,  /* (314) frame_exclude_opt ::= */
   -2,  /* (315) frame_exclude_opt ::= EXCLUDE frame_exclude */
   -2,  /* (316) frame_exclude ::= NO OTHERS */
   -2,  /* (317) frame_exclude ::= CURRENT ROW */
   -1,  /* (318) frame_exclude ::= GROUP|TIES */
   -2,  /* (319) window_clause ::= WINDOW windowdefn_list */
   -2,  /* (320) filter_over ::= filter_clause over_clause */
   -1,  /* (321) filter_over ::= over_clause */
   -1,  /* (322) filter_over ::= filter_clause */
   -4,  /* (323) over_clause ::= OVER LP window RP */
   -2,  /* (324) over_clause ::= OVER nm */
   -5,  /* (325) filter_clause ::= FILTER LP WHERE expr RP */
   -1,  /* (326) input ::= cmdlist */
   -2,  /* (327) cmdlist ::= cmdlist ecmd */
   -1,  /* (328) cmdlist ::= ecmd */
   -1,  /* (329) ecmd ::= SEMI */
   -2,  /* (330) ecmd ::= cmdx SEMI */
   -3,  /* (331) ecmd ::= explain cmdx SEMI */
    0,  /* (332) trans_opt ::= */
   -1,  /* (333) trans_opt ::= TRANSACTION */
   -2,  /* (334) trans_opt ::= TRANSACTION nm */
   -1,  /* (335) savepoint_opt ::= SAVEPOINT */
    0,  /* (336) savepoint_opt ::= */
   -2,  /* (337) cmd ::= create_table create_table_args */
   -4,  /* (338) columnlist ::= columnlist COMMA columnname carglist */
   -2,  /* (339) columnlist ::= columnname carglist */

   -1,  /* (340) nm ::= ID|INDEXED */
   -1,  /* (341) nm ::= STRING */
   -1,  /* (342) nm ::= JOIN_KW */
   -1,  /* (343) typetoken ::= typename */
   -1,  /* (344) typename ::= ID|STRING */
   -1,  /* (345) signed ::= plus_num */
   -1,  /* (346) signed ::= minus_num */
   -2,  /* (347) carglist ::= carglist ccons */
    0,  /* (348) carglist ::= */
   -2,  /* (349) ccons ::= NULL onconf */
   -4,  /* (350) ccons ::= GENERATED ALWAYS AS generated */
   -2,  /* (351) ccons ::= AS generated */
   -2,  /* (352) conslist_opt ::= COMMA conslist */
   -3,  /* (353) conslist ::= conslist tconscomma tcons */
   -1,  /* (354) conslist ::= tcons */
    0,  /* (355) tconscomma ::= */
   -1,  /* (356) defer_subclause_opt ::= defer_subclause */
   -1,  /* (357) resolvetype ::= raisetype */
   -1,  /* (358) selectnowith ::= oneselect */
   -1,  /* (359) oneselect ::= values */
   -2,  /* (360) sclp ::= selcollist COMMA */
   -1,  /* (361) as ::= ID|STRING */
   -1,  /* (362) expr ::= term */
   -1,  /* (363) likeop ::= LIKE_KW|MATCH */
   -1,  /* (364) exprlist ::= nexprlist */

   -1,  /* (365) nmnum ::= plus_num */
   -1,  /* (366) nmnum ::= nm */
   -1,  /* (367) nmnum ::= ON */
   -1,  /* (368) nmnum ::= DELETE */
   -1,  /* (369) nmnum ::= DEFAULT */
   -1,  /* (370) plus_num ::= INTEGER|FLOAT */
    0,  /* (371) foreach_clause ::= */
   -3,  /* (372) foreach_clause ::= FOR EACH ROW */
   -1,  /* (373) trnm ::= nm */
    0,  /* (374) tridxby ::= */
   -1,  /* (375) database_kw_opt ::= DATABASE */
    0,  /* (376) database_kw_opt ::= */
    0,  /* (377) kwcolumn_opt ::= */
   -1,  /* (378) kwcolumn_opt ::= COLUMNKW */
   -1,  /* (379) vtabarglist ::= vtabarg */
   -3,  /* (380) vtabarglist ::= vtabarglist COMMA vtabarg */
   -2,  /* (381) vtabarg ::= vtabarg vtabargtoken */
    0,  /* (382) anylist ::= */
   -4,  /* (383) anylist ::= anylist LP anylist RP */
   -2,  /* (384) anylist ::= anylist ANY */
    0,  /* (385) with ::= */
};

static void yy_accept(yyParser*);  /* Forward Declaration */

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
158355
158356
158357
158358
158359
158360
158361
158362
158363
158364
158365
158366
158367
158368
158369
        break;
      case 4: /* transtype ::= */
{yymsp[1].minor.yy192 = TK_DEFERRED;}
        break;
      case 5: /* transtype ::= DEFERRED */
      case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
      case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
      case 306: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==306);
{yymsp[0].minor.yy192 = 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 */







|







158992
158993
158994
158995
158996
158997
158998
158999
159000
159001
159002
159003
159004
159005
159006
        break;
      case 4: /* transtype ::= */
{yymsp[1].minor.yy192 = TK_DEFERRED;}
        break;
      case 5: /* transtype ::= DEFERRED */
      case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
      case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
      case 307: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==307);
{yymsp[0].minor.yy192 = 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 */
158393
158394
158395
158396
158397
158398
158399
158400
158401
158402
158403
158404
158405
158406
158407
      case 18: /* temp ::= */ yytestcase(yyruleno==18);
      case 21: /* table_options ::= */ yytestcase(yyruleno==21);
      case 45: /* autoinc ::= */ yytestcase(yyruleno==45);
      case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60);
      case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70);
      case 79: /* ifexists ::= */ yytestcase(yyruleno==79);
      case 96: /* distinct ::= */ yytestcase(yyruleno==96);
      case 232: /* collate ::= */ yytestcase(yyruleno==232);
{yymsp[1].minor.yy192 = 0;}
        break;
      case 16: /* ifnotexists ::= IF NOT EXISTS */
{yymsp[-2].minor.yy192 = 1;}
        break;
      case 17: /* temp ::= TEMP */
      case 46: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==46);







|







159030
159031
159032
159033
159034
159035
159036
159037
159038
159039
159040
159041
159042
159043
159044
      case 18: /* temp ::= */ yytestcase(yyruleno==18);
      case 21: /* table_options ::= */ yytestcase(yyruleno==21);
      case 45: /* autoinc ::= */ yytestcase(yyruleno==45);
      case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60);
      case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70);
      case 79: /* ifexists ::= */ yytestcase(yyruleno==79);
      case 96: /* distinct ::= */ yytestcase(yyruleno==96);
      case 233: /* collate ::= */ yytestcase(yyruleno==233);
{yymsp[1].minor.yy192 = 0;}
        break;
      case 16: /* ifnotexists ::= IF NOT EXISTS */
{yymsp[-2].minor.yy192 = 1;}
        break;
      case 17: /* temp ::= TEMP */
      case 46: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==46);
158552
158553
158554
158555
158556
158557
158558
158559
158560
158561
158562
158563
158564
158565
158566
158567
158568
158569
158570
158571
158572
158573
{ yymsp[-1].minor.yy192 = OE_None;     /* EV: R-33326-45252 */}
        break;
      case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
{yymsp[-2].minor.yy192 = 0;}
        break;
      case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
      case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74);
      case 162: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==162);
{yymsp[-1].minor.yy192 = yymsp[0].minor.yy192;}
        break;
      case 61: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
      case 78: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==78);
      case 204: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==204);
      case 207: /* in_op ::= NOT IN */ yytestcase(yyruleno==207);
      case 233: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==233);
{yymsp[-1].minor.yy192 = 1;}
        break;
      case 62: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
{yymsp[-1].minor.yy192 = 0;}
        break;
      case 64: /* tconscomma ::= COMMA */
{pParse->constraintName.n = 0;}







|




|
|
|







159189
159190
159191
159192
159193
159194
159195
159196
159197
159198
159199
159200
159201
159202
159203
159204
159205
159206
159207
159208
159209
159210
{ yymsp[-1].minor.yy192 = OE_None;     /* EV: R-33326-45252 */}
        break;
      case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
{yymsp[-2].minor.yy192 = 0;}
        break;
      case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
      case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74);
      case 163: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==163);
{yymsp[-1].minor.yy192 = yymsp[0].minor.yy192;}
        break;
      case 61: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
      case 78: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==78);
      case 205: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==205);
      case 208: /* in_op ::= NOT IN */ yytestcase(yyruleno==208);
      case 234: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==234);
{yymsp[-1].minor.yy192 = 1;}
        break;
      case 62: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
{yymsp[-1].minor.yy192 = 0;}
        break;
      case 64: /* tconscomma ::= COMMA */
{pParse->constraintName.n = 0;}
158595
158596
158597
158598
158599
158600
158601
158602
158603
158604
158605
158606
158607
158608
158609
      case 72: /* onconf ::= ON CONFLICT resolvetype */
{yymsp[-2].minor.yy192 = yymsp[0].minor.yy192;}
        break;
      case 75: /* resolvetype ::= IGNORE */
{yymsp[0].minor.yy192 = OE_Ignore;}
        break;
      case 76: /* resolvetype ::= REPLACE */
      case 163: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==163);
{yymsp[0].minor.yy192 = OE_Replace;}
        break;
      case 77: /* cmd ::= DROP TABLE ifexists fullname */
{
  sqlite3DropTable(pParse, yymsp[0].minor.yy47, 0, yymsp[-1].minor.yy192);
}
        break;







|







159232
159233
159234
159235
159236
159237
159238
159239
159240
159241
159242
159243
159244
159245
159246
      case 72: /* onconf ::= ON CONFLICT resolvetype */
{yymsp[-2].minor.yy192 = yymsp[0].minor.yy192;}
        break;
      case 75: /* resolvetype ::= IGNORE */
{yymsp[0].minor.yy192 = OE_Ignore;}
        break;
      case 76: /* resolvetype ::= REPLACE */
      case 164: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==164);
{yymsp[0].minor.yy192 = OE_Replace;}
        break;
      case 77: /* cmd ::= DROP TABLE ifexists fullname */
{
  sqlite3DropTable(pParse, yymsp[0].minor.yy47, 0, yymsp[-1].minor.yy192);
}
        break;
158727
158728
158729
158730
158731
158732
158733
158734
158735
158736
158737
158738
158739
158740
158741
158742
158743
        break;
      case 95: /* distinct ::= ALL */
{yymsp[0].minor.yy192 = SF_All;}
        break;
      case 97: /* sclp ::= */
      case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130);
      case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140);
      case 220: /* exprlist ::= */ yytestcase(yyruleno==220);
      case 223: /* paren_exprlist ::= */ yytestcase(yyruleno==223);
      case 228: /* eidlist_opt ::= */ yytestcase(yyruleno==228);
{yymsp[1].minor.yy242 = 0;}
        break;
      case 98: /* selcollist ::= sclp scanpt expr scanpt as */
{
   yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
   if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy242, &yymsp[0].minor.yy0, 1);
   sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy242,yymsp[-3].minor.yy436,yymsp[-1].minor.yy436);







|
|
|







159364
159365
159366
159367
159368
159369
159370
159371
159372
159373
159374
159375
159376
159377
159378
159379
159380
        break;
      case 95: /* distinct ::= ALL */
{yymsp[0].minor.yy192 = SF_All;}
        break;
      case 97: /* sclp ::= */
      case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130);
      case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140);
      case 221: /* exprlist ::= */ yytestcase(yyruleno==221);
      case 224: /* paren_exprlist ::= */ yytestcase(yyruleno==224);
      case 229: /* eidlist_opt ::= */ yytestcase(yyruleno==229);
{yymsp[1].minor.yy242 = 0;}
        break;
      case 98: /* selcollist ::= sclp scanpt expr scanpt as */
{
   yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
   if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy242, &yymsp[0].minor.yy0, 1);
   sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy242,yymsp[-3].minor.yy436,yymsp[-1].minor.yy436);
158755
158756
158757
158758
158759
158760
158761
158762
158763
158764
158765
158766
158767
158768
158769
158770
  Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
  Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
  yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, pDot);
}
        break;
      case 101: /* as ::= AS nm */
      case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112);
      case 244: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==244);
      case 245: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==245);
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
        break;
      case 103: /* from ::= */
      case 106: /* stl_prefix ::= */ yytestcase(yyruleno==106);
{yymsp[1].minor.yy47 = 0;}
        break;
      case 104: /* from ::= FROM seltablist */







|
|







159392
159393
159394
159395
159396
159397
159398
159399
159400
159401
159402
159403
159404
159405
159406
159407
  Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
  Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
  yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, pDot);
}
        break;
      case 101: /* as ::= AS nm */
      case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112);
      case 245: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==245);
      case 246: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==246);
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
        break;
      case 103: /* from ::= */
      case 106: /* stl_prefix ::= */ yytestcase(yyruleno==106);
{yymsp[1].minor.yy47 = 0;}
        break;
      case 104: /* from ::= FROM seltablist */
158872
158873
158874
158875
158876
158877
158878
158879
158880
158881
158882
158883
158884
158885
158886
158887
158888
158889
158890
158891
158892
158893
158894
158895
158896
158897
158898
158899
158900
158901
158902
158903
158904
158905
158906
158907
158908
158909
        break;
      case 122: /* joinop ::= JOIN_KW nm nm JOIN */
{yymsp[-3].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
        break;
      case 123: /* on_opt ::= ON expr */
      case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143);
      case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150);
      case 216: /* case_else ::= ELSE expr */ yytestcase(yyruleno==216);
      case 237: /* vinto ::= INTO expr */ yytestcase(yyruleno==237);
{yymsp[-1].minor.yy202 = yymsp[0].minor.yy202;}
        break;
      case 124: /* on_opt ::= */
      case 142: /* having_opt ::= */ yytestcase(yyruleno==142);
      case 144: /* limit_opt ::= */ yytestcase(yyruleno==144);
      case 149: /* where_opt ::= */ yytestcase(yyruleno==149);
      case 217: /* case_else ::= */ yytestcase(yyruleno==217);
      case 219: /* case_operand ::= */ yytestcase(yyruleno==219);
      case 238: /* vinto ::= */ yytestcase(yyruleno==238);
{yymsp[1].minor.yy202 = 0;}
        break;
      case 126: /* indexed_opt ::= INDEXED BY nm */
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
        break;
      case 127: /* indexed_opt ::= NOT INDEXED */
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
        break;
      case 128: /* using_opt ::= USING LP idlist RP */
{yymsp[-3].minor.yy600 = yymsp[-1].minor.yy600;}
        break;
      case 129: /* using_opt ::= */
      case 164: /* idlist_opt ::= */ yytestcase(yyruleno==164);
{yymsp[1].minor.yy600 = 0;}
        break;
      case 131: /* orderby_opt ::= ORDER BY sortlist */
      case 141: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==141);
{yymsp[-2].minor.yy242 = yymsp[0].minor.yy242;}
        break;
      case 132: /* sortlist ::= sortlist COMMA expr sortorder nulls */







|
|






|
|
|












|







159509
159510
159511
159512
159513
159514
159515
159516
159517
159518
159519
159520
159521
159522
159523
159524
159525
159526
159527
159528
159529
159530
159531
159532
159533
159534
159535
159536
159537
159538
159539
159540
159541
159542
159543
159544
159545
159546
        break;
      case 122: /* joinop ::= JOIN_KW nm nm JOIN */
{yymsp[-3].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
        break;
      case 123: /* on_opt ::= ON expr */
      case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143);
      case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150);
      case 217: /* case_else ::= ELSE expr */ yytestcase(yyruleno==217);
      case 238: /* vinto ::= INTO expr */ yytestcase(yyruleno==238);
{yymsp[-1].minor.yy202 = yymsp[0].minor.yy202;}
        break;
      case 124: /* on_opt ::= */
      case 142: /* having_opt ::= */ yytestcase(yyruleno==142);
      case 144: /* limit_opt ::= */ yytestcase(yyruleno==144);
      case 149: /* where_opt ::= */ yytestcase(yyruleno==149);
      case 218: /* case_else ::= */ yytestcase(yyruleno==218);
      case 220: /* case_operand ::= */ yytestcase(yyruleno==220);
      case 239: /* vinto ::= */ yytestcase(yyruleno==239);
{yymsp[1].minor.yy202 = 0;}
        break;
      case 126: /* indexed_opt ::= INDEXED BY nm */
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
        break;
      case 127: /* indexed_opt ::= NOT INDEXED */
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
        break;
      case 128: /* using_opt ::= USING LP idlist RP */
{yymsp[-3].minor.yy600 = yymsp[-1].minor.yy600;}
        break;
      case 129: /* using_opt ::= */
      case 165: /* idlist_opt ::= */ yytestcase(yyruleno==165);
{yymsp[1].minor.yy600 = 0;}
        break;
      case 131: /* orderby_opt ::= ORDER BY sortlist */
      case 141: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==141);
{yymsp[-2].minor.yy242 = yymsp[0].minor.yy242;}
        break;
      case 132: /* sortlist ::= sortlist COMMA expr sortorder nulls */
158989
158990
158991
158992
158993
158994
158995
158996
158997
158998
158999
159000
159001
159002
159003
159004



159005
159006
159007
159008
159009
159010
159011
159012
159013
159014
159015
159016
159017
159018
159019
159020
159021
159022
159023
159024
159025
159026
159027
159028
159029
159030
159031
159032
159033
159034
159035
159036
159037
159038
159039
159040
159041
159042
159043
159044
159045
159046
159047
159048
159049
159050
159051
159052
159053
159054
159055
159056
159057
159058
159059
159060
159061
159062
159063
159064
{
  sqlite3Insert(pParse, yymsp[-3].minor.yy47, 0, yymsp[-2].minor.yy600, yymsp[-5].minor.yy192, 0);
}
        break;
      case 158: /* upsert ::= */
{ yymsp[1].minor.yy318 = 0; }
        break;
      case 159: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
{ yymsp[-10].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy242,yymsp[-5].minor.yy202,yymsp[-1].minor.yy242,yymsp[0].minor.yy202);}
        break;
      case 160: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
{ yymsp[-7].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy242,yymsp[-2].minor.yy202,0,0); }
        break;
      case 161: /* upsert ::= ON CONFLICT DO NOTHING */
{ yymsp[-3].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,0,0); }
        break;



      case 165: /* idlist_opt ::= LP idlist RP */
{yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600;}
        break;
      case 166: /* idlist ::= idlist COMMA nm */
{yymsp[-2].minor.yy600 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy600,&yymsp[0].minor.yy0);}
        break;
      case 167: /* idlist ::= nm */
{yymsp[0].minor.yy600 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
        break;
      case 168: /* expr ::= LP expr RP */
{yymsp[-2].minor.yy202 = yymsp[-1].minor.yy202;}
        break;
      case 169: /* expr ::= ID|INDEXED */
      case 170: /* expr ::= JOIN_KW */ yytestcase(yyruleno==170);
{yymsp[0].minor.yy202=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
        break;
      case 171: /* 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.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
        break;
      case 172: /* 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.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
}
  yymsp[-4].minor.yy202 = yylhsminor.yy202;
        break;
      case 173: /* term ::= NULL|FLOAT|BLOB */
      case 174: /* term ::= STRING */ yytestcase(yyruleno==174);
{yymsp[0].minor.yy202=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
        break;
      case 175: /* term ::= INTEGER */
{
  yylhsminor.yy202 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
        break;
      case 176: /* 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.yy202 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
    sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy202, n);
  }else{
    /* When doing a nested parse, one can include terms in an expression







|
|

|
|


|

>
>
>
|


|


|


|


|
|


|











|













|
|


|





|







159626
159627
159628
159629
159630
159631
159632
159633
159634
159635
159636
159637
159638
159639
159640
159641
159642
159643
159644
159645
159646
159647
159648
159649
159650
159651
159652
159653
159654
159655
159656
159657
159658
159659
159660
159661
159662
159663
159664
159665
159666
159667
159668
159669
159670
159671
159672
159673
159674
159675
159676
159677
159678
159679
159680
159681
159682
159683
159684
159685
159686
159687
159688
159689
159690
159691
159692
159693
159694
159695
159696
159697
159698
159699
159700
159701
159702
159703
159704
{
  sqlite3Insert(pParse, yymsp[-3].minor.yy47, 0, yymsp[-2].minor.yy600, yymsp[-5].minor.yy192, 0);
}
        break;
      case 158: /* upsert ::= */
{ yymsp[1].minor.yy318 = 0; }
        break;
      case 159: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
{ yymsp[-11].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy242,yymsp[-6].minor.yy202,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202,yymsp[0].minor.yy318);}
        break;
      case 160: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
{ yymsp[-8].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy242,yymsp[-3].minor.yy202,0,0,yymsp[0].minor.yy318); }
        break;
      case 161: /* upsert ::= ON CONFLICT DO NOTHING */
{ yymsp[-3].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
        break;
      case 162: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
{ yymsp[-6].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-1].minor.yy242,yymsp[0].minor.yy202,0);}
        break;
      case 166: /* idlist_opt ::= LP idlist RP */
{yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600;}
        break;
      case 167: /* idlist ::= idlist COMMA nm */
{yymsp[-2].minor.yy600 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy600,&yymsp[0].minor.yy0);}
        break;
      case 168: /* idlist ::= nm */
{yymsp[0].minor.yy600 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
        break;
      case 169: /* expr ::= LP expr RP */
{yymsp[-2].minor.yy202 = yymsp[-1].minor.yy202;}
        break;
      case 170: /* expr ::= ID|INDEXED */
      case 171: /* expr ::= JOIN_KW */ yytestcase(yyruleno==171);
{yymsp[0].minor.yy202=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
        break;
      case 172: /* 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.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
}
  yymsp[-2].minor.yy202 = yylhsminor.yy202;
        break;
      case 173: /* 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.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
}
  yymsp[-4].minor.yy202 = yylhsminor.yy202;
        break;
      case 174: /* term ::= NULL|FLOAT|BLOB */
      case 175: /* term ::= STRING */ yytestcase(yyruleno==175);
{yymsp[0].minor.yy202=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
        break;
      case 176: /* term ::= INTEGER */
{
  yylhsminor.yy202 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
        break;
      case 177: /* 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.yy202 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
    sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy202, n);
  }else{
    /* When doing a nested parse, one can include terms in an expression
159072
159073
159074
159075
159076
159077
159078
159079
159080
159081
159082
159083
159084
159085
159086
159087
159088
159089
159090
159091
159092
159093
159094
159095
159096
159097
159098
159099
159100
159101
159102
159103
159104
159105
159106
159107
159108
159109
159110
159111
159112
159113
159114
159115
159116
159117
159118
159119
159120
159121
159122
159123
159124
159125
159126
159127
159128
159129
159130
159131
159132
159133
159134
159135
159136
159137
159138
159139
159140
159141
159142
159143
159144
159145
159146
159147
159148
159149
159150
159151
159152
159153
159154
159155
159156
159157
159158
159159
159160
159161
159162
159163
159164
159165
159166
159167
159168
159169
159170
159171
159172
159173
159174
159175
159176
159177
159178
159179
159180
159181
159182
159183
159184
159185
159186
159187
159188
159189
159190
159191
159192
159193
159194
159195
159196
159197
159198
159199
159200
159201
159202
159203
159204
159205
159206
159207
159208
159209
159210
159211
159212
159213
159214
159215
159216
159217
159218
159219
159220
159221
159222
159223
159224
159225
159226
159227
159228
    }else{
      yymsp[0].minor.yy202 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
      if( yymsp[0].minor.yy202 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy202->iTable);
    }
  }
}
        break;
      case 177: /* expr ::= expr COLLATE ID|STRING */
{
  yymsp[-2].minor.yy202 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy202, &yymsp[0].minor.yy0, 1);
}
        break;
      case 178: /* expr ::= CAST LP expr AS typetoken RP */
{
  yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
  sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy202, yymsp[-3].minor.yy202, 0);
}
        break;
      case 179: /* expr ::= ID|INDEXED LP distinct exprlist RP */
{
  yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy192);
}
  yymsp[-4].minor.yy202 = yylhsminor.yy202;
        break;
      case 180: /* expr ::= ID|INDEXED LP STAR RP */
{
  yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
}
  yymsp[-3].minor.yy202 = yylhsminor.yy202;
        break;
      case 181: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
{
  yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy242, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy192);
  sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
}
  yymsp[-5].minor.yy202 = yylhsminor.yy202;
        break;
      case 182: /* expr ::= ID|INDEXED LP STAR RP filter_over */
{
  yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
  sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
}
  yymsp[-4].minor.yy202 = yylhsminor.yy202;
        break;
      case 183: /* term ::= CTIME_KW */
{
  yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
        break;
      case 184: /* expr ::= LP nexprlist COMMA expr RP */
{
  ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202);
  yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
  if( yymsp[-4].minor.yy202 ){
    yymsp[-4].minor.yy202->x.pList = pList;
    if( ALWAYS(pList->nExpr) ){
      yymsp[-4].minor.yy202->flags |= pList->a[0].pExpr->flags & EP_Propagate;
    }
  }else{
    sqlite3ExprListDelete(pParse->db, pList);
  }
}
        break;
      case 185: /* expr ::= expr AND expr */
{yymsp[-2].minor.yy202=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
        break;
      case 186: /* expr ::= expr OR expr */
      case 187: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==187);
      case 188: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==188);
      case 189: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==189);
      case 190: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==190);
      case 191: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==191);
      case 192: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==192);
{yymsp[-2].minor.yy202=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
        break;
      case 193: /* 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 194: /* 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.yy202);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy202);
  yymsp[-2].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
  if( bNot ) yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy202, 0);
  if( yymsp[-2].minor.yy202 ) yymsp[-2].minor.yy202->flags |= EP_InfixFunc;
}
        break;
      case 195: /* 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.yy202);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy202);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202);
  yymsp[-4].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
  if( bNot ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
  if( yymsp[-4].minor.yy202 ) yymsp[-4].minor.yy202->flags |= EP_InfixFunc;
}
        break;
      case 196: /* expr ::= expr ISNULL|NOTNULL */
{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy202,0);}
        break;
      case 197: /* expr ::= expr NOT NULL */
{yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy202,0);}
        break;
      case 198: /* expr ::= expr IS expr */
{
  yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);
  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-2].minor.yy202, TK_ISNULL);
}
        break;
      case 199: /* expr ::= expr IS NOT expr */
{
  yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy202,yymsp[0].minor.yy202);
  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-3].minor.yy202, TK_NOTNULL);
}
        break;
      case 200: /* expr ::= NOT expr */
      case 201: /* expr ::= BITNOT expr */ yytestcase(yyruleno==201);
{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy202, 0);/*A-overwrites-B*/}
        break;
      case 202: /* expr ::= PLUS|MINUS expr */
{
  yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy202, 0);
  /*A-overwrites-B*/
}
        break;
      case 203: /* between_op ::= BETWEEN */
      case 206: /* in_op ::= IN */ yytestcase(yyruleno==206);
{yymsp[0].minor.yy192 = 0;}
        break;
      case 205: /* expr ::= expr between_op expr AND expr */
{
  ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202);
  yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy202, 0);
  if( yymsp[-4].minor.yy202 ){
    yymsp[-4].minor.yy202->x.pList = pList;
  }else{
    sqlite3ExprListDelete(pParse->db, pList);
  }
  if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
}
        break;
      case 208: /* expr ::= expr in_op LP exprlist RP */
{
    if( yymsp[-1].minor.yy242==0 ){
      /* Expressions of the form
      **
      **      expr1 IN ()
      **      expr1 NOT IN ()
      **







|




|





|





|





|






|






|





|













|


|
|
|
|
|
|
|


|


|











|












|


|


|





|





|
|


|





|
|


|












|







159712
159713
159714
159715
159716
159717
159718
159719
159720
159721
159722
159723
159724
159725
159726
159727
159728
159729
159730
159731
159732
159733
159734
159735
159736
159737
159738
159739
159740
159741
159742
159743
159744
159745
159746
159747
159748
159749
159750
159751
159752
159753
159754
159755
159756
159757
159758
159759
159760
159761
159762
159763
159764
159765
159766
159767
159768
159769
159770
159771
159772
159773
159774
159775
159776
159777
159778
159779
159780
159781
159782
159783
159784
159785
159786
159787
159788
159789
159790
159791
159792
159793
159794
159795
159796
159797
159798
159799
159800
159801
159802
159803
159804
159805
159806
159807
159808
159809
159810
159811
159812
159813
159814
159815
159816
159817
159818
159819
159820
159821
159822
159823
159824
159825
159826
159827
159828
159829
159830
159831
159832
159833
159834
159835
159836
159837
159838
159839
159840
159841
159842
159843
159844
159845
159846
159847
159848
159849
159850
159851
159852
159853
159854
159855
159856
159857
159858
159859
159860
159861
159862
159863
159864
159865
159866
159867
159868
    }else{
      yymsp[0].minor.yy202 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
      if( yymsp[0].minor.yy202 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy202->iTable);
    }
  }
}
        break;
      case 178: /* expr ::= expr COLLATE ID|STRING */
{
  yymsp[-2].minor.yy202 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy202, &yymsp[0].minor.yy0, 1);
}
        break;
      case 179: /* expr ::= CAST LP expr AS typetoken RP */
{
  yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
  sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy202, yymsp[-3].minor.yy202, 0);
}
        break;
      case 180: /* expr ::= ID|INDEXED LP distinct exprlist RP */
{
  yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy192);
}
  yymsp[-4].minor.yy202 = yylhsminor.yy202;
        break;
      case 181: /* expr ::= ID|INDEXED LP STAR RP */
{
  yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
}
  yymsp[-3].minor.yy202 = yylhsminor.yy202;
        break;
      case 182: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
{
  yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy242, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy192);
  sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
}
  yymsp[-5].minor.yy202 = yylhsminor.yy202;
        break;
      case 183: /* expr ::= ID|INDEXED LP STAR RP filter_over */
{
  yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
  sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
}
  yymsp[-4].minor.yy202 = yylhsminor.yy202;
        break;
      case 184: /* term ::= CTIME_KW */
{
  yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
}
  yymsp[0].minor.yy202 = yylhsminor.yy202;
        break;
      case 185: /* expr ::= LP nexprlist COMMA expr RP */
{
  ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202);
  yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
  if( yymsp[-4].minor.yy202 ){
    yymsp[-4].minor.yy202->x.pList = pList;
    if( ALWAYS(pList->nExpr) ){
      yymsp[-4].minor.yy202->flags |= pList->a[0].pExpr->flags & EP_Propagate;
    }
  }else{
    sqlite3ExprListDelete(pParse->db, pList);
  }
}
        break;
      case 186: /* expr ::= expr AND expr */
{yymsp[-2].minor.yy202=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
        break;
      case 187: /* expr ::= expr OR expr */
      case 188: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==188);
      case 189: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==189);
      case 190: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==190);
      case 191: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==191);
      case 192: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==192);
      case 193: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==193);
{yymsp[-2].minor.yy202=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
        break;
      case 194: /* 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 195: /* 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.yy202);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy202);
  yymsp[-2].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
  if( bNot ) yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy202, 0);
  if( yymsp[-2].minor.yy202 ) yymsp[-2].minor.yy202->flags |= EP_InfixFunc;
}
        break;
      case 196: /* 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.yy202);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy202);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202);
  yymsp[-4].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
  if( bNot ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
  if( yymsp[-4].minor.yy202 ) yymsp[-4].minor.yy202->flags |= EP_InfixFunc;
}
        break;
      case 197: /* expr ::= expr ISNULL|NOTNULL */
{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy202,0);}
        break;
      case 198: /* expr ::= expr NOT NULL */
{yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy202,0);}
        break;
      case 199: /* expr ::= expr IS expr */
{
  yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);
  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-2].minor.yy202, TK_ISNULL);
}
        break;
      case 200: /* expr ::= expr IS NOT expr */
{
  yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy202,yymsp[0].minor.yy202);
  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-3].minor.yy202, TK_NOTNULL);
}
        break;
      case 201: /* expr ::= NOT expr */
      case 202: /* expr ::= BITNOT expr */ yytestcase(yyruleno==202);
{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy202, 0);/*A-overwrites-B*/}
        break;
      case 203: /* expr ::= PLUS|MINUS expr */
{
  yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy202, 0);
  /*A-overwrites-B*/
}
        break;
      case 204: /* between_op ::= BETWEEN */
      case 207: /* in_op ::= IN */ yytestcase(yyruleno==207);
{yymsp[0].minor.yy192 = 0;}
        break;
      case 206: /* expr ::= expr between_op expr AND expr */
{
  ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202);
  yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy202, 0);
  if( yymsp[-4].minor.yy202 ){
    yymsp[-4].minor.yy202->x.pList = pList;
  }else{
    sqlite3ExprListDelete(pParse->db, pList);
  }
  if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
}
        break;
      case 209: /* expr ::= expr in_op LP exprlist RP */
{
    if( yymsp[-1].minor.yy242==0 ){
      /* Expressions of the form
      **
      **      expr1 IN ()
      **      expr1 NOT IN ()
      **
159246
159247
159248
159249
159250
159251
159252
159253
159254
159255
159256
159257
159258
159259
159260
159261
159262
159263
159264
159265
159266
159267
159268
159269
159270
159271
159272
159273
159274
159275
159276
159277
159278
159279
159280
159281
159282
159283
159284
159285
159286
159287
159288
159289
159290
159291
159292
159293
159294
159295
159296
159297
159298
159299
159300
159301
159302
159303
159304
159305
159306
159307
159308
159309
159310
159311
159312
159313
159314
159315
159316
159317
159318
159319
159320
159321
159322
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
159353
159354
159355
159356
159357
159358
159359
159360
159361
159362
159363
159364
159365
159366
159367
159368
159369
159370
159371
159372
159373
159374
159375
159376
159377
159378
159379
159380
159381
159382
159383
159384
159385
159386
159387
159388
159389
159390
159391
159392
159393
159394
159395
159396
159397
159398
159399
159400
159401
159402
159403
159404
159405
159406
159407
159408
159409
159410
159411
159412
159413
159414
159415
159416
159417
159418
159419
159420
159421
159422
159423
159424
159425
159426
159427
159428
159429
159430
159431
159432
159433
159434
159435
159436
159437
159438
159439
159440
159441
159442
159443
159444
159445
159446
159447
159448
159449
159450
159451
159452
159453
159454
159455
159456
159457
159458
159459
159460
159461
159462
159463
159464
159465
159466
159467
159468
159469
159470
159471
159472
159473
159474
159475
159476
159477
159478
159479
159480
159481
159482
159483
159484
159485
159486
159487
159488
159489
159490
159491
159492
159493
159494
159495
159496
159497
159498
159499
159500
159501
159502
159503
159504
159505
159506
159507
159508
159509
159510
159511
159512
159513
159514
159515
159516
159517
159518
159519
159520
159521
159522
159523
159524
159525
159526
159527
159528
159529
159530
159531
159532
159533
159534
159535
159536
159537
159538
159539
159540
159541
159542
159543
159544
159545
159546
159547
159548
159549
159550
159551
159552
159553
159554
159555
159556
159557
159558
159559
159560
159561
159562
159563
159564
159565
159566
159567
159568
159569
159570
159571
159572
159573
159574
159575
159576
159577
159578
159579
159580
159581
159582
159583
159584
159585
159586
159587
159588
159589
159590
159591
159592
159593
159594
159595
159596
159597
159598
159599
159600
159601
159602
159603
159604
159605
159606
159607
159608
159609
159610
159611
159612
159613
159614
159615
159616
159617
159618
159619
159620
159621
159622
159623
159624
159625
159626
159627
159628
159629
159630
159631
159632
159633
159634
159635
159636
159637
159638
159639
159640
159641
159642
159643
159644
159645
159646
159647
159648
159649
159650
159651
159652
159653
159654
159655
159656
159657
159658
159659
159660
159661
159662
159663
159664
159665
159666
159667
159668
159669
159670
159671
159672
159673
159674
159675
159676
159677
159678
159679
159680
159681
159682
159683
159684
159685
159686
159687
159688
159689
159690
159691
159692
159693
159694
159695
159696
159697
159698
159699
159700
159701
159702
159703
159704
159705
159706
159707
159708
159709
159710
159711
159712
159713
159714
159715
159716
159717
159718
159719
159720
159721
159722
159723
159724
159725
159726
159727
159728
159729
159730
159731
159732
159733
159734
159735
159736
159737
159738
159739
159740
159741
159742
159743
159744
159745
159746
159747
159748
159749
159750
159751
159752
159753
159754
159755
159756
159757
159758
159759
159760
159761
159762
159763
159764
159765
159766
159767
159768
159769
159770
159771
159772
159773
159774
      }else{
        sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy242);
      }
      if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
    }
  }
        break;
      case 209: /* expr ::= LP select RP */
{
    yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy202, yymsp[-1].minor.yy539);
  }
        break;
      case 210: /* expr ::= expr in_op LP select RP */
{
    yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, yymsp[-1].minor.yy539);
    if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
  }
        break;
      case 211: /* 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.yy242 )  sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy242);
    yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, pSelect);
    if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
  }
        break;
      case 212: /* expr ::= EXISTS LP select RP */
{
    Expr *p;
    p = yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
    sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy539);
  }
        break;
      case 213: /* expr ::= CASE case_operand case_exprlist case_else END */
{
  yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy202, 0);
  if( yymsp[-4].minor.yy202 ){
    yymsp[-4].minor.yy202->x.pList = yymsp[-1].minor.yy202 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202) : yymsp[-2].minor.yy242;
    sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202);
  }else{
    sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy242);
    sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy202);
  }
}
        break;
      case 214: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
{
  yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
  yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[0].minor.yy202);
}
        break;
      case 215: /* case_exprlist ::= WHEN expr THEN expr */
{
  yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
  yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy242, yymsp[0].minor.yy202);
}
        break;
      case 218: /* case_operand ::= expr */
{yymsp[0].minor.yy202 = yymsp[0].minor.yy202; /*A-overwrites-X*/}
        break;
      case 221: /* nexprlist ::= nexprlist COMMA expr */
{yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[0].minor.yy202);}
        break;
      case 222: /* nexprlist ::= expr */
{yymsp[0].minor.yy242 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy202); /*A-overwrites-Y*/}
        break;
      case 224: /* paren_exprlist ::= LP exprlist RP */
      case 229: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==229);
{yymsp[-2].minor.yy242 = yymsp[-1].minor.yy242;}
        break;
      case 225: /* 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.yy242, yymsp[-10].minor.yy192,
                      &yymsp[-11].minor.yy0, yymsp[0].minor.yy202, SQLITE_SO_ASC, yymsp[-8].minor.yy192, SQLITE_IDXTYPE_APPDEF);
  if( IN_RENAME_OBJECT && pParse->pNewIndex ){
    sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
  }
}
        break;
      case 226: /* uniqueflag ::= UNIQUE */
      case 268: /* raisetype ::= ABORT */ yytestcase(yyruleno==268);
{yymsp[0].minor.yy192 = OE_Abort;}
        break;
      case 227: /* uniqueflag ::= */
{yymsp[1].minor.yy192 = OE_None;}
        break;
      case 230: /* eidlist ::= eidlist COMMA nm collate sortorder */
{
  yymsp[-4].minor.yy242 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy242, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192);
}
        break;
      case 231: /* eidlist ::= nm collate sortorder */
{
  yymsp[-2].minor.yy242 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); /*A-overwrites-Y*/
}
        break;
      case 234: /* cmd ::= DROP INDEX ifexists fullname */
{sqlite3DropIndex(pParse, yymsp[0].minor.yy47, yymsp[-1].minor.yy192);}
        break;
      case 235: /* cmd ::= VACUUM vinto */
{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy202);}
        break;
      case 236: /* cmd ::= VACUUM nm vinto */
{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy202);}
        break;
      case 239: /* cmd ::= PRAGMA nm dbnm */
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
        break;
      case 240: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
        break;
      case 241: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
        break;
      case 242: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
        break;
      case 243: /* 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 246: /* 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.yy447, &all);
}
        break;
      case 247: /* 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.yy192, yymsp[-4].minor.yy230.a, yymsp[-4].minor.yy230.b, yymsp[-2].minor.yy47, yymsp[0].minor.yy202, yymsp[-10].minor.yy192, yymsp[-8].minor.yy192);
  yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
}
        break;
      case 248: /* trigger_time ::= BEFORE|AFTER */
{ yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/ }
        break;
      case 249: /* trigger_time ::= INSTEAD OF */
{ yymsp[-1].minor.yy192 = TK_INSTEAD;}
        break;
      case 250: /* trigger_time ::= */
{ yymsp[1].minor.yy192 = TK_BEFORE; }
        break;
      case 251: /* trigger_event ::= DELETE|INSERT */
      case 252: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==252);
{yymsp[0].minor.yy230.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy230.b = 0;}
        break;
      case 253: /* trigger_event ::= UPDATE OF idlist */
{yymsp[-2].minor.yy230.a = TK_UPDATE; yymsp[-2].minor.yy230.b = yymsp[0].minor.yy600;}
        break;
      case 254: /* when_clause ::= */
      case 273: /* key_opt ::= */ yytestcase(yyruleno==273);
{ yymsp[1].minor.yy202 = 0; }
        break;
      case 255: /* when_clause ::= WHEN expr */
      case 274: /* key_opt ::= KEY expr */ yytestcase(yyruleno==274);
{ yymsp[-1].minor.yy202 = yymsp[0].minor.yy202; }
        break;
      case 256: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
{
  assert( yymsp[-2].minor.yy447!=0 );
  yymsp[-2].minor.yy447->pLast->pNext = yymsp[-1].minor.yy447;
  yymsp[-2].minor.yy447->pLast = yymsp[-1].minor.yy447;
}
        break;
      case 257: /* trigger_cmd_list ::= trigger_cmd SEMI */
{
  assert( yymsp[-1].minor.yy447!=0 );
  yymsp[-1].minor.yy447->pLast = yymsp[-1].minor.yy447;
}
        break;
      case 258: /* 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 259: /* tridxby ::= INDEXED BY nm */
{
  sqlite3ErrorMsg(pParse,
        "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
        "within triggers");
}
        break;
      case 260: /* tridxby ::= NOT INDEXED */
{
  sqlite3ErrorMsg(pParse,
        "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
        "within triggers");
}
        break;
      case 261: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
{yylhsminor.yy447 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy47, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202, yymsp[-7].minor.yy192, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy436);}
  yymsp[-8].minor.yy447 = yylhsminor.yy447;
        break;
      case 262: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
{
   yylhsminor.yy447 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy600,yymsp[-2].minor.yy539,yymsp[-6].minor.yy192,yymsp[-1].minor.yy318,yymsp[-7].minor.yy436,yymsp[0].minor.yy436);/*yylhsminor.yy447-overwrites-yymsp[-6].minor.yy192*/
}
  yymsp[-7].minor.yy447 = yylhsminor.yy447;
        break;
      case 263: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
{yylhsminor.yy447 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy202, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy436);}
  yymsp[-5].minor.yy447 = yylhsminor.yy447;
        break;
      case 264: /* trigger_cmd ::= scanpt select scanpt */
{yylhsminor.yy447 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy539, yymsp[-2].minor.yy436, yymsp[0].minor.yy436); /*yylhsminor.yy447-overwrites-yymsp[-1].minor.yy539*/}
  yymsp[-2].minor.yy447 = yylhsminor.yy447;
        break;
      case 265: /* expr ::= RAISE LP IGNORE RP */
{
  yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
  if( yymsp[-3].minor.yy202 ){
    yymsp[-3].minor.yy202->affExpr = OE_Ignore;
  }
}
        break;
      case 266: /* expr ::= RAISE LP raisetype COMMA nm RP */
{
  yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
  if( yymsp[-5].minor.yy202 ) {
    yymsp[-5].minor.yy202->affExpr = (char)yymsp[-3].minor.yy192;
  }
}
        break;
      case 267: /* raisetype ::= ROLLBACK */
{yymsp[0].minor.yy192 = OE_Rollback;}
        break;
      case 269: /* raisetype ::= FAIL */
{yymsp[0].minor.yy192 = OE_Fail;}
        break;
      case 270: /* cmd ::= DROP TRIGGER ifexists fullname */
{
  sqlite3DropTrigger(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy192);
}
        break;
      case 271: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
{
  sqlite3Attach(pParse, yymsp[-3].minor.yy202, yymsp[-1].minor.yy202, yymsp[0].minor.yy202);
}
        break;
      case 272: /* cmd ::= DETACH database_kw_opt expr */
{
  sqlite3Detach(pParse, yymsp[0].minor.yy202);
}
        break;
      case 275: /* cmd ::= REINDEX */
{sqlite3Reindex(pParse, 0, 0);}
        break;
      case 276: /* cmd ::= REINDEX nm dbnm */
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
        break;
      case 277: /* cmd ::= ANALYZE */
{sqlite3Analyze(pParse, 0, 0);}
        break;
      case 278: /* cmd ::= ANALYZE nm dbnm */
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
        break;
      case 279: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
{
  sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy47,&yymsp[0].minor.yy0);
}
        break;
      case 280: /* 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 281: /* add_column_fullname ::= fullname */
{
  disableLookaside(pParse);
  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy47);
}
        break;
      case 282: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
{
  sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy47, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
        break;
      case 283: /* cmd ::= create_vtab */
{sqlite3VtabFinishParse(pParse,0);}
        break;
      case 284: /* cmd ::= create_vtab LP vtabarglist RP */
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
        break;
      case 285: /* 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.yy192);
}
        break;
      case 286: /* vtabarg ::= */
{sqlite3VtabArgInit(pParse);}
        break;
      case 287: /* vtabargtoken ::= ANY */
      case 288: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==288);
      case 289: /* lp ::= LP */ yytestcase(yyruleno==289);
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
        break;
      case 290: /* with ::= WITH wqlist */
      case 291: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==291);
{ sqlite3WithPush(pParse, yymsp[0].minor.yy131, 1); }
        break;
      case 292: /* wqlist ::= nm eidlist_opt AS LP select RP */
{
  yymsp[-5].minor.yy131 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); /*A-overwrites-X*/
}
        break;
      case 293: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
{
  yymsp[-7].minor.yy131 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy131, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539);
}
        break;
      case 294: /* windowdefn_list ::= windowdefn */
{ yylhsminor.yy303 = yymsp[0].minor.yy303; }
  yymsp[0].minor.yy303 = yylhsminor.yy303;
        break;
      case 295: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
{
  assert( yymsp[0].minor.yy303!=0 );
  sqlite3WindowChain(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy303);
  yymsp[0].minor.yy303->pNextWin = yymsp[-2].minor.yy303;
  yylhsminor.yy303 = yymsp[0].minor.yy303;
}
  yymsp[-2].minor.yy303 = yylhsminor.yy303;
        break;
      case 296: /* windowdefn ::= nm AS LP window RP */
{
  if( ALWAYS(yymsp[-1].minor.yy303) ){
    yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
  }
  yylhsminor.yy303 = yymsp[-1].minor.yy303;
}
  yymsp[-4].minor.yy303 = yylhsminor.yy303;
        break;
      case 297: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
{
  yymsp[-4].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, 0);
}
        break;
      case 298: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
{
  yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, &yymsp[-5].minor.yy0);
}
  yymsp[-5].minor.yy303 = yylhsminor.yy303;
        break;
      case 299: /* window ::= ORDER BY sortlist frame_opt */
{
  yymsp[-3].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, 0);
}
        break;
      case 300: /* window ::= nm ORDER BY sortlist frame_opt */
{
  yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0);
}
  yymsp[-4].minor.yy303 = yylhsminor.yy303;
        break;
      case 301: /* window ::= frame_opt */
      case 320: /* filter_over ::= over_clause */ yytestcase(yyruleno==320);
{
  yylhsminor.yy303 = yymsp[0].minor.yy303;
}
  yymsp[0].minor.yy303 = yylhsminor.yy303;
        break;
      case 302: /* window ::= nm frame_opt */
{
  yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, 0, &yymsp[-1].minor.yy0);
}
  yymsp[-1].minor.yy303 = yylhsminor.yy303;
        break;
      case 303: /* frame_opt ::= */
{
  yymsp[1].minor.yy303 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
}
        break;
      case 304: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
{
  yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy192, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy58);
}
  yymsp[-2].minor.yy303 = yylhsminor.yy303;
        break;
      case 305: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
{
  yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy192, yymsp[-3].minor.yy77.eType, yymsp[-3].minor.yy77.pExpr, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, yymsp[0].minor.yy58);
}
  yymsp[-5].minor.yy303 = yylhsminor.yy303;
        break;
      case 307: /* frame_bound_s ::= frame_bound */
      case 309: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==309);
{yylhsminor.yy77 = yymsp[0].minor.yy77;}
  yymsp[0].minor.yy77 = yylhsminor.yy77;
        break;
      case 308: /* frame_bound_s ::= UNBOUNDED PRECEDING */
      case 310: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==310);
      case 312: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==312);
{yylhsminor.yy77.eType = yymsp[-1].major; yylhsminor.yy77.pExpr = 0;}
  yymsp[-1].minor.yy77 = yylhsminor.yy77;
        break;
      case 311: /* frame_bound ::= expr PRECEDING|FOLLOWING */
{yylhsminor.yy77.eType = yymsp[0].major; yylhsminor.yy77.pExpr = yymsp[-1].minor.yy202;}
  yymsp[-1].minor.yy77 = yylhsminor.yy77;
        break;
      case 313: /* frame_exclude_opt ::= */
{yymsp[1].minor.yy58 = 0;}
        break;
      case 314: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
{yymsp[-1].minor.yy58 = yymsp[0].minor.yy58;}
        break;
      case 315: /* frame_exclude ::= NO OTHERS */
      case 316: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==316);
{yymsp[-1].minor.yy58 = yymsp[-1].major; /*A-overwrites-X*/}
        break;
      case 317: /* frame_exclude ::= GROUP|TIES */
{yymsp[0].minor.yy58 = yymsp[0].major; /*A-overwrites-X*/}
        break;
      case 318: /* window_clause ::= WINDOW windowdefn_list */
{ yymsp[-1].minor.yy303 = yymsp[0].minor.yy303; }
        break;
      case 319: /* filter_over ::= filter_clause over_clause */
{
  yymsp[0].minor.yy303->pFilter = yymsp[-1].minor.yy202;
  yylhsminor.yy303 = yymsp[0].minor.yy303;
}
  yymsp[-1].minor.yy303 = yylhsminor.yy303;
        break;
      case 321: /* filter_over ::= filter_clause */
{
  yylhsminor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( yylhsminor.yy303 ){
    yylhsminor.yy303->eFrmType = TK_FILTER;
    yylhsminor.yy303->pFilter = yymsp[0].minor.yy202;
  }else{
    sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy202);
  }
}
  yymsp[0].minor.yy303 = yylhsminor.yy303;
        break;
      case 322: /* over_clause ::= OVER LP window RP */
{
  yymsp[-3].minor.yy303 = yymsp[-1].minor.yy303;
  assert( yymsp[-3].minor.yy303!=0 );
}
        break;
      case 323: /* over_clause ::= OVER nm */
{
  yymsp[-1].minor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( yymsp[-1].minor.yy303 ){
    yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
  }
}
        break;
      case 324: /* filter_clause ::= FILTER LP WHERE expr RP */
{ yymsp[-4].minor.yy202 = yymsp[-1].minor.yy202; }
        break;
      default:
      /* (325) input ::= cmdlist */ yytestcase(yyruleno==325);
      /* (326) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==326);
      /* (327) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=327);
      /* (328) ecmd ::= SEMI */ yytestcase(yyruleno==328);
      /* (329) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==329);
      /* (330) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=330);
      /* (331) trans_opt ::= */ yytestcase(yyruleno==331);
      /* (332) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==332);
      /* (333) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==333);
      /* (334) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==334);
      /* (335) savepoint_opt ::= */ yytestcase(yyruleno==335);
      /* (336) cmd ::= create_table create_table_args */ yytestcase(yyruleno==336);
      /* (337) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==337);
      /* (338) columnlist ::= columnname carglist */ yytestcase(yyruleno==338);
      /* (339) nm ::= ID|INDEXED */ yytestcase(yyruleno==339);
      /* (340) nm ::= STRING */ yytestcase(yyruleno==340);
      /* (341) nm ::= JOIN_KW */ yytestcase(yyruleno==341);
      /* (342) typetoken ::= typename */ yytestcase(yyruleno==342);
      /* (343) typename ::= ID|STRING */ yytestcase(yyruleno==343);
      /* (344) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=344);
      /* (345) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=345);
      /* (346) carglist ::= carglist ccons */ yytestcase(yyruleno==346);
      /* (347) carglist ::= */ yytestcase(yyruleno==347);
      /* (348) ccons ::= NULL onconf */ yytestcase(yyruleno==348);
      /* (349) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==349);
      /* (350) ccons ::= AS generated */ yytestcase(yyruleno==350);
      /* (351) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==351);
      /* (352) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==352);
      /* (353) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=353);
      /* (354) tconscomma ::= */ yytestcase(yyruleno==354);
      /* (355) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=355);
      /* (356) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=356);
      /* (357) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=357);
      /* (358) oneselect ::= values */ yytestcase(yyruleno==358);
      /* (359) sclp ::= selcollist COMMA */ yytestcase(yyruleno==359);
      /* (360) as ::= ID|STRING */ yytestcase(yyruleno==360);
      /* (361) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=361);
      /* (362) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==362);
      /* (363) exprlist ::= nexprlist */ yytestcase(yyruleno==363);
      /* (364) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=364);
      /* (365) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=365);
      /* (366) nmnum ::= ON */ yytestcase(yyruleno==366);
      /* (367) nmnum ::= DELETE */ yytestcase(yyruleno==367);
      /* (368) nmnum ::= DEFAULT */ yytestcase(yyruleno==368);
      /* (369) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==369);
      /* (370) foreach_clause ::= */ yytestcase(yyruleno==370);
      /* (371) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==371);
      /* (372) trnm ::= nm */ yytestcase(yyruleno==372);
      /* (373) tridxby ::= */ yytestcase(yyruleno==373);
      /* (374) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==374);
      /* (375) database_kw_opt ::= */ yytestcase(yyruleno==375);
      /* (376) kwcolumn_opt ::= */ yytestcase(yyruleno==376);
      /* (377) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==377);
      /* (378) vtabarglist ::= vtabarg */ yytestcase(yyruleno==378);
      /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==379);
      /* (380) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==380);
      /* (381) anylist ::= */ yytestcase(yyruleno==381);
      /* (382) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==382);
      /* (383) anylist ::= anylist ANY */ yytestcase(yyruleno==383);
      /* (384) with ::= */ yytestcase(yyruleno==384);
        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);







|





|






|









|






|











|





|





|


|


|


|
|


|









|
|


|


|




|




|


|


|


|


|


|


|


|


|







|





|


|


|


|
|


|


|
|


|
|


|






|





|







|






|






|



|





|



|



|







|







|


|


|




|




|




|


|


|


|


|




|





|





|




|


|


|




|


|
|
|


|
|


|




|




|



|








|








|




|





|




|





|
|





|





|




|





|





|
|



|
|
|



|



|


|


|
|


|


|


|






|











|





|







|



|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







159886
159887
159888
159889
159890
159891
159892
159893
159894
159895
159896
159897
159898
159899
159900
159901
159902
159903
159904
159905
159906
159907
159908
159909
159910
159911
159912
159913
159914
159915
159916
159917
159918
159919
159920
159921
159922
159923
159924
159925
159926
159927
159928
159929
159930
159931
159932
159933
159934
159935
159936
159937
159938
159939
159940
159941
159942
159943
159944
159945
159946
159947
159948
159949
159950
159951
159952
159953
159954
159955
159956
159957
159958
159959
159960
159961
159962
159963
159964
159965
159966
159967
159968
159969
159970
159971
159972
159973
159974
159975
159976
159977
159978
159979
159980
159981
159982
159983
159984
159985
159986
159987
159988
159989
159990
159991
159992
159993
159994
159995
159996
159997
159998
159999
160000
160001
160002
160003
160004
160005
160006
160007
160008
160009
160010
160011
160012
160013
160014
160015
160016
160017
160018
160019
160020
160021
160022
160023
160024
160025
160026
160027
160028
160029
160030
160031
160032
160033
160034
160035
160036
160037
160038
160039
160040
160041
160042
160043
160044
160045
160046
160047
160048
160049
160050
160051
160052
160053
160054
160055
160056
160057
160058
160059
160060
160061
160062
160063
160064
160065
160066
160067
160068
160069
160070
160071
160072
160073
160074
160075
160076
160077
160078
160079
160080
160081
160082
160083
160084
160085
160086
160087
160088
160089
160090
160091
160092
160093
160094
160095
160096
160097
160098
160099
160100
160101
160102
160103
160104
160105
160106
160107
160108
160109
160110
160111
160112
160113
160114
160115
160116
160117
160118
160119
160120
160121
160122
160123
160124
160125
160126
160127
160128
160129
160130
160131
160132
160133
160134
160135
160136
160137
160138
160139
160140
160141
160142
160143
160144
160145
160146
160147
160148
160149
160150
160151
160152
160153
160154
160155
160156
160157
160158
160159
160160
160161
160162
160163
160164
160165
160166
160167
160168
160169
160170
160171
160172
160173
160174
160175
160176
160177
160178
160179
160180
160181
160182
160183
160184
160185
160186
160187
160188
160189
160190
160191
160192
160193
160194
160195
160196
160197
160198
160199
160200
160201
160202
160203
160204
160205
160206
160207
160208
160209
160210
160211
160212
160213
160214
160215
160216
160217
160218
160219
160220
160221
160222
160223
160224
160225
160226
160227
160228
160229
160230
160231
160232
160233
160234
160235
160236
160237
160238
160239
160240
160241
160242
160243
160244
160245
160246
160247
160248
160249
160250
160251
160252
160253
160254
160255
160256
160257
160258
160259
160260
160261
160262
160263
160264
160265
160266
160267
160268
160269
160270
160271
160272
160273
160274
160275
160276
160277
160278
160279
160280
160281
160282
160283
160284
160285
160286
160287
160288
160289
160290
160291
160292
160293
160294
160295
160296
160297
160298
160299
160300
160301
160302
160303
160304
160305
160306
160307
160308
160309
160310
160311
160312
160313
160314
160315
160316
160317
160318
160319
160320
160321
160322
160323
160324
160325
160326
160327
160328
160329
160330
160331
160332
160333
160334
160335
160336
160337
160338
160339
160340
160341
160342
160343
160344
160345
160346
160347
160348
160349
160350
160351
160352
160353
160354
160355
160356
160357
160358
160359
160360
160361
160362
160363
160364
160365
160366
160367
160368
160369
160370
160371
160372
160373
160374
160375
160376
160377
160378
160379
160380
160381
160382
160383
160384
160385
160386
160387
160388
160389
160390
160391
160392
160393
160394
160395
160396
160397
160398
160399
160400
160401
160402
160403
160404
160405
160406
160407
160408
160409
160410
160411
160412
160413
160414
      }else{
        sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy242);
      }
      if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
    }
  }
        break;
      case 210: /* expr ::= LP select RP */
{
    yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy202, yymsp[-1].minor.yy539);
  }
        break;
      case 211: /* expr ::= expr in_op LP select RP */
{
    yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, yymsp[-1].minor.yy539);
    if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
  }
        break;
      case 212: /* 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.yy242 )  sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy242);
    yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
    sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, pSelect);
    if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
  }
        break;
      case 213: /* expr ::= EXISTS LP select RP */
{
    Expr *p;
    p = yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
    sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy539);
  }
        break;
      case 214: /* expr ::= CASE case_operand case_exprlist case_else END */
{
  yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy202, 0);
  if( yymsp[-4].minor.yy202 ){
    yymsp[-4].minor.yy202->x.pList = yymsp[-1].minor.yy202 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202) : yymsp[-2].minor.yy242;
    sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202);
  }else{
    sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy242);
    sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy202);
  }
}
        break;
      case 215: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
{
  yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
  yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[0].minor.yy202);
}
        break;
      case 216: /* case_exprlist ::= WHEN expr THEN expr */
{
  yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
  yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy242, yymsp[0].minor.yy202);
}
        break;
      case 219: /* case_operand ::= expr */
{yymsp[0].minor.yy202 = yymsp[0].minor.yy202; /*A-overwrites-X*/}
        break;
      case 222: /* nexprlist ::= nexprlist COMMA expr */
{yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[0].minor.yy202);}
        break;
      case 223: /* nexprlist ::= expr */
{yymsp[0].minor.yy242 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy202); /*A-overwrites-Y*/}
        break;
      case 225: /* paren_exprlist ::= LP exprlist RP */
      case 230: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==230);
{yymsp[-2].minor.yy242 = yymsp[-1].minor.yy242;}
        break;
      case 226: /* 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.yy242, yymsp[-10].minor.yy192,
                      &yymsp[-11].minor.yy0, yymsp[0].minor.yy202, SQLITE_SO_ASC, yymsp[-8].minor.yy192, SQLITE_IDXTYPE_APPDEF);
  if( IN_RENAME_OBJECT && pParse->pNewIndex ){
    sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
  }
}
        break;
      case 227: /* uniqueflag ::= UNIQUE */
      case 269: /* raisetype ::= ABORT */ yytestcase(yyruleno==269);
{yymsp[0].minor.yy192 = OE_Abort;}
        break;
      case 228: /* uniqueflag ::= */
{yymsp[1].minor.yy192 = OE_None;}
        break;
      case 231: /* eidlist ::= eidlist COMMA nm collate sortorder */
{
  yymsp[-4].minor.yy242 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy242, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192);
}
        break;
      case 232: /* eidlist ::= nm collate sortorder */
{
  yymsp[-2].minor.yy242 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); /*A-overwrites-Y*/
}
        break;
      case 235: /* cmd ::= DROP INDEX ifexists fullname */
{sqlite3DropIndex(pParse, yymsp[0].minor.yy47, yymsp[-1].minor.yy192);}
        break;
      case 236: /* cmd ::= VACUUM vinto */
{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy202);}
        break;
      case 237: /* cmd ::= VACUUM nm vinto */
{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy202);}
        break;
      case 240: /* cmd ::= PRAGMA nm dbnm */
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
        break;
      case 241: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
        break;
      case 242: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
        break;
      case 243: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
        break;
      case 244: /* 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 247: /* 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.yy447, &all);
}
        break;
      case 248: /* 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.yy192, yymsp[-4].minor.yy230.a, yymsp[-4].minor.yy230.b, yymsp[-2].minor.yy47, yymsp[0].minor.yy202, yymsp[-10].minor.yy192, yymsp[-8].minor.yy192);
  yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
}
        break;
      case 249: /* trigger_time ::= BEFORE|AFTER */
{ yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/ }
        break;
      case 250: /* trigger_time ::= INSTEAD OF */
{ yymsp[-1].minor.yy192 = TK_INSTEAD;}
        break;
      case 251: /* trigger_time ::= */
{ yymsp[1].minor.yy192 = TK_BEFORE; }
        break;
      case 252: /* trigger_event ::= DELETE|INSERT */
      case 253: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==253);
{yymsp[0].minor.yy230.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy230.b = 0;}
        break;
      case 254: /* trigger_event ::= UPDATE OF idlist */
{yymsp[-2].minor.yy230.a = TK_UPDATE; yymsp[-2].minor.yy230.b = yymsp[0].minor.yy600;}
        break;
      case 255: /* when_clause ::= */
      case 274: /* key_opt ::= */ yytestcase(yyruleno==274);
{ yymsp[1].minor.yy202 = 0; }
        break;
      case 256: /* when_clause ::= WHEN expr */
      case 275: /* key_opt ::= KEY expr */ yytestcase(yyruleno==275);
{ yymsp[-1].minor.yy202 = yymsp[0].minor.yy202; }
        break;
      case 257: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
{
  assert( yymsp[-2].minor.yy447!=0 );
  yymsp[-2].minor.yy447->pLast->pNext = yymsp[-1].minor.yy447;
  yymsp[-2].minor.yy447->pLast = yymsp[-1].minor.yy447;
}
        break;
      case 258: /* trigger_cmd_list ::= trigger_cmd SEMI */
{
  assert( yymsp[-1].minor.yy447!=0 );
  yymsp[-1].minor.yy447->pLast = yymsp[-1].minor.yy447;
}
        break;
      case 259: /* 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 260: /* tridxby ::= INDEXED BY nm */
{
  sqlite3ErrorMsg(pParse,
        "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
        "within triggers");
}
        break;
      case 261: /* tridxby ::= NOT INDEXED */
{
  sqlite3ErrorMsg(pParse,
        "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
        "within triggers");
}
        break;
      case 262: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
{yylhsminor.yy447 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy47, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202, yymsp[-7].minor.yy192, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy436);}
  yymsp[-8].minor.yy447 = yylhsminor.yy447;
        break;
      case 263: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
{
   yylhsminor.yy447 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy600,yymsp[-2].minor.yy539,yymsp[-6].minor.yy192,yymsp[-1].minor.yy318,yymsp[-7].minor.yy436,yymsp[0].minor.yy436);/*yylhsminor.yy447-overwrites-yymsp[-6].minor.yy192*/
}
  yymsp[-7].minor.yy447 = yylhsminor.yy447;
        break;
      case 264: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
{yylhsminor.yy447 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy202, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy436);}
  yymsp[-5].minor.yy447 = yylhsminor.yy447;
        break;
      case 265: /* trigger_cmd ::= scanpt select scanpt */
{yylhsminor.yy447 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy539, yymsp[-2].minor.yy436, yymsp[0].minor.yy436); /*yylhsminor.yy447-overwrites-yymsp[-1].minor.yy539*/}
  yymsp[-2].minor.yy447 = yylhsminor.yy447;
        break;
      case 266: /* expr ::= RAISE LP IGNORE RP */
{
  yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
  if( yymsp[-3].minor.yy202 ){
    yymsp[-3].minor.yy202->affExpr = OE_Ignore;
  }
}
        break;
      case 267: /* expr ::= RAISE LP raisetype COMMA nm RP */
{
  yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
  if( yymsp[-5].minor.yy202 ) {
    yymsp[-5].minor.yy202->affExpr = (char)yymsp[-3].minor.yy192;
  }
}
        break;
      case 268: /* raisetype ::= ROLLBACK */
{yymsp[0].minor.yy192 = OE_Rollback;}
        break;
      case 270: /* raisetype ::= FAIL */
{yymsp[0].minor.yy192 = OE_Fail;}
        break;
      case 271: /* cmd ::= DROP TRIGGER ifexists fullname */
{
  sqlite3DropTrigger(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy192);
}
        break;
      case 272: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
{
  sqlite3Attach(pParse, yymsp[-3].minor.yy202, yymsp[-1].minor.yy202, yymsp[0].minor.yy202);
}
        break;
      case 273: /* cmd ::= DETACH database_kw_opt expr */
{
  sqlite3Detach(pParse, yymsp[0].minor.yy202);
}
        break;
      case 276: /* cmd ::= REINDEX */
{sqlite3Reindex(pParse, 0, 0);}
        break;
      case 277: /* cmd ::= REINDEX nm dbnm */
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
        break;
      case 278: /* cmd ::= ANALYZE */
{sqlite3Analyze(pParse, 0, 0);}
        break;
      case 279: /* cmd ::= ANALYZE nm dbnm */
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
        break;
      case 280: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
{
  sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy47,&yymsp[0].minor.yy0);
}
        break;
      case 281: /* 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 282: /* add_column_fullname ::= fullname */
{
  disableLookaside(pParse);
  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy47);
}
        break;
      case 283: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
{
  sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy47, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
        break;
      case 284: /* cmd ::= create_vtab */
{sqlite3VtabFinishParse(pParse,0);}
        break;
      case 285: /* cmd ::= create_vtab LP vtabarglist RP */
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
        break;
      case 286: /* 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.yy192);
}
        break;
      case 287: /* vtabarg ::= */
{sqlite3VtabArgInit(pParse);}
        break;
      case 288: /* vtabargtoken ::= ANY */
      case 289: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==289);
      case 290: /* lp ::= LP */ yytestcase(yyruleno==290);
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
        break;
      case 291: /* with ::= WITH wqlist */
      case 292: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==292);
{ sqlite3WithPush(pParse, yymsp[0].minor.yy131, 1); }
        break;
      case 293: /* wqlist ::= nm eidlist_opt AS LP select RP */
{
  yymsp[-5].minor.yy131 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); /*A-overwrites-X*/
}
        break;
      case 294: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
{
  yymsp[-7].minor.yy131 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy131, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539);
}
        break;
      case 295: /* windowdefn_list ::= windowdefn */
{ yylhsminor.yy303 = yymsp[0].minor.yy303; }
  yymsp[0].minor.yy303 = yylhsminor.yy303;
        break;
      case 296: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
{
  assert( yymsp[0].minor.yy303!=0 );
  sqlite3WindowChain(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy303);
  yymsp[0].minor.yy303->pNextWin = yymsp[-2].minor.yy303;
  yylhsminor.yy303 = yymsp[0].minor.yy303;
}
  yymsp[-2].minor.yy303 = yylhsminor.yy303;
        break;
      case 297: /* windowdefn ::= nm AS LP window RP */
{
  if( ALWAYS(yymsp[-1].minor.yy303) ){
    yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
  }
  yylhsminor.yy303 = yymsp[-1].minor.yy303;
}
  yymsp[-4].minor.yy303 = yylhsminor.yy303;
        break;
      case 298: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
{
  yymsp[-4].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, 0);
}
        break;
      case 299: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
{
  yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, &yymsp[-5].minor.yy0);
}
  yymsp[-5].minor.yy303 = yylhsminor.yy303;
        break;
      case 300: /* window ::= ORDER BY sortlist frame_opt */
{
  yymsp[-3].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, 0);
}
        break;
      case 301: /* window ::= nm ORDER BY sortlist frame_opt */
{
  yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0);
}
  yymsp[-4].minor.yy303 = yylhsminor.yy303;
        break;
      case 302: /* window ::= frame_opt */
      case 321: /* filter_over ::= over_clause */ yytestcase(yyruleno==321);
{
  yylhsminor.yy303 = yymsp[0].minor.yy303;
}
  yymsp[0].minor.yy303 = yylhsminor.yy303;
        break;
      case 303: /* window ::= nm frame_opt */
{
  yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, 0, &yymsp[-1].minor.yy0);
}
  yymsp[-1].minor.yy303 = yylhsminor.yy303;
        break;
      case 304: /* frame_opt ::= */
{
  yymsp[1].minor.yy303 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
}
        break;
      case 305: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
{
  yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy192, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy58);
}
  yymsp[-2].minor.yy303 = yylhsminor.yy303;
        break;
      case 306: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
{
  yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy192, yymsp[-3].minor.yy77.eType, yymsp[-3].minor.yy77.pExpr, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, yymsp[0].minor.yy58);
}
  yymsp[-5].minor.yy303 = yylhsminor.yy303;
        break;
      case 308: /* frame_bound_s ::= frame_bound */
      case 310: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==310);
{yylhsminor.yy77 = yymsp[0].minor.yy77;}
  yymsp[0].minor.yy77 = yylhsminor.yy77;
        break;
      case 309: /* frame_bound_s ::= UNBOUNDED PRECEDING */
      case 311: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==311);
      case 313: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==313);
{yylhsminor.yy77.eType = yymsp[-1].major; yylhsminor.yy77.pExpr = 0;}
  yymsp[-1].minor.yy77 = yylhsminor.yy77;
        break;
      case 312: /* frame_bound ::= expr PRECEDING|FOLLOWING */
{yylhsminor.yy77.eType = yymsp[0].major; yylhsminor.yy77.pExpr = yymsp[-1].minor.yy202;}
  yymsp[-1].minor.yy77 = yylhsminor.yy77;
        break;
      case 314: /* frame_exclude_opt ::= */
{yymsp[1].minor.yy58 = 0;}
        break;
      case 315: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
{yymsp[-1].minor.yy58 = yymsp[0].minor.yy58;}
        break;
      case 316: /* frame_exclude ::= NO OTHERS */
      case 317: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==317);
{yymsp[-1].minor.yy58 = yymsp[-1].major; /*A-overwrites-X*/}
        break;
      case 318: /* frame_exclude ::= GROUP|TIES */
{yymsp[0].minor.yy58 = yymsp[0].major; /*A-overwrites-X*/}
        break;
      case 319: /* window_clause ::= WINDOW windowdefn_list */
{ yymsp[-1].minor.yy303 = yymsp[0].minor.yy303; }
        break;
      case 320: /* filter_over ::= filter_clause over_clause */
{
  yymsp[0].minor.yy303->pFilter = yymsp[-1].minor.yy202;
  yylhsminor.yy303 = yymsp[0].minor.yy303;
}
  yymsp[-1].minor.yy303 = yylhsminor.yy303;
        break;
      case 322: /* filter_over ::= filter_clause */
{
  yylhsminor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( yylhsminor.yy303 ){
    yylhsminor.yy303->eFrmType = TK_FILTER;
    yylhsminor.yy303->pFilter = yymsp[0].minor.yy202;
  }else{
    sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy202);
  }
}
  yymsp[0].minor.yy303 = yylhsminor.yy303;
        break;
      case 323: /* over_clause ::= OVER LP window RP */
{
  yymsp[-3].minor.yy303 = yymsp[-1].minor.yy303;
  assert( yymsp[-3].minor.yy303!=0 );
}
        break;
      case 324: /* over_clause ::= OVER nm */
{
  yymsp[-1].minor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( yymsp[-1].minor.yy303 ){
    yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
  }
}
        break;
      case 325: /* filter_clause ::= FILTER LP WHERE expr RP */
{ yymsp[-4].minor.yy202 = yymsp[-1].minor.yy202; }
        break;
      default:
      /* (326) input ::= cmdlist */ yytestcase(yyruleno==326);
      /* (327) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==327);
      /* (328) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=328);
      /* (329) ecmd ::= SEMI */ yytestcase(yyruleno==329);
      /* (330) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==330);
      /* (331) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=331);
      /* (332) trans_opt ::= */ yytestcase(yyruleno==332);
      /* (333) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==333);
      /* (334) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==334);
      /* (335) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==335);
      /* (336) savepoint_opt ::= */ yytestcase(yyruleno==336);
      /* (337) cmd ::= create_table create_table_args */ yytestcase(yyruleno==337);
      /* (338) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==338);
      /* (339) columnlist ::= columnname carglist */ yytestcase(yyruleno==339);
      /* (340) nm ::= ID|INDEXED */ yytestcase(yyruleno==340);
      /* (341) nm ::= STRING */ yytestcase(yyruleno==341);
      /* (342) nm ::= JOIN_KW */ yytestcase(yyruleno==342);
      /* (343) typetoken ::= typename */ yytestcase(yyruleno==343);
      /* (344) typename ::= ID|STRING */ yytestcase(yyruleno==344);
      /* (345) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=345);
      /* (346) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=346);
      /* (347) carglist ::= carglist ccons */ yytestcase(yyruleno==347);
      /* (348) carglist ::= */ yytestcase(yyruleno==348);
      /* (349) ccons ::= NULL onconf */ yytestcase(yyruleno==349);
      /* (350) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==350);
      /* (351) ccons ::= AS generated */ yytestcase(yyruleno==351);
      /* (352) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==352);
      /* (353) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==353);
      /* (354) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=354);
      /* (355) tconscomma ::= */ yytestcase(yyruleno==355);
      /* (356) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=356);
      /* (357) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=357);
      /* (358) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=358);
      /* (359) oneselect ::= values */ yytestcase(yyruleno==359);
      /* (360) sclp ::= selcollist COMMA */ yytestcase(yyruleno==360);
      /* (361) as ::= ID|STRING */ yytestcase(yyruleno==361);
      /* (362) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=362);
      /* (363) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==363);
      /* (364) exprlist ::= nexprlist */ yytestcase(yyruleno==364);
      /* (365) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=365);
      /* (366) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=366);
      /* (367) nmnum ::= ON */ yytestcase(yyruleno==367);
      /* (368) nmnum ::= DELETE */ yytestcase(yyruleno==368);
      /* (369) nmnum ::= DEFAULT */ yytestcase(yyruleno==369);
      /* (370) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==370);
      /* (371) foreach_clause ::= */ yytestcase(yyruleno==371);
      /* (372) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==372);
      /* (373) trnm ::= nm */ yytestcase(yyruleno==373);
      /* (374) tridxby ::= */ yytestcase(yyruleno==374);
      /* (375) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==375);
      /* (376) database_kw_opt ::= */ yytestcase(yyruleno==376);
      /* (377) kwcolumn_opt ::= */ yytestcase(yyruleno==377);
      /* (378) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==378);
      /* (379) vtabarglist ::= vtabarg */ yytestcase(yyruleno==379);
      /* (380) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==380);
      /* (381) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==381);
      /* (382) anylist ::= */ yytestcase(yyruleno==382);
      /* (383) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==383);
      /* (384) anylist ::= anylist ANY */ yytestcase(yyruleno==384);
      /* (385) with ::= */ yytestcase(yyruleno==385);
        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);
160091
160092
160093
160094
160095
160096
160097

160098
160099
160100
160101
160102
160103
160104
160105
160106
** In the sqlite3GetToken() function, a switch() on aiClass[c] is implemented
** using a lookup table, whereas a switch() directly on c uses a binary search.
** The lookup table is much faster.  To maximize speed, and to ensure that
** a lookup table is used, all of the classes need to be small integers and
** all of them need to be used within the switch.
*/
#define CC_X          0    /* The letter 'x', or start of BLOB literal */

#define CC_KYWD       1    /* Alphabetics or '_'.  Usable in a keyword */
#define CC_ID         2    /* unicode characters usable in IDs */
#define CC_DIGIT      3    /* Digits */
#define CC_DOLLAR     4    /* '$' */
#define CC_VARALPHA   5    /* '@', '#', ':'.  Alphabetic SQL variables */
#define CC_VARNUM     6    /* '?'.  Numeric SQL variables */
#define CC_SPACE      7    /* Space characters */
#define CC_QUOTE      8    /* '"', '\'', or '`'.  String literals, quoted ids */
#define CC_QUOTE2     9    /* '['.   [...] style quoted ids */







>
|
<







160731
160732
160733
160734
160735
160736
160737
160738
160739

160740
160741
160742
160743
160744
160745
160746
** In the sqlite3GetToken() function, a switch() on aiClass[c] is implemented
** using a lookup table, whereas a switch() directly on c uses a binary search.
** The lookup table is much faster.  To maximize speed, and to ensure that
** a lookup table is used, all of the classes need to be small integers and
** all of them need to be used within the switch.
*/
#define CC_X          0    /* The letter 'x', or start of BLOB literal */
#define CC_KYWD0      1    /* First letter of a keyword */
#define CC_KYWD       2    /* Alphabetics or '_'.  Usable in a keyword */

#define CC_DIGIT      3    /* Digits */
#define CC_DOLLAR     4    /* '$' */
#define CC_VARALPHA   5    /* '@', '#', ':'.  Alphabetic SQL variables */
#define CC_VARNUM     6    /* '?'.  Numeric SQL variables */
#define CC_SPACE      7    /* Space characters */
#define CC_QUOTE      8    /* '"', '\'', or '`'.  String literals, quoted ids */
#define CC_QUOTE2     9    /* '['.   [...] style quoted ids */
160117
160118
160119
160120
160121
160122
160123

160124
160125
160126
160127
160128
160129
160130
160131
160132
160133
160134
160135
160136
160137
160138
160139
160140
160141
160142
160143
160144
160145
160146
160147
160148
160149
160150
160151
160152
160153
160154
160155
160156
160157
160158
160159
160160
160161
160162
160163
160164
160165
160166
160167
160168
160169
160170
160171
#define CC_PLUS      20    /* '+' */
#define CC_STAR      21    /* '*' */
#define CC_PERCENT   22    /* '%' */
#define CC_COMMA     23    /* ',' */
#define CC_AND       24    /* '&' */
#define CC_TILDA     25    /* '~' */
#define CC_DOT       26    /* '.' */

#define CC_ILLEGAL   27    /* Illegal character */
#define CC_NUL       28    /* 0x00 */

static const unsigned char aiClass[] = {
#ifdef SQLITE_ASCII
/*         x0  x1  x2  x3  x4  x5  x6  x7  x8  x9  xa  xb  xc  xd  xe  xf */
/* 0x */   28, 27, 27, 27, 27, 27, 27, 27, 27,  7,  7, 27,  7,  7, 27, 27,
/* 1x */   27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
/* 2x */    7, 15,  8,  5,  4, 22, 24,  8, 17, 18, 21, 20, 23, 11, 26, 16,
/* 3x */    3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  5, 19, 12, 14, 13,  6,
/* 4x */    5,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
/* 5x */    1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1,  9, 27, 27, 27,  1,
/* 6x */    8,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
/* 7x */    1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1, 27, 10, 27, 25, 27,
/* 8x */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* 9x */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Ax */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Bx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Cx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Dx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Ex */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Fx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2
#endif
#ifdef SQLITE_EBCDIC
/*         x0  x1  x2  x3  x4  x5  x6  x7  x8  x9  xa  xb  xc  xd  xe  xf */
/* 0x */   27, 27, 27, 27, 27,  7, 27, 27, 27, 27, 27, 27,  7,  7, 27, 27,
/* 1x */   27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
/* 2x */   27, 27, 27, 27, 27,  7, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
/* 3x */   27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
/* 4x */    7, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, 12, 17, 20, 10,
/* 5x */   24, 27, 27, 27, 27, 27, 27, 27, 27, 27, 15,  4, 21, 18, 19, 27,
/* 6x */   11, 16, 27, 27, 27, 27, 27, 27, 27, 27, 27, 23, 22,  1, 13,  6,
/* 7x */   27, 27, 27, 27, 27, 27, 27, 27, 27,  8,  5,  5,  5,  8, 14,  8,
/* 8x */   27,  1,  1,  1,  1,  1,  1,  1,  1,  1, 27, 27, 27, 27, 27, 27,
/* 9x */   27,  1,  1,  1,  1,  1,  1,  1,  1,  1, 27, 27, 27, 27, 27, 27,
/* Ax */   27, 25,  1,  1,  1,  1,  1,  0,  1,  1, 27, 27, 27, 27, 27, 27,
/* Bx */   27, 27, 27, 27, 27, 27, 27, 27, 27, 27,  9, 27, 27, 27, 27, 27,
/* Cx */   27,  1,  1,  1,  1,  1,  1,  1,  1,  1, 27, 27, 27, 27, 27, 27,
/* Dx */   27,  1,  1,  1,  1,  1,  1,  1,  1,  1, 27, 27, 27, 27, 27, 27,
/* Ex */   27, 27,  1,  1,  1,  1,  1,  0,  1,  1, 27, 27, 27, 27, 27, 27,
/* Fx */    3,  3,  3,  3,  3,  3,  3,  3,  3,  3, 27, 27, 27, 27, 27, 27,
#endif
};

/*
** The charMap() macro maps alphabetic characters (only) into their
** lower-case ASCII equivalent.  On ASCII machines, this is just
** an upper-to-lower case map.  On EBCDIC machines we also need







>
|
|




|
|



|

|











|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







160757
160758
160759
160760
160761
160762
160763
160764
160765
160766
160767
160768
160769
160770
160771
160772
160773
160774
160775
160776
160777
160778
160779
160780
160781
160782
160783
160784
160785
160786
160787
160788
160789
160790
160791
160792
160793
160794
160795
160796
160797
160798
160799
160800
160801
160802
160803
160804
160805
160806
160807
160808
160809
160810
160811
160812
#define CC_PLUS      20    /* '+' */
#define CC_STAR      21    /* '*' */
#define CC_PERCENT   22    /* '%' */
#define CC_COMMA     23    /* ',' */
#define CC_AND       24    /* '&' */
#define CC_TILDA     25    /* '~' */
#define CC_DOT       26    /* '.' */
#define CC_ID        27    /* unicode characters usable in IDs */
#define CC_ILLEGAL   28    /* Illegal character */
#define CC_NUL       29    /* 0x00 */

static const unsigned char aiClass[] = {
#ifdef SQLITE_ASCII
/*         x0  x1  x2  x3  x4  x5  x6  x7  x8  x9  xa  xb  xc  xd  xe  xf */
/* 0x */   29, 28, 28, 28, 28, 28, 28, 28, 28,  7,  7, 28,  7,  7, 28, 28,
/* 1x */   28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
/* 2x */    7, 15,  8,  5,  4, 22, 24,  8, 17, 18, 21, 20, 23, 11, 26, 16,
/* 3x */    3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  5, 19, 12, 14, 13,  6,
/* 4x */    5,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
/* 5x */    1,  1,  1,  1,  1,  1,  1,  1,  0,  2,  2,  9, 28, 28, 28,  2,
/* 6x */    8,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
/* 7x */    1,  1,  1,  1,  1,  1,  1,  1,  0,  2,  2, 28, 10, 28, 25, 28,
/* 8x */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* 9x */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Ax */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Bx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Cx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Dx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Ex */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
/* Fx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2
#endif
#ifdef SQLITE_EBCDIC
/*         x0  x1  x2  x3  x4  x5  x6  x7  x8  x9  xa  xb  xc  xd  xe  xf */
/* 0x */   29, 28, 28, 28, 28,  7, 28, 28, 28, 28, 28, 28,  7,  7, 28, 28,
/* 1x */   28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
/* 2x */   28, 28, 28, 28, 28,  7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
/* 3x */   28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
/* 4x */    7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 26, 12, 17, 20, 10,
/* 5x */   24, 28, 28, 28, 28, 28, 28, 28, 28, 28, 15,  4, 21, 18, 19, 28,
/* 6x */   11, 16, 28, 28, 28, 28, 28, 28, 28, 28, 28, 23, 22,  2, 13,  6,
/* 7x */   28, 28, 28, 28, 28, 28, 28, 28, 28,  8,  5,  5,  5,  8, 14,  8,
/* 8x */   28,  1,  1,  1,  1,  1,  1,  1,  1,  1, 28, 28, 28, 28, 28, 28,
/* 9x */   28,  1,  1,  1,  1,  1,  1,  1,  1,  1, 28, 28, 28, 28, 28, 28,
/* Ax */   28, 25,  1,  1,  1,  1,  1,  0,  2,  2, 28, 28, 28, 28, 28, 28,
/* Bx */   28, 28, 28, 28, 28, 28, 28, 28, 28, 28,  9, 28, 28, 28, 28, 28,
/* Cx */   28,  1,  1,  1,  1,  1,  1,  1,  1,  1, 28, 28, 28, 28, 28, 28,
/* Dx */   28,  1,  1,  1,  1,  1,  1,  1,  1,  1, 28, 28, 28, 28, 28, 28,
/* Ex */   28, 28,  1,  1,  1,  1,  1,  0,  2,  2, 28, 28, 28, 28, 28, 28,
/* Fx */    3,  3,  3,  3,  3,  3,  3,  3,  3,  3, 28, 28, 28, 28, 28, 28,
#endif
};

/*
** The charMap() macro maps alphabetic characters (only) into their
** lower-case ASCII equivalent.  On ASCII machines, this is just
** an upper-to-lower case map.  On EBCDIC machines we also need
160502
160503
160504
160505
160506
160507
160508
160509
160510
160511
160512
160513
160514
160515
160516
/* Check to see if z[0..n-1] is a keyword. If it is, write the
** parser symbol code for that keyword into *pType.  Always
** return the integer n (the length of the token). */
static int keywordCode(const char *z, int n, int *pType){
  int i, j;
  const char *zKW;
  if( n>=2 ){
    i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n) % 127;
    for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
      if( aKWLen[i]!=n ) continue;
      zKW = &zKWText[aKWOffset[i]];
#ifdef SQLITE_ASCII
      if( (z[0]&~0x20)!=zKW[0] ) continue;
      if( (z[1]&~0x20)!=zKW[1] ) continue;
      j = 2;







|







161143
161144
161145
161146
161147
161148
161149
161150
161151
161152
161153
161154
161155
161156
161157
/* Check to see if z[0..n-1] is a keyword. If it is, write the
** parser symbol code for that keyword into *pType.  Always
** return the integer n (the length of the token). */
static int keywordCode(const char *z, int n, int *pType){
  int i, j;
  const char *zKW;
  if( n>=2 ){
    i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
    for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
      if( aKWLen[i]!=n ) continue;
      zKW = &zKWText[aKWOffset[i]];
#ifdef SQLITE_ASCII
      if( (z[0]&~0x20)!=zKW[0] ) continue;
      if( (z[1]&~0x20)!=zKW[1] ) continue;
      j = 2;
161044
161045
161046
161047
161048
161049
161050
161051
161052
161053
161054
161055
161056
161057
161058
        }else{
          break;
        }
      }
      if( n==0 ) *tokenType = TK_ILLEGAL;
      return i;
    }
    case CC_KYWD: {
      for(i=1; aiClass[z[i]]<=CC_KYWD; i++){}
      if( IdChar(z[i]) ){
        /* This token started out using characters that can appear in keywords,
        ** but z[i] is a character not allowed within keywords, so this must
        ** be an identifier instead */
        i++;
        break;







|







161685
161686
161687
161688
161689
161690
161691
161692
161693
161694
161695
161696
161697
161698
161699
        }else{
          break;
        }
      }
      if( n==0 ) *tokenType = TK_ILLEGAL;
      return i;
    }
    case CC_KYWD0: {
      for(i=1; aiClass[z[i]]<=CC_KYWD; i++){}
      if( IdChar(z[i]) ){
        /* This token started out using characters that can appear in keywords,
        ** but z[i] is a character not allowed within keywords, so this must
        ** be an identifier instead */
        i++;
        break;
161074
161075
161076
161077
161078
161079
161080

161081
161082
161083
161084
161085
161086
161087
        return i;
      }
#endif
      /* If it is not a BLOB literal, then it must be an ID, since no
      ** SQL keywords start with the letter 'x'.  Fall through */
      /* no break */ deliberate_fall_through
    }

    case CC_ID: {
      i = 1;
      break;
    }
    case CC_NUL: {
      *tokenType = TK_ILLEGAL;
      return 0;







>







161715
161716
161717
161718
161719
161720
161721
161722
161723
161724
161725
161726
161727
161728
161729
        return i;
      }
#endif
      /* If it is not a BLOB literal, then it must be an ID, since no
      ** SQL keywords start with the letter 'x'.  Fall through */
      /* no break */ deliberate_fall_through
    }
    case CC_KYWD:
    case CC_ID: {
      i = 1;
      break;
    }
    case CC_NUL: {
      *tokenType = TK_ILLEGAL;
      return 0;
166056
166057
166058
166059
166060
166061
166062

















166063


166064
166065
166066
166067
166068
166069
166070
      sqlite3 *db = va_arg(ap, sqlite3*);
      u64 *pn = va_arg(ap, sqlite3_uint64*);
      *pn = sqlite3BtreeSeekCount(db->aDb->pBt);
      (void)db;  /* Silence harmless unused variable warning */
      break;
    }





















  }
  va_end(ap);
#endif /* SQLITE_UNTESTABLE */
  return rc;
}

/*







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>







166698
166699
166700
166701
166702
166703
166704
166705
166706
166707
166708
166709
166710
166711
166712
166713
166714
166715
166716
166717
166718
166719
166720
166721
166722
166723
166724
166725
166726
166727
166728
166729
166730
166731
      sqlite3 *db = va_arg(ap, sqlite3*);
      u64 *pn = va_arg(ap, sqlite3_uint64*);
      *pn = sqlite3BtreeSeekCount(db->aDb->pBt);
      (void)db;  /* Silence harmless unused variable warning */
      break;
    }

    /*  sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, op, ptr)
    **
    **  "ptr" is a pointer to a u32.
    **
    **   op==0       Store the current sqlite3SelectTrace in *ptr
    **   op==1       Set sqlite3SelectTrace to the value *ptr
    **   op==3       Store the current sqlite3WhereTrace in *ptr
    **   op==3       Set sqlite3WhereTrace to the value *ptr
    */
    case SQLITE_TESTCTRL_TRACEFLAGS: {
       int opTrace = va_arg(ap, int);
       u32 *ptr = va_arg(ap, u32*);
       switch( opTrace ){
         case 0:   *ptr = sqlite3SelectTrace;      break;
         case 1:   sqlite3SelectTrace = *ptr;      break;
         case 2:   *ptr = sqlite3WhereTrace;       break;
         case 3:   sqlite3WhereTrace = *ptr;       break;
       }
       break;
    }
  }
  va_end(ap);
#endif /* SQLITE_UNTESTABLE */
  return rc;
}

/*
215280
215281
215282
215283
215284
215285
215286
215287
215288
215289
215290
215291
215292
215293
215294
215295
   && 0==pRoot->bEof
   && fts5RowidCmp(p, pRoot->iRowid, iFirst)<0
  ){
    rc = fts5ExprNodeNext(p, pRoot, 1, iFirst);
  }

  /* If the iterator is not at a real match, skip forward until it is. */
  while( pRoot->bNomatch ){
    assert( pRoot->bEof==0 && rc==SQLITE_OK );
    rc = fts5ExprNodeNext(p, pRoot, 0, 0);
  }
  return rc;
}

/*
** Move to the next document







|
|







215941
215942
215943
215944
215945
215946
215947
215948
215949
215950
215951
215952
215953
215954
215955
215956
   && 0==pRoot->bEof
   && fts5RowidCmp(p, pRoot->iRowid, iFirst)<0
  ){
    rc = fts5ExprNodeNext(p, pRoot, 1, iFirst);
  }

  /* If the iterator is not at a real match, skip forward until it is. */
  while( pRoot->bNomatch && rc==SQLITE_OK ){
    assert( pRoot->bEof==0 );
    rc = fts5ExprNodeNext(p, pRoot, 0, 0);
  }
  return rc;
}

/*
** Move to the next document
220465
220466
220467
220468
220469
220470
220471
220472
220473
220474
220475
220476
220477
220478
220479
220480
220481
220482
220483
220484



220485
220486
220487
220488
220489
220490
220491
  int nRem = pSeg->nPos;          /* Number of bytes still to come */
  Fts5Data *pData = 0;
  u8 *pChunk = &pSeg->pLeaf->p[pSeg->iLeafOffset];
  int nChunk = MIN(nRem, pSeg->pLeaf->szLeaf - pSeg->iLeafOffset);
  int pgno = pSeg->iLeafPgno;
  int pgnoSave = 0;

  /* This function does notmwork with detail=none databases. */
  assert( p->pConfig->eDetail!=FTS5_DETAIL_NONE );

  if( (pSeg->flags & FTS5_SEGITER_REVERSE)==0 ){
    pgnoSave = pgno+1;
  }

  while( 1 ){
    xChunk(p, pCtx, pChunk, nChunk);
    nRem -= nChunk;
    fts5DataRelease(pData);
    if( nRem<=0 ){
      break;



    }else{
      pgno++;
      pData = fts5LeafRead(p, FTS5_SEGMENT_ROWID(pSeg->pSeg->iSegid, pgno));
      if( pData==0 ) break;
      pChunk = &pData->p[4];
      nChunk = MIN(nRem, pData->szLeaf - 4);
      if( pgno==pgnoSave ){







|












>
>
>







221126
221127
221128
221129
221130
221131
221132
221133
221134
221135
221136
221137
221138
221139
221140
221141
221142
221143
221144
221145
221146
221147
221148
221149
221150
221151
221152
221153
221154
221155
  int nRem = pSeg->nPos;          /* Number of bytes still to come */
  Fts5Data *pData = 0;
  u8 *pChunk = &pSeg->pLeaf->p[pSeg->iLeafOffset];
  int nChunk = MIN(nRem, pSeg->pLeaf->szLeaf - pSeg->iLeafOffset);
  int pgno = pSeg->iLeafPgno;
  int pgnoSave = 0;

  /* This function does not work with detail=none databases. */
  assert( p->pConfig->eDetail!=FTS5_DETAIL_NONE );

  if( (pSeg->flags & FTS5_SEGITER_REVERSE)==0 ){
    pgnoSave = pgno+1;
  }

  while( 1 ){
    xChunk(p, pCtx, pChunk, nChunk);
    nRem -= nChunk;
    fts5DataRelease(pData);
    if( nRem<=0 ){
      break;
    }else if( pSeg->pSeg==0 ){
      p->rc = FTS5_CORRUPT;
      return;
    }else{
      pgno++;
      pData = fts5LeafRead(p, FTS5_SEGMENT_ROWID(pSeg->pSeg->iSegid, pgno));
      if( pData==0 ) break;
      pChunk = &pData->p[4];
      nChunk = MIN(nRem, pData->szLeaf - 4);
      if( pgno==pgnoSave ){
220529
220530
220531
220532
220533
220534
220535
220536
220537
220538
220539
220540
220541
220542
220543
220544
220545
220546
220547
220548
220549
220550
220551
220552
220553
220554
220555
220556
220557
220558
220559
220560
220561
220562
220563
220564
220565
220566
220567
220568
220569
220570
220571
220572
220573
220574
220575
220576
220577
220578
220579
220580
220581
220582
220583
220584
220585



220586

220587







220588





220589






220590
220591




220592
220593




220594





220595



220596
220597
220598
220599
220600
220601
220602
        fts5ChunkIterate(p, pSeg, (void*)&sCtx, fts5PoslistOffsetsCallback);
      }
    }
  }
}

/*
** IN/OUT parameter (*pa) points to a position list n bytes in size. If
** the position list contains entries for column iCol, then (*pa) is set
** to point to the sub-position-list for that column and the number of
** bytes in it returned. Or, if the argument position list does not
** contain any entries for column iCol, return 0.
*/
static int fts5IndexExtractCol(
  const u8 **pa,                  /* IN/OUT: Pointer to poslist */
  int n,                          /* IN: Size of poslist in bytes */
  int iCol                        /* Column to extract from poslist */
){
  int iCurrent = 0;               /* Anything before the first 0x01 is col 0 */
  const u8 *p = *pa;
  const u8 *pEnd = &p[n];         /* One byte past end of position list */

  while( iCol>iCurrent ){
    /* Advance pointer p until it points to pEnd or an 0x01 byte that is
    ** not part of a varint. Note that it is not possible for a negative
    ** or extremely large varint to occur within an uncorrupted position
    ** list. So the last byte of each varint may be assumed to have a clear
    ** 0x80 bit.  */
    while( *p!=0x01 ){
      while( *p++ & 0x80 );
      if( p>=pEnd ) return 0;
    }
    *pa = p++;
    iCurrent = *p++;
    if( iCurrent & 0x80 ){
      p--;
      p += fts5GetVarint32(p, iCurrent);
    }
  }
  if( iCol!=iCurrent ) return 0;

  /* Advance pointer p until it points to pEnd or an 0x01 byte that is
  ** not part of a varint */
  while( p<pEnd && *p!=0x01 ){
    while( *p++ & 0x80 );
  }

  return p - (*pa);
}

static void fts5IndexExtractColset(
  int *pRc,
  Fts5Colset *pColset,            /* Colset to filter on */
  const u8 *pPos, int nPos,       /* Position list */
  Fts5Buffer *pBuf                /* Output buffer */
){
  if( *pRc==SQLITE_OK ){



    int i;

    fts5BufferZero(pBuf);







    for(i=0; i<pColset->nCol; i++){





      const u8 *pSub = pPos;






      int nSub = fts5IndexExtractCol(&pSub, nPos, pColset->aiCol[i]);
      if( nSub ){




        fts5BufferAppendBlob(pRc, pBuf, nSub, pSub);
      }




    }





  }



}

/*
** xSetOutputs callback used by detail=none tables.
*/
static void fts5IterSetOutputs_None(Fts5Iter *pIter, Fts5SegIter *pSeg){
  assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_NONE );







|
|
|
|
<
<
<
<
<
<
<
<
<
|
|
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
|
|
<
|




|


>
>
>
|
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
|
|
>
>
>
>
|

>
>
>
>
|
>
>
>
>
>
|
>
>
>







221193
221194
221195
221196
221197
221198
221199
221200
221201
221202
221203









221204
221205





221206












221207





221208
221209

221210
221211
221212
221213
221214
221215
221216
221217
221218
221219
221220
221221
221222
221223
221224
221225
221226
221227
221228
221229
221230
221231
221232
221233
221234
221235
221236
221237
221238
221239
221240
221241
221242
221243
221244
221245
221246
221247
221248
221249
221250
221251
221252
221253
221254
221255
221256
221257
221258
221259
221260
221261
221262
221263
221264
221265
221266
221267
221268
221269
221270
221271
221272
        fts5ChunkIterate(p, pSeg, (void*)&sCtx, fts5PoslistOffsetsCallback);
      }
    }
  }
}

/*
** Parameter pPos points to a buffer containing a position list, size nPos.
** This function filters it according to pColset (which must be non-NULL)
** and sets pIter->base.pData/nData to point to the new position list.
** If memory is required for the new position list, use buffer pIter->poslist.









** Or, if the new position list is a contiguous subset of the input, set
** pIter->base.pData/nData to point directly to it.





**












** This function is a no-op if *pRc is other than SQLITE_OK when it is





** called. If an OOM error is encountered, *pRc is set to SQLITE_NOMEM
** before returning.

*/
static void fts5IndexExtractColset(
  int *pRc,
  Fts5Colset *pColset,            /* Colset to filter on */
  const u8 *pPos, int nPos,       /* Position list */
  Fts5Iter *pIter
){
  if( *pRc==SQLITE_OK ){
    const u8 *p = pPos;
    const u8 *aCopy = p;
    const u8 *pEnd = &p[nPos];    /* One byte past end of position list */
    int i = 0;
    int iCurrent = 0;

    if( pColset->nCol>1 && sqlite3Fts5BufferSize(pRc, &pIter->poslist, nPos) ){
      return;
    }

    while( 1 ){
      while( pColset->aiCol[i]<iCurrent ){
        i++;
        if( i==pColset->nCol ){
          pIter->base.pData = pIter->poslist.p;
          pIter->base.nData = pIter->poslist.n;
          return;
        }
      }

      /* Advance pointer p until it points to pEnd or an 0x01 byte that is
      ** not part of a varint */
      while( p<pEnd && *p!=0x01 ){
        while( *p++ & 0x80 );
      }

      if( pColset->aiCol[i]==iCurrent ){
        if( pColset->nCol==1 ){
          pIter->base.pData = aCopy;
          pIter->base.nData = p-aCopy;
          return;
        }
        fts5BufferSafeAppendBlob(&pIter->poslist, aCopy, p-aCopy);
      }
      if( p==pEnd ){
        pIter->base.pData = pIter->poslist.p;
        pIter->base.nData = pIter->poslist.n;
        return;
      }
      aCopy = p++;
      iCurrent = *p++;
      if( iCurrent & 0x80 ){
        p--;
        p += fts5GetVarint32(p, iCurrent);
      }
    }
  }

}

/*
** xSetOutputs callback used by detail=none tables.
*/
static void fts5IterSetOutputs_None(Fts5Iter *pIter, Fts5SegIter *pSeg){
  assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_NONE );
220708
220709
220710
220711
220712
220713
220714
220715
220716
220717
220718
220719
220720
220721
220722
220723
220724
220725
220726
220727
220728
220729
220730
220731
  assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_FULL );
  assert( pColset );

  if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){
    /* All data is stored on the current page. Populate the output
    ** variables to point into the body of the page object. */
    const u8 *a = &pSeg->pLeaf->p[pSeg->iLeafOffset];
    if( pColset->nCol==1 ){
      pIter->base.nData = fts5IndexExtractCol(&a, pSeg->nPos,pColset->aiCol[0]);
      pIter->base.pData = a;
    }else{
      int *pRc = &pIter->pIndex->rc;
      fts5BufferZero(&pIter->poslist);
      fts5IndexExtractColset(pRc, pColset, a, pSeg->nPos, &pIter->poslist);
      pIter->base.pData = pIter->poslist.p;
      pIter->base.nData = pIter->poslist.n;
    }
  }else{
    /* The data is distributed over two or more pages. Copy it into the
    ** Fts5Iter.poslist buffer and then set the output pointer to point
    ** to this buffer.  */
    fts5BufferZero(&pIter->poslist);
    fts5SegiterPoslist(pIter->pIndex, pSeg, pColset, &pIter->poslist);
    pIter->base.pData = pIter->poslist.p;







<
<
<
<
|
|
|
<
<
<







221378
221379
221380
221381
221382
221383
221384




221385
221386
221387



221388
221389
221390
221391
221392
221393
221394
  assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_FULL );
  assert( pColset );

  if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){
    /* All data is stored on the current page. Populate the output
    ** variables to point into the body of the page object. */
    const u8 *a = &pSeg->pLeaf->p[pSeg->iLeafOffset];




    int *pRc = &pIter->pIndex->rc;
    fts5BufferZero(&pIter->poslist);
    fts5IndexExtractColset(pRc, pColset, a, pSeg->nPos, pIter);



  }else{
    /* The data is distributed over two or more pages. Copy it into the
    ** Fts5Iter.poslist buffer and then set the output pointer to point
    ** to this buffer.  */
    fts5BufferZero(&pIter->poslist);
    fts5SegiterPoslist(pIter->pIndex, pSeg, pColset, &pIter->poslist);
    pIter->base.pData = pIter->poslist.p;
222200
222201
222202
222203
222204
222205
222206
222207
222208
222209
222210
222211
222212
222213
222214
  }
}


static void fts5DoclistIterNext(Fts5DoclistIter *pIter){
  u8 *p = pIter->aPoslist + pIter->nSize + pIter->nPoslist;

  assert( pIter->aPoslist );
  if( p>=pIter->aEof ){
    pIter->aPoslist = 0;
  }else{
    i64 iDelta;

    p += fts5GetVarint(p, (u64*)&iDelta);
    pIter->iRowid += iDelta;







|







222863
222864
222865
222866
222867
222868
222869
222870
222871
222872
222873
222874
222875
222876
222877
  }
}


static void fts5DoclistIterNext(Fts5DoclistIter *pIter){
  u8 *p = pIter->aPoslist + pIter->nSize + pIter->nPoslist;

  assert( pIter->aPoslist || (p==0 && pIter->aPoslist==0) );
  if( p>=pIter->aEof ){
    pIter->aPoslist = 0;
  }else{
    i64 iDelta;

    p += fts5GetVarint(p, (u64*)&iDelta);
    pIter->iRowid += iDelta;
222284
222285
222286
222287
222288
222289
222290

222291
222292
222293
222294
222295
222296
222297
222298
222299


222300

222301
222302
222303
222304
222305
222306
222307
/*
** This is the equivalent of fts5MergePrefixLists() for detail=none mode.
** In this case the buffers consist of a delta-encoded list of rowids only.
*/
static void fts5MergeRowidLists(
  Fts5Index *p,                   /* FTS5 backend object */
  Fts5Buffer *p1,                 /* First list to merge */

  Fts5Buffer *p2                  /* Second list to merge */
){
  int i1 = 0;
  int i2 = 0;
  i64 iRowid1 = 0;
  i64 iRowid2 = 0;
  i64 iOut = 0;

  Fts5Buffer out;


  memset(&out, 0, sizeof(out));

  sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n);
  if( p->rc ) return;

  fts5NextRowid(p1, &i1, &iRowid1);
  fts5NextRowid(p2, &i2, &iRowid2);
  while( i1>=0 || i2>=0 ){
    if( i1>=0 && (i2<0 || iRowid1<iRowid2) ){







>
|






|

>
>

>







222947
222948
222949
222950
222951
222952
222953
222954
222955
222956
222957
222958
222959
222960
222961
222962
222963
222964
222965
222966
222967
222968
222969
222970
222971
222972
222973
222974
/*
** This is the equivalent of fts5MergePrefixLists() for detail=none mode.
** In this case the buffers consist of a delta-encoded list of rowids only.
*/
static void fts5MergeRowidLists(
  Fts5Index *p,                   /* FTS5 backend object */
  Fts5Buffer *p1,                 /* First list to merge */
  int nBuf,                       /* Number of entries in apBuf[] */
  Fts5Buffer *aBuf                /* Array of other lists to merge into p1 */
){
  int i1 = 0;
  int i2 = 0;
  i64 iRowid1 = 0;
  i64 iRowid2 = 0;
  i64 iOut = 0;
  Fts5Buffer *p2 = &aBuf[0];
  Fts5Buffer out;

  (void)nBuf;
  memset(&out, 0, sizeof(out));
  assert( nBuf==1 );
  sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n);
  if( p->rc ) return;

  fts5NextRowid(p1, &i1, &iRowid1);
  fts5NextRowid(p2, &i2, &iRowid2);
  while( i1>=0 || i2>=0 ){
    if( i1>=0 && (i2<0 || iRowid1<iRowid2) ){
222319
222320
222321
222322
222323
222324
222325
222326





222327


222328













222329


222330







222331


222332
222333



222334
222335
222336
222337

222338
222339
222340




222341
222342
222343

222344
222345

222346















222347
222348
222349
222350
222351
222352
222353
222354
222355
222356
222357
222358
222359
222360
222361
222362
222363
222364
222365
222366
222367
222368
222369
222370
222371
222372
222373
222374
222375
222376
222377
222378
222379
222380

222381

222382
222383
222384
222385




222386

222387




222388


222389
222390
222391
222392
222393
222394
222395
222396
222397
222398
222399
222400
222401
222402
222403
222404
222405
222406
222407

222408
222409
222410
222411
222412
222413
222414

222415
222416
222417
222418

222419
222420
222421
222422
222423
222424

222425
222426
222427
222428
222429
222430
222431
222432
222433
222434
222435
222436
222437
222438
222439

222440
222441

222442
222443

222444


222445
222446
222447
222448
222449
222450
222451
222452
222453
222454
222455
222456
222457
222458
222459
222460
222461
222462
222463
222464
222465

222466
222467

222468



222469
222470
222471
222472
222473
222474
222475
222476
222477
222478
222479
222480
222481
222482
222483
222484
222485

222486
222487
222488
222489
222490
222491
222492
222493

222494
222495
222496
222497
222498
222499
222500


222501
222502
222503
222504
222505
222506
222507
222508
222509
222510
222511
222512
222513
222514
222515
222516
222517
222518
222519





















222520
222521
222522
222523
222524
222525
222526
222527
222528
222529
222530
222531
222532
222533
222534
222535
222536
222537
222538
222539


222540

222541
222542
222543
222544



222545

222546

222547
222548
222549
222550
222551
222552
222553
222554
222555

222556

222557
222558
222559

222560

222561
222562
222563
222564
222565
222566
222567
      fts5NextRowid(p2, &i2, &iRowid2);
    }
  }

  fts5BufferSwap(&out, p1);
  fts5BufferFree(&out);
}






/*


** Buffers p1 and p2 contain doclists. This function merges the content













** of the two doclists together and sets buffer p1 to the result before


** returning.







**


** If an error occurs, an error code is left in p->rc. If an error has
** already occurred, this function is a no-op.



*/
static void fts5MergePrefixLists(
  Fts5Index *p,                   /* FTS5 backend object */
  Fts5Buffer *p1,                 /* First list to merge */

  Fts5Buffer *p2                  /* Second list to merge */
){
  if( p2->n ){




    i64 iLastRowid = 0;
    Fts5DoclistIter i1;
    Fts5DoclistIter i2;

    Fts5Buffer out = {0, 0, 0};
    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.
    **
    ** 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;




        u8 *a1 = &i1.aPoslist[i1.nSize];

        u8 *a2 = &i2.aPoslist[i2.nSize];




        int nCopy;


        u8 *aCopy;

        i64 iPrev = 0;
        Fts5PoslistWriter writer;
        memset(&writer, 0, sizeof(writer));

        /* See the earlier comment in this function for an explanation of why
        ** corrupt input position lists might cause the output to consume
        ** at most 20 bytes of unexpected space. */
        fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);
        fts5BufferZero(&tmp);
        sqlite3Fts5BufferSize(&p->rc, &tmp,
            i1.nPoslist + i2.nPoslist + 10 + 10 + FTS5_DATA_ZERO_PADDING
        );
        if( p->rc ) break;

        sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);
        sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
        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);
              if( iPos1<0 ) break;
            }else{

              assert_nc( iPos2!=iPrev );
              sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);
              sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);
              if( iPos2<0 ) break;
            }
          }
        }

        if( iPos1>=0 ){
          if( iPos1!=iPrev ){
            sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);
          }
          aCopy = &a1[iOff1];
          nCopy = i1.nPoslist - iOff1;
        }else{

          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 */
        assert_nc( tmp.n<=i1.nPoslist+i2.nPoslist );
        assert( tmp.n<=i1.nPoslist+i2.nPoslist+10+10 );
        if( tmp.n>i1.nPoslist+i2.nPoslist ){
          if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;
          break;
        }
        fts5BufferSafeAppendVarint(&out, tmp.n * 2);
        fts5BufferSafeAppendBlob(&out, tmp.p, tmp.n);
        fts5DoclistIterNext(&i1);
        fts5DoclistIterNext(&i2);
        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_nc( out.n<=(p1->n+p2->n+9) );

    fts5BufferFree(p1);
    fts5BufferFree(&tmp);
    memset(&out.p[out.n], 0, FTS5_DATA_ZERO_PADDING);
    *p1 = out;
  }
}

static void fts5SetupPrefixIter(
  Fts5Index *p,                   /* Index to read from */
  int bDesc,                      /* True for "ORDER BY rowid DESC" */

  const u8 *pToken,               /* Buffer containing prefix to match */
  int nToken,                     /* Size of buffer pToken in bytes */
  Fts5Colset *pColset,            /* Restrict matches to these columns */
  Fts5Iter **ppIter          /* OUT: New iterator */
){
  Fts5Structure *pStruct;
  Fts5Buffer *aBuf;
  const int nBuf = 32;


  void (*xMerge)(Fts5Index*, Fts5Buffer*, Fts5Buffer*);
  void (*xAppend)(Fts5Index*, i64, Fts5Iter*, Fts5Buffer*);
  if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){
    xMerge = fts5MergeRowidLists;
    xAppend = fts5AppendRowid;
  }else{


    xMerge = fts5MergePrefixLists;
    xAppend = fts5AppendPoslist;
  }

  aBuf = (Fts5Buffer*)fts5IdxMalloc(p, sizeof(Fts5Buffer)*nBuf);
  pStruct = fts5StructureRead(p);

  if( aBuf && pStruct ){
    const int flags = FTS5INDEX_QUERY_SCAN
                    | FTS5INDEX_QUERY_SKIPEMPTY
                    | FTS5INDEX_QUERY_NOOUTPUT;
    int i;
    i64 iLastRowid = 0;
    Fts5Iter *p1 = 0;     /* Iterator used to gather data from index */
    Fts5Data *pData;
    Fts5Buffer doclist;
    int bNewTerm = 1;

    memset(&doclist, 0, sizeof(doclist));





















    fts5MultiIterNew(p, pStruct, flags, pColset, pToken, nToken, -1, 0, &p1);
    fts5IterSetOutputCb(&p->rc, p1);
    for( /* no-op */ ;
        fts5MultiIterEof(p, p1)==0;
        fts5MultiIterNext2(p, p1, &bNewTerm)
    ){
      Fts5SegIter *pSeg = &p1->aSeg[ p1->aFirst[1].iFirst ];
      int nTerm = pSeg->term.n;
      const u8 *pTerm = pSeg->term.p;
      p1->xSetOutputs(p1, pSeg);

      assert_nc( memcmp(pToken, pTerm, MIN(nToken, nTerm))<=0 );
      if( bNewTerm ){
        if( nTerm<nToken || memcmp(pToken, pTerm, nToken) ) break;
      }

      if( p1->base.nData==0 ) continue;

      if( p1->base.iRowid<=iLastRowid && doclist.n>0 ){
        for(i=0; p->rc==SQLITE_OK && doclist.n; i++){


          assert( i<nBuf );

          if( aBuf[i].n==0 ){
            fts5BufferSwap(&doclist, &aBuf[i]);
            fts5BufferZero(&doclist);
          }else{



            xMerge(p, &doclist, &aBuf[i]);

            fts5BufferZero(&aBuf[i]);

          }
        }
        iLastRowid = 0;
      }

      xAppend(p, p1->base.iRowid-iLastRowid, p1, &doclist);
      iLastRowid = p1->base.iRowid;
    }


    for(i=0; i<nBuf; i++){

      if( p->rc==SQLITE_OK ){
        xMerge(p, &doclist, &aBuf[i]);
      }

      fts5BufferFree(&aBuf[i]);

    }
    fts5MultiIterFree(p1);

    pData = fts5IdxMalloc(p, sizeof(Fts5Data)+doclist.n+FTS5_DATA_ZERO_PADDING);
    if( pData ){
      pData->p = (u8*)&pData[1];
      pData->nn = pData->szLeaf = doclist.n;








>
>
>
>
>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
|
>
>
>
>
>
>
>
|
>
>
|
|
>
>
>




>
|

<
>
>
>
>
|
|
<
>
|
|
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
<
<

|
<
<
|
<
<
<
<
|
|
<
<
<
<
|
<
<
|
>
|
>
|
|
|
|
>
>
>
>
|
>
|
>
>
>
>
|
>
>
|
|
<
<
<

|
|
|
<
<
|
<
<
|
|
<
<
<
>

<
<
|
|
|
|
>
|
<
|
<
>
|
|
|
<
|
<
>
|
<
<
<
|
|
<
<
<
|
|
|
<
|
|
>
|
<
>
|
<
>
|
>
>
|
|
|

|
|
|
|
<
<
<
<
<
|
|
<
<
<
|
|

>
|
|
>
|
>
>
>

<
<
<
|
<

|
|
|
|
<





>
|






|
>

|





>
>



















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




















>
>
|
>
|
|
|
|
>
>
>
|
>
|
>









>
|
>

|

>
|
>







222986
222987
222988
222989
222990
222991
222992
222993
222994
222995
222996
222997
222998
222999
223000
223001
223002
223003
223004
223005
223006
223007
223008
223009
223010
223011
223012
223013
223014
223015
223016
223017
223018
223019
223020
223021
223022
223023
223024
223025
223026
223027
223028
223029
223030
223031
223032
223033
223034
223035
223036
223037
223038
223039
223040
223041

223042
223043
223044
223045
223046
223047

223048
223049
223050
223051
223052
223053
223054
223055
223056
223057
223058
223059
223060
223061
223062
223063
223064
223065
223066
223067
223068
223069
223070
223071
223072
223073
223074
223075
223076
223077
223078
223079
223080


223081
223082


223083




223084
223085




223086


223087
223088
223089
223090
223091
223092
223093
223094
223095
223096
223097
223098
223099
223100
223101
223102
223103
223104
223105
223106
223107
223108
223109
223110



223111
223112
223113
223114


223115


223116
223117



223118
223119


223120
223121
223122
223123
223124
223125

223126

223127
223128
223129
223130

223131

223132
223133



223134
223135



223136
223137
223138

223139
223140
223141
223142

223143
223144

223145
223146
223147
223148
223149
223150
223151
223152
223153
223154
223155
223156





223157
223158



223159
223160
223161
223162
223163
223164
223165
223166
223167
223168
223169
223170



223171

223172
223173
223174
223175
223176

223177
223178
223179
223180
223181
223182
223183
223184
223185
223186
223187
223188
223189
223190
223191
223192
223193
223194
223195
223196
223197
223198
223199
223200
223201
223202
223203
223204
223205
223206
223207
223208
223209
223210
223211
223212
223213
223214
223215
223216
223217
223218
223219
223220
223221
223222
223223
223224
223225
223226
223227
223228
223229
223230
223231
223232
223233
223234
223235
223236
223237
223238
223239
223240
223241
223242
223243
223244
223245
223246
223247
223248
223249
223250
223251
223252
223253
223254
223255
223256
223257
223258
223259
223260
223261
223262
223263
223264
223265
223266
223267
223268
223269
223270
223271
223272
223273
223274
223275
223276
223277
223278
223279
223280
223281
223282
223283
223284
223285
223286
223287
223288
223289
223290
223291
223292
223293
223294
223295
223296
223297
223298
223299
223300
      fts5NextRowid(p2, &i2, &iRowid2);
    }
  }

  fts5BufferSwap(&out, p1);
  fts5BufferFree(&out);
}

typedef struct PrefixMerger PrefixMerger;
struct PrefixMerger {
  Fts5DoclistIter iter;           /* Doclist iterator */
  i64 iPos;                       /* For iterating through a position list */
  int iOff;
  u8 *aPos;
  PrefixMerger *pNext;            /* Next in docid/poslist order */
};

static void fts5PrefixMergerInsertByRowid(
  PrefixMerger **ppHead,
  PrefixMerger *p
){
  if( p->iter.aPoslist ){
    PrefixMerger **pp = ppHead;
    while( *pp && p->iter.iRowid>(*pp)->iter.iRowid ){
      pp = &(*pp)->pNext;
    }
    p->pNext = *pp;
    *pp = p;
  }
}

static void fts5PrefixMergerInsertByPosition(
  PrefixMerger **ppHead,
  PrefixMerger *p
){
  if( p->iPos>=0 ){
    PrefixMerger **pp = ppHead;
    while( *pp && p->iPos>(*pp)->iPos ){
      pp = &(*pp)->pNext;
    }
    p->pNext = *pp;
    *pp = p;
  }
}


/*
** Array aBuf[] contains nBuf doclists. These are all merged in with the
** doclist in buffer p1.
*/
static void fts5MergePrefixLists(
  Fts5Index *p,                   /* FTS5 backend object */
  Fts5Buffer *p1,                 /* First list to merge */
  int nBuf,                       /* Number of buffers in array aBuf[] */
  Fts5Buffer *aBuf                /* Other lists to merge in */
){

#define fts5PrefixMergerNextPosition(p) \
  sqlite3Fts5PoslistNext64((p)->aPos,(p)->iter.nPoslist,&(p)->iOff,&(p)->iPos);
#define FTS5_MERGE_NLIST 16
  PrefixMerger aMerger[FTS5_MERGE_NLIST];
  PrefixMerger *pHead = 0;
  int i;

  int nOut = 0;
  Fts5Buffer out = {0, 0, 0};
  Fts5Buffer tmp = {0, 0, 0};
  i64 iLastRowid = 0;

  /* Initialize a doclist-iterator for each input buffer. Arrange them in
  ** a linked-list starting at pHead in ascending order of rowid. Avoid
  ** linking any iterators already at EOF into the linked list at all. */
  assert( nBuf+1<=sizeof(aMerger)/sizeof(aMerger[0]) );
  memset(aMerger, 0, sizeof(PrefixMerger)*(nBuf+1));
  pHead = &aMerger[nBuf];
  fts5DoclistIterInit(p1, &pHead->iter);
  for(i=0; i<nBuf; i++){
    fts5DoclistIterInit(&aBuf[i], &aMerger[i].iter);
    fts5PrefixMergerInsertByRowid(&pHead, &aMerger[i]);
    nOut += aBuf[i].n;
  }
  if( nOut==0 ) return;
  nOut += p1->n + 9 + 10*nBuf;

  /* The maximum size of the output is equal to the sum of the
  ** 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.
  **
  ** Or, if the input position-lists are corrupt, then the output might
  ** include up to (nBuf+1) 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 (nBuf+1) 10 byte paddings.  */
  if( sqlite3Fts5BufferSize(&p->rc, &out, nOut) ) return;



  while( pHead ){


    fts5MergeAppendDocid(&out, iLastRowid, pHead->iter.iRowid);





    if( pHead->pNext && iLastRowid==pHead->pNext->iter.iRowid ){




      /* Merge data from two or more poslists */


      i64 iPrev = 0;
      int nTmp = FTS5_DATA_ZERO_PADDING;
      int nMerge = 0;
      PrefixMerger *pSave = pHead;
      PrefixMerger *pThis = 0;
      int nTail = 0;

      pHead = 0;
      while( pSave && pSave->iter.iRowid==iLastRowid ){
        PrefixMerger *pNext = pSave->pNext;
        pSave->iOff = 0;
        pSave->iPos = 0;
        pSave->aPos = &pSave->iter.aPoslist[pSave->iter.nSize];
        fts5PrefixMergerNextPosition(pSave);
        nTmp += pSave->iter.nPoslist + 10;
        nMerge++;
        fts5PrefixMergerInsertByPosition(&pHead, pSave);
        pSave = pNext;
      }

      if( pHead==0 || pHead->pNext==0 ){
        p->rc = FTS5_CORRUPT;
        break;
      }




      /* See the earlier comment in this function for an explanation of why
      ** corrupt input position lists might cause the output to consume
      ** at most nMerge*10 bytes of unexpected space. */


      if( sqlite3Fts5BufferSize(&p->rc, &tmp, nTmp+nMerge*10) ){


        break;
      }



      fts5BufferZero(&tmp);



      pThis = pHead;
      pHead = pThis->pNext;
      sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pThis->iPos);
      fts5PrefixMergerNextPosition(pThis);
      fts5PrefixMergerInsertByPosition(&pHead, pThis);


      while( pHead->pNext ){

        pThis = pHead;
        if( pThis->iPos!=iPrev ){
          sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pThis->iPos);
        }

        fts5PrefixMergerNextPosition(pThis);

        pHead = pThis->pNext;
        fts5PrefixMergerInsertByPosition(&pHead, pThis);



      }




      if( pHead->iPos!=iPrev ){
        sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pHead->iPos);
      }

      nTail = pHead->iter.nPoslist - pHead->iOff;

      /* WRITEPOSLISTSIZE */
      assert( tmp.n+nTail<=nTmp );

      if( tmp.n+nTail>nTmp-FTS5_DATA_ZERO_PADDING ){
        if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;

        break;
      }
      fts5BufferSafeAppendVarint(&out, (tmp.n+nTail) * 2);
      fts5BufferSafeAppendBlob(&out, tmp.p, tmp.n);
      if( nTail>0 ){
        fts5BufferSafeAppendBlob(&out, &pHead->aPos[pHead->iOff], nTail);
      }

      pHead = pSave;
      for(i=0; i<nBuf+1; i++){
        PrefixMerger *pX = &aMerger[i];
        if( pX->iter.aPoslist && pX->iter.iRowid==iLastRowid ){





          fts5DoclistIterNext(&pX->iter);
          fts5PrefixMergerInsertByRowid(&pHead, pX);



        }
      }

    }else{
      /* Copy poslist from pHead to output */
      PrefixMerger *pThis = pHead;
      Fts5DoclistIter *pI = &pThis->iter;
      fts5BufferSafeAppendBlob(&out, pI->aPoslist, pI->nPoslist+pI->nSize);
      fts5DoclistIterNext(pI);
      pHead = pThis->pNext;
      fts5PrefixMergerInsertByRowid(&pHead, pThis);
    }



  }


  fts5BufferFree(p1);
  fts5BufferFree(&tmp);
  memset(&out.p[out.n], 0, FTS5_DATA_ZERO_PADDING);
  *p1 = out;

}

static void fts5SetupPrefixIter(
  Fts5Index *p,                   /* Index to read from */
  int bDesc,                      /* True for "ORDER BY rowid DESC" */
  int iIdx,                       /* Index to scan for data */
  u8 *pToken,                     /* Buffer containing prefix to match */
  int nToken,                     /* Size of buffer pToken in bytes */
  Fts5Colset *pColset,            /* Restrict matches to these columns */
  Fts5Iter **ppIter          /* OUT: New iterator */
){
  Fts5Structure *pStruct;
  Fts5Buffer *aBuf;
  int nBuf = 32;
  int nMerge = 1;

  void (*xMerge)(Fts5Index*, Fts5Buffer*, int, Fts5Buffer*);
  void (*xAppend)(Fts5Index*, i64, Fts5Iter*, Fts5Buffer*);
  if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){
    xMerge = fts5MergeRowidLists;
    xAppend = fts5AppendRowid;
  }else{
    nMerge = FTS5_MERGE_NLIST-1;
    nBuf = nMerge*8;   /* Sufficient to merge (16^8)==(2^32) lists */
    xMerge = fts5MergePrefixLists;
    xAppend = fts5AppendPoslist;
  }

  aBuf = (Fts5Buffer*)fts5IdxMalloc(p, sizeof(Fts5Buffer)*nBuf);
  pStruct = fts5StructureRead(p);

  if( aBuf && pStruct ){
    const int flags = FTS5INDEX_QUERY_SCAN
                    | FTS5INDEX_QUERY_SKIPEMPTY
                    | FTS5INDEX_QUERY_NOOUTPUT;
    int i;
    i64 iLastRowid = 0;
    Fts5Iter *p1 = 0;     /* Iterator used to gather data from index */
    Fts5Data *pData;
    Fts5Buffer doclist;
    int bNewTerm = 1;

    memset(&doclist, 0, sizeof(doclist));
    if( iIdx!=0 ){
      int dummy = 0;
      const int f2 = FTS5INDEX_QUERY_SKIPEMPTY|FTS5INDEX_QUERY_NOOUTPUT;
      pToken[0] = FTS5_MAIN_PREFIX;
      fts5MultiIterNew(p, pStruct, f2, pColset, pToken, nToken, -1, 0, &p1);
      fts5IterSetOutputCb(&p->rc, p1);
      for(;
        fts5MultiIterEof(p, p1)==0;
        fts5MultiIterNext2(p, p1, &dummy)
      ){
        Fts5SegIter *pSeg = &p1->aSeg[ p1->aFirst[1].iFirst ];
        p1->xSetOutputs(p1, pSeg);
        if( p1->base.nData ){
          xAppend(p, p1->base.iRowid-iLastRowid, p1, &doclist);
          iLastRowid = p1->base.iRowid;
        }
      }
      fts5MultiIterFree(p1);
    }

    pToken[0] = FTS5_MAIN_PREFIX + iIdx;
    fts5MultiIterNew(p, pStruct, flags, pColset, pToken, nToken, -1, 0, &p1);
    fts5IterSetOutputCb(&p->rc, p1);
    for( /* no-op */ ;
        fts5MultiIterEof(p, p1)==0;
        fts5MultiIterNext2(p, p1, &bNewTerm)
    ){
      Fts5SegIter *pSeg = &p1->aSeg[ p1->aFirst[1].iFirst ];
      int nTerm = pSeg->term.n;
      const u8 *pTerm = pSeg->term.p;
      p1->xSetOutputs(p1, pSeg);

      assert_nc( memcmp(pToken, pTerm, MIN(nToken, nTerm))<=0 );
      if( bNewTerm ){
        if( nTerm<nToken || memcmp(pToken, pTerm, nToken) ) break;
      }

      if( p1->base.nData==0 ) continue;

      if( p1->base.iRowid<=iLastRowid && doclist.n>0 ){
        for(i=0; p->rc==SQLITE_OK && doclist.n; i++){
          int i1 = i*nMerge;
          int iStore;
          assert( i1+nMerge<=nBuf );
          for(iStore=i1; iStore<i1+nMerge; iStore++){
            if( aBuf[iStore].n==0 ){
              fts5BufferSwap(&doclist, &aBuf[iStore]);
              fts5BufferZero(&doclist);
              break;
            }
          }
          if( iStore==i1+nMerge ){
            xMerge(p, &doclist, nMerge, &aBuf[i1]);
            for(iStore=i1; iStore<i1+nMerge; iStore++){
              fts5BufferZero(&aBuf[iStore]);
            }
          }
        }
        iLastRowid = 0;
      }

      xAppend(p, p1->base.iRowid-iLastRowid, p1, &doclist);
      iLastRowid = p1->base.iRowid;
    }

    assert( (nBuf%nMerge)==0 );
    for(i=0; i<nBuf; i+=nMerge){
      int iFree;
      if( p->rc==SQLITE_OK ){
        xMerge(p, &doclist, nMerge, &aBuf[i]);
      }
      for(iFree=i; iFree<i+nMerge; iFree++){
        fts5BufferFree(&aBuf[iFree]);
      }
    }
    fts5MultiIterFree(p1);

    pData = fts5IdxMalloc(p, sizeof(Fts5Data)+doclist.n+FTS5_DATA_ZERO_PADDING);
    if( pData ){
      pData->p = (u8*)&pData[1];
      pData->nn = pData->szLeaf = doclist.n;
222808
222809
222810
222811
222812
222813
222814

222815
222816
222817
222818
222819
222820
222821
  Fts5Buffer buf = {0, 0, 0};

  /* If the QUERY_SCAN flag is set, all other flags must be clear. */
  assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN );

  if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
    int iIdx = 0;                 /* Index to search */

    if( nToken ) memcpy(&buf.p[1], pToken, nToken);

    /* Figure out which index to search and set iIdx accordingly. If this
    ** is a prefix query for which there is no prefix index, set iIdx to
    ** greater than pConfig->nPrefix to indicate that the query will be
    ** satisfied by scanning multiple terms in the main index.
    **







>







223541
223542
223543
223544
223545
223546
223547
223548
223549
223550
223551
223552
223553
223554
223555
  Fts5Buffer buf = {0, 0, 0};

  /* If the QUERY_SCAN flag is set, all other flags must be clear. */
  assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN );

  if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
    int iIdx = 0;                 /* Index to search */
    int iPrefixIdx = 0;           /* +1 prefix index */
    if( nToken ) memcpy(&buf.p[1], pToken, nToken);

    /* Figure out which index to search and set iIdx accordingly. If this
    ** is a prefix query for which there is no prefix index, set iIdx to
    ** greater than pConfig->nPrefix to indicate that the query will be
    ** satisfied by scanning multiple terms in the main index.
    **
222829
222830
222831
222832
222833
222834
222835
222836


222837
222838
222839
222840
222841
222842
222843
222844
222845
222846
222847
222848
222849
222850
222851
222852
222853
222854
222855
222856
222857
222858
222859
222860
222861
      assert( flags & FTS5INDEX_QUERY_PREFIX );
      iIdx = 1+pConfig->nPrefix;
    }else
#endif
    if( flags & FTS5INDEX_QUERY_PREFIX ){
      int nChar = fts5IndexCharlen(pToken, nToken);
      for(iIdx=1; iIdx<=pConfig->nPrefix; iIdx++){
        if( pConfig->aPrefix[iIdx-1]==nChar ) break;


      }
    }

    if( iIdx<=pConfig->nPrefix ){
      /* Straight index lookup */
      Fts5Structure *pStruct = fts5StructureRead(p);
      buf.p[0] = (u8)(FTS5_MAIN_PREFIX + iIdx);
      if( pStruct ){
        fts5MultiIterNew(p, pStruct, flags | FTS5INDEX_QUERY_SKIPEMPTY,
            pColset, buf.p, nToken+1, -1, 0, &pRet
        );
        fts5StructureRelease(pStruct);
      }
    }else{
      /* Scan multiple terms in the main index */
      int bDesc = (flags & FTS5INDEX_QUERY_DESC)!=0;
      buf.p[0] = FTS5_MAIN_PREFIX;
      fts5SetupPrefixIter(p, bDesc, buf.p, nToken+1, pColset, &pRet);
      assert( p->rc!=SQLITE_OK || pRet->pColset==0 );
      fts5IterSetOutputCb(&p->rc, pRet);
      if( p->rc==SQLITE_OK ){
        Fts5SegIter *pSeg = &pRet->aSeg[pRet->aFirst[1].iFirst];
        if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);
      }
    }







|
>
>
















<
|







223563
223564
223565
223566
223567
223568
223569
223570
223571
223572
223573
223574
223575
223576
223577
223578
223579
223580
223581
223582
223583
223584
223585
223586
223587
223588

223589
223590
223591
223592
223593
223594
223595
223596
      assert( flags & FTS5INDEX_QUERY_PREFIX );
      iIdx = 1+pConfig->nPrefix;
    }else
#endif
    if( flags & FTS5INDEX_QUERY_PREFIX ){
      int nChar = fts5IndexCharlen(pToken, nToken);
      for(iIdx=1; iIdx<=pConfig->nPrefix; iIdx++){
        int nIdxChar = pConfig->aPrefix[iIdx-1];
        if( nIdxChar==nChar ) break;
        if( nIdxChar==nChar+1 ) iPrefixIdx = iIdx;
      }
    }

    if( iIdx<=pConfig->nPrefix ){
      /* Straight index lookup */
      Fts5Structure *pStruct = fts5StructureRead(p);
      buf.p[0] = (u8)(FTS5_MAIN_PREFIX + iIdx);
      if( pStruct ){
        fts5MultiIterNew(p, pStruct, flags | FTS5INDEX_QUERY_SKIPEMPTY,
            pColset, buf.p, nToken+1, -1, 0, &pRet
        );
        fts5StructureRelease(pStruct);
      }
    }else{
      /* Scan multiple terms in the main index */
      int bDesc = (flags & FTS5INDEX_QUERY_DESC)!=0;

      fts5SetupPrefixIter(p, bDesc, iPrefixIdx, buf.p, nToken+1, pColset,&pRet);
      assert( p->rc!=SQLITE_OK || pRet->pColset==0 );
      fts5IterSetOutputCb(&p->rc, pRet);
      if( p->rc==SQLITE_OK ){
        Fts5SegIter *pSeg = &pRet->aSeg[pRet->aFirst[1].iFirst];
        if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);
      }
    }
226815
226816
226817
226818
226819
226820
226821
226822
226823
226824
226825
226826
226827
226828
226829
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: 2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b", -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){







|







227550
227551
227552
227553
227554
227555
227556
227557
227558
227559
227560
227561
227562
227563
227564
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: 2020-12-15 13:55:38 ea0a7f103a6f6a9e57d7377140ff9f372bf2b156f86f148291fb05a7030f2b36", -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){
231741
231742
231743
231744
231745
231746
231747
231748
231749
231750
231751
231752
231753
231754
#endif
  return rc;
}
#endif /* SQLITE_CORE */
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */

/************** End of stmt.c ************************************************/
#if __LINE__!=231748
#undef SQLITE_SOURCE_ID
#define SQLITE_SOURCE_ID      "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089falt2"
#endif
/* Return the source-id for this library */
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
/************************** End of sqlite3.c ******************************/







|

|




232476
232477
232478
232479
232480
232481
232482
232483
232484
232485
232486
232487
232488
232489
#endif
  return rc;
}
#endif /* SQLITE_CORE */
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */

/************** End of stmt.c ************************************************/
#if __LINE__!=232483
#undef SQLITE_SOURCE_ID
#define SQLITE_SOURCE_ID      "2020-12-15 13:55:38 ea0a7f103a6f6a9e57d7377140ff9f372bf2b156f86f148291fb05a7030falt2"
#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 src/sqlite3.h.
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.34.0"
#define SQLITE_VERSION_NUMBER 3034000
#define SQLITE_SOURCE_ID      "2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b"

/*
** 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







|
|
|







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.35.0"
#define SQLITE_VERSION_NUMBER 3035000
#define SQLITE_SOURCE_ID      "2020-12-15 13:55:38 ea0a7f103a6f6a9e57d7377140ff9f372bf2b156f86f148291fb05a7030f2b36"

/*
** 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
7761
7762
7763
7764
7765
7766
7767

7768
7769
7770
7771
7772
7773
7774
7775
#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_PRNG_SEED               28
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS     29
#define SQLITE_TESTCTRL_SEEK_COUNT              30

#define SQLITE_TESTCTRL_LAST                    30  /* 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,







>
|







7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
#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_PRNG_SEED               28
#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS     29
#define SQLITE_TESTCTRL_SEEK_COUNT              30
#define SQLITE_TESTCTRL_TRACEFLAGS              31
#define SQLITE_TESTCTRL_LAST                    31  /* 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,