Fossil

Check-in [736e5c892b]
Login

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

Overview
Comment:Update the built-in SQLite to the latest 3.35 alpha including CLI enhancements and DROP COLUMN support.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 736e5c892bb94c8c7ef9dbe8212d1137bf99e62fa7c7088ad02d1aa55ac502d9
User & Date: drh 2021-02-19 14:58:36.911
Context
2021-02-19
15:18
Google Summer of Code project ideas for prospective students check-in: 932f88cb55 user: danshearer tags: trunk
14:58
Update the built-in SQLite to the latest 3.35 alpha including CLI enhancements and DROP COLUMN support. check-in: 736e5c892b user: drh tags: trunk
2021-02-18
23:14
Typo fix. Removed a block of commented-out pikchr. check-in: 269788ebdb user: stephan tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/shell.c.
18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805
18806
18807
    }
  }else

  if( (c=='o'
        && (strncmp(azArg[0], "output", n)==0||strncmp(azArg[0], "once", n)==0))
   || (c=='e' && n==5 && strcmp(azArg[0],"excel")==0)
  ){
    const char *zFile = 0;
    int bTxtMode = 0;
    int i;
    int eMode = 0;
    int bBOM = 0;
    int bOnce = 0;  /* 0: .output, 1: .once, 2: .excel */

    if( c=='e' ){







|







18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805
18806
18807
    }
  }else

  if( (c=='o'
        && (strncmp(azArg[0], "output", n)==0||strncmp(azArg[0], "once", n)==0))
   || (c=='e' && n==5 && strcmp(azArg[0],"excel")==0)
  ){
    char *zFile = 0;
    int bTxtMode = 0;
    int i;
    int eMode = 0;
    int bBOM = 0;
    int bOnce = 0;  /* 0: .output, 1: .once, 2: .excel */

    if( c=='e' ){
18823
18824
18825
18826
18827
18828
18829
18830
18831




18832
18833
18834
18835
18836

18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
        }else{
          utf8_printf(p->out, "ERROR: unknown option: \"%s\".  Usage:\n",
                      azArg[i]);
          showHelp(p->out, azArg[0]);
          rc = 1;
          goto meta_command_exit;
        }
      }else if( zFile==0 ){
        zFile = z;




      }else{
        utf8_printf(p->out,"ERROR: extra parameter: \"%s\".  Usage:\n",
                    azArg[i]);
        showHelp(p->out, azArg[0]);
        rc = 1;

        goto meta_command_exit;
      }
    }
    if( zFile==0 ) zFile = "stdout";
    if( bOnce ){
      p->outCount = 2;
    }else{
      p->outCount = 0;
    }
    output_reset(p);
#ifndef SQLITE_NOHAVE_SYSTEM







|
|
>
>
>
>





>



|







18823
18824
18825
18826
18827
18828
18829
18830
18831
18832
18833
18834
18835
18836
18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
18848
18849
18850
18851
18852
        }else{
          utf8_printf(p->out, "ERROR: unknown option: \"%s\".  Usage:\n",
                      azArg[i]);
          showHelp(p->out, azArg[0]);
          rc = 1;
          goto meta_command_exit;
        }
      }else if( zFile==0 && eMode!='e' && eMode!='x' ){
        zFile = sqlite3_mprintf("%s", z);
        if( zFile[0]=='|' ){
          while( i+1<nArg ) zFile = sqlite3_mprintf("%z %s", zFile, azArg[++i]);
          break;
        }
      }else{
        utf8_printf(p->out,"ERROR: extra parameter: \"%s\".  Usage:\n",
                    azArg[i]);
        showHelp(p->out, azArg[0]);
        rc = 1;
        sqlite3_free(zFile);
        goto meta_command_exit;
      }
    }
    if( zFile==0 ) zFile = sqlite3_mprintf("stdout");
    if( bOnce ){
      p->outCount = 2;
    }else{
      p->outCount = 0;
    }
    output_reset(p);
#ifndef SQLITE_NOHAVE_SYSTEM
18856
18857
18858
18859
18860
18861
18862

18863
18864
18865
18866
18867
18868
18869
18870
        sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma);
        sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_CrLf);
      }else{
        /* text editor mode */
        newTempFile(p, "txt");
        bTxtMode = 1;
      }

      zFile = p->zTempFile;
    }
#endif /* SQLITE_NOHAVE_SYSTEM */
    if( zFile[0]=='|' ){
#ifdef SQLITE_OMIT_POPEN
      raw_printf(stderr, "Error: pipes are not supported in this OS\n");
      rc = 1;
      p->out = stdout;







>
|







18861
18862
18863
18864
18865
18866
18867
18868
18869
18870
18871
18872
18873
18874
18875
18876
        sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma);
        sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_CrLf);
      }else{
        /* text editor mode */
        newTempFile(p, "txt");
        bTxtMode = 1;
      }
      sqlite3_free(zFile);
      zFile = sqlite3_mprintf("%s", p->zTempFile);
    }
#endif /* SQLITE_NOHAVE_SYSTEM */
    if( zFile[0]=='|' ){
#ifdef SQLITE_OMIT_POPEN
      raw_printf(stderr, "Error: pipes are not supported in this OS\n");
      rc = 1;
      p->out = stdout;
18888
18889
18890
18891
18892
18893
18894

18895
18896
18897
18898
18899
18900
18901
        p->out = stdout;
        rc = 1;
      } else {
        if( bBOM ) fprintf(p->out,"\357\273\277");
        sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
      }
    }

  }else

  if( c=='p' && n>=3 && strncmp(azArg[0], "parameter", n)==0 ){
    open_db(p,0);
    if( nArg<=1 ) goto parameter_syntax_error;

    /* .parameter clear







>







18894
18895
18896
18897
18898
18899
18900
18901
18902
18903
18904
18905
18906
18907
18908
        p->out = stdout;
        rc = 1;
      } else {
        if( bBOM ) fprintf(p->out,"\357\273\277");
        sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
      }
    }
    sqlite3_free(zFile);
  }else

  if( c=='p' && n>=3 && strncmp(azArg[0], "parameter", n)==0 ){
    open_db(p,0);
    if( nArg<=1 ) goto parameter_syntax_error;

    /* .parameter clear
Changes to src/sqlite3.c.
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
** be larger than the release from which it is derived.  Either Y will
** be held constant and Z will be incremented or else Y will be incremented
** and Z will be reset to zero.
**
** Since [version 3.6.18] ([dateof:3.6.18]),
** SQLite source code has been stored in the
** <a href="http://fossil-scm.org/">Fossil configuration management
** system</a>.  ^The SQLITE_SOURCE_ID macro evaluates to
** a string which identifies a particular check-in of SQLite
** within its configuration management system.  ^The SQLITE_SOURCE_ID
** string contains the date and time of the check-in (UTC) and a SHA1
** or SHA3-256 hash of the entire source tree.  If the source code has
** 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      "2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398f17d"

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







|














|







1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
** be larger than the release from which it is derived.  Either Y will
** be held constant and Z will be incremented or else Y will be incremented
** and Z will be reset to zero.
**
** Since [version 3.6.18] ([dateof:3.6.18]),
** SQLite source code has been stored in the
** <a href="http://www.fossil-scm.org/">Fossil configuration management
** system</a>.  ^The SQLITE_SOURCE_ID macro evaluates to
** a string which identifies a particular check-in of SQLite
** within its configuration management system.  ^The SQLITE_SOURCE_ID
** string contains the date and time of the check-in (UTC) and a SHA1
** or SHA3-256 hash of the entire source tree.  If the source code has
** 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      "2021-02-19 14:32:58 c844a331e78949850fde8ed95058cb34f863566944bc9e92e3ae042768f130e1"

/*
** 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
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
# define sqlite3ExplainBreakpoint(A,B) /*no-op*/
#endif
#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_EXPLAIN)
SQLITE_PRIVATE   void sqlite3ExplainBreakpoint(const char*,const char*);
#else
# define sqlite3ExplainBreakpoint(A,B) /*no-op*/
#endif
SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);
SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, int addr, u8);
SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3);
SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u16 P5);
SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe*, int addr);
SQLITE_PRIVATE void sqlite3VdbeJumpHereOrPopInst(Vdbe*, int addr);







|







15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
# define sqlite3ExplainBreakpoint(A,B) /*no-op*/
#endif
#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_EXPLAIN)
SQLITE_PRIVATE   void sqlite3ExplainBreakpoint(const char*,const char*);
#else
# define sqlite3ExplainBreakpoint(A,B) /*no-op*/
#endif
SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*, int, char*, u16);
SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, int addr, u8);
SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3);
SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u16 P5);
SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe*, int addr);
SQLITE_PRIVATE void sqlite3VdbeJumpHereOrPopInst(Vdbe*, int addr);
17473
17474
17475
17476
17477
17478
17479
17480





17481
17482
17483
17484
17485
17486
17487
  u8 notNull;      /* An OE_ code for handling a NOT NULL constraint */
  char affinity;   /* One of the SQLITE_AFF_... values */
  u8 szEst;        /* Estimated size of value in this column. sizeof(INT)==1 */
  u8 hName;        /* Column name hash for faster lookup */
  u16 colFlags;    /* Boolean properties.  See COLFLAG_ defines below */
};

/* Allowed values for Column.colFlags:





*/
#define COLFLAG_PRIMKEY   0x0001   /* Column is part of the primary key */
#define COLFLAG_HIDDEN    0x0002   /* A hidden column in a virtual table */
#define COLFLAG_HASTYPE   0x0004   /* Type name follows column name */
#define COLFLAG_UNIQUE    0x0008   /* Column def contains "UNIQUE" or "PK" */
#define COLFLAG_SORTERREF 0x0010   /* Use sorter-refs with this column */
#define COLFLAG_VIRTUAL   0x0020   /* GENERATED ALWAYS AS ... VIRTUAL */







|
>
>
>
>
>







17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
  u8 notNull;      /* An OE_ code for handling a NOT NULL constraint */
  char affinity;   /* One of the SQLITE_AFF_... values */
  u8 szEst;        /* Estimated size of value in this column. sizeof(INT)==1 */
  u8 hName;        /* Column name hash for faster lookup */
  u16 colFlags;    /* Boolean properties.  See COLFLAG_ defines below */
};

/* Allowed values for Column.colFlags.
**
** Constraints:
**         TF_HasVirtual == COLFLAG_VIRTUAL
**         TF_HasStored  == COLFLAG_STORED
**         TF_HasHidden  == COLFLAG_HIDDEN
*/
#define COLFLAG_PRIMKEY   0x0001   /* Column is part of the primary key */
#define COLFLAG_HIDDEN    0x0002   /* A hidden column in a virtual table */
#define COLFLAG_HASTYPE   0x0004   /* Type name follows column name */
#define COLFLAG_UNIQUE    0x0008   /* Column def contains "UNIQUE" or "PK" */
#define COLFLAG_SORTERREF 0x0010   /* Use sorter-refs with this column */
#define COLFLAG_VIRTUAL   0x0020   /* GENERATED ALWAYS AS ... VIRTUAL */
17662
17663
17664
17665
17666
17667
17668
17669
17670

17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687

17688
17689
17690
17691
17692
17693
17694
** followed by non-hidden columns.  Example:  "CREATE VIRTUAL TABLE x USING
** vtab1(a HIDDEN, b);".  Since "b" is a non-hidden column but "a" is hidden,
** the TF_OOOHidden attribute would apply in this case.  Such tables require
** special handling during INSERT processing. The "OOO" means "Out Of Order".
**
** Constraints:
**
**         TF_HasVirtual == COLFLAG_Virtual
**         TF_HasStored  == COLFLAG_Stored

*/
#define TF_Readonly        0x0001    /* Read-only system table */
#define TF_Ephemeral       0x0002    /* An ephemeral table */
#define TF_HasPrimaryKey   0x0004    /* Table has a primary key */
#define TF_Autoincrement   0x0008    /* Integer primary key is autoincrement */
#define TF_HasStat1        0x0010    /* nRowLogEst set from sqlite_stat1 */
#define TF_HasVirtual      0x0020    /* Has one or more VIRTUAL columns */
#define TF_HasStored       0x0040    /* Has one or more STORED columns */
#define TF_HasGenerated    0x0060    /* Combo: HasVirtual + HasStored */
#define TF_WithoutRowid    0x0080    /* No rowid.  PRIMARY KEY is the key */
#define TF_StatsUsed       0x0100    /* Query planner decisions affected by
                                     ** Index.aiRowLogEst[] values */
#define TF_NoVisibleRowid  0x0200    /* No user-visible "rowid" column */
#define TF_OOOHidden       0x0400    /* Out-of-Order hidden columns */
#define TF_HasNotNull      0x0800    /* Contains NOT NULL constraints */
#define TF_Shadow          0x1000    /* True for a shadow table */
#define TF_HasStat4        0x2000    /* STAT4 info available for this table */


/*
** Test to see whether or not a table is a virtual table.  This is
** done as a macro so that it will be optimized out when virtual
** table support is omitted from the build.
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE







|
|
>


|














>







17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
** followed by non-hidden columns.  Example:  "CREATE VIRTUAL TABLE x USING
** vtab1(a HIDDEN, b);".  Since "b" is a non-hidden column but "a" is hidden,
** the TF_OOOHidden attribute would apply in this case.  Such tables require
** special handling during INSERT processing. The "OOO" means "Out Of Order".
**
** Constraints:
**
**         TF_HasVirtual == COLFLAG_VIRTUAL
**         TF_HasStored  == COLFLAG_STORED
**         TF_HasHidden  == COLFLAG_HIDDEN
*/
#define TF_Readonly        0x0001    /* Read-only system table */
#define TF_HasHidden       0x0002    /* Has one or more hidden columns */
#define TF_HasPrimaryKey   0x0004    /* Table has a primary key */
#define TF_Autoincrement   0x0008    /* Integer primary key is autoincrement */
#define TF_HasStat1        0x0010    /* nRowLogEst set from sqlite_stat1 */
#define TF_HasVirtual      0x0020    /* Has one or more VIRTUAL columns */
#define TF_HasStored       0x0040    /* Has one or more STORED columns */
#define TF_HasGenerated    0x0060    /* Combo: HasVirtual + HasStored */
#define TF_WithoutRowid    0x0080    /* No rowid.  PRIMARY KEY is the key */
#define TF_StatsUsed       0x0100    /* Query planner decisions affected by
                                     ** Index.aiRowLogEst[] values */
#define TF_NoVisibleRowid  0x0200    /* No user-visible "rowid" column */
#define TF_OOOHidden       0x0400    /* Out-of-Order hidden columns */
#define TF_HasNotNull      0x0800    /* Contains NOT NULL constraints */
#define TF_Shadow          0x1000    /* True for a shadow table */
#define TF_HasStat4        0x2000    /* STAT4 info available for this table */
#define TF_Ephemeral       0x4000    /* An ephemeral table */

/*
** Test to see whether or not a table is a virtual table.  This is
** done as a macro so that it will be optimized out when virtual
** table support is omitted from the build.
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
    Expr *pFExpr;            /* Expression encoding the function */
    FuncDef *pFunc;          /* The aggregate function implementation */
    int iMem;                /* Memory location that acts as accumulator */
    int iDistinct;           /* Ephemeral table used to enforce DISTINCT */
  } *aFunc;
  int nFunc;              /* Number of entries in aFunc[] */
  u32 selId;              /* Select to which this AggInfo belongs */
  AggInfo *pNext;         /* Next in list of them all */
};

/*
** The datatype ynVar is a signed integer, either 16-bit or 32-bit.
** Usually it is 16-bits.  But if SQLITE_MAX_VARIABLE_NUMBER is greater
** than 32767 we have to make it 32-bit.  16-bit is preferred because
** it uses less memory in the Expr object, which is a big memory user







<







18056
18057
18058
18059
18060
18061
18062

18063
18064
18065
18066
18067
18068
18069
    Expr *pFExpr;            /* Expression encoding the function */
    FuncDef *pFunc;          /* The aggregate function implementation */
    int iMem;                /* Memory location that acts as accumulator */
    int iDistinct;           /* Ephemeral table used to enforce DISTINCT */
  } *aFunc;
  int nFunc;              /* Number of entries in aFunc[] */
  u32 selId;              /* Select to which this AggInfo belongs */

};

/*
** The datatype ynVar is a signed integer, either 16-bit or 32-bit.
** Usually it is 16-bits.  But if SQLITE_MAX_VARIABLE_NUMBER is greater
** than 32767 we have to make it 32-bit.  16-bit is preferred because
** it uses less memory in the Expr object, which is a big memory user
18642
18643
18644
18645
18646
18647
18648

18649
18650
18651
18652
18653
18654
18655
#define SF_IncludeHidden 0x0020000 /* Include hidden columns in output */
#define SF_ComplexResult 0x0040000 /* Result contains subquery or function */
#define SF_WhereBegin    0x0080000 /* Really a WhereBegin() call.  Debug Only */
#define SF_WinRewrite    0x0100000 /* Window function rewrite accomplished */
#define SF_View          0x0200000 /* SELECT statement is a view */
#define SF_NoopOrderBy   0x0400000 /* ORDER BY is ignored for this query */
#define SF_UpdateFrom    0x0800000 /* Statement is an UPDATE...FROM */


/*
** The results of a SELECT can be distributed in several ways, as defined
** by one of the following macros.  The "SRT" prefix means "SELECT Result
** Type".
**
**     SRT_Union       Store results as a key in a temporary index







>







18648
18649
18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
#define SF_IncludeHidden 0x0020000 /* Include hidden columns in output */
#define SF_ComplexResult 0x0040000 /* Result contains subquery or function */
#define SF_WhereBegin    0x0080000 /* Really a WhereBegin() call.  Debug Only */
#define SF_WinRewrite    0x0100000 /* Window function rewrite accomplished */
#define SF_View          0x0200000 /* SELECT statement is a view */
#define SF_NoopOrderBy   0x0400000 /* ORDER BY is ignored for this query */
#define SF_UpdateFrom    0x0800000 /* Statement is an UPDATE...FROM */
#define SF_PushDown      0x1000000 /* SELECT has be modified by push-down opt */

/*
** The results of a SELECT can be distributed in several ways, as defined
** by one of the following macros.  The "SRT" prefix means "SELECT Result
** Type".
**
**     SRT_Union       Store results as a key in a temporary index
18884
18885
18886
18887
18888
18889
18890
18891
18892
18893
18894
18895
18896
18897
18898
  int nTableLock;        /* Number of locks in aTableLock */
  TableLock *aTableLock; /* Required table locks for shared-cache mode */
#endif
  AutoincInfo *pAinc;  /* Information about AUTOINCREMENT counters */
  Parse *pToplevel;    /* Parse structure for main program (or NULL) */
  Table *pTriggerTab;  /* Table triggers are being coded for */
  Parse *pParentParse; /* Parent parser if this parser is nested */
  AggInfo *pAggList;   /* List of all AggInfo objects */
  union {
    int addrCrTab;         /* Address of OP_CreateBtree on CREATE TABLE */
    Returning *pReturning; /* The RETURNING clause */
  } u1;
  u32 nQueryLoop;      /* Est number of iterations of a query (10*log2(N)) */
  u32 oldmask;         /* Mask of old.* columns referenced */
  u32 newmask;         /* Mask of new.* columns referenced */







<







18891
18892
18893
18894
18895
18896
18897

18898
18899
18900
18901
18902
18903
18904
  int nTableLock;        /* Number of locks in aTableLock */
  TableLock *aTableLock; /* Required table locks for shared-cache mode */
#endif
  AutoincInfo *pAinc;  /* Information about AUTOINCREMENT counters */
  Parse *pToplevel;    /* Parse structure for main program (or NULL) */
  Table *pTriggerTab;  /* Table triggers are being coded for */
  Parse *pParentParse; /* Parent parser if this parser is nested */

  union {
    int addrCrTab;         /* Address of OP_CreateBtree on CREATE TABLE */
    Returning *pReturning; /* The RETURNING clause */
  } u1;
  u32 nQueryLoop;      /* Est number of iterations of a query (10*log2(N)) */
  u32 oldmask;         /* Mask of old.* columns referenced */
  u32 newmask;         /* Mask of new.* columns referenced */
19168
19169
19170
19171
19172
19173
19174
19175

19176
19177
19178
19179
19180
19181
19182
  u32 nInitRow;       /* Number of rows processed */
  Pgno mxPage;        /* Maximum page number.  0 for no limit. */
} InitData;

/*
** Allowed values for mInitFlags
*/
#define INITFLAG_AlterTable   0x0001  /* This is a reparse after ALTER TABLE */


/*
** Structure containing global configuration data for the SQLite library.
**
** This structure also contains some state information.
*/
struct Sqlite3Config {







|
>







19174
19175
19176
19177
19178
19179
19180
19181
19182
19183
19184
19185
19186
19187
19188
19189
  u32 nInitRow;       /* Number of rows processed */
  Pgno mxPage;        /* Maximum page number.  0 for no limit. */
} InitData;

/*
** Allowed values for mInitFlags
*/
#define INITFLAG_AlterRename   0x0001  /* Reparse after a RENAME */
#define INITFLAG_AlterDrop     0x0002  /* Reparse after a DROP COLUMN */

/*
** Structure containing global configuration data for the SQLite library.
**
** This structure also contains some state information.
*/
struct Sqlite3Config {
19988
19989
19990
19991
19992
19993
19994

19995
19996
19997
19998
19999
20000
20001
# define sqlite3ParseToplevel(p) p
# define sqlite3IsToplevel(p) 1
# define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
# define sqlite3TriggerStepSrc(A,B) 0
#endif

SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*);

SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr*,int);
SQLITE_PRIVATE void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);
SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse*, int);
#ifndef SQLITE_OMIT_AUTHORIZATION
SQLITE_PRIVATE   void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);
SQLITE_PRIVATE   int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*);
SQLITE_PRIVATE   void sqlite3AuthContextPush(Parse*, AuthContext*, const char*);







>







19995
19996
19997
19998
19999
20000
20001
20002
20003
20004
20005
20006
20007
20008
20009
# define sqlite3ParseToplevel(p) p
# define sqlite3IsToplevel(p) 1
# define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
# define sqlite3TriggerStepSrc(A,B) 0
#endif

SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*);
SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol);
SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr*,int);
SQLITE_PRIVATE void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);
SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse*, int);
#ifndef SQLITE_OMIT_AUTHORIZATION
SQLITE_PRIVATE   void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);
SQLITE_PRIVATE   int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*);
SQLITE_PRIVATE   void sqlite3AuthContextPush(Parse*, AuthContext*, const char*);
20172
20173
20174
20175
20176
20177
20178

20179
20180
20181
20182
20183
20184
20185
SQLITE_PRIVATE int sqlite3ResolveExprListNames(NameContext*, ExprList*);
SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*);
SQLITE_PRIVATE int sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*);
SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);

SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse*, void*, Token*);
SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom);
SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*);
SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse*, ExprList*);
SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
SQLITE_PRIVATE char sqlite3AffinityType(const char*, Column*);
SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*);







>







20180
20181
20182
20183
20184
20185
20186
20187
20188
20189
20190
20191
20192
20193
20194
SQLITE_PRIVATE int sqlite3ResolveExprListNames(NameContext*, ExprList*);
SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*);
SQLITE_PRIVATE int sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*);
SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse*, SrcList*, Token*);
SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse*, void*, Token*);
SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom);
SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*);
SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse*, ExprList*);
SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
SQLITE_PRIVATE char sqlite3AffinityType(const char*, Column*);
SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*);
78731
78732
78733
78734
78735
78736
78737
78738
78739
78740

78741
78742
78743
78744
78745
78746
78747
** Add an OP_ParseSchema opcode.  This routine is broken out from
** sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees
** as having been used.
**
** The zWhere string must have been obtained from sqlite3_malloc().
** This routine will take ownership of the allocated memory.
*/
SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere){
  int j;
  sqlite3VdbeAddOp4(p, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC);

  for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);
  sqlite3MayAbort(p->pParse);
}

/*
** Add an opcode that includes the p4 value as an integer.
*/







|


>







78740
78741
78742
78743
78744
78745
78746
78747
78748
78749
78750
78751
78752
78753
78754
78755
78756
78757
** Add an OP_ParseSchema opcode.  This routine is broken out from
** sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees
** as having been used.
**
** The zWhere string must have been obtained from sqlite3_malloc().
** This routine will take ownership of the allocated memory.
*/
SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere, u16 p5){
  int j;
  sqlite3VdbeAddOp4(p, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC);
  sqlite3VdbeChangeP5(p, p5);
  for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);
  sqlite3MayAbort(p->pParse);
}

/*
** Add an opcode that includes the p4 value as an integer.
*/
92183
92184
92185
92186
92187
92188
92189
92190
92191
92192
92193
92194
92195
92196
92197
  assert( iDb>=0 && iDb<db->nDb );
  assert( DbHasProperty(db, iDb, DB_SchemaLoaded) );

#ifndef SQLITE_OMIT_ALTERTABLE
  if( pOp->p4.z==0 ){
    sqlite3SchemaClear(db->aDb[iDb].pSchema);
    db->mDbFlags &= ~DBFLAG_SchemaKnownOk;
    rc = sqlite3InitOne(db, iDb, &p->zErrMsg, INITFLAG_AlterTable);
    db->mDbFlags |= DBFLAG_SchemaChange;
    p->expired = 0;
  }else
#endif
  {
    zSchema = DFLT_SCHEMA_TABLE;
    initData.db = db;







|







92193
92194
92195
92196
92197
92198
92199
92200
92201
92202
92203
92204
92205
92206
92207
  assert( iDb>=0 && iDb<db->nDb );
  assert( DbHasProperty(db, iDb, DB_SchemaLoaded) );

#ifndef SQLITE_OMIT_ALTERTABLE
  if( pOp->p4.z==0 ){
    sqlite3SchemaClear(db->aDb[iDb].pSchema);
    db->mDbFlags &= ~DBFLAG_SchemaKnownOk;
    rc = sqlite3InitOne(db, iDb, &p->zErrMsg, pOp->p5);
    db->mDbFlags |= DBFLAG_SchemaChange;
    p->expired = 0;
  }else
#endif
  {
    zSchema = DFLT_SCHEMA_TABLE;
    initData.db = db;
98573
98574
98575
98576
98577
98578
98579
98580
98581
98582
98583
98584
98585
98586
98587
98588
98589
98590
98591
98592
98593
98594
98595
98596
98597
98598
98599
98600
** structures must be increased by the nSubquery amount.
*/
static void resolveAlias(
  Parse *pParse,         /* Parsing context */
  ExprList *pEList,      /* A result set */
  int iCol,              /* A column in the result set.  0..pEList->nExpr-1 */
  Expr *pExpr,           /* Transform this into an alias to the result set */
  const char *zType,     /* "GROUP" or "ORDER" or "" */
  int nSubquery          /* Number of subqueries that the label is moving */
){
  Expr *pOrig;           /* The iCol-th column of the result set */
  Expr *pDup;            /* Copy of pOrig */
  sqlite3 *db;           /* The database connection */

  assert( iCol>=0 && iCol<pEList->nExpr );
  pOrig = pEList->a[iCol].pExpr;
  assert( pOrig!=0 );
  db = pParse->db;
  pDup = sqlite3ExprDup(db, pOrig, 0);
  if( pDup!=0 ){
    if( zType[0]!='G' ) incrAggFunctionDepth(pDup, nSubquery);
    if( pExpr->op==TK_COLLATE ){
      pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);
    }

    /* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
    ** prevents ExprDelete() from deleting the Expr structure itself,
    ** allowing it to be repopulated by the memcpy() on the following line.







<












|







98583
98584
98585
98586
98587
98588
98589

98590
98591
98592
98593
98594
98595
98596
98597
98598
98599
98600
98601
98602
98603
98604
98605
98606
98607
98608
98609
** structures must be increased by the nSubquery amount.
*/
static void resolveAlias(
  Parse *pParse,         /* Parsing context */
  ExprList *pEList,      /* A result set */
  int iCol,              /* A column in the result set.  0..pEList->nExpr-1 */
  Expr *pExpr,           /* Transform this into an alias to the result set */

  int nSubquery          /* Number of subqueries that the label is moving */
){
  Expr *pOrig;           /* The iCol-th column of the result set */
  Expr *pDup;            /* Copy of pOrig */
  sqlite3 *db;           /* The database connection */

  assert( iCol>=0 && iCol<pEList->nExpr );
  pOrig = pEList->a[iCol].pExpr;
  assert( pOrig!=0 );
  db = pParse->db;
  pDup = sqlite3ExprDup(db, pOrig, 0);
  if( pDup!=0 ){
    incrAggFunctionDepth(pDup, nSubquery);
    if( pExpr->op==TK_COLLATE ){
      pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);
    }

    /* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
    ** prevents ExprDelete() from deleting the Expr structure itself,
    ** allowing it to be repopulated by the memcpy() on the following line.
98871
98872
98873
98874
98875
98876
98877
98878

98879
98880
98881
98882
98883
98884
98885
98886
98887
98888
98889
98890
98891
98892
98893
98894
98895
98896
98897
98898
98899
98900
98901
98902
98903
98904
98905
98906
        pSchema = pExpr->y.pTab->pSchema;
      }
    } /* if( pSrcList ) */

#if !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT)
    /* If we have not already resolved the name, then maybe
    ** it is a new.* or old.* trigger argument reference.  Or
    ** maybe it is an excluded.* from an upsert.

    */
    if( cntTab==0 && zDb==0 ){
      pTab = 0;
#ifndef SQLITE_OMIT_TRIGGER
      if( pParse->pTriggerTab!=0 ){
        int op = pParse->eTriggerOp;
        assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
        if( op!=TK_DELETE && zTab && sqlite3StrICmp("new",zTab) == 0 ){
          pExpr->iTable = 1;
          pTab = pParse->pTriggerTab;
        }else if( op!=TK_INSERT && zTab && sqlite3StrICmp("old",zTab)==0 ){
          pExpr->iTable = 0;
          pTab = pParse->pTriggerTab;
        }else if( pParse->bReturning ){
          pExpr->iTable = op!=TK_DELETE;
          pTab = pParse->pTriggerTab;
        }
      }
#endif /* SQLITE_OMIT_TRIGGER */
#ifndef SQLITE_OMIT_UPSERT
      if( (pNC->ncFlags & NC_UUpsert)!=0 && ALWAYS(zTab) ){
        Upsert *pUpsert = pNC->uNC.pUpsert;
        if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){
          pTab = pUpsert->pUpsertSrc->a[0].pTab;
          pExpr->iTable = EXCLUDED_TABLE_NUMBER;
        }
      }
#endif /* SQLITE_OMIT_UPSERT */







|
>

|











|






|







98880
98881
98882
98883
98884
98885
98886
98887
98888
98889
98890
98891
98892
98893
98894
98895
98896
98897
98898
98899
98900
98901
98902
98903
98904
98905
98906
98907
98908
98909
98910
98911
98912
98913
98914
98915
98916
        pSchema = pExpr->y.pTab->pSchema;
      }
    } /* if( pSrcList ) */

#if !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT)
    /* If we have not already resolved the name, then maybe
    ** it is a new.* or old.* trigger argument reference.  Or
    ** maybe it is an excluded.* from an upsert.  Or maybe it is
    ** a reference in the RETURNING clause to a table being modified.
    */
    if( cnt==0 && zDb==0 ){
      pTab = 0;
#ifndef SQLITE_OMIT_TRIGGER
      if( pParse->pTriggerTab!=0 ){
        int op = pParse->eTriggerOp;
        assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
        if( op!=TK_DELETE && zTab && sqlite3StrICmp("new",zTab) == 0 ){
          pExpr->iTable = 1;
          pTab = pParse->pTriggerTab;
        }else if( op!=TK_INSERT && zTab && sqlite3StrICmp("old",zTab)==0 ){
          pExpr->iTable = 0;
          pTab = pParse->pTriggerTab;
        }else if( pParse->bReturning && (pNC->ncFlags & NC_UBaseReg)!=0 ){
          pExpr->iTable = op!=TK_DELETE;
          pTab = pParse->pTriggerTab;
        }
      }
#endif /* SQLITE_OMIT_TRIGGER */
#ifndef SQLITE_OMIT_UPSERT
      if( (pNC->ncFlags & NC_UUpsert)!=0 && zTab!=0 ){
        Upsert *pUpsert = pNC->uNC.pUpsert;
        if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){
          pTab = pUpsert->pUpsertSrc->a[0].pTab;
          pExpr->iTable = EXCLUDED_TABLE_NUMBER;
        }
      }
#endif /* SQLITE_OMIT_UPSERT */
98939
98940
98941
98942
98943
98944
98945
98946
98947
98948
98949
98950
98951
98952
98953
          }else
#endif /* SQLITE_OMIT_UPSERT */
          {
            pExpr->y.pTab = pTab;
            if( pParse->bReturning ){
              eNewExprOp = TK_REGISTER;
              pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable
                                   + iCol + 1;
            }else{
              pExpr->iColumn = (i16)iCol;
              eNewExprOp = TK_TRIGGER;
#ifndef SQLITE_OMIT_TRIGGER
              if( iCol<0 ){
                pExpr->affExpr = SQLITE_AFF_INTEGER;
              }else if( pExpr->iTable==0 ){







|







98949
98950
98951
98952
98953
98954
98955
98956
98957
98958
98959
98960
98961
98962
98963
          }else
#endif /* SQLITE_OMIT_UPSERT */
          {
            pExpr->y.pTab = pTab;
            if( pParse->bReturning ){
              eNewExprOp = TK_REGISTER;
              pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable
                                + iCol + 1;
            }else{
              pExpr->iColumn = (i16)iCol;
              eNewExprOp = TK_TRIGGER;
#ifndef SQLITE_OMIT_TRIGGER
              if( iCol<0 ){
                pExpr->affExpr = SQLITE_AFF_INTEGER;
              }else if( pExpr->iTable==0 ){
99026
99027
99028
99029
99030
99031
99032
99033
99034
99035
99036
99037
99038
99039
99040
            sqlite3ErrorMsg(pParse, "misuse of aliased window function %s",zAs);
            return WRC_Abort;
          }
          if( sqlite3ExprVectorSize(pOrig)!=1 ){
            sqlite3ErrorMsg(pParse, "row value misused");
            return WRC_Abort;
          }
          resolveAlias(pParse, pEList, j, pExpr, "", nSubquery);
          cnt = 1;
          pMatch = 0;
          assert( zTab==0 && zDb==0 );
          if( IN_RENAME_OBJECT ){
            sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr);
          }
          goto lookupname_end;







|







99036
99037
99038
99039
99040
99041
99042
99043
99044
99045
99046
99047
99048
99049
99050
            sqlite3ErrorMsg(pParse, "misuse of aliased window function %s",zAs);
            return WRC_Abort;
          }
          if( sqlite3ExprVectorSize(pOrig)!=1 ){
            sqlite3ErrorMsg(pParse, "row value misused");
            return WRC_Abort;
          }
          resolveAlias(pParse, pEList, j, pExpr, nSubquery);
          cnt = 1;
          pMatch = 0;
          assert( zTab==0 && zDb==0 );
          if( IN_RENAME_OBJECT ){
            sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr);
          }
          goto lookupname_end;
99128
99129
99130
99131
99132
99133
99134

99135
99136
99137
99138

99139
99140
99141
99142
99143
99144
99145
  */
  if( pExpr->iColumn>=0 && pMatch!=0 ){
    pMatch->colUsed |= sqlite3ExprColUsed(pExpr);
  }

  /* Clean up and return
  */

  sqlite3ExprDelete(db, pExpr->pLeft);
  pExpr->pLeft = 0;
  sqlite3ExprDelete(db, pExpr->pRight);
  pExpr->pRight = 0;

  pExpr->op = eNewExprOp;
  ExprSetProperty(pExpr, EP_Leaf);
lookupname_end:
  if( cnt==1 ){
    assert( pNC!=0 );
    if( pParse->db->xAuth
     && (pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER)







>
|
|
|
|
>







99138
99139
99140
99141
99142
99143
99144
99145
99146
99147
99148
99149
99150
99151
99152
99153
99154
99155
99156
99157
  */
  if( pExpr->iColumn>=0 && pMatch!=0 ){
    pMatch->colUsed |= sqlite3ExprColUsed(pExpr);
  }

  /* Clean up and return
  */
  if( !ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
    sqlite3ExprDelete(db, pExpr->pLeft);
    pExpr->pLeft = 0;
    sqlite3ExprDelete(db, pExpr->pRight);
    pExpr->pRight = 0;
  }
  pExpr->op = eNewExprOp;
  ExprSetProperty(pExpr, EP_Leaf);
lookupname_end:
  if( cnt==1 ){
    assert( pNC!=0 );
    if( pParse->db->xAuth
     && (pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER)
99903
99904
99905
99906
99907
99908
99909
99910
99911
99912
99913
99914
99915
99916
99917
99918
  assert( pEList!=0 );  /* sqlite3SelectNew() guarantees this */
  for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
    if( pItem->u.x.iOrderByCol ){
      if( pItem->u.x.iOrderByCol>pEList->nExpr ){
        resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr);
        return 1;
      }
      resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,
                   zType,0);
    }
  }
  return 0;
}

#ifndef SQLITE_OMIT_WINDOWFUNC
/*







|
<







99915
99916
99917
99918
99919
99920
99921
99922

99923
99924
99925
99926
99927
99928
99929
  assert( pEList!=0 );  /* sqlite3SelectNew() guarantees this */
  for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
    if( pItem->u.x.iOrderByCol ){
      if( pItem->u.x.iOrderByCol>pEList->nExpr ){
        resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr);
        return 1;
      }
      resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,0);

    }
  }
  return 0;
}

#ifndef SQLITE_OMIT_WINDOWFUNC
/*
100151
100152
100153
100154
100155
100156
100157
100158
100159
100160
100161
100162
100163
100164
100165
    ** other expressions in the SELECT statement. This is so that
    ** expressions in the WHERE clause (etc.) can refer to expressions by
    ** aliases in the result set.
    **
    ** Minor point: If this is the case, then the expression will be
    ** re-evaluated for each reference to it.
    */
    assert( (sNC.ncFlags & (NC_UAggInfo|NC_UUpsert))==0 );
    sNC.uNC.pEList = p->pEList;
    sNC.ncFlags |= NC_UEList;
    if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
    if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;

    /* Resolve names in table-valued-function arguments */
    for(i=0; i<p->pSrc->nSrc; i++){







|







100162
100163
100164
100165
100166
100167
100168
100169
100170
100171
100172
100173
100174
100175
100176
    ** other expressions in the SELECT statement. This is so that
    ** expressions in the WHERE clause (etc.) can refer to expressions by
    ** aliases in the result set.
    **
    ** Minor point: If this is the case, then the expression will be
    ** re-evaluated for each reference to it.
    */
    assert( (sNC.ncFlags & (NC_UAggInfo|NC_UUpsert|NC_UBaseReg))==0 );
    sNC.uNC.pEList = p->pEList;
    sNC.ncFlags |= NC_UEList;
    if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
    if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;

    /* Resolve names in table-valued-function arguments */
    for(i=0; i<p->pSrc->nSrc; i++){
106623
106624
106625
106626
106627
106628
106629
106630






106631
106632
106633
106634
106635
106636
106637
106638
106639
106640
106641
106642
106643
106644
106645
106646
106647
106648
106649
106650
106651
106652
106653
106654
106655
106656
106657
106658
106659
106660
106661
106662
106663
106664
106665
106666
106667
106668
106669
/*
** Generate code to verify that the schemas of database zDb and, if
** bTemp is not true, database "temp", can still be parsed. This is
** called at the end of the generation of an ALTER TABLE ... RENAME ...
** statement to ensure that the operation has not rendered any schema
** objects unusable.
*/
static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){






  sqlite3NestedParse(pParse,
      "SELECT 1 "
      "FROM \"%w\"." DFLT_SCHEMA_TABLE " "
      "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
      " AND sql NOT LIKE 'create virtual%%'"
      " AND sqlite_rename_test(%Q, sql, type, name, %d)=NULL ",
      zDb,
      zDb, bTemp
  );

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

/*
** Generate code to reload the schema for database iDb. And, if iDb!=1, for
** the temp database as well.
*/
static void renameReloadSchema(Parse *pParse, int iDb){
  Vdbe *v = pParse->pVdbe;
  if( v ){
    sqlite3ChangeCookie(pParse, iDb);
    sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, iDb, 0);
    if( iDb!=1 ) sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0);
  }
}

/*
** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy"
** command.
*/







|
>
>
>
>
>
>





|

|








|
|








|



|
|







106634
106635
106636
106637
106638
106639
106640
106641
106642
106643
106644
106645
106646
106647
106648
106649
106650
106651
106652
106653
106654
106655
106656
106657
106658
106659
106660
106661
106662
106663
106664
106665
106666
106667
106668
106669
106670
106671
106672
106673
106674
106675
106676
106677
106678
106679
106680
106681
106682
106683
106684
106685
106686
/*
** Generate code to verify that the schemas of database zDb and, if
** bTemp is not true, database "temp", can still be parsed. This is
** called at the end of the generation of an ALTER TABLE ... RENAME ...
** statement to ensure that the operation has not rendered any schema
** objects unusable.
*/
static void renameTestSchema(
  Parse *pParse,                  /* Parse context */
  const char *zDb,                /* Name of db to verify schema of */
  int bTemp,                      /* True if this is the temp db */
  const char *zWhen               /* "when" part of error message */
){
  pParse->colNamesSet = 1;
  sqlite3NestedParse(pParse,
      "SELECT 1 "
      "FROM \"%w\"." DFLT_SCHEMA_TABLE " "
      "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
      " AND sql NOT LIKE 'create virtual%%'"
      " AND sqlite_rename_test(%Q, sql, type, name, %d, %Q)=NULL ",
      zDb,
      zDb, bTemp, zWhen
  );

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

/*
** Generate code to reload the schema for database iDb. And, if iDb!=1, for
** the temp database as well.
*/
static void renameReloadSchema(Parse *pParse, int iDb, u16 p5){
  Vdbe *v = pParse->pVdbe;
  if( v ){
    sqlite3ChangeCookie(pParse, iDb);
    sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, iDb, 0, p5);
    if( iDb!=1 ) sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0, p5);
  }
}

/*
** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy"
** command.
*/
106804
106805
106806
106807
106808
106809
106810
106811
106812
106813
106814
106815
106816
106817
106818
106819
106820
106821
106822
106823
106824
106825
106826
106827
106828
106829
106830
106831
106832
106833
106834
106835
106836
106837
106838
  ** as required.  */
  if( iDb!=1 ){
    sqlite3NestedParse(pParse,
        "UPDATE sqlite_temp_schema SET "
            "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), "
            "tbl_name = "
              "CASE WHEN tbl_name=%Q COLLATE nocase AND "
              "          sqlite_rename_test(%Q, sql, type, name, 1) "
              "THEN %Q ELSE tbl_name END "
            "WHERE type IN ('view', 'trigger')"
        , zDb, zTabName, zName, zTabName, zDb, zName);
  }

  /* If this is a virtual table, invoke the xRename() function if
  ** one is defined. The xRename() callback will modify the names
  ** of any resources used by the v-table implementation (including other
  ** SQLite tables) that are identified by the name of the virtual table.
  */
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( pVTab ){
    int i = ++pParse->nMem;
    sqlite3VdbeLoadString(v, i, zName);
    sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB);
  }
#endif

  renameReloadSchema(pParse, iDb);
  renameTestSchema(pParse, zDb, iDb==1);

exit_rename_table:
  sqlite3SrcListDelete(db, pSrc);
  sqlite3DbFree(db, zName);
  db->mDbFlags = savedDbFlags;
}








|


















|
|







106821
106822
106823
106824
106825
106826
106827
106828
106829
106830
106831
106832
106833
106834
106835
106836
106837
106838
106839
106840
106841
106842
106843
106844
106845
106846
106847
106848
106849
106850
106851
106852
106853
106854
106855
  ** as required.  */
  if( iDb!=1 ){
    sqlite3NestedParse(pParse,
        "UPDATE sqlite_temp_schema SET "
            "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), "
            "tbl_name = "
              "CASE WHEN tbl_name=%Q COLLATE nocase AND "
              "    sqlite_rename_test(%Q, sql, type, name, 1, 'after rename') "
              "THEN %Q ELSE tbl_name END "
            "WHERE type IN ('view', 'trigger')"
        , zDb, zTabName, zName, zTabName, zDb, zName);
  }

  /* If this is a virtual table, invoke the xRename() function if
  ** one is defined. The xRename() callback will modify the names
  ** of any resources used by the v-table implementation (including other
  ** SQLite tables) that are identified by the name of the virtual table.
  */
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( pVTab ){
    int i = ++pParse->nMem;
    sqlite3VdbeLoadString(v, i, zName);
    sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB);
  }
#endif

  renameReloadSchema(pParse, iDb, INITFLAG_AlterRename);
  renameTestSchema(pParse, zDb, iDb==1, "after rename");

exit_rename_table:
  sqlite3SrcListDelete(db, pSrc);
  sqlite3DbFree(db, zName);
  db->mDbFlags = savedDbFlags;
}

106986
106987
106988
106989
106990
106991
106992
106993
106994
106995
106996
106997
106998
106999
107000
    sqlite3VdbeAddOp2(v, OP_IfPos, r1, sqlite3VdbeCurrentAddr(v)+2);
    VdbeCoverage(v);
    sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3);
    sqlite3ReleaseTempReg(pParse, r1);
  }

  /* Reload the table definition */
  renameReloadSchema(pParse, iDb);
}

/*
** This function is called by the parser after the table-name in
** an "ALTER TABLE <table-name> ADD" statement is parsed. Argument
** pSrc is the full-name of the table being altered.
**







|







107003
107004
107005
107006
107007
107008
107009
107010
107011
107012
107013
107014
107015
107016
107017
    sqlite3VdbeAddOp2(v, OP_IfPos, r1, sqlite3VdbeCurrentAddr(v)+2);
    VdbeCoverage(v);
    sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3);
    sqlite3ReleaseTempReg(pParse, r1);
  }

  /* Reload the table definition */
  renameReloadSchema(pParse, iDb, INITFLAG_AlterRename);
}

/*
** This function is called by the parser after the table-name in
** an "ALTER TABLE <table-name> ADD" statement is parsed. Argument
** pSrc is the full-name of the table being altered.
**
107086
107087
107088
107089
107090
107091
107092
107093
107094
107095
107096
107097
107098
107099
107100
107101
107102
107103
107104
107105
107106

107107
107108
107109
107110
107111
107112
107113
107114
107115
107116
107117
107118
107119
107120
107121
** command. This function checks if the table is a view or virtual
** table (columns of views or virtual tables may not be renamed). If so,
** it loads an error message into pParse and returns non-zero.
**
** Or, if pTab is not a view or virtual table, zero is returned.
*/
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
static int isRealTable(Parse *pParse, Table *pTab){
  const char *zType = 0;
#ifndef SQLITE_OMIT_VIEW
  if( pTab->pSelect ){
    zType = "view";
  }
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( IsVirtual(pTab) ){
    zType = "virtual table";
  }
#endif
  if( zType ){
    sqlite3ErrorMsg(

        pParse, "cannot rename columns of %s \"%s\"", zType, pTab->zName
    );
    return 1;
  }
  return 0;
}
#else /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */
# define isRealTable(x,y) (0)
#endif

/*
** Handles the following parser reduction:
**
**  cmd ::= ALTER TABLE pSrc RENAME COLUMN pOld TO pNew
*/







|












|
>
|






|







107103
107104
107105
107106
107107
107108
107109
107110
107111
107112
107113
107114
107115
107116
107117
107118
107119
107120
107121
107122
107123
107124
107125
107126
107127
107128
107129
107130
107131
107132
107133
107134
107135
107136
107137
107138
107139
** command. This function checks if the table is a view or virtual
** table (columns of views or virtual tables may not be renamed). If so,
** it loads an error message into pParse and returns non-zero.
**
** Or, if pTab is not a view or virtual table, zero is returned.
*/
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
static int isRealTable(Parse *pParse, Table *pTab, int bDrop){
  const char *zType = 0;
#ifndef SQLITE_OMIT_VIEW
  if( pTab->pSelect ){
    zType = "view";
  }
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( IsVirtual(pTab) ){
    zType = "virtual table";
  }
#endif
  if( zType ){
    sqlite3ErrorMsg(pParse, "cannot %s %s \"%s\"",
        (bDrop ? "drop column from" : "rename columns of"),
        zType, pTab->zName
    );
    return 1;
  }
  return 0;
}
#else /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */
# define isRealTable(x,y,z) (0)
#endif

/*
** Handles the following parser reduction:
**
**  cmd ::= ALTER TABLE pSrc RENAME COLUMN pOld TO pNew
*/
107136
107137
107138
107139
107140
107141
107142
107143
107144
107145
107146
107147
107148
107149
107150

  /* Locate the table to be altered */
  pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
  if( !pTab ) goto exit_rename_column;

  /* Cannot alter a system table */
  if( SQLITE_OK!=isAlterableTable(pParse, pTab) ) goto exit_rename_column;
  if( SQLITE_OK!=isRealTable(pParse, pTab) ) goto exit_rename_column;

  /* Which schema holds the table to be altered */
  iSchema = sqlite3SchemaToIndex(db, pTab->pSchema);
  assert( iSchema>=0 );
  zDb = db->aDb[iSchema].zDbSName;

#ifndef SQLITE_OMIT_AUTHORIZATION







|







107154
107155
107156
107157
107158
107159
107160
107161
107162
107163
107164
107165
107166
107167
107168

  /* Locate the table to be altered */
  pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
  if( !pTab ) goto exit_rename_column;

  /* Cannot alter a system table */
  if( SQLITE_OK!=isAlterableTable(pParse, pTab) ) goto exit_rename_column;
  if( SQLITE_OK!=isRealTable(pParse, pTab, 0) ) goto exit_rename_column;

  /* Which schema holds the table to be altered */
  iSchema = sqlite3SchemaToIndex(db, pTab->pSchema);
  assert( iSchema>=0 );
  zDb = db->aDb[iSchema].zDbSName;

#ifndef SQLITE_OMIT_AUTHORIZATION
107190
107191
107192
107193
107194
107195
107196
107197
107198
107199
107200
107201
107202
107203
107204
107205
      "UPDATE temp." DFLT_SCHEMA_TABLE " SET "
      "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) "
      "WHERE type IN ('trigger', 'view')",
      zDb, pTab->zName, iCol, zNew, bQuote
  );

  /* Drop and reload the database schema. */
  renameReloadSchema(pParse, iSchema);
  renameTestSchema(pParse, zDb, iSchema==1);

 exit_rename_column:
  sqlite3SrcListDelete(db, pSrc);
  sqlite3DbFree(db, zOld);
  sqlite3DbFree(db, zNew);
  return;
}







|
|







107208
107209
107210
107211
107212
107213
107214
107215
107216
107217
107218
107219
107220
107221
107222
107223
      "UPDATE temp." DFLT_SCHEMA_TABLE " SET "
      "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) "
      "WHERE type IN ('trigger', 'view')",
      zDb, pTab->zName, iCol, zNew, bQuote
  );

  /* Drop and reload the database schema. */
  renameReloadSchema(pParse, iSchema, INITFLAG_AlterRename);
  renameTestSchema(pParse, zDb, iSchema==1, "after rename");

 exit_rename_column:
  sqlite3SrcListDelete(db, pSrc);
  sqlite3DbFree(db, zOld);
  sqlite3DbFree(db, zNew);
  return;
}
107443
107444
107445
107446
107447
107448
107449
107450



107451
107452
107453


107454


107455
107456
107457
107458
107459

107460
107461
107462
107463

107464
107465
107466

107467
107468
107469
107470
107471
107472
107473
    pNext = p->pNext;
    sqlite3DbFree(db, p);
  }
}

/*
** Search the Parse object passed as the first argument for a RenameToken
** object associated with parse tree element pPtr. If found, remove it



** from the Parse object and add it to the list maintained by the
** RenameCtx object passed as the second argument.
*/


static void renameTokenFind(Parse *pParse, struct RenameCtx *pCtx, void *pPtr){


  RenameToken **pp;
  assert( pPtr!=0 );
  for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){
    if( (*pp)->p==pPtr ){
      RenameToken *pToken = *pp;

      *pp = pToken->pNext;
      pToken->pNext = pCtx->pList;
      pCtx->pList = pToken;
      pCtx->nList++;

      break;
    }
  }

}

/*
** This is a Walker select callback. It does nothing. It is only required
** because without a dummy callback, sqlite3WalkExpr() and similar do not
** descend into sub-select statements.
*/







|
>
>
>
|
|

>
>
|
>
>





>
|
|
|
|
>
|


>







107461
107462
107463
107464
107465
107466
107467
107468
107469
107470
107471
107472
107473
107474
107475
107476
107477
107478
107479
107480
107481
107482
107483
107484
107485
107486
107487
107488
107489
107490
107491
107492
107493
107494
107495
107496
107497
107498
107499
107500
107501
    pNext = p->pNext;
    sqlite3DbFree(db, p);
  }
}

/*
** Search the Parse object passed as the first argument for a RenameToken
** object associated with parse tree element pPtr. If found, return a pointer
** to it. Otherwise, return NULL.
**
** If the second argument passed to this function is not NULL and a matching
** RenameToken object is found, remove it from the Parse object and add it to
** the list maintained by the RenameCtx object.
*/
static RenameToken *renameTokenFind(
  Parse *pParse,
  struct RenameCtx *pCtx,
  void *pPtr
){
  RenameToken **pp;
  assert( pPtr!=0 );
  for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){
    if( (*pp)->p==pPtr ){
      RenameToken *pToken = *pp;
      if( pCtx ){
        *pp = pToken->pNext;
        pToken->pNext = pCtx->pList;
        pCtx->pList = pToken;
        pCtx->nList++;
      }
      return pToken;
    }
  }
  return 0;
}

/*
** This is a Walker select callback. It does nothing. It is only required
** because without a dummy callback, sqlite3WalkExpr() and similar do not
** descend into sub-select statements.
*/
107530
107531
107532
107533
107534
107535
107536
107537
107538
107539
107540
107541
107542
107543
107544
107545
107546
107547
107548
107549
107550
107551
107552
107553
107554
** object (either pParse->pNewTable, pNewIndex or pNewTrigger) as part of an
** ALTER TABLE RENAME COLUMN program. The error message emitted by the
** sub-routine is currently stored in pParse->zErrMsg. This function
** adds context to the error message and then stores it in pCtx.
*/
static void renameColumnParseError(
  sqlite3_context *pCtx,
  int bPost,
  sqlite3_value *pType,
  sqlite3_value *pObject,
  Parse *pParse
){
  const char *zT = (const char*)sqlite3_value_text(pType);
  const char *zN = (const char*)sqlite3_value_text(pObject);
  char *zErr;

  zErr = sqlite3_mprintf("error in %s %s%s: %s",
      zT, zN, (bPost ? " after rename" : ""),
      pParse->zErrMsg
  );
  sqlite3_result_error(pCtx, zErr, -1);
  sqlite3_free(zErr);
}

/*







|








|
|







107558
107559
107560
107561
107562
107563
107564
107565
107566
107567
107568
107569
107570
107571
107572
107573
107574
107575
107576
107577
107578
107579
107580
107581
107582
** object (either pParse->pNewTable, pNewIndex or pNewTrigger) as part of an
** ALTER TABLE RENAME COLUMN program. The error message emitted by the
** sub-routine is currently stored in pParse->zErrMsg. This function
** adds context to the error message and then stores it in pCtx.
*/
static void renameColumnParseError(
  sqlite3_context *pCtx,
  const char *zWhen,
  sqlite3_value *pType,
  sqlite3_value *pObject,
  Parse *pParse
){
  const char *zT = (const char*)sqlite3_value_text(pType);
  const char *zN = (const char*)sqlite3_value_text(pObject);
  char *zErr;

  zErr = sqlite3_mprintf("error in %s %s%s%s: %s",
      zT, zN, (zWhen[0] ? " " : ""), zWhen,
      pParse->zErrMsg
  );
  sqlite3_result_error(pCtx, zErr, -1);
  sqlite3_free(zErr);
}

/*
107619
107620
107621
107622
107623
107624
107625
107626
107627
107628
107629
107630
107631
107632
107633
  /* Parse the SQL statement passed as the first argument. If no error
  ** occurs and the parse does not result in a new table, index or
  ** trigger object, the database must be corrupt. */
  memset(p, 0, sizeof(Parse));
  p->eParseMode = PARSE_MODE_RENAME;
  p->db = db;
  p->nQueryLoop = 1;
  rc = sqlite3RunParser(p, zSql, &zErr);
  assert( p->zErrMsg==0 );
  assert( rc!=SQLITE_OK || zErr==0 );
  p->zErrMsg = zErr;
  if( db->mallocFailed ) rc = SQLITE_NOMEM;
  if( rc==SQLITE_OK
   && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0
  ){







|







107647
107648
107649
107650
107651
107652
107653
107654
107655
107656
107657
107658
107659
107660
107661
  /* Parse the SQL statement passed as the first argument. If no error
  ** occurs and the parse does not result in a new table, index or
  ** trigger object, the database must be corrupt. */
  memset(p, 0, sizeof(Parse));
  p->eParseMode = PARSE_MODE_RENAME;
  p->db = db;
  p->nQueryLoop = 1;
  rc = zSql ? sqlite3RunParser(p, zSql, &zErr) : SQLITE_NOMEM;
  assert( p->zErrMsg==0 );
  assert( rc!=SQLITE_OK || zErr==0 );
  p->zErrMsg = zErr;
  if( db->mallocFailed ) rc = SQLITE_NOMEM;
  if( rc==SQLITE_OK
   && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0
  ){
108046
108047
108048
108049
108050
108051
108052
108053
108054
108055
108056
108057
108058
108059
108060

  assert( rc==SQLITE_OK );
  rc = renameEditSql(context, &sCtx, zSql, zNew, bQuote);

renameColumnFunc_done:
  if( rc!=SQLITE_OK ){
    if( sParse.zErrMsg ){
      renameColumnParseError(context, 0, argv[1], argv[2], &sParse);
    }else{
      sqlite3_result_error_code(context, rc);
    }
  }

  renameParseCleanup(&sParse);
  renameTokenFree(db, sCtx.pList);







|







108074
108075
108076
108077
108078
108079
108080
108081
108082
108083
108084
108085
108086
108087
108088

  assert( rc==SQLITE_OK );
  rc = renameEditSql(context, &sCtx, zSql, zNew, bQuote);

renameColumnFunc_done:
  if( rc!=SQLITE_OK ){
    if( sParse.zErrMsg ){
      renameColumnParseError(context, "", argv[1], argv[2], &sParse);
    }else{
      sqlite3_result_error_code(context, rc);
    }
  }

  renameParseCleanup(&sParse);
  renameTokenFree(db, sCtx.pList);
108235
108236
108237
108238
108239
108240
108241
108242
108243
108244
108245
108246
108247
108248
108249
    }

    if( rc==SQLITE_OK ){
      rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote);
    }
    if( rc!=SQLITE_OK ){
      if( sParse.zErrMsg ){
        renameColumnParseError(context, 0, argv[1], argv[2], &sParse);
      }else{
        sqlite3_result_error_code(context, rc);
      }
    }

    renameParseCleanup(&sParse);
    renameTokenFree(db, sCtx.pList);







|







108263
108264
108265
108266
108267
108268
108269
108270
108271
108272
108273
108274
108275
108276
108277
    }

    if( rc==SQLITE_OK ){
      rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote);
    }
    if( rc!=SQLITE_OK ){
      if( sParse.zErrMsg ){
        renameColumnParseError(context, "", argv[1], argv[2], &sParse);
      }else{
        sqlite3_result_error_code(context, rc);
      }
    }

    renameParseCleanup(&sParse);
    renameTokenFree(db, sCtx.pList);
108264
108265
108266
108267
108268
108269
108270

108271
108272
108273
108274
108275
108276
108277
108278
108279
108280
108281
108282
108283
108284
108285
108286
108287

108288
108289
108290
108291
108292
108293
108294
** to ensure that it is still usable.
**
**   0: Database name ("main", "temp" etc.).
**   1: SQL statement.
**   2: Object type ("view", "table", "trigger" or "index").
**   3: Object name.
**   4: True if object is from temp schema.

**
** Unless it finds an error, this function normally returns NULL. However, it
** returns integer value 1 if:
**
**   * the SQL argument creates a trigger, and
**   * the table that the trigger is attached to is in database zDb.
*/
static void renameTableTest(
  sqlite3_context *context,
  int NotUsed,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_context_db_handle(context);
  char const *zDb = (const char*)sqlite3_value_text(argv[0]);
  char const *zInput = (const char*)sqlite3_value_text(argv[1]);
  int bTemp = sqlite3_value_int(argv[4]);
  int isLegacy = (db->flags & SQLITE_LegacyAlter);


#ifndef SQLITE_OMIT_AUTHORIZATION
  sqlite3_xauth xAuth = db->xAuth;
  db->xAuth = 0;
#endif

  UNUSED_PARAMETER(NotUsed);







>

















>







108292
108293
108294
108295
108296
108297
108298
108299
108300
108301
108302
108303
108304
108305
108306
108307
108308
108309
108310
108311
108312
108313
108314
108315
108316
108317
108318
108319
108320
108321
108322
108323
108324
** to ensure that it is still usable.
**
**   0: Database name ("main", "temp" etc.).
**   1: SQL statement.
**   2: Object type ("view", "table", "trigger" or "index").
**   3: Object name.
**   4: True if object is from temp schema.
**   5: "when" part of error message.
**
** Unless it finds an error, this function normally returns NULL. However, it
** returns integer value 1 if:
**
**   * the SQL argument creates a trigger, and
**   * the table that the trigger is attached to is in database zDb.
*/
static void renameTableTest(
  sqlite3_context *context,
  int NotUsed,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_context_db_handle(context);
  char const *zDb = (const char*)sqlite3_value_text(argv[0]);
  char const *zInput = (const char*)sqlite3_value_text(argv[1]);
  int bTemp = sqlite3_value_int(argv[4]);
  int isLegacy = (db->flags & SQLITE_LegacyAlter);
  char const *zWhen = (const char*)sqlite3_value_text(argv[5]);

#ifndef SQLITE_OMIT_AUTHORIZATION
  sqlite3_xauth xAuth = db->xAuth;
  db->xAuth = 0;
#endif

  UNUSED_PARAMETER(NotUsed);
108313
108314
108315
108316
108317
108318
108319
108320
108321
108322
108323
108324
108325
108326
108327
108328
108329
































































































































































































108330
108331
108332
108333
108334
108335
108336
108337
108338

108339
108340
108341
108342
108343
108344
108345
          int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema);
          int i2 = sqlite3FindDbName(db, zDb);
          if( i1==i2 ) sqlite3_result_int(context, 1);
        }
      }
    }

    if( rc!=SQLITE_OK ){
      renameColumnParseError(context, 1, argv[2], argv[3], &sParse);
    }
    renameParseCleanup(&sParse);
  }

#ifndef SQLITE_OMIT_AUTHORIZATION
  db->xAuth = xAuth;
#endif
}

































































































































































































/*
** Register built-in functions used to help implement ALTER TABLE
*/
SQLITE_PRIVATE void sqlite3AlterFunctions(void){
  static FuncDef aAlterTableFuncs[] = {
    INTERNAL_FUNCTION(sqlite_rename_column, 9, renameColumnFunc),
    INTERNAL_FUNCTION(sqlite_rename_table,  7, renameTableFunc),
    INTERNAL_FUNCTION(sqlite_rename_test,   5, renameTableTest),

  };
  sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs));
}
#endif  /* SQLITE_ALTER_TABLE */

/************** End of alter.c ***********************************************/
/************** Begin file analyze.c *****************************************/







|
|








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






|
|
|
>







108343
108344
108345
108346
108347
108348
108349
108350
108351
108352
108353
108354
108355
108356
108357
108358
108359
108360
108361
108362
108363
108364
108365
108366
108367
108368
108369
108370
108371
108372
108373
108374
108375
108376
108377
108378
108379
108380
108381
108382
108383
108384
108385
108386
108387
108388
108389
108390
108391
108392
108393
108394
108395
108396
108397
108398
108399
108400
108401
108402
108403
108404
108405
108406
108407
108408
108409
108410
108411
108412
108413
108414
108415
108416
108417
108418
108419
108420
108421
108422
108423
108424
108425
108426
108427
108428
108429
108430
108431
108432
108433
108434
108435
108436
108437
108438
108439
108440
108441
108442
108443
108444
108445
108446
108447
108448
108449
108450
108451
108452
108453
108454
108455
108456
108457
108458
108459
108460
108461
108462
108463
108464
108465
108466
108467
108468
108469
108470
108471
108472
108473
108474
108475
108476
108477
108478
108479
108480
108481
108482
108483
108484
108485
108486
108487
108488
108489
108490
108491
108492
108493
108494
108495
108496
108497
108498
108499
108500
108501
108502
108503
108504
108505
108506
108507
108508
108509
108510
108511
108512
108513
108514
108515
108516
108517
108518
108519
108520
108521
108522
108523
108524
108525
108526
108527
108528
108529
108530
108531
108532
108533
108534
108535
108536
108537
108538
108539
108540
108541
108542
108543
108544
108545
108546
108547
108548
108549
108550
108551
108552
108553
108554
108555
108556
108557
108558
108559
108560
108561
108562
108563
108564
108565
108566
108567
108568
          int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema);
          int i2 = sqlite3FindDbName(db, zDb);
          if( i1==i2 ) sqlite3_result_int(context, 1);
        }
      }
    }

    if( rc!=SQLITE_OK && zWhen ){
      renameColumnParseError(context, zWhen, argv[2], argv[3],&sParse);
    }
    renameParseCleanup(&sParse);
  }

#ifndef SQLITE_OMIT_AUTHORIZATION
  db->xAuth = xAuth;
#endif
}

/*
** The implementation of internal UDF sqlite_drop_column().
**
** Arguments:
**
**  argv[0]: An integer - the index of the schema containing the table
**  argv[1]: CREATE TABLE statement to modify.
**  argv[2]: An integer - the index of the column to remove.
**  argv[3]: Byte offset of first byte after last column definition in argv[1]
**
** The value returned is a string containing the CREATE TABLE statement
** with column argv[2] removed.
*/
static void dropColumnFunc(
  sqlite3_context *context,
  int NotUsed,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_context_db_handle(context);
  int iSchema = sqlite3_value_int(argv[0]);
  const char *zSql = (const char*)sqlite3_value_text(argv[1]);
  int iCol = sqlite3_value_int(argv[2]);
  int iAddColOffset = sqlite3_value_int(argv[3]);
  const char *zDb = db->aDb[iSchema].zDbSName;
  int rc;
  Parse sParse;
  RenameToken *pCol;
  Table *pTab;
  const char *zEnd;
  char *zNew = 0;

#ifndef SQLITE_OMIT_AUTHORIZATION
  sqlite3_xauth xAuth = db->xAuth;
  db->xAuth = 0;
#endif

  rc = renameParseSql(&sParse, zDb, db, zSql, iSchema==1);
  if( rc!=SQLITE_OK ) goto drop_column_done;
  pTab = sParse.pNewTable;
  if( iCol>=pTab->nCol ){
    /* This can happen if the sqlite_schema table is corrupt */
    rc = SQLITE_CORRUPT_BKPT;
    goto drop_column_done;
  }

  pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol].zName);
  if( iCol<pTab->nCol-1 ){
    RenameToken *pEnd;
    pEnd = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol+1].zName);
    zEnd = (const char*)pEnd->t.z;
  }else{
    zEnd = (const char*)&zSql[iAddColOffset];
    while( ALWAYS(pCol->t.z[0]!=0) && pCol->t.z[0]!=',' ) pCol->t.z--;
  }

  zNew = sqlite3MPrintf(db, "%.*s%s", pCol->t.z-zSql, zSql, zEnd);
  sqlite3_result_text(context, zNew, -1, SQLITE_TRANSIENT);
  sqlite3_free(zNew);

drop_column_done:
  renameParseCleanup(&sParse);
#ifndef SQLITE_OMIT_AUTHORIZATION
  db->xAuth = xAuth;
#endif
  if( rc!=SQLITE_OK ){
    sqlite3_result_error_code(context, rc);
  }
}

/*
** This function is called by the parser upon parsing an
**
**     ALTER TABLE pSrc DROP COLUMN pName
**
** statement. Argument pSrc contains the possibly qualified name of the
** table being edited, and token pName the name of the column to drop.
*/
SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token *pName){
  sqlite3 *db = pParse->db;       /* Database handle */
  Table *pTab;                    /* Table to modify */
  int iDb;                        /* Index of db containing pTab in aDb[] */
  const char *zDb;                /* Database containing pTab ("main" etc.) */
  char *zCol = 0;                 /* Name of column to drop */
  int iCol;                       /* Index of column zCol in pTab->aCol[] */

  /* Look up the table being altered. */
  assert( pParse->pNewTable==0 );
  assert( sqlite3BtreeHoldsAllMutexes(db) );
  if( NEVER(db->mallocFailed) ) goto exit_drop_column;
  pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
  if( !pTab ) goto exit_drop_column;

  /* Make sure this is not an attempt to ALTER a view, virtual table or
  ** system table. */
  if( SQLITE_OK!=isAlterableTable(pParse, pTab) ) goto exit_drop_column;
  if( SQLITE_OK!=isRealTable(pParse, pTab, 1) ) goto exit_drop_column;

  /* Find the index of the column being dropped. */
  zCol = sqlite3NameFromToken(db, pName);
  if( zCol==0 ){
    assert( db->mallocFailed );
    goto exit_drop_column;
  }
  iCol = sqlite3ColumnIndex(pTab, zCol);
  if( iCol<0 ){
    sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zCol);
    goto exit_drop_column;
  }

  /* Do not allow the user to drop a PRIMARY KEY column or a column
  ** constrained by a UNIQUE constraint.  */
  if( pTab->aCol[iCol].colFlags & (COLFLAG_PRIMKEY|COLFLAG_UNIQUE) ){
    sqlite3ErrorMsg(pParse, "cannot drop %s column: \"%s\"",
        (pTab->aCol[iCol].colFlags&COLFLAG_PRIMKEY) ? "PRIMARY KEY" : "UNIQUE",
        zCol
    );
    goto exit_drop_column;
  }

  /* Do not allow the number of columns to go to zero */
  if( pTab->nCol<=1 ){
    sqlite3ErrorMsg(pParse, "cannot drop column \"%s\": no other columns exist",zCol);
    goto exit_drop_column;
  }

  /* Edit the sqlite_schema table */
  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
  assert( iDb>=0 );
  zDb = db->aDb[iDb].zDbSName;
  renameTestSchema(pParse, zDb, iDb==1, "");
  sqlite3NestedParse(pParse,
      "UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
      "sql = sqlite_drop_column(%d, sql, %d, %d) "
      "WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)"
      , zDb, iDb, iCol, pTab->addColOffset, pTab->zName
  );

  /* Drop and reload the database schema. */
  renameReloadSchema(pParse, iDb, INITFLAG_AlterDrop);
  renameTestSchema(pParse, zDb, iDb==1, "after drop column");

  /* Edit rows of table on disk */
  if( pParse->nErr==0 && (pTab->aCol[iCol].colFlags & COLFLAG_VIRTUAL)==0 ){
    int i;
    int addr;
    int reg;
    int regRec;
    Index *pPk = 0;
    int nField = 0;               /* Number of non-virtual columns after drop */
    int iCur;
    Vdbe *v = sqlite3GetVdbe(pParse);
    iCur = pParse->nTab++;
    sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenWrite);
    addr = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v);
    reg = ++pParse->nMem;
    pParse->nMem += pTab->nCol;
    if( HasRowid(pTab) ){
      sqlite3VdbeAddOp2(v, OP_Rowid, iCur, reg);
    }else{
      pPk = sqlite3PrimaryKeyIndex(pTab);
    }
    for(i=0; i<pTab->nCol; i++){
      if( i!=iCol && (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 ){
        int regOut;
        if( pPk ){
          int iPos = sqlite3TableColumnToIndex(pPk, i);
          int iColPos = sqlite3TableColumnToIndex(pPk, iCol);
          regOut = reg+1+iPos-(iPos>iColPos);
        }else{
          regOut = reg+1+nField;
        }
        sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, i, regOut);
        nField++;
      }
    }
    regRec = reg + pTab->nCol;
    sqlite3VdbeAddOp3(v, OP_MakeRecord, reg+1, nField, regRec);
    if( pPk ){
      sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iCur, regRec, reg+1, pPk->nKeyCol);
    }else{
      sqlite3VdbeAddOp3(v, OP_Insert, iCur, regRec, reg);
    }

    sqlite3VdbeAddOp2(v, OP_Next, iCur, addr+1); VdbeCoverage(v);
    sqlite3VdbeJumpHere(v, addr);
  }

exit_drop_column:
  sqlite3DbFree(db, zCol);
  sqlite3SrcListDelete(db, pSrc);
}

/*
** Register built-in functions used to help implement ALTER TABLE
*/
SQLITE_PRIVATE void sqlite3AlterFunctions(void){
  static FuncDef aAlterTableFuncs[] = {
    INTERNAL_FUNCTION(sqlite_rename_column,  9, renameColumnFunc),
    INTERNAL_FUNCTION(sqlite_rename_table,   7, renameTableFunc),
    INTERNAL_FUNCTION(sqlite_rename_test,    6, renameTableTest),
    INTERNAL_FUNCTION(sqlite_drop_column,    4, dropColumnFunc),
  };
  sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs));
}
#endif  /* SQLITE_ALTER_TABLE */

/************** End of alter.c ***********************************************/
/************** Begin file analyze.c *****************************************/
111316
111317
111318
111319
111320
111321
111322

111323
111324
111325
111326
111327
111328

111329
111330
111331
111332
111333
111334
111335
      Returning *pReturning = pParse->u1.pReturning;
      int addrRewind;
      int i;
      int reg;

      addrRewind =
         sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);

      reg = pReturning->iRetReg;
      for(i=0; i<pReturning->nRetCol; i++){
        sqlite3VdbeAddOp3(v, OP_Column, pReturning->iRetCur, i, reg+i);
      }
      sqlite3VdbeAddOp2(v, OP_ResultRow, reg, i);
      sqlite3VdbeAddOp2(v, OP_Next, pReturning->iRetCur, addrRewind+1);

      sqlite3VdbeJumpHere(v, addrRewind);
    }
    sqlite3VdbeAddOp0(v, OP_Halt);

#if SQLITE_USER_AUTHENTICATION
    if( pParse->nTableLock>0 && db->init.busy==0 ){
      sqlite3UserAuthInit(db);







>






>







111539
111540
111541
111542
111543
111544
111545
111546
111547
111548
111549
111550
111551
111552
111553
111554
111555
111556
111557
111558
111559
111560
      Returning *pReturning = pParse->u1.pReturning;
      int addrRewind;
      int i;
      int reg;

      addrRewind =
         sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
      VdbeCoverage(v);
      reg = pReturning->iRetReg;
      for(i=0; i<pReturning->nRetCol; i++){
        sqlite3VdbeAddOp3(v, OP_Column, pReturning->iRetCur, i, reg+i);
      }
      sqlite3VdbeAddOp2(v, OP_ResultRow, reg, i);
      sqlite3VdbeAddOp2(v, OP_Next, pReturning->iRetCur, addrRewind+1);
      VdbeCoverage(v);
      sqlite3VdbeJumpHere(v, addrRewind);
    }
    sqlite3VdbeAddOp0(v, OP_Halt);

#if SQLITE_USER_AUTHENTICATION
    if( pParse->nTableLock>0 && db->init.busy==0 ){
      sqlite3UserAuthInit(db);
112415
112416
112417
112418
112419
112420
112421

112422
112423
112424
112425
112426
112427
112428
/* Set properties of a table column based on the (magical)
** name of the column.
*/
#if SQLITE_ENABLE_HIDDEN_COLUMNS
SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){
  if( sqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){
    pCol->colFlags |= COLFLAG_HIDDEN;

  }else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){
    pTab->tabFlags |= TF_OOOHidden;
  }
}
#endif

/*







>







112640
112641
112642
112643
112644
112645
112646
112647
112648
112649
112650
112651
112652
112653
112654
/* Set properties of a table column based on the (magical)
** name of the column.
*/
#if SQLITE_ENABLE_HIDDEN_COLUMNS
SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){
  if( sqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){
    pCol->colFlags |= COLFLAG_HIDDEN;
    if( pTab ) pTab->tabFlags |= TF_HasHidden;
  }else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){
    pTab->tabFlags |= TF_OOOHidden;
  }
}
#endif

/*
112459
112460
112461
112462
112463
112464
112465



112466

112467
112468
112469
112470
112471
112472
112473
** RETURNING trigger instead.  It will then be converted into the appropriate
** type on the first call to sqlite3TriggersExist().
*/
SQLITE_PRIVATE void sqlite3AddReturning(Parse *pParse, ExprList *pList){
  Returning *pRet;
  Hash *pHash;
  sqlite3 *db = pParse->db;



  assert( !pParse->bReturning );

  pParse->bReturning = 1;
  pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
  if( pRet==0 ){
    sqlite3ExprListDelete(db, pList);
    return;
  }
  pParse->u1.pReturning = pRet;







>
>
>
|
>







112685
112686
112687
112688
112689
112690
112691
112692
112693
112694
112695
112696
112697
112698
112699
112700
112701
112702
112703
** RETURNING trigger instead.  It will then be converted into the appropriate
** type on the first call to sqlite3TriggersExist().
*/
SQLITE_PRIVATE void sqlite3AddReturning(Parse *pParse, ExprList *pList){
  Returning *pRet;
  Hash *pHash;
  sqlite3 *db = pParse->db;
  if( pParse->pNewTrigger ){
    sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
  }else{
    assert( pParse->bReturning==0 );
  }
  pParse->bReturning = 1;
  pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
  if( pRet==0 ){
    sqlite3ExprListDelete(db, pList);
    return;
  }
  pParse->u1.pReturning = pRet;
112482
112483
112484
112485
112486
112487
112488
112489
112490
112491
112492
112493
112494
112495
112496
  pRet->retTrig.bReturning = 1;
  pRet->retTrig.pSchema = db->aDb[1].pSchema;
  pRet->retTrig.step_list = &pRet->retTStep;
  pRet->retTStep.op = TK_RETURNING;
  pRet->retTStep.pTrig = &pRet->retTrig;
  pRet->retTStep.pExprList = pList;
  pHash = &(db->aDb[1].pSchema->trigHash);
  assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 );
  if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
          ==&pRet->retTrig ){
    sqlite3OomFault(db);
  }
}

/*







|







112712
112713
112714
112715
112716
112717
112718
112719
112720
112721
112722
112723
112724
112725
112726
  pRet->retTrig.bReturning = 1;
  pRet->retTrig.pSchema = db->aDb[1].pSchema;
  pRet->retTrig.step_list = &pRet->retTStep;
  pRet->retTStep.op = TK_RETURNING;
  pRet->retTStep.pTrig = &pRet->retTrig;
  pRet->retTStep.pExprList = pList;
  pHash = &(db->aDb[1].pSchema->trigHash);
  assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 || pParse->nErr );
  if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
          ==&pRet->retTrig ){
    sqlite3OomFault(db);
  }
}

/*
113787
113788
113789
113790
113791
113792
113793
113794
113795
113796
113797
113798
113799
113800
113801
        );
      }
    }
#endif

    /* Reparse everything to update our internal data structures */
    sqlite3VdbeAddParseSchemaOp(v, iDb,
           sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName));
  }

  /* Add the table to the in-memory representation of the database.
  */
  if( db->init.busy ){
    Table *pOld;
    Schema *pSchema = p->pSchema;







|







114017
114018
114019
114020
114021
114022
114023
114024
114025
114026
114027
114028
114029
114030
114031
        );
      }
    }
#endif

    /* Reparse everything to update our internal data structures */
    sqlite3VdbeAddParseSchemaOp(v, iDb,
           sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName),0);
  }

  /* Add the table to the in-memory representation of the database.
  */
  if( db->init.busy ){
    Table *pOld;
    Schema *pSchema = p->pSchema;
115275
115276
115277
115278
115279
115280
115281
115282
115283
115284
115285
115286
115287
115288
115289
      /* Fill the index with data and reparse the schema. Code an OP_Expire
      ** to invalidate all pre-compiled statements.
      */
      if( pTblName ){
        sqlite3RefillIndex(pParse, pIndex, iMem);
        sqlite3ChangeCookie(pParse, iDb);
        sqlite3VdbeAddParseSchemaOp(v, iDb,
            sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName));
        sqlite3VdbeAddOp2(v, OP_Expire, 0, 1);
      }

      sqlite3VdbeJumpHere(v, (int)pIndex->tnum);
    }
  }
  if( db->init.busy || pTblName==0 ){







|







115505
115506
115507
115508
115509
115510
115511
115512
115513
115514
115515
115516
115517
115518
115519
      /* Fill the index with data and reparse the schema. Code an OP_Expire
      ** to invalidate all pre-compiled statements.
      */
      if( pTblName ){
        sqlite3RefillIndex(pParse, pIndex, iMem);
        sqlite3ChangeCookie(pParse, iDb);
        sqlite3VdbeAddParseSchemaOp(v, iDb,
            sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName), 0);
        sqlite3VdbeAddOp2(v, OP_Expire, 0, 1);
      }

      sqlite3VdbeJumpHere(v, (int)pIndex->tnum);
    }
  }
  if( db->init.busy || pTblName==0 ){
118621
118622
118623
118624
118625
118626
118627
118628

118629
118630
118631
118632
118633
118634
118635
  const u8 *zEscaped = 0;          /* One past the last escaped input char */

  while( (c = Utf8Read(zPattern))!=0 ){
    if( c==matchAll ){  /* Match "*" */
      /* Skip over multiple "*" characters in the pattern.  If there
      ** are also "?" characters, skip those as well, but consume a
      ** single character of the input string for each "?" skipped */
      while( (c=Utf8Read(zPattern)) == matchAll || c == matchOne ){

        if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
          return SQLITE_NOWILDCARDMATCH;
        }
      }
      if( c==0 ){
        return SQLITE_MATCH;   /* "*" at the end of the pattern matches */
      }else if( c==matchOther ){







|
>







118851
118852
118853
118854
118855
118856
118857
118858
118859
118860
118861
118862
118863
118864
118865
118866
  const u8 *zEscaped = 0;          /* One past the last escaped input char */

  while( (c = Utf8Read(zPattern))!=0 ){
    if( c==matchAll ){  /* Match "*" */
      /* Skip over multiple "*" characters in the pattern.  If there
      ** are also "?" characters, skip those as well, but consume a
      ** single character of the input string for each "?" skipped */
      while( (c=Utf8Read(zPattern)) == matchAll
             || (c == matchOne && matchOne!=0) ){
        if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
          return SQLITE_NOWILDCARDMATCH;
        }
      }
      if( c==0 ){
        return SQLITE_MATCH;   /* "*" at the end of the pattern matches */
      }else if( c==matchOther ){
122601
122602
122603
122604
122605
122606
122607
122608
122609
122610
122611
122612




122613
122614
122615

122616
122617
122618
122619
122620

122621
122622
122623
122624
122625
122626
122627
          testcase( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL );
          testcase( pTab->aCol[i].colFlags & COLFLAG_STORED );
          ipkColumn--;
        }
      }
    }
#endif
  }

  /* Make sure the number of columns in the source data matches the number
  ** of columns to be inserted into the table.
  */




  for(i=0; i<pTab->nCol; i++){
    if( pTab->aCol[i].colFlags & COLFLAG_NOINSERT ) nHidden++;
  }

  if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){
    sqlite3ErrorMsg(pParse,
       "table %S has %d columns but %d values were supplied",
       pTabList, 0, pTab->nCol-nHidden, nColumn);
    goto insert_cleanup;

  }
  if( pColumn!=0 && nColumn!=pColumn->nId ){
    sqlite3ErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId);
    goto insert_cleanup;
  }

  /* Initialize the count of rows to be inserted







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







122832
122833
122834
122835
122836
122837
122838
122839

122840
122841
122842
122843
122844
122845
122846
122847
122848
122849
122850
122851
122852
122853
122854
122855
122856
122857
122858
122859
122860
122861
122862
122863
          testcase( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL );
          testcase( pTab->aCol[i].colFlags & COLFLAG_STORED );
          ipkColumn--;
        }
      }
    }
#endif


    /* Make sure the number of columns in the source data matches the number
    ** of columns to be inserted into the table.
    */
    assert( TF_HasHidden==COLFLAG_HIDDEN );
    assert( TF_HasGenerated==COLFLAG_GENERATED );
    assert( COLFLAG_NOINSERT==(COLFLAG_GENERATED|COLFLAG_HIDDEN) );
    if( (pTab->tabFlags & (TF_HasGenerated|TF_HasHidden))!=0 ){
      for(i=0; i<pTab->nCol; i++){
        if( pTab->aCol[i].colFlags & COLFLAG_NOINSERT ) nHidden++;
      }
    }
    if( nColumn!=(pTab->nCol-nHidden) ){
      sqlite3ErrorMsg(pParse,
         "table %S has %d columns but %d values were supplied",
         pTabList, 0, pTab->nCol-nHidden, nColumn);
     goto insert_cleanup;
    }
  }
  if( pColumn!=0 && nColumn!=pColumn->nId ){
    sqlite3ErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId);
    goto insert_cleanup;
  }

  /* Initialize the count of rows to be inserted
124076
124077
124078
124079
124080
124081
124082


























124083
124084
124085
124086
124087
124088
124089
    if( pTab->aCol[i].pDflt!=0 ) break;
    if( pTab->aCol[i].colFlags & COLFLAG_PRIMKEY ) break;
  }
  sqlite3VdbeChangeP5(v, i+1);
}
#endif



























/*
** This routine generates code to finish the INSERT or UPDATE operation
** that was started by a prior call to sqlite3GenerateConstraintChecks.
** A consecutive range of registers starting at regNewData contains the
** rowid and the content to be inserted.
**
** The arguments to this routine should be the same as the first six







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







124312
124313
124314
124315
124316
124317
124318
124319
124320
124321
124322
124323
124324
124325
124326
124327
124328
124329
124330
124331
124332
124333
124334
124335
124336
124337
124338
124339
124340
124341
124342
124343
124344
124345
124346
124347
124348
124349
124350
124351
    if( pTab->aCol[i].pDflt!=0 ) break;
    if( pTab->aCol[i].colFlags & COLFLAG_PRIMKEY ) break;
  }
  sqlite3VdbeChangeP5(v, i+1);
}
#endif

/*
** Table pTab is a WITHOUT ROWID table that is being written to. The cursor
** number is iCur, and register regData contains the new record for the
** PK index. This function adds code to invoke the pre-update hook,
** if one is registered.
*/
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
static void codeWithoutRowidPreupdate(
  Parse *pParse,                  /* Parse context */
  Table *pTab,                    /* Table being updated */
  int iCur,                       /* Cursor number for table */
  int regData                     /* Data containing new record */
){
  Vdbe *v = pParse->pVdbe;
  int r = sqlite3GetTempReg(pParse);
  assert( !HasRowid(pTab) );
  assert( 0==(pParse->db->mDbFlags & DBFLAG_Vacuum) );
  sqlite3VdbeAddOp2(v, OP_Integer, 0, r);
  sqlite3VdbeAddOp4(v, OP_Insert, iCur, regData, r, (char*)pTab, P4_TABLE);
  sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP);
  sqlite3ReleaseTempReg(pParse, r);
}
#else
# define codeWithoutRowidPreupdate(a,b,c,d)
#endif

/*
** This routine generates code to finish the INSERT or UPDATE operation
** that was started by a prior call to sqlite3GenerateConstraintChecks.
** A consecutive range of registers starting at regNewData contains the
** rowid and the content to be inserted.
**
** The arguments to this routine should be the same as the first six
124124
124125
124126
124127
124128
124129
124130
124131
124132
124133
124134
124135
124136
124137
124138
124139
124140
124141
124142
124143
124144
124145
124146
124147
124148
      VdbeCoverage(v);
    }
    pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
    if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
      assert( pParse->nested==0 );
      pik_flags |= OPFLAG_NCHANGE;
      pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
      if( update_flags==0 ){
        int r = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp2(v, OP_Integer, 0, r);
        sqlite3VdbeAddOp4(v, OP_Insert,
            iIdxCur+i, aRegIdx[i], r, (char*)pTab, P4_TABLE
        );
        sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP);
        sqlite3ReleaseTempReg(pParse, r);
      }
#endif
    }
    sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
                         aRegIdx[i]+1,
                         pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn);
    sqlite3VdbeChangeP5(v, pik_flags);
  }
  if( !HasRowid(pTab) ) return;







<

<
<
<
|
<
<
<

<







124386
124387
124388
124389
124390
124391
124392

124393



124394



124395

124396
124397
124398
124399
124400
124401
124402
      VdbeCoverage(v);
    }
    pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
    if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
      assert( pParse->nested==0 );
      pik_flags |= OPFLAG_NCHANGE;
      pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);

      if( update_flags==0 ){



        codeWithoutRowidPreupdate(pParse, pTab, iIdxCur+i, aRegIdx[i]);



      }

    }
    sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
                         aRegIdx[i]+1,
                         pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn);
    sqlite3VdbeChangeP5(v, pik_flags);
  }
  if( !HasRowid(pTab) ) return;
124607
124608
124609
124610
124611
124612
124613
124614
124615
124616
124617
124618
124619
124620
124621
124622

124623

124624
124625
124626
124627
124628
124629
124630
    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);







|







|
>
|
>







124861
124862
124863
124864
124865
124866
124867
124868
124869
124870
124871
124872
124873
124874
124875
124876
124877
124878
124879
124880
124881
124882
124883
124884
124885
124886
    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->mDbFlags & DBFLAG_Vacuum)==0 ){
      sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
      insFlags &= ~OPFLAG_PREFORMAT;
    }else
#endif
    {
      sqlite3VdbeAddOp3(v, OP_RowCell, iDest, iSrc, regRowid);
    }
    sqlite3VdbeAddOp3(v, OP_Insert, iDest, regData, regRowid);
    if( (db->mDbFlags & DBFLAG_Vacuum)==0 ){
      sqlite3VdbeChangeP4(v, -1, (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);
124669
124670
124671
124672
124673
124674
124675






124676
124677
124678
124679
124680
124681
124682
        sqlite3VdbeAddOp2(v, OP_RowCell, iDest, iSrc);
      }
    }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);







>
>
>
>
>
>







124925
124926
124927
124928
124929
124930
124931
124932
124933
124934
124935
124936
124937
124938
124939
124940
124941
124942
124943
124944
        sqlite3VdbeAddOp2(v, OP_RowCell, iDest, iSrc);
      }
    }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);
      if( (db->mDbFlags & DBFLAG_Vacuum)==0
       && !HasRowid(pDest)
       && IsPrimaryKeyIndex(pDestIdx)
      ){
        codeWithoutRowidPreupdate(pParse, pDest, iDest, regData);
      }
    }
    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);
129633
129634
129635
129636
129637
129638
129639
129640
129641
129642
129643
129644
129645
129646
129647
129648
129649




129650
129651
129652
129653
129654
129655
129656
129657
129658
129659
129660
129661
129662

/*
** Fill the InitData structure with an error message that indicates
** that the database is corrupt.
*/
static void corruptSchema(
  InitData *pData,     /* Initialization context */
  const char *zObj,    /* Object being parsed at the point of error */
  const char *zExtra   /* Error information */
){
  sqlite3 *db = pData->db;
  if( db->mallocFailed ){
    pData->rc = SQLITE_NOMEM_BKPT;
  }else if( pData->pzErrMsg[0]!=0 ){
    /* A error message has already been generated.  Do not overwrite it */
  }else if( pData->mInitFlags & INITFLAG_AlterTable ){
    *pData->pzErrMsg = sqlite3DbStrDup(db, zExtra);




    pData->rc = SQLITE_ERROR;
  }else if( db->flags & SQLITE_WriteSchema ){
    pData->rc = SQLITE_CORRUPT_BKPT;
  }else{
    char *z;
    if( zObj==0 ) zObj = "?";
    z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
    if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
    *pData->pzErrMsg = z;
    pData->rc = SQLITE_CORRUPT_BKPT;
  }
}








|







|
|
>
>
>
>





|







129895
129896
129897
129898
129899
129900
129901
129902
129903
129904
129905
129906
129907
129908
129909
129910
129911
129912
129913
129914
129915
129916
129917
129918
129919
129920
129921
129922
129923
129924
129925
129926
129927
129928

/*
** Fill the InitData structure with an error message that indicates
** that the database is corrupt.
*/
static void corruptSchema(
  InitData *pData,     /* Initialization context */
  char **azObj,        /* Type and name of object being parsed */
  const char *zExtra   /* Error information */
){
  sqlite3 *db = pData->db;
  if( db->mallocFailed ){
    pData->rc = SQLITE_NOMEM_BKPT;
  }else if( pData->pzErrMsg[0]!=0 ){
    /* A error message has already been generated.  Do not overwrite it */
  }else if( pData->mInitFlags & (INITFLAG_AlterRename|INITFLAG_AlterDrop) ){
    *pData->pzErrMsg = sqlite3MPrintf(db,
        "error in %s %s after %s: %s", azObj[0], azObj[1],
        (pData->mInitFlags & INITFLAG_AlterRename) ? "rename" : "drop column",
        zExtra
    );
    pData->rc = SQLITE_ERROR;
  }else if( db->flags & SQLITE_WriteSchema ){
    pData->rc = SQLITE_CORRUPT_BKPT;
  }else{
    char *z;
    const char *zObj = azObj[1] ? azObj[1] : "?";
    z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
    if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
    *pData->pzErrMsg = z;
    pData->rc = SQLITE_CORRUPT_BKPT;
  }
}

129706
129707
129708
129709
129710
129711
129712
129713
129714
129715
129716
129717
129718
129719
129720
129721
129722
129723
129724
129725
129726
129727

  assert( argc==5 );
  UNUSED_PARAMETER2(NotUsed, argc);
  assert( sqlite3_mutex_held(db->mutex) );
  db->mDbFlags |= DBFLAG_EncodingFixed;
  pData->nInitRow++;
  if( db->mallocFailed ){
    corruptSchema(pData, argv[1], 0);
    return 1;
  }

  assert( iDb>=0 && iDb<db->nDb );
  if( argv==0 ) return 0;   /* Might happen if EMPTY_RESULT_CALLBACKS are on */
  if( argv[3]==0 ){
    corruptSchema(pData, argv[1], 0);
  }else if( argv[4]
         && 'c'==sqlite3UpperToLower[(unsigned char)argv[4][0]]
         && 'r'==sqlite3UpperToLower[(unsigned char)argv[4][1]] ){
    /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
    ** But because db->init.busy is set to 1, no VDBE code is generated
    ** or executed.  All the parser does is build the internal data
    ** structures that describe the table, index, or view.







|






|







129972
129973
129974
129975
129976
129977
129978
129979
129980
129981
129982
129983
129984
129985
129986
129987
129988
129989
129990
129991
129992
129993

  assert( argc==5 );
  UNUSED_PARAMETER2(NotUsed, argc);
  assert( sqlite3_mutex_held(db->mutex) );
  db->mDbFlags |= DBFLAG_EncodingFixed;
  pData->nInitRow++;
  if( db->mallocFailed ){
    corruptSchema(pData, argv, 0);
    return 1;
  }

  assert( iDb>=0 && iDb<db->nDb );
  if( argv==0 ) return 0;   /* Might happen if EMPTY_RESULT_CALLBACKS are on */
  if( argv[3]==0 ){
    corruptSchema(pData, argv, 0);
  }else if( argv[4]
         && 'c'==sqlite3UpperToLower[(unsigned char)argv[4][0]]
         && 'r'==sqlite3UpperToLower[(unsigned char)argv[4][1]] ){
    /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
    ** But because db->init.busy is set to 1, no VDBE code is generated
    ** or executed.  All the parser does is build the internal data
    ** structures that describe the table, index, or view.
129738
129739
129740
129741
129742
129743
129744
129745
129746
129747
129748
129749
129750
129751
129752
129753
129754
129755
129756
129757
129758
129759
129760
129761
129762
129763
129764
129765
129766
129767
129768
129769
129770
129771
129772
129773
129774
129775
129776
129777
129778
129779
129780
129781
129782
129783
129784
129785
129786
129787
129788
129789
129790
129791
129792
129793
129794
129795
129796

    assert( db->init.busy );
    db->init.iDb = iDb;
    if( sqlite3GetUInt32(argv[3], &db->init.newTnum)==0
     || (db->init.newTnum>pData->mxPage && pData->mxPage>0)
    ){
      if( sqlite3Config.bExtraSchemaChecks ){
        corruptSchema(pData, argv[1], "invalid rootpage");
      }
    }
    db->init.orphanTrigger = 0;
    db->init.azInit = argv;
    pStmt = 0;
    TESTONLY(rcp = ) sqlite3Prepare(db, argv[4], -1, 0, 0, &pStmt, 0);
    rc = db->errCode;
    assert( (rc&0xFF)==(rcp&0xFF) );
    db->init.iDb = saved_iDb;
    /* assert( saved_iDb==0 || (db->mDbFlags & DBFLAG_Vacuum)!=0 ); */
    if( SQLITE_OK!=rc ){
      if( db->init.orphanTrigger ){
        assert( iDb==1 );
      }else{
        if( rc > pData->rc ) pData->rc = rc;
        if( rc==SQLITE_NOMEM ){
          sqlite3OomFault(db);
        }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){
          corruptSchema(pData, argv[1], sqlite3_errmsg(db));
        }
      }
    }
    sqlite3_finalize(pStmt);
  }else if( argv[1]==0 || (argv[4]!=0 && argv[4][0]!=0) ){
    corruptSchema(pData, argv[1], 0);
  }else{
    /* If the SQL column is blank it means this is an index that
    ** was created to be the PRIMARY KEY or to fulfill a UNIQUE
    ** constraint for a CREATE TABLE.  The index should have already
    ** been created when we processed the CREATE TABLE.  All we have
    ** to do here is record the root page number for that index.
    */
    Index *pIndex;
    pIndex = sqlite3FindIndex(db, argv[1], db->aDb[iDb].zDbSName);
    if( pIndex==0 ){
      corruptSchema(pData, argv[1], "orphan index");
    }else
    if( sqlite3GetUInt32(argv[3],&pIndex->tnum)==0
     || pIndex->tnum<2
     || pIndex->tnum>pData->mxPage
     || sqlite3IndexHasDuplicateRootPage(pIndex)
    ){
      if( sqlite3Config.bExtraSchemaChecks ){
        corruptSchema(pData, argv[1], "invalid rootpage");
      }
    }
  }
  return 0;
}

/*







|


















|





|










|







|







130004
130005
130006
130007
130008
130009
130010
130011
130012
130013
130014
130015
130016
130017
130018
130019
130020
130021
130022
130023
130024
130025
130026
130027
130028
130029
130030
130031
130032
130033
130034
130035
130036
130037
130038
130039
130040
130041
130042
130043
130044
130045
130046
130047
130048
130049
130050
130051
130052
130053
130054
130055
130056
130057
130058
130059
130060
130061
130062

    assert( db->init.busy );
    db->init.iDb = iDb;
    if( sqlite3GetUInt32(argv[3], &db->init.newTnum)==0
     || (db->init.newTnum>pData->mxPage && pData->mxPage>0)
    ){
      if( sqlite3Config.bExtraSchemaChecks ){
        corruptSchema(pData, argv, "invalid rootpage");
      }
    }
    db->init.orphanTrigger = 0;
    db->init.azInit = argv;
    pStmt = 0;
    TESTONLY(rcp = ) sqlite3Prepare(db, argv[4], -1, 0, 0, &pStmt, 0);
    rc = db->errCode;
    assert( (rc&0xFF)==(rcp&0xFF) );
    db->init.iDb = saved_iDb;
    /* assert( saved_iDb==0 || (db->mDbFlags & DBFLAG_Vacuum)!=0 ); */
    if( SQLITE_OK!=rc ){
      if( db->init.orphanTrigger ){
        assert( iDb==1 );
      }else{
        if( rc > pData->rc ) pData->rc = rc;
        if( rc==SQLITE_NOMEM ){
          sqlite3OomFault(db);
        }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){
          corruptSchema(pData, argv, sqlite3_errmsg(db));
        }
      }
    }
    sqlite3_finalize(pStmt);
  }else if( argv[1]==0 || (argv[4]!=0 && argv[4][0]!=0) ){
    corruptSchema(pData, argv, 0);
  }else{
    /* If the SQL column is blank it means this is an index that
    ** was created to be the PRIMARY KEY or to fulfill a UNIQUE
    ** constraint for a CREATE TABLE.  The index should have already
    ** been created when we processed the CREATE TABLE.  All we have
    ** to do here is record the root page number for that index.
    */
    Index *pIndex;
    pIndex = sqlite3FindIndex(db, argv[1], db->aDb[iDb].zDbSName);
    if( pIndex==0 ){
      corruptSchema(pData, argv, "orphan index");
    }else
    if( sqlite3GetUInt32(argv[3],&pIndex->tnum)==0
     || pIndex->tnum<2
     || pIndex->tnum>pData->mxPage
     || sqlite3IndexHasDuplicateRootPage(pIndex)
    ){
      if( sqlite3Config.bExtraSchemaChecks ){
        corruptSchema(pData, argv, "invalid rootpage");
      }
    }
  }
  return 0;
}

/*
130162
130163
130164
130165
130166
130167
130168
130169
130170
130171
130172
130173
130174
130175
130176
130177
130178
130179
130180
130181
130182
130183
130184
130185
130186
130187
130188
130189
130190
130191
130192
130193
130194
130195
130196
130197
130198
130199
130200
      }
    }
    assert( i>=0 && i<db->nDb );
  }
  return i;
}

/*
** Deallocate a single AggInfo object
*/
static void agginfoFree(sqlite3 *db, AggInfo *p){
  sqlite3DbFree(db, p->aCol);
  sqlite3DbFree(db, p->aFunc);
  sqlite3DbFree(db, p);
}

/*
** Free all memory allocations in the pParse object
*/
SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
  sqlite3 *db = pParse->db;
  AggInfo *pThis = pParse->pAggList;
  while( pThis ){
    AggInfo *pNext = pThis->pNext;
    agginfoFree(db, pThis);
    pThis = pNext;
  }
  while( pParse->pCleanup ){
    ParseCleanup *pCleanup = pParse->pCleanup;
    pParse->pCleanup = pCleanup->pNext;
    pCleanup->xCleanup(db, pCleanup->pPtr);
    sqlite3DbFree(db, pCleanup);
  }
  sqlite3DbFree(db, pParse->aLabel);
  if( pParse->pConstExpr ){
    sqlite3ExprListDelete(db, pParse->pConstExpr);
  }
  if( db ){
    assert( db->lookaside.bDisable >= pParse->disableLookaside );







<
<
<
<
<
<
<
<
<





<
<
<
<
<
<




|







130428
130429
130430
130431
130432
130433
130434









130435
130436
130437
130438
130439






130440
130441
130442
130443
130444
130445
130446
130447
130448
130449
130450
130451
      }
    }
    assert( i>=0 && i<db->nDb );
  }
  return i;
}










/*
** Free all memory allocations in the pParse object
*/
SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
  sqlite3 *db = pParse->db;






  while( pParse->pCleanup ){
    ParseCleanup *pCleanup = pParse->pCleanup;
    pParse->pCleanup = pCleanup->pNext;
    pCleanup->xCleanup(db, pCleanup->pPtr);
    sqlite3DbFreeNN(db, pCleanup);
  }
  sqlite3DbFree(db, pParse->aLabel);
  if( pParse->pConstExpr ){
    sqlite3ExprListDelete(db, pParse->pConstExpr);
  }
  if( db ){
    assert( db->lookaside.bDisable >= pParse->disableLookaside );
130891
130892
130893
130894
130895
130896
130897
130898
130899
130900
130901
130902
130903
130904
130905
  return jointype;
}

/*
** Return the index of a column in a table.  Return -1 if the column
** is not contained in the table.
*/
static int columnIndex(Table *pTab, const char *zCol){
  int i;
  u8 h = sqlite3StrIHash(zCol);
  Column *pCol;
  for(pCol=pTab->aCol, i=0; i<pTab->nCol; pCol++, i++){
    if( pCol->hName==h && sqlite3StrICmp(pCol->zName, zCol)==0 ) return i;
  }
  return -1;







|







131142
131143
131144
131145
131146
131147
131148
131149
131150
131151
131152
131153
131154
131155
131156
  return jointype;
}

/*
** Return the index of a column in a table.  Return -1 if the column
** is not contained in the table.
*/
SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol){
  int i;
  u8 h = sqlite3StrIHash(zCol);
  Column *pCol;
  for(pCol=pTab->aCol, i=0; i<pTab->nCol; pCol++, i++){
    if( pCol->hName==h && sqlite3StrICmp(pCol->zName, zCol)==0 ) return i;
  }
  return -1;
130923
130924
130925
130926
130927
130928
130929
130930
130931
130932
130933
130934
130935
130936
130937
  int bIgnoreHidden    /* True to ignore hidden columns */
){
  int i;               /* For looping over tables in pSrc */
  int iCol;            /* Index of column matching zCol */

  assert( (piTab==0)==(piCol==0) );  /* Both or neither are NULL */
  for(i=0; i<N; i++){
    iCol = columnIndex(pSrc->a[i].pTab, zCol);
    if( iCol>=0
     && (bIgnoreHidden==0 || IsHiddenColumn(&pSrc->a[i].pTab->aCol[iCol])==0)
    ){
      if( piTab ){
        *piTab = i;
        *piCol = iCol;
      }







|







131174
131175
131176
131177
131178
131179
131180
131181
131182
131183
131184
131185
131186
131187
131188
  int bIgnoreHidden    /* True to ignore hidden columns */
){
  int i;               /* For looping over tables in pSrc */
  int iCol;            /* Index of column matching zCol */

  assert( (piTab==0)==(piCol==0) );  /* Both or neither are NULL */
  for(i=0; i<N; i++){
    iCol = sqlite3ColumnIndex(pSrc->a[i].pTab, zCol);
    if( iCol>=0
     && (bIgnoreHidden==0 || IsHiddenColumn(&pSrc->a[i].pTab->aCol[iCol])==0)
    ){
      if( piTab ){
        *piTab = i;
        *piCol = iCol;
      }
131133
131134
131135
131136
131137
131138
131139
131140
131141
131142
131143
131144
131145
131146
131147
      for(j=0; j<pList->nId; j++){
        char *zName;     /* Name of the term in the USING clause */
        int iLeft;       /* Table on the left with matching column name */
        int iLeftCol;    /* Column number of matching column on the left */
        int iRightCol;   /* Column number of matching column on the right */

        zName = pList->a[j].zName;
        iRightCol = columnIndex(pRightTab, zName);
        if( iRightCol<0
         || !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol, 0)
        ){
          sqlite3ErrorMsg(pParse, "cannot join using column %s - column "
            "not present in both tables", zName);
          return 1;
        }







|







131384
131385
131386
131387
131388
131389
131390
131391
131392
131393
131394
131395
131396
131397
131398
      for(j=0; j<pList->nId; j++){
        char *zName;     /* Name of the term in the USING clause */
        int iLeft;       /* Table on the left with matching column name */
        int iLeftCol;    /* Column number of matching column on the left */
        int iRightCol;   /* Column number of matching column on the right */

        zName = pList->a[j].zName;
        iRightCol = sqlite3ColumnIndex(pRightTab, zName);
        if( iRightCol<0
         || !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol, 0)
        ){
          sqlite3ErrorMsg(pParse, "cannot join using column %s - column "
            "not present in both tables", zName);
          return 1;
        }
132715
132716
132717
132718
132719
132720
132721

132722
132723
132724
132725
132726
132727
132728
  if( db->mallocFailed ) return;
  memset(&sNC, 0, sizeof(sNC));
  sNC.pSrcList = pSelect->pSrc;
  a = pSelect->pEList->a;
  for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
    const char *zType;
    int n, m;

    p = a[i].pExpr;
    zType = columnType(&sNC, p, 0, 0, 0);
    /* pCol->szEst = ... // Column size est for SELECT tables never used */
    pCol->affinity = sqlite3ExprAffinity(p);
    if( zType ){
      m = sqlite3Strlen30(zType);
      n = sqlite3Strlen30(pCol->zName);







>







132966
132967
132968
132969
132970
132971
132972
132973
132974
132975
132976
132977
132978
132979
132980
  if( db->mallocFailed ) return;
  memset(&sNC, 0, sizeof(sNC));
  sNC.pSrcList = pSelect->pSrc;
  a = pSelect->pEList->a;
  for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
    const char *zType;
    int n, m;
    pTab->tabFlags |= (pCol->colFlags & COLFLAG_NOINSERT);
    p = a[i].pExpr;
    zType = columnType(&sNC, p, 0, 0, 0);
    /* pCol->szEst = ... // Column size est for SELECT tables never used */
    pCol->affinity = sqlite3ExprAffinity(p);
    if( zType ){
      m = sqlite3Strlen30(zType);
      n = sqlite3Strlen30(pCol->zName);
134317
134318
134319
134320
134321
134322
134323

134324
134325
134326
134327
134328
134329
134330
134331

/*
** Expression walker callback used by renumberCursors() to update
** Expr objects to match newly assigned cursor numbers.
*/
static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){
  int *aCsrMap = pWalker->u.aiCol;

  if( pExpr->op==TK_COLUMN && aCsrMap[pExpr->iTable] ){
    pExpr->iTable = aCsrMap[pExpr->iTable];
  }
  if( ExprHasProperty(pExpr, EP_FromJoin) && aCsrMap[pExpr->iRightJoinTable] ){
    pExpr->iRightJoinTable = aCsrMap[pExpr->iRightJoinTable];
  }
  return WRC_Continue;
}







>
|







134569
134570
134571
134572
134573
134574
134575
134576
134577
134578
134579
134580
134581
134582
134583
134584

/*
** Expression walker callback used by renumberCursors() to update
** Expr objects to match newly assigned cursor numbers.
*/
static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){
  int *aCsrMap = pWalker->u.aiCol;
  int op = pExpr->op;
  if( (op==TK_COLUMN || op==TK_IF_NULL_ROW) && aCsrMap[pExpr->iTable] ){
    pExpr->iTable = aCsrMap[pExpr->iTable];
  }
  if( ExprHasProperty(pExpr, EP_FromJoin) && aCsrMap[pExpr->iRightJoinTable] ){
    pExpr->iRightJoinTable = aCsrMap[pExpr->iRightJoinTable];
  }
  return WRC_Continue;
}
135221
135222
135223
135224
135225
135226
135227

135228
135229
135230
135231
135232
135233
135234
    return 0; /* restriction (4) */
  }
  if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){
    return 0; /* restriction (5) */
  }
  if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
    nChng++;

    while( pSubq ){
      SubstContext x;
      pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
      unsetJoinExpr(pNew, -1);
      x.pParse = pParse;
      x.iTable = iCursor;
      x.iNewTable = iCursor;







>







135474
135475
135476
135477
135478
135479
135480
135481
135482
135483
135484
135485
135486
135487
135488
    return 0; /* restriction (4) */
  }
  if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){
    return 0; /* restriction (5) */
  }
  if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
    nChng++;
    pSubq->selFlags |= SF_PushDown;
    while( pSubq ){
      SubstContext x;
      pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
      unsetJoinExpr(pNew, -1);
      x.pParse = pParse;
      x.iTable = iCursor;
      x.iNewTable = iCursor;
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
136424
136425









136426
136427
136428
136429
136430
136431
136432
** then return 0.
*/
static struct SrcList_item *isSelfJoinView(
  SrcList *pTabList,           /* Search for self-joins in this FROM clause */
  struct SrcList_item *pThis   /* Search for prior reference to this subquery */
){
  struct SrcList_item *pItem;


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










#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
/*
** Attempt to transform a query of the form
**
**    SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
**







>
>















|
<
<








>
>
>
>
>
>
>
>
>







136647
136648
136649
136650
136651
136652
136653
136654
136655
136656
136657
136658
136659
136660
136661
136662
136663
136664
136665
136666
136667
136668
136669
136670
136671


136672
136673
136674
136675
136676
136677
136678
136679
136680
136681
136682
136683
136684
136685
136686
136687
136688
136689
136690
136691
136692
136693
136694
136695
** then return 0.
*/
static struct SrcList_item *isSelfJoinView(
  SrcList *pTabList,           /* Search for self-joins in this FROM clause */
  struct SrcList_item *pThis   /* Search for prior reference to this subquery */
){
  struct SrcList_item *pItem;
  assert( pThis->pSelect!=0 );
  if( pThis->pSelect->selFlags & SF_PushDown ) return 0;
  for(pItem = pTabList->a; pItem<pThis; pItem++){
    Select *pS1;
    if( pItem->pSelect==0 ) continue;
    if( pItem->fg.viaCoroutine ) continue;
    if( pItem->zName==0 ) continue;
    assert( pItem->pTab!=0 );
    assert( pThis->pTab!=0 );
    if( pItem->pTab->pSchema!=pThis->pTab->pSchema ) continue;
    if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue;
    pS1 = pItem->pSelect;
    if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){
      /* The query flattener left two different CTE tables with identical
      ** names in the same FROM clause. */
      continue;
    }
    if( pItem->pSelect->selFlags & SF_PushDown ){


      /* The view was modified by some other optimization such as
      ** pushDownWhereTerms() */
      continue;
    }
    return pItem;
  }
  return 0;
}

/*
** Deallocate a single AggInfo object
*/
static void agginfoFree(sqlite3 *db, AggInfo *p){
  sqlite3DbFree(db, p->aCol);
  sqlite3DbFree(db, p->aFunc);
  sqlite3DbFreeNN(db, p);
}

#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
/*
** Attempt to transform a query of the form
**
**    SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
**
136831
136832
136833
136834
136835
136836
136837

136838
136839
136840
136841
136842
136843
136844
#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"));
    }

    zSavedAuthContext = pParse->zAuthContext;
    pParse->zAuthContext = pItem->zName;








>







137094
137095
137096
137097
137098
137099
137100
137101
137102
137103
137104
137105
137106
137107
137108
#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
      assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
    }else{
      SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));
    }

    zSavedAuthContext = pParse->zAuthContext;
    pParse->zAuthContext = pItem->zName;

137053
137054
137055
137056
137057
137058
137059

137060
137061
137062
137063
137064
137065
137066
    if( sSort.pOrderBy ){
      sSort.nOBSat = sqlite3WhereIsOrdered(pWInfo);
      sSort.labelOBLopt = sqlite3WhereOrderByLimitOptLabel(pWInfo);
      if( sSort.nOBSat==sSort.pOrderBy->nExpr ){
        sSort.pOrderBy = 0;
      }
    }


    /* If sorting index that was created by a prior OP_OpenEphemeral
    ** instruction ended up not being needed, then change the OP_OpenEphemeral
    ** into an OP_Noop.
    */
    if( sSort.addrSortIndex>=0 && sSort.pOrderBy==0 ){
      sqlite3VdbeChangeToNoop(v, sSort.addrSortIndex);







>







137317
137318
137319
137320
137321
137322
137323
137324
137325
137326
137327
137328
137329
137330
137331
    if( sSort.pOrderBy ){
      sSort.nOBSat = sqlite3WhereIsOrdered(pWInfo);
      sSort.labelOBLopt = sqlite3WhereOrderByLimitOptLabel(pWInfo);
      if( sSort.nOBSat==sSort.pOrderBy->nExpr ){
        sSort.pOrderBy = 0;
      }
    }
    SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));

    /* If sorting index that was created by a prior OP_OpenEphemeral
    ** instruction ended up not being needed, then change the OP_OpenEphemeral
    ** into an OP_Noop.
    */
    if( sSort.addrSortIndex>=0 && sSort.pOrderBy==0 ){
      sqlite3VdbeChangeToNoop(v, sSort.addrSortIndex);
137091
137092
137093
137094
137095
137096
137097

137098
137099
137100
137101
137102
137103
137104
      /* Use the standard inner loop. */
      selectInnerLoop(pParse, p, -1, &sSort, &sDistinct, pDest,
          sqlite3WhereContinueLabel(pWInfo),
          sqlite3WhereBreakLabel(pWInfo));

      /* End the database scan loop.
      */

      sqlite3WhereEnd(pWInfo);
    }
  }else{
    /* This case when there exist aggregate functions or a GROUP BY clause
    ** or both */
    NameContext sNC;    /* Name context for processing aggregate information */
    int iAMem;          /* First Mem address for storing current GROUP BY */







>







137356
137357
137358
137359
137360
137361
137362
137363
137364
137365
137366
137367
137368
137369
137370
      /* Use the standard inner loop. */
      selectInnerLoop(pParse, p, -1, &sSort, &sDistinct, pDest,
          sqlite3WhereContinueLabel(pWInfo),
          sqlite3WhereBreakLabel(pWInfo));

      /* End the database scan loop.
      */
      SELECTTRACE(1,pParse,p,("WhereEnd\n"));
      sqlite3WhereEnd(pWInfo);
    }
  }else{
    /* This case when there exist aggregate functions or a GROUP BY clause
    ** or both */
    NameContext sNC;    /* Name context for processing aggregate information */
    int iAMem;          /* First Mem address for storing current GROUP BY */
137161
137162
137163
137164
137165
137166
137167
137168




137169
137170
137171
137172
137173
137174
137175
137176
137177
137178
137179
    addrEnd = sqlite3VdbeMakeLabel(pParse);

    /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in
    ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the
    ** SELECT statement.
    */
    pAggInfo = sqlite3DbMallocZero(db, sizeof(*pAggInfo) );
    if( pAggInfo==0 ){




      goto select_end;
    }
    pAggInfo->pNext = pParse->pAggList;
    pParse->pAggList = pAggInfo;
    pAggInfo->selId = p->selId;
    memset(&sNC, 0, sizeof(sNC));
    sNC.pParse = pParse;
    sNC.pSrcList = pTabList;
    sNC.uNC.pAggInfo = pAggInfo;
    VVA_ONLY( sNC.ncFlags = NC_UAggInfo; )
    pAggInfo->mnReg = pParse->nMem+1;







|
>
>
>
>


<
<







137427
137428
137429
137430
137431
137432
137433
137434
137435
137436
137437
137438
137439
137440


137441
137442
137443
137444
137445
137446
137447
    addrEnd = sqlite3VdbeMakeLabel(pParse);

    /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in
    ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the
    ** SELECT statement.
    */
    pAggInfo = sqlite3DbMallocZero(db, sizeof(*pAggInfo) );
    if( pAggInfo ){
      sqlite3ParserAddCleanup(pParse,
          (void(*)(sqlite3*,void*))agginfoFree, pAggInfo);
    }
    if( db->mallocFailed ){
      goto select_end;
    }


    pAggInfo->selId = p->selId;
    memset(&sNC, 0, sizeof(sNC));
    sNC.pParse = pParse;
    sNC.pSrcList = pTabList;
    sNC.uNC.pAggInfo = pAggInfo;
    VVA_ONLY( sNC.ncFlags = NC_UAggInfo; )
    pAggInfo->mnReg = pParse->nMem+1;
137284
137285
137286
137287
137288
137289
137290

137291
137292
137293
137294
137295
137296
137297
      */
      sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset);
      SELECTTRACE(1,pParse,p,("WhereBegin\n"));
      pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, 0,
          WHERE_GROUPBY | (orderByGrp ? WHERE_SORTBYGROUP : 0), 0
      );
      if( pWInfo==0 ) goto select_end;

      if( sqlite3WhereIsOrdered(pWInfo)==pGroupBy->nExpr ){
        /* The optimizer is able to deliver rows in group by order so
        ** we do not have to sort.  The OP_OpenEphemeral table will be
        ** cancelled later because we still need to use the pKeyInfo
        */
        groupBySort = 0;
      }else{







>







137552
137553
137554
137555
137556
137557
137558
137559
137560
137561
137562
137563
137564
137565
137566
      */
      sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset);
      SELECTTRACE(1,pParse,p,("WhereBegin\n"));
      pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, 0,
          WHERE_GROUPBY | (orderByGrp ? WHERE_SORTBYGROUP : 0), 0
      );
      if( pWInfo==0 ) goto select_end;
      SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));
      if( sqlite3WhereIsOrdered(pWInfo)==pGroupBy->nExpr ){
        /* The optimizer is able to deliver rows in group by order so
        ** we do not have to sort.  The OP_OpenEphemeral table will be
        ** cancelled later because we still need to use the pKeyInfo
        */
        groupBySort = 0;
      }else{
137332
137333
137334
137335
137336
137337
137338

137339
137340
137341
137342
137343
137344
137345
          }
        }
        regRecord = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord);
        sqlite3VdbeAddOp2(v, OP_SorterInsert, pAggInfo->sortingIdx, regRecord);
        sqlite3ReleaseTempReg(pParse, regRecord);
        sqlite3ReleaseTempRange(pParse, regBase, nCol);

        sqlite3WhereEnd(pWInfo);
        pAggInfo->sortingIdxPTab = sortPTab = pParse->nTab++;
        sortOut = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol);
        sqlite3VdbeAddOp2(v, OP_SorterSort, pAggInfo->sortingIdx, addrEnd);
        VdbeComment((v, "GROUP BY sort")); VdbeCoverage(v);
        pAggInfo->useSortingIdx = 1;







>







137601
137602
137603
137604
137605
137606
137607
137608
137609
137610
137611
137612
137613
137614
137615
          }
        }
        regRecord = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord);
        sqlite3VdbeAddOp2(v, OP_SorterInsert, pAggInfo->sortingIdx, regRecord);
        sqlite3ReleaseTempReg(pParse, regRecord);
        sqlite3ReleaseTempRange(pParse, regBase, nCol);
        SELECTTRACE(1,pParse,p,("WhereEnd\n"));
        sqlite3WhereEnd(pWInfo);
        pAggInfo->sortingIdxPTab = sortPTab = pParse->nTab++;
        sortOut = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol);
        sqlite3VdbeAddOp2(v, OP_SorterSort, pAggInfo->sortingIdx, addrEnd);
        VdbeComment((v, "GROUP BY sort")); VdbeCoverage(v);
        pAggInfo->useSortingIdx = 1;
137409
137410
137411
137412
137413
137414
137415

137416
137417
137418
137419
137420
137421
137422

      /* End of the loop
      */
      if( groupBySort ){
        sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx,addrTopOfLoop);
        VdbeCoverage(v);
      }else{

        sqlite3WhereEnd(pWInfo);
        sqlite3VdbeChangeToNoop(v, addrSortingIdx);
      }

      /* Output the final row of result
      */
      sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow);







>







137679
137680
137681
137682
137683
137684
137685
137686
137687
137688
137689
137690
137691
137692
137693

      /* End of the loop
      */
      if( groupBySort ){
        sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx,addrTopOfLoop);
        VdbeCoverage(v);
      }else{
        SELECTTRACE(1,pParse,p,("WhereEnd\n"));
        sqlite3WhereEnd(pWInfo);
        sqlite3VdbeChangeToNoop(v, addrSortingIdx);
      }

      /* Output the final row of result
      */
      sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow);
137564
137565
137566
137567
137568
137569
137570

137571
137572
137573
137574
137575

137576
137577
137578
137579
137580
137581
137582

        SELECTTRACE(1,pParse,p,("WhereBegin\n"));
        pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy,
                                   0, minMaxFlag, 0);
        if( pWInfo==0 ){
          goto select_end;
        }

        updateAccumulator(pParse, regAcc, pAggInfo);
        if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc);
        if( minMaxFlag ){
          sqlite3WhereMinMaxOptEarlyOut(v, pWInfo);
        }

        sqlite3WhereEnd(pWInfo);
        finalizeAggFunctions(pParse, pAggInfo);
      }

      sSort.pOrderBy = 0;
      sqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL);
      selectInnerLoop(pParse, p, -1, 0, 0,







>





>







137835
137836
137837
137838
137839
137840
137841
137842
137843
137844
137845
137846
137847
137848
137849
137850
137851
137852
137853
137854
137855

        SELECTTRACE(1,pParse,p,("WhereBegin\n"));
        pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy,
                                   0, minMaxFlag, 0);
        if( pWInfo==0 ){
          goto select_end;
        }
        SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));
        updateAccumulator(pParse, regAcc, pAggInfo);
        if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc);
        if( minMaxFlag ){
          sqlite3WhereMinMaxOptEarlyOut(v, pWInfo);
        }
        SELECTTRACE(1,pParse,p,("WhereEnd\n"));
        sqlite3WhereEnd(pWInfo);
        finalizeAggFunctions(pParse, pAggInfo);
      }

      sSort.pOrderBy = 0;
      sqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL);
      selectInnerLoop(pParse, p, -1, 0, 0,
138197
138198
138199
138200
138201
138202
138203
138204
138205
138206
138207
138208
138209
138210
138211
       "INSERT INTO %Q." DFLT_SCHEMA_TABLE
       " VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')",
       db->aDb[iDb].zDbSName, zName,
       pTrig->table, z);
    sqlite3DbFree(db, z);
    sqlite3ChangeCookie(pParse, iDb);
    sqlite3VdbeAddParseSchemaOp(v, iDb,
        sqlite3MPrintf(db, "type='trigger' AND name='%q'", zName));
  }

  if( db->init.busy ){
    Trigger *pLink = pTrig;
    Hash *pHash = &db->aDb[iDb].pSchema->trigHash;
    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
    assert( pLink!=0 );







|







138470
138471
138472
138473
138474
138475
138476
138477
138478
138479
138480
138481
138482
138483
138484
       "INSERT INTO %Q." DFLT_SCHEMA_TABLE
       " VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')",
       db->aDb[iDb].zDbSName, zName,
       pTrig->table, z);
    sqlite3DbFree(db, z);
    sqlite3ChangeCookie(pParse, iDb);
    sqlite3VdbeAddParseSchemaOp(v, iDb,
        sqlite3MPrintf(db, "type='trigger' AND name='%q'", zName), 0);
  }

  if( db->init.busy ){
    Trigger *pLink = pTrig;
    Hash *pHash = &db->aDb[iDb].pSchema->trigHash;
    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
    assert( pLink!=0 );
141762
141763
141764
141765
141766
141767
141768
141769
141770
141771
141772
141773
141774
141775
141776
      pParse->regRowid
    );
    v = sqlite3GetVdbe(pParse);
    sqlite3ChangeCookie(pParse, iDb);

    sqlite3VdbeAddOp0(v, OP_Expire);
    zWhere = sqlite3MPrintf(db, "name=%Q AND sql=%Q", pTab->zName, zStmt);
    sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere);
    sqlite3DbFree(db, zStmt);

    iReg = ++pParse->nMem;
    sqlite3VdbeLoadString(v, iReg, pTab->zName);
    sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg);
  }








|







142035
142036
142037
142038
142039
142040
142041
142042
142043
142044
142045
142046
142047
142048
142049
      pParse->regRowid
    );
    v = sqlite3GetVdbe(pParse);
    sqlite3ChangeCookie(pParse, iDb);

    sqlite3VdbeAddOp0(v, OP_Expire);
    zWhere = sqlite3MPrintf(db, "name=%Q AND sql=%Q", pTab->zName, zStmt);
    sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere, 0);
    sqlite3DbFree(db, zStmt);

    iReg = ++pParse->nMem;
    sqlite3VdbeLoadString(v, iReg, pTab->zName);
    sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg);
  }

141933
141934
141935
141936
141937
141938
141939

141940
141941
141942
141943
141944
141945
141946
            zType[j] = zType[j+nDel];
          }
          if( zType[i]=='\0' && i>0 ){
            assert(zType[i-1]==' ');
            zType[i-1] = '\0';
          }
          pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN;

          oooHidden = TF_OOOHidden;
        }else{
          pTab->tabFlags |= oooHidden;
        }
      }
    }
  }







>







142206
142207
142208
142209
142210
142211
142212
142213
142214
142215
142216
142217
142218
142219
142220
            zType[j] = zType[j+nDel];
          }
          if( zType[i]=='\0' && i>0 ){
            assert(zType[i-1]==' ');
            zType[i-1] = '\0';
          }
          pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN;
          pTab->tabFlags |= TF_HasHidden;
          oooHidden = TF_OOOHidden;
        }else{
          pTab->tabFlags |= oooHidden;
        }
      }
    }
  }
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
#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             571
#define YYNRULE              393
#define YYNRULE_WITH_ACTION  332
#define YYNTOKEN             182
#define YY_MAX_SHIFT         570
#define YY_MIN_SHIFTREDUCE   822
#define YY_MAX_SHIFTREDUCE   1214
#define YY_ERROR_ACTION      1215
#define YY_ACCEPT_ACTION     1216
#define YY_NO_ACTION         1217
#define YY_MIN_REDUCE        1218
#define YY_MAX_REDUCE        1610
/************* 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







|
|
|

|
|
|
|
|
|
|
|







157026
157027
157028
157029
157030
157031
157032
157033
157034
157035
157036
157037
157038
157039
157040
157041
157042
157043
157044
157045
157046
157047
157048
157049
157050
157051
#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             573
#define YYNRULE              394
#define YYNRULE_WITH_ACTION  333
#define YYNTOKEN             182
#define YY_MAX_SHIFT         572
#define YY_MIN_SHIFTREDUCE   825
#define YY_MAX_SHIFTREDUCE   1218
#define YY_ERROR_ACTION      1219
#define YY_ACCEPT_ACTION     1220
#define YY_NO_ACTION         1221
#define YY_MIN_REDUCE        1222
#define YY_MAX_REDUCE        1615
/************* 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
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
156979
156980
156981
156982
156983
156984
156985
156986
156987
156988
156989
156990
156991
156992
156993
156994
156995
156996
156997
156998
156999
157000
157001
157002
157003
157004
157005
157006
157007
157008
157009
157010
157011
157012
157013
157014
157015
157016
157017
157018
157019
157020
157021
157022
157023
157024
157025
157026
157027
157028
157029
157030
157031
157032
157033
157034
157035
157036
157037
157038
157039
157040
157041
157042
157043
157044
157045
157046
157047
**  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 (2017)
static const YYACTIONTYPE yy_action[] = {
 /*     0 */   564, 1249,  564,  197, 1571,  564, 1252,  564,  116,  113,
 /*    10 */   218,  564, 1259,  564,  486,  393,  116,  113,  218,  405,
 /*    20 */   357,  357,   42,   42,   42,   42,  469,   42,   42,   72,
 /*    30 */    72,  956, 1251,   72,   72,   72,   72, 1496, 1576,  957,
 /*    40 */     9,  886,  251,  123,  124,  114, 1192, 1192, 1032, 1035,
 /*    50 */  1025, 1025,  121,  121,  122,  122,  122,  122,  445,  405,
 /*    60 */   471, 1551,  570,    2, 1220, 1577,  546,  145,  147,  305,
 /*    70 */   546,  138,  546, 1292, 1292,  522,  564, 1189, 1300,  545,
 /*    80 */   521,  511,  167,  123,  124,  114, 1192, 1192, 1032, 1035,
 /*    90 */  1025, 1025,  121,  121,  122,  122,  122,  122,   72,   72,
 /*   100 */   281,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*   110 */   117,  438,  273,  273,  273,  273,  443, 1168, 1532,  371,
 /*   120 */  1534, 1168,  370, 1532,  535,  561, 1140,  561, 1140,  405,
 /*   130 */  1075,  248,  215, 1189,  174,  527,  100,  304,  555,  228,
 /*   140 */   438,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*   150 */   117,  438,  448,  123,  124,  114, 1192, 1192, 1032, 1035,
 /*   160 */  1025, 1025,  121,  121,  122,  122,  122,  122,  541,  448,
 /*   170 */   447,  442, 1168, 1169, 1170,  395, 1168, 1169, 1170,  125,
 /*   180 */   120,  120,  120,  120,  119,  119,  118,  118,  118,  117,
 /*   190 */   438,  119,  119,  118,  118,  118,  117,  438,  268,  405,
 /*   200 */  1548,  122,  122,  122,  122,  115,  379,   84,  375,  273,
 /*   210 */   273,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*   220 */   117,  438,  561,  123,  124,  114, 1192, 1192, 1032, 1035,
 /*   230 */  1025, 1025,  121,  121,  122,  122,  122,  122,  405,  467,
 /*   240 */  1118, 1604,  448,   82, 1604,  460,  329,   81,  120,  120,
 /*   250 */   120,  120,  119,  119,  118,  118,  118,  117,  438,  116,
 /*   260 */   113,  218,  123,  124,  114, 1192, 1192, 1032, 1035, 1025,
 /*   270 */  1025,  121,  121,  122,  122,  122,  122,  564,  542, 1519,
 /*   280 */   877,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*   290 */   117,  438,  118,  118,  118,  117,  438,   12,  197,   71,
 /*   300 */    71, 1135,  122,  122,  122,  122,  384,  405,  428, 1168,
 /*   310 */   398,  503,  531,  347, 1135,  166,  312, 1135, 1116,  878,
 /*   320 */   120,  120,  120,  120,  119,  119,  118,  118,  118,  117,
 /*   330 */   438,  123,  124,  114, 1192, 1192, 1032, 1035, 1025, 1025,
 /*   340 */   121,  121,  122,  122,  122,  122, 1168,  267,  267,  120,
 /*   350 */   120,  120,  120,  119,  119,  118,  118,  118,  117,  438,
 /*   360 */   561,  378, 1012, 1135, 1168, 1169, 1170,  240,  530,  563,
 /*   370 */   499,  496,  495,  426,  538,  476, 1135, 1527, 1003, 1135,
 /*   380 */   494,    6, 1002, 1392,  502, 1022, 1022, 1033, 1036,  120,
 /*   390 */   120,  120,  120,  119,  119,  118,  118,  118,  117,  438,
 /*   400 */   425, 1168, 1169, 1170, 1096, 1460,  259,  276,  355,  505,
 /*   410 */   350,  504,  245,  405, 1002, 1002, 1004,  343,  346, 1097,
 /*   420 */   240,  460,  329,  499,  496,  495,  369,  510, 1526,  357,
 /*   430 */   529,  358,    6,  494, 1098,  450,  203,  123,  124,  114,
 /*   440 */  1192, 1192, 1032, 1035, 1025, 1025,  121,  121,  122,  122,
 /*   450 */   122,  122,  520,  419, 1168,  897,  405,  569, 1026, 1220,
 /*   460 */   500,  319, 1270,  992,  305,  898,  138,  188, 1287,  423,
 /*   470 */  1266,  167,  486, 1300,   16,   16,  144,  857, 1287, 1269,
 /*   480 */   123,  124,  114, 1192, 1192, 1032, 1035, 1025, 1025,  121,
 /*   490 */   121,  122,  122,  122,  122,  120,  120,  120,  120,  119,
 /*   500 */   119,  118,  118,  118,  117,  438,  526,  273,  273, 1168,
 /*   510 */  1169, 1170, 1392,  564,  166,  327, 1495, 1012,  414,  372,
 /*   520 */   561,  486,  316, 1168,  318,  405,  304,  555,  373,  861,
 /*   530 */   182,  216,  857, 1003,  228,   72,   72, 1002,  120,  120,
 /*   540 */   120,  120,  119,  119,  118,  118,  118,  117,  438,  123,
 /*   550 */   124,  114, 1192, 1192, 1032, 1035, 1025, 1025,  121,  121,
 /*   560 */   122,  122,  122,  122,  405, 1459,  442, 1168,  854, 1002,
 /*   570 */  1002, 1004,  300, 1524,  116,  113,  218,    6, 1168, 1169,
 /*   580 */  1170,  183,  420,  116,  113,  218, 1168,  314,  123,  124,
 /*   590 */   114, 1192, 1192, 1032, 1035, 1025, 1025,  121,  121,  122,
 /*   600 */   122,  122,  122, 1465,  317,  943,  469,  120,  120,  120,
 /*   610 */   120,  119,  119,  118,  118,  118,  117,  438, 1168,  211,
 /*   620 */  1465, 1467, 1168, 1169, 1170,  917,  539, 1526,  475, 1168,
 /*   630 */   916,    6, 1168,  405,  922,  435,  434, 1153,  213,  509,
 /*   640 */    32, 1168, 1169, 1170,  279,    5,  120,  120,  120,  120,
 /*   650 */   119,  119,  118,  118,  118,  117,  438,  123,  124,  114,
 /*   660 */  1192, 1192, 1032, 1035, 1025, 1025,  121,  121,  122,  122,
 /*   670 */   122,  122,  405, 1168, 1169, 1170, 1013, 1168,  273,  273,
 /*   680 */   286, 1199, 1168, 1199, 1168, 1169, 1170, 1168, 1169, 1170,
 /*   690 */   564,  561,  167, 1465,  117,  438,  123,  124,  114, 1192,
 /*   700 */  1192, 1032, 1035, 1025, 1025,  121,  121,  122,  122,  122,
 /*   710 */   122,  942,   13,   13,  127,  120,  120,  120,  120,  119,
 /*   720 */   119,  118,  118,  118,  117,  438,  285,  417,  564,  449,
 /*   730 */   564, 1392, 1168, 1169, 1170, 1290, 1290, 1168, 1169, 1170,
 /*   740 */    97,  405,  992, 1606,  391,  997,  486,  304,  555,   17,
 /*   750 */    72,   72,   72,   72,  120,  120,  120,  120,  119,  119,
 /*   760 */   118,  118,  118,  117,  438,  123,  124,  114, 1192, 1192,
 /*   770 */  1032, 1035, 1025, 1025,  121,  121,  122,  122,  122,  122,
 /*   780 */   405, 1216,    1,    1,  570,    2, 1220,  301,  415,  433,
 /*   790 */  1299,  305,  839,  138,  327,  455,  315,  402,  401,  564,
 /*   800 */  1300,  421,    3,  290,  123,  124,  114, 1192, 1192, 1032,
 /*   810 */  1035, 1025, 1025,  121,  121,  122,  122,  122,  122,  377,
 /*   820 */   564,   13,   13,  120,  120,  120,  120,  119,  119,  118,
 /*   830 */   118,  118,  117,  438,  273,  273,  422,  273,  273, 1168,
 /*   840 */  1304,  357,   13,   13, 1118, 1605,   12,  561, 1605,  405,
 /*   850 */   561,  458,  561, 1168,  558,  558,  558,  424,  436,  436,
 /*   860 */   436,  228,  120,  120,  120,  120,  119,  119,  118,  118,
 /*   870 */   118,  117,  438,  123,  124,  114, 1192, 1192, 1032, 1035,
 /*   880 */  1025, 1025,  121,  121,  122,  122,  122,  122,  146,  197,
 /*   890 */   414,  564, 1055,  442, 1168, 1169, 1170,  414,  469,  435,
 /*   900 */   434,  404,  562,  247,  911,  911,  564, 1196, 1168, 1169,
 /*   910 */  1170,  486, 1198,   72,   72,  491, 1507,  547,  102,  194,
 /*   920 */  1197,  564, 1116,  294,  459,  294, 1298,  251,   72,   72,
 /*   930 */  1452,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*   940 */   117,  438,  244,   56,   56, 1199,  564, 1199,  564, 1238,
 /*   950 */   437,  273,  273,  564,  514, 1295,  564,  512,  564,  282,
 /*   960 */   273,  273, 1189,  517,  561,  546,  284,  341,   52,   52,
 /*   970 */    13,   13,  289,  561,  548,   13,   13,  564,   13,   13,
 /*   980 */    13,   13,  549,  273,  273,  293, 1407,  105,  273,  273,
 /*   990 */   191,  273,  273,  192,  444,  543,  561,  273,  273,   57,
 /*  1000 */    57,  561,  274,  274,  561,  513, 1504,  405,  270,  410,
 /*  1010 */   561,  941,  198,  304,  555,  561,  273,  273, 1189,  106,
 /*  1020 */   409,  104,  356, 1545,  307,  346,  564,  405,  336,  561,
 /*  1030 */   339,  123,  124,  114, 1192, 1192, 1032, 1035, 1025, 1025,
 /*  1040 */   121,  121,  122,  122,  122,  122,  469,  405,   15,   15,
 /*  1050 */   475,  123,  124,  114, 1192, 1192, 1032, 1035, 1025, 1025,
 /*  1060 */   121,  121,  122,  122,  122,  122, 1080, 1080,  483,  358,
 /*  1070 */   475,  123,  112,  114, 1192, 1192, 1032, 1035, 1025, 1025,
 /*  1080 */   121,  121,  122,  122,  122,  122,  390, 1212,  308,  120,
 /*  1090 */   120,  120,  120,  119,  119,  118,  118,  118,  117,  438,
 /*  1100 */    99,  217,  480, 1172, 1406,  564,  477,  430,  541,  120,
 /*  1110 */   120,  120,  120,  119,  119,  118,  118,  118,  117,  438,
 /*  1120 */   291, 1077,  564, 1392,  564, 1077,  941,   44,   44,  120,
 /*  1130 */   120,  120,  120,  119,  119,  118,  118,  118,  117,  438,
 /*  1140 */   356, 1545,  537, 1096,   58,   58,   45,   45,  326,  405,
 /*  1150 */  1135,  827,  828,  829,  243,  242,  241,  481, 1097, 1172,
 /*  1160 */  1392,  536,  311, 1135, 1213,  486, 1135,  564,  292,  405,
 /*  1170 */  1146, 1241,  411, 1098,  124,  114, 1192, 1192, 1032, 1035,
 /*  1180 */  1025, 1025,  121,  121,  122,  122,  122,  122,  564,   59,
 /*  1190 */    59,  564,  507,  482,  552,  114, 1192, 1192, 1032, 1035,
 /*  1200 */  1025, 1025,  121,  121,  122,  122,  122,  122, 1525,  334,
 /*  1210 */    60,   60,    6,   61,   61,  390, 1117, 1523,  917, 1520,
 /*  1220 */  1146,    6,  564,  916,  564,  109,  556,  564,    4,  941,
 /*  1230 */   431,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*  1240 */   117,  438,  559,  864,   62,   62,   63,   63,  564,   46,
 /*  1250 */    46,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*  1260 */   117,  438,  564, 1135, 1522,  439, 1323,  564,    6,  564,
 /*  1270 */    47,   47,  564,  557,  411, 1268, 1135,  553,  142, 1135,
 /*  1280 */   564,  465,  304,  555,   48,   48,  564,  167,  544,   50,
 /*  1290 */    50,   51,   51, 1213,   64,   64,  956,  109,  556,  864,
 /*  1300 */     4,  564,   65,   65,  957, 1012,  564,  140,   66,   66,
 /*  1310 */   564,  107,  107,  564,  559,  849,  205,  564,  108,  217,
 /*  1320 */   439,  566,  565,   14,   14, 1002,    8,  523,   67,   67,
 /*  1330 */   564,  452,  129,  129,  221,   68,   68,  439,  453,   53,
 /*  1340 */    53,  403,  304,  555,  941,  412,  168,  211,  403,  553,
 /*  1350 */   111, 1188,   69,   69,   99,  462,  244, 1002, 1002, 1004,
 /*  1360 */  1005,   27,  466,  533,  564,  403,  564, 1336,  532,  272,
 /*  1370 */   215,  849,  403,  564,   85,  202,  564, 1012,  564, 1207,
 /*  1380 */   564,  303,  564,  107,  107,  564,   70,   70,   54,   54,
 /*  1390 */   108,  403,  439,  566,  565,  153,  153, 1002,  154,  154,
 /*  1400 */    77,   77,   55,   55,   73,   73, 1113,  130,  130,  392,
 /*  1410 */   109,  556,  143,    4,   38,  564,  473,  299,  564,  461,
 /*  1420 */   225, 1335,  524,  410,   30,  876,  875,  559,  454, 1002,
 /*  1430 */  1002, 1004, 1005,   27, 1550, 1157,  441,   74,   74,  277,
 /*  1440 */   131,  131,  324, 1510,  388,  388,  387,  262,  385,  564,
 /*  1450 */   439,  836,  868,  320,  463,   31,  564,  883,  884,  354,
 /*  1460 */   325,  206,  553,   99,  222,  206,  310,  544, 1539,  353,
 /*  1470 */   994,  132,  132,  250,  309, 1484,  533,  287,  128,  128,
 /*  1480 */  1062,  534,  109,  556,  468,    4,  564,  250, 1483,  470,
 /*  1490 */  1012,  564,  250,  275,  564,  330,  107,  107,   99,  559,
 /*  1500 */  1074,  564, 1074,  108,  224,  439,  566,  565,  152,  152,
 /*  1510 */  1002,  474,  158,  151,  151,  160,  136,  136,  492,  959,
 /*  1520 */   960,  246,  439,  135,  135,  344,  478,  564,   99, 1058,
 /*  1530 */   487,  223,  246,  564,  553,  227, 1062,  950,  914, 1006,
 /*  1540 */   250,  111, 1002, 1002, 1004, 1005,   27,  331,  533,  133,
 /*  1550 */   133,  564, 1073,  532, 1073,  134,  134,  847,  915, 1332,
 /*  1560 */   141,  111, 1012,  335,  338,  406,  340,  342,  107,  107,
 /*  1570 */   304,  555, 1283,   76,   76,  108,  564,  439,  566,  565,
 /*  1580 */  1157,  441, 1002,  564,  277,  109,  556,  551,    4,  388,
 /*  1590 */   388,  387,  262,  385,  446, 1006,  836, 1267,   78,   78,
 /*  1600 */   349,  564,  559,  359,  564,   75,   75,  360, 1330,  222,
 /*  1610 */  1564,  310, 1344, 1391, 1002, 1002, 1004, 1005,   27,  309,
 /*  1620 */  1319,  550, 1397,   43,   43,  439,   49,   49, 1248, 1240,
 /*  1630 */  1229, 1228, 1230, 1558,  265, 1316,  200,  553,  362,  364,
 /*  1640 */   366,  389,   11,  208, 1373,  220, 1378,  280, 1366,  224,
 /*  1650 */   451,  322,  472,  328,  283, 1561, 1266,  158,  323, 1383,
 /*  1660 */   160, 1382,  288,  368,  497, 1012,  352,  396,  382,  212,
 /*  1670 */  1456,  107,  107,  921, 1455, 1207,  223,  254,  108, 1503,
 /*  1680 */   439,  566,  565, 1501, 1204, 1002,  413,  204,  207,   84,
 /*  1690 */   195,  109,  556, 1379,    4,  554,  180,  196,  170,   80,
 /*  1700 */   164,  456,  175, 1461,  172,   83,  176,  457,  559,  177,
 /*  1710 */   406,  178,   35,  490,  230,  304,  555, 1002, 1002, 1004,
 /*  1720 */  1005,   27,   97,  394, 1385, 1384,  464, 1387,  184,  397,
 /*  1730 */    36,  439, 1450,  479,   90,  485,  189,  234,  236,  446,
 /*  1740 */  1472,  266,  488,  553,  337,  333,  237,  399, 1231,  238,
 /*  1750 */   506, 1286,  427,   92, 1277,  868, 1276, 1285,  213,  101,
 /*  1760 */   556,  429,    4, 1284, 1255, 1575, 1574,  525, 1256,  400,
 /*  1770 */   351, 1012, 1254, 1573, 1544,   96,  559,  107,  107,  516,
 /*  1780 */   519,  297,  298, 1327,  108,  361,  439,  566,  565, 1328,
 /*  1790 */   252, 1002,  253,  432, 1530,  126, 1529,  544,   10,  439,
 /*  1800 */  1436,  376,  528,  103,   98,  260, 1237,   34,  567, 1163,
 /*  1810 */   374,  553, 1326,  363,  199, 1309,  365, 1308, 1325,  380,
 /*  1820 */   367,  261,  381, 1002, 1002, 1004, 1005,   27, 1351, 1350,
 /*  1830 */   263,  264,  568, 1226, 1221,  155, 1488, 1489, 1487, 1012,
 /*  1840 */   139,  156, 1486,   79,  295,  107,  107,  302,  823,  440,
 /*  1850 */   209,  210,  108,  201,  439,  566,  565,  306,  157, 1002,
 /*  1860 */   219,  277,  278,  137, 1072, 1070,  388,  388,  387,  262,
 /*  1870 */   385,  313,  407,  836,  171,  159,  408,  169, 1188,  226,
 /*  1880 */   900,  173,  321, 1086,  229,  179,  222,  161,  310,  162,
 /*  1890 */   416, 1002, 1002, 1004, 1005,   27,  309,  181,  418,  163,
 /*  1900 */  1089,   86,   87,   88,   89,  231,  232, 1085,  148,   18,
 /*  1910 */   233,  332,  250, 1201,  484,  186,  235,   37,  838,  489,
 /*  1920 */   353, 1078,  185,  239,  187,  493,  224,   91,  866,   19,
 /*  1930 */   498,  345,   20,  348,  158,  501,   93,  160,  165,  879,
 /*  1940 */   149,  296,   94,  508,   95, 1151,  150, 1038, 1121,   39,
 /*  1950 */   515, 1122,   40,  223,  214,  518,  269,  271,  190,  944,
 /*  1960 */  1137,  111, 1139,  249, 1141, 1145,   21, 1125, 1144,   33,
 /*  1970 */   540,  949,   22,   23,   24,   25,  193,   99, 1053,   26,
 /*  1980 */  1039,    7, 1037, 1041, 1095, 1042, 1094,  406,  255,  256,
 /*  1990 */    28,   41,  304,  555, 1007,  848,  560,  110,   29,  386,
 /*  2000 */   910,  257,  383,  258, 1566, 1159, 1158, 1565, 1217, 1217,
 /*  2010 */  1217, 1217, 1217, 1217, 1217, 1217,  446,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */   190,  212,  190,  190,  211,  190,  212,  190,  270,  271,
 /*    10 */   272,  190,  219,  190,  190,  202,  270,  271,  272,   19,
 /*    20 */   190,  190,  212,  213,  212,  213,  190,  212,  213,  212,
 /*    30 */   213,   31,  212,  212,  213,  212,  213,  291,   23,   39,
 /*    40 */    22,   26,   24,   43,   44,   45,   46,   47,   48,   49,







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

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

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

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

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

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







157106
157107
157108
157109
157110
157111
157112
157113
157114
157115
157116
157117
157118
157119
157120
157121
157122
157123
157124
157125
157126
157127
157128
157129
157130
157131
157132
157133
157134
157135
157136
157137
157138
157139
157140
157141
157142
157143
157144
157145
157146
157147
157148
157149
157150
157151
157152
157153
157154
157155
157156
157157
157158
157159
157160
157161
157162
157163
157164
157165
157166
157167
157168
157169
157170
157171
157172
157173
157174
157175
157176
157177
157178
157179
157180
157181
157182
157183
157184
157185
157186
157187
157188
157189
157190
157191
157192
157193
157194
157195
157196
157197
157198
157199
157200
157201
157202
157203
157204
157205
157206
157207
157208
157209
157210
157211
157212
157213
157214
157215
157216
157217
157218
157219
157220
157221
157222
157223
157224
157225
157226
157227
157228
157229
157230
157231
157232
157233
157234
157235
157236
157237
157238
157239
157240
157241
157242
157243
157244
157245
157246
157247
157248
157249
157250
157251
157252
157253
157254
157255
157256
157257
157258
157259
157260
157261
157262
157263
157264
157265
157266
157267
157268
157269
157270
157271
157272
157273
157274
157275
157276
157277
157278
157279
157280
157281
157282
157283
157284
157285
157286
157287
157288
157289
157290
157291
157292
157293
157294
157295
157296
157297
157298
157299
157300
157301
157302
157303
157304
157305
157306
157307
157308
157309
157310
157311
157312
157313
157314
157315
157316
157317
157318
157319
157320
157321
**  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 (2017)
static const YYACTIONTYPE yy_action[] = {
 /*     0 */   566, 1253,  566,  197, 1576,  566, 1256,  566,  116,  113,
 /*    10 */   218,  566, 1263,  566,  488,  395,  116,  113,  218,  407,
 /*    20 */   359,  359,   42,   42,   42,   42,  471,   42,   42,   72,
 /*    30 */    72,  959, 1255,   72,   72,   72,   72, 1500, 1581,  960,
 /*    40 */     9,  889,  252,  123,  124,  114, 1196, 1196, 1035, 1038,
 /*    50 */  1028, 1028,  121,  121,  122,  122,  122,  122,  415,  407,
 /*    60 */   473, 1556,  572,    2, 1224, 1582,  548,  145,  147,  306,
 /*    70 */   548,  138,  548, 1296, 1296,  524,  566, 1193, 1304,  547,
 /*    80 */   523,  513,  167,  123,  124,  114, 1196, 1196, 1035, 1038,
 /*    90 */  1028, 1028,  121,  121,  122,  122,  122,  122,   72,   72,
 /*   100 */   282,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*   110 */   117,  441,  274,  274,  274,  274,  446, 1172, 1537,  373,
 /*   120 */  1539, 1172,  372, 1537,  537,  563, 1144,  563, 1144,  407,
 /*   130 */  1078,  249,  215, 1193,  174,  529,  100,  305,  557,  229,
 /*   140 */   441,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*   150 */   117,  441,  450,  123,  124,  114, 1196, 1196, 1035, 1038,
 /*   160 */  1028, 1028,  121,  121,  122,  122,  122,  122,  543,  450,
 /*   170 */   449,  445, 1172, 1173, 1174,  397, 1172, 1173, 1174,  125,
 /*   180 */   120,  120,  120,  120,  119,  119,  118,  118,  118,  117,
 /*   190 */   441,  119,  119,  118,  118,  118,  117,  441,  269,  407,
 /*   200 */  1553,  122,  122,  122,  122,  115,  381,   84,  377,  274,
 /*   210 */   274,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*   220 */   117,  441,  563,  123,  124,  114, 1196, 1196, 1035, 1038,
 /*   230 */  1028, 1028,  121,  121,  122,  122,  122,  122,  407,  469,
 /*   240 */  1122, 1609,  450,   82, 1609,  462,  331,   81,  120,  120,
 /*   250 */   120,  120,  119,  119,  118,  118,  118,  117,  441,  116,
 /*   260 */   113,  218,  123,  124,  114, 1196, 1196, 1035, 1038, 1028,
 /*   270 */  1028,  121,  121,  122,  122,  122,  122,  566,  544, 1524,
 /*   280 */   880,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*   290 */   117,  441,  118,  118,  118,  117,  441,   12,  197,   71,
 /*   300 */    71, 1139,  122,  122,  122,  122,  386,  407,  431, 1172,
 /*   310 */   400,  505,  533,  349, 1139,  166,  314, 1139, 1120,  881,
 /*   320 */   120,  120,  120,  120,  119,  119,  118,  118,  118,  117,
 /*   330 */   441,  123,  124,  114, 1196, 1196, 1035, 1038, 1028, 1028,
 /*   340 */   121,  121,  122,  122,  122,  122, 1172,  268,  268,  120,
 /*   350 */   120,  120,  120,  119,  119,  118,  118,  118,  117,  441,
 /*   360 */   563,  380, 1015, 1139, 1172, 1173, 1174,  241,  532,  565,
 /*   370 */   501,  498,  497,  429,  540,  478, 1139, 1532, 1006, 1139,
 /*   380 */   496,    6, 1005, 1396,  504, 1025, 1025, 1036, 1039,  120,
 /*   390 */   120,  120,  120,  119,  119,  118,  118,  118,  117,  441,
 /*   400 */   428, 1172, 1173, 1174, 1099, 1464,  260,  277,  357,  507,
 /*   410 */   352,  506,  246,  407, 1005, 1005, 1007,  345,  348, 1100,
 /*   420 */   241,  462,  331,  501,  498,  497,  371,  512, 1531,  359,
 /*   430 */   531,  360,    6,  496, 1101,  452,  203,  123,  124,  114,
 /*   440 */  1196, 1196, 1035, 1038, 1028, 1028,  121,  121,  122,  122,
 /*   450 */   122,  122,  522,  422, 1172,  900,  407,  571, 1029, 1224,
 /*   460 */   502,  321, 1274,  995,  306,  901,  138,  188, 1291,  426,
 /*   470 */  1270,  167,  488, 1304,   16,   16,  144,  860, 1291, 1273,
 /*   480 */   123,  124,  114, 1196, 1196, 1035, 1038, 1028, 1028,  121,
 /*   490 */   121,  122,  122,  122,  122,  120,  120,  120,  120,  119,
 /*   500 */   119,  118,  118,  118,  117,  441,  528,  274,  274, 1172,
 /*   510 */  1173, 1174, 1396,  566,  166,  329, 1499, 1015,  417,  374,
 /*   520 */   563,  488,  318, 1172,  320,  407,  305,  557,  375,  864,
 /*   530 */   182,  216,  860, 1006,  229,   72,   72, 1005,  120,  120,
 /*   540 */   120,  120,  119,  119,  118,  118,  118,  117,  441,  123,
 /*   550 */   124,  114, 1196, 1196, 1035, 1038, 1028, 1028,  121,  121,
 /*   560 */   122,  122,  122,  122,  407, 1463,  445, 1172,  857, 1005,
 /*   570 */  1005, 1007,  301, 1529,  116,  113,  218,    6, 1172, 1173,
 /*   580 */  1174,  183,  423,  116,  113,  218, 1172,  316,  123,  124,
 /*   590 */   114, 1196, 1196, 1035, 1038, 1028, 1028,  121,  121,  122,
 /*   600 */   122,  122,  122, 1469,  319,  946,  471,  120,  120,  120,
 /*   610 */   120,  119,  119,  118,  118,  118,  117,  441, 1172,  211,
 /*   620 */  1469, 1471, 1172, 1173, 1174,  920,  541, 1531,  477, 1172,
 /*   630 */   919,    6, 1172,  407,  925,  438,  437, 1157,  213,  511,
 /*   640 */    32, 1172, 1173, 1174,  280,    5,  120,  120,  120,  120,
 /*   650 */   119,  119,  118,  118,  118,  117,  441,  123,  124,  114,
 /*   660 */  1196, 1196, 1035, 1038, 1028, 1028,  121,  121,  122,  122,
 /*   670 */   122,  122,  407, 1172, 1173, 1174, 1016, 1172,  274,  274,
 /*   680 */   287, 1203, 1172, 1203, 1172, 1173, 1174, 1172, 1173, 1174,
 /*   690 */   566,  563,  167, 1469,  117,  441,  123,  124,  114, 1196,
 /*   700 */  1196, 1035, 1038, 1028, 1028,  121,  121,  122,  122,  122,
 /*   710 */   122,  945,   13,   13,  127,  120,  120,  120,  120,  119,
 /*   720 */   119,  118,  118,  118,  117,  441,  286,  420,  566,  451,
 /*   730 */   566, 1396, 1172, 1173, 1174, 1294, 1294, 1172, 1173, 1174,
 /*   740 */    97,  407,  995, 1611,  393, 1000,  488,  305,  557,   17,
 /*   750 */    72,   72,   72,   72,  120,  120,  120,  120,  119,  119,
 /*   760 */   118,  118,  118,  117,  441,  123,  124,  114, 1196, 1196,
 /*   770 */  1035, 1038, 1028, 1028,  121,  121,  122,  122,  122,  122,
 /*   780 */   407, 1220,    1,    1,  572,    2, 1224,  302,  418,  436,
 /*   790 */  1303,  306,  842,  138,  329,  457,  317,  404,  403,  566,
 /*   800 */  1304,  424,    3,  291,  123,  124,  114, 1196, 1196, 1035,
 /*   810 */  1038, 1028, 1028,  121,  121,  122,  122,  122,  122,  379,
 /*   820 */   566,   13,   13,  120,  120,  120,  120,  119,  119,  118,
 /*   830 */   118,  118,  117,  441,  274,  274,  425,  274,  274, 1172,
 /*   840 */  1308,  359,   13,   13, 1122, 1610,   12,  563, 1610,  407,
 /*   850 */   563,  460,  563, 1172,  560,  560,  560,  427,  439,  439,
 /*   860 */   439,  229,  120,  120,  120,  120,  119,  119,  118,  118,
 /*   870 */   118,  117,  441,  123,  124,  114, 1196, 1196, 1035, 1038,
 /*   880 */  1028, 1028,  121,  121,  122,  122,  122,  122,  146,  197,
 /*   890 */   417,  566, 1058,  445, 1172, 1173, 1174,  417,  471,  438,
 /*   900 */   437,  406,  564,  248,  914,  914,  566, 1200, 1172, 1173,
 /*   910 */  1174,  488, 1202,   72,   72,  493, 1510,  549,  102,  194,
 /*   920 */  1201,  566, 1120,  295,  461,  295, 1302,  252,   72,   72,
 /*   930 */  1456,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*   940 */   117,  441,  245,   56,   56, 1203,  566, 1203,  566, 1242,
 /*   950 */   440,  274,  274,  566,  516, 1299,  566,  514,  566,  283,
 /*   960 */   274,  274, 1193,  519,  563,  548,  285,  343,   52,   52,
 /*   970 */    13,   13,  290,  563,  550,   13,   13,  566,   13,   13,
 /*   980 */    13,   13,  551,  274,  274,  294, 1411,  105,  274,  274,
 /*   990 */   191,  274,  274,  192, 1512,  545,  563,  274,  274,   57,
 /*  1000 */    57,  563,  275,  275,  563,  515,  447,  407,  271,  412,
 /*  1010 */   563,  944,  198,  305,  557,  563,  274,  274, 1193,  106,
 /*  1020 */   411,  104,  358, 1550, 1508,  348,  566,  407,  338,  563,
 /*  1030 */   341,  123,  124,  114, 1196, 1196, 1035, 1038, 1028, 1028,
 /*  1040 */   121,  121,  122,  122,  122,  122,  471,  407,   15,   15,
 /*  1050 */   477,  123,  124,  114, 1196, 1196, 1035, 1038, 1028, 1028,
 /*  1060 */   121,  121,  122,  122,  122,  122, 1083, 1083,  485,  360,
 /*  1070 */   477,  123,  112,  114, 1196, 1196, 1035, 1038, 1028, 1028,
 /*  1080 */   121,  121,  122,  122,  122,  122,  392, 1216,  309,  120,
 /*  1090 */   120,  120,  120,  119,  119,  118,  118,  118,  117,  441,
 /*  1100 */    99,  217,  482, 1176, 1410,  566,  479,  433,  543,  120,
 /*  1110 */   120,  120,  120,  119,  119,  118,  118,  118,  117,  441,
 /*  1120 */   292, 1080,  566, 1396,  566, 1080,  944,   44,   44,  120,
 /*  1130 */   120,  120,  120,  119,  119,  118,  118,  118,  117,  441,
 /*  1140 */   358, 1550,  539, 1099,   58,   58,   45,   45,  328,  407,
 /*  1150 */  1139,  830,  831,  832,  244,  243,  242,  483, 1100, 1176,
 /*  1160 */  1396,  538,  310, 1139, 1217,  488, 1139,  566,  293,  407,
 /*  1170 */  1150, 1245,  413, 1101,  124,  114, 1196, 1196, 1035, 1038,
 /*  1180 */  1028, 1028,  121,  121,  122,  122,  122,  122,  566,   59,
 /*  1190 */    59,  566,  509,  484,  554,  114, 1196, 1196, 1035, 1038,
 /*  1200 */  1028, 1028,  121,  121,  122,  122,  122,  122, 1530,  336,
 /*  1210 */    60,   60,    6,   61,   61,  392, 1121, 1528,  920, 1525,
 /*  1220 */  1150,    6,  566,  919,  566,  109,  558,  566,    4,  944,
 /*  1230 */   434,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*  1240 */   117,  441,  561,  867,   62,   62,   63,   63,  566,   46,
 /*  1250 */    46,  120,  120,  120,  120,  119,  119,  118,  118,  118,
 /*  1260 */   117,  441,  566, 1139, 1527,  442, 1327,  566,    6,  566,
 /*  1270 */    47,   47,  566,  559,  413, 1272, 1139,  555,  142, 1139,
 /*  1280 */   566,  467,  305,  557,   48,   48,  566,  167,  546,   50,
 /*  1290 */    50,   51,   51, 1217,   64,   64,  959,  109,  558,  867,
 /*  1300 */     4,  566,   65,   65,  960, 1015,  566,  140,   66,   66,
 /*  1310 */   566,  107,  107,  566,  561,  852,  205,  566,  108,  217,
 /*  1320 */   442,  568,  567,   14,   14, 1005,    8,  525,   67,   67,
 /*  1330 */   566,  454,  129,  129,  222,   68,   68,  442,  455,   53,
 /*  1340 */    53,  405,  305,  557,  944,  414,  168,  211,  405,  555,
 /*  1350 */   111, 1192,   69,   69,   99,  464,  245, 1005, 1005, 1007,
 /*  1360 */  1008,   27,  468,  535,  566,  405,  566,  313,  534,  273,
 /*  1370 */   215,  852,  405,  566,   85,  202,  566, 1015,  566, 1211,
 /*  1380 */   566,  304,  566,  107,  107,  566,   70,   70,   54,   54,
 /*  1390 */   108,  405,  442,  568,  567,  153,  153, 1005,  154,  154,
 /*  1400 */    77,   77,   55,   55,   73,   73, 1117,  130,  130,  394,
 /*  1410 */   109,  558,  143,    4,   38,  566,  475,  300,  566,  463,
 /*  1420 */   279, 1340,  526,  412,   30,  226, 1077,  561, 1077, 1005,
 /*  1430 */  1005, 1007, 1008,   27, 1555, 1161,  444,   74,   74,  278,
 /*  1440 */   131,  131,  326, 1339,  390,  390,  389,  263,  387,  566,
 /*  1450 */   442,  839,  871,  308,  465,   31,  566,  879,  878,  356,
 /*  1460 */   327,  206,  555,   99,  223,  206,  312,  546, 1544,  355,
 /*  1470 */   997,  132,  132,  251,  311,  456,  535,  288,  128,  128,
 /*  1480 */  1065,  536,  109,  558,  470,    4,  566,  251, 1515,  472,
 /*  1490 */  1015,  566,  251,  276,  566,  332,  107,  107,   99,  561,
 /*  1500 */  1076,  566, 1076,  108,  225,  442,  568,  567,  152,  152,
 /*  1510 */  1005,  476,  158,  151,  151,  160,  136,  136,  494,  886,
 /*  1520 */   887,  247,  442,  135,  135,  346,  322,  566,   99, 1061,
 /*  1530 */   489,  224,  247,  566,  555, 1488, 1065, 1487,  953, 1009,
 /*  1540 */   228,  251, 1005, 1005, 1007, 1008,   27,  480,  535,  133,
 /*  1550 */   133,  566,  333,  534, 1336,  134,  134,  962,  963,  337,
 /*  1560 */   917,  340, 1015,  111,  850,  408,  342,  141,  107,  107,
 /*  1570 */   305,  557,  344,   76,   76,  108,  566,  442,  568,  567,
 /*  1580 */  1161,  444, 1005,  566,  278,  109,  558,  553,    4,  390,
 /*  1590 */   390,  389,  263,  387,  448, 1009,  839,  918,   78,   78,
 /*  1600 */   111,  566,  561, 1287,  566,   75,   75, 1271, 1334,  223,
 /*  1610 */  1569,  312,  351,  361, 1005, 1005, 1007, 1008,   27,  311,
 /*  1620 */   362, 1348, 1395,   43,   43,  442,   49,   49, 1323,  552,
 /*  1630 */  1401, 1252, 1244, 1233, 1232, 1234, 1563,  555,  200,  266,
 /*  1640 */  1320,  391,   11,  364,  221,  366,  368, 1382, 1377,  225,
 /*  1650 */   281,  453,  324,  330,  284, 1387,  474,  158,  208,  370,
 /*  1660 */   160, 1370,  325,  556,  195, 1015,  289,  499,  384,  354,
 /*  1670 */  1270,  107,  107,  924, 1386,  398,  224,  212,  108, 1460,
 /*  1680 */   442,  568,  567, 1459, 1566, 1005, 1211,  255, 1208, 1507,
 /*  1690 */  1505,  109,  558,  416,    4,  196,  207,  204,  170,  219,
 /*  1700 */    80,   84,  180, 1383, 1465,   83,  164,  172,  561,  458,
 /*  1710 */   408,  175,  176,  459,  177,  305,  557, 1005, 1005, 1007,
 /*  1720 */  1008,   27,   35,  178,  492,  231,  396,   97, 1389,  466,
 /*  1730 */  1388,  442,  481,   36, 1391,  184,  399,   90,  235,  448,
 /*  1740 */  1454, 1476,  267,  555,  487,  189,  237,  490,  339,  238,
 /*  1750 */   335, 1235,  239,  401,  508, 1281,  430, 1290, 1289,  101,
 /*  1760 */   558, 1288,    4,   92,  871,  213, 1580,  432, 1331,  527,
 /*  1770 */    96, 1015, 1260,  353,  402, 1579,  561,  107,  107, 1259,
 /*  1780 */   363, 1258, 1578, 1280,  108,  298,  442,  568,  567, 1549,
 /*  1790 */   518, 1005,  299,  521,  253, 1332,  365, 1535,  254,  442,
 /*  1800 */  1534,  435,  546,   10,  126,  378, 1440,  103,  530,  303,
 /*  1810 */    98,  555,  261, 1241,   34,  569,  199, 1313, 1330, 1329,
 /*  1820 */   367,  369,  376, 1005, 1005, 1007, 1008,   27, 1312,  382,
 /*  1830 */  1355, 1354,  383, 1167,  262,  264,  265,  570, 1230, 1015,
 /*  1840 */   155, 1225, 1492, 1493, 1491,  107,  107, 1490,  156,  139,
 /*  1850 */   296,   79,  108,  826,  442,  568,  567,  209,  157, 1005,
 /*  1860 */   443,  278,  201,  210,  307,  220,  390,  390,  389,  263,
 /*  1870 */   387,  137,  315,  839,  409, 1075, 1073,  410,  171,  169,
 /*  1880 */   159,  903,  173,  227, 1192,  230,  223,  323,  312, 1089,
 /*  1890 */   179, 1005, 1005, 1007, 1008,   27,  311,  161,  162,  419,
 /*  1900 */   421,   86,  181,  163,   87, 1092,  232,   88, 1088,  148,
 /*  1910 */   233,   18,  234,   89,  334, 1081,  251, 1205,  486,  236,
 /*  1920 */   186,   37,  841,  355,  491,  240,  225,  869,  187,  503,
 /*  1930 */   185,  495,   91,   19,  158,  347,   20,  160,   93,  350,
 /*  1940 */   500,  882,  297,  149,   94,  165,  510,   95, 1155,  150,
 /*  1950 */  1041, 1125,   39,  224,   40,  517, 1126,  214,  520,  270,
 /*  1960 */   272,  190,  947,  250,  111, 1143, 1141, 1145, 1149,   21,
 /*  1970 */  1129,   33,  542, 1148,   22,   23,   24,   25,  193,  952,
 /*  1980 */    99, 1056, 1042, 1040,   26, 1044, 1098,  408,    7, 1097,
 /*  1990 */   256,  257,  305,  557, 1045,   28,   41,  562, 1010,  851,
 /*  2000 */   110,   29,  913,  385,  388,  258,  259, 1163, 1162, 1571,
 /*  2010 */  1221, 1221, 1221, 1570, 1221, 1221,  448,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */   190,  212,  190,  190,  211,  190,  212,  190,  270,  271,
 /*    10 */   272,  190,  219,  190,  190,  202,  270,  271,  272,   19,
 /*    20 */   190,  190,  212,  213,  212,  213,  190,  212,  213,  212,
 /*    30 */   213,   31,  212,  212,  213,  212,  213,  291,   23,   39,
 /*    40 */    22,   26,   24,   43,   44,   45,   46,   47,   48,   49,
157178
157179
157180
157181
157182
157183
157184
157185
157186
157187
157188
157189
157190
157191
157192
157193
157194
157195
157196
157197
157198
157199
157200
157201
157202
157203
157204
157205
157206
157207
157208
157209
157210
157211
157212
157213
157214
157215
157216
157217
157218
157219
157220
157221
157222
157223
157224
157225
157226
157227
157228
157229
157230
157231







157232
157233
157234
157235
157236
157237
157238
157239
157240
157241
157242
157243
157244
157245
157246
157247
157248
157249
157250
157251
157252
157253
157254
157255
157256
157257
157258
157259
157260
157261
157262
157263
157264
157265
157266
157267
157268
157269
157270
157271
157272
157273
 /*  1350 */    26,   26,  212,  213,   26,  240,   46,  151,  152,  153,
 /*  1360 */   154,  155,  240,   85,  190,  250,  190,  190,   90,  252,
 /*  1370 */   253,  115,  250,  190,  147,  148,  190,   99,  190,   60,
 /*  1380 */   190,  240,  190,  105,  106,  190,  212,  213,  212,  213,
 /*  1390 */   112,  250,  114,  115,  116,  212,  213,  119,  212,  213,
 /*  1400 */   212,  213,  212,  213,  212,  213,   23,  212,  213,   26,
 /*  1410 */    19,   20,   22,   22,   24,  190,   19,  251,  190,  127,
 /*  1420 */    24,  190,  114,  113,   22,  118,  119,   36,  190,  151,
 /*  1430 */   152,  153,  154,  155,    0,    1,    2,  212,  213,    5,
 /*  1440 */   212,  213,  150,  190,   10,   11,   12,   13,   14,  190,
 /*  1450 */    59,   17,  124,  190,  127,   53,  190,    7,    8,  119,
 /*  1460 */    23,  140,   71,   26,   30,  140,   32,  143,  312,  129,
 /*  1470 */    23,  212,  213,   26,   40,  190,   85,  150,  212,  213,
 /*  1480 */    59,   90,   19,   20,   23,   22,  190,   26,  190,   23,
 /*  1490 */    99,  190,   26,   22,  190,   23,  105,  106,   26,   36,
 /*  1500 */   151,  190,  153,  112,   70,  114,  115,  116,  212,  213,
 /*  1510 */   119,  114,   78,  212,  213,   81,  212,  213,   23,   83,
 /*  1520 */    84,   26,   59,  212,  213,   23,  190,  190,   26,   23,
 /*  1530 */   284,   97,   26,  190,   71,  139,  115,   23,   23,   59,
 /*  1540 */    26,   26,  151,  152,  153,  154,  155,  190,   85,  212,
 /*  1550 */   213,  190,  151,   90,  153,  212,  213,   23,   23,  190,
 /*  1560 */    26,   26,   99,  190,  190,  131,  190,  190,  105,  106,
 /*  1570 */   136,  137,  190,  212,  213,  112,  190,  114,  115,  116,
 /*  1580 */     1,    2,  119,  190,    5,   19,   20,  232,   22,   10,
 /*  1590 */    11,   12,   13,   14,  160,  115,   17,  190,  212,  213,
 /*  1600 */   190,  190,   36,  190,  190,  212,  213,  190,  190,   30,
 /*  1610 */   139,   32,  190,  190,  151,  152,  153,  154,  155,   40,
 /*  1620 */   190,  190,  190,  212,  213,   59,  212,  213,  190,  190,
 /*  1630 */   190,  190,  190,  190,  283,  251,  238,   71,  251,  251,
 /*  1640 */   251,  188,  239,  210,  263,  293,  267,  241,  263,   70,
 /*  1650 */   255,  289,  289,  241,  255,  193,  221,   78,  242,  267,
 /*  1660 */    81,  267,  242,  255,  216,   99,  215,  267,  241,  225,
 /*  1670 */   215,  105,  106,  107,  215,   60,   97,  139,  112,  197,
 /*  1680 */   114,  115,  116,  197,   38,  119,  197,  148,  239,  149,
 /*  1690 */   245,   19,   20,  268,   22,  276,   22,  245,  293,  290,
 /*  1700 */    43,   18,  233,  279,  230,  290,  233,  197,   36,  233,
 /*  1710 */   131,  233,  266,   18,  196,  136,  137,  151,  152,  153,
 /*  1720 */   154,  155,  147,  242,  268,  268,  242,  230,  230,  242,
 /*  1730 */   266,   59,  242,  197,  156,   62,   22,  196,  196,  160,
 /*  1740 */   286,  197,  217,   71,  197,  285,  196,  217,  197,  196,
 /*  1750 */   113,  214,   64,   22,  223,  124,  223,  214,  163,   19,
 /*  1760 */    20,  111,   22,  214,  216,  220,  220,  142,  214,  217,
 /*  1770 */   214,   99,  214,  214,  306,  113,   36,  105,  106,  217,
 /*  1780 */   217,  278,  278,  257,  112,  256,  114,  115,  116,  257,
 /*  1790 */   197,  119,   91,   82,  311,  146,  311,  143,   22,   59,
 /*  1800 */   273,  197,  144,  156,  145,   25,  200,   26,  199,   13,
 /*  1810 */   245,   71,  257,  256,  244,  246,  256,  246,  257,  243,
 /*  1820 */   256,  191,  242,  151,  152,  153,  154,  155,  261,  261,
 /*  1830 */   191,    6,  189,  189,  189,  203,  209,  209,  209,   99,
 /*  1840 */   218,  203,  209,  209,  218,  105,  106,  275,    4,    3,
 /*  1850 */   210,  210,  112,   22,  114,  115,  116,  161,  203,  119,
 /*  1860 */    15,    5,   98,   16,   23,   23,   10,   11,   12,   13,
 /*  1870 */    14,  137,  299,   17,  149,  128,  299,  296,   26,   24,
 /*  1880 */    20,  140,   16,    1,  142,  140,   30,  128,   32,  128,







 /*  1890 */    61,  151,  152,  153,  154,  155,   40,  149,   37,  128,
 /*  1900 */   114,   53,   53,   53,   53,   34,  139,    1,    5,   22,
 /*  1910 */   113,  159,   26,   75,   41,  113,  139,   24,   20,   19,
 /*  1920 */   129,   68,   68,  123,   22,   67,   70,   22,   59,   22,
 /*  1930 */    67,   23,   22,   24,   78,   96,   22,   81,   37,   28,
 /*  1940 */    23,   67,  147,   22,   26,   23,   23,   23,   23,   22,
 /*  1950 */    24,   23,   22,   97,  139,   24,   23,   23,   22,  141,
 /*  1960 */    88,   26,   86,   34,   75,   75,   34,   23,   93,   22,
 /*  1970 */    24,  114,   34,   34,   34,   34,   26,   26,   23,   34,
 /*  1980 */    23,   44,   23,   23,   23,   11,   23,  131,   26,   22,
 /*  1990 */    22,   22,  136,  137,   23,   23,   26,   22,   22,   15,
 /*  2000 */   133,  139,   23,  139,  139,    1,    1,  139,  313,  313,
 /*  2010 */   313,  313,  313,  313,  313,  313,  160,  313,  313,  313,
 /*  2020 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2030 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2040 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2050 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2060 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2070 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2080 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2090 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2100 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2110 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2120 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2130 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2140 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2150 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2160 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2170 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2180 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2190 */   182,  182,  182,  182,  182,  182,  182,  182,  182,
};
#define YY_SHIFT_COUNT    (570)
#define YY_SHIFT_MIN      (0)
#define YY_SHIFT_MAX      (2005)
static const unsigned short int yy_shift_ofst[] = {
 /*     0 */  1579, 1434, 1856, 1206, 1206,    1, 1278, 1391, 1463, 1672,
 /*    10 */  1672, 1672,  390,    0,    0,  180, 1008, 1672, 1672, 1672,
 /*    20 */  1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672,
 /*    30 */   794,  794,  287,  287,  250,  611,    1,    1,    1,    1,
 /*    40 */     1,    1,   40,  110,  219,  288,  394,  437,  506,  545,
 /*    50 */   614,  653,  722,  761,  830,  988, 1008, 1008, 1008, 1008,







|


|





|
|
|
|
|
|


|
|


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

















|

|

|







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
 /*  1350 */    26,   26,  212,  213,   26,  240,   46,  151,  152,  153,
 /*  1360 */   154,  155,  240,   85,  190,  250,  190,  190,   90,  252,
 /*  1370 */   253,  115,  250,  190,  147,  148,  190,   99,  190,   60,
 /*  1380 */   190,  240,  190,  105,  106,  190,  212,  213,  212,  213,
 /*  1390 */   112,  250,  114,  115,  116,  212,  213,  119,  212,  213,
 /*  1400 */   212,  213,  212,  213,  212,  213,   23,  212,  213,   26,
 /*  1410 */    19,   20,   22,   22,   24,  190,   19,  251,  190,  127,
 /*  1420 */    98,  190,  114,  113,   22,   24,  151,   36,  153,  151,
 /*  1430 */   152,  153,  154,  155,    0,    1,    2,  212,  213,    5,
 /*  1440 */   212,  213,  150,  190,   10,   11,   12,   13,   14,  190,
 /*  1450 */    59,   17,  124,  131,  127,   53,  190,  118,  119,  119,
 /*  1460 */    23,  140,   71,   26,   30,  140,   32,  143,  312,  129,
 /*  1470 */    23,  212,  213,   26,   40,  190,   85,  150,  212,  213,
 /*  1480 */    59,   90,   19,   20,   23,   22,  190,   26,  190,   23,
 /*  1490 */    99,  190,   26,   22,  190,   23,  105,  106,   26,   36,
 /*  1500 */   151,  190,  153,  112,   70,  114,  115,  116,  212,  213,
 /*  1510 */   119,  114,   78,  212,  213,   81,  212,  213,   23,    7,
 /*  1520 */     8,   26,   59,  212,  213,   23,  190,  190,   26,   23,
 /*  1530 */   284,   97,   26,  190,   71,  190,  115,  190,   23,   59,
 /*  1540 */   139,   26,  151,  152,  153,  154,  155,  190,   85,  212,
 /*  1550 */   213,  190,  190,   90,  190,  212,  213,   83,   84,  190,
 /*  1560 */    23,  190,   99,   26,   23,  131,  190,   26,  105,  106,
 /*  1570 */   136,  137,  190,  212,  213,  112,  190,  114,  115,  116,
 /*  1580 */     1,    2,  119,  190,    5,   19,   20,  232,   22,   10,
 /*  1590 */    11,   12,   13,   14,  160,  115,   17,   23,  212,  213,
 /*  1600 */    26,  190,   36,  190,  190,  212,  213,  190,  190,   30,
 /*  1610 */   139,   32,  190,  190,  151,  152,  153,  154,  155,   40,
 /*  1620 */   190,  190,  190,  212,  213,   59,  212,  213,  190,  190,
 /*  1630 */   190,  190,  190,  190,  190,  190,  190,   71,  238,  283,
 /*  1640 */   251,  188,  239,  251,  293,  251,  251,  267,  263,   70,
 /*  1650 */   241,  255,  289,  241,  255,  267,  289,   78,  210,  255,
 /*  1660 */    81,  263,  242,  276,  245,   99,  242,  216,  241,  215,
 /*  1670 */   221,  105,  106,  107,  267,  267,   97,  225,  112,  215,
 /*  1680 */   114,  115,  116,  215,  193,  119,   60,  139,   38,  197,
 /*  1690 */   197,   19,   20,  197,   22,  245,  239,  148,  293,  293,
 /*  1700 */   290,  149,   22,  268,  279,  290,   43,  230,   36,   18,
 /*  1710 */   131,  233,  233,  197,  233,  136,  137,  151,  152,  153,
 /*  1720 */   154,  155,  266,  233,   18,  196,  242,  147,  268,  242,
 /*  1730 */   268,   59,  197,  266,  230,  230,  242,  156,  196,  160,
 /*  1740 */   242,  286,  197,   71,   62,   22,  196,  217,  197,  196,
 /*  1750 */   285,  197,  196,  217,  113,  223,   64,  214,  214,   19,
 /*  1760 */    20,  214,   22,   22,  124,  163,  220,  111,  257,  142,
 /*  1770 */   113,   99,  214,  214,  217,  220,   36,  105,  106,  216,
 /*  1780 */   256,  214,  214,  223,  112,  278,  114,  115,  116,  306,
 /*  1790 */   217,  119,  278,  217,  197,  257,  256,  311,   91,   59,
 /*  1800 */   311,   82,  143,   22,  146,  197,  273,  156,  144,  275,
 /*  1810 */   145,   71,   25,  200,   26,  199,  244,  246,  257,  257,







 /*  1820 */   256,  256,  245,  151,  152,  153,  154,  155,  246,  243,
 /*  1830 */   261,  261,  242,   13,  191,  191,    6,  189,  189,   99,
 /*  1840 */   203,  189,  209,  209,  209,  105,  106,  209,  203,  218,
 /*  1850 */   218,  209,  112,    4,  114,  115,  116,  210,  203,  119,
 /*  1860 */     3,    5,   22,  210,  161,   15,   10,   11,   12,   13,
 /*  1870 */    14,   16,  137,   17,  299,   23,   23,  299,  149,  296,
 /*  1880 */   128,   20,  140,   24,   26,  142,   30,   16,   32,    1,
 /*  1890 */   140,  151,  152,  153,  154,  155,   40,  128,  128,   61,
 /*  1900 */    37,   53,  149,  128,   53,  114,   34,   53,    1,    5,
 /*  1910 */   139,   22,  113,   53,  159,   68,   26,   75,   41,  139,
 /*  1920 */   113,   24,   20,  129,   19,  123,   70,   59,   22,   96,
 /*  1930 */    68,   67,   22,   22,   78,   23,   22,   81,   22,   24,
 /*  1940 */    67,   28,   67,   23,  147,   37,   22,   26,   23,   23,
 /*  1950 */    23,   23,   22,   97,   22,   24,   23,  139,   24,   23,
 /*  1960 */    23,   22,  141,   34,   26,   86,   88,   75,   75,   34,
 /*  1970 */    23,   22,   24,   93,   34,   34,   34,   34,   26,  114,
 /*  1980 */    26,   23,   23,   23,   34,   23,   23,  131,   44,   23,
 /*  1990 */    26,   22,  136,  137,   11,   22,   22,   26,   23,   23,
 /*  2000 */    22,   22,  133,   23,   15,  139,  139,    1,    1,  139,
 /*  2010 */   313,  313,  313,  139,  313,  313,  160,  313,  313,  313,
 /*  2020 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2030 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2040 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2050 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2060 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2070 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2080 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2090 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2100 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2110 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2120 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2130 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2140 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2150 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2160 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2170 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2180 */   313,  313,  313,  313,  313,  313,  313,  313,  313,  313,
 /*  2190 */   313,  313,  313,  313,  313,  313,  182,  182,  182,
};
#define YY_SHIFT_COUNT    (572)
#define YY_SHIFT_MIN      (0)
#define YY_SHIFT_MAX      (2007)
static const unsigned short int yy_shift_ofst[] = {
 /*     0 */  1579, 1434, 1856, 1206, 1206,    1, 1278, 1391, 1463, 1672,
 /*    10 */  1672, 1672,  390,    0,    0,  180, 1008, 1672, 1672, 1672,
 /*    20 */  1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672,
 /*    30 */   794,  794,  287,  287,  250,  611,    1,    1,    1,    1,
 /*    40 */     1,    1,   40,  110,  219,  288,  394,  437,  506,  545,
 /*    50 */   614,  653,  722,  761,  830,  988, 1008, 1008, 1008, 1008,
157283
157284
157285
157286
157287
157288
157289
157290
157291
157292
157293
157294
157295
157296
157297
157298
157299
157300
157301
157302
157303
157304
157305
157306
157307
157308
157309
157310
157311
157312
157313
157314
157315
157316
157317
157318
157319
157320
157321
157322
157323
157324
157325
157326
157327
157328
157329
157330
157331
157332
157333
157334
 /*   150 */   475,  584,   29, 2017, 2017,  289,  289,  289,   58,  508,
 /*   160 */    62,  508,  508,  508,  392,  392,  225,  395,  218,  822,
 /*   170 */   573,  573,  573,  573,  573,  573,  573,  573,  573,  573,
 /*   180 */   573,  573,  573,  573,  573,  573,  573,  573,  573,  573,
 /*   190 */   573, 1074, 1074,  573,  119, 1187, 1187, 1044, 1044, 1145,
 /*   200 */  1146, 2017, 2017, 2017, 2017, 2017, 2017, 2017,  418,  263,
 /*   210 */   263,  559,  303,  618,  527,  623,  464,  570,  780,  573,
 /*   220 */   573,  573,  573,  573,  573,  573,  573,  573,  669,  573,
 /*   230 */   573,  573,  573,  573,  573,  573,  573,  573,  573,  573,
 /*   240 */   573,  245,  245,  245,  573,  573,  573,  573,  985,  573,
 /*   250 */   573,  573,   18, 1076,  573,  573, 1131,  573,  573,  573,
 /*   260 */   573,  573,  573,  573,  573,  941, 1092,  770,  903,  903,
 /*   270 */   903,  903, 1203,  770,  770, 1085,  692, 1144, 1319, 1168,
 /*   280 */  1227, 1321, 1308, 1227, 1308, 1397,  593, 1168, 1168,  593,
 /*   290 */  1168, 1321, 1397, 1328,   15, 1310, 1265, 1265, 1265, 1308,
 /*   300 */  1324, 1324,  863, 1325,  492, 1390, 1615, 1538, 1538, 1646,
 /*   310 */  1646, 1538, 1540, 1539, 1674, 1657, 1683, 1683, 1683, 1683,
 /*   320 */  1538, 1695, 1575, 1539, 1539, 1575, 1674, 1657, 1575, 1657,
 /*   330 */  1575, 1538, 1695, 1578, 1673, 1538, 1695, 1714, 1538, 1695,
 /*   340 */  1538, 1695, 1714, 1637, 1637, 1637, 1688, 1731, 1731, 1714,
 /*   350 */  1637, 1631, 1637, 1688, 1637, 1637, 1595, 1714, 1650, 1650,
 /*   360 */  1714, 1625, 1662, 1625, 1662, 1625, 1662, 1625, 1662, 1538,
 /*   370 */  1701, 1701, 1711, 1711, 1649, 1654, 1776, 1538, 1647, 1649,
 /*   380 */  1659, 1658, 1575, 1780, 1781, 1796, 1796, 1825, 1825, 1825,
 /*   390 */  2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
 /*   400 */  2017, 2017, 2017, 2017, 2017,  339,  445, 1064, 1193,  951,
 /*   410 */  1029, 1256, 1383, 1402, 1396, 1292, 1327, 1437,  727, 1447,
 /*   420 */  1461, 1466, 1472, 1495, 1502, 1184, 1307, 1450, 1340, 1421,
 /*   430 */  1506, 1514, 1436, 1515, 1349, 1401, 1534, 1535, 1480, 1471,
 /*   440 */  1844, 1846, 1831, 1696, 1845, 1764, 1847, 1841, 1842, 1734,
 /*   450 */  1725, 1747, 1852, 1852, 1855, 1741, 1860, 1742, 1866, 1882,
 /*   460 */  1745, 1759, 1852, 1761, 1829, 1861, 1852, 1748, 1848, 1849,
 /*   470 */  1850, 1851, 1771, 1786, 1871, 1767, 1906, 1903, 1887, 1797,
 /*   480 */  1752, 1853, 1886, 1854, 1838, 1873, 1777, 1802, 1893, 1898,
 /*   490 */  1900, 1791, 1800, 1902, 1858, 1905, 1907, 1908, 1910, 1863,
 /*   500 */  1869, 1909, 1839, 1911, 1914, 1874, 1901, 1917, 1795, 1921,
 /*   510 */  1922, 1923, 1924, 1918, 1925, 1927, 1926, 1928, 1930, 1931,
 /*   520 */  1815, 1933, 1934, 1857, 1929, 1936, 1818, 1935, 1932, 1938,
 /*   530 */  1939, 1940, 1872, 1889, 1876, 1937, 1890, 1875, 1941, 1944,
 /*   540 */  1947, 1946, 1950, 1951, 1945, 1955, 1935, 1957, 1959, 1960,
 /*   550 */  1961, 1962, 1963, 1967, 1974, 1968, 1969, 1971, 1972, 1975,
 /*   560 */  1976, 1970, 1867, 1862, 1864, 1865, 1868, 1979, 1984, 2004,
 /*   570 */  2005,
};
#define YY_REDUCE_COUNT (404)
#define YY_REDUCE_MIN   (-262)
#define YY_REDUCE_MAX   (1655)
static const short yy_reduce_ofst[] = {
 /*     0 */   599, -123,  272,  716,  756, -121, -190, -188, -185, -183,
 /*    10 */  -179, -177,  -26,  304,  313, -254,  -11,  500,  609,  630,
 /*    20 */   758, -114,  763,  766,  323,  538,  768,   87,  540,  701,
 /*    30 */   -38,  413,  125,  324,  699,  443,  602,  725,  748,  753,







|

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

|







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
 /*   150 */   475,  584,   29, 2017, 2017,  289,  289,  289,   58,  508,
 /*   160 */    62,  508,  508,  508,  392,  392,  225,  395,  218,  822,
 /*   170 */   573,  573,  573,  573,  573,  573,  573,  573,  573,  573,
 /*   180 */   573,  573,  573,  573,  573,  573,  573,  573,  573,  573,
 /*   190 */   573, 1074, 1074,  573,  119, 1187, 1187, 1044, 1044, 1145,
 /*   200 */  1146, 2017, 2017, 2017, 2017, 2017, 2017, 2017,  418,  263,
 /*   210 */   263,  559,  303,  618,  527,  623,  464,  570,  780,  573,
 /*   220 */   573,  573,  573,  573,  573,  573,  573,  573,  573,  669,
 /*   230 */   573,  573,  573,  573,  573,  573,  573,  573,  573,  573,
 /*   240 */   573,  573,  245,  245,  245,  573,  573,  573,  573,  985,
 /*   250 */   573,  573,  573,   18, 1076,  573,  573, 1131,  573,  573,
 /*   260 */   573,  573,  573,  573,  573,  573,  941, 1092,  770,  903,
 /*   270 */   903,  903,  903, 1203,  770,  770, 1085,  692, 1144, 1319,
 /*   280 */  1168, 1227, 1321, 1308, 1227, 1308, 1397,  593, 1168, 1168,
 /*   290 */   593, 1168, 1321, 1397, 1328,   15, 1310, 1265, 1265, 1265,
 /*   300 */  1308, 1324, 1324,  863, 1325,  492, 1390, 1626, 1626, 1548,
 /*   310 */  1548, 1650, 1650, 1548, 1552, 1549, 1680, 1663, 1691, 1691,
 /*   320 */  1691, 1691, 1548, 1706, 1580, 1549, 1549, 1580, 1680, 1663,
 /*   330 */  1580, 1663, 1580, 1548, 1706, 1581, 1682, 1548, 1706, 1723,
 /*   340 */  1548, 1706, 1548, 1706, 1723, 1641, 1641, 1641, 1692, 1741,
 /*   350 */  1741, 1723, 1641, 1640, 1641, 1692, 1641, 1641, 1602, 1723,
 /*   360 */  1656, 1656, 1723, 1627, 1657, 1627, 1657, 1627, 1657, 1627,
 /*   370 */  1657, 1548, 1707, 1707, 1719, 1719, 1658, 1659, 1781, 1548,
 /*   380 */  1651, 1658, 1665, 1664, 1580, 1787, 1788, 1820, 1820, 1830,
 /*   390 */  1830, 1830, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
 /*   400 */  2017, 2017, 2017, 2017, 2017, 2017, 2017,  339,  445, 1064,
 /*   410 */  1193,  951, 1029, 1256, 1383, 1322, 1402, 1401, 1292, 1327,
 /*   420 */  1437,  727, 1447, 1461, 1466, 1472, 1495, 1502, 1184, 1339,
 /*   430 */  1512, 1340, 1421, 1506, 1515, 1474, 1537, 1275, 1349, 1541,
 /*   440 */  1574, 1480, 1471, 1849, 1857, 1840, 1703, 1850, 1855, 1852,
 /*   450 */  1853, 1735, 1729, 1752, 1858, 1858, 1859, 1742, 1861, 1743,
 /*   460 */  1871, 1888, 1750, 1769, 1858, 1770, 1838, 1863, 1858, 1753,
 /*   470 */  1848, 1851, 1854, 1860, 1775, 1791, 1872, 1771, 1907, 1904,
 /*   480 */  1889, 1799, 1755, 1847, 1890, 1862, 1842, 1877, 1780, 1807,
 /*   490 */  1897, 1902, 1905, 1794, 1802, 1906, 1864, 1910, 1911, 1912,
 /*   500 */  1914, 1873, 1868, 1915, 1833, 1913, 1916, 1875, 1908, 1920,
 /*   510 */  1797, 1924, 1925, 1926, 1927, 1921, 1928, 1930, 1931, 1933,
 /*   520 */  1932, 1934, 1818, 1936, 1937, 1865, 1929, 1939, 1821, 1938,
 /*   530 */  1935, 1940, 1941, 1942, 1878, 1892, 1879, 1944, 1893, 1880,
 /*   540 */  1943, 1947, 1949, 1948, 1952, 1954, 1950, 1958, 1938, 1959,
 /*   550 */  1960, 1962, 1963, 1964, 1966, 1969, 1983, 1973, 1974, 1975,
 /*   560 */  1976, 1978, 1979, 1971, 1869, 1866, 1867, 1870, 1874, 1980,
 /*   570 */  1989, 2006, 2007,
};
#define YY_REDUCE_COUNT (406)
#define YY_REDUCE_MIN   (-262)
#define YY_REDUCE_MAX   (1655)
static const short yy_reduce_ofst[] = {
 /*     0 */   599, -123,  272,  716,  756, -121, -190, -188, -185, -183,
 /*    10 */  -179, -177,  -26,  304,  313, -254,  -11,  500,  609,  630,
 /*    20 */   758, -114,  763,  766,  323,  538,  768,   87,  540,  701,
 /*    30 */   -38,  413,  125,  324,  699,  443,  602,  725,  748,  753,
157346
157347
157348
157349
157350
157351
157352
157353
157354
157355
157356
157357
157358
157359
157360
157361
157362
157363
157364
157365
157366
157367
157368
157369
157370
157371
157372
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
 /*   150 */   835, -262, -262, -262, -262, -207, -207, -207,  126, -164,
 /*   160 */  -170,  416,  708,  856, -158,  504,   74, -169,  446,  446,
 /*   170 */  -187,  328,  700,  707,  239,  282,  331,  556,  721,  438,
 /*   180 */   193,  860,  322,  541,  880,  933,  975,  241,  651,  879,
 /*   190 */   970,  270,  905,  918,   88,  914,  961,  967, 1069,  -39,
 /*   200 */   604, 1050, 1091, 1098, 1115, 1122, 1117, 1141, -211, -206,
 /*   210 */  -180, -130, -161,   10,  179,  236,  316,  341,  629,  726,
 /*   220 */   804,  816,  834,  898,  972, 1177, 1231, 1238,  170, 1253,
 /*   230 */  1263, 1285, 1298, 1336, 1357, 1369, 1373, 1374, 1376, 1377,
 /*   240 */  1382,  240,  257, 1053, 1407, 1410, 1413, 1417, 1012, 1422,
 /*   250 */  1423, 1430, 1166, 1156, 1418, 1431, 1355, 1432,  179, 1438,
 /*   260 */  1439, 1440, 1441, 1442, 1443, 1246, 1351, 1398, 1384, 1387,
 /*   270 */  1388, 1389, 1012, 1398, 1398, 1403, 1433, 1453, 1352, 1379,
 /*   280 */  1381, 1406, 1395, 1385, 1399, 1362, 1416, 1392, 1394, 1420,
 /*   290 */  1400, 1412, 1363, 1448, 1444, 1435, 1451, 1455, 1459, 1408,
 /*   300 */  1445, 1452, 1419, 1427, 1449, 1462, 1405, 1482, 1486, 1409,
 /*   310 */  1415, 1489, 1424, 1425, 1446, 1474, 1469, 1473, 1476, 1478,
 /*   320 */  1510, 1518, 1481, 1456, 1457, 1484, 1464, 1497, 1487, 1498,
 /*   330 */  1490, 1536, 1541, 1454, 1460, 1544, 1542, 1525, 1547, 1550,
 /*   340 */  1551, 1553, 1530, 1537, 1543, 1549, 1531, 1545, 1546, 1552,
 /*   350 */  1554, 1548, 1556, 1533, 1558, 1559, 1468, 1562, 1503, 1504,
 /*   360 */  1563, 1526, 1529, 1532, 1557, 1555, 1560, 1561, 1564, 1593,
 /*   370 */  1483, 1485, 1567, 1568, 1569, 1565, 1527, 1604, 1572, 1571,
 /*   380 */  1570, 1576, 1580, 1606, 1609, 1630, 1639, 1643, 1644, 1645,
 /*   390 */  1573, 1577, 1581, 1632, 1627, 1628, 1629, 1633, 1638, 1622,
 /*   400 */  1626, 1640, 1641, 1634, 1655,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */  1610, 1610, 1610, 1445, 1215, 1324, 1215, 1215, 1215, 1445,
 /*    10 */  1445, 1445, 1215, 1354, 1354, 1498, 1246, 1215, 1215, 1215,
 /*    20 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1444, 1215, 1215,
 /*    30 */  1215, 1215, 1528, 1528, 1215, 1215, 1215, 1215, 1215, 1215,
 /*    40 */  1215, 1215, 1215, 1363, 1215, 1370, 1215, 1215, 1215, 1215,
 /*    50 */  1215, 1446, 1447, 1215, 1215, 1215, 1497, 1499, 1462, 1377,
 /*    60 */  1376, 1375, 1374, 1480, 1341, 1368, 1361, 1365, 1440, 1441,
 /*    70 */  1439, 1443, 1447, 1446, 1215, 1364, 1411, 1425, 1410, 1215,
 /*    80 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*    90 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   100 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   110 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   120 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1419, 1424,
 /*   130 */  1430, 1423, 1420, 1413, 1412, 1414, 1415, 1215, 1236, 1288,
 /*   140 */  1215, 1215, 1215, 1215, 1516, 1515, 1215, 1215, 1246, 1405,
 /*   150 */  1404, 1416, 1417, 1427, 1426, 1505, 1563, 1562, 1463, 1215,
 /*   160 */  1215, 1215, 1215, 1215, 1215, 1215, 1528, 1215, 1215, 1215,
 /*   170 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   180 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   190 */  1215, 1528, 1528, 1215, 1246, 1528, 1528, 1242, 1242, 1348,
 /*   200 */  1215, 1511, 1315, 1315, 1315, 1315, 1324, 1315, 1215, 1215,
 /*   210 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   220 */  1215, 1215, 1502, 1500, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   230 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   240 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   250 */  1215, 1215, 1320, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   260 */  1215, 1215, 1215, 1215, 1557, 1215, 1475, 1302, 1320, 1320,
 /*   270 */  1320, 1320, 1322, 1303, 1301, 1314, 1247, 1222, 1602, 1380,
 /*   280 */  1369, 1321, 1343, 1369, 1343, 1599, 1367, 1380, 1380, 1367,
 /*   290 */  1380, 1321, 1599, 1263, 1579, 1258, 1354, 1354, 1354, 1343,
 /*   300 */  1348, 1348, 1442, 1321, 1314, 1215, 1602, 1329, 1329, 1601,
 /*   310 */  1601, 1329, 1463, 1586, 1389, 1291, 1297, 1297, 1297, 1297,
 /*   320 */  1329, 1233, 1367, 1586, 1586, 1367, 1389, 1291, 1367, 1291,
 /*   330 */  1367, 1329, 1233, 1479, 1596, 1329, 1233, 1453, 1329, 1233,
 /*   340 */  1329, 1233, 1453, 1289, 1289, 1289, 1278, 1215, 1215, 1453,
 /*   350 */  1289, 1263, 1289, 1278, 1289, 1289, 1546, 1453, 1457, 1457,
 /*   360 */  1453, 1347, 1342, 1347, 1342, 1347, 1342, 1347, 1342, 1329,
 /*   370 */  1538, 1538, 1357, 1357, 1362, 1348, 1448, 1329, 1215, 1362,
 /*   380 */  1360, 1358, 1367, 1239, 1281, 1560, 1560, 1556, 1556, 1556,
 /*   390 */  1607, 1607, 1511, 1572, 1246, 1246, 1246, 1246, 1572, 1265,
 /*   400 */  1265, 1247, 1247, 1246, 1572, 1215, 1215, 1215, 1215, 1215,
 /*   410 */  1215, 1567, 1215, 1464, 1333, 1215, 1215, 1215, 1215, 1215,
 /*   420 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   430 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1394,
 /*   440 */  1215, 1218, 1508, 1215, 1215, 1506, 1215, 1215, 1215, 1215,
 /*   450 */  1215, 1215, 1371, 1372, 1334, 1215, 1215, 1215, 1215, 1215,
 /*   460 */  1215, 1215, 1386, 1215, 1215, 1215, 1381, 1215, 1215, 1215,
 /*   470 */  1215, 1215, 1215, 1215, 1215, 1598, 1215, 1215, 1215, 1215,
 /*   480 */  1215, 1215, 1478, 1477, 1215, 1215, 1331, 1215, 1215, 1215,
 /*   490 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   500 */  1261, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   510 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   520 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1359, 1215, 1215,
 /*   530 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   540 */  1215, 1215, 1543, 1349, 1215, 1215, 1589, 1215, 1215, 1215,
 /*   550 */  1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
 /*   560 */  1215, 1583, 1305, 1396, 1215, 1395, 1399, 1215, 1227, 1215,
 /*   570 */  1215,
};
/********** 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.







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


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







157620
157621
157622
157623
157624
157625
157626
157627
157628
157629
157630
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
 /*   150 */   835, -262, -262, -262, -262, -207, -207, -207,  126, -164,
 /*   160 */  -170,  416,  708,  856, -158,  504,   74, -169,  446,  446,
 /*   170 */  -187,  328,  700,  707,  239,  282,  331,  556,  721,  438,
 /*   180 */   193,  860,  322,  541,  880,  933,  975,  241,  651,  879,
 /*   190 */   970,  270,  905,  918,   88,  914,  961,  967, 1069,  -39,
 /*   200 */   604, 1050, 1091, 1098, 1115, 1122, 1117, 1141, -211, -206,
 /*   210 */  -180, -130, -161,   10,  179,  236,  316,  341,  629,  726,
 /*   220 */   804,  816,  834,  898,  972, 1177, 1231, 1253, 1285,  170,
 /*   230 */  1298, 1336, 1345, 1347, 1357, 1362, 1364, 1369, 1371, 1376,
 /*   240 */  1382, 1413,  240,  257, 1053, 1417, 1422, 1423, 1430, 1012,
 /*   250 */  1431, 1432, 1438, 1166, 1156, 1418, 1439, 1355, 1440,  179,
 /*   260 */  1441, 1442, 1443, 1444, 1445, 1446, 1246, 1356, 1400, 1389,
 /*   270 */  1392, 1394, 1395, 1012, 1400, 1400, 1403, 1448, 1453, 1351,
 /*   280 */  1380, 1385, 1409, 1396, 1398, 1399, 1363, 1420, 1388, 1407,
 /*   290 */  1424, 1408, 1412, 1367, 1451, 1452, 1449, 1454, 1464, 1468,
 /*   300 */  1404, 1419, 1450, 1387, 1427, 1457, 1491, 1405, 1406, 1492,
 /*   310 */  1493, 1410, 1415, 1496, 1425, 1435, 1456, 1477, 1478, 1479,
 /*   320 */  1481, 1490, 1516, 1529, 1484, 1460, 1462, 1487, 1467, 1504,
 /*   330 */  1494, 1505, 1498, 1535, 1542, 1455, 1465, 1545, 1550, 1530,
 /*   340 */  1551, 1553, 1554, 1556, 1536, 1543, 1544, 1547, 1532, 1546,
 /*   350 */  1555, 1557, 1558, 1563, 1559, 1560, 1567, 1568, 1483, 1573,
 /*   360 */  1507, 1514, 1576, 1511, 1524, 1538, 1540, 1561, 1564, 1562,
 /*   370 */  1565, 1597, 1486, 1489, 1569, 1570, 1571, 1577, 1533, 1608,
 /*   380 */  1534, 1582, 1572, 1586, 1590, 1613, 1616, 1643, 1644, 1648,
 /*   390 */  1649, 1652, 1575, 1578, 1583, 1637, 1633, 1634, 1635, 1638,
 /*   400 */  1645, 1631, 1632, 1647, 1653, 1642, 1655,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */  1615, 1615, 1615, 1449, 1219, 1328, 1219, 1219, 1219, 1449,
 /*    10 */  1449, 1449, 1219, 1358, 1358, 1502, 1250, 1219, 1219, 1219,
 /*    20 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1448, 1219, 1219,
 /*    30 */  1219, 1219, 1533, 1533, 1219, 1219, 1219, 1219, 1219, 1219,
 /*    40 */  1219, 1219, 1219, 1367, 1219, 1374, 1219, 1219, 1219, 1219,
 /*    50 */  1219, 1450, 1451, 1219, 1219, 1219, 1501, 1503, 1466, 1381,
 /*    60 */  1380, 1379, 1378, 1484, 1345, 1372, 1365, 1369, 1444, 1445,
 /*    70 */  1443, 1447, 1451, 1450, 1219, 1368, 1415, 1429, 1414, 1219,
 /*    80 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*    90 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   100 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   110 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   120 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1423, 1428,
 /*   130 */  1434, 1427, 1424, 1417, 1416, 1418, 1419, 1219, 1240, 1292,
 /*   140 */  1219, 1219, 1219, 1219, 1521, 1520, 1219, 1219, 1250, 1409,
 /*   150 */  1408, 1420, 1421, 1431, 1430, 1509, 1568, 1567, 1467, 1219,
 /*   160 */  1219, 1219, 1219, 1219, 1219, 1219, 1533, 1219, 1219, 1219,
 /*   170 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   180 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   190 */  1219, 1533, 1533, 1219, 1250, 1533, 1533, 1246, 1246, 1352,
 /*   200 */  1219, 1516, 1319, 1319, 1319, 1319, 1328, 1319, 1219, 1219,
 /*   210 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   220 */  1219, 1219, 1219, 1506, 1504, 1219, 1219, 1219, 1219, 1219,
 /*   230 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   240 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   250 */  1219, 1219, 1219, 1324, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   260 */  1219, 1219, 1219, 1219, 1219, 1562, 1219, 1479, 1306, 1324,
 /*   270 */  1324, 1324, 1324, 1326, 1307, 1305, 1318, 1251, 1226, 1607,
 /*   280 */  1384, 1373, 1325, 1347, 1373, 1347, 1604, 1371, 1384, 1384,
 /*   290 */  1371, 1384, 1325, 1604, 1267, 1584, 1262, 1358, 1358, 1358,
 /*   300 */  1347, 1352, 1352, 1446, 1325, 1318, 1219, 1607, 1607, 1333,
 /*   310 */  1333, 1606, 1606, 1333, 1467, 1591, 1393, 1295, 1301, 1301,
 /*   320 */  1301, 1301, 1333, 1237, 1371, 1591, 1591, 1371, 1393, 1295,
 /*   330 */  1371, 1295, 1371, 1333, 1237, 1483, 1601, 1333, 1237, 1457,
 /*   340 */  1333, 1237, 1333, 1237, 1457, 1293, 1293, 1293, 1282, 1219,
 /*   350 */  1219, 1457, 1293, 1267, 1293, 1282, 1293, 1293, 1551, 1457,
 /*   360 */  1461, 1461, 1457, 1351, 1346, 1351, 1346, 1351, 1346, 1351,
 /*   370 */  1346, 1333, 1543, 1543, 1361, 1361, 1366, 1352, 1452, 1333,
 /*   380 */  1219, 1366, 1364, 1362, 1371, 1243, 1285, 1565, 1565, 1561,
 /*   390 */  1561, 1561, 1612, 1612, 1516, 1577, 1250, 1250, 1250, 1250,
 /*   400 */  1577, 1269, 1269, 1251, 1251, 1250, 1577, 1219, 1219, 1219,
 /*   410 */  1219, 1219, 1219, 1572, 1219, 1511, 1468, 1337, 1219, 1219,
 /*   420 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   430 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   440 */  1219, 1219, 1398, 1219, 1222, 1513, 1219, 1219, 1219, 1219,
 /*   450 */  1219, 1219, 1219, 1219, 1375, 1376, 1338, 1219, 1219, 1219,
 /*   460 */  1219, 1219, 1219, 1219, 1390, 1219, 1219, 1219, 1385, 1219,
 /*   470 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1603, 1219, 1219,
 /*   480 */  1219, 1219, 1219, 1219, 1482, 1481, 1219, 1219, 1335, 1219,
 /*   490 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   500 */  1219, 1219, 1265, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   510 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   520 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1363,
 /*   530 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   540 */  1219, 1219, 1219, 1219, 1548, 1353, 1219, 1219, 1594, 1219,
 /*   550 */  1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219, 1219,
 /*   560 */  1219, 1219, 1219, 1588, 1309, 1400, 1219, 1399, 1403, 1219,
 /*   570 */  1231, 1219, 1219,
};
/********** 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.
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
 /* 281 */ "key_opt ::= KEY expr",
 /* 282 */ "cmd ::= REINDEX",
 /* 283 */ "cmd ::= REINDEX nm dbnm",
 /* 284 */ "cmd ::= ANALYZE",
 /* 285 */ "cmd ::= ANALYZE nm dbnm",
 /* 286 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
 /* 287 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",

 /* 288 */ "add_column_fullname ::= fullname",
 /* 289 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
 /* 290 */ "cmd ::= create_vtab",
 /* 291 */ "cmd ::= create_vtab LP vtabarglist RP",
 /* 292 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
 /* 293 */ "vtabarg ::=",
 /* 294 */ "vtabargtoken ::= ANY",
 /* 295 */ "vtabargtoken ::= lp anylist RP",
 /* 296 */ "lp ::= LP",
 /* 297 */ "with ::= WITH wqlist",
 /* 298 */ "with ::= WITH RECURSIVE wqlist",
 /* 299 */ "wqlist ::= nm eidlist_opt AS LP select RP",
 /* 300 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
 /* 301 */ "windowdefn_list ::= windowdefn",
 /* 302 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
 /* 303 */ "windowdefn ::= nm AS LP window RP",
 /* 304 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
 /* 305 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
 /* 306 */ "window ::= ORDER BY sortlist frame_opt",
 /* 307 */ "window ::= nm ORDER BY sortlist frame_opt",
 /* 308 */ "window ::= frame_opt",
 /* 309 */ "window ::= nm frame_opt",
 /* 310 */ "frame_opt ::=",
 /* 311 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
 /* 312 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
 /* 313 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
 /* 314 */ "frame_bound_s ::= frame_bound",
 /* 315 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
 /* 316 */ "frame_bound_e ::= frame_bound",
 /* 317 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
 /* 318 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
 /* 319 */ "frame_bound ::= CURRENT ROW",
 /* 320 */ "frame_exclude_opt ::=",
 /* 321 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
 /* 322 */ "frame_exclude ::= NO OTHERS",
 /* 323 */ "frame_exclude ::= CURRENT ROW",
 /* 324 */ "frame_exclude ::= GROUP|TIES",
 /* 325 */ "window_clause ::= WINDOW windowdefn_list",
 /* 326 */ "filter_over ::= filter_clause over_clause",
 /* 327 */ "filter_over ::= over_clause",
 /* 328 */ "filter_over ::= filter_clause",
 /* 329 */ "over_clause ::= OVER LP window RP",
 /* 330 */ "over_clause ::= OVER nm",
 /* 331 */ "filter_clause ::= FILTER LP WHERE expr RP",
 /* 332 */ "input ::= cmdlist",
 /* 333 */ "cmdlist ::= cmdlist ecmd",
 /* 334 */ "cmdlist ::= ecmd",
 /* 335 */ "ecmd ::= SEMI",
 /* 336 */ "ecmd ::= cmdx SEMI",
 /* 337 */ "ecmd ::= explain cmdx SEMI",
 /* 338 */ "trans_opt ::=",
 /* 339 */ "trans_opt ::= TRANSACTION",
 /* 340 */ "trans_opt ::= TRANSACTION nm",
 /* 341 */ "savepoint_opt ::= SAVEPOINT",
 /* 342 */ "savepoint_opt ::=",
 /* 343 */ "cmd ::= create_table create_table_args",
 /* 344 */ "columnlist ::= columnlist COMMA columnname carglist",
 /* 345 */ "columnlist ::= columnname carglist",
 /* 346 */ "nm ::= ID|INDEXED",
 /* 347 */ "nm ::= STRING",
 /* 348 */ "nm ::= JOIN_KW",
 /* 349 */ "typetoken ::= typename",
 /* 350 */ "typename ::= ID|STRING",
 /* 351 */ "signed ::= plus_num",
 /* 352 */ "signed ::= minus_num",
 /* 353 */ "carglist ::= carglist ccons",
 /* 354 */ "carglist ::=",
 /* 355 */ "ccons ::= NULL onconf",
 /* 356 */ "ccons ::= GENERATED ALWAYS AS generated",
 /* 357 */ "ccons ::= AS generated",
 /* 358 */ "conslist_opt ::= COMMA conslist",
 /* 359 */ "conslist ::= conslist tconscomma tcons",
 /* 360 */ "conslist ::= tcons",
 /* 361 */ "tconscomma ::=",
 /* 362 */ "defer_subclause_opt ::= defer_subclause",
 /* 363 */ "resolvetype ::= raisetype",
 /* 364 */ "selectnowith ::= oneselect",
 /* 365 */ "oneselect ::= values",
 /* 366 */ "sclp ::= selcollist COMMA",
 /* 367 */ "as ::= ID|STRING",
 /* 368 */ "returning ::=",
 /* 369 */ "expr ::= term",
 /* 370 */ "likeop ::= LIKE_KW|MATCH",
 /* 371 */ "exprlist ::= nexprlist",
 /* 372 */ "nmnum ::= plus_num",
 /* 373 */ "nmnum ::= nm",
 /* 374 */ "nmnum ::= ON",
 /* 375 */ "nmnum ::= DELETE",
 /* 376 */ "nmnum ::= DEFAULT",

 /* 377 */ "plus_num ::= INTEGER|FLOAT",
 /* 378 */ "foreach_clause ::=",
 /* 379 */ "foreach_clause ::= FOR EACH ROW",
 /* 380 */ "trnm ::= nm",
 /* 381 */ "tridxby ::=",
 /* 382 */ "database_kw_opt ::= DATABASE",
 /* 383 */ "database_kw_opt ::=",
 /* 384 */ "kwcolumn_opt ::=",
 /* 385 */ "kwcolumn_opt ::= COLUMNKW",
 /* 386 */ "vtabarglist ::= vtabarg",
 /* 387 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
 /* 388 */ "vtabarg ::= vtabarg vtabargtoken",
 /* 389 */ "anylist ::=",
 /* 390 */ "anylist ::= anylist LP anylist RP",
 /* 391 */ "anylist ::= anylist ANY",
 /* 392 */ "with ::=",
};
#endif /* NDEBUG */


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







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







158596
158597
158598
158599
158600
158601
158602
158603
158604
158605
158606
158607
158608
158609
158610
158611
158612
158613
158614
158615
158616
158617
158618
158619
158620
158621
158622
158623
158624
158625
158626
158627
158628
158629
158630
158631
158632
158633
158634
158635
158636
158637
158638
158639
158640
158641
158642
158643
158644
158645
158646
158647
158648
158649
158650
158651
158652
158653
158654
158655
158656
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
 /* 281 */ "key_opt ::= KEY expr",
 /* 282 */ "cmd ::= REINDEX",
 /* 283 */ "cmd ::= REINDEX nm dbnm",
 /* 284 */ "cmd ::= ANALYZE",
 /* 285 */ "cmd ::= ANALYZE nm dbnm",
 /* 286 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
 /* 287 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
 /* 288 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
 /* 289 */ "add_column_fullname ::= fullname",
 /* 290 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
 /* 291 */ "cmd ::= create_vtab",
 /* 292 */ "cmd ::= create_vtab LP vtabarglist RP",
 /* 293 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
 /* 294 */ "vtabarg ::=",
 /* 295 */ "vtabargtoken ::= ANY",
 /* 296 */ "vtabargtoken ::= lp anylist RP",
 /* 297 */ "lp ::= LP",
 /* 298 */ "with ::= WITH wqlist",
 /* 299 */ "with ::= WITH RECURSIVE wqlist",
 /* 300 */ "wqlist ::= nm eidlist_opt AS LP select RP",
 /* 301 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
 /* 302 */ "windowdefn_list ::= windowdefn",
 /* 303 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
 /* 304 */ "windowdefn ::= nm AS LP window RP",
 /* 305 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
 /* 306 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
 /* 307 */ "window ::= ORDER BY sortlist frame_opt",
 /* 308 */ "window ::= nm ORDER BY sortlist frame_opt",
 /* 309 */ "window ::= frame_opt",
 /* 310 */ "window ::= nm frame_opt",
 /* 311 */ "frame_opt ::=",
 /* 312 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
 /* 313 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
 /* 314 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
 /* 315 */ "frame_bound_s ::= frame_bound",
 /* 316 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
 /* 317 */ "frame_bound_e ::= frame_bound",
 /* 318 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
 /* 319 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
 /* 320 */ "frame_bound ::= CURRENT ROW",
 /* 321 */ "frame_exclude_opt ::=",
 /* 322 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
 /* 323 */ "frame_exclude ::= NO OTHERS",
 /* 324 */ "frame_exclude ::= CURRENT ROW",
 /* 325 */ "frame_exclude ::= GROUP|TIES",
 /* 326 */ "window_clause ::= WINDOW windowdefn_list",
 /* 327 */ "filter_over ::= filter_clause over_clause",
 /* 328 */ "filter_over ::= over_clause",
 /* 329 */ "filter_over ::= filter_clause",
 /* 330 */ "over_clause ::= OVER LP window RP",
 /* 331 */ "over_clause ::= OVER nm",
 /* 332 */ "filter_clause ::= FILTER LP WHERE expr RP",
 /* 333 */ "input ::= cmdlist",
 /* 334 */ "cmdlist ::= cmdlist ecmd",
 /* 335 */ "cmdlist ::= ecmd",
 /* 336 */ "ecmd ::= SEMI",
 /* 337 */ "ecmd ::= cmdx SEMI",
 /* 338 */ "ecmd ::= explain cmdx SEMI",
 /* 339 */ "trans_opt ::=",
 /* 340 */ "trans_opt ::= TRANSACTION",
 /* 341 */ "trans_opt ::= TRANSACTION nm",
 /* 342 */ "savepoint_opt ::= SAVEPOINT",
 /* 343 */ "savepoint_opt ::=",
 /* 344 */ "cmd ::= create_table create_table_args",
 /* 345 */ "columnlist ::= columnlist COMMA columnname carglist",
 /* 346 */ "columnlist ::= columnname carglist",
 /* 347 */ "nm ::= ID|INDEXED",
 /* 348 */ "nm ::= STRING",
 /* 349 */ "nm ::= JOIN_KW",
 /* 350 */ "typetoken ::= typename",
 /* 351 */ "typename ::= ID|STRING",
 /* 352 */ "signed ::= plus_num",
 /* 353 */ "signed ::= minus_num",
 /* 354 */ "carglist ::= carglist ccons",
 /* 355 */ "carglist ::=",
 /* 356 */ "ccons ::= NULL onconf",
 /* 357 */ "ccons ::= GENERATED ALWAYS AS generated",
 /* 358 */ "ccons ::= AS generated",
 /* 359 */ "conslist_opt ::= COMMA conslist",
 /* 360 */ "conslist ::= conslist tconscomma tcons",
 /* 361 */ "conslist ::= tcons",
 /* 362 */ "tconscomma ::=",
 /* 363 */ "defer_subclause_opt ::= defer_subclause",
 /* 364 */ "resolvetype ::= raisetype",
 /* 365 */ "selectnowith ::= oneselect",
 /* 366 */ "oneselect ::= values",
 /* 367 */ "sclp ::= selcollist COMMA",
 /* 368 */ "as ::= ID|STRING",
 /* 369 */ "returning ::=",
 /* 370 */ "expr ::= term",
 /* 371 */ "likeop ::= LIKE_KW|MATCH",
 /* 372 */ "exprlist ::= nexprlist",

 /* 373 */ "nmnum ::= plus_num",
 /* 374 */ "nmnum ::= nm",
 /* 375 */ "nmnum ::= ON",
 /* 376 */ "nmnum ::= DELETE",
 /* 377 */ "nmnum ::= DEFAULT",
 /* 378 */ "plus_num ::= INTEGER|FLOAT",
 /* 379 */ "foreach_clause ::=",
 /* 380 */ "foreach_clause ::= FOR EACH ROW",
 /* 381 */ "trnm ::= nm",
 /* 382 */ "tridxby ::=",
 /* 383 */ "database_kw_opt ::= DATABASE",
 /* 384 */ "database_kw_opt ::=",
 /* 385 */ "kwcolumn_opt ::=",
 /* 386 */ "kwcolumn_opt ::= COLUMNKW",
 /* 387 */ "vtabarglist ::= vtabarg",
 /* 388 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
 /* 389 */ "vtabarg ::= vtabarg vtabargtoken",
 /* 390 */ "anylist ::=",
 /* 391 */ "anylist ::= anylist LP anylist RP",
 /* 392 */ "anylist ::= anylist ANY",
 /* 393 */ "with ::=",
};
#endif /* NDEBUG */


#if YYSTACKDEPTH<=0
/*
** Try to increase the size of the parser stack.  Return the number
159223
159224
159225
159226
159227
159228
159229

159230
159231
159232
159233
159234
159235
159236
159237
159238
159239
159240
159241
159242
159243
159244
159245
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
   291,  /* (281) key_opt ::= KEY expr */
   187,  /* (282) cmd ::= REINDEX */
   187,  /* (283) cmd ::= REINDEX nm dbnm */
   187,  /* (284) cmd ::= ANALYZE */
   187,  /* (285) cmd ::= ANALYZE nm dbnm */
   187,  /* (286) cmd ::= ALTER TABLE fullname RENAME TO nm */
   187,  /* (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */

   292,  /* (288) add_column_fullname ::= fullname */
   187,  /* (289) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
   187,  /* (290) cmd ::= create_vtab */
   187,  /* (291) cmd ::= create_vtab LP vtabarglist RP */
   294,  /* (292) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
   296,  /* (293) vtabarg ::= */
   297,  /* (294) vtabargtoken ::= ANY */
   297,  /* (295) vtabargtoken ::= lp anylist RP */
   298,  /* (296) lp ::= LP */
   262,  /* (297) with ::= WITH wqlist */
   262,  /* (298) with ::= WITH RECURSIVE wqlist */
   237,  /* (299) wqlist ::= nm eidlist_opt AS LP select RP */
   237,  /* (300) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
   300,  /* (301) windowdefn_list ::= windowdefn */
   300,  /* (302) windowdefn_list ::= windowdefn_list COMMA windowdefn */
   301,  /* (303) windowdefn ::= nm AS LP window RP */
   302,  /* (304) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
   302,  /* (305) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
   302,  /* (306) window ::= ORDER BY sortlist frame_opt */
   302,  /* (307) window ::= nm ORDER BY sortlist frame_opt */
   302,  /* (308) window ::= frame_opt */
   302,  /* (309) window ::= nm frame_opt */
   303,  /* (310) frame_opt ::= */
   303,  /* (311) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
   303,  /* (312) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
   307,  /* (313) range_or_rows ::= RANGE|ROWS|GROUPS */
   309,  /* (314) frame_bound_s ::= frame_bound */
   309,  /* (315) frame_bound_s ::= UNBOUNDED PRECEDING */
   310,  /* (316) frame_bound_e ::= frame_bound */
   310,  /* (317) frame_bound_e ::= UNBOUNDED FOLLOWING */
   308,  /* (318) frame_bound ::= expr PRECEDING|FOLLOWING */
   308,  /* (319) frame_bound ::= CURRENT ROW */
   311,  /* (320) frame_exclude_opt ::= */
   311,  /* (321) frame_exclude_opt ::= EXCLUDE frame_exclude */
   312,  /* (322) frame_exclude ::= NO OTHERS */
   312,  /* (323) frame_exclude ::= CURRENT ROW */
   312,  /* (324) frame_exclude ::= GROUP|TIES */
   247,  /* (325) window_clause ::= WINDOW windowdefn_list */
   269,  /* (326) filter_over ::= filter_clause over_clause */
   269,  /* (327) filter_over ::= over_clause */
   269,  /* (328) filter_over ::= filter_clause */
   306,  /* (329) over_clause ::= OVER LP window RP */
   306,  /* (330) over_clause ::= OVER nm */
   305,  /* (331) filter_clause ::= FILTER LP WHERE expr RP */
   182,  /* (332) input ::= cmdlist */
   183,  /* (333) cmdlist ::= cmdlist ecmd */
   183,  /* (334) cmdlist ::= ecmd */
   184,  /* (335) ecmd ::= SEMI */
   184,  /* (336) ecmd ::= cmdx SEMI */
   184,  /* (337) ecmd ::= explain cmdx SEMI */
   189,  /* (338) trans_opt ::= */
   189,  /* (339) trans_opt ::= TRANSACTION */
   189,  /* (340) trans_opt ::= TRANSACTION nm */
   191,  /* (341) savepoint_opt ::= SAVEPOINT */
   191,  /* (342) savepoint_opt ::= */
   187,  /* (343) cmd ::= create_table create_table_args */
   198,  /* (344) columnlist ::= columnlist COMMA columnname carglist */
   198,  /* (345) columnlist ::= columnname carglist */
   190,  /* (346) nm ::= ID|INDEXED */
   190,  /* (347) nm ::= STRING */
   190,  /* (348) nm ::= JOIN_KW */

   204,  /* (349) typetoken ::= typename */
   205,  /* (350) typename ::= ID|STRING */
   206,  /* (351) signed ::= plus_num */
   206,  /* (352) signed ::= minus_num */
   203,  /* (353) carglist ::= carglist ccons */
   203,  /* (354) carglist ::= */
   211,  /* (355) ccons ::= NULL onconf */
   211,  /* (356) ccons ::= GENERATED ALWAYS AS generated */
   211,  /* (357) ccons ::= AS generated */
   199,  /* (358) conslist_opt ::= COMMA conslist */
   224,  /* (359) conslist ::= conslist tconscomma tcons */
   224,  /* (360) conslist ::= tcons */
   225,  /* (361) tconscomma ::= */
   229,  /* (362) defer_subclause_opt ::= defer_subclause */
   231,  /* (363) resolvetype ::= raisetype */
   235,  /* (364) selectnowith ::= oneselect */
   236,  /* (365) oneselect ::= values */
   250,  /* (366) sclp ::= selcollist COMMA */
   251,  /* (367) as ::= ID|STRING */
   268,  /* (368) returning ::= */
   213,  /* (369) expr ::= term */
   270,  /* (370) likeop ::= LIKE_KW|MATCH */
   258,  /* (371) exprlist ::= nexprlist */
   280,  /* (372) nmnum ::= plus_num */
   280,  /* (373) nmnum ::= nm */
   280,  /* (374) nmnum ::= ON */
   280,  /* (375) nmnum ::= DELETE */
   280,  /* (376) nmnum ::= DEFAULT */

   207,  /* (377) plus_num ::= INTEGER|FLOAT */
   285,  /* (378) foreach_clause ::= */
   285,  /* (379) foreach_clause ::= FOR EACH ROW */
   288,  /* (380) trnm ::= nm */
   289,  /* (381) tridxby ::= */
   290,  /* (382) database_kw_opt ::= DATABASE */
   290,  /* (383) database_kw_opt ::= */
   293,  /* (384) kwcolumn_opt ::= */
   293,  /* (385) kwcolumn_opt ::= COLUMNKW */
   295,  /* (386) vtabarglist ::= vtabarg */
   295,  /* (387) vtabarglist ::= vtabarglist COMMA vtabarg */
   296,  /* (388) vtabarg ::= vtabarg vtabargtoken */
   299,  /* (389) anylist ::= */
   299,  /* (390) anylist ::= anylist LP anylist RP */
   299,  /* (391) anylist ::= anylist ANY */
   262,  /* (392) 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 */







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







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

   190,  /* (347) nm ::= ID|INDEXED */
   190,  /* (348) nm ::= STRING */
   190,  /* (349) nm ::= JOIN_KW */
   204,  /* (350) typetoken ::= typename */
   205,  /* (351) typename ::= ID|STRING */
   206,  /* (352) signed ::= plus_num */
   206,  /* (353) signed ::= minus_num */
   203,  /* (354) carglist ::= carglist ccons */
   203,  /* (355) carglist ::= */
   211,  /* (356) ccons ::= NULL onconf */
   211,  /* (357) ccons ::= GENERATED ALWAYS AS generated */
   211,  /* (358) ccons ::= AS generated */
   199,  /* (359) conslist_opt ::= COMMA conslist */
   224,  /* (360) conslist ::= conslist tconscomma tcons */
   224,  /* (361) conslist ::= tcons */
   225,  /* (362) tconscomma ::= */
   229,  /* (363) defer_subclause_opt ::= defer_subclause */
   231,  /* (364) resolvetype ::= raisetype */
   235,  /* (365) selectnowith ::= oneselect */
   236,  /* (366) oneselect ::= values */
   250,  /* (367) sclp ::= selcollist COMMA */
   251,  /* (368) as ::= ID|STRING */
   268,  /* (369) returning ::= */
   213,  /* (370) expr ::= term */
   270,  /* (371) likeop ::= LIKE_KW|MATCH */
   258,  /* (372) exprlist ::= nexprlist */

   280,  /* (373) nmnum ::= plus_num */
   280,  /* (374) nmnum ::= nm */
   280,  /* (375) nmnum ::= ON */
   280,  /* (376) nmnum ::= DELETE */
   280,  /* (377) nmnum ::= DEFAULT */
   207,  /* (378) plus_num ::= INTEGER|FLOAT */
   285,  /* (379) foreach_clause ::= */
   285,  /* (380) foreach_clause ::= FOR EACH ROW */
   288,  /* (381) trnm ::= nm */
   289,  /* (382) tridxby ::= */
   290,  /* (383) database_kw_opt ::= DATABASE */
   290,  /* (384) database_kw_opt ::= */
   293,  /* (385) kwcolumn_opt ::= */
   293,  /* (386) kwcolumn_opt ::= COLUMNKW */
   295,  /* (387) vtabarglist ::= vtabarg */
   295,  /* (388) vtabarglist ::= vtabarglist COMMA vtabarg */
   296,  /* (389) vtabarg ::= vtabarg vtabargtoken */
   299,  /* (390) anylist ::= */
   299,  /* (391) anylist ::= anylist LP anylist RP */
   299,  /* (392) anylist ::= anylist ANY */
   262,  /* (393) 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 */
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
   -2,  /* (281) key_opt ::= KEY expr */
   -1,  /* (282) cmd ::= REINDEX */
   -3,  /* (283) cmd ::= REINDEX nm dbnm */
   -1,  /* (284) cmd ::= ANALYZE */
   -3,  /* (285) cmd ::= ANALYZE nm dbnm */
   -6,  /* (286) cmd ::= ALTER TABLE fullname RENAME TO nm */
   -7,  /* (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */

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

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

   -1,  /* (377) plus_num ::= INTEGER|FLOAT */
    0,  /* (378) foreach_clause ::= */
   -3,  /* (379) foreach_clause ::= FOR EACH ROW */
   -1,  /* (380) trnm ::= nm */
    0,  /* (381) tridxby ::= */
   -1,  /* (382) database_kw_opt ::= DATABASE */
    0,  /* (383) database_kw_opt ::= */
    0,  /* (384) kwcolumn_opt ::= */
   -1,  /* (385) kwcolumn_opt ::= COLUMNKW */
   -1,  /* (386) vtabarglist ::= vtabarg */
   -3,  /* (387) vtabarglist ::= vtabarglist COMMA vtabarg */
   -2,  /* (388) vtabarg ::= vtabarg vtabargtoken */
    0,  /* (389) anylist ::= */
   -4,  /* (390) anylist ::= anylist LP anylist RP */
   -2,  /* (391) anylist ::= anylist ANY */
    0,  /* (392) with ::= */
};

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

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







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







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

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

   -1,  /* (373) nmnum ::= plus_num */
   -1,  /* (374) nmnum ::= nm */
   -1,  /* (375) nmnum ::= ON */
   -1,  /* (376) nmnum ::= DELETE */
   -1,  /* (377) nmnum ::= DEFAULT */
   -1,  /* (378) plus_num ::= INTEGER|FLOAT */
    0,  /* (379) foreach_clause ::= */
   -3,  /* (380) foreach_clause ::= FOR EACH ROW */
   -1,  /* (381) trnm ::= nm */
    0,  /* (382) tridxby ::= */
   -1,  /* (383) database_kw_opt ::= DATABASE */
    0,  /* (384) database_kw_opt ::= */
    0,  /* (385) kwcolumn_opt ::= */
   -1,  /* (386) kwcolumn_opt ::= COLUMNKW */
   -1,  /* (387) vtabarglist ::= vtabarg */
   -3,  /* (388) vtabarglist ::= vtabarglist COMMA vtabarg */
   -2,  /* (389) vtabarg ::= vtabarg vtabargtoken */
    0,  /* (390) anylist ::= */
   -4,  /* (391) anylist ::= anylist LP anylist RP */
   -2,  /* (392) anylist ::= anylist ANY */
    0,  /* (393) with ::= */
};

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

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
159785
159786
159787
159788
159789
159790
159791
159792
159793
159794
159795
159796
159797
159798
159799
        break;
      case 4: /* transtype ::= */
{yymsp[1].minor.yy412 = TK_DEFERRED;}
        break;
      case 5: /* transtype ::= DEFERRED */
      case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
      case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
      case 313: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==313);
{yymsp[0].minor.yy412 = 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 */







|







160062
160063
160064
160065
160066
160067
160068
160069
160070
160071
160072
160073
160074
160075
160076
        break;
      case 4: /* transtype ::= */
{yymsp[1].minor.yy412 = TK_DEFERRED;}
        break;
      case 5: /* transtype ::= DEFERRED */
      case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
      case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
      case 314: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==314);
{yymsp[0].minor.yy412 = 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 */
160962
160963
160964
160965
160966
160967
160968





160969
160970
160971
160972
160973
160974
160975
160976
160977
160978
160979
160980
160981
160982
160983
160984
160985
160986
160987
160988
160989
160990
160991
160992
160993
160994
160995
160996
160997
160998
160999
161000
161001
161002
161003
161004
161005
161006
161007
161008
161009
161010
161011
161012
161013
161014
161015
161016
161017
161018
161019
161020
161021
161022
161023
161024
161025
161026
161027
161028
161029
161030
161031
161032
161033
161034
161035
161036
161037
161038
161039
161040
161041
161042
161043
161044
161045
161046
161047
161048
161049
161050
161051
161052
161053
161054
161055
161056
161057
161058
161059
161060
161061
161062
161063
161064
161065
161066
161067
161068
161069
161070
161071
161072
161073
161074
161075
161076
161077
161078
161079
161080
161081
161082
161083
161084
161085
161086
161087
161088
161089
161090
161091
161092
161093
161094
161095
161096
161097
161098
161099
161100
161101
161102
161103
161104
161105
161106
161107
161108
161109
161110
161111
161112
161113
161114
161115
161116
161117
161118
161119
161120
161121
161122
161123
161124
161125
161126
161127
161128
161129
161130
161131
161132
161133
161134
161135
161136
161137
161138
161139
161140
161141
161142
161143
161144
161145
161146
161147
161148
161149
161150
161151
161152
161153
161154
161155
161156
161157
161158
161159
161160
161161
161162
161163
161164
161165
161166
161167
161168
161169
161170
161171
161172
161173
161174
161175
161176
161177
161178
161179
161180
161181
161182
161183
161184
161185
161186
161187
161188
161189
161190
161191
161192
161193
161194
161195
161196
161197
161198
161199
161200
161201
161202
161203
161204
161205
161206
161207
161208
161209
161210
161211
161212
161213
161214
161215
161216
161217
161218
161219
161220
161221
161222
        break;
      case 287: /* 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 288: /* add_column_fullname ::= fullname */
{
  disableLookaside(pParse);
  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy457);
}
        break;
      case 289: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
{
  sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy457, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
        break;
      case 290: /* cmd ::= create_vtab */
{sqlite3VtabFinishParse(pParse,0);}
        break;
      case 291: /* cmd ::= create_vtab LP vtabarglist RP */
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
        break;
      case 292: /* 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.yy412);
}
        break;
      case 293: /* vtabarg ::= */
{sqlite3VtabArgInit(pParse);}
        break;
      case 294: /* vtabargtoken ::= ANY */
      case 295: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==295);
      case 296: /* lp ::= LP */ yytestcase(yyruleno==296);
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
        break;
      case 297: /* with ::= WITH wqlist */
      case 298: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==298);
{ sqlite3WithPush(pParse, yymsp[0].minor.yy105, 1); }
        break;
      case 299: /* wqlist ::= nm eidlist_opt AS LP select RP */
{
  yymsp[-5].minor.yy105 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy350, yymsp[-1].minor.yy293); /*A-overwrites-X*/
}
        break;
      case 300: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
{
  yymsp[-7].minor.yy105 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy105, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy350, yymsp[-1].minor.yy293);
}
        break;
      case 301: /* windowdefn_list ::= windowdefn */
{ yylhsminor.yy503 = yymsp[0].minor.yy503; }
  yymsp[0].minor.yy503 = yylhsminor.yy503;
        break;
      case 302: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
{
  assert( yymsp[0].minor.yy503!=0 );
  sqlite3WindowChain(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy503);
  yymsp[0].minor.yy503->pNextWin = yymsp[-2].minor.yy503;
  yylhsminor.yy503 = yymsp[0].minor.yy503;
}
  yymsp[-2].minor.yy503 = yylhsminor.yy503;
        break;
      case 303: /* windowdefn ::= nm AS LP window RP */
{
  if( ALWAYS(yymsp[-1].minor.yy503) ){
    yymsp[-1].minor.yy503->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
  }
  yylhsminor.yy503 = yymsp[-1].minor.yy503;
}
  yymsp[-4].minor.yy503 = yylhsminor.yy503;
        break;
      case 304: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
{
  yymsp[-4].minor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy350, yymsp[-1].minor.yy350, 0);
}
        break;
      case 305: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
{
  yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy350, yymsp[-1].minor.yy350, &yymsp[-5].minor.yy0);
}
  yymsp[-5].minor.yy503 = yylhsminor.yy503;
        break;
      case 306: /* window ::= ORDER BY sortlist frame_opt */
{
  yymsp[-3].minor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, yymsp[-1].minor.yy350, 0);
}
        break;
      case 307: /* window ::= nm ORDER BY sortlist frame_opt */
{
  yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, yymsp[-1].minor.yy350, &yymsp[-4].minor.yy0);
}
  yymsp[-4].minor.yy503 = yylhsminor.yy503;
        break;
      case 308: /* window ::= frame_opt */
      case 327: /* filter_over ::= over_clause */ yytestcase(yyruleno==327);
{
  yylhsminor.yy503 = yymsp[0].minor.yy503;
}
  yymsp[0].minor.yy503 = yylhsminor.yy503;
        break;
      case 309: /* window ::= nm frame_opt */
{
  yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, 0, &yymsp[-1].minor.yy0);
}
  yymsp[-1].minor.yy503 = yylhsminor.yy503;
        break;
      case 310: /* frame_opt ::= */
{
  yymsp[1].minor.yy503 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
}
        break;
      case 311: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
{
  yylhsminor.yy503 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy412, yymsp[-1].minor.yy341.eType, yymsp[-1].minor.yy341.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy624);
}
  yymsp[-2].minor.yy503 = yylhsminor.yy503;
        break;
      case 312: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
{
  yylhsminor.yy503 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy412, yymsp[-3].minor.yy341.eType, yymsp[-3].minor.yy341.pExpr, yymsp[-1].minor.yy341.eType, yymsp[-1].minor.yy341.pExpr, yymsp[0].minor.yy624);
}
  yymsp[-5].minor.yy503 = yylhsminor.yy503;
        break;
      case 314: /* frame_bound_s ::= frame_bound */
      case 316: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==316);
{yylhsminor.yy341 = yymsp[0].minor.yy341;}
  yymsp[0].minor.yy341 = yylhsminor.yy341;
        break;
      case 315: /* frame_bound_s ::= UNBOUNDED PRECEDING */
      case 317: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==317);
      case 319: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==319);
{yylhsminor.yy341.eType = yymsp[-1].major; yylhsminor.yy341.pExpr = 0;}
  yymsp[-1].minor.yy341 = yylhsminor.yy341;
        break;
      case 318: /* frame_bound ::= expr PRECEDING|FOLLOWING */
{yylhsminor.yy341.eType = yymsp[0].major; yylhsminor.yy341.pExpr = yymsp[-1].minor.yy354;}
  yymsp[-1].minor.yy341 = yylhsminor.yy341;
        break;
      case 320: /* frame_exclude_opt ::= */
{yymsp[1].minor.yy624 = 0;}
        break;
      case 321: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
{yymsp[-1].minor.yy624 = yymsp[0].minor.yy624;}
        break;
      case 322: /* frame_exclude ::= NO OTHERS */
      case 323: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==323);
{yymsp[-1].minor.yy624 = yymsp[-1].major; /*A-overwrites-X*/}
        break;
      case 324: /* frame_exclude ::= GROUP|TIES */
{yymsp[0].minor.yy624 = yymsp[0].major; /*A-overwrites-X*/}
        break;
      case 325: /* window_clause ::= WINDOW windowdefn_list */
{ yymsp[-1].minor.yy503 = yymsp[0].minor.yy503; }
        break;
      case 326: /* filter_over ::= filter_clause over_clause */
{
  yymsp[0].minor.yy503->pFilter = yymsp[-1].minor.yy354;
  yylhsminor.yy503 = yymsp[0].minor.yy503;
}
  yymsp[-1].minor.yy503 = yylhsminor.yy503;
        break;
      case 328: /* filter_over ::= filter_clause */
{
  yylhsminor.yy503 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( yylhsminor.yy503 ){
    yylhsminor.yy503->eFrmType = TK_FILTER;
    yylhsminor.yy503->pFilter = yymsp[0].minor.yy354;
  }else{
    sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy354);
  }
}
  yymsp[0].minor.yy503 = yylhsminor.yy503;
        break;
      case 329: /* over_clause ::= OVER LP window RP */
{
  yymsp[-3].minor.yy503 = yymsp[-1].minor.yy503;
  assert( yymsp[-3].minor.yy503!=0 );
}
        break;
      case 330: /* over_clause ::= OVER nm */
{
  yymsp[-1].minor.yy503 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( yymsp[-1].minor.yy503 ){
    yymsp[-1].minor.yy503->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
  }
}
        break;
      case 331: /* filter_clause ::= FILTER LP WHERE expr RP */
{ yymsp[-4].minor.yy354 = yymsp[-1].minor.yy354; }
        break;
      default:
      /* (332) input ::= cmdlist */ yytestcase(yyruleno==332);
      /* (333) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==333);
      /* (334) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=334);
      /* (335) ecmd ::= SEMI */ yytestcase(yyruleno==335);
      /* (336) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==336);
      /* (337) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=337);
      /* (338) trans_opt ::= */ yytestcase(yyruleno==338);
      /* (339) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==339);
      /* (340) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==340);
      /* (341) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==341);
      /* (342) savepoint_opt ::= */ yytestcase(yyruleno==342);
      /* (343) cmd ::= create_table create_table_args */ yytestcase(yyruleno==343);
      /* (344) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==344);
      /* (345) columnlist ::= columnname carglist */ yytestcase(yyruleno==345);
      /* (346) nm ::= ID|INDEXED */ yytestcase(yyruleno==346);
      /* (347) nm ::= STRING */ yytestcase(yyruleno==347);
      /* (348) nm ::= JOIN_KW */ yytestcase(yyruleno==348);
      /* (349) typetoken ::= typename */ yytestcase(yyruleno==349);
      /* (350) typename ::= ID|STRING */ yytestcase(yyruleno==350);
      /* (351) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=351);
      /* (352) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=352);
      /* (353) carglist ::= carglist ccons */ yytestcase(yyruleno==353);
      /* (354) carglist ::= */ yytestcase(yyruleno==354);
      /* (355) ccons ::= NULL onconf */ yytestcase(yyruleno==355);
      /* (356) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==356);
      /* (357) ccons ::= AS generated */ yytestcase(yyruleno==357);
      /* (358) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==358);
      /* (359) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==359);
      /* (360) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=360);
      /* (361) tconscomma ::= */ yytestcase(yyruleno==361);
      /* (362) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=362);
      /* (363) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=363);
      /* (364) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=364);
      /* (365) oneselect ::= values */ yytestcase(yyruleno==365);
      /* (366) sclp ::= selcollist COMMA */ yytestcase(yyruleno==366);
      /* (367) as ::= ID|STRING */ yytestcase(yyruleno==367);
      /* (368) returning ::= */ yytestcase(yyruleno==368);
      /* (369) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=369);
      /* (370) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==370);
      /* (371) exprlist ::= nexprlist */ yytestcase(yyruleno==371);
      /* (372) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=372);
      /* (373) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=373);
      /* (374) nmnum ::= ON */ yytestcase(yyruleno==374);
      /* (375) nmnum ::= DELETE */ yytestcase(yyruleno==375);
      /* (376) nmnum ::= DEFAULT */ yytestcase(yyruleno==376);
      /* (377) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==377);
      /* (378) foreach_clause ::= */ yytestcase(yyruleno==378);
      /* (379) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==379);
      /* (380) trnm ::= nm */ yytestcase(yyruleno==380);
      /* (381) tridxby ::= */ yytestcase(yyruleno==381);
      /* (382) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==382);
      /* (383) database_kw_opt ::= */ yytestcase(yyruleno==383);
      /* (384) kwcolumn_opt ::= */ yytestcase(yyruleno==384);
      /* (385) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==385);
      /* (386) vtabarglist ::= vtabarg */ yytestcase(yyruleno==386);
      /* (387) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==387);
      /* (388) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==388);
      /* (389) anylist ::= */ yytestcase(yyruleno==389);
      /* (390) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==390);
      /* (391) anylist ::= anylist ANY */ yytestcase(yyruleno==391);
      /* (392) with ::= */ yytestcase(yyruleno==392);
        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);







>
>
>
>
>
|





|




|


|


|




|


|
|
|


|
|


|




|




|



|








|








|




|





|




|





|
|





|





|




|





|





|
|



|
|
|



|



|


|


|
|


|


|


|






|











|





|







|



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







161239
161240
161241
161242
161243
161244
161245
161246
161247
161248
161249
161250
161251
161252
161253
161254
161255
161256
161257
161258
161259
161260
161261
161262
161263
161264
161265
161266
161267
161268
161269
161270
161271
161272
161273
161274
161275
161276
161277
161278
161279
161280
161281
161282
161283
161284
161285
161286
161287
161288
161289
161290
161291
161292
161293
161294
161295
161296
161297
161298
161299
161300
161301
161302
161303
161304
161305
161306
161307
161308
161309
161310
161311
161312
161313
161314
161315
161316
161317
161318
161319
161320
161321
161322
161323
161324
161325
161326
161327
161328
161329
161330
161331
161332
161333
161334
161335
161336
161337
161338
161339
161340
161341
161342
161343
161344
161345
161346
161347
161348
161349
161350
161351
161352
161353
161354
161355
161356
161357
161358
161359
161360
161361
161362
161363
161364
161365
161366
161367
161368
161369
161370
161371
161372
161373
161374
161375
161376
161377
161378
161379
161380
161381
161382
161383
161384
161385
161386
161387
161388
161389
161390
161391
161392
161393
161394
161395
161396
161397
161398
161399
161400
161401
161402
161403
161404
161405
161406
161407
161408
161409
161410
161411
161412
161413
161414
161415
161416
161417
161418
161419
161420
161421
161422
161423
161424
161425
161426
161427
161428
161429
161430
161431
161432
161433
161434
161435
161436
161437
161438
161439
161440
161441
161442
161443
161444
161445
161446
161447
161448
161449
161450
161451
161452
161453
161454
161455
161456
161457
161458
161459
161460
161461
161462
161463
161464
161465
161466
161467
161468
161469
161470
161471
161472
161473
161474
161475
161476
161477
161478
161479
161480
161481
161482
161483
161484
161485
161486
161487
161488
161489
161490
161491
161492
161493
161494
161495
161496
161497
161498
161499
161500
161501
161502
161503
161504
        break;
      case 287: /* 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 288: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
{
  sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy457, &yymsp[0].minor.yy0);
}
        break;
      case 289: /* add_column_fullname ::= fullname */
{
  disableLookaside(pParse);
  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy457);
}
        break;
      case 290: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
{
  sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy457, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
        break;
      case 291: /* cmd ::= create_vtab */
{sqlite3VtabFinishParse(pParse,0);}
        break;
      case 292: /* cmd ::= create_vtab LP vtabarglist RP */
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
        break;
      case 293: /* 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.yy412);
}
        break;
      case 294: /* vtabarg ::= */
{sqlite3VtabArgInit(pParse);}
        break;
      case 295: /* vtabargtoken ::= ANY */
      case 296: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==296);
      case 297: /* lp ::= LP */ yytestcase(yyruleno==297);
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
        break;
      case 298: /* with ::= WITH wqlist */
      case 299: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==299);
{ sqlite3WithPush(pParse, yymsp[0].minor.yy105, 1); }
        break;
      case 300: /* wqlist ::= nm eidlist_opt AS LP select RP */
{
  yymsp[-5].minor.yy105 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy350, yymsp[-1].minor.yy293); /*A-overwrites-X*/
}
        break;
      case 301: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
{
  yymsp[-7].minor.yy105 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy105, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy350, yymsp[-1].minor.yy293);
}
        break;
      case 302: /* windowdefn_list ::= windowdefn */
{ yylhsminor.yy503 = yymsp[0].minor.yy503; }
  yymsp[0].minor.yy503 = yylhsminor.yy503;
        break;
      case 303: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
{
  assert( yymsp[0].minor.yy503!=0 );
  sqlite3WindowChain(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy503);
  yymsp[0].minor.yy503->pNextWin = yymsp[-2].minor.yy503;
  yylhsminor.yy503 = yymsp[0].minor.yy503;
}
  yymsp[-2].minor.yy503 = yylhsminor.yy503;
        break;
      case 304: /* windowdefn ::= nm AS LP window RP */
{
  if( ALWAYS(yymsp[-1].minor.yy503) ){
    yymsp[-1].minor.yy503->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
  }
  yylhsminor.yy503 = yymsp[-1].minor.yy503;
}
  yymsp[-4].minor.yy503 = yylhsminor.yy503;
        break;
      case 305: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
{
  yymsp[-4].minor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy350, yymsp[-1].minor.yy350, 0);
}
        break;
      case 306: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
{
  yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy350, yymsp[-1].minor.yy350, &yymsp[-5].minor.yy0);
}
  yymsp[-5].minor.yy503 = yylhsminor.yy503;
        break;
      case 307: /* window ::= ORDER BY sortlist frame_opt */
{
  yymsp[-3].minor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, yymsp[-1].minor.yy350, 0);
}
        break;
      case 308: /* window ::= nm ORDER BY sortlist frame_opt */
{
  yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, yymsp[-1].minor.yy350, &yymsp[-4].minor.yy0);
}
  yymsp[-4].minor.yy503 = yylhsminor.yy503;
        break;
      case 309: /* window ::= frame_opt */
      case 328: /* filter_over ::= over_clause */ yytestcase(yyruleno==328);
{
  yylhsminor.yy503 = yymsp[0].minor.yy503;
}
  yymsp[0].minor.yy503 = yylhsminor.yy503;
        break;
      case 310: /* window ::= nm frame_opt */
{
  yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, 0, &yymsp[-1].minor.yy0);
}
  yymsp[-1].minor.yy503 = yylhsminor.yy503;
        break;
      case 311: /* frame_opt ::= */
{
  yymsp[1].minor.yy503 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
}
        break;
      case 312: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
{
  yylhsminor.yy503 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy412, yymsp[-1].minor.yy341.eType, yymsp[-1].minor.yy341.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy624);
}
  yymsp[-2].minor.yy503 = yylhsminor.yy503;
        break;
      case 313: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
{
  yylhsminor.yy503 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy412, yymsp[-3].minor.yy341.eType, yymsp[-3].minor.yy341.pExpr, yymsp[-1].minor.yy341.eType, yymsp[-1].minor.yy341.pExpr, yymsp[0].minor.yy624);
}
  yymsp[-5].minor.yy503 = yylhsminor.yy503;
        break;
      case 315: /* frame_bound_s ::= frame_bound */
      case 317: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==317);
{yylhsminor.yy341 = yymsp[0].minor.yy341;}
  yymsp[0].minor.yy341 = yylhsminor.yy341;
        break;
      case 316: /* frame_bound_s ::= UNBOUNDED PRECEDING */
      case 318: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==318);
      case 320: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==320);
{yylhsminor.yy341.eType = yymsp[-1].major; yylhsminor.yy341.pExpr = 0;}
  yymsp[-1].minor.yy341 = yylhsminor.yy341;
        break;
      case 319: /* frame_bound ::= expr PRECEDING|FOLLOWING */
{yylhsminor.yy341.eType = yymsp[0].major; yylhsminor.yy341.pExpr = yymsp[-1].minor.yy354;}
  yymsp[-1].minor.yy341 = yylhsminor.yy341;
        break;
      case 321: /* frame_exclude_opt ::= */
{yymsp[1].minor.yy624 = 0;}
        break;
      case 322: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
{yymsp[-1].minor.yy624 = yymsp[0].minor.yy624;}
        break;
      case 323: /* frame_exclude ::= NO OTHERS */
      case 324: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==324);
{yymsp[-1].minor.yy624 = yymsp[-1].major; /*A-overwrites-X*/}
        break;
      case 325: /* frame_exclude ::= GROUP|TIES */
{yymsp[0].minor.yy624 = yymsp[0].major; /*A-overwrites-X*/}
        break;
      case 326: /* window_clause ::= WINDOW windowdefn_list */
{ yymsp[-1].minor.yy503 = yymsp[0].minor.yy503; }
        break;
      case 327: /* filter_over ::= filter_clause over_clause */
{
  yymsp[0].minor.yy503->pFilter = yymsp[-1].minor.yy354;
  yylhsminor.yy503 = yymsp[0].minor.yy503;
}
  yymsp[-1].minor.yy503 = yylhsminor.yy503;
        break;
      case 329: /* filter_over ::= filter_clause */
{
  yylhsminor.yy503 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( yylhsminor.yy503 ){
    yylhsminor.yy503->eFrmType = TK_FILTER;
    yylhsminor.yy503->pFilter = yymsp[0].minor.yy354;
  }else{
    sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy354);
  }
}
  yymsp[0].minor.yy503 = yylhsminor.yy503;
        break;
      case 330: /* over_clause ::= OVER LP window RP */
{
  yymsp[-3].minor.yy503 = yymsp[-1].minor.yy503;
  assert( yymsp[-3].minor.yy503!=0 );
}
        break;
      case 331: /* over_clause ::= OVER nm */
{
  yymsp[-1].minor.yy503 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
  if( yymsp[-1].minor.yy503 ){
    yymsp[-1].minor.yy503->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
  }
}
        break;
      case 332: /* filter_clause ::= FILTER LP WHERE expr RP */
{ yymsp[-4].minor.yy354 = yymsp[-1].minor.yy354; }
        break;
      default:
      /* (333) input ::= cmdlist */ yytestcase(yyruleno==333);
      /* (334) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==334);
      /* (335) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=335);
      /* (336) ecmd ::= SEMI */ yytestcase(yyruleno==336);
      /* (337) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==337);
      /* (338) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=338);
      /* (339) trans_opt ::= */ yytestcase(yyruleno==339);
      /* (340) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==340);
      /* (341) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==341);
      /* (342) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==342);
      /* (343) savepoint_opt ::= */ yytestcase(yyruleno==343);
      /* (344) cmd ::= create_table create_table_args */ yytestcase(yyruleno==344);
      /* (345) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==345);
      /* (346) columnlist ::= columnname carglist */ yytestcase(yyruleno==346);
      /* (347) nm ::= ID|INDEXED */ yytestcase(yyruleno==347);
      /* (348) nm ::= STRING */ yytestcase(yyruleno==348);
      /* (349) nm ::= JOIN_KW */ yytestcase(yyruleno==349);
      /* (350) typetoken ::= typename */ yytestcase(yyruleno==350);
      /* (351) typename ::= ID|STRING */ yytestcase(yyruleno==351);
      /* (352) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=352);
      /* (353) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=353);
      /* (354) carglist ::= carglist ccons */ yytestcase(yyruleno==354);
      /* (355) carglist ::= */ yytestcase(yyruleno==355);
      /* (356) ccons ::= NULL onconf */ yytestcase(yyruleno==356);
      /* (357) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==357);
      /* (358) ccons ::= AS generated */ yytestcase(yyruleno==358);
      /* (359) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==359);
      /* (360) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==360);
      /* (361) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=361);
      /* (362) tconscomma ::= */ yytestcase(yyruleno==362);
      /* (363) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=363);
      /* (364) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=364);
      /* (365) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=365);
      /* (366) oneselect ::= values */ yytestcase(yyruleno==366);
      /* (367) sclp ::= selcollist COMMA */ yytestcase(yyruleno==367);
      /* (368) as ::= ID|STRING */ yytestcase(yyruleno==368);
      /* (369) returning ::= */ yytestcase(yyruleno==369);
      /* (370) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=370);
      /* (371) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==371);
      /* (372) exprlist ::= nexprlist */ yytestcase(yyruleno==372);
      /* (373) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=373);
      /* (374) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=374);
      /* (375) nmnum ::= ON */ yytestcase(yyruleno==375);
      /* (376) nmnum ::= DELETE */ yytestcase(yyruleno==376);
      /* (377) nmnum ::= DEFAULT */ yytestcase(yyruleno==377);
      /* (378) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==378);
      /* (379) foreach_clause ::= */ yytestcase(yyruleno==379);
      /* (380) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==380);
      /* (381) trnm ::= nm */ yytestcase(yyruleno==381);
      /* (382) tridxby ::= */ yytestcase(yyruleno==382);
      /* (383) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==383);
      /* (384) database_kw_opt ::= */ yytestcase(yyruleno==384);
      /* (385) kwcolumn_opt ::= */ yytestcase(yyruleno==385);
      /* (386) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==386);
      /* (387) vtabarglist ::= vtabarg */ yytestcase(yyruleno==387);
      /* (388) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==388);
      /* (389) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==389);
      /* (390) anylist ::= */ yytestcase(yyruleno==390);
      /* (391) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==391);
      /* (392) anylist ::= anylist ANY */ yytestcase(yyruleno==392);
      /* (393) with ::= */ yytestcase(yyruleno==393);
        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);
203038
203039
203040
203041
203042
203043
203044


203045


203046
203047
203048
203049


203050
203051
203052
203053
203054
203055
203056
203057
203058
203059
203060
203061
203062
203063
203064
203065
203066
203067
  int rc = SQLITE_OK;

#ifdef SQLITE_AMALGAMATION
    assert( WAL_CKPT_LOCK==1 );
#endif

  assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) );


  if( pRbu && (pRbu->eStage==RBU_STAGE_OAL || pRbu->eStage==RBU_STAGE_MOVE) ){


    /* Magic number 1 is the WAL_CKPT_LOCK lock. Preventing SQLite from
    ** taking this lock also prevents any checkpoints from occurring.
    ** todo: really, it's not clear why this might occur, as
    ** wal_autocheckpoint ought to be turned off.  */


    if( ofst==WAL_LOCK_CKPT && n==1 ) rc = SQLITE_BUSY;
  }else{
    int bCapture = 0;
    if( pRbu && pRbu->eStage==RBU_STAGE_CAPTURE ){
      bCapture = 1;
    }

    if( bCapture==0 || 0==(flags & SQLITE_SHM_UNLOCK) ){
      rc = p->pReal->pMethods->xShmLock(p->pReal, ofst, n, flags);
      if( bCapture && rc==SQLITE_OK ){
        pRbu->mLock |= (1 << ofst);
      }
    }
  }

  return rc;
}








>
>
|
>
>
|
<
<
<
>
>






<



|







203320
203321
203322
203323
203324
203325
203326
203327
203328
203329
203330
203331
203332



203333
203334
203335
203336
203337
203338
203339
203340

203341
203342
203343
203344
203345
203346
203347
203348
203349
203350
203351
  int rc = SQLITE_OK;

#ifdef SQLITE_AMALGAMATION
    assert( WAL_CKPT_LOCK==1 );
#endif

  assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) );
  if( pRbu && (
       pRbu->eStage==RBU_STAGE_OAL
    || pRbu->eStage==RBU_STAGE_MOVE
    || pRbu->eStage==RBU_STAGE_DONE
  )){
    /* Prevent SQLite from taking a shm-lock on the target file when it



    ** is supplying heap memory to the upper layer in place of *-shm
    ** segments. */
    if( ofst==WAL_LOCK_CKPT && n==1 ) rc = SQLITE_BUSY;
  }else{
    int bCapture = 0;
    if( pRbu && pRbu->eStage==RBU_STAGE_CAPTURE ){
      bCapture = 1;
    }

    if( bCapture==0 || 0==(flags & SQLITE_SHM_UNLOCK) ){
      rc = p->pReal->pMethods->xShmLock(p->pReal, ofst, n, flags);
      if( bCapture && rc==SQLITE_OK ){
        pRbu->mLock |= ((1<<n) - 1) << ofst;
      }
    }
  }

  return rc;
}

228482
228483
228484
228485
228486
228487
228488
228489
228490
228491
228492
228493
228494
228495
228496
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: 2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398f17d", -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){







|







228766
228767
228768
228769
228770
228771
228772
228773
228774
228775
228776
228777
228778
228779
228780
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: 2021-02-17 13:19:22 c46a94a624c2cc6c49ac916a206a913081e1628c24805987cabc75c9057ea36b", -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){
233408
233409
233410
233411
233412
233413
233414
233415
233416
233417
233418
233419
233420
233421
#endif
  return rc;
}
#endif /* SQLITE_CORE */
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */

/************** End of stmt.c ************************************************/
#if __LINE__!=233415
#undef SQLITE_SOURCE_ID
#define SQLITE_SOURCE_ID      "2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398alt2"
#endif
/* Return the source-id for this library */
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
/************************** End of sqlite3.c ******************************/







|

|




233692
233693
233694
233695
233696
233697
233698
233699
233700
233701
233702
233703
233704
233705
#endif
  return rc;
}
#endif /* SQLITE_CORE */
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */

/************** End of stmt.c ************************************************/
#if __LINE__!=233699
#undef SQLITE_SOURCE_ID
#define SQLITE_SOURCE_ID      "2021-02-19 14:32:58 c844a331e78949850fde8ed95058cb34f863566944bc9e92e3ae042768f1alt2"
#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.
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
** be larger than the release from which it is derived.  Either Y will
** be held constant and Z will be incremented or else Y will be incremented
** and Z will be reset to zero.
**
** Since [version 3.6.18] ([dateof:3.6.18]),
** SQLite source code has been stored in the
** <a href="http://fossil-scm.org/">Fossil configuration management
** system</a>.  ^The SQLITE_SOURCE_ID macro evaluates to
** a string which identifies a particular check-in of SQLite
** within its configuration management system.  ^The SQLITE_SOURCE_ID
** string contains the date and time of the check-in (UTC) and a SHA1
** or SHA3-256 hash of the entire source tree.  If the source code has
** 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      "2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398f17d"

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







|














|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
** be larger than the release from which it is derived.  Either Y will
** be held constant and Z will be incremented or else Y will be incremented
** and Z will be reset to zero.
**
** Since [version 3.6.18] ([dateof:3.6.18]),
** SQLite source code has been stored in the
** <a href="http://www.fossil-scm.org/">Fossil configuration management
** system</a>.  ^The SQLITE_SOURCE_ID macro evaluates to
** a string which identifies a particular check-in of SQLite
** within its configuration management system.  ^The SQLITE_SOURCE_ID
** string contains the date and time of the check-in (UTC) and a SHA1
** or SHA3-256 hash of the entire source tree.  If the source code has
** 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      "2021-02-19 14:32:58 c844a331e78949850fde8ed95058cb34f863566944bc9e92e3ae042768f130e1"

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