Fossil SCM

Merge from trunk.

larrybr 2021-02-23 01:23 error_returns merge
Commit 7d835ff5374ddd84ea7f089e0c632f83f25f8854c9a69b3a803940b1b63355cd
+1 -1
--- src/chat.c
+++ src/chat.c
@@ -501,11 +501,11 @@
501501
**
502502
** The "msgid" values will be in increasing order.
503503
**
504504
** The "mdel" will only exist if "xmsg" is an empty string and "fsize" is zero.
505505
**
506
-** The "lmtime" value might be known, in which case it is omitted.
506
+** The "lmtime" value might be unknown, in which case it is omitted.
507507
**
508508
** The messages are ordered oldest first unless "before" is provided, in which
509509
** case they are sorted newest first (to facilitate the client-side UI update).
510510
**
511511
** As a special case, if this routine encounters an error, e.g. the user's
512512
--- src/chat.c
+++ src/chat.c
@@ -501,11 +501,11 @@
501 **
502 ** The "msgid" values will be in increasing order.
503 **
504 ** The "mdel" will only exist if "xmsg" is an empty string and "fsize" is zero.
505 **
506 ** The "lmtime" value might be known, in which case it is omitted.
507 **
508 ** The messages are ordered oldest first unless "before" is provided, in which
509 ** case they are sorted newest first (to facilitate the client-side UI update).
510 **
511 ** As a special case, if this routine encounters an error, e.g. the user's
512
--- src/chat.c
+++ src/chat.c
@@ -501,11 +501,11 @@
501 **
502 ** The "msgid" values will be in increasing order.
503 **
504 ** The "mdel" will only exist if "xmsg" is an empty string and "fsize" is zero.
505 **
506 ** The "lmtime" value might be unknown, in which case it is omitted.
507 **
508 ** The messages are ordered oldest first unless "before" is provided, in which
509 ** case they are sorted newest first (to facilitate the client-side UI update).
510 **
511 ** As a special case, if this routine encounters an error, e.g. the user's
512
--- src/content.c
+++ src/content.c
@@ -798,10 +798,12 @@
798798
** gives the smallest delta is choosen.
799799
**
800800
** If rid is already a delta from some other place then no
801801
** conversion occurs and this is a no-op unless force==1. If force==1,
802802
** then nSrc must also be 1.
803
+**
804
+** If rid refers to a phantom, no delta is created.
803805
**
804806
** Never generate a delta that carries a private artifact into a public
805807
** artifact. Otherwise, when we go to send the public artifact on a
806808
** sync operation, the other end of the sync will never be able to receive
807809
** the source of the delta. It is OK to delta private->private and
@@ -829,10 +831,13 @@
829831
830832
/* If rid is already a child (a delta) of some other artifact, return
831833
** immediately if the force flags is false
832834
*/
833835
if( !force && delta_source_rid(rid)>0 ) return 0;
836
+
837
+ /* If rid refers to a phantom, skip deltification. */
838
+ if( 0==content_is_available(rid) ) return 0;
834839
835840
/* Get the complete content of the object to be delta-ed. If the size
836841
** is less than 50 bytes, then there really is no point in trying to do
837842
** a delta, so return immediately
838843
*/
839844
--- src/content.c
+++ src/content.c
@@ -798,10 +798,12 @@
798 ** gives the smallest delta is choosen.
799 **
800 ** If rid is already a delta from some other place then no
801 ** conversion occurs and this is a no-op unless force==1. If force==1,
802 ** then nSrc must also be 1.
 
 
803 **
804 ** Never generate a delta that carries a private artifact into a public
805 ** artifact. Otherwise, when we go to send the public artifact on a
806 ** sync operation, the other end of the sync will never be able to receive
807 ** the source of the delta. It is OK to delta private->private and
@@ -829,10 +831,13 @@
829
830 /* If rid is already a child (a delta) of some other artifact, return
831 ** immediately if the force flags is false
832 */
833 if( !force && delta_source_rid(rid)>0 ) return 0;
 
 
 
834
835 /* Get the complete content of the object to be delta-ed. If the size
836 ** is less than 50 bytes, then there really is no point in trying to do
837 ** a delta, so return immediately
838 */
839
--- src/content.c
+++ src/content.c
@@ -798,10 +798,12 @@
798 ** gives the smallest delta is choosen.
799 **
800 ** If rid is already a delta from some other place then no
801 ** conversion occurs and this is a no-op unless force==1. If force==1,
802 ** then nSrc must also be 1.
803 **
804 ** If rid refers to a phantom, no delta is created.
805 **
806 ** Never generate a delta that carries a private artifact into a public
807 ** artifact. Otherwise, when we go to send the public artifact on a
808 ** sync operation, the other end of the sync will never be able to receive
809 ** the source of the delta. It is OK to delta private->private and
@@ -829,10 +831,13 @@
831
832 /* If rid is already a child (a delta) of some other artifact, return
833 ** immediately if the force flags is false
834 */
835 if( !force && delta_source_rid(rid)>0 ) return 0;
836
837 /* If rid refers to a phantom, skip deltification. */
838 if( 0==content_is_available(rid) ) return 0;
839
840 /* Get the complete content of the object to be delta-ed. If the size
841 ** is less than 50 bytes, then there really is no point in trying to do
842 ** a delta, so return immediately
843 */
844
+5 -2
--- src/export.c
+++ src/export.c
@@ -1324,11 +1324,11 @@
13241324
/* Create a new Git repository at zMirror */
13251325
zCmd = mprintf("git init %$", zMirror);
13261326
gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
13271327
rc = fossil_system(zCmd);
13281328
if( rc ){
1329
- fossil_fatal("cannot initialize git repository using: %s\n", zCmd);
1329
+ fossil_fatal("cannot initialize git repository using: %s", zCmd);
13301330
}
13311331
fossil_free(zCmd);
13321332
13331333
/* Must be in the new Git repository directory for subsequent commands */
13341334
rc = file_chdir(zMirror, 0);
@@ -1718,11 +1718,14 @@
17181718
zPushCmd = mprintf("git push --mirror %s", zPushUrl);
17191719
}
17201720
gitmirror_message(VERB_NORMAL, "%s\n", zPushCmd);
17211721
fossil_free(zPushCmd);
17221722
zPushCmd = mprintf("git push --mirror %$", zPushUrl);
1723
- fossil_system(zPushCmd);
1723
+ rc = fossil_system(zPushCmd);
1724
+ if( rc ){
1725
+ fossil_fatal("cannot push content using: %s", zPushCmd);
1726
+ }
17241727
fossil_free(zPushCmd);
17251728
}
17261729
}
17271730
17281731
/*
17291732
--- src/export.c
+++ src/export.c
@@ -1324,11 +1324,11 @@
1324 /* Create a new Git repository at zMirror */
1325 zCmd = mprintf("git init %$", zMirror);
1326 gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1327 rc = fossil_system(zCmd);
1328 if( rc ){
1329 fossil_fatal("cannot initialize git repository using: %s\n", zCmd);
1330 }
1331 fossil_free(zCmd);
1332
1333 /* Must be in the new Git repository directory for subsequent commands */
1334 rc = file_chdir(zMirror, 0);
@@ -1718,11 +1718,14 @@
1718 zPushCmd = mprintf("git push --mirror %s", zPushUrl);
1719 }
1720 gitmirror_message(VERB_NORMAL, "%s\n", zPushCmd);
1721 fossil_free(zPushCmd);
1722 zPushCmd = mprintf("git push --mirror %$", zPushUrl);
1723 fossil_system(zPushCmd);
 
 
 
1724 fossil_free(zPushCmd);
1725 }
1726 }
1727
1728 /*
1729
--- src/export.c
+++ src/export.c
@@ -1324,11 +1324,11 @@
1324 /* Create a new Git repository at zMirror */
1325 zCmd = mprintf("git init %$", zMirror);
1326 gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1327 rc = fossil_system(zCmd);
1328 if( rc ){
1329 fossil_fatal("cannot initialize git repository using: %s", zCmd);
1330 }
1331 fossil_free(zCmd);
1332
1333 /* Must be in the new Git repository directory for subsequent commands */
1334 rc = file_chdir(zMirror, 0);
@@ -1718,11 +1718,14 @@
1718 zPushCmd = mprintf("git push --mirror %s", zPushUrl);
1719 }
1720 gitmirror_message(VERB_NORMAL, "%s\n", zPushCmd);
1721 fossil_free(zPushCmd);
1722 zPushCmd = mprintf("git push --mirror %$", zPushUrl);
1723 rc = fossil_system(zPushCmd);
1724 if( rc ){
1725 fossil_fatal("cannot push content using: %s", zPushCmd);
1726 }
1727 fossil_free(zPushCmd);
1728 }
1729 }
1730
1731 /*
1732
--- src/fossil.pikchr.js
+++ src/fossil.pikchr.js
@@ -78,7 +78,8 @@
7878
if(!srcView || !srcView.classList.contains('pikchr-src')){
7979
/* Without this element, there's nothing for us to do here. */
8080
return this;
8181
}
8282
parent.addEventListener('click', f.parentClick, false);
83
+ return this;
8384
};
8485
})(window.fossil);
8586
--- src/fossil.pikchr.js
+++ src/fossil.pikchr.js
@@ -78,7 +78,8 @@
78 if(!srcView || !srcView.classList.contains('pikchr-src')){
79 /* Without this element, there's nothing for us to do here. */
80 return this;
81 }
82 parent.addEventListener('click', f.parentClick, false);
 
83 };
84 })(window.fossil);
85
--- src/fossil.pikchr.js
+++ src/fossil.pikchr.js
@@ -78,7 +78,8 @@
78 if(!srcView || !srcView.classList.contains('pikchr-src')){
79 /* Without this element, there's nothing for us to do here. */
80 return this;
81 }
82 parent.addEventListener('click', f.parentClick, false);
83 return this;
84 };
85 })(window.fossil);
86
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -1468,10 +1468,11 @@
14681468
OBJDIR = $(T)
14691469
OX = $(OBJDIR)
14701470
O = .obj
14711471
E = .exe
14721472
P = .pdb
1473
+OPTLEVEL= /Os
14731474
14741475
INSTALLDIR = .
14751476
!ifdef DESTDIR
14761477
INSTALLDIR = $(DESTDIR)\$(INSTALLDIR)
14771478
!endif
@@ -1667,11 +1668,11 @@
16671668
16681669
!if $(DEBUG)!=0
16691670
CFLAGS = $(CFLAGS) /Zi $(CRTFLAGS) /Od /DFOSSIL_DEBUG
16701671
LDFLAGS = $(LDFLAGS) /DEBUG
16711672
!else
1672
-CFLAGS = $(CFLAGS) $(CRTFLAGS) /Os
1673
+CFLAGS = $(CFLAGS) $(CRTFLAGS) $(OPTLEVEL)
16731674
!endif
16741675
16751676
BCC = $(CC) $(CFLAGS)
16761677
TCC = $(CC) /c $(CFLAGS) $(MSCDEF) $(INCL)
16771678
RCC = $(RC) /D_WIN32 /D_MSC_VER $(MSCDEF) $(INCL)
16781679
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -1468,10 +1468,11 @@
1468 OBJDIR = $(T)
1469 OX = $(OBJDIR)
1470 O = .obj
1471 E = .exe
1472 P = .pdb
 
1473
1474 INSTALLDIR = .
1475 !ifdef DESTDIR
1476 INSTALLDIR = $(DESTDIR)\$(INSTALLDIR)
1477 !endif
@@ -1667,11 +1668,11 @@
1667
1668 !if $(DEBUG)!=0
1669 CFLAGS = $(CFLAGS) /Zi $(CRTFLAGS) /Od /DFOSSIL_DEBUG
1670 LDFLAGS = $(LDFLAGS) /DEBUG
1671 !else
1672 CFLAGS = $(CFLAGS) $(CRTFLAGS) /Os
1673 !endif
1674
1675 BCC = $(CC) $(CFLAGS)
1676 TCC = $(CC) /c $(CFLAGS) $(MSCDEF) $(INCL)
1677 RCC = $(RC) /D_WIN32 /D_MSC_VER $(MSCDEF) $(INCL)
1678
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -1468,10 +1468,11 @@
1468 OBJDIR = $(T)
1469 OX = $(OBJDIR)
1470 O = .obj
1471 E = .exe
1472 P = .pdb
1473 OPTLEVEL= /Os
1474
1475 INSTALLDIR = .
1476 !ifdef DESTDIR
1477 INSTALLDIR = $(DESTDIR)\$(INSTALLDIR)
1478 !endif
@@ -1667,11 +1668,11 @@
1668
1669 !if $(DEBUG)!=0
1670 CFLAGS = $(CFLAGS) /Zi $(CRTFLAGS) /Od /DFOSSIL_DEBUG
1671 LDFLAGS = $(LDFLAGS) /DEBUG
1672 !else
1673 CFLAGS = $(CFLAGS) $(CRTFLAGS) $(OPTLEVEL)
1674 !endif
1675
1676 BCC = $(CC) $(CFLAGS)
1677 TCC = $(CC) /c $(CFLAGS) $(MSCDEF) $(INCL)
1678 RCC = $(RC) /D_WIN32 /D_MSC_VER $(MSCDEF) $(INCL)
1679
+10 -15
--- src/manifest.c
+++ src/manifest.c
@@ -2419,27 +2419,23 @@
24192419
tag_propagate_all(parentid);
24202420
}
24212421
}
24222422
if( p->type==CFTYPE_WIKI ){
24232423
char *zTag = mprintf("wiki-%s", p->zWikiTitle);
2424
- int tagid = tag_findid(zTag, 1);
2425
- int prior;
2424
+ int prior = 0;
24262425
char cPrefix;
24272426
int nWiki;
24282427
char zLength[40];
24292428
24302429
while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
24312430
nWiki = strlen(p->zWiki);
24322431
sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
24332432
tag_insert(zTag, 1, zLength, rid, p->rDate, rid);
24342433
fossil_free(zTag);
2435
- prior = db_int(0,
2436
- "SELECT rid FROM tagxref"
2437
- " WHERE tagid=%d AND mtime<%.17g"
2438
- " ORDER BY mtime DESC",
2439
- tagid, p->rDate
2440
- );
2434
+ if(p->nParent){
2435
+ prior = fast_uuid_to_rid(p->azParent[0]);
2436
+ }
24412437
if( prior ){
24422438
content_deltify(prior, &rid, 1, 0);
24432439
}
24442440
if( nWiki<=0 ){
24452441
cPrefix = '-';
@@ -2462,26 +2458,25 @@
24622458
);
24632459
}
24642460
if( p->type==CFTYPE_EVENT ){
24652461
char *zTag = mprintf("event-%s", p->zEventId);
24662462
int tagid = tag_findid(zTag, 1);
2467
- int prior, subsequent;
2463
+ int prior = 0, subsequent;
24682464
int nWiki;
24692465
char zLength[40];
24702466
Stmt qatt;
24712467
while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
24722468
nWiki = strlen(p->zWiki);
24732469
sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
24742470
tag_insert(zTag, 1, zLength, rid, p->rDate, rid);
24752471
fossil_free(zTag);
2476
- prior = db_int(0,
2477
- "SELECT rid FROM tagxref"
2478
- " WHERE tagid=%d AND mtime<%.17g AND rid!=%d"
2479
- " ORDER BY mtime DESC",
2480
- tagid, p->rDate, rid
2481
- );
2472
+ if(p->nParent){
2473
+ prior = fast_uuid_to_rid(p->azParent[0]);
2474
+ }
24822475
subsequent = db_int(0,
2476
+ /* BUG: this check is only correct if subsequent
2477
+ version has already been crosslinked. */
24832478
"SELECT rid FROM tagxref"
24842479
" WHERE tagid=%d AND mtime>=%.17g AND rid!=%d"
24852480
" ORDER BY mtime",
24862481
tagid, p->rDate, rid
24872482
);
24882483
--- src/manifest.c
+++ src/manifest.c
@@ -2419,27 +2419,23 @@
2419 tag_propagate_all(parentid);
2420 }
2421 }
2422 if( p->type==CFTYPE_WIKI ){
2423 char *zTag = mprintf("wiki-%s", p->zWikiTitle);
2424 int tagid = tag_findid(zTag, 1);
2425 int prior;
2426 char cPrefix;
2427 int nWiki;
2428 char zLength[40];
2429
2430 while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
2431 nWiki = strlen(p->zWiki);
2432 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
2433 tag_insert(zTag, 1, zLength, rid, p->rDate, rid);
2434 fossil_free(zTag);
2435 prior = db_int(0,
2436 "SELECT rid FROM tagxref"
2437 " WHERE tagid=%d AND mtime<%.17g"
2438 " ORDER BY mtime DESC",
2439 tagid, p->rDate
2440 );
2441 if( prior ){
2442 content_deltify(prior, &rid, 1, 0);
2443 }
2444 if( nWiki<=0 ){
2445 cPrefix = '-';
@@ -2462,26 +2458,25 @@
2462 );
2463 }
2464 if( p->type==CFTYPE_EVENT ){
2465 char *zTag = mprintf("event-%s", p->zEventId);
2466 int tagid = tag_findid(zTag, 1);
2467 int prior, subsequent;
2468 int nWiki;
2469 char zLength[40];
2470 Stmt qatt;
2471 while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
2472 nWiki = strlen(p->zWiki);
2473 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
2474 tag_insert(zTag, 1, zLength, rid, p->rDate, rid);
2475 fossil_free(zTag);
2476 prior = db_int(0,
2477 "SELECT rid FROM tagxref"
2478 " WHERE tagid=%d AND mtime<%.17g AND rid!=%d"
2479 " ORDER BY mtime DESC",
2480 tagid, p->rDate, rid
2481 );
2482 subsequent = db_int(0,
 
 
2483 "SELECT rid FROM tagxref"
2484 " WHERE tagid=%d AND mtime>=%.17g AND rid!=%d"
2485 " ORDER BY mtime",
2486 tagid, p->rDate, rid
2487 );
2488
--- src/manifest.c
+++ src/manifest.c
@@ -2419,27 +2419,23 @@
2419 tag_propagate_all(parentid);
2420 }
2421 }
2422 if( p->type==CFTYPE_WIKI ){
2423 char *zTag = mprintf("wiki-%s", p->zWikiTitle);
2424 int prior = 0;
 
2425 char cPrefix;
2426 int nWiki;
2427 char zLength[40];
2428
2429 while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
2430 nWiki = strlen(p->zWiki);
2431 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
2432 tag_insert(zTag, 1, zLength, rid, p->rDate, rid);
2433 fossil_free(zTag);
2434 if(p->nParent){
2435 prior = fast_uuid_to_rid(p->azParent[0]);
2436 }
 
 
 
2437 if( prior ){
2438 content_deltify(prior, &rid, 1, 0);
2439 }
2440 if( nWiki<=0 ){
2441 cPrefix = '-';
@@ -2462,26 +2458,25 @@
2458 );
2459 }
2460 if( p->type==CFTYPE_EVENT ){
2461 char *zTag = mprintf("event-%s", p->zEventId);
2462 int tagid = tag_findid(zTag, 1);
2463 int prior = 0, subsequent;
2464 int nWiki;
2465 char zLength[40];
2466 Stmt qatt;
2467 while( fossil_isspace(p->zWiki[0]) ) p->zWiki++;
2468 nWiki = strlen(p->zWiki);
2469 sqlite3_snprintf(sizeof(zLength), zLength, "%d", nWiki);
2470 tag_insert(zTag, 1, zLength, rid, p->rDate, rid);
2471 fossil_free(zTag);
2472 if(p->nParent){
2473 prior = fast_uuid_to_rid(p->azParent[0]);
2474 }
 
 
 
2475 subsequent = db_int(0,
2476 /* BUG: this check is only correct if subsequent
2477 version has already been crosslinked. */
2478 "SELECT rid FROM tagxref"
2479 " WHERE tagid=%d AND mtime>=%.17g AND rid!=%d"
2480 " ORDER BY mtime",
2481 tagid, p->rDate, rid
2482 );
2483
+12 -5
--- src/shell.c
+++ src/shell.c
@@ -18795,11 +18795,11 @@
1879518795
1879618796
if( (c=='o'
1879718797
&& (strncmp(azArg[0], "output", n)==0||strncmp(azArg[0], "once", n)==0))
1879818798
|| (c=='e' && n==5 && strcmp(azArg[0],"excel")==0)
1879918799
){
18800
- const char *zFile = 0;
18800
+ char *zFile = 0;
1880118801
int bTxtMode = 0;
1880218802
int i;
1880318803
int eMode = 0;
1880418804
int bBOM = 0;
1880518805
int bOnce = 0; /* 0: .output, 1: .once, 2: .excel */
@@ -18825,21 +18825,26 @@
1882518825
azArg[i]);
1882618826
showHelp(p->out, azArg[0]);
1882718827
rc = 1;
1882818828
goto meta_command_exit;
1882918829
}
18830
- }else if( zFile==0 ){
18831
- zFile = z;
18830
+ }else if( zFile==0 && eMode!='e' && eMode!='x' ){
18831
+ zFile = sqlite3_mprintf("%s", z);
18832
+ if( zFile[0]=='|' ){
18833
+ while( i+1<nArg ) zFile = sqlite3_mprintf("%z %s", zFile, azArg[++i]);
18834
+ break;
18835
+ }
1883218836
}else{
1883318837
utf8_printf(p->out,"ERROR: extra parameter: \"%s\". Usage:\n",
1883418838
azArg[i]);
1883518839
showHelp(p->out, azArg[0]);
1883618840
rc = 1;
18841
+ sqlite3_free(zFile);
1883718842
goto meta_command_exit;
1883818843
}
1883918844
}
18840
- if( zFile==0 ) zFile = "stdout";
18845
+ if( zFile==0 ) zFile = sqlite3_mprintf("stdout");
1884118846
if( bOnce ){
1884218847
p->outCount = 2;
1884318848
}else{
1884418849
p->outCount = 0;
1884518850
}
@@ -18858,11 +18863,12 @@
1885818863
}else{
1885918864
/* text editor mode */
1886018865
newTempFile(p, "txt");
1886118866
bTxtMode = 1;
1886218867
}
18863
- zFile = p->zTempFile;
18868
+ sqlite3_free(zFile);
18869
+ zFile = sqlite3_mprintf("%s", p->zTempFile);
1886418870
}
1886518871
#endif /* SQLITE_NOHAVE_SYSTEM */
1886618872
if( zFile[0]=='|' ){
1886718873
#ifdef SQLITE_OMIT_POPEN
1886818874
raw_printf(stderr, "Error: pipes are not supported in this OS\n");
@@ -18890,10 +18896,11 @@
1889018896
} else {
1889118897
if( bBOM ) fprintf(p->out,"\357\273\277");
1889218898
sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
1889318899
}
1889418900
}
18901
+ sqlite3_free(zFile);
1889518902
}else
1889618903
1889718904
if( c=='p' && n>=3 && strncmp(azArg[0], "parameter", n)==0 ){
1889818905
open_db(p,0);
1889918906
if( nArg<=1 ) goto parameter_syntax_error;
1890018907
--- src/shell.c
+++ src/shell.c
@@ -18795,11 +18795,11 @@
18795
18796 if( (c=='o'
18797 && (strncmp(azArg[0], "output", n)==0||strncmp(azArg[0], "once", n)==0))
18798 || (c=='e' && n==5 && strcmp(azArg[0],"excel")==0)
18799 ){
18800 const char *zFile = 0;
18801 int bTxtMode = 0;
18802 int i;
18803 int eMode = 0;
18804 int bBOM = 0;
18805 int bOnce = 0; /* 0: .output, 1: .once, 2: .excel */
@@ -18825,21 +18825,26 @@
18825 azArg[i]);
18826 showHelp(p->out, azArg[0]);
18827 rc = 1;
18828 goto meta_command_exit;
18829 }
18830 }else if( zFile==0 ){
18831 zFile = z;
 
 
 
 
18832 }else{
18833 utf8_printf(p->out,"ERROR: extra parameter: \"%s\". Usage:\n",
18834 azArg[i]);
18835 showHelp(p->out, azArg[0]);
18836 rc = 1;
 
18837 goto meta_command_exit;
18838 }
18839 }
18840 if( zFile==0 ) zFile = "stdout";
18841 if( bOnce ){
18842 p->outCount = 2;
18843 }else{
18844 p->outCount = 0;
18845 }
@@ -18858,11 +18863,12 @@
18858 }else{
18859 /* text editor mode */
18860 newTempFile(p, "txt");
18861 bTxtMode = 1;
18862 }
18863 zFile = p->zTempFile;
 
18864 }
18865 #endif /* SQLITE_NOHAVE_SYSTEM */
18866 if( zFile[0]=='|' ){
18867 #ifdef SQLITE_OMIT_POPEN
18868 raw_printf(stderr, "Error: pipes are not supported in this OS\n");
@@ -18890,10 +18896,11 @@
18890 } else {
18891 if( bBOM ) fprintf(p->out,"\357\273\277");
18892 sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
18893 }
18894 }
 
18895 }else
18896
18897 if( c=='p' && n>=3 && strncmp(azArg[0], "parameter", n)==0 ){
18898 open_db(p,0);
18899 if( nArg<=1 ) goto parameter_syntax_error;
18900
--- src/shell.c
+++ src/shell.c
@@ -18795,11 +18795,11 @@
18795
18796 if( (c=='o'
18797 && (strncmp(azArg[0], "output", n)==0||strncmp(azArg[0], "once", n)==0))
18798 || (c=='e' && n==5 && strcmp(azArg[0],"excel")==0)
18799 ){
18800 char *zFile = 0;
18801 int bTxtMode = 0;
18802 int i;
18803 int eMode = 0;
18804 int bBOM = 0;
18805 int bOnce = 0; /* 0: .output, 1: .once, 2: .excel */
@@ -18825,21 +18825,26 @@
18825 azArg[i]);
18826 showHelp(p->out, azArg[0]);
18827 rc = 1;
18828 goto meta_command_exit;
18829 }
18830 }else if( zFile==0 && eMode!='e' && eMode!='x' ){
18831 zFile = sqlite3_mprintf("%s", z);
18832 if( zFile[0]=='|' ){
18833 while( i+1<nArg ) zFile = sqlite3_mprintf("%z %s", zFile, azArg[++i]);
18834 break;
18835 }
18836 }else{
18837 utf8_printf(p->out,"ERROR: extra parameter: \"%s\". Usage:\n",
18838 azArg[i]);
18839 showHelp(p->out, azArg[0]);
18840 rc = 1;
18841 sqlite3_free(zFile);
18842 goto meta_command_exit;
18843 }
18844 }
18845 if( zFile==0 ) zFile = sqlite3_mprintf("stdout");
18846 if( bOnce ){
18847 p->outCount = 2;
18848 }else{
18849 p->outCount = 0;
18850 }
@@ -18858,11 +18863,12 @@
18863 }else{
18864 /* text editor mode */
18865 newTempFile(p, "txt");
18866 bTxtMode = 1;
18867 }
18868 sqlite3_free(zFile);
18869 zFile = sqlite3_mprintf("%s", p->zTempFile);
18870 }
18871 #endif /* SQLITE_NOHAVE_SYSTEM */
18872 if( zFile[0]=='|' ){
18873 #ifdef SQLITE_OMIT_POPEN
18874 raw_printf(stderr, "Error: pipes are not supported in this OS\n");
@@ -18890,10 +18896,11 @@
18896 } else {
18897 if( bBOM ) fprintf(p->out,"\357\273\277");
18898 sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
18899 }
18900 }
18901 sqlite3_free(zFile);
18902 }else
18903
18904 if( c=='p' && n>=3 && strncmp(azArg[0], "parameter", n)==0 ){
18905 open_db(p,0);
18906 if( nArg<=1 ) goto parameter_syntax_error;
18907
+3377 -2871
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1171,11 +1171,11 @@
11711171
** be held constant and Z will be incremented or else Y will be incremented
11721172
** and Z will be reset to zero.
11731173
**
11741174
** Since [version 3.6.18] ([dateof:3.6.18]),
11751175
** SQLite source code has been stored in the
1176
-** <a href="http://fossil-scm.org/">Fossil configuration management
1176
+** <a href="http://www.fossil-scm.org/">Fossil configuration management
11771177
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
11781178
** a string which identifies a particular check-in of SQLite
11791179
** within its configuration management system. ^The SQLITE_SOURCE_ID
11801180
** string contains the date and time of the check-in (UTC) and a SHA1
11811181
** or SHA3-256 hash of the entire source tree. If the source code has
@@ -1186,11 +1186,11 @@
11861186
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11871187
** [sqlite_version()] and [sqlite_source_id()].
11881188
*/
11891189
#define SQLITE_VERSION "3.35.0"
11901190
#define SQLITE_VERSION_NUMBER 3035000
1191
-#define SQLITE_SOURCE_ID "2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398f17d"
1191
+#define SQLITE_SOURCE_ID "2021-02-22 16:42:09 b5a0778cc5a98a864bea72670f83262da940aceb91fa4cdf46ec097337a3alt1"
11921192
11931193
/*
11941194
** CAPI3REF: Run-Time Library Version Numbers
11951195
** KEYWORDS: sqlite3_version sqlite3_sourceid
11961196
**
@@ -14125,95 +14125,96 @@
1412514125
#define TK_GROUPS 92
1412614126
#define TK_OTHERS 93
1412714127
#define TK_TIES 94
1412814128
#define TK_GENERATED 95
1412914129
#define TK_ALWAYS 96
14130
-#define TK_REINDEX 97
14131
-#define TK_RENAME 98
14132
-#define TK_CTIME_KW 99
14133
-#define TK_ANY 100
14134
-#define TK_BITAND 101
14135
-#define TK_BITOR 102
14136
-#define TK_LSHIFT 103
14137
-#define TK_RSHIFT 104
14138
-#define TK_PLUS 105
14139
-#define TK_MINUS 106
14140
-#define TK_STAR 107
14141
-#define TK_SLASH 108
14142
-#define TK_REM 109
14143
-#define TK_CONCAT 110
14144
-#define TK_COLLATE 111
14145
-#define TK_BITNOT 112
14146
-#define TK_ON 113
14147
-#define TK_INDEXED 114
14148
-#define TK_STRING 115
14149
-#define TK_JOIN_KW 116
14150
-#define TK_CONSTRAINT 117
14151
-#define TK_DEFAULT 118
14152
-#define TK_NULL 119
14153
-#define TK_PRIMARY 120
14154
-#define TK_UNIQUE 121
14155
-#define TK_CHECK 122
14156
-#define TK_REFERENCES 123
14157
-#define TK_AUTOINCR 124
14158
-#define TK_INSERT 125
14159
-#define TK_DELETE 126
14160
-#define TK_UPDATE 127
14161
-#define TK_SET 128
14162
-#define TK_DEFERRABLE 129
14163
-#define TK_FOREIGN 130
14164
-#define TK_DROP 131
14165
-#define TK_UNION 132
14166
-#define TK_ALL 133
14167
-#define TK_EXCEPT 134
14168
-#define TK_INTERSECT 135
14169
-#define TK_SELECT 136
14170
-#define TK_VALUES 137
14171
-#define TK_DISTINCT 138
14172
-#define TK_DOT 139
14173
-#define TK_FROM 140
14174
-#define TK_JOIN 141
14175
-#define TK_USING 142
14176
-#define TK_ORDER 143
14177
-#define TK_GROUP 144
14178
-#define TK_HAVING 145
14179
-#define TK_LIMIT 146
14180
-#define TK_WHERE 147
14181
-#define TK_RETURNING 148
14182
-#define TK_INTO 149
14183
-#define TK_NOTHING 150
14184
-#define TK_FLOAT 151
14185
-#define TK_BLOB 152
14186
-#define TK_INTEGER 153
14187
-#define TK_VARIABLE 154
14188
-#define TK_CASE 155
14189
-#define TK_WHEN 156
14190
-#define TK_THEN 157
14191
-#define TK_ELSE 158
14192
-#define TK_INDEX 159
14193
-#define TK_ALTER 160
14194
-#define TK_ADD 161
14195
-#define TK_WINDOW 162
14196
-#define TK_OVER 163
14197
-#define TK_FILTER 164
14198
-#define TK_COLUMN 165
14199
-#define TK_AGG_FUNCTION 166
14200
-#define TK_AGG_COLUMN 167
14201
-#define TK_TRUEFALSE 168
14202
-#define TK_ISNOT 169
14203
-#define TK_FUNCTION 170
14204
-#define TK_UMINUS 171
14205
-#define TK_UPLUS 172
14206
-#define TK_TRUTH 173
14207
-#define TK_REGISTER 174
14208
-#define TK_VECTOR 175
14209
-#define TK_SELECT_COLUMN 176
14210
-#define TK_IF_NULL_ROW 177
14211
-#define TK_ASTERISK 178
14212
-#define TK_SPAN 179
14213
-#define TK_SPACE 180
14214
-#define TK_ILLEGAL 181
14130
+#define TK_MATERIALIZED 97
14131
+#define TK_REINDEX 98
14132
+#define TK_RENAME 99
14133
+#define TK_CTIME_KW 100
14134
+#define TK_ANY 101
14135
+#define TK_BITAND 102
14136
+#define TK_BITOR 103
14137
+#define TK_LSHIFT 104
14138
+#define TK_RSHIFT 105
14139
+#define TK_PLUS 106
14140
+#define TK_MINUS 107
14141
+#define TK_STAR 108
14142
+#define TK_SLASH 109
14143
+#define TK_REM 110
14144
+#define TK_CONCAT 111
14145
+#define TK_COLLATE 112
14146
+#define TK_BITNOT 113
14147
+#define TK_ON 114
14148
+#define TK_INDEXED 115
14149
+#define TK_STRING 116
14150
+#define TK_JOIN_KW 117
14151
+#define TK_CONSTRAINT 118
14152
+#define TK_DEFAULT 119
14153
+#define TK_NULL 120
14154
+#define TK_PRIMARY 121
14155
+#define TK_UNIQUE 122
14156
+#define TK_CHECK 123
14157
+#define TK_REFERENCES 124
14158
+#define TK_AUTOINCR 125
14159
+#define TK_INSERT 126
14160
+#define TK_DELETE 127
14161
+#define TK_UPDATE 128
14162
+#define TK_SET 129
14163
+#define TK_DEFERRABLE 130
14164
+#define TK_FOREIGN 131
14165
+#define TK_DROP 132
14166
+#define TK_UNION 133
14167
+#define TK_ALL 134
14168
+#define TK_EXCEPT 135
14169
+#define TK_INTERSECT 136
14170
+#define TK_SELECT 137
14171
+#define TK_VALUES 138
14172
+#define TK_DISTINCT 139
14173
+#define TK_DOT 140
14174
+#define TK_FROM 141
14175
+#define TK_JOIN 142
14176
+#define TK_USING 143
14177
+#define TK_ORDER 144
14178
+#define TK_GROUP 145
14179
+#define TK_HAVING 146
14180
+#define TK_LIMIT 147
14181
+#define TK_WHERE 148
14182
+#define TK_RETURNING 149
14183
+#define TK_INTO 150
14184
+#define TK_NOTHING 151
14185
+#define TK_FLOAT 152
14186
+#define TK_BLOB 153
14187
+#define TK_INTEGER 154
14188
+#define TK_VARIABLE 155
14189
+#define TK_CASE 156
14190
+#define TK_WHEN 157
14191
+#define TK_THEN 158
14192
+#define TK_ELSE 159
14193
+#define TK_INDEX 160
14194
+#define TK_ALTER 161
14195
+#define TK_ADD 162
14196
+#define TK_WINDOW 163
14197
+#define TK_OVER 164
14198
+#define TK_FILTER 165
14199
+#define TK_COLUMN 166
14200
+#define TK_AGG_FUNCTION 167
14201
+#define TK_AGG_COLUMN 168
14202
+#define TK_TRUEFALSE 169
14203
+#define TK_ISNOT 170
14204
+#define TK_FUNCTION 171
14205
+#define TK_UMINUS 172
14206
+#define TK_UPLUS 173
14207
+#define TK_TRUTH 174
14208
+#define TK_REGISTER 175
14209
+#define TK_VECTOR 176
14210
+#define TK_SELECT_COLUMN 177
14211
+#define TK_IF_NULL_ROW 178
14212
+#define TK_ASTERISK 179
14213
+#define TK_SPAN 180
14214
+#define TK_SPACE 181
14215
+#define TK_ILLEGAL 182
1421514216
1421614217
/************** End of parse.h ***********************************************/
1421714218
/************** Continuing where we left off in sqliteInt.h ******************/
1421814219
#include <stdio.h>
1421914220
#include <stdlib.h>
@@ -14764,10 +14765,12 @@
1476414765
typedef struct AuthContext AuthContext;
1476514766
typedef struct AutoincInfo AutoincInfo;
1476614767
typedef struct Bitvec Bitvec;
1476714768
typedef struct CollSeq CollSeq;
1476814769
typedef struct Column Column;
14770
+typedef struct Cte Cte;
14771
+typedef struct CteUse CteUse;
1476914772
typedef struct Db Db;
1477014773
typedef struct DbFixer DbFixer;
1477114774
typedef struct Schema Schema;
1477214775
typedef struct Expr Expr;
1477314776
typedef struct ExprList ExprList;
@@ -14793,10 +14796,11 @@
1479314796
typedef struct RowSet RowSet;
1479414797
typedef struct Savepoint Savepoint;
1479514798
typedef struct Select Select;
1479614799
typedef struct SQLiteThread SQLiteThread;
1479714800
typedef struct SelectDest SelectDest;
14801
+typedef struct SrcItem SrcItem;
1479814802
typedef struct SrcList SrcList;
1479914803
typedef struct sqlite3_str StrAccum; /* Internal alias for sqlite3_str */
1480014804
typedef struct Table Table;
1480114805
typedef struct TableLock TableLock;
1480214806
typedef struct Token Token;
@@ -15786,26 +15790,26 @@
1578615790
#define OP_ReopenIdx 96 /* synopsis: root=P2 iDb=P3 */
1578715791
#define OP_OpenRead 97 /* synopsis: root=P2 iDb=P3 */
1578815792
#define OP_OpenWrite 98 /* synopsis: root=P2 iDb=P3 */
1578915793
#define OP_OpenDup 99
1579015794
#define OP_OpenAutoindex 100 /* synopsis: nColumn=P2 */
15791
-#define OP_BitAnd 101 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
15792
-#define OP_BitOr 102 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
15793
-#define OP_ShiftLeft 103 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
15794
-#define OP_ShiftRight 104 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
15795
-#define OP_Add 105 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
15796
-#define OP_Subtract 106 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
15797
-#define OP_Multiply 107 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
15798
-#define OP_Divide 108 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
15799
-#define OP_Remainder 109 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
15800
-#define OP_Concat 110 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
15801
-#define OP_OpenEphemeral 111 /* synopsis: nColumn=P2 */
15802
-#define OP_BitNot 112 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
15803
-#define OP_SorterOpen 113
15795
+#define OP_OpenEphemeral 101 /* synopsis: nColumn=P2 */
15796
+#define OP_BitAnd 102 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
15797
+#define OP_BitOr 103 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
15798
+#define OP_ShiftLeft 104 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
15799
+#define OP_ShiftRight 105 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
15800
+#define OP_Add 106 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
15801
+#define OP_Subtract 107 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
15802
+#define OP_Multiply 108 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
15803
+#define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
15804
+#define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
15805
+#define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
15806
+#define OP_SorterOpen 112
15807
+#define OP_BitNot 113 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
1580415808
#define OP_SequenceTest 114 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
15805
-#define OP_String8 115 /* same as TK_STRING, synopsis: r[P2]='P4' */
15806
-#define OP_OpenPseudo 116 /* synopsis: P3 columns in r[P2] */
15809
+#define OP_OpenPseudo 115 /* synopsis: P3 columns in r[P2] */
15810
+#define OP_String8 116 /* same as TK_STRING, synopsis: r[P2]='P4' */
1580715811
#define OP_Close 117
1580815812
#define OP_ColumnsUsed 118
1580915813
#define OP_SeekScan 119 /* synopsis: Scan-ahead up to P1 rows */
1581015814
#define OP_SeekHit 120 /* synopsis: set P2<=seekHit<=P3 */
1581115815
#define OP_Sequence 121 /* synopsis: r[P2]=cursor[P1].ctr++ */
@@ -15836,12 +15840,12 @@
1583615840
#define OP_DropTable 146
1583715841
#define OP_DropIndex 147
1583815842
#define OP_DropTrigger 148
1583915843
#define OP_IntegrityCk 149
1584015844
#define OP_RowSetAdd 150 /* synopsis: rowset(P1)=r[P2] */
15841
-#define OP_Real 151 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15842
-#define OP_Param 152
15845
+#define OP_Param 151
15846
+#define OP_Real 152 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
1584315847
#define OP_FkCounter 153 /* synopsis: fkctr[P1]+=P2 */
1584415848
#define OP_MemMax 154 /* synopsis: r[P1]=max(r[P1],r[P2]) */
1584515849
#define OP_OffsetLimit 155 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
1584615850
#define OP_AggInverse 156 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
1584715851
#define OP_AggStep 157 /* synopsis: accum=r[P3] step(r[P2@P5]) */
@@ -15888,13 +15892,13 @@
1588815892
/* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x01, 0x01, 0x01, 0x00,\
1588915893
/* 64 */ 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10,\
1589015894
/* 72 */ 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\
1589115895
/* 80 */ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\
1589215896
/* 88 */ 0x12, 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
15893
-/* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0x26,\
15894
-/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00,\
15895
-/* 112 */ 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\
15897
+/* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26,\
15898
+/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
15899
+/* 112 */ 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
1589615900
/* 120 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
1589715901
/* 128 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00,\
1589815902
/* 136 */ 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00,\
1589915903
/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10,\
1590015904
/* 152 */ 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00,\
@@ -15966,11 +15970,11 @@
1596615970
#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_EXPLAIN)
1596715971
SQLITE_PRIVATE void sqlite3ExplainBreakpoint(const char*,const char*);
1596815972
#else
1596915973
# define sqlite3ExplainBreakpoint(A,B) /*no-op*/
1597015974
#endif
15971
-SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);
15975
+SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*, int, char*, u16);
1597215976
SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, int addr, u8);
1597315977
SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
1597415978
SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
1597515979
SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3);
1597615980
SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u16 P5);
@@ -17475,11 +17479,16 @@
1747517479
u8 szEst; /* Estimated size of value in this column. sizeof(INT)==1 */
1747617480
u8 hName; /* Column name hash for faster lookup */
1747717481
u16 colFlags; /* Boolean properties. See COLFLAG_ defines below */
1747817482
};
1747917483
17480
-/* Allowed values for Column.colFlags:
17484
+/* Allowed values for Column.colFlags.
17485
+**
17486
+** Constraints:
17487
+** TF_HasVirtual == COLFLAG_VIRTUAL
17488
+** TF_HasStored == COLFLAG_STORED
17489
+** TF_HasHidden == COLFLAG_HIDDEN
1748117490
*/
1748217491
#define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */
1748317492
#define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */
1748417493
#define COLFLAG_HASTYPE 0x0004 /* Type name follows column name */
1748517494
#define COLFLAG_UNIQUE 0x0008 /* Column def contains "UNIQUE" or "PK" */
@@ -17664,15 +17673,16 @@
1766417673
** the TF_OOOHidden attribute would apply in this case. Such tables require
1766517674
** special handling during INSERT processing. The "OOO" means "Out Of Order".
1766617675
**
1766717676
** Constraints:
1766817677
**
17669
-** TF_HasVirtual == COLFLAG_Virtual
17670
-** TF_HasStored == COLFLAG_Stored
17678
+** TF_HasVirtual == COLFLAG_VIRTUAL
17679
+** TF_HasStored == COLFLAG_STORED
17680
+** TF_HasHidden == COLFLAG_HIDDEN
1767117681
*/
1767217682
#define TF_Readonly 0x0001 /* Read-only system table */
17673
-#define TF_Ephemeral 0x0002 /* An ephemeral table */
17683
+#define TF_HasHidden 0x0002 /* Has one or more hidden columns */
1767417684
#define TF_HasPrimaryKey 0x0004 /* Table has a primary key */
1767517685
#define TF_Autoincrement 0x0008 /* Integer primary key is autoincrement */
1767617686
#define TF_HasStat1 0x0010 /* nRowLogEst set from sqlite_stat1 */
1767717687
#define TF_HasVirtual 0x0020 /* Has one or more VIRTUAL columns */
1767817688
#define TF_HasStored 0x0040 /* Has one or more STORED columns */
@@ -17683,10 +17693,11 @@
1768317693
#define TF_NoVisibleRowid 0x0200 /* No user-visible "rowid" column */
1768417694
#define TF_OOOHidden 0x0400 /* Out-of-Order hidden columns */
1768517695
#define TF_HasNotNull 0x0800 /* Contains NOT NULL constraints */
1768617696
#define TF_Shadow 0x1000 /* True for a shadow table */
1768717697
#define TF_HasStat4 0x2000 /* STAT4 info available for this table */
17698
+#define TF_Ephemeral 0x4000 /* An ephemeral table */
1768817699
1768917700
/*
1769017701
** Test to see whether or not a table is a virtual table. This is
1769117702
** done as a macro so that it will be optimized out when virtual
1769217703
** table support is omitted from the build.
@@ -18051,11 +18062,10 @@
1805118062
int iMem; /* Memory location that acts as accumulator */
1805218063
int iDistinct; /* Ephemeral table used to enforce DISTINCT */
1805318064
} *aFunc;
1805418065
int nFunc; /* Number of entries in aFunc[] */
1805518066
u32 selId; /* Select to which this AggInfo belongs */
18056
- AggInfo *pNext; /* Next in list of them all */
1805718067
};
1805818068
1805918069
/*
1806018070
** The datatype ynVar is a signed integer, either 16-bit or 32-bit.
1806118071
** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater
@@ -18370,10 +18380,49 @@
1837018380
int idx; /* Index in some Table.aCol[] of a column named zName */
1837118381
} *a;
1837218382
int nId; /* Number of identifiers on the list */
1837318383
};
1837418384
18385
+/*
18386
+** The SrcItem object represents a single term in the FROM clause of a query.
18387
+** The SrcList object is mostly an array of SrcItems.
18388
+*/
18389
+struct SrcItem {
18390
+ Schema *pSchema; /* Schema to which this item is fixed */
18391
+ char *zDatabase; /* Name of database holding this table */
18392
+ char *zName; /* Name of the table */
18393
+ char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */
18394
+ Table *pTab; /* An SQL table corresponding to zName */
18395
+ Select *pSelect; /* A SELECT statement used in place of a table name */
18396
+ int addrFillSub; /* Address of subroutine to manifest a subquery */
18397
+ int regReturn; /* Register holding return address of addrFillSub */
18398
+ int regResult; /* Registers holding results of a co-routine */
18399
+ struct {
18400
+ u8 jointype; /* Type of join between this table and the previous */
18401
+ unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */
18402
+ unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */
18403
+ unsigned isTabFunc :1; /* True if table-valued-function syntax */
18404
+ unsigned isCorrelated :1; /* True if sub-query is correlated */
18405
+ unsigned viaCoroutine :1; /* Implemented as a co-routine */
18406
+ unsigned isRecursive :1; /* True for recursive reference in WITH */
18407
+ unsigned fromDDL :1; /* Comes from sqlite_schema */
18408
+ unsigned isCte :1; /* This is a CTE */
18409
+ } fg;
18410
+ int iCursor; /* The VDBE cursor number used to access this table */
18411
+ Expr *pOn; /* The ON clause of a join */
18412
+ IdList *pUsing; /* The USING clause of a join */
18413
+ Bitmask colUsed; /* Bit N (1<<N) set if column N of pTab is used */
18414
+ union {
18415
+ char *zIndexedBy; /* Identifier from "INDEXED BY <zIndex>" clause */
18416
+ ExprList *pFuncArg; /* Arguments to table-valued-function */
18417
+ } u1;
18418
+ union {
18419
+ Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */
18420
+ CteUse *pCteUse; /* CTE Usage info info fg.isCte is true */
18421
+ } u2;
18422
+};
18423
+
1837518424
/*
1837618425
** The following structure describes the FROM clause of a SELECT statement.
1837718426
** Each table or subquery in the FROM clause is a separate element of
1837818427
** the SrcList.a[] array.
1837918428
**
@@ -18392,40 +18441,11 @@
1839218441
** contains more than 63 columns and the 64-th or later column is used.
1839318442
*/
1839418443
struct SrcList {
1839518444
int nSrc; /* Number of tables or subqueries in the FROM clause */
1839618445
u32 nAlloc; /* Number of entries allocated in a[] below */
18397
- struct SrcList_item {
18398
- Schema *pSchema; /* Schema to which this item is fixed */
18399
- char *zDatabase; /* Name of database holding this table */
18400
- char *zName; /* Name of the table */
18401
- char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */
18402
- Table *pTab; /* An SQL table corresponding to zName */
18403
- Select *pSelect; /* A SELECT statement used in place of a table name */
18404
- int addrFillSub; /* Address of subroutine to manifest a subquery */
18405
- int regReturn; /* Register holding return address of addrFillSub */
18406
- int regResult; /* Registers holding results of a co-routine */
18407
- struct {
18408
- u8 jointype; /* Type of join between this table and the previous */
18409
- unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */
18410
- unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */
18411
- unsigned isTabFunc :1; /* True if table-valued-function syntax */
18412
- unsigned isCorrelated :1; /* True if sub-query is correlated */
18413
- unsigned viaCoroutine :1; /* Implemented as a co-routine */
18414
- unsigned isRecursive :1; /* True for recursive reference in WITH */
18415
- unsigned fromDDL :1; /* Comes from sqlite_schema */
18416
- } fg;
18417
- int iCursor; /* The VDBE cursor number used to access this table */
18418
- Expr *pOn; /* The ON clause of a join */
18419
- IdList *pUsing; /* The USING clause of a join */
18420
- Bitmask colUsed; /* Bit N (1<<N) set if column N of pTab is used */
18421
- union {
18422
- char *zIndexedBy; /* Identifier from "INDEXED BY <zIndex>" clause */
18423
- ExprList *pFuncArg; /* Arguments to table-valued-function */
18424
- } u1;
18425
- Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */
18426
- } a[1]; /* One entry for each identifier on the list */
18446
+ SrcItem a[1]; /* One entry for each identifier on the list */
1842718447
};
1842818448
1842918449
/*
1843018450
** Permitted values of the SrcList.a.jointype field
1843118451
*/
@@ -18644,10 +18664,11 @@
1864418664
#define SF_WhereBegin 0x0080000 /* Really a WhereBegin() call. Debug Only */
1864518665
#define SF_WinRewrite 0x0100000 /* Window function rewrite accomplished */
1864618666
#define SF_View 0x0200000 /* SELECT statement is a view */
1864718667
#define SF_NoopOrderBy 0x0400000 /* ORDER BY is ignored for this query */
1864818668
#define SF_UpdateFrom 0x0800000 /* Statement is an UPDATE...FROM */
18669
+#define SF_PushDown 0x1000000 /* SELECT has be modified by push-down opt */
1864918670
1865018671
/*
1865118672
** The results of a SELECT can be distributed in several ways, as defined
1865218673
** by one of the following macros. The "SRT" prefix means "SELECT Result
1865318674
** Type".
@@ -18886,11 +18907,10 @@
1888618907
#endif
1888718908
AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
1888818909
Parse *pToplevel; /* Parse structure for main program (or NULL) */
1888918910
Table *pTriggerTab; /* Table triggers are being coded for */
1889018911
Parse *pParentParse; /* Parent parser if this parser is nested */
18891
- AggInfo *pAggList; /* List of all AggInfo objects */
1889218912
union {
1889318913
int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
1889418914
Returning *pReturning; /* The RETURNING clause */
1889518915
} u1;
1889618916
u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
@@ -19170,11 +19190,12 @@
1917019190
} InitData;
1917119191
1917219192
/*
1917319193
** Allowed values for mInitFlags
1917419194
*/
19175
-#define INITFLAG_AlterTable 0x0001 /* This is a reparse after ALTER TABLE */
19195
+#define INITFLAG_AlterRename 0x0001 /* Reparse after a RENAME */
19196
+#define INITFLAG_AlterDrop 0x0002 /* Reparse after a DROP COLUMN */
1917619197
1917719198
/*
1917819199
** Structure containing global configuration data for the SQLite library.
1917919200
**
1918019201
** This structure also contains some state information.
@@ -19282,11 +19303,11 @@
1928219303
Select *pSelect; /* HAVING to WHERE clause ctx */
1928319304
struct WindowRewrite *pRewrite; /* Window rewrite context */
1928419305
struct WhereConst *pConst; /* WHERE clause constants */
1928519306
struct RenameCtx *pRename; /* RENAME COLUMN context */
1928619307
struct Table *pTab; /* Table of generated column */
19287
- struct SrcList_item *pSrcItem; /* A single FROM clause item */
19308
+ SrcItem *pSrcItem; /* A single FROM clause item */
1928819309
DbFixer *pFix;
1928919310
} u;
1929019311
};
1929119312
1929219313
/*
@@ -19327,23 +19348,58 @@
1932719348
#define WRC_Continue 0 /* Continue down into children */
1932819349
#define WRC_Prune 1 /* Omit children but continue walking siblings */
1932919350
#define WRC_Abort 2 /* Abandon the tree walk */
1933019351
1933119352
/*
19332
-** An instance of this structure represents a set of one or more CTEs
19333
-** (common table expressions) created by a single WITH clause.
19353
+** A single common table expression
19354
+*/
19355
+struct Cte {
19356
+ char *zName; /* Name of this CTE */
19357
+ ExprList *pCols; /* List of explicit column names, or NULL */
19358
+ Select *pSelect; /* The definition of this CTE */
19359
+ const char *zCteErr; /* Error message for circular references */
19360
+ CteUse *pUse; /* Usage information for this CTE */
19361
+ u8 eM10d; /* The MATERIALIZED flag */
19362
+};
19363
+
19364
+/*
19365
+** Allowed values for the materialized flag (eM10d):
19366
+*/
19367
+#define M10d_Yes 0 /* AS MATERIALIZED */
19368
+#define M10d_Any 1 /* Not specified. Query planner's choice */
19369
+#define M10d_No 2 /* AS NOT MATERIALIZED */
19370
+
19371
+/*
19372
+** An instance of the With object represents a WITH clause containing
19373
+** one or more CTEs (common table expressions).
1933419374
*/
1933519375
struct With {
19336
- int nCte; /* Number of CTEs in the WITH clause */
19337
- With *pOuter; /* Containing WITH clause, or NULL */
19338
- struct Cte { /* For each CTE in the WITH clause.... */
19339
- char *zName; /* Name of this CTE */
19340
- ExprList *pCols; /* List of explicit column names, or NULL */
19341
- Select *pSelect; /* The definition of this CTE */
19342
- const char *zCteErr; /* Error message for circular references */
19343
- } a[1];
19376
+ int nCte; /* Number of CTEs in the WITH clause */
19377
+ With *pOuter; /* Containing WITH clause, or NULL */
19378
+ Cte a[1]; /* For each CTE in the WITH clause.... */
1934419379
};
19380
+
19381
+/*
19382
+** The Cte object is not guaranteed to persist for the entire duration
19383
+** of code generation. (The query flattener or other parser tree
19384
+** edits might delete it.) The following object records information
19385
+** about each Common Table Expression that must be preserved for the
19386
+** duration of the parse.
19387
+**
19388
+** The CteUse objects are freed using sqlite3ParserAddCleanup() rather
19389
+** than sqlite3SelectDelete(), which is what enables them to persist
19390
+** until the end of code generation.
19391
+*/
19392
+struct CteUse {
19393
+ int nUse; /* Number of users of this CTE */
19394
+ int addrM9e; /* Start of subroutine to compute materialization */
19395
+ int regRtn; /* Return address register for addrM9e subroutine */
19396
+ int iCur; /* Ephemeral table holding the materialization */
19397
+ LogEst nRowEst; /* Estimated number of rows in the table */
19398
+ u8 eM10d; /* The MATERIALIZED flag */
19399
+};
19400
+
1934519401
1934619402
#ifdef SQLITE_DEBUG
1934719403
/*
1934819404
** An instance of the TreeView object is used for printing the content of
1934919405
** data structures on sqlite3DebugPrintf() using a tree-like view.
@@ -19800,11 +19856,11 @@
1980019856
SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(Parse*, SrcList*, Token*, Token*);
1980119857
SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*,
1980219858
Token*, Select*, Expr*, IdList*);
1980319859
SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *);
1980419860
SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse*, SrcList*, ExprList*);
19805
-SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, struct SrcList_item *);
19861
+SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, SrcItem *);
1980619862
SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList*);
1980719863
SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse*, SrcList*);
1980819864
SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*);
1980919865
SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3*, SrcList*);
1981019866
SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(sqlite3*,i16,int,char**);
@@ -19862,11 +19918,11 @@
1986219918
SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse*, Expr*, int, int);
1986319919
SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*);
1986419920
#define LOCATE_VIEW 0x01
1986519921
#define LOCATE_NOERR 0x02
1986619922
SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*);
19867
-SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,struct SrcList_item *);
19923
+SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,SrcItem *);
1986819924
SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*);
1986919925
SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);
1987019926
SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
1987119927
SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*,Expr*);
1987219928
SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int, sqlite3_value*);
@@ -19990,10 +20046,11 @@
1999020046
# define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
1999120047
# define sqlite3TriggerStepSrc(A,B) 0
1999220048
#endif
1999320049
1999420050
SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*);
20051
+SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol);
1999520052
SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr*,int);
1999620053
SQLITE_PRIVATE void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);
1999720054
SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse*, int);
1999820055
#ifndef SQLITE_OMIT_AUTHORIZATION
1999920056
SQLITE_PRIVATE void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);
@@ -20156,11 +20213,11 @@
2015620213
SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
2015720214
SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
2015820215
SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
2015920216
SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
2016020217
SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
20161
-SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, struct SrcList_item*);
20218
+SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, SrcItem*);
2016220219
SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
2016320220
SQLITE_PRIVATE int sqlite3MatchEName(
2016420221
const struct ExprList_item*,
2016520222
const char*,
2016620223
const char*,
@@ -20174,10 +20231,11 @@
2017420231
SQLITE_PRIVATE int sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*);
2017520232
SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
2017620233
SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
2017720234
SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
2017820235
SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
20236
+SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse*, SrcList*, Token*);
2017920237
SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse*, void*, Token*);
2018020238
SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom);
2018120239
SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*);
2018220240
SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse*, ExprList*);
2018320241
SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
@@ -20327,11 +20385,11 @@
2032720385
SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
2032820386
SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
2032920387
SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
2033020388
SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
2033120389
SQLITE_PRIVATE void sqlite3ParserReset(Parse*);
20332
-SQLITE_PRIVATE void sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*);
20390
+SQLITE_PRIVATE void *sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*);
2033320391
#ifdef SQLITE_ENABLE_NORMALIZE
2033420392
SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*);
2033520393
#endif
2033620394
SQLITE_PRIVATE int sqlite3Reprepare(Vdbe*);
2033720395
SQLITE_PRIVATE void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*);
@@ -20342,16 +20400,21 @@
2034220400
#ifndef SQLITE_OMIT_WAL
2034320401
SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3*, int, int, int*, int*);
2034420402
SQLITE_PRIVATE int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int);
2034520403
#endif
2034620404
#ifndef SQLITE_OMIT_CTE
20347
-SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Token*,ExprList*,Select*);
20405
+SQLITE_PRIVATE Cte *sqlite3CteNew(Parse*,Token*,ExprList*,Select*,u8);
20406
+SQLITE_PRIVATE void sqlite3CteDelete(sqlite3*,Cte*);
20407
+SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Cte*);
2034820408
SQLITE_PRIVATE void sqlite3WithDelete(sqlite3*,With*);
2034920409
SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8);
2035020410
#else
20351
-#define sqlite3WithPush(x,y,z)
20352
-#define sqlite3WithDelete(x,y)
20411
+# define sqlite3CteNew(P,T,E,S) ((void*)0)
20412
+# define sqlite3CteDelete(D,C)
20413
+# define sqlite3CteWithAdd(P,W,C) ((void*)0)
20414
+# define sqlite3WithDelete(x,y)
20415
+# define sqlite3WithPush(x,y,z)
2035320416
#endif
2035420417
#ifndef SQLITE_OMIT_UPSERT
2035520418
SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*);
2035620419
SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*);
2035720420
SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
@@ -29201,11 +29264,11 @@
2920129264
break;
2920229265
}
2920329266
case etSRCLIST: {
2920429267
SrcList *pSrc;
2920529268
int k;
29206
- struct SrcList_item *pItem;
29269
+ SrcItem *pItem;
2920729270
if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
2920829271
pSrc = va_arg(ap, SrcList*);
2920929272
k = va_arg(ap, int);
2921029273
pItem = &pSrc->a[k];
2921129274
assert( bArgList==0 );
@@ -29769,11 +29832,14 @@
2976929832
sqlite3_str_appendf(&x, "%c%s", cSep, pCte->pCols->a[j].zEName);
2977029833
cSep = ',';
2977129834
}
2977229835
sqlite3_str_appendf(&x, ")");
2977329836
}
29774
- sqlite3_str_appendf(&x, " AS");
29837
+ if( pCte->pUse ){
29838
+ sqlite3_str_appendf(&x, " (pUse=0x%p, nUse=%d)", pCte->pUse,
29839
+ pCte->pUse->nUse);
29840
+ }
2977529841
sqlite3StrAccumFinish(&x);
2977629842
sqlite3TreeViewItem(pView, zLine, i<pWith->nCte-1);
2977729843
sqlite3TreeViewSelect(pView, pCte->pSelect, 0);
2977829844
sqlite3TreeViewPop(pView);
2977929845
}
@@ -29785,11 +29851,11 @@
2978529851
** Generate a human-readable description of a SrcList object.
2978629852
*/
2978729853
SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){
2978829854
int i;
2978929855
for(i=0; i<pSrc->nSrc; i++){
29790
- const struct SrcList_item *pItem = &pSrc->a[i];
29856
+ const SrcItem *pItem = &pSrc->a[i];
2979129857
StrAccum x;
2979229858
char zLine[100];
2979329859
sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);
2979429860
sqlite3_str_appendf(&x, "{%d:*}", pItem->iCursor);
2979529861
if( pItem->zDatabase ){
@@ -29808,10 +29874,13 @@
2980829874
sqlite3_str_appendf(&x, " LEFT-JOIN");
2980929875
}
2981029876
if( pItem->fg.fromDDL ){
2981129877
sqlite3_str_appendf(&x, " DDL");
2981229878
}
29879
+ if( pItem->fg.isCte ){
29880
+ sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse);
29881
+ }
2981329882
sqlite3StrAccumFinish(&x);
2981429883
sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1);
2981529884
if( pItem->pSelect ){
2981629885
sqlite3TreeViewSelect(pView, pItem->pSelect, 0);
2981729886
}
@@ -33481,26 +33550,26 @@
3348133550
/* 96 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
3348233551
/* 97 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
3348333552
/* 98 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
3348433553
/* 99 */ "OpenDup" OpHelp(""),
3348533554
/* 100 */ "OpenAutoindex" OpHelp("nColumn=P2"),
33486
- /* 101 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
33487
- /* 102 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
33488
- /* 103 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
33489
- /* 104 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
33490
- /* 105 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
33491
- /* 106 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
33492
- /* 107 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
33493
- /* 108 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
33494
- /* 109 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
33495
- /* 110 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
33496
- /* 111 */ "OpenEphemeral" OpHelp("nColumn=P2"),
33497
- /* 112 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
33498
- /* 113 */ "SorterOpen" OpHelp(""),
33555
+ /* 101 */ "OpenEphemeral" OpHelp("nColumn=P2"),
33556
+ /* 102 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
33557
+ /* 103 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
33558
+ /* 104 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
33559
+ /* 105 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
33560
+ /* 106 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
33561
+ /* 107 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
33562
+ /* 108 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
33563
+ /* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
33564
+ /* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
33565
+ /* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
33566
+ /* 112 */ "SorterOpen" OpHelp(""),
33567
+ /* 113 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
3349933568
/* 114 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
33500
- /* 115 */ "String8" OpHelp("r[P2]='P4'"),
33501
- /* 116 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
33569
+ /* 115 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
33570
+ /* 116 */ "String8" OpHelp("r[P2]='P4'"),
3350233571
/* 117 */ "Close" OpHelp(""),
3350333572
/* 118 */ "ColumnsUsed" OpHelp(""),
3350433573
/* 119 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
3350533574
/* 120 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
3350633575
/* 121 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
@@ -33531,12 +33600,12 @@
3353133600
/* 146 */ "DropTable" OpHelp(""),
3353233601
/* 147 */ "DropIndex" OpHelp(""),
3353333602
/* 148 */ "DropTrigger" OpHelp(""),
3353433603
/* 149 */ "IntegrityCk" OpHelp(""),
3353533604
/* 150 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
33536
- /* 151 */ "Real" OpHelp("r[P2]=P4"),
33537
- /* 152 */ "Param" OpHelp(""),
33605
+ /* 151 */ "Param" OpHelp(""),
33606
+ /* 152 */ "Real" OpHelp("r[P2]=P4"),
3353833607
/* 153 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
3353933608
/* 154 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
3354033609
/* 155 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
3354133610
/* 156 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
3354233611
/* 157 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
@@ -78733,13 +78802,14 @@
7873378802
** as having been used.
7873478803
**
7873578804
** The zWhere string must have been obtained from sqlite3_malloc().
7873678805
** This routine will take ownership of the allocated memory.
7873778806
*/
78738
-SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere){
78807
+SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere, u16 p5){
7873978808
int j;
7874078809
sqlite3VdbeAddOp4(p, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC);
78810
+ sqlite3VdbeChangeP5(p, p5);
7874178811
for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);
7874278812
sqlite3MayAbort(p->pParse);
7874378813
}
7874478814
7874578815
/*
@@ -89804,11 +89874,11 @@
8980489874
assert( aMem[pOp->p3].flags & MEM_Null );
8980589875
aMem[pOp->p3].n = 0;
8980689876
aMem[pOp->p3].z = "";
8980789877
}
8980889878
pCx = p->apCsr[pOp->p1];
89809
- if( pCx && pCx->pBtx ){
89879
+ if( pCx && ALWAYS(pCx->pBtx) ){
8981089880
/* If the ephermeral table is already open, erase all existing content
8981189881
** so that the table is empty again, rather than creating a new table. */
8981289882
assert( pCx->isEphemeral );
8981389883
pCx->seqCount = 0;
8981489884
pCx->cacheStatus = CACHE_STALE;
@@ -92185,11 +92255,11 @@
9218592255
9218692256
#ifndef SQLITE_OMIT_ALTERTABLE
9218792257
if( pOp->p4.z==0 ){
9218892258
sqlite3SchemaClear(db->aDb[iDb].pSchema);
9218992259
db->mDbFlags &= ~DBFLAG_SchemaKnownOk;
92190
- rc = sqlite3InitOne(db, iDb, &p->zErrMsg, INITFLAG_AlterTable);
92260
+ rc = sqlite3InitOne(db, iDb, &p->zErrMsg, pOp->p5);
9219192261
db->mDbFlags |= DBFLAG_SchemaChange;
9219292262
p->expired = 0;
9219392263
}else
9219492264
#endif
9219592265
{
@@ -98409,11 +98479,11 @@
9840998479
** WRC_Abort or WRC_Continue;
9841098480
*/
9841198481
SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){
9841298482
SrcList *pSrc;
9841398483
int i;
98414
- struct SrcList_item *pItem;
98484
+ SrcItem *pItem;
9841598485
9841698486
pSrc = p->pSrc;
9841798487
if( pSrc ){
9841898488
for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
9841998489
if( pItem->pSelect && sqlite3WalkSelect(pWalker, pItem->pSelect) ){
@@ -98575,11 +98645,10 @@
9857598645
static void resolveAlias(
9857698646
Parse *pParse, /* Parsing context */
9857798647
ExprList *pEList, /* A result set */
9857898648
int iCol, /* A column in the result set. 0..pEList->nExpr-1 */
9857998649
Expr *pExpr, /* Transform this into an alias to the result set */
98580
- const char *zType, /* "GROUP" or "ORDER" or "" */
9858198650
int nSubquery /* Number of subqueries that the label is moving */
9858298651
){
9858398652
Expr *pOrig; /* The iCol-th column of the result set */
9858498653
Expr *pDup; /* Copy of pOrig */
9858598654
sqlite3 *db; /* The database connection */
@@ -98588,11 +98657,11 @@
9858898657
pOrig = pEList->a[iCol].pExpr;
9858998658
assert( pOrig!=0 );
9859098659
db = pParse->db;
9859198660
pDup = sqlite3ExprDup(db, pOrig, 0);
9859298661
if( pDup!=0 ){
98593
- if( zType[0]!='G' ) incrAggFunctionDepth(pDup, nSubquery);
98662
+ incrAggFunctionDepth(pDup, nSubquery);
9859498663
if( pExpr->op==TK_COLLATE ){
9859598664
pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);
9859698665
}
9859798666
9859898667
/* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
@@ -98751,12 +98820,12 @@
9875198820
int i, j; /* Loop counters */
9875298821
int cnt = 0; /* Number of matching column names */
9875398822
int cntTab = 0; /* Number of matching table names */
9875498823
int nSubquery = 0; /* How many levels of subquery */
9875598824
sqlite3 *db = pParse->db; /* The database connection */
98756
- struct SrcList_item *pItem; /* Use for looping over pSrcList items */
98757
- struct SrcList_item *pMatch = 0; /* The matching pSrcList item */
98825
+ SrcItem *pItem; /* Use for looping over pSrcList items */
98826
+ SrcItem *pMatch = 0; /* The matching pSrcList item */
9875898827
NameContext *pTopNC = pNC; /* First namecontext in the list */
9875998828
Schema *pSchema = 0; /* Schema of the expression */
9876098829
int eNewExprOp = TK_COLUMN; /* New value for pExpr->op on success */
9876198830
Table *pTab = 0; /* Table hold the row */
9876298831
Column *pCol; /* A column of pTab */
@@ -98873,13 +98942,14 @@
9887398942
} /* if( pSrcList ) */
9887498943
9887598944
#if !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT)
9887698945
/* If we have not already resolved the name, then maybe
9887798946
** it is a new.* or old.* trigger argument reference. Or
98878
- ** maybe it is an excluded.* from an upsert.
98947
+ ** maybe it is an excluded.* from an upsert. Or maybe it is
98948
+ ** a reference in the RETURNING clause to a table being modified.
9887998949
*/
98880
- if( cntTab==0 && zDb==0 ){
98950
+ if( cnt==0 && zDb==0 ){
9888198951
pTab = 0;
9888298952
#ifndef SQLITE_OMIT_TRIGGER
9888398953
if( pParse->pTriggerTab!=0 ){
9888498954
int op = pParse->eTriggerOp;
9888598955
assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
@@ -98887,18 +98957,18 @@
9888798957
pExpr->iTable = 1;
9888898958
pTab = pParse->pTriggerTab;
9888998959
}else if( op!=TK_INSERT && zTab && sqlite3StrICmp("old",zTab)==0 ){
9889098960
pExpr->iTable = 0;
9889198961
pTab = pParse->pTriggerTab;
98892
- }else if( pParse->bReturning ){
98962
+ }else if( pParse->bReturning && (pNC->ncFlags & NC_UBaseReg)!=0 ){
9889398963
pExpr->iTable = op!=TK_DELETE;
9889498964
pTab = pParse->pTriggerTab;
9889598965
}
9889698966
}
9889798967
#endif /* SQLITE_OMIT_TRIGGER */
9889898968
#ifndef SQLITE_OMIT_UPSERT
98899
- if( (pNC->ncFlags & NC_UUpsert)!=0 && ALWAYS(zTab) ){
98969
+ if( (pNC->ncFlags & NC_UUpsert)!=0 && zTab!=0 ){
9890098970
Upsert *pUpsert = pNC->uNC.pUpsert;
9890198971
if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){
9890298972
pTab = pUpsert->pUpsertSrc->a[0].pTab;
9890398973
pExpr->iTable = EXCLUDED_TABLE_NUMBER;
9890498974
}
@@ -98941,11 +99011,11 @@
9894199011
{
9894299012
pExpr->y.pTab = pTab;
9894399013
if( pParse->bReturning ){
9894499014
eNewExprOp = TK_REGISTER;
9894599015
pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable
98946
- + iCol + 1;
99016
+ + iCol + 1;
9894799017
}else{
9894899018
pExpr->iColumn = (i16)iCol;
9894999019
eNewExprOp = TK_TRIGGER;
9895099020
#ifndef SQLITE_OMIT_TRIGGER
9895199021
if( iCol<0 ){
@@ -99028,11 +99098,11 @@
9902899098
}
9902999099
if( sqlite3ExprVectorSize(pOrig)!=1 ){
9903099100
sqlite3ErrorMsg(pParse, "row value misused");
9903199101
return WRC_Abort;
9903299102
}
99033
- resolveAlias(pParse, pEList, j, pExpr, "", nSubquery);
99103
+ resolveAlias(pParse, pEList, j, pExpr, nSubquery);
9903499104
cnt = 1;
9903599105
pMatch = 0;
9903699106
assert( zTab==0 && zDb==0 );
9903799107
if( IN_RENAME_OBJECT ){
9903899108
sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr);
@@ -99130,14 +99200,16 @@
9913099200
pMatch->colUsed |= sqlite3ExprColUsed(pExpr);
9913199201
}
9913299202
9913399203
/* Clean up and return
9913499204
*/
99135
- sqlite3ExprDelete(db, pExpr->pLeft);
99136
- pExpr->pLeft = 0;
99137
- sqlite3ExprDelete(db, pExpr->pRight);
99138
- pExpr->pRight = 0;
99205
+ if( !ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
99206
+ sqlite3ExprDelete(db, pExpr->pLeft);
99207
+ pExpr->pLeft = 0;
99208
+ sqlite3ExprDelete(db, pExpr->pRight);
99209
+ pExpr->pRight = 0;
99210
+ }
9913999211
pExpr->op = eNewExprOp;
9914099212
ExprSetProperty(pExpr, EP_Leaf);
9914199213
lookupname_end:
9914299214
if( cnt==1 ){
9914399215
assert( pNC!=0 );
@@ -99165,11 +99237,11 @@
9916599237
** from datasource iSrc in SrcList pSrc.
9916699238
*/
9916799239
SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
9916899240
Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0);
9916999241
if( p ){
99170
- struct SrcList_item *pItem = &pSrc->a[iSrc];
99242
+ SrcItem *pItem = &pSrc->a[iSrc];
9917199243
Table *pTab = p->y.pTab = pItem->pTab;
9917299244
p->iTable = pItem->iCursor;
9917399245
if( p->y.pTab->iPKey==iCol ){
9917499246
p->iColumn = -1;
9917599247
}else{
@@ -99277,11 +99349,11 @@
9927799349
** clause processing on UPDATE and DELETE statements, and by
9927899350
** UPDATE ... FROM statement processing.
9927999351
*/
9928099352
case TK_ROW: {
9928199353
SrcList *pSrcList = pNC->pSrcList;
99282
- struct SrcList_item *pItem;
99354
+ SrcItem *pItem;
9928399355
assert( pSrcList && pSrcList->nSrc>=1 );
9928499356
pItem = pSrcList->a;
9928599357
pExpr->op = TK_COLUMN;
9928699358
pExpr->y.pTab = pItem->pTab;
9928799359
pExpr->iTable = pItem->iCursor;
@@ -99905,12 +99977,11 @@
9990599977
if( pItem->u.x.iOrderByCol ){
9990699978
if( pItem->u.x.iOrderByCol>pEList->nExpr ){
9990799979
resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr);
9990899980
return 1;
9990999981
}
99910
- resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,
99911
- zType,0);
99982
+ resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,0);
9991299983
}
9991399984
}
9991499985
return 0;
9991599986
}
9991699987
@@ -100091,11 +100162,11 @@
100091100162
}
100092100163
100093100164
/* Recursively resolve names in all subqueries
100094100165
*/
100095100166
for(i=0; i<p->pSrc->nSrc; i++){
100096
- struct SrcList_item *pItem = &p->pSrc->a[i];
100167
+ SrcItem *pItem = &p->pSrc->a[i];
100097100168
if( pItem->pSelect && (pItem->pSelect->selFlags & SF_Resolved)==0 ){
100098100169
NameContext *pNC; /* Used to iterate name contexts */
100099100170
int nRef = 0; /* Refcount for pOuterNC and outer contexts */
100100100171
const char *zSavedContext = pParse->zAuthContext;
100101100172
@@ -100153,19 +100224,19 @@
100153100224
** aliases in the result set.
100154100225
**
100155100226
** Minor point: If this is the case, then the expression will be
100156100227
** re-evaluated for each reference to it.
100157100228
*/
100158
- assert( (sNC.ncFlags & (NC_UAggInfo|NC_UUpsert))==0 );
100229
+ assert( (sNC.ncFlags & (NC_UAggInfo|NC_UUpsert|NC_UBaseReg))==0 );
100159100230
sNC.uNC.pEList = p->pEList;
100160100231
sNC.ncFlags |= NC_UEList;
100161100232
if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
100162100233
if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;
100163100234
100164100235
/* Resolve names in table-valued-function arguments */
100165100236
for(i=0; i<p->pSrc->nSrc; i++){
100166
- struct SrcList_item *pItem = &p->pSrc->a[i];
100237
+ SrcItem *pItem = &p->pSrc->a[i];
100167100238
if( pItem->fg.isTabFunc
100168100239
&& sqlite3ResolveExprListNames(&sNC, pItem->u1.pFuncArg)
100169100240
){
100170100241
return WRC_Abort;
100171100242
}
@@ -102005,12 +102076,12 @@
102005102076
nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0);
102006102077
pNew = sqlite3DbMallocRawNN(db, nByte );
102007102078
if( pNew==0 ) return 0;
102008102079
pNew->nSrc = pNew->nAlloc = p->nSrc;
102009102080
for(i=0; i<p->nSrc; i++){
102010
- struct SrcList_item *pNewItem = &pNew->a[i];
102011
- struct SrcList_item *pOldItem = &p->a[i];
102081
+ SrcItem *pNewItem = &pNew->a[i];
102082
+ SrcItem *pOldItem = &p->a[i];
102012102083
Table *pTab;
102013102084
pNewItem->pSchema = pOldItem->pSchema;
102014102085
pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase);
102015102086
pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
102016102087
pNewItem->zAlias = sqlite3DbStrDup(db, pOldItem->zAlias);
@@ -102019,11 +102090,14 @@
102019102090
pNewItem->addrFillSub = pOldItem->addrFillSub;
102020102091
pNewItem->regReturn = pOldItem->regReturn;
102021102092
if( pNewItem->fg.isIndexedBy ){
102022102093
pNewItem->u1.zIndexedBy = sqlite3DbStrDup(db, pOldItem->u1.zIndexedBy);
102023102094
}
102024
- pNewItem->pIBIndex = pOldItem->pIBIndex;
102095
+ pNewItem->u2 = pOldItem->u2;
102096
+ if( pNewItem->fg.isCte ){
102097
+ pNewItem->u2.pCteUse->nUse++;
102098
+ }
102025102099
if( pNewItem->fg.isTabFunc ){
102026102100
pNewItem->u1.pFuncArg =
102027102101
sqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags);
102028102102
}
102029102103
pTab = pNewItem->pTab = pOldItem->pTab;
@@ -106336,11 +106410,11 @@
106336106410
testcase( pExpr->op==TK_AGG_COLUMN );
106337106411
testcase( pExpr->op==TK_COLUMN );
106338106412
/* Check to see if the column is in one of the tables in the FROM
106339106413
** clause of the aggregate query */
106340106414
if( ALWAYS(pSrcList!=0) ){
106341
- struct SrcList_item *pItem = pSrcList->a;
106415
+ SrcItem *pItem = pSrcList->a;
106342106416
for(i=0; i<pSrcList->nSrc; i++, pItem++){
106343106417
struct AggInfo_col *pCol;
106344106418
assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) );
106345106419
if( pExpr->iTable==pItem->iCursor ){
106346106420
/* If we reach this point, it means that pExpr refers to a table
@@ -106625,43 +106699,49 @@
106625106699
** bTemp is not true, database "temp", can still be parsed. This is
106626106700
** called at the end of the generation of an ALTER TABLE ... RENAME ...
106627106701
** statement to ensure that the operation has not rendered any schema
106628106702
** objects unusable.
106629106703
*/
106630
-static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){
106704
+static void renameTestSchema(
106705
+ Parse *pParse, /* Parse context */
106706
+ const char *zDb, /* Name of db to verify schema of */
106707
+ int bTemp, /* True if this is the temp db */
106708
+ const char *zWhen /* "when" part of error message */
106709
+){
106710
+ pParse->colNamesSet = 1;
106631106711
sqlite3NestedParse(pParse,
106632106712
"SELECT 1 "
106633106713
"FROM \"%w\"." DFLT_SCHEMA_TABLE " "
106634106714
"WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
106635106715
" AND sql NOT LIKE 'create virtual%%'"
106636
- " AND sqlite_rename_test(%Q, sql, type, name, %d)=NULL ",
106716
+ " AND sqlite_rename_test(%Q, sql, type, name, %d, %Q)=NULL ",
106637106717
zDb,
106638
- zDb, bTemp
106718
+ zDb, bTemp, zWhen
106639106719
);
106640106720
106641106721
if( bTemp==0 ){
106642106722
sqlite3NestedParse(pParse,
106643106723
"SELECT 1 "
106644106724
"FROM temp." DFLT_SCHEMA_TABLE " "
106645106725
"WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
106646106726
" AND sql NOT LIKE 'create virtual%%'"
106647
- " AND sqlite_rename_test(%Q, sql, type, name, 1)=NULL ",
106648
- zDb
106727
+ " AND sqlite_rename_test(%Q, sql, type, name, 1, %Q)=NULL ",
106728
+ zDb, zWhen
106649106729
);
106650106730
}
106651106731
}
106652106732
106653106733
/*
106654106734
** Generate code to reload the schema for database iDb. And, if iDb!=1, for
106655106735
** the temp database as well.
106656106736
*/
106657
-static void renameReloadSchema(Parse *pParse, int iDb){
106737
+static void renameReloadSchema(Parse *pParse, int iDb, u16 p5){
106658106738
Vdbe *v = pParse->pVdbe;
106659106739
if( v ){
106660106740
sqlite3ChangeCookie(pParse, iDb);
106661
- sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, iDb, 0);
106662
- if( iDb!=1 ) sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0);
106741
+ sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, iDb, 0, p5);
106742
+ if( iDb!=1 ) sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0, p5);
106663106743
}
106664106744
}
106665106745
106666106746
/*
106667106747
** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy"
@@ -106806,11 +106886,11 @@
106806106886
sqlite3NestedParse(pParse,
106807106887
"UPDATE sqlite_temp_schema SET "
106808106888
"sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), "
106809106889
"tbl_name = "
106810106890
"CASE WHEN tbl_name=%Q COLLATE nocase AND "
106811
- " sqlite_rename_test(%Q, sql, type, name, 1) "
106891
+ " sqlite_rename_test(%Q, sql, type, name, 1, 'after rename') "
106812106892
"THEN %Q ELSE tbl_name END "
106813106893
"WHERE type IN ('view', 'trigger')"
106814106894
, zDb, zTabName, zName, zTabName, zDb, zName);
106815106895
}
106816106896
@@ -106825,12 +106905,12 @@
106825106905
sqlite3VdbeLoadString(v, i, zName);
106826106906
sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB);
106827106907
}
106828106908
#endif
106829106909
106830
- renameReloadSchema(pParse, iDb);
106831
- renameTestSchema(pParse, zDb, iDb==1);
106910
+ renameReloadSchema(pParse, iDb, INITFLAG_AlterRename);
106911
+ renameTestSchema(pParse, zDb, iDb==1, "after rename");
106832106912
106833106913
exit_rename_table:
106834106914
sqlite3SrcListDelete(db, pSrc);
106835106915
sqlite3DbFree(db, zName);
106836106916
db->mDbFlags = savedDbFlags;
@@ -106988,11 +107068,11 @@
106988107068
sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3);
106989107069
sqlite3ReleaseTempReg(pParse, r1);
106990107070
}
106991107071
106992107072
/* Reload the table definition */
106993
- renameReloadSchema(pParse, iDb);
107073
+ renameReloadSchema(pParse, iDb, INITFLAG_AlterRename);
106994107074
}
106995107075
106996107076
/*
106997107077
** This function is called by the parser after the table-name in
106998107078
** an "ALTER TABLE <table-name> ADD" statement is parsed. Argument
@@ -107088,11 +107168,11 @@
107088107168
** it loads an error message into pParse and returns non-zero.
107089107169
**
107090107170
** Or, if pTab is not a view or virtual table, zero is returned.
107091107171
*/
107092107172
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
107093
-static int isRealTable(Parse *pParse, Table *pTab){
107173
+static int isRealTable(Parse *pParse, Table *pTab, int bDrop){
107094107174
const char *zType = 0;
107095107175
#ifndef SQLITE_OMIT_VIEW
107096107176
if( pTab->pSelect ){
107097107177
zType = "view";
107098107178
}
@@ -107101,19 +107181,20 @@
107101107181
if( IsVirtual(pTab) ){
107102107182
zType = "virtual table";
107103107183
}
107104107184
#endif
107105107185
if( zType ){
107106
- sqlite3ErrorMsg(
107107
- pParse, "cannot rename columns of %s \"%s\"", zType, pTab->zName
107186
+ sqlite3ErrorMsg(pParse, "cannot %s %s \"%s\"",
107187
+ (bDrop ? "drop column from" : "rename columns of"),
107188
+ zType, pTab->zName
107108107189
);
107109107190
return 1;
107110107191
}
107111107192
return 0;
107112107193
}
107113107194
#else /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */
107114
-# define isRealTable(x,y) (0)
107195
+# define isRealTable(x,y,z) (0)
107115107196
#endif
107116107197
107117107198
/*
107118107199
** Handles the following parser reduction:
107119107200
**
@@ -107138,11 +107219,11 @@
107138107219
pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
107139107220
if( !pTab ) goto exit_rename_column;
107140107221
107141107222
/* Cannot alter a system table */
107142107223
if( SQLITE_OK!=isAlterableTable(pParse, pTab) ) goto exit_rename_column;
107143
- if( SQLITE_OK!=isRealTable(pParse, pTab) ) goto exit_rename_column;
107224
+ if( SQLITE_OK!=isRealTable(pParse, pTab, 0) ) goto exit_rename_column;
107144107225
107145107226
/* Which schema holds the table to be altered */
107146107227
iSchema = sqlite3SchemaToIndex(db, pTab->pSchema);
107147107228
assert( iSchema>=0 );
107148107229
zDb = db->aDb[iSchema].zDbSName;
@@ -107192,12 +107273,12 @@
107192107273
"WHERE type IN ('trigger', 'view')",
107193107274
zDb, pTab->zName, iCol, zNew, bQuote
107194107275
);
107195107276
107196107277
/* Drop and reload the database schema. */
107197
- renameReloadSchema(pParse, iSchema);
107198
- renameTestSchema(pParse, zDb, iSchema==1);
107278
+ renameReloadSchema(pParse, iSchema, INITFLAG_AlterRename);
107279
+ renameTestSchema(pParse, zDb, iSchema==1, "after rename");
107199107280
107200107281
exit_rename_column:
107201107282
sqlite3SrcListDelete(db, pSrc);
107202107283
sqlite3DbFree(db, zOld);
107203107284
sqlite3DbFree(db, zNew);
@@ -107445,27 +107526,37 @@
107445107526
}
107446107527
}
107447107528
107448107529
/*
107449107530
** Search the Parse object passed as the first argument for a RenameToken
107450
-** object associated with parse tree element pPtr. If found, remove it
107451
-** from the Parse object and add it to the list maintained by the
107452
-** RenameCtx object passed as the second argument.
107531
+** object associated with parse tree element pPtr. If found, return a pointer
107532
+** to it. Otherwise, return NULL.
107533
+**
107534
+** If the second argument passed to this function is not NULL and a matching
107535
+** RenameToken object is found, remove it from the Parse object and add it to
107536
+** the list maintained by the RenameCtx object.
107453107537
*/
107454
-static void renameTokenFind(Parse *pParse, struct RenameCtx *pCtx, void *pPtr){
107538
+static RenameToken *renameTokenFind(
107539
+ Parse *pParse,
107540
+ struct RenameCtx *pCtx,
107541
+ void *pPtr
107542
+){
107455107543
RenameToken **pp;
107456107544
assert( pPtr!=0 );
107457107545
for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){
107458107546
if( (*pp)->p==pPtr ){
107459107547
RenameToken *pToken = *pp;
107460
- *pp = pToken->pNext;
107461
- pToken->pNext = pCtx->pList;
107462
- pCtx->pList = pToken;
107463
- pCtx->nList++;
107464
- break;
107548
+ if( pCtx ){
107549
+ *pp = pToken->pNext;
107550
+ pToken->pNext = pCtx->pList;
107551
+ pCtx->pList = pToken;
107552
+ pCtx->nList++;
107553
+ }
107554
+ return pToken;
107465107555
}
107466107556
}
107557
+ return 0;
107467107558
}
107468107559
107469107560
/*
107470107561
** This is a Walker select callback. It does nothing. It is only required
107471107562
** because without a dummy callback, sqlite3WalkExpr() and similar do not
@@ -107532,21 +107623,21 @@
107532107623
** sub-routine is currently stored in pParse->zErrMsg. This function
107533107624
** adds context to the error message and then stores it in pCtx.
107534107625
*/
107535107626
static void renameColumnParseError(
107536107627
sqlite3_context *pCtx,
107537
- int bPost,
107628
+ const char *zWhen,
107538107629
sqlite3_value *pType,
107539107630
sqlite3_value *pObject,
107540107631
Parse *pParse
107541107632
){
107542107633
const char *zT = (const char*)sqlite3_value_text(pType);
107543107634
const char *zN = (const char*)sqlite3_value_text(pObject);
107544107635
char *zErr;
107545107636
107546
- zErr = sqlite3_mprintf("error in %s %s%s: %s",
107547
- zT, zN, (bPost ? " after rename" : ""),
107637
+ zErr = sqlite3_mprintf("error in %s %s%s%s: %s",
107638
+ zT, zN, (zWhen[0] ? " " : ""), zWhen,
107548107639
pParse->zErrMsg
107549107640
);
107550107641
sqlite3_result_error(pCtx, zErr, -1);
107551107642
sqlite3_free(zErr);
107552107643
}
@@ -107621,11 +107712,11 @@
107621107712
** trigger object, the database must be corrupt. */
107622107713
memset(p, 0, sizeof(Parse));
107623107714
p->eParseMode = PARSE_MODE_RENAME;
107624107715
p->db = db;
107625107716
p->nQueryLoop = 1;
107626
- rc = sqlite3RunParser(p, zSql, &zErr);
107717
+ rc = zSql ? sqlite3RunParser(p, zSql, &zErr) : SQLITE_NOMEM;
107627107718
assert( p->zErrMsg==0 );
107628107719
assert( rc!=SQLITE_OK || zErr==0 );
107629107720
p->zErrMsg = zErr;
107630107721
if( db->mallocFailed ) rc = SQLITE_NOMEM;
107631107722
if( rc==SQLITE_OK
@@ -107774,11 +107865,11 @@
107774107865
if( rc==SQLITE_OK && pStep->zTarget ){
107775107866
SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
107776107867
if( pSrc ){
107777107868
int i;
107778107869
for(i=0; i<pSrc->nSrc && rc==SQLITE_OK; i++){
107779
- struct SrcList_item *p = &pSrc->a[i];
107870
+ SrcItem *p = &pSrc->a[i];
107780107871
p->iCursor = pParse->nTab++;
107781107872
if( p->pSelect ){
107782107873
sqlite3SelectPrep(pParse, p->pSelect, 0);
107783107874
sqlite3ExpandSubquery(pParse, p);
107784107875
assert( i>0 );
@@ -108048,11 +108139,11 @@
108048108139
rc = renameEditSql(context, &sCtx, zSql, zNew, bQuote);
108049108140
108050108141
renameColumnFunc_done:
108051108142
if( rc!=SQLITE_OK ){
108052108143
if( sParse.zErrMsg ){
108053
- renameColumnParseError(context, 0, argv[1], argv[2], &sParse);
108144
+ renameColumnParseError(context, "", argv[1], argv[2], &sParse);
108054108145
}else{
108055108146
sqlite3_result_error_code(context, rc);
108056108147
}
108057108148
}
108058108149
@@ -108086,11 +108177,11 @@
108086108177
if( pSrc==0 ){
108087108178
assert( pWalker->pParse->db->mallocFailed );
108088108179
return WRC_Abort;
108089108180
}
108090108181
for(i=0; i<pSrc->nSrc; i++){
108091
- struct SrcList_item *pItem = &pSrc->a[i];
108182
+ SrcItem *pItem = &pSrc->a[i];
108092108183
if( pItem->pTab==p->pTab ){
108093108184
renameTokenFind(pWalker->pParse, p, pItem->zName);
108094108185
}
108095108186
}
108096108187
renameWalkWith(pWalker, pSelect);
@@ -108237,11 +108328,11 @@
108237108328
if( rc==SQLITE_OK ){
108238108329
rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote);
108239108330
}
108240108331
if( rc!=SQLITE_OK ){
108241108332
if( sParse.zErrMsg ){
108242
- renameColumnParseError(context, 0, argv[1], argv[2], &sParse);
108333
+ renameColumnParseError(context, "", argv[1], argv[2], &sParse);
108243108334
}else{
108244108335
sqlite3_result_error_code(context, rc);
108245108336
}
108246108337
}
108247108338
@@ -108266,10 +108357,11 @@
108266108357
** 0: Database name ("main", "temp" etc.).
108267108358
** 1: SQL statement.
108268108359
** 2: Object type ("view", "table", "trigger" or "index").
108269108360
** 3: Object name.
108270108361
** 4: True if object is from temp schema.
108362
+** 5: "when" part of error message.
108271108363
**
108272108364
** Unless it finds an error, this function normally returns NULL. However, it
108273108365
** returns integer value 1 if:
108274108366
**
108275108367
** * the SQL argument creates a trigger, and
@@ -108283,10 +108375,11 @@
108283108375
sqlite3 *db = sqlite3_context_db_handle(context);
108284108376
char const *zDb = (const char*)sqlite3_value_text(argv[0]);
108285108377
char const *zInput = (const char*)sqlite3_value_text(argv[1]);
108286108378
int bTemp = sqlite3_value_int(argv[4]);
108287108379
int isLegacy = (db->flags & SQLITE_LegacyAlter);
108380
+ char const *zWhen = (const char*)sqlite3_value_text(argv[5]);
108288108381
108289108382
#ifndef SQLITE_OMIT_AUTHORIZATION
108290108383
sqlite3_xauth xAuth = db->xAuth;
108291108384
db->xAuth = 0;
108292108385
#endif
@@ -108315,29 +108408,220 @@
108315108408
if( i1==i2 ) sqlite3_result_int(context, 1);
108316108409
}
108317108410
}
108318108411
}
108319108412
108320
- if( rc!=SQLITE_OK ){
108321
- renameColumnParseError(context, 1, argv[2], argv[3], &sParse);
108413
+ if( rc!=SQLITE_OK && zWhen ){
108414
+ renameColumnParseError(context, zWhen, argv[2], argv[3],&sParse);
108322108415
}
108323108416
renameParseCleanup(&sParse);
108324108417
}
108325108418
108326108419
#ifndef SQLITE_OMIT_AUTHORIZATION
108327108420
db->xAuth = xAuth;
108328108421
#endif
108329108422
}
108423
+
108424
+/*
108425
+** The implementation of internal UDF sqlite_drop_column().
108426
+**
108427
+** Arguments:
108428
+**
108429
+** argv[0]: An integer - the index of the schema containing the table
108430
+** argv[1]: CREATE TABLE statement to modify.
108431
+** argv[2]: An integer - the index of the column to remove.
108432
+**
108433
+** The value returned is a string containing the CREATE TABLE statement
108434
+** with column argv[2] removed.
108435
+*/
108436
+static void dropColumnFunc(
108437
+ sqlite3_context *context,
108438
+ int NotUsed,
108439
+ sqlite3_value **argv
108440
+){
108441
+ sqlite3 *db = sqlite3_context_db_handle(context);
108442
+ int iSchema = sqlite3_value_int(argv[0]);
108443
+ const char *zSql = (const char*)sqlite3_value_text(argv[1]);
108444
+ int iCol = sqlite3_value_int(argv[2]);
108445
+ const char *zDb = db->aDb[iSchema].zDbSName;
108446
+ int rc;
108447
+ Parse sParse;
108448
+ RenameToken *pCol;
108449
+ Table *pTab;
108450
+ const char *zEnd;
108451
+ char *zNew = 0;
108452
+
108453
+#ifndef SQLITE_OMIT_AUTHORIZATION
108454
+ sqlite3_xauth xAuth = db->xAuth;
108455
+ db->xAuth = 0;
108456
+#endif
108457
+
108458
+ rc = renameParseSql(&sParse, zDb, db, zSql, iSchema==1);
108459
+ if( rc!=SQLITE_OK ) goto drop_column_done;
108460
+ pTab = sParse.pNewTable;
108461
+ if( pTab->nCol==1 || iCol>=pTab->nCol ){
108462
+ /* This can happen if the sqlite_schema table is corrupt */
108463
+ rc = SQLITE_CORRUPT_BKPT;
108464
+ goto drop_column_done;
108465
+ }
108466
+
108467
+ pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol].zName);
108468
+ if( iCol<pTab->nCol-1 ){
108469
+ RenameToken *pEnd;
108470
+ pEnd = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol+1].zName);
108471
+ zEnd = (const char*)pEnd->t.z;
108472
+ }else{
108473
+ zEnd = (const char*)&zSql[pTab->addColOffset];
108474
+ while( ALWAYS(pCol->t.z[0]!=0) && pCol->t.z[0]!=',' ) pCol->t.z--;
108475
+ }
108476
+
108477
+ zNew = sqlite3MPrintf(db, "%.*s%s", pCol->t.z-zSql, zSql, zEnd);
108478
+ sqlite3_result_text(context, zNew, -1, SQLITE_TRANSIENT);
108479
+ sqlite3_free(zNew);
108480
+
108481
+drop_column_done:
108482
+ renameParseCleanup(&sParse);
108483
+#ifndef SQLITE_OMIT_AUTHORIZATION
108484
+ db->xAuth = xAuth;
108485
+#endif
108486
+ if( rc!=SQLITE_OK ){
108487
+ sqlite3_result_error_code(context, rc);
108488
+ }
108489
+}
108490
+
108491
+/*
108492
+** This function is called by the parser upon parsing an
108493
+**
108494
+** ALTER TABLE pSrc DROP COLUMN pName
108495
+**
108496
+** statement. Argument pSrc contains the possibly qualified name of the
108497
+** table being edited, and token pName the name of the column to drop.
108498
+*/
108499
+SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token *pName){
108500
+ sqlite3 *db = pParse->db; /* Database handle */
108501
+ Table *pTab; /* Table to modify */
108502
+ int iDb; /* Index of db containing pTab in aDb[] */
108503
+ const char *zDb; /* Database containing pTab ("main" etc.) */
108504
+ char *zCol = 0; /* Name of column to drop */
108505
+ int iCol; /* Index of column zCol in pTab->aCol[] */
108506
+
108507
+ /* Look up the table being altered. */
108508
+ assert( pParse->pNewTable==0 );
108509
+ assert( sqlite3BtreeHoldsAllMutexes(db) );
108510
+ if( NEVER(db->mallocFailed) ) goto exit_drop_column;
108511
+ pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
108512
+ if( !pTab ) goto exit_drop_column;
108513
+
108514
+ /* Make sure this is not an attempt to ALTER a view, virtual table or
108515
+ ** system table. */
108516
+ if( SQLITE_OK!=isAlterableTable(pParse, pTab) ) goto exit_drop_column;
108517
+ if( SQLITE_OK!=isRealTable(pParse, pTab, 1) ) goto exit_drop_column;
108518
+
108519
+ /* Find the index of the column being dropped. */
108520
+ zCol = sqlite3NameFromToken(db, pName);
108521
+ if( zCol==0 ){
108522
+ assert( db->mallocFailed );
108523
+ goto exit_drop_column;
108524
+ }
108525
+ iCol = sqlite3ColumnIndex(pTab, zCol);
108526
+ if( iCol<0 ){
108527
+ sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zCol);
108528
+ goto exit_drop_column;
108529
+ }
108530
+
108531
+ /* Do not allow the user to drop a PRIMARY KEY column or a column
108532
+ ** constrained by a UNIQUE constraint. */
108533
+ if( pTab->aCol[iCol].colFlags & (COLFLAG_PRIMKEY|COLFLAG_UNIQUE) ){
108534
+ sqlite3ErrorMsg(pParse, "cannot drop %s column: \"%s\"",
108535
+ (pTab->aCol[iCol].colFlags&COLFLAG_PRIMKEY) ? "PRIMARY KEY" : "UNIQUE",
108536
+ zCol
108537
+ );
108538
+ goto exit_drop_column;
108539
+ }
108540
+
108541
+ /* Do not allow the number of columns to go to zero */
108542
+ if( pTab->nCol<=1 ){
108543
+ sqlite3ErrorMsg(pParse, "cannot drop column \"%s\": no other columns exist",zCol);
108544
+ goto exit_drop_column;
108545
+ }
108546
+
108547
+ /* Edit the sqlite_schema table */
108548
+ iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
108549
+ assert( iDb>=0 );
108550
+ zDb = db->aDb[iDb].zDbSName;
108551
+ renameTestSchema(pParse, zDb, iDb==1, "");
108552
+ sqlite3NestedParse(pParse,
108553
+ "UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
108554
+ "sql = sqlite_drop_column(%d, sql, %d) "
108555
+ "WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)"
108556
+ , zDb, iDb, iCol, pTab->zName
108557
+ );
108558
+
108559
+ /* Drop and reload the database schema. */
108560
+ renameReloadSchema(pParse, iDb, INITFLAG_AlterDrop);
108561
+ renameTestSchema(pParse, zDb, iDb==1, "after drop column");
108562
+
108563
+ /* Edit rows of table on disk */
108564
+ if( pParse->nErr==0 && (pTab->aCol[iCol].colFlags & COLFLAG_VIRTUAL)==0 ){
108565
+ int i;
108566
+ int addr;
108567
+ int reg;
108568
+ int regRec;
108569
+ Index *pPk = 0;
108570
+ int nField = 0; /* Number of non-virtual columns after drop */
108571
+ int iCur;
108572
+ Vdbe *v = sqlite3GetVdbe(pParse);
108573
+ iCur = pParse->nTab++;
108574
+ sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenWrite);
108575
+ addr = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v);
108576
+ reg = ++pParse->nMem;
108577
+ pParse->nMem += pTab->nCol;
108578
+ if( HasRowid(pTab) ){
108579
+ sqlite3VdbeAddOp2(v, OP_Rowid, iCur, reg);
108580
+ }else{
108581
+ pPk = sqlite3PrimaryKeyIndex(pTab);
108582
+ }
108583
+ for(i=0; i<pTab->nCol; i++){
108584
+ if( i!=iCol && (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 ){
108585
+ int regOut;
108586
+ if( pPk ){
108587
+ int iPos = sqlite3TableColumnToIndex(pPk, i);
108588
+ int iColPos = sqlite3TableColumnToIndex(pPk, iCol);
108589
+ regOut = reg+1+iPos-(iPos>iColPos);
108590
+ }else{
108591
+ regOut = reg+1+nField;
108592
+ }
108593
+ sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, i, regOut);
108594
+ nField++;
108595
+ }
108596
+ }
108597
+ regRec = reg + pTab->nCol;
108598
+ sqlite3VdbeAddOp3(v, OP_MakeRecord, reg+1, nField, regRec);
108599
+ if( pPk ){
108600
+ sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iCur, regRec, reg+1, pPk->nKeyCol);
108601
+ }else{
108602
+ sqlite3VdbeAddOp3(v, OP_Insert, iCur, regRec, reg);
108603
+ }
108604
+
108605
+ sqlite3VdbeAddOp2(v, OP_Next, iCur, addr+1); VdbeCoverage(v);
108606
+ sqlite3VdbeJumpHere(v, addr);
108607
+ }
108608
+
108609
+exit_drop_column:
108610
+ sqlite3DbFree(db, zCol);
108611
+ sqlite3SrcListDelete(db, pSrc);
108612
+}
108330108613
108331108614
/*
108332108615
** Register built-in functions used to help implement ALTER TABLE
108333108616
*/
108334108617
SQLITE_PRIVATE void sqlite3AlterFunctions(void){
108335108618
static FuncDef aAlterTableFuncs[] = {
108336
- INTERNAL_FUNCTION(sqlite_rename_column, 9, renameColumnFunc),
108337
- INTERNAL_FUNCTION(sqlite_rename_table, 7, renameTableFunc),
108338
- INTERNAL_FUNCTION(sqlite_rename_test, 5, renameTableTest),
108619
+ INTERNAL_FUNCTION(sqlite_rename_column, 9, renameColumnFunc),
108620
+ INTERNAL_FUNCTION(sqlite_rename_table, 7, renameTableFunc),
108621
+ INTERNAL_FUNCTION(sqlite_rename_test, 6, renameTableTest),
108622
+ INTERNAL_FUNCTION(sqlite_drop_column, 3, dropColumnFunc),
108339108623
};
108340108624
sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs));
108341108625
}
108342108626
#endif /* SQLITE_ALTER_TABLE */
108343108627
@@ -110745,11 +111029,11 @@
110745111029
** Select callback used by sqlite3FixAAAA() routines.
110746111030
*/
110747111031
static int fixSelectCb(Walker *p, Select *pSelect){
110748111032
DbFixer *pFix = p->u.pFix;
110749111033
int i;
110750
- struct SrcList_item *pItem;
111034
+ SrcItem *pItem;
110751111035
sqlite3 *db = pFix->pParse->db;
110752111036
int iDb = sqlite3FindDbName(db, pFix->zDb);
110753111037
SrcList *pList = pSelect->pSrc;
110754111038
110755111039
if( NEVER(pList==0) ) return WRC_Continue;
@@ -111318,16 +111602,18 @@
111318111602
int i;
111319111603
int reg;
111320111604
111321111605
addrRewind =
111322111606
sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
111607
+ VdbeCoverage(v);
111323111608
reg = pReturning->iRetReg;
111324111609
for(i=0; i<pReturning->nRetCol; i++){
111325111610
sqlite3VdbeAddOp3(v, OP_Column, pReturning->iRetCur, i, reg+i);
111326111611
}
111327111612
sqlite3VdbeAddOp2(v, OP_ResultRow, reg, i);
111328111613
sqlite3VdbeAddOp2(v, OP_Next, pReturning->iRetCur, addrRewind+1);
111614
+ VdbeCoverage(v);
111329111615
sqlite3VdbeJumpHere(v, addrRewind);
111330111616
}
111331111617
sqlite3VdbeAddOp0(v, OP_Halt);
111332111618
111333111619
#if SQLITE_USER_AUTHENTICATION
@@ -111631,11 +111917,11 @@
111631111917
** sqlite3FixSrcList() for details.
111632111918
*/
111633111919
SQLITE_PRIVATE Table *sqlite3LocateTableItem(
111634111920
Parse *pParse,
111635111921
u32 flags,
111636
- struct SrcList_item *p
111922
+ SrcItem *p
111637111923
){
111638111924
const char *zDb;
111639111925
assert( p->pSchema==0 || p->zDatabase==0 );
111640111926
if( p->pSchema ){
111641111927
int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema);
@@ -112417,10 +112703,11 @@
112417112703
*/
112418112704
#if SQLITE_ENABLE_HIDDEN_COLUMNS
112419112705
SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){
112420112706
if( sqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){
112421112707
pCol->colFlags |= COLFLAG_HIDDEN;
112708
+ if( pTab ) pTab->tabFlags |= TF_HasHidden;
112422112709
}else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){
112423112710
pTab->tabFlags |= TF_OOOHidden;
112424112711
}
112425112712
}
112426112713
#endif
@@ -112461,11 +112748,15 @@
112461112748
*/
112462112749
SQLITE_PRIVATE void sqlite3AddReturning(Parse *pParse, ExprList *pList){
112463112750
Returning *pRet;
112464112751
Hash *pHash;
112465112752
sqlite3 *db = pParse->db;
112466
- assert( !pParse->bReturning );
112753
+ if( pParse->pNewTrigger ){
112754
+ sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
112755
+ }else{
112756
+ assert( pParse->bReturning==0 );
112757
+ }
112467112758
pParse->bReturning = 1;
112468112759
pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
112469112760
if( pRet==0 ){
112470112761
sqlite3ExprListDelete(db, pList);
112471112762
return;
@@ -112484,11 +112775,11 @@
112484112775
pRet->retTrig.step_list = &pRet->retTStep;
112485112776
pRet->retTStep.op = TK_RETURNING;
112486112777
pRet->retTStep.pTrig = &pRet->retTrig;
112487112778
pRet->retTStep.pExprList = pList;
112488112779
pHash = &(db->aDb[1].pSchema->trigHash);
112489
- assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 );
112780
+ assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 || pParse->nErr );
112490112781
if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
112491112782
==&pRet->retTrig ){
112492112783
sqlite3OomFault(db);
112493112784
}
112494112785
}
@@ -113789,11 +114080,11 @@
113789114080
}
113790114081
#endif
113791114082
113792114083
/* Reparse everything to update our internal data structures */
113793114084
sqlite3VdbeAddParseSchemaOp(v, iDb,
113794
- sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName));
114085
+ sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName),0);
113795114086
}
113796114087
113797114088
/* Add the table to the in-memory representation of the database.
113798114089
*/
113799114090
if( db->init.busy ){
@@ -113806,24 +114097,21 @@
113806114097
sqlite3OomFault(db);
113807114098
return;
113808114099
}
113809114100
pParse->pNewTable = 0;
113810114101
db->mDbFlags |= DBFLAG_SchemaChange;
114102
+ }
113811114103
113812114104
#ifndef SQLITE_OMIT_ALTERTABLE
113813
- if( !p->pSelect ){
113814
- const char *zName = (const char *)pParse->sNameToken.z;
113815
- int nName;
113816
- assert( !pSelect && pCons && pEnd );
113817
- if( pCons->z==0 ){
113818
- pCons = pEnd;
113819
- }
113820
- nName = (int)((const char *)pCons->z - zName);
113821
- p->addColOffset = 13 + nName;
113822
- }
113823
-#endif
113824
- }
114105
+ if( !pSelect && !p->pSelect ){
114106
+ assert( pCons && pEnd );
114107
+ if( pCons->z==0 ){
114108
+ pCons = pEnd;
114109
+ }
114110
+ p->addColOffset = 13 + (int)(pCons->z - pParse->sNameToken.z);
114111
+ }
114112
+#endif
113825114113
}
113826114114
113827114115
#ifndef SQLITE_OMIT_VIEW
113828114116
/*
113829114117
** The parser calls this routine in order to create a new VIEW
@@ -115277,11 +115565,11 @@
115277115565
*/
115278115566
if( pTblName ){
115279115567
sqlite3RefillIndex(pParse, pIndex, iMem);
115280115568
sqlite3ChangeCookie(pParse, iDb);
115281115569
sqlite3VdbeAddParseSchemaOp(v, iDb,
115282
- sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName));
115570
+ sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName), 0);
115283115571
sqlite3VdbeAddOp2(v, OP_Expire, 0, 1);
115284115572
}
115285115573
115286115574
sqlite3VdbeJumpHere(v, (int)pIndex->tnum);
115287115575
}
@@ -115670,11 +115958,11 @@
115670115958
Parse *pParse, /* Parsing context, in which errors are reported */
115671115959
SrcList *pList, /* Append to this SrcList. NULL creates a new SrcList */
115672115960
Token *pTable, /* Table to append */
115673115961
Token *pDatabase /* Database of the table */
115674115962
){
115675
- struct SrcList_item *pItem;
115963
+ SrcItem *pItem;
115676115964
sqlite3 *db;
115677115965
assert( pDatabase==0 || pTable!=0 ); /* Cannot have C without B */
115678115966
assert( pParse!=0 );
115679115967
assert( pParse->db!=0 );
115680115968
db = pParse->db;
@@ -115711,11 +115999,11 @@
115711115999
/*
115712116000
** Assign VdbeCursor index numbers to all tables in a SrcList
115713116001
*/
115714116002
SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){
115715116003
int i;
115716
- struct SrcList_item *pItem;
116004
+ SrcItem *pItem;
115717116005
assert(pList || pParse->db->mallocFailed );
115718116006
if( pList ){
115719116007
for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){
115720116008
if( pItem->iCursor>=0 ) continue;
115721116009
pItem->iCursor = pParse->nTab++;
@@ -115729,11 +116017,11 @@
115729116017
/*
115730116018
** Delete an entire SrcList including all its substructure.
115731116019
*/
115732116020
SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){
115733116021
int i;
115734
- struct SrcList_item *pItem;
116022
+ SrcItem *pItem;
115735116023
if( pList==0 ) return;
115736116024
for(pItem=pList->a, i=0; i<pList->nSrc; i++, pItem++){
115737116025
if( pItem->zDatabase ) sqlite3DbFreeNN(db, pItem->zDatabase);
115738116026
sqlite3DbFree(db, pItem->zName);
115739116027
if( pItem->zAlias ) sqlite3DbFreeNN(db, pItem->zAlias);
@@ -115771,11 +116059,11 @@
115771116059
Token *pAlias, /* The right-hand side of the AS subexpression */
115772116060
Select *pSubquery, /* A subquery used in place of a table name */
115773116061
Expr *pOn, /* The ON clause of a join */
115774116062
IdList *pUsing /* The USING clause of a join */
115775116063
){
115776
- struct SrcList_item *pItem;
116064
+ SrcItem *pItem;
115777116065
sqlite3 *db = pParse->db;
115778116066
if( !p && (pOn || pUsing) ){
115779116067
sqlite3ErrorMsg(pParse, "a JOIN clause is required before %s",
115780116068
(pOn ? "ON" : "USING")
115781116069
);
@@ -115815,11 +116103,11 @@
115815116103
** element of the source-list passed as the second argument.
115816116104
*/
115817116105
SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pIndexedBy){
115818116106
assert( pIndexedBy!=0 );
115819116107
if( p && pIndexedBy->n>0 ){
115820
- struct SrcList_item *pItem;
116108
+ SrcItem *pItem;
115821116109
assert( p->nSrc>0 );
115822116110
pItem = &p->a[p->nSrc-1];
115823116111
assert( pItem->fg.notIndexed==0 );
115824116112
assert( pItem->fg.isIndexedBy==0 );
115825116113
assert( pItem->fg.isTabFunc==0 );
@@ -115845,11 +116133,11 @@
115845116133
SrcList *pNew = sqlite3SrcListEnlarge(pParse, p1, p2->nSrc, 1);
115846116134
if( pNew==0 ){
115847116135
sqlite3SrcListDelete(pParse->db, p2);
115848116136
}else{
115849116137
p1 = pNew;
115850
- memcpy(&p1->a[1], p2->a, p2->nSrc*sizeof(struct SrcList_item));
116138
+ memcpy(&p1->a[1], p2->a, p2->nSrc*sizeof(SrcItem));
115851116139
sqlite3DbFree(pParse->db, p2);
115852116140
}
115853116141
}
115854116142
return p1;
115855116143
}
@@ -115858,11 +116146,11 @@
115858116146
** Add the list of function arguments to the SrcList entry for a
115859116147
** table-valued-function.
115860116148
*/
115861116149
SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, ExprList *pList){
115862116150
if( p ){
115863
- struct SrcList_item *pItem = &p->a[p->nSrc-1];
116151
+ SrcItem *pItem = &p->a[p->nSrc-1];
115864116152
assert( pItem->fg.notIndexed==0 );
115865116153
assert( pItem->fg.isIndexedBy==0 );
115866116154
assert( pItem->fg.isTabFunc==0 );
115867116155
pItem->u1.pFuncArg = pList;
115868116156
pItem->fg.isTabFunc = 1;
@@ -116355,28 +116643,80 @@
116355116643
}
116356116644
return pKey;
116357116645
}
116358116646
116359116647
#ifndef SQLITE_OMIT_CTE
116648
+/*
116649
+** Create a new CTE object
116650
+*/
116651
+SQLITE_PRIVATE Cte *sqlite3CteNew(
116652
+ Parse *pParse, /* Parsing context */
116653
+ Token *pName, /* Name of the common-table */
116654
+ ExprList *pArglist, /* Optional column name list for the table */
116655
+ Select *pQuery, /* Query used to initialize the table */
116656
+ u8 eM10d /* The MATERIALIZED flag */
116657
+){
116658
+ Cte *pNew;
116659
+ sqlite3 *db = pParse->db;
116660
+
116661
+ pNew = sqlite3DbMallocZero(db, sizeof(*pNew));
116662
+ assert( pNew!=0 || db->mallocFailed );
116663
+
116664
+ if( db->mallocFailed ){
116665
+ sqlite3ExprListDelete(db, pArglist);
116666
+ sqlite3SelectDelete(db, pQuery);
116667
+ }else{
116668
+ pNew->pSelect = pQuery;
116669
+ pNew->pCols = pArglist;
116670
+ pNew->zName = sqlite3NameFromToken(pParse->db, pName);
116671
+ pNew->eM10d = eM10d;
116672
+ }
116673
+ return pNew;
116674
+}
116675
+
116676
+/*
116677
+** Clear information from a Cte object, but do not deallocate storage
116678
+** for the object itself.
116679
+*/
116680
+static void cteClear(sqlite3 *db, Cte *pCte){
116681
+ assert( pCte!=0 );
116682
+ sqlite3ExprListDelete(db, pCte->pCols);
116683
+ sqlite3SelectDelete(db, pCte->pSelect);
116684
+ sqlite3DbFree(db, pCte->zName);
116685
+}
116686
+
116687
+/*
116688
+** Free the contents of the CTE object passed as the second argument.
116689
+*/
116690
+SQLITE_PRIVATE void sqlite3CteDelete(sqlite3 *db, Cte *pCte){
116691
+ assert( pCte!=0 );
116692
+ cteClear(db, pCte);
116693
+ sqlite3DbFree(db, pCte);
116694
+}
116695
+
116360116696
/*
116361116697
** This routine is invoked once per CTE by the parser while parsing a
116362
-** WITH clause.
116698
+** WITH clause. The CTE described by teh third argument is added to
116699
+** the WITH clause of the second argument. If the second argument is
116700
+** NULL, then a new WITH argument is created.
116363116701
*/
116364116702
SQLITE_PRIVATE With *sqlite3WithAdd(
116365116703
Parse *pParse, /* Parsing context */
116366116704
With *pWith, /* Existing WITH clause, or NULL */
116367
- Token *pName, /* Name of the common-table */
116368
- ExprList *pArglist, /* Optional column name list for the table */
116369
- Select *pQuery /* Query used to initialize the table */
116705
+ Cte *pCte /* CTE to add to the WITH clause */
116370116706
){
116371116707
sqlite3 *db = pParse->db;
116372116708
With *pNew;
116373116709
char *zName;
116710
+
116711
+ if( pCte==0 ){
116712
+ return pWith;
116713
+ }
116374116714
116375116715
/* Check that the CTE name is unique within this WITH clause. If
116376116716
** not, store an error in the Parse structure. */
116377
- zName = sqlite3NameFromToken(pParse->db, pName);
116717
+ zName = pCte->zName;
116378116718
if( zName && pWith ){
116379116719
int i;
116380116720
for(i=0; i<pWith->nCte; i++){
116381116721
if( sqlite3StrICmp(zName, pWith->a[i].zName)==0 ){
116382116722
sqlite3ErrorMsg(pParse, "duplicate WITH table name: %s", zName);
@@ -116391,20 +116731,15 @@
116391116731
pNew = sqlite3DbMallocZero(db, sizeof(*pWith));
116392116732
}
116393116733
assert( (pNew!=0 && zName!=0) || db->mallocFailed );
116394116734
116395116735
if( db->mallocFailed ){
116396
- sqlite3ExprListDelete(db, pArglist);
116397
- sqlite3SelectDelete(db, pQuery);
116398
- sqlite3DbFree(db, zName);
116736
+ sqlite3CteDelete(db, pCte);
116399116737
pNew = pWith;
116400116738
}else{
116401
- pNew->a[pNew->nCte].pSelect = pQuery;
116402
- pNew->a[pNew->nCte].pCols = pArglist;
116403
- pNew->a[pNew->nCte].zName = zName;
116404
- pNew->a[pNew->nCte].zCteErr = 0;
116405
- pNew->nCte++;
116739
+ pNew->a[pNew->nCte++] = *pCte;
116740
+ sqlite3DbFree(db, pCte);
116406116741
}
116407116742
116408116743
return pNew;
116409116744
}
116410116745
@@ -116413,14 +116748,11 @@
116413116748
*/
116414116749
SQLITE_PRIVATE void sqlite3WithDelete(sqlite3 *db, With *pWith){
116415116750
if( pWith ){
116416116751
int i;
116417116752
for(i=0; i<pWith->nCte; i++){
116418
- struct Cte *pCte = &pWith->a[i];
116419
- sqlite3ExprListDelete(db, pCte->pCols);
116420
- sqlite3SelectDelete(db, pCte->pSelect);
116421
- sqlite3DbFree(db, pCte->zName);
116753
+ cteClear(db, &pWith->a[i]);
116422116754
}
116423116755
sqlite3DbFree(db, pWith);
116424116756
}
116425116757
}
116426116758
#endif /* !defined(SQLITE_OMIT_CTE) */
@@ -116995,21 +117327,21 @@
116995117327
** pSrc->a[0].pTab Pointer to the Table object
116996117328
** pSrc->a[0].pIndex Pointer to the INDEXED BY index, if there is one
116997117329
**
116998117330
*/
116999117331
SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
117000
- struct SrcList_item *pItem = pSrc->a;
117332
+ SrcItem *pItem = pSrc->a;
117001117333
Table *pTab;
117002117334
assert( pItem && pSrc->nSrc>=1 );
117003117335
pTab = sqlite3LocateTableItem(pParse, 0, pItem);
117004117336
sqlite3DeleteTable(pParse->db, pItem->pTab);
117005117337
pItem->pTab = pTab;
117006117338
if( pTab ){
117007117339
pTab->nTabRef++;
117008
- }
117009
- if( sqlite3IndexedByLookup(pParse, pItem) ){
117010
- pTab = 0;
117340
+ if( pItem->fg.isIndexedBy && sqlite3IndexedByLookup(pParse, pItem) ){
117341
+ pTab = 0;
117342
+ }
117011117343
}
117012117344
return pTab;
117013117345
}
117014117346
117015117347
/* Return true if table pTab is read-only.
@@ -117175,11 +117507,15 @@
117175117507
/* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree
117176117508
** and the SELECT subtree. */
117177117509
pSrc->a[0].pTab = 0;
117178117510
pSelectSrc = sqlite3SrcListDup(pParse->db, pSrc, 0);
117179117511
pSrc->a[0].pTab = pTab;
117180
- pSrc->a[0].pIBIndex = 0;
117512
+ if( pSrc->a[0].fg.isIndexedBy ){
117513
+ pSrc->a[0].u2.pIBIndex = 0;
117514
+ }else if( pSrc->a[0].fg.isCte ){
117515
+ pSrc->a[0].u2.pCteUse->nUse++;
117516
+ }
117181117517
117182117518
/* generate the SELECT expression tree. */
117183117519
pSelect = sqlite3SelectNew(pParse, pEList, pSelectSrc, pWhere, 0 ,0,
117184117520
pOrderBy,0,pLimit
117185117521
);
@@ -118623,11 +118959,12 @@
118623118959
while( (c = Utf8Read(zPattern))!=0 ){
118624118960
if( c==matchAll ){ /* Match "*" */
118625118961
/* Skip over multiple "*" characters in the pattern. If there
118626118962
** are also "?" characters, skip those as well, but consume a
118627118963
** single character of the input string for each "?" skipped */
118628
- while( (c=Utf8Read(zPattern)) == matchAll || c == matchOne ){
118964
+ while( (c=Utf8Read(zPattern)) == matchAll
118965
+ || (c == matchOne && matchOne!=0) ){
118629118966
if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
118630118967
return SQLITE_NOWILDCARDMATCH;
118631118968
}
118632118969
}
118633118970
if( c==0 ){
@@ -121242,11 +121579,11 @@
121242121579
121243121580
/* Create a SrcList structure containing the child table. We need the
121244121581
** child table as a SrcList for sqlite3WhereBegin() */
121245121582
pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
121246121583
if( pSrc ){
121247
- struct SrcList_item *pItem = pSrc->a;
121584
+ SrcItem *pItem = pSrc->a;
121248121585
pItem->pTab = pFKey->pFrom;
121249121586
pItem->zName = pFKey->pFrom->zName;
121250121587
pItem->pTab->nTabRef++;
121251121588
pItem->iCursor = pParse->nTab++;
121252121589
@@ -122603,23 +122940,28 @@
122603122940
ipkColumn--;
122604122941
}
122605122942
}
122606122943
}
122607122944
#endif
122608
- }
122609
-
122610
- /* Make sure the number of columns in the source data matches the number
122611
- ** of columns to be inserted into the table.
122612
- */
122613
- for(i=0; i<pTab->nCol; i++){
122614
- if( pTab->aCol[i].colFlags & COLFLAG_NOINSERT ) nHidden++;
122615
- }
122616
- if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){
122617
- sqlite3ErrorMsg(pParse,
122618
- "table %S has %d columns but %d values were supplied",
122619
- pTabList, 0, pTab->nCol-nHidden, nColumn);
122620
- goto insert_cleanup;
122945
+
122946
+ /* Make sure the number of columns in the source data matches the number
122947
+ ** of columns to be inserted into the table.
122948
+ */
122949
+ assert( TF_HasHidden==COLFLAG_HIDDEN );
122950
+ assert( TF_HasGenerated==COLFLAG_GENERATED );
122951
+ assert( COLFLAG_NOINSERT==(COLFLAG_GENERATED|COLFLAG_HIDDEN) );
122952
+ if( (pTab->tabFlags & (TF_HasGenerated|TF_HasHidden))!=0 ){
122953
+ for(i=0; i<pTab->nCol; i++){
122954
+ if( pTab->aCol[i].colFlags & COLFLAG_NOINSERT ) nHidden++;
122955
+ }
122956
+ }
122957
+ if( nColumn!=(pTab->nCol-nHidden) ){
122958
+ sqlite3ErrorMsg(pParse,
122959
+ "table %S has %d columns but %d values were supplied",
122960
+ pTabList, 0, pTab->nCol-nHidden, nColumn);
122961
+ goto insert_cleanup;
122962
+ }
122621122963
}
122622122964
if( pColumn!=0 && nColumn!=pColumn->nId ){
122623122965
sqlite3ErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId);
122624122966
goto insert_cleanup;
122625122967
}
@@ -124078,10 +124420,36 @@
124078124420
}
124079124421
sqlite3VdbeChangeP5(v, i+1);
124080124422
}
124081124423
#endif
124082124424
124425
+/*
124426
+** Table pTab is a WITHOUT ROWID table that is being written to. The cursor
124427
+** number is iCur, and register regData contains the new record for the
124428
+** PK index. This function adds code to invoke the pre-update hook,
124429
+** if one is registered.
124430
+*/
124431
+#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
124432
+static void codeWithoutRowidPreupdate(
124433
+ Parse *pParse, /* Parse context */
124434
+ Table *pTab, /* Table being updated */
124435
+ int iCur, /* Cursor number for table */
124436
+ int regData /* Data containing new record */
124437
+){
124438
+ Vdbe *v = pParse->pVdbe;
124439
+ int r = sqlite3GetTempReg(pParse);
124440
+ assert( !HasRowid(pTab) );
124441
+ assert( 0==(pParse->db->mDbFlags & DBFLAG_Vacuum) );
124442
+ sqlite3VdbeAddOp2(v, OP_Integer, 0, r);
124443
+ sqlite3VdbeAddOp4(v, OP_Insert, iCur, regData, r, (char*)pTab, P4_TABLE);
124444
+ sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP);
124445
+ sqlite3ReleaseTempReg(pParse, r);
124446
+}
124447
+#else
124448
+# define codeWithoutRowidPreupdate(a,b,c,d)
124449
+#endif
124450
+
124083124451
/*
124084124452
** This routine generates code to finish the INSERT or UPDATE operation
124085124453
** that was started by a prior call to sqlite3GenerateConstraintChecks.
124086124454
** A consecutive range of registers starting at regNewData contains the
124087124455
** rowid and the content to be inserted.
@@ -124126,21 +124494,13 @@
124126124494
pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
124127124495
if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
124128124496
assert( pParse->nested==0 );
124129124497
pik_flags |= OPFLAG_NCHANGE;
124130124498
pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
124131
-#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
124132124499
if( update_flags==0 ){
124133
- int r = sqlite3GetTempReg(pParse);
124134
- sqlite3VdbeAddOp2(v, OP_Integer, 0, r);
124135
- sqlite3VdbeAddOp4(v, OP_Insert,
124136
- iIdxCur+i, aRegIdx[i], r, (char*)pTab, P4_TABLE
124137
- );
124138
- sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP);
124139
- sqlite3ReleaseTempReg(pParse, r);
124140
- }
124141
-#endif
124500
+ codeWithoutRowidPreupdate(pParse, pTab, iIdxCur+i, aRegIdx[i]);
124501
+ }
124142124502
}
124143124503
sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
124144124504
aRegIdx[i]+1,
124145124505
pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn);
124146124506
sqlite3VdbeChangeP5(v, pik_flags);
@@ -124334,11 +124694,11 @@
124334124694
){
124335124695
sqlite3 *db = pParse->db;
124336124696
ExprList *pEList; /* The result set of the SELECT */
124337124697
Table *pSrc; /* The table in the FROM clause of SELECT */
124338124698
Index *pSrcIdx, *pDestIdx; /* Source and destination indices */
124339
- struct SrcList_item *pItem; /* An element of pSelect->pSrc */
124699
+ SrcItem *pItem; /* An element of pSelect->pSrc */
124340124700
int i; /* Loop counter */
124341124701
int iDbSrc; /* The database of pSrc */
124342124702
int iSrc, iDest; /* Cursors from source and destination */
124343124703
int addr1, addr2; /* Loop addresses */
124344124704
int emptyDestTest = 0; /* Address of test for empty pDest */
@@ -124609,20 +124969,22 @@
124609124969
insFlags = OPFLAG_APPEND|OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT;
124610124970
}else{
124611124971
insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND|OPFLAG_PREFORMAT;
124612124972
}
124613124973
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
124614
- if( db->xPreUpdateCallback ){
124974
+ if( (db->mDbFlags & DBFLAG_Vacuum)==0 ){
124615124975
sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
124616124976
insFlags &= ~OPFLAG_PREFORMAT;
124617124977
}else
124618124978
#endif
124619124979
{
124620124980
sqlite3VdbeAddOp3(v, OP_RowCell, iDest, iSrc, regRowid);
124621124981
}
124622
- sqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid,
124623
- (char*)pDest, P4_TABLE);
124982
+ sqlite3VdbeAddOp3(v, OP_Insert, iDest, regData, regRowid);
124983
+ if( (db->mDbFlags & DBFLAG_Vacuum)==0 ){
124984
+ sqlite3VdbeChangeP4(v, -1, (char*)pDest, P4_TABLE);
124985
+ }
124624124986
sqlite3VdbeChangeP5(v, insFlags);
124625124987
124626124988
sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v);
124627124989
sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
124628124990
sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
@@ -124671,10 +125033,16 @@
124671125033
}else if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
124672125034
idxInsFlags |= OPFLAG_NCHANGE;
124673125035
}
124674125036
if( idxInsFlags!=(OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT) ){
124675125037
sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
125038
+ if( (db->mDbFlags & DBFLAG_Vacuum)==0
125039
+ && !HasRowid(pDest)
125040
+ && IsPrimaryKeyIndex(pDestIdx)
125041
+ ){
125042
+ codeWithoutRowidPreupdate(pParse, pDest, iDest, regData);
125043
+ }
124676125044
}
124677125045
sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
124678125046
sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
124679125047
sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
124680125048
sqlite3VdbeJumpHere(v, addr1);
@@ -129635,26 +130003,30 @@
129635130003
** Fill the InitData structure with an error message that indicates
129636130004
** that the database is corrupt.
129637130005
*/
129638130006
static void corruptSchema(
129639130007
InitData *pData, /* Initialization context */
129640
- const char *zObj, /* Object being parsed at the point of error */
130008
+ char **azObj, /* Type and name of object being parsed */
129641130009
const char *zExtra /* Error information */
129642130010
){
129643130011
sqlite3 *db = pData->db;
129644130012
if( db->mallocFailed ){
129645130013
pData->rc = SQLITE_NOMEM_BKPT;
129646130014
}else if( pData->pzErrMsg[0]!=0 ){
129647130015
/* A error message has already been generated. Do not overwrite it */
129648
- }else if( pData->mInitFlags & INITFLAG_AlterTable ){
129649
- *pData->pzErrMsg = sqlite3DbStrDup(db, zExtra);
130016
+ }else if( pData->mInitFlags & (INITFLAG_AlterRename|INITFLAG_AlterDrop) ){
130017
+ *pData->pzErrMsg = sqlite3MPrintf(db,
130018
+ "error in %s %s after %s: %s", azObj[0], azObj[1],
130019
+ (pData->mInitFlags & INITFLAG_AlterRename) ? "rename" : "drop column",
130020
+ zExtra
130021
+ );
129650130022
pData->rc = SQLITE_ERROR;
129651130023
}else if( db->flags & SQLITE_WriteSchema ){
129652130024
pData->rc = SQLITE_CORRUPT_BKPT;
129653130025
}else{
129654130026
char *z;
129655
- if( zObj==0 ) zObj = "?";
130027
+ const char *zObj = azObj[1] ? azObj[1] : "?";
129656130028
z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
129657130029
if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
129658130030
*pData->pzErrMsg = z;
129659130031
pData->rc = SQLITE_CORRUPT_BKPT;
129660130032
}
@@ -129708,18 +130080,18 @@
129708130080
UNUSED_PARAMETER2(NotUsed, argc);
129709130081
assert( sqlite3_mutex_held(db->mutex) );
129710130082
db->mDbFlags |= DBFLAG_EncodingFixed;
129711130083
pData->nInitRow++;
129712130084
if( db->mallocFailed ){
129713
- corruptSchema(pData, argv[1], 0);
130085
+ corruptSchema(pData, argv, 0);
129714130086
return 1;
129715130087
}
129716130088
129717130089
assert( iDb>=0 && iDb<db->nDb );
129718130090
if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
129719130091
if( argv[3]==0 ){
129720
- corruptSchema(pData, argv[1], 0);
130092
+ corruptSchema(pData, argv, 0);
129721130093
}else if( argv[4]
129722130094
&& 'c'==sqlite3UpperToLower[(unsigned char)argv[4][0]]
129723130095
&& 'r'==sqlite3UpperToLower[(unsigned char)argv[4][1]] ){
129724130096
/* Call the parser to process a CREATE TABLE, INDEX or VIEW.
129725130097
** But because db->init.busy is set to 1, no VDBE code is generated
@@ -129740,11 +130112,11 @@
129740130112
db->init.iDb = iDb;
129741130113
if( sqlite3GetUInt32(argv[3], &db->init.newTnum)==0
129742130114
|| (db->init.newTnum>pData->mxPage && pData->mxPage>0)
129743130115
){
129744130116
if( sqlite3Config.bExtraSchemaChecks ){
129745
- corruptSchema(pData, argv[1], "invalid rootpage");
130117
+ corruptSchema(pData, argv, "invalid rootpage");
129746130118
}
129747130119
}
129748130120
db->init.orphanTrigger = 0;
129749130121
db->init.azInit = argv;
129750130122
pStmt = 0;
@@ -129759,17 +130131,17 @@
129759130131
}else{
129760130132
if( rc > pData->rc ) pData->rc = rc;
129761130133
if( rc==SQLITE_NOMEM ){
129762130134
sqlite3OomFault(db);
129763130135
}else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){
129764
- corruptSchema(pData, argv[1], sqlite3_errmsg(db));
130136
+ corruptSchema(pData, argv, sqlite3_errmsg(db));
129765130137
}
129766130138
}
129767130139
}
129768130140
sqlite3_finalize(pStmt);
129769130141
}else if( argv[1]==0 || (argv[4]!=0 && argv[4][0]!=0) ){
129770
- corruptSchema(pData, argv[1], 0);
130142
+ corruptSchema(pData, argv, 0);
129771130143
}else{
129772130144
/* If the SQL column is blank it means this is an index that
129773130145
** was created to be the PRIMARY KEY or to fulfill a UNIQUE
129774130146
** constraint for a CREATE TABLE. The index should have already
129775130147
** been created when we processed the CREATE TABLE. All we have
@@ -129776,19 +130148,19 @@
129776130148
** to do here is record the root page number for that index.
129777130149
*/
129778130150
Index *pIndex;
129779130151
pIndex = sqlite3FindIndex(db, argv[1], db->aDb[iDb].zDbSName);
129780130152
if( pIndex==0 ){
129781
- corruptSchema(pData, argv[1], "orphan index");
130153
+ corruptSchema(pData, argv, "orphan index");
129782130154
}else
129783130155
if( sqlite3GetUInt32(argv[3],&pIndex->tnum)==0
129784130156
|| pIndex->tnum<2
129785130157
|| pIndex->tnum>pData->mxPage
129786130158
|| sqlite3IndexHasDuplicateRootPage(pIndex)
129787130159
){
129788130160
if( sqlite3Config.bExtraSchemaChecks ){
129789
- corruptSchema(pData, argv[1], "invalid rootpage");
130161
+ corruptSchema(pData, argv, "invalid rootpage");
129790130162
}
129791130163
}
129792130164
}
129793130165
return 0;
129794130166
}
@@ -130164,35 +130536,20 @@
130164130536
assert( i>=0 && i<db->nDb );
130165130537
}
130166130538
return i;
130167130539
}
130168130540
130169
-/*
130170
-** Deallocate a single AggInfo object
130171
-*/
130172
-static void agginfoFree(sqlite3 *db, AggInfo *p){
130173
- sqlite3DbFree(db, p->aCol);
130174
- sqlite3DbFree(db, p->aFunc);
130175
- sqlite3DbFree(db, p);
130176
-}
130177
-
130178130541
/*
130179130542
** Free all memory allocations in the pParse object
130180130543
*/
130181130544
SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
130182130545
sqlite3 *db = pParse->db;
130183
- AggInfo *pThis = pParse->pAggList;
130184
- while( pThis ){
130185
- AggInfo *pNext = pThis->pNext;
130186
- agginfoFree(db, pThis);
130187
- pThis = pNext;
130188
- }
130189130546
while( pParse->pCleanup ){
130190130547
ParseCleanup *pCleanup = pParse->pCleanup;
130191130548
pParse->pCleanup = pCleanup->pNext;
130192130549
pCleanup->xCleanup(db, pCleanup->pPtr);
130193
- sqlite3DbFree(db, pCleanup);
130550
+ sqlite3DbFreeNN(db, pCleanup);
130194130551
}
130195130552
sqlite3DbFree(db, pParse->aLabel);
130196130553
if( pParse->pConstExpr ){
130197130554
sqlite3ExprListDelete(db, pParse->pConstExpr);
130198130555
}
@@ -130222,11 +130579,11 @@
130222130579
** use-after-free errors following an OOM. The preferred way to do this is
130223130580
** to immediately follow the call to this routine with:
130224130581
**
130225130582
** testcase( pParse->earlyCleanup );
130226130583
*/
130227
-SQLITE_PRIVATE void sqlite3ParserAddCleanup(
130584
+SQLITE_PRIVATE void *sqlite3ParserAddCleanup(
130228130585
Parse *pParse, /* Destroy when this Parser finishes */
130229130586
void (*xCleanup)(sqlite3*,void*), /* The cleanup routine */
130230130587
void *pPtr /* Pointer to object to be cleaned up */
130231130588
){
130232130589
ParseCleanup *pCleanup = sqlite3DbMallocRaw(pParse->db, sizeof(*pCleanup));
@@ -130235,14 +130592,16 @@
130235130592
pParse->pCleanup = pCleanup;
130236130593
pCleanup->pPtr = pPtr;
130237130594
pCleanup->xCleanup = xCleanup;
130238130595
}else{
130239130596
xCleanup(pParse->db, pPtr);
130597
+ pPtr = 0;
130240130598
#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
130241130599
pParse->earlyCleanup = 1;
130242130600
#endif
130243130601
}
130602
+ return pPtr;
130244130603
}
130245130604
130246130605
/*
130247130606
** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
130248130607
*/
@@ -130893,11 +131252,11 @@
130893131252
130894131253
/*
130895131254
** Return the index of a column in a table. Return -1 if the column
130896131255
** is not contained in the table.
130897131256
*/
130898
-static int columnIndex(Table *pTab, const char *zCol){
131257
+SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol){
130899131258
int i;
130900131259
u8 h = sqlite3StrIHash(zCol);
130901131260
Column *pCol;
130902131261
for(pCol=pTab->aCol, i=0; i<pTab->nCol; pCol++, i++){
130903131262
if( pCol->hName==h && sqlite3StrICmp(pCol->zName, zCol)==0 ) return i;
@@ -130925,11 +131284,11 @@
130925131284
int i; /* For looping over tables in pSrc */
130926131285
int iCol; /* Index of column matching zCol */
130927131286
130928131287
assert( (piTab==0)==(piCol==0) ); /* Both or neither are NULL */
130929131288
for(i=0; i<N; i++){
130930
- iCol = columnIndex(pSrc->a[i].pTab, zCol);
131289
+ iCol = sqlite3ColumnIndex(pSrc->a[i].pTab, zCol);
130931131290
if( iCol>=0
130932131291
&& (bIgnoreHidden==0 || IsHiddenColumn(&pSrc->a[i].pTab->aCol[iCol])==0)
130933131292
){
130934131293
if( piTab ){
130935131294
*piTab = i;
@@ -131066,12 +131425,12 @@
131066131425
** This routine returns the number of errors encountered.
131067131426
*/
131068131427
static int sqliteProcessJoin(Parse *pParse, Select *p){
131069131428
SrcList *pSrc; /* All tables in the FROM clause */
131070131429
int i, j; /* Loop counters */
131071
- struct SrcList_item *pLeft; /* Left table being joined */
131072
- struct SrcList_item *pRight; /* Right table being joined */
131430
+ SrcItem *pLeft; /* Left table being joined */
131431
+ SrcItem *pRight; /* Right table being joined */
131073131432
131074131433
pSrc = p->pSrc;
131075131434
pLeft = &pSrc->a[0];
131076131435
pRight = &pLeft[1];
131077131436
for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){
@@ -131135,11 +131494,11 @@
131135131494
int iLeft; /* Table on the left with matching column name */
131136131495
int iLeftCol; /* Column number of matching column on the left */
131137131496
int iRightCol; /* Column number of matching column on the right */
131138131497
131139131498
zName = pList->a[j].zName;
131140
- iRightCol = columnIndex(pRightTab, zName);
131499
+ iRightCol = sqlite3ColumnIndex(pRightTab, zName);
131141131500
if( iRightCol<0
131142131501
|| !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol, 0)
131143131502
){
131144131503
sqlite3ErrorMsg(pParse, "cannot join using column %s - column "
131145131504
"not present in both tables", zName);
@@ -132717,10 +133076,11 @@
132717133076
sNC.pSrcList = pSelect->pSrc;
132718133077
a = pSelect->pEList->a;
132719133078
for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
132720133079
const char *zType;
132721133080
int n, m;
133081
+ pTab->tabFlags |= (pCol->colFlags & COLFLAG_NOINSERT);
132722133082
p = a[i].pExpr;
132723133083
zType = columnType(&sNC, p, 0, 0, 0);
132724133084
/* pCol->szEst = ... // Column size est for SELECT tables never used */
132725133085
pCol->affinity = sqlite3ExprAffinity(p);
132726133086
if( zType ){
@@ -134227,11 +134587,11 @@
134227134587
SubstContext *pSubst, /* Description of the substitution */
134228134588
Select *p, /* SELECT statement in which to make substitutions */
134229134589
int doPrior /* Do substitutes on p->pPrior too */
134230134590
){
134231134591
SrcList *pSrc;
134232
- struct SrcList_item *pItem;
134592
+ SrcItem *pItem;
134233134593
int i;
134234134594
if( !p ) return;
134235134595
do{
134236134596
substExprList(pSubst, p->pEList);
134237134597
substExprList(pSubst, p->pGroupBy);
@@ -134257,21 +134617,21 @@
134257134617
**
134258134618
** This routine scans the entire SELECT statement and recomputes the
134259134619
** pSrcItem->colUsed mask.
134260134620
*/
134261134621
static int recomputeColumnsUsedExpr(Walker *pWalker, Expr *pExpr){
134262
- struct SrcList_item *pItem;
134622
+ SrcItem *pItem;
134263134623
if( pExpr->op!=TK_COLUMN ) return WRC_Continue;
134264134624
pItem = pWalker->u.pSrcItem;
134265134625
if( pItem->iCursor!=pExpr->iTable ) return WRC_Continue;
134266134626
if( pExpr->iColumn<0 ) return WRC_Continue;
134267134627
pItem->colUsed |= sqlite3ExprColUsed(pExpr);
134268134628
return WRC_Continue;
134269134629
}
134270134630
static void recomputeColumnsUsed(
134271134631
Select *pSelect, /* The complete SELECT statement */
134272
- struct SrcList_item *pSrcItem /* Which FROM clause item to recompute */
134632
+ SrcItem *pSrcItem /* Which FROM clause item to recompute */
134273134633
){
134274134634
Walker w;
134275134635
if( NEVER(pSrcItem->pTab==0) ) return;
134276134636
memset(&w, 0, sizeof(w));
134277134637
w.xExprCallback = recomputeColumnsUsedExpr;
@@ -134301,11 +134661,11 @@
134301134661
int *aCsrMap, /* Array to store cursor mappings in */
134302134662
SrcList *pSrc, /* FROM clause to renumber */
134303134663
int iExcept /* FROM clause item to skip */
134304134664
){
134305134665
int i;
134306
- struct SrcList_item *pItem;
134666
+ SrcItem *pItem;
134307134667
for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){
134308134668
if( i!=iExcept ){
134309134669
Select *p;
134310134670
pItem->iCursor = aCsrMap[pItem->iCursor] = pParse->nTab++;
134311134671
for(p=pItem->pSelect; p; p=p->pPrior){
@@ -134319,11 +134679,12 @@
134319134679
** Expression walker callback used by renumberCursors() to update
134320134680
** Expr objects to match newly assigned cursor numbers.
134321134681
*/
134322134682
static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){
134323134683
int *aCsrMap = pWalker->u.aiCol;
134324
- if( pExpr->op==TK_COLUMN && aCsrMap[pExpr->iTable] ){
134684
+ int op = pExpr->op;
134685
+ if( (op==TK_COLUMN || op==TK_IF_NULL_ROW) && aCsrMap[pExpr->iTable] ){
134325134686
pExpr->iTable = aCsrMap[pExpr->iTable];
134326134687
}
134327134688
if( ExprHasProperty(pExpr, EP_FromJoin) && aCsrMap[pExpr->iRightJoinTable] ){
134328134689
pExpr->iRightJoinTable = aCsrMap[pExpr->iRightJoinTable];
134329134690
}
@@ -134534,11 +134895,11 @@
134534134895
int iParent; /* VDBE cursor number of the pSub result set temp table */
134535134896
int iNewParent = -1;/* Replacement table for iParent */
134536134897
int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */
134537134898
int i; /* Loop counter */
134538134899
Expr *pWhere; /* The WHERE clause */
134539
- struct SrcList_item *pSubitem; /* The subquery */
134900
+ SrcItem *pSubitem; /* The subquery */
134540134901
sqlite3 *db = pParse->db;
134541134902
Walker w; /* Walker to persist agginfo data */
134542134903
int *aCsrMap = 0;
134543134904
134544134905
/* Check to see if flattening is permitted. Return 0 if not.
@@ -135168,10 +135529,14 @@
135168135529
** then the (1,1,NULL) row would be suppressed.
135169135530
**
135170135531
** (6) The inner query features one or more window-functions (since
135171135532
** changes to the WHERE clause of the inner query could change the
135172135533
** window over which window functions are calculated).
135534
+**
135535
+** (7) The inner query is a Common Table Expression (CTE) that should
135536
+** be materialized. (This restriction is implemented in the calling
135537
+** routine.)
135173135538
**
135174135539
** Return 0 if no changes are made and non-zero if one or more WHERE clause
135175135540
** terms are duplicated into the subquery.
135176135541
*/
135177135542
static int pushDownWhereTerms(
@@ -135223,10 +135588,11 @@
135223135588
if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){
135224135589
return 0; /* restriction (5) */
135225135590
}
135226135591
if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
135227135592
nChng++;
135593
+ pSubq->selFlags |= SF_PushDown;
135228135594
while( pSubq ){
135229135595
SubstContext x;
135230135596
pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
135231135597
unsetJoinExpr(pNew, -1);
135232135598
x.pParse = pParse;
@@ -135338,28 +135704,30 @@
135338135704
** INDEXED BY clause, then try to locate the specified index. If there
135339135705
** was such a clause and the named index cannot be found, return
135340135706
** SQLITE_ERROR and leave an error in pParse. Otherwise, populate
135341135707
** pFrom->pIndex and return SQLITE_OK.
135342135708
*/
135343
-SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *pParse, struct SrcList_item *pFrom){
135344
- if( pFrom->pTab && pFrom->fg.isIndexedBy ){
135345
- Table *pTab = pFrom->pTab;
135346
- char *zIndexedBy = pFrom->u1.zIndexedBy;
135347
- Index *pIdx;
135348
- for(pIdx=pTab->pIndex;
135349
- pIdx && sqlite3StrICmp(pIdx->zName, zIndexedBy);
135350
- pIdx=pIdx->pNext
135351
- );
135352
- if( !pIdx ){
135353
- sqlite3ErrorMsg(pParse, "no such index: %s", zIndexedBy, 0);
135354
- pParse->checkSchema = 1;
135355
- return SQLITE_ERROR;
135356
- }
135357
- pFrom->pIBIndex = pIdx;
135358
- }
135709
+SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *pParse, SrcItem *pFrom){
135710
+ Table *pTab = pFrom->pTab;
135711
+ char *zIndexedBy = pFrom->u1.zIndexedBy;
135712
+ Index *pIdx;
135713
+ assert( pTab!=0 );
135714
+ assert( pFrom->fg.isIndexedBy!=0 );
135715
+
135716
+ for(pIdx=pTab->pIndex;
135717
+ pIdx && sqlite3StrICmp(pIdx->zName, zIndexedBy);
135718
+ pIdx=pIdx->pNext
135719
+ );
135720
+ if( !pIdx ){
135721
+ sqlite3ErrorMsg(pParse, "no such index: %s", zIndexedBy, 0);
135722
+ pParse->checkSchema = 1;
135723
+ return SQLITE_ERROR;
135724
+ }
135725
+ pFrom->u2.pIBIndex = pIdx;
135359135726
return SQLITE_OK;
135360135727
}
135728
+
135361135729
/*
135362135730
** Detect compound SELECT statements that use an ORDER BY clause with
135363135731
** an alternative collating sequence.
135364135732
**
135365135733
** SELECT ... FROM t1 EXCEPT SELECT ... FROM t2 ORDER BY .. COLLATE ...
@@ -135442,11 +135810,11 @@
135442135810
/*
135443135811
** Check to see if the FROM clause term pFrom has table-valued function
135444135812
** arguments. If it does, leave an error message in pParse and return
135445135813
** non-zero, since pFrom is not allowed to be a table-valued function.
135446135814
*/
135447
-static int cannotBeFunction(Parse *pParse, struct SrcList_item *pFrom){
135815
+static int cannotBeFunction(Parse *pParse, SrcItem *pFrom){
135448135816
if( pFrom->fg.isTabFunc ){
135449135817
sqlite3ErrorMsg(pParse, "'%s' is not a function", pFrom->zName);
135450135818
return 1;
135451135819
}
135452135820
return 0;
@@ -135463,23 +135831,23 @@
135463135831
** If a non-NULL value is returned, set *ppContext to point to the With
135464135832
** object that the returned CTE belongs to.
135465135833
*/
135466135834
static struct Cte *searchWith(
135467135835
With *pWith, /* Current innermost WITH clause */
135468
- struct SrcList_item *pItem, /* FROM clause element to resolve */
135836
+ SrcItem *pItem, /* FROM clause element to resolve */
135469135837
With **ppContext /* OUT: WITH clause return value belongs to */
135470135838
){
135471
- const char *zName;
135472
- if( pItem->zDatabase==0 && (zName = pItem->zName)!=0 ){
135473
- With *p;
135474
- for(p=pWith; p; p=p->pOuter){
135475
- int i;
135476
- for(i=0; i<p->nCte; i++){
135477
- if( sqlite3StrICmp(zName, p->a[i].zName)==0 ){
135478
- *ppContext = p;
135479
- return &p->a[i];
135480
- }
135839
+ const char *zName = pItem->zName;
135840
+ With *p;
135841
+ assert( pItem->zDatabase==0 );
135842
+ assert( zName!=0 );
135843
+ for(p=pWith; p; p=p->pOuter){
135844
+ int i;
135845
+ for(i=0; i<p->nCte; i++){
135846
+ if( sqlite3StrICmp(zName, p->a[i].zName)==0 ){
135847
+ *ppContext = p;
135848
+ return &p->a[i];
135481135849
}
135482135850
}
135483135851
}
135484135852
return 0;
135485135853
}
@@ -135508,79 +135876,102 @@
135508135876
}
135509135877
}
135510135878
135511135879
/*
135512135880
** This function checks if argument pFrom refers to a CTE declared by
135513
-** a WITH clause on the stack currently maintained by the parser. And,
135514
-** if currently processing a CTE expression, if it is a recursive
135515
-** reference to the current CTE.
135516
-**
135517
-** If pFrom falls into either of the two categories above, pFrom->pTab
135518
-** and other fields are populated accordingly. The caller should check
135519
-** (pFrom->pTab!=0) to determine whether or not a successful match
135520
-** was found.
135521
-**
135522
-** Whether or not a match is found, SQLITE_OK is returned if no error
135523
-** occurs. If an error does occur, an error message is stored in the
135524
-** parser and some error code other than SQLITE_OK returned.
135525
-*/
135526
-static int withExpand(
135527
- Walker *pWalker,
135528
- struct SrcList_item *pFrom
135529
-){
135530
- Parse *pParse = pWalker->pParse;
135531
- sqlite3 *db = pParse->db;
135532
- struct Cte *pCte; /* Matched CTE (or NULL if no match) */
135533
- With *pWith; /* WITH clause that pCte belongs to */
135881
+** a WITH clause on the stack currently maintained by the parser (on the
135882
+** pParse->pWith linked list). And if currently processing a CTE
135883
+** CTE expression, through routine checks to see if the reference is
135884
+** a recursive reference to the CTE.
135885
+**
135886
+** If pFrom matches a CTE according to either of these two above, pFrom->pTab
135887
+** and other fields are populated accordingly.
135888
+**
135889
+** Return 0 if no match is found.
135890
+** Return 1 if a match is found.
135891
+** Return 2 if an error condition is detected.
135892
+*/
135893
+static int resolveFromTermToCte(
135894
+ Parse *pParse, /* The parsing context */
135895
+ Walker *pWalker, /* Current tree walker */
135896
+ SrcItem *pFrom /* The FROM clause term to check */
135897
+){
135898
+ Cte *pCte; /* Matched CTE (or NULL if no match) */
135899
+ With *pWith; /* The matching WITH */
135534135900
135535135901
assert( pFrom->pTab==0 );
135536
- if( pParse->nErr ){
135537
- return SQLITE_ERROR;
135902
+ if( pParse->pWith==0 ){
135903
+ /* There are no WITH clauses in the stack. No match is possible */
135904
+ return 0;
135538135905
}
135539
-
135906
+ if( pFrom->zDatabase!=0 ){
135907
+ /* The FROM term contains a schema qualifier (ex: main.t1) and so
135908
+ ** it cannot possibly be a CTE reference. */
135909
+ return 0;
135910
+ }
135540135911
pCte = searchWith(pParse->pWith, pFrom, &pWith);
135541135912
if( pCte ){
135913
+ sqlite3 *db = pParse->db;
135542135914
Table *pTab;
135543135915
ExprList *pEList;
135544135916
Select *pSel;
135545135917
Select *pLeft; /* Left-most SELECT statement */
135546135918
Select *pRecTerm; /* Left-most recursive term */
135547135919
int bMayRecursive; /* True if compound joined by UNION [ALL] */
135548135920
With *pSavedWith; /* Initial value of pParse->pWith */
135549135921
int iRecTab = -1; /* Cursor for recursive table */
135922
+ CteUse *pCteUse;
135550135923
135551135924
/* If pCte->zCteErr is non-NULL at this point, then this is an illegal
135552135925
** recursive reference to CTE pCte. Leave an error in pParse and return
135553135926
** early. If pCte->zCteErr is NULL, then this is not a recursive reference.
135554135927
** In this case, proceed. */
135555135928
if( pCte->zCteErr ){
135556135929
sqlite3ErrorMsg(pParse, pCte->zCteErr, pCte->zName);
135557
- return SQLITE_ERROR;
135930
+ return 2;
135558135931
}
135559
- if( cannotBeFunction(pParse, pFrom) ) return SQLITE_ERROR;
135932
+ if( cannotBeFunction(pParse, pFrom) ) return 2;
135560135933
135561135934
assert( pFrom->pTab==0 );
135562
- pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));
135563
- if( pTab==0 ) return WRC_Abort;
135935
+ pTab = sqlite3DbMallocZero(db, sizeof(Table));
135936
+ if( pTab==0 ) return 2;
135937
+ pCteUse = pCte->pUse;
135938
+ if( pCteUse==0 ){
135939
+ pCte->pUse = pCteUse = sqlite3DbMallocZero(db, sizeof(pCteUse[0]));
135940
+ if( pCteUse==0
135941
+ || sqlite3ParserAddCleanup(pParse,sqlite3DbFree,pCteUse)==0
135942
+ ){
135943
+ sqlite3DbFree(db, pTab);
135944
+ return 2;
135945
+ }
135946
+ pCteUse->eM10d = pCte->eM10d;
135947
+ }
135948
+ pFrom->pTab = pTab;
135564135949
pTab->nTabRef = 1;
135565135950
pTab->zName = sqlite3DbStrDup(db, pCte->zName);
135566135951
pTab->iPKey = -1;
135567135952
pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
135568135953
pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid;
135569135954
pFrom->pSelect = sqlite3SelectDup(db, pCte->pSelect, 0);
135570
- if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
135955
+ if( db->mallocFailed ) return 2;
135571135956
assert( pFrom->pSelect );
135957
+ pFrom->fg.isCte = 1;
135958
+ pFrom->u2.pCteUse = pCteUse;
135959
+ pCteUse->nUse++;
135960
+ if( pCteUse->nUse>=2 && pCteUse->eM10d==M10d_Any ){
135961
+ pCteUse->eM10d = M10d_Yes;
135962
+ }
135572135963
135573135964
/* Check if this is a recursive CTE. */
135574135965
pRecTerm = pSel = pFrom->pSelect;
135575135966
bMayRecursive = ( pSel->op==TK_ALL || pSel->op==TK_UNION );
135576135967
while( bMayRecursive && pRecTerm->op==pSel->op ){
135577135968
int i;
135578135969
SrcList *pSrc = pRecTerm->pSrc;
135579135970
assert( pRecTerm->pPrior!=0 );
135580135971
for(i=0; i<pSrc->nSrc; i++){
135581
- struct SrcList_item *pItem = &pSrc->a[i];
135972
+ SrcItem *pItem = &pSrc->a[i];
135582135973
if( pItem->zDatabase==0
135583135974
&& pItem->zName!=0
135584135975
&& 0==sqlite3StrICmp(pItem->zName, pCte->zName)
135585135976
){
135586135977
pItem->pTab = pTab;
@@ -135588,11 +135979,11 @@
135588135979
pItem->fg.isRecursive = 1;
135589135980
if( pRecTerm->selFlags & SF_Recursive ){
135590135981
sqlite3ErrorMsg(pParse,
135591135982
"multiple references to recursive table: %s", pCte->zName
135592135983
);
135593
- return SQLITE_ERROR;
135984
+ return 2;
135594135985
}
135595135986
pRecTerm->selFlags |= SF_Recursive;
135596135987
if( iRecTab<0 ) iRecTab = pParse->nTab++;
135597135988
pItem->iCursor = iRecTab;
135598135989
}
@@ -135624,11 +136015,11 @@
135624136015
if( pEList && pEList->nExpr!=pCte->pCols->nExpr ){
135625136016
sqlite3ErrorMsg(pParse, "table %s has %d values for %d columns",
135626136017
pCte->zName, pEList->nExpr, pCte->pCols->nExpr
135627136018
);
135628136019
pParse->pWith = pSavedWith;
135629
- return SQLITE_ERROR;
136020
+ return 2;
135630136021
}
135631136022
pEList = pCte->pCols;
135632136023
}
135633136024
135634136025
sqlite3ColumnsFromExprList(pParse, pEList, &pTab->nCol, &pTab->aCol);
@@ -135640,13 +136031,13 @@
135640136031
}
135641136032
sqlite3WalkSelect(pWalker, pSel);
135642136033
}
135643136034
pCte->zCteErr = 0;
135644136035
pParse->pWith = pSavedWith;
136036
+ return 1; /* Success */
135645136037
}
135646
-
135647
- return SQLITE_OK;
136038
+ return 0; /* No match */
135648136039
}
135649136040
#endif
135650136041
135651136042
#ifndef SQLITE_OMIT_CTE
135652136043
/*
@@ -135676,11 +136067,11 @@
135676136067
** sub-query in the FROM clause of a SELECT statement. This function
135677136068
** allocates and populates the SrcList_item.pTab object. If successful,
135678136069
** SQLITE_OK is returned. Otherwise, if an OOM error is encountered,
135679136070
** SQLITE_NOMEM.
135680136071
*/
135681
-SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse *pParse, struct SrcList_item *pFrom){
136072
+SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse *pParse, SrcItem *pFrom){
135682136073
Select *pSel = pFrom->pSelect;
135683136074
Table *pTab;
135684136075
135685136076
assert( pSel );
135686136077
pFrom->pTab = pTab = sqlite3DbMallocZero(pParse->db, sizeof(Table));
@@ -135724,14 +136115,14 @@
135724136115
** and TABLE.* to be every column in TABLE.
135725136116
**
135726136117
*/
135727136118
static int selectExpander(Walker *pWalker, Select *p){
135728136119
Parse *pParse = pWalker->pParse;
135729
- int i, j, k;
136120
+ int i, j, k, rc;
135730136121
SrcList *pTabList;
135731136122
ExprList *pEList;
135732
- struct SrcList_item *pFrom;
136123
+ SrcItem *pFrom;
135733136124
sqlite3 *db = pParse->db;
135734136125
Expr *pE, *pRight, *pExpr;
135735136126
u16 selFlags = p->selFlags;
135736136127
u32 elistFlags = 0;
135737136128
@@ -135763,23 +136154,25 @@
135763136154
for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){
135764136155
Table *pTab;
135765136156
assert( pFrom->fg.isRecursive==0 || pFrom->pTab!=0 );
135766136157
if( pFrom->pTab ) continue;
135767136158
assert( pFrom->fg.isRecursive==0 );
135768
-#ifndef SQLITE_OMIT_CTE
135769
- if( withExpand(pWalker, pFrom) ) return WRC_Abort;
135770
- if( pFrom->pTab ) {} else
135771
-#endif
135772136159
if( pFrom->zName==0 ){
135773136160
#ifndef SQLITE_OMIT_SUBQUERY
135774136161
Select *pSel = pFrom->pSelect;
135775136162
/* A sub-query in the FROM clause of a SELECT */
135776136163
assert( pSel!=0 );
135777136164
assert( pFrom->pTab==0 );
135778136165
if( sqlite3WalkSelect(pWalker, pSel) ) return WRC_Abort;
135779136166
if( sqlite3ExpandSubquery(pParse, pFrom) ) return WRC_Abort;
135780136167
#endif
136168
+#ifndef SQLITE_OMIT_CTE
136169
+ }else if( (rc = resolveFromTermToCte(pParse, pWalker, pFrom))!=0 ){
136170
+ if( rc>1 ) return WRC_Abort;
136171
+ pTab = pFrom->pTab;
136172
+ assert( pTab!=0 );
136173
+#endif
135781136174
}else{
135782136175
/* An ordinary table or view name in the FROM clause */
135783136176
assert( pFrom->pTab==0 );
135784136177
pFrom->pTab = pTab = sqlite3LocateTableItem(pParse, 0, pFrom);
135785136178
if( pTab==0 ) return WRC_Abort;
@@ -135823,11 +136216,11 @@
135823136216
}
135824136217
#endif
135825136218
}
135826136219
135827136220
/* Locate the index named by the INDEXED BY clause, if any. */
135828
- if( sqlite3IndexedByLookup(pParse, pFrom) ){
136221
+ if( pFrom->fg.isIndexedBy && sqlite3IndexedByLookup(pParse, pFrom) ){
135829136222
return WRC_Abort;
135830136223
}
135831136224
}
135832136225
135833136226
/* Process NATURAL keywords, and ON and USING clauses of joins.
@@ -136066,11 +136459,11 @@
136066136459
*/
136067136460
static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){
136068136461
Parse *pParse;
136069136462
int i;
136070136463
SrcList *pTabList;
136071
- struct SrcList_item *pFrom;
136464
+ SrcItem *pFrom;
136072136465
136073136466
assert( p->selFlags & SF_Resolved );
136074136467
if( p->selFlags & SF_HasTypeInfo ) return;
136075136468
p->selFlags |= SF_HasTypeInfo;
136076136469
pParse = pWalker->pParse;
@@ -136390,15 +136783,17 @@
136390136783
/*
136391136784
** Check to see if the pThis entry of pTabList is a self-join of a prior view.
136392136785
** If it is, then return the SrcList_item for the prior view. If it is not,
136393136786
** then return 0.
136394136787
*/
136395
-static struct SrcList_item *isSelfJoinView(
136788
+static SrcItem *isSelfJoinView(
136396136789
SrcList *pTabList, /* Search for self-joins in this FROM clause */
136397
- struct SrcList_item *pThis /* Search for prior reference to this subquery */
136790
+ SrcItem *pThis /* Search for prior reference to this subquery */
136398136791
){
136399
- struct SrcList_item *pItem;
136792
+ SrcItem *pItem;
136793
+ assert( pThis->pSelect!=0 );
136794
+ if( pThis->pSelect->selFlags & SF_PushDown ) return 0;
136400136795
for(pItem = pTabList->a; pItem<pThis; pItem++){
136401136796
Select *pS1;
136402136797
if( pItem->pSelect==0 ) continue;
136403136798
if( pItem->fg.viaCoroutine ) continue;
136404136799
if( pItem->zName==0 ) continue;
@@ -136410,21 +136805,28 @@
136410136805
if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){
136411136806
/* The query flattener left two different CTE tables with identical
136412136807
** names in the same FROM clause. */
136413136808
continue;
136414136809
}
136415
- if( sqlite3ExprCompare(0, pThis->pSelect->pWhere, pS1->pWhere, -1)
136416
- || sqlite3ExprCompare(0, pThis->pSelect->pHaving, pS1->pHaving, -1)
136417
- ){
136810
+ if( pItem->pSelect->selFlags & SF_PushDown ){
136418136811
/* The view was modified by some other optimization such as
136419136812
** pushDownWhereTerms() */
136420136813
continue;
136421136814
}
136422136815
return pItem;
136423136816
}
136424136817
return 0;
136425136818
}
136819
+
136820
+/*
136821
+** Deallocate a single AggInfo object
136822
+*/
136823
+static void agginfoFree(sqlite3 *db, AggInfo *p){
136824
+ sqlite3DbFree(db, p->aCol);
136825
+ sqlite3DbFree(db, p->aFunc);
136826
+ sqlite3DbFreeNN(db, p);
136827
+}
136426136828
136427136829
#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
136428136830
/*
136429136831
** Attempt to transform a query of the form
136430136832
**
@@ -136589,13 +136991,13 @@
136589136991
/* If the SF_UpdateFrom flag is set, then this function is being called
136590136992
** as part of populating the temp table for an UPDATE...FROM statement.
136591136993
** In this case, it is an error if the target object (pSrc->a[0]) name
136592136994
** or alias is duplicated within FROM clause (pSrc->a[1..n]). */
136593136995
if( p->selFlags & SF_UpdateFrom ){
136594
- struct SrcList_item *p0 = &p->pSrc->a[0];
136996
+ SrcItem *p0 = &p->pSrc->a[0];
136595136997
for(i=1; i<p->pSrc->nSrc; i++){
136596
- struct SrcList_item *p1 = &p->pSrc->a[i];
136998
+ SrcItem *p1 = &p->pSrc->a[i];
136597136999
if( p0->pTab==p1->pTab && 0==sqlite3_stricmp(p0->zAlias, p1->zAlias) ){
136598137000
sqlite3ErrorMsg(pParse,
136599137001
"target object/alias may not appear in FROM clause: %s",
136600137002
p0->zAlias ? p0->zAlias : p0->pTab->zName
136601137003
);
@@ -136629,11 +137031,11 @@
136629137031
/* Try to do various optimizations (flattening subqueries, and strength
136630137032
** reduction of join operators) in the FROM clause up into the main query
136631137033
*/
136632137034
#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
136633137035
for(i=0; !p->pPrior && i<pTabList->nSrc; i++){
136634
- struct SrcList_item *pItem = &pTabList->a[i];
137036
+ SrcItem *pItem = &pTabList->a[i];
136635137037
Select *pSub = pItem->pSelect;
136636137038
Table *pTab = pItem->pTab;
136637137039
136638137040
/* The expander should have already created transient Table objects
136639137041
** even for FROM clause elements such as subqueries that do not correspond
@@ -136763,11 +137165,12 @@
136763137165
/* For each term in the FROM clause, do two things:
136764137166
** (1) Authorized unreferenced tables
136765137167
** (2) Generate code for all sub-queries
136766137168
*/
136767137169
for(i=0; i<pTabList->nSrc; i++){
136768
- struct SrcList_item *pItem = &pTabList->a[i];
137170
+ SrcItem *pItem = &pTabList->a[i];
137171
+ SrcItem *pPrior;
136769137172
SelectDest dest;
136770137173
Select *pSub;
136771137174
#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
136772137175
const char *zSavedAuthContext;
136773137176
#endif
@@ -136823,10 +137226,11 @@
136823137226
136824137227
/* Make copies of constant WHERE-clause terms in the outer query down
136825137228
** inside the subquery. This can help the subquery to run more efficiently.
136826137229
*/
136827137230
if( OptimizationEnabled(db, SQLITE_PushDown)
137231
+ && (pItem->fg.isCte==0 || pItem->u2.pCteUse->eM10d!=M10d_Yes)
136828137232
&& pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
136829137233
(pItem->fg.jointype & JT_OUTER)!=0)
136830137234
){
136831137235
#if SELECTTRACE_ENABLED
136832137236
if( sqlite3SelectTrace & 0x100 ){
@@ -136833,29 +137237,32 @@
136833137237
SELECTTRACE(0x100,pParse,p,
136834137238
("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
136835137239
sqlite3TreeViewSelect(0, p, 0);
136836137240
}
136837137241
#endif
137242
+ assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
136838137243
}else{
136839137244
SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));
136840137245
}
136841137246
136842137247
zSavedAuthContext = pParse->zAuthContext;
136843137248
pParse->zAuthContext = pItem->zName;
136844137249
136845137250
/* Generate code to implement the subquery
136846137251
**
136847
- ** The subquery is implemented as a co-routine if the subquery is
136848
- ** guaranteed to be the outer loop (so that it does not need to be
136849
- ** computed more than once)
137252
+ ** The subquery is implemented as a co-routine if:
137253
+ ** (1) the subquery is guaranteed to be the outer loop (so that
137254
+ ** it does not need to be computed more than once), and
137255
+ ** (2) the subquery is not a CTE that should be materialized
136850137256
**
136851
- ** TODO: Are there other reasons beside (1) to use a co-routine
137257
+ ** TODO: Are there other reasons beside (1) and (2) to use a co-routine
136852137258
** implementation?
136853137259
*/
136854137260
if( i==0
136855137261
&& (pTabList->nSrc==1
136856137262
|| (pTabList->a[1].fg.jointype&(JT_LEFT|JT_CROSS))!=0) /* (1) */
137263
+ && (pItem->fg.isCte==0 || pItem->u2.pCteUse->eM10d!=M10d_Yes) /* (2) */
136857137264
){
136858137265
/* Implement a co-routine that will return a single row of the result
136859137266
** set on each invocation.
136860137267
*/
136861137268
int addrTop = sqlite3VdbeCurrentAddr(v)+1;
@@ -136871,20 +137278,34 @@
136871137278
pItem->fg.viaCoroutine = 1;
136872137279
pItem->regResult = dest.iSdst;
136873137280
sqlite3VdbeEndCoroutine(v, pItem->regReturn);
136874137281
sqlite3VdbeJumpHere(v, addrTop-1);
136875137282
sqlite3ClearTempRegCache(pParse);
137283
+ }else if( pItem->fg.isCte && pItem->u2.pCteUse->addrM9e>0 ){
137284
+ /* This is a CTE for which materialization code has already been
137285
+ ** generated. Invoke the subroutine to compute the materialization,
137286
+ ** the make the pItem->iCursor be a copy of the ephemerial table that
137287
+ ** holds the result of the materialization. */
137288
+ CteUse *pCteUse = pItem->u2.pCteUse;
137289
+ sqlite3VdbeAddOp2(v, OP_Gosub, pCteUse->regRtn, pCteUse->addrM9e);
137290
+ if( pItem->iCursor!=pCteUse->iCur ){
137291
+ sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pCteUse->iCur);
137292
+ }
137293
+ pSub->nSelectRow = pCteUse->nRowEst;
137294
+ }else if( (pPrior = isSelfJoinView(pTabList, pItem))!=0 ){
137295
+ /* This view has already been materialized by a prior entry in
137296
+ ** this same FROM clause. Reuse it. */
137297
+ if( pPrior->addrFillSub ){
137298
+ sqlite3VdbeAddOp2(v, OP_Gosub, pPrior->regReturn, pPrior->addrFillSub);
137299
+ }
137300
+ sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor);
137301
+ pSub->nSelectRow = pPrior->pSelect->nSelectRow;
136876137302
}else{
136877
- /* Generate a subroutine that will fill an ephemeral table with
136878
- ** the content of this subquery. pItem->addrFillSub will point
136879
- ** to the address of the generated subroutine. pItem->regReturn
136880
- ** is a register allocated to hold the subroutine return address
136881
- */
137303
+ /* Generate a subroutine that will materialize the view. */
136882137304
int topAddr;
136883137305
int onceAddr = 0;
136884137306
int retAddr;
136885
- struct SrcList_item *pPrior;
136886137307
136887137308
testcase( pItem->addrFillSub==0 ); /* Ticket c52b09c7f38903b1311 */
136888137309
pItem->regReturn = ++pParse->nMem;
136889137310
topAddr = sqlite3VdbeAddOp2(v, OP_Integer, 0, pItem->regReturn);
136890137311
pItem->addrFillSub = topAddr+1;
@@ -136895,26 +137316,26 @@
136895137316
onceAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
136896137317
VdbeComment((v, "materialize \"%s\"", pItem->pTab->zName));
136897137318
}else{
136898137319
VdbeNoopComment((v, "materialize \"%s\"", pItem->pTab->zName));
136899137320
}
136900
- pPrior = isSelfJoinView(pTabList, pItem);
136901
- if( pPrior ){
136902
- sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor);
136903
- assert( pPrior->pSelect!=0 );
136904
- pSub->nSelectRow = pPrior->pSelect->nSelectRow;
136905
- }else{
136906
- sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
136907
- ExplainQueryPlan((pParse, 1, "MATERIALIZE %u", pSub->selId));
136908
- sqlite3Select(pParse, pSub, &dest);
136909
- }
137321
+ sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
137322
+ ExplainQueryPlan((pParse, 1, "MATERIALIZE %u", pSub->selId));
137323
+ sqlite3Select(pParse, pSub, &dest);
136910137324
pItem->pTab->nRowLogEst = pSub->nSelectRow;
136911137325
if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr);
136912137326
retAddr = sqlite3VdbeAddOp1(v, OP_Return, pItem->regReturn);
136913137327
VdbeComment((v, "end %s", pItem->pTab->zName));
136914137328
sqlite3VdbeChangeP1(v, topAddr, retAddr);
136915137329
sqlite3ClearTempRegCache(pParse);
137330
+ if( pItem->fg.isCte ){
137331
+ CteUse *pCteUse = pItem->u2.pCteUse;
137332
+ pCteUse->addrM9e = pItem->addrFillSub;
137333
+ pCteUse->regRtn = pItem->regReturn;
137334
+ pCteUse->iCur = pItem->iCursor;
137335
+ pCteUse->nRowEst = pSub->nSelectRow;
137336
+ }
136916137337
}
136917137338
if( db->mallocFailed ) goto select_end;
136918137339
pParse->nHeight -= sqlite3SelectExprHeight(p);
136919137340
pParse->zAuthContext = zSavedAuthContext;
136920137341
#endif
@@ -137055,10 +137476,11 @@
137055137476
sSort.labelOBLopt = sqlite3WhereOrderByLimitOptLabel(pWInfo);
137056137477
if( sSort.nOBSat==sSort.pOrderBy->nExpr ){
137057137478
sSort.pOrderBy = 0;
137058137479
}
137059137480
}
137481
+ SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));
137060137482
137061137483
/* If sorting index that was created by a prior OP_OpenEphemeral
137062137484
** instruction ended up not being needed, then change the OP_OpenEphemeral
137063137485
** into an OP_Noop.
137064137486
*/
@@ -137093,10 +137515,11 @@
137093137515
sqlite3WhereContinueLabel(pWInfo),
137094137516
sqlite3WhereBreakLabel(pWInfo));
137095137517
137096137518
/* End the database scan loop.
137097137519
*/
137520
+ SELECTTRACE(1,pParse,p,("WhereEnd\n"));
137098137521
sqlite3WhereEnd(pWInfo);
137099137522
}
137100137523
}else{
137101137524
/* This case when there exist aggregate functions or a GROUP BY clause
137102137525
** or both */
@@ -137163,15 +137586,17 @@
137163137586
/* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in
137164137587
** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the
137165137588
** SELECT statement.
137166137589
*/
137167137590
pAggInfo = sqlite3DbMallocZero(db, sizeof(*pAggInfo) );
137168
- if( pAggInfo==0 ){
137591
+ if( pAggInfo ){
137592
+ sqlite3ParserAddCleanup(pParse,
137593
+ (void(*)(sqlite3*,void*))agginfoFree, pAggInfo);
137594
+ }
137595
+ if( db->mallocFailed ){
137169137596
goto select_end;
137170137597
}
137171
- pAggInfo->pNext = pParse->pAggList;
137172
- pParse->pAggList = pAggInfo;
137173137598
pAggInfo->selId = p->selId;
137174137599
memset(&sNC, 0, sizeof(sNC));
137175137600
sNC.pParse = pParse;
137176137601
sNC.pSrcList = pTabList;
137177137602
sNC.uNC.pAggInfo = pAggInfo;
@@ -137286,10 +137711,11 @@
137286137711
SELECTTRACE(1,pParse,p,("WhereBegin\n"));
137287137712
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, 0,
137288137713
WHERE_GROUPBY | (orderByGrp ? WHERE_SORTBYGROUP : 0), 0
137289137714
);
137290137715
if( pWInfo==0 ) goto select_end;
137716
+ SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));
137291137717
if( sqlite3WhereIsOrdered(pWInfo)==pGroupBy->nExpr ){
137292137718
/* The optimizer is able to deliver rows in group by order so
137293137719
** we do not have to sort. The OP_OpenEphemeral table will be
137294137720
** cancelled later because we still need to use the pKeyInfo
137295137721
*/
@@ -137334,10 +137760,11 @@
137334137760
regRecord = sqlite3GetTempReg(pParse);
137335137761
sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord);
137336137762
sqlite3VdbeAddOp2(v, OP_SorterInsert, pAggInfo->sortingIdx, regRecord);
137337137763
sqlite3ReleaseTempReg(pParse, regRecord);
137338137764
sqlite3ReleaseTempRange(pParse, regBase, nCol);
137765
+ SELECTTRACE(1,pParse,p,("WhereEnd\n"));
137339137766
sqlite3WhereEnd(pWInfo);
137340137767
pAggInfo->sortingIdxPTab = sortPTab = pParse->nTab++;
137341137768
sortOut = sqlite3GetTempReg(pParse);
137342137769
sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol);
137343137770
sqlite3VdbeAddOp2(v, OP_SorterSort, pAggInfo->sortingIdx, addrEnd);
@@ -137411,10 +137838,11 @@
137411137838
*/
137412137839
if( groupBySort ){
137413137840
sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx,addrTopOfLoop);
137414137841
VdbeCoverage(v);
137415137842
}else{
137843
+ SELECTTRACE(1,pParse,p,("WhereEnd\n"));
137416137844
sqlite3WhereEnd(pWInfo);
137417137845
sqlite3VdbeChangeToNoop(v, addrSortingIdx);
137418137846
}
137419137847
137420137848
/* Output the final row of result
@@ -137566,15 +137994,17 @@
137566137994
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy,
137567137995
0, minMaxFlag, 0);
137568137996
if( pWInfo==0 ){
137569137997
goto select_end;
137570137998
}
137999
+ SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));
137571138000
updateAccumulator(pParse, regAcc, pAggInfo);
137572138001
if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc);
137573138002
if( minMaxFlag ){
137574138003
sqlite3WhereMinMaxOptEarlyOut(v, pWInfo);
137575138004
}
138005
+ SELECTTRACE(1,pParse,p,("WhereEnd\n"));
137576138006
sqlite3WhereEnd(pWInfo);
137577138007
finalizeAggFunctions(pParse, pAggInfo);
137578138008
}
137579138009
137580138010
sSort.pOrderBy = 0;
@@ -138199,11 +138629,11 @@
138199138629
db->aDb[iDb].zDbSName, zName,
138200138630
pTrig->table, z);
138201138631
sqlite3DbFree(db, z);
138202138632
sqlite3ChangeCookie(pParse, iDb);
138203138633
sqlite3VdbeAddParseSchemaOp(v, iDb,
138204
- sqlite3MPrintf(db, "type='trigger' AND name='%q'", zName));
138634
+ sqlite3MPrintf(db, "type='trigger' AND name='%q'", zName), 0);
138205138635
}
138206138636
138207138637
if( db->init.busy ){
138208138638
Trigger *pLink = pTrig;
138209138639
Hash *pHash = &db->aDb[iDb].pSchema->trigHash;
@@ -141764,11 +142194,11 @@
141764142194
v = sqlite3GetVdbe(pParse);
141765142195
sqlite3ChangeCookie(pParse, iDb);
141766142196
141767142197
sqlite3VdbeAddOp0(v, OP_Expire);
141768142198
zWhere = sqlite3MPrintf(db, "name=%Q AND sql=%Q", pTab->zName, zStmt);
141769
- sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere);
142199
+ sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere, 0);
141770142200
sqlite3DbFree(db, zStmt);
141771142201
141772142202
iReg = ++pParse->nMem;
141773142203
sqlite3VdbeLoadString(v, iReg, pTab->zName);
141774142204
sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg);
@@ -141935,10 +142365,11 @@
141935142365
if( zType[i]=='\0' && i>0 ){
141936142366
assert(zType[i-1]==' ');
141937142367
zType[i-1] = '\0';
141938142368
}
141939142369
pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN;
142370
+ pTab->tabFlags |= TF_HasHidden;
141940142371
oooHidden = TF_OOOHidden;
141941142372
}else{
141942142373
pTab->tabFlags |= oooHidden;
141943142374
}
141944142375
}
@@ -143158,11 +143589,11 @@
143158143589
SQLITE_PRIVATE void sqlite3WhereSplit(WhereClause*,Expr*,u8);
143159143590
SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet*, Expr*);
143160143591
SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet*, Expr*);
143161143592
SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet*, ExprList*);
143162143593
SQLITE_PRIVATE void sqlite3WhereExprAnalyze(SrcList*, WhereClause*);
143163
-SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, struct SrcList_item*, WhereClause*);
143594
+SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, SrcItem*, WhereClause*);
143164143595
143165143596
143166143597
143167143598
143168143599
@@ -143336,11 +143767,11 @@
143336143767
int ret = 0;
143337143768
#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
143338143769
if( sqlite3ParseToplevel(pParse)->explain==2 )
143339143770
#endif
143340143771
{
143341
- struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];
143772
+ SrcItem *pItem = &pTabList->a[pLevel->iFrom];
143342143773
Vdbe *v = pParse->pVdbe; /* VM being constructed */
143343143774
sqlite3 *db = pParse->db; /* Database handle */
143344143775
int isSearch; /* True for a SEARCH. False for SCAN. */
143345143776
WhereLoop *pLoop; /* The controlling WhereLoop object */
143346143777
u32 flags; /* Flags that describe this loop */
@@ -144129,11 +144560,11 @@
144129144560
144130144561
/*
144131144562
** Insert an OP_CursorHint instruction if it is appropriate to do so.
144132144563
*/
144133144564
static void codeCursorHint(
144134
- struct SrcList_item *pTabItem, /* FROM clause item */
144565
+ SrcItem *pTabItem, /* FROM clause item */
144135144566
WhereInfo *pWInfo, /* The where clause */
144136144567
WhereLevel *pLevel, /* Which loop to provide hints for */
144137144568
WhereTerm *pEndRange /* Hint this end-of-scan boundary term if not NULL */
144138144569
){
144139144570
Parse *pParse = pWInfo->pParse;
@@ -144504,11 +144935,11 @@
144504144935
int bRev; /* True if we need to scan in reverse order */
144505144936
WhereLoop *pLoop; /* The WhereLoop object being coded */
144506144937
WhereClause *pWC; /* Decomposition of the entire WHERE clause */
144507144938
WhereTerm *pTerm; /* A WHERE clause term */
144508144939
sqlite3 *db; /* Database connection */
144509
- struct SrcList_item *pTabItem; /* FROM clause term being coded */
144940
+ SrcItem *pTabItem; /* FROM clause term being coded */
144510144941
int addrBrk; /* Jump here to break out of the loop */
144511144942
int addrHalt; /* addrBrk for the outermost loop */
144512144943
int addrCont; /* Jump here to continue with next cycle */
144513144944
int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
144514144945
int iReleaseReg = 0; /* Temp register to free before returning */
@@ -145292,11 +145723,11 @@
145292145723
** by this loop in the a[0] slot and all notReady tables in a[1..] slots.
145293145724
** This becomes the SrcList in the recursive call to sqlite3WhereBegin().
145294145725
*/
145295145726
if( pWInfo->nLevel>1 ){
145296145727
int nNotReady; /* The number of notReady tables */
145297
- struct SrcList_item *origSrc; /* Original list of tables */
145728
+ SrcItem *origSrc; /* Original list of tables */
145298145729
nNotReady = pWInfo->nLevel - iLevel - 1;
145299145730
pOrTab = sqlite3StackAllocRaw(db,
145300145731
sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0]));
145301145732
if( pOrTab==0 ) return notReady;
145302145733
pOrTab->nAlloc = (u8)(nNotReady + 1);
@@ -147557,11 +147988,11 @@
147557147988
** Each function argument translates into an equality constraint against
147558147989
** a HIDDEN column in the table.
147559147990
*/
147560147991
SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(
147561147992
Parse *pParse, /* Parsing context */
147562
- struct SrcList_item *pItem, /* The FROM clause term to process */
147993
+ SrcItem *pItem, /* The FROM clause term to process */
147563147994
WhereClause *pWC /* Xfer function arguments to here */
147564147995
){
147565147996
Table *pTab;
147566147997
int j, k;
147567147998
ExprList *pArgs;
@@ -148291,11 +148722,11 @@
148291148722
** could be used with an index to access pSrc, assuming an appropriate
148292148723
** index existed.
148293148724
*/
148294148725
static int termCanDriveIndex(
148295148726
WhereTerm *pTerm, /* WHERE clause term to check */
148296
- struct SrcList_item *pSrc, /* Table we are trying to access */
148727
+ SrcItem *pSrc, /* Table we are trying to access */
148297148728
Bitmask notReady /* Tables in outer loops of the join */
148298148729
){
148299148730
char aff;
148300148731
if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
148301148732
if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) return 0;
@@ -148325,11 +148756,11 @@
148325148756
** makes use of the automatic index.
148326148757
*/
148327148758
static void constructAutomaticIndex(
148328148759
Parse *pParse, /* The parsing context */
148329148760
WhereClause *pWC, /* The WHERE clause */
148330
- struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
148761
+ SrcItem *pSrc, /* The FROM clause term to get the next index */
148331148762
Bitmask notReady, /* Mask of cursors that are not available */
148332148763
WhereLevel *pLevel /* Write new index here */
148333148764
){
148334148765
int nKeyCol; /* Number of columns in the constructed index */
148335148766
WhereTerm *pTerm; /* A single term of the WHERE clause */
@@ -148349,11 +148780,11 @@
148349148780
Bitmask idxCols; /* Bitmap of columns used for indexing */
148350148781
Bitmask extraCols; /* Bitmap of additional columns */
148351148782
u8 sentWarning = 0; /* True if a warnning has been issued */
148352148783
Expr *pPartial = 0; /* Partial Index Expression */
148353148784
int iContinue = 0; /* Jump here to skip excluded rows */
148354
- struct SrcList_item *pTabItem; /* FROM clause term being indexed */
148785
+ SrcItem *pTabItem; /* FROM clause term being indexed */
148355148786
int addrCounter = 0; /* Address where integer counter is initialized */
148356148787
int regBase; /* Array of registers where record is assembled */
148357148788
148358148789
/* Generate code to skip over the creation and initialization of the
148359148790
** transient index on 2nd and subsequent iterations of the loop. */
@@ -148533,11 +148964,11 @@
148533148964
*/
148534148965
static sqlite3_index_info *allocateIndexInfo(
148535148966
Parse *pParse, /* The parsing context */
148536148967
WhereClause *pWC, /* The WHERE clause being analyzed */
148537148968
Bitmask mUnusable, /* Ignore terms with these prereqs */
148538
- struct SrcList_item *pSrc, /* The FROM clause term that is the vtab */
148969
+ SrcItem *pSrc, /* The FROM clause term that is the vtab */
148539148970
ExprList *pOrderBy, /* The ORDER BY clause */
148540148971
u16 *pmNoOmit /* Mask of terms not to omit */
148541148972
){
148542148973
int i, j;
148543148974
int nTerm;
@@ -149431,11 +149862,11 @@
149431149862
** Print a WhereLoop object for debugging purposes
149432149863
*/
149433149864
SQLITE_PRIVATE void sqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC){
149434149865
WhereInfo *pWInfo = pWC->pWInfo;
149435149866
int nb = 1+(pWInfo->pTabList->nSrc+3)/4;
149436
- struct SrcList_item *pItem = pWInfo->pTabList->a + p->iTab;
149867
+ SrcItem *pItem = pWInfo->pTabList->a + p->iTab;
149437149868
Table *pTab = pItem->pTab;
149438149869
Bitmask mAll = (((Bitmask)1)<<(nb*4)) - 1;
149439149870
sqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId,
149440149871
p->iTab, nb, p->maskSelf, nb, p->prereq & mAll);
149441149872
sqlite3DebugPrintf(" %12s",
@@ -150042,11 +150473,11 @@
150042150473
** If pProbe->idxType==SQLITE_IDXTYPE_IPK, that means pIndex is
150043150474
** a fake index used for the INTEGER PRIMARY KEY.
150044150475
*/
150045150476
static int whereLoopAddBtreeIndex(
150046150477
WhereLoopBuilder *pBuilder, /* The WhereLoop factory */
150047
- struct SrcList_item *pSrc, /* FROM clause term being analyzed */
150478
+ SrcItem *pSrc, /* FROM clause term being analyzed */
150048150479
Index *pProbe, /* An index on pSrc */
150049150480
LogEst nInMul /* log(Number of iterations due to IN) */
150050150481
){
150051150482
WhereInfo *pWInfo = pBuilder->pWInfo; /* WHERE analyse context */
150052150483
Parse *pParse = pWInfo->pParse; /* Parsing context */
@@ -150533,11 +150964,11 @@
150533150964
Index *pProbe; /* An index we are evaluating */
150534150965
Index sPk; /* A fake index object for the primary key */
150535150966
LogEst aiRowEstPk[2]; /* The aiRowLogEst[] value for the sPk index */
150536150967
i16 aiColumnPk = -1; /* The aColumn[] value for the sPk index */
150537150968
SrcList *pTabList; /* The FROM clause */
150538
- struct SrcList_item *pSrc; /* The FROM clause btree term to add */
150969
+ SrcItem *pSrc; /* The FROM clause btree term to add */
150539150970
WhereLoop *pNew; /* Template WhereLoop object */
150540150971
int rc = SQLITE_OK; /* Return code */
150541150972
int iSortIdx = 1; /* Index number */
150542150973
int b; /* A boolean value */
150543150974
LogEst rSize; /* number of rows in the table */
@@ -150551,13 +150982,13 @@
150551150982
pSrc = pTabList->a + pNew->iTab;
150552150983
pTab = pSrc->pTab;
150553150984
pWC = pBuilder->pWC;
150554150985
assert( !IsVirtual(pSrc->pTab) );
150555150986
150556
- if( pSrc->pIBIndex ){
150987
+ if( pSrc->fg.isIndexedBy ){
150557150988
/* An INDEXED BY clause specifies a particular index to use */
150558
- pProbe = pSrc->pIBIndex;
150989
+ pProbe = pSrc->u2.pIBIndex;
150559150990
}else if( !HasRowid(pTab) ){
150560150991
pProbe = pTab->pIndex;
150561150992
}else{
150562150993
/* There is no INDEXED BY clause. Create a fake Index object in local
150563150994
** variable sPk to represent the rowid primary key index. Make this
@@ -150589,11 +151020,11 @@
150589151020
#ifndef SQLITE_OMIT_AUTOMATIC_INDEX
150590151021
/* Automatic indexes */
150591151022
if( !pBuilder->pOrSet /* Not part of an OR optimization */
150592151023
&& (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0
150593151024
&& (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0
150594
- && pSrc->pIBIndex==0 /* Has no INDEXED BY clause */
151025
+ && !pSrc->fg.isIndexedBy /* Has no INDEXED BY clause */
150595151026
&& !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */
150596151027
&& HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */
150597151028
&& !pSrc->fg.isCorrelated /* Not a correlated subquery */
150598151029
&& !pSrc->fg.isRecursive /* Not a recursive common table expression. */
150599151030
){
@@ -150639,11 +151070,11 @@
150639151070
#endif /* SQLITE_OMIT_AUTOMATIC_INDEX */
150640151071
150641151072
/* Loop over all indices. If there was an INDEXED BY clause, then only
150642151073
** consider index pProbe. */
150643151074
for(; rc==SQLITE_OK && pProbe;
150644
- pProbe=(pSrc->pIBIndex ? 0 : pProbe->pNext), iSortIdx++
151075
+ pProbe=(pSrc->fg.isIndexedBy ? 0 : pProbe->pNext), iSortIdx++
150645151076
){
150646151077
int isLeft = (pSrc->fg.jointype & JT_OUTER)!=0;
150647151078
if( pProbe->pPartIdxWhere!=0
150648151079
&& !whereUsablePartialIndex(pSrc->iCursor, isLeft, pWC,
150649151080
pProbe->pPartIdxWhere)
@@ -150814,11 +151245,11 @@
150814151245
int i;
150815151246
int mxTerm;
150816151247
int rc = SQLITE_OK;
150817151248
WhereLoop *pNew = pBuilder->pNew;
150818151249
Parse *pParse = pBuilder->pWInfo->pParse;
150819
- struct SrcList_item *pSrc = &pBuilder->pWInfo->pTabList->a[pNew->iTab];
151250
+ SrcItem *pSrc = &pBuilder->pWInfo->pTabList->a[pNew->iTab];
150820151251
int nConstraint = pIdxInfo->nConstraint;
150821151252
150822151253
assert( (mUsable & mPrereq)==mPrereq );
150823151254
*pbIn = 0;
150824151255
pNew->prereq = mPrereq;
@@ -151006,11 +151437,11 @@
151006151437
){
151007151438
int rc = SQLITE_OK; /* Return code */
151008151439
WhereInfo *pWInfo; /* WHERE analysis context */
151009151440
Parse *pParse; /* The parsing context */
151010151441
WhereClause *pWC; /* The WHERE clause */
151011
- struct SrcList_item *pSrc; /* The FROM clause term to search */
151442
+ SrcItem *pSrc; /* The FROM clause term to search */
151012151443
sqlite3_index_info *p; /* Object to pass to xBestIndex() */
151013151444
int nConstraint; /* Number of constraints in p */
151014151445
int bIn; /* True if plan uses IN(...) operator */
151015151446
WhereLoop *pNew;
151016151447
Bitmask mBest; /* Tables used by best possible plan */
@@ -151134,11 +151565,11 @@
151134151565
int rc = SQLITE_OK;
151135151566
int iCur;
151136151567
WhereClause tempWC;
151137151568
WhereLoopBuilder sSubBuild;
151138151569
WhereOrSet sSum, sCur;
151139
- struct SrcList_item *pItem;
151570
+ SrcItem *pItem;
151140151571
151141151572
pWC = pBuilder->pWC;
151142151573
pWCEnd = pWC->a + pWC->nTerm;
151143151574
pNew = pBuilder->pNew;
151144151575
memset(&sSum, 0, sizeof(sSum));
@@ -151250,12 +151681,12 @@
151250151681
WhereInfo *pWInfo = pBuilder->pWInfo;
151251151682
Bitmask mPrereq = 0;
151252151683
Bitmask mPrior = 0;
151253151684
int iTab;
151254151685
SrcList *pTabList = pWInfo->pTabList;
151255
- struct SrcList_item *pItem;
151256
- struct SrcList_item *pEnd = &pTabList->a[pWInfo->nLevel];
151686
+ SrcItem *pItem;
151687
+ SrcItem *pEnd = &pTabList->a[pWInfo->nLevel];
151257151688
sqlite3 *db = pWInfo->pParse->db;
151258151689
int rc = SQLITE_OK;
151259151690
WhereLoop *pNew;
151260151691
151261151692
/* Loop over the tables in the join, from left to right */
@@ -151274,11 +151705,11 @@
151274151705
}else{
151275151706
mPrereq = 0;
151276151707
}
151277151708
#ifndef SQLITE_OMIT_VIRTUALTABLE
151278151709
if( IsVirtual(pItem->pTab) ){
151279
- struct SrcList_item *p;
151710
+ SrcItem *p;
151280151711
for(p=&pItem[1]; p<pEnd; p++){
151281151712
if( mUnusable || (p->fg.jointype & (JT_LEFT|JT_CROSS)) ){
151282151713
mUnusable |= sqlite3WhereGetMask(&pWInfo->sMaskSet, p->iCursor);
151283151714
}
151284151715
}
@@ -152129,11 +152560,11 @@
152129152560
** no-frills query planner. Return zero if this query needs the
152130152561
** general-purpose query planner.
152131152562
*/
152132152563
static int whereShortCut(WhereLoopBuilder *pBuilder){
152133152564
WhereInfo *pWInfo;
152134
- struct SrcList_item *pItem;
152565
+ SrcItem *pItem;
152135152566
WhereClause *pWC;
152136152567
WhereTerm *pTerm;
152137152568
WhereLoop *pLoop;
152138152569
int iCur;
152139152570
int j;
@@ -152659,11 +153090,11 @@
152659153090
if( sWLB.pOrderBy ){
152660153091
tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy);
152661153092
}
152662153093
for(i=pWInfo->nLevel-1; i>=1; i--){
152663153094
WhereTerm *pTerm, *pEnd;
152664
- struct SrcList_item *pItem;
153095
+ SrcItem *pItem;
152665153096
pLoop = pWInfo->a[i].pWLoop;
152666153097
pItem = &pWInfo->pTabList->a[pLoop->iTab];
152667153098
if( (pItem->fg.jointype & JT_LEFT)==0 ) continue;
152668153099
if( (wctrlFlags & WHERE_WANT_DISTINCT)==0
152669153100
&& (pLoop->wsFlags & WHERE_ONEROW)==0
@@ -152749,11 +153180,11 @@
152749153180
** searching those tables.
152750153181
*/
152751153182
for(ii=0, pLevel=pWInfo->a; ii<nTabList; ii++, pLevel++){
152752153183
Table *pTab; /* Table to open */
152753153184
int iDb; /* Index of database containing table/index */
152754
- struct SrcList_item *pTabItem;
153185
+ SrcItem *pTabItem;
152755153186
152756153187
pTabItem = &pTabList->a[pLevel->iFrom];
152757153188
pTab = pTabItem->pTab;
152758153189
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
152759153190
pLoop = pLevel->pWLoop;
@@ -153086,11 +153517,11 @@
153086153517
assert( pWInfo->nLevel<=pTabList->nSrc );
153087153518
for(i=0, pLevel=pWInfo->a; i<pWInfo->nLevel; i++, pLevel++){
153088153519
int k, last;
153089153520
VdbeOp *pOp, *pLastOp;
153090153521
Index *pIdx = 0;
153091
- struct SrcList_item *pTabItem = &pTabList->a[pLevel->iFrom];
153522
+ SrcItem *pTabItem = &pTabList->a[pLevel->iFrom];
153092153523
Table *pTab = pTabItem->pTab;
153093153524
assert( pTab!=0 );
153094153525
pLoop = pLevel->pWLoop;
153095153526
153096153527
/* For a co-routine, change all OP_Column references to the table of
@@ -156398,10 +156829,23 @@
156398156829
sqlite3ErrorMsg(pParse, "too many terms in compound SELECT");
156399156830
}
156400156831
}
156401156832
}
156402156833
156834
+ /* Attach a With object describing the WITH clause to a Select
156835
+ ** object describing the query for which the WITH clause is a prefix.
156836
+ */
156837
+ static Select *attachWithToSelect(Parse *pParse, Select *pSelect, With *pWith){
156838
+ if( pSelect ){
156839
+ pSelect->pWith = pWith;
156840
+ parserDoubleLinkSelect(pParse, pSelect);
156841
+ }else{
156842
+ sqlite3WithDelete(pParse->db, pWith);
156843
+ }
156844
+ return pSelect;
156845
+ }
156846
+
156403156847
156404156848
/* Construct a new Expr object from a single identifier. Use the
156405156849
** new Expr to populate pOut. Set the span of pOut to be the identifier
156406156850
** that created the expression.
156407156851
*/
@@ -156573,95 +157017,96 @@
156573157017
#define TK_GROUPS 92
156574157018
#define TK_OTHERS 93
156575157019
#define TK_TIES 94
156576157020
#define TK_GENERATED 95
156577157021
#define TK_ALWAYS 96
156578
-#define TK_REINDEX 97
156579
-#define TK_RENAME 98
156580
-#define TK_CTIME_KW 99
156581
-#define TK_ANY 100
156582
-#define TK_BITAND 101
156583
-#define TK_BITOR 102
156584
-#define TK_LSHIFT 103
156585
-#define TK_RSHIFT 104
156586
-#define TK_PLUS 105
156587
-#define TK_MINUS 106
156588
-#define TK_STAR 107
156589
-#define TK_SLASH 108
156590
-#define TK_REM 109
156591
-#define TK_CONCAT 110
156592
-#define TK_COLLATE 111
156593
-#define TK_BITNOT 112
156594
-#define TK_ON 113
156595
-#define TK_INDEXED 114
156596
-#define TK_STRING 115
156597
-#define TK_JOIN_KW 116
156598
-#define TK_CONSTRAINT 117
156599
-#define TK_DEFAULT 118
156600
-#define TK_NULL 119
156601
-#define TK_PRIMARY 120
156602
-#define TK_UNIQUE 121
156603
-#define TK_CHECK 122
156604
-#define TK_REFERENCES 123
156605
-#define TK_AUTOINCR 124
156606
-#define TK_INSERT 125
156607
-#define TK_DELETE 126
156608
-#define TK_UPDATE 127
156609
-#define TK_SET 128
156610
-#define TK_DEFERRABLE 129
156611
-#define TK_FOREIGN 130
156612
-#define TK_DROP 131
156613
-#define TK_UNION 132
156614
-#define TK_ALL 133
156615
-#define TK_EXCEPT 134
156616
-#define TK_INTERSECT 135
156617
-#define TK_SELECT 136
156618
-#define TK_VALUES 137
156619
-#define TK_DISTINCT 138
156620
-#define TK_DOT 139
156621
-#define TK_FROM 140
156622
-#define TK_JOIN 141
156623
-#define TK_USING 142
156624
-#define TK_ORDER 143
156625
-#define TK_GROUP 144
156626
-#define TK_HAVING 145
156627
-#define TK_LIMIT 146
156628
-#define TK_WHERE 147
156629
-#define TK_RETURNING 148
156630
-#define TK_INTO 149
156631
-#define TK_NOTHING 150
156632
-#define TK_FLOAT 151
156633
-#define TK_BLOB 152
156634
-#define TK_INTEGER 153
156635
-#define TK_VARIABLE 154
156636
-#define TK_CASE 155
156637
-#define TK_WHEN 156
156638
-#define TK_THEN 157
156639
-#define TK_ELSE 158
156640
-#define TK_INDEX 159
156641
-#define TK_ALTER 160
156642
-#define TK_ADD 161
156643
-#define TK_WINDOW 162
156644
-#define TK_OVER 163
156645
-#define TK_FILTER 164
156646
-#define TK_COLUMN 165
156647
-#define TK_AGG_FUNCTION 166
156648
-#define TK_AGG_COLUMN 167
156649
-#define TK_TRUEFALSE 168
156650
-#define TK_ISNOT 169
156651
-#define TK_FUNCTION 170
156652
-#define TK_UMINUS 171
156653
-#define TK_UPLUS 172
156654
-#define TK_TRUTH 173
156655
-#define TK_REGISTER 174
156656
-#define TK_VECTOR 175
156657
-#define TK_SELECT_COLUMN 176
156658
-#define TK_IF_NULL_ROW 177
156659
-#define TK_ASTERISK 178
156660
-#define TK_SPAN 179
156661
-#define TK_SPACE 180
156662
-#define TK_ILLEGAL 181
157022
+#define TK_MATERIALIZED 97
157023
+#define TK_REINDEX 98
157024
+#define TK_RENAME 99
157025
+#define TK_CTIME_KW 100
157026
+#define TK_ANY 101
157027
+#define TK_BITAND 102
157028
+#define TK_BITOR 103
157029
+#define TK_LSHIFT 104
157030
+#define TK_RSHIFT 105
157031
+#define TK_PLUS 106
157032
+#define TK_MINUS 107
157033
+#define TK_STAR 108
157034
+#define TK_SLASH 109
157035
+#define TK_REM 110
157036
+#define TK_CONCAT 111
157037
+#define TK_COLLATE 112
157038
+#define TK_BITNOT 113
157039
+#define TK_ON 114
157040
+#define TK_INDEXED 115
157041
+#define TK_STRING 116
157042
+#define TK_JOIN_KW 117
157043
+#define TK_CONSTRAINT 118
157044
+#define TK_DEFAULT 119
157045
+#define TK_NULL 120
157046
+#define TK_PRIMARY 121
157047
+#define TK_UNIQUE 122
157048
+#define TK_CHECK 123
157049
+#define TK_REFERENCES 124
157050
+#define TK_AUTOINCR 125
157051
+#define TK_INSERT 126
157052
+#define TK_DELETE 127
157053
+#define TK_UPDATE 128
157054
+#define TK_SET 129
157055
+#define TK_DEFERRABLE 130
157056
+#define TK_FOREIGN 131
157057
+#define TK_DROP 132
157058
+#define TK_UNION 133
157059
+#define TK_ALL 134
157060
+#define TK_EXCEPT 135
157061
+#define TK_INTERSECT 136
157062
+#define TK_SELECT 137
157063
+#define TK_VALUES 138
157064
+#define TK_DISTINCT 139
157065
+#define TK_DOT 140
157066
+#define TK_FROM 141
157067
+#define TK_JOIN 142
157068
+#define TK_USING 143
157069
+#define TK_ORDER 144
157070
+#define TK_GROUP 145
157071
+#define TK_HAVING 146
157072
+#define TK_LIMIT 147
157073
+#define TK_WHERE 148
157074
+#define TK_RETURNING 149
157075
+#define TK_INTO 150
157076
+#define TK_NOTHING 151
157077
+#define TK_FLOAT 152
157078
+#define TK_BLOB 153
157079
+#define TK_INTEGER 154
157080
+#define TK_VARIABLE 155
157081
+#define TK_CASE 156
157082
+#define TK_WHEN 157
157083
+#define TK_THEN 158
157084
+#define TK_ELSE 159
157085
+#define TK_INDEX 160
157086
+#define TK_ALTER 161
157087
+#define TK_ADD 162
157088
+#define TK_WINDOW 163
157089
+#define TK_OVER 164
157090
+#define TK_FILTER 165
157091
+#define TK_COLUMN 166
157092
+#define TK_AGG_FUNCTION 167
157093
+#define TK_AGG_COLUMN 168
157094
+#define TK_TRUEFALSE 169
157095
+#define TK_ISNOT 170
157096
+#define TK_FUNCTION 171
157097
+#define TK_UMINUS 172
157098
+#define TK_UPLUS 173
157099
+#define TK_TRUTH 174
157100
+#define TK_REGISTER 175
157101
+#define TK_VECTOR 176
157102
+#define TK_SELECT_COLUMN 177
157103
+#define TK_IF_NULL_ROW 178
157104
+#define TK_ASTERISK 179
157105
+#define TK_SPAN 180
157106
+#define TK_SPACE 181
157107
+#define TK_ILLEGAL 182
156663157108
#endif
156664157109
/**************** End token definitions ***************************************/
156665157110
156666157111
/* The next sections is a series of control #defines.
156667157112
** various aspects of the generated parser.
@@ -156717,32 +157162,33 @@
156717157162
#ifndef INTERFACE
156718157163
# define INTERFACE 1
156719157164
#endif
156720157165
/************* Begin control #defines *****************************************/
156721157166
#define YYCODETYPE unsigned short int
156722
-#define YYNOCODE 313
157167
+#define YYNOCODE 316
156723157168
#define YYACTIONTYPE unsigned short int
156724
-#define YYWILDCARD 100
157169
+#define YYWILDCARD 101
156725157170
#define sqlite3ParserTOKENTYPE Token
156726157171
typedef union {
156727157172
int yyinit;
156728157173
sqlite3ParserTOKENTYPE yy0;
156729
- Upsert* yy40;
156730
- TriggerStep* yy51;
156731
- With* yy105;
156732
- Select* yy293;
156733
- struct TrigEvent yy298;
156734
- struct FrameBound yy341;
156735
- ExprList* yy350;
156736
- Expr* yy354;
156737
- int yy412;
156738
- SrcList* yy457;
156739
- struct {int value; int mask;} yy463;
156740
- IdList* yy498;
156741
- Window* yy503;
156742
- const char* yy504;
156743
- u8 yy624;
157174
+ Window* yy19;
157175
+ struct TrigEvent yy50;
157176
+ int yy60;
157177
+ struct FrameBound yy113;
157178
+ Upsert* yy178;
157179
+ With* yy195;
157180
+ IdList* yy288;
157181
+ SrcList* yy291;
157182
+ Select* yy307;
157183
+ ExprList* yy338;
157184
+ TriggerStep* yy483;
157185
+ const char* yy528;
157186
+ u8 yy570;
157187
+ Expr* yy602;
157188
+ Cte* yy607;
157189
+ struct {int value; int mask;} yy615;
156744157190
} YYMINORTYPE;
156745157191
#ifndef YYSTACKDEPTH
156746157192
#define YYSTACKDEPTH 100
156747157193
#endif
156748157194
#define sqlite3ParserARG_SDECL
@@ -156754,22 +157200,22 @@
156754157200
#define sqlite3ParserCTX_PDECL ,Parse *pParse
156755157201
#define sqlite3ParserCTX_PARAM ,pParse
156756157202
#define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
156757157203
#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
156758157204
#define YYFALLBACK 1
156759
-#define YYNSTATE 571
156760
-#define YYNRULE 393
156761
-#define YYNRULE_WITH_ACTION 332
156762
-#define YYNTOKEN 182
156763
-#define YY_MAX_SHIFT 570
156764
-#define YY_MIN_SHIFTREDUCE 822
156765
-#define YY_MAX_SHIFTREDUCE 1214
156766
-#define YY_ERROR_ACTION 1215
156767
-#define YY_ACCEPT_ACTION 1216
156768
-#define YY_NO_ACTION 1217
156769
-#define YY_MIN_REDUCE 1218
156770
-#define YY_MAX_REDUCE 1610
157205
+#define YYNSTATE 570
157206
+#define YYNRULE 398
157207
+#define YYNRULE_WITH_ACTION 337
157208
+#define YYNTOKEN 183
157209
+#define YY_MAX_SHIFT 569
157210
+#define YY_MIN_SHIFTREDUCE 825
157211
+#define YY_MAX_SHIFTREDUCE 1222
157212
+#define YY_ERROR_ACTION 1223
157213
+#define YY_ACCEPT_ACTION 1224
157214
+#define YY_NO_ACTION 1225
157215
+#define YY_MIN_REDUCE 1226
157216
+#define YY_MAX_REDUCE 1623
156771157217
/************* End control #defines *******************************************/
156772157218
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
156773157219
156774157220
/* Define the yytestcase() macro to be a no-op if is not already defined
156775157221
** otherwise.
@@ -156832,605 +157278,604 @@
156832157278
** yy_reduce_ofst[] For each state, the offset into yy_action for
156833157279
** shifting non-terminals after a reduce.
156834157280
** yy_default[] Default action for each state.
156835157281
**
156836157282
*********** Begin parsing tables **********************************************/
156837
-#define YY_ACTTAB_COUNT (2017)
157283
+#define YY_ACTTAB_COUNT (2020)
156838157284
static const YYACTIONTYPE yy_action[] = {
156839
- /* 0 */ 564, 1249, 564, 197, 1571, 564, 1252, 564, 116, 113,
156840
- /* 10 */ 218, 564, 1259, 564, 486, 393, 116, 113, 218, 405,
156841
- /* 20 */ 357, 357, 42, 42, 42, 42, 469, 42, 42, 72,
156842
- /* 30 */ 72, 956, 1251, 72, 72, 72, 72, 1496, 1576, 957,
156843
- /* 40 */ 9, 886, 251, 123, 124, 114, 1192, 1192, 1032, 1035,
156844
- /* 50 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 445, 405,
156845
- /* 60 */ 471, 1551, 570, 2, 1220, 1577, 546, 145, 147, 305,
156846
- /* 70 */ 546, 138, 546, 1292, 1292, 522, 564, 1189, 1300, 545,
156847
- /* 80 */ 521, 511, 167, 123, 124, 114, 1192, 1192, 1032, 1035,
156848
- /* 90 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 72, 72,
156849
- /* 100 */ 281, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156850
- /* 110 */ 117, 438, 273, 273, 273, 273, 443, 1168, 1532, 371,
156851
- /* 120 */ 1534, 1168, 370, 1532, 535, 561, 1140, 561, 1140, 405,
156852
- /* 130 */ 1075, 248, 215, 1189, 174, 527, 100, 304, 555, 228,
156853
- /* 140 */ 438, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156854
- /* 150 */ 117, 438, 448, 123, 124, 114, 1192, 1192, 1032, 1035,
156855
- /* 160 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 541, 448,
156856
- /* 170 */ 447, 442, 1168, 1169, 1170, 395, 1168, 1169, 1170, 125,
156857
- /* 180 */ 120, 120, 120, 120, 119, 119, 118, 118, 118, 117,
156858
- /* 190 */ 438, 119, 119, 118, 118, 118, 117, 438, 268, 405,
156859
- /* 200 */ 1548, 122, 122, 122, 122, 115, 379, 84, 375, 273,
156860
- /* 210 */ 273, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156861
- /* 220 */ 117, 438, 561, 123, 124, 114, 1192, 1192, 1032, 1035,
156862
- /* 230 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 405, 467,
156863
- /* 240 */ 1118, 1604, 448, 82, 1604, 460, 329, 81, 120, 120,
156864
- /* 250 */ 120, 120, 119, 119, 118, 118, 118, 117, 438, 116,
156865
- /* 260 */ 113, 218, 123, 124, 114, 1192, 1192, 1032, 1035, 1025,
156866
- /* 270 */ 1025, 121, 121, 122, 122, 122, 122, 564, 542, 1519,
156867
- /* 280 */ 877, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156868
- /* 290 */ 117, 438, 118, 118, 118, 117, 438, 12, 197, 71,
156869
- /* 300 */ 71, 1135, 122, 122, 122, 122, 384, 405, 428, 1168,
156870
- /* 310 */ 398, 503, 531, 347, 1135, 166, 312, 1135, 1116, 878,
156871
- /* 320 */ 120, 120, 120, 120, 119, 119, 118, 118, 118, 117,
156872
- /* 330 */ 438, 123, 124, 114, 1192, 1192, 1032, 1035, 1025, 1025,
156873
- /* 340 */ 121, 121, 122, 122, 122, 122, 1168, 267, 267, 120,
156874
- /* 350 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 438,
156875
- /* 360 */ 561, 378, 1012, 1135, 1168, 1169, 1170, 240, 530, 563,
156876
- /* 370 */ 499, 496, 495, 426, 538, 476, 1135, 1527, 1003, 1135,
156877
- /* 380 */ 494, 6, 1002, 1392, 502, 1022, 1022, 1033, 1036, 120,
156878
- /* 390 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 438,
156879
- /* 400 */ 425, 1168, 1169, 1170, 1096, 1460, 259, 276, 355, 505,
156880
- /* 410 */ 350, 504, 245, 405, 1002, 1002, 1004, 343, 346, 1097,
156881
- /* 420 */ 240, 460, 329, 499, 496, 495, 369, 510, 1526, 357,
156882
- /* 430 */ 529, 358, 6, 494, 1098, 450, 203, 123, 124, 114,
156883
- /* 440 */ 1192, 1192, 1032, 1035, 1025, 1025, 121, 121, 122, 122,
156884
- /* 450 */ 122, 122, 520, 419, 1168, 897, 405, 569, 1026, 1220,
156885
- /* 460 */ 500, 319, 1270, 992, 305, 898, 138, 188, 1287, 423,
156886
- /* 470 */ 1266, 167, 486, 1300, 16, 16, 144, 857, 1287, 1269,
156887
- /* 480 */ 123, 124, 114, 1192, 1192, 1032, 1035, 1025, 1025, 121,
156888
- /* 490 */ 121, 122, 122, 122, 122, 120, 120, 120, 120, 119,
156889
- /* 500 */ 119, 118, 118, 118, 117, 438, 526, 273, 273, 1168,
156890
- /* 510 */ 1169, 1170, 1392, 564, 166, 327, 1495, 1012, 414, 372,
156891
- /* 520 */ 561, 486, 316, 1168, 318, 405, 304, 555, 373, 861,
156892
- /* 530 */ 182, 216, 857, 1003, 228, 72, 72, 1002, 120, 120,
156893
- /* 540 */ 120, 120, 119, 119, 118, 118, 118, 117, 438, 123,
156894
- /* 550 */ 124, 114, 1192, 1192, 1032, 1035, 1025, 1025, 121, 121,
156895
- /* 560 */ 122, 122, 122, 122, 405, 1459, 442, 1168, 854, 1002,
156896
- /* 570 */ 1002, 1004, 300, 1524, 116, 113, 218, 6, 1168, 1169,
156897
- /* 580 */ 1170, 183, 420, 116, 113, 218, 1168, 314, 123, 124,
156898
- /* 590 */ 114, 1192, 1192, 1032, 1035, 1025, 1025, 121, 121, 122,
156899
- /* 600 */ 122, 122, 122, 1465, 317, 943, 469, 120, 120, 120,
156900
- /* 610 */ 120, 119, 119, 118, 118, 118, 117, 438, 1168, 211,
156901
- /* 620 */ 1465, 1467, 1168, 1169, 1170, 917, 539, 1526, 475, 1168,
156902
- /* 630 */ 916, 6, 1168, 405, 922, 435, 434, 1153, 213, 509,
156903
- /* 640 */ 32, 1168, 1169, 1170, 279, 5, 120, 120, 120, 120,
156904
- /* 650 */ 119, 119, 118, 118, 118, 117, 438, 123, 124, 114,
156905
- /* 660 */ 1192, 1192, 1032, 1035, 1025, 1025, 121, 121, 122, 122,
156906
- /* 670 */ 122, 122, 405, 1168, 1169, 1170, 1013, 1168, 273, 273,
156907
- /* 680 */ 286, 1199, 1168, 1199, 1168, 1169, 1170, 1168, 1169, 1170,
156908
- /* 690 */ 564, 561, 167, 1465, 117, 438, 123, 124, 114, 1192,
156909
- /* 700 */ 1192, 1032, 1035, 1025, 1025, 121, 121, 122, 122, 122,
156910
- /* 710 */ 122, 942, 13, 13, 127, 120, 120, 120, 120, 119,
156911
- /* 720 */ 119, 118, 118, 118, 117, 438, 285, 417, 564, 449,
156912
- /* 730 */ 564, 1392, 1168, 1169, 1170, 1290, 1290, 1168, 1169, 1170,
156913
- /* 740 */ 97, 405, 992, 1606, 391, 997, 486, 304, 555, 17,
156914
- /* 750 */ 72, 72, 72, 72, 120, 120, 120, 120, 119, 119,
156915
- /* 760 */ 118, 118, 118, 117, 438, 123, 124, 114, 1192, 1192,
156916
- /* 770 */ 1032, 1035, 1025, 1025, 121, 121, 122, 122, 122, 122,
156917
- /* 780 */ 405, 1216, 1, 1, 570, 2, 1220, 301, 415, 433,
156918
- /* 790 */ 1299, 305, 839, 138, 327, 455, 315, 402, 401, 564,
156919
- /* 800 */ 1300, 421, 3, 290, 123, 124, 114, 1192, 1192, 1032,
156920
- /* 810 */ 1035, 1025, 1025, 121, 121, 122, 122, 122, 122, 377,
156921
- /* 820 */ 564, 13, 13, 120, 120, 120, 120, 119, 119, 118,
156922
- /* 830 */ 118, 118, 117, 438, 273, 273, 422, 273, 273, 1168,
156923
- /* 840 */ 1304, 357, 13, 13, 1118, 1605, 12, 561, 1605, 405,
156924
- /* 850 */ 561, 458, 561, 1168, 558, 558, 558, 424, 436, 436,
156925
- /* 860 */ 436, 228, 120, 120, 120, 120, 119, 119, 118, 118,
156926
- /* 870 */ 118, 117, 438, 123, 124, 114, 1192, 1192, 1032, 1035,
156927
- /* 880 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 146, 197,
156928
- /* 890 */ 414, 564, 1055, 442, 1168, 1169, 1170, 414, 469, 435,
156929
- /* 900 */ 434, 404, 562, 247, 911, 911, 564, 1196, 1168, 1169,
156930
- /* 910 */ 1170, 486, 1198, 72, 72, 491, 1507, 547, 102, 194,
156931
- /* 920 */ 1197, 564, 1116, 294, 459, 294, 1298, 251, 72, 72,
156932
- /* 930 */ 1452, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156933
- /* 940 */ 117, 438, 244, 56, 56, 1199, 564, 1199, 564, 1238,
156934
- /* 950 */ 437, 273, 273, 564, 514, 1295, 564, 512, 564, 282,
156935
- /* 960 */ 273, 273, 1189, 517, 561, 546, 284, 341, 52, 52,
156936
- /* 970 */ 13, 13, 289, 561, 548, 13, 13, 564, 13, 13,
156937
- /* 980 */ 13, 13, 549, 273, 273, 293, 1407, 105, 273, 273,
156938
- /* 990 */ 191, 273, 273, 192, 444, 543, 561, 273, 273, 57,
156939
- /* 1000 */ 57, 561, 274, 274, 561, 513, 1504, 405, 270, 410,
156940
- /* 1010 */ 561, 941, 198, 304, 555, 561, 273, 273, 1189, 106,
156941
- /* 1020 */ 409, 104, 356, 1545, 307, 346, 564, 405, 336, 561,
156942
- /* 1030 */ 339, 123, 124, 114, 1192, 1192, 1032, 1035, 1025, 1025,
156943
- /* 1040 */ 121, 121, 122, 122, 122, 122, 469, 405, 15, 15,
156944
- /* 1050 */ 475, 123, 124, 114, 1192, 1192, 1032, 1035, 1025, 1025,
156945
- /* 1060 */ 121, 121, 122, 122, 122, 122, 1080, 1080, 483, 358,
156946
- /* 1070 */ 475, 123, 112, 114, 1192, 1192, 1032, 1035, 1025, 1025,
156947
- /* 1080 */ 121, 121, 122, 122, 122, 122, 390, 1212, 308, 120,
156948
- /* 1090 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 438,
156949
- /* 1100 */ 99, 217, 480, 1172, 1406, 564, 477, 430, 541, 120,
156950
- /* 1110 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 438,
156951
- /* 1120 */ 291, 1077, 564, 1392, 564, 1077, 941, 44, 44, 120,
156952
- /* 1130 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 438,
156953
- /* 1140 */ 356, 1545, 537, 1096, 58, 58, 45, 45, 326, 405,
156954
- /* 1150 */ 1135, 827, 828, 829, 243, 242, 241, 481, 1097, 1172,
156955
- /* 1160 */ 1392, 536, 311, 1135, 1213, 486, 1135, 564, 292, 405,
156956
- /* 1170 */ 1146, 1241, 411, 1098, 124, 114, 1192, 1192, 1032, 1035,
156957
- /* 1180 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 564, 59,
156958
- /* 1190 */ 59, 564, 507, 482, 552, 114, 1192, 1192, 1032, 1035,
156959
- /* 1200 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 1525, 334,
156960
- /* 1210 */ 60, 60, 6, 61, 61, 390, 1117, 1523, 917, 1520,
156961
- /* 1220 */ 1146, 6, 564, 916, 564, 109, 556, 564, 4, 941,
156962
- /* 1230 */ 431, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156963
- /* 1240 */ 117, 438, 559, 864, 62, 62, 63, 63, 564, 46,
156964
- /* 1250 */ 46, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156965
- /* 1260 */ 117, 438, 564, 1135, 1522, 439, 1323, 564, 6, 564,
156966
- /* 1270 */ 47, 47, 564, 557, 411, 1268, 1135, 553, 142, 1135,
156967
- /* 1280 */ 564, 465, 304, 555, 48, 48, 564, 167, 544, 50,
156968
- /* 1290 */ 50, 51, 51, 1213, 64, 64, 956, 109, 556, 864,
156969
- /* 1300 */ 4, 564, 65, 65, 957, 1012, 564, 140, 66, 66,
156970
- /* 1310 */ 564, 107, 107, 564, 559, 849, 205, 564, 108, 217,
156971
- /* 1320 */ 439, 566, 565, 14, 14, 1002, 8, 523, 67, 67,
156972
- /* 1330 */ 564, 452, 129, 129, 221, 68, 68, 439, 453, 53,
156973
- /* 1340 */ 53, 403, 304, 555, 941, 412, 168, 211, 403, 553,
156974
- /* 1350 */ 111, 1188, 69, 69, 99, 462, 244, 1002, 1002, 1004,
156975
- /* 1360 */ 1005, 27, 466, 533, 564, 403, 564, 1336, 532, 272,
156976
- /* 1370 */ 215, 849, 403, 564, 85, 202, 564, 1012, 564, 1207,
156977
- /* 1380 */ 564, 303, 564, 107, 107, 564, 70, 70, 54, 54,
156978
- /* 1390 */ 108, 403, 439, 566, 565, 153, 153, 1002, 154, 154,
156979
- /* 1400 */ 77, 77, 55, 55, 73, 73, 1113, 130, 130, 392,
156980
- /* 1410 */ 109, 556, 143, 4, 38, 564, 473, 299, 564, 461,
156981
- /* 1420 */ 225, 1335, 524, 410, 30, 876, 875, 559, 454, 1002,
156982
- /* 1430 */ 1002, 1004, 1005, 27, 1550, 1157, 441, 74, 74, 277,
156983
- /* 1440 */ 131, 131, 324, 1510, 388, 388, 387, 262, 385, 564,
156984
- /* 1450 */ 439, 836, 868, 320, 463, 31, 564, 883, 884, 354,
156985
- /* 1460 */ 325, 206, 553, 99, 222, 206, 310, 544, 1539, 353,
156986
- /* 1470 */ 994, 132, 132, 250, 309, 1484, 533, 287, 128, 128,
156987
- /* 1480 */ 1062, 534, 109, 556, 468, 4, 564, 250, 1483, 470,
156988
- /* 1490 */ 1012, 564, 250, 275, 564, 330, 107, 107, 99, 559,
156989
- /* 1500 */ 1074, 564, 1074, 108, 224, 439, 566, 565, 152, 152,
156990
- /* 1510 */ 1002, 474, 158, 151, 151, 160, 136, 136, 492, 959,
156991
- /* 1520 */ 960, 246, 439, 135, 135, 344, 478, 564, 99, 1058,
156992
- /* 1530 */ 487, 223, 246, 564, 553, 227, 1062, 950, 914, 1006,
156993
- /* 1540 */ 250, 111, 1002, 1002, 1004, 1005, 27, 331, 533, 133,
156994
- /* 1550 */ 133, 564, 1073, 532, 1073, 134, 134, 847, 915, 1332,
156995
- /* 1560 */ 141, 111, 1012, 335, 338, 406, 340, 342, 107, 107,
156996
- /* 1570 */ 304, 555, 1283, 76, 76, 108, 564, 439, 566, 565,
156997
- /* 1580 */ 1157, 441, 1002, 564, 277, 109, 556, 551, 4, 388,
156998
- /* 1590 */ 388, 387, 262, 385, 446, 1006, 836, 1267, 78, 78,
156999
- /* 1600 */ 349, 564, 559, 359, 564, 75, 75, 360, 1330, 222,
157000
- /* 1610 */ 1564, 310, 1344, 1391, 1002, 1002, 1004, 1005, 27, 309,
157001
- /* 1620 */ 1319, 550, 1397, 43, 43, 439, 49, 49, 1248, 1240,
157002
- /* 1630 */ 1229, 1228, 1230, 1558, 265, 1316, 200, 553, 362, 364,
157003
- /* 1640 */ 366, 389, 11, 208, 1373, 220, 1378, 280, 1366, 224,
157004
- /* 1650 */ 451, 322, 472, 328, 283, 1561, 1266, 158, 323, 1383,
157005
- /* 1660 */ 160, 1382, 288, 368, 497, 1012, 352, 396, 382, 212,
157006
- /* 1670 */ 1456, 107, 107, 921, 1455, 1207, 223, 254, 108, 1503,
157007
- /* 1680 */ 439, 566, 565, 1501, 1204, 1002, 413, 204, 207, 84,
157008
- /* 1690 */ 195, 109, 556, 1379, 4, 554, 180, 196, 170, 80,
157009
- /* 1700 */ 164, 456, 175, 1461, 172, 83, 176, 457, 559, 177,
157010
- /* 1710 */ 406, 178, 35, 490, 230, 304, 555, 1002, 1002, 1004,
157011
- /* 1720 */ 1005, 27, 97, 394, 1385, 1384, 464, 1387, 184, 397,
157012
- /* 1730 */ 36, 439, 1450, 479, 90, 485, 189, 234, 236, 446,
157013
- /* 1740 */ 1472, 266, 488, 553, 337, 333, 237, 399, 1231, 238,
157014
- /* 1750 */ 506, 1286, 427, 92, 1277, 868, 1276, 1285, 213, 101,
157015
- /* 1760 */ 556, 429, 4, 1284, 1255, 1575, 1574, 525, 1256, 400,
157016
- /* 1770 */ 351, 1012, 1254, 1573, 1544, 96, 559, 107, 107, 516,
157017
- /* 1780 */ 519, 297, 298, 1327, 108, 361, 439, 566, 565, 1328,
157018
- /* 1790 */ 252, 1002, 253, 432, 1530, 126, 1529, 544, 10, 439,
157019
- /* 1800 */ 1436, 376, 528, 103, 98, 260, 1237, 34, 567, 1163,
157020
- /* 1810 */ 374, 553, 1326, 363, 199, 1309, 365, 1308, 1325, 380,
157021
- /* 1820 */ 367, 261, 381, 1002, 1002, 1004, 1005, 27, 1351, 1350,
157022
- /* 1830 */ 263, 264, 568, 1226, 1221, 155, 1488, 1489, 1487, 1012,
157023
- /* 1840 */ 139, 156, 1486, 79, 295, 107, 107, 302, 823, 440,
157024
- /* 1850 */ 209, 210, 108, 201, 439, 566, 565, 306, 157, 1002,
157025
- /* 1860 */ 219, 277, 278, 137, 1072, 1070, 388, 388, 387, 262,
157026
- /* 1870 */ 385, 313, 407, 836, 171, 159, 408, 169, 1188, 226,
157027
- /* 1880 */ 900, 173, 321, 1086, 229, 179, 222, 161, 310, 162,
157028
- /* 1890 */ 416, 1002, 1002, 1004, 1005, 27, 309, 181, 418, 163,
157029
- /* 1900 */ 1089, 86, 87, 88, 89, 231, 232, 1085, 148, 18,
157030
- /* 1910 */ 233, 332, 250, 1201, 484, 186, 235, 37, 838, 489,
157031
- /* 1920 */ 353, 1078, 185, 239, 187, 493, 224, 91, 866, 19,
157032
- /* 1930 */ 498, 345, 20, 348, 158, 501, 93, 160, 165, 879,
157033
- /* 1940 */ 149, 296, 94, 508, 95, 1151, 150, 1038, 1121, 39,
157034
- /* 1950 */ 515, 1122, 40, 223, 214, 518, 269, 271, 190, 944,
157035
- /* 1960 */ 1137, 111, 1139, 249, 1141, 1145, 21, 1125, 1144, 33,
157036
- /* 1970 */ 540, 949, 22, 23, 24, 25, 193, 99, 1053, 26,
157037
- /* 1980 */ 1039, 7, 1037, 1041, 1095, 1042, 1094, 406, 255, 256,
157038
- /* 1990 */ 28, 41, 304, 555, 1007, 848, 560, 110, 29, 386,
157039
- /* 2000 */ 910, 257, 383, 258, 1566, 1159, 1158, 1565, 1217, 1217,
157040
- /* 2010 */ 1217, 1217, 1217, 1217, 1217, 1217, 446,
157285
+ /* 0 */ 563, 1295, 563, 1274, 168, 361, 115, 112, 218, 373,
157286
+ /* 10 */ 563, 1295, 374, 563, 488, 563, 115, 112, 218, 406,
157287
+ /* 20 */ 1300, 1300, 41, 41, 41, 41, 514, 1504, 520, 1298,
157288
+ /* 30 */ 1298, 959, 41, 41, 1257, 71, 71, 51, 51, 960,
157289
+ /* 40 */ 557, 557, 557, 122, 123, 113, 1200, 1200, 1035, 1038,
157290
+ /* 50 */ 1028, 1028, 120, 120, 121, 121, 121, 121, 414, 406,
157291
+ /* 60 */ 273, 273, 273, 273, 115, 112, 218, 115, 112, 218,
157292
+ /* 70 */ 197, 268, 545, 560, 515, 560, 1260, 563, 385, 248,
157293
+ /* 80 */ 215, 521, 399, 122, 123, 113, 1200, 1200, 1035, 1038,
157294
+ /* 90 */ 1028, 1028, 120, 120, 121, 121, 121, 121, 540, 13,
157295
+ /* 100 */ 13, 1259, 119, 119, 119, 119, 118, 118, 117, 117,
157296
+ /* 110 */ 117, 116, 441, 1176, 419, 1531, 446, 137, 512, 1539,
157297
+ /* 120 */ 1545, 372, 1547, 6, 371, 1176, 1148, 1584, 1148, 406,
157298
+ /* 130 */ 1545, 534, 115, 112, 218, 1267, 99, 441, 121, 121,
157299
+ /* 140 */ 121, 121, 119, 119, 119, 119, 118, 118, 117, 117,
157300
+ /* 150 */ 117, 116, 441, 122, 123, 113, 1200, 1200, 1035, 1038,
157301
+ /* 160 */ 1028, 1028, 120, 120, 121, 121, 121, 121, 197, 1176,
157302
+ /* 170 */ 1177, 1178, 241, 304, 554, 501, 498, 497, 473, 124,
157303
+ /* 180 */ 394, 1176, 1177, 1178, 1176, 496, 119, 119, 119, 119,
157304
+ /* 190 */ 118, 118, 117, 117, 117, 116, 441, 139, 540, 406,
157305
+ /* 200 */ 121, 121, 121, 121, 114, 117, 117, 117, 116, 441,
157306
+ /* 210 */ 541, 1532, 119, 119, 119, 119, 118, 118, 117, 117,
157307
+ /* 220 */ 117, 116, 441, 122, 123, 113, 1200, 1200, 1035, 1038,
157308
+ /* 230 */ 1028, 1028, 120, 120, 121, 121, 121, 121, 406, 320,
157309
+ /* 240 */ 1176, 1177, 1178, 81, 342, 1590, 396, 80, 119, 119,
157310
+ /* 250 */ 119, 119, 118, 118, 117, 117, 117, 116, 441, 1176,
157311
+ /* 260 */ 211, 450, 122, 123, 113, 1200, 1200, 1035, 1038, 1028,
157312
+ /* 270 */ 1028, 120, 120, 121, 121, 121, 121, 251, 450, 449,
157313
+ /* 280 */ 273, 273, 119, 119, 119, 119, 118, 118, 117, 117,
157314
+ /* 290 */ 117, 116, 441, 560, 1224, 1, 1, 569, 2, 1228,
157315
+ /* 300 */ 317, 1176, 319, 1561, 305, 337, 140, 340, 406, 430,
157316
+ /* 310 */ 469, 1533, 1197, 1308, 348, 1176, 1177, 1178, 168, 462,
157317
+ /* 320 */ 330, 119, 119, 119, 119, 118, 118, 117, 117, 117,
157318
+ /* 330 */ 116, 441, 122, 123, 113, 1200, 1200, 1035, 1038, 1028,
157319
+ /* 340 */ 1028, 120, 120, 121, 121, 121, 121, 273, 273, 563,
157320
+ /* 350 */ 83, 450, 416, 1564, 569, 2, 1228, 1176, 1177, 1178,
157321
+ /* 360 */ 560, 305, 471, 140, 944, 995, 860, 563, 467, 1197,
157322
+ /* 370 */ 1308, 13, 13, 137, 229, 118, 118, 117, 117, 117,
157323
+ /* 380 */ 116, 441, 96, 318, 946, 504, 424, 361, 562, 71,
157324
+ /* 390 */ 71, 119, 119, 119, 119, 118, 118, 117, 117, 117,
157325
+ /* 400 */ 116, 441, 427, 205, 273, 273, 445, 1015, 259, 276,
157326
+ /* 410 */ 356, 507, 351, 506, 246, 406, 959, 560, 328, 344,
157327
+ /* 420 */ 347, 315, 860, 1006, 960, 126, 545, 1005, 313, 304,
157328
+ /* 430 */ 554, 229, 538, 1539, 148, 544, 281, 6, 203, 122,
157329
+ /* 440 */ 123, 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120,
157330
+ /* 450 */ 121, 121, 121, 121, 563, 217, 563, 12, 406, 1005,
157331
+ /* 460 */ 1005, 1007, 502, 445, 119, 119, 119, 119, 118, 118,
157332
+ /* 470 */ 117, 117, 117, 116, 441, 452, 71, 71, 70, 70,
157333
+ /* 480 */ 944, 137, 122, 123, 113, 1200, 1200, 1035, 1038, 1028,
157334
+ /* 490 */ 1028, 120, 120, 121, 121, 121, 121, 1530, 119, 119,
157335
+ /* 500 */ 119, 119, 118, 118, 117, 117, 117, 116, 441, 403,
157336
+ /* 510 */ 402, 241, 1176, 545, 501, 498, 497, 1468, 1143, 451,
157337
+ /* 520 */ 267, 267, 513, 1540, 496, 142, 1176, 6, 406, 530,
157338
+ /* 530 */ 194, 1143, 864, 560, 1143, 461, 182, 304, 554, 32,
157339
+ /* 540 */ 379, 119, 119, 119, 119, 118, 118, 117, 117, 117,
157340
+ /* 550 */ 116, 441, 122, 123, 113, 1200, 1200, 1035, 1038, 1028,
157341
+ /* 560 */ 1028, 120, 120, 121, 121, 121, 121, 406, 1176, 1177,
157342
+ /* 570 */ 1178, 857, 568, 1176, 1228, 925, 1176, 454, 361, 305,
157343
+ /* 580 */ 189, 140, 1176, 1177, 1178, 519, 529, 404, 1308, 183,
157344
+ /* 590 */ 1015, 122, 123, 113, 1200, 1200, 1035, 1038, 1028, 1028,
157345
+ /* 600 */ 120, 120, 121, 121, 121, 121, 1006, 16, 16, 370,
157346
+ /* 610 */ 1005, 119, 119, 119, 119, 118, 118, 117, 117, 117,
157347
+ /* 620 */ 116, 441, 273, 273, 1537, 150, 1176, 98, 6, 1176,
157348
+ /* 630 */ 1177, 1178, 1176, 1177, 1178, 560, 380, 406, 376, 438,
157349
+ /* 640 */ 437, 1161, 1005, 1005, 1007, 1025, 1025, 1036, 1039, 229,
157350
+ /* 650 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
157351
+ /* 660 */ 441, 122, 123, 113, 1200, 1200, 1035, 1038, 1028, 1028,
157352
+ /* 670 */ 120, 120, 121, 121, 121, 121, 406, 1143, 1619, 392,
157353
+ /* 680 */ 1016, 445, 1176, 1177, 1178, 1207, 525, 1207, 1530, 995,
157354
+ /* 690 */ 1143, 304, 554, 1143, 5, 563, 543, 3, 361, 216,
157355
+ /* 700 */ 122, 123, 113, 1200, 1200, 1035, 1038, 1028, 1028, 120,
157356
+ /* 710 */ 120, 121, 121, 121, 121, 143, 563, 13, 13, 1029,
157357
+ /* 720 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
157358
+ /* 730 */ 441, 1176, 426, 563, 1176, 563, 274, 274, 13, 13,
157359
+ /* 740 */ 1078, 1176, 328, 457, 316, 147, 406, 211, 361, 560,
157360
+ /* 750 */ 1000, 213, 511, 293, 477, 55, 55, 71, 71, 119,
157361
+ /* 760 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 441,
157362
+ /* 770 */ 122, 123, 113, 1200, 1200, 1035, 1038, 1028, 1028, 120,
157363
+ /* 780 */ 120, 121, 121, 121, 121, 406, 455, 1176, 1177, 1178,
157364
+ /* 790 */ 1176, 1177, 1178, 471, 526, 149, 404, 1176, 1177, 1178,
157365
+ /* 800 */ 105, 270, 103, 563, 944, 563, 116, 441, 1530, 122,
157366
+ /* 810 */ 123, 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120,
157367
+ /* 820 */ 121, 121, 121, 121, 945, 13, 13, 13, 13, 119,
157368
+ /* 830 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 441,
157369
+ /* 840 */ 191, 563, 192, 563, 416, 439, 439, 439, 1083, 1083,
157370
+ /* 850 */ 485, 561, 285, 914, 914, 406, 462, 330, 1530, 830,
157371
+ /* 860 */ 831, 832, 206, 71, 71, 71, 71, 286, 119, 119,
157372
+ /* 870 */ 119, 119, 118, 118, 117, 117, 117, 116, 441, 122,
157373
+ /* 880 */ 123, 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120,
157374
+ /* 890 */ 121, 121, 121, 121, 563, 217, 563, 1122, 1617, 406,
157375
+ /* 900 */ 300, 1617, 301, 416, 1278, 1473, 244, 243, 242, 1249,
157376
+ /* 910 */ 412, 556, 412, 282, 842, 279, 71, 71, 71, 71,
157377
+ /* 920 */ 944, 1415, 1473, 1475, 101, 113, 1200, 1200, 1035, 1038,
157378
+ /* 930 */ 1028, 1028, 120, 120, 121, 121, 121, 121, 119, 119,
157379
+ /* 940 */ 119, 119, 118, 118, 117, 117, 117, 116, 441, 273,
157380
+ /* 950 */ 273, 1099, 563, 436, 1143, 440, 563, 1122, 1618, 357,
157381
+ /* 960 */ 1558, 1618, 560, 546, 488, 197, 1100, 1143, 378, 290,
157382
+ /* 970 */ 1143, 1306, 284, 460, 71, 71, 1120, 405, 13, 13,
157383
+ /* 980 */ 145, 1101, 119, 119, 119, 119, 118, 118, 117, 117,
157384
+ /* 990 */ 117, 116, 441, 542, 104, 1473, 509, 273, 273, 294,
157385
+ /* 1000 */ 1514, 294, 900, 273, 273, 273, 273, 563, 1503, 563,
157386
+ /* 1010 */ 560, 545, 901, 464, 406, 1058, 560, 852, 560, 198,
157387
+ /* 1020 */ 547, 1080, 920, 404, 1400, 1080, 146, 919, 38, 56,
157388
+ /* 1030 */ 56, 15, 15, 563, 406, 12, 1120, 471, 122, 123,
157389
+ /* 1040 */ 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120, 121,
157390
+ /* 1050 */ 121, 121, 121, 1460, 406, 43, 43, 483, 122, 123,
157391
+ /* 1060 */ 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120, 121,
157392
+ /* 1070 */ 121, 121, 121, 563, 852, 9, 471, 251, 122, 111,
157393
+ /* 1080 */ 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120, 121,
157394
+ /* 1090 */ 121, 121, 121, 563, 421, 57, 57, 119, 119, 119,
157395
+ /* 1100 */ 119, 118, 118, 117, 117, 117, 116, 441, 1176, 493,
157396
+ /* 1110 */ 563, 289, 1197, 478, 1516, 44, 44, 119, 119, 119,
157397
+ /* 1120 */ 119, 118, 118, 117, 117, 117, 116, 441, 880, 563,
157398
+ /* 1130 */ 536, 563, 58, 58, 488, 1414, 245, 119, 119, 119,
157399
+ /* 1140 */ 119, 118, 118, 117, 117, 117, 116, 441, 563, 535,
157400
+ /* 1150 */ 291, 59, 59, 60, 60, 438, 437, 406, 1154, 505,
157401
+ /* 1160 */ 304, 554, 477, 1204, 1176, 1177, 1178, 881, 1206, 1197,
157402
+ /* 1170 */ 61, 61, 1246, 357, 1558, 1538, 1205, 563, 1467, 6,
157403
+ /* 1180 */ 1176, 488, 123, 113, 1200, 1200, 1035, 1038, 1028, 1028,
157404
+ /* 1190 */ 120, 120, 121, 121, 121, 121, 1400, 1143, 410, 62,
157405
+ /* 1200 */ 62, 1207, 1099, 1207, 411, 447, 273, 273, 537, 1154,
157406
+ /* 1210 */ 1143, 108, 555, 1143, 4, 391, 1220, 1100, 1512, 560,
157407
+ /* 1220 */ 347, 516, 428, 548, 308, 1307, 1536, 1077, 558, 1077,
157408
+ /* 1230 */ 6, 488, 1101, 1400, 488, 309, 1176, 1177, 1178, 563,
157409
+ /* 1240 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
157410
+ /* 1250 */ 441, 442, 278, 551, 563, 273, 273, 273, 273, 563,
157411
+ /* 1260 */ 327, 45, 45, 552, 563, 528, 422, 563, 560, 1400,
157412
+ /* 1270 */ 560, 108, 555, 137, 4, 1303, 46, 46, 335, 563,
157413
+ /* 1280 */ 482, 47, 47, 477, 479, 307, 49, 49, 558, 50,
157414
+ /* 1290 */ 50, 563, 1015, 563, 1221, 563, 1400, 563, 106, 106,
157415
+ /* 1300 */ 8, 63, 63, 423, 563, 107, 312, 442, 565, 564,
157416
+ /* 1310 */ 563, 442, 1005, 64, 64, 65, 65, 14, 14, 66,
157417
+ /* 1320 */ 66, 391, 1121, 552, 1312, 1180, 128, 128, 563, 304,
157418
+ /* 1330 */ 554, 563, 67, 67, 563, 359, 560, 532, 563, 484,
157419
+ /* 1340 */ 563, 1196, 531, 222, 1005, 1005, 1007, 1008, 27, 522,
157420
+ /* 1350 */ 52, 52, 1015, 68, 68, 563, 69, 69, 106, 106,
157421
+ /* 1360 */ 53, 53, 156, 156, 563, 107, 434, 442, 565, 564,
157422
+ /* 1370 */ 272, 215, 1005, 425, 563, 359, 563, 157, 157, 563,
157423
+ /* 1380 */ 1535, 292, 1180, 98, 6, 1344, 76, 76, 1215, 475,
157424
+ /* 1390 */ 413, 169, 226, 563, 245, 563, 54, 54, 72, 72,
157425
+ /* 1400 */ 1221, 129, 129, 1343, 1005, 1005, 1007, 1008, 27, 1563,
157426
+ /* 1410 */ 1165, 444, 456, 433, 277, 73, 73, 130, 130, 389,
157427
+ /* 1420 */ 389, 388, 262, 386, 1165, 444, 839, 1519, 277, 108,
157428
+ /* 1430 */ 555, 321, 4, 389, 389, 388, 262, 386, 563, 223,
157429
+ /* 1440 */ 839, 311, 468, 84, 202, 523, 558, 1492, 303, 310,
157430
+ /* 1450 */ 563, 110, 404, 223, 563, 311, 206, 30, 404, 277,
157431
+ /* 1460 */ 131, 131, 411, 310, 389, 389, 388, 262, 386, 442,
157432
+ /* 1470 */ 920, 839, 127, 127, 563, 919, 155, 155, 1491, 225,
157433
+ /* 1480 */ 563, 552, 871, 563, 223, 476, 311, 161, 31, 563,
157434
+ /* 1490 */ 135, 563, 480, 225, 310, 532, 154, 154, 332, 17,
157435
+ /* 1500 */ 533, 161, 136, 136, 135, 134, 134, 224, 228, 355,
157436
+ /* 1510 */ 1015, 132, 132, 133, 133, 1589, 106, 106, 889, 354,
157437
+ /* 1520 */ 563, 224, 563, 107, 225, 442, 565, 564, 1117, 275,
157438
+ /* 1530 */ 1005, 393, 161, 518, 563, 135, 108, 555, 417, 4,
157439
+ /* 1540 */ 1340, 407, 75, 75, 77, 77, 304, 554, 867, 563,
157440
+ /* 1550 */ 336, 563, 224, 558, 463, 407, 74, 74, 465, 1065,
157441
+ /* 1560 */ 304, 554, 1005, 1005, 1007, 1008, 27, 962, 963, 543,
157442
+ /* 1570 */ 448, 42, 42, 48, 48, 326, 442, 325, 98, 997,
157443
+ /* 1580 */ 470, 287, 250, 250, 448, 1009, 407, 472, 552, 339,
157444
+ /* 1590 */ 250, 304, 554, 879, 878, 331, 108, 555, 98, 4,
157445
+ /* 1600 */ 1277, 494, 532, 345, 247, 867, 98, 531, 341, 886,
157446
+ /* 1610 */ 887, 1126, 1076, 558, 1076, 448, 1065, 1015, 1061, 953,
157447
+ /* 1620 */ 343, 247, 250, 106, 106, 1291, 917, 1276, 850, 110,
157448
+ /* 1630 */ 107, 144, 442, 565, 564, 918, 442, 1005, 110, 1275,
157449
+ /* 1640 */ 350, 360, 1009, 1331, 1352, 299, 1399, 1577, 552, 1327,
157450
+ /* 1650 */ 1552, 550, 1338, 549, 1405, 1256, 1248, 1237, 1236, 1238,
157451
+ /* 1660 */ 1571, 489, 265, 200, 1324, 363, 365, 367, 11, 1005,
157452
+ /* 1670 */ 1005, 1007, 1008, 27, 390, 221, 1386, 1015, 280, 1391,
157453
+ /* 1680 */ 1381, 208, 323, 106, 106, 924, 1374, 453, 283, 324,
157454
+ /* 1690 */ 107, 474, 442, 565, 564, 1390, 499, 1005, 212, 288,
157455
+ /* 1700 */ 1274, 397, 353, 108, 555, 195, 4, 1464, 369, 1463,
157456
+ /* 1710 */ 1574, 1215, 1212, 329, 553, 171, 207, 383, 1511, 196,
157457
+ /* 1720 */ 558, 254, 1509, 415, 100, 555, 83, 4, 204, 1005,
157458
+ /* 1730 */ 1005, 1007, 1008, 27, 219, 79, 82, 1469, 180, 166,
157459
+ /* 1740 */ 173, 558, 458, 442, 175, 176, 177, 178, 35, 1387,
157460
+ /* 1750 */ 492, 459, 231, 1395, 96, 552, 1393, 1392, 395, 184,
157461
+ /* 1760 */ 481, 466, 36, 235, 442, 89, 398, 266, 487, 1480,
157462
+ /* 1770 */ 1458, 237, 188, 338, 508, 429, 552, 490, 400, 238,
157463
+ /* 1780 */ 334, 1239, 239, 1294, 1015, 1293, 1292, 1285, 91, 871,
157464
+ /* 1790 */ 106, 106, 213, 431, 1588, 432, 524, 107, 517, 442,
157465
+ /* 1800 */ 565, 564, 401, 1264, 1005, 1015, 1263, 1587, 352, 1262,
157466
+ /* 1810 */ 1557, 106, 106, 1586, 1284, 297, 298, 358, 107, 1335,
157467
+ /* 1820 */ 442, 565, 564, 95, 362, 1005, 253, 252, 435, 125,
157468
+ /* 1830 */ 543, 10, 1444, 1543, 377, 1542, 1005, 1005, 1007, 1008,
157469
+ /* 1840 */ 27, 302, 102, 97, 527, 1336, 260, 1317, 364, 1245,
157470
+ /* 1850 */ 1334, 34, 566, 1171, 366, 381, 375, 1005, 1005, 1007,
157471
+ /* 1860 */ 1008, 27, 1333, 1359, 368, 1316, 199, 382, 261, 263,
157472
+ /* 1870 */ 264, 1358, 158, 1496, 141, 1497, 1495, 567, 1234, 1229,
157473
+ /* 1880 */ 1494, 295, 159, 209, 210, 78, 826, 443, 201, 306,
157474
+ /* 1890 */ 220, 1075, 138, 1073, 160, 314, 162, 172, 1196, 174,
157475
+ /* 1900 */ 903, 227, 230, 322, 1089, 179, 163, 164, 418, 85,
157476
+ /* 1910 */ 420, 181, 170, 408, 409, 86, 87, 165, 88, 1092,
157477
+ /* 1920 */ 232, 233, 1088, 151, 18, 234, 1081, 250, 333, 185,
157478
+ /* 1930 */ 1209, 486, 236, 186, 37, 841, 491, 354, 240, 346,
157479
+ /* 1940 */ 503, 187, 90, 167, 19, 495, 20, 869, 500, 349,
157480
+ /* 1950 */ 92, 882, 296, 152, 93, 510, 1127, 1159, 153, 1041,
157481
+ /* 1960 */ 214, 1128, 39, 94, 269, 271, 952, 190, 947, 110,
157482
+ /* 1970 */ 1149, 1145, 1153, 249, 1133, 1147, 7, 33, 21, 193,
157483
+ /* 1980 */ 22, 23, 24, 25, 1152, 539, 98, 1056, 26, 1042,
157484
+ /* 1990 */ 1040, 1044, 1098, 1045, 1097, 256, 255, 28, 40, 387,
157485
+ /* 2000 */ 1010, 851, 109, 29, 1167, 559, 384, 257, 913, 258,
157486
+ /* 2010 */ 1166, 1579, 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1578,
157041157487
};
157042157488
static const YYCODETYPE yy_lookahead[] = {
157043
- /* 0 */ 190, 212, 190, 190, 211, 190, 212, 190, 270, 271,
157044
- /* 10 */ 272, 190, 219, 190, 190, 202, 270, 271, 272, 19,
157045
- /* 20 */ 190, 190, 212, 213, 212, 213, 190, 212, 213, 212,
157046
- /* 30 */ 213, 31, 212, 212, 213, 212, 213, 291, 23, 39,
157047
- /* 40 */ 22, 26, 24, 43, 44, 45, 46, 47, 48, 49,
157048
- /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 234, 19,
157049
- /* 60 */ 190, 184, 185, 186, 187, 226, 249, 237, 237, 192,
157050
- /* 70 */ 249, 194, 249, 231, 232, 258, 190, 59, 201, 258,
157051
- /* 80 */ 201, 258, 81, 43, 44, 45, 46, 47, 48, 49,
157052
- /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 212, 213,
157053
- /* 100 */ 264, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157054
- /* 110 */ 110, 111, 235, 236, 235, 236, 292, 59, 308, 309,
157055
- /* 120 */ 308, 59, 310, 308, 309, 248, 86, 248, 88, 19,
157056
- /* 130 */ 11, 252, 253, 115, 72, 249, 26, 136, 137, 262,
157057
- /* 140 */ 111, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157058
- /* 150 */ 110, 111, 190, 43, 44, 45, 46, 47, 48, 49,
157059
- /* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 190, 207,
157060
- /* 170 */ 208, 294, 114, 115, 116, 201, 114, 115, 116, 69,
157061
- /* 180 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157062
- /* 190 */ 111, 105, 106, 107, 108, 109, 110, 111, 209, 19,
157063
- /* 200 */ 190, 54, 55, 56, 57, 58, 245, 149, 247, 235,
157064
- /* 210 */ 236, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157065
- /* 220 */ 110, 111, 248, 43, 44, 45, 46, 47, 48, 49,
157066
- /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 265,
157067
- /* 240 */ 22, 23, 280, 24, 26, 126, 127, 67, 101, 102,
157068
- /* 250 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 270,
157069
- /* 260 */ 271, 272, 43, 44, 45, 46, 47, 48, 49, 50,
157070
- /* 270 */ 51, 52, 53, 54, 55, 56, 57, 190, 300, 301,
157071
- /* 280 */ 35, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157072
- /* 290 */ 110, 111, 107, 108, 109, 110, 111, 209, 190, 212,
157073
- /* 300 */ 213, 76, 54, 55, 56, 57, 198, 19, 19, 59,
157074
- /* 310 */ 202, 66, 87, 24, 89, 190, 190, 92, 100, 74,
157075
- /* 320 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157076
- /* 330 */ 111, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157077
- /* 340 */ 52, 53, 54, 55, 56, 57, 59, 235, 236, 101,
157078
- /* 350 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157079
- /* 360 */ 248, 274, 99, 76, 114, 115, 116, 117, 143, 190,
157080
- /* 370 */ 120, 121, 122, 128, 87, 287, 89, 303, 115, 92,
157081
- /* 380 */ 130, 307, 119, 190, 95, 46, 47, 48, 49, 101,
157082
- /* 390 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157083
- /* 400 */ 111, 114, 115, 116, 12, 279, 117, 118, 119, 120,
157084
- /* 410 */ 121, 122, 123, 19, 151, 152, 153, 23, 129, 27,
157085
- /* 420 */ 117, 126, 127, 120, 121, 122, 190, 302, 303, 190,
157086
- /* 430 */ 143, 190, 307, 130, 42, 265, 148, 43, 44, 45,
157087
- /* 440 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
157088
- /* 450 */ 56, 57, 190, 260, 59, 63, 19, 185, 119, 187,
157089
- /* 460 */ 23, 16, 222, 73, 192, 73, 194, 72, 219, 228,
157090
- /* 470 */ 221, 81, 190, 201, 212, 213, 237, 59, 229, 222,
157091
- /* 480 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
157092
- /* 490 */ 53, 54, 55, 56, 57, 101, 102, 103, 104, 105,
157093
- /* 500 */ 106, 107, 108, 109, 110, 111, 190, 235, 236, 114,
157094
- /* 510 */ 115, 116, 190, 190, 190, 125, 234, 99, 190, 215,
157095
- /* 520 */ 248, 190, 77, 59, 79, 19, 136, 137, 215, 23,
157096
- /* 530 */ 22, 190, 114, 115, 262, 212, 213, 119, 101, 102,
157097
- /* 540 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 43,
157098
- /* 550 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
157099
- /* 560 */ 54, 55, 56, 57, 19, 234, 294, 59, 23, 151,
157100
- /* 570 */ 152, 153, 249, 303, 270, 271, 272, 307, 114, 115,
157101
- /* 580 */ 116, 22, 260, 270, 271, 272, 59, 259, 43, 44,
157102
- /* 590 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
157103
- /* 600 */ 55, 56, 57, 190, 159, 141, 190, 101, 102, 103,
157104
- /* 610 */ 104, 105, 106, 107, 108, 109, 110, 111, 59, 26,
157105
- /* 620 */ 207, 208, 114, 115, 116, 133, 302, 303, 190, 59,
157106
- /* 630 */ 138, 307, 59, 19, 107, 105, 106, 23, 163, 164,
157107
- /* 640 */ 22, 114, 115, 116, 201, 22, 101, 102, 103, 104,
157108
- /* 650 */ 105, 106, 107, 108, 109, 110, 111, 43, 44, 45,
157109
- /* 660 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
157110
- /* 670 */ 56, 57, 19, 114, 115, 116, 23, 59, 235, 236,
157111
- /* 680 */ 264, 151, 59, 153, 114, 115, 116, 114, 115, 116,
157112
- /* 690 */ 190, 248, 81, 280, 110, 111, 43, 44, 45, 46,
157113
- /* 700 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
157114
- /* 710 */ 57, 141, 212, 213, 22, 101, 102, 103, 104, 105,
157115
- /* 720 */ 106, 107, 108, 109, 110, 111, 288, 227, 190, 118,
157116
- /* 730 */ 190, 190, 114, 115, 116, 231, 232, 114, 115, 116,
157117
- /* 740 */ 147, 19, 73, 297, 298, 23, 190, 136, 137, 22,
157118
- /* 750 */ 212, 213, 212, 213, 101, 102, 103, 104, 105, 106,
157119
- /* 760 */ 107, 108, 109, 110, 111, 43, 44, 45, 46, 47,
157120
- /* 770 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
157121
- /* 780 */ 19, 182, 183, 184, 185, 186, 187, 249, 61, 249,
157122
- /* 790 */ 234, 192, 21, 194, 125, 126, 127, 105, 106, 190,
157123
- /* 800 */ 201, 260, 22, 201, 43, 44, 45, 46, 47, 48,
157124
- /* 810 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 190,
157125
- /* 820 */ 190, 212, 213, 101, 102, 103, 104, 105, 106, 107,
157126
- /* 830 */ 108, 109, 110, 111, 235, 236, 227, 235, 236, 59,
157127
- /* 840 */ 236, 190, 212, 213, 22, 23, 209, 248, 26, 19,
157128
- /* 850 */ 248, 80, 248, 59, 206, 207, 208, 227, 206, 207,
157129
- /* 860 */ 208, 262, 101, 102, 103, 104, 105, 106, 107, 108,
157130
- /* 870 */ 109, 110, 111, 43, 44, 45, 46, 47, 48, 49,
157131
- /* 880 */ 50, 51, 52, 53, 54, 55, 56, 57, 237, 190,
157132
- /* 890 */ 190, 190, 121, 294, 114, 115, 116, 190, 190, 105,
157133
- /* 900 */ 106, 202, 132, 26, 134, 135, 190, 113, 114, 115,
157134
- /* 910 */ 116, 190, 118, 212, 213, 19, 190, 201, 157, 282,
157135
- /* 920 */ 126, 190, 100, 224, 287, 226, 201, 24, 212, 213,
157136
- /* 930 */ 159, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157137
- /* 940 */ 110, 111, 46, 212, 213, 151, 190, 153, 190, 201,
157138
- /* 950 */ 249, 235, 236, 190, 201, 234, 190, 201, 190, 259,
157139
- /* 960 */ 235, 236, 59, 201, 248, 249, 259, 16, 212, 213,
157140
- /* 970 */ 212, 213, 264, 248, 258, 212, 213, 190, 212, 213,
157141
- /* 980 */ 212, 213, 201, 235, 236, 227, 269, 157, 235, 236,
157142
- /* 990 */ 227, 235, 236, 227, 190, 227, 248, 235, 236, 212,
157143
- /* 1000 */ 213, 248, 235, 236, 248, 249, 190, 19, 23, 113,
157144
- /* 1010 */ 248, 26, 24, 136, 137, 248, 235, 236, 115, 156,
157145
- /* 1020 */ 195, 158, 305, 306, 190, 129, 190, 19, 77, 248,
157146
- /* 1030 */ 79, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157147
- /* 1040 */ 52, 53, 54, 55, 56, 57, 190, 19, 212, 213,
157148
- /* 1050 */ 190, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157149
- /* 1060 */ 52, 53, 54, 55, 56, 57, 125, 126, 127, 190,
157150
- /* 1070 */ 190, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157151
- /* 1080 */ 52, 53, 54, 55, 56, 57, 22, 23, 190, 101,
157152
- /* 1090 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157153
- /* 1100 */ 26, 116, 277, 59, 269, 190, 281, 228, 190, 101,
157154
- /* 1110 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157155
- /* 1120 */ 264, 29, 190, 190, 190, 33, 141, 212, 213, 101,
157156
- /* 1130 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157157
- /* 1140 */ 305, 306, 66, 12, 212, 213, 212, 213, 288, 19,
157158
- /* 1150 */ 76, 7, 8, 9, 125, 126, 127, 65, 27, 115,
157159
- /* 1160 */ 190, 85, 190, 89, 100, 190, 92, 190, 288, 19,
157160
- /* 1170 */ 94, 204, 205, 42, 44, 45, 46, 47, 48, 49,
157161
- /* 1180 */ 50, 51, 52, 53, 54, 55, 56, 57, 190, 212,
157162
- /* 1190 */ 213, 190, 107, 260, 63, 45, 46, 47, 48, 49,
157163
- /* 1200 */ 50, 51, 52, 53, 54, 55, 56, 57, 303, 234,
157164
- /* 1210 */ 212, 213, 307, 212, 213, 22, 23, 303, 133, 301,
157165
- /* 1220 */ 144, 307, 190, 138, 190, 19, 20, 190, 22, 26,
157166
- /* 1230 */ 260, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157167
- /* 1240 */ 110, 111, 36, 59, 212, 213, 212, 213, 190, 212,
157168
- /* 1250 */ 213, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157169
- /* 1260 */ 110, 111, 190, 76, 303, 59, 254, 190, 307, 190,
157170
- /* 1270 */ 212, 213, 190, 204, 205, 222, 89, 71, 22, 92,
157171
- /* 1280 */ 190, 113, 136, 137, 212, 213, 190, 81, 143, 212,
157172
- /* 1290 */ 213, 212, 213, 100, 212, 213, 31, 19, 20, 115,
157173
- /* 1300 */ 22, 190, 212, 213, 39, 99, 190, 162, 212, 213,
157174
- /* 1310 */ 190, 105, 106, 190, 36, 59, 148, 190, 112, 116,
157175
- /* 1320 */ 114, 115, 116, 212, 213, 119, 48, 19, 212, 213,
157176
- /* 1330 */ 190, 240, 212, 213, 15, 212, 213, 59, 240, 212,
157177
- /* 1340 */ 213, 250, 136, 137, 141, 295, 296, 26, 250, 71,
157178
- /* 1350 */ 26, 26, 212, 213, 26, 240, 46, 151, 152, 153,
157179
- /* 1360 */ 154, 155, 240, 85, 190, 250, 190, 190, 90, 252,
157180
- /* 1370 */ 253, 115, 250, 190, 147, 148, 190, 99, 190, 60,
157181
- /* 1380 */ 190, 240, 190, 105, 106, 190, 212, 213, 212, 213,
157182
- /* 1390 */ 112, 250, 114, 115, 116, 212, 213, 119, 212, 213,
157183
- /* 1400 */ 212, 213, 212, 213, 212, 213, 23, 212, 213, 26,
157184
- /* 1410 */ 19, 20, 22, 22, 24, 190, 19, 251, 190, 127,
157185
- /* 1420 */ 24, 190, 114, 113, 22, 118, 119, 36, 190, 151,
157186
- /* 1430 */ 152, 153, 154, 155, 0, 1, 2, 212, 213, 5,
157187
- /* 1440 */ 212, 213, 150, 190, 10, 11, 12, 13, 14, 190,
157188
- /* 1450 */ 59, 17, 124, 190, 127, 53, 190, 7, 8, 119,
157189
- /* 1460 */ 23, 140, 71, 26, 30, 140, 32, 143, 312, 129,
157190
- /* 1470 */ 23, 212, 213, 26, 40, 190, 85, 150, 212, 213,
157191
- /* 1480 */ 59, 90, 19, 20, 23, 22, 190, 26, 190, 23,
157192
- /* 1490 */ 99, 190, 26, 22, 190, 23, 105, 106, 26, 36,
157193
- /* 1500 */ 151, 190, 153, 112, 70, 114, 115, 116, 212, 213,
157194
- /* 1510 */ 119, 114, 78, 212, 213, 81, 212, 213, 23, 83,
157195
- /* 1520 */ 84, 26, 59, 212, 213, 23, 190, 190, 26, 23,
157196
- /* 1530 */ 284, 97, 26, 190, 71, 139, 115, 23, 23, 59,
157197
- /* 1540 */ 26, 26, 151, 152, 153, 154, 155, 190, 85, 212,
157198
- /* 1550 */ 213, 190, 151, 90, 153, 212, 213, 23, 23, 190,
157199
- /* 1560 */ 26, 26, 99, 190, 190, 131, 190, 190, 105, 106,
157200
- /* 1570 */ 136, 137, 190, 212, 213, 112, 190, 114, 115, 116,
157201
- /* 1580 */ 1, 2, 119, 190, 5, 19, 20, 232, 22, 10,
157202
- /* 1590 */ 11, 12, 13, 14, 160, 115, 17, 190, 212, 213,
157203
- /* 1600 */ 190, 190, 36, 190, 190, 212, 213, 190, 190, 30,
157204
- /* 1610 */ 139, 32, 190, 190, 151, 152, 153, 154, 155, 40,
157205
- /* 1620 */ 190, 190, 190, 212, 213, 59, 212, 213, 190, 190,
157206
- /* 1630 */ 190, 190, 190, 190, 283, 251, 238, 71, 251, 251,
157207
- /* 1640 */ 251, 188, 239, 210, 263, 293, 267, 241, 263, 70,
157208
- /* 1650 */ 255, 289, 289, 241, 255, 193, 221, 78, 242, 267,
157209
- /* 1660 */ 81, 267, 242, 255, 216, 99, 215, 267, 241, 225,
157210
- /* 1670 */ 215, 105, 106, 107, 215, 60, 97, 139, 112, 197,
157211
- /* 1680 */ 114, 115, 116, 197, 38, 119, 197, 148, 239, 149,
157212
- /* 1690 */ 245, 19, 20, 268, 22, 276, 22, 245, 293, 290,
157213
- /* 1700 */ 43, 18, 233, 279, 230, 290, 233, 197, 36, 233,
157214
- /* 1710 */ 131, 233, 266, 18, 196, 136, 137, 151, 152, 153,
157215
- /* 1720 */ 154, 155, 147, 242, 268, 268, 242, 230, 230, 242,
157216
- /* 1730 */ 266, 59, 242, 197, 156, 62, 22, 196, 196, 160,
157217
- /* 1740 */ 286, 197, 217, 71, 197, 285, 196, 217, 197, 196,
157218
- /* 1750 */ 113, 214, 64, 22, 223, 124, 223, 214, 163, 19,
157219
- /* 1760 */ 20, 111, 22, 214, 216, 220, 220, 142, 214, 217,
157220
- /* 1770 */ 214, 99, 214, 214, 306, 113, 36, 105, 106, 217,
157221
- /* 1780 */ 217, 278, 278, 257, 112, 256, 114, 115, 116, 257,
157222
- /* 1790 */ 197, 119, 91, 82, 311, 146, 311, 143, 22, 59,
157223
- /* 1800 */ 273, 197, 144, 156, 145, 25, 200, 26, 199, 13,
157224
- /* 1810 */ 245, 71, 257, 256, 244, 246, 256, 246, 257, 243,
157225
- /* 1820 */ 256, 191, 242, 151, 152, 153, 154, 155, 261, 261,
157226
- /* 1830 */ 191, 6, 189, 189, 189, 203, 209, 209, 209, 99,
157227
- /* 1840 */ 218, 203, 209, 209, 218, 105, 106, 275, 4, 3,
157228
- /* 1850 */ 210, 210, 112, 22, 114, 115, 116, 161, 203, 119,
157229
- /* 1860 */ 15, 5, 98, 16, 23, 23, 10, 11, 12, 13,
157230
- /* 1870 */ 14, 137, 299, 17, 149, 128, 299, 296, 26, 24,
157231
- /* 1880 */ 20, 140, 16, 1, 142, 140, 30, 128, 32, 128,
157232
- /* 1890 */ 61, 151, 152, 153, 154, 155, 40, 149, 37, 128,
157233
- /* 1900 */ 114, 53, 53, 53, 53, 34, 139, 1, 5, 22,
157234
- /* 1910 */ 113, 159, 26, 75, 41, 113, 139, 24, 20, 19,
157235
- /* 1920 */ 129, 68, 68, 123, 22, 67, 70, 22, 59, 22,
157236
- /* 1930 */ 67, 23, 22, 24, 78, 96, 22, 81, 37, 28,
157237
- /* 1940 */ 23, 67, 147, 22, 26, 23, 23, 23, 23, 22,
157238
- /* 1950 */ 24, 23, 22, 97, 139, 24, 23, 23, 22, 141,
157239
- /* 1960 */ 88, 26, 86, 34, 75, 75, 34, 23, 93, 22,
157240
- /* 1970 */ 24, 114, 34, 34, 34, 34, 26, 26, 23, 34,
157241
- /* 1980 */ 23, 44, 23, 23, 23, 11, 23, 131, 26, 22,
157242
- /* 1990 */ 22, 22, 136, 137, 23, 23, 26, 22, 22, 15,
157243
- /* 2000 */ 133, 139, 23, 139, 139, 1, 1, 139, 313, 313,
157244
- /* 2010 */ 313, 313, 313, 313, 313, 313, 160, 313, 313, 313,
157245
- /* 2020 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157246
- /* 2030 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157247
- /* 2040 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157248
- /* 2050 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157249
- /* 2060 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157250
- /* 2070 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157251
- /* 2080 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157252
- /* 2090 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157253
- /* 2100 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157254
- /* 2110 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157255
- /* 2120 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157256
- /* 2130 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157257
- /* 2140 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157258
- /* 2150 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157259
- /* 2160 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157260
- /* 2170 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157261
- /* 2180 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157262
- /* 2190 */ 182, 182, 182, 182, 182, 182, 182, 182, 182,
157263
-};
157264
-#define YY_SHIFT_COUNT (570)
157489
+ /* 0 */ 191, 220, 191, 222, 191, 191, 271, 272, 273, 216,
157490
+ /* 10 */ 191, 230, 216, 191, 191, 191, 271, 272, 273, 19,
157491
+ /* 20 */ 232, 233, 213, 214, 213, 214, 202, 292, 202, 232,
157492
+ /* 30 */ 233, 31, 213, 214, 213, 213, 214, 213, 214, 39,
157493
+ /* 40 */ 207, 208, 209, 43, 44, 45, 46, 47, 48, 49,
157494
+ /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 235, 19,
157495
+ /* 60 */ 236, 237, 236, 237, 271, 272, 273, 271, 272, 273,
157496
+ /* 70 */ 191, 210, 250, 249, 250, 249, 213, 191, 199, 253,
157497
+ /* 80 */ 254, 259, 203, 43, 44, 45, 46, 47, 48, 49,
157498
+ /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 191, 213,
157499
+ /* 100 */ 214, 213, 102, 103, 104, 105, 106, 107, 108, 109,
157500
+ /* 110 */ 110, 111, 112, 59, 228, 301, 293, 81, 305, 306,
157501
+ /* 120 */ 311, 312, 311, 310, 313, 59, 86, 212, 88, 19,
157502
+ /* 130 */ 311, 312, 271, 272, 273, 220, 26, 112, 54, 55,
157503
+ /* 140 */ 56, 57, 102, 103, 104, 105, 106, 107, 108, 109,
157504
+ /* 150 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
157505
+ /* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 191, 115,
157506
+ /* 170 */ 116, 117, 118, 137, 138, 121, 122, 123, 191, 69,
157507
+ /* 180 */ 203, 115, 116, 117, 59, 131, 102, 103, 104, 105,
157508
+ /* 190 */ 106, 107, 108, 109, 110, 111, 112, 72, 191, 19,
157509
+ /* 200 */ 54, 55, 56, 57, 58, 108, 109, 110, 111, 112,
157510
+ /* 210 */ 303, 304, 102, 103, 104, 105, 106, 107, 108, 109,
157511
+ /* 220 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
157512
+ /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 16,
157513
+ /* 240 */ 115, 116, 117, 24, 16, 227, 202, 67, 102, 103,
157514
+ /* 250 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 59,
157515
+ /* 260 */ 26, 191, 43, 44, 45, 46, 47, 48, 49, 50,
157516
+ /* 270 */ 51, 52, 53, 54, 55, 56, 57, 24, 208, 209,
157517
+ /* 280 */ 236, 237, 102, 103, 104, 105, 106, 107, 108, 109,
157518
+ /* 290 */ 110, 111, 112, 249, 183, 184, 185, 186, 187, 188,
157519
+ /* 300 */ 77, 59, 79, 191, 193, 77, 195, 79, 19, 19,
157520
+ /* 310 */ 266, 304, 59, 202, 24, 115, 116, 117, 191, 127,
157521
+ /* 320 */ 128, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157522
+ /* 330 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
157523
+ /* 340 */ 51, 52, 53, 54, 55, 56, 57, 236, 237, 191,
157524
+ /* 350 */ 150, 281, 191, 185, 186, 187, 188, 115, 116, 117,
157525
+ /* 360 */ 249, 193, 191, 195, 26, 73, 59, 191, 114, 116,
157526
+ /* 370 */ 202, 213, 214, 81, 263, 106, 107, 108, 109, 110,
157527
+ /* 380 */ 111, 112, 148, 160, 142, 95, 228, 191, 191, 213,
157528
+ /* 390 */ 214, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157529
+ /* 400 */ 111, 112, 112, 149, 236, 237, 295, 100, 118, 119,
157530
+ /* 410 */ 120, 121, 122, 123, 124, 19, 31, 249, 126, 23,
157531
+ /* 420 */ 130, 260, 115, 116, 39, 22, 250, 120, 191, 137,
157532
+ /* 430 */ 138, 263, 305, 306, 238, 259, 265, 310, 149, 43,
157533
+ /* 440 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
157534
+ /* 450 */ 54, 55, 56, 57, 191, 117, 191, 210, 19, 152,
157535
+ /* 460 */ 153, 154, 23, 295, 102, 103, 104, 105, 106, 107,
157536
+ /* 470 */ 108, 109, 110, 111, 112, 266, 213, 214, 213, 214,
157537
+ /* 480 */ 142, 81, 43, 44, 45, 46, 47, 48, 49, 50,
157538
+ /* 490 */ 51, 52, 53, 54, 55, 56, 57, 301, 102, 103,
157539
+ /* 500 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 106,
157540
+ /* 510 */ 107, 118, 59, 250, 121, 122, 123, 280, 76, 119,
157541
+ /* 520 */ 236, 237, 259, 306, 131, 72, 59, 310, 19, 87,
157542
+ /* 530 */ 283, 89, 23, 249, 92, 288, 22, 137, 138, 22,
157543
+ /* 540 */ 275, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157544
+ /* 550 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
157545
+ /* 560 */ 51, 52, 53, 54, 55, 56, 57, 19, 115, 116,
157546
+ /* 570 */ 117, 23, 186, 59, 188, 108, 59, 241, 191, 193,
157547
+ /* 580 */ 26, 195, 115, 116, 117, 191, 144, 251, 202, 22,
157548
+ /* 590 */ 100, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157549
+ /* 600 */ 52, 53, 54, 55, 56, 57, 116, 213, 214, 191,
157550
+ /* 610 */ 120, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157551
+ /* 620 */ 111, 112, 236, 237, 306, 238, 59, 26, 310, 115,
157552
+ /* 630 */ 116, 117, 115, 116, 117, 249, 246, 19, 248, 106,
157553
+ /* 640 */ 107, 23, 152, 153, 154, 46, 47, 48, 49, 263,
157554
+ /* 650 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157555
+ /* 660 */ 112, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157556
+ /* 670 */ 52, 53, 54, 55, 56, 57, 19, 76, 298, 299,
157557
+ /* 680 */ 23, 295, 115, 116, 117, 152, 191, 154, 301, 73,
157558
+ /* 690 */ 89, 137, 138, 92, 22, 191, 144, 22, 191, 191,
157559
+ /* 700 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
157560
+ /* 710 */ 53, 54, 55, 56, 57, 163, 191, 213, 214, 120,
157561
+ /* 720 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157562
+ /* 730 */ 112, 59, 228, 191, 59, 191, 236, 237, 213, 214,
157563
+ /* 740 */ 11, 59, 126, 127, 128, 238, 19, 26, 191, 249,
157564
+ /* 750 */ 23, 164, 165, 228, 191, 213, 214, 213, 214, 102,
157565
+ /* 760 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
157566
+ /* 770 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
157567
+ /* 780 */ 53, 54, 55, 56, 57, 19, 241, 115, 116, 117,
157568
+ /* 790 */ 115, 116, 117, 191, 250, 238, 251, 115, 116, 117,
157569
+ /* 800 */ 157, 23, 159, 191, 26, 191, 111, 112, 301, 43,
157570
+ /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
157571
+ /* 820 */ 54, 55, 56, 57, 142, 213, 214, 213, 214, 102,
157572
+ /* 830 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
157573
+ /* 840 */ 228, 191, 228, 191, 191, 207, 208, 209, 126, 127,
157574
+ /* 850 */ 128, 133, 289, 135, 136, 19, 127, 128, 301, 7,
157575
+ /* 860 */ 8, 9, 141, 213, 214, 213, 214, 265, 102, 103,
157576
+ /* 870 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 43,
157577
+ /* 880 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
157578
+ /* 890 */ 54, 55, 56, 57, 191, 117, 191, 22, 23, 19,
157579
+ /* 900 */ 250, 26, 250, 191, 223, 191, 126, 127, 128, 205,
157580
+ /* 910 */ 206, 205, 206, 260, 21, 202, 213, 214, 213, 214,
157581
+ /* 920 */ 142, 270, 208, 209, 158, 45, 46, 47, 48, 49,
157582
+ /* 930 */ 50, 51, 52, 53, 54, 55, 56, 57, 102, 103,
157583
+ /* 940 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 236,
157584
+ /* 950 */ 237, 12, 191, 250, 76, 250, 191, 22, 23, 308,
157585
+ /* 960 */ 309, 26, 249, 202, 191, 191, 27, 89, 191, 202,
157586
+ /* 970 */ 92, 202, 260, 80, 213, 214, 101, 203, 213, 214,
157587
+ /* 980 */ 22, 42, 102, 103, 104, 105, 106, 107, 108, 109,
157588
+ /* 990 */ 110, 111, 112, 228, 158, 281, 108, 236, 237, 225,
157589
+ /* 1000 */ 191, 227, 63, 236, 237, 236, 237, 191, 235, 191,
157590
+ /* 1010 */ 249, 250, 73, 241, 19, 122, 249, 59, 249, 24,
157591
+ /* 1020 */ 259, 29, 134, 251, 191, 33, 22, 139, 24, 213,
157592
+ /* 1030 */ 214, 213, 214, 191, 19, 210, 101, 191, 43, 44,
157593
+ /* 1040 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
157594
+ /* 1050 */ 55, 56, 57, 160, 19, 213, 214, 65, 43, 44,
157595
+ /* 1060 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
157596
+ /* 1070 */ 55, 56, 57, 191, 116, 22, 191, 24, 43, 44,
157597
+ /* 1080 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
157598
+ /* 1090 */ 55, 56, 57, 191, 261, 213, 214, 102, 103, 104,
157599
+ /* 1100 */ 105, 106, 107, 108, 109, 110, 111, 112, 59, 19,
157600
+ /* 1110 */ 191, 265, 59, 288, 191, 213, 214, 102, 103, 104,
157601
+ /* 1120 */ 105, 106, 107, 108, 109, 110, 111, 112, 35, 191,
157602
+ /* 1130 */ 66, 191, 213, 214, 191, 270, 46, 102, 103, 104,
157603
+ /* 1140 */ 105, 106, 107, 108, 109, 110, 111, 112, 191, 85,
157604
+ /* 1150 */ 265, 213, 214, 213, 214, 106, 107, 19, 94, 66,
157605
+ /* 1160 */ 137, 138, 191, 114, 115, 116, 117, 74, 119, 116,
157606
+ /* 1170 */ 213, 214, 202, 308, 309, 306, 127, 191, 235, 310,
157607
+ /* 1180 */ 59, 191, 44, 45, 46, 47, 48, 49, 50, 51,
157608
+ /* 1190 */ 52, 53, 54, 55, 56, 57, 191, 76, 196, 213,
157609
+ /* 1200 */ 214, 152, 12, 154, 114, 191, 236, 237, 87, 145,
157610
+ /* 1210 */ 89, 19, 20, 92, 22, 22, 23, 27, 191, 249,
157611
+ /* 1220 */ 130, 202, 129, 202, 191, 235, 306, 152, 36, 154,
157612
+ /* 1230 */ 310, 191, 42, 191, 191, 191, 115, 116, 117, 191,
157613
+ /* 1240 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157614
+ /* 1250 */ 112, 59, 99, 63, 191, 236, 237, 236, 237, 191,
157615
+ /* 1260 */ 289, 213, 214, 71, 191, 144, 261, 191, 249, 191,
157616
+ /* 1270 */ 249, 19, 20, 81, 22, 235, 213, 214, 235, 191,
157617
+ /* 1280 */ 278, 213, 214, 191, 282, 132, 213, 214, 36, 213,
157618
+ /* 1290 */ 214, 191, 100, 191, 101, 191, 191, 191, 106, 107,
157619
+ /* 1300 */ 48, 213, 214, 261, 191, 113, 191, 115, 116, 117,
157620
+ /* 1310 */ 191, 59, 120, 213, 214, 213, 214, 213, 214, 213,
157621
+ /* 1320 */ 214, 22, 23, 71, 237, 59, 213, 214, 191, 137,
157622
+ /* 1330 */ 138, 191, 213, 214, 191, 191, 249, 85, 191, 261,
157623
+ /* 1340 */ 191, 26, 90, 15, 152, 153, 154, 155, 156, 19,
157624
+ /* 1350 */ 213, 214, 100, 213, 214, 191, 213, 214, 106, 107,
157625
+ /* 1360 */ 213, 214, 213, 214, 191, 113, 261, 115, 116, 117,
157626
+ /* 1370 */ 253, 254, 120, 229, 191, 191, 191, 213, 214, 191,
157627
+ /* 1380 */ 306, 289, 116, 26, 310, 191, 213, 214, 60, 19,
157628
+ /* 1390 */ 296, 297, 24, 191, 46, 191, 213, 214, 213, 214,
157629
+ /* 1400 */ 101, 213, 214, 191, 152, 153, 154, 155, 156, 0,
157630
+ /* 1410 */ 1, 2, 191, 229, 5, 213, 214, 213, 214, 10,
157631
+ /* 1420 */ 11, 12, 13, 14, 1, 2, 17, 191, 5, 19,
157632
+ /* 1430 */ 20, 191, 22, 10, 11, 12, 13, 14, 191, 30,
157633
+ /* 1440 */ 17, 32, 241, 148, 149, 115, 36, 191, 241, 40,
157634
+ /* 1450 */ 191, 26, 251, 30, 191, 32, 141, 22, 251, 5,
157635
+ /* 1460 */ 213, 214, 114, 40, 10, 11, 12, 13, 14, 59,
157636
+ /* 1470 */ 134, 17, 213, 214, 191, 139, 213, 214, 191, 70,
157637
+ /* 1480 */ 191, 71, 125, 191, 30, 115, 32, 78, 53, 191,
157638
+ /* 1490 */ 81, 191, 191, 70, 40, 85, 213, 214, 191, 22,
157639
+ /* 1500 */ 90, 78, 213, 214, 81, 213, 214, 98, 140, 120,
157640
+ /* 1510 */ 100, 213, 214, 213, 214, 23, 106, 107, 26, 130,
157641
+ /* 1520 */ 191, 98, 191, 113, 70, 115, 116, 117, 23, 22,
157642
+ /* 1530 */ 120, 26, 78, 19, 191, 81, 19, 20, 61, 22,
157643
+ /* 1540 */ 191, 132, 213, 214, 213, 214, 137, 138, 59, 191,
157644
+ /* 1550 */ 191, 191, 98, 36, 128, 132, 213, 214, 128, 59,
157645
+ /* 1560 */ 137, 138, 152, 153, 154, 155, 156, 83, 84, 144,
157646
+ /* 1570 */ 161, 213, 214, 213, 214, 23, 59, 151, 26, 23,
157647
+ /* 1580 */ 23, 151, 26, 26, 161, 59, 132, 23, 71, 191,
157648
+ /* 1590 */ 26, 137, 138, 119, 120, 23, 19, 20, 26, 22,
157649
+ /* 1600 */ 223, 23, 85, 23, 26, 116, 26, 90, 191, 7,
157650
+ /* 1610 */ 8, 97, 152, 36, 154, 161, 116, 100, 23, 23,
157651
+ /* 1620 */ 191, 26, 26, 106, 107, 191, 23, 223, 23, 26,
157652
+ /* 1630 */ 113, 26, 115, 116, 117, 23, 59, 120, 26, 191,
157653
+ /* 1640 */ 191, 191, 116, 255, 191, 252, 191, 140, 71, 191,
157654
+ /* 1650 */ 315, 233, 191, 191, 191, 191, 191, 191, 191, 191,
157655
+ /* 1660 */ 191, 285, 284, 239, 252, 252, 252, 252, 240, 152,
157656
+ /* 1670 */ 153, 154, 155, 156, 189, 294, 268, 100, 242, 268,
157657
+ /* 1680 */ 264, 211, 290, 106, 107, 108, 264, 256, 256, 243,
157658
+ /* 1690 */ 113, 290, 115, 116, 117, 268, 217, 120, 226, 243,
157659
+ /* 1700 */ 222, 268, 216, 19, 20, 246, 22, 216, 256, 216,
157660
+ /* 1710 */ 194, 60, 38, 242, 277, 294, 240, 242, 198, 246,
157661
+ /* 1720 */ 36, 140, 198, 198, 19, 20, 150, 22, 149, 152,
157662
+ /* 1730 */ 153, 154, 155, 156, 294, 291, 291, 280, 22, 43,
157663
+ /* 1740 */ 231, 36, 18, 59, 234, 234, 234, 234, 267, 269,
157664
+ /* 1750 */ 18, 198, 197, 231, 148, 71, 269, 269, 243, 231,
157665
+ /* 1760 */ 198, 243, 267, 197, 59, 157, 243, 198, 62, 287,
157666
+ /* 1770 */ 243, 197, 22, 198, 114, 64, 71, 218, 218, 197,
157667
+ /* 1780 */ 286, 198, 197, 215, 100, 215, 215, 224, 22, 125,
157668
+ /* 1790 */ 106, 107, 164, 24, 221, 112, 143, 113, 302, 115,
157669
+ /* 1800 */ 116, 117, 218, 215, 120, 100, 217, 221, 215, 215,
157670
+ /* 1810 */ 309, 106, 107, 215, 224, 279, 279, 218, 113, 258,
157671
+ /* 1820 */ 115, 116, 117, 114, 257, 120, 91, 198, 82, 147,
157672
+ /* 1830 */ 144, 22, 274, 314, 198, 314, 152, 153, 154, 155,
157673
+ /* 1840 */ 156, 276, 157, 146, 145, 258, 25, 247, 257, 201,
157674
+ /* 1850 */ 258, 26, 200, 13, 257, 244, 246, 152, 153, 154,
157675
+ /* 1860 */ 155, 156, 258, 262, 257, 247, 245, 243, 192, 192,
157676
+ /* 1870 */ 6, 262, 204, 210, 219, 210, 210, 190, 190, 190,
157677
+ /* 1880 */ 210, 219, 204, 211, 211, 210, 4, 3, 22, 162,
157678
+ /* 1890 */ 15, 23, 16, 23, 204, 138, 129, 150, 26, 141,
157679
+ /* 1900 */ 20, 24, 143, 16, 1, 141, 129, 129, 61, 53,
157680
+ /* 1910 */ 37, 150, 297, 300, 300, 53, 53, 129, 53, 115,
157681
+ /* 1920 */ 34, 140, 1, 5, 22, 114, 68, 26, 160, 68,
157682
+ /* 1930 */ 75, 41, 140, 114, 24, 20, 19, 130, 124, 23,
157683
+ /* 1940 */ 96, 22, 22, 37, 22, 67, 22, 59, 67, 24,
157684
+ /* 1950 */ 22, 28, 67, 23, 148, 22, 97, 23, 23, 23,
157685
+ /* 1960 */ 140, 23, 22, 26, 23, 23, 115, 22, 142, 26,
157686
+ /* 1970 */ 75, 88, 75, 34, 23, 86, 44, 22, 34, 26,
157687
+ /* 1980 */ 34, 34, 34, 34, 93, 24, 26, 23, 34, 23,
157688
+ /* 1990 */ 23, 23, 23, 11, 23, 22, 26, 22, 22, 15,
157689
+ /* 2000 */ 23, 23, 22, 22, 1, 26, 23, 140, 134, 140,
157690
+ /* 2010 */ 1, 140, 316, 316, 316, 316, 316, 316, 316, 140,
157691
+ /* 2020 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157692
+ /* 2030 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157693
+ /* 2040 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157694
+ /* 2050 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157695
+ /* 2060 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157696
+ /* 2070 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157697
+ /* 2080 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157698
+ /* 2090 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157699
+ /* 2100 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157700
+ /* 2110 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157701
+ /* 2120 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157702
+ /* 2130 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157703
+ /* 2140 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157704
+ /* 2150 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157705
+ /* 2160 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157706
+ /* 2170 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157707
+ /* 2180 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157708
+ /* 2190 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157709
+ /* 2200 */ 316, 316, 316,
157710
+};
157711
+#define YY_SHIFT_COUNT (569)
157265157712
#define YY_SHIFT_MIN (0)
157266
-#define YY_SHIFT_MAX (2005)
157713
+#define YY_SHIFT_MAX (2009)
157267157714
static const unsigned short int yy_shift_ofst[] = {
157268
- /* 0 */ 1579, 1434, 1856, 1206, 1206, 1, 1278, 1391, 1463, 1672,
157269
- /* 10 */ 1672, 1672, 390, 0, 0, 180, 1008, 1672, 1672, 1672,
157270
- /* 20 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672,
157271
- /* 30 */ 794, 794, 287, 287, 250, 611, 1, 1, 1, 1,
157272
- /* 40 */ 1, 1, 40, 110, 219, 288, 394, 437, 506, 545,
157273
- /* 50 */ 614, 653, 722, 761, 830, 988, 1008, 1008, 1008, 1008,
157274
- /* 60 */ 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008,
157275
- /* 70 */ 1008, 1008, 1008, 1008, 1028, 1008, 1130, 1150, 1150, 1566,
157276
- /* 80 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672,
157277
- /* 90 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672,
157278
- /* 100 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672,
157279
- /* 110 */ 1672, 1672, 1672, 1672, 1740, 1672, 1672, 1672, 1672, 1672,
157280
- /* 120 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 147, 248,
157281
- /* 130 */ 248, 248, 248, 248, 79, 86, 185, 573, 771, 896,
157282
- /* 140 */ 573, 530, 530, 573, 877, 877, 877, 877, 295, 475,
157283
- /* 150 */ 475, 584, 29, 2017, 2017, 289, 289, 289, 58, 508,
157284
- /* 160 */ 62, 508, 508, 508, 392, 392, 225, 395, 218, 822,
157285
- /* 170 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
157286
- /* 180 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
157287
- /* 190 */ 573, 1074, 1074, 573, 119, 1187, 1187, 1044, 1044, 1145,
157288
- /* 200 */ 1146, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 418, 263,
157289
- /* 210 */ 263, 559, 303, 618, 527, 623, 464, 570, 780, 573,
157290
- /* 220 */ 573, 573, 573, 573, 573, 573, 573, 573, 669, 573,
157291
- /* 230 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
157292
- /* 240 */ 573, 245, 245, 245, 573, 573, 573, 573, 985, 573,
157293
- /* 250 */ 573, 573, 18, 1076, 573, 573, 1131, 573, 573, 573,
157294
- /* 260 */ 573, 573, 573, 573, 573, 941, 1092, 770, 903, 903,
157295
- /* 270 */ 903, 903, 1203, 770, 770, 1085, 692, 1144, 1319, 1168,
157296
- /* 280 */ 1227, 1321, 1308, 1227, 1308, 1397, 593, 1168, 1168, 593,
157297
- /* 290 */ 1168, 1321, 1397, 1328, 15, 1310, 1265, 1265, 1265, 1308,
157298
- /* 300 */ 1324, 1324, 863, 1325, 492, 1390, 1615, 1538, 1538, 1646,
157299
- /* 310 */ 1646, 1538, 1540, 1539, 1674, 1657, 1683, 1683, 1683, 1683,
157300
- /* 320 */ 1538, 1695, 1575, 1539, 1539, 1575, 1674, 1657, 1575, 1657,
157301
- /* 330 */ 1575, 1538, 1695, 1578, 1673, 1538, 1695, 1714, 1538, 1695,
157302
- /* 340 */ 1538, 1695, 1714, 1637, 1637, 1637, 1688, 1731, 1731, 1714,
157303
- /* 350 */ 1637, 1631, 1637, 1688, 1637, 1637, 1595, 1714, 1650, 1650,
157304
- /* 360 */ 1714, 1625, 1662, 1625, 1662, 1625, 1662, 1625, 1662, 1538,
157305
- /* 370 */ 1701, 1701, 1711, 1711, 1649, 1654, 1776, 1538, 1647, 1649,
157306
- /* 380 */ 1659, 1658, 1575, 1780, 1781, 1796, 1796, 1825, 1825, 1825,
157307
- /* 390 */ 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
157308
- /* 400 */ 2017, 2017, 2017, 2017, 2017, 339, 445, 1064, 1193, 951,
157309
- /* 410 */ 1029, 1256, 1383, 1402, 1396, 1292, 1327, 1437, 727, 1447,
157310
- /* 420 */ 1461, 1466, 1472, 1495, 1502, 1184, 1307, 1450, 1340, 1421,
157311
- /* 430 */ 1506, 1514, 1436, 1515, 1349, 1401, 1534, 1535, 1480, 1471,
157312
- /* 440 */ 1844, 1846, 1831, 1696, 1845, 1764, 1847, 1841, 1842, 1734,
157313
- /* 450 */ 1725, 1747, 1852, 1852, 1855, 1741, 1860, 1742, 1866, 1882,
157314
- /* 460 */ 1745, 1759, 1852, 1761, 1829, 1861, 1852, 1748, 1848, 1849,
157315
- /* 470 */ 1850, 1851, 1771, 1786, 1871, 1767, 1906, 1903, 1887, 1797,
157316
- /* 480 */ 1752, 1853, 1886, 1854, 1838, 1873, 1777, 1802, 1893, 1898,
157317
- /* 490 */ 1900, 1791, 1800, 1902, 1858, 1905, 1907, 1908, 1910, 1863,
157318
- /* 500 */ 1869, 1909, 1839, 1911, 1914, 1874, 1901, 1917, 1795, 1921,
157319
- /* 510 */ 1922, 1923, 1924, 1918, 1925, 1927, 1926, 1928, 1930, 1931,
157320
- /* 520 */ 1815, 1933, 1934, 1857, 1929, 1936, 1818, 1935, 1932, 1938,
157321
- /* 530 */ 1939, 1940, 1872, 1889, 1876, 1937, 1890, 1875, 1941, 1944,
157322
- /* 540 */ 1947, 1946, 1950, 1951, 1945, 1955, 1935, 1957, 1959, 1960,
157323
- /* 550 */ 1961, 1962, 1963, 1967, 1974, 1968, 1969, 1971, 1972, 1975,
157324
- /* 560 */ 1976, 1970, 1867, 1862, 1864, 1865, 1868, 1979, 1984, 2004,
157325
- /* 570 */ 2005,
157326
-};
157327
-#define YY_REDUCE_COUNT (404)
157328
-#define YY_REDUCE_MIN (-262)
157329
-#define YY_REDUCE_MAX (1655)
157715
+ /* 0 */ 1423, 1409, 1454, 1192, 1192, 36, 1252, 1410, 1517, 1684,
157716
+ /* 10 */ 1684, 1684, 292, 0, 0, 180, 1015, 1684, 1684, 1684,
157717
+ /* 20 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
157718
+ /* 30 */ 1049, 1049, 1121, 1121, 54, 400, 36, 36, 36, 36,
157719
+ /* 40 */ 36, 40, 110, 219, 289, 396, 439, 509, 548, 618,
157720
+ /* 50 */ 657, 727, 766, 836, 995, 1015, 1015, 1015, 1015, 1015,
157721
+ /* 60 */ 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,
157722
+ /* 70 */ 1015, 1015, 1015, 1035, 1015, 1138, 880, 880, 1577, 1684,
157723
+ /* 80 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
157724
+ /* 90 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
157725
+ /* 100 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
157726
+ /* 110 */ 1684, 1684, 1684, 1705, 1684, 1684, 1684, 1684, 1684, 1684,
157727
+ /* 120 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 146, 84, 84,
157728
+ /* 130 */ 84, 84, 84, 362, 269, 125, 97, 453, 66, 66,
157729
+ /* 140 */ 893, 1090, 66, 66, 533, 533, 66, 554, 554, 554,
157730
+ /* 150 */ 554, 192, 587, 587, 695, 25, 2020, 2020, 290, 290,
157731
+ /* 160 */ 290, 200, 514, 514, 514, 514, 939, 939, 442, 875,
157732
+ /* 170 */ 935, 66, 66, 66, 66, 66, 66, 66, 66, 66,
157733
+ /* 180 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
157734
+ /* 190 */ 66, 601, 601, 66, 729, 878, 878, 1266, 1266, 552,
157735
+ /* 200 */ 1023, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 307, 490,
157736
+ /* 210 */ 490, 567, 393, 517, 467, 672, 242, 682, 675, 66,
157737
+ /* 220 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 616,
157738
+ /* 230 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
157739
+ /* 240 */ 66, 66, 1093, 1093, 1093, 66, 66, 66, 778, 66,
157740
+ /* 250 */ 66, 66, 1053, 1064, 66, 66, 1190, 66, 66, 66,
157741
+ /* 260 */ 66, 66, 66, 66, 66, 722, 992, 718, 253, 253,
157742
+ /* 270 */ 253, 253, 338, 718, 718, 888, 403, 852, 1328, 254,
157743
+ /* 280 */ 1295, 721, 1330, 1295, 1330, 1370, 234, 254, 254, 234,
157744
+ /* 290 */ 254, 721, 1370, 1357, 1492, 1348, 385, 385, 385, 1330,
157745
+ /* 300 */ 1425, 1425, 643, 1315, 1336, 1004, 1651, 1651, 1581, 1581,
157746
+ /* 310 */ 1674, 1674, 1581, 1576, 1579, 1716, 1696, 1724, 1724, 1724,
157747
+ /* 320 */ 1724, 1581, 1732, 1606, 1579, 1579, 1606, 1716, 1696, 1606,
157748
+ /* 330 */ 1696, 1606, 1581, 1732, 1608, 1706, 1581, 1732, 1750, 1581,
157749
+ /* 340 */ 1732, 1581, 1732, 1750, 1660, 1660, 1660, 1711, 1766, 1766,
157750
+ /* 350 */ 1750, 1660, 1664, 1660, 1711, 1660, 1660, 1628, 1769, 1683,
157751
+ /* 360 */ 1683, 1750, 1653, 1709, 1653, 1709, 1653, 1709, 1653, 1709,
157752
+ /* 370 */ 1581, 1735, 1735, 1746, 1746, 1682, 1686, 1809, 1581, 1685,
157753
+ /* 380 */ 1682, 1697, 1699, 1606, 1821, 1825, 1840, 1840, 1864, 1864,
157754
+ /* 390 */ 1864, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020,
157755
+ /* 400 */ 2020, 2020, 2020, 2020, 2020, 2020, 599, 223, 1193, 1299,
157756
+ /* 410 */ 228, 780, 958, 1505, 1153, 1435, 1368, 1426, 1430, 1552,
157757
+ /* 420 */ 1477, 1556, 1557, 1564, 1572, 1578, 1580, 1489, 1474, 1602,
157758
+ /* 430 */ 1389, 1514, 1500, 1595, 1596, 1484, 1603, 1075, 1460, 1605,
157759
+ /* 440 */ 1612, 1526, 1507, 1882, 1884, 1866, 1727, 1875, 1876, 1868,
157760
+ /* 450 */ 1870, 1757, 1747, 1767, 1872, 1872, 1877, 1758, 1880, 1759,
157761
+ /* 460 */ 1887, 1903, 1764, 1777, 1872, 1778, 1847, 1873, 1872, 1761,
157762
+ /* 470 */ 1856, 1862, 1863, 1865, 1788, 1804, 1886, 1781, 1921, 1918,
157763
+ /* 480 */ 1902, 1811, 1768, 1858, 1901, 1861, 1855, 1890, 1792, 1819,
157764
+ /* 490 */ 1910, 1915, 1917, 1807, 1814, 1919, 1878, 1920, 1922, 1916,
157765
+ /* 500 */ 1924, 1881, 1888, 1925, 1844, 1923, 1928, 1885, 1906, 1930,
157766
+ /* 510 */ 1806, 1933, 1934, 1935, 1936, 1937, 1938, 1940, 1859, 1820,
157767
+ /* 520 */ 1941, 1942, 1851, 1939, 1945, 1826, 1943, 1944, 1946, 1947,
157768
+ /* 530 */ 1948, 1883, 1895, 1889, 1932, 1897, 1891, 1949, 1951, 1955,
157769
+ /* 540 */ 1961, 1953, 1960, 1954, 1964, 1943, 1966, 1967, 1968, 1969,
157770
+ /* 550 */ 1970, 1971, 1973, 1982, 1975, 1976, 1977, 1978, 1980, 1981,
157771
+ /* 560 */ 1979, 1874, 1867, 1869, 1871, 1879, 1983, 1984, 2003, 2009,
157772
+};
157773
+#define YY_REDUCE_COUNT (405)
157774
+#define YY_REDUCE_MIN (-265)
157775
+#define YY_REDUCE_MAX (1690)
157330157776
static const short yy_reduce_ofst[] = {
157331
- /* 0 */ 599, -123, 272, 716, 756, -121, -190, -188, -185, -183,
157332
- /* 10 */ -179, -177, -26, 304, 313, -254, -11, 500, 609, 630,
157333
- /* 20 */ 758, -114, 763, 766, 323, 538, 768, 87, 540, 701,
157334
- /* 30 */ -38, 413, 125, 324, 699, 443, 602, 725, 748, 753,
157335
- /* 40 */ 762, 781, -262, -262, -262, -262, -262, -262, -262, -262,
157336
- /* 50 */ -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,
157337
- /* 60 */ -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,
157338
- /* 70 */ -262, -262, -262, -262, -262, -262, -262, -262, -262, 262,
157339
- /* 80 */ 731, 787, 836, 915, 932, 934, 977, 998, 1001, 1032,
157340
- /* 90 */ 1034, 1037, 1058, 1072, 1077, 1079, 1082, 1090, 1096, 1111,
157341
- /* 100 */ 1116, 1120, 1123, 1127, 1140, 1174, 1176, 1183, 1186, 1188,
157342
- /* 110 */ 1190, 1192, 1195, 1225, 1228, 1259, 1266, 1296, 1301, 1304,
157343
- /* 120 */ 1311, 1337, 1343, 1361, 1386, 1393, 1411, 1414, -262, -262,
157344
- /* 130 */ -262, -262, -262, -262, -262, -262, -262, -176, 825, 249,
157345
- /* 140 */ -22, 648, 652, 108, 112, 767, 112, 767, 637, 717,
157346
- /* 150 */ 835, -262, -262, -262, -262, -207, -207, -207, 126, -164,
157347
- /* 160 */ -170, 416, 708, 856, -158, 504, 74, -169, 446, 446,
157348
- /* 170 */ -187, 328, 700, 707, 239, 282, 331, 556, 721, 438,
157349
- /* 180 */ 193, 860, 322, 541, 880, 933, 975, 241, 651, 879,
157350
- /* 190 */ 970, 270, 905, 918, 88, 914, 961, 967, 1069, -39,
157351
- /* 200 */ 604, 1050, 1091, 1098, 1115, 1122, 1117, 1141, -211, -206,
157352
- /* 210 */ -180, -130, -161, 10, 179, 236, 316, 341, 629, 726,
157353
- /* 220 */ 804, 816, 834, 898, 972, 1177, 1231, 1238, 170, 1253,
157354
- /* 230 */ 1263, 1285, 1298, 1336, 1357, 1369, 1373, 1374, 1376, 1377,
157355
- /* 240 */ 1382, 240, 257, 1053, 1407, 1410, 1413, 1417, 1012, 1422,
157356
- /* 250 */ 1423, 1430, 1166, 1156, 1418, 1431, 1355, 1432, 179, 1438,
157357
- /* 260 */ 1439, 1440, 1441, 1442, 1443, 1246, 1351, 1398, 1384, 1387,
157358
- /* 270 */ 1388, 1389, 1012, 1398, 1398, 1403, 1433, 1453, 1352, 1379,
157359
- /* 280 */ 1381, 1406, 1395, 1385, 1399, 1362, 1416, 1392, 1394, 1420,
157360
- /* 290 */ 1400, 1412, 1363, 1448, 1444, 1435, 1451, 1455, 1459, 1408,
157361
- /* 300 */ 1445, 1452, 1419, 1427, 1449, 1462, 1405, 1482, 1486, 1409,
157362
- /* 310 */ 1415, 1489, 1424, 1425, 1446, 1474, 1469, 1473, 1476, 1478,
157363
- /* 320 */ 1510, 1518, 1481, 1456, 1457, 1484, 1464, 1497, 1487, 1498,
157364
- /* 330 */ 1490, 1536, 1541, 1454, 1460, 1544, 1542, 1525, 1547, 1550,
157365
- /* 340 */ 1551, 1553, 1530, 1537, 1543, 1549, 1531, 1545, 1546, 1552,
157366
- /* 350 */ 1554, 1548, 1556, 1533, 1558, 1559, 1468, 1562, 1503, 1504,
157367
- /* 360 */ 1563, 1526, 1529, 1532, 1557, 1555, 1560, 1561, 1564, 1593,
157368
- /* 370 */ 1483, 1485, 1567, 1568, 1569, 1565, 1527, 1604, 1572, 1571,
157369
- /* 380 */ 1570, 1576, 1580, 1606, 1609, 1630, 1639, 1643, 1644, 1645,
157370
- /* 390 */ 1573, 1577, 1581, 1632, 1627, 1628, 1629, 1633, 1638, 1622,
157371
- /* 400 */ 1626, 1640, 1641, 1634, 1655,
157777
+ /* 0 */ 111, 168, 386, 761, -176, -174, -191, -189, -181, -178,
157778
+ /* 10 */ 176, 263, 44, -207, -204, -265, -139, -114, 158, 504,
157779
+ /* 20 */ 525, 544, 612, 614, 650, 652, 765, 265, 703, 705,
157780
+ /* 30 */ 70, 714, -187, 127, 774, 713, 767, 769, 970, 1019,
157781
+ /* 40 */ 1021, -255, -255, -255, -255, -255, -255, -255, -255, -255,
157782
+ /* 50 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
157783
+ /* 60 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
157784
+ /* 70 */ -255, -255, -255, -255, -255, -255, -255, -255, 394, 542,
157785
+ /* 80 */ 816, 818, 842, 882, 902, 919, 938, 940, 957, 986,
157786
+ /* 90 */ 1048, 1063, 1068, 1073, 1076, 1088, 1100, 1102, 1104, 1106,
157787
+ /* 100 */ 1113, 1119, 1137, 1140, 1143, 1147, 1149, 1164, 1173, 1183,
157788
+ /* 110 */ 1185, 1188, 1202, 1204, 1247, 1259, 1263, 1283, 1289, 1292,
157789
+ /* 120 */ 1298, 1300, 1329, 1331, 1343, 1358, 1360, -255, -255, -255,
157790
+ /* 130 */ -255, -255, -255, -255, -255, 196, -255, 387, -177, 507,
157791
+ /* 140 */ 1002, -219, 557, -93, -167, 638, -121, 284, 500, 284,
157792
+ /* 150 */ 500, 247, 651, 865, -255, -255, -255, -255, -85, -85,
157793
+ /* 160 */ -85, 237, 171, 602, 846, 885, -212, -203, 217, 380,
157794
+ /* 170 */ 380, -23, 161, 653, 712, 773, 943, 990, 1040, 563,
157795
+ /* 180 */ 833, 971, 1005, 1042, 1092, 1078, 1043, 1144, 1184, -186,
157796
+ /* 190 */ 1105, 318, 869, 7, 825, 920, 1074, 704, 706, 390,
157797
+ /* 200 */ 1087, 1094, 336, 545, 772, 1201, 1117, 1207, -179, -137,
157798
+ /* 210 */ -112, -13, 18, 112, 197, 418, 495, 508, 777, 809,
157799
+ /* 220 */ 923, 1014, 1027, 1033, 1044, 1115, 1194, 1212, 1221, 209,
157800
+ /* 230 */ 1236, 1240, 1256, 1287, 1301, 1307, 1349, 1359, 1398, 1417,
157801
+ /* 240 */ 1429, 1434, 681, 1377, 1404, 1448, 1449, 1450, 1388, 1453,
157802
+ /* 250 */ 1455, 1458, 1393, 1335, 1461, 1462, 1418, 1463, 197, 1464,
157803
+ /* 260 */ 1465, 1466, 1467, 1468, 1469, 1376, 1378, 1424, 1412, 1413,
157804
+ /* 270 */ 1414, 1415, 1388, 1424, 1424, 1428, 1470, 1485, 1381, 1408,
157805
+ /* 280 */ 1416, 1436, 1431, 1422, 1432, 1392, 1446, 1411, 1427, 1456,
157806
+ /* 290 */ 1433, 1471, 1401, 1479, 1472, 1478, 1486, 1491, 1493, 1452,
157807
+ /* 300 */ 1459, 1473, 1437, 1475, 1476, 1516, 1421, 1440, 1520, 1524,
157808
+ /* 310 */ 1444, 1445, 1525, 1457, 1480, 1481, 1509, 1510, 1511, 1512,
157809
+ /* 320 */ 1513, 1553, 1555, 1515, 1487, 1488, 1518, 1495, 1522, 1523,
157810
+ /* 330 */ 1528, 1527, 1562, 1566, 1482, 1494, 1569, 1574, 1559, 1575,
157811
+ /* 340 */ 1582, 1583, 1585, 1560, 1568, 1570, 1571, 1563, 1573, 1586,
157812
+ /* 350 */ 1584, 1588, 1589, 1593, 1590, 1594, 1598, 1501, 1496, 1536,
157813
+ /* 360 */ 1537, 1599, 1561, 1567, 1587, 1591, 1592, 1597, 1604, 1607,
157814
+ /* 370 */ 1629, 1519, 1521, 1601, 1609, 1600, 1610, 1558, 1636, 1565,
157815
+ /* 380 */ 1618, 1621, 1611, 1624, 1648, 1652, 1676, 1677, 1687, 1688,
157816
+ /* 390 */ 1689, 1613, 1614, 1615, 1668, 1663, 1665, 1666, 1670, 1678,
157817
+ /* 400 */ 1655, 1662, 1672, 1673, 1675, 1690,
157372157818
};
157373157819
static const YYACTIONTYPE yy_default[] = {
157374
- /* 0 */ 1610, 1610, 1610, 1445, 1215, 1324, 1215, 1215, 1215, 1445,
157375
- /* 10 */ 1445, 1445, 1215, 1354, 1354, 1498, 1246, 1215, 1215, 1215,
157376
- /* 20 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1444, 1215, 1215,
157377
- /* 30 */ 1215, 1215, 1528, 1528, 1215, 1215, 1215, 1215, 1215, 1215,
157378
- /* 40 */ 1215, 1215, 1215, 1363, 1215, 1370, 1215, 1215, 1215, 1215,
157379
- /* 50 */ 1215, 1446, 1447, 1215, 1215, 1215, 1497, 1499, 1462, 1377,
157380
- /* 60 */ 1376, 1375, 1374, 1480, 1341, 1368, 1361, 1365, 1440, 1441,
157381
- /* 70 */ 1439, 1443, 1447, 1446, 1215, 1364, 1411, 1425, 1410, 1215,
157382
- /* 80 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157383
- /* 90 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157384
- /* 100 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157385
- /* 110 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157386
- /* 120 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1419, 1424,
157387
- /* 130 */ 1430, 1423, 1420, 1413, 1412, 1414, 1415, 1215, 1236, 1288,
157388
- /* 140 */ 1215, 1215, 1215, 1215, 1516, 1515, 1215, 1215, 1246, 1405,
157389
- /* 150 */ 1404, 1416, 1417, 1427, 1426, 1505, 1563, 1562, 1463, 1215,
157390
- /* 160 */ 1215, 1215, 1215, 1215, 1215, 1215, 1528, 1215, 1215, 1215,
157391
- /* 170 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157392
- /* 180 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157393
- /* 190 */ 1215, 1528, 1528, 1215, 1246, 1528, 1528, 1242, 1242, 1348,
157394
- /* 200 */ 1215, 1511, 1315, 1315, 1315, 1315, 1324, 1315, 1215, 1215,
157395
- /* 210 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157396
- /* 220 */ 1215, 1215, 1502, 1500, 1215, 1215, 1215, 1215, 1215, 1215,
157397
- /* 230 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157398
- /* 240 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157399
- /* 250 */ 1215, 1215, 1320, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157400
- /* 260 */ 1215, 1215, 1215, 1215, 1557, 1215, 1475, 1302, 1320, 1320,
157401
- /* 270 */ 1320, 1320, 1322, 1303, 1301, 1314, 1247, 1222, 1602, 1380,
157402
- /* 280 */ 1369, 1321, 1343, 1369, 1343, 1599, 1367, 1380, 1380, 1367,
157403
- /* 290 */ 1380, 1321, 1599, 1263, 1579, 1258, 1354, 1354, 1354, 1343,
157404
- /* 300 */ 1348, 1348, 1442, 1321, 1314, 1215, 1602, 1329, 1329, 1601,
157405
- /* 310 */ 1601, 1329, 1463, 1586, 1389, 1291, 1297, 1297, 1297, 1297,
157406
- /* 320 */ 1329, 1233, 1367, 1586, 1586, 1367, 1389, 1291, 1367, 1291,
157407
- /* 330 */ 1367, 1329, 1233, 1479, 1596, 1329, 1233, 1453, 1329, 1233,
157408
- /* 340 */ 1329, 1233, 1453, 1289, 1289, 1289, 1278, 1215, 1215, 1453,
157409
- /* 350 */ 1289, 1263, 1289, 1278, 1289, 1289, 1546, 1453, 1457, 1457,
157410
- /* 360 */ 1453, 1347, 1342, 1347, 1342, 1347, 1342, 1347, 1342, 1329,
157411
- /* 370 */ 1538, 1538, 1357, 1357, 1362, 1348, 1448, 1329, 1215, 1362,
157412
- /* 380 */ 1360, 1358, 1367, 1239, 1281, 1560, 1560, 1556, 1556, 1556,
157413
- /* 390 */ 1607, 1607, 1511, 1572, 1246, 1246, 1246, 1246, 1572, 1265,
157414
- /* 400 */ 1265, 1247, 1247, 1246, 1572, 1215, 1215, 1215, 1215, 1215,
157415
- /* 410 */ 1215, 1567, 1215, 1464, 1333, 1215, 1215, 1215, 1215, 1215,
157416
- /* 420 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157417
- /* 430 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1394,
157418
- /* 440 */ 1215, 1218, 1508, 1215, 1215, 1506, 1215, 1215, 1215, 1215,
157419
- /* 450 */ 1215, 1215, 1371, 1372, 1334, 1215, 1215, 1215, 1215, 1215,
157420
- /* 460 */ 1215, 1215, 1386, 1215, 1215, 1215, 1381, 1215, 1215, 1215,
157421
- /* 470 */ 1215, 1215, 1215, 1215, 1215, 1598, 1215, 1215, 1215, 1215,
157422
- /* 480 */ 1215, 1215, 1478, 1477, 1215, 1215, 1331, 1215, 1215, 1215,
157423
- /* 490 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157424
- /* 500 */ 1261, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157425
- /* 510 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157426
- /* 520 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1359, 1215, 1215,
157427
- /* 530 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157428
- /* 540 */ 1215, 1215, 1543, 1349, 1215, 1215, 1589, 1215, 1215, 1215,
157429
- /* 550 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157430
- /* 560 */ 1215, 1583, 1305, 1396, 1215, 1395, 1399, 1215, 1227, 1215,
157431
- /* 570 */ 1215,
157820
+ /* 0 */ 1623, 1623, 1623, 1453, 1223, 1332, 1223, 1223, 1223, 1453,
157821
+ /* 10 */ 1453, 1453, 1223, 1362, 1362, 1506, 1254, 1223, 1223, 1223,
157822
+ /* 20 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1452, 1223, 1223,
157823
+ /* 30 */ 1223, 1223, 1541, 1541, 1223, 1223, 1223, 1223, 1223, 1223,
157824
+ /* 40 */ 1223, 1223, 1371, 1223, 1378, 1223, 1223, 1223, 1223, 1223,
157825
+ /* 50 */ 1454, 1455, 1223, 1223, 1223, 1505, 1507, 1470, 1385, 1384,
157826
+ /* 60 */ 1383, 1382, 1488, 1349, 1376, 1369, 1373, 1448, 1449, 1447,
157827
+ /* 70 */ 1451, 1455, 1454, 1223, 1372, 1419, 1433, 1418, 1223, 1223,
157828
+ /* 80 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157829
+ /* 90 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157830
+ /* 100 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157831
+ /* 110 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157832
+ /* 120 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1427, 1432, 1438,
157833
+ /* 130 */ 1431, 1428, 1421, 1420, 1422, 1223, 1423, 1223, 1223, 1223,
157834
+ /* 140 */ 1244, 1296, 1223, 1223, 1223, 1223, 1223, 1525, 1524, 1223,
157835
+ /* 150 */ 1223, 1254, 1413, 1412, 1424, 1425, 1435, 1434, 1513, 1576,
157836
+ /* 160 */ 1575, 1471, 1223, 1223, 1223, 1223, 1223, 1223, 1541, 1223,
157837
+ /* 170 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157838
+ /* 180 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157839
+ /* 190 */ 1223, 1541, 1541, 1223, 1254, 1541, 1541, 1250, 1250, 1356,
157840
+ /* 200 */ 1223, 1520, 1323, 1323, 1323, 1323, 1332, 1323, 1223, 1223,
157841
+ /* 210 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157842
+ /* 220 */ 1223, 1223, 1223, 1510, 1508, 1223, 1223, 1223, 1223, 1223,
157843
+ /* 230 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157844
+ /* 240 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157845
+ /* 250 */ 1223, 1223, 1328, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157846
+ /* 260 */ 1223, 1223, 1223, 1223, 1570, 1223, 1483, 1310, 1328, 1328,
157847
+ /* 270 */ 1328, 1328, 1330, 1311, 1309, 1322, 1255, 1230, 1615, 1388,
157848
+ /* 280 */ 1377, 1329, 1351, 1377, 1351, 1612, 1375, 1388, 1388, 1375,
157849
+ /* 290 */ 1388, 1329, 1612, 1271, 1592, 1266, 1362, 1362, 1362, 1351,
157850
+ /* 300 */ 1356, 1356, 1450, 1329, 1322, 1223, 1615, 1615, 1337, 1337,
157851
+ /* 310 */ 1614, 1614, 1337, 1471, 1599, 1397, 1299, 1305, 1305, 1305,
157852
+ /* 320 */ 1305, 1337, 1241, 1375, 1599, 1599, 1375, 1397, 1299, 1375,
157853
+ /* 330 */ 1299, 1375, 1337, 1241, 1487, 1609, 1337, 1241, 1461, 1337,
157854
+ /* 340 */ 1241, 1337, 1241, 1461, 1297, 1297, 1297, 1286, 1223, 1223,
157855
+ /* 350 */ 1461, 1297, 1271, 1297, 1286, 1297, 1297, 1559, 1223, 1465,
157856
+ /* 360 */ 1465, 1461, 1355, 1350, 1355, 1350, 1355, 1350, 1355, 1350,
157857
+ /* 370 */ 1337, 1551, 1551, 1365, 1365, 1370, 1356, 1456, 1337, 1223,
157858
+ /* 380 */ 1370, 1368, 1366, 1375, 1247, 1289, 1573, 1573, 1569, 1569,
157859
+ /* 390 */ 1569, 1620, 1620, 1520, 1585, 1254, 1254, 1254, 1254, 1585,
157860
+ /* 400 */ 1273, 1273, 1255, 1255, 1254, 1585, 1223, 1223, 1223, 1223,
157861
+ /* 410 */ 1223, 1223, 1580, 1223, 1515, 1472, 1341, 1223, 1223, 1223,
157862
+ /* 420 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157863
+ /* 430 */ 1223, 1526, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157864
+ /* 440 */ 1223, 1223, 1402, 1223, 1226, 1517, 1223, 1223, 1223, 1223,
157865
+ /* 450 */ 1223, 1223, 1223, 1223, 1379, 1380, 1342, 1223, 1223, 1223,
157866
+ /* 460 */ 1223, 1223, 1223, 1223, 1394, 1223, 1223, 1223, 1389, 1223,
157867
+ /* 470 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1611, 1223, 1223,
157868
+ /* 480 */ 1223, 1223, 1223, 1223, 1486, 1485, 1223, 1223, 1339, 1223,
157869
+ /* 490 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157870
+ /* 500 */ 1223, 1223, 1269, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157871
+ /* 510 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157872
+ /* 520 */ 1223, 1223, 1223, 1223, 1223, 1223, 1367, 1223, 1223, 1223,
157873
+ /* 530 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157874
+ /* 540 */ 1223, 1556, 1357, 1223, 1223, 1602, 1223, 1223, 1223, 1223,
157875
+ /* 550 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157876
+ /* 560 */ 1596, 1313, 1404, 1223, 1403, 1407, 1223, 1235, 1223, 1223,
157432157877
};
157433157878
/********** End of lemon-generated parsing tables *****************************/
157434157879
157435157880
/* The next table maps tokens (terminal symbols) into fallback tokens.
157436157881
** If a construct like the following:
@@ -157543,10 +157988,11 @@
157543157988
59, /* GROUPS => ID */
157544157989
59, /* OTHERS => ID */
157545157990
59, /* TIES => ID */
157546157991
59, /* GENERATED => ID */
157547157992
59, /* ALWAYS => ID */
157993
+ 59, /* MATERIALIZED => ID */
157548157994
59, /* REINDEX => ID */
157549157995
59, /* RENAME => ID */
157550157996
59, /* CTIME_KW => ID */
157551157997
0, /* ANY => nothing */
157552157998
0, /* BITAND => nothing */
@@ -157813,226 +158259,229 @@
157813158259
/* 92 */ "GROUPS",
157814158260
/* 93 */ "OTHERS",
157815158261
/* 94 */ "TIES",
157816158262
/* 95 */ "GENERATED",
157817158263
/* 96 */ "ALWAYS",
157818
- /* 97 */ "REINDEX",
157819
- /* 98 */ "RENAME",
157820
- /* 99 */ "CTIME_KW",
157821
- /* 100 */ "ANY",
157822
- /* 101 */ "BITAND",
157823
- /* 102 */ "BITOR",
157824
- /* 103 */ "LSHIFT",
157825
- /* 104 */ "RSHIFT",
157826
- /* 105 */ "PLUS",
157827
- /* 106 */ "MINUS",
157828
- /* 107 */ "STAR",
157829
- /* 108 */ "SLASH",
157830
- /* 109 */ "REM",
157831
- /* 110 */ "CONCAT",
157832
- /* 111 */ "COLLATE",
157833
- /* 112 */ "BITNOT",
157834
- /* 113 */ "ON",
157835
- /* 114 */ "INDEXED",
157836
- /* 115 */ "STRING",
157837
- /* 116 */ "JOIN_KW",
157838
- /* 117 */ "CONSTRAINT",
157839
- /* 118 */ "DEFAULT",
157840
- /* 119 */ "NULL",
157841
- /* 120 */ "PRIMARY",
157842
- /* 121 */ "UNIQUE",
157843
- /* 122 */ "CHECK",
157844
- /* 123 */ "REFERENCES",
157845
- /* 124 */ "AUTOINCR",
157846
- /* 125 */ "INSERT",
157847
- /* 126 */ "DELETE",
157848
- /* 127 */ "UPDATE",
157849
- /* 128 */ "SET",
157850
- /* 129 */ "DEFERRABLE",
157851
- /* 130 */ "FOREIGN",
157852
- /* 131 */ "DROP",
157853
- /* 132 */ "UNION",
157854
- /* 133 */ "ALL",
157855
- /* 134 */ "EXCEPT",
157856
- /* 135 */ "INTERSECT",
157857
- /* 136 */ "SELECT",
157858
- /* 137 */ "VALUES",
157859
- /* 138 */ "DISTINCT",
157860
- /* 139 */ "DOT",
157861
- /* 140 */ "FROM",
157862
- /* 141 */ "JOIN",
157863
- /* 142 */ "USING",
157864
- /* 143 */ "ORDER",
157865
- /* 144 */ "GROUP",
157866
- /* 145 */ "HAVING",
157867
- /* 146 */ "LIMIT",
157868
- /* 147 */ "WHERE",
157869
- /* 148 */ "RETURNING",
157870
- /* 149 */ "INTO",
157871
- /* 150 */ "NOTHING",
157872
- /* 151 */ "FLOAT",
157873
- /* 152 */ "BLOB",
157874
- /* 153 */ "INTEGER",
157875
- /* 154 */ "VARIABLE",
157876
- /* 155 */ "CASE",
157877
- /* 156 */ "WHEN",
157878
- /* 157 */ "THEN",
157879
- /* 158 */ "ELSE",
157880
- /* 159 */ "INDEX",
157881
- /* 160 */ "ALTER",
157882
- /* 161 */ "ADD",
157883
- /* 162 */ "WINDOW",
157884
- /* 163 */ "OVER",
157885
- /* 164 */ "FILTER",
157886
- /* 165 */ "COLUMN",
157887
- /* 166 */ "AGG_FUNCTION",
157888
- /* 167 */ "AGG_COLUMN",
157889
- /* 168 */ "TRUEFALSE",
157890
- /* 169 */ "ISNOT",
157891
- /* 170 */ "FUNCTION",
157892
- /* 171 */ "UMINUS",
157893
- /* 172 */ "UPLUS",
157894
- /* 173 */ "TRUTH",
157895
- /* 174 */ "REGISTER",
157896
- /* 175 */ "VECTOR",
157897
- /* 176 */ "SELECT_COLUMN",
157898
- /* 177 */ "IF_NULL_ROW",
157899
- /* 178 */ "ASTERISK",
157900
- /* 179 */ "SPAN",
157901
- /* 180 */ "SPACE",
157902
- /* 181 */ "ILLEGAL",
157903
- /* 182 */ "input",
157904
- /* 183 */ "cmdlist",
157905
- /* 184 */ "ecmd",
157906
- /* 185 */ "cmdx",
157907
- /* 186 */ "explain",
157908
- /* 187 */ "cmd",
157909
- /* 188 */ "transtype",
157910
- /* 189 */ "trans_opt",
157911
- /* 190 */ "nm",
157912
- /* 191 */ "savepoint_opt",
157913
- /* 192 */ "create_table",
157914
- /* 193 */ "create_table_args",
157915
- /* 194 */ "createkw",
157916
- /* 195 */ "temp",
157917
- /* 196 */ "ifnotexists",
157918
- /* 197 */ "dbnm",
157919
- /* 198 */ "columnlist",
157920
- /* 199 */ "conslist_opt",
157921
- /* 200 */ "table_options",
157922
- /* 201 */ "select",
157923
- /* 202 */ "columnname",
157924
- /* 203 */ "carglist",
157925
- /* 204 */ "typetoken",
157926
- /* 205 */ "typename",
157927
- /* 206 */ "signed",
157928
- /* 207 */ "plus_num",
157929
- /* 208 */ "minus_num",
157930
- /* 209 */ "scanpt",
157931
- /* 210 */ "scantok",
157932
- /* 211 */ "ccons",
157933
- /* 212 */ "term",
157934
- /* 213 */ "expr",
157935
- /* 214 */ "onconf",
157936
- /* 215 */ "sortorder",
157937
- /* 216 */ "autoinc",
157938
- /* 217 */ "eidlist_opt",
157939
- /* 218 */ "refargs",
157940
- /* 219 */ "defer_subclause",
157941
- /* 220 */ "generated",
157942
- /* 221 */ "refarg",
157943
- /* 222 */ "refact",
157944
- /* 223 */ "init_deferred_pred_opt",
157945
- /* 224 */ "conslist",
157946
- /* 225 */ "tconscomma",
157947
- /* 226 */ "tcons",
157948
- /* 227 */ "sortlist",
157949
- /* 228 */ "eidlist",
157950
- /* 229 */ "defer_subclause_opt",
157951
- /* 230 */ "orconf",
157952
- /* 231 */ "resolvetype",
157953
- /* 232 */ "raisetype",
157954
- /* 233 */ "ifexists",
157955
- /* 234 */ "fullname",
157956
- /* 235 */ "selectnowith",
157957
- /* 236 */ "oneselect",
157958
- /* 237 */ "wqlist",
157959
- /* 238 */ "multiselect_op",
157960
- /* 239 */ "distinct",
157961
- /* 240 */ "selcollist",
157962
- /* 241 */ "from",
157963
- /* 242 */ "where_opt",
157964
- /* 243 */ "groupby_opt",
157965
- /* 244 */ "having_opt",
157966
- /* 245 */ "orderby_opt",
157967
- /* 246 */ "limit_opt",
157968
- /* 247 */ "window_clause",
157969
- /* 248 */ "values",
157970
- /* 249 */ "nexprlist",
157971
- /* 250 */ "sclp",
157972
- /* 251 */ "as",
157973
- /* 252 */ "seltablist",
157974
- /* 253 */ "stl_prefix",
157975
- /* 254 */ "joinop",
157976
- /* 255 */ "indexed_opt",
157977
- /* 256 */ "on_opt",
157978
- /* 257 */ "using_opt",
157979
- /* 258 */ "exprlist",
157980
- /* 259 */ "xfullname",
157981
- /* 260 */ "idlist",
157982
- /* 261 */ "nulls",
157983
- /* 262 */ "with",
157984
- /* 263 */ "where_opt_ret",
157985
- /* 264 */ "setlist",
157986
- /* 265 */ "insert_cmd",
157987
- /* 266 */ "idlist_opt",
157988
- /* 267 */ "upsert",
157989
- /* 268 */ "returning",
157990
- /* 269 */ "filter_over",
157991
- /* 270 */ "likeop",
157992
- /* 271 */ "between_op",
157993
- /* 272 */ "in_op",
157994
- /* 273 */ "paren_exprlist",
157995
- /* 274 */ "case_operand",
157996
- /* 275 */ "case_exprlist",
157997
- /* 276 */ "case_else",
157998
- /* 277 */ "uniqueflag",
157999
- /* 278 */ "collate",
158000
- /* 279 */ "vinto",
158001
- /* 280 */ "nmnum",
158002
- /* 281 */ "trigger_decl",
158003
- /* 282 */ "trigger_cmd_list",
158004
- /* 283 */ "trigger_time",
158005
- /* 284 */ "trigger_event",
158006
- /* 285 */ "foreach_clause",
158007
- /* 286 */ "when_clause",
158008
- /* 287 */ "trigger_cmd",
158009
- /* 288 */ "trnm",
158010
- /* 289 */ "tridxby",
158011
- /* 290 */ "database_kw_opt",
158012
- /* 291 */ "key_opt",
158013
- /* 292 */ "add_column_fullname",
158014
- /* 293 */ "kwcolumn_opt",
158015
- /* 294 */ "create_vtab",
158016
- /* 295 */ "vtabarglist",
158017
- /* 296 */ "vtabarg",
158018
- /* 297 */ "vtabargtoken",
158019
- /* 298 */ "lp",
158020
- /* 299 */ "anylist",
158021
- /* 300 */ "windowdefn_list",
158022
- /* 301 */ "windowdefn",
158023
- /* 302 */ "window",
158024
- /* 303 */ "frame_opt",
158025
- /* 304 */ "part_opt",
158026
- /* 305 */ "filter_clause",
158027
- /* 306 */ "over_clause",
158028
- /* 307 */ "range_or_rows",
158029
- /* 308 */ "frame_bound",
158030
- /* 309 */ "frame_bound_s",
158031
- /* 310 */ "frame_bound_e",
158032
- /* 311 */ "frame_exclude_opt",
158033
- /* 312 */ "frame_exclude",
158264
+ /* 97 */ "MATERIALIZED",
158265
+ /* 98 */ "REINDEX",
158266
+ /* 99 */ "RENAME",
158267
+ /* 100 */ "CTIME_KW",
158268
+ /* 101 */ "ANY",
158269
+ /* 102 */ "BITAND",
158270
+ /* 103 */ "BITOR",
158271
+ /* 104 */ "LSHIFT",
158272
+ /* 105 */ "RSHIFT",
158273
+ /* 106 */ "PLUS",
158274
+ /* 107 */ "MINUS",
158275
+ /* 108 */ "STAR",
158276
+ /* 109 */ "SLASH",
158277
+ /* 110 */ "REM",
158278
+ /* 111 */ "CONCAT",
158279
+ /* 112 */ "COLLATE",
158280
+ /* 113 */ "BITNOT",
158281
+ /* 114 */ "ON",
158282
+ /* 115 */ "INDEXED",
158283
+ /* 116 */ "STRING",
158284
+ /* 117 */ "JOIN_KW",
158285
+ /* 118 */ "CONSTRAINT",
158286
+ /* 119 */ "DEFAULT",
158287
+ /* 120 */ "NULL",
158288
+ /* 121 */ "PRIMARY",
158289
+ /* 122 */ "UNIQUE",
158290
+ /* 123 */ "CHECK",
158291
+ /* 124 */ "REFERENCES",
158292
+ /* 125 */ "AUTOINCR",
158293
+ /* 126 */ "INSERT",
158294
+ /* 127 */ "DELETE",
158295
+ /* 128 */ "UPDATE",
158296
+ /* 129 */ "SET",
158297
+ /* 130 */ "DEFERRABLE",
158298
+ /* 131 */ "FOREIGN",
158299
+ /* 132 */ "DROP",
158300
+ /* 133 */ "UNION",
158301
+ /* 134 */ "ALL",
158302
+ /* 135 */ "EXCEPT",
158303
+ /* 136 */ "INTERSECT",
158304
+ /* 137 */ "SELECT",
158305
+ /* 138 */ "VALUES",
158306
+ /* 139 */ "DISTINCT",
158307
+ /* 140 */ "DOT",
158308
+ /* 141 */ "FROM",
158309
+ /* 142 */ "JOIN",
158310
+ /* 143 */ "USING",
158311
+ /* 144 */ "ORDER",
158312
+ /* 145 */ "GROUP",
158313
+ /* 146 */ "HAVING",
158314
+ /* 147 */ "LIMIT",
158315
+ /* 148 */ "WHERE",
158316
+ /* 149 */ "RETURNING",
158317
+ /* 150 */ "INTO",
158318
+ /* 151 */ "NOTHING",
158319
+ /* 152 */ "FLOAT",
158320
+ /* 153 */ "BLOB",
158321
+ /* 154 */ "INTEGER",
158322
+ /* 155 */ "VARIABLE",
158323
+ /* 156 */ "CASE",
158324
+ /* 157 */ "WHEN",
158325
+ /* 158 */ "THEN",
158326
+ /* 159 */ "ELSE",
158327
+ /* 160 */ "INDEX",
158328
+ /* 161 */ "ALTER",
158329
+ /* 162 */ "ADD",
158330
+ /* 163 */ "WINDOW",
158331
+ /* 164 */ "OVER",
158332
+ /* 165 */ "FILTER",
158333
+ /* 166 */ "COLUMN",
158334
+ /* 167 */ "AGG_FUNCTION",
158335
+ /* 168 */ "AGG_COLUMN",
158336
+ /* 169 */ "TRUEFALSE",
158337
+ /* 170 */ "ISNOT",
158338
+ /* 171 */ "FUNCTION",
158339
+ /* 172 */ "UMINUS",
158340
+ /* 173 */ "UPLUS",
158341
+ /* 174 */ "TRUTH",
158342
+ /* 175 */ "REGISTER",
158343
+ /* 176 */ "VECTOR",
158344
+ /* 177 */ "SELECT_COLUMN",
158345
+ /* 178 */ "IF_NULL_ROW",
158346
+ /* 179 */ "ASTERISK",
158347
+ /* 180 */ "SPAN",
158348
+ /* 181 */ "SPACE",
158349
+ /* 182 */ "ILLEGAL",
158350
+ /* 183 */ "input",
158351
+ /* 184 */ "cmdlist",
158352
+ /* 185 */ "ecmd",
158353
+ /* 186 */ "cmdx",
158354
+ /* 187 */ "explain",
158355
+ /* 188 */ "cmd",
158356
+ /* 189 */ "transtype",
158357
+ /* 190 */ "trans_opt",
158358
+ /* 191 */ "nm",
158359
+ /* 192 */ "savepoint_opt",
158360
+ /* 193 */ "create_table",
158361
+ /* 194 */ "create_table_args",
158362
+ /* 195 */ "createkw",
158363
+ /* 196 */ "temp",
158364
+ /* 197 */ "ifnotexists",
158365
+ /* 198 */ "dbnm",
158366
+ /* 199 */ "columnlist",
158367
+ /* 200 */ "conslist_opt",
158368
+ /* 201 */ "table_options",
158369
+ /* 202 */ "select",
158370
+ /* 203 */ "columnname",
158371
+ /* 204 */ "carglist",
158372
+ /* 205 */ "typetoken",
158373
+ /* 206 */ "typename",
158374
+ /* 207 */ "signed",
158375
+ /* 208 */ "plus_num",
158376
+ /* 209 */ "minus_num",
158377
+ /* 210 */ "scanpt",
158378
+ /* 211 */ "scantok",
158379
+ /* 212 */ "ccons",
158380
+ /* 213 */ "term",
158381
+ /* 214 */ "expr",
158382
+ /* 215 */ "onconf",
158383
+ /* 216 */ "sortorder",
158384
+ /* 217 */ "autoinc",
158385
+ /* 218 */ "eidlist_opt",
158386
+ /* 219 */ "refargs",
158387
+ /* 220 */ "defer_subclause",
158388
+ /* 221 */ "generated",
158389
+ /* 222 */ "refarg",
158390
+ /* 223 */ "refact",
158391
+ /* 224 */ "init_deferred_pred_opt",
158392
+ /* 225 */ "conslist",
158393
+ /* 226 */ "tconscomma",
158394
+ /* 227 */ "tcons",
158395
+ /* 228 */ "sortlist",
158396
+ /* 229 */ "eidlist",
158397
+ /* 230 */ "defer_subclause_opt",
158398
+ /* 231 */ "orconf",
158399
+ /* 232 */ "resolvetype",
158400
+ /* 233 */ "raisetype",
158401
+ /* 234 */ "ifexists",
158402
+ /* 235 */ "fullname",
158403
+ /* 236 */ "selectnowith",
158404
+ /* 237 */ "oneselect",
158405
+ /* 238 */ "wqlist",
158406
+ /* 239 */ "multiselect_op",
158407
+ /* 240 */ "distinct",
158408
+ /* 241 */ "selcollist",
158409
+ /* 242 */ "from",
158410
+ /* 243 */ "where_opt",
158411
+ /* 244 */ "groupby_opt",
158412
+ /* 245 */ "having_opt",
158413
+ /* 246 */ "orderby_opt",
158414
+ /* 247 */ "limit_opt",
158415
+ /* 248 */ "window_clause",
158416
+ /* 249 */ "values",
158417
+ /* 250 */ "nexprlist",
158418
+ /* 251 */ "sclp",
158419
+ /* 252 */ "as",
158420
+ /* 253 */ "seltablist",
158421
+ /* 254 */ "stl_prefix",
158422
+ /* 255 */ "joinop",
158423
+ /* 256 */ "indexed_opt",
158424
+ /* 257 */ "on_opt",
158425
+ /* 258 */ "using_opt",
158426
+ /* 259 */ "exprlist",
158427
+ /* 260 */ "xfullname",
158428
+ /* 261 */ "idlist",
158429
+ /* 262 */ "nulls",
158430
+ /* 263 */ "with",
158431
+ /* 264 */ "where_opt_ret",
158432
+ /* 265 */ "setlist",
158433
+ /* 266 */ "insert_cmd",
158434
+ /* 267 */ "idlist_opt",
158435
+ /* 268 */ "upsert",
158436
+ /* 269 */ "returning",
158437
+ /* 270 */ "filter_over",
158438
+ /* 271 */ "likeop",
158439
+ /* 272 */ "between_op",
158440
+ /* 273 */ "in_op",
158441
+ /* 274 */ "paren_exprlist",
158442
+ /* 275 */ "case_operand",
158443
+ /* 276 */ "case_exprlist",
158444
+ /* 277 */ "case_else",
158445
+ /* 278 */ "uniqueflag",
158446
+ /* 279 */ "collate",
158447
+ /* 280 */ "vinto",
158448
+ /* 281 */ "nmnum",
158449
+ /* 282 */ "trigger_decl",
158450
+ /* 283 */ "trigger_cmd_list",
158451
+ /* 284 */ "trigger_time",
158452
+ /* 285 */ "trigger_event",
158453
+ /* 286 */ "foreach_clause",
158454
+ /* 287 */ "when_clause",
158455
+ /* 288 */ "trigger_cmd",
158456
+ /* 289 */ "trnm",
158457
+ /* 290 */ "tridxby",
158458
+ /* 291 */ "database_kw_opt",
158459
+ /* 292 */ "key_opt",
158460
+ /* 293 */ "add_column_fullname",
158461
+ /* 294 */ "kwcolumn_opt",
158462
+ /* 295 */ "create_vtab",
158463
+ /* 296 */ "vtabarglist",
158464
+ /* 297 */ "vtabarg",
158465
+ /* 298 */ "vtabargtoken",
158466
+ /* 299 */ "lp",
158467
+ /* 300 */ "anylist",
158468
+ /* 301 */ "wqitem",
158469
+ /* 302 */ "wqas",
158470
+ /* 303 */ "windowdefn_list",
158471
+ /* 304 */ "windowdefn",
158472
+ /* 305 */ "window",
158473
+ /* 306 */ "frame_opt",
158474
+ /* 307 */ "part_opt",
158475
+ /* 308 */ "filter_clause",
158476
+ /* 309 */ "over_clause",
158477
+ /* 310 */ "range_or_rows",
158478
+ /* 311 */ "frame_bound",
158479
+ /* 312 */ "frame_bound_s",
158480
+ /* 313 */ "frame_bound_e",
158481
+ /* 314 */ "frame_exclude_opt",
158482
+ /* 315 */ "frame_exclude",
158034158483
};
158035158484
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
158036158485
158037158486
#ifndef NDEBUG
158038158487
/* For tracing reduce actions, the names of all rules are required.
@@ -158324,115 +158773,120 @@
158324158773
/* 283 */ "cmd ::= REINDEX nm dbnm",
158325158774
/* 284 */ "cmd ::= ANALYZE",
158326158775
/* 285 */ "cmd ::= ANALYZE nm dbnm",
158327158776
/* 286 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
158328158777
/* 287 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
158329
- /* 288 */ "add_column_fullname ::= fullname",
158330
- /* 289 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
158331
- /* 290 */ "cmd ::= create_vtab",
158332
- /* 291 */ "cmd ::= create_vtab LP vtabarglist RP",
158333
- /* 292 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
158334
- /* 293 */ "vtabarg ::=",
158335
- /* 294 */ "vtabargtoken ::= ANY",
158336
- /* 295 */ "vtabargtoken ::= lp anylist RP",
158337
- /* 296 */ "lp ::= LP",
158338
- /* 297 */ "with ::= WITH wqlist",
158339
- /* 298 */ "with ::= WITH RECURSIVE wqlist",
158340
- /* 299 */ "wqlist ::= nm eidlist_opt AS LP select RP",
158341
- /* 300 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
158342
- /* 301 */ "windowdefn_list ::= windowdefn",
158343
- /* 302 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
158344
- /* 303 */ "windowdefn ::= nm AS LP window RP",
158345
- /* 304 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
158346
- /* 305 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
158347
- /* 306 */ "window ::= ORDER BY sortlist frame_opt",
158348
- /* 307 */ "window ::= nm ORDER BY sortlist frame_opt",
158349
- /* 308 */ "window ::= frame_opt",
158350
- /* 309 */ "window ::= nm frame_opt",
158351
- /* 310 */ "frame_opt ::=",
158352
- /* 311 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
158353
- /* 312 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
158354
- /* 313 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
158355
- /* 314 */ "frame_bound_s ::= frame_bound",
158356
- /* 315 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
158357
- /* 316 */ "frame_bound_e ::= frame_bound",
158358
- /* 317 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
158359
- /* 318 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
158360
- /* 319 */ "frame_bound ::= CURRENT ROW",
158361
- /* 320 */ "frame_exclude_opt ::=",
158362
- /* 321 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
158363
- /* 322 */ "frame_exclude ::= NO OTHERS",
158364
- /* 323 */ "frame_exclude ::= CURRENT ROW",
158365
- /* 324 */ "frame_exclude ::= GROUP|TIES",
158366
- /* 325 */ "window_clause ::= WINDOW windowdefn_list",
158367
- /* 326 */ "filter_over ::= filter_clause over_clause",
158368
- /* 327 */ "filter_over ::= over_clause",
158369
- /* 328 */ "filter_over ::= filter_clause",
158370
- /* 329 */ "over_clause ::= OVER LP window RP",
158371
- /* 330 */ "over_clause ::= OVER nm",
158372
- /* 331 */ "filter_clause ::= FILTER LP WHERE expr RP",
158373
- /* 332 */ "input ::= cmdlist",
158374
- /* 333 */ "cmdlist ::= cmdlist ecmd",
158375
- /* 334 */ "cmdlist ::= ecmd",
158376
- /* 335 */ "ecmd ::= SEMI",
158377
- /* 336 */ "ecmd ::= cmdx SEMI",
158378
- /* 337 */ "ecmd ::= explain cmdx SEMI",
158379
- /* 338 */ "trans_opt ::=",
158380
- /* 339 */ "trans_opt ::= TRANSACTION",
158381
- /* 340 */ "trans_opt ::= TRANSACTION nm",
158382
- /* 341 */ "savepoint_opt ::= SAVEPOINT",
158383
- /* 342 */ "savepoint_opt ::=",
158384
- /* 343 */ "cmd ::= create_table create_table_args",
158385
- /* 344 */ "columnlist ::= columnlist COMMA columnname carglist",
158386
- /* 345 */ "columnlist ::= columnname carglist",
158387
- /* 346 */ "nm ::= ID|INDEXED",
158388
- /* 347 */ "nm ::= STRING",
158389
- /* 348 */ "nm ::= JOIN_KW",
158390
- /* 349 */ "typetoken ::= typename",
158391
- /* 350 */ "typename ::= ID|STRING",
158392
- /* 351 */ "signed ::= plus_num",
158393
- /* 352 */ "signed ::= minus_num",
158394
- /* 353 */ "carglist ::= carglist ccons",
158395
- /* 354 */ "carglist ::=",
158396
- /* 355 */ "ccons ::= NULL onconf",
158397
- /* 356 */ "ccons ::= GENERATED ALWAYS AS generated",
158398
- /* 357 */ "ccons ::= AS generated",
158399
- /* 358 */ "conslist_opt ::= COMMA conslist",
158400
- /* 359 */ "conslist ::= conslist tconscomma tcons",
158401
- /* 360 */ "conslist ::= tcons",
158402
- /* 361 */ "tconscomma ::=",
158403
- /* 362 */ "defer_subclause_opt ::= defer_subclause",
158404
- /* 363 */ "resolvetype ::= raisetype",
158405
- /* 364 */ "selectnowith ::= oneselect",
158406
- /* 365 */ "oneselect ::= values",
158407
- /* 366 */ "sclp ::= selcollist COMMA",
158408
- /* 367 */ "as ::= ID|STRING",
158409
- /* 368 */ "returning ::=",
158410
- /* 369 */ "expr ::= term",
158411
- /* 370 */ "likeop ::= LIKE_KW|MATCH",
158412
- /* 371 */ "exprlist ::= nexprlist",
158413
- /* 372 */ "nmnum ::= plus_num",
158414
- /* 373 */ "nmnum ::= nm",
158415
- /* 374 */ "nmnum ::= ON",
158416
- /* 375 */ "nmnum ::= DELETE",
158417
- /* 376 */ "nmnum ::= DEFAULT",
158418
- /* 377 */ "plus_num ::= INTEGER|FLOAT",
158419
- /* 378 */ "foreach_clause ::=",
158420
- /* 379 */ "foreach_clause ::= FOR EACH ROW",
158421
- /* 380 */ "trnm ::= nm",
158422
- /* 381 */ "tridxby ::=",
158423
- /* 382 */ "database_kw_opt ::= DATABASE",
158424
- /* 383 */ "database_kw_opt ::=",
158425
- /* 384 */ "kwcolumn_opt ::=",
158426
- /* 385 */ "kwcolumn_opt ::= COLUMNKW",
158427
- /* 386 */ "vtabarglist ::= vtabarg",
158428
- /* 387 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
158429
- /* 388 */ "vtabarg ::= vtabarg vtabargtoken",
158430
- /* 389 */ "anylist ::=",
158431
- /* 390 */ "anylist ::= anylist LP anylist RP",
158432
- /* 391 */ "anylist ::= anylist ANY",
158433
- /* 392 */ "with ::=",
158778
+ /* 288 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
158779
+ /* 289 */ "add_column_fullname ::= fullname",
158780
+ /* 290 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
158781
+ /* 291 */ "cmd ::= create_vtab",
158782
+ /* 292 */ "cmd ::= create_vtab LP vtabarglist RP",
158783
+ /* 293 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
158784
+ /* 294 */ "vtabarg ::=",
158785
+ /* 295 */ "vtabargtoken ::= ANY",
158786
+ /* 296 */ "vtabargtoken ::= lp anylist RP",
158787
+ /* 297 */ "lp ::= LP",
158788
+ /* 298 */ "with ::= WITH wqlist",
158789
+ /* 299 */ "with ::= WITH RECURSIVE wqlist",
158790
+ /* 300 */ "wqas ::= AS",
158791
+ /* 301 */ "wqas ::= AS MATERIALIZED",
158792
+ /* 302 */ "wqas ::= AS NOT MATERIALIZED",
158793
+ /* 303 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
158794
+ /* 304 */ "wqlist ::= wqitem",
158795
+ /* 305 */ "wqlist ::= wqlist COMMA wqitem",
158796
+ /* 306 */ "windowdefn_list ::= windowdefn",
158797
+ /* 307 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
158798
+ /* 308 */ "windowdefn ::= nm AS LP window RP",
158799
+ /* 309 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
158800
+ /* 310 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
158801
+ /* 311 */ "window ::= ORDER BY sortlist frame_opt",
158802
+ /* 312 */ "window ::= nm ORDER BY sortlist frame_opt",
158803
+ /* 313 */ "window ::= frame_opt",
158804
+ /* 314 */ "window ::= nm frame_opt",
158805
+ /* 315 */ "frame_opt ::=",
158806
+ /* 316 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
158807
+ /* 317 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
158808
+ /* 318 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
158809
+ /* 319 */ "frame_bound_s ::= frame_bound",
158810
+ /* 320 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
158811
+ /* 321 */ "frame_bound_e ::= frame_bound",
158812
+ /* 322 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
158813
+ /* 323 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
158814
+ /* 324 */ "frame_bound ::= CURRENT ROW",
158815
+ /* 325 */ "frame_exclude_opt ::=",
158816
+ /* 326 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
158817
+ /* 327 */ "frame_exclude ::= NO OTHERS",
158818
+ /* 328 */ "frame_exclude ::= CURRENT ROW",
158819
+ /* 329 */ "frame_exclude ::= GROUP|TIES",
158820
+ /* 330 */ "window_clause ::= WINDOW windowdefn_list",
158821
+ /* 331 */ "filter_over ::= filter_clause over_clause",
158822
+ /* 332 */ "filter_over ::= over_clause",
158823
+ /* 333 */ "filter_over ::= filter_clause",
158824
+ /* 334 */ "over_clause ::= OVER LP window RP",
158825
+ /* 335 */ "over_clause ::= OVER nm",
158826
+ /* 336 */ "filter_clause ::= FILTER LP WHERE expr RP",
158827
+ /* 337 */ "input ::= cmdlist",
158828
+ /* 338 */ "cmdlist ::= cmdlist ecmd",
158829
+ /* 339 */ "cmdlist ::= ecmd",
158830
+ /* 340 */ "ecmd ::= SEMI",
158831
+ /* 341 */ "ecmd ::= cmdx SEMI",
158832
+ /* 342 */ "ecmd ::= explain cmdx SEMI",
158833
+ /* 343 */ "trans_opt ::=",
158834
+ /* 344 */ "trans_opt ::= TRANSACTION",
158835
+ /* 345 */ "trans_opt ::= TRANSACTION nm",
158836
+ /* 346 */ "savepoint_opt ::= SAVEPOINT",
158837
+ /* 347 */ "savepoint_opt ::=",
158838
+ /* 348 */ "cmd ::= create_table create_table_args",
158839
+ /* 349 */ "columnlist ::= columnlist COMMA columnname carglist",
158840
+ /* 350 */ "columnlist ::= columnname carglist",
158841
+ /* 351 */ "nm ::= ID|INDEXED",
158842
+ /* 352 */ "nm ::= STRING",
158843
+ /* 353 */ "nm ::= JOIN_KW",
158844
+ /* 354 */ "typetoken ::= typename",
158845
+ /* 355 */ "typename ::= ID|STRING",
158846
+ /* 356 */ "signed ::= plus_num",
158847
+ /* 357 */ "signed ::= minus_num",
158848
+ /* 358 */ "carglist ::= carglist ccons",
158849
+ /* 359 */ "carglist ::=",
158850
+ /* 360 */ "ccons ::= NULL onconf",
158851
+ /* 361 */ "ccons ::= GENERATED ALWAYS AS generated",
158852
+ /* 362 */ "ccons ::= AS generated",
158853
+ /* 363 */ "conslist_opt ::= COMMA conslist",
158854
+ /* 364 */ "conslist ::= conslist tconscomma tcons",
158855
+ /* 365 */ "conslist ::= tcons",
158856
+ /* 366 */ "tconscomma ::=",
158857
+ /* 367 */ "defer_subclause_opt ::= defer_subclause",
158858
+ /* 368 */ "resolvetype ::= raisetype",
158859
+ /* 369 */ "selectnowith ::= oneselect",
158860
+ /* 370 */ "oneselect ::= values",
158861
+ /* 371 */ "sclp ::= selcollist COMMA",
158862
+ /* 372 */ "as ::= ID|STRING",
158863
+ /* 373 */ "returning ::=",
158864
+ /* 374 */ "expr ::= term",
158865
+ /* 375 */ "likeop ::= LIKE_KW|MATCH",
158866
+ /* 376 */ "exprlist ::= nexprlist",
158867
+ /* 377 */ "nmnum ::= plus_num",
158868
+ /* 378 */ "nmnum ::= nm",
158869
+ /* 379 */ "nmnum ::= ON",
158870
+ /* 380 */ "nmnum ::= DELETE",
158871
+ /* 381 */ "nmnum ::= DEFAULT",
158872
+ /* 382 */ "plus_num ::= INTEGER|FLOAT",
158873
+ /* 383 */ "foreach_clause ::=",
158874
+ /* 384 */ "foreach_clause ::= FOR EACH ROW",
158875
+ /* 385 */ "trnm ::= nm",
158876
+ /* 386 */ "tridxby ::=",
158877
+ /* 387 */ "database_kw_opt ::= DATABASE",
158878
+ /* 388 */ "database_kw_opt ::=",
158879
+ /* 389 */ "kwcolumn_opt ::=",
158880
+ /* 390 */ "kwcolumn_opt ::= COLUMNKW",
158881
+ /* 391 */ "vtabarglist ::= vtabarg",
158882
+ /* 392 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
158883
+ /* 393 */ "vtabarg ::= vtabarg vtabargtoken",
158884
+ /* 394 */ "anylist ::=",
158885
+ /* 395 */ "anylist ::= anylist LP anylist RP",
158886
+ /* 396 */ "anylist ::= anylist ANY",
158887
+ /* 397 */ "with ::=",
158434158888
};
158435158889
#endif /* NDEBUG */
158436158890
158437158891
158438158892
#if YYSTACKDEPTH<=0
@@ -158554,103 +159008,103 @@
158554159008
** Note: during a reduce, the only symbols destroyed are those
158555159009
** which appear on the RHS of the rule, but which are *not* used
158556159010
** inside the C code.
158557159011
*/
158558159012
/********* Begin destructor definitions ***************************************/
158559
- case 201: /* select */
158560
- case 235: /* selectnowith */
158561
- case 236: /* oneselect */
158562
- case 248: /* values */
158563
-{
158564
-sqlite3SelectDelete(pParse->db, (yypminor->yy293));
158565
-}
158566
- break;
158567
- case 212: /* term */
158568
- case 213: /* expr */
158569
- case 242: /* where_opt */
158570
- case 244: /* having_opt */
158571
- case 256: /* on_opt */
158572
- case 263: /* where_opt_ret */
158573
- case 274: /* case_operand */
158574
- case 276: /* case_else */
158575
- case 279: /* vinto */
158576
- case 286: /* when_clause */
158577
- case 291: /* key_opt */
158578
- case 305: /* filter_clause */
158579
-{
158580
-sqlite3ExprDelete(pParse->db, (yypminor->yy354));
158581
-}
158582
- break;
158583
- case 217: /* eidlist_opt */
158584
- case 227: /* sortlist */
158585
- case 228: /* eidlist */
158586
- case 240: /* selcollist */
158587
- case 243: /* groupby_opt */
158588
- case 245: /* orderby_opt */
158589
- case 249: /* nexprlist */
158590
- case 250: /* sclp */
158591
- case 258: /* exprlist */
158592
- case 264: /* setlist */
158593
- case 273: /* paren_exprlist */
158594
- case 275: /* case_exprlist */
158595
- case 304: /* part_opt */
158596
-{
158597
-sqlite3ExprListDelete(pParse->db, (yypminor->yy350));
158598
-}
158599
- break;
158600
- case 234: /* fullname */
158601
- case 241: /* from */
158602
- case 252: /* seltablist */
158603
- case 253: /* stl_prefix */
158604
- case 259: /* xfullname */
158605
-{
158606
-sqlite3SrcListDelete(pParse->db, (yypminor->yy457));
158607
-}
158608
- break;
158609
- case 237: /* wqlist */
158610
-{
158611
-sqlite3WithDelete(pParse->db, (yypminor->yy105));
158612
-}
158613
- break;
158614
- case 247: /* window_clause */
158615
- case 300: /* windowdefn_list */
158616
-{
158617
-sqlite3WindowListDelete(pParse->db, (yypminor->yy503));
158618
-}
158619
- break;
158620
- case 257: /* using_opt */
158621
- case 260: /* idlist */
158622
- case 266: /* idlist_opt */
158623
-{
158624
-sqlite3IdListDelete(pParse->db, (yypminor->yy498));
158625
-}
158626
- break;
158627
- case 269: /* filter_over */
158628
- case 301: /* windowdefn */
158629
- case 302: /* window */
158630
- case 303: /* frame_opt */
158631
- case 306: /* over_clause */
158632
-{
158633
-sqlite3WindowDelete(pParse->db, (yypminor->yy503));
158634
-}
158635
- break;
158636
- case 282: /* trigger_cmd_list */
158637
- case 287: /* trigger_cmd */
158638
-{
158639
-sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy51));
158640
-}
158641
- break;
158642
- case 284: /* trigger_event */
158643
-{
158644
-sqlite3IdListDelete(pParse->db, (yypminor->yy298).b);
158645
-}
158646
- break;
158647
- case 308: /* frame_bound */
158648
- case 309: /* frame_bound_s */
158649
- case 310: /* frame_bound_e */
158650
-{
158651
-sqlite3ExprDelete(pParse->db, (yypminor->yy341).pExpr);
159013
+ case 202: /* select */
159014
+ case 236: /* selectnowith */
159015
+ case 237: /* oneselect */
159016
+ case 249: /* values */
159017
+{
159018
+sqlite3SelectDelete(pParse->db, (yypminor->yy307));
159019
+}
159020
+ break;
159021
+ case 213: /* term */
159022
+ case 214: /* expr */
159023
+ case 243: /* where_opt */
159024
+ case 245: /* having_opt */
159025
+ case 257: /* on_opt */
159026
+ case 264: /* where_opt_ret */
159027
+ case 275: /* case_operand */
159028
+ case 277: /* case_else */
159029
+ case 280: /* vinto */
159030
+ case 287: /* when_clause */
159031
+ case 292: /* key_opt */
159032
+ case 308: /* filter_clause */
159033
+{
159034
+sqlite3ExprDelete(pParse->db, (yypminor->yy602));
159035
+}
159036
+ break;
159037
+ case 218: /* eidlist_opt */
159038
+ case 228: /* sortlist */
159039
+ case 229: /* eidlist */
159040
+ case 241: /* selcollist */
159041
+ case 244: /* groupby_opt */
159042
+ case 246: /* orderby_opt */
159043
+ case 250: /* nexprlist */
159044
+ case 251: /* sclp */
159045
+ case 259: /* exprlist */
159046
+ case 265: /* setlist */
159047
+ case 274: /* paren_exprlist */
159048
+ case 276: /* case_exprlist */
159049
+ case 307: /* part_opt */
159050
+{
159051
+sqlite3ExprListDelete(pParse->db, (yypminor->yy338));
159052
+}
159053
+ break;
159054
+ case 235: /* fullname */
159055
+ case 242: /* from */
159056
+ case 253: /* seltablist */
159057
+ case 254: /* stl_prefix */
159058
+ case 260: /* xfullname */
159059
+{
159060
+sqlite3SrcListDelete(pParse->db, (yypminor->yy291));
159061
+}
159062
+ break;
159063
+ case 238: /* wqlist */
159064
+{
159065
+sqlite3WithDelete(pParse->db, (yypminor->yy195));
159066
+}
159067
+ break;
159068
+ case 248: /* window_clause */
159069
+ case 303: /* windowdefn_list */
159070
+{
159071
+sqlite3WindowListDelete(pParse->db, (yypminor->yy19));
159072
+}
159073
+ break;
159074
+ case 258: /* using_opt */
159075
+ case 261: /* idlist */
159076
+ case 267: /* idlist_opt */
159077
+{
159078
+sqlite3IdListDelete(pParse->db, (yypminor->yy288));
159079
+}
159080
+ break;
159081
+ case 270: /* filter_over */
159082
+ case 304: /* windowdefn */
159083
+ case 305: /* window */
159084
+ case 306: /* frame_opt */
159085
+ case 309: /* over_clause */
159086
+{
159087
+sqlite3WindowDelete(pParse->db, (yypminor->yy19));
159088
+}
159089
+ break;
159090
+ case 283: /* trigger_cmd_list */
159091
+ case 288: /* trigger_cmd */
159092
+{
159093
+sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy483));
159094
+}
159095
+ break;
159096
+ case 285: /* trigger_event */
159097
+{
159098
+sqlite3IdListDelete(pParse->db, (yypminor->yy50).b);
159099
+}
159100
+ break;
159101
+ case 311: /* frame_bound */
159102
+ case 312: /* frame_bound_s */
159103
+ case 313: /* frame_bound_e */
159104
+{
159105
+sqlite3ExprDelete(pParse->db, (yypminor->yy113).pExpr);
158652159106
}
158653159107
break;
158654159108
/********* End destructor definitions *****************************************/
158655159109
default: break; /* If no destructor action specified: do nothing */
158656159110
}
@@ -158937,403 +159391,408 @@
158937159391
}
158938159392
158939159393
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
158940159394
** of that rule */
158941159395
static const YYCODETYPE yyRuleInfoLhs[] = {
158942
- 186, /* (0) explain ::= EXPLAIN */
158943
- 186, /* (1) explain ::= EXPLAIN QUERY PLAN */
158944
- 185, /* (2) cmdx ::= cmd */
158945
- 187, /* (3) cmd ::= BEGIN transtype trans_opt */
158946
- 188, /* (4) transtype ::= */
158947
- 188, /* (5) transtype ::= DEFERRED */
158948
- 188, /* (6) transtype ::= IMMEDIATE */
158949
- 188, /* (7) transtype ::= EXCLUSIVE */
158950
- 187, /* (8) cmd ::= COMMIT|END trans_opt */
158951
- 187, /* (9) cmd ::= ROLLBACK trans_opt */
158952
- 187, /* (10) cmd ::= SAVEPOINT nm */
158953
- 187, /* (11) cmd ::= RELEASE savepoint_opt nm */
158954
- 187, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
158955
- 192, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
158956
- 194, /* (14) createkw ::= CREATE */
158957
- 196, /* (15) ifnotexists ::= */
158958
- 196, /* (16) ifnotexists ::= IF NOT EXISTS */
158959
- 195, /* (17) temp ::= TEMP */
158960
- 195, /* (18) temp ::= */
158961
- 193, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */
158962
- 193, /* (20) create_table_args ::= AS select */
158963
- 200, /* (21) table_options ::= */
158964
- 200, /* (22) table_options ::= WITHOUT nm */
158965
- 202, /* (23) columnname ::= nm typetoken */
158966
- 204, /* (24) typetoken ::= */
158967
- 204, /* (25) typetoken ::= typename LP signed RP */
158968
- 204, /* (26) typetoken ::= typename LP signed COMMA signed RP */
158969
- 205, /* (27) typename ::= typename ID|STRING */
158970
- 209, /* (28) scanpt ::= */
158971
- 210, /* (29) scantok ::= */
158972
- 211, /* (30) ccons ::= CONSTRAINT nm */
158973
- 211, /* (31) ccons ::= DEFAULT scantok term */
158974
- 211, /* (32) ccons ::= DEFAULT LP expr RP */
158975
- 211, /* (33) ccons ::= DEFAULT PLUS scantok term */
158976
- 211, /* (34) ccons ::= DEFAULT MINUS scantok term */
158977
- 211, /* (35) ccons ::= DEFAULT scantok ID|INDEXED */
158978
- 211, /* (36) ccons ::= NOT NULL onconf */
158979
- 211, /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */
158980
- 211, /* (38) ccons ::= UNIQUE onconf */
158981
- 211, /* (39) ccons ::= CHECK LP expr RP */
158982
- 211, /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */
158983
- 211, /* (41) ccons ::= defer_subclause */
158984
- 211, /* (42) ccons ::= COLLATE ID|STRING */
158985
- 220, /* (43) generated ::= LP expr RP */
158986
- 220, /* (44) generated ::= LP expr RP ID */
158987
- 216, /* (45) autoinc ::= */
158988
- 216, /* (46) autoinc ::= AUTOINCR */
158989
- 218, /* (47) refargs ::= */
158990
- 218, /* (48) refargs ::= refargs refarg */
158991
- 221, /* (49) refarg ::= MATCH nm */
158992
- 221, /* (50) refarg ::= ON INSERT refact */
158993
- 221, /* (51) refarg ::= ON DELETE refact */
158994
- 221, /* (52) refarg ::= ON UPDATE refact */
158995
- 222, /* (53) refact ::= SET NULL */
158996
- 222, /* (54) refact ::= SET DEFAULT */
158997
- 222, /* (55) refact ::= CASCADE */
158998
- 222, /* (56) refact ::= RESTRICT */
158999
- 222, /* (57) refact ::= NO ACTION */
159000
- 219, /* (58) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
159001
- 219, /* (59) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
159002
- 223, /* (60) init_deferred_pred_opt ::= */
159003
- 223, /* (61) init_deferred_pred_opt ::= INITIALLY DEFERRED */
159004
- 223, /* (62) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
159005
- 199, /* (63) conslist_opt ::= */
159006
- 225, /* (64) tconscomma ::= COMMA */
159007
- 226, /* (65) tcons ::= CONSTRAINT nm */
159008
- 226, /* (66) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
159009
- 226, /* (67) tcons ::= UNIQUE LP sortlist RP onconf */
159010
- 226, /* (68) tcons ::= CHECK LP expr RP onconf */
159011
- 226, /* (69) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
159012
- 229, /* (70) defer_subclause_opt ::= */
159013
- 214, /* (71) onconf ::= */
159014
- 214, /* (72) onconf ::= ON CONFLICT resolvetype */
159015
- 230, /* (73) orconf ::= */
159016
- 230, /* (74) orconf ::= OR resolvetype */
159017
- 231, /* (75) resolvetype ::= IGNORE */
159018
- 231, /* (76) resolvetype ::= REPLACE */
159019
- 187, /* (77) cmd ::= DROP TABLE ifexists fullname */
159020
- 233, /* (78) ifexists ::= IF EXISTS */
159021
- 233, /* (79) ifexists ::= */
159022
- 187, /* (80) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
159023
- 187, /* (81) cmd ::= DROP VIEW ifexists fullname */
159024
- 187, /* (82) cmd ::= select */
159025
- 201, /* (83) select ::= WITH wqlist selectnowith */
159026
- 201, /* (84) select ::= WITH RECURSIVE wqlist selectnowith */
159027
- 201, /* (85) select ::= selectnowith */
159028
- 235, /* (86) selectnowith ::= selectnowith multiselect_op oneselect */
159029
- 238, /* (87) multiselect_op ::= UNION */
159030
- 238, /* (88) multiselect_op ::= UNION ALL */
159031
- 238, /* (89) multiselect_op ::= EXCEPT|INTERSECT */
159032
- 236, /* (90) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
159033
- 236, /* (91) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
159034
- 248, /* (92) values ::= VALUES LP nexprlist RP */
159035
- 248, /* (93) values ::= values COMMA LP nexprlist RP */
159036
- 239, /* (94) distinct ::= DISTINCT */
159037
- 239, /* (95) distinct ::= ALL */
159038
- 239, /* (96) distinct ::= */
159039
- 250, /* (97) sclp ::= */
159040
- 240, /* (98) selcollist ::= sclp scanpt expr scanpt as */
159041
- 240, /* (99) selcollist ::= sclp scanpt STAR */
159042
- 240, /* (100) selcollist ::= sclp scanpt nm DOT STAR */
159043
- 251, /* (101) as ::= AS nm */
159044
- 251, /* (102) as ::= */
159045
- 241, /* (103) from ::= */
159046
- 241, /* (104) from ::= FROM seltablist */
159047
- 253, /* (105) stl_prefix ::= seltablist joinop */
159048
- 253, /* (106) stl_prefix ::= */
159049
- 252, /* (107) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
159050
- 252, /* (108) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
159051
- 252, /* (109) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
159052
- 252, /* (110) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
159053
- 197, /* (111) dbnm ::= */
159054
- 197, /* (112) dbnm ::= DOT nm */
159055
- 234, /* (113) fullname ::= nm */
159056
- 234, /* (114) fullname ::= nm DOT nm */
159057
- 259, /* (115) xfullname ::= nm */
159058
- 259, /* (116) xfullname ::= nm DOT nm */
159059
- 259, /* (117) xfullname ::= nm DOT nm AS nm */
159060
- 259, /* (118) xfullname ::= nm AS nm */
159061
- 254, /* (119) joinop ::= COMMA|JOIN */
159062
- 254, /* (120) joinop ::= JOIN_KW JOIN */
159063
- 254, /* (121) joinop ::= JOIN_KW nm JOIN */
159064
- 254, /* (122) joinop ::= JOIN_KW nm nm JOIN */
159065
- 256, /* (123) on_opt ::= ON expr */
159066
- 256, /* (124) on_opt ::= */
159067
- 255, /* (125) indexed_opt ::= */
159068
- 255, /* (126) indexed_opt ::= INDEXED BY nm */
159069
- 255, /* (127) indexed_opt ::= NOT INDEXED */
159070
- 257, /* (128) using_opt ::= USING LP idlist RP */
159071
- 257, /* (129) using_opt ::= */
159072
- 245, /* (130) orderby_opt ::= */
159073
- 245, /* (131) orderby_opt ::= ORDER BY sortlist */
159074
- 227, /* (132) sortlist ::= sortlist COMMA expr sortorder nulls */
159075
- 227, /* (133) sortlist ::= expr sortorder nulls */
159076
- 215, /* (134) sortorder ::= ASC */
159077
- 215, /* (135) sortorder ::= DESC */
159078
- 215, /* (136) sortorder ::= */
159079
- 261, /* (137) nulls ::= NULLS FIRST */
159080
- 261, /* (138) nulls ::= NULLS LAST */
159081
- 261, /* (139) nulls ::= */
159082
- 243, /* (140) groupby_opt ::= */
159083
- 243, /* (141) groupby_opt ::= GROUP BY nexprlist */
159084
- 244, /* (142) having_opt ::= */
159085
- 244, /* (143) having_opt ::= HAVING expr */
159086
- 246, /* (144) limit_opt ::= */
159087
- 246, /* (145) limit_opt ::= LIMIT expr */
159088
- 246, /* (146) limit_opt ::= LIMIT expr OFFSET expr */
159089
- 246, /* (147) limit_opt ::= LIMIT expr COMMA expr */
159090
- 187, /* (148) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
159091
- 242, /* (149) where_opt ::= */
159092
- 242, /* (150) where_opt ::= WHERE expr */
159093
- 263, /* (151) where_opt_ret ::= */
159094
- 263, /* (152) where_opt_ret ::= WHERE expr */
159095
- 263, /* (153) where_opt_ret ::= RETURNING selcollist */
159096
- 263, /* (154) where_opt_ret ::= WHERE expr RETURNING selcollist */
159097
- 187, /* (155) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
159098
- 264, /* (156) setlist ::= setlist COMMA nm EQ expr */
159099
- 264, /* (157) setlist ::= setlist COMMA LP idlist RP EQ expr */
159100
- 264, /* (158) setlist ::= nm EQ expr */
159101
- 264, /* (159) setlist ::= LP idlist RP EQ expr */
159102
- 187, /* (160) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
159103
- 187, /* (161) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
159104
- 267, /* (162) upsert ::= */
159105
- 267, /* (163) upsert ::= RETURNING selcollist */
159106
- 267, /* (164) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
159107
- 267, /* (165) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
159108
- 267, /* (166) upsert ::= ON CONFLICT DO NOTHING returning */
159109
- 267, /* (167) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
159110
- 268, /* (168) returning ::= RETURNING selcollist */
159111
- 265, /* (169) insert_cmd ::= INSERT orconf */
159112
- 265, /* (170) insert_cmd ::= REPLACE */
159113
- 266, /* (171) idlist_opt ::= */
159114
- 266, /* (172) idlist_opt ::= LP idlist RP */
159115
- 260, /* (173) idlist ::= idlist COMMA nm */
159116
- 260, /* (174) idlist ::= nm */
159117
- 213, /* (175) expr ::= LP expr RP */
159118
- 213, /* (176) expr ::= ID|INDEXED */
159119
- 213, /* (177) expr ::= JOIN_KW */
159120
- 213, /* (178) expr ::= nm DOT nm */
159121
- 213, /* (179) expr ::= nm DOT nm DOT nm */
159122
- 212, /* (180) term ::= NULL|FLOAT|BLOB */
159123
- 212, /* (181) term ::= STRING */
159124
- 212, /* (182) term ::= INTEGER */
159125
- 213, /* (183) expr ::= VARIABLE */
159126
- 213, /* (184) expr ::= expr COLLATE ID|STRING */
159127
- 213, /* (185) expr ::= CAST LP expr AS typetoken RP */
159128
- 213, /* (186) expr ::= ID|INDEXED LP distinct exprlist RP */
159129
- 213, /* (187) expr ::= ID|INDEXED LP STAR RP */
159130
- 213, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
159131
- 213, /* (189) expr ::= ID|INDEXED LP STAR RP filter_over */
159132
- 212, /* (190) term ::= CTIME_KW */
159133
- 213, /* (191) expr ::= LP nexprlist COMMA expr RP */
159134
- 213, /* (192) expr ::= expr AND expr */
159135
- 213, /* (193) expr ::= expr OR expr */
159136
- 213, /* (194) expr ::= expr LT|GT|GE|LE expr */
159137
- 213, /* (195) expr ::= expr EQ|NE expr */
159138
- 213, /* (196) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
159139
- 213, /* (197) expr ::= expr PLUS|MINUS expr */
159140
- 213, /* (198) expr ::= expr STAR|SLASH|REM expr */
159141
- 213, /* (199) expr ::= expr CONCAT expr */
159142
- 270, /* (200) likeop ::= NOT LIKE_KW|MATCH */
159143
- 213, /* (201) expr ::= expr likeop expr */
159144
- 213, /* (202) expr ::= expr likeop expr ESCAPE expr */
159145
- 213, /* (203) expr ::= expr ISNULL|NOTNULL */
159146
- 213, /* (204) expr ::= expr NOT NULL */
159147
- 213, /* (205) expr ::= expr IS expr */
159148
- 213, /* (206) expr ::= expr IS NOT expr */
159149
- 213, /* (207) expr ::= NOT expr */
159150
- 213, /* (208) expr ::= BITNOT expr */
159151
- 213, /* (209) expr ::= PLUS|MINUS expr */
159152
- 271, /* (210) between_op ::= BETWEEN */
159153
- 271, /* (211) between_op ::= NOT BETWEEN */
159154
- 213, /* (212) expr ::= expr between_op expr AND expr */
159155
- 272, /* (213) in_op ::= IN */
159156
- 272, /* (214) in_op ::= NOT IN */
159157
- 213, /* (215) expr ::= expr in_op LP exprlist RP */
159158
- 213, /* (216) expr ::= LP select RP */
159159
- 213, /* (217) expr ::= expr in_op LP select RP */
159160
- 213, /* (218) expr ::= expr in_op nm dbnm paren_exprlist */
159161
- 213, /* (219) expr ::= EXISTS LP select RP */
159162
- 213, /* (220) expr ::= CASE case_operand case_exprlist case_else END */
159163
- 275, /* (221) case_exprlist ::= case_exprlist WHEN expr THEN expr */
159164
- 275, /* (222) case_exprlist ::= WHEN expr THEN expr */
159165
- 276, /* (223) case_else ::= ELSE expr */
159166
- 276, /* (224) case_else ::= */
159167
- 274, /* (225) case_operand ::= expr */
159168
- 274, /* (226) case_operand ::= */
159169
- 258, /* (227) exprlist ::= */
159170
- 249, /* (228) nexprlist ::= nexprlist COMMA expr */
159171
- 249, /* (229) nexprlist ::= expr */
159172
- 273, /* (230) paren_exprlist ::= */
159173
- 273, /* (231) paren_exprlist ::= LP exprlist RP */
159174
- 187, /* (232) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
159175
- 277, /* (233) uniqueflag ::= UNIQUE */
159176
- 277, /* (234) uniqueflag ::= */
159177
- 217, /* (235) eidlist_opt ::= */
159178
- 217, /* (236) eidlist_opt ::= LP eidlist RP */
159179
- 228, /* (237) eidlist ::= eidlist COMMA nm collate sortorder */
159180
- 228, /* (238) eidlist ::= nm collate sortorder */
159181
- 278, /* (239) collate ::= */
159182
- 278, /* (240) collate ::= COLLATE ID|STRING */
159183
- 187, /* (241) cmd ::= DROP INDEX ifexists fullname */
159184
- 187, /* (242) cmd ::= VACUUM vinto */
159185
- 187, /* (243) cmd ::= VACUUM nm vinto */
159186
- 279, /* (244) vinto ::= INTO expr */
159187
- 279, /* (245) vinto ::= */
159188
- 187, /* (246) cmd ::= PRAGMA nm dbnm */
159189
- 187, /* (247) cmd ::= PRAGMA nm dbnm EQ nmnum */
159190
- 187, /* (248) cmd ::= PRAGMA nm dbnm LP nmnum RP */
159191
- 187, /* (249) cmd ::= PRAGMA nm dbnm EQ minus_num */
159192
- 187, /* (250) cmd ::= PRAGMA nm dbnm LP minus_num RP */
159193
- 207, /* (251) plus_num ::= PLUS INTEGER|FLOAT */
159194
- 208, /* (252) minus_num ::= MINUS INTEGER|FLOAT */
159195
- 187, /* (253) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
159196
- 281, /* (254) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
159197
- 283, /* (255) trigger_time ::= BEFORE|AFTER */
159198
- 283, /* (256) trigger_time ::= INSTEAD OF */
159199
- 283, /* (257) trigger_time ::= */
159200
- 284, /* (258) trigger_event ::= DELETE|INSERT */
159201
- 284, /* (259) trigger_event ::= UPDATE */
159202
- 284, /* (260) trigger_event ::= UPDATE OF idlist */
159203
- 286, /* (261) when_clause ::= */
159204
- 286, /* (262) when_clause ::= WHEN expr */
159205
- 282, /* (263) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
159206
- 282, /* (264) trigger_cmd_list ::= trigger_cmd SEMI */
159207
- 288, /* (265) trnm ::= nm DOT nm */
159208
- 289, /* (266) tridxby ::= INDEXED BY nm */
159209
- 289, /* (267) tridxby ::= NOT INDEXED */
159210
- 287, /* (268) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
159211
- 287, /* (269) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
159212
- 287, /* (270) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
159213
- 287, /* (271) trigger_cmd ::= scanpt select scanpt */
159214
- 213, /* (272) expr ::= RAISE LP IGNORE RP */
159215
- 213, /* (273) expr ::= RAISE LP raisetype COMMA nm RP */
159216
- 232, /* (274) raisetype ::= ROLLBACK */
159217
- 232, /* (275) raisetype ::= ABORT */
159218
- 232, /* (276) raisetype ::= FAIL */
159219
- 187, /* (277) cmd ::= DROP TRIGGER ifexists fullname */
159220
- 187, /* (278) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
159221
- 187, /* (279) cmd ::= DETACH database_kw_opt expr */
159222
- 291, /* (280) key_opt ::= */
159223
- 291, /* (281) key_opt ::= KEY expr */
159224
- 187, /* (282) cmd ::= REINDEX */
159225
- 187, /* (283) cmd ::= REINDEX nm dbnm */
159226
- 187, /* (284) cmd ::= ANALYZE */
159227
- 187, /* (285) cmd ::= ANALYZE nm dbnm */
159228
- 187, /* (286) cmd ::= ALTER TABLE fullname RENAME TO nm */
159229
- 187, /* (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
159230
- 292, /* (288) add_column_fullname ::= fullname */
159231
- 187, /* (289) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
159232
- 187, /* (290) cmd ::= create_vtab */
159233
- 187, /* (291) cmd ::= create_vtab LP vtabarglist RP */
159234
- 294, /* (292) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
159235
- 296, /* (293) vtabarg ::= */
159236
- 297, /* (294) vtabargtoken ::= ANY */
159237
- 297, /* (295) vtabargtoken ::= lp anylist RP */
159238
- 298, /* (296) lp ::= LP */
159239
- 262, /* (297) with ::= WITH wqlist */
159240
- 262, /* (298) with ::= WITH RECURSIVE wqlist */
159241
- 237, /* (299) wqlist ::= nm eidlist_opt AS LP select RP */
159242
- 237, /* (300) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
159243
- 300, /* (301) windowdefn_list ::= windowdefn */
159244
- 300, /* (302) windowdefn_list ::= windowdefn_list COMMA windowdefn */
159245
- 301, /* (303) windowdefn ::= nm AS LP window RP */
159246
- 302, /* (304) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
159247
- 302, /* (305) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
159248
- 302, /* (306) window ::= ORDER BY sortlist frame_opt */
159249
- 302, /* (307) window ::= nm ORDER BY sortlist frame_opt */
159250
- 302, /* (308) window ::= frame_opt */
159251
- 302, /* (309) window ::= nm frame_opt */
159252
- 303, /* (310) frame_opt ::= */
159253
- 303, /* (311) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
159254
- 303, /* (312) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
159255
- 307, /* (313) range_or_rows ::= RANGE|ROWS|GROUPS */
159256
- 309, /* (314) frame_bound_s ::= frame_bound */
159257
- 309, /* (315) frame_bound_s ::= UNBOUNDED PRECEDING */
159258
- 310, /* (316) frame_bound_e ::= frame_bound */
159259
- 310, /* (317) frame_bound_e ::= UNBOUNDED FOLLOWING */
159260
- 308, /* (318) frame_bound ::= expr PRECEDING|FOLLOWING */
159261
- 308, /* (319) frame_bound ::= CURRENT ROW */
159262
- 311, /* (320) frame_exclude_opt ::= */
159263
- 311, /* (321) frame_exclude_opt ::= EXCLUDE frame_exclude */
159264
- 312, /* (322) frame_exclude ::= NO OTHERS */
159265
- 312, /* (323) frame_exclude ::= CURRENT ROW */
159266
- 312, /* (324) frame_exclude ::= GROUP|TIES */
159267
- 247, /* (325) window_clause ::= WINDOW windowdefn_list */
159268
- 269, /* (326) filter_over ::= filter_clause over_clause */
159269
- 269, /* (327) filter_over ::= over_clause */
159270
- 269, /* (328) filter_over ::= filter_clause */
159271
- 306, /* (329) over_clause ::= OVER LP window RP */
159272
- 306, /* (330) over_clause ::= OVER nm */
159273
- 305, /* (331) filter_clause ::= FILTER LP WHERE expr RP */
159274
- 182, /* (332) input ::= cmdlist */
159275
- 183, /* (333) cmdlist ::= cmdlist ecmd */
159276
- 183, /* (334) cmdlist ::= ecmd */
159277
- 184, /* (335) ecmd ::= SEMI */
159278
- 184, /* (336) ecmd ::= cmdx SEMI */
159279
- 184, /* (337) ecmd ::= explain cmdx SEMI */
159280
- 189, /* (338) trans_opt ::= */
159281
- 189, /* (339) trans_opt ::= TRANSACTION */
159282
- 189, /* (340) trans_opt ::= TRANSACTION nm */
159283
- 191, /* (341) savepoint_opt ::= SAVEPOINT */
159284
- 191, /* (342) savepoint_opt ::= */
159285
- 187, /* (343) cmd ::= create_table create_table_args */
159286
- 198, /* (344) columnlist ::= columnlist COMMA columnname carglist */
159287
- 198, /* (345) columnlist ::= columnname carglist */
159288
- 190, /* (346) nm ::= ID|INDEXED */
159289
- 190, /* (347) nm ::= STRING */
159290
- 190, /* (348) nm ::= JOIN_KW */
159291
- 204, /* (349) typetoken ::= typename */
159292
- 205, /* (350) typename ::= ID|STRING */
159293
- 206, /* (351) signed ::= plus_num */
159294
- 206, /* (352) signed ::= minus_num */
159295
- 203, /* (353) carglist ::= carglist ccons */
159296
- 203, /* (354) carglist ::= */
159297
- 211, /* (355) ccons ::= NULL onconf */
159298
- 211, /* (356) ccons ::= GENERATED ALWAYS AS generated */
159299
- 211, /* (357) ccons ::= AS generated */
159300
- 199, /* (358) conslist_opt ::= COMMA conslist */
159301
- 224, /* (359) conslist ::= conslist tconscomma tcons */
159302
- 224, /* (360) conslist ::= tcons */
159303
- 225, /* (361) tconscomma ::= */
159304
- 229, /* (362) defer_subclause_opt ::= defer_subclause */
159305
- 231, /* (363) resolvetype ::= raisetype */
159306
- 235, /* (364) selectnowith ::= oneselect */
159307
- 236, /* (365) oneselect ::= values */
159308
- 250, /* (366) sclp ::= selcollist COMMA */
159309
- 251, /* (367) as ::= ID|STRING */
159310
- 268, /* (368) returning ::= */
159311
- 213, /* (369) expr ::= term */
159312
- 270, /* (370) likeop ::= LIKE_KW|MATCH */
159313
- 258, /* (371) exprlist ::= nexprlist */
159314
- 280, /* (372) nmnum ::= plus_num */
159315
- 280, /* (373) nmnum ::= nm */
159316
- 280, /* (374) nmnum ::= ON */
159317
- 280, /* (375) nmnum ::= DELETE */
159318
- 280, /* (376) nmnum ::= DEFAULT */
159319
- 207, /* (377) plus_num ::= INTEGER|FLOAT */
159320
- 285, /* (378) foreach_clause ::= */
159321
- 285, /* (379) foreach_clause ::= FOR EACH ROW */
159322
- 288, /* (380) trnm ::= nm */
159323
- 289, /* (381) tridxby ::= */
159324
- 290, /* (382) database_kw_opt ::= DATABASE */
159325
- 290, /* (383) database_kw_opt ::= */
159326
- 293, /* (384) kwcolumn_opt ::= */
159327
- 293, /* (385) kwcolumn_opt ::= COLUMNKW */
159328
- 295, /* (386) vtabarglist ::= vtabarg */
159329
- 295, /* (387) vtabarglist ::= vtabarglist COMMA vtabarg */
159330
- 296, /* (388) vtabarg ::= vtabarg vtabargtoken */
159331
- 299, /* (389) anylist ::= */
159332
- 299, /* (390) anylist ::= anylist LP anylist RP */
159333
- 299, /* (391) anylist ::= anylist ANY */
159334
- 262, /* (392) with ::= */
159396
+ 187, /* (0) explain ::= EXPLAIN */
159397
+ 187, /* (1) explain ::= EXPLAIN QUERY PLAN */
159398
+ 186, /* (2) cmdx ::= cmd */
159399
+ 188, /* (3) cmd ::= BEGIN transtype trans_opt */
159400
+ 189, /* (4) transtype ::= */
159401
+ 189, /* (5) transtype ::= DEFERRED */
159402
+ 189, /* (6) transtype ::= IMMEDIATE */
159403
+ 189, /* (7) transtype ::= EXCLUSIVE */
159404
+ 188, /* (8) cmd ::= COMMIT|END trans_opt */
159405
+ 188, /* (9) cmd ::= ROLLBACK trans_opt */
159406
+ 188, /* (10) cmd ::= SAVEPOINT nm */
159407
+ 188, /* (11) cmd ::= RELEASE savepoint_opt nm */
159408
+ 188, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
159409
+ 193, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
159410
+ 195, /* (14) createkw ::= CREATE */
159411
+ 197, /* (15) ifnotexists ::= */
159412
+ 197, /* (16) ifnotexists ::= IF NOT EXISTS */
159413
+ 196, /* (17) temp ::= TEMP */
159414
+ 196, /* (18) temp ::= */
159415
+ 194, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */
159416
+ 194, /* (20) create_table_args ::= AS select */
159417
+ 201, /* (21) table_options ::= */
159418
+ 201, /* (22) table_options ::= WITHOUT nm */
159419
+ 203, /* (23) columnname ::= nm typetoken */
159420
+ 205, /* (24) typetoken ::= */
159421
+ 205, /* (25) typetoken ::= typename LP signed RP */
159422
+ 205, /* (26) typetoken ::= typename LP signed COMMA signed RP */
159423
+ 206, /* (27) typename ::= typename ID|STRING */
159424
+ 210, /* (28) scanpt ::= */
159425
+ 211, /* (29) scantok ::= */
159426
+ 212, /* (30) ccons ::= CONSTRAINT nm */
159427
+ 212, /* (31) ccons ::= DEFAULT scantok term */
159428
+ 212, /* (32) ccons ::= DEFAULT LP expr RP */
159429
+ 212, /* (33) ccons ::= DEFAULT PLUS scantok term */
159430
+ 212, /* (34) ccons ::= DEFAULT MINUS scantok term */
159431
+ 212, /* (35) ccons ::= DEFAULT scantok ID|INDEXED */
159432
+ 212, /* (36) ccons ::= NOT NULL onconf */
159433
+ 212, /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */
159434
+ 212, /* (38) ccons ::= UNIQUE onconf */
159435
+ 212, /* (39) ccons ::= CHECK LP expr RP */
159436
+ 212, /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */
159437
+ 212, /* (41) ccons ::= defer_subclause */
159438
+ 212, /* (42) ccons ::= COLLATE ID|STRING */
159439
+ 221, /* (43) generated ::= LP expr RP */
159440
+ 221, /* (44) generated ::= LP expr RP ID */
159441
+ 217, /* (45) autoinc ::= */
159442
+ 217, /* (46) autoinc ::= AUTOINCR */
159443
+ 219, /* (47) refargs ::= */
159444
+ 219, /* (48) refargs ::= refargs refarg */
159445
+ 222, /* (49) refarg ::= MATCH nm */
159446
+ 222, /* (50) refarg ::= ON INSERT refact */
159447
+ 222, /* (51) refarg ::= ON DELETE refact */
159448
+ 222, /* (52) refarg ::= ON UPDATE refact */
159449
+ 223, /* (53) refact ::= SET NULL */
159450
+ 223, /* (54) refact ::= SET DEFAULT */
159451
+ 223, /* (55) refact ::= CASCADE */
159452
+ 223, /* (56) refact ::= RESTRICT */
159453
+ 223, /* (57) refact ::= NO ACTION */
159454
+ 220, /* (58) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
159455
+ 220, /* (59) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
159456
+ 224, /* (60) init_deferred_pred_opt ::= */
159457
+ 224, /* (61) init_deferred_pred_opt ::= INITIALLY DEFERRED */
159458
+ 224, /* (62) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
159459
+ 200, /* (63) conslist_opt ::= */
159460
+ 226, /* (64) tconscomma ::= COMMA */
159461
+ 227, /* (65) tcons ::= CONSTRAINT nm */
159462
+ 227, /* (66) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
159463
+ 227, /* (67) tcons ::= UNIQUE LP sortlist RP onconf */
159464
+ 227, /* (68) tcons ::= CHECK LP expr RP onconf */
159465
+ 227, /* (69) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
159466
+ 230, /* (70) defer_subclause_opt ::= */
159467
+ 215, /* (71) onconf ::= */
159468
+ 215, /* (72) onconf ::= ON CONFLICT resolvetype */
159469
+ 231, /* (73) orconf ::= */
159470
+ 231, /* (74) orconf ::= OR resolvetype */
159471
+ 232, /* (75) resolvetype ::= IGNORE */
159472
+ 232, /* (76) resolvetype ::= REPLACE */
159473
+ 188, /* (77) cmd ::= DROP TABLE ifexists fullname */
159474
+ 234, /* (78) ifexists ::= IF EXISTS */
159475
+ 234, /* (79) ifexists ::= */
159476
+ 188, /* (80) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
159477
+ 188, /* (81) cmd ::= DROP VIEW ifexists fullname */
159478
+ 188, /* (82) cmd ::= select */
159479
+ 202, /* (83) select ::= WITH wqlist selectnowith */
159480
+ 202, /* (84) select ::= WITH RECURSIVE wqlist selectnowith */
159481
+ 202, /* (85) select ::= selectnowith */
159482
+ 236, /* (86) selectnowith ::= selectnowith multiselect_op oneselect */
159483
+ 239, /* (87) multiselect_op ::= UNION */
159484
+ 239, /* (88) multiselect_op ::= UNION ALL */
159485
+ 239, /* (89) multiselect_op ::= EXCEPT|INTERSECT */
159486
+ 237, /* (90) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
159487
+ 237, /* (91) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
159488
+ 249, /* (92) values ::= VALUES LP nexprlist RP */
159489
+ 249, /* (93) values ::= values COMMA LP nexprlist RP */
159490
+ 240, /* (94) distinct ::= DISTINCT */
159491
+ 240, /* (95) distinct ::= ALL */
159492
+ 240, /* (96) distinct ::= */
159493
+ 251, /* (97) sclp ::= */
159494
+ 241, /* (98) selcollist ::= sclp scanpt expr scanpt as */
159495
+ 241, /* (99) selcollist ::= sclp scanpt STAR */
159496
+ 241, /* (100) selcollist ::= sclp scanpt nm DOT STAR */
159497
+ 252, /* (101) as ::= AS nm */
159498
+ 252, /* (102) as ::= */
159499
+ 242, /* (103) from ::= */
159500
+ 242, /* (104) from ::= FROM seltablist */
159501
+ 254, /* (105) stl_prefix ::= seltablist joinop */
159502
+ 254, /* (106) stl_prefix ::= */
159503
+ 253, /* (107) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
159504
+ 253, /* (108) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
159505
+ 253, /* (109) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
159506
+ 253, /* (110) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
159507
+ 198, /* (111) dbnm ::= */
159508
+ 198, /* (112) dbnm ::= DOT nm */
159509
+ 235, /* (113) fullname ::= nm */
159510
+ 235, /* (114) fullname ::= nm DOT nm */
159511
+ 260, /* (115) xfullname ::= nm */
159512
+ 260, /* (116) xfullname ::= nm DOT nm */
159513
+ 260, /* (117) xfullname ::= nm DOT nm AS nm */
159514
+ 260, /* (118) xfullname ::= nm AS nm */
159515
+ 255, /* (119) joinop ::= COMMA|JOIN */
159516
+ 255, /* (120) joinop ::= JOIN_KW JOIN */
159517
+ 255, /* (121) joinop ::= JOIN_KW nm JOIN */
159518
+ 255, /* (122) joinop ::= JOIN_KW nm nm JOIN */
159519
+ 257, /* (123) on_opt ::= ON expr */
159520
+ 257, /* (124) on_opt ::= */
159521
+ 256, /* (125) indexed_opt ::= */
159522
+ 256, /* (126) indexed_opt ::= INDEXED BY nm */
159523
+ 256, /* (127) indexed_opt ::= NOT INDEXED */
159524
+ 258, /* (128) using_opt ::= USING LP idlist RP */
159525
+ 258, /* (129) using_opt ::= */
159526
+ 246, /* (130) orderby_opt ::= */
159527
+ 246, /* (131) orderby_opt ::= ORDER BY sortlist */
159528
+ 228, /* (132) sortlist ::= sortlist COMMA expr sortorder nulls */
159529
+ 228, /* (133) sortlist ::= expr sortorder nulls */
159530
+ 216, /* (134) sortorder ::= ASC */
159531
+ 216, /* (135) sortorder ::= DESC */
159532
+ 216, /* (136) sortorder ::= */
159533
+ 262, /* (137) nulls ::= NULLS FIRST */
159534
+ 262, /* (138) nulls ::= NULLS LAST */
159535
+ 262, /* (139) nulls ::= */
159536
+ 244, /* (140) groupby_opt ::= */
159537
+ 244, /* (141) groupby_opt ::= GROUP BY nexprlist */
159538
+ 245, /* (142) having_opt ::= */
159539
+ 245, /* (143) having_opt ::= HAVING expr */
159540
+ 247, /* (144) limit_opt ::= */
159541
+ 247, /* (145) limit_opt ::= LIMIT expr */
159542
+ 247, /* (146) limit_opt ::= LIMIT expr OFFSET expr */
159543
+ 247, /* (147) limit_opt ::= LIMIT expr COMMA expr */
159544
+ 188, /* (148) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
159545
+ 243, /* (149) where_opt ::= */
159546
+ 243, /* (150) where_opt ::= WHERE expr */
159547
+ 264, /* (151) where_opt_ret ::= */
159548
+ 264, /* (152) where_opt_ret ::= WHERE expr */
159549
+ 264, /* (153) where_opt_ret ::= RETURNING selcollist */
159550
+ 264, /* (154) where_opt_ret ::= WHERE expr RETURNING selcollist */
159551
+ 188, /* (155) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
159552
+ 265, /* (156) setlist ::= setlist COMMA nm EQ expr */
159553
+ 265, /* (157) setlist ::= setlist COMMA LP idlist RP EQ expr */
159554
+ 265, /* (158) setlist ::= nm EQ expr */
159555
+ 265, /* (159) setlist ::= LP idlist RP EQ expr */
159556
+ 188, /* (160) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
159557
+ 188, /* (161) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
159558
+ 268, /* (162) upsert ::= */
159559
+ 268, /* (163) upsert ::= RETURNING selcollist */
159560
+ 268, /* (164) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
159561
+ 268, /* (165) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
159562
+ 268, /* (166) upsert ::= ON CONFLICT DO NOTHING returning */
159563
+ 268, /* (167) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
159564
+ 269, /* (168) returning ::= RETURNING selcollist */
159565
+ 266, /* (169) insert_cmd ::= INSERT orconf */
159566
+ 266, /* (170) insert_cmd ::= REPLACE */
159567
+ 267, /* (171) idlist_opt ::= */
159568
+ 267, /* (172) idlist_opt ::= LP idlist RP */
159569
+ 261, /* (173) idlist ::= idlist COMMA nm */
159570
+ 261, /* (174) idlist ::= nm */
159571
+ 214, /* (175) expr ::= LP expr RP */
159572
+ 214, /* (176) expr ::= ID|INDEXED */
159573
+ 214, /* (177) expr ::= JOIN_KW */
159574
+ 214, /* (178) expr ::= nm DOT nm */
159575
+ 214, /* (179) expr ::= nm DOT nm DOT nm */
159576
+ 213, /* (180) term ::= NULL|FLOAT|BLOB */
159577
+ 213, /* (181) term ::= STRING */
159578
+ 213, /* (182) term ::= INTEGER */
159579
+ 214, /* (183) expr ::= VARIABLE */
159580
+ 214, /* (184) expr ::= expr COLLATE ID|STRING */
159581
+ 214, /* (185) expr ::= CAST LP expr AS typetoken RP */
159582
+ 214, /* (186) expr ::= ID|INDEXED LP distinct exprlist RP */
159583
+ 214, /* (187) expr ::= ID|INDEXED LP STAR RP */
159584
+ 214, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
159585
+ 214, /* (189) expr ::= ID|INDEXED LP STAR RP filter_over */
159586
+ 213, /* (190) term ::= CTIME_KW */
159587
+ 214, /* (191) expr ::= LP nexprlist COMMA expr RP */
159588
+ 214, /* (192) expr ::= expr AND expr */
159589
+ 214, /* (193) expr ::= expr OR expr */
159590
+ 214, /* (194) expr ::= expr LT|GT|GE|LE expr */
159591
+ 214, /* (195) expr ::= expr EQ|NE expr */
159592
+ 214, /* (196) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
159593
+ 214, /* (197) expr ::= expr PLUS|MINUS expr */
159594
+ 214, /* (198) expr ::= expr STAR|SLASH|REM expr */
159595
+ 214, /* (199) expr ::= expr CONCAT expr */
159596
+ 271, /* (200) likeop ::= NOT LIKE_KW|MATCH */
159597
+ 214, /* (201) expr ::= expr likeop expr */
159598
+ 214, /* (202) expr ::= expr likeop expr ESCAPE expr */
159599
+ 214, /* (203) expr ::= expr ISNULL|NOTNULL */
159600
+ 214, /* (204) expr ::= expr NOT NULL */
159601
+ 214, /* (205) expr ::= expr IS expr */
159602
+ 214, /* (206) expr ::= expr IS NOT expr */
159603
+ 214, /* (207) expr ::= NOT expr */
159604
+ 214, /* (208) expr ::= BITNOT expr */
159605
+ 214, /* (209) expr ::= PLUS|MINUS expr */
159606
+ 272, /* (210) between_op ::= BETWEEN */
159607
+ 272, /* (211) between_op ::= NOT BETWEEN */
159608
+ 214, /* (212) expr ::= expr between_op expr AND expr */
159609
+ 273, /* (213) in_op ::= IN */
159610
+ 273, /* (214) in_op ::= NOT IN */
159611
+ 214, /* (215) expr ::= expr in_op LP exprlist RP */
159612
+ 214, /* (216) expr ::= LP select RP */
159613
+ 214, /* (217) expr ::= expr in_op LP select RP */
159614
+ 214, /* (218) expr ::= expr in_op nm dbnm paren_exprlist */
159615
+ 214, /* (219) expr ::= EXISTS LP select RP */
159616
+ 214, /* (220) expr ::= CASE case_operand case_exprlist case_else END */
159617
+ 276, /* (221) case_exprlist ::= case_exprlist WHEN expr THEN expr */
159618
+ 276, /* (222) case_exprlist ::= WHEN expr THEN expr */
159619
+ 277, /* (223) case_else ::= ELSE expr */
159620
+ 277, /* (224) case_else ::= */
159621
+ 275, /* (225) case_operand ::= expr */
159622
+ 275, /* (226) case_operand ::= */
159623
+ 259, /* (227) exprlist ::= */
159624
+ 250, /* (228) nexprlist ::= nexprlist COMMA expr */
159625
+ 250, /* (229) nexprlist ::= expr */
159626
+ 274, /* (230) paren_exprlist ::= */
159627
+ 274, /* (231) paren_exprlist ::= LP exprlist RP */
159628
+ 188, /* (232) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
159629
+ 278, /* (233) uniqueflag ::= UNIQUE */
159630
+ 278, /* (234) uniqueflag ::= */
159631
+ 218, /* (235) eidlist_opt ::= */
159632
+ 218, /* (236) eidlist_opt ::= LP eidlist RP */
159633
+ 229, /* (237) eidlist ::= eidlist COMMA nm collate sortorder */
159634
+ 229, /* (238) eidlist ::= nm collate sortorder */
159635
+ 279, /* (239) collate ::= */
159636
+ 279, /* (240) collate ::= COLLATE ID|STRING */
159637
+ 188, /* (241) cmd ::= DROP INDEX ifexists fullname */
159638
+ 188, /* (242) cmd ::= VACUUM vinto */
159639
+ 188, /* (243) cmd ::= VACUUM nm vinto */
159640
+ 280, /* (244) vinto ::= INTO expr */
159641
+ 280, /* (245) vinto ::= */
159642
+ 188, /* (246) cmd ::= PRAGMA nm dbnm */
159643
+ 188, /* (247) cmd ::= PRAGMA nm dbnm EQ nmnum */
159644
+ 188, /* (248) cmd ::= PRAGMA nm dbnm LP nmnum RP */
159645
+ 188, /* (249) cmd ::= PRAGMA nm dbnm EQ minus_num */
159646
+ 188, /* (250) cmd ::= PRAGMA nm dbnm LP minus_num RP */
159647
+ 208, /* (251) plus_num ::= PLUS INTEGER|FLOAT */
159648
+ 209, /* (252) minus_num ::= MINUS INTEGER|FLOAT */
159649
+ 188, /* (253) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
159650
+ 282, /* (254) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
159651
+ 284, /* (255) trigger_time ::= BEFORE|AFTER */
159652
+ 284, /* (256) trigger_time ::= INSTEAD OF */
159653
+ 284, /* (257) trigger_time ::= */
159654
+ 285, /* (258) trigger_event ::= DELETE|INSERT */
159655
+ 285, /* (259) trigger_event ::= UPDATE */
159656
+ 285, /* (260) trigger_event ::= UPDATE OF idlist */
159657
+ 287, /* (261) when_clause ::= */
159658
+ 287, /* (262) when_clause ::= WHEN expr */
159659
+ 283, /* (263) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
159660
+ 283, /* (264) trigger_cmd_list ::= trigger_cmd SEMI */
159661
+ 289, /* (265) trnm ::= nm DOT nm */
159662
+ 290, /* (266) tridxby ::= INDEXED BY nm */
159663
+ 290, /* (267) tridxby ::= NOT INDEXED */
159664
+ 288, /* (268) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
159665
+ 288, /* (269) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
159666
+ 288, /* (270) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
159667
+ 288, /* (271) trigger_cmd ::= scanpt select scanpt */
159668
+ 214, /* (272) expr ::= RAISE LP IGNORE RP */
159669
+ 214, /* (273) expr ::= RAISE LP raisetype COMMA nm RP */
159670
+ 233, /* (274) raisetype ::= ROLLBACK */
159671
+ 233, /* (275) raisetype ::= ABORT */
159672
+ 233, /* (276) raisetype ::= FAIL */
159673
+ 188, /* (277) cmd ::= DROP TRIGGER ifexists fullname */
159674
+ 188, /* (278) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
159675
+ 188, /* (279) cmd ::= DETACH database_kw_opt expr */
159676
+ 292, /* (280) key_opt ::= */
159677
+ 292, /* (281) key_opt ::= KEY expr */
159678
+ 188, /* (282) cmd ::= REINDEX */
159679
+ 188, /* (283) cmd ::= REINDEX nm dbnm */
159680
+ 188, /* (284) cmd ::= ANALYZE */
159681
+ 188, /* (285) cmd ::= ANALYZE nm dbnm */
159682
+ 188, /* (286) cmd ::= ALTER TABLE fullname RENAME TO nm */
159683
+ 188, /* (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
159684
+ 188, /* (288) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
159685
+ 293, /* (289) add_column_fullname ::= fullname */
159686
+ 188, /* (290) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
159687
+ 188, /* (291) cmd ::= create_vtab */
159688
+ 188, /* (292) cmd ::= create_vtab LP vtabarglist RP */
159689
+ 295, /* (293) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
159690
+ 297, /* (294) vtabarg ::= */
159691
+ 298, /* (295) vtabargtoken ::= ANY */
159692
+ 298, /* (296) vtabargtoken ::= lp anylist RP */
159693
+ 299, /* (297) lp ::= LP */
159694
+ 263, /* (298) with ::= WITH wqlist */
159695
+ 263, /* (299) with ::= WITH RECURSIVE wqlist */
159696
+ 302, /* (300) wqas ::= AS */
159697
+ 302, /* (301) wqas ::= AS MATERIALIZED */
159698
+ 302, /* (302) wqas ::= AS NOT MATERIALIZED */
159699
+ 301, /* (303) wqitem ::= nm eidlist_opt wqas LP select RP */
159700
+ 238, /* (304) wqlist ::= wqitem */
159701
+ 238, /* (305) wqlist ::= wqlist COMMA wqitem */
159702
+ 303, /* (306) windowdefn_list ::= windowdefn */
159703
+ 303, /* (307) windowdefn_list ::= windowdefn_list COMMA windowdefn */
159704
+ 304, /* (308) windowdefn ::= nm AS LP window RP */
159705
+ 305, /* (309) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
159706
+ 305, /* (310) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
159707
+ 305, /* (311) window ::= ORDER BY sortlist frame_opt */
159708
+ 305, /* (312) window ::= nm ORDER BY sortlist frame_opt */
159709
+ 305, /* (313) window ::= frame_opt */
159710
+ 305, /* (314) window ::= nm frame_opt */
159711
+ 306, /* (315) frame_opt ::= */
159712
+ 306, /* (316) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
159713
+ 306, /* (317) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
159714
+ 310, /* (318) range_or_rows ::= RANGE|ROWS|GROUPS */
159715
+ 312, /* (319) frame_bound_s ::= frame_bound */
159716
+ 312, /* (320) frame_bound_s ::= UNBOUNDED PRECEDING */
159717
+ 313, /* (321) frame_bound_e ::= frame_bound */
159718
+ 313, /* (322) frame_bound_e ::= UNBOUNDED FOLLOWING */
159719
+ 311, /* (323) frame_bound ::= expr PRECEDING|FOLLOWING */
159720
+ 311, /* (324) frame_bound ::= CURRENT ROW */
159721
+ 314, /* (325) frame_exclude_opt ::= */
159722
+ 314, /* (326) frame_exclude_opt ::= EXCLUDE frame_exclude */
159723
+ 315, /* (327) frame_exclude ::= NO OTHERS */
159724
+ 315, /* (328) frame_exclude ::= CURRENT ROW */
159725
+ 315, /* (329) frame_exclude ::= GROUP|TIES */
159726
+ 248, /* (330) window_clause ::= WINDOW windowdefn_list */
159727
+ 270, /* (331) filter_over ::= filter_clause over_clause */
159728
+ 270, /* (332) filter_over ::= over_clause */
159729
+ 270, /* (333) filter_over ::= filter_clause */
159730
+ 309, /* (334) over_clause ::= OVER LP window RP */
159731
+ 309, /* (335) over_clause ::= OVER nm */
159732
+ 308, /* (336) filter_clause ::= FILTER LP WHERE expr RP */
159733
+ 183, /* (337) input ::= cmdlist */
159734
+ 184, /* (338) cmdlist ::= cmdlist ecmd */
159735
+ 184, /* (339) cmdlist ::= ecmd */
159736
+ 185, /* (340) ecmd ::= SEMI */
159737
+ 185, /* (341) ecmd ::= cmdx SEMI */
159738
+ 185, /* (342) ecmd ::= explain cmdx SEMI */
159739
+ 190, /* (343) trans_opt ::= */
159740
+ 190, /* (344) trans_opt ::= TRANSACTION */
159741
+ 190, /* (345) trans_opt ::= TRANSACTION nm */
159742
+ 192, /* (346) savepoint_opt ::= SAVEPOINT */
159743
+ 192, /* (347) savepoint_opt ::= */
159744
+ 188, /* (348) cmd ::= create_table create_table_args */
159745
+ 199, /* (349) columnlist ::= columnlist COMMA columnname carglist */
159746
+ 199, /* (350) columnlist ::= columnname carglist */
159747
+ 191, /* (351) nm ::= ID|INDEXED */
159748
+ 191, /* (352) nm ::= STRING */
159749
+ 191, /* (353) nm ::= JOIN_KW */
159750
+ 205, /* (354) typetoken ::= typename */
159751
+ 206, /* (355) typename ::= ID|STRING */
159752
+ 207, /* (356) signed ::= plus_num */
159753
+ 207, /* (357) signed ::= minus_num */
159754
+ 204, /* (358) carglist ::= carglist ccons */
159755
+ 204, /* (359) carglist ::= */
159756
+ 212, /* (360) ccons ::= NULL onconf */
159757
+ 212, /* (361) ccons ::= GENERATED ALWAYS AS generated */
159758
+ 212, /* (362) ccons ::= AS generated */
159759
+ 200, /* (363) conslist_opt ::= COMMA conslist */
159760
+ 225, /* (364) conslist ::= conslist tconscomma tcons */
159761
+ 225, /* (365) conslist ::= tcons */
159762
+ 226, /* (366) tconscomma ::= */
159763
+ 230, /* (367) defer_subclause_opt ::= defer_subclause */
159764
+ 232, /* (368) resolvetype ::= raisetype */
159765
+ 236, /* (369) selectnowith ::= oneselect */
159766
+ 237, /* (370) oneselect ::= values */
159767
+ 251, /* (371) sclp ::= selcollist COMMA */
159768
+ 252, /* (372) as ::= ID|STRING */
159769
+ 269, /* (373) returning ::= */
159770
+ 214, /* (374) expr ::= term */
159771
+ 271, /* (375) likeop ::= LIKE_KW|MATCH */
159772
+ 259, /* (376) exprlist ::= nexprlist */
159773
+ 281, /* (377) nmnum ::= plus_num */
159774
+ 281, /* (378) nmnum ::= nm */
159775
+ 281, /* (379) nmnum ::= ON */
159776
+ 281, /* (380) nmnum ::= DELETE */
159777
+ 281, /* (381) nmnum ::= DEFAULT */
159778
+ 208, /* (382) plus_num ::= INTEGER|FLOAT */
159779
+ 286, /* (383) foreach_clause ::= */
159780
+ 286, /* (384) foreach_clause ::= FOR EACH ROW */
159781
+ 289, /* (385) trnm ::= nm */
159782
+ 290, /* (386) tridxby ::= */
159783
+ 291, /* (387) database_kw_opt ::= DATABASE */
159784
+ 291, /* (388) database_kw_opt ::= */
159785
+ 294, /* (389) kwcolumn_opt ::= */
159786
+ 294, /* (390) kwcolumn_opt ::= COLUMNKW */
159787
+ 296, /* (391) vtabarglist ::= vtabarg */
159788
+ 296, /* (392) vtabarglist ::= vtabarglist COMMA vtabarg */
159789
+ 297, /* (393) vtabarg ::= vtabarg vtabargtoken */
159790
+ 300, /* (394) anylist ::= */
159791
+ 300, /* (395) anylist ::= anylist LP anylist RP */
159792
+ 300, /* (396) anylist ::= anylist ANY */
159793
+ 263, /* (397) with ::= */
159335159794
};
159336159795
159337159796
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
159338159797
** of symbols on the right-hand side of that rule. */
159339159798
static const signed char yyRuleInfoNRhs[] = {
@@ -159623,115 +160082,120 @@
159623160082
-3, /* (283) cmd ::= REINDEX nm dbnm */
159624160083
-1, /* (284) cmd ::= ANALYZE */
159625160084
-3, /* (285) cmd ::= ANALYZE nm dbnm */
159626160085
-6, /* (286) cmd ::= ALTER TABLE fullname RENAME TO nm */
159627160086
-7, /* (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
159628
- -1, /* (288) add_column_fullname ::= fullname */
159629
- -8, /* (289) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
159630
- -1, /* (290) cmd ::= create_vtab */
159631
- -4, /* (291) cmd ::= create_vtab LP vtabarglist RP */
159632
- -8, /* (292) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
159633
- 0, /* (293) vtabarg ::= */
159634
- -1, /* (294) vtabargtoken ::= ANY */
159635
- -3, /* (295) vtabargtoken ::= lp anylist RP */
159636
- -1, /* (296) lp ::= LP */
159637
- -2, /* (297) with ::= WITH wqlist */
159638
- -3, /* (298) with ::= WITH RECURSIVE wqlist */
159639
- -6, /* (299) wqlist ::= nm eidlist_opt AS LP select RP */
159640
- -8, /* (300) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
159641
- -1, /* (301) windowdefn_list ::= windowdefn */
159642
- -3, /* (302) windowdefn_list ::= windowdefn_list COMMA windowdefn */
159643
- -5, /* (303) windowdefn ::= nm AS LP window RP */
159644
- -5, /* (304) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
159645
- -6, /* (305) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
159646
- -4, /* (306) window ::= ORDER BY sortlist frame_opt */
159647
- -5, /* (307) window ::= nm ORDER BY sortlist frame_opt */
159648
- -1, /* (308) window ::= frame_opt */
159649
- -2, /* (309) window ::= nm frame_opt */
159650
- 0, /* (310) frame_opt ::= */
159651
- -3, /* (311) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
159652
- -6, /* (312) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
159653
- -1, /* (313) range_or_rows ::= RANGE|ROWS|GROUPS */
159654
- -1, /* (314) frame_bound_s ::= frame_bound */
159655
- -2, /* (315) frame_bound_s ::= UNBOUNDED PRECEDING */
159656
- -1, /* (316) frame_bound_e ::= frame_bound */
159657
- -2, /* (317) frame_bound_e ::= UNBOUNDED FOLLOWING */
159658
- -2, /* (318) frame_bound ::= expr PRECEDING|FOLLOWING */
159659
- -2, /* (319) frame_bound ::= CURRENT ROW */
159660
- 0, /* (320) frame_exclude_opt ::= */
159661
- -2, /* (321) frame_exclude_opt ::= EXCLUDE frame_exclude */
159662
- -2, /* (322) frame_exclude ::= NO OTHERS */
159663
- -2, /* (323) frame_exclude ::= CURRENT ROW */
159664
- -1, /* (324) frame_exclude ::= GROUP|TIES */
159665
- -2, /* (325) window_clause ::= WINDOW windowdefn_list */
159666
- -2, /* (326) filter_over ::= filter_clause over_clause */
159667
- -1, /* (327) filter_over ::= over_clause */
159668
- -1, /* (328) filter_over ::= filter_clause */
159669
- -4, /* (329) over_clause ::= OVER LP window RP */
159670
- -2, /* (330) over_clause ::= OVER nm */
159671
- -5, /* (331) filter_clause ::= FILTER LP WHERE expr RP */
159672
- -1, /* (332) input ::= cmdlist */
159673
- -2, /* (333) cmdlist ::= cmdlist ecmd */
159674
- -1, /* (334) cmdlist ::= ecmd */
159675
- -1, /* (335) ecmd ::= SEMI */
159676
- -2, /* (336) ecmd ::= cmdx SEMI */
159677
- -3, /* (337) ecmd ::= explain cmdx SEMI */
159678
- 0, /* (338) trans_opt ::= */
159679
- -1, /* (339) trans_opt ::= TRANSACTION */
159680
- -2, /* (340) trans_opt ::= TRANSACTION nm */
159681
- -1, /* (341) savepoint_opt ::= SAVEPOINT */
159682
- 0, /* (342) savepoint_opt ::= */
159683
- -2, /* (343) cmd ::= create_table create_table_args */
159684
- -4, /* (344) columnlist ::= columnlist COMMA columnname carglist */
159685
- -2, /* (345) columnlist ::= columnname carglist */
159686
- -1, /* (346) nm ::= ID|INDEXED */
159687
- -1, /* (347) nm ::= STRING */
159688
- -1, /* (348) nm ::= JOIN_KW */
159689
- -1, /* (349) typetoken ::= typename */
159690
- -1, /* (350) typename ::= ID|STRING */
159691
- -1, /* (351) signed ::= plus_num */
159692
- -1, /* (352) signed ::= minus_num */
159693
- -2, /* (353) carglist ::= carglist ccons */
159694
- 0, /* (354) carglist ::= */
159695
- -2, /* (355) ccons ::= NULL onconf */
159696
- -4, /* (356) ccons ::= GENERATED ALWAYS AS generated */
159697
- -2, /* (357) ccons ::= AS generated */
159698
- -2, /* (358) conslist_opt ::= COMMA conslist */
159699
- -3, /* (359) conslist ::= conslist tconscomma tcons */
159700
- -1, /* (360) conslist ::= tcons */
159701
- 0, /* (361) tconscomma ::= */
159702
- -1, /* (362) defer_subclause_opt ::= defer_subclause */
159703
- -1, /* (363) resolvetype ::= raisetype */
159704
- -1, /* (364) selectnowith ::= oneselect */
159705
- -1, /* (365) oneselect ::= values */
159706
- -2, /* (366) sclp ::= selcollist COMMA */
159707
- -1, /* (367) as ::= ID|STRING */
159708
- 0, /* (368) returning ::= */
159709
- -1, /* (369) expr ::= term */
159710
- -1, /* (370) likeop ::= LIKE_KW|MATCH */
159711
- -1, /* (371) exprlist ::= nexprlist */
159712
- -1, /* (372) nmnum ::= plus_num */
159713
- -1, /* (373) nmnum ::= nm */
159714
- -1, /* (374) nmnum ::= ON */
159715
- -1, /* (375) nmnum ::= DELETE */
159716
- -1, /* (376) nmnum ::= DEFAULT */
159717
- -1, /* (377) plus_num ::= INTEGER|FLOAT */
159718
- 0, /* (378) foreach_clause ::= */
159719
- -3, /* (379) foreach_clause ::= FOR EACH ROW */
159720
- -1, /* (380) trnm ::= nm */
159721
- 0, /* (381) tridxby ::= */
159722
- -1, /* (382) database_kw_opt ::= DATABASE */
159723
- 0, /* (383) database_kw_opt ::= */
159724
- 0, /* (384) kwcolumn_opt ::= */
159725
- -1, /* (385) kwcolumn_opt ::= COLUMNKW */
159726
- -1, /* (386) vtabarglist ::= vtabarg */
159727
- -3, /* (387) vtabarglist ::= vtabarglist COMMA vtabarg */
159728
- -2, /* (388) vtabarg ::= vtabarg vtabargtoken */
159729
- 0, /* (389) anylist ::= */
159730
- -4, /* (390) anylist ::= anylist LP anylist RP */
159731
- -2, /* (391) anylist ::= anylist ANY */
159732
- 0, /* (392) with ::= */
160087
+ -6, /* (288) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
160088
+ -1, /* (289) add_column_fullname ::= fullname */
160089
+ -8, /* (290) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
160090
+ -1, /* (291) cmd ::= create_vtab */
160091
+ -4, /* (292) cmd ::= create_vtab LP vtabarglist RP */
160092
+ -8, /* (293) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
160093
+ 0, /* (294) vtabarg ::= */
160094
+ -1, /* (295) vtabargtoken ::= ANY */
160095
+ -3, /* (296) vtabargtoken ::= lp anylist RP */
160096
+ -1, /* (297) lp ::= LP */
160097
+ -2, /* (298) with ::= WITH wqlist */
160098
+ -3, /* (299) with ::= WITH RECURSIVE wqlist */
160099
+ -1, /* (300) wqas ::= AS */
160100
+ -2, /* (301) wqas ::= AS MATERIALIZED */
160101
+ -3, /* (302) wqas ::= AS NOT MATERIALIZED */
160102
+ -6, /* (303) wqitem ::= nm eidlist_opt wqas LP select RP */
160103
+ -1, /* (304) wqlist ::= wqitem */
160104
+ -3, /* (305) wqlist ::= wqlist COMMA wqitem */
160105
+ -1, /* (306) windowdefn_list ::= windowdefn */
160106
+ -3, /* (307) windowdefn_list ::= windowdefn_list COMMA windowdefn */
160107
+ -5, /* (308) windowdefn ::= nm AS LP window RP */
160108
+ -5, /* (309) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
160109
+ -6, /* (310) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
160110
+ -4, /* (311) window ::= ORDER BY sortlist frame_opt */
160111
+ -5, /* (312) window ::= nm ORDER BY sortlist frame_opt */
160112
+ -1, /* (313) window ::= frame_opt */
160113
+ -2, /* (314) window ::= nm frame_opt */
160114
+ 0, /* (315) frame_opt ::= */
160115
+ -3, /* (316) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
160116
+ -6, /* (317) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
160117
+ -1, /* (318) range_or_rows ::= RANGE|ROWS|GROUPS */
160118
+ -1, /* (319) frame_bound_s ::= frame_bound */
160119
+ -2, /* (320) frame_bound_s ::= UNBOUNDED PRECEDING */
160120
+ -1, /* (321) frame_bound_e ::= frame_bound */
160121
+ -2, /* (322) frame_bound_e ::= UNBOUNDED FOLLOWING */
160122
+ -2, /* (323) frame_bound ::= expr PRECEDING|FOLLOWING */
160123
+ -2, /* (324) frame_bound ::= CURRENT ROW */
160124
+ 0, /* (325) frame_exclude_opt ::= */
160125
+ -2, /* (326) frame_exclude_opt ::= EXCLUDE frame_exclude */
160126
+ -2, /* (327) frame_exclude ::= NO OTHERS */
160127
+ -2, /* (328) frame_exclude ::= CURRENT ROW */
160128
+ -1, /* (329) frame_exclude ::= GROUP|TIES */
160129
+ -2, /* (330) window_clause ::= WINDOW windowdefn_list */
160130
+ -2, /* (331) filter_over ::= filter_clause over_clause */
160131
+ -1, /* (332) filter_over ::= over_clause */
160132
+ -1, /* (333) filter_over ::= filter_clause */
160133
+ -4, /* (334) over_clause ::= OVER LP window RP */
160134
+ -2, /* (335) over_clause ::= OVER nm */
160135
+ -5, /* (336) filter_clause ::= FILTER LP WHERE expr RP */
160136
+ -1, /* (337) input ::= cmdlist */
160137
+ -2, /* (338) cmdlist ::= cmdlist ecmd */
160138
+ -1, /* (339) cmdlist ::= ecmd */
160139
+ -1, /* (340) ecmd ::= SEMI */
160140
+ -2, /* (341) ecmd ::= cmdx SEMI */
160141
+ -3, /* (342) ecmd ::= explain cmdx SEMI */
160142
+ 0, /* (343) trans_opt ::= */
160143
+ -1, /* (344) trans_opt ::= TRANSACTION */
160144
+ -2, /* (345) trans_opt ::= TRANSACTION nm */
160145
+ -1, /* (346) savepoint_opt ::= SAVEPOINT */
160146
+ 0, /* (347) savepoint_opt ::= */
160147
+ -2, /* (348) cmd ::= create_table create_table_args */
160148
+ -4, /* (349) columnlist ::= columnlist COMMA columnname carglist */
160149
+ -2, /* (350) columnlist ::= columnname carglist */
160150
+ -1, /* (351) nm ::= ID|INDEXED */
160151
+ -1, /* (352) nm ::= STRING */
160152
+ -1, /* (353) nm ::= JOIN_KW */
160153
+ -1, /* (354) typetoken ::= typename */
160154
+ -1, /* (355) typename ::= ID|STRING */
160155
+ -1, /* (356) signed ::= plus_num */
160156
+ -1, /* (357) signed ::= minus_num */
160157
+ -2, /* (358) carglist ::= carglist ccons */
160158
+ 0, /* (359) carglist ::= */
160159
+ -2, /* (360) ccons ::= NULL onconf */
160160
+ -4, /* (361) ccons ::= GENERATED ALWAYS AS generated */
160161
+ -2, /* (362) ccons ::= AS generated */
160162
+ -2, /* (363) conslist_opt ::= COMMA conslist */
160163
+ -3, /* (364) conslist ::= conslist tconscomma tcons */
160164
+ -1, /* (365) conslist ::= tcons */
160165
+ 0, /* (366) tconscomma ::= */
160166
+ -1, /* (367) defer_subclause_opt ::= defer_subclause */
160167
+ -1, /* (368) resolvetype ::= raisetype */
160168
+ -1, /* (369) selectnowith ::= oneselect */
160169
+ -1, /* (370) oneselect ::= values */
160170
+ -2, /* (371) sclp ::= selcollist COMMA */
160171
+ -1, /* (372) as ::= ID|STRING */
160172
+ 0, /* (373) returning ::= */
160173
+ -1, /* (374) expr ::= term */
160174
+ -1, /* (375) likeop ::= LIKE_KW|MATCH */
160175
+ -1, /* (376) exprlist ::= nexprlist */
160176
+ -1, /* (377) nmnum ::= plus_num */
160177
+ -1, /* (378) nmnum ::= nm */
160178
+ -1, /* (379) nmnum ::= ON */
160179
+ -1, /* (380) nmnum ::= DELETE */
160180
+ -1, /* (381) nmnum ::= DEFAULT */
160181
+ -1, /* (382) plus_num ::= INTEGER|FLOAT */
160182
+ 0, /* (383) foreach_clause ::= */
160183
+ -3, /* (384) foreach_clause ::= FOR EACH ROW */
160184
+ -1, /* (385) trnm ::= nm */
160185
+ 0, /* (386) tridxby ::= */
160186
+ -1, /* (387) database_kw_opt ::= DATABASE */
160187
+ 0, /* (388) database_kw_opt ::= */
160188
+ 0, /* (389) kwcolumn_opt ::= */
160189
+ -1, /* (390) kwcolumn_opt ::= COLUMNKW */
160190
+ -1, /* (391) vtabarglist ::= vtabarg */
160191
+ -3, /* (392) vtabarglist ::= vtabarglist COMMA vtabarg */
160192
+ -2, /* (393) vtabarg ::= vtabarg vtabargtoken */
160193
+ 0, /* (394) anylist ::= */
160194
+ -4, /* (395) anylist ::= anylist LP anylist RP */
160195
+ -2, /* (396) anylist ::= anylist ANY */
160196
+ 0, /* (397) with ::= */
159733160197
};
159734160198
159735160199
static void yy_accept(yyParser*); /* Forward Declaration */
159736160200
159737160201
/*
@@ -159779,20 +160243,20 @@
159779160243
break;
159780160244
case 2: /* cmdx ::= cmd */
159781160245
{ sqlite3FinishCoding(pParse); }
159782160246
break;
159783160247
case 3: /* cmd ::= BEGIN transtype trans_opt */
159784
-{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy412);}
160248
+{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy60);}
159785160249
break;
159786160250
case 4: /* transtype ::= */
159787
-{yymsp[1].minor.yy412 = TK_DEFERRED;}
160251
+{yymsp[1].minor.yy60 = TK_DEFERRED;}
159788160252
break;
159789160253
case 5: /* transtype ::= DEFERRED */
159790160254
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
159791160255
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
159792
- case 313: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==313);
159793
-{yymsp[0].minor.yy412 = yymsp[0].major; /*A-overwrites-X*/}
160256
+ case 318: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==318);
160257
+{yymsp[0].minor.yy60 = yymsp[0].major; /*A-overwrites-X*/}
159794160258
break;
159795160259
case 8: /* cmd ::= COMMIT|END trans_opt */
159796160260
case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
159797160261
{sqlite3EndTransaction(pParse,yymsp[-1].major);}
159798160262
break;
@@ -159811,11 +160275,11 @@
159811160275
sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
159812160276
}
159813160277
break;
159814160278
case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
159815160279
{
159816
- sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy412,0,0,yymsp[-2].minor.yy412);
160280
+ sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy60,0,0,yymsp[-2].minor.yy60);
159817160281
}
159818160282
break;
159819160283
case 14: /* createkw ::= CREATE */
159820160284
{disableLookaside(pParse);}
159821160285
break;
@@ -159826,36 +160290,36 @@
159826160290
case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60);
159827160291
case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70);
159828160292
case 79: /* ifexists ::= */ yytestcase(yyruleno==79);
159829160293
case 96: /* distinct ::= */ yytestcase(yyruleno==96);
159830160294
case 239: /* collate ::= */ yytestcase(yyruleno==239);
159831
-{yymsp[1].minor.yy412 = 0;}
160295
+{yymsp[1].minor.yy60 = 0;}
159832160296
break;
159833160297
case 16: /* ifnotexists ::= IF NOT EXISTS */
159834
-{yymsp[-2].minor.yy412 = 1;}
160298
+{yymsp[-2].minor.yy60 = 1;}
159835160299
break;
159836160300
case 17: /* temp ::= TEMP */
159837160301
case 46: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==46);
159838
-{yymsp[0].minor.yy412 = 1;}
160302
+{yymsp[0].minor.yy60 = 1;}
159839160303
break;
159840160304
case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
159841160305
{
159842
- sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy412,0);
160306
+ sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy60,0);
159843160307
}
159844160308
break;
159845160309
case 20: /* create_table_args ::= AS select */
159846160310
{
159847
- sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy293);
159848
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy293);
160311
+ sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy307);
160312
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy307);
159849160313
}
159850160314
break;
159851160315
case 22: /* table_options ::= WITHOUT nm */
159852160316
{
159853160317
if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
159854
- yymsp[-1].minor.yy412 = TF_WithoutRowid | TF_NoVisibleRowid;
160318
+ yymsp[-1].minor.yy60 = TF_WithoutRowid | TF_NoVisibleRowid;
159855160319
}else{
159856
- yymsp[-1].minor.yy412 = 0;
160320
+ yymsp[-1].minor.yy60 = 0;
159857160321
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
159858160322
}
159859160323
}
159860160324
break;
159861160325
case 23: /* columnname ::= nm typetoken */
@@ -159880,11 +160344,11 @@
159880160344
{yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
159881160345
break;
159882160346
case 28: /* scanpt ::= */
159883160347
{
159884160348
assert( yyLookahead!=YYNOCODE );
159885
- yymsp[1].minor.yy504 = yyLookaheadToken.z;
160349
+ yymsp[1].minor.yy528 = yyLookaheadToken.z;
159886160350
}
159887160351
break;
159888160352
case 29: /* scantok ::= */
159889160353
{
159890160354
assert( yyLookahead!=YYNOCODE );
@@ -159894,21 +160358,21 @@
159894160358
case 30: /* ccons ::= CONSTRAINT nm */
159895160359
case 65: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==65);
159896160360
{pParse->constraintName = yymsp[0].minor.yy0;}
159897160361
break;
159898160362
case 31: /* ccons ::= DEFAULT scantok term */
159899
-{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy354,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
160363
+{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy602,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
159900160364
break;
159901160365
case 32: /* ccons ::= DEFAULT LP expr RP */
159902
-{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy354,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
160366
+{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy602,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
159903160367
break;
159904160368
case 33: /* ccons ::= DEFAULT PLUS scantok term */
159905
-{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy354,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
160369
+{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy602,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
159906160370
break;
159907160371
case 34: /* ccons ::= DEFAULT MINUS scantok term */
159908160372
{
159909
- Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy354, 0);
160373
+ Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy602, 0);
159910160374
sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
159911160375
}
159912160376
break;
159913160377
case 35: /* ccons ::= DEFAULT scantok ID|INDEXED */
159914160378
{
@@ -159919,274 +160383,256 @@
159919160383
}
159920160384
sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
159921160385
}
159922160386
break;
159923160387
case 36: /* ccons ::= NOT NULL onconf */
159924
-{sqlite3AddNotNull(pParse, yymsp[0].minor.yy412);}
160388
+{sqlite3AddNotNull(pParse, yymsp[0].minor.yy60);}
159925160389
break;
159926160390
case 37: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
159927
-{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy412,yymsp[0].minor.yy412,yymsp[-2].minor.yy412);}
160391
+{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy60,yymsp[0].minor.yy60,yymsp[-2].minor.yy60);}
159928160392
break;
159929160393
case 38: /* ccons ::= UNIQUE onconf */
159930
-{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy412,0,0,0,0,
160394
+{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy60,0,0,0,0,
159931160395
SQLITE_IDXTYPE_UNIQUE);}
159932160396
break;
159933160397
case 39: /* ccons ::= CHECK LP expr RP */
159934
-{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy354,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
160398
+{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy602,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
159935160399
break;
159936160400
case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */
159937
-{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy350,yymsp[0].minor.yy412);}
160401
+{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy338,yymsp[0].minor.yy60);}
159938160402
break;
159939160403
case 41: /* ccons ::= defer_subclause */
159940
-{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy412);}
160404
+{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy60);}
159941160405
break;
159942160406
case 42: /* ccons ::= COLLATE ID|STRING */
159943160407
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
159944160408
break;
159945160409
case 43: /* generated ::= LP expr RP */
159946
-{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy354,0);}
160410
+{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy602,0);}
159947160411
break;
159948160412
case 44: /* generated ::= LP expr RP ID */
159949
-{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy354,&yymsp[0].minor.yy0);}
160413
+{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy602,&yymsp[0].minor.yy0);}
159950160414
break;
159951160415
case 47: /* refargs ::= */
159952
-{ yymsp[1].minor.yy412 = OE_None*0x0101; /* EV: R-19803-45884 */}
160416
+{ yymsp[1].minor.yy60 = OE_None*0x0101; /* EV: R-19803-45884 */}
159953160417
break;
159954160418
case 48: /* refargs ::= refargs refarg */
159955
-{ yymsp[-1].minor.yy412 = (yymsp[-1].minor.yy412 & ~yymsp[0].minor.yy463.mask) | yymsp[0].minor.yy463.value; }
160419
+{ yymsp[-1].minor.yy60 = (yymsp[-1].minor.yy60 & ~yymsp[0].minor.yy615.mask) | yymsp[0].minor.yy615.value; }
159956160420
break;
159957160421
case 49: /* refarg ::= MATCH nm */
159958
-{ yymsp[-1].minor.yy463.value = 0; yymsp[-1].minor.yy463.mask = 0x000000; }
160422
+{ yymsp[-1].minor.yy615.value = 0; yymsp[-1].minor.yy615.mask = 0x000000; }
159959160423
break;
159960160424
case 50: /* refarg ::= ON INSERT refact */
159961
-{ yymsp[-2].minor.yy463.value = 0; yymsp[-2].minor.yy463.mask = 0x000000; }
160425
+{ yymsp[-2].minor.yy615.value = 0; yymsp[-2].minor.yy615.mask = 0x000000; }
159962160426
break;
159963160427
case 51: /* refarg ::= ON DELETE refact */
159964
-{ yymsp[-2].minor.yy463.value = yymsp[0].minor.yy412; yymsp[-2].minor.yy463.mask = 0x0000ff; }
160428
+{ yymsp[-2].minor.yy615.value = yymsp[0].minor.yy60; yymsp[-2].minor.yy615.mask = 0x0000ff; }
159965160429
break;
159966160430
case 52: /* refarg ::= ON UPDATE refact */
159967
-{ yymsp[-2].minor.yy463.value = yymsp[0].minor.yy412<<8; yymsp[-2].minor.yy463.mask = 0x00ff00; }
160431
+{ yymsp[-2].minor.yy615.value = yymsp[0].minor.yy60<<8; yymsp[-2].minor.yy615.mask = 0x00ff00; }
159968160432
break;
159969160433
case 53: /* refact ::= SET NULL */
159970
-{ yymsp[-1].minor.yy412 = OE_SetNull; /* EV: R-33326-45252 */}
160434
+{ yymsp[-1].minor.yy60 = OE_SetNull; /* EV: R-33326-45252 */}
159971160435
break;
159972160436
case 54: /* refact ::= SET DEFAULT */
159973
-{ yymsp[-1].minor.yy412 = OE_SetDflt; /* EV: R-33326-45252 */}
160437
+{ yymsp[-1].minor.yy60 = OE_SetDflt; /* EV: R-33326-45252 */}
159974160438
break;
159975160439
case 55: /* refact ::= CASCADE */
159976
-{ yymsp[0].minor.yy412 = OE_Cascade; /* EV: R-33326-45252 */}
160440
+{ yymsp[0].minor.yy60 = OE_Cascade; /* EV: R-33326-45252 */}
159977160441
break;
159978160442
case 56: /* refact ::= RESTRICT */
159979
-{ yymsp[0].minor.yy412 = OE_Restrict; /* EV: R-33326-45252 */}
160443
+{ yymsp[0].minor.yy60 = OE_Restrict; /* EV: R-33326-45252 */}
159980160444
break;
159981160445
case 57: /* refact ::= NO ACTION */
159982
-{ yymsp[-1].minor.yy412 = OE_None; /* EV: R-33326-45252 */}
160446
+{ yymsp[-1].minor.yy60 = OE_None; /* EV: R-33326-45252 */}
159983160447
break;
159984160448
case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
159985
-{yymsp[-2].minor.yy412 = 0;}
160449
+{yymsp[-2].minor.yy60 = 0;}
159986160450
break;
159987160451
case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
159988160452
case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74);
159989160453
case 169: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==169);
159990
-{yymsp[-1].minor.yy412 = yymsp[0].minor.yy412;}
160454
+{yymsp[-1].minor.yy60 = yymsp[0].minor.yy60;}
159991160455
break;
159992160456
case 61: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
159993160457
case 78: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==78);
159994160458
case 211: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==211);
159995160459
case 214: /* in_op ::= NOT IN */ yytestcase(yyruleno==214);
159996160460
case 240: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==240);
159997
-{yymsp[-1].minor.yy412 = 1;}
160461
+{yymsp[-1].minor.yy60 = 1;}
159998160462
break;
159999160463
case 62: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
160000
-{yymsp[-1].minor.yy412 = 0;}
160464
+{yymsp[-1].minor.yy60 = 0;}
160001160465
break;
160002160466
case 64: /* tconscomma ::= COMMA */
160003160467
{pParse->constraintName.n = 0;}
160004160468
break;
160005160469
case 66: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
160006
-{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy350,yymsp[0].minor.yy412,yymsp[-2].minor.yy412,0);}
160470
+{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy338,yymsp[0].minor.yy60,yymsp[-2].minor.yy60,0);}
160007160471
break;
160008160472
case 67: /* tcons ::= UNIQUE LP sortlist RP onconf */
160009
-{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy350,yymsp[0].minor.yy412,0,0,0,0,
160473
+{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy338,yymsp[0].minor.yy60,0,0,0,0,
160010160474
SQLITE_IDXTYPE_UNIQUE);}
160011160475
break;
160012160476
case 68: /* tcons ::= CHECK LP expr RP onconf */
160013
-{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy354,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
160477
+{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy602,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
160014160478
break;
160015160479
case 69: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
160016160480
{
160017
- sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy350, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy350, yymsp[-1].minor.yy412);
160018
- sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy412);
160481
+ sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy338, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy338, yymsp[-1].minor.yy60);
160482
+ sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy60);
160019160483
}
160020160484
break;
160021160485
case 71: /* onconf ::= */
160022160486
case 73: /* orconf ::= */ yytestcase(yyruleno==73);
160023
-{yymsp[1].minor.yy412 = OE_Default;}
160487
+{yymsp[1].minor.yy60 = OE_Default;}
160024160488
break;
160025160489
case 72: /* onconf ::= ON CONFLICT resolvetype */
160026
-{yymsp[-2].minor.yy412 = yymsp[0].minor.yy412;}
160490
+{yymsp[-2].minor.yy60 = yymsp[0].minor.yy60;}
160027160491
break;
160028160492
case 75: /* resolvetype ::= IGNORE */
160029
-{yymsp[0].minor.yy412 = OE_Ignore;}
160493
+{yymsp[0].minor.yy60 = OE_Ignore;}
160030160494
break;
160031160495
case 76: /* resolvetype ::= REPLACE */
160032160496
case 170: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==170);
160033
-{yymsp[0].minor.yy412 = OE_Replace;}
160497
+{yymsp[0].minor.yy60 = OE_Replace;}
160034160498
break;
160035160499
case 77: /* cmd ::= DROP TABLE ifexists fullname */
160036160500
{
160037
- sqlite3DropTable(pParse, yymsp[0].minor.yy457, 0, yymsp[-1].minor.yy412);
160501
+ sqlite3DropTable(pParse, yymsp[0].minor.yy291, 0, yymsp[-1].minor.yy60);
160038160502
}
160039160503
break;
160040160504
case 80: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
160041160505
{
160042
- sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy350, yymsp[0].minor.yy293, yymsp[-7].minor.yy412, yymsp[-5].minor.yy412);
160506
+ sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy338, yymsp[0].minor.yy307, yymsp[-7].minor.yy60, yymsp[-5].minor.yy60);
160043160507
}
160044160508
break;
160045160509
case 81: /* cmd ::= DROP VIEW ifexists fullname */
160046160510
{
160047
- sqlite3DropTable(pParse, yymsp[0].minor.yy457, 1, yymsp[-1].minor.yy412);
160511
+ sqlite3DropTable(pParse, yymsp[0].minor.yy291, 1, yymsp[-1].minor.yy60);
160048160512
}
160049160513
break;
160050160514
case 82: /* cmd ::= select */
160051160515
{
160052160516
SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
160053
- sqlite3Select(pParse, yymsp[0].minor.yy293, &dest);
160054
- sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy293);
160517
+ sqlite3Select(pParse, yymsp[0].minor.yy307, &dest);
160518
+ sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy307);
160055160519
}
160056160520
break;
160057160521
case 83: /* select ::= WITH wqlist selectnowith */
160058
-{
160059
- Select *p = yymsp[0].minor.yy293;
160060
- if( p ){
160061
- p->pWith = yymsp[-1].minor.yy105;
160062
- parserDoubleLinkSelect(pParse, p);
160063
- }else{
160064
- sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy105);
160065
- }
160066
- yymsp[-2].minor.yy293 = p;
160067
-}
160522
+{yymsp[-2].minor.yy307 = attachWithToSelect(pParse,yymsp[0].minor.yy307,yymsp[-1].minor.yy195);}
160068160523
break;
160069160524
case 84: /* select ::= WITH RECURSIVE wqlist selectnowith */
160070
-{
160071
- Select *p = yymsp[0].minor.yy293;
160072
- if( p ){
160073
- p->pWith = yymsp[-1].minor.yy105;
160074
- parserDoubleLinkSelect(pParse, p);
160075
- }else{
160076
- sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy105);
160077
- }
160078
- yymsp[-3].minor.yy293 = p;
160079
-}
160525
+{yymsp[-3].minor.yy307 = attachWithToSelect(pParse,yymsp[0].minor.yy307,yymsp[-1].minor.yy195);}
160080160526
break;
160081160527
case 85: /* select ::= selectnowith */
160082160528
{
160083
- Select *p = yymsp[0].minor.yy293;
160529
+ Select *p = yymsp[0].minor.yy307;
160084160530
if( p ){
160085160531
parserDoubleLinkSelect(pParse, p);
160086160532
}
160087
- yymsp[0].minor.yy293 = p; /*A-overwrites-X*/
160533
+ yymsp[0].minor.yy307 = p; /*A-overwrites-X*/
160088160534
}
160089160535
break;
160090160536
case 86: /* selectnowith ::= selectnowith multiselect_op oneselect */
160091160537
{
160092
- Select *pRhs = yymsp[0].minor.yy293;
160093
- Select *pLhs = yymsp[-2].minor.yy293;
160538
+ Select *pRhs = yymsp[0].minor.yy307;
160539
+ Select *pLhs = yymsp[-2].minor.yy307;
160094160540
if( pRhs && pRhs->pPrior ){
160095160541
SrcList *pFrom;
160096160542
Token x;
160097160543
x.n = 0;
160098160544
parserDoubleLinkSelect(pParse, pRhs);
160099160545
pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
160100160546
pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
160101160547
}
160102160548
if( pRhs ){
160103
- pRhs->op = (u8)yymsp[-1].minor.yy412;
160549
+ pRhs->op = (u8)yymsp[-1].minor.yy60;
160104160550
pRhs->pPrior = pLhs;
160105160551
if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
160106160552
pRhs->selFlags &= ~SF_MultiValue;
160107
- if( yymsp[-1].minor.yy412!=TK_ALL ) pParse->hasCompound = 1;
160553
+ if( yymsp[-1].minor.yy60!=TK_ALL ) pParse->hasCompound = 1;
160108160554
}else{
160109160555
sqlite3SelectDelete(pParse->db, pLhs);
160110160556
}
160111
- yymsp[-2].minor.yy293 = pRhs;
160557
+ yymsp[-2].minor.yy307 = pRhs;
160112160558
}
160113160559
break;
160114160560
case 87: /* multiselect_op ::= UNION */
160115160561
case 89: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==89);
160116
-{yymsp[0].minor.yy412 = yymsp[0].major; /*A-overwrites-OP*/}
160562
+{yymsp[0].minor.yy60 = yymsp[0].major; /*A-overwrites-OP*/}
160117160563
break;
160118160564
case 88: /* multiselect_op ::= UNION ALL */
160119
-{yymsp[-1].minor.yy412 = TK_ALL;}
160565
+{yymsp[-1].minor.yy60 = TK_ALL;}
160120160566
break;
160121160567
case 90: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
160122160568
{
160123
- yymsp[-8].minor.yy293 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy350,yymsp[-5].minor.yy457,yymsp[-4].minor.yy354,yymsp[-3].minor.yy350,yymsp[-2].minor.yy354,yymsp[-1].minor.yy350,yymsp[-7].minor.yy412,yymsp[0].minor.yy354);
160569
+ yymsp[-8].minor.yy307 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy338,yymsp[-5].minor.yy291,yymsp[-4].minor.yy602,yymsp[-3].minor.yy338,yymsp[-2].minor.yy602,yymsp[-1].minor.yy338,yymsp[-7].minor.yy60,yymsp[0].minor.yy602);
160124160570
}
160125160571
break;
160126160572
case 91: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
160127160573
{
160128
- yymsp[-9].minor.yy293 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy350,yymsp[-6].minor.yy457,yymsp[-5].minor.yy354,yymsp[-4].minor.yy350,yymsp[-3].minor.yy354,yymsp[-1].minor.yy350,yymsp[-8].minor.yy412,yymsp[0].minor.yy354);
160129
- if( yymsp[-9].minor.yy293 ){
160130
- yymsp[-9].minor.yy293->pWinDefn = yymsp[-2].minor.yy503;
160574
+ yymsp[-9].minor.yy307 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy338,yymsp[-6].minor.yy291,yymsp[-5].minor.yy602,yymsp[-4].minor.yy338,yymsp[-3].minor.yy602,yymsp[-1].minor.yy338,yymsp[-8].minor.yy60,yymsp[0].minor.yy602);
160575
+ if( yymsp[-9].minor.yy307 ){
160576
+ yymsp[-9].minor.yy307->pWinDefn = yymsp[-2].minor.yy19;
160131160577
}else{
160132
- sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy503);
160578
+ sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy19);
160133160579
}
160134160580
}
160135160581
break;
160136160582
case 92: /* values ::= VALUES LP nexprlist RP */
160137160583
{
160138
- yymsp[-3].minor.yy293 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy350,0,0,0,0,0,SF_Values,0);
160584
+ yymsp[-3].minor.yy307 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy338,0,0,0,0,0,SF_Values,0);
160139160585
}
160140160586
break;
160141160587
case 93: /* values ::= values COMMA LP nexprlist RP */
160142160588
{
160143
- Select *pRight, *pLeft = yymsp[-4].minor.yy293;
160144
- pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy350,0,0,0,0,0,SF_Values|SF_MultiValue,0);
160589
+ Select *pRight, *pLeft = yymsp[-4].minor.yy307;
160590
+ pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy338,0,0,0,0,0,SF_Values|SF_MultiValue,0);
160145160591
if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
160146160592
if( pRight ){
160147160593
pRight->op = TK_ALL;
160148160594
pRight->pPrior = pLeft;
160149
- yymsp[-4].minor.yy293 = pRight;
160595
+ yymsp[-4].minor.yy307 = pRight;
160150160596
}else{
160151
- yymsp[-4].minor.yy293 = pLeft;
160597
+ yymsp[-4].minor.yy307 = pLeft;
160152160598
}
160153160599
}
160154160600
break;
160155160601
case 94: /* distinct ::= DISTINCT */
160156
-{yymsp[0].minor.yy412 = SF_Distinct;}
160602
+{yymsp[0].minor.yy60 = SF_Distinct;}
160157160603
break;
160158160604
case 95: /* distinct ::= ALL */
160159
-{yymsp[0].minor.yy412 = SF_All;}
160605
+{yymsp[0].minor.yy60 = SF_All;}
160160160606
break;
160161160607
case 97: /* sclp ::= */
160162160608
case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130);
160163160609
case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140);
160164160610
case 227: /* exprlist ::= */ yytestcase(yyruleno==227);
160165160611
case 230: /* paren_exprlist ::= */ yytestcase(yyruleno==230);
160166160612
case 235: /* eidlist_opt ::= */ yytestcase(yyruleno==235);
160167
-{yymsp[1].minor.yy350 = 0;}
160613
+{yymsp[1].minor.yy338 = 0;}
160168160614
break;
160169160615
case 98: /* selcollist ::= sclp scanpt expr scanpt as */
160170160616
{
160171
- yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy350, yymsp[-2].minor.yy354);
160172
- if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy350, &yymsp[0].minor.yy0, 1);
160173
- sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy350,yymsp[-3].minor.yy504,yymsp[-1].minor.yy504);
160617
+ yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy338, yymsp[-2].minor.yy602);
160618
+ if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy338, &yymsp[0].minor.yy0, 1);
160619
+ sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy338,yymsp[-3].minor.yy528,yymsp[-1].minor.yy528);
160174160620
}
160175160621
break;
160176160622
case 99: /* selcollist ::= sclp scanpt STAR */
160177160623
{
160178160624
Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
160179
- yymsp[-2].minor.yy350 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy350, p);
160625
+ yymsp[-2].minor.yy338 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy338, p);
160180160626
}
160181160627
break;
160182160628
case 100: /* selcollist ::= sclp scanpt nm DOT STAR */
160183160629
{
160184160630
Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
160185160631
Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
160186160632
Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
160187
- yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy350, pDot);
160633
+ yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy338, pDot);
160188160634
}
160189160635
break;
160190160636
case 101: /* as ::= AS nm */
160191160637
case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112);
160192160638
case 251: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==251);
@@ -160193,49 +160639,49 @@
160193160639
case 252: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==252);
160194160640
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
160195160641
break;
160196160642
case 103: /* from ::= */
160197160643
case 106: /* stl_prefix ::= */ yytestcase(yyruleno==106);
160198
-{yymsp[1].minor.yy457 = 0;}
160644
+{yymsp[1].minor.yy291 = 0;}
160199160645
break;
160200160646
case 104: /* from ::= FROM seltablist */
160201160647
{
160202
- yymsp[-1].minor.yy457 = yymsp[0].minor.yy457;
160203
- sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy457);
160648
+ yymsp[-1].minor.yy291 = yymsp[0].minor.yy291;
160649
+ sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy291);
160204160650
}
160205160651
break;
160206160652
case 105: /* stl_prefix ::= seltablist joinop */
160207160653
{
160208
- if( ALWAYS(yymsp[-1].minor.yy457 && yymsp[-1].minor.yy457->nSrc>0) ) yymsp[-1].minor.yy457->a[yymsp[-1].minor.yy457->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy412;
160654
+ if( ALWAYS(yymsp[-1].minor.yy291 && yymsp[-1].minor.yy291->nSrc>0) ) yymsp[-1].minor.yy291->a[yymsp[-1].minor.yy291->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy60;
160209160655
}
160210160656
break;
160211160657
case 107: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
160212160658
{
160213
- yymsp[-6].minor.yy457 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy457,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy354,yymsp[0].minor.yy498);
160214
- sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy457, &yymsp[-2].minor.yy0);
160659
+ yymsp[-6].minor.yy291 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy291,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy602,yymsp[0].minor.yy288);
160660
+ sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy291, &yymsp[-2].minor.yy0);
160215160661
}
160216160662
break;
160217160663
case 108: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
160218160664
{
160219
- yymsp[-8].minor.yy457 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy457,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy354,yymsp[0].minor.yy498);
160220
- sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy457, yymsp[-4].minor.yy350);
160665
+ yymsp[-8].minor.yy291 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy291,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy602,yymsp[0].minor.yy288);
160666
+ sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy291, yymsp[-4].minor.yy338);
160221160667
}
160222160668
break;
160223160669
case 109: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
160224160670
{
160225
- yymsp[-6].minor.yy457 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy457,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy293,yymsp[-1].minor.yy354,yymsp[0].minor.yy498);
160671
+ yymsp[-6].minor.yy291 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy291,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy307,yymsp[-1].minor.yy602,yymsp[0].minor.yy288);
160226160672
}
160227160673
break;
160228160674
case 110: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
160229160675
{
160230
- if( yymsp[-6].minor.yy457==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy354==0 && yymsp[0].minor.yy498==0 ){
160231
- yymsp[-6].minor.yy457 = yymsp[-4].minor.yy457;
160232
- }else if( yymsp[-4].minor.yy457->nSrc==1 ){
160233
- yymsp[-6].minor.yy457 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy457,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy354,yymsp[0].minor.yy498);
160234
- if( yymsp[-6].minor.yy457 ){
160235
- struct SrcList_item *pNew = &yymsp[-6].minor.yy457->a[yymsp[-6].minor.yy457->nSrc-1];
160236
- struct SrcList_item *pOld = yymsp[-4].minor.yy457->a;
160676
+ if( yymsp[-6].minor.yy291==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy602==0 && yymsp[0].minor.yy288==0 ){
160677
+ yymsp[-6].minor.yy291 = yymsp[-4].minor.yy291;
160678
+ }else if( yymsp[-4].minor.yy291->nSrc==1 ){
160679
+ yymsp[-6].minor.yy291 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy291,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy602,yymsp[0].minor.yy288);
160680
+ if( yymsp[-6].minor.yy291 ){
160681
+ SrcItem *pNew = &yymsp[-6].minor.yy291->a[yymsp[-6].minor.yy291->nSrc-1];
160682
+ SrcItem *pOld = yymsp[-4].minor.yy291->a;
160237160683
pNew->zName = pOld->zName;
160238160684
pNew->zDatabase = pOld->zDatabase;
160239160685
pNew->pSelect = pOld->pSelect;
160240160686
if( pOld->fg.isTabFunc ){
160241160687
pNew->u1.pFuncArg = pOld->u1.pFuncArg;
@@ -160244,240 +160690,240 @@
160244160690
pNew->fg.isTabFunc = 1;
160245160691
}
160246160692
pOld->zName = pOld->zDatabase = 0;
160247160693
pOld->pSelect = 0;
160248160694
}
160249
- sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy457);
160695
+ sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy291);
160250160696
}else{
160251160697
Select *pSubquery;
160252
- sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy457);
160253
- pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy457,0,0,0,0,SF_NestedFrom,0);
160254
- yymsp[-6].minor.yy457 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy457,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy354,yymsp[0].minor.yy498);
160698
+ sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy291);
160699
+ pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy291,0,0,0,0,SF_NestedFrom,0);
160700
+ yymsp[-6].minor.yy291 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy291,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy602,yymsp[0].minor.yy288);
160255160701
}
160256160702
}
160257160703
break;
160258160704
case 111: /* dbnm ::= */
160259160705
case 125: /* indexed_opt ::= */ yytestcase(yyruleno==125);
160260160706
{yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
160261160707
break;
160262160708
case 113: /* fullname ::= nm */
160263160709
{
160264
- yylhsminor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
160265
- if( IN_RENAME_OBJECT && yylhsminor.yy457 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy457->a[0].zName, &yymsp[0].minor.yy0);
160710
+ yylhsminor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
160711
+ if( IN_RENAME_OBJECT && yylhsminor.yy291 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy291->a[0].zName, &yymsp[0].minor.yy0);
160266160712
}
160267
- yymsp[0].minor.yy457 = yylhsminor.yy457;
160713
+ yymsp[0].minor.yy291 = yylhsminor.yy291;
160268160714
break;
160269160715
case 114: /* fullname ::= nm DOT nm */
160270160716
{
160271
- yylhsminor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
160272
- if( IN_RENAME_OBJECT && yylhsminor.yy457 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy457->a[0].zName, &yymsp[0].minor.yy0);
160717
+ yylhsminor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
160718
+ if( IN_RENAME_OBJECT && yylhsminor.yy291 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy291->a[0].zName, &yymsp[0].minor.yy0);
160273160719
}
160274
- yymsp[-2].minor.yy457 = yylhsminor.yy457;
160720
+ yymsp[-2].minor.yy291 = yylhsminor.yy291;
160275160721
break;
160276160722
case 115: /* xfullname ::= nm */
160277
-{yymsp[0].minor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
160723
+{yymsp[0].minor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
160278160724
break;
160279160725
case 116: /* xfullname ::= nm DOT nm */
160280
-{yymsp[-2].minor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
160726
+{yymsp[-2].minor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
160281160727
break;
160282160728
case 117: /* xfullname ::= nm DOT nm AS nm */
160283160729
{
160284
- yymsp[-4].minor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
160285
- if( yymsp[-4].minor.yy457 ) yymsp[-4].minor.yy457->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
160730
+ yymsp[-4].minor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
160731
+ if( yymsp[-4].minor.yy291 ) yymsp[-4].minor.yy291->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
160286160732
}
160287160733
break;
160288160734
case 118: /* xfullname ::= nm AS nm */
160289160735
{
160290
- yymsp[-2].minor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
160291
- if( yymsp[-2].minor.yy457 ) yymsp[-2].minor.yy457->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
160736
+ yymsp[-2].minor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
160737
+ if( yymsp[-2].minor.yy291 ) yymsp[-2].minor.yy291->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
160292160738
}
160293160739
break;
160294160740
case 119: /* joinop ::= COMMA|JOIN */
160295
-{ yymsp[0].minor.yy412 = JT_INNER; }
160741
+{ yymsp[0].minor.yy60 = JT_INNER; }
160296160742
break;
160297160743
case 120: /* joinop ::= JOIN_KW JOIN */
160298
-{yymsp[-1].minor.yy412 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
160744
+{yymsp[-1].minor.yy60 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
160299160745
break;
160300160746
case 121: /* joinop ::= JOIN_KW nm JOIN */
160301
-{yymsp[-2].minor.yy412 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
160747
+{yymsp[-2].minor.yy60 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
160302160748
break;
160303160749
case 122: /* joinop ::= JOIN_KW nm nm JOIN */
160304
-{yymsp[-3].minor.yy412 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
160750
+{yymsp[-3].minor.yy60 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
160305160751
break;
160306160752
case 123: /* on_opt ::= ON expr */
160307160753
case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143);
160308160754
case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150);
160309160755
case 152: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==152);
160310160756
case 223: /* case_else ::= ELSE expr */ yytestcase(yyruleno==223);
160311160757
case 244: /* vinto ::= INTO expr */ yytestcase(yyruleno==244);
160312
-{yymsp[-1].minor.yy354 = yymsp[0].minor.yy354;}
160758
+{yymsp[-1].minor.yy602 = yymsp[0].minor.yy602;}
160313160759
break;
160314160760
case 124: /* on_opt ::= */
160315160761
case 142: /* having_opt ::= */ yytestcase(yyruleno==142);
160316160762
case 144: /* limit_opt ::= */ yytestcase(yyruleno==144);
160317160763
case 149: /* where_opt ::= */ yytestcase(yyruleno==149);
160318160764
case 151: /* where_opt_ret ::= */ yytestcase(yyruleno==151);
160319160765
case 224: /* case_else ::= */ yytestcase(yyruleno==224);
160320160766
case 226: /* case_operand ::= */ yytestcase(yyruleno==226);
160321160767
case 245: /* vinto ::= */ yytestcase(yyruleno==245);
160322
-{yymsp[1].minor.yy354 = 0;}
160768
+{yymsp[1].minor.yy602 = 0;}
160323160769
break;
160324160770
case 126: /* indexed_opt ::= INDEXED BY nm */
160325160771
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
160326160772
break;
160327160773
case 127: /* indexed_opt ::= NOT INDEXED */
160328160774
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
160329160775
break;
160330160776
case 128: /* using_opt ::= USING LP idlist RP */
160331
-{yymsp[-3].minor.yy498 = yymsp[-1].minor.yy498;}
160777
+{yymsp[-3].minor.yy288 = yymsp[-1].minor.yy288;}
160332160778
break;
160333160779
case 129: /* using_opt ::= */
160334160780
case 171: /* idlist_opt ::= */ yytestcase(yyruleno==171);
160335
-{yymsp[1].minor.yy498 = 0;}
160781
+{yymsp[1].minor.yy288 = 0;}
160336160782
break;
160337160783
case 131: /* orderby_opt ::= ORDER BY sortlist */
160338160784
case 141: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==141);
160339
-{yymsp[-2].minor.yy350 = yymsp[0].minor.yy350;}
160785
+{yymsp[-2].minor.yy338 = yymsp[0].minor.yy338;}
160340160786
break;
160341160787
case 132: /* sortlist ::= sortlist COMMA expr sortorder nulls */
160342160788
{
160343
- yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy350,yymsp[-2].minor.yy354);
160344
- sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy350,yymsp[-1].minor.yy412,yymsp[0].minor.yy412);
160789
+ yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy338,yymsp[-2].minor.yy602);
160790
+ sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy338,yymsp[-1].minor.yy60,yymsp[0].minor.yy60);
160345160791
}
160346160792
break;
160347160793
case 133: /* sortlist ::= expr sortorder nulls */
160348160794
{
160349
- yymsp[-2].minor.yy350 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy354); /*A-overwrites-Y*/
160350
- sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy350,yymsp[-1].minor.yy412,yymsp[0].minor.yy412);
160795
+ yymsp[-2].minor.yy338 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy602); /*A-overwrites-Y*/
160796
+ sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy338,yymsp[-1].minor.yy60,yymsp[0].minor.yy60);
160351160797
}
160352160798
break;
160353160799
case 134: /* sortorder ::= ASC */
160354
-{yymsp[0].minor.yy412 = SQLITE_SO_ASC;}
160800
+{yymsp[0].minor.yy60 = SQLITE_SO_ASC;}
160355160801
break;
160356160802
case 135: /* sortorder ::= DESC */
160357
-{yymsp[0].minor.yy412 = SQLITE_SO_DESC;}
160803
+{yymsp[0].minor.yy60 = SQLITE_SO_DESC;}
160358160804
break;
160359160805
case 136: /* sortorder ::= */
160360160806
case 139: /* nulls ::= */ yytestcase(yyruleno==139);
160361
-{yymsp[1].minor.yy412 = SQLITE_SO_UNDEFINED;}
160807
+{yymsp[1].minor.yy60 = SQLITE_SO_UNDEFINED;}
160362160808
break;
160363160809
case 137: /* nulls ::= NULLS FIRST */
160364
-{yymsp[-1].minor.yy412 = SQLITE_SO_ASC;}
160810
+{yymsp[-1].minor.yy60 = SQLITE_SO_ASC;}
160365160811
break;
160366160812
case 138: /* nulls ::= NULLS LAST */
160367
-{yymsp[-1].minor.yy412 = SQLITE_SO_DESC;}
160813
+{yymsp[-1].minor.yy60 = SQLITE_SO_DESC;}
160368160814
break;
160369160815
case 145: /* limit_opt ::= LIMIT expr */
160370
-{yymsp[-1].minor.yy354 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy354,0);}
160816
+{yymsp[-1].minor.yy602 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy602,0);}
160371160817
break;
160372160818
case 146: /* limit_opt ::= LIMIT expr OFFSET expr */
160373
-{yymsp[-3].minor.yy354 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy354,yymsp[0].minor.yy354);}
160819
+{yymsp[-3].minor.yy602 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy602,yymsp[0].minor.yy602);}
160374160820
break;
160375160821
case 147: /* limit_opt ::= LIMIT expr COMMA expr */
160376
-{yymsp[-3].minor.yy354 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy354,yymsp[-2].minor.yy354);}
160822
+{yymsp[-3].minor.yy602 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy602,yymsp[-2].minor.yy602);}
160377160823
break;
160378160824
case 148: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
160379160825
{
160380
- sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy457, &yymsp[-1].minor.yy0);
160381
- sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy457,yymsp[0].minor.yy354,0,0);
160826
+ sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy291, &yymsp[-1].minor.yy0);
160827
+ sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy291,yymsp[0].minor.yy602,0,0);
160382160828
}
160383160829
break;
160384160830
case 153: /* where_opt_ret ::= RETURNING selcollist */
160385
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy350); yymsp[-1].minor.yy354 = 0;}
160831
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy338); yymsp[-1].minor.yy602 = 0;}
160386160832
break;
160387160833
case 154: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
160388
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy350); yymsp[-3].minor.yy354 = yymsp[-2].minor.yy354;}
160834
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy338); yymsp[-3].minor.yy602 = yymsp[-2].minor.yy602;}
160389160835
break;
160390160836
case 155: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
160391160837
{
160392
- sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy457, &yymsp[-4].minor.yy0);
160393
- sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy350,"set list");
160394
- yymsp[-5].minor.yy457 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy457, yymsp[-1].minor.yy457);
160395
- sqlite3Update(pParse,yymsp[-5].minor.yy457,yymsp[-2].minor.yy350,yymsp[0].minor.yy354,yymsp[-6].minor.yy412,0,0,0);
160838
+ sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy291, &yymsp[-4].minor.yy0);
160839
+ sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy338,"set list");
160840
+ yymsp[-5].minor.yy291 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy291, yymsp[-1].minor.yy291);
160841
+ sqlite3Update(pParse,yymsp[-5].minor.yy291,yymsp[-2].minor.yy338,yymsp[0].minor.yy602,yymsp[-6].minor.yy60,0,0,0);
160396160842
}
160397160843
break;
160398160844
case 156: /* setlist ::= setlist COMMA nm EQ expr */
160399160845
{
160400
- yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy350, yymsp[0].minor.yy354);
160401
- sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy350, &yymsp[-2].minor.yy0, 1);
160846
+ yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy338, yymsp[0].minor.yy602);
160847
+ sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy338, &yymsp[-2].minor.yy0, 1);
160402160848
}
160403160849
break;
160404160850
case 157: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
160405160851
{
160406
- yymsp[-6].minor.yy350 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy350, yymsp[-3].minor.yy498, yymsp[0].minor.yy354);
160852
+ yymsp[-6].minor.yy338 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy338, yymsp[-3].minor.yy288, yymsp[0].minor.yy602);
160407160853
}
160408160854
break;
160409160855
case 158: /* setlist ::= nm EQ expr */
160410160856
{
160411
- yylhsminor.yy350 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy354);
160412
- sqlite3ExprListSetName(pParse, yylhsminor.yy350, &yymsp[-2].minor.yy0, 1);
160857
+ yylhsminor.yy338 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy602);
160858
+ sqlite3ExprListSetName(pParse, yylhsminor.yy338, &yymsp[-2].minor.yy0, 1);
160413160859
}
160414
- yymsp[-2].minor.yy350 = yylhsminor.yy350;
160860
+ yymsp[-2].minor.yy338 = yylhsminor.yy338;
160415160861
break;
160416160862
case 159: /* setlist ::= LP idlist RP EQ expr */
160417160863
{
160418
- yymsp[-4].minor.yy350 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy498, yymsp[0].minor.yy354);
160864
+ yymsp[-4].minor.yy338 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy288, yymsp[0].minor.yy602);
160419160865
}
160420160866
break;
160421160867
case 160: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
160422160868
{
160423
- sqlite3Insert(pParse, yymsp[-3].minor.yy457, yymsp[-1].minor.yy293, yymsp[-2].minor.yy498, yymsp[-5].minor.yy412, yymsp[0].minor.yy40);
160869
+ sqlite3Insert(pParse, yymsp[-3].minor.yy291, yymsp[-1].minor.yy307, yymsp[-2].minor.yy288, yymsp[-5].minor.yy60, yymsp[0].minor.yy178);
160424160870
}
160425160871
break;
160426160872
case 161: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
160427160873
{
160428
- sqlite3Insert(pParse, yymsp[-4].minor.yy457, 0, yymsp[-3].minor.yy498, yymsp[-6].minor.yy412, 0);
160874
+ sqlite3Insert(pParse, yymsp[-4].minor.yy291, 0, yymsp[-3].minor.yy288, yymsp[-6].minor.yy60, 0);
160429160875
}
160430160876
break;
160431160877
case 162: /* upsert ::= */
160432
-{ yymsp[1].minor.yy40 = 0; }
160878
+{ yymsp[1].minor.yy178 = 0; }
160433160879
break;
160434160880
case 163: /* upsert ::= RETURNING selcollist */
160435
-{ yymsp[-1].minor.yy40 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy350); }
160881
+{ yymsp[-1].minor.yy178 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy338); }
160436160882
break;
160437160883
case 164: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
160438
-{ yymsp[-11].minor.yy40 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy350,yymsp[-6].minor.yy354,yymsp[-2].minor.yy350,yymsp[-1].minor.yy354,yymsp[0].minor.yy40);}
160884
+{ yymsp[-11].minor.yy178 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy338,yymsp[-6].minor.yy602,yymsp[-2].minor.yy338,yymsp[-1].minor.yy602,yymsp[0].minor.yy178);}
160439160885
break;
160440160886
case 165: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
160441
-{ yymsp[-8].minor.yy40 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy350,yymsp[-3].minor.yy354,0,0,yymsp[0].minor.yy40); }
160887
+{ yymsp[-8].minor.yy178 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy338,yymsp[-3].minor.yy602,0,0,yymsp[0].minor.yy178); }
160442160888
break;
160443160889
case 166: /* upsert ::= ON CONFLICT DO NOTHING returning */
160444
-{ yymsp[-4].minor.yy40 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
160890
+{ yymsp[-4].minor.yy178 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
160445160891
break;
160446160892
case 167: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
160447
-{ yymsp[-7].minor.yy40 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy350,yymsp[-1].minor.yy354,0);}
160893
+{ yymsp[-7].minor.yy178 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy338,yymsp[-1].minor.yy602,0);}
160448160894
break;
160449160895
case 168: /* returning ::= RETURNING selcollist */
160450
-{sqlite3AddReturning(pParse,yymsp[0].minor.yy350);}
160896
+{sqlite3AddReturning(pParse,yymsp[0].minor.yy338);}
160451160897
break;
160452160898
case 172: /* idlist_opt ::= LP idlist RP */
160453
-{yymsp[-2].minor.yy498 = yymsp[-1].minor.yy498;}
160899
+{yymsp[-2].minor.yy288 = yymsp[-1].minor.yy288;}
160454160900
break;
160455160901
case 173: /* idlist ::= idlist COMMA nm */
160456
-{yymsp[-2].minor.yy498 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy498,&yymsp[0].minor.yy0);}
160902
+{yymsp[-2].minor.yy288 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy288,&yymsp[0].minor.yy0);}
160457160903
break;
160458160904
case 174: /* idlist ::= nm */
160459
-{yymsp[0].minor.yy498 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
160905
+{yymsp[0].minor.yy288 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
160460160906
break;
160461160907
case 175: /* expr ::= LP expr RP */
160462
-{yymsp[-2].minor.yy354 = yymsp[-1].minor.yy354;}
160908
+{yymsp[-2].minor.yy602 = yymsp[-1].minor.yy602;}
160463160909
break;
160464160910
case 176: /* expr ::= ID|INDEXED */
160465160911
case 177: /* expr ::= JOIN_KW */ yytestcase(yyruleno==177);
160466
-{yymsp[0].minor.yy354=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
160912
+{yymsp[0].minor.yy602=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
160467160913
break;
160468160914
case 178: /* expr ::= nm DOT nm */
160469160915
{
160470160916
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
160471160917
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
160472160918
if( IN_RENAME_OBJECT ){
160473160919
sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
160474160920
sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0);
160475160921
}
160476
- yylhsminor.yy354 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
160922
+ yylhsminor.yy602 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
160477160923
}
160478
- yymsp[-2].minor.yy354 = yylhsminor.yy354;
160924
+ yymsp[-2].minor.yy602 = yylhsminor.yy602;
160479160925
break;
160480160926
case 179: /* expr ::= nm DOT nm DOT nm */
160481160927
{
160482160928
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
160483160929
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
@@ -160485,322 +160931,322 @@
160485160931
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
160486160932
if( IN_RENAME_OBJECT ){
160487160933
sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0);
160488160934
sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0);
160489160935
}
160490
- yylhsminor.yy354 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
160936
+ yylhsminor.yy602 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
160491160937
}
160492
- yymsp[-4].minor.yy354 = yylhsminor.yy354;
160938
+ yymsp[-4].minor.yy602 = yylhsminor.yy602;
160493160939
break;
160494160940
case 180: /* term ::= NULL|FLOAT|BLOB */
160495160941
case 181: /* term ::= STRING */ yytestcase(yyruleno==181);
160496
-{yymsp[0].minor.yy354=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
160942
+{yymsp[0].minor.yy602=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
160497160943
break;
160498160944
case 182: /* term ::= INTEGER */
160499160945
{
160500
- yylhsminor.yy354 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
160946
+ yylhsminor.yy602 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
160501160947
}
160502
- yymsp[0].minor.yy354 = yylhsminor.yy354;
160948
+ yymsp[0].minor.yy602 = yylhsminor.yy602;
160503160949
break;
160504160950
case 183: /* expr ::= VARIABLE */
160505160951
{
160506160952
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
160507160953
u32 n = yymsp[0].minor.yy0.n;
160508
- yymsp[0].minor.yy354 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
160509
- sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy354, n);
160954
+ yymsp[0].minor.yy602 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
160955
+ sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy602, n);
160510160956
}else{
160511160957
/* When doing a nested parse, one can include terms in an expression
160512160958
** that look like this: #1 #2 ... These terms refer to registers
160513160959
** in the virtual machine. #N is the N-th register. */
160514160960
Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
160515160961
assert( t.n>=2 );
160516160962
if( pParse->nested==0 ){
160517160963
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
160518
- yymsp[0].minor.yy354 = 0;
160964
+ yymsp[0].minor.yy602 = 0;
160519160965
}else{
160520
- yymsp[0].minor.yy354 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
160521
- if( yymsp[0].minor.yy354 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy354->iTable);
160966
+ yymsp[0].minor.yy602 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
160967
+ if( yymsp[0].minor.yy602 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy602->iTable);
160522160968
}
160523160969
}
160524160970
}
160525160971
break;
160526160972
case 184: /* expr ::= expr COLLATE ID|STRING */
160527160973
{
160528
- yymsp[-2].minor.yy354 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy354, &yymsp[0].minor.yy0, 1);
160974
+ yymsp[-2].minor.yy602 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy602, &yymsp[0].minor.yy0, 1);
160529160975
}
160530160976
break;
160531160977
case 185: /* expr ::= CAST LP expr AS typetoken RP */
160532160978
{
160533
- yymsp[-5].minor.yy354 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
160534
- sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy354, yymsp[-3].minor.yy354, 0);
160979
+ yymsp[-5].minor.yy602 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
160980
+ sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy602, yymsp[-3].minor.yy602, 0);
160535160981
}
160536160982
break;
160537160983
case 186: /* expr ::= ID|INDEXED LP distinct exprlist RP */
160538160984
{
160539
- yylhsminor.yy354 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy350, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy412);
160985
+ yylhsminor.yy602 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy338, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy60);
160540160986
}
160541
- yymsp[-4].minor.yy354 = yylhsminor.yy354;
160987
+ yymsp[-4].minor.yy602 = yylhsminor.yy602;
160542160988
break;
160543160989
case 187: /* expr ::= ID|INDEXED LP STAR RP */
160544160990
{
160545
- yylhsminor.yy354 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
160991
+ yylhsminor.yy602 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
160546160992
}
160547
- yymsp[-3].minor.yy354 = yylhsminor.yy354;
160993
+ yymsp[-3].minor.yy602 = yylhsminor.yy602;
160548160994
break;
160549160995
case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
160550160996
{
160551
- yylhsminor.yy354 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy350, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy412);
160552
- sqlite3WindowAttach(pParse, yylhsminor.yy354, yymsp[0].minor.yy503);
160997
+ yylhsminor.yy602 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy338, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy60);
160998
+ sqlite3WindowAttach(pParse, yylhsminor.yy602, yymsp[0].minor.yy19);
160553160999
}
160554
- yymsp[-5].minor.yy354 = yylhsminor.yy354;
161000
+ yymsp[-5].minor.yy602 = yylhsminor.yy602;
160555161001
break;
160556161002
case 189: /* expr ::= ID|INDEXED LP STAR RP filter_over */
160557161003
{
160558
- yylhsminor.yy354 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
160559
- sqlite3WindowAttach(pParse, yylhsminor.yy354, yymsp[0].minor.yy503);
161004
+ yylhsminor.yy602 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
161005
+ sqlite3WindowAttach(pParse, yylhsminor.yy602, yymsp[0].minor.yy19);
160560161006
}
160561
- yymsp[-4].minor.yy354 = yylhsminor.yy354;
161007
+ yymsp[-4].minor.yy602 = yylhsminor.yy602;
160562161008
break;
160563161009
case 190: /* term ::= CTIME_KW */
160564161010
{
160565
- yylhsminor.yy354 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
161011
+ yylhsminor.yy602 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
160566161012
}
160567
- yymsp[0].minor.yy354 = yylhsminor.yy354;
161013
+ yymsp[0].minor.yy602 = yylhsminor.yy602;
160568161014
break;
160569161015
case 191: /* expr ::= LP nexprlist COMMA expr RP */
160570161016
{
160571
- ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy350, yymsp[-1].minor.yy354);
160572
- yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
160573
- if( yymsp[-4].minor.yy354 ){
160574
- yymsp[-4].minor.yy354->x.pList = pList;
161017
+ ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy338, yymsp[-1].minor.yy602);
161018
+ yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
161019
+ if( yymsp[-4].minor.yy602 ){
161020
+ yymsp[-4].minor.yy602->x.pList = pList;
160575161021
if( ALWAYS(pList->nExpr) ){
160576
- yymsp[-4].minor.yy354->flags |= pList->a[0].pExpr->flags & EP_Propagate;
161022
+ yymsp[-4].minor.yy602->flags |= pList->a[0].pExpr->flags & EP_Propagate;
160577161023
}
160578161024
}else{
160579161025
sqlite3ExprListDelete(pParse->db, pList);
160580161026
}
160581161027
}
160582161028
break;
160583161029
case 192: /* expr ::= expr AND expr */
160584
-{yymsp[-2].minor.yy354=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy354,yymsp[0].minor.yy354);}
161030
+{yymsp[-2].minor.yy602=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy602,yymsp[0].minor.yy602);}
160585161031
break;
160586161032
case 193: /* expr ::= expr OR expr */
160587161033
case 194: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==194);
160588161034
case 195: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==195);
160589161035
case 196: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==196);
160590161036
case 197: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==197);
160591161037
case 198: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==198);
160592161038
case 199: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==199);
160593
-{yymsp[-2].minor.yy354=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy354,yymsp[0].minor.yy354);}
161039
+{yymsp[-2].minor.yy602=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy602,yymsp[0].minor.yy602);}
160594161040
break;
160595161041
case 200: /* likeop ::= NOT LIKE_KW|MATCH */
160596161042
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
160597161043
break;
160598161044
case 201: /* expr ::= expr likeop expr */
160599161045
{
160600161046
ExprList *pList;
160601161047
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
160602161048
yymsp[-1].minor.yy0.n &= 0x7fffffff;
160603
- pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy354);
160604
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy354);
160605
- yymsp[-2].minor.yy354 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
160606
- if( bNot ) yymsp[-2].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy354, 0);
160607
- if( yymsp[-2].minor.yy354 ) yymsp[-2].minor.yy354->flags |= EP_InfixFunc;
161049
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy602);
161050
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy602);
161051
+ yymsp[-2].minor.yy602 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
161052
+ if( bNot ) yymsp[-2].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy602, 0);
161053
+ if( yymsp[-2].minor.yy602 ) yymsp[-2].minor.yy602->flags |= EP_InfixFunc;
160608161054
}
160609161055
break;
160610161056
case 202: /* expr ::= expr likeop expr ESCAPE expr */
160611161057
{
160612161058
ExprList *pList;
160613161059
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
160614161060
yymsp[-3].minor.yy0.n &= 0x7fffffff;
160615
- pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy354);
160616
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy354);
160617
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy354);
160618
- yymsp[-4].minor.yy354 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
160619
- if( bNot ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
160620
- if( yymsp[-4].minor.yy354 ) yymsp[-4].minor.yy354->flags |= EP_InfixFunc;
161061
+ pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy602);
161062
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy602);
161063
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy602);
161064
+ yymsp[-4].minor.yy602 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
161065
+ if( bNot ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
161066
+ if( yymsp[-4].minor.yy602 ) yymsp[-4].minor.yy602->flags |= EP_InfixFunc;
160621161067
}
160622161068
break;
160623161069
case 203: /* expr ::= expr ISNULL|NOTNULL */
160624
-{yymsp[-1].minor.yy354 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy354,0);}
161070
+{yymsp[-1].minor.yy602 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy602,0);}
160625161071
break;
160626161072
case 204: /* expr ::= expr NOT NULL */
160627
-{yymsp[-2].minor.yy354 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy354,0);}
161073
+{yymsp[-2].minor.yy602 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy602,0);}
160628161074
break;
160629161075
case 205: /* expr ::= expr IS expr */
160630161076
{
160631
- yymsp[-2].minor.yy354 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy354,yymsp[0].minor.yy354);
160632
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy354, yymsp[-2].minor.yy354, TK_ISNULL);
161077
+ yymsp[-2].minor.yy602 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy602,yymsp[0].minor.yy602);
161078
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy602, yymsp[-2].minor.yy602, TK_ISNULL);
160633161079
}
160634161080
break;
160635161081
case 206: /* expr ::= expr IS NOT expr */
160636161082
{
160637
- yymsp[-3].minor.yy354 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy354,yymsp[0].minor.yy354);
160638
- binaryToUnaryIfNull(pParse, yymsp[0].minor.yy354, yymsp[-3].minor.yy354, TK_NOTNULL);
161083
+ yymsp[-3].minor.yy602 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy602,yymsp[0].minor.yy602);
161084
+ binaryToUnaryIfNull(pParse, yymsp[0].minor.yy602, yymsp[-3].minor.yy602, TK_NOTNULL);
160639161085
}
160640161086
break;
160641161087
case 207: /* expr ::= NOT expr */
160642161088
case 208: /* expr ::= BITNOT expr */ yytestcase(yyruleno==208);
160643
-{yymsp[-1].minor.yy354 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy354, 0);/*A-overwrites-B*/}
161089
+{yymsp[-1].minor.yy602 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy602, 0);/*A-overwrites-B*/}
160644161090
break;
160645161091
case 209: /* expr ::= PLUS|MINUS expr */
160646161092
{
160647
- yymsp[-1].minor.yy354 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy354, 0);
161093
+ yymsp[-1].minor.yy602 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy602, 0);
160648161094
/*A-overwrites-B*/
160649161095
}
160650161096
break;
160651161097
case 210: /* between_op ::= BETWEEN */
160652161098
case 213: /* in_op ::= IN */ yytestcase(yyruleno==213);
160653
-{yymsp[0].minor.yy412 = 0;}
161099
+{yymsp[0].minor.yy60 = 0;}
160654161100
break;
160655161101
case 212: /* expr ::= expr between_op expr AND expr */
160656161102
{
160657
- ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy354);
160658
- pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy354);
160659
- yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy354, 0);
160660
- if( yymsp[-4].minor.yy354 ){
160661
- yymsp[-4].minor.yy354->x.pList = pList;
161103
+ ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy602);
161104
+ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy602);
161105
+ yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy602, 0);
161106
+ if( yymsp[-4].minor.yy602 ){
161107
+ yymsp[-4].minor.yy602->x.pList = pList;
160662161108
}else{
160663161109
sqlite3ExprListDelete(pParse->db, pList);
160664161110
}
160665
- if( yymsp[-3].minor.yy412 ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
161111
+ if( yymsp[-3].minor.yy60 ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
160666161112
}
160667161113
break;
160668161114
case 215: /* expr ::= expr in_op LP exprlist RP */
160669161115
{
160670
- if( yymsp[-1].minor.yy350==0 ){
161116
+ if( yymsp[-1].minor.yy338==0 ){
160671161117
/* Expressions of the form
160672161118
**
160673161119
** expr1 IN ()
160674161120
** expr1 NOT IN ()
160675161121
**
160676161122
** simplify to constants 0 (false) and 1 (true), respectively,
160677161123
** regardless of the value of expr1.
160678161124
*/
160679
- sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy354);
160680
- yymsp[-4].minor.yy354 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy412 ? "1" : "0");
160681
- }else if( yymsp[-1].minor.yy350->nExpr==1 && sqlite3ExprIsConstant(yymsp[-1].minor.yy350->a[0].pExpr) ){
160682
- Expr *pRHS = yymsp[-1].minor.yy350->a[0].pExpr;
160683
- yymsp[-1].minor.yy350->a[0].pExpr = 0;
160684
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy350);
161125
+ sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy602);
161126
+ yymsp[-4].minor.yy602 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy60 ? "1" : "0");
161127
+ }else if( yymsp[-1].minor.yy338->nExpr==1 && sqlite3ExprIsConstant(yymsp[-1].minor.yy338->a[0].pExpr) ){
161128
+ Expr *pRHS = yymsp[-1].minor.yy338->a[0].pExpr;
161129
+ yymsp[-1].minor.yy338->a[0].pExpr = 0;
161130
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy338);
160685161131
pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
160686
- yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy354, pRHS);
160687
- if( yymsp[-3].minor.yy412 ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
160688
- }else{
160689
- yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy354, 0);
160690
- if( yymsp[-4].minor.yy354 ){
160691
- yymsp[-4].minor.yy354->x.pList = yymsp[-1].minor.yy350;
160692
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy354);
160693
- }else{
160694
- sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy350);
160695
- }
160696
- if( yymsp[-3].minor.yy412 ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
161132
+ yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy602, pRHS);
161133
+ if( yymsp[-3].minor.yy60 ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
161134
+ }else{
161135
+ yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy602, 0);
161136
+ if( yymsp[-4].minor.yy602 ){
161137
+ yymsp[-4].minor.yy602->x.pList = yymsp[-1].minor.yy338;
161138
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy602);
161139
+ }else{
161140
+ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy338);
161141
+ }
161142
+ if( yymsp[-3].minor.yy60 ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
160697161143
}
160698161144
}
160699161145
break;
160700161146
case 216: /* expr ::= LP select RP */
160701161147
{
160702
- yymsp[-2].minor.yy354 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
160703
- sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy354, yymsp[-1].minor.yy293);
161148
+ yymsp[-2].minor.yy602 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
161149
+ sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy602, yymsp[-1].minor.yy307);
160704161150
}
160705161151
break;
160706161152
case 217: /* expr ::= expr in_op LP select RP */
160707161153
{
160708
- yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy354, 0);
160709
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy354, yymsp[-1].minor.yy293);
160710
- if( yymsp[-3].minor.yy412 ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
161154
+ yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy602, 0);
161155
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy602, yymsp[-1].minor.yy307);
161156
+ if( yymsp[-3].minor.yy60 ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
160711161157
}
160712161158
break;
160713161159
case 218: /* expr ::= expr in_op nm dbnm paren_exprlist */
160714161160
{
160715161161
SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
160716161162
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
160717
- if( yymsp[0].minor.yy350 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy350);
160718
- yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy354, 0);
160719
- sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy354, pSelect);
160720
- if( yymsp[-3].minor.yy412 ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
161163
+ if( yymsp[0].minor.yy338 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy338);
161164
+ yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy602, 0);
161165
+ sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy602, pSelect);
161166
+ if( yymsp[-3].minor.yy60 ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
160721161167
}
160722161168
break;
160723161169
case 219: /* expr ::= EXISTS LP select RP */
160724161170
{
160725161171
Expr *p;
160726
- p = yymsp[-3].minor.yy354 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
160727
- sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy293);
161172
+ p = yymsp[-3].minor.yy602 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
161173
+ sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy307);
160728161174
}
160729161175
break;
160730161176
case 220: /* expr ::= CASE case_operand case_exprlist case_else END */
160731161177
{
160732
- yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy354, 0);
160733
- if( yymsp[-4].minor.yy354 ){
160734
- yymsp[-4].minor.yy354->x.pList = yymsp[-1].minor.yy354 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy350,yymsp[-1].minor.yy354) : yymsp[-2].minor.yy350;
160735
- sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy354);
161178
+ yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy602, 0);
161179
+ if( yymsp[-4].minor.yy602 ){
161180
+ yymsp[-4].minor.yy602->x.pList = yymsp[-1].minor.yy602 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy338,yymsp[-1].minor.yy602) : yymsp[-2].minor.yy338;
161181
+ sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy602);
160736161182
}else{
160737
- sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy350);
160738
- sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy354);
161183
+ sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy338);
161184
+ sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy602);
160739161185
}
160740161186
}
160741161187
break;
160742161188
case 221: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
160743161189
{
160744
- yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy350, yymsp[-2].minor.yy354);
160745
- yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy350, yymsp[0].minor.yy354);
161190
+ yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy338, yymsp[-2].minor.yy602);
161191
+ yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy338, yymsp[0].minor.yy602);
160746161192
}
160747161193
break;
160748161194
case 222: /* case_exprlist ::= WHEN expr THEN expr */
160749161195
{
160750
- yymsp[-3].minor.yy350 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy354);
160751
- yymsp[-3].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy350, yymsp[0].minor.yy354);
161196
+ yymsp[-3].minor.yy338 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy602);
161197
+ yymsp[-3].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy338, yymsp[0].minor.yy602);
160752161198
}
160753161199
break;
160754161200
case 225: /* case_operand ::= expr */
160755
-{yymsp[0].minor.yy354 = yymsp[0].minor.yy354; /*A-overwrites-X*/}
161201
+{yymsp[0].minor.yy602 = yymsp[0].minor.yy602; /*A-overwrites-X*/}
160756161202
break;
160757161203
case 228: /* nexprlist ::= nexprlist COMMA expr */
160758
-{yymsp[-2].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy350,yymsp[0].minor.yy354);}
161204
+{yymsp[-2].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy338,yymsp[0].minor.yy602);}
160759161205
break;
160760161206
case 229: /* nexprlist ::= expr */
160761
-{yymsp[0].minor.yy350 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy354); /*A-overwrites-Y*/}
161207
+{yymsp[0].minor.yy338 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy602); /*A-overwrites-Y*/}
160762161208
break;
160763161209
case 231: /* paren_exprlist ::= LP exprlist RP */
160764161210
case 236: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==236);
160765
-{yymsp[-2].minor.yy350 = yymsp[-1].minor.yy350;}
161211
+{yymsp[-2].minor.yy338 = yymsp[-1].minor.yy338;}
160766161212
break;
160767161213
case 232: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
160768161214
{
160769161215
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
160770
- sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy350, yymsp[-10].minor.yy412,
160771
- &yymsp[-11].minor.yy0, yymsp[0].minor.yy354, SQLITE_SO_ASC, yymsp[-8].minor.yy412, SQLITE_IDXTYPE_APPDEF);
161216
+ sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy338, yymsp[-10].minor.yy60,
161217
+ &yymsp[-11].minor.yy0, yymsp[0].minor.yy602, SQLITE_SO_ASC, yymsp[-8].minor.yy60, SQLITE_IDXTYPE_APPDEF);
160772161218
if( IN_RENAME_OBJECT && pParse->pNewIndex ){
160773161219
sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
160774161220
}
160775161221
}
160776161222
break;
160777161223
case 233: /* uniqueflag ::= UNIQUE */
160778161224
case 275: /* raisetype ::= ABORT */ yytestcase(yyruleno==275);
160779
-{yymsp[0].minor.yy412 = OE_Abort;}
161225
+{yymsp[0].minor.yy60 = OE_Abort;}
160780161226
break;
160781161227
case 234: /* uniqueflag ::= */
160782
-{yymsp[1].minor.yy412 = OE_None;}
161228
+{yymsp[1].minor.yy60 = OE_None;}
160783161229
break;
160784161230
case 237: /* eidlist ::= eidlist COMMA nm collate sortorder */
160785161231
{
160786
- yymsp[-4].minor.yy350 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy350, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy412, yymsp[0].minor.yy412);
161232
+ yymsp[-4].minor.yy338 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy338, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy60, yymsp[0].minor.yy60);
160787161233
}
160788161234
break;
160789161235
case 238: /* eidlist ::= nm collate sortorder */
160790161236
{
160791
- yymsp[-2].minor.yy350 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy412, yymsp[0].minor.yy412); /*A-overwrites-Y*/
161237
+ yymsp[-2].minor.yy338 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy60, yymsp[0].minor.yy60); /*A-overwrites-Y*/
160792161238
}
160793161239
break;
160794161240
case 241: /* cmd ::= DROP INDEX ifexists fullname */
160795
-{sqlite3DropIndex(pParse, yymsp[0].minor.yy457, yymsp[-1].minor.yy412);}
161241
+{sqlite3DropIndex(pParse, yymsp[0].minor.yy291, yymsp[-1].minor.yy60);}
160796161242
break;
160797161243
case 242: /* cmd ::= VACUUM vinto */
160798
-{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy354);}
161244
+{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy602);}
160799161245
break;
160800161246
case 243: /* cmd ::= VACUUM nm vinto */
160801
-{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy354);}
161247
+{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy602);}
160802161248
break;
160803161249
case 246: /* cmd ::= PRAGMA nm dbnm */
160804161250
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
160805161251
break;
160806161252
case 247: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
@@ -160818,54 +161264,54 @@
160818161264
case 253: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
160819161265
{
160820161266
Token all;
160821161267
all.z = yymsp[-3].minor.yy0.z;
160822161268
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
160823
- sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy51, &all);
161269
+ sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy483, &all);
160824161270
}
160825161271
break;
160826161272
case 254: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
160827161273
{
160828
- sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy412, yymsp[-4].minor.yy298.a, yymsp[-4].minor.yy298.b, yymsp[-2].minor.yy457, yymsp[0].minor.yy354, yymsp[-10].minor.yy412, yymsp[-8].minor.yy412);
161274
+ sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy60, yymsp[-4].minor.yy50.a, yymsp[-4].minor.yy50.b, yymsp[-2].minor.yy291, yymsp[0].minor.yy602, yymsp[-10].minor.yy60, yymsp[-8].minor.yy60);
160829161275
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
160830161276
}
160831161277
break;
160832161278
case 255: /* trigger_time ::= BEFORE|AFTER */
160833
-{ yymsp[0].minor.yy412 = yymsp[0].major; /*A-overwrites-X*/ }
161279
+{ yymsp[0].minor.yy60 = yymsp[0].major; /*A-overwrites-X*/ }
160834161280
break;
160835161281
case 256: /* trigger_time ::= INSTEAD OF */
160836
-{ yymsp[-1].minor.yy412 = TK_INSTEAD;}
161282
+{ yymsp[-1].minor.yy60 = TK_INSTEAD;}
160837161283
break;
160838161284
case 257: /* trigger_time ::= */
160839
-{ yymsp[1].minor.yy412 = TK_BEFORE; }
161285
+{ yymsp[1].minor.yy60 = TK_BEFORE; }
160840161286
break;
160841161287
case 258: /* trigger_event ::= DELETE|INSERT */
160842161288
case 259: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==259);
160843
-{yymsp[0].minor.yy298.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy298.b = 0;}
161289
+{yymsp[0].minor.yy50.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy50.b = 0;}
160844161290
break;
160845161291
case 260: /* trigger_event ::= UPDATE OF idlist */
160846
-{yymsp[-2].minor.yy298.a = TK_UPDATE; yymsp[-2].minor.yy298.b = yymsp[0].minor.yy498;}
161292
+{yymsp[-2].minor.yy50.a = TK_UPDATE; yymsp[-2].minor.yy50.b = yymsp[0].minor.yy288;}
160847161293
break;
160848161294
case 261: /* when_clause ::= */
160849161295
case 280: /* key_opt ::= */ yytestcase(yyruleno==280);
160850
-{ yymsp[1].minor.yy354 = 0; }
161296
+{ yymsp[1].minor.yy602 = 0; }
160851161297
break;
160852161298
case 262: /* when_clause ::= WHEN expr */
160853161299
case 281: /* key_opt ::= KEY expr */ yytestcase(yyruleno==281);
160854
-{ yymsp[-1].minor.yy354 = yymsp[0].minor.yy354; }
161300
+{ yymsp[-1].minor.yy602 = yymsp[0].minor.yy602; }
160855161301
break;
160856161302
case 263: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
160857161303
{
160858
- assert( yymsp[-2].minor.yy51!=0 );
160859
- yymsp[-2].minor.yy51->pLast->pNext = yymsp[-1].minor.yy51;
160860
- yymsp[-2].minor.yy51->pLast = yymsp[-1].minor.yy51;
161304
+ assert( yymsp[-2].minor.yy483!=0 );
161305
+ yymsp[-2].minor.yy483->pLast->pNext = yymsp[-1].minor.yy483;
161306
+ yymsp[-2].minor.yy483->pLast = yymsp[-1].minor.yy483;
160861161307
}
160862161308
break;
160863161309
case 264: /* trigger_cmd_list ::= trigger_cmd SEMI */
160864161310
{
160865
- assert( yymsp[-1].minor.yy51!=0 );
160866
- yymsp[-1].minor.yy51->pLast = yymsp[-1].minor.yy51;
161311
+ assert( yymsp[-1].minor.yy483!=0 );
161312
+ yymsp[-1].minor.yy483->pLast = yymsp[-1].minor.yy483;
160867161313
}
160868161314
break;
160869161315
case 265: /* trnm ::= nm DOT nm */
160870161316
{
160871161317
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
@@ -160887,62 +161333,62 @@
160887161333
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
160888161334
"within triggers");
160889161335
}
160890161336
break;
160891161337
case 268: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
160892
-{yylhsminor.yy51 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy457, yymsp[-3].minor.yy350, yymsp[-1].minor.yy354, yymsp[-7].minor.yy412, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy504);}
160893
- yymsp[-8].minor.yy51 = yylhsminor.yy51;
161338
+{yylhsminor.yy483 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy291, yymsp[-3].minor.yy338, yymsp[-1].minor.yy602, yymsp[-7].minor.yy60, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy528);}
161339
+ yymsp[-8].minor.yy483 = yylhsminor.yy483;
160894161340
break;
160895161341
case 269: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
160896161342
{
160897
- yylhsminor.yy51 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy498,yymsp[-2].minor.yy293,yymsp[-6].minor.yy412,yymsp[-1].minor.yy40,yymsp[-7].minor.yy504,yymsp[0].minor.yy504);/*yylhsminor.yy51-overwrites-yymsp[-6].minor.yy412*/
161343
+ yylhsminor.yy483 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy288,yymsp[-2].minor.yy307,yymsp[-6].minor.yy60,yymsp[-1].minor.yy178,yymsp[-7].minor.yy528,yymsp[0].minor.yy528);/*yylhsminor.yy483-overwrites-yymsp[-6].minor.yy60*/
160898161344
}
160899
- yymsp[-7].minor.yy51 = yylhsminor.yy51;
161345
+ yymsp[-7].minor.yy483 = yylhsminor.yy483;
160900161346
break;
160901161347
case 270: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
160902
-{yylhsminor.yy51 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy354, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy504);}
160903
- yymsp[-5].minor.yy51 = yylhsminor.yy51;
161348
+{yylhsminor.yy483 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy602, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy528);}
161349
+ yymsp[-5].minor.yy483 = yylhsminor.yy483;
160904161350
break;
160905161351
case 271: /* trigger_cmd ::= scanpt select scanpt */
160906
-{yylhsminor.yy51 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy293, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); /*yylhsminor.yy51-overwrites-yymsp[-1].minor.yy293*/}
160907
- yymsp[-2].minor.yy51 = yylhsminor.yy51;
161352
+{yylhsminor.yy483 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy307, yymsp[-2].minor.yy528, yymsp[0].minor.yy528); /*yylhsminor.yy483-overwrites-yymsp[-1].minor.yy307*/}
161353
+ yymsp[-2].minor.yy483 = yylhsminor.yy483;
160908161354
break;
160909161355
case 272: /* expr ::= RAISE LP IGNORE RP */
160910161356
{
160911
- yymsp[-3].minor.yy354 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
160912
- if( yymsp[-3].minor.yy354 ){
160913
- yymsp[-3].minor.yy354->affExpr = OE_Ignore;
161357
+ yymsp[-3].minor.yy602 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
161358
+ if( yymsp[-3].minor.yy602 ){
161359
+ yymsp[-3].minor.yy602->affExpr = OE_Ignore;
160914161360
}
160915161361
}
160916161362
break;
160917161363
case 273: /* expr ::= RAISE LP raisetype COMMA nm RP */
160918161364
{
160919
- yymsp[-5].minor.yy354 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
160920
- if( yymsp[-5].minor.yy354 ) {
160921
- yymsp[-5].minor.yy354->affExpr = (char)yymsp[-3].minor.yy412;
161365
+ yymsp[-5].minor.yy602 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
161366
+ if( yymsp[-5].minor.yy602 ) {
161367
+ yymsp[-5].minor.yy602->affExpr = (char)yymsp[-3].minor.yy60;
160922161368
}
160923161369
}
160924161370
break;
160925161371
case 274: /* raisetype ::= ROLLBACK */
160926
-{yymsp[0].minor.yy412 = OE_Rollback;}
161372
+{yymsp[0].minor.yy60 = OE_Rollback;}
160927161373
break;
160928161374
case 276: /* raisetype ::= FAIL */
160929
-{yymsp[0].minor.yy412 = OE_Fail;}
161375
+{yymsp[0].minor.yy60 = OE_Fail;}
160930161376
break;
160931161377
case 277: /* cmd ::= DROP TRIGGER ifexists fullname */
160932161378
{
160933
- sqlite3DropTrigger(pParse,yymsp[0].minor.yy457,yymsp[-1].minor.yy412);
161379
+ sqlite3DropTrigger(pParse,yymsp[0].minor.yy291,yymsp[-1].minor.yy60);
160934161380
}
160935161381
break;
160936161382
case 278: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
160937161383
{
160938
- sqlite3Attach(pParse, yymsp[-3].minor.yy354, yymsp[-1].minor.yy354, yymsp[0].minor.yy354);
161384
+ sqlite3Attach(pParse, yymsp[-3].minor.yy602, yymsp[-1].minor.yy602, yymsp[0].minor.yy602);
160939161385
}
160940161386
break;
160941161387
case 279: /* cmd ::= DETACH database_kw_opt expr */
160942161388
{
160943
- sqlite3Detach(pParse, yymsp[0].minor.yy354);
161389
+ sqlite3Detach(pParse, yymsp[0].minor.yy602);
160944161390
}
160945161391
break;
160946161392
case 282: /* cmd ::= REINDEX */
160947161393
{sqlite3Reindex(pParse, 0, 0);}
160948161394
break;
@@ -160955,266 +161401,285 @@
160955161401
case 285: /* cmd ::= ANALYZE nm dbnm */
160956161402
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
160957161403
break;
160958161404
case 286: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
160959161405
{
160960
- sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy457,&yymsp[0].minor.yy0);
161406
+ sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy291,&yymsp[0].minor.yy0);
160961161407
}
160962161408
break;
160963161409
case 287: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
160964161410
{
160965161411
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
160966161412
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
160967161413
}
160968161414
break;
160969
- case 288: /* add_column_fullname ::= fullname */
161415
+ case 288: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
161416
+{
161417
+ sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy291, &yymsp[0].minor.yy0);
161418
+}
161419
+ break;
161420
+ case 289: /* add_column_fullname ::= fullname */
160970161421
{
160971161422
disableLookaside(pParse);
160972
- sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy457);
160973
-}
160974
- break;
160975
- case 289: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
160976
-{
160977
- sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy457, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
160978
-}
160979
- break;
160980
- case 290: /* cmd ::= create_vtab */
161423
+ sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy291);
161424
+}
161425
+ break;
161426
+ case 290: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
161427
+{
161428
+ sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy291, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
161429
+}
161430
+ break;
161431
+ case 291: /* cmd ::= create_vtab */
160981161432
{sqlite3VtabFinishParse(pParse,0);}
160982161433
break;
160983
- case 291: /* cmd ::= create_vtab LP vtabarglist RP */
161434
+ case 292: /* cmd ::= create_vtab LP vtabarglist RP */
160984161435
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
160985161436
break;
160986
- case 292: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
161437
+ case 293: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
160987161438
{
160988
- sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy412);
161439
+ sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy60);
160989161440
}
160990161441
break;
160991
- case 293: /* vtabarg ::= */
161442
+ case 294: /* vtabarg ::= */
160992161443
{sqlite3VtabArgInit(pParse);}
160993161444
break;
160994
- case 294: /* vtabargtoken ::= ANY */
160995
- case 295: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==295);
160996
- case 296: /* lp ::= LP */ yytestcase(yyruleno==296);
161445
+ case 295: /* vtabargtoken ::= ANY */
161446
+ case 296: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==296);
161447
+ case 297: /* lp ::= LP */ yytestcase(yyruleno==297);
160997161448
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
160998161449
break;
160999
- case 297: /* with ::= WITH wqlist */
161000
- case 298: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==298);
161001
-{ sqlite3WithPush(pParse, yymsp[0].minor.yy105, 1); }
161002
- break;
161003
- case 299: /* wqlist ::= nm eidlist_opt AS LP select RP */
161004
-{
161005
- yymsp[-5].minor.yy105 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy350, yymsp[-1].minor.yy293); /*A-overwrites-X*/
161006
-}
161007
- break;
161008
- case 300: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
161009
-{
161010
- yymsp[-7].minor.yy105 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy105, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy350, yymsp[-1].minor.yy293);
161011
-}
161012
- break;
161013
- case 301: /* windowdefn_list ::= windowdefn */
161014
-{ yylhsminor.yy503 = yymsp[0].minor.yy503; }
161015
- yymsp[0].minor.yy503 = yylhsminor.yy503;
161016
- break;
161017
- case 302: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
161018
-{
161019
- assert( yymsp[0].minor.yy503!=0 );
161020
- sqlite3WindowChain(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy503);
161021
- yymsp[0].minor.yy503->pNextWin = yymsp[-2].minor.yy503;
161022
- yylhsminor.yy503 = yymsp[0].minor.yy503;
161023
-}
161024
- yymsp[-2].minor.yy503 = yylhsminor.yy503;
161025
- break;
161026
- case 303: /* windowdefn ::= nm AS LP window RP */
161027
-{
161028
- if( ALWAYS(yymsp[-1].minor.yy503) ){
161029
- yymsp[-1].minor.yy503->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
161030
- }
161031
- yylhsminor.yy503 = yymsp[-1].minor.yy503;
161032
-}
161033
- yymsp[-4].minor.yy503 = yylhsminor.yy503;
161034
- break;
161035
- case 304: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
161036
-{
161037
- yymsp[-4].minor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy350, yymsp[-1].minor.yy350, 0);
161038
-}
161039
- break;
161040
- case 305: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
161041
-{
161042
- yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy350, yymsp[-1].minor.yy350, &yymsp[-5].minor.yy0);
161043
-}
161044
- yymsp[-5].minor.yy503 = yylhsminor.yy503;
161045
- break;
161046
- case 306: /* window ::= ORDER BY sortlist frame_opt */
161047
-{
161048
- yymsp[-3].minor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, yymsp[-1].minor.yy350, 0);
161049
-}
161050
- break;
161051
- case 307: /* window ::= nm ORDER BY sortlist frame_opt */
161052
-{
161053
- yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, yymsp[-1].minor.yy350, &yymsp[-4].minor.yy0);
161054
-}
161055
- yymsp[-4].minor.yy503 = yylhsminor.yy503;
161056
- break;
161057
- case 308: /* window ::= frame_opt */
161058
- case 327: /* filter_over ::= over_clause */ yytestcase(yyruleno==327);
161059
-{
161060
- yylhsminor.yy503 = yymsp[0].minor.yy503;
161061
-}
161062
- yymsp[0].minor.yy503 = yylhsminor.yy503;
161063
- break;
161064
- case 309: /* window ::= nm frame_opt */
161065
-{
161066
- yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, 0, &yymsp[-1].minor.yy0);
161067
-}
161068
- yymsp[-1].minor.yy503 = yylhsminor.yy503;
161069
- break;
161070
- case 310: /* frame_opt ::= */
161071
-{
161072
- yymsp[1].minor.yy503 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
161073
-}
161074
- break;
161075
- case 311: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
161076
-{
161077
- 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);
161078
-}
161079
- yymsp[-2].minor.yy503 = yylhsminor.yy503;
161080
- break;
161081
- case 312: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
161082
-{
161083
- 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);
161084
-}
161085
- yymsp[-5].minor.yy503 = yylhsminor.yy503;
161086
- break;
161087
- case 314: /* frame_bound_s ::= frame_bound */
161088
- case 316: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==316);
161089
-{yylhsminor.yy341 = yymsp[0].minor.yy341;}
161090
- yymsp[0].minor.yy341 = yylhsminor.yy341;
161091
- break;
161092
- case 315: /* frame_bound_s ::= UNBOUNDED PRECEDING */
161093
- case 317: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==317);
161094
- case 319: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==319);
161095
-{yylhsminor.yy341.eType = yymsp[-1].major; yylhsminor.yy341.pExpr = 0;}
161096
- yymsp[-1].minor.yy341 = yylhsminor.yy341;
161097
- break;
161098
- case 318: /* frame_bound ::= expr PRECEDING|FOLLOWING */
161099
-{yylhsminor.yy341.eType = yymsp[0].major; yylhsminor.yy341.pExpr = yymsp[-1].minor.yy354;}
161100
- yymsp[-1].minor.yy341 = yylhsminor.yy341;
161101
- break;
161102
- case 320: /* frame_exclude_opt ::= */
161103
-{yymsp[1].minor.yy624 = 0;}
161104
- break;
161105
- case 321: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
161106
-{yymsp[-1].minor.yy624 = yymsp[0].minor.yy624;}
161107
- break;
161108
- case 322: /* frame_exclude ::= NO OTHERS */
161109
- case 323: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==323);
161110
-{yymsp[-1].minor.yy624 = yymsp[-1].major; /*A-overwrites-X*/}
161111
- break;
161112
- case 324: /* frame_exclude ::= GROUP|TIES */
161113
-{yymsp[0].minor.yy624 = yymsp[0].major; /*A-overwrites-X*/}
161114
- break;
161115
- case 325: /* window_clause ::= WINDOW windowdefn_list */
161116
-{ yymsp[-1].minor.yy503 = yymsp[0].minor.yy503; }
161117
- break;
161118
- case 326: /* filter_over ::= filter_clause over_clause */
161119
-{
161120
- yymsp[0].minor.yy503->pFilter = yymsp[-1].minor.yy354;
161121
- yylhsminor.yy503 = yymsp[0].minor.yy503;
161122
-}
161123
- yymsp[-1].minor.yy503 = yylhsminor.yy503;
161124
- break;
161125
- case 328: /* filter_over ::= filter_clause */
161126
-{
161127
- yylhsminor.yy503 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
161128
- if( yylhsminor.yy503 ){
161129
- yylhsminor.yy503->eFrmType = TK_FILTER;
161130
- yylhsminor.yy503->pFilter = yymsp[0].minor.yy354;
161131
- }else{
161132
- sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy354);
161133
- }
161134
-}
161135
- yymsp[0].minor.yy503 = yylhsminor.yy503;
161136
- break;
161137
- case 329: /* over_clause ::= OVER LP window RP */
161138
-{
161139
- yymsp[-3].minor.yy503 = yymsp[-1].minor.yy503;
161140
- assert( yymsp[-3].minor.yy503!=0 );
161141
-}
161142
- break;
161143
- case 330: /* over_clause ::= OVER nm */
161144
-{
161145
- yymsp[-1].minor.yy503 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
161146
- if( yymsp[-1].minor.yy503 ){
161147
- yymsp[-1].minor.yy503->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
161148
- }
161149
-}
161150
- break;
161151
- case 331: /* filter_clause ::= FILTER LP WHERE expr RP */
161152
-{ yymsp[-4].minor.yy354 = yymsp[-1].minor.yy354; }
161450
+ case 298: /* with ::= WITH wqlist */
161451
+ case 299: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==299);
161452
+{ sqlite3WithPush(pParse, yymsp[0].minor.yy195, 1); }
161453
+ break;
161454
+ case 300: /* wqas ::= AS */
161455
+{yymsp[0].minor.yy570 = M10d_Any;}
161456
+ break;
161457
+ case 301: /* wqas ::= AS MATERIALIZED */
161458
+{yymsp[-1].minor.yy570 = M10d_Yes;}
161459
+ break;
161460
+ case 302: /* wqas ::= AS NOT MATERIALIZED */
161461
+{yymsp[-2].minor.yy570 = M10d_No;}
161462
+ break;
161463
+ case 303: /* wqitem ::= nm eidlist_opt wqas LP select RP */
161464
+{
161465
+ yymsp[-5].minor.yy607 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy338, yymsp[-1].minor.yy307, yymsp[-3].minor.yy570); /*A-overwrites-X*/
161466
+}
161467
+ break;
161468
+ case 304: /* wqlist ::= wqitem */
161469
+{
161470
+ yymsp[0].minor.yy195 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy607); /*A-overwrites-X*/
161471
+}
161472
+ break;
161473
+ case 305: /* wqlist ::= wqlist COMMA wqitem */
161474
+{
161475
+ yymsp[-2].minor.yy195 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy195, yymsp[0].minor.yy607);
161476
+}
161477
+ break;
161478
+ case 306: /* windowdefn_list ::= windowdefn */
161479
+{ yylhsminor.yy19 = yymsp[0].minor.yy19; }
161480
+ yymsp[0].minor.yy19 = yylhsminor.yy19;
161481
+ break;
161482
+ case 307: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
161483
+{
161484
+ assert( yymsp[0].minor.yy19!=0 );
161485
+ sqlite3WindowChain(pParse, yymsp[0].minor.yy19, yymsp[-2].minor.yy19);
161486
+ yymsp[0].minor.yy19->pNextWin = yymsp[-2].minor.yy19;
161487
+ yylhsminor.yy19 = yymsp[0].minor.yy19;
161488
+}
161489
+ yymsp[-2].minor.yy19 = yylhsminor.yy19;
161490
+ break;
161491
+ case 308: /* windowdefn ::= nm AS LP window RP */
161492
+{
161493
+ if( ALWAYS(yymsp[-1].minor.yy19) ){
161494
+ yymsp[-1].minor.yy19->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
161495
+ }
161496
+ yylhsminor.yy19 = yymsp[-1].minor.yy19;
161497
+}
161498
+ yymsp[-4].minor.yy19 = yylhsminor.yy19;
161499
+ break;
161500
+ case 309: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
161501
+{
161502
+ yymsp[-4].minor.yy19 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy19, yymsp[-2].minor.yy338, yymsp[-1].minor.yy338, 0);
161503
+}
161504
+ break;
161505
+ case 310: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
161506
+{
161507
+ yylhsminor.yy19 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy19, yymsp[-2].minor.yy338, yymsp[-1].minor.yy338, &yymsp[-5].minor.yy0);
161508
+}
161509
+ yymsp[-5].minor.yy19 = yylhsminor.yy19;
161510
+ break;
161511
+ case 311: /* window ::= ORDER BY sortlist frame_opt */
161512
+{
161513
+ yymsp[-3].minor.yy19 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy19, 0, yymsp[-1].minor.yy338, 0);
161514
+}
161515
+ break;
161516
+ case 312: /* window ::= nm ORDER BY sortlist frame_opt */
161517
+{
161518
+ yylhsminor.yy19 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy19, 0, yymsp[-1].minor.yy338, &yymsp[-4].minor.yy0);
161519
+}
161520
+ yymsp[-4].minor.yy19 = yylhsminor.yy19;
161521
+ break;
161522
+ case 313: /* window ::= frame_opt */
161523
+ case 332: /* filter_over ::= over_clause */ yytestcase(yyruleno==332);
161524
+{
161525
+ yylhsminor.yy19 = yymsp[0].minor.yy19;
161526
+}
161527
+ yymsp[0].minor.yy19 = yylhsminor.yy19;
161528
+ break;
161529
+ case 314: /* window ::= nm frame_opt */
161530
+{
161531
+ yylhsminor.yy19 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy19, 0, 0, &yymsp[-1].minor.yy0);
161532
+}
161533
+ yymsp[-1].minor.yy19 = yylhsminor.yy19;
161534
+ break;
161535
+ case 315: /* frame_opt ::= */
161536
+{
161537
+ yymsp[1].minor.yy19 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
161538
+}
161539
+ break;
161540
+ case 316: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
161541
+{
161542
+ yylhsminor.yy19 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy60, yymsp[-1].minor.yy113.eType, yymsp[-1].minor.yy113.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy570);
161543
+}
161544
+ yymsp[-2].minor.yy19 = yylhsminor.yy19;
161545
+ break;
161546
+ case 317: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
161547
+{
161548
+ yylhsminor.yy19 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy60, yymsp[-3].minor.yy113.eType, yymsp[-3].minor.yy113.pExpr, yymsp[-1].minor.yy113.eType, yymsp[-1].minor.yy113.pExpr, yymsp[0].minor.yy570);
161549
+}
161550
+ yymsp[-5].minor.yy19 = yylhsminor.yy19;
161551
+ break;
161552
+ case 319: /* frame_bound_s ::= frame_bound */
161553
+ case 321: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==321);
161554
+{yylhsminor.yy113 = yymsp[0].minor.yy113;}
161555
+ yymsp[0].minor.yy113 = yylhsminor.yy113;
161556
+ break;
161557
+ case 320: /* frame_bound_s ::= UNBOUNDED PRECEDING */
161558
+ case 322: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==322);
161559
+ case 324: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==324);
161560
+{yylhsminor.yy113.eType = yymsp[-1].major; yylhsminor.yy113.pExpr = 0;}
161561
+ yymsp[-1].minor.yy113 = yylhsminor.yy113;
161562
+ break;
161563
+ case 323: /* frame_bound ::= expr PRECEDING|FOLLOWING */
161564
+{yylhsminor.yy113.eType = yymsp[0].major; yylhsminor.yy113.pExpr = yymsp[-1].minor.yy602;}
161565
+ yymsp[-1].minor.yy113 = yylhsminor.yy113;
161566
+ break;
161567
+ case 325: /* frame_exclude_opt ::= */
161568
+{yymsp[1].minor.yy570 = 0;}
161569
+ break;
161570
+ case 326: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
161571
+{yymsp[-1].minor.yy570 = yymsp[0].minor.yy570;}
161572
+ break;
161573
+ case 327: /* frame_exclude ::= NO OTHERS */
161574
+ case 328: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==328);
161575
+{yymsp[-1].minor.yy570 = yymsp[-1].major; /*A-overwrites-X*/}
161576
+ break;
161577
+ case 329: /* frame_exclude ::= GROUP|TIES */
161578
+{yymsp[0].minor.yy570 = yymsp[0].major; /*A-overwrites-X*/}
161579
+ break;
161580
+ case 330: /* window_clause ::= WINDOW windowdefn_list */
161581
+{ yymsp[-1].minor.yy19 = yymsp[0].minor.yy19; }
161582
+ break;
161583
+ case 331: /* filter_over ::= filter_clause over_clause */
161584
+{
161585
+ yymsp[0].minor.yy19->pFilter = yymsp[-1].minor.yy602;
161586
+ yylhsminor.yy19 = yymsp[0].minor.yy19;
161587
+}
161588
+ yymsp[-1].minor.yy19 = yylhsminor.yy19;
161589
+ break;
161590
+ case 333: /* filter_over ::= filter_clause */
161591
+{
161592
+ yylhsminor.yy19 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
161593
+ if( yylhsminor.yy19 ){
161594
+ yylhsminor.yy19->eFrmType = TK_FILTER;
161595
+ yylhsminor.yy19->pFilter = yymsp[0].minor.yy602;
161596
+ }else{
161597
+ sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy602);
161598
+ }
161599
+}
161600
+ yymsp[0].minor.yy19 = yylhsminor.yy19;
161601
+ break;
161602
+ case 334: /* over_clause ::= OVER LP window RP */
161603
+{
161604
+ yymsp[-3].minor.yy19 = yymsp[-1].minor.yy19;
161605
+ assert( yymsp[-3].minor.yy19!=0 );
161606
+}
161607
+ break;
161608
+ case 335: /* over_clause ::= OVER nm */
161609
+{
161610
+ yymsp[-1].minor.yy19 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
161611
+ if( yymsp[-1].minor.yy19 ){
161612
+ yymsp[-1].minor.yy19->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
161613
+ }
161614
+}
161615
+ break;
161616
+ case 336: /* filter_clause ::= FILTER LP WHERE expr RP */
161617
+{ yymsp[-4].minor.yy602 = yymsp[-1].minor.yy602; }
161153161618
break;
161154161619
default:
161155
- /* (332) input ::= cmdlist */ yytestcase(yyruleno==332);
161156
- /* (333) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==333);
161157
- /* (334) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=334);
161158
- /* (335) ecmd ::= SEMI */ yytestcase(yyruleno==335);
161159
- /* (336) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==336);
161160
- /* (337) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=337);
161161
- /* (338) trans_opt ::= */ yytestcase(yyruleno==338);
161162
- /* (339) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==339);
161163
- /* (340) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==340);
161164
- /* (341) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==341);
161165
- /* (342) savepoint_opt ::= */ yytestcase(yyruleno==342);
161166
- /* (343) cmd ::= create_table create_table_args */ yytestcase(yyruleno==343);
161167
- /* (344) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==344);
161168
- /* (345) columnlist ::= columnname carglist */ yytestcase(yyruleno==345);
161169
- /* (346) nm ::= ID|INDEXED */ yytestcase(yyruleno==346);
161170
- /* (347) nm ::= STRING */ yytestcase(yyruleno==347);
161171
- /* (348) nm ::= JOIN_KW */ yytestcase(yyruleno==348);
161172
- /* (349) typetoken ::= typename */ yytestcase(yyruleno==349);
161173
- /* (350) typename ::= ID|STRING */ yytestcase(yyruleno==350);
161174
- /* (351) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=351);
161175
- /* (352) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=352);
161176
- /* (353) carglist ::= carglist ccons */ yytestcase(yyruleno==353);
161177
- /* (354) carglist ::= */ yytestcase(yyruleno==354);
161178
- /* (355) ccons ::= NULL onconf */ yytestcase(yyruleno==355);
161179
- /* (356) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==356);
161180
- /* (357) ccons ::= AS generated */ yytestcase(yyruleno==357);
161181
- /* (358) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==358);
161182
- /* (359) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==359);
161183
- /* (360) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=360);
161184
- /* (361) tconscomma ::= */ yytestcase(yyruleno==361);
161185
- /* (362) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=362);
161186
- /* (363) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=363);
161187
- /* (364) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=364);
161188
- /* (365) oneselect ::= values */ yytestcase(yyruleno==365);
161189
- /* (366) sclp ::= selcollist COMMA */ yytestcase(yyruleno==366);
161190
- /* (367) as ::= ID|STRING */ yytestcase(yyruleno==367);
161191
- /* (368) returning ::= */ yytestcase(yyruleno==368);
161192
- /* (369) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=369);
161193
- /* (370) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==370);
161194
- /* (371) exprlist ::= nexprlist */ yytestcase(yyruleno==371);
161195
- /* (372) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=372);
161196
- /* (373) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=373);
161197
- /* (374) nmnum ::= ON */ yytestcase(yyruleno==374);
161198
- /* (375) nmnum ::= DELETE */ yytestcase(yyruleno==375);
161199
- /* (376) nmnum ::= DEFAULT */ yytestcase(yyruleno==376);
161200
- /* (377) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==377);
161201
- /* (378) foreach_clause ::= */ yytestcase(yyruleno==378);
161202
- /* (379) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==379);
161203
- /* (380) trnm ::= nm */ yytestcase(yyruleno==380);
161204
- /* (381) tridxby ::= */ yytestcase(yyruleno==381);
161205
- /* (382) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==382);
161206
- /* (383) database_kw_opt ::= */ yytestcase(yyruleno==383);
161207
- /* (384) kwcolumn_opt ::= */ yytestcase(yyruleno==384);
161208
- /* (385) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==385);
161209
- /* (386) vtabarglist ::= vtabarg */ yytestcase(yyruleno==386);
161210
- /* (387) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==387);
161211
- /* (388) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==388);
161212
- /* (389) anylist ::= */ yytestcase(yyruleno==389);
161213
- /* (390) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==390);
161214
- /* (391) anylist ::= anylist ANY */ yytestcase(yyruleno==391);
161215
- /* (392) with ::= */ yytestcase(yyruleno==392);
161620
+ /* (337) input ::= cmdlist */ yytestcase(yyruleno==337);
161621
+ /* (338) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==338);
161622
+ /* (339) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=339);
161623
+ /* (340) ecmd ::= SEMI */ yytestcase(yyruleno==340);
161624
+ /* (341) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==341);
161625
+ /* (342) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=342);
161626
+ /* (343) trans_opt ::= */ yytestcase(yyruleno==343);
161627
+ /* (344) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==344);
161628
+ /* (345) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==345);
161629
+ /* (346) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==346);
161630
+ /* (347) savepoint_opt ::= */ yytestcase(yyruleno==347);
161631
+ /* (348) cmd ::= create_table create_table_args */ yytestcase(yyruleno==348);
161632
+ /* (349) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==349);
161633
+ /* (350) columnlist ::= columnname carglist */ yytestcase(yyruleno==350);
161634
+ /* (351) nm ::= ID|INDEXED */ yytestcase(yyruleno==351);
161635
+ /* (352) nm ::= STRING */ yytestcase(yyruleno==352);
161636
+ /* (353) nm ::= JOIN_KW */ yytestcase(yyruleno==353);
161637
+ /* (354) typetoken ::= typename */ yytestcase(yyruleno==354);
161638
+ /* (355) typename ::= ID|STRING */ yytestcase(yyruleno==355);
161639
+ /* (356) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=356);
161640
+ /* (357) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=357);
161641
+ /* (358) carglist ::= carglist ccons */ yytestcase(yyruleno==358);
161642
+ /* (359) carglist ::= */ yytestcase(yyruleno==359);
161643
+ /* (360) ccons ::= NULL onconf */ yytestcase(yyruleno==360);
161644
+ /* (361) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==361);
161645
+ /* (362) ccons ::= AS generated */ yytestcase(yyruleno==362);
161646
+ /* (363) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==363);
161647
+ /* (364) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==364);
161648
+ /* (365) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=365);
161649
+ /* (366) tconscomma ::= */ yytestcase(yyruleno==366);
161650
+ /* (367) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=367);
161651
+ /* (368) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=368);
161652
+ /* (369) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=369);
161653
+ /* (370) oneselect ::= values */ yytestcase(yyruleno==370);
161654
+ /* (371) sclp ::= selcollist COMMA */ yytestcase(yyruleno==371);
161655
+ /* (372) as ::= ID|STRING */ yytestcase(yyruleno==372);
161656
+ /* (373) returning ::= */ yytestcase(yyruleno==373);
161657
+ /* (374) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=374);
161658
+ /* (375) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==375);
161659
+ /* (376) exprlist ::= nexprlist */ yytestcase(yyruleno==376);
161660
+ /* (377) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=377);
161661
+ /* (378) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=378);
161662
+ /* (379) nmnum ::= ON */ yytestcase(yyruleno==379);
161663
+ /* (380) nmnum ::= DELETE */ yytestcase(yyruleno==380);
161664
+ /* (381) nmnum ::= DEFAULT */ yytestcase(yyruleno==381);
161665
+ /* (382) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==382);
161666
+ /* (383) foreach_clause ::= */ yytestcase(yyruleno==383);
161667
+ /* (384) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==384);
161668
+ /* (385) trnm ::= nm */ yytestcase(yyruleno==385);
161669
+ /* (386) tridxby ::= */ yytestcase(yyruleno==386);
161670
+ /* (387) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==387);
161671
+ /* (388) database_kw_opt ::= */ yytestcase(yyruleno==388);
161672
+ /* (389) kwcolumn_opt ::= */ yytestcase(yyruleno==389);
161673
+ /* (390) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==390);
161674
+ /* (391) vtabarglist ::= vtabarg */ yytestcase(yyruleno==391);
161675
+ /* (392) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==392);
161676
+ /* (393) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==393);
161677
+ /* (394) anylist ::= */ yytestcase(yyruleno==394);
161678
+ /* (395) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==395);
161679
+ /* (396) anylist ::= anylist ANY */ yytestcase(yyruleno==396);
161680
+ /* (397) with ::= */ yytestcase(yyruleno==397);
161216161681
break;
161217161682
/********** End reduce actions ************************************************/
161218161683
};
161219161684
assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
161220161685
yygoto = yyRuleInfoLhs[yyruleno];
@@ -161717,25 +162182,25 @@
161717162182
** might be implemented more directly using a hand-written hash table.
161718162183
** But by using this automatically generated code, the size of the code
161719162184
** is substantially reduced. This is important for embedded applications
161720162185
** on platforms with limited memory.
161721162186
*/
161722
-/* Hash score: 229 */
161723
-/* zKWText[] encodes 994 bytes of keyword text in 657 bytes */
162187
+/* Hash score: 231 */
162188
+/* zKWText[] encodes 1007 bytes of keyword text in 667 bytes */
161724162189
/* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
161725162190
/* ABLEFTHENDEFERRABLELSEXCLUDELETEMPORARYISNULLSAVEPOINTERSECT */
161726162191
/* IESNOTNULLIKEXCEPTRANSACTIONATURALTERAISEXCLUSIVEXISTS */
161727162192
/* CONSTRAINTOFFSETRIGGERANGENERATEDETACHAVINGLOBEGINNEREFERENCES */
161728162193
/* UNIQUERYWITHOUTERELEASEATTACHBETWEENOTHINGROUPSCASCADEFAULT */
161729162194
/* CASECOLLATECREATECURRENT_DATEIMMEDIATEJOINSERTMATCHPLANALYZE */
161730
-/* PRAGMABORTUPDATEVALUESVIRTUALWAYSWHENWHERECURSIVEAFTERENAMEAND */
161731
-/* EFERREDISTINCTAUTOINCREMENTCASTCOLUMNCOMMITCONFLICTCROSS */
161732
-/* CURRENT_TIMESTAMPARTITIONDROPRECEDINGFAILASTFILTEREPLACEFIRST */
161733
-/* FOLLOWINGFROMFULLIMITIFORDERESTRICTOTHERSOVERETURNINGRIGHT */
161734
-/* ROLLBACKROWSUNBOUNDEDUNIONUSINGVACUUMVIEWINDOWBYINITIALLY */
161735
-/* PRIMARY */
161736
-static const char zKWText[656] = {
162195
+/* PRAGMATERIALIZEDEFERREDISTINCTUPDATEVALUESVIRTUALWAYSWHENWHERE */
162196
+/* CURSIVEABORTAFTERENAMEANDROPARTITIONAUTOINCREMENTCASTCOLUMN */
162197
+/* COMMITCONFLICTCROSSCURRENT_TIMESTAMPRECEDINGFAILASTFILTER */
162198
+/* EPLACEFIRSTFOLLOWINGFROMFULLIMITIFORDERESTRICTOTHERSOVER */
162199
+/* ETURNINGRIGHTROLLBACKROWSUNBOUNDEDUNIONUSINGVACUUMVIEWINDOWBY */
162200
+/* INITIALLYPRIMARY */
162201
+static const char zKWText[666] = {
161737162202
'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
161738162203
'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
161739162204
'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
161740162205
'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
161741162206
'E','R','R','A','B','L','E','L','S','E','X','C','L','U','D','E','L','E',
@@ -161752,91 +162217,91 @@
161752162217
'E','N','O','T','H','I','N','G','R','O','U','P','S','C','A','S','C','A',
161753162218
'D','E','F','A','U','L','T','C','A','S','E','C','O','L','L','A','T','E',
161754162219
'C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A','T','E',
161755162220
'I','M','M','E','D','I','A','T','E','J','O','I','N','S','E','R','T','M',
161756162221
'A','T','C','H','P','L','A','N','A','L','Y','Z','E','P','R','A','G','M',
161757
- 'A','B','O','R','T','U','P','D','A','T','E','V','A','L','U','E','S','V',
161758
- 'I','R','T','U','A','L','W','A','Y','S','W','H','E','N','W','H','E','R',
161759
- 'E','C','U','R','S','I','V','E','A','F','T','E','R','E','N','A','M','E',
161760
- 'A','N','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','A',
161761
- 'U','T','O','I','N','C','R','E','M','E','N','T','C','A','S','T','C','O',
161762
- 'L','U','M','N','C','O','M','M','I','T','C','O','N','F','L','I','C','T',
161763
- 'C','R','O','S','S','C','U','R','R','E','N','T','_','T','I','M','E','S',
161764
- 'T','A','M','P','A','R','T','I','T','I','O','N','D','R','O','P','R','E',
161765
- 'C','E','D','I','N','G','F','A','I','L','A','S','T','F','I','L','T','E',
161766
- 'R','E','P','L','A','C','E','F','I','R','S','T','F','O','L','L','O','W',
161767
- 'I','N','G','F','R','O','M','F','U','L','L','I','M','I','T','I','F','O',
161768
- 'R','D','E','R','E','S','T','R','I','C','T','O','T','H','E','R','S','O',
161769
- 'V','E','R','E','T','U','R','N','I','N','G','R','I','G','H','T','R','O',
161770
- 'L','L','B','A','C','K','R','O','W','S','U','N','B','O','U','N','D','E',
161771
- 'D','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M','V',
161772
- 'I','E','W','I','N','D','O','W','B','Y','I','N','I','T','I','A','L','L',
161773
- 'Y','P','R','I','M','A','R','Y',
162222
+ 'A','T','E','R','I','A','L','I','Z','E','D','E','F','E','R','R','E','D',
162223
+ 'I','S','T','I','N','C','T','U','P','D','A','T','E','V','A','L','U','E',
162224
+ 'S','V','I','R','T','U','A','L','W','A','Y','S','W','H','E','N','W','H',
162225
+ 'E','R','E','C','U','R','S','I','V','E','A','B','O','R','T','A','F','T',
162226
+ 'E','R','E','N','A','M','E','A','N','D','R','O','P','A','R','T','I','T',
162227
+ 'I','O','N','A','U','T','O','I','N','C','R','E','M','E','N','T','C','A',
162228
+ 'S','T','C','O','L','U','M','N','C','O','M','M','I','T','C','O','N','F',
162229
+ 'L','I','C','T','C','R','O','S','S','C','U','R','R','E','N','T','_','T',
162230
+ 'I','M','E','S','T','A','M','P','R','E','C','E','D','I','N','G','F','A',
162231
+ 'I','L','A','S','T','F','I','L','T','E','R','E','P','L','A','C','E','F',
162232
+ 'I','R','S','T','F','O','L','L','O','W','I','N','G','F','R','O','M','F',
162233
+ 'U','L','L','I','M','I','T','I','F','O','R','D','E','R','E','S','T','R',
162234
+ 'I','C','T','O','T','H','E','R','S','O','V','E','R','E','T','U','R','N',
162235
+ 'I','N','G','R','I','G','H','T','R','O','L','L','B','A','C','K','R','O',
162236
+ 'W','S','U','N','B','O','U','N','D','E','D','U','N','I','O','N','U','S',
162237
+ 'I','N','G','V','A','C','U','U','M','V','I','E','W','I','N','D','O','W',
162238
+ 'B','Y','I','N','I','T','I','A','L','L','Y','P','R','I','M','A','R','Y',
161774162239
};
161775162240
/* aKWHash[i] is the hash value for the i-th keyword */
161776162241
static const unsigned char aKWHash[127] = {
161777
- 84, 102, 133, 82, 114, 29, 0, 0, 91, 0, 85, 72, 0,
161778
- 53, 35, 86, 15, 0, 42, 94, 54, 126, 134, 19, 0, 0,
161779
- 139, 0, 40, 128, 0, 22, 104, 0, 9, 0, 0, 122, 80,
161780
- 0, 78, 6, 0, 65, 99, 146, 0, 135, 112, 0, 0, 48,
161781
- 0, 100, 24, 0, 17, 0, 27, 70, 23, 26, 5, 60, 141,
161782
- 107, 121, 0, 73, 101, 71, 144, 61, 119, 74, 0, 49, 0,
161783
- 11, 41, 0, 110, 0, 0, 0, 106, 10, 108, 113, 124, 14,
161784
- 50, 123, 0, 89, 0, 18, 120, 143, 56, 129, 138, 88, 83,
161785
- 37, 30, 125, 0, 0, 105, 51, 130, 127, 0, 34, 0, 0,
161786
- 131, 0, 95, 38, 39, 0, 20, 45, 116, 90,
162242
+ 84, 92, 134, 82, 105, 29, 0, 0, 94, 0, 85, 72, 0,
162243
+ 53, 35, 86, 15, 0, 42, 97, 54, 89, 135, 19, 0, 0,
162244
+ 140, 0, 40, 129, 0, 22, 107, 0, 9, 0, 0, 123, 80,
162245
+ 0, 78, 6, 0, 65, 103, 147, 0, 136, 115, 0, 0, 48,
162246
+ 0, 90, 24, 0, 17, 0, 27, 70, 23, 26, 5, 60, 142,
162247
+ 110, 122, 0, 73, 91, 71, 145, 61, 120, 74, 0, 49, 0,
162248
+ 11, 41, 0, 113, 0, 0, 0, 109, 10, 111, 116, 125, 14,
162249
+ 50, 124, 0, 100, 0, 18, 121, 144, 56, 130, 139, 88, 83,
162250
+ 37, 30, 126, 0, 0, 108, 51, 131, 128, 0, 34, 0, 0,
162251
+ 132, 0, 98, 38, 39, 0, 20, 45, 117, 93,
161787162252
};
161788162253
/* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
161789162254
** then the i-th keyword has no more hash collisions. Otherwise,
161790162255
** the next keyword with the same hash is aKWHash[i]-1. */
161791
-static const unsigned char aKWNext[146] = {
161792
- 0, 0, 0, 0, 4, 0, 43, 0, 0, 103, 111, 0, 0,
161793
- 0, 2, 0, 0, 142, 0, 0, 0, 13, 0, 0, 0, 0,
161794
- 140, 0, 0, 118, 52, 0, 0, 136, 12, 0, 0, 62, 0,
161795
- 137, 0, 132, 0, 0, 36, 0, 0, 28, 77, 0, 0, 0,
162256
+static const unsigned char aKWNext[147] = {
162257
+ 0, 0, 0, 0, 4, 0, 43, 0, 0, 106, 114, 0, 0,
162258
+ 0, 2, 0, 0, 143, 0, 0, 0, 13, 0, 0, 0, 0,
162259
+ 141, 0, 0, 119, 52, 0, 0, 137, 12, 0, 0, 62, 0,
162260
+ 138, 0, 133, 0, 0, 36, 0, 0, 28, 77, 0, 0, 0,
161796162261
0, 59, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
161797
- 0, 69, 0, 0, 0, 0, 0, 145, 3, 0, 58, 0, 1,
161798
- 75, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 64, 66,
161799
- 63, 0, 0, 0, 0, 46, 0, 16, 0, 115, 0, 0, 0,
161800
- 0, 0, 0, 0, 0, 0, 0, 81, 97, 0, 8, 0, 109,
161801
- 21, 7, 67, 0, 79, 93, 117, 0, 0, 68, 0, 0, 96,
161802
- 44, 0, 55, 0, 76, 0, 92, 32, 33, 57, 25, 0, 98,
161803
- 0, 0, 87,
162262
+ 0, 69, 0, 0, 0, 0, 0, 146, 3, 0, 58, 0, 1,
162263
+ 75, 0, 0, 0, 31, 0, 0, 0, 0, 0, 127, 0, 104,
162264
+ 0, 64, 66, 63, 0, 0, 0, 0, 0, 46, 0, 16, 8,
162265
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 101, 0,
162266
+ 112, 21, 7, 67, 0, 79, 96, 118, 0, 0, 68, 0, 0,
162267
+ 99, 44, 0, 55, 0, 76, 0, 95, 32, 33, 57, 25, 0,
162268
+ 102, 0, 0, 87,
161804162269
};
161805162270
/* aKWLen[i] is the length (in bytes) of the i-th keyword */
161806
-static const unsigned char aKWLen[146] = {
162271
+static const unsigned char aKWLen[147] = {
161807162272
7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
161808162273
7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 7,
161809162274
6, 9, 4, 2, 6, 5, 9, 9, 4, 7, 3, 2, 4,
161810162275
4, 6, 11, 6, 2, 7, 5, 5, 9, 6, 10, 4, 6,
161811162276
2, 3, 7, 5, 9, 6, 6, 4, 5, 5, 10, 6, 5,
161812162277
7, 4, 5, 7, 6, 7, 7, 6, 5, 7, 3, 7, 4,
161813
- 7, 6, 12, 9, 4, 6, 5, 4, 7, 6, 5, 6, 6,
161814
- 7, 6, 4, 5, 9, 5, 6, 3, 8, 8, 2, 13, 2,
161815
- 2, 4, 6, 6, 8, 5, 17, 12, 7, 9, 4, 9, 4,
161816
- 4, 6, 7, 5, 9, 4, 4, 5, 2, 5, 8, 6, 4,
161817
- 9, 5, 8, 4, 3, 9, 5, 5, 6, 4, 6, 2, 2,
161818
- 9, 3, 7,
162278
+ 7, 6, 12, 9, 4, 6, 5, 4, 7, 6, 12, 8, 8,
162279
+ 2, 6, 6, 7, 6, 4, 5, 9, 5, 5, 6, 3, 4,
162280
+ 9, 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 9,
162281
+ 4, 4, 6, 7, 5, 9, 4, 4, 5, 2, 5, 8, 6,
162282
+ 4, 9, 5, 8, 4, 3, 9, 5, 5, 6, 4, 6, 2,
162283
+ 2, 9, 3, 7,
161819162284
};
161820162285
/* aKWOffset[i] is the index into zKWText[] of the start of
161821162286
** the text for the i-th keyword. */
161822
-static const unsigned short int aKWOffset[146] = {
162287
+static const unsigned short int aKWOffset[147] = {
161823162288
0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
161824162289
36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
161825162290
86, 90, 90, 94, 99, 101, 105, 111, 119, 123, 123, 123, 126,
161826162291
129, 132, 137, 142, 146, 147, 152, 156, 160, 168, 174, 181, 184,
161827162292
184, 187, 189, 195, 198, 206, 211, 216, 219, 222, 226, 236, 239,
161828162293
244, 244, 248, 252, 259, 265, 271, 277, 277, 283, 284, 288, 295,
161829
- 299, 306, 312, 324, 333, 335, 341, 346, 348, 355, 360, 365, 371,
161830
- 377, 382, 388, 392, 395, 404, 408, 414, 416, 423, 424, 431, 433,
161831
- 435, 444, 448, 454, 460, 468, 473, 473, 473, 489, 498, 501, 510,
161832
- 513, 517, 522, 529, 534, 543, 547, 550, 555, 557, 561, 569, 575,
161833
- 578, 587, 592, 600, 600, 604, 613, 618, 623, 629, 632, 635, 638,
161834
- 640, 645, 649,
162294
+ 299, 306, 312, 324, 333, 335, 341, 346, 348, 355, 359, 370, 377,
162295
+ 378, 385, 391, 397, 402, 408, 412, 415, 424, 429, 433, 439, 441,
162296
+ 444, 453, 455, 457, 466, 470, 476, 482, 490, 495, 495, 495, 511,
162297
+ 520, 523, 527, 532, 539, 544, 553, 557, 560, 565, 567, 571, 579,
162298
+ 585, 588, 597, 602, 610, 610, 614, 623, 628, 633, 639, 642, 645,
162299
+ 648, 650, 655, 659,
161835162300
};
161836162301
/* aKWCode[i] is the parser symbol code for the i-th keyword */
161837
-static const unsigned char aKWCode[146] = {
162302
+static const unsigned char aKWCode[147] = {
161838162303
TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
161839162304
TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
161840162305
TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
161841162306
TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
161842162307
TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
@@ -161850,23 +162315,23 @@
161850162315
TK_BEGIN, TK_JOIN_KW, TK_REFERENCES, TK_UNIQUE, TK_QUERY,
161851162316
TK_WITHOUT, TK_WITH, TK_JOIN_KW, TK_RELEASE, TK_ATTACH,
161852162317
TK_BETWEEN, TK_NOTHING, TK_GROUPS, TK_GROUP, TK_CASCADE,
161853162318
TK_ASC, TK_DEFAULT, TK_CASE, TK_COLLATE, TK_CREATE,
161854162319
TK_CTIME_KW, TK_IMMEDIATE, TK_JOIN, TK_INSERT, TK_MATCH,
161855
- TK_PLAN, TK_ANALYZE, TK_PRAGMA, TK_ABORT, TK_UPDATE,
161856
- TK_VALUES, TK_VIRTUAL, TK_ALWAYS, TK_WHEN, TK_WHERE,
161857
- TK_RECURSIVE, TK_AFTER, TK_RENAME, TK_AND, TK_DEFERRED,
161858
- TK_DISTINCT, TK_IS, TK_AUTOINCR, TK_TO, TK_IN,
161859
- TK_CAST, TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW,
161860
- TK_CTIME_KW, TK_CTIME_KW, TK_CURRENT, TK_PARTITION, TK_DROP,
161861
- TK_PRECEDING, TK_FAIL, TK_LAST, TK_FILTER, TK_REPLACE,
161862
- TK_FIRST, TK_FOLLOWING, TK_FROM, TK_JOIN_KW, TK_LIMIT,
161863
- TK_IF, TK_ORDER, TK_RESTRICT, TK_OTHERS, TK_OVER,
161864
- TK_RETURNING, TK_JOIN_KW, TK_ROLLBACK, TK_ROWS, TK_ROW,
161865
- TK_UNBOUNDED, TK_UNION, TK_USING, TK_VACUUM, TK_VIEW,
161866
- TK_WINDOW, TK_DO, TK_BY, TK_INITIALLY, TK_ALL,
161867
- TK_PRIMARY,
162320
+ TK_PLAN, TK_ANALYZE, TK_PRAGMA, TK_MATERIALIZED, TK_DEFERRED,
162321
+ TK_DISTINCT, TK_IS, TK_UPDATE, TK_VALUES, TK_VIRTUAL,
162322
+ TK_ALWAYS, TK_WHEN, TK_WHERE, TK_RECURSIVE, TK_ABORT,
162323
+ TK_AFTER, TK_RENAME, TK_AND, TK_DROP, TK_PARTITION,
162324
+ TK_AUTOINCR, TK_TO, TK_IN, TK_CAST, TK_COLUMNKW,
162325
+ TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW,
162326
+ TK_CURRENT, TK_PRECEDING, TK_FAIL, TK_LAST, TK_FILTER,
162327
+ TK_REPLACE, TK_FIRST, TK_FOLLOWING, TK_FROM, TK_JOIN_KW,
162328
+ TK_LIMIT, TK_IF, TK_ORDER, TK_RESTRICT, TK_OTHERS,
162329
+ TK_OVER, TK_RETURNING, TK_JOIN_KW, TK_ROLLBACK, TK_ROWS,
162330
+ TK_ROW, TK_UNBOUNDED, TK_UNION, TK_USING, TK_VACUUM,
162331
+ TK_VIEW, TK_WINDOW, TK_DO, TK_BY, TK_INITIALLY,
162332
+ TK_ALL, TK_PRIMARY,
161868162333
};
161869162334
/* Hash table decoded:
161870162335
** 0: INSERT
161871162336
** 1: IS
161872162337
** 2: ROLLBACK TRIGGER
@@ -161886,11 +162351,11 @@
161886162351
** 16: INSTEAD INDEXED
161887162352
** 17:
161888162353
** 18: TRANSACTION RIGHT
161889162354
** 19: WHEN
161890162355
** 20: SET HAVING
161891
-** 21: IF
162356
+** 21: MATERIALIZED IF
161892162357
** 22: ROWS
161893162358
** 23: SELECT
161894162359
** 24:
161895162360
** 25:
161896162361
** 26: VACUUM SAVEPOINT
@@ -162105,68 +162570,69 @@
162105162570
testcase( i==83 ); /* INSERT */
162106162571
testcase( i==84 ); /* MATCH */
162107162572
testcase( i==85 ); /* PLAN */
162108162573
testcase( i==86 ); /* ANALYZE */
162109162574
testcase( i==87 ); /* PRAGMA */
162110
- testcase( i==88 ); /* ABORT */
162111
- testcase( i==89 ); /* UPDATE */
162112
- testcase( i==90 ); /* VALUES */
162113
- testcase( i==91 ); /* VIRTUAL */
162114
- testcase( i==92 ); /* ALWAYS */
162115
- testcase( i==93 ); /* WHEN */
162116
- testcase( i==94 ); /* WHERE */
162117
- testcase( i==95 ); /* RECURSIVE */
162118
- testcase( i==96 ); /* AFTER */
162119
- testcase( i==97 ); /* RENAME */
162120
- testcase( i==98 ); /* AND */
162121
- testcase( i==99 ); /* DEFERRED */
162122
- testcase( i==100 ); /* DISTINCT */
162123
- testcase( i==101 ); /* IS */
162124
- testcase( i==102 ); /* AUTOINCREMENT */
162125
- testcase( i==103 ); /* TO */
162126
- testcase( i==104 ); /* IN */
162127
- testcase( i==105 ); /* CAST */
162128
- testcase( i==106 ); /* COLUMN */
162129
- testcase( i==107 ); /* COMMIT */
162130
- testcase( i==108 ); /* CONFLICT */
162131
- testcase( i==109 ); /* CROSS */
162132
- testcase( i==110 ); /* CURRENT_TIMESTAMP */
162133
- testcase( i==111 ); /* CURRENT_TIME */
162134
- testcase( i==112 ); /* CURRENT */
162135
- testcase( i==113 ); /* PARTITION */
162136
- testcase( i==114 ); /* DROP */
162137
- testcase( i==115 ); /* PRECEDING */
162138
- testcase( i==116 ); /* FAIL */
162139
- testcase( i==117 ); /* LAST */
162140
- testcase( i==118 ); /* FILTER */
162141
- testcase( i==119 ); /* REPLACE */
162142
- testcase( i==120 ); /* FIRST */
162143
- testcase( i==121 ); /* FOLLOWING */
162144
- testcase( i==122 ); /* FROM */
162145
- testcase( i==123 ); /* FULL */
162146
- testcase( i==124 ); /* LIMIT */
162147
- testcase( i==125 ); /* IF */
162148
- testcase( i==126 ); /* ORDER */
162149
- testcase( i==127 ); /* RESTRICT */
162150
- testcase( i==128 ); /* OTHERS */
162151
- testcase( i==129 ); /* OVER */
162152
- testcase( i==130 ); /* RETURNING */
162153
- testcase( i==131 ); /* RIGHT */
162154
- testcase( i==132 ); /* ROLLBACK */
162155
- testcase( i==133 ); /* ROWS */
162156
- testcase( i==134 ); /* ROW */
162157
- testcase( i==135 ); /* UNBOUNDED */
162158
- testcase( i==136 ); /* UNION */
162159
- testcase( i==137 ); /* USING */
162160
- testcase( i==138 ); /* VACUUM */
162161
- testcase( i==139 ); /* VIEW */
162162
- testcase( i==140 ); /* WINDOW */
162163
- testcase( i==141 ); /* DO */
162164
- testcase( i==142 ); /* BY */
162165
- testcase( i==143 ); /* INITIALLY */
162166
- testcase( i==144 ); /* ALL */
162167
- testcase( i==145 ); /* PRIMARY */
162575
+ testcase( i==88 ); /* MATERIALIZED */
162576
+ testcase( i==89 ); /* DEFERRED */
162577
+ testcase( i==90 ); /* DISTINCT */
162578
+ testcase( i==91 ); /* IS */
162579
+ testcase( i==92 ); /* UPDATE */
162580
+ testcase( i==93 ); /* VALUES */
162581
+ testcase( i==94 ); /* VIRTUAL */
162582
+ testcase( i==95 ); /* ALWAYS */
162583
+ testcase( i==96 ); /* WHEN */
162584
+ testcase( i==97 ); /* WHERE */
162585
+ testcase( i==98 ); /* RECURSIVE */
162586
+ testcase( i==99 ); /* ABORT */
162587
+ testcase( i==100 ); /* AFTER */
162588
+ testcase( i==101 ); /* RENAME */
162589
+ testcase( i==102 ); /* AND */
162590
+ testcase( i==103 ); /* DROP */
162591
+ testcase( i==104 ); /* PARTITION */
162592
+ testcase( i==105 ); /* AUTOINCREMENT */
162593
+ testcase( i==106 ); /* TO */
162594
+ testcase( i==107 ); /* IN */
162595
+ testcase( i==108 ); /* CAST */
162596
+ testcase( i==109 ); /* COLUMN */
162597
+ testcase( i==110 ); /* COMMIT */
162598
+ testcase( i==111 ); /* CONFLICT */
162599
+ testcase( i==112 ); /* CROSS */
162600
+ testcase( i==113 ); /* CURRENT_TIMESTAMP */
162601
+ testcase( i==114 ); /* CURRENT_TIME */
162602
+ testcase( i==115 ); /* CURRENT */
162603
+ testcase( i==116 ); /* PRECEDING */
162604
+ testcase( i==117 ); /* FAIL */
162605
+ testcase( i==118 ); /* LAST */
162606
+ testcase( i==119 ); /* FILTER */
162607
+ testcase( i==120 ); /* REPLACE */
162608
+ testcase( i==121 ); /* FIRST */
162609
+ testcase( i==122 ); /* FOLLOWING */
162610
+ testcase( i==123 ); /* FROM */
162611
+ testcase( i==124 ); /* FULL */
162612
+ testcase( i==125 ); /* LIMIT */
162613
+ testcase( i==126 ); /* IF */
162614
+ testcase( i==127 ); /* ORDER */
162615
+ testcase( i==128 ); /* RESTRICT */
162616
+ testcase( i==129 ); /* OTHERS */
162617
+ testcase( i==130 ); /* OVER */
162618
+ testcase( i==131 ); /* RETURNING */
162619
+ testcase( i==132 ); /* RIGHT */
162620
+ testcase( i==133 ); /* ROLLBACK */
162621
+ testcase( i==134 ); /* ROWS */
162622
+ testcase( i==135 ); /* ROW */
162623
+ testcase( i==136 ); /* UNBOUNDED */
162624
+ testcase( i==137 ); /* UNION */
162625
+ testcase( i==138 ); /* USING */
162626
+ testcase( i==139 ); /* VACUUM */
162627
+ testcase( i==140 ); /* VIEW */
162628
+ testcase( i==141 ); /* WINDOW */
162629
+ testcase( i==142 ); /* DO */
162630
+ testcase( i==143 ); /* BY */
162631
+ testcase( i==144 ); /* INITIALLY */
162632
+ testcase( i==145 ); /* ALL */
162633
+ testcase( i==146 ); /* PRIMARY */
162168162634
*pType = aKWCode[i];
162169162635
break;
162170162636
}
162171162637
}
162172162638
return n;
@@ -162174,11 +162640,11 @@
162174162640
SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){
162175162641
int id = TK_ID;
162176162642
keywordCode((char*)z, n, &id);
162177162643
return id;
162178162644
}
162179
-#define SQLITE_N_KEYWORD 146
162645
+#define SQLITE_N_KEYWORD 147
162180162646
SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){
162181162647
if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
162182162648
*pzName = zKWText + aKWOffset[i];
162183162649
*pnName = aKWLen[i];
162184162650
return SQLITE_OK;
@@ -183787,27 +184253,31 @@
183787184253
if( pNode->block.a){
183788184254
rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n);
183789184255
while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
183790184256
blobGrowBuffer(&pNode->key, reader.term.n, &rc);
183791184257
if( rc==SQLITE_OK ){
183792
- memcpy(pNode->key.a, reader.term.a, reader.term.n);
183793
- pNode->key.n = reader.term.n;
183794
- if( i>0 ){
183795
- char *aBlock = 0;
183796
- int nBlock = 0;
183797
- pNode = &pWriter->aNodeWriter[i-1];
183798
- pNode->iBlock = reader.iChild;
183799
- rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock, 0);
183800
- blobGrowBuffer(&pNode->block,
183801
- MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc
183802
- );
183803
- if( rc==SQLITE_OK ){
183804
- memcpy(pNode->block.a, aBlock, nBlock);
183805
- pNode->block.n = nBlock;
183806
- memset(&pNode->block.a[nBlock], 0, FTS3_NODE_PADDING);
183807
- }
183808
- sqlite3_free(aBlock);
184258
+ if( reader.term.n<=0 ){
184259
+ rc = FTS_CORRUPT_VTAB;
184260
+ }else{
184261
+ memcpy(pNode->key.a, reader.term.a, reader.term.n);
184262
+ pNode->key.n = reader.term.n;
184263
+ if( i>0 ){
184264
+ char *aBlock = 0;
184265
+ int nBlock = 0;
184266
+ pNode = &pWriter->aNodeWriter[i-1];
184267
+ pNode->iBlock = reader.iChild;
184268
+ rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock,0);
184269
+ blobGrowBuffer(&pNode->block,
184270
+ MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc
184271
+ );
184272
+ if( rc==SQLITE_OK ){
184273
+ memcpy(pNode->block.a, aBlock, nBlock);
184274
+ pNode->block.n = nBlock;
184275
+ memset(&pNode->block.a[nBlock], 0, FTS3_NODE_PADDING);
184276
+ }
184277
+ sqlite3_free(aBlock);
184278
+ }
183809184279
}
183810184280
}
183811184281
}
183812184282
nodeReaderRelease(&reader);
183813184283
}
@@ -203040,26 +203510,28 @@
203040203510
#ifdef SQLITE_AMALGAMATION
203041203511
assert( WAL_CKPT_LOCK==1 );
203042203512
#endif
203043203513
203044203514
assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) );
203045
- if( pRbu && (pRbu->eStage==RBU_STAGE_OAL || pRbu->eStage==RBU_STAGE_MOVE) ){
203046
- /* Magic number 1 is the WAL_CKPT_LOCK lock. Preventing SQLite from
203047
- ** taking this lock also prevents any checkpoints from occurring.
203048
- ** todo: really, it's not clear why this might occur, as
203049
- ** wal_autocheckpoint ought to be turned off. */
203515
+ if( pRbu && (
203516
+ pRbu->eStage==RBU_STAGE_OAL
203517
+ || pRbu->eStage==RBU_STAGE_MOVE
203518
+ || pRbu->eStage==RBU_STAGE_DONE
203519
+ )){
203520
+ /* Prevent SQLite from taking a shm-lock on the target file when it
203521
+ ** is supplying heap memory to the upper layer in place of *-shm
203522
+ ** segments. */
203050203523
if( ofst==WAL_LOCK_CKPT && n==1 ) rc = SQLITE_BUSY;
203051203524
}else{
203052203525
int bCapture = 0;
203053203526
if( pRbu && pRbu->eStage==RBU_STAGE_CAPTURE ){
203054203527
bCapture = 1;
203055203528
}
203056
-
203057203529
if( bCapture==0 || 0==(flags & SQLITE_SHM_UNLOCK) ){
203058203530
rc = p->pReal->pMethods->xShmLock(p->pReal, ofst, n, flags);
203059203531
if( bCapture && rc==SQLITE_OK ){
203060
- pRbu->mLock |= (1 << ofst);
203532
+ pRbu->mLock |= ((1<<n) - 1) << ofst;
203061203533
}
203062203534
}
203063203535
}
203064203536
203065203537
return rc;
@@ -204885,10 +205357,11 @@
204885205357
struct sqlite3_changeset_iter {
204886205358
SessionInput in; /* Input buffer or stream */
204887205359
SessionBuffer tblhdr; /* Buffer to hold apValue/zTab/abPK/ */
204888205360
int bPatchset; /* True if this is a patchset */
204889205361
int bInvert; /* True to invert changeset */
205362
+ int bSkipEmpty; /* Skip noop UPDATE changes */
204890205363
int rc; /* Iterator error code */
204891205364
sqlite3_stmt *pConflict; /* Points to conflicting row, if any */
204892205365
char *zTab; /* Current table */
204893205366
int nCol; /* Number of columns in zTab */
204894205367
int op; /* Current operation */
@@ -207414,11 +207887,12 @@
207414207887
sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207415207888
int (*xInput)(void *pIn, void *pData, int *pnData),
207416207889
void *pIn,
207417207890
int nChangeset, /* Size of buffer pChangeset in bytes */
207418207891
void *pChangeset, /* Pointer to buffer containing changeset */
207419
- int bInvert /* True to invert changeset */
207892
+ int bInvert, /* True to invert changeset */
207893
+ int bSkipEmpty /* True to skip empty UPDATE changes */
207420207894
){
207421207895
sqlite3_changeset_iter *pRet; /* Iterator to return */
207422207896
int nByte; /* Number of bytes to allocate for iterator */
207423207897
207424207898
assert( xInput==0 || (pChangeset==0 && nChangeset==0) );
@@ -207435,10 +207909,11 @@
207435207909
pRet->in.nData = nChangeset;
207436207910
pRet->in.xInput = xInput;
207437207911
pRet->in.pIn = pIn;
207438207912
pRet->in.bEof = (xInput ? 0 : 1);
207439207913
pRet->bInvert = bInvert;
207914
+ pRet->bSkipEmpty = bSkipEmpty;
207440207915
207441207916
/* Populate the output variable and return success. */
207442207917
*pp = pRet;
207443207918
return SQLITE_OK;
207444207919
}
@@ -207449,20 +207924,20 @@
207449207924
SQLITE_API int sqlite3changeset_start(
207450207925
sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207451207926
int nChangeset, /* Size of buffer pChangeset in bytes */
207452207927
void *pChangeset /* Pointer to buffer containing changeset */
207453207928
){
207454
- return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset, 0);
207929
+ return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset, 0, 0);
207455207930
}
207456207931
SQLITE_API int sqlite3changeset_start_v2(
207457207932
sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207458207933
int nChangeset, /* Size of buffer pChangeset in bytes */
207459207934
void *pChangeset, /* Pointer to buffer containing changeset */
207460207935
int flags
207461207936
){
207462207937
int bInvert = !!(flags & SQLITE_CHANGESETSTART_INVERT);
207463
- return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset, bInvert);
207938
+ return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset, bInvert, 0);
207464207939
}
207465207940
207466207941
/*
207467207942
** Streaming version of sqlite3changeset_start().
207468207943
*/
@@ -207469,20 +207944,20 @@
207469207944
SQLITE_API int sqlite3changeset_start_strm(
207470207945
sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207471207946
int (*xInput)(void *pIn, void *pData, int *pnData),
207472207947
void *pIn
207473207948
){
207474
- return sessionChangesetStart(pp, xInput, pIn, 0, 0, 0);
207949
+ return sessionChangesetStart(pp, xInput, pIn, 0, 0, 0, 0);
207475207950
}
207476207951
SQLITE_API int sqlite3changeset_start_v2_strm(
207477207952
sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207478207953
int (*xInput)(void *pIn, void *pData, int *pnData),
207479207954
void *pIn,
207480207955
int flags
207481207956
){
207482207957
int bInvert = !!(flags & SQLITE_CHANGESETSTART_INVERT);
207483
- return sessionChangesetStart(pp, xInput, pIn, 0, 0, bInvert);
207958
+ return sessionChangesetStart(pp, xInput, pIn, 0, 0, bInvert, 0);
207484207959
}
207485207960
207486207961
/*
207487207962
** If the SessionInput object passed as the only argument is a streaming
207488207963
** object and the buffer is full, discard some data to free up space.
@@ -207604,15 +208079,18 @@
207604208079
*/
207605208080
static int sessionReadRecord(
207606208081
SessionInput *pIn, /* Input data */
207607208082
int nCol, /* Number of values in record */
207608208083
u8 *abPK, /* Array of primary key flags, or NULL */
207609
- sqlite3_value **apOut /* Write values to this array */
208084
+ sqlite3_value **apOut, /* Write values to this array */
208085
+ int *pbEmpty
207610208086
){
207611208087
int i; /* Used to iterate through columns */
207612208088
int rc = SQLITE_OK;
207613208089
208090
+ assert( pbEmpty==0 || *pbEmpty==0 );
208091
+ if( pbEmpty ) *pbEmpty = 1;
207614208092
for(i=0; i<nCol && rc==SQLITE_OK; i++){
207615208093
int eType = 0; /* Type of value (SQLITE_NULL, TEXT etc.) */
207616208094
if( abPK && abPK[i]==0 ) continue;
207617208095
rc = sessionInputBuffer(pIn, 9);
207618208096
if( rc==SQLITE_OK ){
@@ -207620,10 +208098,11 @@
207620208098
rc = SQLITE_CORRUPT_BKPT;
207621208099
}else{
207622208100
eType = pIn->aData[pIn->iNext++];
207623208101
assert( apOut[i]==0 );
207624208102
if( eType ){
208103
+ if( pbEmpty ) *pbEmpty = 0;
207625208104
apOut[i] = sqlite3ValueNew(0);
207626208105
if( !apOut[i] ) rc = SQLITE_NOMEM;
207627208106
}
207628208107
}
207629208108
}
@@ -207799,35 +208278,31 @@
207799208278
}
207800208279
return (p->rc = rc);
207801208280
}
207802208281
207803208282
/*
207804
-** Advance the changeset iterator to the next change.
207805
-**
207806
-** If both paRec and pnRec are NULL, then this function works like the public
207807
-** API sqlite3changeset_next(). If SQLITE_ROW is returned, then the
207808
-** sqlite3changeset_new() and old() APIs may be used to query for values.
207809
-**
207810
-** Otherwise, if paRec and pnRec are not NULL, then a pointer to the change
207811
-** record is written to *paRec before returning and the number of bytes in
207812
-** the record to *pnRec.
207813
-**
207814
-** Either way, this function returns SQLITE_ROW if the iterator is
207815
-** successfully advanced to the next change in the changeset, an SQLite
207816
-** error code if an error occurs, or SQLITE_DONE if there are no further
207817
-** changes in the changeset.
207818
-*/
207819
-static int sessionChangesetNext(
208283
+** Advance the changeset iterator to the next change. The differences between
208284
+** this function and sessionChangesetNext() are that
208285
+**
208286
+** * If pbEmpty is not NULL and the change is a no-op UPDATE (an UPDATE
208287
+** that modifies no columns), this function sets (*pbEmpty) to 1.
208288
+**
208289
+** * If the iterator is configured to skip no-op UPDATEs,
208290
+** sessionChangesetNext() does that. This function does not.
208291
+*/
208292
+static int sessionChangesetNextOne(
207820208293
sqlite3_changeset_iter *p, /* Changeset iterator */
207821208294
u8 **paRec, /* If non-NULL, store record pointer here */
207822208295
int *pnRec, /* If non-NULL, store size of record here */
207823
- int *pbNew /* If non-NULL, true if new table */
208296
+ int *pbNew, /* If non-NULL, true if new table */
208297
+ int *pbEmpty
207824208298
){
207825208299
int i;
207826208300
u8 op;
207827208301
207828208302
assert( (paRec==0 && pnRec==0) || (paRec && pnRec) );
208303
+ assert( pbEmpty==0 || *pbEmpty==0 );
207829208304
207830208305
/* If the iterator is in the error-state, return immediately. */
207831208306
if( p->rc!=SQLITE_OK ) return p->rc;
207832208307
207833208308
/* Free the current contents of p->apValue[], if any. */
@@ -207896,17 +208371,17 @@
207896208371
sqlite3_value **apNew = (p->bInvert ? p->apValue : &p->apValue[p->nCol]);
207897208372
207898208373
/* If this is an UPDATE or DELETE, read the old.* record. */
207899208374
if( p->op!=SQLITE_INSERT && (p->bPatchset==0 || p->op==SQLITE_DELETE) ){
207900208375
u8 *abPK = p->bPatchset ? p->abPK : 0;
207901
- p->rc = sessionReadRecord(&p->in, p->nCol, abPK, apOld);
208376
+ p->rc = sessionReadRecord(&p->in, p->nCol, abPK, apOld, 0);
207902208377
if( p->rc!=SQLITE_OK ) return p->rc;
207903208378
}
207904208379
207905208380
/* If this is an INSERT or UPDATE, read the new.* record. */
207906208381
if( p->op!=SQLITE_DELETE ){
207907
- p->rc = sessionReadRecord(&p->in, p->nCol, 0, apNew);
208382
+ p->rc = sessionReadRecord(&p->in, p->nCol, 0, apNew, pbEmpty);
207908208383
if( p->rc!=SQLITE_OK ) return p->rc;
207909208384
}
207910208385
207911208386
if( (p->bPatchset || p->bInvert) && p->op==SQLITE_UPDATE ){
207912208387
/* If this is an UPDATE that is part of a patchset, then all PK and
@@ -207928,10 +208403,41 @@
207928208403
}
207929208404
}
207930208405
207931208406
return SQLITE_ROW;
207932208407
}
208408
+
208409
+/*
208410
+** Advance the changeset iterator to the next change.
208411
+**
208412
+** If both paRec and pnRec are NULL, then this function works like the public
208413
+** API sqlite3changeset_next(). If SQLITE_ROW is returned, then the
208414
+** sqlite3changeset_new() and old() APIs may be used to query for values.
208415
+**
208416
+** Otherwise, if paRec and pnRec are not NULL, then a pointer to the change
208417
+** record is written to *paRec before returning and the number of bytes in
208418
+** the record to *pnRec.
208419
+**
208420
+** Either way, this function returns SQLITE_ROW if the iterator is
208421
+** successfully advanced to the next change in the changeset, an SQLite
208422
+** error code if an error occurs, or SQLITE_DONE if there are no further
208423
+** changes in the changeset.
208424
+*/
208425
+static int sessionChangesetNext(
208426
+ sqlite3_changeset_iter *p, /* Changeset iterator */
208427
+ u8 **paRec, /* If non-NULL, store record pointer here */
208428
+ int *pnRec, /* If non-NULL, store size of record here */
208429
+ int *pbNew /* If non-NULL, true if new table */
208430
+){
208431
+ int bEmpty;
208432
+ int rc;
208433
+ do {
208434
+ bEmpty = 0;
208435
+ rc = sessionChangesetNextOne(p, paRec, pnRec, pbNew, &bEmpty);
208436
+ }while( rc==SQLITE_ROW && p->bSkipEmpty && bEmpty);
208437
+ return rc;
208438
+}
207933208439
207934208440
/*
207935208441
** Advance an iterator created by sqlite3changeset_start() to the next
207936208442
** change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE
207937208443
** or SQLITE_CORRUPT.
@@ -208201,13 +208707,13 @@
208201208707
sessionAppendByte(&sOut, eType, &rc);
208202208708
sessionAppendByte(&sOut, pInput->aData[pInput->iNext+1], &rc);
208203208709
208204208710
/* Read the old.* and new.* records for the update change. */
208205208711
pInput->iNext += 2;
208206
- rc = sessionReadRecord(pInput, nCol, 0, &apVal[0]);
208712
+ rc = sessionReadRecord(pInput, nCol, 0, &apVal[0], 0);
208207208713
if( rc==SQLITE_OK ){
208208
- rc = sessionReadRecord(pInput, nCol, 0, &apVal[nCol]);
208714
+ rc = sessionReadRecord(pInput, nCol, 0, &apVal[nCol], 0);
208209208715
}
208210208716
208211208717
/* Write the new old.* record. Consists of the PK columns from the
208212208718
** original old.* record, and the other values from the original
208213208719
** new.* record. */
@@ -209151,11 +209657,11 @@
209151209657
sqlite3_changeset_iter *pIter2 = 0;
209152209658
SessionBuffer cons = pApply->constraints;
209153209659
memset(&pApply->constraints, 0, sizeof(SessionBuffer));
209154209660
209155209661
rc = sessionChangesetStart(
209156
- &pIter2, 0, 0, cons.nBuf, cons.aBuf, pApply->bInvertConstraints
209662
+ &pIter2, 0, 0, cons.nBuf, cons.aBuf, pApply->bInvertConstraints, 1
209157209663
);
209158209664
if( rc==SQLITE_OK ){
209159209665
size_t nByte = 2*pApply->nCol*sizeof(sqlite3_value*);
209160209666
int rc2;
209161209667
pIter2->bPatchset = bPatchset;
@@ -209407,12 +209913,12 @@
209407209913
void *pCtx, /* First argument passed to xConflict */
209408209914
void **ppRebase, int *pnRebase,
209409209915
int flags
209410209916
){
209411209917
sqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */
209412
- int bInverse = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
209413
- int rc = sessionChangesetStart(&pIter, 0, 0, nChangeset, pChangeset,bInverse);
209918
+ int bInv = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
209919
+ int rc = sessionChangesetStart(&pIter, 0, 0, nChangeset, pChangeset, bInv, 1);
209414209920
if( rc==SQLITE_OK ){
209415209921
rc = sessionChangesetApply(
209416209922
db, pIter, xFilter, xConflict, pCtx, ppRebase, pnRebase, flags
209417209923
);
209418209924
}
@@ -209466,11 +209972,11 @@
209466209972
void **ppRebase, int *pnRebase,
209467209973
int flags
209468209974
){
209469209975
sqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */
209470209976
int bInverse = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
209471
- int rc = sessionChangesetStart(&pIter, xInput, pIn, 0, 0, bInverse);
209977
+ int rc = sessionChangesetStart(&pIter, xInput, pIn, 0, 0, bInverse, 1);
209472209978
if( rc==SQLITE_OK ){
209473209979
rc = sessionChangesetApply(
209474209980
db, pIter, xFilter, xConflict, pCtx, ppRebase, pnRebase, flags
209475209981
);
209476209982
}
@@ -210086,11 +210592,11 @@
210086210592
*pOut++ = pIter->bIndirect;
210087210593
for(i=0; i<pIter->nCol; i++){
210088210594
int n1 = sessionSerialLen(a1);
210089210595
int n2 = sessionSerialLen(a2);
210090210596
if( pIter->abPK[i] || a2[0]==0 ){
210091
- if( !pIter->abPK[i] ) bData = 1;
210597
+ if( !pIter->abPK[i] && a1[0] ) bData = 1;
210092210598
memcpy(pOut, a1, n1);
210093210599
pOut += n1;
210094210600
}else if( a2[0]!=0xFF ){
210095210601
bData = 1;
210096210602
memcpy(pOut, a2, n2);
@@ -228484,11 +228990,11 @@
228484228990
int nArg, /* Number of args */
228485228991
sqlite3_value **apUnused /* Function arguments */
228486228992
){
228487228993
assert( nArg==0 );
228488228994
UNUSED_PARAM2(nArg, apUnused);
228489
- sqlite3_result_text(pCtx, "fts5: 2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398f17d", -1, SQLITE_TRANSIENT);
228995
+ sqlite3_result_text(pCtx, "fts5: 2021-02-22 11:07:25 b66a49570852cf118a372a6ac44be3070cf9b4254696f16315b7c79a614e6c35", -1, SQLITE_TRANSIENT);
228490228996
}
228491228997
228492228998
/*
228493228999
** Return true if zName is the extension on one of the shadow tables used
228494229000
** by this module.
@@ -233410,12 +233916,12 @@
233410233916
}
233411233917
#endif /* SQLITE_CORE */
233412233918
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
233413233919
233414233920
/************** End of stmt.c ************************************************/
233415
-#if __LINE__!=233415
233921
+#if __LINE__!=233921
233416233922
#undef SQLITE_SOURCE_ID
233417
-#define SQLITE_SOURCE_ID "2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398alt2"
233923
+#define SQLITE_SOURCE_ID "2021-02-22 16:42:09 b5a0778cc5a98a864bea72670f83262da940aceb91fa4cdf46ec097337a3alt2"
233418233924
#endif
233419233925
/* Return the source-id for this library */
233420233926
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
233421233927
/************************** End of sqlite3.c ******************************/
233422233928
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1171,11 +1171,11 @@
1171 ** be held constant and Z will be incremented or else Y will be incremented
1172 ** and Z will be reset to zero.
1173 **
1174 ** Since [version 3.6.18] ([dateof:3.6.18]),
1175 ** SQLite source code has been stored in the
1176 ** <a href="http://fossil-scm.org/">Fossil configuration management
1177 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
1178 ** a string which identifies a particular check-in of SQLite
1179 ** within its configuration management system. ^The SQLITE_SOURCE_ID
1180 ** string contains the date and time of the check-in (UTC) and a SHA1
1181 ** or SHA3-256 hash of the entire source tree. If the source code has
@@ -1186,11 +1186,11 @@
1186 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1187 ** [sqlite_version()] and [sqlite_source_id()].
1188 */
1189 #define SQLITE_VERSION "3.35.0"
1190 #define SQLITE_VERSION_NUMBER 3035000
1191 #define SQLITE_SOURCE_ID "2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398f17d"
1192
1193 /*
1194 ** CAPI3REF: Run-Time Library Version Numbers
1195 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1196 **
@@ -14125,95 +14125,96 @@
14125 #define TK_GROUPS 92
14126 #define TK_OTHERS 93
14127 #define TK_TIES 94
14128 #define TK_GENERATED 95
14129 #define TK_ALWAYS 96
14130 #define TK_REINDEX 97
14131 #define TK_RENAME 98
14132 #define TK_CTIME_KW 99
14133 #define TK_ANY 100
14134 #define TK_BITAND 101
14135 #define TK_BITOR 102
14136 #define TK_LSHIFT 103
14137 #define TK_RSHIFT 104
14138 #define TK_PLUS 105
14139 #define TK_MINUS 106
14140 #define TK_STAR 107
14141 #define TK_SLASH 108
14142 #define TK_REM 109
14143 #define TK_CONCAT 110
14144 #define TK_COLLATE 111
14145 #define TK_BITNOT 112
14146 #define TK_ON 113
14147 #define TK_INDEXED 114
14148 #define TK_STRING 115
14149 #define TK_JOIN_KW 116
14150 #define TK_CONSTRAINT 117
14151 #define TK_DEFAULT 118
14152 #define TK_NULL 119
14153 #define TK_PRIMARY 120
14154 #define TK_UNIQUE 121
14155 #define TK_CHECK 122
14156 #define TK_REFERENCES 123
14157 #define TK_AUTOINCR 124
14158 #define TK_INSERT 125
14159 #define TK_DELETE 126
14160 #define TK_UPDATE 127
14161 #define TK_SET 128
14162 #define TK_DEFERRABLE 129
14163 #define TK_FOREIGN 130
14164 #define TK_DROP 131
14165 #define TK_UNION 132
14166 #define TK_ALL 133
14167 #define TK_EXCEPT 134
14168 #define TK_INTERSECT 135
14169 #define TK_SELECT 136
14170 #define TK_VALUES 137
14171 #define TK_DISTINCT 138
14172 #define TK_DOT 139
14173 #define TK_FROM 140
14174 #define TK_JOIN 141
14175 #define TK_USING 142
14176 #define TK_ORDER 143
14177 #define TK_GROUP 144
14178 #define TK_HAVING 145
14179 #define TK_LIMIT 146
14180 #define TK_WHERE 147
14181 #define TK_RETURNING 148
14182 #define TK_INTO 149
14183 #define TK_NOTHING 150
14184 #define TK_FLOAT 151
14185 #define TK_BLOB 152
14186 #define TK_INTEGER 153
14187 #define TK_VARIABLE 154
14188 #define TK_CASE 155
14189 #define TK_WHEN 156
14190 #define TK_THEN 157
14191 #define TK_ELSE 158
14192 #define TK_INDEX 159
14193 #define TK_ALTER 160
14194 #define TK_ADD 161
14195 #define TK_WINDOW 162
14196 #define TK_OVER 163
14197 #define TK_FILTER 164
14198 #define TK_COLUMN 165
14199 #define TK_AGG_FUNCTION 166
14200 #define TK_AGG_COLUMN 167
14201 #define TK_TRUEFALSE 168
14202 #define TK_ISNOT 169
14203 #define TK_FUNCTION 170
14204 #define TK_UMINUS 171
14205 #define TK_UPLUS 172
14206 #define TK_TRUTH 173
14207 #define TK_REGISTER 174
14208 #define TK_VECTOR 175
14209 #define TK_SELECT_COLUMN 176
14210 #define TK_IF_NULL_ROW 177
14211 #define TK_ASTERISK 178
14212 #define TK_SPAN 179
14213 #define TK_SPACE 180
14214 #define TK_ILLEGAL 181
 
14215
14216 /************** End of parse.h ***********************************************/
14217 /************** Continuing where we left off in sqliteInt.h ******************/
14218 #include <stdio.h>
14219 #include <stdlib.h>
@@ -14764,10 +14765,12 @@
14764 typedef struct AuthContext AuthContext;
14765 typedef struct AutoincInfo AutoincInfo;
14766 typedef struct Bitvec Bitvec;
14767 typedef struct CollSeq CollSeq;
14768 typedef struct Column Column;
 
 
14769 typedef struct Db Db;
14770 typedef struct DbFixer DbFixer;
14771 typedef struct Schema Schema;
14772 typedef struct Expr Expr;
14773 typedef struct ExprList ExprList;
@@ -14793,10 +14796,11 @@
14793 typedef struct RowSet RowSet;
14794 typedef struct Savepoint Savepoint;
14795 typedef struct Select Select;
14796 typedef struct SQLiteThread SQLiteThread;
14797 typedef struct SelectDest SelectDest;
 
14798 typedef struct SrcList SrcList;
14799 typedef struct sqlite3_str StrAccum; /* Internal alias for sqlite3_str */
14800 typedef struct Table Table;
14801 typedef struct TableLock TableLock;
14802 typedef struct Token Token;
@@ -15786,26 +15790,26 @@
15786 #define OP_ReopenIdx 96 /* synopsis: root=P2 iDb=P3 */
15787 #define OP_OpenRead 97 /* synopsis: root=P2 iDb=P3 */
15788 #define OP_OpenWrite 98 /* synopsis: root=P2 iDb=P3 */
15789 #define OP_OpenDup 99
15790 #define OP_OpenAutoindex 100 /* synopsis: nColumn=P2 */
15791 #define OP_BitAnd 101 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
15792 #define OP_BitOr 102 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
15793 #define OP_ShiftLeft 103 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
15794 #define OP_ShiftRight 104 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
15795 #define OP_Add 105 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
15796 #define OP_Subtract 106 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
15797 #define OP_Multiply 107 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
15798 #define OP_Divide 108 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
15799 #define OP_Remainder 109 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
15800 #define OP_Concat 110 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
15801 #define OP_OpenEphemeral 111 /* synopsis: nColumn=P2 */
15802 #define OP_BitNot 112 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
15803 #define OP_SorterOpen 113
15804 #define OP_SequenceTest 114 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
15805 #define OP_String8 115 /* same as TK_STRING, synopsis: r[P2]='P4' */
15806 #define OP_OpenPseudo 116 /* synopsis: P3 columns in r[P2] */
15807 #define OP_Close 117
15808 #define OP_ColumnsUsed 118
15809 #define OP_SeekScan 119 /* synopsis: Scan-ahead up to P1 rows */
15810 #define OP_SeekHit 120 /* synopsis: set P2<=seekHit<=P3 */
15811 #define OP_Sequence 121 /* synopsis: r[P2]=cursor[P1].ctr++ */
@@ -15836,12 +15840,12 @@
15836 #define OP_DropTable 146
15837 #define OP_DropIndex 147
15838 #define OP_DropTrigger 148
15839 #define OP_IntegrityCk 149
15840 #define OP_RowSetAdd 150 /* synopsis: rowset(P1)=r[P2] */
15841 #define OP_Real 151 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15842 #define OP_Param 152
15843 #define OP_FkCounter 153 /* synopsis: fkctr[P1]+=P2 */
15844 #define OP_MemMax 154 /* synopsis: r[P1]=max(r[P1],r[P2]) */
15845 #define OP_OffsetLimit 155 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
15846 #define OP_AggInverse 156 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
15847 #define OP_AggStep 157 /* synopsis: accum=r[P3] step(r[P2@P5]) */
@@ -15888,13 +15892,13 @@
15888 /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x01, 0x01, 0x01, 0x00,\
15889 /* 64 */ 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10,\
15890 /* 72 */ 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\
15891 /* 80 */ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\
15892 /* 88 */ 0x12, 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
15893 /* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0x26,\
15894 /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00,\
15895 /* 112 */ 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\
15896 /* 120 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
15897 /* 128 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00,\
15898 /* 136 */ 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00,\
15899 /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10,\
15900 /* 152 */ 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00,\
@@ -15966,11 +15970,11 @@
15966 #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_EXPLAIN)
15967 SQLITE_PRIVATE void sqlite3ExplainBreakpoint(const char*,const char*);
15968 #else
15969 # define sqlite3ExplainBreakpoint(A,B) /*no-op*/
15970 #endif
15971 SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);
15972 SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, int addr, u8);
15973 SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
15974 SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
15975 SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3);
15976 SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u16 P5);
@@ -17475,11 +17479,16 @@
17475 u8 szEst; /* Estimated size of value in this column. sizeof(INT)==1 */
17476 u8 hName; /* Column name hash for faster lookup */
17477 u16 colFlags; /* Boolean properties. See COLFLAG_ defines below */
17478 };
17479
17480 /* Allowed values for Column.colFlags:
 
 
 
 
 
17481 */
17482 #define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */
17483 #define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */
17484 #define COLFLAG_HASTYPE 0x0004 /* Type name follows column name */
17485 #define COLFLAG_UNIQUE 0x0008 /* Column def contains "UNIQUE" or "PK" */
@@ -17664,15 +17673,16 @@
17664 ** the TF_OOOHidden attribute would apply in this case. Such tables require
17665 ** special handling during INSERT processing. The "OOO" means "Out Of Order".
17666 **
17667 ** Constraints:
17668 **
17669 ** TF_HasVirtual == COLFLAG_Virtual
17670 ** TF_HasStored == COLFLAG_Stored
 
17671 */
17672 #define TF_Readonly 0x0001 /* Read-only system table */
17673 #define TF_Ephemeral 0x0002 /* An ephemeral table */
17674 #define TF_HasPrimaryKey 0x0004 /* Table has a primary key */
17675 #define TF_Autoincrement 0x0008 /* Integer primary key is autoincrement */
17676 #define TF_HasStat1 0x0010 /* nRowLogEst set from sqlite_stat1 */
17677 #define TF_HasVirtual 0x0020 /* Has one or more VIRTUAL columns */
17678 #define TF_HasStored 0x0040 /* Has one or more STORED columns */
@@ -17683,10 +17693,11 @@
17683 #define TF_NoVisibleRowid 0x0200 /* No user-visible "rowid" column */
17684 #define TF_OOOHidden 0x0400 /* Out-of-Order hidden columns */
17685 #define TF_HasNotNull 0x0800 /* Contains NOT NULL constraints */
17686 #define TF_Shadow 0x1000 /* True for a shadow table */
17687 #define TF_HasStat4 0x2000 /* STAT4 info available for this table */
 
17688
17689 /*
17690 ** Test to see whether or not a table is a virtual table. This is
17691 ** done as a macro so that it will be optimized out when virtual
17692 ** table support is omitted from the build.
@@ -18051,11 +18062,10 @@
18051 int iMem; /* Memory location that acts as accumulator */
18052 int iDistinct; /* Ephemeral table used to enforce DISTINCT */
18053 } *aFunc;
18054 int nFunc; /* Number of entries in aFunc[] */
18055 u32 selId; /* Select to which this AggInfo belongs */
18056 AggInfo *pNext; /* Next in list of them all */
18057 };
18058
18059 /*
18060 ** The datatype ynVar is a signed integer, either 16-bit or 32-bit.
18061 ** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater
@@ -18370,10 +18380,49 @@
18370 int idx; /* Index in some Table.aCol[] of a column named zName */
18371 } *a;
18372 int nId; /* Number of identifiers on the list */
18373 };
18374
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18375 /*
18376 ** The following structure describes the FROM clause of a SELECT statement.
18377 ** Each table or subquery in the FROM clause is a separate element of
18378 ** the SrcList.a[] array.
18379 **
@@ -18392,40 +18441,11 @@
18392 ** contains more than 63 columns and the 64-th or later column is used.
18393 */
18394 struct SrcList {
18395 int nSrc; /* Number of tables or subqueries in the FROM clause */
18396 u32 nAlloc; /* Number of entries allocated in a[] below */
18397 struct SrcList_item {
18398 Schema *pSchema; /* Schema to which this item is fixed */
18399 char *zDatabase; /* Name of database holding this table */
18400 char *zName; /* Name of the table */
18401 char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */
18402 Table *pTab; /* An SQL table corresponding to zName */
18403 Select *pSelect; /* A SELECT statement used in place of a table name */
18404 int addrFillSub; /* Address of subroutine to manifest a subquery */
18405 int regReturn; /* Register holding return address of addrFillSub */
18406 int regResult; /* Registers holding results of a co-routine */
18407 struct {
18408 u8 jointype; /* Type of join between this table and the previous */
18409 unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */
18410 unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */
18411 unsigned isTabFunc :1; /* True if table-valued-function syntax */
18412 unsigned isCorrelated :1; /* True if sub-query is correlated */
18413 unsigned viaCoroutine :1; /* Implemented as a co-routine */
18414 unsigned isRecursive :1; /* True for recursive reference in WITH */
18415 unsigned fromDDL :1; /* Comes from sqlite_schema */
18416 } fg;
18417 int iCursor; /* The VDBE cursor number used to access this table */
18418 Expr *pOn; /* The ON clause of a join */
18419 IdList *pUsing; /* The USING clause of a join */
18420 Bitmask colUsed; /* Bit N (1<<N) set if column N of pTab is used */
18421 union {
18422 char *zIndexedBy; /* Identifier from "INDEXED BY <zIndex>" clause */
18423 ExprList *pFuncArg; /* Arguments to table-valued-function */
18424 } u1;
18425 Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */
18426 } a[1]; /* One entry for each identifier on the list */
18427 };
18428
18429 /*
18430 ** Permitted values of the SrcList.a.jointype field
18431 */
@@ -18644,10 +18664,11 @@
18644 #define SF_WhereBegin 0x0080000 /* Really a WhereBegin() call. Debug Only */
18645 #define SF_WinRewrite 0x0100000 /* Window function rewrite accomplished */
18646 #define SF_View 0x0200000 /* SELECT statement is a view */
18647 #define SF_NoopOrderBy 0x0400000 /* ORDER BY is ignored for this query */
18648 #define SF_UpdateFrom 0x0800000 /* Statement is an UPDATE...FROM */
 
18649
18650 /*
18651 ** The results of a SELECT can be distributed in several ways, as defined
18652 ** by one of the following macros. The "SRT" prefix means "SELECT Result
18653 ** Type".
@@ -18886,11 +18907,10 @@
18886 #endif
18887 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
18888 Parse *pToplevel; /* Parse structure for main program (or NULL) */
18889 Table *pTriggerTab; /* Table triggers are being coded for */
18890 Parse *pParentParse; /* Parent parser if this parser is nested */
18891 AggInfo *pAggList; /* List of all AggInfo objects */
18892 union {
18893 int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
18894 Returning *pReturning; /* The RETURNING clause */
18895 } u1;
18896 u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
@@ -19170,11 +19190,12 @@
19170 } InitData;
19171
19172 /*
19173 ** Allowed values for mInitFlags
19174 */
19175 #define INITFLAG_AlterTable 0x0001 /* This is a reparse after ALTER TABLE */
 
19176
19177 /*
19178 ** Structure containing global configuration data for the SQLite library.
19179 **
19180 ** This structure also contains some state information.
@@ -19282,11 +19303,11 @@
19282 Select *pSelect; /* HAVING to WHERE clause ctx */
19283 struct WindowRewrite *pRewrite; /* Window rewrite context */
19284 struct WhereConst *pConst; /* WHERE clause constants */
19285 struct RenameCtx *pRename; /* RENAME COLUMN context */
19286 struct Table *pTab; /* Table of generated column */
19287 struct SrcList_item *pSrcItem; /* A single FROM clause item */
19288 DbFixer *pFix;
19289 } u;
19290 };
19291
19292 /*
@@ -19327,23 +19348,58 @@
19327 #define WRC_Continue 0 /* Continue down into children */
19328 #define WRC_Prune 1 /* Omit children but continue walking siblings */
19329 #define WRC_Abort 2 /* Abandon the tree walk */
19330
19331 /*
19332 ** An instance of this structure represents a set of one or more CTEs
19333 ** (common table expressions) created by a single WITH clause.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19334 */
19335 struct With {
19336 int nCte; /* Number of CTEs in the WITH clause */
19337 With *pOuter; /* Containing WITH clause, or NULL */
19338 struct Cte { /* For each CTE in the WITH clause.... */
19339 char *zName; /* Name of this CTE */
19340 ExprList *pCols; /* List of explicit column names, or NULL */
19341 Select *pSelect; /* The definition of this CTE */
19342 const char *zCteErr; /* Error message for circular references */
19343 } a[1];
19344 };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19345
19346 #ifdef SQLITE_DEBUG
19347 /*
19348 ** An instance of the TreeView object is used for printing the content of
19349 ** data structures on sqlite3DebugPrintf() using a tree-like view.
@@ -19800,11 +19856,11 @@
19800 SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(Parse*, SrcList*, Token*, Token*);
19801 SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*,
19802 Token*, Select*, Expr*, IdList*);
19803 SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *);
19804 SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse*, SrcList*, ExprList*);
19805 SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, struct SrcList_item *);
19806 SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList*);
19807 SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse*, SrcList*);
19808 SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*);
19809 SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3*, SrcList*);
19810 SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(sqlite3*,i16,int,char**);
@@ -19862,11 +19918,11 @@
19862 SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse*, Expr*, int, int);
19863 SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*);
19864 #define LOCATE_VIEW 0x01
19865 #define LOCATE_NOERR 0x02
19866 SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*);
19867 SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,struct SrcList_item *);
19868 SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*);
19869 SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);
19870 SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
19871 SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*,Expr*);
19872 SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int, sqlite3_value*);
@@ -19990,10 +20046,11 @@
19990 # define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
19991 # define sqlite3TriggerStepSrc(A,B) 0
19992 #endif
19993
19994 SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*);
 
19995 SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr*,int);
19996 SQLITE_PRIVATE void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);
19997 SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse*, int);
19998 #ifndef SQLITE_OMIT_AUTHORIZATION
19999 SQLITE_PRIVATE void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);
@@ -20156,11 +20213,11 @@
20156 SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
20157 SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
20158 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
20159 SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
20160 SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
20161 SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, struct SrcList_item*);
20162 SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
20163 SQLITE_PRIVATE int sqlite3MatchEName(
20164 const struct ExprList_item*,
20165 const char*,
20166 const char*,
@@ -20174,10 +20231,11 @@
20174 SQLITE_PRIVATE int sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*);
20175 SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
20176 SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
20177 SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
20178 SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
 
20179 SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse*, void*, Token*);
20180 SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom);
20181 SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*);
20182 SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse*, ExprList*);
20183 SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
@@ -20327,11 +20385,11 @@
20327 SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
20328 SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
20329 SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
20330 SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
20331 SQLITE_PRIVATE void sqlite3ParserReset(Parse*);
20332 SQLITE_PRIVATE void sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*);
20333 #ifdef SQLITE_ENABLE_NORMALIZE
20334 SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*);
20335 #endif
20336 SQLITE_PRIVATE int sqlite3Reprepare(Vdbe*);
20337 SQLITE_PRIVATE void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*);
@@ -20342,16 +20400,21 @@
20342 #ifndef SQLITE_OMIT_WAL
20343 SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3*, int, int, int*, int*);
20344 SQLITE_PRIVATE int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int);
20345 #endif
20346 #ifndef SQLITE_OMIT_CTE
20347 SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Token*,ExprList*,Select*);
 
 
20348 SQLITE_PRIVATE void sqlite3WithDelete(sqlite3*,With*);
20349 SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8);
20350 #else
20351 #define sqlite3WithPush(x,y,z)
20352 #define sqlite3WithDelete(x,y)
 
 
 
20353 #endif
20354 #ifndef SQLITE_OMIT_UPSERT
20355 SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*);
20356 SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*);
20357 SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
@@ -29201,11 +29264,11 @@
29201 break;
29202 }
29203 case etSRCLIST: {
29204 SrcList *pSrc;
29205 int k;
29206 struct SrcList_item *pItem;
29207 if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
29208 pSrc = va_arg(ap, SrcList*);
29209 k = va_arg(ap, int);
29210 pItem = &pSrc->a[k];
29211 assert( bArgList==0 );
@@ -29769,11 +29832,14 @@
29769 sqlite3_str_appendf(&x, "%c%s", cSep, pCte->pCols->a[j].zEName);
29770 cSep = ',';
29771 }
29772 sqlite3_str_appendf(&x, ")");
29773 }
29774 sqlite3_str_appendf(&x, " AS");
 
 
 
29775 sqlite3StrAccumFinish(&x);
29776 sqlite3TreeViewItem(pView, zLine, i<pWith->nCte-1);
29777 sqlite3TreeViewSelect(pView, pCte->pSelect, 0);
29778 sqlite3TreeViewPop(pView);
29779 }
@@ -29785,11 +29851,11 @@
29785 ** Generate a human-readable description of a SrcList object.
29786 */
29787 SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){
29788 int i;
29789 for(i=0; i<pSrc->nSrc; i++){
29790 const struct SrcList_item *pItem = &pSrc->a[i];
29791 StrAccum x;
29792 char zLine[100];
29793 sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);
29794 sqlite3_str_appendf(&x, "{%d:*}", pItem->iCursor);
29795 if( pItem->zDatabase ){
@@ -29808,10 +29874,13 @@
29808 sqlite3_str_appendf(&x, " LEFT-JOIN");
29809 }
29810 if( pItem->fg.fromDDL ){
29811 sqlite3_str_appendf(&x, " DDL");
29812 }
 
 
 
29813 sqlite3StrAccumFinish(&x);
29814 sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1);
29815 if( pItem->pSelect ){
29816 sqlite3TreeViewSelect(pView, pItem->pSelect, 0);
29817 }
@@ -33481,26 +33550,26 @@
33481 /* 96 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
33482 /* 97 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
33483 /* 98 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
33484 /* 99 */ "OpenDup" OpHelp(""),
33485 /* 100 */ "OpenAutoindex" OpHelp("nColumn=P2"),
33486 /* 101 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
33487 /* 102 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
33488 /* 103 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
33489 /* 104 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
33490 /* 105 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
33491 /* 106 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
33492 /* 107 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
33493 /* 108 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
33494 /* 109 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
33495 /* 110 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
33496 /* 111 */ "OpenEphemeral" OpHelp("nColumn=P2"),
33497 /* 112 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
33498 /* 113 */ "SorterOpen" OpHelp(""),
33499 /* 114 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
33500 /* 115 */ "String8" OpHelp("r[P2]='P4'"),
33501 /* 116 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
33502 /* 117 */ "Close" OpHelp(""),
33503 /* 118 */ "ColumnsUsed" OpHelp(""),
33504 /* 119 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
33505 /* 120 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
33506 /* 121 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
@@ -33531,12 +33600,12 @@
33531 /* 146 */ "DropTable" OpHelp(""),
33532 /* 147 */ "DropIndex" OpHelp(""),
33533 /* 148 */ "DropTrigger" OpHelp(""),
33534 /* 149 */ "IntegrityCk" OpHelp(""),
33535 /* 150 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
33536 /* 151 */ "Real" OpHelp("r[P2]=P4"),
33537 /* 152 */ "Param" OpHelp(""),
33538 /* 153 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
33539 /* 154 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
33540 /* 155 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
33541 /* 156 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
33542 /* 157 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
@@ -78733,13 +78802,14 @@
78733 ** as having been used.
78734 **
78735 ** The zWhere string must have been obtained from sqlite3_malloc().
78736 ** This routine will take ownership of the allocated memory.
78737 */
78738 SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere){
78739 int j;
78740 sqlite3VdbeAddOp4(p, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC);
 
78741 for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);
78742 sqlite3MayAbort(p->pParse);
78743 }
78744
78745 /*
@@ -89804,11 +89874,11 @@
89804 assert( aMem[pOp->p3].flags & MEM_Null );
89805 aMem[pOp->p3].n = 0;
89806 aMem[pOp->p3].z = "";
89807 }
89808 pCx = p->apCsr[pOp->p1];
89809 if( pCx && pCx->pBtx ){
89810 /* If the ephermeral table is already open, erase all existing content
89811 ** so that the table is empty again, rather than creating a new table. */
89812 assert( pCx->isEphemeral );
89813 pCx->seqCount = 0;
89814 pCx->cacheStatus = CACHE_STALE;
@@ -92185,11 +92255,11 @@
92185
92186 #ifndef SQLITE_OMIT_ALTERTABLE
92187 if( pOp->p4.z==0 ){
92188 sqlite3SchemaClear(db->aDb[iDb].pSchema);
92189 db->mDbFlags &= ~DBFLAG_SchemaKnownOk;
92190 rc = sqlite3InitOne(db, iDb, &p->zErrMsg, INITFLAG_AlterTable);
92191 db->mDbFlags |= DBFLAG_SchemaChange;
92192 p->expired = 0;
92193 }else
92194 #endif
92195 {
@@ -98409,11 +98479,11 @@
98409 ** WRC_Abort or WRC_Continue;
98410 */
98411 SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){
98412 SrcList *pSrc;
98413 int i;
98414 struct SrcList_item *pItem;
98415
98416 pSrc = p->pSrc;
98417 if( pSrc ){
98418 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
98419 if( pItem->pSelect && sqlite3WalkSelect(pWalker, pItem->pSelect) ){
@@ -98575,11 +98645,10 @@
98575 static void resolveAlias(
98576 Parse *pParse, /* Parsing context */
98577 ExprList *pEList, /* A result set */
98578 int iCol, /* A column in the result set. 0..pEList->nExpr-1 */
98579 Expr *pExpr, /* Transform this into an alias to the result set */
98580 const char *zType, /* "GROUP" or "ORDER" or "" */
98581 int nSubquery /* Number of subqueries that the label is moving */
98582 ){
98583 Expr *pOrig; /* The iCol-th column of the result set */
98584 Expr *pDup; /* Copy of pOrig */
98585 sqlite3 *db; /* The database connection */
@@ -98588,11 +98657,11 @@
98588 pOrig = pEList->a[iCol].pExpr;
98589 assert( pOrig!=0 );
98590 db = pParse->db;
98591 pDup = sqlite3ExprDup(db, pOrig, 0);
98592 if( pDup!=0 ){
98593 if( zType[0]!='G' ) incrAggFunctionDepth(pDup, nSubquery);
98594 if( pExpr->op==TK_COLLATE ){
98595 pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);
98596 }
98597
98598 /* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
@@ -98751,12 +98820,12 @@
98751 int i, j; /* Loop counters */
98752 int cnt = 0; /* Number of matching column names */
98753 int cntTab = 0; /* Number of matching table names */
98754 int nSubquery = 0; /* How many levels of subquery */
98755 sqlite3 *db = pParse->db; /* The database connection */
98756 struct SrcList_item *pItem; /* Use for looping over pSrcList items */
98757 struct SrcList_item *pMatch = 0; /* The matching pSrcList item */
98758 NameContext *pTopNC = pNC; /* First namecontext in the list */
98759 Schema *pSchema = 0; /* Schema of the expression */
98760 int eNewExprOp = TK_COLUMN; /* New value for pExpr->op on success */
98761 Table *pTab = 0; /* Table hold the row */
98762 Column *pCol; /* A column of pTab */
@@ -98873,13 +98942,14 @@
98873 } /* if( pSrcList ) */
98874
98875 #if !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT)
98876 /* If we have not already resolved the name, then maybe
98877 ** it is a new.* or old.* trigger argument reference. Or
98878 ** maybe it is an excluded.* from an upsert.
 
98879 */
98880 if( cntTab==0 && zDb==0 ){
98881 pTab = 0;
98882 #ifndef SQLITE_OMIT_TRIGGER
98883 if( pParse->pTriggerTab!=0 ){
98884 int op = pParse->eTriggerOp;
98885 assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
@@ -98887,18 +98957,18 @@
98887 pExpr->iTable = 1;
98888 pTab = pParse->pTriggerTab;
98889 }else if( op!=TK_INSERT && zTab && sqlite3StrICmp("old",zTab)==0 ){
98890 pExpr->iTable = 0;
98891 pTab = pParse->pTriggerTab;
98892 }else if( pParse->bReturning ){
98893 pExpr->iTable = op!=TK_DELETE;
98894 pTab = pParse->pTriggerTab;
98895 }
98896 }
98897 #endif /* SQLITE_OMIT_TRIGGER */
98898 #ifndef SQLITE_OMIT_UPSERT
98899 if( (pNC->ncFlags & NC_UUpsert)!=0 && ALWAYS(zTab) ){
98900 Upsert *pUpsert = pNC->uNC.pUpsert;
98901 if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){
98902 pTab = pUpsert->pUpsertSrc->a[0].pTab;
98903 pExpr->iTable = EXCLUDED_TABLE_NUMBER;
98904 }
@@ -98941,11 +99011,11 @@
98941 {
98942 pExpr->y.pTab = pTab;
98943 if( pParse->bReturning ){
98944 eNewExprOp = TK_REGISTER;
98945 pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable
98946 + iCol + 1;
98947 }else{
98948 pExpr->iColumn = (i16)iCol;
98949 eNewExprOp = TK_TRIGGER;
98950 #ifndef SQLITE_OMIT_TRIGGER
98951 if( iCol<0 ){
@@ -99028,11 +99098,11 @@
99028 }
99029 if( sqlite3ExprVectorSize(pOrig)!=1 ){
99030 sqlite3ErrorMsg(pParse, "row value misused");
99031 return WRC_Abort;
99032 }
99033 resolveAlias(pParse, pEList, j, pExpr, "", nSubquery);
99034 cnt = 1;
99035 pMatch = 0;
99036 assert( zTab==0 && zDb==0 );
99037 if( IN_RENAME_OBJECT ){
99038 sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr);
@@ -99130,14 +99200,16 @@
99130 pMatch->colUsed |= sqlite3ExprColUsed(pExpr);
99131 }
99132
99133 /* Clean up and return
99134 */
99135 sqlite3ExprDelete(db, pExpr->pLeft);
99136 pExpr->pLeft = 0;
99137 sqlite3ExprDelete(db, pExpr->pRight);
99138 pExpr->pRight = 0;
 
 
99139 pExpr->op = eNewExprOp;
99140 ExprSetProperty(pExpr, EP_Leaf);
99141 lookupname_end:
99142 if( cnt==1 ){
99143 assert( pNC!=0 );
@@ -99165,11 +99237,11 @@
99165 ** from datasource iSrc in SrcList pSrc.
99166 */
99167 SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
99168 Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0);
99169 if( p ){
99170 struct SrcList_item *pItem = &pSrc->a[iSrc];
99171 Table *pTab = p->y.pTab = pItem->pTab;
99172 p->iTable = pItem->iCursor;
99173 if( p->y.pTab->iPKey==iCol ){
99174 p->iColumn = -1;
99175 }else{
@@ -99277,11 +99349,11 @@
99277 ** clause processing on UPDATE and DELETE statements, and by
99278 ** UPDATE ... FROM statement processing.
99279 */
99280 case TK_ROW: {
99281 SrcList *pSrcList = pNC->pSrcList;
99282 struct SrcList_item *pItem;
99283 assert( pSrcList && pSrcList->nSrc>=1 );
99284 pItem = pSrcList->a;
99285 pExpr->op = TK_COLUMN;
99286 pExpr->y.pTab = pItem->pTab;
99287 pExpr->iTable = pItem->iCursor;
@@ -99905,12 +99977,11 @@
99905 if( pItem->u.x.iOrderByCol ){
99906 if( pItem->u.x.iOrderByCol>pEList->nExpr ){
99907 resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr);
99908 return 1;
99909 }
99910 resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,
99911 zType,0);
99912 }
99913 }
99914 return 0;
99915 }
99916
@@ -100091,11 +100162,11 @@
100091 }
100092
100093 /* Recursively resolve names in all subqueries
100094 */
100095 for(i=0; i<p->pSrc->nSrc; i++){
100096 struct SrcList_item *pItem = &p->pSrc->a[i];
100097 if( pItem->pSelect && (pItem->pSelect->selFlags & SF_Resolved)==0 ){
100098 NameContext *pNC; /* Used to iterate name contexts */
100099 int nRef = 0; /* Refcount for pOuterNC and outer contexts */
100100 const char *zSavedContext = pParse->zAuthContext;
100101
@@ -100153,19 +100224,19 @@
100153 ** aliases in the result set.
100154 **
100155 ** Minor point: If this is the case, then the expression will be
100156 ** re-evaluated for each reference to it.
100157 */
100158 assert( (sNC.ncFlags & (NC_UAggInfo|NC_UUpsert))==0 );
100159 sNC.uNC.pEList = p->pEList;
100160 sNC.ncFlags |= NC_UEList;
100161 if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
100162 if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;
100163
100164 /* Resolve names in table-valued-function arguments */
100165 for(i=0; i<p->pSrc->nSrc; i++){
100166 struct SrcList_item *pItem = &p->pSrc->a[i];
100167 if( pItem->fg.isTabFunc
100168 && sqlite3ResolveExprListNames(&sNC, pItem->u1.pFuncArg)
100169 ){
100170 return WRC_Abort;
100171 }
@@ -102005,12 +102076,12 @@
102005 nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0);
102006 pNew = sqlite3DbMallocRawNN(db, nByte );
102007 if( pNew==0 ) return 0;
102008 pNew->nSrc = pNew->nAlloc = p->nSrc;
102009 for(i=0; i<p->nSrc; i++){
102010 struct SrcList_item *pNewItem = &pNew->a[i];
102011 struct SrcList_item *pOldItem = &p->a[i];
102012 Table *pTab;
102013 pNewItem->pSchema = pOldItem->pSchema;
102014 pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase);
102015 pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
102016 pNewItem->zAlias = sqlite3DbStrDup(db, pOldItem->zAlias);
@@ -102019,11 +102090,14 @@
102019 pNewItem->addrFillSub = pOldItem->addrFillSub;
102020 pNewItem->regReturn = pOldItem->regReturn;
102021 if( pNewItem->fg.isIndexedBy ){
102022 pNewItem->u1.zIndexedBy = sqlite3DbStrDup(db, pOldItem->u1.zIndexedBy);
102023 }
102024 pNewItem->pIBIndex = pOldItem->pIBIndex;
 
 
 
102025 if( pNewItem->fg.isTabFunc ){
102026 pNewItem->u1.pFuncArg =
102027 sqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags);
102028 }
102029 pTab = pNewItem->pTab = pOldItem->pTab;
@@ -106336,11 +106410,11 @@
106336 testcase( pExpr->op==TK_AGG_COLUMN );
106337 testcase( pExpr->op==TK_COLUMN );
106338 /* Check to see if the column is in one of the tables in the FROM
106339 ** clause of the aggregate query */
106340 if( ALWAYS(pSrcList!=0) ){
106341 struct SrcList_item *pItem = pSrcList->a;
106342 for(i=0; i<pSrcList->nSrc; i++, pItem++){
106343 struct AggInfo_col *pCol;
106344 assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) );
106345 if( pExpr->iTable==pItem->iCursor ){
106346 /* If we reach this point, it means that pExpr refers to a table
@@ -106625,43 +106699,49 @@
106625 ** bTemp is not true, database "temp", can still be parsed. This is
106626 ** called at the end of the generation of an ALTER TABLE ... RENAME ...
106627 ** statement to ensure that the operation has not rendered any schema
106628 ** objects unusable.
106629 */
106630 static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){
 
 
 
 
 
 
106631 sqlite3NestedParse(pParse,
106632 "SELECT 1 "
106633 "FROM \"%w\"." DFLT_SCHEMA_TABLE " "
106634 "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
106635 " AND sql NOT LIKE 'create virtual%%'"
106636 " AND sqlite_rename_test(%Q, sql, type, name, %d)=NULL ",
106637 zDb,
106638 zDb, bTemp
106639 );
106640
106641 if( bTemp==0 ){
106642 sqlite3NestedParse(pParse,
106643 "SELECT 1 "
106644 "FROM temp." DFLT_SCHEMA_TABLE " "
106645 "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
106646 " AND sql NOT LIKE 'create virtual%%'"
106647 " AND sqlite_rename_test(%Q, sql, type, name, 1)=NULL ",
106648 zDb
106649 );
106650 }
106651 }
106652
106653 /*
106654 ** Generate code to reload the schema for database iDb. And, if iDb!=1, for
106655 ** the temp database as well.
106656 */
106657 static void renameReloadSchema(Parse *pParse, int iDb){
106658 Vdbe *v = pParse->pVdbe;
106659 if( v ){
106660 sqlite3ChangeCookie(pParse, iDb);
106661 sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, iDb, 0);
106662 if( iDb!=1 ) sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0);
106663 }
106664 }
106665
106666 /*
106667 ** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy"
@@ -106806,11 +106886,11 @@
106806 sqlite3NestedParse(pParse,
106807 "UPDATE sqlite_temp_schema SET "
106808 "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), "
106809 "tbl_name = "
106810 "CASE WHEN tbl_name=%Q COLLATE nocase AND "
106811 " sqlite_rename_test(%Q, sql, type, name, 1) "
106812 "THEN %Q ELSE tbl_name END "
106813 "WHERE type IN ('view', 'trigger')"
106814 , zDb, zTabName, zName, zTabName, zDb, zName);
106815 }
106816
@@ -106825,12 +106905,12 @@
106825 sqlite3VdbeLoadString(v, i, zName);
106826 sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB);
106827 }
106828 #endif
106829
106830 renameReloadSchema(pParse, iDb);
106831 renameTestSchema(pParse, zDb, iDb==1);
106832
106833 exit_rename_table:
106834 sqlite3SrcListDelete(db, pSrc);
106835 sqlite3DbFree(db, zName);
106836 db->mDbFlags = savedDbFlags;
@@ -106988,11 +107068,11 @@
106988 sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3);
106989 sqlite3ReleaseTempReg(pParse, r1);
106990 }
106991
106992 /* Reload the table definition */
106993 renameReloadSchema(pParse, iDb);
106994 }
106995
106996 /*
106997 ** This function is called by the parser after the table-name in
106998 ** an "ALTER TABLE <table-name> ADD" statement is parsed. Argument
@@ -107088,11 +107168,11 @@
107088 ** it loads an error message into pParse and returns non-zero.
107089 **
107090 ** Or, if pTab is not a view or virtual table, zero is returned.
107091 */
107092 #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
107093 static int isRealTable(Parse *pParse, Table *pTab){
107094 const char *zType = 0;
107095 #ifndef SQLITE_OMIT_VIEW
107096 if( pTab->pSelect ){
107097 zType = "view";
107098 }
@@ -107101,19 +107181,20 @@
107101 if( IsVirtual(pTab) ){
107102 zType = "virtual table";
107103 }
107104 #endif
107105 if( zType ){
107106 sqlite3ErrorMsg(
107107 pParse, "cannot rename columns of %s \"%s\"", zType, pTab->zName
 
107108 );
107109 return 1;
107110 }
107111 return 0;
107112 }
107113 #else /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */
107114 # define isRealTable(x,y) (0)
107115 #endif
107116
107117 /*
107118 ** Handles the following parser reduction:
107119 **
@@ -107138,11 +107219,11 @@
107138 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
107139 if( !pTab ) goto exit_rename_column;
107140
107141 /* Cannot alter a system table */
107142 if( SQLITE_OK!=isAlterableTable(pParse, pTab) ) goto exit_rename_column;
107143 if( SQLITE_OK!=isRealTable(pParse, pTab) ) goto exit_rename_column;
107144
107145 /* Which schema holds the table to be altered */
107146 iSchema = sqlite3SchemaToIndex(db, pTab->pSchema);
107147 assert( iSchema>=0 );
107148 zDb = db->aDb[iSchema].zDbSName;
@@ -107192,12 +107273,12 @@
107192 "WHERE type IN ('trigger', 'view')",
107193 zDb, pTab->zName, iCol, zNew, bQuote
107194 );
107195
107196 /* Drop and reload the database schema. */
107197 renameReloadSchema(pParse, iSchema);
107198 renameTestSchema(pParse, zDb, iSchema==1);
107199
107200 exit_rename_column:
107201 sqlite3SrcListDelete(db, pSrc);
107202 sqlite3DbFree(db, zOld);
107203 sqlite3DbFree(db, zNew);
@@ -107445,27 +107526,37 @@
107445 }
107446 }
107447
107448 /*
107449 ** Search the Parse object passed as the first argument for a RenameToken
107450 ** object associated with parse tree element pPtr. If found, remove it
107451 ** from the Parse object and add it to the list maintained by the
107452 ** RenameCtx object passed as the second argument.
 
 
 
107453 */
107454 static void renameTokenFind(Parse *pParse, struct RenameCtx *pCtx, void *pPtr){
 
 
 
 
107455 RenameToken **pp;
107456 assert( pPtr!=0 );
107457 for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){
107458 if( (*pp)->p==pPtr ){
107459 RenameToken *pToken = *pp;
107460 *pp = pToken->pNext;
107461 pToken->pNext = pCtx->pList;
107462 pCtx->pList = pToken;
107463 pCtx->nList++;
107464 break;
 
 
107465 }
107466 }
 
107467 }
107468
107469 /*
107470 ** This is a Walker select callback. It does nothing. It is only required
107471 ** because without a dummy callback, sqlite3WalkExpr() and similar do not
@@ -107532,21 +107623,21 @@
107532 ** sub-routine is currently stored in pParse->zErrMsg. This function
107533 ** adds context to the error message and then stores it in pCtx.
107534 */
107535 static void renameColumnParseError(
107536 sqlite3_context *pCtx,
107537 int bPost,
107538 sqlite3_value *pType,
107539 sqlite3_value *pObject,
107540 Parse *pParse
107541 ){
107542 const char *zT = (const char*)sqlite3_value_text(pType);
107543 const char *zN = (const char*)sqlite3_value_text(pObject);
107544 char *zErr;
107545
107546 zErr = sqlite3_mprintf("error in %s %s%s: %s",
107547 zT, zN, (bPost ? " after rename" : ""),
107548 pParse->zErrMsg
107549 );
107550 sqlite3_result_error(pCtx, zErr, -1);
107551 sqlite3_free(zErr);
107552 }
@@ -107621,11 +107712,11 @@
107621 ** trigger object, the database must be corrupt. */
107622 memset(p, 0, sizeof(Parse));
107623 p->eParseMode = PARSE_MODE_RENAME;
107624 p->db = db;
107625 p->nQueryLoop = 1;
107626 rc = sqlite3RunParser(p, zSql, &zErr);
107627 assert( p->zErrMsg==0 );
107628 assert( rc!=SQLITE_OK || zErr==0 );
107629 p->zErrMsg = zErr;
107630 if( db->mallocFailed ) rc = SQLITE_NOMEM;
107631 if( rc==SQLITE_OK
@@ -107774,11 +107865,11 @@
107774 if( rc==SQLITE_OK && pStep->zTarget ){
107775 SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
107776 if( pSrc ){
107777 int i;
107778 for(i=0; i<pSrc->nSrc && rc==SQLITE_OK; i++){
107779 struct SrcList_item *p = &pSrc->a[i];
107780 p->iCursor = pParse->nTab++;
107781 if( p->pSelect ){
107782 sqlite3SelectPrep(pParse, p->pSelect, 0);
107783 sqlite3ExpandSubquery(pParse, p);
107784 assert( i>0 );
@@ -108048,11 +108139,11 @@
108048 rc = renameEditSql(context, &sCtx, zSql, zNew, bQuote);
108049
108050 renameColumnFunc_done:
108051 if( rc!=SQLITE_OK ){
108052 if( sParse.zErrMsg ){
108053 renameColumnParseError(context, 0, argv[1], argv[2], &sParse);
108054 }else{
108055 sqlite3_result_error_code(context, rc);
108056 }
108057 }
108058
@@ -108086,11 +108177,11 @@
108086 if( pSrc==0 ){
108087 assert( pWalker->pParse->db->mallocFailed );
108088 return WRC_Abort;
108089 }
108090 for(i=0; i<pSrc->nSrc; i++){
108091 struct SrcList_item *pItem = &pSrc->a[i];
108092 if( pItem->pTab==p->pTab ){
108093 renameTokenFind(pWalker->pParse, p, pItem->zName);
108094 }
108095 }
108096 renameWalkWith(pWalker, pSelect);
@@ -108237,11 +108328,11 @@
108237 if( rc==SQLITE_OK ){
108238 rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote);
108239 }
108240 if( rc!=SQLITE_OK ){
108241 if( sParse.zErrMsg ){
108242 renameColumnParseError(context, 0, argv[1], argv[2], &sParse);
108243 }else{
108244 sqlite3_result_error_code(context, rc);
108245 }
108246 }
108247
@@ -108266,10 +108357,11 @@
108266 ** 0: Database name ("main", "temp" etc.).
108267 ** 1: SQL statement.
108268 ** 2: Object type ("view", "table", "trigger" or "index").
108269 ** 3: Object name.
108270 ** 4: True if object is from temp schema.
 
108271 **
108272 ** Unless it finds an error, this function normally returns NULL. However, it
108273 ** returns integer value 1 if:
108274 **
108275 ** * the SQL argument creates a trigger, and
@@ -108283,10 +108375,11 @@
108283 sqlite3 *db = sqlite3_context_db_handle(context);
108284 char const *zDb = (const char*)sqlite3_value_text(argv[0]);
108285 char const *zInput = (const char*)sqlite3_value_text(argv[1]);
108286 int bTemp = sqlite3_value_int(argv[4]);
108287 int isLegacy = (db->flags & SQLITE_LegacyAlter);
 
108288
108289 #ifndef SQLITE_OMIT_AUTHORIZATION
108290 sqlite3_xauth xAuth = db->xAuth;
108291 db->xAuth = 0;
108292 #endif
@@ -108315,29 +108408,220 @@
108315 if( i1==i2 ) sqlite3_result_int(context, 1);
108316 }
108317 }
108318 }
108319
108320 if( rc!=SQLITE_OK ){
108321 renameColumnParseError(context, 1, argv[2], argv[3], &sParse);
108322 }
108323 renameParseCleanup(&sParse);
108324 }
108325
108326 #ifndef SQLITE_OMIT_AUTHORIZATION
108327 db->xAuth = xAuth;
108328 #endif
108329 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108330
108331 /*
108332 ** Register built-in functions used to help implement ALTER TABLE
108333 */
108334 SQLITE_PRIVATE void sqlite3AlterFunctions(void){
108335 static FuncDef aAlterTableFuncs[] = {
108336 INTERNAL_FUNCTION(sqlite_rename_column, 9, renameColumnFunc),
108337 INTERNAL_FUNCTION(sqlite_rename_table, 7, renameTableFunc),
108338 INTERNAL_FUNCTION(sqlite_rename_test, 5, renameTableTest),
 
108339 };
108340 sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs));
108341 }
108342 #endif /* SQLITE_ALTER_TABLE */
108343
@@ -110745,11 +111029,11 @@
110745 ** Select callback used by sqlite3FixAAAA() routines.
110746 */
110747 static int fixSelectCb(Walker *p, Select *pSelect){
110748 DbFixer *pFix = p->u.pFix;
110749 int i;
110750 struct SrcList_item *pItem;
110751 sqlite3 *db = pFix->pParse->db;
110752 int iDb = sqlite3FindDbName(db, pFix->zDb);
110753 SrcList *pList = pSelect->pSrc;
110754
110755 if( NEVER(pList==0) ) return WRC_Continue;
@@ -111318,16 +111602,18 @@
111318 int i;
111319 int reg;
111320
111321 addrRewind =
111322 sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
 
111323 reg = pReturning->iRetReg;
111324 for(i=0; i<pReturning->nRetCol; i++){
111325 sqlite3VdbeAddOp3(v, OP_Column, pReturning->iRetCur, i, reg+i);
111326 }
111327 sqlite3VdbeAddOp2(v, OP_ResultRow, reg, i);
111328 sqlite3VdbeAddOp2(v, OP_Next, pReturning->iRetCur, addrRewind+1);
 
111329 sqlite3VdbeJumpHere(v, addrRewind);
111330 }
111331 sqlite3VdbeAddOp0(v, OP_Halt);
111332
111333 #if SQLITE_USER_AUTHENTICATION
@@ -111631,11 +111917,11 @@
111631 ** sqlite3FixSrcList() for details.
111632 */
111633 SQLITE_PRIVATE Table *sqlite3LocateTableItem(
111634 Parse *pParse,
111635 u32 flags,
111636 struct SrcList_item *p
111637 ){
111638 const char *zDb;
111639 assert( p->pSchema==0 || p->zDatabase==0 );
111640 if( p->pSchema ){
111641 int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema);
@@ -112417,10 +112703,11 @@
112417 */
112418 #if SQLITE_ENABLE_HIDDEN_COLUMNS
112419 SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){
112420 if( sqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){
112421 pCol->colFlags |= COLFLAG_HIDDEN;
 
112422 }else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){
112423 pTab->tabFlags |= TF_OOOHidden;
112424 }
112425 }
112426 #endif
@@ -112461,11 +112748,15 @@
112461 */
112462 SQLITE_PRIVATE void sqlite3AddReturning(Parse *pParse, ExprList *pList){
112463 Returning *pRet;
112464 Hash *pHash;
112465 sqlite3 *db = pParse->db;
112466 assert( !pParse->bReturning );
 
 
 
 
112467 pParse->bReturning = 1;
112468 pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
112469 if( pRet==0 ){
112470 sqlite3ExprListDelete(db, pList);
112471 return;
@@ -112484,11 +112775,11 @@
112484 pRet->retTrig.step_list = &pRet->retTStep;
112485 pRet->retTStep.op = TK_RETURNING;
112486 pRet->retTStep.pTrig = &pRet->retTrig;
112487 pRet->retTStep.pExprList = pList;
112488 pHash = &(db->aDb[1].pSchema->trigHash);
112489 assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 );
112490 if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
112491 ==&pRet->retTrig ){
112492 sqlite3OomFault(db);
112493 }
112494 }
@@ -113789,11 +114080,11 @@
113789 }
113790 #endif
113791
113792 /* Reparse everything to update our internal data structures */
113793 sqlite3VdbeAddParseSchemaOp(v, iDb,
113794 sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName));
113795 }
113796
113797 /* Add the table to the in-memory representation of the database.
113798 */
113799 if( db->init.busy ){
@@ -113806,24 +114097,21 @@
113806 sqlite3OomFault(db);
113807 return;
113808 }
113809 pParse->pNewTable = 0;
113810 db->mDbFlags |= DBFLAG_SchemaChange;
 
113811
113812 #ifndef SQLITE_OMIT_ALTERTABLE
113813 if( !p->pSelect ){
113814 const char *zName = (const char *)pParse->sNameToken.z;
113815 int nName;
113816 assert( !pSelect && pCons && pEnd );
113817 if( pCons->z==0 ){
113818 pCons = pEnd;
113819 }
113820 nName = (int)((const char *)pCons->z - zName);
113821 p->addColOffset = 13 + nName;
113822 }
113823 #endif
113824 }
113825 }
113826
113827 #ifndef SQLITE_OMIT_VIEW
113828 /*
113829 ** The parser calls this routine in order to create a new VIEW
@@ -115277,11 +115565,11 @@
115277 */
115278 if( pTblName ){
115279 sqlite3RefillIndex(pParse, pIndex, iMem);
115280 sqlite3ChangeCookie(pParse, iDb);
115281 sqlite3VdbeAddParseSchemaOp(v, iDb,
115282 sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName));
115283 sqlite3VdbeAddOp2(v, OP_Expire, 0, 1);
115284 }
115285
115286 sqlite3VdbeJumpHere(v, (int)pIndex->tnum);
115287 }
@@ -115670,11 +115958,11 @@
115670 Parse *pParse, /* Parsing context, in which errors are reported */
115671 SrcList *pList, /* Append to this SrcList. NULL creates a new SrcList */
115672 Token *pTable, /* Table to append */
115673 Token *pDatabase /* Database of the table */
115674 ){
115675 struct SrcList_item *pItem;
115676 sqlite3 *db;
115677 assert( pDatabase==0 || pTable!=0 ); /* Cannot have C without B */
115678 assert( pParse!=0 );
115679 assert( pParse->db!=0 );
115680 db = pParse->db;
@@ -115711,11 +115999,11 @@
115711 /*
115712 ** Assign VdbeCursor index numbers to all tables in a SrcList
115713 */
115714 SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){
115715 int i;
115716 struct SrcList_item *pItem;
115717 assert(pList || pParse->db->mallocFailed );
115718 if( pList ){
115719 for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){
115720 if( pItem->iCursor>=0 ) continue;
115721 pItem->iCursor = pParse->nTab++;
@@ -115729,11 +116017,11 @@
115729 /*
115730 ** Delete an entire SrcList including all its substructure.
115731 */
115732 SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){
115733 int i;
115734 struct SrcList_item *pItem;
115735 if( pList==0 ) return;
115736 for(pItem=pList->a, i=0; i<pList->nSrc; i++, pItem++){
115737 if( pItem->zDatabase ) sqlite3DbFreeNN(db, pItem->zDatabase);
115738 sqlite3DbFree(db, pItem->zName);
115739 if( pItem->zAlias ) sqlite3DbFreeNN(db, pItem->zAlias);
@@ -115771,11 +116059,11 @@
115771 Token *pAlias, /* The right-hand side of the AS subexpression */
115772 Select *pSubquery, /* A subquery used in place of a table name */
115773 Expr *pOn, /* The ON clause of a join */
115774 IdList *pUsing /* The USING clause of a join */
115775 ){
115776 struct SrcList_item *pItem;
115777 sqlite3 *db = pParse->db;
115778 if( !p && (pOn || pUsing) ){
115779 sqlite3ErrorMsg(pParse, "a JOIN clause is required before %s",
115780 (pOn ? "ON" : "USING")
115781 );
@@ -115815,11 +116103,11 @@
115815 ** element of the source-list passed as the second argument.
115816 */
115817 SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pIndexedBy){
115818 assert( pIndexedBy!=0 );
115819 if( p && pIndexedBy->n>0 ){
115820 struct SrcList_item *pItem;
115821 assert( p->nSrc>0 );
115822 pItem = &p->a[p->nSrc-1];
115823 assert( pItem->fg.notIndexed==0 );
115824 assert( pItem->fg.isIndexedBy==0 );
115825 assert( pItem->fg.isTabFunc==0 );
@@ -115845,11 +116133,11 @@
115845 SrcList *pNew = sqlite3SrcListEnlarge(pParse, p1, p2->nSrc, 1);
115846 if( pNew==0 ){
115847 sqlite3SrcListDelete(pParse->db, p2);
115848 }else{
115849 p1 = pNew;
115850 memcpy(&p1->a[1], p2->a, p2->nSrc*sizeof(struct SrcList_item));
115851 sqlite3DbFree(pParse->db, p2);
115852 }
115853 }
115854 return p1;
115855 }
@@ -115858,11 +116146,11 @@
115858 ** Add the list of function arguments to the SrcList entry for a
115859 ** table-valued-function.
115860 */
115861 SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, ExprList *pList){
115862 if( p ){
115863 struct SrcList_item *pItem = &p->a[p->nSrc-1];
115864 assert( pItem->fg.notIndexed==0 );
115865 assert( pItem->fg.isIndexedBy==0 );
115866 assert( pItem->fg.isTabFunc==0 );
115867 pItem->u1.pFuncArg = pList;
115868 pItem->fg.isTabFunc = 1;
@@ -116355,28 +116643,80 @@
116355 }
116356 return pKey;
116357 }
116358
116359 #ifndef SQLITE_OMIT_CTE
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116360 /*
116361 ** This routine is invoked once per CTE by the parser while parsing a
116362 ** WITH clause.
 
 
116363 */
116364 SQLITE_PRIVATE With *sqlite3WithAdd(
116365 Parse *pParse, /* Parsing context */
116366 With *pWith, /* Existing WITH clause, or NULL */
116367 Token *pName, /* Name of the common-table */
116368 ExprList *pArglist, /* Optional column name list for the table */
116369 Select *pQuery /* Query used to initialize the table */
116370 ){
116371 sqlite3 *db = pParse->db;
116372 With *pNew;
116373 char *zName;
 
 
 
 
116374
116375 /* Check that the CTE name is unique within this WITH clause. If
116376 ** not, store an error in the Parse structure. */
116377 zName = sqlite3NameFromToken(pParse->db, pName);
116378 if( zName && pWith ){
116379 int i;
116380 for(i=0; i<pWith->nCte; i++){
116381 if( sqlite3StrICmp(zName, pWith->a[i].zName)==0 ){
116382 sqlite3ErrorMsg(pParse, "duplicate WITH table name: %s", zName);
@@ -116391,20 +116731,15 @@
116391 pNew = sqlite3DbMallocZero(db, sizeof(*pWith));
116392 }
116393 assert( (pNew!=0 && zName!=0) || db->mallocFailed );
116394
116395 if( db->mallocFailed ){
116396 sqlite3ExprListDelete(db, pArglist);
116397 sqlite3SelectDelete(db, pQuery);
116398 sqlite3DbFree(db, zName);
116399 pNew = pWith;
116400 }else{
116401 pNew->a[pNew->nCte].pSelect = pQuery;
116402 pNew->a[pNew->nCte].pCols = pArglist;
116403 pNew->a[pNew->nCte].zName = zName;
116404 pNew->a[pNew->nCte].zCteErr = 0;
116405 pNew->nCte++;
116406 }
116407
116408 return pNew;
116409 }
116410
@@ -116413,14 +116748,11 @@
116413 */
116414 SQLITE_PRIVATE void sqlite3WithDelete(sqlite3 *db, With *pWith){
116415 if( pWith ){
116416 int i;
116417 for(i=0; i<pWith->nCte; i++){
116418 struct Cte *pCte = &pWith->a[i];
116419 sqlite3ExprListDelete(db, pCte->pCols);
116420 sqlite3SelectDelete(db, pCte->pSelect);
116421 sqlite3DbFree(db, pCte->zName);
116422 }
116423 sqlite3DbFree(db, pWith);
116424 }
116425 }
116426 #endif /* !defined(SQLITE_OMIT_CTE) */
@@ -116995,21 +117327,21 @@
116995 ** pSrc->a[0].pTab Pointer to the Table object
116996 ** pSrc->a[0].pIndex Pointer to the INDEXED BY index, if there is one
116997 **
116998 */
116999 SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
117000 struct SrcList_item *pItem = pSrc->a;
117001 Table *pTab;
117002 assert( pItem && pSrc->nSrc>=1 );
117003 pTab = sqlite3LocateTableItem(pParse, 0, pItem);
117004 sqlite3DeleteTable(pParse->db, pItem->pTab);
117005 pItem->pTab = pTab;
117006 if( pTab ){
117007 pTab->nTabRef++;
117008 }
117009 if( sqlite3IndexedByLookup(pParse, pItem) ){
117010 pTab = 0;
117011 }
117012 return pTab;
117013 }
117014
117015 /* Return true if table pTab is read-only.
@@ -117175,11 +117507,15 @@
117175 /* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree
117176 ** and the SELECT subtree. */
117177 pSrc->a[0].pTab = 0;
117178 pSelectSrc = sqlite3SrcListDup(pParse->db, pSrc, 0);
117179 pSrc->a[0].pTab = pTab;
117180 pSrc->a[0].pIBIndex = 0;
 
 
 
 
117181
117182 /* generate the SELECT expression tree. */
117183 pSelect = sqlite3SelectNew(pParse, pEList, pSelectSrc, pWhere, 0 ,0,
117184 pOrderBy,0,pLimit
117185 );
@@ -118623,11 +118959,12 @@
118623 while( (c = Utf8Read(zPattern))!=0 ){
118624 if( c==matchAll ){ /* Match "*" */
118625 /* Skip over multiple "*" characters in the pattern. If there
118626 ** are also "?" characters, skip those as well, but consume a
118627 ** single character of the input string for each "?" skipped */
118628 while( (c=Utf8Read(zPattern)) == matchAll || c == matchOne ){
 
118629 if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
118630 return SQLITE_NOWILDCARDMATCH;
118631 }
118632 }
118633 if( c==0 ){
@@ -121242,11 +121579,11 @@
121242
121243 /* Create a SrcList structure containing the child table. We need the
121244 ** child table as a SrcList for sqlite3WhereBegin() */
121245 pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
121246 if( pSrc ){
121247 struct SrcList_item *pItem = pSrc->a;
121248 pItem->pTab = pFKey->pFrom;
121249 pItem->zName = pFKey->pFrom->zName;
121250 pItem->pTab->nTabRef++;
121251 pItem->iCursor = pParse->nTab++;
121252
@@ -122603,23 +122940,28 @@
122603 ipkColumn--;
122604 }
122605 }
122606 }
122607 #endif
122608 }
122609
122610 /* Make sure the number of columns in the source data matches the number
122611 ** of columns to be inserted into the table.
122612 */
122613 for(i=0; i<pTab->nCol; i++){
122614 if( pTab->aCol[i].colFlags & COLFLAG_NOINSERT ) nHidden++;
122615 }
122616 if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){
122617 sqlite3ErrorMsg(pParse,
122618 "table %S has %d columns but %d values were supplied",
122619 pTabList, 0, pTab->nCol-nHidden, nColumn);
122620 goto insert_cleanup;
 
 
 
 
 
122621 }
122622 if( pColumn!=0 && nColumn!=pColumn->nId ){
122623 sqlite3ErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId);
122624 goto insert_cleanup;
122625 }
@@ -124078,10 +124420,36 @@
124078 }
124079 sqlite3VdbeChangeP5(v, i+1);
124080 }
124081 #endif
124082
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124083 /*
124084 ** This routine generates code to finish the INSERT or UPDATE operation
124085 ** that was started by a prior call to sqlite3GenerateConstraintChecks.
124086 ** A consecutive range of registers starting at regNewData contains the
124087 ** rowid and the content to be inserted.
@@ -124126,21 +124494,13 @@
124126 pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
124127 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
124128 assert( pParse->nested==0 );
124129 pik_flags |= OPFLAG_NCHANGE;
124130 pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
124131 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
124132 if( update_flags==0 ){
124133 int r = sqlite3GetTempReg(pParse);
124134 sqlite3VdbeAddOp2(v, OP_Integer, 0, r);
124135 sqlite3VdbeAddOp4(v, OP_Insert,
124136 iIdxCur+i, aRegIdx[i], r, (char*)pTab, P4_TABLE
124137 );
124138 sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP);
124139 sqlite3ReleaseTempReg(pParse, r);
124140 }
124141 #endif
124142 }
124143 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
124144 aRegIdx[i]+1,
124145 pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn);
124146 sqlite3VdbeChangeP5(v, pik_flags);
@@ -124334,11 +124694,11 @@
124334 ){
124335 sqlite3 *db = pParse->db;
124336 ExprList *pEList; /* The result set of the SELECT */
124337 Table *pSrc; /* The table in the FROM clause of SELECT */
124338 Index *pSrcIdx, *pDestIdx; /* Source and destination indices */
124339 struct SrcList_item *pItem; /* An element of pSelect->pSrc */
124340 int i; /* Loop counter */
124341 int iDbSrc; /* The database of pSrc */
124342 int iSrc, iDest; /* Cursors from source and destination */
124343 int addr1, addr2; /* Loop addresses */
124344 int emptyDestTest = 0; /* Address of test for empty pDest */
@@ -124609,20 +124969,22 @@
124609 insFlags = OPFLAG_APPEND|OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT;
124610 }else{
124611 insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND|OPFLAG_PREFORMAT;
124612 }
124613 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
124614 if( db->xPreUpdateCallback ){
124615 sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
124616 insFlags &= ~OPFLAG_PREFORMAT;
124617 }else
124618 #endif
124619 {
124620 sqlite3VdbeAddOp3(v, OP_RowCell, iDest, iSrc, regRowid);
124621 }
124622 sqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid,
124623 (char*)pDest, P4_TABLE);
 
 
124624 sqlite3VdbeChangeP5(v, insFlags);
124625
124626 sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v);
124627 sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
124628 sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
@@ -124671,10 +125033,16 @@
124671 }else if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
124672 idxInsFlags |= OPFLAG_NCHANGE;
124673 }
124674 if( idxInsFlags!=(OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT) ){
124675 sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
 
 
 
 
 
 
124676 }
124677 sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
124678 sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
124679 sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
124680 sqlite3VdbeJumpHere(v, addr1);
@@ -129635,26 +130003,30 @@
129635 ** Fill the InitData structure with an error message that indicates
129636 ** that the database is corrupt.
129637 */
129638 static void corruptSchema(
129639 InitData *pData, /* Initialization context */
129640 const char *zObj, /* Object being parsed at the point of error */
129641 const char *zExtra /* Error information */
129642 ){
129643 sqlite3 *db = pData->db;
129644 if( db->mallocFailed ){
129645 pData->rc = SQLITE_NOMEM_BKPT;
129646 }else if( pData->pzErrMsg[0]!=0 ){
129647 /* A error message has already been generated. Do not overwrite it */
129648 }else if( pData->mInitFlags & INITFLAG_AlterTable ){
129649 *pData->pzErrMsg = sqlite3DbStrDup(db, zExtra);
 
 
 
 
129650 pData->rc = SQLITE_ERROR;
129651 }else if( db->flags & SQLITE_WriteSchema ){
129652 pData->rc = SQLITE_CORRUPT_BKPT;
129653 }else{
129654 char *z;
129655 if( zObj==0 ) zObj = "?";
129656 z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
129657 if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
129658 *pData->pzErrMsg = z;
129659 pData->rc = SQLITE_CORRUPT_BKPT;
129660 }
@@ -129708,18 +130080,18 @@
129708 UNUSED_PARAMETER2(NotUsed, argc);
129709 assert( sqlite3_mutex_held(db->mutex) );
129710 db->mDbFlags |= DBFLAG_EncodingFixed;
129711 pData->nInitRow++;
129712 if( db->mallocFailed ){
129713 corruptSchema(pData, argv[1], 0);
129714 return 1;
129715 }
129716
129717 assert( iDb>=0 && iDb<db->nDb );
129718 if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
129719 if( argv[3]==0 ){
129720 corruptSchema(pData, argv[1], 0);
129721 }else if( argv[4]
129722 && 'c'==sqlite3UpperToLower[(unsigned char)argv[4][0]]
129723 && 'r'==sqlite3UpperToLower[(unsigned char)argv[4][1]] ){
129724 /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
129725 ** But because db->init.busy is set to 1, no VDBE code is generated
@@ -129740,11 +130112,11 @@
129740 db->init.iDb = iDb;
129741 if( sqlite3GetUInt32(argv[3], &db->init.newTnum)==0
129742 || (db->init.newTnum>pData->mxPage && pData->mxPage>0)
129743 ){
129744 if( sqlite3Config.bExtraSchemaChecks ){
129745 corruptSchema(pData, argv[1], "invalid rootpage");
129746 }
129747 }
129748 db->init.orphanTrigger = 0;
129749 db->init.azInit = argv;
129750 pStmt = 0;
@@ -129759,17 +130131,17 @@
129759 }else{
129760 if( rc > pData->rc ) pData->rc = rc;
129761 if( rc==SQLITE_NOMEM ){
129762 sqlite3OomFault(db);
129763 }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){
129764 corruptSchema(pData, argv[1], sqlite3_errmsg(db));
129765 }
129766 }
129767 }
129768 sqlite3_finalize(pStmt);
129769 }else if( argv[1]==0 || (argv[4]!=0 && argv[4][0]!=0) ){
129770 corruptSchema(pData, argv[1], 0);
129771 }else{
129772 /* If the SQL column is blank it means this is an index that
129773 ** was created to be the PRIMARY KEY or to fulfill a UNIQUE
129774 ** constraint for a CREATE TABLE. The index should have already
129775 ** been created when we processed the CREATE TABLE. All we have
@@ -129776,19 +130148,19 @@
129776 ** to do here is record the root page number for that index.
129777 */
129778 Index *pIndex;
129779 pIndex = sqlite3FindIndex(db, argv[1], db->aDb[iDb].zDbSName);
129780 if( pIndex==0 ){
129781 corruptSchema(pData, argv[1], "orphan index");
129782 }else
129783 if( sqlite3GetUInt32(argv[3],&pIndex->tnum)==0
129784 || pIndex->tnum<2
129785 || pIndex->tnum>pData->mxPage
129786 || sqlite3IndexHasDuplicateRootPage(pIndex)
129787 ){
129788 if( sqlite3Config.bExtraSchemaChecks ){
129789 corruptSchema(pData, argv[1], "invalid rootpage");
129790 }
129791 }
129792 }
129793 return 0;
129794 }
@@ -130164,35 +130536,20 @@
130164 assert( i>=0 && i<db->nDb );
130165 }
130166 return i;
130167 }
130168
130169 /*
130170 ** Deallocate a single AggInfo object
130171 */
130172 static void agginfoFree(sqlite3 *db, AggInfo *p){
130173 sqlite3DbFree(db, p->aCol);
130174 sqlite3DbFree(db, p->aFunc);
130175 sqlite3DbFree(db, p);
130176 }
130177
130178 /*
130179 ** Free all memory allocations in the pParse object
130180 */
130181 SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
130182 sqlite3 *db = pParse->db;
130183 AggInfo *pThis = pParse->pAggList;
130184 while( pThis ){
130185 AggInfo *pNext = pThis->pNext;
130186 agginfoFree(db, pThis);
130187 pThis = pNext;
130188 }
130189 while( pParse->pCleanup ){
130190 ParseCleanup *pCleanup = pParse->pCleanup;
130191 pParse->pCleanup = pCleanup->pNext;
130192 pCleanup->xCleanup(db, pCleanup->pPtr);
130193 sqlite3DbFree(db, pCleanup);
130194 }
130195 sqlite3DbFree(db, pParse->aLabel);
130196 if( pParse->pConstExpr ){
130197 sqlite3ExprListDelete(db, pParse->pConstExpr);
130198 }
@@ -130222,11 +130579,11 @@
130222 ** use-after-free errors following an OOM. The preferred way to do this is
130223 ** to immediately follow the call to this routine with:
130224 **
130225 ** testcase( pParse->earlyCleanup );
130226 */
130227 SQLITE_PRIVATE void sqlite3ParserAddCleanup(
130228 Parse *pParse, /* Destroy when this Parser finishes */
130229 void (*xCleanup)(sqlite3*,void*), /* The cleanup routine */
130230 void *pPtr /* Pointer to object to be cleaned up */
130231 ){
130232 ParseCleanup *pCleanup = sqlite3DbMallocRaw(pParse->db, sizeof(*pCleanup));
@@ -130235,14 +130592,16 @@
130235 pParse->pCleanup = pCleanup;
130236 pCleanup->pPtr = pPtr;
130237 pCleanup->xCleanup = xCleanup;
130238 }else{
130239 xCleanup(pParse->db, pPtr);
 
130240 #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
130241 pParse->earlyCleanup = 1;
130242 #endif
130243 }
 
130244 }
130245
130246 /*
130247 ** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
130248 */
@@ -130893,11 +131252,11 @@
130893
130894 /*
130895 ** Return the index of a column in a table. Return -1 if the column
130896 ** is not contained in the table.
130897 */
130898 static int columnIndex(Table *pTab, const char *zCol){
130899 int i;
130900 u8 h = sqlite3StrIHash(zCol);
130901 Column *pCol;
130902 for(pCol=pTab->aCol, i=0; i<pTab->nCol; pCol++, i++){
130903 if( pCol->hName==h && sqlite3StrICmp(pCol->zName, zCol)==0 ) return i;
@@ -130925,11 +131284,11 @@
130925 int i; /* For looping over tables in pSrc */
130926 int iCol; /* Index of column matching zCol */
130927
130928 assert( (piTab==0)==(piCol==0) ); /* Both or neither are NULL */
130929 for(i=0; i<N; i++){
130930 iCol = columnIndex(pSrc->a[i].pTab, zCol);
130931 if( iCol>=0
130932 && (bIgnoreHidden==0 || IsHiddenColumn(&pSrc->a[i].pTab->aCol[iCol])==0)
130933 ){
130934 if( piTab ){
130935 *piTab = i;
@@ -131066,12 +131425,12 @@
131066 ** This routine returns the number of errors encountered.
131067 */
131068 static int sqliteProcessJoin(Parse *pParse, Select *p){
131069 SrcList *pSrc; /* All tables in the FROM clause */
131070 int i, j; /* Loop counters */
131071 struct SrcList_item *pLeft; /* Left table being joined */
131072 struct SrcList_item *pRight; /* Right table being joined */
131073
131074 pSrc = p->pSrc;
131075 pLeft = &pSrc->a[0];
131076 pRight = &pLeft[1];
131077 for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){
@@ -131135,11 +131494,11 @@
131135 int iLeft; /* Table on the left with matching column name */
131136 int iLeftCol; /* Column number of matching column on the left */
131137 int iRightCol; /* Column number of matching column on the right */
131138
131139 zName = pList->a[j].zName;
131140 iRightCol = columnIndex(pRightTab, zName);
131141 if( iRightCol<0
131142 || !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol, 0)
131143 ){
131144 sqlite3ErrorMsg(pParse, "cannot join using column %s - column "
131145 "not present in both tables", zName);
@@ -132717,10 +133076,11 @@
132717 sNC.pSrcList = pSelect->pSrc;
132718 a = pSelect->pEList->a;
132719 for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
132720 const char *zType;
132721 int n, m;
 
132722 p = a[i].pExpr;
132723 zType = columnType(&sNC, p, 0, 0, 0);
132724 /* pCol->szEst = ... // Column size est for SELECT tables never used */
132725 pCol->affinity = sqlite3ExprAffinity(p);
132726 if( zType ){
@@ -134227,11 +134587,11 @@
134227 SubstContext *pSubst, /* Description of the substitution */
134228 Select *p, /* SELECT statement in which to make substitutions */
134229 int doPrior /* Do substitutes on p->pPrior too */
134230 ){
134231 SrcList *pSrc;
134232 struct SrcList_item *pItem;
134233 int i;
134234 if( !p ) return;
134235 do{
134236 substExprList(pSubst, p->pEList);
134237 substExprList(pSubst, p->pGroupBy);
@@ -134257,21 +134617,21 @@
134257 **
134258 ** This routine scans the entire SELECT statement and recomputes the
134259 ** pSrcItem->colUsed mask.
134260 */
134261 static int recomputeColumnsUsedExpr(Walker *pWalker, Expr *pExpr){
134262 struct SrcList_item *pItem;
134263 if( pExpr->op!=TK_COLUMN ) return WRC_Continue;
134264 pItem = pWalker->u.pSrcItem;
134265 if( pItem->iCursor!=pExpr->iTable ) return WRC_Continue;
134266 if( pExpr->iColumn<0 ) return WRC_Continue;
134267 pItem->colUsed |= sqlite3ExprColUsed(pExpr);
134268 return WRC_Continue;
134269 }
134270 static void recomputeColumnsUsed(
134271 Select *pSelect, /* The complete SELECT statement */
134272 struct SrcList_item *pSrcItem /* Which FROM clause item to recompute */
134273 ){
134274 Walker w;
134275 if( NEVER(pSrcItem->pTab==0) ) return;
134276 memset(&w, 0, sizeof(w));
134277 w.xExprCallback = recomputeColumnsUsedExpr;
@@ -134301,11 +134661,11 @@
134301 int *aCsrMap, /* Array to store cursor mappings in */
134302 SrcList *pSrc, /* FROM clause to renumber */
134303 int iExcept /* FROM clause item to skip */
134304 ){
134305 int i;
134306 struct SrcList_item *pItem;
134307 for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){
134308 if( i!=iExcept ){
134309 Select *p;
134310 pItem->iCursor = aCsrMap[pItem->iCursor] = pParse->nTab++;
134311 for(p=pItem->pSelect; p; p=p->pPrior){
@@ -134319,11 +134679,12 @@
134319 ** Expression walker callback used by renumberCursors() to update
134320 ** Expr objects to match newly assigned cursor numbers.
134321 */
134322 static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){
134323 int *aCsrMap = pWalker->u.aiCol;
134324 if( pExpr->op==TK_COLUMN && aCsrMap[pExpr->iTable] ){
 
134325 pExpr->iTable = aCsrMap[pExpr->iTable];
134326 }
134327 if( ExprHasProperty(pExpr, EP_FromJoin) && aCsrMap[pExpr->iRightJoinTable] ){
134328 pExpr->iRightJoinTable = aCsrMap[pExpr->iRightJoinTable];
134329 }
@@ -134534,11 +134895,11 @@
134534 int iParent; /* VDBE cursor number of the pSub result set temp table */
134535 int iNewParent = -1;/* Replacement table for iParent */
134536 int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */
134537 int i; /* Loop counter */
134538 Expr *pWhere; /* The WHERE clause */
134539 struct SrcList_item *pSubitem; /* The subquery */
134540 sqlite3 *db = pParse->db;
134541 Walker w; /* Walker to persist agginfo data */
134542 int *aCsrMap = 0;
134543
134544 /* Check to see if flattening is permitted. Return 0 if not.
@@ -135168,10 +135529,14 @@
135168 ** then the (1,1,NULL) row would be suppressed.
135169 **
135170 ** (6) The inner query features one or more window-functions (since
135171 ** changes to the WHERE clause of the inner query could change the
135172 ** window over which window functions are calculated).
 
 
 
 
135173 **
135174 ** Return 0 if no changes are made and non-zero if one or more WHERE clause
135175 ** terms are duplicated into the subquery.
135176 */
135177 static int pushDownWhereTerms(
@@ -135223,10 +135588,11 @@
135223 if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){
135224 return 0; /* restriction (5) */
135225 }
135226 if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
135227 nChng++;
 
135228 while( pSubq ){
135229 SubstContext x;
135230 pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
135231 unsetJoinExpr(pNew, -1);
135232 x.pParse = pParse;
@@ -135338,28 +135704,30 @@
135338 ** INDEXED BY clause, then try to locate the specified index. If there
135339 ** was such a clause and the named index cannot be found, return
135340 ** SQLITE_ERROR and leave an error in pParse. Otherwise, populate
135341 ** pFrom->pIndex and return SQLITE_OK.
135342 */
135343 SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *pParse, struct SrcList_item *pFrom){
135344 if( pFrom->pTab && pFrom->fg.isIndexedBy ){
135345 Table *pTab = pFrom->pTab;
135346 char *zIndexedBy = pFrom->u1.zIndexedBy;
135347 Index *pIdx;
135348 for(pIdx=pTab->pIndex;
135349 pIdx && sqlite3StrICmp(pIdx->zName, zIndexedBy);
135350 pIdx=pIdx->pNext
135351 );
135352 if( !pIdx ){
135353 sqlite3ErrorMsg(pParse, "no such index: %s", zIndexedBy, 0);
135354 pParse->checkSchema = 1;
135355 return SQLITE_ERROR;
135356 }
135357 pFrom->pIBIndex = pIdx;
135358 }
 
135359 return SQLITE_OK;
135360 }
 
135361 /*
135362 ** Detect compound SELECT statements that use an ORDER BY clause with
135363 ** an alternative collating sequence.
135364 **
135365 ** SELECT ... FROM t1 EXCEPT SELECT ... FROM t2 ORDER BY .. COLLATE ...
@@ -135442,11 +135810,11 @@
135442 /*
135443 ** Check to see if the FROM clause term pFrom has table-valued function
135444 ** arguments. If it does, leave an error message in pParse and return
135445 ** non-zero, since pFrom is not allowed to be a table-valued function.
135446 */
135447 static int cannotBeFunction(Parse *pParse, struct SrcList_item *pFrom){
135448 if( pFrom->fg.isTabFunc ){
135449 sqlite3ErrorMsg(pParse, "'%s' is not a function", pFrom->zName);
135450 return 1;
135451 }
135452 return 0;
@@ -135463,23 +135831,23 @@
135463 ** If a non-NULL value is returned, set *ppContext to point to the With
135464 ** object that the returned CTE belongs to.
135465 */
135466 static struct Cte *searchWith(
135467 With *pWith, /* Current innermost WITH clause */
135468 struct SrcList_item *pItem, /* FROM clause element to resolve */
135469 With **ppContext /* OUT: WITH clause return value belongs to */
135470 ){
135471 const char *zName;
135472 if( pItem->zDatabase==0 && (zName = pItem->zName)!=0 ){
135473 With *p;
135474 for(p=pWith; p; p=p->pOuter){
135475 int i;
135476 for(i=0; i<p->nCte; i++){
135477 if( sqlite3StrICmp(zName, p->a[i].zName)==0 ){
135478 *ppContext = p;
135479 return &p->a[i];
135480 }
135481 }
135482 }
135483 }
135484 return 0;
135485 }
@@ -135508,79 +135876,102 @@
135508 }
135509 }
135510
135511 /*
135512 ** This function checks if argument pFrom refers to a CTE declared by
135513 ** a WITH clause on the stack currently maintained by the parser. And,
135514 ** if currently processing a CTE expression, if it is a recursive
135515 ** reference to the current CTE.
135516 **
135517 ** If pFrom falls into either of the two categories above, pFrom->pTab
135518 ** and other fields are populated accordingly. The caller should check
135519 ** (pFrom->pTab!=0) to determine whether or not a successful match
135520 ** was found.
135521 **
135522 ** Whether or not a match is found, SQLITE_OK is returned if no error
135523 ** occurs. If an error does occur, an error message is stored in the
135524 ** parser and some error code other than SQLITE_OK returned.
135525 */
135526 static int withExpand(
135527 Walker *pWalker,
135528 struct SrcList_item *pFrom
135529 ){
135530 Parse *pParse = pWalker->pParse;
135531 sqlite3 *db = pParse->db;
135532 struct Cte *pCte; /* Matched CTE (or NULL if no match) */
135533 With *pWith; /* WITH clause that pCte belongs to */
135534
135535 assert( pFrom->pTab==0 );
135536 if( pParse->nErr ){
135537 return SQLITE_ERROR;
 
135538 }
135539
 
 
 
 
135540 pCte = searchWith(pParse->pWith, pFrom, &pWith);
135541 if( pCte ){
 
135542 Table *pTab;
135543 ExprList *pEList;
135544 Select *pSel;
135545 Select *pLeft; /* Left-most SELECT statement */
135546 Select *pRecTerm; /* Left-most recursive term */
135547 int bMayRecursive; /* True if compound joined by UNION [ALL] */
135548 With *pSavedWith; /* Initial value of pParse->pWith */
135549 int iRecTab = -1; /* Cursor for recursive table */
 
135550
135551 /* If pCte->zCteErr is non-NULL at this point, then this is an illegal
135552 ** recursive reference to CTE pCte. Leave an error in pParse and return
135553 ** early. If pCte->zCteErr is NULL, then this is not a recursive reference.
135554 ** In this case, proceed. */
135555 if( pCte->zCteErr ){
135556 sqlite3ErrorMsg(pParse, pCte->zCteErr, pCte->zName);
135557 return SQLITE_ERROR;
135558 }
135559 if( cannotBeFunction(pParse, pFrom) ) return SQLITE_ERROR;
135560
135561 assert( pFrom->pTab==0 );
135562 pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));
135563 if( pTab==0 ) return WRC_Abort;
 
 
 
 
 
 
 
 
 
 
 
 
135564 pTab->nTabRef = 1;
135565 pTab->zName = sqlite3DbStrDup(db, pCte->zName);
135566 pTab->iPKey = -1;
135567 pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
135568 pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid;
135569 pFrom->pSelect = sqlite3SelectDup(db, pCte->pSelect, 0);
135570 if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
135571 assert( pFrom->pSelect );
 
 
 
 
 
 
135572
135573 /* Check if this is a recursive CTE. */
135574 pRecTerm = pSel = pFrom->pSelect;
135575 bMayRecursive = ( pSel->op==TK_ALL || pSel->op==TK_UNION );
135576 while( bMayRecursive && pRecTerm->op==pSel->op ){
135577 int i;
135578 SrcList *pSrc = pRecTerm->pSrc;
135579 assert( pRecTerm->pPrior!=0 );
135580 for(i=0; i<pSrc->nSrc; i++){
135581 struct SrcList_item *pItem = &pSrc->a[i];
135582 if( pItem->zDatabase==0
135583 && pItem->zName!=0
135584 && 0==sqlite3StrICmp(pItem->zName, pCte->zName)
135585 ){
135586 pItem->pTab = pTab;
@@ -135588,11 +135979,11 @@
135588 pItem->fg.isRecursive = 1;
135589 if( pRecTerm->selFlags & SF_Recursive ){
135590 sqlite3ErrorMsg(pParse,
135591 "multiple references to recursive table: %s", pCte->zName
135592 );
135593 return SQLITE_ERROR;
135594 }
135595 pRecTerm->selFlags |= SF_Recursive;
135596 if( iRecTab<0 ) iRecTab = pParse->nTab++;
135597 pItem->iCursor = iRecTab;
135598 }
@@ -135624,11 +136015,11 @@
135624 if( pEList && pEList->nExpr!=pCte->pCols->nExpr ){
135625 sqlite3ErrorMsg(pParse, "table %s has %d values for %d columns",
135626 pCte->zName, pEList->nExpr, pCte->pCols->nExpr
135627 );
135628 pParse->pWith = pSavedWith;
135629 return SQLITE_ERROR;
135630 }
135631 pEList = pCte->pCols;
135632 }
135633
135634 sqlite3ColumnsFromExprList(pParse, pEList, &pTab->nCol, &pTab->aCol);
@@ -135640,13 +136031,13 @@
135640 }
135641 sqlite3WalkSelect(pWalker, pSel);
135642 }
135643 pCte->zCteErr = 0;
135644 pParse->pWith = pSavedWith;
 
135645 }
135646
135647 return SQLITE_OK;
135648 }
135649 #endif
135650
135651 #ifndef SQLITE_OMIT_CTE
135652 /*
@@ -135676,11 +136067,11 @@
135676 ** sub-query in the FROM clause of a SELECT statement. This function
135677 ** allocates and populates the SrcList_item.pTab object. If successful,
135678 ** SQLITE_OK is returned. Otherwise, if an OOM error is encountered,
135679 ** SQLITE_NOMEM.
135680 */
135681 SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse *pParse, struct SrcList_item *pFrom){
135682 Select *pSel = pFrom->pSelect;
135683 Table *pTab;
135684
135685 assert( pSel );
135686 pFrom->pTab = pTab = sqlite3DbMallocZero(pParse->db, sizeof(Table));
@@ -135724,14 +136115,14 @@
135724 ** and TABLE.* to be every column in TABLE.
135725 **
135726 */
135727 static int selectExpander(Walker *pWalker, Select *p){
135728 Parse *pParse = pWalker->pParse;
135729 int i, j, k;
135730 SrcList *pTabList;
135731 ExprList *pEList;
135732 struct SrcList_item *pFrom;
135733 sqlite3 *db = pParse->db;
135734 Expr *pE, *pRight, *pExpr;
135735 u16 selFlags = p->selFlags;
135736 u32 elistFlags = 0;
135737
@@ -135763,23 +136154,25 @@
135763 for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){
135764 Table *pTab;
135765 assert( pFrom->fg.isRecursive==0 || pFrom->pTab!=0 );
135766 if( pFrom->pTab ) continue;
135767 assert( pFrom->fg.isRecursive==0 );
135768 #ifndef SQLITE_OMIT_CTE
135769 if( withExpand(pWalker, pFrom) ) return WRC_Abort;
135770 if( pFrom->pTab ) {} else
135771 #endif
135772 if( pFrom->zName==0 ){
135773 #ifndef SQLITE_OMIT_SUBQUERY
135774 Select *pSel = pFrom->pSelect;
135775 /* A sub-query in the FROM clause of a SELECT */
135776 assert( pSel!=0 );
135777 assert( pFrom->pTab==0 );
135778 if( sqlite3WalkSelect(pWalker, pSel) ) return WRC_Abort;
135779 if( sqlite3ExpandSubquery(pParse, pFrom) ) return WRC_Abort;
135780 #endif
 
 
 
 
 
 
135781 }else{
135782 /* An ordinary table or view name in the FROM clause */
135783 assert( pFrom->pTab==0 );
135784 pFrom->pTab = pTab = sqlite3LocateTableItem(pParse, 0, pFrom);
135785 if( pTab==0 ) return WRC_Abort;
@@ -135823,11 +136216,11 @@
135823 }
135824 #endif
135825 }
135826
135827 /* Locate the index named by the INDEXED BY clause, if any. */
135828 if( sqlite3IndexedByLookup(pParse, pFrom) ){
135829 return WRC_Abort;
135830 }
135831 }
135832
135833 /* Process NATURAL keywords, and ON and USING clauses of joins.
@@ -136066,11 +136459,11 @@
136066 */
136067 static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){
136068 Parse *pParse;
136069 int i;
136070 SrcList *pTabList;
136071 struct SrcList_item *pFrom;
136072
136073 assert( p->selFlags & SF_Resolved );
136074 if( p->selFlags & SF_HasTypeInfo ) return;
136075 p->selFlags |= SF_HasTypeInfo;
136076 pParse = pWalker->pParse;
@@ -136390,15 +136783,17 @@
136390 /*
136391 ** Check to see if the pThis entry of pTabList is a self-join of a prior view.
136392 ** If it is, then return the SrcList_item for the prior view. If it is not,
136393 ** then return 0.
136394 */
136395 static struct SrcList_item *isSelfJoinView(
136396 SrcList *pTabList, /* Search for self-joins in this FROM clause */
136397 struct SrcList_item *pThis /* Search for prior reference to this subquery */
136398 ){
136399 struct SrcList_item *pItem;
 
 
136400 for(pItem = pTabList->a; pItem<pThis; pItem++){
136401 Select *pS1;
136402 if( pItem->pSelect==0 ) continue;
136403 if( pItem->fg.viaCoroutine ) continue;
136404 if( pItem->zName==0 ) continue;
@@ -136410,21 +136805,28 @@
136410 if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){
136411 /* The query flattener left two different CTE tables with identical
136412 ** names in the same FROM clause. */
136413 continue;
136414 }
136415 if( sqlite3ExprCompare(0, pThis->pSelect->pWhere, pS1->pWhere, -1)
136416 || sqlite3ExprCompare(0, pThis->pSelect->pHaving, pS1->pHaving, -1)
136417 ){
136418 /* The view was modified by some other optimization such as
136419 ** pushDownWhereTerms() */
136420 continue;
136421 }
136422 return pItem;
136423 }
136424 return 0;
136425 }
 
 
 
 
 
 
 
 
 
136426
136427 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
136428 /*
136429 ** Attempt to transform a query of the form
136430 **
@@ -136589,13 +136991,13 @@
136589 /* If the SF_UpdateFrom flag is set, then this function is being called
136590 ** as part of populating the temp table for an UPDATE...FROM statement.
136591 ** In this case, it is an error if the target object (pSrc->a[0]) name
136592 ** or alias is duplicated within FROM clause (pSrc->a[1..n]). */
136593 if( p->selFlags & SF_UpdateFrom ){
136594 struct SrcList_item *p0 = &p->pSrc->a[0];
136595 for(i=1; i<p->pSrc->nSrc; i++){
136596 struct SrcList_item *p1 = &p->pSrc->a[i];
136597 if( p0->pTab==p1->pTab && 0==sqlite3_stricmp(p0->zAlias, p1->zAlias) ){
136598 sqlite3ErrorMsg(pParse,
136599 "target object/alias may not appear in FROM clause: %s",
136600 p0->zAlias ? p0->zAlias : p0->pTab->zName
136601 );
@@ -136629,11 +137031,11 @@
136629 /* Try to do various optimizations (flattening subqueries, and strength
136630 ** reduction of join operators) in the FROM clause up into the main query
136631 */
136632 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
136633 for(i=0; !p->pPrior && i<pTabList->nSrc; i++){
136634 struct SrcList_item *pItem = &pTabList->a[i];
136635 Select *pSub = pItem->pSelect;
136636 Table *pTab = pItem->pTab;
136637
136638 /* The expander should have already created transient Table objects
136639 ** even for FROM clause elements such as subqueries that do not correspond
@@ -136763,11 +137165,12 @@
136763 /* For each term in the FROM clause, do two things:
136764 ** (1) Authorized unreferenced tables
136765 ** (2) Generate code for all sub-queries
136766 */
136767 for(i=0; i<pTabList->nSrc; i++){
136768 struct SrcList_item *pItem = &pTabList->a[i];
 
136769 SelectDest dest;
136770 Select *pSub;
136771 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
136772 const char *zSavedAuthContext;
136773 #endif
@@ -136823,10 +137226,11 @@
136823
136824 /* Make copies of constant WHERE-clause terms in the outer query down
136825 ** inside the subquery. This can help the subquery to run more efficiently.
136826 */
136827 if( OptimizationEnabled(db, SQLITE_PushDown)
 
136828 && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
136829 (pItem->fg.jointype & JT_OUTER)!=0)
136830 ){
136831 #if SELECTTRACE_ENABLED
136832 if( sqlite3SelectTrace & 0x100 ){
@@ -136833,29 +137237,32 @@
136833 SELECTTRACE(0x100,pParse,p,
136834 ("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
136835 sqlite3TreeViewSelect(0, p, 0);
136836 }
136837 #endif
 
136838 }else{
136839 SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));
136840 }
136841
136842 zSavedAuthContext = pParse->zAuthContext;
136843 pParse->zAuthContext = pItem->zName;
136844
136845 /* Generate code to implement the subquery
136846 **
136847 ** The subquery is implemented as a co-routine if the subquery is
136848 ** guaranteed to be the outer loop (so that it does not need to be
136849 ** computed more than once)
 
136850 **
136851 ** TODO: Are there other reasons beside (1) to use a co-routine
136852 ** implementation?
136853 */
136854 if( i==0
136855 && (pTabList->nSrc==1
136856 || (pTabList->a[1].fg.jointype&(JT_LEFT|JT_CROSS))!=0) /* (1) */
 
136857 ){
136858 /* Implement a co-routine that will return a single row of the result
136859 ** set on each invocation.
136860 */
136861 int addrTop = sqlite3VdbeCurrentAddr(v)+1;
@@ -136871,20 +137278,34 @@
136871 pItem->fg.viaCoroutine = 1;
136872 pItem->regResult = dest.iSdst;
136873 sqlite3VdbeEndCoroutine(v, pItem->regReturn);
136874 sqlite3VdbeJumpHere(v, addrTop-1);
136875 sqlite3ClearTempRegCache(pParse);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136876 }else{
136877 /* Generate a subroutine that will fill an ephemeral table with
136878 ** the content of this subquery. pItem->addrFillSub will point
136879 ** to the address of the generated subroutine. pItem->regReturn
136880 ** is a register allocated to hold the subroutine return address
136881 */
136882 int topAddr;
136883 int onceAddr = 0;
136884 int retAddr;
136885 struct SrcList_item *pPrior;
136886
136887 testcase( pItem->addrFillSub==0 ); /* Ticket c52b09c7f38903b1311 */
136888 pItem->regReturn = ++pParse->nMem;
136889 topAddr = sqlite3VdbeAddOp2(v, OP_Integer, 0, pItem->regReturn);
136890 pItem->addrFillSub = topAddr+1;
@@ -136895,26 +137316,26 @@
136895 onceAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
136896 VdbeComment((v, "materialize \"%s\"", pItem->pTab->zName));
136897 }else{
136898 VdbeNoopComment((v, "materialize \"%s\"", pItem->pTab->zName));
136899 }
136900 pPrior = isSelfJoinView(pTabList, pItem);
136901 if( pPrior ){
136902 sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor);
136903 assert( pPrior->pSelect!=0 );
136904 pSub->nSelectRow = pPrior->pSelect->nSelectRow;
136905 }else{
136906 sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
136907 ExplainQueryPlan((pParse, 1, "MATERIALIZE %u", pSub->selId));
136908 sqlite3Select(pParse, pSub, &dest);
136909 }
136910 pItem->pTab->nRowLogEst = pSub->nSelectRow;
136911 if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr);
136912 retAddr = sqlite3VdbeAddOp1(v, OP_Return, pItem->regReturn);
136913 VdbeComment((v, "end %s", pItem->pTab->zName));
136914 sqlite3VdbeChangeP1(v, topAddr, retAddr);
136915 sqlite3ClearTempRegCache(pParse);
 
 
 
 
 
 
 
136916 }
136917 if( db->mallocFailed ) goto select_end;
136918 pParse->nHeight -= sqlite3SelectExprHeight(p);
136919 pParse->zAuthContext = zSavedAuthContext;
136920 #endif
@@ -137055,10 +137476,11 @@
137055 sSort.labelOBLopt = sqlite3WhereOrderByLimitOptLabel(pWInfo);
137056 if( sSort.nOBSat==sSort.pOrderBy->nExpr ){
137057 sSort.pOrderBy = 0;
137058 }
137059 }
 
137060
137061 /* If sorting index that was created by a prior OP_OpenEphemeral
137062 ** instruction ended up not being needed, then change the OP_OpenEphemeral
137063 ** into an OP_Noop.
137064 */
@@ -137093,10 +137515,11 @@
137093 sqlite3WhereContinueLabel(pWInfo),
137094 sqlite3WhereBreakLabel(pWInfo));
137095
137096 /* End the database scan loop.
137097 */
 
137098 sqlite3WhereEnd(pWInfo);
137099 }
137100 }else{
137101 /* This case when there exist aggregate functions or a GROUP BY clause
137102 ** or both */
@@ -137163,15 +137586,17 @@
137163 /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in
137164 ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the
137165 ** SELECT statement.
137166 */
137167 pAggInfo = sqlite3DbMallocZero(db, sizeof(*pAggInfo) );
137168 if( pAggInfo==0 ){
 
 
 
 
137169 goto select_end;
137170 }
137171 pAggInfo->pNext = pParse->pAggList;
137172 pParse->pAggList = pAggInfo;
137173 pAggInfo->selId = p->selId;
137174 memset(&sNC, 0, sizeof(sNC));
137175 sNC.pParse = pParse;
137176 sNC.pSrcList = pTabList;
137177 sNC.uNC.pAggInfo = pAggInfo;
@@ -137286,10 +137711,11 @@
137286 SELECTTRACE(1,pParse,p,("WhereBegin\n"));
137287 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, 0,
137288 WHERE_GROUPBY | (orderByGrp ? WHERE_SORTBYGROUP : 0), 0
137289 );
137290 if( pWInfo==0 ) goto select_end;
 
137291 if( sqlite3WhereIsOrdered(pWInfo)==pGroupBy->nExpr ){
137292 /* The optimizer is able to deliver rows in group by order so
137293 ** we do not have to sort. The OP_OpenEphemeral table will be
137294 ** cancelled later because we still need to use the pKeyInfo
137295 */
@@ -137334,10 +137760,11 @@
137334 regRecord = sqlite3GetTempReg(pParse);
137335 sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord);
137336 sqlite3VdbeAddOp2(v, OP_SorterInsert, pAggInfo->sortingIdx, regRecord);
137337 sqlite3ReleaseTempReg(pParse, regRecord);
137338 sqlite3ReleaseTempRange(pParse, regBase, nCol);
 
137339 sqlite3WhereEnd(pWInfo);
137340 pAggInfo->sortingIdxPTab = sortPTab = pParse->nTab++;
137341 sortOut = sqlite3GetTempReg(pParse);
137342 sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol);
137343 sqlite3VdbeAddOp2(v, OP_SorterSort, pAggInfo->sortingIdx, addrEnd);
@@ -137411,10 +137838,11 @@
137411 */
137412 if( groupBySort ){
137413 sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx,addrTopOfLoop);
137414 VdbeCoverage(v);
137415 }else{
 
137416 sqlite3WhereEnd(pWInfo);
137417 sqlite3VdbeChangeToNoop(v, addrSortingIdx);
137418 }
137419
137420 /* Output the final row of result
@@ -137566,15 +137994,17 @@
137566 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy,
137567 0, minMaxFlag, 0);
137568 if( pWInfo==0 ){
137569 goto select_end;
137570 }
 
137571 updateAccumulator(pParse, regAcc, pAggInfo);
137572 if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc);
137573 if( minMaxFlag ){
137574 sqlite3WhereMinMaxOptEarlyOut(v, pWInfo);
137575 }
 
137576 sqlite3WhereEnd(pWInfo);
137577 finalizeAggFunctions(pParse, pAggInfo);
137578 }
137579
137580 sSort.pOrderBy = 0;
@@ -138199,11 +138629,11 @@
138199 db->aDb[iDb].zDbSName, zName,
138200 pTrig->table, z);
138201 sqlite3DbFree(db, z);
138202 sqlite3ChangeCookie(pParse, iDb);
138203 sqlite3VdbeAddParseSchemaOp(v, iDb,
138204 sqlite3MPrintf(db, "type='trigger' AND name='%q'", zName));
138205 }
138206
138207 if( db->init.busy ){
138208 Trigger *pLink = pTrig;
138209 Hash *pHash = &db->aDb[iDb].pSchema->trigHash;
@@ -141764,11 +142194,11 @@
141764 v = sqlite3GetVdbe(pParse);
141765 sqlite3ChangeCookie(pParse, iDb);
141766
141767 sqlite3VdbeAddOp0(v, OP_Expire);
141768 zWhere = sqlite3MPrintf(db, "name=%Q AND sql=%Q", pTab->zName, zStmt);
141769 sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere);
141770 sqlite3DbFree(db, zStmt);
141771
141772 iReg = ++pParse->nMem;
141773 sqlite3VdbeLoadString(v, iReg, pTab->zName);
141774 sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg);
@@ -141935,10 +142365,11 @@
141935 if( zType[i]=='\0' && i>0 ){
141936 assert(zType[i-1]==' ');
141937 zType[i-1] = '\0';
141938 }
141939 pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN;
 
141940 oooHidden = TF_OOOHidden;
141941 }else{
141942 pTab->tabFlags |= oooHidden;
141943 }
141944 }
@@ -143158,11 +143589,11 @@
143158 SQLITE_PRIVATE void sqlite3WhereSplit(WhereClause*,Expr*,u8);
143159 SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet*, Expr*);
143160 SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet*, Expr*);
143161 SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet*, ExprList*);
143162 SQLITE_PRIVATE void sqlite3WhereExprAnalyze(SrcList*, WhereClause*);
143163 SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, struct SrcList_item*, WhereClause*);
143164
143165
143166
143167
143168
@@ -143336,11 +143767,11 @@
143336 int ret = 0;
143337 #if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
143338 if( sqlite3ParseToplevel(pParse)->explain==2 )
143339 #endif
143340 {
143341 struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];
143342 Vdbe *v = pParse->pVdbe; /* VM being constructed */
143343 sqlite3 *db = pParse->db; /* Database handle */
143344 int isSearch; /* True for a SEARCH. False for SCAN. */
143345 WhereLoop *pLoop; /* The controlling WhereLoop object */
143346 u32 flags; /* Flags that describe this loop */
@@ -144129,11 +144560,11 @@
144129
144130 /*
144131 ** Insert an OP_CursorHint instruction if it is appropriate to do so.
144132 */
144133 static void codeCursorHint(
144134 struct SrcList_item *pTabItem, /* FROM clause item */
144135 WhereInfo *pWInfo, /* The where clause */
144136 WhereLevel *pLevel, /* Which loop to provide hints for */
144137 WhereTerm *pEndRange /* Hint this end-of-scan boundary term if not NULL */
144138 ){
144139 Parse *pParse = pWInfo->pParse;
@@ -144504,11 +144935,11 @@
144504 int bRev; /* True if we need to scan in reverse order */
144505 WhereLoop *pLoop; /* The WhereLoop object being coded */
144506 WhereClause *pWC; /* Decomposition of the entire WHERE clause */
144507 WhereTerm *pTerm; /* A WHERE clause term */
144508 sqlite3 *db; /* Database connection */
144509 struct SrcList_item *pTabItem; /* FROM clause term being coded */
144510 int addrBrk; /* Jump here to break out of the loop */
144511 int addrHalt; /* addrBrk for the outermost loop */
144512 int addrCont; /* Jump here to continue with next cycle */
144513 int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
144514 int iReleaseReg = 0; /* Temp register to free before returning */
@@ -145292,11 +145723,11 @@
145292 ** by this loop in the a[0] slot and all notReady tables in a[1..] slots.
145293 ** This becomes the SrcList in the recursive call to sqlite3WhereBegin().
145294 */
145295 if( pWInfo->nLevel>1 ){
145296 int nNotReady; /* The number of notReady tables */
145297 struct SrcList_item *origSrc; /* Original list of tables */
145298 nNotReady = pWInfo->nLevel - iLevel - 1;
145299 pOrTab = sqlite3StackAllocRaw(db,
145300 sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0]));
145301 if( pOrTab==0 ) return notReady;
145302 pOrTab->nAlloc = (u8)(nNotReady + 1);
@@ -147557,11 +147988,11 @@
147557 ** Each function argument translates into an equality constraint against
147558 ** a HIDDEN column in the table.
147559 */
147560 SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(
147561 Parse *pParse, /* Parsing context */
147562 struct SrcList_item *pItem, /* The FROM clause term to process */
147563 WhereClause *pWC /* Xfer function arguments to here */
147564 ){
147565 Table *pTab;
147566 int j, k;
147567 ExprList *pArgs;
@@ -148291,11 +148722,11 @@
148291 ** could be used with an index to access pSrc, assuming an appropriate
148292 ** index existed.
148293 */
148294 static int termCanDriveIndex(
148295 WhereTerm *pTerm, /* WHERE clause term to check */
148296 struct SrcList_item *pSrc, /* Table we are trying to access */
148297 Bitmask notReady /* Tables in outer loops of the join */
148298 ){
148299 char aff;
148300 if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
148301 if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) return 0;
@@ -148325,11 +148756,11 @@
148325 ** makes use of the automatic index.
148326 */
148327 static void constructAutomaticIndex(
148328 Parse *pParse, /* The parsing context */
148329 WhereClause *pWC, /* The WHERE clause */
148330 struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
148331 Bitmask notReady, /* Mask of cursors that are not available */
148332 WhereLevel *pLevel /* Write new index here */
148333 ){
148334 int nKeyCol; /* Number of columns in the constructed index */
148335 WhereTerm *pTerm; /* A single term of the WHERE clause */
@@ -148349,11 +148780,11 @@
148349 Bitmask idxCols; /* Bitmap of columns used for indexing */
148350 Bitmask extraCols; /* Bitmap of additional columns */
148351 u8 sentWarning = 0; /* True if a warnning has been issued */
148352 Expr *pPartial = 0; /* Partial Index Expression */
148353 int iContinue = 0; /* Jump here to skip excluded rows */
148354 struct SrcList_item *pTabItem; /* FROM clause term being indexed */
148355 int addrCounter = 0; /* Address where integer counter is initialized */
148356 int regBase; /* Array of registers where record is assembled */
148357
148358 /* Generate code to skip over the creation and initialization of the
148359 ** transient index on 2nd and subsequent iterations of the loop. */
@@ -148533,11 +148964,11 @@
148533 */
148534 static sqlite3_index_info *allocateIndexInfo(
148535 Parse *pParse, /* The parsing context */
148536 WhereClause *pWC, /* The WHERE clause being analyzed */
148537 Bitmask mUnusable, /* Ignore terms with these prereqs */
148538 struct SrcList_item *pSrc, /* The FROM clause term that is the vtab */
148539 ExprList *pOrderBy, /* The ORDER BY clause */
148540 u16 *pmNoOmit /* Mask of terms not to omit */
148541 ){
148542 int i, j;
148543 int nTerm;
@@ -149431,11 +149862,11 @@
149431 ** Print a WhereLoop object for debugging purposes
149432 */
149433 SQLITE_PRIVATE void sqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC){
149434 WhereInfo *pWInfo = pWC->pWInfo;
149435 int nb = 1+(pWInfo->pTabList->nSrc+3)/4;
149436 struct SrcList_item *pItem = pWInfo->pTabList->a + p->iTab;
149437 Table *pTab = pItem->pTab;
149438 Bitmask mAll = (((Bitmask)1)<<(nb*4)) - 1;
149439 sqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId,
149440 p->iTab, nb, p->maskSelf, nb, p->prereq & mAll);
149441 sqlite3DebugPrintf(" %12s",
@@ -150042,11 +150473,11 @@
150042 ** If pProbe->idxType==SQLITE_IDXTYPE_IPK, that means pIndex is
150043 ** a fake index used for the INTEGER PRIMARY KEY.
150044 */
150045 static int whereLoopAddBtreeIndex(
150046 WhereLoopBuilder *pBuilder, /* The WhereLoop factory */
150047 struct SrcList_item *pSrc, /* FROM clause term being analyzed */
150048 Index *pProbe, /* An index on pSrc */
150049 LogEst nInMul /* log(Number of iterations due to IN) */
150050 ){
150051 WhereInfo *pWInfo = pBuilder->pWInfo; /* WHERE analyse context */
150052 Parse *pParse = pWInfo->pParse; /* Parsing context */
@@ -150533,11 +150964,11 @@
150533 Index *pProbe; /* An index we are evaluating */
150534 Index sPk; /* A fake index object for the primary key */
150535 LogEst aiRowEstPk[2]; /* The aiRowLogEst[] value for the sPk index */
150536 i16 aiColumnPk = -1; /* The aColumn[] value for the sPk index */
150537 SrcList *pTabList; /* The FROM clause */
150538 struct SrcList_item *pSrc; /* The FROM clause btree term to add */
150539 WhereLoop *pNew; /* Template WhereLoop object */
150540 int rc = SQLITE_OK; /* Return code */
150541 int iSortIdx = 1; /* Index number */
150542 int b; /* A boolean value */
150543 LogEst rSize; /* number of rows in the table */
@@ -150551,13 +150982,13 @@
150551 pSrc = pTabList->a + pNew->iTab;
150552 pTab = pSrc->pTab;
150553 pWC = pBuilder->pWC;
150554 assert( !IsVirtual(pSrc->pTab) );
150555
150556 if( pSrc->pIBIndex ){
150557 /* An INDEXED BY clause specifies a particular index to use */
150558 pProbe = pSrc->pIBIndex;
150559 }else if( !HasRowid(pTab) ){
150560 pProbe = pTab->pIndex;
150561 }else{
150562 /* There is no INDEXED BY clause. Create a fake Index object in local
150563 ** variable sPk to represent the rowid primary key index. Make this
@@ -150589,11 +151020,11 @@
150589 #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
150590 /* Automatic indexes */
150591 if( !pBuilder->pOrSet /* Not part of an OR optimization */
150592 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0
150593 && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0
150594 && pSrc->pIBIndex==0 /* Has no INDEXED BY clause */
150595 && !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */
150596 && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */
150597 && !pSrc->fg.isCorrelated /* Not a correlated subquery */
150598 && !pSrc->fg.isRecursive /* Not a recursive common table expression. */
150599 ){
@@ -150639,11 +151070,11 @@
150639 #endif /* SQLITE_OMIT_AUTOMATIC_INDEX */
150640
150641 /* Loop over all indices. If there was an INDEXED BY clause, then only
150642 ** consider index pProbe. */
150643 for(; rc==SQLITE_OK && pProbe;
150644 pProbe=(pSrc->pIBIndex ? 0 : pProbe->pNext), iSortIdx++
150645 ){
150646 int isLeft = (pSrc->fg.jointype & JT_OUTER)!=0;
150647 if( pProbe->pPartIdxWhere!=0
150648 && !whereUsablePartialIndex(pSrc->iCursor, isLeft, pWC,
150649 pProbe->pPartIdxWhere)
@@ -150814,11 +151245,11 @@
150814 int i;
150815 int mxTerm;
150816 int rc = SQLITE_OK;
150817 WhereLoop *pNew = pBuilder->pNew;
150818 Parse *pParse = pBuilder->pWInfo->pParse;
150819 struct SrcList_item *pSrc = &pBuilder->pWInfo->pTabList->a[pNew->iTab];
150820 int nConstraint = pIdxInfo->nConstraint;
150821
150822 assert( (mUsable & mPrereq)==mPrereq );
150823 *pbIn = 0;
150824 pNew->prereq = mPrereq;
@@ -151006,11 +151437,11 @@
151006 ){
151007 int rc = SQLITE_OK; /* Return code */
151008 WhereInfo *pWInfo; /* WHERE analysis context */
151009 Parse *pParse; /* The parsing context */
151010 WhereClause *pWC; /* The WHERE clause */
151011 struct SrcList_item *pSrc; /* The FROM clause term to search */
151012 sqlite3_index_info *p; /* Object to pass to xBestIndex() */
151013 int nConstraint; /* Number of constraints in p */
151014 int bIn; /* True if plan uses IN(...) operator */
151015 WhereLoop *pNew;
151016 Bitmask mBest; /* Tables used by best possible plan */
@@ -151134,11 +151565,11 @@
151134 int rc = SQLITE_OK;
151135 int iCur;
151136 WhereClause tempWC;
151137 WhereLoopBuilder sSubBuild;
151138 WhereOrSet sSum, sCur;
151139 struct SrcList_item *pItem;
151140
151141 pWC = pBuilder->pWC;
151142 pWCEnd = pWC->a + pWC->nTerm;
151143 pNew = pBuilder->pNew;
151144 memset(&sSum, 0, sizeof(sSum));
@@ -151250,12 +151681,12 @@
151250 WhereInfo *pWInfo = pBuilder->pWInfo;
151251 Bitmask mPrereq = 0;
151252 Bitmask mPrior = 0;
151253 int iTab;
151254 SrcList *pTabList = pWInfo->pTabList;
151255 struct SrcList_item *pItem;
151256 struct SrcList_item *pEnd = &pTabList->a[pWInfo->nLevel];
151257 sqlite3 *db = pWInfo->pParse->db;
151258 int rc = SQLITE_OK;
151259 WhereLoop *pNew;
151260
151261 /* Loop over the tables in the join, from left to right */
@@ -151274,11 +151705,11 @@
151274 }else{
151275 mPrereq = 0;
151276 }
151277 #ifndef SQLITE_OMIT_VIRTUALTABLE
151278 if( IsVirtual(pItem->pTab) ){
151279 struct SrcList_item *p;
151280 for(p=&pItem[1]; p<pEnd; p++){
151281 if( mUnusable || (p->fg.jointype & (JT_LEFT|JT_CROSS)) ){
151282 mUnusable |= sqlite3WhereGetMask(&pWInfo->sMaskSet, p->iCursor);
151283 }
151284 }
@@ -152129,11 +152560,11 @@
152129 ** no-frills query planner. Return zero if this query needs the
152130 ** general-purpose query planner.
152131 */
152132 static int whereShortCut(WhereLoopBuilder *pBuilder){
152133 WhereInfo *pWInfo;
152134 struct SrcList_item *pItem;
152135 WhereClause *pWC;
152136 WhereTerm *pTerm;
152137 WhereLoop *pLoop;
152138 int iCur;
152139 int j;
@@ -152659,11 +153090,11 @@
152659 if( sWLB.pOrderBy ){
152660 tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy);
152661 }
152662 for(i=pWInfo->nLevel-1; i>=1; i--){
152663 WhereTerm *pTerm, *pEnd;
152664 struct SrcList_item *pItem;
152665 pLoop = pWInfo->a[i].pWLoop;
152666 pItem = &pWInfo->pTabList->a[pLoop->iTab];
152667 if( (pItem->fg.jointype & JT_LEFT)==0 ) continue;
152668 if( (wctrlFlags & WHERE_WANT_DISTINCT)==0
152669 && (pLoop->wsFlags & WHERE_ONEROW)==0
@@ -152749,11 +153180,11 @@
152749 ** searching those tables.
152750 */
152751 for(ii=0, pLevel=pWInfo->a; ii<nTabList; ii++, pLevel++){
152752 Table *pTab; /* Table to open */
152753 int iDb; /* Index of database containing table/index */
152754 struct SrcList_item *pTabItem;
152755
152756 pTabItem = &pTabList->a[pLevel->iFrom];
152757 pTab = pTabItem->pTab;
152758 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
152759 pLoop = pLevel->pWLoop;
@@ -153086,11 +153517,11 @@
153086 assert( pWInfo->nLevel<=pTabList->nSrc );
153087 for(i=0, pLevel=pWInfo->a; i<pWInfo->nLevel; i++, pLevel++){
153088 int k, last;
153089 VdbeOp *pOp, *pLastOp;
153090 Index *pIdx = 0;
153091 struct SrcList_item *pTabItem = &pTabList->a[pLevel->iFrom];
153092 Table *pTab = pTabItem->pTab;
153093 assert( pTab!=0 );
153094 pLoop = pLevel->pWLoop;
153095
153096 /* For a co-routine, change all OP_Column references to the table of
@@ -156398,10 +156829,23 @@
156398 sqlite3ErrorMsg(pParse, "too many terms in compound SELECT");
156399 }
156400 }
156401 }
156402
 
 
 
 
 
 
 
 
 
 
 
 
 
156403
156404 /* Construct a new Expr object from a single identifier. Use the
156405 ** new Expr to populate pOut. Set the span of pOut to be the identifier
156406 ** that created the expression.
156407 */
@@ -156573,95 +157017,96 @@
156573 #define TK_GROUPS 92
156574 #define TK_OTHERS 93
156575 #define TK_TIES 94
156576 #define TK_GENERATED 95
156577 #define TK_ALWAYS 96
156578 #define TK_REINDEX 97
156579 #define TK_RENAME 98
156580 #define TK_CTIME_KW 99
156581 #define TK_ANY 100
156582 #define TK_BITAND 101
156583 #define TK_BITOR 102
156584 #define TK_LSHIFT 103
156585 #define TK_RSHIFT 104
156586 #define TK_PLUS 105
156587 #define TK_MINUS 106
156588 #define TK_STAR 107
156589 #define TK_SLASH 108
156590 #define TK_REM 109
156591 #define TK_CONCAT 110
156592 #define TK_COLLATE 111
156593 #define TK_BITNOT 112
156594 #define TK_ON 113
156595 #define TK_INDEXED 114
156596 #define TK_STRING 115
156597 #define TK_JOIN_KW 116
156598 #define TK_CONSTRAINT 117
156599 #define TK_DEFAULT 118
156600 #define TK_NULL 119
156601 #define TK_PRIMARY 120
156602 #define TK_UNIQUE 121
156603 #define TK_CHECK 122
156604 #define TK_REFERENCES 123
156605 #define TK_AUTOINCR 124
156606 #define TK_INSERT 125
156607 #define TK_DELETE 126
156608 #define TK_UPDATE 127
156609 #define TK_SET 128
156610 #define TK_DEFERRABLE 129
156611 #define TK_FOREIGN 130
156612 #define TK_DROP 131
156613 #define TK_UNION 132
156614 #define TK_ALL 133
156615 #define TK_EXCEPT 134
156616 #define TK_INTERSECT 135
156617 #define TK_SELECT 136
156618 #define TK_VALUES 137
156619 #define TK_DISTINCT 138
156620 #define TK_DOT 139
156621 #define TK_FROM 140
156622 #define TK_JOIN 141
156623 #define TK_USING 142
156624 #define TK_ORDER 143
156625 #define TK_GROUP 144
156626 #define TK_HAVING 145
156627 #define TK_LIMIT 146
156628 #define TK_WHERE 147
156629 #define TK_RETURNING 148
156630 #define TK_INTO 149
156631 #define TK_NOTHING 150
156632 #define TK_FLOAT 151
156633 #define TK_BLOB 152
156634 #define TK_INTEGER 153
156635 #define TK_VARIABLE 154
156636 #define TK_CASE 155
156637 #define TK_WHEN 156
156638 #define TK_THEN 157
156639 #define TK_ELSE 158
156640 #define TK_INDEX 159
156641 #define TK_ALTER 160
156642 #define TK_ADD 161
156643 #define TK_WINDOW 162
156644 #define TK_OVER 163
156645 #define TK_FILTER 164
156646 #define TK_COLUMN 165
156647 #define TK_AGG_FUNCTION 166
156648 #define TK_AGG_COLUMN 167
156649 #define TK_TRUEFALSE 168
156650 #define TK_ISNOT 169
156651 #define TK_FUNCTION 170
156652 #define TK_UMINUS 171
156653 #define TK_UPLUS 172
156654 #define TK_TRUTH 173
156655 #define TK_REGISTER 174
156656 #define TK_VECTOR 175
156657 #define TK_SELECT_COLUMN 176
156658 #define TK_IF_NULL_ROW 177
156659 #define TK_ASTERISK 178
156660 #define TK_SPAN 179
156661 #define TK_SPACE 180
156662 #define TK_ILLEGAL 181
 
156663 #endif
156664 /**************** End token definitions ***************************************/
156665
156666 /* The next sections is a series of control #defines.
156667 ** various aspects of the generated parser.
@@ -156717,32 +157162,33 @@
156717 #ifndef INTERFACE
156718 # define INTERFACE 1
156719 #endif
156720 /************* Begin control #defines *****************************************/
156721 #define YYCODETYPE unsigned short int
156722 #define YYNOCODE 313
156723 #define YYACTIONTYPE unsigned short int
156724 #define YYWILDCARD 100
156725 #define sqlite3ParserTOKENTYPE Token
156726 typedef union {
156727 int yyinit;
156728 sqlite3ParserTOKENTYPE yy0;
156729 Upsert* yy40;
156730 TriggerStep* yy51;
156731 With* yy105;
156732 Select* yy293;
156733 struct TrigEvent yy298;
156734 struct FrameBound yy341;
156735 ExprList* yy350;
156736 Expr* yy354;
156737 int yy412;
156738 SrcList* yy457;
156739 struct {int value; int mask;} yy463;
156740 IdList* yy498;
156741 Window* yy503;
156742 const char* yy504;
156743 u8 yy624;
 
156744 } YYMINORTYPE;
156745 #ifndef YYSTACKDEPTH
156746 #define YYSTACKDEPTH 100
156747 #endif
156748 #define sqlite3ParserARG_SDECL
@@ -156754,22 +157200,22 @@
156754 #define sqlite3ParserCTX_PDECL ,Parse *pParse
156755 #define sqlite3ParserCTX_PARAM ,pParse
156756 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
156757 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
156758 #define YYFALLBACK 1
156759 #define YYNSTATE 571
156760 #define YYNRULE 393
156761 #define YYNRULE_WITH_ACTION 332
156762 #define YYNTOKEN 182
156763 #define YY_MAX_SHIFT 570
156764 #define YY_MIN_SHIFTREDUCE 822
156765 #define YY_MAX_SHIFTREDUCE 1214
156766 #define YY_ERROR_ACTION 1215
156767 #define YY_ACCEPT_ACTION 1216
156768 #define YY_NO_ACTION 1217
156769 #define YY_MIN_REDUCE 1218
156770 #define YY_MAX_REDUCE 1610
156771 /************* End control #defines *******************************************/
156772 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
156773
156774 /* Define the yytestcase() macro to be a no-op if is not already defined
156775 ** otherwise.
@@ -156832,605 +157278,604 @@
156832 ** yy_reduce_ofst[] For each state, the offset into yy_action for
156833 ** shifting non-terminals after a reduce.
156834 ** yy_default[] Default action for each state.
156835 **
156836 *********** Begin parsing tables **********************************************/
156837 #define YY_ACTTAB_COUNT (2017)
156838 static const YYACTIONTYPE yy_action[] = {
156839 /* 0 */ 564, 1249, 564, 197, 1571, 564, 1252, 564, 116, 113,
156840 /* 10 */ 218, 564, 1259, 564, 486, 393, 116, 113, 218, 405,
156841 /* 20 */ 357, 357, 42, 42, 42, 42, 469, 42, 42, 72,
156842 /* 30 */ 72, 956, 1251, 72, 72, 72, 72, 1496, 1576, 957,
156843 /* 40 */ 9, 886, 251, 123, 124, 114, 1192, 1192, 1032, 1035,
156844 /* 50 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 445, 405,
156845 /* 60 */ 471, 1551, 570, 2, 1220, 1577, 546, 145, 147, 305,
156846 /* 70 */ 546, 138, 546, 1292, 1292, 522, 564, 1189, 1300, 545,
156847 /* 80 */ 521, 511, 167, 123, 124, 114, 1192, 1192, 1032, 1035,
156848 /* 90 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 72, 72,
156849 /* 100 */ 281, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156850 /* 110 */ 117, 438, 273, 273, 273, 273, 443, 1168, 1532, 371,
156851 /* 120 */ 1534, 1168, 370, 1532, 535, 561, 1140, 561, 1140, 405,
156852 /* 130 */ 1075, 248, 215, 1189, 174, 527, 100, 304, 555, 228,
156853 /* 140 */ 438, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156854 /* 150 */ 117, 438, 448, 123, 124, 114, 1192, 1192, 1032, 1035,
156855 /* 160 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 541, 448,
156856 /* 170 */ 447, 442, 1168, 1169, 1170, 395, 1168, 1169, 1170, 125,
156857 /* 180 */ 120, 120, 120, 120, 119, 119, 118, 118, 118, 117,
156858 /* 190 */ 438, 119, 119, 118, 118, 118, 117, 438, 268, 405,
156859 /* 200 */ 1548, 122, 122, 122, 122, 115, 379, 84, 375, 273,
156860 /* 210 */ 273, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156861 /* 220 */ 117, 438, 561, 123, 124, 114, 1192, 1192, 1032, 1035,
156862 /* 230 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 405, 467,
156863 /* 240 */ 1118, 1604, 448, 82, 1604, 460, 329, 81, 120, 120,
156864 /* 250 */ 120, 120, 119, 119, 118, 118, 118, 117, 438, 116,
156865 /* 260 */ 113, 218, 123, 124, 114, 1192, 1192, 1032, 1035, 1025,
156866 /* 270 */ 1025, 121, 121, 122, 122, 122, 122, 564, 542, 1519,
156867 /* 280 */ 877, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156868 /* 290 */ 117, 438, 118, 118, 118, 117, 438, 12, 197, 71,
156869 /* 300 */ 71, 1135, 122, 122, 122, 122, 384, 405, 428, 1168,
156870 /* 310 */ 398, 503, 531, 347, 1135, 166, 312, 1135, 1116, 878,
156871 /* 320 */ 120, 120, 120, 120, 119, 119, 118, 118, 118, 117,
156872 /* 330 */ 438, 123, 124, 114, 1192, 1192, 1032, 1035, 1025, 1025,
156873 /* 340 */ 121, 121, 122, 122, 122, 122, 1168, 267, 267, 120,
156874 /* 350 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 438,
156875 /* 360 */ 561, 378, 1012, 1135, 1168, 1169, 1170, 240, 530, 563,
156876 /* 370 */ 499, 496, 495, 426, 538, 476, 1135, 1527, 1003, 1135,
156877 /* 380 */ 494, 6, 1002, 1392, 502, 1022, 1022, 1033, 1036, 120,
156878 /* 390 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 438,
156879 /* 400 */ 425, 1168, 1169, 1170, 1096, 1460, 259, 276, 355, 505,
156880 /* 410 */ 350, 504, 245, 405, 1002, 1002, 1004, 343, 346, 1097,
156881 /* 420 */ 240, 460, 329, 499, 496, 495, 369, 510, 1526, 357,
156882 /* 430 */ 529, 358, 6, 494, 1098, 450, 203, 123, 124, 114,
156883 /* 440 */ 1192, 1192, 1032, 1035, 1025, 1025, 121, 121, 122, 122,
156884 /* 450 */ 122, 122, 520, 419, 1168, 897, 405, 569, 1026, 1220,
156885 /* 460 */ 500, 319, 1270, 992, 305, 898, 138, 188, 1287, 423,
156886 /* 470 */ 1266, 167, 486, 1300, 16, 16, 144, 857, 1287, 1269,
156887 /* 480 */ 123, 124, 114, 1192, 1192, 1032, 1035, 1025, 1025, 121,
156888 /* 490 */ 121, 122, 122, 122, 122, 120, 120, 120, 120, 119,
156889 /* 500 */ 119, 118, 118, 118, 117, 438, 526, 273, 273, 1168,
156890 /* 510 */ 1169, 1170, 1392, 564, 166, 327, 1495, 1012, 414, 372,
156891 /* 520 */ 561, 486, 316, 1168, 318, 405, 304, 555, 373, 861,
156892 /* 530 */ 182, 216, 857, 1003, 228, 72, 72, 1002, 120, 120,
156893 /* 540 */ 120, 120, 119, 119, 118, 118, 118, 117, 438, 123,
156894 /* 550 */ 124, 114, 1192, 1192, 1032, 1035, 1025, 1025, 121, 121,
156895 /* 560 */ 122, 122, 122, 122, 405, 1459, 442, 1168, 854, 1002,
156896 /* 570 */ 1002, 1004, 300, 1524, 116, 113, 218, 6, 1168, 1169,
156897 /* 580 */ 1170, 183, 420, 116, 113, 218, 1168, 314, 123, 124,
156898 /* 590 */ 114, 1192, 1192, 1032, 1035, 1025, 1025, 121, 121, 122,
156899 /* 600 */ 122, 122, 122, 1465, 317, 943, 469, 120, 120, 120,
156900 /* 610 */ 120, 119, 119, 118, 118, 118, 117, 438, 1168, 211,
156901 /* 620 */ 1465, 1467, 1168, 1169, 1170, 917, 539, 1526, 475, 1168,
156902 /* 630 */ 916, 6, 1168, 405, 922, 435, 434, 1153, 213, 509,
156903 /* 640 */ 32, 1168, 1169, 1170, 279, 5, 120, 120, 120, 120,
156904 /* 650 */ 119, 119, 118, 118, 118, 117, 438, 123, 124, 114,
156905 /* 660 */ 1192, 1192, 1032, 1035, 1025, 1025, 121, 121, 122, 122,
156906 /* 670 */ 122, 122, 405, 1168, 1169, 1170, 1013, 1168, 273, 273,
156907 /* 680 */ 286, 1199, 1168, 1199, 1168, 1169, 1170, 1168, 1169, 1170,
156908 /* 690 */ 564, 561, 167, 1465, 117, 438, 123, 124, 114, 1192,
156909 /* 700 */ 1192, 1032, 1035, 1025, 1025, 121, 121, 122, 122, 122,
156910 /* 710 */ 122, 942, 13, 13, 127, 120, 120, 120, 120, 119,
156911 /* 720 */ 119, 118, 118, 118, 117, 438, 285, 417, 564, 449,
156912 /* 730 */ 564, 1392, 1168, 1169, 1170, 1290, 1290, 1168, 1169, 1170,
156913 /* 740 */ 97, 405, 992, 1606, 391, 997, 486, 304, 555, 17,
156914 /* 750 */ 72, 72, 72, 72, 120, 120, 120, 120, 119, 119,
156915 /* 760 */ 118, 118, 118, 117, 438, 123, 124, 114, 1192, 1192,
156916 /* 770 */ 1032, 1035, 1025, 1025, 121, 121, 122, 122, 122, 122,
156917 /* 780 */ 405, 1216, 1, 1, 570, 2, 1220, 301, 415, 433,
156918 /* 790 */ 1299, 305, 839, 138, 327, 455, 315, 402, 401, 564,
156919 /* 800 */ 1300, 421, 3, 290, 123, 124, 114, 1192, 1192, 1032,
156920 /* 810 */ 1035, 1025, 1025, 121, 121, 122, 122, 122, 122, 377,
156921 /* 820 */ 564, 13, 13, 120, 120, 120, 120, 119, 119, 118,
156922 /* 830 */ 118, 118, 117, 438, 273, 273, 422, 273, 273, 1168,
156923 /* 840 */ 1304, 357, 13, 13, 1118, 1605, 12, 561, 1605, 405,
156924 /* 850 */ 561, 458, 561, 1168, 558, 558, 558, 424, 436, 436,
156925 /* 860 */ 436, 228, 120, 120, 120, 120, 119, 119, 118, 118,
156926 /* 870 */ 118, 117, 438, 123, 124, 114, 1192, 1192, 1032, 1035,
156927 /* 880 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 146, 197,
156928 /* 890 */ 414, 564, 1055, 442, 1168, 1169, 1170, 414, 469, 435,
156929 /* 900 */ 434, 404, 562, 247, 911, 911, 564, 1196, 1168, 1169,
156930 /* 910 */ 1170, 486, 1198, 72, 72, 491, 1507, 547, 102, 194,
156931 /* 920 */ 1197, 564, 1116, 294, 459, 294, 1298, 251, 72, 72,
156932 /* 930 */ 1452, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156933 /* 940 */ 117, 438, 244, 56, 56, 1199, 564, 1199, 564, 1238,
156934 /* 950 */ 437, 273, 273, 564, 514, 1295, 564, 512, 564, 282,
156935 /* 960 */ 273, 273, 1189, 517, 561, 546, 284, 341, 52, 52,
156936 /* 970 */ 13, 13, 289, 561, 548, 13, 13, 564, 13, 13,
156937 /* 980 */ 13, 13, 549, 273, 273, 293, 1407, 105, 273, 273,
156938 /* 990 */ 191, 273, 273, 192, 444, 543, 561, 273, 273, 57,
156939 /* 1000 */ 57, 561, 274, 274, 561, 513, 1504, 405, 270, 410,
156940 /* 1010 */ 561, 941, 198, 304, 555, 561, 273, 273, 1189, 106,
156941 /* 1020 */ 409, 104, 356, 1545, 307, 346, 564, 405, 336, 561,
156942 /* 1030 */ 339, 123, 124, 114, 1192, 1192, 1032, 1035, 1025, 1025,
156943 /* 1040 */ 121, 121, 122, 122, 122, 122, 469, 405, 15, 15,
156944 /* 1050 */ 475, 123, 124, 114, 1192, 1192, 1032, 1035, 1025, 1025,
156945 /* 1060 */ 121, 121, 122, 122, 122, 122, 1080, 1080, 483, 358,
156946 /* 1070 */ 475, 123, 112, 114, 1192, 1192, 1032, 1035, 1025, 1025,
156947 /* 1080 */ 121, 121, 122, 122, 122, 122, 390, 1212, 308, 120,
156948 /* 1090 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 438,
156949 /* 1100 */ 99, 217, 480, 1172, 1406, 564, 477, 430, 541, 120,
156950 /* 1110 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 438,
156951 /* 1120 */ 291, 1077, 564, 1392, 564, 1077, 941, 44, 44, 120,
156952 /* 1130 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 438,
156953 /* 1140 */ 356, 1545, 537, 1096, 58, 58, 45, 45, 326, 405,
156954 /* 1150 */ 1135, 827, 828, 829, 243, 242, 241, 481, 1097, 1172,
156955 /* 1160 */ 1392, 536, 311, 1135, 1213, 486, 1135, 564, 292, 405,
156956 /* 1170 */ 1146, 1241, 411, 1098, 124, 114, 1192, 1192, 1032, 1035,
156957 /* 1180 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 564, 59,
156958 /* 1190 */ 59, 564, 507, 482, 552, 114, 1192, 1192, 1032, 1035,
156959 /* 1200 */ 1025, 1025, 121, 121, 122, 122, 122, 122, 1525, 334,
156960 /* 1210 */ 60, 60, 6, 61, 61, 390, 1117, 1523, 917, 1520,
156961 /* 1220 */ 1146, 6, 564, 916, 564, 109, 556, 564, 4, 941,
156962 /* 1230 */ 431, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156963 /* 1240 */ 117, 438, 559, 864, 62, 62, 63, 63, 564, 46,
156964 /* 1250 */ 46, 120, 120, 120, 120, 119, 119, 118, 118, 118,
156965 /* 1260 */ 117, 438, 564, 1135, 1522, 439, 1323, 564, 6, 564,
156966 /* 1270 */ 47, 47, 564, 557, 411, 1268, 1135, 553, 142, 1135,
156967 /* 1280 */ 564, 465, 304, 555, 48, 48, 564, 167, 544, 50,
156968 /* 1290 */ 50, 51, 51, 1213, 64, 64, 956, 109, 556, 864,
156969 /* 1300 */ 4, 564, 65, 65, 957, 1012, 564, 140, 66, 66,
156970 /* 1310 */ 564, 107, 107, 564, 559, 849, 205, 564, 108, 217,
156971 /* 1320 */ 439, 566, 565, 14, 14, 1002, 8, 523, 67, 67,
156972 /* 1330 */ 564, 452, 129, 129, 221, 68, 68, 439, 453, 53,
156973 /* 1340 */ 53, 403, 304, 555, 941, 412, 168, 211, 403, 553,
156974 /* 1350 */ 111, 1188, 69, 69, 99, 462, 244, 1002, 1002, 1004,
156975 /* 1360 */ 1005, 27, 466, 533, 564, 403, 564, 1336, 532, 272,
156976 /* 1370 */ 215, 849, 403, 564, 85, 202, 564, 1012, 564, 1207,
156977 /* 1380 */ 564, 303, 564, 107, 107, 564, 70, 70, 54, 54,
156978 /* 1390 */ 108, 403, 439, 566, 565, 153, 153, 1002, 154, 154,
156979 /* 1400 */ 77, 77, 55, 55, 73, 73, 1113, 130, 130, 392,
156980 /* 1410 */ 109, 556, 143, 4, 38, 564, 473, 299, 564, 461,
156981 /* 1420 */ 225, 1335, 524, 410, 30, 876, 875, 559, 454, 1002,
156982 /* 1430 */ 1002, 1004, 1005, 27, 1550, 1157, 441, 74, 74, 277,
156983 /* 1440 */ 131, 131, 324, 1510, 388, 388, 387, 262, 385, 564,
156984 /* 1450 */ 439, 836, 868, 320, 463, 31, 564, 883, 884, 354,
156985 /* 1460 */ 325, 206, 553, 99, 222, 206, 310, 544, 1539, 353,
156986 /* 1470 */ 994, 132, 132, 250, 309, 1484, 533, 287, 128, 128,
156987 /* 1480 */ 1062, 534, 109, 556, 468, 4, 564, 250, 1483, 470,
156988 /* 1490 */ 1012, 564, 250, 275, 564, 330, 107, 107, 99, 559,
156989 /* 1500 */ 1074, 564, 1074, 108, 224, 439, 566, 565, 152, 152,
156990 /* 1510 */ 1002, 474, 158, 151, 151, 160, 136, 136, 492, 959,
156991 /* 1520 */ 960, 246, 439, 135, 135, 344, 478, 564, 99, 1058,
156992 /* 1530 */ 487, 223, 246, 564, 553, 227, 1062, 950, 914, 1006,
156993 /* 1540 */ 250, 111, 1002, 1002, 1004, 1005, 27, 331, 533, 133,
156994 /* 1550 */ 133, 564, 1073, 532, 1073, 134, 134, 847, 915, 1332,
156995 /* 1560 */ 141, 111, 1012, 335, 338, 406, 340, 342, 107, 107,
156996 /* 1570 */ 304, 555, 1283, 76, 76, 108, 564, 439, 566, 565,
156997 /* 1580 */ 1157, 441, 1002, 564, 277, 109, 556, 551, 4, 388,
156998 /* 1590 */ 388, 387, 262, 385, 446, 1006, 836, 1267, 78, 78,
156999 /* 1600 */ 349, 564, 559, 359, 564, 75, 75, 360, 1330, 222,
157000 /* 1610 */ 1564, 310, 1344, 1391, 1002, 1002, 1004, 1005, 27, 309,
157001 /* 1620 */ 1319, 550, 1397, 43, 43, 439, 49, 49, 1248, 1240,
157002 /* 1630 */ 1229, 1228, 1230, 1558, 265, 1316, 200, 553, 362, 364,
157003 /* 1640 */ 366, 389, 11, 208, 1373, 220, 1378, 280, 1366, 224,
157004 /* 1650 */ 451, 322, 472, 328, 283, 1561, 1266, 158, 323, 1383,
157005 /* 1660 */ 160, 1382, 288, 368, 497, 1012, 352, 396, 382, 212,
157006 /* 1670 */ 1456, 107, 107, 921, 1455, 1207, 223, 254, 108, 1503,
157007 /* 1680 */ 439, 566, 565, 1501, 1204, 1002, 413, 204, 207, 84,
157008 /* 1690 */ 195, 109, 556, 1379, 4, 554, 180, 196, 170, 80,
157009 /* 1700 */ 164, 456, 175, 1461, 172, 83, 176, 457, 559, 177,
157010 /* 1710 */ 406, 178, 35, 490, 230, 304, 555, 1002, 1002, 1004,
157011 /* 1720 */ 1005, 27, 97, 394, 1385, 1384, 464, 1387, 184, 397,
157012 /* 1730 */ 36, 439, 1450, 479, 90, 485, 189, 234, 236, 446,
157013 /* 1740 */ 1472, 266, 488, 553, 337, 333, 237, 399, 1231, 238,
157014 /* 1750 */ 506, 1286, 427, 92, 1277, 868, 1276, 1285, 213, 101,
157015 /* 1760 */ 556, 429, 4, 1284, 1255, 1575, 1574, 525, 1256, 400,
157016 /* 1770 */ 351, 1012, 1254, 1573, 1544, 96, 559, 107, 107, 516,
157017 /* 1780 */ 519, 297, 298, 1327, 108, 361, 439, 566, 565, 1328,
157018 /* 1790 */ 252, 1002, 253, 432, 1530, 126, 1529, 544, 10, 439,
157019 /* 1800 */ 1436, 376, 528, 103, 98, 260, 1237, 34, 567, 1163,
157020 /* 1810 */ 374, 553, 1326, 363, 199, 1309, 365, 1308, 1325, 380,
157021 /* 1820 */ 367, 261, 381, 1002, 1002, 1004, 1005, 27, 1351, 1350,
157022 /* 1830 */ 263, 264, 568, 1226, 1221, 155, 1488, 1489, 1487, 1012,
157023 /* 1840 */ 139, 156, 1486, 79, 295, 107, 107, 302, 823, 440,
157024 /* 1850 */ 209, 210, 108, 201, 439, 566, 565, 306, 157, 1002,
157025 /* 1860 */ 219, 277, 278, 137, 1072, 1070, 388, 388, 387, 262,
157026 /* 1870 */ 385, 313, 407, 836, 171, 159, 408, 169, 1188, 226,
157027 /* 1880 */ 900, 173, 321, 1086, 229, 179, 222, 161, 310, 162,
157028 /* 1890 */ 416, 1002, 1002, 1004, 1005, 27, 309, 181, 418, 163,
157029 /* 1900 */ 1089, 86, 87, 88, 89, 231, 232, 1085, 148, 18,
157030 /* 1910 */ 233, 332, 250, 1201, 484, 186, 235, 37, 838, 489,
157031 /* 1920 */ 353, 1078, 185, 239, 187, 493, 224, 91, 866, 19,
157032 /* 1930 */ 498, 345, 20, 348, 158, 501, 93, 160, 165, 879,
157033 /* 1940 */ 149, 296, 94, 508, 95, 1151, 150, 1038, 1121, 39,
157034 /* 1950 */ 515, 1122, 40, 223, 214, 518, 269, 271, 190, 944,
157035 /* 1960 */ 1137, 111, 1139, 249, 1141, 1145, 21, 1125, 1144, 33,
157036 /* 1970 */ 540, 949, 22, 23, 24, 25, 193, 99, 1053, 26,
157037 /* 1980 */ 1039, 7, 1037, 1041, 1095, 1042, 1094, 406, 255, 256,
157038 /* 1990 */ 28, 41, 304, 555, 1007, 848, 560, 110, 29, 386,
157039 /* 2000 */ 910, 257, 383, 258, 1566, 1159, 1158, 1565, 1217, 1217,
157040 /* 2010 */ 1217, 1217, 1217, 1217, 1217, 1217, 446,
157041 };
157042 static const YYCODETYPE yy_lookahead[] = {
157043 /* 0 */ 190, 212, 190, 190, 211, 190, 212, 190, 270, 271,
157044 /* 10 */ 272, 190, 219, 190, 190, 202, 270, 271, 272, 19,
157045 /* 20 */ 190, 190, 212, 213, 212, 213, 190, 212, 213, 212,
157046 /* 30 */ 213, 31, 212, 212, 213, 212, 213, 291, 23, 39,
157047 /* 40 */ 22, 26, 24, 43, 44, 45, 46, 47, 48, 49,
157048 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 234, 19,
157049 /* 60 */ 190, 184, 185, 186, 187, 226, 249, 237, 237, 192,
157050 /* 70 */ 249, 194, 249, 231, 232, 258, 190, 59, 201, 258,
157051 /* 80 */ 201, 258, 81, 43, 44, 45, 46, 47, 48, 49,
157052 /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 212, 213,
157053 /* 100 */ 264, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157054 /* 110 */ 110, 111, 235, 236, 235, 236, 292, 59, 308, 309,
157055 /* 120 */ 308, 59, 310, 308, 309, 248, 86, 248, 88, 19,
157056 /* 130 */ 11, 252, 253, 115, 72, 249, 26, 136, 137, 262,
157057 /* 140 */ 111, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157058 /* 150 */ 110, 111, 190, 43, 44, 45, 46, 47, 48, 49,
157059 /* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 190, 207,
157060 /* 170 */ 208, 294, 114, 115, 116, 201, 114, 115, 116, 69,
157061 /* 180 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157062 /* 190 */ 111, 105, 106, 107, 108, 109, 110, 111, 209, 19,
157063 /* 200 */ 190, 54, 55, 56, 57, 58, 245, 149, 247, 235,
157064 /* 210 */ 236, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157065 /* 220 */ 110, 111, 248, 43, 44, 45, 46, 47, 48, 49,
157066 /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 265,
157067 /* 240 */ 22, 23, 280, 24, 26, 126, 127, 67, 101, 102,
157068 /* 250 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 270,
157069 /* 260 */ 271, 272, 43, 44, 45, 46, 47, 48, 49, 50,
157070 /* 270 */ 51, 52, 53, 54, 55, 56, 57, 190, 300, 301,
157071 /* 280 */ 35, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157072 /* 290 */ 110, 111, 107, 108, 109, 110, 111, 209, 190, 212,
157073 /* 300 */ 213, 76, 54, 55, 56, 57, 198, 19, 19, 59,
157074 /* 310 */ 202, 66, 87, 24, 89, 190, 190, 92, 100, 74,
157075 /* 320 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157076 /* 330 */ 111, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157077 /* 340 */ 52, 53, 54, 55, 56, 57, 59, 235, 236, 101,
157078 /* 350 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157079 /* 360 */ 248, 274, 99, 76, 114, 115, 116, 117, 143, 190,
157080 /* 370 */ 120, 121, 122, 128, 87, 287, 89, 303, 115, 92,
157081 /* 380 */ 130, 307, 119, 190, 95, 46, 47, 48, 49, 101,
157082 /* 390 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157083 /* 400 */ 111, 114, 115, 116, 12, 279, 117, 118, 119, 120,
157084 /* 410 */ 121, 122, 123, 19, 151, 152, 153, 23, 129, 27,
157085 /* 420 */ 117, 126, 127, 120, 121, 122, 190, 302, 303, 190,
157086 /* 430 */ 143, 190, 307, 130, 42, 265, 148, 43, 44, 45,
157087 /* 440 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
157088 /* 450 */ 56, 57, 190, 260, 59, 63, 19, 185, 119, 187,
157089 /* 460 */ 23, 16, 222, 73, 192, 73, 194, 72, 219, 228,
157090 /* 470 */ 221, 81, 190, 201, 212, 213, 237, 59, 229, 222,
157091 /* 480 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
157092 /* 490 */ 53, 54, 55, 56, 57, 101, 102, 103, 104, 105,
157093 /* 500 */ 106, 107, 108, 109, 110, 111, 190, 235, 236, 114,
157094 /* 510 */ 115, 116, 190, 190, 190, 125, 234, 99, 190, 215,
157095 /* 520 */ 248, 190, 77, 59, 79, 19, 136, 137, 215, 23,
157096 /* 530 */ 22, 190, 114, 115, 262, 212, 213, 119, 101, 102,
157097 /* 540 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 43,
157098 /* 550 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
157099 /* 560 */ 54, 55, 56, 57, 19, 234, 294, 59, 23, 151,
157100 /* 570 */ 152, 153, 249, 303, 270, 271, 272, 307, 114, 115,
157101 /* 580 */ 116, 22, 260, 270, 271, 272, 59, 259, 43, 44,
157102 /* 590 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
157103 /* 600 */ 55, 56, 57, 190, 159, 141, 190, 101, 102, 103,
157104 /* 610 */ 104, 105, 106, 107, 108, 109, 110, 111, 59, 26,
157105 /* 620 */ 207, 208, 114, 115, 116, 133, 302, 303, 190, 59,
157106 /* 630 */ 138, 307, 59, 19, 107, 105, 106, 23, 163, 164,
157107 /* 640 */ 22, 114, 115, 116, 201, 22, 101, 102, 103, 104,
157108 /* 650 */ 105, 106, 107, 108, 109, 110, 111, 43, 44, 45,
157109 /* 660 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
157110 /* 670 */ 56, 57, 19, 114, 115, 116, 23, 59, 235, 236,
157111 /* 680 */ 264, 151, 59, 153, 114, 115, 116, 114, 115, 116,
157112 /* 690 */ 190, 248, 81, 280, 110, 111, 43, 44, 45, 46,
157113 /* 700 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
157114 /* 710 */ 57, 141, 212, 213, 22, 101, 102, 103, 104, 105,
157115 /* 720 */ 106, 107, 108, 109, 110, 111, 288, 227, 190, 118,
157116 /* 730 */ 190, 190, 114, 115, 116, 231, 232, 114, 115, 116,
157117 /* 740 */ 147, 19, 73, 297, 298, 23, 190, 136, 137, 22,
157118 /* 750 */ 212, 213, 212, 213, 101, 102, 103, 104, 105, 106,
157119 /* 760 */ 107, 108, 109, 110, 111, 43, 44, 45, 46, 47,
157120 /* 770 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
157121 /* 780 */ 19, 182, 183, 184, 185, 186, 187, 249, 61, 249,
157122 /* 790 */ 234, 192, 21, 194, 125, 126, 127, 105, 106, 190,
157123 /* 800 */ 201, 260, 22, 201, 43, 44, 45, 46, 47, 48,
157124 /* 810 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 190,
157125 /* 820 */ 190, 212, 213, 101, 102, 103, 104, 105, 106, 107,
157126 /* 830 */ 108, 109, 110, 111, 235, 236, 227, 235, 236, 59,
157127 /* 840 */ 236, 190, 212, 213, 22, 23, 209, 248, 26, 19,
157128 /* 850 */ 248, 80, 248, 59, 206, 207, 208, 227, 206, 207,
157129 /* 860 */ 208, 262, 101, 102, 103, 104, 105, 106, 107, 108,
157130 /* 870 */ 109, 110, 111, 43, 44, 45, 46, 47, 48, 49,
157131 /* 880 */ 50, 51, 52, 53, 54, 55, 56, 57, 237, 190,
157132 /* 890 */ 190, 190, 121, 294, 114, 115, 116, 190, 190, 105,
157133 /* 900 */ 106, 202, 132, 26, 134, 135, 190, 113, 114, 115,
157134 /* 910 */ 116, 190, 118, 212, 213, 19, 190, 201, 157, 282,
157135 /* 920 */ 126, 190, 100, 224, 287, 226, 201, 24, 212, 213,
157136 /* 930 */ 159, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157137 /* 940 */ 110, 111, 46, 212, 213, 151, 190, 153, 190, 201,
157138 /* 950 */ 249, 235, 236, 190, 201, 234, 190, 201, 190, 259,
157139 /* 960 */ 235, 236, 59, 201, 248, 249, 259, 16, 212, 213,
157140 /* 970 */ 212, 213, 264, 248, 258, 212, 213, 190, 212, 213,
157141 /* 980 */ 212, 213, 201, 235, 236, 227, 269, 157, 235, 236,
157142 /* 990 */ 227, 235, 236, 227, 190, 227, 248, 235, 236, 212,
157143 /* 1000 */ 213, 248, 235, 236, 248, 249, 190, 19, 23, 113,
157144 /* 1010 */ 248, 26, 24, 136, 137, 248, 235, 236, 115, 156,
157145 /* 1020 */ 195, 158, 305, 306, 190, 129, 190, 19, 77, 248,
157146 /* 1030 */ 79, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157147 /* 1040 */ 52, 53, 54, 55, 56, 57, 190, 19, 212, 213,
157148 /* 1050 */ 190, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157149 /* 1060 */ 52, 53, 54, 55, 56, 57, 125, 126, 127, 190,
157150 /* 1070 */ 190, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157151 /* 1080 */ 52, 53, 54, 55, 56, 57, 22, 23, 190, 101,
157152 /* 1090 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157153 /* 1100 */ 26, 116, 277, 59, 269, 190, 281, 228, 190, 101,
157154 /* 1110 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157155 /* 1120 */ 264, 29, 190, 190, 190, 33, 141, 212, 213, 101,
157156 /* 1130 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157157 /* 1140 */ 305, 306, 66, 12, 212, 213, 212, 213, 288, 19,
157158 /* 1150 */ 76, 7, 8, 9, 125, 126, 127, 65, 27, 115,
157159 /* 1160 */ 190, 85, 190, 89, 100, 190, 92, 190, 288, 19,
157160 /* 1170 */ 94, 204, 205, 42, 44, 45, 46, 47, 48, 49,
157161 /* 1180 */ 50, 51, 52, 53, 54, 55, 56, 57, 190, 212,
157162 /* 1190 */ 213, 190, 107, 260, 63, 45, 46, 47, 48, 49,
157163 /* 1200 */ 50, 51, 52, 53, 54, 55, 56, 57, 303, 234,
157164 /* 1210 */ 212, 213, 307, 212, 213, 22, 23, 303, 133, 301,
157165 /* 1220 */ 144, 307, 190, 138, 190, 19, 20, 190, 22, 26,
157166 /* 1230 */ 260, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157167 /* 1240 */ 110, 111, 36, 59, 212, 213, 212, 213, 190, 212,
157168 /* 1250 */ 213, 101, 102, 103, 104, 105, 106, 107, 108, 109,
157169 /* 1260 */ 110, 111, 190, 76, 303, 59, 254, 190, 307, 190,
157170 /* 1270 */ 212, 213, 190, 204, 205, 222, 89, 71, 22, 92,
157171 /* 1280 */ 190, 113, 136, 137, 212, 213, 190, 81, 143, 212,
157172 /* 1290 */ 213, 212, 213, 100, 212, 213, 31, 19, 20, 115,
157173 /* 1300 */ 22, 190, 212, 213, 39, 99, 190, 162, 212, 213,
157174 /* 1310 */ 190, 105, 106, 190, 36, 59, 148, 190, 112, 116,
157175 /* 1320 */ 114, 115, 116, 212, 213, 119, 48, 19, 212, 213,
157176 /* 1330 */ 190, 240, 212, 213, 15, 212, 213, 59, 240, 212,
157177 /* 1340 */ 213, 250, 136, 137, 141, 295, 296, 26, 250, 71,
157178 /* 1350 */ 26, 26, 212, 213, 26, 240, 46, 151, 152, 153,
157179 /* 1360 */ 154, 155, 240, 85, 190, 250, 190, 190, 90, 252,
157180 /* 1370 */ 253, 115, 250, 190, 147, 148, 190, 99, 190, 60,
157181 /* 1380 */ 190, 240, 190, 105, 106, 190, 212, 213, 212, 213,
157182 /* 1390 */ 112, 250, 114, 115, 116, 212, 213, 119, 212, 213,
157183 /* 1400 */ 212, 213, 212, 213, 212, 213, 23, 212, 213, 26,
157184 /* 1410 */ 19, 20, 22, 22, 24, 190, 19, 251, 190, 127,
157185 /* 1420 */ 24, 190, 114, 113, 22, 118, 119, 36, 190, 151,
157186 /* 1430 */ 152, 153, 154, 155, 0, 1, 2, 212, 213, 5,
157187 /* 1440 */ 212, 213, 150, 190, 10, 11, 12, 13, 14, 190,
157188 /* 1450 */ 59, 17, 124, 190, 127, 53, 190, 7, 8, 119,
157189 /* 1460 */ 23, 140, 71, 26, 30, 140, 32, 143, 312, 129,
157190 /* 1470 */ 23, 212, 213, 26, 40, 190, 85, 150, 212, 213,
157191 /* 1480 */ 59, 90, 19, 20, 23, 22, 190, 26, 190, 23,
157192 /* 1490 */ 99, 190, 26, 22, 190, 23, 105, 106, 26, 36,
157193 /* 1500 */ 151, 190, 153, 112, 70, 114, 115, 116, 212, 213,
157194 /* 1510 */ 119, 114, 78, 212, 213, 81, 212, 213, 23, 83,
157195 /* 1520 */ 84, 26, 59, 212, 213, 23, 190, 190, 26, 23,
157196 /* 1530 */ 284, 97, 26, 190, 71, 139, 115, 23, 23, 59,
157197 /* 1540 */ 26, 26, 151, 152, 153, 154, 155, 190, 85, 212,
157198 /* 1550 */ 213, 190, 151, 90, 153, 212, 213, 23, 23, 190,
157199 /* 1560 */ 26, 26, 99, 190, 190, 131, 190, 190, 105, 106,
157200 /* 1570 */ 136, 137, 190, 212, 213, 112, 190, 114, 115, 116,
157201 /* 1580 */ 1, 2, 119, 190, 5, 19, 20, 232, 22, 10,
157202 /* 1590 */ 11, 12, 13, 14, 160, 115, 17, 190, 212, 213,
157203 /* 1600 */ 190, 190, 36, 190, 190, 212, 213, 190, 190, 30,
157204 /* 1610 */ 139, 32, 190, 190, 151, 152, 153, 154, 155, 40,
157205 /* 1620 */ 190, 190, 190, 212, 213, 59, 212, 213, 190, 190,
157206 /* 1630 */ 190, 190, 190, 190, 283, 251, 238, 71, 251, 251,
157207 /* 1640 */ 251, 188, 239, 210, 263, 293, 267, 241, 263, 70,
157208 /* 1650 */ 255, 289, 289, 241, 255, 193, 221, 78, 242, 267,
157209 /* 1660 */ 81, 267, 242, 255, 216, 99, 215, 267, 241, 225,
157210 /* 1670 */ 215, 105, 106, 107, 215, 60, 97, 139, 112, 197,
157211 /* 1680 */ 114, 115, 116, 197, 38, 119, 197, 148, 239, 149,
157212 /* 1690 */ 245, 19, 20, 268, 22, 276, 22, 245, 293, 290,
157213 /* 1700 */ 43, 18, 233, 279, 230, 290, 233, 197, 36, 233,
157214 /* 1710 */ 131, 233, 266, 18, 196, 136, 137, 151, 152, 153,
157215 /* 1720 */ 154, 155, 147, 242, 268, 268, 242, 230, 230, 242,
157216 /* 1730 */ 266, 59, 242, 197, 156, 62, 22, 196, 196, 160,
157217 /* 1740 */ 286, 197, 217, 71, 197, 285, 196, 217, 197, 196,
157218 /* 1750 */ 113, 214, 64, 22, 223, 124, 223, 214, 163, 19,
157219 /* 1760 */ 20, 111, 22, 214, 216, 220, 220, 142, 214, 217,
157220 /* 1770 */ 214, 99, 214, 214, 306, 113, 36, 105, 106, 217,
157221 /* 1780 */ 217, 278, 278, 257, 112, 256, 114, 115, 116, 257,
157222 /* 1790 */ 197, 119, 91, 82, 311, 146, 311, 143, 22, 59,
157223 /* 1800 */ 273, 197, 144, 156, 145, 25, 200, 26, 199, 13,
157224 /* 1810 */ 245, 71, 257, 256, 244, 246, 256, 246, 257, 243,
157225 /* 1820 */ 256, 191, 242, 151, 152, 153, 154, 155, 261, 261,
157226 /* 1830 */ 191, 6, 189, 189, 189, 203, 209, 209, 209, 99,
157227 /* 1840 */ 218, 203, 209, 209, 218, 105, 106, 275, 4, 3,
157228 /* 1850 */ 210, 210, 112, 22, 114, 115, 116, 161, 203, 119,
157229 /* 1860 */ 15, 5, 98, 16, 23, 23, 10, 11, 12, 13,
157230 /* 1870 */ 14, 137, 299, 17, 149, 128, 299, 296, 26, 24,
157231 /* 1880 */ 20, 140, 16, 1, 142, 140, 30, 128, 32, 128,
157232 /* 1890 */ 61, 151, 152, 153, 154, 155, 40, 149, 37, 128,
157233 /* 1900 */ 114, 53, 53, 53, 53, 34, 139, 1, 5, 22,
157234 /* 1910 */ 113, 159, 26, 75, 41, 113, 139, 24, 20, 19,
157235 /* 1920 */ 129, 68, 68, 123, 22, 67, 70, 22, 59, 22,
157236 /* 1930 */ 67, 23, 22, 24, 78, 96, 22, 81, 37, 28,
157237 /* 1940 */ 23, 67, 147, 22, 26, 23, 23, 23, 23, 22,
157238 /* 1950 */ 24, 23, 22, 97, 139, 24, 23, 23, 22, 141,
157239 /* 1960 */ 88, 26, 86, 34, 75, 75, 34, 23, 93, 22,
157240 /* 1970 */ 24, 114, 34, 34, 34, 34, 26, 26, 23, 34,
157241 /* 1980 */ 23, 44, 23, 23, 23, 11, 23, 131, 26, 22,
157242 /* 1990 */ 22, 22, 136, 137, 23, 23, 26, 22, 22, 15,
157243 /* 2000 */ 133, 139, 23, 139, 139, 1, 1, 139, 313, 313,
157244 /* 2010 */ 313, 313, 313, 313, 313, 313, 160, 313, 313, 313,
157245 /* 2020 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157246 /* 2030 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157247 /* 2040 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157248 /* 2050 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157249 /* 2060 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157250 /* 2070 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157251 /* 2080 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157252 /* 2090 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157253 /* 2100 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157254 /* 2110 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157255 /* 2120 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157256 /* 2130 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157257 /* 2140 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157258 /* 2150 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157259 /* 2160 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157260 /* 2170 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157261 /* 2180 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313,
157262 /* 2190 */ 182, 182, 182, 182, 182, 182, 182, 182, 182,
157263 };
157264 #define YY_SHIFT_COUNT (570)
 
157265 #define YY_SHIFT_MIN (0)
157266 #define YY_SHIFT_MAX (2005)
157267 static const unsigned short int yy_shift_ofst[] = {
157268 /* 0 */ 1579, 1434, 1856, 1206, 1206, 1, 1278, 1391, 1463, 1672,
157269 /* 10 */ 1672, 1672, 390, 0, 0, 180, 1008, 1672, 1672, 1672,
157270 /* 20 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672,
157271 /* 30 */ 794, 794, 287, 287, 250, 611, 1, 1, 1, 1,
157272 /* 40 */ 1, 1, 40, 110, 219, 288, 394, 437, 506, 545,
157273 /* 50 */ 614, 653, 722, 761, 830, 988, 1008, 1008, 1008, 1008,
157274 /* 60 */ 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008,
157275 /* 70 */ 1008, 1008, 1008, 1008, 1028, 1008, 1130, 1150, 1150, 1566,
157276 /* 80 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672,
157277 /* 90 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672,
157278 /* 100 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672,
157279 /* 110 */ 1672, 1672, 1672, 1672, 1740, 1672, 1672, 1672, 1672, 1672,
157280 /* 120 */ 1672, 1672, 1672, 1672, 1672, 1672, 1672, 1672, 147, 248,
157281 /* 130 */ 248, 248, 248, 248, 79, 86, 185, 573, 771, 896,
157282 /* 140 */ 573, 530, 530, 573, 877, 877, 877, 877, 295, 475,
157283 /* 150 */ 475, 584, 29, 2017, 2017, 289, 289, 289, 58, 508,
157284 /* 160 */ 62, 508, 508, 508, 392, 392, 225, 395, 218, 822,
157285 /* 170 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
157286 /* 180 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
157287 /* 190 */ 573, 1074, 1074, 573, 119, 1187, 1187, 1044, 1044, 1145,
157288 /* 200 */ 1146, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 418, 263,
157289 /* 210 */ 263, 559, 303, 618, 527, 623, 464, 570, 780, 573,
157290 /* 220 */ 573, 573, 573, 573, 573, 573, 573, 573, 669, 573,
157291 /* 230 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
157292 /* 240 */ 573, 245, 245, 245, 573, 573, 573, 573, 985, 573,
157293 /* 250 */ 573, 573, 18, 1076, 573, 573, 1131, 573, 573, 573,
157294 /* 260 */ 573, 573, 573, 573, 573, 941, 1092, 770, 903, 903,
157295 /* 270 */ 903, 903, 1203, 770, 770, 1085, 692, 1144, 1319, 1168,
157296 /* 280 */ 1227, 1321, 1308, 1227, 1308, 1397, 593, 1168, 1168, 593,
157297 /* 290 */ 1168, 1321, 1397, 1328, 15, 1310, 1265, 1265, 1265, 1308,
157298 /* 300 */ 1324, 1324, 863, 1325, 492, 1390, 1615, 1538, 1538, 1646,
157299 /* 310 */ 1646, 1538, 1540, 1539, 1674, 1657, 1683, 1683, 1683, 1683,
157300 /* 320 */ 1538, 1695, 1575, 1539, 1539, 1575, 1674, 1657, 1575, 1657,
157301 /* 330 */ 1575, 1538, 1695, 1578, 1673, 1538, 1695, 1714, 1538, 1695,
157302 /* 340 */ 1538, 1695, 1714, 1637, 1637, 1637, 1688, 1731, 1731, 1714,
157303 /* 350 */ 1637, 1631, 1637, 1688, 1637, 1637, 1595, 1714, 1650, 1650,
157304 /* 360 */ 1714, 1625, 1662, 1625, 1662, 1625, 1662, 1625, 1662, 1538,
157305 /* 370 */ 1701, 1701, 1711, 1711, 1649, 1654, 1776, 1538, 1647, 1649,
157306 /* 380 */ 1659, 1658, 1575, 1780, 1781, 1796, 1796, 1825, 1825, 1825,
157307 /* 390 */ 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
157308 /* 400 */ 2017, 2017, 2017, 2017, 2017, 339, 445, 1064, 1193, 951,
157309 /* 410 */ 1029, 1256, 1383, 1402, 1396, 1292, 1327, 1437, 727, 1447,
157310 /* 420 */ 1461, 1466, 1472, 1495, 1502, 1184, 1307, 1450, 1340, 1421,
157311 /* 430 */ 1506, 1514, 1436, 1515, 1349, 1401, 1534, 1535, 1480, 1471,
157312 /* 440 */ 1844, 1846, 1831, 1696, 1845, 1764, 1847, 1841, 1842, 1734,
157313 /* 450 */ 1725, 1747, 1852, 1852, 1855, 1741, 1860, 1742, 1866, 1882,
157314 /* 460 */ 1745, 1759, 1852, 1761, 1829, 1861, 1852, 1748, 1848, 1849,
157315 /* 470 */ 1850, 1851, 1771, 1786, 1871, 1767, 1906, 1903, 1887, 1797,
157316 /* 480 */ 1752, 1853, 1886, 1854, 1838, 1873, 1777, 1802, 1893, 1898,
157317 /* 490 */ 1900, 1791, 1800, 1902, 1858, 1905, 1907, 1908, 1910, 1863,
157318 /* 500 */ 1869, 1909, 1839, 1911, 1914, 1874, 1901, 1917, 1795, 1921,
157319 /* 510 */ 1922, 1923, 1924, 1918, 1925, 1927, 1926, 1928, 1930, 1931,
157320 /* 520 */ 1815, 1933, 1934, 1857, 1929, 1936, 1818, 1935, 1932, 1938,
157321 /* 530 */ 1939, 1940, 1872, 1889, 1876, 1937, 1890, 1875, 1941, 1944,
157322 /* 540 */ 1947, 1946, 1950, 1951, 1945, 1955, 1935, 1957, 1959, 1960,
157323 /* 550 */ 1961, 1962, 1963, 1967, 1974, 1968, 1969, 1971, 1972, 1975,
157324 /* 560 */ 1976, 1970, 1867, 1862, 1864, 1865, 1868, 1979, 1984, 2004,
157325 /* 570 */ 2005,
157326 };
157327 #define YY_REDUCE_COUNT (404)
157328 #define YY_REDUCE_MIN (-262)
157329 #define YY_REDUCE_MAX (1655)
157330 static const short yy_reduce_ofst[] = {
157331 /* 0 */ 599, -123, 272, 716, 756, -121, -190, -188, -185, -183,
157332 /* 10 */ -179, -177, -26, 304, 313, -254, -11, 500, 609, 630,
157333 /* 20 */ 758, -114, 763, 766, 323, 538, 768, 87, 540, 701,
157334 /* 30 */ -38, 413, 125, 324, 699, 443, 602, 725, 748, 753,
157335 /* 40 */ 762, 781, -262, -262, -262, -262, -262, -262, -262, -262,
157336 /* 50 */ -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,
157337 /* 60 */ -262, -262, -262, -262, -262, -262, -262, -262, -262, -262,
157338 /* 70 */ -262, -262, -262, -262, -262, -262, -262, -262, -262, 262,
157339 /* 80 */ 731, 787, 836, 915, 932, 934, 977, 998, 1001, 1032,
157340 /* 90 */ 1034, 1037, 1058, 1072, 1077, 1079, 1082, 1090, 1096, 1111,
157341 /* 100 */ 1116, 1120, 1123, 1127, 1140, 1174, 1176, 1183, 1186, 1188,
157342 /* 110 */ 1190, 1192, 1195, 1225, 1228, 1259, 1266, 1296, 1301, 1304,
157343 /* 120 */ 1311, 1337, 1343, 1361, 1386, 1393, 1411, 1414, -262, -262,
157344 /* 130 */ -262, -262, -262, -262, -262, -262, -262, -176, 825, 249,
157345 /* 140 */ -22, 648, 652, 108, 112, 767, 112, 767, 637, 717,
157346 /* 150 */ 835, -262, -262, -262, -262, -207, -207, -207, 126, -164,
157347 /* 160 */ -170, 416, 708, 856, -158, 504, 74, -169, 446, 446,
157348 /* 170 */ -187, 328, 700, 707, 239, 282, 331, 556, 721, 438,
157349 /* 180 */ 193, 860, 322, 541, 880, 933, 975, 241, 651, 879,
157350 /* 190 */ 970, 270, 905, 918, 88, 914, 961, 967, 1069, -39,
157351 /* 200 */ 604, 1050, 1091, 1098, 1115, 1122, 1117, 1141, -211, -206,
157352 /* 210 */ -180, -130, -161, 10, 179, 236, 316, 341, 629, 726,
157353 /* 220 */ 804, 816, 834, 898, 972, 1177, 1231, 1238, 170, 1253,
157354 /* 230 */ 1263, 1285, 1298, 1336, 1357, 1369, 1373, 1374, 1376, 1377,
157355 /* 240 */ 1382, 240, 257, 1053, 1407, 1410, 1413, 1417, 1012, 1422,
157356 /* 250 */ 1423, 1430, 1166, 1156, 1418, 1431, 1355, 1432, 179, 1438,
157357 /* 260 */ 1439, 1440, 1441, 1442, 1443, 1246, 1351, 1398, 1384, 1387,
157358 /* 270 */ 1388, 1389, 1012, 1398, 1398, 1403, 1433, 1453, 1352, 1379,
157359 /* 280 */ 1381, 1406, 1395, 1385, 1399, 1362, 1416, 1392, 1394, 1420,
157360 /* 290 */ 1400, 1412, 1363, 1448, 1444, 1435, 1451, 1455, 1459, 1408,
157361 /* 300 */ 1445, 1452, 1419, 1427, 1449, 1462, 1405, 1482, 1486, 1409,
157362 /* 310 */ 1415, 1489, 1424, 1425, 1446, 1474, 1469, 1473, 1476, 1478,
157363 /* 320 */ 1510, 1518, 1481, 1456, 1457, 1484, 1464, 1497, 1487, 1498,
157364 /* 330 */ 1490, 1536, 1541, 1454, 1460, 1544, 1542, 1525, 1547, 1550,
157365 /* 340 */ 1551, 1553, 1530, 1537, 1543, 1549, 1531, 1545, 1546, 1552,
157366 /* 350 */ 1554, 1548, 1556, 1533, 1558, 1559, 1468, 1562, 1503, 1504,
157367 /* 360 */ 1563, 1526, 1529, 1532, 1557, 1555, 1560, 1561, 1564, 1593,
157368 /* 370 */ 1483, 1485, 1567, 1568, 1569, 1565, 1527, 1604, 1572, 1571,
157369 /* 380 */ 1570, 1576, 1580, 1606, 1609, 1630, 1639, 1643, 1644, 1645,
157370 /* 390 */ 1573, 1577, 1581, 1632, 1627, 1628, 1629, 1633, 1638, 1622,
157371 /* 400 */ 1626, 1640, 1641, 1634, 1655,
157372 };
157373 static const YYACTIONTYPE yy_default[] = {
157374 /* 0 */ 1610, 1610, 1610, 1445, 1215, 1324, 1215, 1215, 1215, 1445,
157375 /* 10 */ 1445, 1445, 1215, 1354, 1354, 1498, 1246, 1215, 1215, 1215,
157376 /* 20 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1444, 1215, 1215,
157377 /* 30 */ 1215, 1215, 1528, 1528, 1215, 1215, 1215, 1215, 1215, 1215,
157378 /* 40 */ 1215, 1215, 1215, 1363, 1215, 1370, 1215, 1215, 1215, 1215,
157379 /* 50 */ 1215, 1446, 1447, 1215, 1215, 1215, 1497, 1499, 1462, 1377,
157380 /* 60 */ 1376, 1375, 1374, 1480, 1341, 1368, 1361, 1365, 1440, 1441,
157381 /* 70 */ 1439, 1443, 1447, 1446, 1215, 1364, 1411, 1425, 1410, 1215,
157382 /* 80 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157383 /* 90 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157384 /* 100 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157385 /* 110 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157386 /* 120 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1419, 1424,
157387 /* 130 */ 1430, 1423, 1420, 1413, 1412, 1414, 1415, 1215, 1236, 1288,
157388 /* 140 */ 1215, 1215, 1215, 1215, 1516, 1515, 1215, 1215, 1246, 1405,
157389 /* 150 */ 1404, 1416, 1417, 1427, 1426, 1505, 1563, 1562, 1463, 1215,
157390 /* 160 */ 1215, 1215, 1215, 1215, 1215, 1215, 1528, 1215, 1215, 1215,
157391 /* 170 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157392 /* 180 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157393 /* 190 */ 1215, 1528, 1528, 1215, 1246, 1528, 1528, 1242, 1242, 1348,
157394 /* 200 */ 1215, 1511, 1315, 1315, 1315, 1315, 1324, 1315, 1215, 1215,
157395 /* 210 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157396 /* 220 */ 1215, 1215, 1502, 1500, 1215, 1215, 1215, 1215, 1215, 1215,
157397 /* 230 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157398 /* 240 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157399 /* 250 */ 1215, 1215, 1320, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157400 /* 260 */ 1215, 1215, 1215, 1215, 1557, 1215, 1475, 1302, 1320, 1320,
157401 /* 270 */ 1320, 1320, 1322, 1303, 1301, 1314, 1247, 1222, 1602, 1380,
157402 /* 280 */ 1369, 1321, 1343, 1369, 1343, 1599, 1367, 1380, 1380, 1367,
157403 /* 290 */ 1380, 1321, 1599, 1263, 1579, 1258, 1354, 1354, 1354, 1343,
157404 /* 300 */ 1348, 1348, 1442, 1321, 1314, 1215, 1602, 1329, 1329, 1601,
157405 /* 310 */ 1601, 1329, 1463, 1586, 1389, 1291, 1297, 1297, 1297, 1297,
157406 /* 320 */ 1329, 1233, 1367, 1586, 1586, 1367, 1389, 1291, 1367, 1291,
157407 /* 330 */ 1367, 1329, 1233, 1479, 1596, 1329, 1233, 1453, 1329, 1233,
157408 /* 340 */ 1329, 1233, 1453, 1289, 1289, 1289, 1278, 1215, 1215, 1453,
157409 /* 350 */ 1289, 1263, 1289, 1278, 1289, 1289, 1546, 1453, 1457, 1457,
157410 /* 360 */ 1453, 1347, 1342, 1347, 1342, 1347, 1342, 1347, 1342, 1329,
157411 /* 370 */ 1538, 1538, 1357, 1357, 1362, 1348, 1448, 1329, 1215, 1362,
157412 /* 380 */ 1360, 1358, 1367, 1239, 1281, 1560, 1560, 1556, 1556, 1556,
157413 /* 390 */ 1607, 1607, 1511, 1572, 1246, 1246, 1246, 1246, 1572, 1265,
157414 /* 400 */ 1265, 1247, 1247, 1246, 1572, 1215, 1215, 1215, 1215, 1215,
157415 /* 410 */ 1215, 1567, 1215, 1464, 1333, 1215, 1215, 1215, 1215, 1215,
157416 /* 420 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157417 /* 430 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1394,
157418 /* 440 */ 1215, 1218, 1508, 1215, 1215, 1506, 1215, 1215, 1215, 1215,
157419 /* 450 */ 1215, 1215, 1371, 1372, 1334, 1215, 1215, 1215, 1215, 1215,
157420 /* 460 */ 1215, 1215, 1386, 1215, 1215, 1215, 1381, 1215, 1215, 1215,
157421 /* 470 */ 1215, 1215, 1215, 1215, 1215, 1598, 1215, 1215, 1215, 1215,
157422 /* 480 */ 1215, 1215, 1478, 1477, 1215, 1215, 1331, 1215, 1215, 1215,
157423 /* 490 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157424 /* 500 */ 1261, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157425 /* 510 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157426 /* 520 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1359, 1215, 1215,
157427 /* 530 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157428 /* 540 */ 1215, 1215, 1543, 1349, 1215, 1215, 1589, 1215, 1215, 1215,
157429 /* 550 */ 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215, 1215,
157430 /* 560 */ 1215, 1583, 1305, 1396, 1215, 1395, 1399, 1215, 1227, 1215,
157431 /* 570 */ 1215,
157432 };
157433 /********** End of lemon-generated parsing tables *****************************/
157434
157435 /* The next table maps tokens (terminal symbols) into fallback tokens.
157436 ** If a construct like the following:
@@ -157543,10 +157988,11 @@
157543 59, /* GROUPS => ID */
157544 59, /* OTHERS => ID */
157545 59, /* TIES => ID */
157546 59, /* GENERATED => ID */
157547 59, /* ALWAYS => ID */
 
157548 59, /* REINDEX => ID */
157549 59, /* RENAME => ID */
157550 59, /* CTIME_KW => ID */
157551 0, /* ANY => nothing */
157552 0, /* BITAND => nothing */
@@ -157813,226 +158259,229 @@
157813 /* 92 */ "GROUPS",
157814 /* 93 */ "OTHERS",
157815 /* 94 */ "TIES",
157816 /* 95 */ "GENERATED",
157817 /* 96 */ "ALWAYS",
157818 /* 97 */ "REINDEX",
157819 /* 98 */ "RENAME",
157820 /* 99 */ "CTIME_KW",
157821 /* 100 */ "ANY",
157822 /* 101 */ "BITAND",
157823 /* 102 */ "BITOR",
157824 /* 103 */ "LSHIFT",
157825 /* 104 */ "RSHIFT",
157826 /* 105 */ "PLUS",
157827 /* 106 */ "MINUS",
157828 /* 107 */ "STAR",
157829 /* 108 */ "SLASH",
157830 /* 109 */ "REM",
157831 /* 110 */ "CONCAT",
157832 /* 111 */ "COLLATE",
157833 /* 112 */ "BITNOT",
157834 /* 113 */ "ON",
157835 /* 114 */ "INDEXED",
157836 /* 115 */ "STRING",
157837 /* 116 */ "JOIN_KW",
157838 /* 117 */ "CONSTRAINT",
157839 /* 118 */ "DEFAULT",
157840 /* 119 */ "NULL",
157841 /* 120 */ "PRIMARY",
157842 /* 121 */ "UNIQUE",
157843 /* 122 */ "CHECK",
157844 /* 123 */ "REFERENCES",
157845 /* 124 */ "AUTOINCR",
157846 /* 125 */ "INSERT",
157847 /* 126 */ "DELETE",
157848 /* 127 */ "UPDATE",
157849 /* 128 */ "SET",
157850 /* 129 */ "DEFERRABLE",
157851 /* 130 */ "FOREIGN",
157852 /* 131 */ "DROP",
157853 /* 132 */ "UNION",
157854 /* 133 */ "ALL",
157855 /* 134 */ "EXCEPT",
157856 /* 135 */ "INTERSECT",
157857 /* 136 */ "SELECT",
157858 /* 137 */ "VALUES",
157859 /* 138 */ "DISTINCT",
157860 /* 139 */ "DOT",
157861 /* 140 */ "FROM",
157862 /* 141 */ "JOIN",
157863 /* 142 */ "USING",
157864 /* 143 */ "ORDER",
157865 /* 144 */ "GROUP",
157866 /* 145 */ "HAVING",
157867 /* 146 */ "LIMIT",
157868 /* 147 */ "WHERE",
157869 /* 148 */ "RETURNING",
157870 /* 149 */ "INTO",
157871 /* 150 */ "NOTHING",
157872 /* 151 */ "FLOAT",
157873 /* 152 */ "BLOB",
157874 /* 153 */ "INTEGER",
157875 /* 154 */ "VARIABLE",
157876 /* 155 */ "CASE",
157877 /* 156 */ "WHEN",
157878 /* 157 */ "THEN",
157879 /* 158 */ "ELSE",
157880 /* 159 */ "INDEX",
157881 /* 160 */ "ALTER",
157882 /* 161 */ "ADD",
157883 /* 162 */ "WINDOW",
157884 /* 163 */ "OVER",
157885 /* 164 */ "FILTER",
157886 /* 165 */ "COLUMN",
157887 /* 166 */ "AGG_FUNCTION",
157888 /* 167 */ "AGG_COLUMN",
157889 /* 168 */ "TRUEFALSE",
157890 /* 169 */ "ISNOT",
157891 /* 170 */ "FUNCTION",
157892 /* 171 */ "UMINUS",
157893 /* 172 */ "UPLUS",
157894 /* 173 */ "TRUTH",
157895 /* 174 */ "REGISTER",
157896 /* 175 */ "VECTOR",
157897 /* 176 */ "SELECT_COLUMN",
157898 /* 177 */ "IF_NULL_ROW",
157899 /* 178 */ "ASTERISK",
157900 /* 179 */ "SPAN",
157901 /* 180 */ "SPACE",
157902 /* 181 */ "ILLEGAL",
157903 /* 182 */ "input",
157904 /* 183 */ "cmdlist",
157905 /* 184 */ "ecmd",
157906 /* 185 */ "cmdx",
157907 /* 186 */ "explain",
157908 /* 187 */ "cmd",
157909 /* 188 */ "transtype",
157910 /* 189 */ "trans_opt",
157911 /* 190 */ "nm",
157912 /* 191 */ "savepoint_opt",
157913 /* 192 */ "create_table",
157914 /* 193 */ "create_table_args",
157915 /* 194 */ "createkw",
157916 /* 195 */ "temp",
157917 /* 196 */ "ifnotexists",
157918 /* 197 */ "dbnm",
157919 /* 198 */ "columnlist",
157920 /* 199 */ "conslist_opt",
157921 /* 200 */ "table_options",
157922 /* 201 */ "select",
157923 /* 202 */ "columnname",
157924 /* 203 */ "carglist",
157925 /* 204 */ "typetoken",
157926 /* 205 */ "typename",
157927 /* 206 */ "signed",
157928 /* 207 */ "plus_num",
157929 /* 208 */ "minus_num",
157930 /* 209 */ "scanpt",
157931 /* 210 */ "scantok",
157932 /* 211 */ "ccons",
157933 /* 212 */ "term",
157934 /* 213 */ "expr",
157935 /* 214 */ "onconf",
157936 /* 215 */ "sortorder",
157937 /* 216 */ "autoinc",
157938 /* 217 */ "eidlist_opt",
157939 /* 218 */ "refargs",
157940 /* 219 */ "defer_subclause",
157941 /* 220 */ "generated",
157942 /* 221 */ "refarg",
157943 /* 222 */ "refact",
157944 /* 223 */ "init_deferred_pred_opt",
157945 /* 224 */ "conslist",
157946 /* 225 */ "tconscomma",
157947 /* 226 */ "tcons",
157948 /* 227 */ "sortlist",
157949 /* 228 */ "eidlist",
157950 /* 229 */ "defer_subclause_opt",
157951 /* 230 */ "orconf",
157952 /* 231 */ "resolvetype",
157953 /* 232 */ "raisetype",
157954 /* 233 */ "ifexists",
157955 /* 234 */ "fullname",
157956 /* 235 */ "selectnowith",
157957 /* 236 */ "oneselect",
157958 /* 237 */ "wqlist",
157959 /* 238 */ "multiselect_op",
157960 /* 239 */ "distinct",
157961 /* 240 */ "selcollist",
157962 /* 241 */ "from",
157963 /* 242 */ "where_opt",
157964 /* 243 */ "groupby_opt",
157965 /* 244 */ "having_opt",
157966 /* 245 */ "orderby_opt",
157967 /* 246 */ "limit_opt",
157968 /* 247 */ "window_clause",
157969 /* 248 */ "values",
157970 /* 249 */ "nexprlist",
157971 /* 250 */ "sclp",
157972 /* 251 */ "as",
157973 /* 252 */ "seltablist",
157974 /* 253 */ "stl_prefix",
157975 /* 254 */ "joinop",
157976 /* 255 */ "indexed_opt",
157977 /* 256 */ "on_opt",
157978 /* 257 */ "using_opt",
157979 /* 258 */ "exprlist",
157980 /* 259 */ "xfullname",
157981 /* 260 */ "idlist",
157982 /* 261 */ "nulls",
157983 /* 262 */ "with",
157984 /* 263 */ "where_opt_ret",
157985 /* 264 */ "setlist",
157986 /* 265 */ "insert_cmd",
157987 /* 266 */ "idlist_opt",
157988 /* 267 */ "upsert",
157989 /* 268 */ "returning",
157990 /* 269 */ "filter_over",
157991 /* 270 */ "likeop",
157992 /* 271 */ "between_op",
157993 /* 272 */ "in_op",
157994 /* 273 */ "paren_exprlist",
157995 /* 274 */ "case_operand",
157996 /* 275 */ "case_exprlist",
157997 /* 276 */ "case_else",
157998 /* 277 */ "uniqueflag",
157999 /* 278 */ "collate",
158000 /* 279 */ "vinto",
158001 /* 280 */ "nmnum",
158002 /* 281 */ "trigger_decl",
158003 /* 282 */ "trigger_cmd_list",
158004 /* 283 */ "trigger_time",
158005 /* 284 */ "trigger_event",
158006 /* 285 */ "foreach_clause",
158007 /* 286 */ "when_clause",
158008 /* 287 */ "trigger_cmd",
158009 /* 288 */ "trnm",
158010 /* 289 */ "tridxby",
158011 /* 290 */ "database_kw_opt",
158012 /* 291 */ "key_opt",
158013 /* 292 */ "add_column_fullname",
158014 /* 293 */ "kwcolumn_opt",
158015 /* 294 */ "create_vtab",
158016 /* 295 */ "vtabarglist",
158017 /* 296 */ "vtabarg",
158018 /* 297 */ "vtabargtoken",
158019 /* 298 */ "lp",
158020 /* 299 */ "anylist",
158021 /* 300 */ "windowdefn_list",
158022 /* 301 */ "windowdefn",
158023 /* 302 */ "window",
158024 /* 303 */ "frame_opt",
158025 /* 304 */ "part_opt",
158026 /* 305 */ "filter_clause",
158027 /* 306 */ "over_clause",
158028 /* 307 */ "range_or_rows",
158029 /* 308 */ "frame_bound",
158030 /* 309 */ "frame_bound_s",
158031 /* 310 */ "frame_bound_e",
158032 /* 311 */ "frame_exclude_opt",
158033 /* 312 */ "frame_exclude",
 
 
 
158034 };
158035 #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
158036
158037 #ifndef NDEBUG
158038 /* For tracing reduce actions, the names of all rules are required.
@@ -158324,115 +158773,120 @@
158324 /* 283 */ "cmd ::= REINDEX nm dbnm",
158325 /* 284 */ "cmd ::= ANALYZE",
158326 /* 285 */ "cmd ::= ANALYZE nm dbnm",
158327 /* 286 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
158328 /* 287 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
158329 /* 288 */ "add_column_fullname ::= fullname",
158330 /* 289 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
158331 /* 290 */ "cmd ::= create_vtab",
158332 /* 291 */ "cmd ::= create_vtab LP vtabarglist RP",
158333 /* 292 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
158334 /* 293 */ "vtabarg ::=",
158335 /* 294 */ "vtabargtoken ::= ANY",
158336 /* 295 */ "vtabargtoken ::= lp anylist RP",
158337 /* 296 */ "lp ::= LP",
158338 /* 297 */ "with ::= WITH wqlist",
158339 /* 298 */ "with ::= WITH RECURSIVE wqlist",
158340 /* 299 */ "wqlist ::= nm eidlist_opt AS LP select RP",
158341 /* 300 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
158342 /* 301 */ "windowdefn_list ::= windowdefn",
158343 /* 302 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
158344 /* 303 */ "windowdefn ::= nm AS LP window RP",
158345 /* 304 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
158346 /* 305 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
158347 /* 306 */ "window ::= ORDER BY sortlist frame_opt",
158348 /* 307 */ "window ::= nm ORDER BY sortlist frame_opt",
158349 /* 308 */ "window ::= frame_opt",
158350 /* 309 */ "window ::= nm frame_opt",
158351 /* 310 */ "frame_opt ::=",
158352 /* 311 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
158353 /* 312 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
158354 /* 313 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
158355 /* 314 */ "frame_bound_s ::= frame_bound",
158356 /* 315 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
158357 /* 316 */ "frame_bound_e ::= frame_bound",
158358 /* 317 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
158359 /* 318 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
158360 /* 319 */ "frame_bound ::= CURRENT ROW",
158361 /* 320 */ "frame_exclude_opt ::=",
158362 /* 321 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
158363 /* 322 */ "frame_exclude ::= NO OTHERS",
158364 /* 323 */ "frame_exclude ::= CURRENT ROW",
158365 /* 324 */ "frame_exclude ::= GROUP|TIES",
158366 /* 325 */ "window_clause ::= WINDOW windowdefn_list",
158367 /* 326 */ "filter_over ::= filter_clause over_clause",
158368 /* 327 */ "filter_over ::= over_clause",
158369 /* 328 */ "filter_over ::= filter_clause",
158370 /* 329 */ "over_clause ::= OVER LP window RP",
158371 /* 330 */ "over_clause ::= OVER nm",
158372 /* 331 */ "filter_clause ::= FILTER LP WHERE expr RP",
158373 /* 332 */ "input ::= cmdlist",
158374 /* 333 */ "cmdlist ::= cmdlist ecmd",
158375 /* 334 */ "cmdlist ::= ecmd",
158376 /* 335 */ "ecmd ::= SEMI",
158377 /* 336 */ "ecmd ::= cmdx SEMI",
158378 /* 337 */ "ecmd ::= explain cmdx SEMI",
158379 /* 338 */ "trans_opt ::=",
158380 /* 339 */ "trans_opt ::= TRANSACTION",
158381 /* 340 */ "trans_opt ::= TRANSACTION nm",
158382 /* 341 */ "savepoint_opt ::= SAVEPOINT",
158383 /* 342 */ "savepoint_opt ::=",
158384 /* 343 */ "cmd ::= create_table create_table_args",
158385 /* 344 */ "columnlist ::= columnlist COMMA columnname carglist",
158386 /* 345 */ "columnlist ::= columnname carglist",
158387 /* 346 */ "nm ::= ID|INDEXED",
158388 /* 347 */ "nm ::= STRING",
158389 /* 348 */ "nm ::= JOIN_KW",
158390 /* 349 */ "typetoken ::= typename",
158391 /* 350 */ "typename ::= ID|STRING",
158392 /* 351 */ "signed ::= plus_num",
158393 /* 352 */ "signed ::= minus_num",
158394 /* 353 */ "carglist ::= carglist ccons",
158395 /* 354 */ "carglist ::=",
158396 /* 355 */ "ccons ::= NULL onconf",
158397 /* 356 */ "ccons ::= GENERATED ALWAYS AS generated",
158398 /* 357 */ "ccons ::= AS generated",
158399 /* 358 */ "conslist_opt ::= COMMA conslist",
158400 /* 359 */ "conslist ::= conslist tconscomma tcons",
158401 /* 360 */ "conslist ::= tcons",
158402 /* 361 */ "tconscomma ::=",
158403 /* 362 */ "defer_subclause_opt ::= defer_subclause",
158404 /* 363 */ "resolvetype ::= raisetype",
158405 /* 364 */ "selectnowith ::= oneselect",
158406 /* 365 */ "oneselect ::= values",
158407 /* 366 */ "sclp ::= selcollist COMMA",
158408 /* 367 */ "as ::= ID|STRING",
158409 /* 368 */ "returning ::=",
158410 /* 369 */ "expr ::= term",
158411 /* 370 */ "likeop ::= LIKE_KW|MATCH",
158412 /* 371 */ "exprlist ::= nexprlist",
158413 /* 372 */ "nmnum ::= plus_num",
158414 /* 373 */ "nmnum ::= nm",
158415 /* 374 */ "nmnum ::= ON",
158416 /* 375 */ "nmnum ::= DELETE",
158417 /* 376 */ "nmnum ::= DEFAULT",
158418 /* 377 */ "plus_num ::= INTEGER|FLOAT",
158419 /* 378 */ "foreach_clause ::=",
158420 /* 379 */ "foreach_clause ::= FOR EACH ROW",
158421 /* 380 */ "trnm ::= nm",
158422 /* 381 */ "tridxby ::=",
158423 /* 382 */ "database_kw_opt ::= DATABASE",
158424 /* 383 */ "database_kw_opt ::=",
158425 /* 384 */ "kwcolumn_opt ::=",
158426 /* 385 */ "kwcolumn_opt ::= COLUMNKW",
158427 /* 386 */ "vtabarglist ::= vtabarg",
158428 /* 387 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
158429 /* 388 */ "vtabarg ::= vtabarg vtabargtoken",
158430 /* 389 */ "anylist ::=",
158431 /* 390 */ "anylist ::= anylist LP anylist RP",
158432 /* 391 */ "anylist ::= anylist ANY",
158433 /* 392 */ "with ::=",
 
 
 
 
 
158434 };
158435 #endif /* NDEBUG */
158436
158437
158438 #if YYSTACKDEPTH<=0
@@ -158554,103 +159008,103 @@
158554 ** Note: during a reduce, the only symbols destroyed are those
158555 ** which appear on the RHS of the rule, but which are *not* used
158556 ** inside the C code.
158557 */
158558 /********* Begin destructor definitions ***************************************/
158559 case 201: /* select */
158560 case 235: /* selectnowith */
158561 case 236: /* oneselect */
158562 case 248: /* values */
158563 {
158564 sqlite3SelectDelete(pParse->db, (yypminor->yy293));
158565 }
158566 break;
158567 case 212: /* term */
158568 case 213: /* expr */
158569 case 242: /* where_opt */
158570 case 244: /* having_opt */
158571 case 256: /* on_opt */
158572 case 263: /* where_opt_ret */
158573 case 274: /* case_operand */
158574 case 276: /* case_else */
158575 case 279: /* vinto */
158576 case 286: /* when_clause */
158577 case 291: /* key_opt */
158578 case 305: /* filter_clause */
158579 {
158580 sqlite3ExprDelete(pParse->db, (yypminor->yy354));
158581 }
158582 break;
158583 case 217: /* eidlist_opt */
158584 case 227: /* sortlist */
158585 case 228: /* eidlist */
158586 case 240: /* selcollist */
158587 case 243: /* groupby_opt */
158588 case 245: /* orderby_opt */
158589 case 249: /* nexprlist */
158590 case 250: /* sclp */
158591 case 258: /* exprlist */
158592 case 264: /* setlist */
158593 case 273: /* paren_exprlist */
158594 case 275: /* case_exprlist */
158595 case 304: /* part_opt */
158596 {
158597 sqlite3ExprListDelete(pParse->db, (yypminor->yy350));
158598 }
158599 break;
158600 case 234: /* fullname */
158601 case 241: /* from */
158602 case 252: /* seltablist */
158603 case 253: /* stl_prefix */
158604 case 259: /* xfullname */
158605 {
158606 sqlite3SrcListDelete(pParse->db, (yypminor->yy457));
158607 }
158608 break;
158609 case 237: /* wqlist */
158610 {
158611 sqlite3WithDelete(pParse->db, (yypminor->yy105));
158612 }
158613 break;
158614 case 247: /* window_clause */
158615 case 300: /* windowdefn_list */
158616 {
158617 sqlite3WindowListDelete(pParse->db, (yypminor->yy503));
158618 }
158619 break;
158620 case 257: /* using_opt */
158621 case 260: /* idlist */
158622 case 266: /* idlist_opt */
158623 {
158624 sqlite3IdListDelete(pParse->db, (yypminor->yy498));
158625 }
158626 break;
158627 case 269: /* filter_over */
158628 case 301: /* windowdefn */
158629 case 302: /* window */
158630 case 303: /* frame_opt */
158631 case 306: /* over_clause */
158632 {
158633 sqlite3WindowDelete(pParse->db, (yypminor->yy503));
158634 }
158635 break;
158636 case 282: /* trigger_cmd_list */
158637 case 287: /* trigger_cmd */
158638 {
158639 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy51));
158640 }
158641 break;
158642 case 284: /* trigger_event */
158643 {
158644 sqlite3IdListDelete(pParse->db, (yypminor->yy298).b);
158645 }
158646 break;
158647 case 308: /* frame_bound */
158648 case 309: /* frame_bound_s */
158649 case 310: /* frame_bound_e */
158650 {
158651 sqlite3ExprDelete(pParse->db, (yypminor->yy341).pExpr);
158652 }
158653 break;
158654 /********* End destructor definitions *****************************************/
158655 default: break; /* If no destructor action specified: do nothing */
158656 }
@@ -158937,403 +159391,408 @@
158937 }
158938
158939 /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
158940 ** of that rule */
158941 static const YYCODETYPE yyRuleInfoLhs[] = {
158942 186, /* (0) explain ::= EXPLAIN */
158943 186, /* (1) explain ::= EXPLAIN QUERY PLAN */
158944 185, /* (2) cmdx ::= cmd */
158945 187, /* (3) cmd ::= BEGIN transtype trans_opt */
158946 188, /* (4) transtype ::= */
158947 188, /* (5) transtype ::= DEFERRED */
158948 188, /* (6) transtype ::= IMMEDIATE */
158949 188, /* (7) transtype ::= EXCLUSIVE */
158950 187, /* (8) cmd ::= COMMIT|END trans_opt */
158951 187, /* (9) cmd ::= ROLLBACK trans_opt */
158952 187, /* (10) cmd ::= SAVEPOINT nm */
158953 187, /* (11) cmd ::= RELEASE savepoint_opt nm */
158954 187, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
158955 192, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
158956 194, /* (14) createkw ::= CREATE */
158957 196, /* (15) ifnotexists ::= */
158958 196, /* (16) ifnotexists ::= IF NOT EXISTS */
158959 195, /* (17) temp ::= TEMP */
158960 195, /* (18) temp ::= */
158961 193, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */
158962 193, /* (20) create_table_args ::= AS select */
158963 200, /* (21) table_options ::= */
158964 200, /* (22) table_options ::= WITHOUT nm */
158965 202, /* (23) columnname ::= nm typetoken */
158966 204, /* (24) typetoken ::= */
158967 204, /* (25) typetoken ::= typename LP signed RP */
158968 204, /* (26) typetoken ::= typename LP signed COMMA signed RP */
158969 205, /* (27) typename ::= typename ID|STRING */
158970 209, /* (28) scanpt ::= */
158971 210, /* (29) scantok ::= */
158972 211, /* (30) ccons ::= CONSTRAINT nm */
158973 211, /* (31) ccons ::= DEFAULT scantok term */
158974 211, /* (32) ccons ::= DEFAULT LP expr RP */
158975 211, /* (33) ccons ::= DEFAULT PLUS scantok term */
158976 211, /* (34) ccons ::= DEFAULT MINUS scantok term */
158977 211, /* (35) ccons ::= DEFAULT scantok ID|INDEXED */
158978 211, /* (36) ccons ::= NOT NULL onconf */
158979 211, /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */
158980 211, /* (38) ccons ::= UNIQUE onconf */
158981 211, /* (39) ccons ::= CHECK LP expr RP */
158982 211, /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */
158983 211, /* (41) ccons ::= defer_subclause */
158984 211, /* (42) ccons ::= COLLATE ID|STRING */
158985 220, /* (43) generated ::= LP expr RP */
158986 220, /* (44) generated ::= LP expr RP ID */
158987 216, /* (45) autoinc ::= */
158988 216, /* (46) autoinc ::= AUTOINCR */
158989 218, /* (47) refargs ::= */
158990 218, /* (48) refargs ::= refargs refarg */
158991 221, /* (49) refarg ::= MATCH nm */
158992 221, /* (50) refarg ::= ON INSERT refact */
158993 221, /* (51) refarg ::= ON DELETE refact */
158994 221, /* (52) refarg ::= ON UPDATE refact */
158995 222, /* (53) refact ::= SET NULL */
158996 222, /* (54) refact ::= SET DEFAULT */
158997 222, /* (55) refact ::= CASCADE */
158998 222, /* (56) refact ::= RESTRICT */
158999 222, /* (57) refact ::= NO ACTION */
159000 219, /* (58) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
159001 219, /* (59) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
159002 223, /* (60) init_deferred_pred_opt ::= */
159003 223, /* (61) init_deferred_pred_opt ::= INITIALLY DEFERRED */
159004 223, /* (62) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
159005 199, /* (63) conslist_opt ::= */
159006 225, /* (64) tconscomma ::= COMMA */
159007 226, /* (65) tcons ::= CONSTRAINT nm */
159008 226, /* (66) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
159009 226, /* (67) tcons ::= UNIQUE LP sortlist RP onconf */
159010 226, /* (68) tcons ::= CHECK LP expr RP onconf */
159011 226, /* (69) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
159012 229, /* (70) defer_subclause_opt ::= */
159013 214, /* (71) onconf ::= */
159014 214, /* (72) onconf ::= ON CONFLICT resolvetype */
159015 230, /* (73) orconf ::= */
159016 230, /* (74) orconf ::= OR resolvetype */
159017 231, /* (75) resolvetype ::= IGNORE */
159018 231, /* (76) resolvetype ::= REPLACE */
159019 187, /* (77) cmd ::= DROP TABLE ifexists fullname */
159020 233, /* (78) ifexists ::= IF EXISTS */
159021 233, /* (79) ifexists ::= */
159022 187, /* (80) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
159023 187, /* (81) cmd ::= DROP VIEW ifexists fullname */
159024 187, /* (82) cmd ::= select */
159025 201, /* (83) select ::= WITH wqlist selectnowith */
159026 201, /* (84) select ::= WITH RECURSIVE wqlist selectnowith */
159027 201, /* (85) select ::= selectnowith */
159028 235, /* (86) selectnowith ::= selectnowith multiselect_op oneselect */
159029 238, /* (87) multiselect_op ::= UNION */
159030 238, /* (88) multiselect_op ::= UNION ALL */
159031 238, /* (89) multiselect_op ::= EXCEPT|INTERSECT */
159032 236, /* (90) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
159033 236, /* (91) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
159034 248, /* (92) values ::= VALUES LP nexprlist RP */
159035 248, /* (93) values ::= values COMMA LP nexprlist RP */
159036 239, /* (94) distinct ::= DISTINCT */
159037 239, /* (95) distinct ::= ALL */
159038 239, /* (96) distinct ::= */
159039 250, /* (97) sclp ::= */
159040 240, /* (98) selcollist ::= sclp scanpt expr scanpt as */
159041 240, /* (99) selcollist ::= sclp scanpt STAR */
159042 240, /* (100) selcollist ::= sclp scanpt nm DOT STAR */
159043 251, /* (101) as ::= AS nm */
159044 251, /* (102) as ::= */
159045 241, /* (103) from ::= */
159046 241, /* (104) from ::= FROM seltablist */
159047 253, /* (105) stl_prefix ::= seltablist joinop */
159048 253, /* (106) stl_prefix ::= */
159049 252, /* (107) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
159050 252, /* (108) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
159051 252, /* (109) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
159052 252, /* (110) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
159053 197, /* (111) dbnm ::= */
159054 197, /* (112) dbnm ::= DOT nm */
159055 234, /* (113) fullname ::= nm */
159056 234, /* (114) fullname ::= nm DOT nm */
159057 259, /* (115) xfullname ::= nm */
159058 259, /* (116) xfullname ::= nm DOT nm */
159059 259, /* (117) xfullname ::= nm DOT nm AS nm */
159060 259, /* (118) xfullname ::= nm AS nm */
159061 254, /* (119) joinop ::= COMMA|JOIN */
159062 254, /* (120) joinop ::= JOIN_KW JOIN */
159063 254, /* (121) joinop ::= JOIN_KW nm JOIN */
159064 254, /* (122) joinop ::= JOIN_KW nm nm JOIN */
159065 256, /* (123) on_opt ::= ON expr */
159066 256, /* (124) on_opt ::= */
159067 255, /* (125) indexed_opt ::= */
159068 255, /* (126) indexed_opt ::= INDEXED BY nm */
159069 255, /* (127) indexed_opt ::= NOT INDEXED */
159070 257, /* (128) using_opt ::= USING LP idlist RP */
159071 257, /* (129) using_opt ::= */
159072 245, /* (130) orderby_opt ::= */
159073 245, /* (131) orderby_opt ::= ORDER BY sortlist */
159074 227, /* (132) sortlist ::= sortlist COMMA expr sortorder nulls */
159075 227, /* (133) sortlist ::= expr sortorder nulls */
159076 215, /* (134) sortorder ::= ASC */
159077 215, /* (135) sortorder ::= DESC */
159078 215, /* (136) sortorder ::= */
159079 261, /* (137) nulls ::= NULLS FIRST */
159080 261, /* (138) nulls ::= NULLS LAST */
159081 261, /* (139) nulls ::= */
159082 243, /* (140) groupby_opt ::= */
159083 243, /* (141) groupby_opt ::= GROUP BY nexprlist */
159084 244, /* (142) having_opt ::= */
159085 244, /* (143) having_opt ::= HAVING expr */
159086 246, /* (144) limit_opt ::= */
159087 246, /* (145) limit_opt ::= LIMIT expr */
159088 246, /* (146) limit_opt ::= LIMIT expr OFFSET expr */
159089 246, /* (147) limit_opt ::= LIMIT expr COMMA expr */
159090 187, /* (148) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
159091 242, /* (149) where_opt ::= */
159092 242, /* (150) where_opt ::= WHERE expr */
159093 263, /* (151) where_opt_ret ::= */
159094 263, /* (152) where_opt_ret ::= WHERE expr */
159095 263, /* (153) where_opt_ret ::= RETURNING selcollist */
159096 263, /* (154) where_opt_ret ::= WHERE expr RETURNING selcollist */
159097 187, /* (155) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
159098 264, /* (156) setlist ::= setlist COMMA nm EQ expr */
159099 264, /* (157) setlist ::= setlist COMMA LP idlist RP EQ expr */
159100 264, /* (158) setlist ::= nm EQ expr */
159101 264, /* (159) setlist ::= LP idlist RP EQ expr */
159102 187, /* (160) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
159103 187, /* (161) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
159104 267, /* (162) upsert ::= */
159105 267, /* (163) upsert ::= RETURNING selcollist */
159106 267, /* (164) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
159107 267, /* (165) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
159108 267, /* (166) upsert ::= ON CONFLICT DO NOTHING returning */
159109 267, /* (167) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
159110 268, /* (168) returning ::= RETURNING selcollist */
159111 265, /* (169) insert_cmd ::= INSERT orconf */
159112 265, /* (170) insert_cmd ::= REPLACE */
159113 266, /* (171) idlist_opt ::= */
159114 266, /* (172) idlist_opt ::= LP idlist RP */
159115 260, /* (173) idlist ::= idlist COMMA nm */
159116 260, /* (174) idlist ::= nm */
159117 213, /* (175) expr ::= LP expr RP */
159118 213, /* (176) expr ::= ID|INDEXED */
159119 213, /* (177) expr ::= JOIN_KW */
159120 213, /* (178) expr ::= nm DOT nm */
159121 213, /* (179) expr ::= nm DOT nm DOT nm */
159122 212, /* (180) term ::= NULL|FLOAT|BLOB */
159123 212, /* (181) term ::= STRING */
159124 212, /* (182) term ::= INTEGER */
159125 213, /* (183) expr ::= VARIABLE */
159126 213, /* (184) expr ::= expr COLLATE ID|STRING */
159127 213, /* (185) expr ::= CAST LP expr AS typetoken RP */
159128 213, /* (186) expr ::= ID|INDEXED LP distinct exprlist RP */
159129 213, /* (187) expr ::= ID|INDEXED LP STAR RP */
159130 213, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
159131 213, /* (189) expr ::= ID|INDEXED LP STAR RP filter_over */
159132 212, /* (190) term ::= CTIME_KW */
159133 213, /* (191) expr ::= LP nexprlist COMMA expr RP */
159134 213, /* (192) expr ::= expr AND expr */
159135 213, /* (193) expr ::= expr OR expr */
159136 213, /* (194) expr ::= expr LT|GT|GE|LE expr */
159137 213, /* (195) expr ::= expr EQ|NE expr */
159138 213, /* (196) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
159139 213, /* (197) expr ::= expr PLUS|MINUS expr */
159140 213, /* (198) expr ::= expr STAR|SLASH|REM expr */
159141 213, /* (199) expr ::= expr CONCAT expr */
159142 270, /* (200) likeop ::= NOT LIKE_KW|MATCH */
159143 213, /* (201) expr ::= expr likeop expr */
159144 213, /* (202) expr ::= expr likeop expr ESCAPE expr */
159145 213, /* (203) expr ::= expr ISNULL|NOTNULL */
159146 213, /* (204) expr ::= expr NOT NULL */
159147 213, /* (205) expr ::= expr IS expr */
159148 213, /* (206) expr ::= expr IS NOT expr */
159149 213, /* (207) expr ::= NOT expr */
159150 213, /* (208) expr ::= BITNOT expr */
159151 213, /* (209) expr ::= PLUS|MINUS expr */
159152 271, /* (210) between_op ::= BETWEEN */
159153 271, /* (211) between_op ::= NOT BETWEEN */
159154 213, /* (212) expr ::= expr between_op expr AND expr */
159155 272, /* (213) in_op ::= IN */
159156 272, /* (214) in_op ::= NOT IN */
159157 213, /* (215) expr ::= expr in_op LP exprlist RP */
159158 213, /* (216) expr ::= LP select RP */
159159 213, /* (217) expr ::= expr in_op LP select RP */
159160 213, /* (218) expr ::= expr in_op nm dbnm paren_exprlist */
159161 213, /* (219) expr ::= EXISTS LP select RP */
159162 213, /* (220) expr ::= CASE case_operand case_exprlist case_else END */
159163 275, /* (221) case_exprlist ::= case_exprlist WHEN expr THEN expr */
159164 275, /* (222) case_exprlist ::= WHEN expr THEN expr */
159165 276, /* (223) case_else ::= ELSE expr */
159166 276, /* (224) case_else ::= */
159167 274, /* (225) case_operand ::= expr */
159168 274, /* (226) case_operand ::= */
159169 258, /* (227) exprlist ::= */
159170 249, /* (228) nexprlist ::= nexprlist COMMA expr */
159171 249, /* (229) nexprlist ::= expr */
159172 273, /* (230) paren_exprlist ::= */
159173 273, /* (231) paren_exprlist ::= LP exprlist RP */
159174 187, /* (232) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
159175 277, /* (233) uniqueflag ::= UNIQUE */
159176 277, /* (234) uniqueflag ::= */
159177 217, /* (235) eidlist_opt ::= */
159178 217, /* (236) eidlist_opt ::= LP eidlist RP */
159179 228, /* (237) eidlist ::= eidlist COMMA nm collate sortorder */
159180 228, /* (238) eidlist ::= nm collate sortorder */
159181 278, /* (239) collate ::= */
159182 278, /* (240) collate ::= COLLATE ID|STRING */
159183 187, /* (241) cmd ::= DROP INDEX ifexists fullname */
159184 187, /* (242) cmd ::= VACUUM vinto */
159185 187, /* (243) cmd ::= VACUUM nm vinto */
159186 279, /* (244) vinto ::= INTO expr */
159187 279, /* (245) vinto ::= */
159188 187, /* (246) cmd ::= PRAGMA nm dbnm */
159189 187, /* (247) cmd ::= PRAGMA nm dbnm EQ nmnum */
159190 187, /* (248) cmd ::= PRAGMA nm dbnm LP nmnum RP */
159191 187, /* (249) cmd ::= PRAGMA nm dbnm EQ minus_num */
159192 187, /* (250) cmd ::= PRAGMA nm dbnm LP minus_num RP */
159193 207, /* (251) plus_num ::= PLUS INTEGER|FLOAT */
159194 208, /* (252) minus_num ::= MINUS INTEGER|FLOAT */
159195 187, /* (253) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
159196 281, /* (254) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
159197 283, /* (255) trigger_time ::= BEFORE|AFTER */
159198 283, /* (256) trigger_time ::= INSTEAD OF */
159199 283, /* (257) trigger_time ::= */
159200 284, /* (258) trigger_event ::= DELETE|INSERT */
159201 284, /* (259) trigger_event ::= UPDATE */
159202 284, /* (260) trigger_event ::= UPDATE OF idlist */
159203 286, /* (261) when_clause ::= */
159204 286, /* (262) when_clause ::= WHEN expr */
159205 282, /* (263) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
159206 282, /* (264) trigger_cmd_list ::= trigger_cmd SEMI */
159207 288, /* (265) trnm ::= nm DOT nm */
159208 289, /* (266) tridxby ::= INDEXED BY nm */
159209 289, /* (267) tridxby ::= NOT INDEXED */
159210 287, /* (268) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
159211 287, /* (269) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
159212 287, /* (270) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
159213 287, /* (271) trigger_cmd ::= scanpt select scanpt */
159214 213, /* (272) expr ::= RAISE LP IGNORE RP */
159215 213, /* (273) expr ::= RAISE LP raisetype COMMA nm RP */
159216 232, /* (274) raisetype ::= ROLLBACK */
159217 232, /* (275) raisetype ::= ABORT */
159218 232, /* (276) raisetype ::= FAIL */
159219 187, /* (277) cmd ::= DROP TRIGGER ifexists fullname */
159220 187, /* (278) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
159221 187, /* (279) cmd ::= DETACH database_kw_opt expr */
159222 291, /* (280) key_opt ::= */
159223 291, /* (281) key_opt ::= KEY expr */
159224 187, /* (282) cmd ::= REINDEX */
159225 187, /* (283) cmd ::= REINDEX nm dbnm */
159226 187, /* (284) cmd ::= ANALYZE */
159227 187, /* (285) cmd ::= ANALYZE nm dbnm */
159228 187, /* (286) cmd ::= ALTER TABLE fullname RENAME TO nm */
159229 187, /* (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
159230 292, /* (288) add_column_fullname ::= fullname */
159231 187, /* (289) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
159232 187, /* (290) cmd ::= create_vtab */
159233 187, /* (291) cmd ::= create_vtab LP vtabarglist RP */
159234 294, /* (292) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
159235 296, /* (293) vtabarg ::= */
159236 297, /* (294) vtabargtoken ::= ANY */
159237 297, /* (295) vtabargtoken ::= lp anylist RP */
159238 298, /* (296) lp ::= LP */
159239 262, /* (297) with ::= WITH wqlist */
159240 262, /* (298) with ::= WITH RECURSIVE wqlist */
159241 237, /* (299) wqlist ::= nm eidlist_opt AS LP select RP */
159242 237, /* (300) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
159243 300, /* (301) windowdefn_list ::= windowdefn */
159244 300, /* (302) windowdefn_list ::= windowdefn_list COMMA windowdefn */
159245 301, /* (303) windowdefn ::= nm AS LP window RP */
159246 302, /* (304) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
159247 302, /* (305) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
159248 302, /* (306) window ::= ORDER BY sortlist frame_opt */
159249 302, /* (307) window ::= nm ORDER BY sortlist frame_opt */
159250 302, /* (308) window ::= frame_opt */
159251 302, /* (309) window ::= nm frame_opt */
159252 303, /* (310) frame_opt ::= */
159253 303, /* (311) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
159254 303, /* (312) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
159255 307, /* (313) range_or_rows ::= RANGE|ROWS|GROUPS */
159256 309, /* (314) frame_bound_s ::= frame_bound */
159257 309, /* (315) frame_bound_s ::= UNBOUNDED PRECEDING */
159258 310, /* (316) frame_bound_e ::= frame_bound */
159259 310, /* (317) frame_bound_e ::= UNBOUNDED FOLLOWING */
159260 308, /* (318) frame_bound ::= expr PRECEDING|FOLLOWING */
159261 308, /* (319) frame_bound ::= CURRENT ROW */
159262 311, /* (320) frame_exclude_opt ::= */
159263 311, /* (321) frame_exclude_opt ::= EXCLUDE frame_exclude */
159264 312, /* (322) frame_exclude ::= NO OTHERS */
159265 312, /* (323) frame_exclude ::= CURRENT ROW */
159266 312, /* (324) frame_exclude ::= GROUP|TIES */
159267 247, /* (325) window_clause ::= WINDOW windowdefn_list */
159268 269, /* (326) filter_over ::= filter_clause over_clause */
159269 269, /* (327) filter_over ::= over_clause */
159270 269, /* (328) filter_over ::= filter_clause */
159271 306, /* (329) over_clause ::= OVER LP window RP */
159272 306, /* (330) over_clause ::= OVER nm */
159273 305, /* (331) filter_clause ::= FILTER LP WHERE expr RP */
159274 182, /* (332) input ::= cmdlist */
159275 183, /* (333) cmdlist ::= cmdlist ecmd */
159276 183, /* (334) cmdlist ::= ecmd */
159277 184, /* (335) ecmd ::= SEMI */
159278 184, /* (336) ecmd ::= cmdx SEMI */
159279 184, /* (337) ecmd ::= explain cmdx SEMI */
159280 189, /* (338) trans_opt ::= */
159281 189, /* (339) trans_opt ::= TRANSACTION */
159282 189, /* (340) trans_opt ::= TRANSACTION nm */
159283 191, /* (341) savepoint_opt ::= SAVEPOINT */
159284 191, /* (342) savepoint_opt ::= */
159285 187, /* (343) cmd ::= create_table create_table_args */
159286 198, /* (344) columnlist ::= columnlist COMMA columnname carglist */
159287 198, /* (345) columnlist ::= columnname carglist */
159288 190, /* (346) nm ::= ID|INDEXED */
159289 190, /* (347) nm ::= STRING */
159290 190, /* (348) nm ::= JOIN_KW */
159291 204, /* (349) typetoken ::= typename */
159292 205, /* (350) typename ::= ID|STRING */
159293 206, /* (351) signed ::= plus_num */
159294 206, /* (352) signed ::= minus_num */
159295 203, /* (353) carglist ::= carglist ccons */
159296 203, /* (354) carglist ::= */
159297 211, /* (355) ccons ::= NULL onconf */
159298 211, /* (356) ccons ::= GENERATED ALWAYS AS generated */
159299 211, /* (357) ccons ::= AS generated */
159300 199, /* (358) conslist_opt ::= COMMA conslist */
159301 224, /* (359) conslist ::= conslist tconscomma tcons */
159302 224, /* (360) conslist ::= tcons */
159303 225, /* (361) tconscomma ::= */
159304 229, /* (362) defer_subclause_opt ::= defer_subclause */
159305 231, /* (363) resolvetype ::= raisetype */
159306 235, /* (364) selectnowith ::= oneselect */
159307 236, /* (365) oneselect ::= values */
159308 250, /* (366) sclp ::= selcollist COMMA */
159309 251, /* (367) as ::= ID|STRING */
159310 268, /* (368) returning ::= */
159311 213, /* (369) expr ::= term */
159312 270, /* (370) likeop ::= LIKE_KW|MATCH */
159313 258, /* (371) exprlist ::= nexprlist */
159314 280, /* (372) nmnum ::= plus_num */
159315 280, /* (373) nmnum ::= nm */
159316 280, /* (374) nmnum ::= ON */
159317 280, /* (375) nmnum ::= DELETE */
159318 280, /* (376) nmnum ::= DEFAULT */
159319 207, /* (377) plus_num ::= INTEGER|FLOAT */
159320 285, /* (378) foreach_clause ::= */
159321 285, /* (379) foreach_clause ::= FOR EACH ROW */
159322 288, /* (380) trnm ::= nm */
159323 289, /* (381) tridxby ::= */
159324 290, /* (382) database_kw_opt ::= DATABASE */
159325 290, /* (383) database_kw_opt ::= */
159326 293, /* (384) kwcolumn_opt ::= */
159327 293, /* (385) kwcolumn_opt ::= COLUMNKW */
159328 295, /* (386) vtabarglist ::= vtabarg */
159329 295, /* (387) vtabarglist ::= vtabarglist COMMA vtabarg */
159330 296, /* (388) vtabarg ::= vtabarg vtabargtoken */
159331 299, /* (389) anylist ::= */
159332 299, /* (390) anylist ::= anylist LP anylist RP */
159333 299, /* (391) anylist ::= anylist ANY */
159334 262, /* (392) with ::= */
 
 
 
 
 
159335 };
159336
159337 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
159338 ** of symbols on the right-hand side of that rule. */
159339 static const signed char yyRuleInfoNRhs[] = {
@@ -159623,115 +160082,120 @@
159623 -3, /* (283) cmd ::= REINDEX nm dbnm */
159624 -1, /* (284) cmd ::= ANALYZE */
159625 -3, /* (285) cmd ::= ANALYZE nm dbnm */
159626 -6, /* (286) cmd ::= ALTER TABLE fullname RENAME TO nm */
159627 -7, /* (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
159628 -1, /* (288) add_column_fullname ::= fullname */
159629 -8, /* (289) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
159630 -1, /* (290) cmd ::= create_vtab */
159631 -4, /* (291) cmd ::= create_vtab LP vtabarglist RP */
159632 -8, /* (292) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
159633 0, /* (293) vtabarg ::= */
159634 -1, /* (294) vtabargtoken ::= ANY */
159635 -3, /* (295) vtabargtoken ::= lp anylist RP */
159636 -1, /* (296) lp ::= LP */
159637 -2, /* (297) with ::= WITH wqlist */
159638 -3, /* (298) with ::= WITH RECURSIVE wqlist */
159639 -6, /* (299) wqlist ::= nm eidlist_opt AS LP select RP */
159640 -8, /* (300) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
159641 -1, /* (301) windowdefn_list ::= windowdefn */
159642 -3, /* (302) windowdefn_list ::= windowdefn_list COMMA windowdefn */
159643 -5, /* (303) windowdefn ::= nm AS LP window RP */
159644 -5, /* (304) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
159645 -6, /* (305) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
159646 -4, /* (306) window ::= ORDER BY sortlist frame_opt */
159647 -5, /* (307) window ::= nm ORDER BY sortlist frame_opt */
159648 -1, /* (308) window ::= frame_opt */
159649 -2, /* (309) window ::= nm frame_opt */
159650 0, /* (310) frame_opt ::= */
159651 -3, /* (311) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
159652 -6, /* (312) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
159653 -1, /* (313) range_or_rows ::= RANGE|ROWS|GROUPS */
159654 -1, /* (314) frame_bound_s ::= frame_bound */
159655 -2, /* (315) frame_bound_s ::= UNBOUNDED PRECEDING */
159656 -1, /* (316) frame_bound_e ::= frame_bound */
159657 -2, /* (317) frame_bound_e ::= UNBOUNDED FOLLOWING */
159658 -2, /* (318) frame_bound ::= expr PRECEDING|FOLLOWING */
159659 -2, /* (319) frame_bound ::= CURRENT ROW */
159660 0, /* (320) frame_exclude_opt ::= */
159661 -2, /* (321) frame_exclude_opt ::= EXCLUDE frame_exclude */
159662 -2, /* (322) frame_exclude ::= NO OTHERS */
159663 -2, /* (323) frame_exclude ::= CURRENT ROW */
159664 -1, /* (324) frame_exclude ::= GROUP|TIES */
159665 -2, /* (325) window_clause ::= WINDOW windowdefn_list */
159666 -2, /* (326) filter_over ::= filter_clause over_clause */
159667 -1, /* (327) filter_over ::= over_clause */
159668 -1, /* (328) filter_over ::= filter_clause */
159669 -4, /* (329) over_clause ::= OVER LP window RP */
159670 -2, /* (330) over_clause ::= OVER nm */
159671 -5, /* (331) filter_clause ::= FILTER LP WHERE expr RP */
159672 -1, /* (332) input ::= cmdlist */
159673 -2, /* (333) cmdlist ::= cmdlist ecmd */
159674 -1, /* (334) cmdlist ::= ecmd */
159675 -1, /* (335) ecmd ::= SEMI */
159676 -2, /* (336) ecmd ::= cmdx SEMI */
159677 -3, /* (337) ecmd ::= explain cmdx SEMI */
159678 0, /* (338) trans_opt ::= */
159679 -1, /* (339) trans_opt ::= TRANSACTION */
159680 -2, /* (340) trans_opt ::= TRANSACTION nm */
159681 -1, /* (341) savepoint_opt ::= SAVEPOINT */
159682 0, /* (342) savepoint_opt ::= */
159683 -2, /* (343) cmd ::= create_table create_table_args */
159684 -4, /* (344) columnlist ::= columnlist COMMA columnname carglist */
159685 -2, /* (345) columnlist ::= columnname carglist */
159686 -1, /* (346) nm ::= ID|INDEXED */
159687 -1, /* (347) nm ::= STRING */
159688 -1, /* (348) nm ::= JOIN_KW */
159689 -1, /* (349) typetoken ::= typename */
159690 -1, /* (350) typename ::= ID|STRING */
159691 -1, /* (351) signed ::= plus_num */
159692 -1, /* (352) signed ::= minus_num */
159693 -2, /* (353) carglist ::= carglist ccons */
159694 0, /* (354) carglist ::= */
159695 -2, /* (355) ccons ::= NULL onconf */
159696 -4, /* (356) ccons ::= GENERATED ALWAYS AS generated */
159697 -2, /* (357) ccons ::= AS generated */
159698 -2, /* (358) conslist_opt ::= COMMA conslist */
159699 -3, /* (359) conslist ::= conslist tconscomma tcons */
159700 -1, /* (360) conslist ::= tcons */
159701 0, /* (361) tconscomma ::= */
159702 -1, /* (362) defer_subclause_opt ::= defer_subclause */
159703 -1, /* (363) resolvetype ::= raisetype */
159704 -1, /* (364) selectnowith ::= oneselect */
159705 -1, /* (365) oneselect ::= values */
159706 -2, /* (366) sclp ::= selcollist COMMA */
159707 -1, /* (367) as ::= ID|STRING */
159708 0, /* (368) returning ::= */
159709 -1, /* (369) expr ::= term */
159710 -1, /* (370) likeop ::= LIKE_KW|MATCH */
159711 -1, /* (371) exprlist ::= nexprlist */
159712 -1, /* (372) nmnum ::= plus_num */
159713 -1, /* (373) nmnum ::= nm */
159714 -1, /* (374) nmnum ::= ON */
159715 -1, /* (375) nmnum ::= DELETE */
159716 -1, /* (376) nmnum ::= DEFAULT */
159717 -1, /* (377) plus_num ::= INTEGER|FLOAT */
159718 0, /* (378) foreach_clause ::= */
159719 -3, /* (379) foreach_clause ::= FOR EACH ROW */
159720 -1, /* (380) trnm ::= nm */
159721 0, /* (381) tridxby ::= */
159722 -1, /* (382) database_kw_opt ::= DATABASE */
159723 0, /* (383) database_kw_opt ::= */
159724 0, /* (384) kwcolumn_opt ::= */
159725 -1, /* (385) kwcolumn_opt ::= COLUMNKW */
159726 -1, /* (386) vtabarglist ::= vtabarg */
159727 -3, /* (387) vtabarglist ::= vtabarglist COMMA vtabarg */
159728 -2, /* (388) vtabarg ::= vtabarg vtabargtoken */
159729 0, /* (389) anylist ::= */
159730 -4, /* (390) anylist ::= anylist LP anylist RP */
159731 -2, /* (391) anylist ::= anylist ANY */
159732 0, /* (392) with ::= */
 
 
 
 
 
159733 };
159734
159735 static void yy_accept(yyParser*); /* Forward Declaration */
159736
159737 /*
@@ -159779,20 +160243,20 @@
159779 break;
159780 case 2: /* cmdx ::= cmd */
159781 { sqlite3FinishCoding(pParse); }
159782 break;
159783 case 3: /* cmd ::= BEGIN transtype trans_opt */
159784 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy412);}
159785 break;
159786 case 4: /* transtype ::= */
159787 {yymsp[1].minor.yy412 = TK_DEFERRED;}
159788 break;
159789 case 5: /* transtype ::= DEFERRED */
159790 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
159791 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
159792 case 313: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==313);
159793 {yymsp[0].minor.yy412 = yymsp[0].major; /*A-overwrites-X*/}
159794 break;
159795 case 8: /* cmd ::= COMMIT|END trans_opt */
159796 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
159797 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
159798 break;
@@ -159811,11 +160275,11 @@
159811 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
159812 }
159813 break;
159814 case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
159815 {
159816 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy412,0,0,yymsp[-2].minor.yy412);
159817 }
159818 break;
159819 case 14: /* createkw ::= CREATE */
159820 {disableLookaside(pParse);}
159821 break;
@@ -159826,36 +160290,36 @@
159826 case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60);
159827 case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70);
159828 case 79: /* ifexists ::= */ yytestcase(yyruleno==79);
159829 case 96: /* distinct ::= */ yytestcase(yyruleno==96);
159830 case 239: /* collate ::= */ yytestcase(yyruleno==239);
159831 {yymsp[1].minor.yy412 = 0;}
159832 break;
159833 case 16: /* ifnotexists ::= IF NOT EXISTS */
159834 {yymsp[-2].minor.yy412 = 1;}
159835 break;
159836 case 17: /* temp ::= TEMP */
159837 case 46: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==46);
159838 {yymsp[0].minor.yy412 = 1;}
159839 break;
159840 case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
159841 {
159842 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy412,0);
159843 }
159844 break;
159845 case 20: /* create_table_args ::= AS select */
159846 {
159847 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy293);
159848 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy293);
159849 }
159850 break;
159851 case 22: /* table_options ::= WITHOUT nm */
159852 {
159853 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
159854 yymsp[-1].minor.yy412 = TF_WithoutRowid | TF_NoVisibleRowid;
159855 }else{
159856 yymsp[-1].minor.yy412 = 0;
159857 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
159858 }
159859 }
159860 break;
159861 case 23: /* columnname ::= nm typetoken */
@@ -159880,11 +160344,11 @@
159880 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
159881 break;
159882 case 28: /* scanpt ::= */
159883 {
159884 assert( yyLookahead!=YYNOCODE );
159885 yymsp[1].minor.yy504 = yyLookaheadToken.z;
159886 }
159887 break;
159888 case 29: /* scantok ::= */
159889 {
159890 assert( yyLookahead!=YYNOCODE );
@@ -159894,21 +160358,21 @@
159894 case 30: /* ccons ::= CONSTRAINT nm */
159895 case 65: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==65);
159896 {pParse->constraintName = yymsp[0].minor.yy0;}
159897 break;
159898 case 31: /* ccons ::= DEFAULT scantok term */
159899 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy354,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
159900 break;
159901 case 32: /* ccons ::= DEFAULT LP expr RP */
159902 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy354,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
159903 break;
159904 case 33: /* ccons ::= DEFAULT PLUS scantok term */
159905 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy354,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
159906 break;
159907 case 34: /* ccons ::= DEFAULT MINUS scantok term */
159908 {
159909 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy354, 0);
159910 sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
159911 }
159912 break;
159913 case 35: /* ccons ::= DEFAULT scantok ID|INDEXED */
159914 {
@@ -159919,274 +160383,256 @@
159919 }
159920 sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
159921 }
159922 break;
159923 case 36: /* ccons ::= NOT NULL onconf */
159924 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy412);}
159925 break;
159926 case 37: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
159927 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy412,yymsp[0].minor.yy412,yymsp[-2].minor.yy412);}
159928 break;
159929 case 38: /* ccons ::= UNIQUE onconf */
159930 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy412,0,0,0,0,
159931 SQLITE_IDXTYPE_UNIQUE);}
159932 break;
159933 case 39: /* ccons ::= CHECK LP expr RP */
159934 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy354,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
159935 break;
159936 case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */
159937 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy350,yymsp[0].minor.yy412);}
159938 break;
159939 case 41: /* ccons ::= defer_subclause */
159940 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy412);}
159941 break;
159942 case 42: /* ccons ::= COLLATE ID|STRING */
159943 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
159944 break;
159945 case 43: /* generated ::= LP expr RP */
159946 {sqlite3AddGenerated(pParse,yymsp[-1].minor.yy354,0);}
159947 break;
159948 case 44: /* generated ::= LP expr RP ID */
159949 {sqlite3AddGenerated(pParse,yymsp[-2].minor.yy354,&yymsp[0].minor.yy0);}
159950 break;
159951 case 47: /* refargs ::= */
159952 { yymsp[1].minor.yy412 = OE_None*0x0101; /* EV: R-19803-45884 */}
159953 break;
159954 case 48: /* refargs ::= refargs refarg */
159955 { yymsp[-1].minor.yy412 = (yymsp[-1].minor.yy412 & ~yymsp[0].minor.yy463.mask) | yymsp[0].minor.yy463.value; }
159956 break;
159957 case 49: /* refarg ::= MATCH nm */
159958 { yymsp[-1].minor.yy463.value = 0; yymsp[-1].minor.yy463.mask = 0x000000; }
159959 break;
159960 case 50: /* refarg ::= ON INSERT refact */
159961 { yymsp[-2].minor.yy463.value = 0; yymsp[-2].minor.yy463.mask = 0x000000; }
159962 break;
159963 case 51: /* refarg ::= ON DELETE refact */
159964 { yymsp[-2].minor.yy463.value = yymsp[0].minor.yy412; yymsp[-2].minor.yy463.mask = 0x0000ff; }
159965 break;
159966 case 52: /* refarg ::= ON UPDATE refact */
159967 { yymsp[-2].minor.yy463.value = yymsp[0].minor.yy412<<8; yymsp[-2].minor.yy463.mask = 0x00ff00; }
159968 break;
159969 case 53: /* refact ::= SET NULL */
159970 { yymsp[-1].minor.yy412 = OE_SetNull; /* EV: R-33326-45252 */}
159971 break;
159972 case 54: /* refact ::= SET DEFAULT */
159973 { yymsp[-1].minor.yy412 = OE_SetDflt; /* EV: R-33326-45252 */}
159974 break;
159975 case 55: /* refact ::= CASCADE */
159976 { yymsp[0].minor.yy412 = OE_Cascade; /* EV: R-33326-45252 */}
159977 break;
159978 case 56: /* refact ::= RESTRICT */
159979 { yymsp[0].minor.yy412 = OE_Restrict; /* EV: R-33326-45252 */}
159980 break;
159981 case 57: /* refact ::= NO ACTION */
159982 { yymsp[-1].minor.yy412 = OE_None; /* EV: R-33326-45252 */}
159983 break;
159984 case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
159985 {yymsp[-2].minor.yy412 = 0;}
159986 break;
159987 case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
159988 case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74);
159989 case 169: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==169);
159990 {yymsp[-1].minor.yy412 = yymsp[0].minor.yy412;}
159991 break;
159992 case 61: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
159993 case 78: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==78);
159994 case 211: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==211);
159995 case 214: /* in_op ::= NOT IN */ yytestcase(yyruleno==214);
159996 case 240: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==240);
159997 {yymsp[-1].minor.yy412 = 1;}
159998 break;
159999 case 62: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
160000 {yymsp[-1].minor.yy412 = 0;}
160001 break;
160002 case 64: /* tconscomma ::= COMMA */
160003 {pParse->constraintName.n = 0;}
160004 break;
160005 case 66: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
160006 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy350,yymsp[0].minor.yy412,yymsp[-2].minor.yy412,0);}
160007 break;
160008 case 67: /* tcons ::= UNIQUE LP sortlist RP onconf */
160009 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy350,yymsp[0].minor.yy412,0,0,0,0,
160010 SQLITE_IDXTYPE_UNIQUE);}
160011 break;
160012 case 68: /* tcons ::= CHECK LP expr RP onconf */
160013 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy354,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
160014 break;
160015 case 69: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
160016 {
160017 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy350, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy350, yymsp[-1].minor.yy412);
160018 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy412);
160019 }
160020 break;
160021 case 71: /* onconf ::= */
160022 case 73: /* orconf ::= */ yytestcase(yyruleno==73);
160023 {yymsp[1].minor.yy412 = OE_Default;}
160024 break;
160025 case 72: /* onconf ::= ON CONFLICT resolvetype */
160026 {yymsp[-2].minor.yy412 = yymsp[0].minor.yy412;}
160027 break;
160028 case 75: /* resolvetype ::= IGNORE */
160029 {yymsp[0].minor.yy412 = OE_Ignore;}
160030 break;
160031 case 76: /* resolvetype ::= REPLACE */
160032 case 170: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==170);
160033 {yymsp[0].minor.yy412 = OE_Replace;}
160034 break;
160035 case 77: /* cmd ::= DROP TABLE ifexists fullname */
160036 {
160037 sqlite3DropTable(pParse, yymsp[0].minor.yy457, 0, yymsp[-1].minor.yy412);
160038 }
160039 break;
160040 case 80: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
160041 {
160042 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy350, yymsp[0].minor.yy293, yymsp[-7].minor.yy412, yymsp[-5].minor.yy412);
160043 }
160044 break;
160045 case 81: /* cmd ::= DROP VIEW ifexists fullname */
160046 {
160047 sqlite3DropTable(pParse, yymsp[0].minor.yy457, 1, yymsp[-1].minor.yy412);
160048 }
160049 break;
160050 case 82: /* cmd ::= select */
160051 {
160052 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
160053 sqlite3Select(pParse, yymsp[0].minor.yy293, &dest);
160054 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy293);
160055 }
160056 break;
160057 case 83: /* select ::= WITH wqlist selectnowith */
160058 {
160059 Select *p = yymsp[0].minor.yy293;
160060 if( p ){
160061 p->pWith = yymsp[-1].minor.yy105;
160062 parserDoubleLinkSelect(pParse, p);
160063 }else{
160064 sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy105);
160065 }
160066 yymsp[-2].minor.yy293 = p;
160067 }
160068 break;
160069 case 84: /* select ::= WITH RECURSIVE wqlist selectnowith */
160070 {
160071 Select *p = yymsp[0].minor.yy293;
160072 if( p ){
160073 p->pWith = yymsp[-1].minor.yy105;
160074 parserDoubleLinkSelect(pParse, p);
160075 }else{
160076 sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy105);
160077 }
160078 yymsp[-3].minor.yy293 = p;
160079 }
160080 break;
160081 case 85: /* select ::= selectnowith */
160082 {
160083 Select *p = yymsp[0].minor.yy293;
160084 if( p ){
160085 parserDoubleLinkSelect(pParse, p);
160086 }
160087 yymsp[0].minor.yy293 = p; /*A-overwrites-X*/
160088 }
160089 break;
160090 case 86: /* selectnowith ::= selectnowith multiselect_op oneselect */
160091 {
160092 Select *pRhs = yymsp[0].minor.yy293;
160093 Select *pLhs = yymsp[-2].minor.yy293;
160094 if( pRhs && pRhs->pPrior ){
160095 SrcList *pFrom;
160096 Token x;
160097 x.n = 0;
160098 parserDoubleLinkSelect(pParse, pRhs);
160099 pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
160100 pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
160101 }
160102 if( pRhs ){
160103 pRhs->op = (u8)yymsp[-1].minor.yy412;
160104 pRhs->pPrior = pLhs;
160105 if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
160106 pRhs->selFlags &= ~SF_MultiValue;
160107 if( yymsp[-1].minor.yy412!=TK_ALL ) pParse->hasCompound = 1;
160108 }else{
160109 sqlite3SelectDelete(pParse->db, pLhs);
160110 }
160111 yymsp[-2].minor.yy293 = pRhs;
160112 }
160113 break;
160114 case 87: /* multiselect_op ::= UNION */
160115 case 89: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==89);
160116 {yymsp[0].minor.yy412 = yymsp[0].major; /*A-overwrites-OP*/}
160117 break;
160118 case 88: /* multiselect_op ::= UNION ALL */
160119 {yymsp[-1].minor.yy412 = TK_ALL;}
160120 break;
160121 case 90: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
160122 {
160123 yymsp[-8].minor.yy293 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy350,yymsp[-5].minor.yy457,yymsp[-4].minor.yy354,yymsp[-3].minor.yy350,yymsp[-2].minor.yy354,yymsp[-1].minor.yy350,yymsp[-7].minor.yy412,yymsp[0].minor.yy354);
160124 }
160125 break;
160126 case 91: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
160127 {
160128 yymsp[-9].minor.yy293 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy350,yymsp[-6].minor.yy457,yymsp[-5].minor.yy354,yymsp[-4].minor.yy350,yymsp[-3].minor.yy354,yymsp[-1].minor.yy350,yymsp[-8].minor.yy412,yymsp[0].minor.yy354);
160129 if( yymsp[-9].minor.yy293 ){
160130 yymsp[-9].minor.yy293->pWinDefn = yymsp[-2].minor.yy503;
160131 }else{
160132 sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy503);
160133 }
160134 }
160135 break;
160136 case 92: /* values ::= VALUES LP nexprlist RP */
160137 {
160138 yymsp[-3].minor.yy293 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy350,0,0,0,0,0,SF_Values,0);
160139 }
160140 break;
160141 case 93: /* values ::= values COMMA LP nexprlist RP */
160142 {
160143 Select *pRight, *pLeft = yymsp[-4].minor.yy293;
160144 pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy350,0,0,0,0,0,SF_Values|SF_MultiValue,0);
160145 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
160146 if( pRight ){
160147 pRight->op = TK_ALL;
160148 pRight->pPrior = pLeft;
160149 yymsp[-4].minor.yy293 = pRight;
160150 }else{
160151 yymsp[-4].minor.yy293 = pLeft;
160152 }
160153 }
160154 break;
160155 case 94: /* distinct ::= DISTINCT */
160156 {yymsp[0].minor.yy412 = SF_Distinct;}
160157 break;
160158 case 95: /* distinct ::= ALL */
160159 {yymsp[0].minor.yy412 = SF_All;}
160160 break;
160161 case 97: /* sclp ::= */
160162 case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130);
160163 case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140);
160164 case 227: /* exprlist ::= */ yytestcase(yyruleno==227);
160165 case 230: /* paren_exprlist ::= */ yytestcase(yyruleno==230);
160166 case 235: /* eidlist_opt ::= */ yytestcase(yyruleno==235);
160167 {yymsp[1].minor.yy350 = 0;}
160168 break;
160169 case 98: /* selcollist ::= sclp scanpt expr scanpt as */
160170 {
160171 yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy350, yymsp[-2].minor.yy354);
160172 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy350, &yymsp[0].minor.yy0, 1);
160173 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy350,yymsp[-3].minor.yy504,yymsp[-1].minor.yy504);
160174 }
160175 break;
160176 case 99: /* selcollist ::= sclp scanpt STAR */
160177 {
160178 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
160179 yymsp[-2].minor.yy350 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy350, p);
160180 }
160181 break;
160182 case 100: /* selcollist ::= sclp scanpt nm DOT STAR */
160183 {
160184 Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
160185 Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
160186 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
160187 yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy350, pDot);
160188 }
160189 break;
160190 case 101: /* as ::= AS nm */
160191 case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112);
160192 case 251: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==251);
@@ -160193,49 +160639,49 @@
160193 case 252: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==252);
160194 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
160195 break;
160196 case 103: /* from ::= */
160197 case 106: /* stl_prefix ::= */ yytestcase(yyruleno==106);
160198 {yymsp[1].minor.yy457 = 0;}
160199 break;
160200 case 104: /* from ::= FROM seltablist */
160201 {
160202 yymsp[-1].minor.yy457 = yymsp[0].minor.yy457;
160203 sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy457);
160204 }
160205 break;
160206 case 105: /* stl_prefix ::= seltablist joinop */
160207 {
160208 if( ALWAYS(yymsp[-1].minor.yy457 && yymsp[-1].minor.yy457->nSrc>0) ) yymsp[-1].minor.yy457->a[yymsp[-1].minor.yy457->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy412;
160209 }
160210 break;
160211 case 107: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
160212 {
160213 yymsp[-6].minor.yy457 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy457,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy354,yymsp[0].minor.yy498);
160214 sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy457, &yymsp[-2].minor.yy0);
160215 }
160216 break;
160217 case 108: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
160218 {
160219 yymsp[-8].minor.yy457 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy457,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy354,yymsp[0].minor.yy498);
160220 sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy457, yymsp[-4].minor.yy350);
160221 }
160222 break;
160223 case 109: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
160224 {
160225 yymsp[-6].minor.yy457 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy457,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy293,yymsp[-1].minor.yy354,yymsp[0].minor.yy498);
160226 }
160227 break;
160228 case 110: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
160229 {
160230 if( yymsp[-6].minor.yy457==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy354==0 && yymsp[0].minor.yy498==0 ){
160231 yymsp[-6].minor.yy457 = yymsp[-4].minor.yy457;
160232 }else if( yymsp[-4].minor.yy457->nSrc==1 ){
160233 yymsp[-6].minor.yy457 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy457,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy354,yymsp[0].minor.yy498);
160234 if( yymsp[-6].minor.yy457 ){
160235 struct SrcList_item *pNew = &yymsp[-6].minor.yy457->a[yymsp[-6].minor.yy457->nSrc-1];
160236 struct SrcList_item *pOld = yymsp[-4].minor.yy457->a;
160237 pNew->zName = pOld->zName;
160238 pNew->zDatabase = pOld->zDatabase;
160239 pNew->pSelect = pOld->pSelect;
160240 if( pOld->fg.isTabFunc ){
160241 pNew->u1.pFuncArg = pOld->u1.pFuncArg;
@@ -160244,240 +160690,240 @@
160244 pNew->fg.isTabFunc = 1;
160245 }
160246 pOld->zName = pOld->zDatabase = 0;
160247 pOld->pSelect = 0;
160248 }
160249 sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy457);
160250 }else{
160251 Select *pSubquery;
160252 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy457);
160253 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy457,0,0,0,0,SF_NestedFrom,0);
160254 yymsp[-6].minor.yy457 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy457,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy354,yymsp[0].minor.yy498);
160255 }
160256 }
160257 break;
160258 case 111: /* dbnm ::= */
160259 case 125: /* indexed_opt ::= */ yytestcase(yyruleno==125);
160260 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
160261 break;
160262 case 113: /* fullname ::= nm */
160263 {
160264 yylhsminor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
160265 if( IN_RENAME_OBJECT && yylhsminor.yy457 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy457->a[0].zName, &yymsp[0].minor.yy0);
160266 }
160267 yymsp[0].minor.yy457 = yylhsminor.yy457;
160268 break;
160269 case 114: /* fullname ::= nm DOT nm */
160270 {
160271 yylhsminor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
160272 if( IN_RENAME_OBJECT && yylhsminor.yy457 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy457->a[0].zName, &yymsp[0].minor.yy0);
160273 }
160274 yymsp[-2].minor.yy457 = yylhsminor.yy457;
160275 break;
160276 case 115: /* xfullname ::= nm */
160277 {yymsp[0].minor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
160278 break;
160279 case 116: /* xfullname ::= nm DOT nm */
160280 {yymsp[-2].minor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
160281 break;
160282 case 117: /* xfullname ::= nm DOT nm AS nm */
160283 {
160284 yymsp[-4].minor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
160285 if( yymsp[-4].minor.yy457 ) yymsp[-4].minor.yy457->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
160286 }
160287 break;
160288 case 118: /* xfullname ::= nm AS nm */
160289 {
160290 yymsp[-2].minor.yy457 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
160291 if( yymsp[-2].minor.yy457 ) yymsp[-2].minor.yy457->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
160292 }
160293 break;
160294 case 119: /* joinop ::= COMMA|JOIN */
160295 { yymsp[0].minor.yy412 = JT_INNER; }
160296 break;
160297 case 120: /* joinop ::= JOIN_KW JOIN */
160298 {yymsp[-1].minor.yy412 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
160299 break;
160300 case 121: /* joinop ::= JOIN_KW nm JOIN */
160301 {yymsp[-2].minor.yy412 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
160302 break;
160303 case 122: /* joinop ::= JOIN_KW nm nm JOIN */
160304 {yymsp[-3].minor.yy412 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
160305 break;
160306 case 123: /* on_opt ::= ON expr */
160307 case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143);
160308 case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150);
160309 case 152: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==152);
160310 case 223: /* case_else ::= ELSE expr */ yytestcase(yyruleno==223);
160311 case 244: /* vinto ::= INTO expr */ yytestcase(yyruleno==244);
160312 {yymsp[-1].minor.yy354 = yymsp[0].minor.yy354;}
160313 break;
160314 case 124: /* on_opt ::= */
160315 case 142: /* having_opt ::= */ yytestcase(yyruleno==142);
160316 case 144: /* limit_opt ::= */ yytestcase(yyruleno==144);
160317 case 149: /* where_opt ::= */ yytestcase(yyruleno==149);
160318 case 151: /* where_opt_ret ::= */ yytestcase(yyruleno==151);
160319 case 224: /* case_else ::= */ yytestcase(yyruleno==224);
160320 case 226: /* case_operand ::= */ yytestcase(yyruleno==226);
160321 case 245: /* vinto ::= */ yytestcase(yyruleno==245);
160322 {yymsp[1].minor.yy354 = 0;}
160323 break;
160324 case 126: /* indexed_opt ::= INDEXED BY nm */
160325 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
160326 break;
160327 case 127: /* indexed_opt ::= NOT INDEXED */
160328 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
160329 break;
160330 case 128: /* using_opt ::= USING LP idlist RP */
160331 {yymsp[-3].minor.yy498 = yymsp[-1].minor.yy498;}
160332 break;
160333 case 129: /* using_opt ::= */
160334 case 171: /* idlist_opt ::= */ yytestcase(yyruleno==171);
160335 {yymsp[1].minor.yy498 = 0;}
160336 break;
160337 case 131: /* orderby_opt ::= ORDER BY sortlist */
160338 case 141: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==141);
160339 {yymsp[-2].minor.yy350 = yymsp[0].minor.yy350;}
160340 break;
160341 case 132: /* sortlist ::= sortlist COMMA expr sortorder nulls */
160342 {
160343 yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy350,yymsp[-2].minor.yy354);
160344 sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy350,yymsp[-1].minor.yy412,yymsp[0].minor.yy412);
160345 }
160346 break;
160347 case 133: /* sortlist ::= expr sortorder nulls */
160348 {
160349 yymsp[-2].minor.yy350 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy354); /*A-overwrites-Y*/
160350 sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy350,yymsp[-1].minor.yy412,yymsp[0].minor.yy412);
160351 }
160352 break;
160353 case 134: /* sortorder ::= ASC */
160354 {yymsp[0].minor.yy412 = SQLITE_SO_ASC;}
160355 break;
160356 case 135: /* sortorder ::= DESC */
160357 {yymsp[0].minor.yy412 = SQLITE_SO_DESC;}
160358 break;
160359 case 136: /* sortorder ::= */
160360 case 139: /* nulls ::= */ yytestcase(yyruleno==139);
160361 {yymsp[1].minor.yy412 = SQLITE_SO_UNDEFINED;}
160362 break;
160363 case 137: /* nulls ::= NULLS FIRST */
160364 {yymsp[-1].minor.yy412 = SQLITE_SO_ASC;}
160365 break;
160366 case 138: /* nulls ::= NULLS LAST */
160367 {yymsp[-1].minor.yy412 = SQLITE_SO_DESC;}
160368 break;
160369 case 145: /* limit_opt ::= LIMIT expr */
160370 {yymsp[-1].minor.yy354 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy354,0);}
160371 break;
160372 case 146: /* limit_opt ::= LIMIT expr OFFSET expr */
160373 {yymsp[-3].minor.yy354 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy354,yymsp[0].minor.yy354);}
160374 break;
160375 case 147: /* limit_opt ::= LIMIT expr COMMA expr */
160376 {yymsp[-3].minor.yy354 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy354,yymsp[-2].minor.yy354);}
160377 break;
160378 case 148: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
160379 {
160380 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy457, &yymsp[-1].minor.yy0);
160381 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy457,yymsp[0].minor.yy354,0,0);
160382 }
160383 break;
160384 case 153: /* where_opt_ret ::= RETURNING selcollist */
160385 {sqlite3AddReturning(pParse,yymsp[0].minor.yy350); yymsp[-1].minor.yy354 = 0;}
160386 break;
160387 case 154: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
160388 {sqlite3AddReturning(pParse,yymsp[0].minor.yy350); yymsp[-3].minor.yy354 = yymsp[-2].minor.yy354;}
160389 break;
160390 case 155: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
160391 {
160392 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy457, &yymsp[-4].minor.yy0);
160393 sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy350,"set list");
160394 yymsp[-5].minor.yy457 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy457, yymsp[-1].minor.yy457);
160395 sqlite3Update(pParse,yymsp[-5].minor.yy457,yymsp[-2].minor.yy350,yymsp[0].minor.yy354,yymsp[-6].minor.yy412,0,0,0);
160396 }
160397 break;
160398 case 156: /* setlist ::= setlist COMMA nm EQ expr */
160399 {
160400 yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy350, yymsp[0].minor.yy354);
160401 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy350, &yymsp[-2].minor.yy0, 1);
160402 }
160403 break;
160404 case 157: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
160405 {
160406 yymsp[-6].minor.yy350 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy350, yymsp[-3].minor.yy498, yymsp[0].minor.yy354);
160407 }
160408 break;
160409 case 158: /* setlist ::= nm EQ expr */
160410 {
160411 yylhsminor.yy350 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy354);
160412 sqlite3ExprListSetName(pParse, yylhsminor.yy350, &yymsp[-2].minor.yy0, 1);
160413 }
160414 yymsp[-2].minor.yy350 = yylhsminor.yy350;
160415 break;
160416 case 159: /* setlist ::= LP idlist RP EQ expr */
160417 {
160418 yymsp[-4].minor.yy350 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy498, yymsp[0].minor.yy354);
160419 }
160420 break;
160421 case 160: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
160422 {
160423 sqlite3Insert(pParse, yymsp[-3].minor.yy457, yymsp[-1].minor.yy293, yymsp[-2].minor.yy498, yymsp[-5].minor.yy412, yymsp[0].minor.yy40);
160424 }
160425 break;
160426 case 161: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
160427 {
160428 sqlite3Insert(pParse, yymsp[-4].minor.yy457, 0, yymsp[-3].minor.yy498, yymsp[-6].minor.yy412, 0);
160429 }
160430 break;
160431 case 162: /* upsert ::= */
160432 { yymsp[1].minor.yy40 = 0; }
160433 break;
160434 case 163: /* upsert ::= RETURNING selcollist */
160435 { yymsp[-1].minor.yy40 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy350); }
160436 break;
160437 case 164: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
160438 { yymsp[-11].minor.yy40 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy350,yymsp[-6].minor.yy354,yymsp[-2].minor.yy350,yymsp[-1].minor.yy354,yymsp[0].minor.yy40);}
160439 break;
160440 case 165: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
160441 { yymsp[-8].minor.yy40 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy350,yymsp[-3].minor.yy354,0,0,yymsp[0].minor.yy40); }
160442 break;
160443 case 166: /* upsert ::= ON CONFLICT DO NOTHING returning */
160444 { yymsp[-4].minor.yy40 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
160445 break;
160446 case 167: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
160447 { yymsp[-7].minor.yy40 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy350,yymsp[-1].minor.yy354,0);}
160448 break;
160449 case 168: /* returning ::= RETURNING selcollist */
160450 {sqlite3AddReturning(pParse,yymsp[0].minor.yy350);}
160451 break;
160452 case 172: /* idlist_opt ::= LP idlist RP */
160453 {yymsp[-2].minor.yy498 = yymsp[-1].minor.yy498;}
160454 break;
160455 case 173: /* idlist ::= idlist COMMA nm */
160456 {yymsp[-2].minor.yy498 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy498,&yymsp[0].minor.yy0);}
160457 break;
160458 case 174: /* idlist ::= nm */
160459 {yymsp[0].minor.yy498 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
160460 break;
160461 case 175: /* expr ::= LP expr RP */
160462 {yymsp[-2].minor.yy354 = yymsp[-1].minor.yy354;}
160463 break;
160464 case 176: /* expr ::= ID|INDEXED */
160465 case 177: /* expr ::= JOIN_KW */ yytestcase(yyruleno==177);
160466 {yymsp[0].minor.yy354=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
160467 break;
160468 case 178: /* expr ::= nm DOT nm */
160469 {
160470 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
160471 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
160472 if( IN_RENAME_OBJECT ){
160473 sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
160474 sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0);
160475 }
160476 yylhsminor.yy354 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
160477 }
160478 yymsp[-2].minor.yy354 = yylhsminor.yy354;
160479 break;
160480 case 179: /* expr ::= nm DOT nm DOT nm */
160481 {
160482 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
160483 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
@@ -160485,322 +160931,322 @@
160485 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
160486 if( IN_RENAME_OBJECT ){
160487 sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0);
160488 sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0);
160489 }
160490 yylhsminor.yy354 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
160491 }
160492 yymsp[-4].minor.yy354 = yylhsminor.yy354;
160493 break;
160494 case 180: /* term ::= NULL|FLOAT|BLOB */
160495 case 181: /* term ::= STRING */ yytestcase(yyruleno==181);
160496 {yymsp[0].minor.yy354=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
160497 break;
160498 case 182: /* term ::= INTEGER */
160499 {
160500 yylhsminor.yy354 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
160501 }
160502 yymsp[0].minor.yy354 = yylhsminor.yy354;
160503 break;
160504 case 183: /* expr ::= VARIABLE */
160505 {
160506 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
160507 u32 n = yymsp[0].minor.yy0.n;
160508 yymsp[0].minor.yy354 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
160509 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy354, n);
160510 }else{
160511 /* When doing a nested parse, one can include terms in an expression
160512 ** that look like this: #1 #2 ... These terms refer to registers
160513 ** in the virtual machine. #N is the N-th register. */
160514 Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
160515 assert( t.n>=2 );
160516 if( pParse->nested==0 ){
160517 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
160518 yymsp[0].minor.yy354 = 0;
160519 }else{
160520 yymsp[0].minor.yy354 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
160521 if( yymsp[0].minor.yy354 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy354->iTable);
160522 }
160523 }
160524 }
160525 break;
160526 case 184: /* expr ::= expr COLLATE ID|STRING */
160527 {
160528 yymsp[-2].minor.yy354 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy354, &yymsp[0].minor.yy0, 1);
160529 }
160530 break;
160531 case 185: /* expr ::= CAST LP expr AS typetoken RP */
160532 {
160533 yymsp[-5].minor.yy354 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
160534 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy354, yymsp[-3].minor.yy354, 0);
160535 }
160536 break;
160537 case 186: /* expr ::= ID|INDEXED LP distinct exprlist RP */
160538 {
160539 yylhsminor.yy354 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy350, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy412);
160540 }
160541 yymsp[-4].minor.yy354 = yylhsminor.yy354;
160542 break;
160543 case 187: /* expr ::= ID|INDEXED LP STAR RP */
160544 {
160545 yylhsminor.yy354 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
160546 }
160547 yymsp[-3].minor.yy354 = yylhsminor.yy354;
160548 break;
160549 case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
160550 {
160551 yylhsminor.yy354 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy350, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy412);
160552 sqlite3WindowAttach(pParse, yylhsminor.yy354, yymsp[0].minor.yy503);
160553 }
160554 yymsp[-5].minor.yy354 = yylhsminor.yy354;
160555 break;
160556 case 189: /* expr ::= ID|INDEXED LP STAR RP filter_over */
160557 {
160558 yylhsminor.yy354 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
160559 sqlite3WindowAttach(pParse, yylhsminor.yy354, yymsp[0].minor.yy503);
160560 }
160561 yymsp[-4].minor.yy354 = yylhsminor.yy354;
160562 break;
160563 case 190: /* term ::= CTIME_KW */
160564 {
160565 yylhsminor.yy354 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
160566 }
160567 yymsp[0].minor.yy354 = yylhsminor.yy354;
160568 break;
160569 case 191: /* expr ::= LP nexprlist COMMA expr RP */
160570 {
160571 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy350, yymsp[-1].minor.yy354);
160572 yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
160573 if( yymsp[-4].minor.yy354 ){
160574 yymsp[-4].minor.yy354->x.pList = pList;
160575 if( ALWAYS(pList->nExpr) ){
160576 yymsp[-4].minor.yy354->flags |= pList->a[0].pExpr->flags & EP_Propagate;
160577 }
160578 }else{
160579 sqlite3ExprListDelete(pParse->db, pList);
160580 }
160581 }
160582 break;
160583 case 192: /* expr ::= expr AND expr */
160584 {yymsp[-2].minor.yy354=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy354,yymsp[0].minor.yy354);}
160585 break;
160586 case 193: /* expr ::= expr OR expr */
160587 case 194: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==194);
160588 case 195: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==195);
160589 case 196: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==196);
160590 case 197: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==197);
160591 case 198: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==198);
160592 case 199: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==199);
160593 {yymsp[-2].minor.yy354=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy354,yymsp[0].minor.yy354);}
160594 break;
160595 case 200: /* likeop ::= NOT LIKE_KW|MATCH */
160596 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
160597 break;
160598 case 201: /* expr ::= expr likeop expr */
160599 {
160600 ExprList *pList;
160601 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
160602 yymsp[-1].minor.yy0.n &= 0x7fffffff;
160603 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy354);
160604 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy354);
160605 yymsp[-2].minor.yy354 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
160606 if( bNot ) yymsp[-2].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy354, 0);
160607 if( yymsp[-2].minor.yy354 ) yymsp[-2].minor.yy354->flags |= EP_InfixFunc;
160608 }
160609 break;
160610 case 202: /* expr ::= expr likeop expr ESCAPE expr */
160611 {
160612 ExprList *pList;
160613 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
160614 yymsp[-3].minor.yy0.n &= 0x7fffffff;
160615 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy354);
160616 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy354);
160617 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy354);
160618 yymsp[-4].minor.yy354 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
160619 if( bNot ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
160620 if( yymsp[-4].minor.yy354 ) yymsp[-4].minor.yy354->flags |= EP_InfixFunc;
160621 }
160622 break;
160623 case 203: /* expr ::= expr ISNULL|NOTNULL */
160624 {yymsp[-1].minor.yy354 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy354,0);}
160625 break;
160626 case 204: /* expr ::= expr NOT NULL */
160627 {yymsp[-2].minor.yy354 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy354,0);}
160628 break;
160629 case 205: /* expr ::= expr IS expr */
160630 {
160631 yymsp[-2].minor.yy354 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy354,yymsp[0].minor.yy354);
160632 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy354, yymsp[-2].minor.yy354, TK_ISNULL);
160633 }
160634 break;
160635 case 206: /* expr ::= expr IS NOT expr */
160636 {
160637 yymsp[-3].minor.yy354 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy354,yymsp[0].minor.yy354);
160638 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy354, yymsp[-3].minor.yy354, TK_NOTNULL);
160639 }
160640 break;
160641 case 207: /* expr ::= NOT expr */
160642 case 208: /* expr ::= BITNOT expr */ yytestcase(yyruleno==208);
160643 {yymsp[-1].minor.yy354 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy354, 0);/*A-overwrites-B*/}
160644 break;
160645 case 209: /* expr ::= PLUS|MINUS expr */
160646 {
160647 yymsp[-1].minor.yy354 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy354, 0);
160648 /*A-overwrites-B*/
160649 }
160650 break;
160651 case 210: /* between_op ::= BETWEEN */
160652 case 213: /* in_op ::= IN */ yytestcase(yyruleno==213);
160653 {yymsp[0].minor.yy412 = 0;}
160654 break;
160655 case 212: /* expr ::= expr between_op expr AND expr */
160656 {
160657 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy354);
160658 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy354);
160659 yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy354, 0);
160660 if( yymsp[-4].minor.yy354 ){
160661 yymsp[-4].minor.yy354->x.pList = pList;
160662 }else{
160663 sqlite3ExprListDelete(pParse->db, pList);
160664 }
160665 if( yymsp[-3].minor.yy412 ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
160666 }
160667 break;
160668 case 215: /* expr ::= expr in_op LP exprlist RP */
160669 {
160670 if( yymsp[-1].minor.yy350==0 ){
160671 /* Expressions of the form
160672 **
160673 ** expr1 IN ()
160674 ** expr1 NOT IN ()
160675 **
160676 ** simplify to constants 0 (false) and 1 (true), respectively,
160677 ** regardless of the value of expr1.
160678 */
160679 sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy354);
160680 yymsp[-4].minor.yy354 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy412 ? "1" : "0");
160681 }else if( yymsp[-1].minor.yy350->nExpr==1 && sqlite3ExprIsConstant(yymsp[-1].minor.yy350->a[0].pExpr) ){
160682 Expr *pRHS = yymsp[-1].minor.yy350->a[0].pExpr;
160683 yymsp[-1].minor.yy350->a[0].pExpr = 0;
160684 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy350);
160685 pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
160686 yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy354, pRHS);
160687 if( yymsp[-3].minor.yy412 ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
160688 }else{
160689 yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy354, 0);
160690 if( yymsp[-4].minor.yy354 ){
160691 yymsp[-4].minor.yy354->x.pList = yymsp[-1].minor.yy350;
160692 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy354);
160693 }else{
160694 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy350);
160695 }
160696 if( yymsp[-3].minor.yy412 ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
160697 }
160698 }
160699 break;
160700 case 216: /* expr ::= LP select RP */
160701 {
160702 yymsp[-2].minor.yy354 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
160703 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy354, yymsp[-1].minor.yy293);
160704 }
160705 break;
160706 case 217: /* expr ::= expr in_op LP select RP */
160707 {
160708 yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy354, 0);
160709 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy354, yymsp[-1].minor.yy293);
160710 if( yymsp[-3].minor.yy412 ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
160711 }
160712 break;
160713 case 218: /* expr ::= expr in_op nm dbnm paren_exprlist */
160714 {
160715 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
160716 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
160717 if( yymsp[0].minor.yy350 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy350);
160718 yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy354, 0);
160719 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy354, pSelect);
160720 if( yymsp[-3].minor.yy412 ) yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy354, 0);
160721 }
160722 break;
160723 case 219: /* expr ::= EXISTS LP select RP */
160724 {
160725 Expr *p;
160726 p = yymsp[-3].minor.yy354 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
160727 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy293);
160728 }
160729 break;
160730 case 220: /* expr ::= CASE case_operand case_exprlist case_else END */
160731 {
160732 yymsp[-4].minor.yy354 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy354, 0);
160733 if( yymsp[-4].minor.yy354 ){
160734 yymsp[-4].minor.yy354->x.pList = yymsp[-1].minor.yy354 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy350,yymsp[-1].minor.yy354) : yymsp[-2].minor.yy350;
160735 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy354);
160736 }else{
160737 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy350);
160738 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy354);
160739 }
160740 }
160741 break;
160742 case 221: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
160743 {
160744 yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy350, yymsp[-2].minor.yy354);
160745 yymsp[-4].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy350, yymsp[0].minor.yy354);
160746 }
160747 break;
160748 case 222: /* case_exprlist ::= WHEN expr THEN expr */
160749 {
160750 yymsp[-3].minor.yy350 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy354);
160751 yymsp[-3].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy350, yymsp[0].minor.yy354);
160752 }
160753 break;
160754 case 225: /* case_operand ::= expr */
160755 {yymsp[0].minor.yy354 = yymsp[0].minor.yy354; /*A-overwrites-X*/}
160756 break;
160757 case 228: /* nexprlist ::= nexprlist COMMA expr */
160758 {yymsp[-2].minor.yy350 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy350,yymsp[0].minor.yy354);}
160759 break;
160760 case 229: /* nexprlist ::= expr */
160761 {yymsp[0].minor.yy350 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy354); /*A-overwrites-Y*/}
160762 break;
160763 case 231: /* paren_exprlist ::= LP exprlist RP */
160764 case 236: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==236);
160765 {yymsp[-2].minor.yy350 = yymsp[-1].minor.yy350;}
160766 break;
160767 case 232: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
160768 {
160769 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
160770 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy350, yymsp[-10].minor.yy412,
160771 &yymsp[-11].minor.yy0, yymsp[0].minor.yy354, SQLITE_SO_ASC, yymsp[-8].minor.yy412, SQLITE_IDXTYPE_APPDEF);
160772 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
160773 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
160774 }
160775 }
160776 break;
160777 case 233: /* uniqueflag ::= UNIQUE */
160778 case 275: /* raisetype ::= ABORT */ yytestcase(yyruleno==275);
160779 {yymsp[0].minor.yy412 = OE_Abort;}
160780 break;
160781 case 234: /* uniqueflag ::= */
160782 {yymsp[1].minor.yy412 = OE_None;}
160783 break;
160784 case 237: /* eidlist ::= eidlist COMMA nm collate sortorder */
160785 {
160786 yymsp[-4].minor.yy350 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy350, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy412, yymsp[0].minor.yy412);
160787 }
160788 break;
160789 case 238: /* eidlist ::= nm collate sortorder */
160790 {
160791 yymsp[-2].minor.yy350 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy412, yymsp[0].minor.yy412); /*A-overwrites-Y*/
160792 }
160793 break;
160794 case 241: /* cmd ::= DROP INDEX ifexists fullname */
160795 {sqlite3DropIndex(pParse, yymsp[0].minor.yy457, yymsp[-1].minor.yy412);}
160796 break;
160797 case 242: /* cmd ::= VACUUM vinto */
160798 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy354);}
160799 break;
160800 case 243: /* cmd ::= VACUUM nm vinto */
160801 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy354);}
160802 break;
160803 case 246: /* cmd ::= PRAGMA nm dbnm */
160804 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
160805 break;
160806 case 247: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
@@ -160818,54 +161264,54 @@
160818 case 253: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
160819 {
160820 Token all;
160821 all.z = yymsp[-3].minor.yy0.z;
160822 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
160823 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy51, &all);
160824 }
160825 break;
160826 case 254: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
160827 {
160828 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy412, yymsp[-4].minor.yy298.a, yymsp[-4].minor.yy298.b, yymsp[-2].minor.yy457, yymsp[0].minor.yy354, yymsp[-10].minor.yy412, yymsp[-8].minor.yy412);
160829 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
160830 }
160831 break;
160832 case 255: /* trigger_time ::= BEFORE|AFTER */
160833 { yymsp[0].minor.yy412 = yymsp[0].major; /*A-overwrites-X*/ }
160834 break;
160835 case 256: /* trigger_time ::= INSTEAD OF */
160836 { yymsp[-1].minor.yy412 = TK_INSTEAD;}
160837 break;
160838 case 257: /* trigger_time ::= */
160839 { yymsp[1].minor.yy412 = TK_BEFORE; }
160840 break;
160841 case 258: /* trigger_event ::= DELETE|INSERT */
160842 case 259: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==259);
160843 {yymsp[0].minor.yy298.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy298.b = 0;}
160844 break;
160845 case 260: /* trigger_event ::= UPDATE OF idlist */
160846 {yymsp[-2].minor.yy298.a = TK_UPDATE; yymsp[-2].minor.yy298.b = yymsp[0].minor.yy498;}
160847 break;
160848 case 261: /* when_clause ::= */
160849 case 280: /* key_opt ::= */ yytestcase(yyruleno==280);
160850 { yymsp[1].minor.yy354 = 0; }
160851 break;
160852 case 262: /* when_clause ::= WHEN expr */
160853 case 281: /* key_opt ::= KEY expr */ yytestcase(yyruleno==281);
160854 { yymsp[-1].minor.yy354 = yymsp[0].minor.yy354; }
160855 break;
160856 case 263: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
160857 {
160858 assert( yymsp[-2].minor.yy51!=0 );
160859 yymsp[-2].minor.yy51->pLast->pNext = yymsp[-1].minor.yy51;
160860 yymsp[-2].minor.yy51->pLast = yymsp[-1].minor.yy51;
160861 }
160862 break;
160863 case 264: /* trigger_cmd_list ::= trigger_cmd SEMI */
160864 {
160865 assert( yymsp[-1].minor.yy51!=0 );
160866 yymsp[-1].minor.yy51->pLast = yymsp[-1].minor.yy51;
160867 }
160868 break;
160869 case 265: /* trnm ::= nm DOT nm */
160870 {
160871 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
@@ -160887,62 +161333,62 @@
160887 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
160888 "within triggers");
160889 }
160890 break;
160891 case 268: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
160892 {yylhsminor.yy51 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy457, yymsp[-3].minor.yy350, yymsp[-1].minor.yy354, yymsp[-7].minor.yy412, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy504);}
160893 yymsp[-8].minor.yy51 = yylhsminor.yy51;
160894 break;
160895 case 269: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
160896 {
160897 yylhsminor.yy51 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy498,yymsp[-2].minor.yy293,yymsp[-6].minor.yy412,yymsp[-1].minor.yy40,yymsp[-7].minor.yy504,yymsp[0].minor.yy504);/*yylhsminor.yy51-overwrites-yymsp[-6].minor.yy412*/
160898 }
160899 yymsp[-7].minor.yy51 = yylhsminor.yy51;
160900 break;
160901 case 270: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
160902 {yylhsminor.yy51 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy354, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy504);}
160903 yymsp[-5].minor.yy51 = yylhsminor.yy51;
160904 break;
160905 case 271: /* trigger_cmd ::= scanpt select scanpt */
160906 {yylhsminor.yy51 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy293, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); /*yylhsminor.yy51-overwrites-yymsp[-1].minor.yy293*/}
160907 yymsp[-2].minor.yy51 = yylhsminor.yy51;
160908 break;
160909 case 272: /* expr ::= RAISE LP IGNORE RP */
160910 {
160911 yymsp[-3].minor.yy354 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
160912 if( yymsp[-3].minor.yy354 ){
160913 yymsp[-3].minor.yy354->affExpr = OE_Ignore;
160914 }
160915 }
160916 break;
160917 case 273: /* expr ::= RAISE LP raisetype COMMA nm RP */
160918 {
160919 yymsp[-5].minor.yy354 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
160920 if( yymsp[-5].minor.yy354 ) {
160921 yymsp[-5].minor.yy354->affExpr = (char)yymsp[-3].minor.yy412;
160922 }
160923 }
160924 break;
160925 case 274: /* raisetype ::= ROLLBACK */
160926 {yymsp[0].minor.yy412 = OE_Rollback;}
160927 break;
160928 case 276: /* raisetype ::= FAIL */
160929 {yymsp[0].minor.yy412 = OE_Fail;}
160930 break;
160931 case 277: /* cmd ::= DROP TRIGGER ifexists fullname */
160932 {
160933 sqlite3DropTrigger(pParse,yymsp[0].minor.yy457,yymsp[-1].minor.yy412);
160934 }
160935 break;
160936 case 278: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
160937 {
160938 sqlite3Attach(pParse, yymsp[-3].minor.yy354, yymsp[-1].minor.yy354, yymsp[0].minor.yy354);
160939 }
160940 break;
160941 case 279: /* cmd ::= DETACH database_kw_opt expr */
160942 {
160943 sqlite3Detach(pParse, yymsp[0].minor.yy354);
160944 }
160945 break;
160946 case 282: /* cmd ::= REINDEX */
160947 {sqlite3Reindex(pParse, 0, 0);}
160948 break;
@@ -160955,266 +161401,285 @@
160955 case 285: /* cmd ::= ANALYZE nm dbnm */
160956 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
160957 break;
160958 case 286: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
160959 {
160960 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy457,&yymsp[0].minor.yy0);
160961 }
160962 break;
160963 case 287: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
160964 {
160965 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
160966 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
160967 }
160968 break;
160969 case 288: /* add_column_fullname ::= fullname */
 
 
 
 
 
160970 {
160971 disableLookaside(pParse);
160972 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy457);
160973 }
160974 break;
160975 case 289: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
160976 {
160977 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy457, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
160978 }
160979 break;
160980 case 290: /* cmd ::= create_vtab */
160981 {sqlite3VtabFinishParse(pParse,0);}
160982 break;
160983 case 291: /* cmd ::= create_vtab LP vtabarglist RP */
160984 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
160985 break;
160986 case 292: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
160987 {
160988 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy412);
160989 }
160990 break;
160991 case 293: /* vtabarg ::= */
160992 {sqlite3VtabArgInit(pParse);}
160993 break;
160994 case 294: /* vtabargtoken ::= ANY */
160995 case 295: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==295);
160996 case 296: /* lp ::= LP */ yytestcase(yyruleno==296);
160997 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
160998 break;
160999 case 297: /* with ::= WITH wqlist */
161000 case 298: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==298);
161001 { sqlite3WithPush(pParse, yymsp[0].minor.yy105, 1); }
161002 break;
161003 case 299: /* wqlist ::= nm eidlist_opt AS LP select RP */
161004 {
161005 yymsp[-5].minor.yy105 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy350, yymsp[-1].minor.yy293); /*A-overwrites-X*/
161006 }
161007 break;
161008 case 300: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
161009 {
161010 yymsp[-7].minor.yy105 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy105, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy350, yymsp[-1].minor.yy293);
161011 }
161012 break;
161013 case 301: /* windowdefn_list ::= windowdefn */
161014 { yylhsminor.yy503 = yymsp[0].minor.yy503; }
161015 yymsp[0].minor.yy503 = yylhsminor.yy503;
161016 break;
161017 case 302: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
161018 {
161019 assert( yymsp[0].minor.yy503!=0 );
161020 sqlite3WindowChain(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy503);
161021 yymsp[0].minor.yy503->pNextWin = yymsp[-2].minor.yy503;
161022 yylhsminor.yy503 = yymsp[0].minor.yy503;
161023 }
161024 yymsp[-2].minor.yy503 = yylhsminor.yy503;
161025 break;
161026 case 303: /* windowdefn ::= nm AS LP window RP */
161027 {
161028 if( ALWAYS(yymsp[-1].minor.yy503) ){
161029 yymsp[-1].minor.yy503->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
161030 }
161031 yylhsminor.yy503 = yymsp[-1].minor.yy503;
161032 }
161033 yymsp[-4].minor.yy503 = yylhsminor.yy503;
161034 break;
161035 case 304: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
161036 {
161037 yymsp[-4].minor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy350, yymsp[-1].minor.yy350, 0);
161038 }
161039 break;
161040 case 305: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
161041 {
161042 yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, yymsp[-2].minor.yy350, yymsp[-1].minor.yy350, &yymsp[-5].minor.yy0);
161043 }
161044 yymsp[-5].minor.yy503 = yylhsminor.yy503;
161045 break;
161046 case 306: /* window ::= ORDER BY sortlist frame_opt */
161047 {
161048 yymsp[-3].minor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, yymsp[-1].minor.yy350, 0);
161049 }
161050 break;
161051 case 307: /* window ::= nm ORDER BY sortlist frame_opt */
161052 {
161053 yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, yymsp[-1].minor.yy350, &yymsp[-4].minor.yy0);
161054 }
161055 yymsp[-4].minor.yy503 = yylhsminor.yy503;
161056 break;
161057 case 308: /* window ::= frame_opt */
161058 case 327: /* filter_over ::= over_clause */ yytestcase(yyruleno==327);
161059 {
161060 yylhsminor.yy503 = yymsp[0].minor.yy503;
161061 }
161062 yymsp[0].minor.yy503 = yylhsminor.yy503;
161063 break;
161064 case 309: /* window ::= nm frame_opt */
161065 {
161066 yylhsminor.yy503 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy503, 0, 0, &yymsp[-1].minor.yy0);
161067 }
161068 yymsp[-1].minor.yy503 = yylhsminor.yy503;
161069 break;
161070 case 310: /* frame_opt ::= */
161071 {
161072 yymsp[1].minor.yy503 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
161073 }
161074 break;
161075 case 311: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
161076 {
161077 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);
161078 }
161079 yymsp[-2].minor.yy503 = yylhsminor.yy503;
161080 break;
161081 case 312: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
161082 {
161083 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);
161084 }
161085 yymsp[-5].minor.yy503 = yylhsminor.yy503;
161086 break;
161087 case 314: /* frame_bound_s ::= frame_bound */
161088 case 316: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==316);
161089 {yylhsminor.yy341 = yymsp[0].minor.yy341;}
161090 yymsp[0].minor.yy341 = yylhsminor.yy341;
161091 break;
161092 case 315: /* frame_bound_s ::= UNBOUNDED PRECEDING */
161093 case 317: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==317);
161094 case 319: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==319);
161095 {yylhsminor.yy341.eType = yymsp[-1].major; yylhsminor.yy341.pExpr = 0;}
161096 yymsp[-1].minor.yy341 = yylhsminor.yy341;
161097 break;
161098 case 318: /* frame_bound ::= expr PRECEDING|FOLLOWING */
161099 {yylhsminor.yy341.eType = yymsp[0].major; yylhsminor.yy341.pExpr = yymsp[-1].minor.yy354;}
161100 yymsp[-1].minor.yy341 = yylhsminor.yy341;
161101 break;
161102 case 320: /* frame_exclude_opt ::= */
161103 {yymsp[1].minor.yy624 = 0;}
161104 break;
161105 case 321: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
161106 {yymsp[-1].minor.yy624 = yymsp[0].minor.yy624;}
161107 break;
161108 case 322: /* frame_exclude ::= NO OTHERS */
161109 case 323: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==323);
161110 {yymsp[-1].minor.yy624 = yymsp[-1].major; /*A-overwrites-X*/}
161111 break;
161112 case 324: /* frame_exclude ::= GROUP|TIES */
161113 {yymsp[0].minor.yy624 = yymsp[0].major; /*A-overwrites-X*/}
161114 break;
161115 case 325: /* window_clause ::= WINDOW windowdefn_list */
161116 { yymsp[-1].minor.yy503 = yymsp[0].minor.yy503; }
161117 break;
161118 case 326: /* filter_over ::= filter_clause over_clause */
161119 {
161120 yymsp[0].minor.yy503->pFilter = yymsp[-1].minor.yy354;
161121 yylhsminor.yy503 = yymsp[0].minor.yy503;
161122 }
161123 yymsp[-1].minor.yy503 = yylhsminor.yy503;
161124 break;
161125 case 328: /* filter_over ::= filter_clause */
161126 {
161127 yylhsminor.yy503 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
161128 if( yylhsminor.yy503 ){
161129 yylhsminor.yy503->eFrmType = TK_FILTER;
161130 yylhsminor.yy503->pFilter = yymsp[0].minor.yy354;
161131 }else{
161132 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy354);
161133 }
161134 }
161135 yymsp[0].minor.yy503 = yylhsminor.yy503;
161136 break;
161137 case 329: /* over_clause ::= OVER LP window RP */
161138 {
161139 yymsp[-3].minor.yy503 = yymsp[-1].minor.yy503;
161140 assert( yymsp[-3].minor.yy503!=0 );
161141 }
161142 break;
161143 case 330: /* over_clause ::= OVER nm */
161144 {
161145 yymsp[-1].minor.yy503 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
161146 if( yymsp[-1].minor.yy503 ){
161147 yymsp[-1].minor.yy503->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
161148 }
161149 }
161150 break;
161151 case 331: /* filter_clause ::= FILTER LP WHERE expr RP */
161152 { yymsp[-4].minor.yy354 = yymsp[-1].minor.yy354; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161153 break;
161154 default:
161155 /* (332) input ::= cmdlist */ yytestcase(yyruleno==332);
161156 /* (333) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==333);
161157 /* (334) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=334);
161158 /* (335) ecmd ::= SEMI */ yytestcase(yyruleno==335);
161159 /* (336) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==336);
161160 /* (337) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=337);
161161 /* (338) trans_opt ::= */ yytestcase(yyruleno==338);
161162 /* (339) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==339);
161163 /* (340) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==340);
161164 /* (341) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==341);
161165 /* (342) savepoint_opt ::= */ yytestcase(yyruleno==342);
161166 /* (343) cmd ::= create_table create_table_args */ yytestcase(yyruleno==343);
161167 /* (344) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==344);
161168 /* (345) columnlist ::= columnname carglist */ yytestcase(yyruleno==345);
161169 /* (346) nm ::= ID|INDEXED */ yytestcase(yyruleno==346);
161170 /* (347) nm ::= STRING */ yytestcase(yyruleno==347);
161171 /* (348) nm ::= JOIN_KW */ yytestcase(yyruleno==348);
161172 /* (349) typetoken ::= typename */ yytestcase(yyruleno==349);
161173 /* (350) typename ::= ID|STRING */ yytestcase(yyruleno==350);
161174 /* (351) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=351);
161175 /* (352) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=352);
161176 /* (353) carglist ::= carglist ccons */ yytestcase(yyruleno==353);
161177 /* (354) carglist ::= */ yytestcase(yyruleno==354);
161178 /* (355) ccons ::= NULL onconf */ yytestcase(yyruleno==355);
161179 /* (356) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==356);
161180 /* (357) ccons ::= AS generated */ yytestcase(yyruleno==357);
161181 /* (358) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==358);
161182 /* (359) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==359);
161183 /* (360) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=360);
161184 /* (361) tconscomma ::= */ yytestcase(yyruleno==361);
161185 /* (362) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=362);
161186 /* (363) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=363);
161187 /* (364) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=364);
161188 /* (365) oneselect ::= values */ yytestcase(yyruleno==365);
161189 /* (366) sclp ::= selcollist COMMA */ yytestcase(yyruleno==366);
161190 /* (367) as ::= ID|STRING */ yytestcase(yyruleno==367);
161191 /* (368) returning ::= */ yytestcase(yyruleno==368);
161192 /* (369) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=369);
161193 /* (370) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==370);
161194 /* (371) exprlist ::= nexprlist */ yytestcase(yyruleno==371);
161195 /* (372) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=372);
161196 /* (373) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=373);
161197 /* (374) nmnum ::= ON */ yytestcase(yyruleno==374);
161198 /* (375) nmnum ::= DELETE */ yytestcase(yyruleno==375);
161199 /* (376) nmnum ::= DEFAULT */ yytestcase(yyruleno==376);
161200 /* (377) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==377);
161201 /* (378) foreach_clause ::= */ yytestcase(yyruleno==378);
161202 /* (379) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==379);
161203 /* (380) trnm ::= nm */ yytestcase(yyruleno==380);
161204 /* (381) tridxby ::= */ yytestcase(yyruleno==381);
161205 /* (382) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==382);
161206 /* (383) database_kw_opt ::= */ yytestcase(yyruleno==383);
161207 /* (384) kwcolumn_opt ::= */ yytestcase(yyruleno==384);
161208 /* (385) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==385);
161209 /* (386) vtabarglist ::= vtabarg */ yytestcase(yyruleno==386);
161210 /* (387) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==387);
161211 /* (388) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==388);
161212 /* (389) anylist ::= */ yytestcase(yyruleno==389);
161213 /* (390) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==390);
161214 /* (391) anylist ::= anylist ANY */ yytestcase(yyruleno==391);
161215 /* (392) with ::= */ yytestcase(yyruleno==392);
161216 break;
161217 /********** End reduce actions ************************************************/
161218 };
161219 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
161220 yygoto = yyRuleInfoLhs[yyruleno];
@@ -161717,25 +162182,25 @@
161717 ** might be implemented more directly using a hand-written hash table.
161718 ** But by using this automatically generated code, the size of the code
161719 ** is substantially reduced. This is important for embedded applications
161720 ** on platforms with limited memory.
161721 */
161722 /* Hash score: 229 */
161723 /* zKWText[] encodes 994 bytes of keyword text in 657 bytes */
161724 /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
161725 /* ABLEFTHENDEFERRABLELSEXCLUDELETEMPORARYISNULLSAVEPOINTERSECT */
161726 /* IESNOTNULLIKEXCEPTRANSACTIONATURALTERAISEXCLUSIVEXISTS */
161727 /* CONSTRAINTOFFSETRIGGERANGENERATEDETACHAVINGLOBEGINNEREFERENCES */
161728 /* UNIQUERYWITHOUTERELEASEATTACHBETWEENOTHINGROUPSCASCADEFAULT */
161729 /* CASECOLLATECREATECURRENT_DATEIMMEDIATEJOINSERTMATCHPLANALYZE */
161730 /* PRAGMABORTUPDATEVALUESVIRTUALWAYSWHENWHERECURSIVEAFTERENAMEAND */
161731 /* EFERREDISTINCTAUTOINCREMENTCASTCOLUMNCOMMITCONFLICTCROSS */
161732 /* CURRENT_TIMESTAMPARTITIONDROPRECEDINGFAILASTFILTEREPLACEFIRST */
161733 /* FOLLOWINGFROMFULLIMITIFORDERESTRICTOTHERSOVERETURNINGRIGHT */
161734 /* ROLLBACKROWSUNBOUNDEDUNIONUSINGVACUUMVIEWINDOWBYINITIALLY */
161735 /* PRIMARY */
161736 static const char zKWText[656] = {
161737 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
161738 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
161739 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
161740 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
161741 'E','R','R','A','B','L','E','L','S','E','X','C','L','U','D','E','L','E',
@@ -161752,91 +162217,91 @@
161752 'E','N','O','T','H','I','N','G','R','O','U','P','S','C','A','S','C','A',
161753 'D','E','F','A','U','L','T','C','A','S','E','C','O','L','L','A','T','E',
161754 'C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A','T','E',
161755 'I','M','M','E','D','I','A','T','E','J','O','I','N','S','E','R','T','M',
161756 'A','T','C','H','P','L','A','N','A','L','Y','Z','E','P','R','A','G','M',
161757 'A','B','O','R','T','U','P','D','A','T','E','V','A','L','U','E','S','V',
161758 'I','R','T','U','A','L','W','A','Y','S','W','H','E','N','W','H','E','R',
161759 'E','C','U','R','S','I','V','E','A','F','T','E','R','E','N','A','M','E',
161760 'A','N','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','A',
161761 'U','T','O','I','N','C','R','E','M','E','N','T','C','A','S','T','C','O',
161762 'L','U','M','N','C','O','M','M','I','T','C','O','N','F','L','I','C','T',
161763 'C','R','O','S','S','C','U','R','R','E','N','T','_','T','I','M','E','S',
161764 'T','A','M','P','A','R','T','I','T','I','O','N','D','R','O','P','R','E',
161765 'C','E','D','I','N','G','F','A','I','L','A','S','T','F','I','L','T','E',
161766 'R','E','P','L','A','C','E','F','I','R','S','T','F','O','L','L','O','W',
161767 'I','N','G','F','R','O','M','F','U','L','L','I','M','I','T','I','F','O',
161768 'R','D','E','R','E','S','T','R','I','C','T','O','T','H','E','R','S','O',
161769 'V','E','R','E','T','U','R','N','I','N','G','R','I','G','H','T','R','O',
161770 'L','L','B','A','C','K','R','O','W','S','U','N','B','O','U','N','D','E',
161771 'D','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M','V',
161772 'I','E','W','I','N','D','O','W','B','Y','I','N','I','T','I','A','L','L',
161773 'Y','P','R','I','M','A','R','Y',
161774 };
161775 /* aKWHash[i] is the hash value for the i-th keyword */
161776 static const unsigned char aKWHash[127] = {
161777 84, 102, 133, 82, 114, 29, 0, 0, 91, 0, 85, 72, 0,
161778 53, 35, 86, 15, 0, 42, 94, 54, 126, 134, 19, 0, 0,
161779 139, 0, 40, 128, 0, 22, 104, 0, 9, 0, 0, 122, 80,
161780 0, 78, 6, 0, 65, 99, 146, 0, 135, 112, 0, 0, 48,
161781 0, 100, 24, 0, 17, 0, 27, 70, 23, 26, 5, 60, 141,
161782 107, 121, 0, 73, 101, 71, 144, 61, 119, 74, 0, 49, 0,
161783 11, 41, 0, 110, 0, 0, 0, 106, 10, 108, 113, 124, 14,
161784 50, 123, 0, 89, 0, 18, 120, 143, 56, 129, 138, 88, 83,
161785 37, 30, 125, 0, 0, 105, 51, 130, 127, 0, 34, 0, 0,
161786 131, 0, 95, 38, 39, 0, 20, 45, 116, 90,
161787 };
161788 /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
161789 ** then the i-th keyword has no more hash collisions. Otherwise,
161790 ** the next keyword with the same hash is aKWHash[i]-1. */
161791 static const unsigned char aKWNext[146] = {
161792 0, 0, 0, 0, 4, 0, 43, 0, 0, 103, 111, 0, 0,
161793 0, 2, 0, 0, 142, 0, 0, 0, 13, 0, 0, 0, 0,
161794 140, 0, 0, 118, 52, 0, 0, 136, 12, 0, 0, 62, 0,
161795 137, 0, 132, 0, 0, 36, 0, 0, 28, 77, 0, 0, 0,
161796 0, 59, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
161797 0, 69, 0, 0, 0, 0, 0, 145, 3, 0, 58, 0, 1,
161798 75, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 64, 66,
161799 63, 0, 0, 0, 0, 46, 0, 16, 0, 115, 0, 0, 0,
161800 0, 0, 0, 0, 0, 0, 0, 81, 97, 0, 8, 0, 109,
161801 21, 7, 67, 0, 79, 93, 117, 0, 0, 68, 0, 0, 96,
161802 44, 0, 55, 0, 76, 0, 92, 32, 33, 57, 25, 0, 98,
161803 0, 0, 87,
161804 };
161805 /* aKWLen[i] is the length (in bytes) of the i-th keyword */
161806 static const unsigned char aKWLen[146] = {
161807 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
161808 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 7,
161809 6, 9, 4, 2, 6, 5, 9, 9, 4, 7, 3, 2, 4,
161810 4, 6, 11, 6, 2, 7, 5, 5, 9, 6, 10, 4, 6,
161811 2, 3, 7, 5, 9, 6, 6, 4, 5, 5, 10, 6, 5,
161812 7, 4, 5, 7, 6, 7, 7, 6, 5, 7, 3, 7, 4,
161813 7, 6, 12, 9, 4, 6, 5, 4, 7, 6, 5, 6, 6,
161814 7, 6, 4, 5, 9, 5, 6, 3, 8, 8, 2, 13, 2,
161815 2, 4, 6, 6, 8, 5, 17, 12, 7, 9, 4, 9, 4,
161816 4, 6, 7, 5, 9, 4, 4, 5, 2, 5, 8, 6, 4,
161817 9, 5, 8, 4, 3, 9, 5, 5, 6, 4, 6, 2, 2,
161818 9, 3, 7,
161819 };
161820 /* aKWOffset[i] is the index into zKWText[] of the start of
161821 ** the text for the i-th keyword. */
161822 static const unsigned short int aKWOffset[146] = {
161823 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
161824 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
161825 86, 90, 90, 94, 99, 101, 105, 111, 119, 123, 123, 123, 126,
161826 129, 132, 137, 142, 146, 147, 152, 156, 160, 168, 174, 181, 184,
161827 184, 187, 189, 195, 198, 206, 211, 216, 219, 222, 226, 236, 239,
161828 244, 244, 248, 252, 259, 265, 271, 277, 277, 283, 284, 288, 295,
161829 299, 306, 312, 324, 333, 335, 341, 346, 348, 355, 360, 365, 371,
161830 377, 382, 388, 392, 395, 404, 408, 414, 416, 423, 424, 431, 433,
161831 435, 444, 448, 454, 460, 468, 473, 473, 473, 489, 498, 501, 510,
161832 513, 517, 522, 529, 534, 543, 547, 550, 555, 557, 561, 569, 575,
161833 578, 587, 592, 600, 600, 604, 613, 618, 623, 629, 632, 635, 638,
161834 640, 645, 649,
161835 };
161836 /* aKWCode[i] is the parser symbol code for the i-th keyword */
161837 static const unsigned char aKWCode[146] = {
161838 TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
161839 TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
161840 TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
161841 TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
161842 TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
@@ -161850,23 +162315,23 @@
161850 TK_BEGIN, TK_JOIN_KW, TK_REFERENCES, TK_UNIQUE, TK_QUERY,
161851 TK_WITHOUT, TK_WITH, TK_JOIN_KW, TK_RELEASE, TK_ATTACH,
161852 TK_BETWEEN, TK_NOTHING, TK_GROUPS, TK_GROUP, TK_CASCADE,
161853 TK_ASC, TK_DEFAULT, TK_CASE, TK_COLLATE, TK_CREATE,
161854 TK_CTIME_KW, TK_IMMEDIATE, TK_JOIN, TK_INSERT, TK_MATCH,
161855 TK_PLAN, TK_ANALYZE, TK_PRAGMA, TK_ABORT, TK_UPDATE,
161856 TK_VALUES, TK_VIRTUAL, TK_ALWAYS, TK_WHEN, TK_WHERE,
161857 TK_RECURSIVE, TK_AFTER, TK_RENAME, TK_AND, TK_DEFERRED,
161858 TK_DISTINCT, TK_IS, TK_AUTOINCR, TK_TO, TK_IN,
161859 TK_CAST, TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW,
161860 TK_CTIME_KW, TK_CTIME_KW, TK_CURRENT, TK_PARTITION, TK_DROP,
161861 TK_PRECEDING, TK_FAIL, TK_LAST, TK_FILTER, TK_REPLACE,
161862 TK_FIRST, TK_FOLLOWING, TK_FROM, TK_JOIN_KW, TK_LIMIT,
161863 TK_IF, TK_ORDER, TK_RESTRICT, TK_OTHERS, TK_OVER,
161864 TK_RETURNING, TK_JOIN_KW, TK_ROLLBACK, TK_ROWS, TK_ROW,
161865 TK_UNBOUNDED, TK_UNION, TK_USING, TK_VACUUM, TK_VIEW,
161866 TK_WINDOW, TK_DO, TK_BY, TK_INITIALLY, TK_ALL,
161867 TK_PRIMARY,
161868 };
161869 /* Hash table decoded:
161870 ** 0: INSERT
161871 ** 1: IS
161872 ** 2: ROLLBACK TRIGGER
@@ -161886,11 +162351,11 @@
161886 ** 16: INSTEAD INDEXED
161887 ** 17:
161888 ** 18: TRANSACTION RIGHT
161889 ** 19: WHEN
161890 ** 20: SET HAVING
161891 ** 21: IF
161892 ** 22: ROWS
161893 ** 23: SELECT
161894 ** 24:
161895 ** 25:
161896 ** 26: VACUUM SAVEPOINT
@@ -162105,68 +162570,69 @@
162105 testcase( i==83 ); /* INSERT */
162106 testcase( i==84 ); /* MATCH */
162107 testcase( i==85 ); /* PLAN */
162108 testcase( i==86 ); /* ANALYZE */
162109 testcase( i==87 ); /* PRAGMA */
162110 testcase( i==88 ); /* ABORT */
162111 testcase( i==89 ); /* UPDATE */
162112 testcase( i==90 ); /* VALUES */
162113 testcase( i==91 ); /* VIRTUAL */
162114 testcase( i==92 ); /* ALWAYS */
162115 testcase( i==93 ); /* WHEN */
162116 testcase( i==94 ); /* WHERE */
162117 testcase( i==95 ); /* RECURSIVE */
162118 testcase( i==96 ); /* AFTER */
162119 testcase( i==97 ); /* RENAME */
162120 testcase( i==98 ); /* AND */
162121 testcase( i==99 ); /* DEFERRED */
162122 testcase( i==100 ); /* DISTINCT */
162123 testcase( i==101 ); /* IS */
162124 testcase( i==102 ); /* AUTOINCREMENT */
162125 testcase( i==103 ); /* TO */
162126 testcase( i==104 ); /* IN */
162127 testcase( i==105 ); /* CAST */
162128 testcase( i==106 ); /* COLUMN */
162129 testcase( i==107 ); /* COMMIT */
162130 testcase( i==108 ); /* CONFLICT */
162131 testcase( i==109 ); /* CROSS */
162132 testcase( i==110 ); /* CURRENT_TIMESTAMP */
162133 testcase( i==111 ); /* CURRENT_TIME */
162134 testcase( i==112 ); /* CURRENT */
162135 testcase( i==113 ); /* PARTITION */
162136 testcase( i==114 ); /* DROP */
162137 testcase( i==115 ); /* PRECEDING */
162138 testcase( i==116 ); /* FAIL */
162139 testcase( i==117 ); /* LAST */
162140 testcase( i==118 ); /* FILTER */
162141 testcase( i==119 ); /* REPLACE */
162142 testcase( i==120 ); /* FIRST */
162143 testcase( i==121 ); /* FOLLOWING */
162144 testcase( i==122 ); /* FROM */
162145 testcase( i==123 ); /* FULL */
162146 testcase( i==124 ); /* LIMIT */
162147 testcase( i==125 ); /* IF */
162148 testcase( i==126 ); /* ORDER */
162149 testcase( i==127 ); /* RESTRICT */
162150 testcase( i==128 ); /* OTHERS */
162151 testcase( i==129 ); /* OVER */
162152 testcase( i==130 ); /* RETURNING */
162153 testcase( i==131 ); /* RIGHT */
162154 testcase( i==132 ); /* ROLLBACK */
162155 testcase( i==133 ); /* ROWS */
162156 testcase( i==134 ); /* ROW */
162157 testcase( i==135 ); /* UNBOUNDED */
162158 testcase( i==136 ); /* UNION */
162159 testcase( i==137 ); /* USING */
162160 testcase( i==138 ); /* VACUUM */
162161 testcase( i==139 ); /* VIEW */
162162 testcase( i==140 ); /* WINDOW */
162163 testcase( i==141 ); /* DO */
162164 testcase( i==142 ); /* BY */
162165 testcase( i==143 ); /* INITIALLY */
162166 testcase( i==144 ); /* ALL */
162167 testcase( i==145 ); /* PRIMARY */
 
162168 *pType = aKWCode[i];
162169 break;
162170 }
162171 }
162172 return n;
@@ -162174,11 +162640,11 @@
162174 SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){
162175 int id = TK_ID;
162176 keywordCode((char*)z, n, &id);
162177 return id;
162178 }
162179 #define SQLITE_N_KEYWORD 146
162180 SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){
162181 if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
162182 *pzName = zKWText + aKWOffset[i];
162183 *pnName = aKWLen[i];
162184 return SQLITE_OK;
@@ -183787,27 +184253,31 @@
183787 if( pNode->block.a){
183788 rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n);
183789 while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
183790 blobGrowBuffer(&pNode->key, reader.term.n, &rc);
183791 if( rc==SQLITE_OK ){
183792 memcpy(pNode->key.a, reader.term.a, reader.term.n);
183793 pNode->key.n = reader.term.n;
183794 if( i>0 ){
183795 char *aBlock = 0;
183796 int nBlock = 0;
183797 pNode = &pWriter->aNodeWriter[i-1];
183798 pNode->iBlock = reader.iChild;
183799 rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock, 0);
183800 blobGrowBuffer(&pNode->block,
183801 MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc
183802 );
183803 if( rc==SQLITE_OK ){
183804 memcpy(pNode->block.a, aBlock, nBlock);
183805 pNode->block.n = nBlock;
183806 memset(&pNode->block.a[nBlock], 0, FTS3_NODE_PADDING);
183807 }
183808 sqlite3_free(aBlock);
 
 
 
 
183809 }
183810 }
183811 }
183812 nodeReaderRelease(&reader);
183813 }
@@ -203040,26 +203510,28 @@
203040 #ifdef SQLITE_AMALGAMATION
203041 assert( WAL_CKPT_LOCK==1 );
203042 #endif
203043
203044 assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) );
203045 if( pRbu && (pRbu->eStage==RBU_STAGE_OAL || pRbu->eStage==RBU_STAGE_MOVE) ){
203046 /* Magic number 1 is the WAL_CKPT_LOCK lock. Preventing SQLite from
203047 ** taking this lock also prevents any checkpoints from occurring.
203048 ** todo: really, it's not clear why this might occur, as
203049 ** wal_autocheckpoint ought to be turned off. */
 
 
 
203050 if( ofst==WAL_LOCK_CKPT && n==1 ) rc = SQLITE_BUSY;
203051 }else{
203052 int bCapture = 0;
203053 if( pRbu && pRbu->eStage==RBU_STAGE_CAPTURE ){
203054 bCapture = 1;
203055 }
203056
203057 if( bCapture==0 || 0==(flags & SQLITE_SHM_UNLOCK) ){
203058 rc = p->pReal->pMethods->xShmLock(p->pReal, ofst, n, flags);
203059 if( bCapture && rc==SQLITE_OK ){
203060 pRbu->mLock |= (1 << ofst);
203061 }
203062 }
203063 }
203064
203065 return rc;
@@ -204885,10 +205357,11 @@
204885 struct sqlite3_changeset_iter {
204886 SessionInput in; /* Input buffer or stream */
204887 SessionBuffer tblhdr; /* Buffer to hold apValue/zTab/abPK/ */
204888 int bPatchset; /* True if this is a patchset */
204889 int bInvert; /* True to invert changeset */
 
204890 int rc; /* Iterator error code */
204891 sqlite3_stmt *pConflict; /* Points to conflicting row, if any */
204892 char *zTab; /* Current table */
204893 int nCol; /* Number of columns in zTab */
204894 int op; /* Current operation */
@@ -207414,11 +207887,12 @@
207414 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207415 int (*xInput)(void *pIn, void *pData, int *pnData),
207416 void *pIn,
207417 int nChangeset, /* Size of buffer pChangeset in bytes */
207418 void *pChangeset, /* Pointer to buffer containing changeset */
207419 int bInvert /* True to invert changeset */
 
207420 ){
207421 sqlite3_changeset_iter *pRet; /* Iterator to return */
207422 int nByte; /* Number of bytes to allocate for iterator */
207423
207424 assert( xInput==0 || (pChangeset==0 && nChangeset==0) );
@@ -207435,10 +207909,11 @@
207435 pRet->in.nData = nChangeset;
207436 pRet->in.xInput = xInput;
207437 pRet->in.pIn = pIn;
207438 pRet->in.bEof = (xInput ? 0 : 1);
207439 pRet->bInvert = bInvert;
 
207440
207441 /* Populate the output variable and return success. */
207442 *pp = pRet;
207443 return SQLITE_OK;
207444 }
@@ -207449,20 +207924,20 @@
207449 SQLITE_API int sqlite3changeset_start(
207450 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207451 int nChangeset, /* Size of buffer pChangeset in bytes */
207452 void *pChangeset /* Pointer to buffer containing changeset */
207453 ){
207454 return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset, 0);
207455 }
207456 SQLITE_API int sqlite3changeset_start_v2(
207457 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207458 int nChangeset, /* Size of buffer pChangeset in bytes */
207459 void *pChangeset, /* Pointer to buffer containing changeset */
207460 int flags
207461 ){
207462 int bInvert = !!(flags & SQLITE_CHANGESETSTART_INVERT);
207463 return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset, bInvert);
207464 }
207465
207466 /*
207467 ** Streaming version of sqlite3changeset_start().
207468 */
@@ -207469,20 +207944,20 @@
207469 SQLITE_API int sqlite3changeset_start_strm(
207470 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207471 int (*xInput)(void *pIn, void *pData, int *pnData),
207472 void *pIn
207473 ){
207474 return sessionChangesetStart(pp, xInput, pIn, 0, 0, 0);
207475 }
207476 SQLITE_API int sqlite3changeset_start_v2_strm(
207477 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207478 int (*xInput)(void *pIn, void *pData, int *pnData),
207479 void *pIn,
207480 int flags
207481 ){
207482 int bInvert = !!(flags & SQLITE_CHANGESETSTART_INVERT);
207483 return sessionChangesetStart(pp, xInput, pIn, 0, 0, bInvert);
207484 }
207485
207486 /*
207487 ** If the SessionInput object passed as the only argument is a streaming
207488 ** object and the buffer is full, discard some data to free up space.
@@ -207604,15 +208079,18 @@
207604 */
207605 static int sessionReadRecord(
207606 SessionInput *pIn, /* Input data */
207607 int nCol, /* Number of values in record */
207608 u8 *abPK, /* Array of primary key flags, or NULL */
207609 sqlite3_value **apOut /* Write values to this array */
 
207610 ){
207611 int i; /* Used to iterate through columns */
207612 int rc = SQLITE_OK;
207613
 
 
207614 for(i=0; i<nCol && rc==SQLITE_OK; i++){
207615 int eType = 0; /* Type of value (SQLITE_NULL, TEXT etc.) */
207616 if( abPK && abPK[i]==0 ) continue;
207617 rc = sessionInputBuffer(pIn, 9);
207618 if( rc==SQLITE_OK ){
@@ -207620,10 +208098,11 @@
207620 rc = SQLITE_CORRUPT_BKPT;
207621 }else{
207622 eType = pIn->aData[pIn->iNext++];
207623 assert( apOut[i]==0 );
207624 if( eType ){
 
207625 apOut[i] = sqlite3ValueNew(0);
207626 if( !apOut[i] ) rc = SQLITE_NOMEM;
207627 }
207628 }
207629 }
@@ -207799,35 +208278,31 @@
207799 }
207800 return (p->rc = rc);
207801 }
207802
207803 /*
207804 ** Advance the changeset iterator to the next change.
207805 **
207806 ** If both paRec and pnRec are NULL, then this function works like the public
207807 ** API sqlite3changeset_next(). If SQLITE_ROW is returned, then the
207808 ** sqlite3changeset_new() and old() APIs may be used to query for values.
207809 **
207810 ** Otherwise, if paRec and pnRec are not NULL, then a pointer to the change
207811 ** record is written to *paRec before returning and the number of bytes in
207812 ** the record to *pnRec.
207813 **
207814 ** Either way, this function returns SQLITE_ROW if the iterator is
207815 ** successfully advanced to the next change in the changeset, an SQLite
207816 ** error code if an error occurs, or SQLITE_DONE if there are no further
207817 ** changes in the changeset.
207818 */
207819 static int sessionChangesetNext(
207820 sqlite3_changeset_iter *p, /* Changeset iterator */
207821 u8 **paRec, /* If non-NULL, store record pointer here */
207822 int *pnRec, /* If non-NULL, store size of record here */
207823 int *pbNew /* If non-NULL, true if new table */
 
207824 ){
207825 int i;
207826 u8 op;
207827
207828 assert( (paRec==0 && pnRec==0) || (paRec && pnRec) );
 
207829
207830 /* If the iterator is in the error-state, return immediately. */
207831 if( p->rc!=SQLITE_OK ) return p->rc;
207832
207833 /* Free the current contents of p->apValue[], if any. */
@@ -207896,17 +208371,17 @@
207896 sqlite3_value **apNew = (p->bInvert ? p->apValue : &p->apValue[p->nCol]);
207897
207898 /* If this is an UPDATE or DELETE, read the old.* record. */
207899 if( p->op!=SQLITE_INSERT && (p->bPatchset==0 || p->op==SQLITE_DELETE) ){
207900 u8 *abPK = p->bPatchset ? p->abPK : 0;
207901 p->rc = sessionReadRecord(&p->in, p->nCol, abPK, apOld);
207902 if( p->rc!=SQLITE_OK ) return p->rc;
207903 }
207904
207905 /* If this is an INSERT or UPDATE, read the new.* record. */
207906 if( p->op!=SQLITE_DELETE ){
207907 p->rc = sessionReadRecord(&p->in, p->nCol, 0, apNew);
207908 if( p->rc!=SQLITE_OK ) return p->rc;
207909 }
207910
207911 if( (p->bPatchset || p->bInvert) && p->op==SQLITE_UPDATE ){
207912 /* If this is an UPDATE that is part of a patchset, then all PK and
@@ -207928,10 +208403,41 @@
207928 }
207929 }
207930
207931 return SQLITE_ROW;
207932 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207933
207934 /*
207935 ** Advance an iterator created by sqlite3changeset_start() to the next
207936 ** change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE
207937 ** or SQLITE_CORRUPT.
@@ -208201,13 +208707,13 @@
208201 sessionAppendByte(&sOut, eType, &rc);
208202 sessionAppendByte(&sOut, pInput->aData[pInput->iNext+1], &rc);
208203
208204 /* Read the old.* and new.* records for the update change. */
208205 pInput->iNext += 2;
208206 rc = sessionReadRecord(pInput, nCol, 0, &apVal[0]);
208207 if( rc==SQLITE_OK ){
208208 rc = sessionReadRecord(pInput, nCol, 0, &apVal[nCol]);
208209 }
208210
208211 /* Write the new old.* record. Consists of the PK columns from the
208212 ** original old.* record, and the other values from the original
208213 ** new.* record. */
@@ -209151,11 +209657,11 @@
209151 sqlite3_changeset_iter *pIter2 = 0;
209152 SessionBuffer cons = pApply->constraints;
209153 memset(&pApply->constraints, 0, sizeof(SessionBuffer));
209154
209155 rc = sessionChangesetStart(
209156 &pIter2, 0, 0, cons.nBuf, cons.aBuf, pApply->bInvertConstraints
209157 );
209158 if( rc==SQLITE_OK ){
209159 size_t nByte = 2*pApply->nCol*sizeof(sqlite3_value*);
209160 int rc2;
209161 pIter2->bPatchset = bPatchset;
@@ -209407,12 +209913,12 @@
209407 void *pCtx, /* First argument passed to xConflict */
209408 void **ppRebase, int *pnRebase,
209409 int flags
209410 ){
209411 sqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */
209412 int bInverse = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
209413 int rc = sessionChangesetStart(&pIter, 0, 0, nChangeset, pChangeset,bInverse);
209414 if( rc==SQLITE_OK ){
209415 rc = sessionChangesetApply(
209416 db, pIter, xFilter, xConflict, pCtx, ppRebase, pnRebase, flags
209417 );
209418 }
@@ -209466,11 +209972,11 @@
209466 void **ppRebase, int *pnRebase,
209467 int flags
209468 ){
209469 sqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */
209470 int bInverse = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
209471 int rc = sessionChangesetStart(&pIter, xInput, pIn, 0, 0, bInverse);
209472 if( rc==SQLITE_OK ){
209473 rc = sessionChangesetApply(
209474 db, pIter, xFilter, xConflict, pCtx, ppRebase, pnRebase, flags
209475 );
209476 }
@@ -210086,11 +210592,11 @@
210086 *pOut++ = pIter->bIndirect;
210087 for(i=0; i<pIter->nCol; i++){
210088 int n1 = sessionSerialLen(a1);
210089 int n2 = sessionSerialLen(a2);
210090 if( pIter->abPK[i] || a2[0]==0 ){
210091 if( !pIter->abPK[i] ) bData = 1;
210092 memcpy(pOut, a1, n1);
210093 pOut += n1;
210094 }else if( a2[0]!=0xFF ){
210095 bData = 1;
210096 memcpy(pOut, a2, n2);
@@ -228484,11 +228990,11 @@
228484 int nArg, /* Number of args */
228485 sqlite3_value **apUnused /* Function arguments */
228486 ){
228487 assert( nArg==0 );
228488 UNUSED_PARAM2(nArg, apUnused);
228489 sqlite3_result_text(pCtx, "fts5: 2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398f17d", -1, SQLITE_TRANSIENT);
228490 }
228491
228492 /*
228493 ** Return true if zName is the extension on one of the shadow tables used
228494 ** by this module.
@@ -233410,12 +233916,12 @@
233410 }
233411 #endif /* SQLITE_CORE */
233412 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
233413
233414 /************** End of stmt.c ************************************************/
233415 #if __LINE__!=233415
233416 #undef SQLITE_SOURCE_ID
233417 #define SQLITE_SOURCE_ID "2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398alt2"
233418 #endif
233419 /* Return the source-id for this library */
233420 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
233421 /************************** End of sqlite3.c ******************************/
233422
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1171,11 +1171,11 @@
1171 ** be held constant and Z will be incremented or else Y will be incremented
1172 ** and Z will be reset to zero.
1173 **
1174 ** Since [version 3.6.18] ([dateof:3.6.18]),
1175 ** SQLite source code has been stored in the
1176 ** <a href="http://www.fossil-scm.org/">Fossil configuration management
1177 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
1178 ** a string which identifies a particular check-in of SQLite
1179 ** within its configuration management system. ^The SQLITE_SOURCE_ID
1180 ** string contains the date and time of the check-in (UTC) and a SHA1
1181 ** or SHA3-256 hash of the entire source tree. If the source code has
@@ -1186,11 +1186,11 @@
1186 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1187 ** [sqlite_version()] and [sqlite_source_id()].
1188 */
1189 #define SQLITE_VERSION "3.35.0"
1190 #define SQLITE_VERSION_NUMBER 3035000
1191 #define SQLITE_SOURCE_ID "2021-02-22 16:42:09 b5a0778cc5a98a864bea72670f83262da940aceb91fa4cdf46ec097337a3alt1"
1192
1193 /*
1194 ** CAPI3REF: Run-Time Library Version Numbers
1195 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1196 **
@@ -14125,95 +14125,96 @@
14125 #define TK_GROUPS 92
14126 #define TK_OTHERS 93
14127 #define TK_TIES 94
14128 #define TK_GENERATED 95
14129 #define TK_ALWAYS 96
14130 #define TK_MATERIALIZED 97
14131 #define TK_REINDEX 98
14132 #define TK_RENAME 99
14133 #define TK_CTIME_KW 100
14134 #define TK_ANY 101
14135 #define TK_BITAND 102
14136 #define TK_BITOR 103
14137 #define TK_LSHIFT 104
14138 #define TK_RSHIFT 105
14139 #define TK_PLUS 106
14140 #define TK_MINUS 107
14141 #define TK_STAR 108
14142 #define TK_SLASH 109
14143 #define TK_REM 110
14144 #define TK_CONCAT 111
14145 #define TK_COLLATE 112
14146 #define TK_BITNOT 113
14147 #define TK_ON 114
14148 #define TK_INDEXED 115
14149 #define TK_STRING 116
14150 #define TK_JOIN_KW 117
14151 #define TK_CONSTRAINT 118
14152 #define TK_DEFAULT 119
14153 #define TK_NULL 120
14154 #define TK_PRIMARY 121
14155 #define TK_UNIQUE 122
14156 #define TK_CHECK 123
14157 #define TK_REFERENCES 124
14158 #define TK_AUTOINCR 125
14159 #define TK_INSERT 126
14160 #define TK_DELETE 127
14161 #define TK_UPDATE 128
14162 #define TK_SET 129
14163 #define TK_DEFERRABLE 130
14164 #define TK_FOREIGN 131
14165 #define TK_DROP 132
14166 #define TK_UNION 133
14167 #define TK_ALL 134
14168 #define TK_EXCEPT 135
14169 #define TK_INTERSECT 136
14170 #define TK_SELECT 137
14171 #define TK_VALUES 138
14172 #define TK_DISTINCT 139
14173 #define TK_DOT 140
14174 #define TK_FROM 141
14175 #define TK_JOIN 142
14176 #define TK_USING 143
14177 #define TK_ORDER 144
14178 #define TK_GROUP 145
14179 #define TK_HAVING 146
14180 #define TK_LIMIT 147
14181 #define TK_WHERE 148
14182 #define TK_RETURNING 149
14183 #define TK_INTO 150
14184 #define TK_NOTHING 151
14185 #define TK_FLOAT 152
14186 #define TK_BLOB 153
14187 #define TK_INTEGER 154
14188 #define TK_VARIABLE 155
14189 #define TK_CASE 156
14190 #define TK_WHEN 157
14191 #define TK_THEN 158
14192 #define TK_ELSE 159
14193 #define TK_INDEX 160
14194 #define TK_ALTER 161
14195 #define TK_ADD 162
14196 #define TK_WINDOW 163
14197 #define TK_OVER 164
14198 #define TK_FILTER 165
14199 #define TK_COLUMN 166
14200 #define TK_AGG_FUNCTION 167
14201 #define TK_AGG_COLUMN 168
14202 #define TK_TRUEFALSE 169
14203 #define TK_ISNOT 170
14204 #define TK_FUNCTION 171
14205 #define TK_UMINUS 172
14206 #define TK_UPLUS 173
14207 #define TK_TRUTH 174
14208 #define TK_REGISTER 175
14209 #define TK_VECTOR 176
14210 #define TK_SELECT_COLUMN 177
14211 #define TK_IF_NULL_ROW 178
14212 #define TK_ASTERISK 179
14213 #define TK_SPAN 180
14214 #define TK_SPACE 181
14215 #define TK_ILLEGAL 182
14216
14217 /************** End of parse.h ***********************************************/
14218 /************** Continuing where we left off in sqliteInt.h ******************/
14219 #include <stdio.h>
14220 #include <stdlib.h>
@@ -14764,10 +14765,12 @@
14765 typedef struct AuthContext AuthContext;
14766 typedef struct AutoincInfo AutoincInfo;
14767 typedef struct Bitvec Bitvec;
14768 typedef struct CollSeq CollSeq;
14769 typedef struct Column Column;
14770 typedef struct Cte Cte;
14771 typedef struct CteUse CteUse;
14772 typedef struct Db Db;
14773 typedef struct DbFixer DbFixer;
14774 typedef struct Schema Schema;
14775 typedef struct Expr Expr;
14776 typedef struct ExprList ExprList;
@@ -14793,10 +14796,11 @@
14796 typedef struct RowSet RowSet;
14797 typedef struct Savepoint Savepoint;
14798 typedef struct Select Select;
14799 typedef struct SQLiteThread SQLiteThread;
14800 typedef struct SelectDest SelectDest;
14801 typedef struct SrcItem SrcItem;
14802 typedef struct SrcList SrcList;
14803 typedef struct sqlite3_str StrAccum; /* Internal alias for sqlite3_str */
14804 typedef struct Table Table;
14805 typedef struct TableLock TableLock;
14806 typedef struct Token Token;
@@ -15786,26 +15790,26 @@
15790 #define OP_ReopenIdx 96 /* synopsis: root=P2 iDb=P3 */
15791 #define OP_OpenRead 97 /* synopsis: root=P2 iDb=P3 */
15792 #define OP_OpenWrite 98 /* synopsis: root=P2 iDb=P3 */
15793 #define OP_OpenDup 99
15794 #define OP_OpenAutoindex 100 /* synopsis: nColumn=P2 */
15795 #define OP_OpenEphemeral 101 /* synopsis: nColumn=P2 */
15796 #define OP_BitAnd 102 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
15797 #define OP_BitOr 103 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
15798 #define OP_ShiftLeft 104 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
15799 #define OP_ShiftRight 105 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
15800 #define OP_Add 106 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
15801 #define OP_Subtract 107 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
15802 #define OP_Multiply 108 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
15803 #define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
15804 #define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
15805 #define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
15806 #define OP_SorterOpen 112
15807 #define OP_BitNot 113 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
15808 #define OP_SequenceTest 114 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
15809 #define OP_OpenPseudo 115 /* synopsis: P3 columns in r[P2] */
15810 #define OP_String8 116 /* same as TK_STRING, synopsis: r[P2]='P4' */
15811 #define OP_Close 117
15812 #define OP_ColumnsUsed 118
15813 #define OP_SeekScan 119 /* synopsis: Scan-ahead up to P1 rows */
15814 #define OP_SeekHit 120 /* synopsis: set P2<=seekHit<=P3 */
15815 #define OP_Sequence 121 /* synopsis: r[P2]=cursor[P1].ctr++ */
@@ -15836,12 +15840,12 @@
15840 #define OP_DropTable 146
15841 #define OP_DropIndex 147
15842 #define OP_DropTrigger 148
15843 #define OP_IntegrityCk 149
15844 #define OP_RowSetAdd 150 /* synopsis: rowset(P1)=r[P2] */
15845 #define OP_Param 151
15846 #define OP_Real 152 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
15847 #define OP_FkCounter 153 /* synopsis: fkctr[P1]+=P2 */
15848 #define OP_MemMax 154 /* synopsis: r[P1]=max(r[P1],r[P2]) */
15849 #define OP_OffsetLimit 155 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
15850 #define OP_AggInverse 156 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
15851 #define OP_AggStep 157 /* synopsis: accum=r[P3] step(r[P2@P5]) */
@@ -15888,13 +15892,13 @@
15892 /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x01, 0x01, 0x01, 0x00,\
15893 /* 64 */ 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10,\
15894 /* 72 */ 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\
15895 /* 80 */ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\
15896 /* 88 */ 0x12, 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\
15897 /* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26,\
15898 /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
15899 /* 112 */ 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
15900 /* 120 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
15901 /* 128 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00,\
15902 /* 136 */ 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00,\
15903 /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10,\
15904 /* 152 */ 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00,\
@@ -15966,11 +15970,11 @@
15970 #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_EXPLAIN)
15971 SQLITE_PRIVATE void sqlite3ExplainBreakpoint(const char*,const char*);
15972 #else
15973 # define sqlite3ExplainBreakpoint(A,B) /*no-op*/
15974 #endif
15975 SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*, int, char*, u16);
15976 SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, int addr, u8);
15977 SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
15978 SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
15979 SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3);
15980 SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u16 P5);
@@ -17475,11 +17479,16 @@
17479 u8 szEst; /* Estimated size of value in this column. sizeof(INT)==1 */
17480 u8 hName; /* Column name hash for faster lookup */
17481 u16 colFlags; /* Boolean properties. See COLFLAG_ defines below */
17482 };
17483
17484 /* Allowed values for Column.colFlags.
17485 **
17486 ** Constraints:
17487 ** TF_HasVirtual == COLFLAG_VIRTUAL
17488 ** TF_HasStored == COLFLAG_STORED
17489 ** TF_HasHidden == COLFLAG_HIDDEN
17490 */
17491 #define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */
17492 #define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */
17493 #define COLFLAG_HASTYPE 0x0004 /* Type name follows column name */
17494 #define COLFLAG_UNIQUE 0x0008 /* Column def contains "UNIQUE" or "PK" */
@@ -17664,15 +17673,16 @@
17673 ** the TF_OOOHidden attribute would apply in this case. Such tables require
17674 ** special handling during INSERT processing. The "OOO" means "Out Of Order".
17675 **
17676 ** Constraints:
17677 **
17678 ** TF_HasVirtual == COLFLAG_VIRTUAL
17679 ** TF_HasStored == COLFLAG_STORED
17680 ** TF_HasHidden == COLFLAG_HIDDEN
17681 */
17682 #define TF_Readonly 0x0001 /* Read-only system table */
17683 #define TF_HasHidden 0x0002 /* Has one or more hidden columns */
17684 #define TF_HasPrimaryKey 0x0004 /* Table has a primary key */
17685 #define TF_Autoincrement 0x0008 /* Integer primary key is autoincrement */
17686 #define TF_HasStat1 0x0010 /* nRowLogEst set from sqlite_stat1 */
17687 #define TF_HasVirtual 0x0020 /* Has one or more VIRTUAL columns */
17688 #define TF_HasStored 0x0040 /* Has one or more STORED columns */
@@ -17683,10 +17693,11 @@
17693 #define TF_NoVisibleRowid 0x0200 /* No user-visible "rowid" column */
17694 #define TF_OOOHidden 0x0400 /* Out-of-Order hidden columns */
17695 #define TF_HasNotNull 0x0800 /* Contains NOT NULL constraints */
17696 #define TF_Shadow 0x1000 /* True for a shadow table */
17697 #define TF_HasStat4 0x2000 /* STAT4 info available for this table */
17698 #define TF_Ephemeral 0x4000 /* An ephemeral table */
17699
17700 /*
17701 ** Test to see whether or not a table is a virtual table. This is
17702 ** done as a macro so that it will be optimized out when virtual
17703 ** table support is omitted from the build.
@@ -18051,11 +18062,10 @@
18062 int iMem; /* Memory location that acts as accumulator */
18063 int iDistinct; /* Ephemeral table used to enforce DISTINCT */
18064 } *aFunc;
18065 int nFunc; /* Number of entries in aFunc[] */
18066 u32 selId; /* Select to which this AggInfo belongs */
 
18067 };
18068
18069 /*
18070 ** The datatype ynVar is a signed integer, either 16-bit or 32-bit.
18071 ** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater
@@ -18370,10 +18380,49 @@
18380 int idx; /* Index in some Table.aCol[] of a column named zName */
18381 } *a;
18382 int nId; /* Number of identifiers on the list */
18383 };
18384
18385 /*
18386 ** The SrcItem object represents a single term in the FROM clause of a query.
18387 ** The SrcList object is mostly an array of SrcItems.
18388 */
18389 struct SrcItem {
18390 Schema *pSchema; /* Schema to which this item is fixed */
18391 char *zDatabase; /* Name of database holding this table */
18392 char *zName; /* Name of the table */
18393 char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */
18394 Table *pTab; /* An SQL table corresponding to zName */
18395 Select *pSelect; /* A SELECT statement used in place of a table name */
18396 int addrFillSub; /* Address of subroutine to manifest a subquery */
18397 int regReturn; /* Register holding return address of addrFillSub */
18398 int regResult; /* Registers holding results of a co-routine */
18399 struct {
18400 u8 jointype; /* Type of join between this table and the previous */
18401 unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */
18402 unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */
18403 unsigned isTabFunc :1; /* True if table-valued-function syntax */
18404 unsigned isCorrelated :1; /* True if sub-query is correlated */
18405 unsigned viaCoroutine :1; /* Implemented as a co-routine */
18406 unsigned isRecursive :1; /* True for recursive reference in WITH */
18407 unsigned fromDDL :1; /* Comes from sqlite_schema */
18408 unsigned isCte :1; /* This is a CTE */
18409 } fg;
18410 int iCursor; /* The VDBE cursor number used to access this table */
18411 Expr *pOn; /* The ON clause of a join */
18412 IdList *pUsing; /* The USING clause of a join */
18413 Bitmask colUsed; /* Bit N (1<<N) set if column N of pTab is used */
18414 union {
18415 char *zIndexedBy; /* Identifier from "INDEXED BY <zIndex>" clause */
18416 ExprList *pFuncArg; /* Arguments to table-valued-function */
18417 } u1;
18418 union {
18419 Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */
18420 CteUse *pCteUse; /* CTE Usage info info fg.isCte is true */
18421 } u2;
18422 };
18423
18424 /*
18425 ** The following structure describes the FROM clause of a SELECT statement.
18426 ** Each table or subquery in the FROM clause is a separate element of
18427 ** the SrcList.a[] array.
18428 **
@@ -18392,40 +18441,11 @@
18441 ** contains more than 63 columns and the 64-th or later column is used.
18442 */
18443 struct SrcList {
18444 int nSrc; /* Number of tables or subqueries in the FROM clause */
18445 u32 nAlloc; /* Number of entries allocated in a[] below */
18446 SrcItem a[1]; /* One entry for each identifier on the list */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18447 };
18448
18449 /*
18450 ** Permitted values of the SrcList.a.jointype field
18451 */
@@ -18644,10 +18664,11 @@
18664 #define SF_WhereBegin 0x0080000 /* Really a WhereBegin() call. Debug Only */
18665 #define SF_WinRewrite 0x0100000 /* Window function rewrite accomplished */
18666 #define SF_View 0x0200000 /* SELECT statement is a view */
18667 #define SF_NoopOrderBy 0x0400000 /* ORDER BY is ignored for this query */
18668 #define SF_UpdateFrom 0x0800000 /* Statement is an UPDATE...FROM */
18669 #define SF_PushDown 0x1000000 /* SELECT has be modified by push-down opt */
18670
18671 /*
18672 ** The results of a SELECT can be distributed in several ways, as defined
18673 ** by one of the following macros. The "SRT" prefix means "SELECT Result
18674 ** Type".
@@ -18886,11 +18907,10 @@
18907 #endif
18908 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
18909 Parse *pToplevel; /* Parse structure for main program (or NULL) */
18910 Table *pTriggerTab; /* Table triggers are being coded for */
18911 Parse *pParentParse; /* Parent parser if this parser is nested */
 
18912 union {
18913 int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */
18914 Returning *pReturning; /* The RETURNING clause */
18915 } u1;
18916 u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
@@ -19170,11 +19190,12 @@
19190 } InitData;
19191
19192 /*
19193 ** Allowed values for mInitFlags
19194 */
19195 #define INITFLAG_AlterRename 0x0001 /* Reparse after a RENAME */
19196 #define INITFLAG_AlterDrop 0x0002 /* Reparse after a DROP COLUMN */
19197
19198 /*
19199 ** Structure containing global configuration data for the SQLite library.
19200 **
19201 ** This structure also contains some state information.
@@ -19282,11 +19303,11 @@
19303 Select *pSelect; /* HAVING to WHERE clause ctx */
19304 struct WindowRewrite *pRewrite; /* Window rewrite context */
19305 struct WhereConst *pConst; /* WHERE clause constants */
19306 struct RenameCtx *pRename; /* RENAME COLUMN context */
19307 struct Table *pTab; /* Table of generated column */
19308 SrcItem *pSrcItem; /* A single FROM clause item */
19309 DbFixer *pFix;
19310 } u;
19311 };
19312
19313 /*
@@ -19327,23 +19348,58 @@
19348 #define WRC_Continue 0 /* Continue down into children */
19349 #define WRC_Prune 1 /* Omit children but continue walking siblings */
19350 #define WRC_Abort 2 /* Abandon the tree walk */
19351
19352 /*
19353 ** A single common table expression
19354 */
19355 struct Cte {
19356 char *zName; /* Name of this CTE */
19357 ExprList *pCols; /* List of explicit column names, or NULL */
19358 Select *pSelect; /* The definition of this CTE */
19359 const char *zCteErr; /* Error message for circular references */
19360 CteUse *pUse; /* Usage information for this CTE */
19361 u8 eM10d; /* The MATERIALIZED flag */
19362 };
19363
19364 /*
19365 ** Allowed values for the materialized flag (eM10d):
19366 */
19367 #define M10d_Yes 0 /* AS MATERIALIZED */
19368 #define M10d_Any 1 /* Not specified. Query planner's choice */
19369 #define M10d_No 2 /* AS NOT MATERIALIZED */
19370
19371 /*
19372 ** An instance of the With object represents a WITH clause containing
19373 ** one or more CTEs (common table expressions).
19374 */
19375 struct With {
19376 int nCte; /* Number of CTEs in the WITH clause */
19377 With *pOuter; /* Containing WITH clause, or NULL */
19378 Cte a[1]; /* For each CTE in the WITH clause.... */
 
 
 
 
 
19379 };
19380
19381 /*
19382 ** The Cte object is not guaranteed to persist for the entire duration
19383 ** of code generation. (The query flattener or other parser tree
19384 ** edits might delete it.) The following object records information
19385 ** about each Common Table Expression that must be preserved for the
19386 ** duration of the parse.
19387 **
19388 ** The CteUse objects are freed using sqlite3ParserAddCleanup() rather
19389 ** than sqlite3SelectDelete(), which is what enables them to persist
19390 ** until the end of code generation.
19391 */
19392 struct CteUse {
19393 int nUse; /* Number of users of this CTE */
19394 int addrM9e; /* Start of subroutine to compute materialization */
19395 int regRtn; /* Return address register for addrM9e subroutine */
19396 int iCur; /* Ephemeral table holding the materialization */
19397 LogEst nRowEst; /* Estimated number of rows in the table */
19398 u8 eM10d; /* The MATERIALIZED flag */
19399 };
19400
19401
19402 #ifdef SQLITE_DEBUG
19403 /*
19404 ** An instance of the TreeView object is used for printing the content of
19405 ** data structures on sqlite3DebugPrintf() using a tree-like view.
@@ -19800,11 +19856,11 @@
19856 SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(Parse*, SrcList*, Token*, Token*);
19857 SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*,
19858 Token*, Select*, Expr*, IdList*);
19859 SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *);
19860 SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse*, SrcList*, ExprList*);
19861 SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, SrcItem *);
19862 SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList*);
19863 SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse*, SrcList*);
19864 SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*);
19865 SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3*, SrcList*);
19866 SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(sqlite3*,i16,int,char**);
@@ -19862,11 +19918,11 @@
19918 SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse*, Expr*, int, int);
19919 SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*);
19920 #define LOCATE_VIEW 0x01
19921 #define LOCATE_NOERR 0x02
19922 SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*);
19923 SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,SrcItem *);
19924 SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*);
19925 SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);
19926 SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
19927 SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*,Expr*);
19928 SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int, sqlite3_value*);
@@ -19990,10 +20046,11 @@
20046 # define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
20047 # define sqlite3TriggerStepSrc(A,B) 0
20048 #endif
20049
20050 SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*);
20051 SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol);
20052 SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr*,int);
20053 SQLITE_PRIVATE void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);
20054 SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse*, int);
20055 #ifndef SQLITE_OMIT_AUTHORIZATION
20056 SQLITE_PRIVATE void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);
@@ -20156,11 +20213,11 @@
20213 SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
20214 SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
20215 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
20216 SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
20217 SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
20218 SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, SrcItem*);
20219 SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
20220 SQLITE_PRIVATE int sqlite3MatchEName(
20221 const struct ExprList_item*,
20222 const char*,
20223 const char*,
@@ -20174,10 +20231,11 @@
20231 SQLITE_PRIVATE int sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*);
20232 SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
20233 SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
20234 SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *);
20235 SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
20236 SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse*, SrcList*, Token*);
20237 SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse*, void*, Token*);
20238 SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom);
20239 SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*);
20240 SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse*, ExprList*);
20241 SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);
@@ -20327,11 +20385,11 @@
20385 SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
20386 SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);
20387 SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
20388 SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
20389 SQLITE_PRIVATE void sqlite3ParserReset(Parse*);
20390 SQLITE_PRIVATE void *sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*);
20391 #ifdef SQLITE_ENABLE_NORMALIZE
20392 SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*);
20393 #endif
20394 SQLITE_PRIVATE int sqlite3Reprepare(Vdbe*);
20395 SQLITE_PRIVATE void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*);
@@ -20342,16 +20400,21 @@
20400 #ifndef SQLITE_OMIT_WAL
20401 SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3*, int, int, int*, int*);
20402 SQLITE_PRIVATE int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int);
20403 #endif
20404 #ifndef SQLITE_OMIT_CTE
20405 SQLITE_PRIVATE Cte *sqlite3CteNew(Parse*,Token*,ExprList*,Select*,u8);
20406 SQLITE_PRIVATE void sqlite3CteDelete(sqlite3*,Cte*);
20407 SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Cte*);
20408 SQLITE_PRIVATE void sqlite3WithDelete(sqlite3*,With*);
20409 SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8);
20410 #else
20411 # define sqlite3CteNew(P,T,E,S) ((void*)0)
20412 # define sqlite3CteDelete(D,C)
20413 # define sqlite3CteWithAdd(P,W,C) ((void*)0)
20414 # define sqlite3WithDelete(x,y)
20415 # define sqlite3WithPush(x,y,z)
20416 #endif
20417 #ifndef SQLITE_OMIT_UPSERT
20418 SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*);
20419 SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*);
20420 SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*);
@@ -29201,11 +29264,11 @@
29264 break;
29265 }
29266 case etSRCLIST: {
29267 SrcList *pSrc;
29268 int k;
29269 SrcItem *pItem;
29270 if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
29271 pSrc = va_arg(ap, SrcList*);
29272 k = va_arg(ap, int);
29273 pItem = &pSrc->a[k];
29274 assert( bArgList==0 );
@@ -29769,11 +29832,14 @@
29832 sqlite3_str_appendf(&x, "%c%s", cSep, pCte->pCols->a[j].zEName);
29833 cSep = ',';
29834 }
29835 sqlite3_str_appendf(&x, ")");
29836 }
29837 if( pCte->pUse ){
29838 sqlite3_str_appendf(&x, " (pUse=0x%p, nUse=%d)", pCte->pUse,
29839 pCte->pUse->nUse);
29840 }
29841 sqlite3StrAccumFinish(&x);
29842 sqlite3TreeViewItem(pView, zLine, i<pWith->nCte-1);
29843 sqlite3TreeViewSelect(pView, pCte->pSelect, 0);
29844 sqlite3TreeViewPop(pView);
29845 }
@@ -29785,11 +29851,11 @@
29851 ** Generate a human-readable description of a SrcList object.
29852 */
29853 SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){
29854 int i;
29855 for(i=0; i<pSrc->nSrc; i++){
29856 const SrcItem *pItem = &pSrc->a[i];
29857 StrAccum x;
29858 char zLine[100];
29859 sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);
29860 sqlite3_str_appendf(&x, "{%d:*}", pItem->iCursor);
29861 if( pItem->zDatabase ){
@@ -29808,10 +29874,13 @@
29874 sqlite3_str_appendf(&x, " LEFT-JOIN");
29875 }
29876 if( pItem->fg.fromDDL ){
29877 sqlite3_str_appendf(&x, " DDL");
29878 }
29879 if( pItem->fg.isCte ){
29880 sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse);
29881 }
29882 sqlite3StrAccumFinish(&x);
29883 sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1);
29884 if( pItem->pSelect ){
29885 sqlite3TreeViewSelect(pView, pItem->pSelect, 0);
29886 }
@@ -33481,26 +33550,26 @@
33550 /* 96 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
33551 /* 97 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
33552 /* 98 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
33553 /* 99 */ "OpenDup" OpHelp(""),
33554 /* 100 */ "OpenAutoindex" OpHelp("nColumn=P2"),
33555 /* 101 */ "OpenEphemeral" OpHelp("nColumn=P2"),
33556 /* 102 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
33557 /* 103 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
33558 /* 104 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
33559 /* 105 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
33560 /* 106 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
33561 /* 107 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
33562 /* 108 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
33563 /* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
33564 /* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
33565 /* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
33566 /* 112 */ "SorterOpen" OpHelp(""),
33567 /* 113 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
33568 /* 114 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
33569 /* 115 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
33570 /* 116 */ "String8" OpHelp("r[P2]='P4'"),
33571 /* 117 */ "Close" OpHelp(""),
33572 /* 118 */ "ColumnsUsed" OpHelp(""),
33573 /* 119 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
33574 /* 120 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
33575 /* 121 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
@@ -33531,12 +33600,12 @@
33600 /* 146 */ "DropTable" OpHelp(""),
33601 /* 147 */ "DropIndex" OpHelp(""),
33602 /* 148 */ "DropTrigger" OpHelp(""),
33603 /* 149 */ "IntegrityCk" OpHelp(""),
33604 /* 150 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
33605 /* 151 */ "Param" OpHelp(""),
33606 /* 152 */ "Real" OpHelp("r[P2]=P4"),
33607 /* 153 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
33608 /* 154 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
33609 /* 155 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
33610 /* 156 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
33611 /* 157 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
@@ -78733,13 +78802,14 @@
78802 ** as having been used.
78803 **
78804 ** The zWhere string must have been obtained from sqlite3_malloc().
78805 ** This routine will take ownership of the allocated memory.
78806 */
78807 SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere, u16 p5){
78808 int j;
78809 sqlite3VdbeAddOp4(p, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC);
78810 sqlite3VdbeChangeP5(p, p5);
78811 for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);
78812 sqlite3MayAbort(p->pParse);
78813 }
78814
78815 /*
@@ -89804,11 +89874,11 @@
89874 assert( aMem[pOp->p3].flags & MEM_Null );
89875 aMem[pOp->p3].n = 0;
89876 aMem[pOp->p3].z = "";
89877 }
89878 pCx = p->apCsr[pOp->p1];
89879 if( pCx && ALWAYS(pCx->pBtx) ){
89880 /* If the ephermeral table is already open, erase all existing content
89881 ** so that the table is empty again, rather than creating a new table. */
89882 assert( pCx->isEphemeral );
89883 pCx->seqCount = 0;
89884 pCx->cacheStatus = CACHE_STALE;
@@ -92185,11 +92255,11 @@
92255
92256 #ifndef SQLITE_OMIT_ALTERTABLE
92257 if( pOp->p4.z==0 ){
92258 sqlite3SchemaClear(db->aDb[iDb].pSchema);
92259 db->mDbFlags &= ~DBFLAG_SchemaKnownOk;
92260 rc = sqlite3InitOne(db, iDb, &p->zErrMsg, pOp->p5);
92261 db->mDbFlags |= DBFLAG_SchemaChange;
92262 p->expired = 0;
92263 }else
92264 #endif
92265 {
@@ -98409,11 +98479,11 @@
98479 ** WRC_Abort or WRC_Continue;
98480 */
98481 SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){
98482 SrcList *pSrc;
98483 int i;
98484 SrcItem *pItem;
98485
98486 pSrc = p->pSrc;
98487 if( pSrc ){
98488 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
98489 if( pItem->pSelect && sqlite3WalkSelect(pWalker, pItem->pSelect) ){
@@ -98575,11 +98645,10 @@
98645 static void resolveAlias(
98646 Parse *pParse, /* Parsing context */
98647 ExprList *pEList, /* A result set */
98648 int iCol, /* A column in the result set. 0..pEList->nExpr-1 */
98649 Expr *pExpr, /* Transform this into an alias to the result set */
 
98650 int nSubquery /* Number of subqueries that the label is moving */
98651 ){
98652 Expr *pOrig; /* The iCol-th column of the result set */
98653 Expr *pDup; /* Copy of pOrig */
98654 sqlite3 *db; /* The database connection */
@@ -98588,11 +98657,11 @@
98657 pOrig = pEList->a[iCol].pExpr;
98658 assert( pOrig!=0 );
98659 db = pParse->db;
98660 pDup = sqlite3ExprDup(db, pOrig, 0);
98661 if( pDup!=0 ){
98662 incrAggFunctionDepth(pDup, nSubquery);
98663 if( pExpr->op==TK_COLLATE ){
98664 pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);
98665 }
98666
98667 /* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
@@ -98751,12 +98820,12 @@
98820 int i, j; /* Loop counters */
98821 int cnt = 0; /* Number of matching column names */
98822 int cntTab = 0; /* Number of matching table names */
98823 int nSubquery = 0; /* How many levels of subquery */
98824 sqlite3 *db = pParse->db; /* The database connection */
98825 SrcItem *pItem; /* Use for looping over pSrcList items */
98826 SrcItem *pMatch = 0; /* The matching pSrcList item */
98827 NameContext *pTopNC = pNC; /* First namecontext in the list */
98828 Schema *pSchema = 0; /* Schema of the expression */
98829 int eNewExprOp = TK_COLUMN; /* New value for pExpr->op on success */
98830 Table *pTab = 0; /* Table hold the row */
98831 Column *pCol; /* A column of pTab */
@@ -98873,13 +98942,14 @@
98942 } /* if( pSrcList ) */
98943
98944 #if !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT)
98945 /* If we have not already resolved the name, then maybe
98946 ** it is a new.* or old.* trigger argument reference. Or
98947 ** maybe it is an excluded.* from an upsert. Or maybe it is
98948 ** a reference in the RETURNING clause to a table being modified.
98949 */
98950 if( cnt==0 && zDb==0 ){
98951 pTab = 0;
98952 #ifndef SQLITE_OMIT_TRIGGER
98953 if( pParse->pTriggerTab!=0 ){
98954 int op = pParse->eTriggerOp;
98955 assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
@@ -98887,18 +98957,18 @@
98957 pExpr->iTable = 1;
98958 pTab = pParse->pTriggerTab;
98959 }else if( op!=TK_INSERT && zTab && sqlite3StrICmp("old",zTab)==0 ){
98960 pExpr->iTable = 0;
98961 pTab = pParse->pTriggerTab;
98962 }else if( pParse->bReturning && (pNC->ncFlags & NC_UBaseReg)!=0 ){
98963 pExpr->iTable = op!=TK_DELETE;
98964 pTab = pParse->pTriggerTab;
98965 }
98966 }
98967 #endif /* SQLITE_OMIT_TRIGGER */
98968 #ifndef SQLITE_OMIT_UPSERT
98969 if( (pNC->ncFlags & NC_UUpsert)!=0 && zTab!=0 ){
98970 Upsert *pUpsert = pNC->uNC.pUpsert;
98971 if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){
98972 pTab = pUpsert->pUpsertSrc->a[0].pTab;
98973 pExpr->iTable = EXCLUDED_TABLE_NUMBER;
98974 }
@@ -98941,11 +99011,11 @@
99011 {
99012 pExpr->y.pTab = pTab;
99013 if( pParse->bReturning ){
99014 eNewExprOp = TK_REGISTER;
99015 pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable
99016 + iCol + 1;
99017 }else{
99018 pExpr->iColumn = (i16)iCol;
99019 eNewExprOp = TK_TRIGGER;
99020 #ifndef SQLITE_OMIT_TRIGGER
99021 if( iCol<0 ){
@@ -99028,11 +99098,11 @@
99098 }
99099 if( sqlite3ExprVectorSize(pOrig)!=1 ){
99100 sqlite3ErrorMsg(pParse, "row value misused");
99101 return WRC_Abort;
99102 }
99103 resolveAlias(pParse, pEList, j, pExpr, nSubquery);
99104 cnt = 1;
99105 pMatch = 0;
99106 assert( zTab==0 && zDb==0 );
99107 if( IN_RENAME_OBJECT ){
99108 sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr);
@@ -99130,14 +99200,16 @@
99200 pMatch->colUsed |= sqlite3ExprColUsed(pExpr);
99201 }
99202
99203 /* Clean up and return
99204 */
99205 if( !ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
99206 sqlite3ExprDelete(db, pExpr->pLeft);
99207 pExpr->pLeft = 0;
99208 sqlite3ExprDelete(db, pExpr->pRight);
99209 pExpr->pRight = 0;
99210 }
99211 pExpr->op = eNewExprOp;
99212 ExprSetProperty(pExpr, EP_Leaf);
99213 lookupname_end:
99214 if( cnt==1 ){
99215 assert( pNC!=0 );
@@ -99165,11 +99237,11 @@
99237 ** from datasource iSrc in SrcList pSrc.
99238 */
99239 SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
99240 Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0);
99241 if( p ){
99242 SrcItem *pItem = &pSrc->a[iSrc];
99243 Table *pTab = p->y.pTab = pItem->pTab;
99244 p->iTable = pItem->iCursor;
99245 if( p->y.pTab->iPKey==iCol ){
99246 p->iColumn = -1;
99247 }else{
@@ -99277,11 +99349,11 @@
99349 ** clause processing on UPDATE and DELETE statements, and by
99350 ** UPDATE ... FROM statement processing.
99351 */
99352 case TK_ROW: {
99353 SrcList *pSrcList = pNC->pSrcList;
99354 SrcItem *pItem;
99355 assert( pSrcList && pSrcList->nSrc>=1 );
99356 pItem = pSrcList->a;
99357 pExpr->op = TK_COLUMN;
99358 pExpr->y.pTab = pItem->pTab;
99359 pExpr->iTable = pItem->iCursor;
@@ -99905,12 +99977,11 @@
99977 if( pItem->u.x.iOrderByCol ){
99978 if( pItem->u.x.iOrderByCol>pEList->nExpr ){
99979 resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr);
99980 return 1;
99981 }
99982 resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,0);
 
99983 }
99984 }
99985 return 0;
99986 }
99987
@@ -100091,11 +100162,11 @@
100162 }
100163
100164 /* Recursively resolve names in all subqueries
100165 */
100166 for(i=0; i<p->pSrc->nSrc; i++){
100167 SrcItem *pItem = &p->pSrc->a[i];
100168 if( pItem->pSelect && (pItem->pSelect->selFlags & SF_Resolved)==0 ){
100169 NameContext *pNC; /* Used to iterate name contexts */
100170 int nRef = 0; /* Refcount for pOuterNC and outer contexts */
100171 const char *zSavedContext = pParse->zAuthContext;
100172
@@ -100153,19 +100224,19 @@
100224 ** aliases in the result set.
100225 **
100226 ** Minor point: If this is the case, then the expression will be
100227 ** re-evaluated for each reference to it.
100228 */
100229 assert( (sNC.ncFlags & (NC_UAggInfo|NC_UUpsert|NC_UBaseReg))==0 );
100230 sNC.uNC.pEList = p->pEList;
100231 sNC.ncFlags |= NC_UEList;
100232 if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
100233 if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;
100234
100235 /* Resolve names in table-valued-function arguments */
100236 for(i=0; i<p->pSrc->nSrc; i++){
100237 SrcItem *pItem = &p->pSrc->a[i];
100238 if( pItem->fg.isTabFunc
100239 && sqlite3ResolveExprListNames(&sNC, pItem->u1.pFuncArg)
100240 ){
100241 return WRC_Abort;
100242 }
@@ -102005,12 +102076,12 @@
102076 nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0);
102077 pNew = sqlite3DbMallocRawNN(db, nByte );
102078 if( pNew==0 ) return 0;
102079 pNew->nSrc = pNew->nAlloc = p->nSrc;
102080 for(i=0; i<p->nSrc; i++){
102081 SrcItem *pNewItem = &pNew->a[i];
102082 SrcItem *pOldItem = &p->a[i];
102083 Table *pTab;
102084 pNewItem->pSchema = pOldItem->pSchema;
102085 pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase);
102086 pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
102087 pNewItem->zAlias = sqlite3DbStrDup(db, pOldItem->zAlias);
@@ -102019,11 +102090,14 @@
102090 pNewItem->addrFillSub = pOldItem->addrFillSub;
102091 pNewItem->regReturn = pOldItem->regReturn;
102092 if( pNewItem->fg.isIndexedBy ){
102093 pNewItem->u1.zIndexedBy = sqlite3DbStrDup(db, pOldItem->u1.zIndexedBy);
102094 }
102095 pNewItem->u2 = pOldItem->u2;
102096 if( pNewItem->fg.isCte ){
102097 pNewItem->u2.pCteUse->nUse++;
102098 }
102099 if( pNewItem->fg.isTabFunc ){
102100 pNewItem->u1.pFuncArg =
102101 sqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags);
102102 }
102103 pTab = pNewItem->pTab = pOldItem->pTab;
@@ -106336,11 +106410,11 @@
106410 testcase( pExpr->op==TK_AGG_COLUMN );
106411 testcase( pExpr->op==TK_COLUMN );
106412 /* Check to see if the column is in one of the tables in the FROM
106413 ** clause of the aggregate query */
106414 if( ALWAYS(pSrcList!=0) ){
106415 SrcItem *pItem = pSrcList->a;
106416 for(i=0; i<pSrcList->nSrc; i++, pItem++){
106417 struct AggInfo_col *pCol;
106418 assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) );
106419 if( pExpr->iTable==pItem->iCursor ){
106420 /* If we reach this point, it means that pExpr refers to a table
@@ -106625,43 +106699,49 @@
106699 ** bTemp is not true, database "temp", can still be parsed. This is
106700 ** called at the end of the generation of an ALTER TABLE ... RENAME ...
106701 ** statement to ensure that the operation has not rendered any schema
106702 ** objects unusable.
106703 */
106704 static void renameTestSchema(
106705 Parse *pParse, /* Parse context */
106706 const char *zDb, /* Name of db to verify schema of */
106707 int bTemp, /* True if this is the temp db */
106708 const char *zWhen /* "when" part of error message */
106709 ){
106710 pParse->colNamesSet = 1;
106711 sqlite3NestedParse(pParse,
106712 "SELECT 1 "
106713 "FROM \"%w\"." DFLT_SCHEMA_TABLE " "
106714 "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
106715 " AND sql NOT LIKE 'create virtual%%'"
106716 " AND sqlite_rename_test(%Q, sql, type, name, %d, %Q)=NULL ",
106717 zDb,
106718 zDb, bTemp, zWhen
106719 );
106720
106721 if( bTemp==0 ){
106722 sqlite3NestedParse(pParse,
106723 "SELECT 1 "
106724 "FROM temp." DFLT_SCHEMA_TABLE " "
106725 "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
106726 " AND sql NOT LIKE 'create virtual%%'"
106727 " AND sqlite_rename_test(%Q, sql, type, name, 1, %Q)=NULL ",
106728 zDb, zWhen
106729 );
106730 }
106731 }
106732
106733 /*
106734 ** Generate code to reload the schema for database iDb. And, if iDb!=1, for
106735 ** the temp database as well.
106736 */
106737 static void renameReloadSchema(Parse *pParse, int iDb, u16 p5){
106738 Vdbe *v = pParse->pVdbe;
106739 if( v ){
106740 sqlite3ChangeCookie(pParse, iDb);
106741 sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, iDb, 0, p5);
106742 if( iDb!=1 ) sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0, p5);
106743 }
106744 }
106745
106746 /*
106747 ** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy"
@@ -106806,11 +106886,11 @@
106886 sqlite3NestedParse(pParse,
106887 "UPDATE sqlite_temp_schema SET "
106888 "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), "
106889 "tbl_name = "
106890 "CASE WHEN tbl_name=%Q COLLATE nocase AND "
106891 " sqlite_rename_test(%Q, sql, type, name, 1, 'after rename') "
106892 "THEN %Q ELSE tbl_name END "
106893 "WHERE type IN ('view', 'trigger')"
106894 , zDb, zTabName, zName, zTabName, zDb, zName);
106895 }
106896
@@ -106825,12 +106905,12 @@
106905 sqlite3VdbeLoadString(v, i, zName);
106906 sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB);
106907 }
106908 #endif
106909
106910 renameReloadSchema(pParse, iDb, INITFLAG_AlterRename);
106911 renameTestSchema(pParse, zDb, iDb==1, "after rename");
106912
106913 exit_rename_table:
106914 sqlite3SrcListDelete(db, pSrc);
106915 sqlite3DbFree(db, zName);
106916 db->mDbFlags = savedDbFlags;
@@ -106988,11 +107068,11 @@
107068 sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3);
107069 sqlite3ReleaseTempReg(pParse, r1);
107070 }
107071
107072 /* Reload the table definition */
107073 renameReloadSchema(pParse, iDb, INITFLAG_AlterRename);
107074 }
107075
107076 /*
107077 ** This function is called by the parser after the table-name in
107078 ** an "ALTER TABLE <table-name> ADD" statement is parsed. Argument
@@ -107088,11 +107168,11 @@
107168 ** it loads an error message into pParse and returns non-zero.
107169 **
107170 ** Or, if pTab is not a view or virtual table, zero is returned.
107171 */
107172 #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
107173 static int isRealTable(Parse *pParse, Table *pTab, int bDrop){
107174 const char *zType = 0;
107175 #ifndef SQLITE_OMIT_VIEW
107176 if( pTab->pSelect ){
107177 zType = "view";
107178 }
@@ -107101,19 +107181,20 @@
107181 if( IsVirtual(pTab) ){
107182 zType = "virtual table";
107183 }
107184 #endif
107185 if( zType ){
107186 sqlite3ErrorMsg(pParse, "cannot %s %s \"%s\"",
107187 (bDrop ? "drop column from" : "rename columns of"),
107188 zType, pTab->zName
107189 );
107190 return 1;
107191 }
107192 return 0;
107193 }
107194 #else /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */
107195 # define isRealTable(x,y,z) (0)
107196 #endif
107197
107198 /*
107199 ** Handles the following parser reduction:
107200 **
@@ -107138,11 +107219,11 @@
107219 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
107220 if( !pTab ) goto exit_rename_column;
107221
107222 /* Cannot alter a system table */
107223 if( SQLITE_OK!=isAlterableTable(pParse, pTab) ) goto exit_rename_column;
107224 if( SQLITE_OK!=isRealTable(pParse, pTab, 0) ) goto exit_rename_column;
107225
107226 /* Which schema holds the table to be altered */
107227 iSchema = sqlite3SchemaToIndex(db, pTab->pSchema);
107228 assert( iSchema>=0 );
107229 zDb = db->aDb[iSchema].zDbSName;
@@ -107192,12 +107273,12 @@
107273 "WHERE type IN ('trigger', 'view')",
107274 zDb, pTab->zName, iCol, zNew, bQuote
107275 );
107276
107277 /* Drop and reload the database schema. */
107278 renameReloadSchema(pParse, iSchema, INITFLAG_AlterRename);
107279 renameTestSchema(pParse, zDb, iSchema==1, "after rename");
107280
107281 exit_rename_column:
107282 sqlite3SrcListDelete(db, pSrc);
107283 sqlite3DbFree(db, zOld);
107284 sqlite3DbFree(db, zNew);
@@ -107445,27 +107526,37 @@
107526 }
107527 }
107528
107529 /*
107530 ** Search the Parse object passed as the first argument for a RenameToken
107531 ** object associated with parse tree element pPtr. If found, return a pointer
107532 ** to it. Otherwise, return NULL.
107533 **
107534 ** If the second argument passed to this function is not NULL and a matching
107535 ** RenameToken object is found, remove it from the Parse object and add it to
107536 ** the list maintained by the RenameCtx object.
107537 */
107538 static RenameToken *renameTokenFind(
107539 Parse *pParse,
107540 struct RenameCtx *pCtx,
107541 void *pPtr
107542 ){
107543 RenameToken **pp;
107544 assert( pPtr!=0 );
107545 for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){
107546 if( (*pp)->p==pPtr ){
107547 RenameToken *pToken = *pp;
107548 if( pCtx ){
107549 *pp = pToken->pNext;
107550 pToken->pNext = pCtx->pList;
107551 pCtx->pList = pToken;
107552 pCtx->nList++;
107553 }
107554 return pToken;
107555 }
107556 }
107557 return 0;
107558 }
107559
107560 /*
107561 ** This is a Walker select callback. It does nothing. It is only required
107562 ** because without a dummy callback, sqlite3WalkExpr() and similar do not
@@ -107532,21 +107623,21 @@
107623 ** sub-routine is currently stored in pParse->zErrMsg. This function
107624 ** adds context to the error message and then stores it in pCtx.
107625 */
107626 static void renameColumnParseError(
107627 sqlite3_context *pCtx,
107628 const char *zWhen,
107629 sqlite3_value *pType,
107630 sqlite3_value *pObject,
107631 Parse *pParse
107632 ){
107633 const char *zT = (const char*)sqlite3_value_text(pType);
107634 const char *zN = (const char*)sqlite3_value_text(pObject);
107635 char *zErr;
107636
107637 zErr = sqlite3_mprintf("error in %s %s%s%s: %s",
107638 zT, zN, (zWhen[0] ? " " : ""), zWhen,
107639 pParse->zErrMsg
107640 );
107641 sqlite3_result_error(pCtx, zErr, -1);
107642 sqlite3_free(zErr);
107643 }
@@ -107621,11 +107712,11 @@
107712 ** trigger object, the database must be corrupt. */
107713 memset(p, 0, sizeof(Parse));
107714 p->eParseMode = PARSE_MODE_RENAME;
107715 p->db = db;
107716 p->nQueryLoop = 1;
107717 rc = zSql ? sqlite3RunParser(p, zSql, &zErr) : SQLITE_NOMEM;
107718 assert( p->zErrMsg==0 );
107719 assert( rc!=SQLITE_OK || zErr==0 );
107720 p->zErrMsg = zErr;
107721 if( db->mallocFailed ) rc = SQLITE_NOMEM;
107722 if( rc==SQLITE_OK
@@ -107774,11 +107865,11 @@
107865 if( rc==SQLITE_OK && pStep->zTarget ){
107866 SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
107867 if( pSrc ){
107868 int i;
107869 for(i=0; i<pSrc->nSrc && rc==SQLITE_OK; i++){
107870 SrcItem *p = &pSrc->a[i];
107871 p->iCursor = pParse->nTab++;
107872 if( p->pSelect ){
107873 sqlite3SelectPrep(pParse, p->pSelect, 0);
107874 sqlite3ExpandSubquery(pParse, p);
107875 assert( i>0 );
@@ -108048,11 +108139,11 @@
108139 rc = renameEditSql(context, &sCtx, zSql, zNew, bQuote);
108140
108141 renameColumnFunc_done:
108142 if( rc!=SQLITE_OK ){
108143 if( sParse.zErrMsg ){
108144 renameColumnParseError(context, "", argv[1], argv[2], &sParse);
108145 }else{
108146 sqlite3_result_error_code(context, rc);
108147 }
108148 }
108149
@@ -108086,11 +108177,11 @@
108177 if( pSrc==0 ){
108178 assert( pWalker->pParse->db->mallocFailed );
108179 return WRC_Abort;
108180 }
108181 for(i=0; i<pSrc->nSrc; i++){
108182 SrcItem *pItem = &pSrc->a[i];
108183 if( pItem->pTab==p->pTab ){
108184 renameTokenFind(pWalker->pParse, p, pItem->zName);
108185 }
108186 }
108187 renameWalkWith(pWalker, pSelect);
@@ -108237,11 +108328,11 @@
108328 if( rc==SQLITE_OK ){
108329 rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote);
108330 }
108331 if( rc!=SQLITE_OK ){
108332 if( sParse.zErrMsg ){
108333 renameColumnParseError(context, "", argv[1], argv[2], &sParse);
108334 }else{
108335 sqlite3_result_error_code(context, rc);
108336 }
108337 }
108338
@@ -108266,10 +108357,11 @@
108357 ** 0: Database name ("main", "temp" etc.).
108358 ** 1: SQL statement.
108359 ** 2: Object type ("view", "table", "trigger" or "index").
108360 ** 3: Object name.
108361 ** 4: True if object is from temp schema.
108362 ** 5: "when" part of error message.
108363 **
108364 ** Unless it finds an error, this function normally returns NULL. However, it
108365 ** returns integer value 1 if:
108366 **
108367 ** * the SQL argument creates a trigger, and
@@ -108283,10 +108375,11 @@
108375 sqlite3 *db = sqlite3_context_db_handle(context);
108376 char const *zDb = (const char*)sqlite3_value_text(argv[0]);
108377 char const *zInput = (const char*)sqlite3_value_text(argv[1]);
108378 int bTemp = sqlite3_value_int(argv[4]);
108379 int isLegacy = (db->flags & SQLITE_LegacyAlter);
108380 char const *zWhen = (const char*)sqlite3_value_text(argv[5]);
108381
108382 #ifndef SQLITE_OMIT_AUTHORIZATION
108383 sqlite3_xauth xAuth = db->xAuth;
108384 db->xAuth = 0;
108385 #endif
@@ -108315,29 +108408,220 @@
108408 if( i1==i2 ) sqlite3_result_int(context, 1);
108409 }
108410 }
108411 }
108412
108413 if( rc!=SQLITE_OK && zWhen ){
108414 renameColumnParseError(context, zWhen, argv[2], argv[3],&sParse);
108415 }
108416 renameParseCleanup(&sParse);
108417 }
108418
108419 #ifndef SQLITE_OMIT_AUTHORIZATION
108420 db->xAuth = xAuth;
108421 #endif
108422 }
108423
108424 /*
108425 ** The implementation of internal UDF sqlite_drop_column().
108426 **
108427 ** Arguments:
108428 **
108429 ** argv[0]: An integer - the index of the schema containing the table
108430 ** argv[1]: CREATE TABLE statement to modify.
108431 ** argv[2]: An integer - the index of the column to remove.
108432 **
108433 ** The value returned is a string containing the CREATE TABLE statement
108434 ** with column argv[2] removed.
108435 */
108436 static void dropColumnFunc(
108437 sqlite3_context *context,
108438 int NotUsed,
108439 sqlite3_value **argv
108440 ){
108441 sqlite3 *db = sqlite3_context_db_handle(context);
108442 int iSchema = sqlite3_value_int(argv[0]);
108443 const char *zSql = (const char*)sqlite3_value_text(argv[1]);
108444 int iCol = sqlite3_value_int(argv[2]);
108445 const char *zDb = db->aDb[iSchema].zDbSName;
108446 int rc;
108447 Parse sParse;
108448 RenameToken *pCol;
108449 Table *pTab;
108450 const char *zEnd;
108451 char *zNew = 0;
108452
108453 #ifndef SQLITE_OMIT_AUTHORIZATION
108454 sqlite3_xauth xAuth = db->xAuth;
108455 db->xAuth = 0;
108456 #endif
108457
108458 rc = renameParseSql(&sParse, zDb, db, zSql, iSchema==1);
108459 if( rc!=SQLITE_OK ) goto drop_column_done;
108460 pTab = sParse.pNewTable;
108461 if( pTab->nCol==1 || iCol>=pTab->nCol ){
108462 /* This can happen if the sqlite_schema table is corrupt */
108463 rc = SQLITE_CORRUPT_BKPT;
108464 goto drop_column_done;
108465 }
108466
108467 pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol].zName);
108468 if( iCol<pTab->nCol-1 ){
108469 RenameToken *pEnd;
108470 pEnd = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol+1].zName);
108471 zEnd = (const char*)pEnd->t.z;
108472 }else{
108473 zEnd = (const char*)&zSql[pTab->addColOffset];
108474 while( ALWAYS(pCol->t.z[0]!=0) && pCol->t.z[0]!=',' ) pCol->t.z--;
108475 }
108476
108477 zNew = sqlite3MPrintf(db, "%.*s%s", pCol->t.z-zSql, zSql, zEnd);
108478 sqlite3_result_text(context, zNew, -1, SQLITE_TRANSIENT);
108479 sqlite3_free(zNew);
108480
108481 drop_column_done:
108482 renameParseCleanup(&sParse);
108483 #ifndef SQLITE_OMIT_AUTHORIZATION
108484 db->xAuth = xAuth;
108485 #endif
108486 if( rc!=SQLITE_OK ){
108487 sqlite3_result_error_code(context, rc);
108488 }
108489 }
108490
108491 /*
108492 ** This function is called by the parser upon parsing an
108493 **
108494 ** ALTER TABLE pSrc DROP COLUMN pName
108495 **
108496 ** statement. Argument pSrc contains the possibly qualified name of the
108497 ** table being edited, and token pName the name of the column to drop.
108498 */
108499 SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token *pName){
108500 sqlite3 *db = pParse->db; /* Database handle */
108501 Table *pTab; /* Table to modify */
108502 int iDb; /* Index of db containing pTab in aDb[] */
108503 const char *zDb; /* Database containing pTab ("main" etc.) */
108504 char *zCol = 0; /* Name of column to drop */
108505 int iCol; /* Index of column zCol in pTab->aCol[] */
108506
108507 /* Look up the table being altered. */
108508 assert( pParse->pNewTable==0 );
108509 assert( sqlite3BtreeHoldsAllMutexes(db) );
108510 if( NEVER(db->mallocFailed) ) goto exit_drop_column;
108511 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
108512 if( !pTab ) goto exit_drop_column;
108513
108514 /* Make sure this is not an attempt to ALTER a view, virtual table or
108515 ** system table. */
108516 if( SQLITE_OK!=isAlterableTable(pParse, pTab) ) goto exit_drop_column;
108517 if( SQLITE_OK!=isRealTable(pParse, pTab, 1) ) goto exit_drop_column;
108518
108519 /* Find the index of the column being dropped. */
108520 zCol = sqlite3NameFromToken(db, pName);
108521 if( zCol==0 ){
108522 assert( db->mallocFailed );
108523 goto exit_drop_column;
108524 }
108525 iCol = sqlite3ColumnIndex(pTab, zCol);
108526 if( iCol<0 ){
108527 sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zCol);
108528 goto exit_drop_column;
108529 }
108530
108531 /* Do not allow the user to drop a PRIMARY KEY column or a column
108532 ** constrained by a UNIQUE constraint. */
108533 if( pTab->aCol[iCol].colFlags & (COLFLAG_PRIMKEY|COLFLAG_UNIQUE) ){
108534 sqlite3ErrorMsg(pParse, "cannot drop %s column: \"%s\"",
108535 (pTab->aCol[iCol].colFlags&COLFLAG_PRIMKEY) ? "PRIMARY KEY" : "UNIQUE",
108536 zCol
108537 );
108538 goto exit_drop_column;
108539 }
108540
108541 /* Do not allow the number of columns to go to zero */
108542 if( pTab->nCol<=1 ){
108543 sqlite3ErrorMsg(pParse, "cannot drop column \"%s\": no other columns exist",zCol);
108544 goto exit_drop_column;
108545 }
108546
108547 /* Edit the sqlite_schema table */
108548 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
108549 assert( iDb>=0 );
108550 zDb = db->aDb[iDb].zDbSName;
108551 renameTestSchema(pParse, zDb, iDb==1, "");
108552 sqlite3NestedParse(pParse,
108553 "UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
108554 "sql = sqlite_drop_column(%d, sql, %d) "
108555 "WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)"
108556 , zDb, iDb, iCol, pTab->zName
108557 );
108558
108559 /* Drop and reload the database schema. */
108560 renameReloadSchema(pParse, iDb, INITFLAG_AlterDrop);
108561 renameTestSchema(pParse, zDb, iDb==1, "after drop column");
108562
108563 /* Edit rows of table on disk */
108564 if( pParse->nErr==0 && (pTab->aCol[iCol].colFlags & COLFLAG_VIRTUAL)==0 ){
108565 int i;
108566 int addr;
108567 int reg;
108568 int regRec;
108569 Index *pPk = 0;
108570 int nField = 0; /* Number of non-virtual columns after drop */
108571 int iCur;
108572 Vdbe *v = sqlite3GetVdbe(pParse);
108573 iCur = pParse->nTab++;
108574 sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenWrite);
108575 addr = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v);
108576 reg = ++pParse->nMem;
108577 pParse->nMem += pTab->nCol;
108578 if( HasRowid(pTab) ){
108579 sqlite3VdbeAddOp2(v, OP_Rowid, iCur, reg);
108580 }else{
108581 pPk = sqlite3PrimaryKeyIndex(pTab);
108582 }
108583 for(i=0; i<pTab->nCol; i++){
108584 if( i!=iCol && (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 ){
108585 int regOut;
108586 if( pPk ){
108587 int iPos = sqlite3TableColumnToIndex(pPk, i);
108588 int iColPos = sqlite3TableColumnToIndex(pPk, iCol);
108589 regOut = reg+1+iPos-(iPos>iColPos);
108590 }else{
108591 regOut = reg+1+nField;
108592 }
108593 sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, i, regOut);
108594 nField++;
108595 }
108596 }
108597 regRec = reg + pTab->nCol;
108598 sqlite3VdbeAddOp3(v, OP_MakeRecord, reg+1, nField, regRec);
108599 if( pPk ){
108600 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iCur, regRec, reg+1, pPk->nKeyCol);
108601 }else{
108602 sqlite3VdbeAddOp3(v, OP_Insert, iCur, regRec, reg);
108603 }
108604
108605 sqlite3VdbeAddOp2(v, OP_Next, iCur, addr+1); VdbeCoverage(v);
108606 sqlite3VdbeJumpHere(v, addr);
108607 }
108608
108609 exit_drop_column:
108610 sqlite3DbFree(db, zCol);
108611 sqlite3SrcListDelete(db, pSrc);
108612 }
108613
108614 /*
108615 ** Register built-in functions used to help implement ALTER TABLE
108616 */
108617 SQLITE_PRIVATE void sqlite3AlterFunctions(void){
108618 static FuncDef aAlterTableFuncs[] = {
108619 INTERNAL_FUNCTION(sqlite_rename_column, 9, renameColumnFunc),
108620 INTERNAL_FUNCTION(sqlite_rename_table, 7, renameTableFunc),
108621 INTERNAL_FUNCTION(sqlite_rename_test, 6, renameTableTest),
108622 INTERNAL_FUNCTION(sqlite_drop_column, 3, dropColumnFunc),
108623 };
108624 sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs));
108625 }
108626 #endif /* SQLITE_ALTER_TABLE */
108627
@@ -110745,11 +111029,11 @@
111029 ** Select callback used by sqlite3FixAAAA() routines.
111030 */
111031 static int fixSelectCb(Walker *p, Select *pSelect){
111032 DbFixer *pFix = p->u.pFix;
111033 int i;
111034 SrcItem *pItem;
111035 sqlite3 *db = pFix->pParse->db;
111036 int iDb = sqlite3FindDbName(db, pFix->zDb);
111037 SrcList *pList = pSelect->pSrc;
111038
111039 if( NEVER(pList==0) ) return WRC_Continue;
@@ -111318,16 +111602,18 @@
111602 int i;
111603 int reg;
111604
111605 addrRewind =
111606 sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
111607 VdbeCoverage(v);
111608 reg = pReturning->iRetReg;
111609 for(i=0; i<pReturning->nRetCol; i++){
111610 sqlite3VdbeAddOp3(v, OP_Column, pReturning->iRetCur, i, reg+i);
111611 }
111612 sqlite3VdbeAddOp2(v, OP_ResultRow, reg, i);
111613 sqlite3VdbeAddOp2(v, OP_Next, pReturning->iRetCur, addrRewind+1);
111614 VdbeCoverage(v);
111615 sqlite3VdbeJumpHere(v, addrRewind);
111616 }
111617 sqlite3VdbeAddOp0(v, OP_Halt);
111618
111619 #if SQLITE_USER_AUTHENTICATION
@@ -111631,11 +111917,11 @@
111917 ** sqlite3FixSrcList() for details.
111918 */
111919 SQLITE_PRIVATE Table *sqlite3LocateTableItem(
111920 Parse *pParse,
111921 u32 flags,
111922 SrcItem *p
111923 ){
111924 const char *zDb;
111925 assert( p->pSchema==0 || p->zDatabase==0 );
111926 if( p->pSchema ){
111927 int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema);
@@ -112417,10 +112703,11 @@
112703 */
112704 #if SQLITE_ENABLE_HIDDEN_COLUMNS
112705 SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){
112706 if( sqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){
112707 pCol->colFlags |= COLFLAG_HIDDEN;
112708 if( pTab ) pTab->tabFlags |= TF_HasHidden;
112709 }else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){
112710 pTab->tabFlags |= TF_OOOHidden;
112711 }
112712 }
112713 #endif
@@ -112461,11 +112748,15 @@
112748 */
112749 SQLITE_PRIVATE void sqlite3AddReturning(Parse *pParse, ExprList *pList){
112750 Returning *pRet;
112751 Hash *pHash;
112752 sqlite3 *db = pParse->db;
112753 if( pParse->pNewTrigger ){
112754 sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
112755 }else{
112756 assert( pParse->bReturning==0 );
112757 }
112758 pParse->bReturning = 1;
112759 pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
112760 if( pRet==0 ){
112761 sqlite3ExprListDelete(db, pList);
112762 return;
@@ -112484,11 +112775,11 @@
112775 pRet->retTrig.step_list = &pRet->retTStep;
112776 pRet->retTStep.op = TK_RETURNING;
112777 pRet->retTStep.pTrig = &pRet->retTrig;
112778 pRet->retTStep.pExprList = pList;
112779 pHash = &(db->aDb[1].pSchema->trigHash);
112780 assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 || pParse->nErr );
112781 if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
112782 ==&pRet->retTrig ){
112783 sqlite3OomFault(db);
112784 }
112785 }
@@ -113789,11 +114080,11 @@
114080 }
114081 #endif
114082
114083 /* Reparse everything to update our internal data structures */
114084 sqlite3VdbeAddParseSchemaOp(v, iDb,
114085 sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName),0);
114086 }
114087
114088 /* Add the table to the in-memory representation of the database.
114089 */
114090 if( db->init.busy ){
@@ -113806,24 +114097,21 @@
114097 sqlite3OomFault(db);
114098 return;
114099 }
114100 pParse->pNewTable = 0;
114101 db->mDbFlags |= DBFLAG_SchemaChange;
114102 }
114103
114104 #ifndef SQLITE_OMIT_ALTERTABLE
114105 if( !pSelect && !p->pSelect ){
114106 assert( pCons && pEnd );
114107 if( pCons->z==0 ){
114108 pCons = pEnd;
114109 }
114110 p->addColOffset = 13 + (int)(pCons->z - pParse->sNameToken.z);
114111 }
114112 #endif
 
 
 
 
114113 }
114114
114115 #ifndef SQLITE_OMIT_VIEW
114116 /*
114117 ** The parser calls this routine in order to create a new VIEW
@@ -115277,11 +115565,11 @@
115565 */
115566 if( pTblName ){
115567 sqlite3RefillIndex(pParse, pIndex, iMem);
115568 sqlite3ChangeCookie(pParse, iDb);
115569 sqlite3VdbeAddParseSchemaOp(v, iDb,
115570 sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName), 0);
115571 sqlite3VdbeAddOp2(v, OP_Expire, 0, 1);
115572 }
115573
115574 sqlite3VdbeJumpHere(v, (int)pIndex->tnum);
115575 }
@@ -115670,11 +115958,11 @@
115958 Parse *pParse, /* Parsing context, in which errors are reported */
115959 SrcList *pList, /* Append to this SrcList. NULL creates a new SrcList */
115960 Token *pTable, /* Table to append */
115961 Token *pDatabase /* Database of the table */
115962 ){
115963 SrcItem *pItem;
115964 sqlite3 *db;
115965 assert( pDatabase==0 || pTable!=0 ); /* Cannot have C without B */
115966 assert( pParse!=0 );
115967 assert( pParse->db!=0 );
115968 db = pParse->db;
@@ -115711,11 +115999,11 @@
115999 /*
116000 ** Assign VdbeCursor index numbers to all tables in a SrcList
116001 */
116002 SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){
116003 int i;
116004 SrcItem *pItem;
116005 assert(pList || pParse->db->mallocFailed );
116006 if( pList ){
116007 for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){
116008 if( pItem->iCursor>=0 ) continue;
116009 pItem->iCursor = pParse->nTab++;
@@ -115729,11 +116017,11 @@
116017 /*
116018 ** Delete an entire SrcList including all its substructure.
116019 */
116020 SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){
116021 int i;
116022 SrcItem *pItem;
116023 if( pList==0 ) return;
116024 for(pItem=pList->a, i=0; i<pList->nSrc; i++, pItem++){
116025 if( pItem->zDatabase ) sqlite3DbFreeNN(db, pItem->zDatabase);
116026 sqlite3DbFree(db, pItem->zName);
116027 if( pItem->zAlias ) sqlite3DbFreeNN(db, pItem->zAlias);
@@ -115771,11 +116059,11 @@
116059 Token *pAlias, /* The right-hand side of the AS subexpression */
116060 Select *pSubquery, /* A subquery used in place of a table name */
116061 Expr *pOn, /* The ON clause of a join */
116062 IdList *pUsing /* The USING clause of a join */
116063 ){
116064 SrcItem *pItem;
116065 sqlite3 *db = pParse->db;
116066 if( !p && (pOn || pUsing) ){
116067 sqlite3ErrorMsg(pParse, "a JOIN clause is required before %s",
116068 (pOn ? "ON" : "USING")
116069 );
@@ -115815,11 +116103,11 @@
116103 ** element of the source-list passed as the second argument.
116104 */
116105 SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pIndexedBy){
116106 assert( pIndexedBy!=0 );
116107 if( p && pIndexedBy->n>0 ){
116108 SrcItem *pItem;
116109 assert( p->nSrc>0 );
116110 pItem = &p->a[p->nSrc-1];
116111 assert( pItem->fg.notIndexed==0 );
116112 assert( pItem->fg.isIndexedBy==0 );
116113 assert( pItem->fg.isTabFunc==0 );
@@ -115845,11 +116133,11 @@
116133 SrcList *pNew = sqlite3SrcListEnlarge(pParse, p1, p2->nSrc, 1);
116134 if( pNew==0 ){
116135 sqlite3SrcListDelete(pParse->db, p2);
116136 }else{
116137 p1 = pNew;
116138 memcpy(&p1->a[1], p2->a, p2->nSrc*sizeof(SrcItem));
116139 sqlite3DbFree(pParse->db, p2);
116140 }
116141 }
116142 return p1;
116143 }
@@ -115858,11 +116146,11 @@
116146 ** Add the list of function arguments to the SrcList entry for a
116147 ** table-valued-function.
116148 */
116149 SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, ExprList *pList){
116150 if( p ){
116151 SrcItem *pItem = &p->a[p->nSrc-1];
116152 assert( pItem->fg.notIndexed==0 );
116153 assert( pItem->fg.isIndexedBy==0 );
116154 assert( pItem->fg.isTabFunc==0 );
116155 pItem->u1.pFuncArg = pList;
116156 pItem->fg.isTabFunc = 1;
@@ -116355,28 +116643,80 @@
116643 }
116644 return pKey;
116645 }
116646
116647 #ifndef SQLITE_OMIT_CTE
116648 /*
116649 ** Create a new CTE object
116650 */
116651 SQLITE_PRIVATE Cte *sqlite3CteNew(
116652 Parse *pParse, /* Parsing context */
116653 Token *pName, /* Name of the common-table */
116654 ExprList *pArglist, /* Optional column name list for the table */
116655 Select *pQuery, /* Query used to initialize the table */
116656 u8 eM10d /* The MATERIALIZED flag */
116657 ){
116658 Cte *pNew;
116659 sqlite3 *db = pParse->db;
116660
116661 pNew = sqlite3DbMallocZero(db, sizeof(*pNew));
116662 assert( pNew!=0 || db->mallocFailed );
116663
116664 if( db->mallocFailed ){
116665 sqlite3ExprListDelete(db, pArglist);
116666 sqlite3SelectDelete(db, pQuery);
116667 }else{
116668 pNew->pSelect = pQuery;
116669 pNew->pCols = pArglist;
116670 pNew->zName = sqlite3NameFromToken(pParse->db, pName);
116671 pNew->eM10d = eM10d;
116672 }
116673 return pNew;
116674 }
116675
116676 /*
116677 ** Clear information from a Cte object, but do not deallocate storage
116678 ** for the object itself.
116679 */
116680 static void cteClear(sqlite3 *db, Cte *pCte){
116681 assert( pCte!=0 );
116682 sqlite3ExprListDelete(db, pCte->pCols);
116683 sqlite3SelectDelete(db, pCte->pSelect);
116684 sqlite3DbFree(db, pCte->zName);
116685 }
116686
116687 /*
116688 ** Free the contents of the CTE object passed as the second argument.
116689 */
116690 SQLITE_PRIVATE void sqlite3CteDelete(sqlite3 *db, Cte *pCte){
116691 assert( pCte!=0 );
116692 cteClear(db, pCte);
116693 sqlite3DbFree(db, pCte);
116694 }
116695
116696 /*
116697 ** This routine is invoked once per CTE by the parser while parsing a
116698 ** WITH clause. The CTE described by teh third argument is added to
116699 ** the WITH clause of the second argument. If the second argument is
116700 ** NULL, then a new WITH argument is created.
116701 */
116702 SQLITE_PRIVATE With *sqlite3WithAdd(
116703 Parse *pParse, /* Parsing context */
116704 With *pWith, /* Existing WITH clause, or NULL */
116705 Cte *pCte /* CTE to add to the WITH clause */
 
 
116706 ){
116707 sqlite3 *db = pParse->db;
116708 With *pNew;
116709 char *zName;
116710
116711 if( pCte==0 ){
116712 return pWith;
116713 }
116714
116715 /* Check that the CTE name is unique within this WITH clause. If
116716 ** not, store an error in the Parse structure. */
116717 zName = pCte->zName;
116718 if( zName && pWith ){
116719 int i;
116720 for(i=0; i<pWith->nCte; i++){
116721 if( sqlite3StrICmp(zName, pWith->a[i].zName)==0 ){
116722 sqlite3ErrorMsg(pParse, "duplicate WITH table name: %s", zName);
@@ -116391,20 +116731,15 @@
116731 pNew = sqlite3DbMallocZero(db, sizeof(*pWith));
116732 }
116733 assert( (pNew!=0 && zName!=0) || db->mallocFailed );
116734
116735 if( db->mallocFailed ){
116736 sqlite3CteDelete(db, pCte);
 
 
116737 pNew = pWith;
116738 }else{
116739 pNew->a[pNew->nCte++] = *pCte;
116740 sqlite3DbFree(db, pCte);
 
 
 
116741 }
116742
116743 return pNew;
116744 }
116745
@@ -116413,14 +116748,11 @@
116748 */
116749 SQLITE_PRIVATE void sqlite3WithDelete(sqlite3 *db, With *pWith){
116750 if( pWith ){
116751 int i;
116752 for(i=0; i<pWith->nCte; i++){
116753 cteClear(db, &pWith->a[i]);
 
 
 
116754 }
116755 sqlite3DbFree(db, pWith);
116756 }
116757 }
116758 #endif /* !defined(SQLITE_OMIT_CTE) */
@@ -116995,21 +117327,21 @@
117327 ** pSrc->a[0].pTab Pointer to the Table object
117328 ** pSrc->a[0].pIndex Pointer to the INDEXED BY index, if there is one
117329 **
117330 */
117331 SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
117332 SrcItem *pItem = pSrc->a;
117333 Table *pTab;
117334 assert( pItem && pSrc->nSrc>=1 );
117335 pTab = sqlite3LocateTableItem(pParse, 0, pItem);
117336 sqlite3DeleteTable(pParse->db, pItem->pTab);
117337 pItem->pTab = pTab;
117338 if( pTab ){
117339 pTab->nTabRef++;
117340 if( pItem->fg.isIndexedBy && sqlite3IndexedByLookup(pParse, pItem) ){
117341 pTab = 0;
117342 }
117343 }
117344 return pTab;
117345 }
117346
117347 /* Return true if table pTab is read-only.
@@ -117175,11 +117507,15 @@
117507 /* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree
117508 ** and the SELECT subtree. */
117509 pSrc->a[0].pTab = 0;
117510 pSelectSrc = sqlite3SrcListDup(pParse->db, pSrc, 0);
117511 pSrc->a[0].pTab = pTab;
117512 if( pSrc->a[0].fg.isIndexedBy ){
117513 pSrc->a[0].u2.pIBIndex = 0;
117514 }else if( pSrc->a[0].fg.isCte ){
117515 pSrc->a[0].u2.pCteUse->nUse++;
117516 }
117517
117518 /* generate the SELECT expression tree. */
117519 pSelect = sqlite3SelectNew(pParse, pEList, pSelectSrc, pWhere, 0 ,0,
117520 pOrderBy,0,pLimit
117521 );
@@ -118623,11 +118959,12 @@
118959 while( (c = Utf8Read(zPattern))!=0 ){
118960 if( c==matchAll ){ /* Match "*" */
118961 /* Skip over multiple "*" characters in the pattern. If there
118962 ** are also "?" characters, skip those as well, but consume a
118963 ** single character of the input string for each "?" skipped */
118964 while( (c=Utf8Read(zPattern)) == matchAll
118965 || (c == matchOne && matchOne!=0) ){
118966 if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
118967 return SQLITE_NOWILDCARDMATCH;
118968 }
118969 }
118970 if( c==0 ){
@@ -121242,11 +121579,11 @@
121579
121580 /* Create a SrcList structure containing the child table. We need the
121581 ** child table as a SrcList for sqlite3WhereBegin() */
121582 pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
121583 if( pSrc ){
121584 SrcItem *pItem = pSrc->a;
121585 pItem->pTab = pFKey->pFrom;
121586 pItem->zName = pFKey->pFrom->zName;
121587 pItem->pTab->nTabRef++;
121588 pItem->iCursor = pParse->nTab++;
121589
@@ -122603,23 +122940,28 @@
122940 ipkColumn--;
122941 }
122942 }
122943 }
122944 #endif
122945
122946 /* Make sure the number of columns in the source data matches the number
122947 ** of columns to be inserted into the table.
122948 */
122949 assert( TF_HasHidden==COLFLAG_HIDDEN );
122950 assert( TF_HasGenerated==COLFLAG_GENERATED );
122951 assert( COLFLAG_NOINSERT==(COLFLAG_GENERATED|COLFLAG_HIDDEN) );
122952 if( (pTab->tabFlags & (TF_HasGenerated|TF_HasHidden))!=0 ){
122953 for(i=0; i<pTab->nCol; i++){
122954 if( pTab->aCol[i].colFlags & COLFLAG_NOINSERT ) nHidden++;
122955 }
122956 }
122957 if( nColumn!=(pTab->nCol-nHidden) ){
122958 sqlite3ErrorMsg(pParse,
122959 "table %S has %d columns but %d values were supplied",
122960 pTabList, 0, pTab->nCol-nHidden, nColumn);
122961 goto insert_cleanup;
122962 }
122963 }
122964 if( pColumn!=0 && nColumn!=pColumn->nId ){
122965 sqlite3ErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId);
122966 goto insert_cleanup;
122967 }
@@ -124078,10 +124420,36 @@
124420 }
124421 sqlite3VdbeChangeP5(v, i+1);
124422 }
124423 #endif
124424
124425 /*
124426 ** Table pTab is a WITHOUT ROWID table that is being written to. The cursor
124427 ** number is iCur, and register regData contains the new record for the
124428 ** PK index. This function adds code to invoke the pre-update hook,
124429 ** if one is registered.
124430 */
124431 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
124432 static void codeWithoutRowidPreupdate(
124433 Parse *pParse, /* Parse context */
124434 Table *pTab, /* Table being updated */
124435 int iCur, /* Cursor number for table */
124436 int regData /* Data containing new record */
124437 ){
124438 Vdbe *v = pParse->pVdbe;
124439 int r = sqlite3GetTempReg(pParse);
124440 assert( !HasRowid(pTab) );
124441 assert( 0==(pParse->db->mDbFlags & DBFLAG_Vacuum) );
124442 sqlite3VdbeAddOp2(v, OP_Integer, 0, r);
124443 sqlite3VdbeAddOp4(v, OP_Insert, iCur, regData, r, (char*)pTab, P4_TABLE);
124444 sqlite3VdbeChangeP5(v, OPFLAG_ISNOOP);
124445 sqlite3ReleaseTempReg(pParse, r);
124446 }
124447 #else
124448 # define codeWithoutRowidPreupdate(a,b,c,d)
124449 #endif
124450
124451 /*
124452 ** This routine generates code to finish the INSERT or UPDATE operation
124453 ** that was started by a prior call to sqlite3GenerateConstraintChecks.
124454 ** A consecutive range of registers starting at regNewData contains the
124455 ** rowid and the content to be inserted.
@@ -124126,21 +124494,13 @@
124494 pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
124495 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
124496 assert( pParse->nested==0 );
124497 pik_flags |= OPFLAG_NCHANGE;
124498 pik_flags |= (update_flags & OPFLAG_SAVEPOSITION);
 
124499 if( update_flags==0 ){
124500 codeWithoutRowidPreupdate(pParse, pTab, iIdxCur+i, aRegIdx[i]);
124501 }
 
 
 
 
 
 
 
124502 }
124503 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
124504 aRegIdx[i]+1,
124505 pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn);
124506 sqlite3VdbeChangeP5(v, pik_flags);
@@ -124334,11 +124694,11 @@
124694 ){
124695 sqlite3 *db = pParse->db;
124696 ExprList *pEList; /* The result set of the SELECT */
124697 Table *pSrc; /* The table in the FROM clause of SELECT */
124698 Index *pSrcIdx, *pDestIdx; /* Source and destination indices */
124699 SrcItem *pItem; /* An element of pSelect->pSrc */
124700 int i; /* Loop counter */
124701 int iDbSrc; /* The database of pSrc */
124702 int iSrc, iDest; /* Cursors from source and destination */
124703 int addr1, addr2; /* Loop addresses */
124704 int emptyDestTest = 0; /* Address of test for empty pDest */
@@ -124609,20 +124969,22 @@
124969 insFlags = OPFLAG_APPEND|OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT;
124970 }else{
124971 insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND|OPFLAG_PREFORMAT;
124972 }
124973 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
124974 if( (db->mDbFlags & DBFLAG_Vacuum)==0 ){
124975 sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
124976 insFlags &= ~OPFLAG_PREFORMAT;
124977 }else
124978 #endif
124979 {
124980 sqlite3VdbeAddOp3(v, OP_RowCell, iDest, iSrc, regRowid);
124981 }
124982 sqlite3VdbeAddOp3(v, OP_Insert, iDest, regData, regRowid);
124983 if( (db->mDbFlags & DBFLAG_Vacuum)==0 ){
124984 sqlite3VdbeChangeP4(v, -1, (char*)pDest, P4_TABLE);
124985 }
124986 sqlite3VdbeChangeP5(v, insFlags);
124987
124988 sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v);
124989 sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
124990 sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
@@ -124671,10 +125033,16 @@
125033 }else if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
125034 idxInsFlags |= OPFLAG_NCHANGE;
125035 }
125036 if( idxInsFlags!=(OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT) ){
125037 sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
125038 if( (db->mDbFlags & DBFLAG_Vacuum)==0
125039 && !HasRowid(pDest)
125040 && IsPrimaryKeyIndex(pDestIdx)
125041 ){
125042 codeWithoutRowidPreupdate(pParse, pDest, iDest, regData);
125043 }
125044 }
125045 sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
125046 sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
125047 sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
125048 sqlite3VdbeJumpHere(v, addr1);
@@ -129635,26 +130003,30 @@
130003 ** Fill the InitData structure with an error message that indicates
130004 ** that the database is corrupt.
130005 */
130006 static void corruptSchema(
130007 InitData *pData, /* Initialization context */
130008 char **azObj, /* Type and name of object being parsed */
130009 const char *zExtra /* Error information */
130010 ){
130011 sqlite3 *db = pData->db;
130012 if( db->mallocFailed ){
130013 pData->rc = SQLITE_NOMEM_BKPT;
130014 }else if( pData->pzErrMsg[0]!=0 ){
130015 /* A error message has already been generated. Do not overwrite it */
130016 }else if( pData->mInitFlags & (INITFLAG_AlterRename|INITFLAG_AlterDrop) ){
130017 *pData->pzErrMsg = sqlite3MPrintf(db,
130018 "error in %s %s after %s: %s", azObj[0], azObj[1],
130019 (pData->mInitFlags & INITFLAG_AlterRename) ? "rename" : "drop column",
130020 zExtra
130021 );
130022 pData->rc = SQLITE_ERROR;
130023 }else if( db->flags & SQLITE_WriteSchema ){
130024 pData->rc = SQLITE_CORRUPT_BKPT;
130025 }else{
130026 char *z;
130027 const char *zObj = azObj[1] ? azObj[1] : "?";
130028 z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
130029 if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
130030 *pData->pzErrMsg = z;
130031 pData->rc = SQLITE_CORRUPT_BKPT;
130032 }
@@ -129708,18 +130080,18 @@
130080 UNUSED_PARAMETER2(NotUsed, argc);
130081 assert( sqlite3_mutex_held(db->mutex) );
130082 db->mDbFlags |= DBFLAG_EncodingFixed;
130083 pData->nInitRow++;
130084 if( db->mallocFailed ){
130085 corruptSchema(pData, argv, 0);
130086 return 1;
130087 }
130088
130089 assert( iDb>=0 && iDb<db->nDb );
130090 if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
130091 if( argv[3]==0 ){
130092 corruptSchema(pData, argv, 0);
130093 }else if( argv[4]
130094 && 'c'==sqlite3UpperToLower[(unsigned char)argv[4][0]]
130095 && 'r'==sqlite3UpperToLower[(unsigned char)argv[4][1]] ){
130096 /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
130097 ** But because db->init.busy is set to 1, no VDBE code is generated
@@ -129740,11 +130112,11 @@
130112 db->init.iDb = iDb;
130113 if( sqlite3GetUInt32(argv[3], &db->init.newTnum)==0
130114 || (db->init.newTnum>pData->mxPage && pData->mxPage>0)
130115 ){
130116 if( sqlite3Config.bExtraSchemaChecks ){
130117 corruptSchema(pData, argv, "invalid rootpage");
130118 }
130119 }
130120 db->init.orphanTrigger = 0;
130121 db->init.azInit = argv;
130122 pStmt = 0;
@@ -129759,17 +130131,17 @@
130131 }else{
130132 if( rc > pData->rc ) pData->rc = rc;
130133 if( rc==SQLITE_NOMEM ){
130134 sqlite3OomFault(db);
130135 }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){
130136 corruptSchema(pData, argv, sqlite3_errmsg(db));
130137 }
130138 }
130139 }
130140 sqlite3_finalize(pStmt);
130141 }else if( argv[1]==0 || (argv[4]!=0 && argv[4][0]!=0) ){
130142 corruptSchema(pData, argv, 0);
130143 }else{
130144 /* If the SQL column is blank it means this is an index that
130145 ** was created to be the PRIMARY KEY or to fulfill a UNIQUE
130146 ** constraint for a CREATE TABLE. The index should have already
130147 ** been created when we processed the CREATE TABLE. All we have
@@ -129776,19 +130148,19 @@
130148 ** to do here is record the root page number for that index.
130149 */
130150 Index *pIndex;
130151 pIndex = sqlite3FindIndex(db, argv[1], db->aDb[iDb].zDbSName);
130152 if( pIndex==0 ){
130153 corruptSchema(pData, argv, "orphan index");
130154 }else
130155 if( sqlite3GetUInt32(argv[3],&pIndex->tnum)==0
130156 || pIndex->tnum<2
130157 || pIndex->tnum>pData->mxPage
130158 || sqlite3IndexHasDuplicateRootPage(pIndex)
130159 ){
130160 if( sqlite3Config.bExtraSchemaChecks ){
130161 corruptSchema(pData, argv, "invalid rootpage");
130162 }
130163 }
130164 }
130165 return 0;
130166 }
@@ -130164,35 +130536,20 @@
130536 assert( i>=0 && i<db->nDb );
130537 }
130538 return i;
130539 }
130540
 
 
 
 
 
 
 
 
 
130541 /*
130542 ** Free all memory allocations in the pParse object
130543 */
130544 SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
130545 sqlite3 *db = pParse->db;
 
 
 
 
 
 
130546 while( pParse->pCleanup ){
130547 ParseCleanup *pCleanup = pParse->pCleanup;
130548 pParse->pCleanup = pCleanup->pNext;
130549 pCleanup->xCleanup(db, pCleanup->pPtr);
130550 sqlite3DbFreeNN(db, pCleanup);
130551 }
130552 sqlite3DbFree(db, pParse->aLabel);
130553 if( pParse->pConstExpr ){
130554 sqlite3ExprListDelete(db, pParse->pConstExpr);
130555 }
@@ -130222,11 +130579,11 @@
130579 ** use-after-free errors following an OOM. The preferred way to do this is
130580 ** to immediately follow the call to this routine with:
130581 **
130582 ** testcase( pParse->earlyCleanup );
130583 */
130584 SQLITE_PRIVATE void *sqlite3ParserAddCleanup(
130585 Parse *pParse, /* Destroy when this Parser finishes */
130586 void (*xCleanup)(sqlite3*,void*), /* The cleanup routine */
130587 void *pPtr /* Pointer to object to be cleaned up */
130588 ){
130589 ParseCleanup *pCleanup = sqlite3DbMallocRaw(pParse->db, sizeof(*pCleanup));
@@ -130235,14 +130592,16 @@
130592 pParse->pCleanup = pCleanup;
130593 pCleanup->pPtr = pPtr;
130594 pCleanup->xCleanup = xCleanup;
130595 }else{
130596 xCleanup(pParse->db, pPtr);
130597 pPtr = 0;
130598 #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
130599 pParse->earlyCleanup = 1;
130600 #endif
130601 }
130602 return pPtr;
130603 }
130604
130605 /*
130606 ** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
130607 */
@@ -130893,11 +131252,11 @@
131252
131253 /*
131254 ** Return the index of a column in a table. Return -1 if the column
131255 ** is not contained in the table.
131256 */
131257 SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol){
131258 int i;
131259 u8 h = sqlite3StrIHash(zCol);
131260 Column *pCol;
131261 for(pCol=pTab->aCol, i=0; i<pTab->nCol; pCol++, i++){
131262 if( pCol->hName==h && sqlite3StrICmp(pCol->zName, zCol)==0 ) return i;
@@ -130925,11 +131284,11 @@
131284 int i; /* For looping over tables in pSrc */
131285 int iCol; /* Index of column matching zCol */
131286
131287 assert( (piTab==0)==(piCol==0) ); /* Both or neither are NULL */
131288 for(i=0; i<N; i++){
131289 iCol = sqlite3ColumnIndex(pSrc->a[i].pTab, zCol);
131290 if( iCol>=0
131291 && (bIgnoreHidden==0 || IsHiddenColumn(&pSrc->a[i].pTab->aCol[iCol])==0)
131292 ){
131293 if( piTab ){
131294 *piTab = i;
@@ -131066,12 +131425,12 @@
131425 ** This routine returns the number of errors encountered.
131426 */
131427 static int sqliteProcessJoin(Parse *pParse, Select *p){
131428 SrcList *pSrc; /* All tables in the FROM clause */
131429 int i, j; /* Loop counters */
131430 SrcItem *pLeft; /* Left table being joined */
131431 SrcItem *pRight; /* Right table being joined */
131432
131433 pSrc = p->pSrc;
131434 pLeft = &pSrc->a[0];
131435 pRight = &pLeft[1];
131436 for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){
@@ -131135,11 +131494,11 @@
131494 int iLeft; /* Table on the left with matching column name */
131495 int iLeftCol; /* Column number of matching column on the left */
131496 int iRightCol; /* Column number of matching column on the right */
131497
131498 zName = pList->a[j].zName;
131499 iRightCol = sqlite3ColumnIndex(pRightTab, zName);
131500 if( iRightCol<0
131501 || !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol, 0)
131502 ){
131503 sqlite3ErrorMsg(pParse, "cannot join using column %s - column "
131504 "not present in both tables", zName);
@@ -132717,10 +133076,11 @@
133076 sNC.pSrcList = pSelect->pSrc;
133077 a = pSelect->pEList->a;
133078 for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
133079 const char *zType;
133080 int n, m;
133081 pTab->tabFlags |= (pCol->colFlags & COLFLAG_NOINSERT);
133082 p = a[i].pExpr;
133083 zType = columnType(&sNC, p, 0, 0, 0);
133084 /* pCol->szEst = ... // Column size est for SELECT tables never used */
133085 pCol->affinity = sqlite3ExprAffinity(p);
133086 if( zType ){
@@ -134227,11 +134587,11 @@
134587 SubstContext *pSubst, /* Description of the substitution */
134588 Select *p, /* SELECT statement in which to make substitutions */
134589 int doPrior /* Do substitutes on p->pPrior too */
134590 ){
134591 SrcList *pSrc;
134592 SrcItem *pItem;
134593 int i;
134594 if( !p ) return;
134595 do{
134596 substExprList(pSubst, p->pEList);
134597 substExprList(pSubst, p->pGroupBy);
@@ -134257,21 +134617,21 @@
134617 **
134618 ** This routine scans the entire SELECT statement and recomputes the
134619 ** pSrcItem->colUsed mask.
134620 */
134621 static int recomputeColumnsUsedExpr(Walker *pWalker, Expr *pExpr){
134622 SrcItem *pItem;
134623 if( pExpr->op!=TK_COLUMN ) return WRC_Continue;
134624 pItem = pWalker->u.pSrcItem;
134625 if( pItem->iCursor!=pExpr->iTable ) return WRC_Continue;
134626 if( pExpr->iColumn<0 ) return WRC_Continue;
134627 pItem->colUsed |= sqlite3ExprColUsed(pExpr);
134628 return WRC_Continue;
134629 }
134630 static void recomputeColumnsUsed(
134631 Select *pSelect, /* The complete SELECT statement */
134632 SrcItem *pSrcItem /* Which FROM clause item to recompute */
134633 ){
134634 Walker w;
134635 if( NEVER(pSrcItem->pTab==0) ) return;
134636 memset(&w, 0, sizeof(w));
134637 w.xExprCallback = recomputeColumnsUsedExpr;
@@ -134301,11 +134661,11 @@
134661 int *aCsrMap, /* Array to store cursor mappings in */
134662 SrcList *pSrc, /* FROM clause to renumber */
134663 int iExcept /* FROM clause item to skip */
134664 ){
134665 int i;
134666 SrcItem *pItem;
134667 for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){
134668 if( i!=iExcept ){
134669 Select *p;
134670 pItem->iCursor = aCsrMap[pItem->iCursor] = pParse->nTab++;
134671 for(p=pItem->pSelect; p; p=p->pPrior){
@@ -134319,11 +134679,12 @@
134679 ** Expression walker callback used by renumberCursors() to update
134680 ** Expr objects to match newly assigned cursor numbers.
134681 */
134682 static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){
134683 int *aCsrMap = pWalker->u.aiCol;
134684 int op = pExpr->op;
134685 if( (op==TK_COLUMN || op==TK_IF_NULL_ROW) && aCsrMap[pExpr->iTable] ){
134686 pExpr->iTable = aCsrMap[pExpr->iTable];
134687 }
134688 if( ExprHasProperty(pExpr, EP_FromJoin) && aCsrMap[pExpr->iRightJoinTable] ){
134689 pExpr->iRightJoinTable = aCsrMap[pExpr->iRightJoinTable];
134690 }
@@ -134534,11 +134895,11 @@
134895 int iParent; /* VDBE cursor number of the pSub result set temp table */
134896 int iNewParent = -1;/* Replacement table for iParent */
134897 int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */
134898 int i; /* Loop counter */
134899 Expr *pWhere; /* The WHERE clause */
134900 SrcItem *pSubitem; /* The subquery */
134901 sqlite3 *db = pParse->db;
134902 Walker w; /* Walker to persist agginfo data */
134903 int *aCsrMap = 0;
134904
134905 /* Check to see if flattening is permitted. Return 0 if not.
@@ -135168,10 +135529,14 @@
135529 ** then the (1,1,NULL) row would be suppressed.
135530 **
135531 ** (6) The inner query features one or more window-functions (since
135532 ** changes to the WHERE clause of the inner query could change the
135533 ** window over which window functions are calculated).
135534 **
135535 ** (7) The inner query is a Common Table Expression (CTE) that should
135536 ** be materialized. (This restriction is implemented in the calling
135537 ** routine.)
135538 **
135539 ** Return 0 if no changes are made and non-zero if one or more WHERE clause
135540 ** terms are duplicated into the subquery.
135541 */
135542 static int pushDownWhereTerms(
@@ -135223,10 +135588,11 @@
135588 if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){
135589 return 0; /* restriction (5) */
135590 }
135591 if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
135592 nChng++;
135593 pSubq->selFlags |= SF_PushDown;
135594 while( pSubq ){
135595 SubstContext x;
135596 pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
135597 unsetJoinExpr(pNew, -1);
135598 x.pParse = pParse;
@@ -135338,28 +135704,30 @@
135704 ** INDEXED BY clause, then try to locate the specified index. If there
135705 ** was such a clause and the named index cannot be found, return
135706 ** SQLITE_ERROR and leave an error in pParse. Otherwise, populate
135707 ** pFrom->pIndex and return SQLITE_OK.
135708 */
135709 SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *pParse, SrcItem *pFrom){
135710 Table *pTab = pFrom->pTab;
135711 char *zIndexedBy = pFrom->u1.zIndexedBy;
135712 Index *pIdx;
135713 assert( pTab!=0 );
135714 assert( pFrom->fg.isIndexedBy!=0 );
135715
135716 for(pIdx=pTab->pIndex;
135717 pIdx && sqlite3StrICmp(pIdx->zName, zIndexedBy);
135718 pIdx=pIdx->pNext
135719 );
135720 if( !pIdx ){
135721 sqlite3ErrorMsg(pParse, "no such index: %s", zIndexedBy, 0);
135722 pParse->checkSchema = 1;
135723 return SQLITE_ERROR;
135724 }
135725 pFrom->u2.pIBIndex = pIdx;
135726 return SQLITE_OK;
135727 }
135728
135729 /*
135730 ** Detect compound SELECT statements that use an ORDER BY clause with
135731 ** an alternative collating sequence.
135732 **
135733 ** SELECT ... FROM t1 EXCEPT SELECT ... FROM t2 ORDER BY .. COLLATE ...
@@ -135442,11 +135810,11 @@
135810 /*
135811 ** Check to see if the FROM clause term pFrom has table-valued function
135812 ** arguments. If it does, leave an error message in pParse and return
135813 ** non-zero, since pFrom is not allowed to be a table-valued function.
135814 */
135815 static int cannotBeFunction(Parse *pParse, SrcItem *pFrom){
135816 if( pFrom->fg.isTabFunc ){
135817 sqlite3ErrorMsg(pParse, "'%s' is not a function", pFrom->zName);
135818 return 1;
135819 }
135820 return 0;
@@ -135463,23 +135831,23 @@
135831 ** If a non-NULL value is returned, set *ppContext to point to the With
135832 ** object that the returned CTE belongs to.
135833 */
135834 static struct Cte *searchWith(
135835 With *pWith, /* Current innermost WITH clause */
135836 SrcItem *pItem, /* FROM clause element to resolve */
135837 With **ppContext /* OUT: WITH clause return value belongs to */
135838 ){
135839 const char *zName = pItem->zName;
135840 With *p;
135841 assert( pItem->zDatabase==0 );
135842 assert( zName!=0 );
135843 for(p=pWith; p; p=p->pOuter){
135844 int i;
135845 for(i=0; i<p->nCte; i++){
135846 if( sqlite3StrICmp(zName, p->a[i].zName)==0 ){
135847 *ppContext = p;
135848 return &p->a[i];
135849 }
135850 }
135851 }
135852 return 0;
135853 }
@@ -135508,79 +135876,102 @@
135876 }
135877 }
135878
135879 /*
135880 ** This function checks if argument pFrom refers to a CTE declared by
135881 ** a WITH clause on the stack currently maintained by the parser (on the
135882 ** pParse->pWith linked list). And if currently processing a CTE
135883 ** CTE expression, through routine checks to see if the reference is
135884 ** a recursive reference to the CTE.
135885 **
135886 ** If pFrom matches a CTE according to either of these two above, pFrom->pTab
135887 ** and other fields are populated accordingly.
135888 **
135889 ** Return 0 if no match is found.
135890 ** Return 1 if a match is found.
135891 ** Return 2 if an error condition is detected.
135892 */
135893 static int resolveFromTermToCte(
135894 Parse *pParse, /* The parsing context */
135895 Walker *pWalker, /* Current tree walker */
135896 SrcItem *pFrom /* The FROM clause term to check */
135897 ){
135898 Cte *pCte; /* Matched CTE (or NULL if no match) */
135899 With *pWith; /* The matching WITH */
 
 
135900
135901 assert( pFrom->pTab==0 );
135902 if( pParse->pWith==0 ){
135903 /* There are no WITH clauses in the stack. No match is possible */
135904 return 0;
135905 }
135906 if( pFrom->zDatabase!=0 ){
135907 /* The FROM term contains a schema qualifier (ex: main.t1) and so
135908 ** it cannot possibly be a CTE reference. */
135909 return 0;
135910 }
135911 pCte = searchWith(pParse->pWith, pFrom, &pWith);
135912 if( pCte ){
135913 sqlite3 *db = pParse->db;
135914 Table *pTab;
135915 ExprList *pEList;
135916 Select *pSel;
135917 Select *pLeft; /* Left-most SELECT statement */
135918 Select *pRecTerm; /* Left-most recursive term */
135919 int bMayRecursive; /* True if compound joined by UNION [ALL] */
135920 With *pSavedWith; /* Initial value of pParse->pWith */
135921 int iRecTab = -1; /* Cursor for recursive table */
135922 CteUse *pCteUse;
135923
135924 /* If pCte->zCteErr is non-NULL at this point, then this is an illegal
135925 ** recursive reference to CTE pCte. Leave an error in pParse and return
135926 ** early. If pCte->zCteErr is NULL, then this is not a recursive reference.
135927 ** In this case, proceed. */
135928 if( pCte->zCteErr ){
135929 sqlite3ErrorMsg(pParse, pCte->zCteErr, pCte->zName);
135930 return 2;
135931 }
135932 if( cannotBeFunction(pParse, pFrom) ) return 2;
135933
135934 assert( pFrom->pTab==0 );
135935 pTab = sqlite3DbMallocZero(db, sizeof(Table));
135936 if( pTab==0 ) return 2;
135937 pCteUse = pCte->pUse;
135938 if( pCteUse==0 ){
135939 pCte->pUse = pCteUse = sqlite3DbMallocZero(db, sizeof(pCteUse[0]));
135940 if( pCteUse==0
135941 || sqlite3ParserAddCleanup(pParse,sqlite3DbFree,pCteUse)==0
135942 ){
135943 sqlite3DbFree(db, pTab);
135944 return 2;
135945 }
135946 pCteUse->eM10d = pCte->eM10d;
135947 }
135948 pFrom->pTab = pTab;
135949 pTab->nTabRef = 1;
135950 pTab->zName = sqlite3DbStrDup(db, pCte->zName);
135951 pTab->iPKey = -1;
135952 pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
135953 pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid;
135954 pFrom->pSelect = sqlite3SelectDup(db, pCte->pSelect, 0);
135955 if( db->mallocFailed ) return 2;
135956 assert( pFrom->pSelect );
135957 pFrom->fg.isCte = 1;
135958 pFrom->u2.pCteUse = pCteUse;
135959 pCteUse->nUse++;
135960 if( pCteUse->nUse>=2 && pCteUse->eM10d==M10d_Any ){
135961 pCteUse->eM10d = M10d_Yes;
135962 }
135963
135964 /* Check if this is a recursive CTE. */
135965 pRecTerm = pSel = pFrom->pSelect;
135966 bMayRecursive = ( pSel->op==TK_ALL || pSel->op==TK_UNION );
135967 while( bMayRecursive && pRecTerm->op==pSel->op ){
135968 int i;
135969 SrcList *pSrc = pRecTerm->pSrc;
135970 assert( pRecTerm->pPrior!=0 );
135971 for(i=0; i<pSrc->nSrc; i++){
135972 SrcItem *pItem = &pSrc->a[i];
135973 if( pItem->zDatabase==0
135974 && pItem->zName!=0
135975 && 0==sqlite3StrICmp(pItem->zName, pCte->zName)
135976 ){
135977 pItem->pTab = pTab;
@@ -135588,11 +135979,11 @@
135979 pItem->fg.isRecursive = 1;
135980 if( pRecTerm->selFlags & SF_Recursive ){
135981 sqlite3ErrorMsg(pParse,
135982 "multiple references to recursive table: %s", pCte->zName
135983 );
135984 return 2;
135985 }
135986 pRecTerm->selFlags |= SF_Recursive;
135987 if( iRecTab<0 ) iRecTab = pParse->nTab++;
135988 pItem->iCursor = iRecTab;
135989 }
@@ -135624,11 +136015,11 @@
136015 if( pEList && pEList->nExpr!=pCte->pCols->nExpr ){
136016 sqlite3ErrorMsg(pParse, "table %s has %d values for %d columns",
136017 pCte->zName, pEList->nExpr, pCte->pCols->nExpr
136018 );
136019 pParse->pWith = pSavedWith;
136020 return 2;
136021 }
136022 pEList = pCte->pCols;
136023 }
136024
136025 sqlite3ColumnsFromExprList(pParse, pEList, &pTab->nCol, &pTab->aCol);
@@ -135640,13 +136031,13 @@
136031 }
136032 sqlite3WalkSelect(pWalker, pSel);
136033 }
136034 pCte->zCteErr = 0;
136035 pParse->pWith = pSavedWith;
136036 return 1; /* Success */
136037 }
136038 return 0; /* No match */
 
136039 }
136040 #endif
136041
136042 #ifndef SQLITE_OMIT_CTE
136043 /*
@@ -135676,11 +136067,11 @@
136067 ** sub-query in the FROM clause of a SELECT statement. This function
136068 ** allocates and populates the SrcList_item.pTab object. If successful,
136069 ** SQLITE_OK is returned. Otherwise, if an OOM error is encountered,
136070 ** SQLITE_NOMEM.
136071 */
136072 SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse *pParse, SrcItem *pFrom){
136073 Select *pSel = pFrom->pSelect;
136074 Table *pTab;
136075
136076 assert( pSel );
136077 pFrom->pTab = pTab = sqlite3DbMallocZero(pParse->db, sizeof(Table));
@@ -135724,14 +136115,14 @@
136115 ** and TABLE.* to be every column in TABLE.
136116 **
136117 */
136118 static int selectExpander(Walker *pWalker, Select *p){
136119 Parse *pParse = pWalker->pParse;
136120 int i, j, k, rc;
136121 SrcList *pTabList;
136122 ExprList *pEList;
136123 SrcItem *pFrom;
136124 sqlite3 *db = pParse->db;
136125 Expr *pE, *pRight, *pExpr;
136126 u16 selFlags = p->selFlags;
136127 u32 elistFlags = 0;
136128
@@ -135763,23 +136154,25 @@
136154 for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){
136155 Table *pTab;
136156 assert( pFrom->fg.isRecursive==0 || pFrom->pTab!=0 );
136157 if( pFrom->pTab ) continue;
136158 assert( pFrom->fg.isRecursive==0 );
 
 
 
 
136159 if( pFrom->zName==0 ){
136160 #ifndef SQLITE_OMIT_SUBQUERY
136161 Select *pSel = pFrom->pSelect;
136162 /* A sub-query in the FROM clause of a SELECT */
136163 assert( pSel!=0 );
136164 assert( pFrom->pTab==0 );
136165 if( sqlite3WalkSelect(pWalker, pSel) ) return WRC_Abort;
136166 if( sqlite3ExpandSubquery(pParse, pFrom) ) return WRC_Abort;
136167 #endif
136168 #ifndef SQLITE_OMIT_CTE
136169 }else if( (rc = resolveFromTermToCte(pParse, pWalker, pFrom))!=0 ){
136170 if( rc>1 ) return WRC_Abort;
136171 pTab = pFrom->pTab;
136172 assert( pTab!=0 );
136173 #endif
136174 }else{
136175 /* An ordinary table or view name in the FROM clause */
136176 assert( pFrom->pTab==0 );
136177 pFrom->pTab = pTab = sqlite3LocateTableItem(pParse, 0, pFrom);
136178 if( pTab==0 ) return WRC_Abort;
@@ -135823,11 +136216,11 @@
136216 }
136217 #endif
136218 }
136219
136220 /* Locate the index named by the INDEXED BY clause, if any. */
136221 if( pFrom->fg.isIndexedBy && sqlite3IndexedByLookup(pParse, pFrom) ){
136222 return WRC_Abort;
136223 }
136224 }
136225
136226 /* Process NATURAL keywords, and ON and USING clauses of joins.
@@ -136066,11 +136459,11 @@
136459 */
136460 static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){
136461 Parse *pParse;
136462 int i;
136463 SrcList *pTabList;
136464 SrcItem *pFrom;
136465
136466 assert( p->selFlags & SF_Resolved );
136467 if( p->selFlags & SF_HasTypeInfo ) return;
136468 p->selFlags |= SF_HasTypeInfo;
136469 pParse = pWalker->pParse;
@@ -136390,15 +136783,17 @@
136783 /*
136784 ** Check to see if the pThis entry of pTabList is a self-join of a prior view.
136785 ** If it is, then return the SrcList_item for the prior view. If it is not,
136786 ** then return 0.
136787 */
136788 static SrcItem *isSelfJoinView(
136789 SrcList *pTabList, /* Search for self-joins in this FROM clause */
136790 SrcItem *pThis /* Search for prior reference to this subquery */
136791 ){
136792 SrcItem *pItem;
136793 assert( pThis->pSelect!=0 );
136794 if( pThis->pSelect->selFlags & SF_PushDown ) return 0;
136795 for(pItem = pTabList->a; pItem<pThis; pItem++){
136796 Select *pS1;
136797 if( pItem->pSelect==0 ) continue;
136798 if( pItem->fg.viaCoroutine ) continue;
136799 if( pItem->zName==0 ) continue;
@@ -136410,21 +136805,28 @@
136805 if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){
136806 /* The query flattener left two different CTE tables with identical
136807 ** names in the same FROM clause. */
136808 continue;
136809 }
136810 if( pItem->pSelect->selFlags & SF_PushDown ){
 
 
136811 /* The view was modified by some other optimization such as
136812 ** pushDownWhereTerms() */
136813 continue;
136814 }
136815 return pItem;
136816 }
136817 return 0;
136818 }
136819
136820 /*
136821 ** Deallocate a single AggInfo object
136822 */
136823 static void agginfoFree(sqlite3 *db, AggInfo *p){
136824 sqlite3DbFree(db, p->aCol);
136825 sqlite3DbFree(db, p->aFunc);
136826 sqlite3DbFreeNN(db, p);
136827 }
136828
136829 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
136830 /*
136831 ** Attempt to transform a query of the form
136832 **
@@ -136589,13 +136991,13 @@
136991 /* If the SF_UpdateFrom flag is set, then this function is being called
136992 ** as part of populating the temp table for an UPDATE...FROM statement.
136993 ** In this case, it is an error if the target object (pSrc->a[0]) name
136994 ** or alias is duplicated within FROM clause (pSrc->a[1..n]). */
136995 if( p->selFlags & SF_UpdateFrom ){
136996 SrcItem *p0 = &p->pSrc->a[0];
136997 for(i=1; i<p->pSrc->nSrc; i++){
136998 SrcItem *p1 = &p->pSrc->a[i];
136999 if( p0->pTab==p1->pTab && 0==sqlite3_stricmp(p0->zAlias, p1->zAlias) ){
137000 sqlite3ErrorMsg(pParse,
137001 "target object/alias may not appear in FROM clause: %s",
137002 p0->zAlias ? p0->zAlias : p0->pTab->zName
137003 );
@@ -136629,11 +137031,11 @@
137031 /* Try to do various optimizations (flattening subqueries, and strength
137032 ** reduction of join operators) in the FROM clause up into the main query
137033 */
137034 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
137035 for(i=0; !p->pPrior && i<pTabList->nSrc; i++){
137036 SrcItem *pItem = &pTabList->a[i];
137037 Select *pSub = pItem->pSelect;
137038 Table *pTab = pItem->pTab;
137039
137040 /* The expander should have already created transient Table objects
137041 ** even for FROM clause elements such as subqueries that do not correspond
@@ -136763,11 +137165,12 @@
137165 /* For each term in the FROM clause, do two things:
137166 ** (1) Authorized unreferenced tables
137167 ** (2) Generate code for all sub-queries
137168 */
137169 for(i=0; i<pTabList->nSrc; i++){
137170 SrcItem *pItem = &pTabList->a[i];
137171 SrcItem *pPrior;
137172 SelectDest dest;
137173 Select *pSub;
137174 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
137175 const char *zSavedAuthContext;
137176 #endif
@@ -136823,10 +137226,11 @@
137226
137227 /* Make copies of constant WHERE-clause terms in the outer query down
137228 ** inside the subquery. This can help the subquery to run more efficiently.
137229 */
137230 if( OptimizationEnabled(db, SQLITE_PushDown)
137231 && (pItem->fg.isCte==0 || pItem->u2.pCteUse->eM10d!=M10d_Yes)
137232 && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
137233 (pItem->fg.jointype & JT_OUTER)!=0)
137234 ){
137235 #if SELECTTRACE_ENABLED
137236 if( sqlite3SelectTrace & 0x100 ){
@@ -136833,29 +137237,32 @@
137237 SELECTTRACE(0x100,pParse,p,
137238 ("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
137239 sqlite3TreeViewSelect(0, p, 0);
137240 }
137241 #endif
137242 assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
137243 }else{
137244 SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));
137245 }
137246
137247 zSavedAuthContext = pParse->zAuthContext;
137248 pParse->zAuthContext = pItem->zName;
137249
137250 /* Generate code to implement the subquery
137251 **
137252 ** The subquery is implemented as a co-routine if:
137253 ** (1) the subquery is guaranteed to be the outer loop (so that
137254 ** it does not need to be computed more than once), and
137255 ** (2) the subquery is not a CTE that should be materialized
137256 **
137257 ** TODO: Are there other reasons beside (1) and (2) to use a co-routine
137258 ** implementation?
137259 */
137260 if( i==0
137261 && (pTabList->nSrc==1
137262 || (pTabList->a[1].fg.jointype&(JT_LEFT|JT_CROSS))!=0) /* (1) */
137263 && (pItem->fg.isCte==0 || pItem->u2.pCteUse->eM10d!=M10d_Yes) /* (2) */
137264 ){
137265 /* Implement a co-routine that will return a single row of the result
137266 ** set on each invocation.
137267 */
137268 int addrTop = sqlite3VdbeCurrentAddr(v)+1;
@@ -136871,20 +137278,34 @@
137278 pItem->fg.viaCoroutine = 1;
137279 pItem->regResult = dest.iSdst;
137280 sqlite3VdbeEndCoroutine(v, pItem->regReturn);
137281 sqlite3VdbeJumpHere(v, addrTop-1);
137282 sqlite3ClearTempRegCache(pParse);
137283 }else if( pItem->fg.isCte && pItem->u2.pCteUse->addrM9e>0 ){
137284 /* This is a CTE for which materialization code has already been
137285 ** generated. Invoke the subroutine to compute the materialization,
137286 ** the make the pItem->iCursor be a copy of the ephemerial table that
137287 ** holds the result of the materialization. */
137288 CteUse *pCteUse = pItem->u2.pCteUse;
137289 sqlite3VdbeAddOp2(v, OP_Gosub, pCteUse->regRtn, pCteUse->addrM9e);
137290 if( pItem->iCursor!=pCteUse->iCur ){
137291 sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pCteUse->iCur);
137292 }
137293 pSub->nSelectRow = pCteUse->nRowEst;
137294 }else if( (pPrior = isSelfJoinView(pTabList, pItem))!=0 ){
137295 /* This view has already been materialized by a prior entry in
137296 ** this same FROM clause. Reuse it. */
137297 if( pPrior->addrFillSub ){
137298 sqlite3VdbeAddOp2(v, OP_Gosub, pPrior->regReturn, pPrior->addrFillSub);
137299 }
137300 sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor);
137301 pSub->nSelectRow = pPrior->pSelect->nSelectRow;
137302 }else{
137303 /* Generate a subroutine that will materialize the view. */
 
 
 
 
137304 int topAddr;
137305 int onceAddr = 0;
137306 int retAddr;
 
137307
137308 testcase( pItem->addrFillSub==0 ); /* Ticket c52b09c7f38903b1311 */
137309 pItem->regReturn = ++pParse->nMem;
137310 topAddr = sqlite3VdbeAddOp2(v, OP_Integer, 0, pItem->regReturn);
137311 pItem->addrFillSub = topAddr+1;
@@ -136895,26 +137316,26 @@
137316 onceAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
137317 VdbeComment((v, "materialize \"%s\"", pItem->pTab->zName));
137318 }else{
137319 VdbeNoopComment((v, "materialize \"%s\"", pItem->pTab->zName));
137320 }
137321 sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
137322 ExplainQueryPlan((pParse, 1, "MATERIALIZE %u", pSub->selId));
137323 sqlite3Select(pParse, pSub, &dest);
 
 
 
 
 
 
 
137324 pItem->pTab->nRowLogEst = pSub->nSelectRow;
137325 if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr);
137326 retAddr = sqlite3VdbeAddOp1(v, OP_Return, pItem->regReturn);
137327 VdbeComment((v, "end %s", pItem->pTab->zName));
137328 sqlite3VdbeChangeP1(v, topAddr, retAddr);
137329 sqlite3ClearTempRegCache(pParse);
137330 if( pItem->fg.isCte ){
137331 CteUse *pCteUse = pItem->u2.pCteUse;
137332 pCteUse->addrM9e = pItem->addrFillSub;
137333 pCteUse->regRtn = pItem->regReturn;
137334 pCteUse->iCur = pItem->iCursor;
137335 pCteUse->nRowEst = pSub->nSelectRow;
137336 }
137337 }
137338 if( db->mallocFailed ) goto select_end;
137339 pParse->nHeight -= sqlite3SelectExprHeight(p);
137340 pParse->zAuthContext = zSavedAuthContext;
137341 #endif
@@ -137055,10 +137476,11 @@
137476 sSort.labelOBLopt = sqlite3WhereOrderByLimitOptLabel(pWInfo);
137477 if( sSort.nOBSat==sSort.pOrderBy->nExpr ){
137478 sSort.pOrderBy = 0;
137479 }
137480 }
137481 SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));
137482
137483 /* If sorting index that was created by a prior OP_OpenEphemeral
137484 ** instruction ended up not being needed, then change the OP_OpenEphemeral
137485 ** into an OP_Noop.
137486 */
@@ -137093,10 +137515,11 @@
137515 sqlite3WhereContinueLabel(pWInfo),
137516 sqlite3WhereBreakLabel(pWInfo));
137517
137518 /* End the database scan loop.
137519 */
137520 SELECTTRACE(1,pParse,p,("WhereEnd\n"));
137521 sqlite3WhereEnd(pWInfo);
137522 }
137523 }else{
137524 /* This case when there exist aggregate functions or a GROUP BY clause
137525 ** or both */
@@ -137163,15 +137586,17 @@
137586 /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in
137587 ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the
137588 ** SELECT statement.
137589 */
137590 pAggInfo = sqlite3DbMallocZero(db, sizeof(*pAggInfo) );
137591 if( pAggInfo ){
137592 sqlite3ParserAddCleanup(pParse,
137593 (void(*)(sqlite3*,void*))agginfoFree, pAggInfo);
137594 }
137595 if( db->mallocFailed ){
137596 goto select_end;
137597 }
 
 
137598 pAggInfo->selId = p->selId;
137599 memset(&sNC, 0, sizeof(sNC));
137600 sNC.pParse = pParse;
137601 sNC.pSrcList = pTabList;
137602 sNC.uNC.pAggInfo = pAggInfo;
@@ -137286,10 +137711,11 @@
137711 SELECTTRACE(1,pParse,p,("WhereBegin\n"));
137712 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, 0,
137713 WHERE_GROUPBY | (orderByGrp ? WHERE_SORTBYGROUP : 0), 0
137714 );
137715 if( pWInfo==0 ) goto select_end;
137716 SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));
137717 if( sqlite3WhereIsOrdered(pWInfo)==pGroupBy->nExpr ){
137718 /* The optimizer is able to deliver rows in group by order so
137719 ** we do not have to sort. The OP_OpenEphemeral table will be
137720 ** cancelled later because we still need to use the pKeyInfo
137721 */
@@ -137334,10 +137760,11 @@
137760 regRecord = sqlite3GetTempReg(pParse);
137761 sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord);
137762 sqlite3VdbeAddOp2(v, OP_SorterInsert, pAggInfo->sortingIdx, regRecord);
137763 sqlite3ReleaseTempReg(pParse, regRecord);
137764 sqlite3ReleaseTempRange(pParse, regBase, nCol);
137765 SELECTTRACE(1,pParse,p,("WhereEnd\n"));
137766 sqlite3WhereEnd(pWInfo);
137767 pAggInfo->sortingIdxPTab = sortPTab = pParse->nTab++;
137768 sortOut = sqlite3GetTempReg(pParse);
137769 sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol);
137770 sqlite3VdbeAddOp2(v, OP_SorterSort, pAggInfo->sortingIdx, addrEnd);
@@ -137411,10 +137838,11 @@
137838 */
137839 if( groupBySort ){
137840 sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx,addrTopOfLoop);
137841 VdbeCoverage(v);
137842 }else{
137843 SELECTTRACE(1,pParse,p,("WhereEnd\n"));
137844 sqlite3WhereEnd(pWInfo);
137845 sqlite3VdbeChangeToNoop(v, addrSortingIdx);
137846 }
137847
137848 /* Output the final row of result
@@ -137566,15 +137994,17 @@
137994 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy,
137995 0, minMaxFlag, 0);
137996 if( pWInfo==0 ){
137997 goto select_end;
137998 }
137999 SELECTTRACE(1,pParse,p,("WhereBegin returns\n"));
138000 updateAccumulator(pParse, regAcc, pAggInfo);
138001 if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc);
138002 if( minMaxFlag ){
138003 sqlite3WhereMinMaxOptEarlyOut(v, pWInfo);
138004 }
138005 SELECTTRACE(1,pParse,p,("WhereEnd\n"));
138006 sqlite3WhereEnd(pWInfo);
138007 finalizeAggFunctions(pParse, pAggInfo);
138008 }
138009
138010 sSort.pOrderBy = 0;
@@ -138199,11 +138629,11 @@
138629 db->aDb[iDb].zDbSName, zName,
138630 pTrig->table, z);
138631 sqlite3DbFree(db, z);
138632 sqlite3ChangeCookie(pParse, iDb);
138633 sqlite3VdbeAddParseSchemaOp(v, iDb,
138634 sqlite3MPrintf(db, "type='trigger' AND name='%q'", zName), 0);
138635 }
138636
138637 if( db->init.busy ){
138638 Trigger *pLink = pTrig;
138639 Hash *pHash = &db->aDb[iDb].pSchema->trigHash;
@@ -141764,11 +142194,11 @@
142194 v = sqlite3GetVdbe(pParse);
142195 sqlite3ChangeCookie(pParse, iDb);
142196
142197 sqlite3VdbeAddOp0(v, OP_Expire);
142198 zWhere = sqlite3MPrintf(db, "name=%Q AND sql=%Q", pTab->zName, zStmt);
142199 sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere, 0);
142200 sqlite3DbFree(db, zStmt);
142201
142202 iReg = ++pParse->nMem;
142203 sqlite3VdbeLoadString(v, iReg, pTab->zName);
142204 sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg);
@@ -141935,10 +142365,11 @@
142365 if( zType[i]=='\0' && i>0 ){
142366 assert(zType[i-1]==' ');
142367 zType[i-1] = '\0';
142368 }
142369 pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN;
142370 pTab->tabFlags |= TF_HasHidden;
142371 oooHidden = TF_OOOHidden;
142372 }else{
142373 pTab->tabFlags |= oooHidden;
142374 }
142375 }
@@ -143158,11 +143589,11 @@
143589 SQLITE_PRIVATE void sqlite3WhereSplit(WhereClause*,Expr*,u8);
143590 SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet*, Expr*);
143591 SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet*, Expr*);
143592 SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet*, ExprList*);
143593 SQLITE_PRIVATE void sqlite3WhereExprAnalyze(SrcList*, WhereClause*);
143594 SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, SrcItem*, WhereClause*);
143595
143596
143597
143598
143599
@@ -143336,11 +143767,11 @@
143767 int ret = 0;
143768 #if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
143769 if( sqlite3ParseToplevel(pParse)->explain==2 )
143770 #endif
143771 {
143772 SrcItem *pItem = &pTabList->a[pLevel->iFrom];
143773 Vdbe *v = pParse->pVdbe; /* VM being constructed */
143774 sqlite3 *db = pParse->db; /* Database handle */
143775 int isSearch; /* True for a SEARCH. False for SCAN. */
143776 WhereLoop *pLoop; /* The controlling WhereLoop object */
143777 u32 flags; /* Flags that describe this loop */
@@ -144129,11 +144560,11 @@
144560
144561 /*
144562 ** Insert an OP_CursorHint instruction if it is appropriate to do so.
144563 */
144564 static void codeCursorHint(
144565 SrcItem *pTabItem, /* FROM clause item */
144566 WhereInfo *pWInfo, /* The where clause */
144567 WhereLevel *pLevel, /* Which loop to provide hints for */
144568 WhereTerm *pEndRange /* Hint this end-of-scan boundary term if not NULL */
144569 ){
144570 Parse *pParse = pWInfo->pParse;
@@ -144504,11 +144935,11 @@
144935 int bRev; /* True if we need to scan in reverse order */
144936 WhereLoop *pLoop; /* The WhereLoop object being coded */
144937 WhereClause *pWC; /* Decomposition of the entire WHERE clause */
144938 WhereTerm *pTerm; /* A WHERE clause term */
144939 sqlite3 *db; /* Database connection */
144940 SrcItem *pTabItem; /* FROM clause term being coded */
144941 int addrBrk; /* Jump here to break out of the loop */
144942 int addrHalt; /* addrBrk for the outermost loop */
144943 int addrCont; /* Jump here to continue with next cycle */
144944 int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
144945 int iReleaseReg = 0; /* Temp register to free before returning */
@@ -145292,11 +145723,11 @@
145723 ** by this loop in the a[0] slot and all notReady tables in a[1..] slots.
145724 ** This becomes the SrcList in the recursive call to sqlite3WhereBegin().
145725 */
145726 if( pWInfo->nLevel>1 ){
145727 int nNotReady; /* The number of notReady tables */
145728 SrcItem *origSrc; /* Original list of tables */
145729 nNotReady = pWInfo->nLevel - iLevel - 1;
145730 pOrTab = sqlite3StackAllocRaw(db,
145731 sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0]));
145732 if( pOrTab==0 ) return notReady;
145733 pOrTab->nAlloc = (u8)(nNotReady + 1);
@@ -147557,11 +147988,11 @@
147988 ** Each function argument translates into an equality constraint against
147989 ** a HIDDEN column in the table.
147990 */
147991 SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(
147992 Parse *pParse, /* Parsing context */
147993 SrcItem *pItem, /* The FROM clause term to process */
147994 WhereClause *pWC /* Xfer function arguments to here */
147995 ){
147996 Table *pTab;
147997 int j, k;
147998 ExprList *pArgs;
@@ -148291,11 +148722,11 @@
148722 ** could be used with an index to access pSrc, assuming an appropriate
148723 ** index existed.
148724 */
148725 static int termCanDriveIndex(
148726 WhereTerm *pTerm, /* WHERE clause term to check */
148727 SrcItem *pSrc, /* Table we are trying to access */
148728 Bitmask notReady /* Tables in outer loops of the join */
148729 ){
148730 char aff;
148731 if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
148732 if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) return 0;
@@ -148325,11 +148756,11 @@
148756 ** makes use of the automatic index.
148757 */
148758 static void constructAutomaticIndex(
148759 Parse *pParse, /* The parsing context */
148760 WhereClause *pWC, /* The WHERE clause */
148761 SrcItem *pSrc, /* The FROM clause term to get the next index */
148762 Bitmask notReady, /* Mask of cursors that are not available */
148763 WhereLevel *pLevel /* Write new index here */
148764 ){
148765 int nKeyCol; /* Number of columns in the constructed index */
148766 WhereTerm *pTerm; /* A single term of the WHERE clause */
@@ -148349,11 +148780,11 @@
148780 Bitmask idxCols; /* Bitmap of columns used for indexing */
148781 Bitmask extraCols; /* Bitmap of additional columns */
148782 u8 sentWarning = 0; /* True if a warnning has been issued */
148783 Expr *pPartial = 0; /* Partial Index Expression */
148784 int iContinue = 0; /* Jump here to skip excluded rows */
148785 SrcItem *pTabItem; /* FROM clause term being indexed */
148786 int addrCounter = 0; /* Address where integer counter is initialized */
148787 int regBase; /* Array of registers where record is assembled */
148788
148789 /* Generate code to skip over the creation and initialization of the
148790 ** transient index on 2nd and subsequent iterations of the loop. */
@@ -148533,11 +148964,11 @@
148964 */
148965 static sqlite3_index_info *allocateIndexInfo(
148966 Parse *pParse, /* The parsing context */
148967 WhereClause *pWC, /* The WHERE clause being analyzed */
148968 Bitmask mUnusable, /* Ignore terms with these prereqs */
148969 SrcItem *pSrc, /* The FROM clause term that is the vtab */
148970 ExprList *pOrderBy, /* The ORDER BY clause */
148971 u16 *pmNoOmit /* Mask of terms not to omit */
148972 ){
148973 int i, j;
148974 int nTerm;
@@ -149431,11 +149862,11 @@
149862 ** Print a WhereLoop object for debugging purposes
149863 */
149864 SQLITE_PRIVATE void sqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC){
149865 WhereInfo *pWInfo = pWC->pWInfo;
149866 int nb = 1+(pWInfo->pTabList->nSrc+3)/4;
149867 SrcItem *pItem = pWInfo->pTabList->a + p->iTab;
149868 Table *pTab = pItem->pTab;
149869 Bitmask mAll = (((Bitmask)1)<<(nb*4)) - 1;
149870 sqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId,
149871 p->iTab, nb, p->maskSelf, nb, p->prereq & mAll);
149872 sqlite3DebugPrintf(" %12s",
@@ -150042,11 +150473,11 @@
150473 ** If pProbe->idxType==SQLITE_IDXTYPE_IPK, that means pIndex is
150474 ** a fake index used for the INTEGER PRIMARY KEY.
150475 */
150476 static int whereLoopAddBtreeIndex(
150477 WhereLoopBuilder *pBuilder, /* The WhereLoop factory */
150478 SrcItem *pSrc, /* FROM clause term being analyzed */
150479 Index *pProbe, /* An index on pSrc */
150480 LogEst nInMul /* log(Number of iterations due to IN) */
150481 ){
150482 WhereInfo *pWInfo = pBuilder->pWInfo; /* WHERE analyse context */
150483 Parse *pParse = pWInfo->pParse; /* Parsing context */
@@ -150533,11 +150964,11 @@
150964 Index *pProbe; /* An index we are evaluating */
150965 Index sPk; /* A fake index object for the primary key */
150966 LogEst aiRowEstPk[2]; /* The aiRowLogEst[] value for the sPk index */
150967 i16 aiColumnPk = -1; /* The aColumn[] value for the sPk index */
150968 SrcList *pTabList; /* The FROM clause */
150969 SrcItem *pSrc; /* The FROM clause btree term to add */
150970 WhereLoop *pNew; /* Template WhereLoop object */
150971 int rc = SQLITE_OK; /* Return code */
150972 int iSortIdx = 1; /* Index number */
150973 int b; /* A boolean value */
150974 LogEst rSize; /* number of rows in the table */
@@ -150551,13 +150982,13 @@
150982 pSrc = pTabList->a + pNew->iTab;
150983 pTab = pSrc->pTab;
150984 pWC = pBuilder->pWC;
150985 assert( !IsVirtual(pSrc->pTab) );
150986
150987 if( pSrc->fg.isIndexedBy ){
150988 /* An INDEXED BY clause specifies a particular index to use */
150989 pProbe = pSrc->u2.pIBIndex;
150990 }else if( !HasRowid(pTab) ){
150991 pProbe = pTab->pIndex;
150992 }else{
150993 /* There is no INDEXED BY clause. Create a fake Index object in local
150994 ** variable sPk to represent the rowid primary key index. Make this
@@ -150589,11 +151020,11 @@
151020 #ifndef SQLITE_OMIT_AUTOMATIC_INDEX
151021 /* Automatic indexes */
151022 if( !pBuilder->pOrSet /* Not part of an OR optimization */
151023 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0
151024 && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0
151025 && !pSrc->fg.isIndexedBy /* Has no INDEXED BY clause */
151026 && !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */
151027 && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */
151028 && !pSrc->fg.isCorrelated /* Not a correlated subquery */
151029 && !pSrc->fg.isRecursive /* Not a recursive common table expression. */
151030 ){
@@ -150639,11 +151070,11 @@
151070 #endif /* SQLITE_OMIT_AUTOMATIC_INDEX */
151071
151072 /* Loop over all indices. If there was an INDEXED BY clause, then only
151073 ** consider index pProbe. */
151074 for(; rc==SQLITE_OK && pProbe;
151075 pProbe=(pSrc->fg.isIndexedBy ? 0 : pProbe->pNext), iSortIdx++
151076 ){
151077 int isLeft = (pSrc->fg.jointype & JT_OUTER)!=0;
151078 if( pProbe->pPartIdxWhere!=0
151079 && !whereUsablePartialIndex(pSrc->iCursor, isLeft, pWC,
151080 pProbe->pPartIdxWhere)
@@ -150814,11 +151245,11 @@
151245 int i;
151246 int mxTerm;
151247 int rc = SQLITE_OK;
151248 WhereLoop *pNew = pBuilder->pNew;
151249 Parse *pParse = pBuilder->pWInfo->pParse;
151250 SrcItem *pSrc = &pBuilder->pWInfo->pTabList->a[pNew->iTab];
151251 int nConstraint = pIdxInfo->nConstraint;
151252
151253 assert( (mUsable & mPrereq)==mPrereq );
151254 *pbIn = 0;
151255 pNew->prereq = mPrereq;
@@ -151006,11 +151437,11 @@
151437 ){
151438 int rc = SQLITE_OK; /* Return code */
151439 WhereInfo *pWInfo; /* WHERE analysis context */
151440 Parse *pParse; /* The parsing context */
151441 WhereClause *pWC; /* The WHERE clause */
151442 SrcItem *pSrc; /* The FROM clause term to search */
151443 sqlite3_index_info *p; /* Object to pass to xBestIndex() */
151444 int nConstraint; /* Number of constraints in p */
151445 int bIn; /* True if plan uses IN(...) operator */
151446 WhereLoop *pNew;
151447 Bitmask mBest; /* Tables used by best possible plan */
@@ -151134,11 +151565,11 @@
151565 int rc = SQLITE_OK;
151566 int iCur;
151567 WhereClause tempWC;
151568 WhereLoopBuilder sSubBuild;
151569 WhereOrSet sSum, sCur;
151570 SrcItem *pItem;
151571
151572 pWC = pBuilder->pWC;
151573 pWCEnd = pWC->a + pWC->nTerm;
151574 pNew = pBuilder->pNew;
151575 memset(&sSum, 0, sizeof(sSum));
@@ -151250,12 +151681,12 @@
151681 WhereInfo *pWInfo = pBuilder->pWInfo;
151682 Bitmask mPrereq = 0;
151683 Bitmask mPrior = 0;
151684 int iTab;
151685 SrcList *pTabList = pWInfo->pTabList;
151686 SrcItem *pItem;
151687 SrcItem *pEnd = &pTabList->a[pWInfo->nLevel];
151688 sqlite3 *db = pWInfo->pParse->db;
151689 int rc = SQLITE_OK;
151690 WhereLoop *pNew;
151691
151692 /* Loop over the tables in the join, from left to right */
@@ -151274,11 +151705,11 @@
151705 }else{
151706 mPrereq = 0;
151707 }
151708 #ifndef SQLITE_OMIT_VIRTUALTABLE
151709 if( IsVirtual(pItem->pTab) ){
151710 SrcItem *p;
151711 for(p=&pItem[1]; p<pEnd; p++){
151712 if( mUnusable || (p->fg.jointype & (JT_LEFT|JT_CROSS)) ){
151713 mUnusable |= sqlite3WhereGetMask(&pWInfo->sMaskSet, p->iCursor);
151714 }
151715 }
@@ -152129,11 +152560,11 @@
152560 ** no-frills query planner. Return zero if this query needs the
152561 ** general-purpose query planner.
152562 */
152563 static int whereShortCut(WhereLoopBuilder *pBuilder){
152564 WhereInfo *pWInfo;
152565 SrcItem *pItem;
152566 WhereClause *pWC;
152567 WhereTerm *pTerm;
152568 WhereLoop *pLoop;
152569 int iCur;
152570 int j;
@@ -152659,11 +153090,11 @@
153090 if( sWLB.pOrderBy ){
153091 tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy);
153092 }
153093 for(i=pWInfo->nLevel-1; i>=1; i--){
153094 WhereTerm *pTerm, *pEnd;
153095 SrcItem *pItem;
153096 pLoop = pWInfo->a[i].pWLoop;
153097 pItem = &pWInfo->pTabList->a[pLoop->iTab];
153098 if( (pItem->fg.jointype & JT_LEFT)==0 ) continue;
153099 if( (wctrlFlags & WHERE_WANT_DISTINCT)==0
153100 && (pLoop->wsFlags & WHERE_ONEROW)==0
@@ -152749,11 +153180,11 @@
153180 ** searching those tables.
153181 */
153182 for(ii=0, pLevel=pWInfo->a; ii<nTabList; ii++, pLevel++){
153183 Table *pTab; /* Table to open */
153184 int iDb; /* Index of database containing table/index */
153185 SrcItem *pTabItem;
153186
153187 pTabItem = &pTabList->a[pLevel->iFrom];
153188 pTab = pTabItem->pTab;
153189 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
153190 pLoop = pLevel->pWLoop;
@@ -153086,11 +153517,11 @@
153517 assert( pWInfo->nLevel<=pTabList->nSrc );
153518 for(i=0, pLevel=pWInfo->a; i<pWInfo->nLevel; i++, pLevel++){
153519 int k, last;
153520 VdbeOp *pOp, *pLastOp;
153521 Index *pIdx = 0;
153522 SrcItem *pTabItem = &pTabList->a[pLevel->iFrom];
153523 Table *pTab = pTabItem->pTab;
153524 assert( pTab!=0 );
153525 pLoop = pLevel->pWLoop;
153526
153527 /* For a co-routine, change all OP_Column references to the table of
@@ -156398,10 +156829,23 @@
156829 sqlite3ErrorMsg(pParse, "too many terms in compound SELECT");
156830 }
156831 }
156832 }
156833
156834 /* Attach a With object describing the WITH clause to a Select
156835 ** object describing the query for which the WITH clause is a prefix.
156836 */
156837 static Select *attachWithToSelect(Parse *pParse, Select *pSelect, With *pWith){
156838 if( pSelect ){
156839 pSelect->pWith = pWith;
156840 parserDoubleLinkSelect(pParse, pSelect);
156841 }else{
156842 sqlite3WithDelete(pParse->db, pWith);
156843 }
156844 return pSelect;
156845 }
156846
156847
156848 /* Construct a new Expr object from a single identifier. Use the
156849 ** new Expr to populate pOut. Set the span of pOut to be the identifier
156850 ** that created the expression.
156851 */
@@ -156573,95 +157017,96 @@
157017 #define TK_GROUPS 92
157018 #define TK_OTHERS 93
157019 #define TK_TIES 94
157020 #define TK_GENERATED 95
157021 #define TK_ALWAYS 96
157022 #define TK_MATERIALIZED 97
157023 #define TK_REINDEX 98
157024 #define TK_RENAME 99
157025 #define TK_CTIME_KW 100
157026 #define TK_ANY 101
157027 #define TK_BITAND 102
157028 #define TK_BITOR 103
157029 #define TK_LSHIFT 104
157030 #define TK_RSHIFT 105
157031 #define TK_PLUS 106
157032 #define TK_MINUS 107
157033 #define TK_STAR 108
157034 #define TK_SLASH 109
157035 #define TK_REM 110
157036 #define TK_CONCAT 111
157037 #define TK_COLLATE 112
157038 #define TK_BITNOT 113
157039 #define TK_ON 114
157040 #define TK_INDEXED 115
157041 #define TK_STRING 116
157042 #define TK_JOIN_KW 117
157043 #define TK_CONSTRAINT 118
157044 #define TK_DEFAULT 119
157045 #define TK_NULL 120
157046 #define TK_PRIMARY 121
157047 #define TK_UNIQUE 122
157048 #define TK_CHECK 123
157049 #define TK_REFERENCES 124
157050 #define TK_AUTOINCR 125
157051 #define TK_INSERT 126
157052 #define TK_DELETE 127
157053 #define TK_UPDATE 128
157054 #define TK_SET 129
157055 #define TK_DEFERRABLE 130
157056 #define TK_FOREIGN 131
157057 #define TK_DROP 132
157058 #define TK_UNION 133
157059 #define TK_ALL 134
157060 #define TK_EXCEPT 135
157061 #define TK_INTERSECT 136
157062 #define TK_SELECT 137
157063 #define TK_VALUES 138
157064 #define TK_DISTINCT 139
157065 #define TK_DOT 140
157066 #define TK_FROM 141
157067 #define TK_JOIN 142
157068 #define TK_USING 143
157069 #define TK_ORDER 144
157070 #define TK_GROUP 145
157071 #define TK_HAVING 146
157072 #define TK_LIMIT 147
157073 #define TK_WHERE 148
157074 #define TK_RETURNING 149
157075 #define TK_INTO 150
157076 #define TK_NOTHING 151
157077 #define TK_FLOAT 152
157078 #define TK_BLOB 153
157079 #define TK_INTEGER 154
157080 #define TK_VARIABLE 155
157081 #define TK_CASE 156
157082 #define TK_WHEN 157
157083 #define TK_THEN 158
157084 #define TK_ELSE 159
157085 #define TK_INDEX 160
157086 #define TK_ALTER 161
157087 #define TK_ADD 162
157088 #define TK_WINDOW 163
157089 #define TK_OVER 164
157090 #define TK_FILTER 165
157091 #define TK_COLUMN 166
157092 #define TK_AGG_FUNCTION 167
157093 #define TK_AGG_COLUMN 168
157094 #define TK_TRUEFALSE 169
157095 #define TK_ISNOT 170
157096 #define TK_FUNCTION 171
157097 #define TK_UMINUS 172
157098 #define TK_UPLUS 173
157099 #define TK_TRUTH 174
157100 #define TK_REGISTER 175
157101 #define TK_VECTOR 176
157102 #define TK_SELECT_COLUMN 177
157103 #define TK_IF_NULL_ROW 178
157104 #define TK_ASTERISK 179
157105 #define TK_SPAN 180
157106 #define TK_SPACE 181
157107 #define TK_ILLEGAL 182
157108 #endif
157109 /**************** End token definitions ***************************************/
157110
157111 /* The next sections is a series of control #defines.
157112 ** various aspects of the generated parser.
@@ -156717,32 +157162,33 @@
157162 #ifndef INTERFACE
157163 # define INTERFACE 1
157164 #endif
157165 /************* Begin control #defines *****************************************/
157166 #define YYCODETYPE unsigned short int
157167 #define YYNOCODE 316
157168 #define YYACTIONTYPE unsigned short int
157169 #define YYWILDCARD 101
157170 #define sqlite3ParserTOKENTYPE Token
157171 typedef union {
157172 int yyinit;
157173 sqlite3ParserTOKENTYPE yy0;
157174 Window* yy19;
157175 struct TrigEvent yy50;
157176 int yy60;
157177 struct FrameBound yy113;
157178 Upsert* yy178;
157179 With* yy195;
157180 IdList* yy288;
157181 SrcList* yy291;
157182 Select* yy307;
157183 ExprList* yy338;
157184 TriggerStep* yy483;
157185 const char* yy528;
157186 u8 yy570;
157187 Expr* yy602;
157188 Cte* yy607;
157189 struct {int value; int mask;} yy615;
157190 } YYMINORTYPE;
157191 #ifndef YYSTACKDEPTH
157192 #define YYSTACKDEPTH 100
157193 #endif
157194 #define sqlite3ParserARG_SDECL
@@ -156754,22 +157200,22 @@
157200 #define sqlite3ParserCTX_PDECL ,Parse *pParse
157201 #define sqlite3ParserCTX_PARAM ,pParse
157202 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
157203 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
157204 #define YYFALLBACK 1
157205 #define YYNSTATE 570
157206 #define YYNRULE 398
157207 #define YYNRULE_WITH_ACTION 337
157208 #define YYNTOKEN 183
157209 #define YY_MAX_SHIFT 569
157210 #define YY_MIN_SHIFTREDUCE 825
157211 #define YY_MAX_SHIFTREDUCE 1222
157212 #define YY_ERROR_ACTION 1223
157213 #define YY_ACCEPT_ACTION 1224
157214 #define YY_NO_ACTION 1225
157215 #define YY_MIN_REDUCE 1226
157216 #define YY_MAX_REDUCE 1623
157217 /************* End control #defines *******************************************/
157218 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
157219
157220 /* Define the yytestcase() macro to be a no-op if is not already defined
157221 ** otherwise.
@@ -156832,605 +157278,604 @@
157278 ** yy_reduce_ofst[] For each state, the offset into yy_action for
157279 ** shifting non-terminals after a reduce.
157280 ** yy_default[] Default action for each state.
157281 **
157282 *********** Begin parsing tables **********************************************/
157283 #define YY_ACTTAB_COUNT (2020)
157284 static const YYACTIONTYPE yy_action[] = {
157285 /* 0 */ 563, 1295, 563, 1274, 168, 361, 115, 112, 218, 373,
157286 /* 10 */ 563, 1295, 374, 563, 488, 563, 115, 112, 218, 406,
157287 /* 20 */ 1300, 1300, 41, 41, 41, 41, 514, 1504, 520, 1298,
157288 /* 30 */ 1298, 959, 41, 41, 1257, 71, 71, 51, 51, 960,
157289 /* 40 */ 557, 557, 557, 122, 123, 113, 1200, 1200, 1035, 1038,
157290 /* 50 */ 1028, 1028, 120, 120, 121, 121, 121, 121, 414, 406,
157291 /* 60 */ 273, 273, 273, 273, 115, 112, 218, 115, 112, 218,
157292 /* 70 */ 197, 268, 545, 560, 515, 560, 1260, 563, 385, 248,
157293 /* 80 */ 215, 521, 399, 122, 123, 113, 1200, 1200, 1035, 1038,
157294 /* 90 */ 1028, 1028, 120, 120, 121, 121, 121, 121, 540, 13,
157295 /* 100 */ 13, 1259, 119, 119, 119, 119, 118, 118, 117, 117,
157296 /* 110 */ 117, 116, 441, 1176, 419, 1531, 446, 137, 512, 1539,
157297 /* 120 */ 1545, 372, 1547, 6, 371, 1176, 1148, 1584, 1148, 406,
157298 /* 130 */ 1545, 534, 115, 112, 218, 1267, 99, 441, 121, 121,
157299 /* 140 */ 121, 121, 119, 119, 119, 119, 118, 118, 117, 117,
157300 /* 150 */ 117, 116, 441, 122, 123, 113, 1200, 1200, 1035, 1038,
157301 /* 160 */ 1028, 1028, 120, 120, 121, 121, 121, 121, 197, 1176,
157302 /* 170 */ 1177, 1178, 241, 304, 554, 501, 498, 497, 473, 124,
157303 /* 180 */ 394, 1176, 1177, 1178, 1176, 496, 119, 119, 119, 119,
157304 /* 190 */ 118, 118, 117, 117, 117, 116, 441, 139, 540, 406,
157305 /* 200 */ 121, 121, 121, 121, 114, 117, 117, 117, 116, 441,
157306 /* 210 */ 541, 1532, 119, 119, 119, 119, 118, 118, 117, 117,
157307 /* 220 */ 117, 116, 441, 122, 123, 113, 1200, 1200, 1035, 1038,
157308 /* 230 */ 1028, 1028, 120, 120, 121, 121, 121, 121, 406, 320,
157309 /* 240 */ 1176, 1177, 1178, 81, 342, 1590, 396, 80, 119, 119,
157310 /* 250 */ 119, 119, 118, 118, 117, 117, 117, 116, 441, 1176,
157311 /* 260 */ 211, 450, 122, 123, 113, 1200, 1200, 1035, 1038, 1028,
157312 /* 270 */ 1028, 120, 120, 121, 121, 121, 121, 251, 450, 449,
157313 /* 280 */ 273, 273, 119, 119, 119, 119, 118, 118, 117, 117,
157314 /* 290 */ 117, 116, 441, 560, 1224, 1, 1, 569, 2, 1228,
157315 /* 300 */ 317, 1176, 319, 1561, 305, 337, 140, 340, 406, 430,
157316 /* 310 */ 469, 1533, 1197, 1308, 348, 1176, 1177, 1178, 168, 462,
157317 /* 320 */ 330, 119, 119, 119, 119, 118, 118, 117, 117, 117,
157318 /* 330 */ 116, 441, 122, 123, 113, 1200, 1200, 1035, 1038, 1028,
157319 /* 340 */ 1028, 120, 120, 121, 121, 121, 121, 273, 273, 563,
157320 /* 350 */ 83, 450, 416, 1564, 569, 2, 1228, 1176, 1177, 1178,
157321 /* 360 */ 560, 305, 471, 140, 944, 995, 860, 563, 467, 1197,
157322 /* 370 */ 1308, 13, 13, 137, 229, 118, 118, 117, 117, 117,
157323 /* 380 */ 116, 441, 96, 318, 946, 504, 424, 361, 562, 71,
157324 /* 390 */ 71, 119, 119, 119, 119, 118, 118, 117, 117, 117,
157325 /* 400 */ 116, 441, 427, 205, 273, 273, 445, 1015, 259, 276,
157326 /* 410 */ 356, 507, 351, 506, 246, 406, 959, 560, 328, 344,
157327 /* 420 */ 347, 315, 860, 1006, 960, 126, 545, 1005, 313, 304,
157328 /* 430 */ 554, 229, 538, 1539, 148, 544, 281, 6, 203, 122,
157329 /* 440 */ 123, 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120,
157330 /* 450 */ 121, 121, 121, 121, 563, 217, 563, 12, 406, 1005,
157331 /* 460 */ 1005, 1007, 502, 445, 119, 119, 119, 119, 118, 118,
157332 /* 470 */ 117, 117, 117, 116, 441, 452, 71, 71, 70, 70,
157333 /* 480 */ 944, 137, 122, 123, 113, 1200, 1200, 1035, 1038, 1028,
157334 /* 490 */ 1028, 120, 120, 121, 121, 121, 121, 1530, 119, 119,
157335 /* 500 */ 119, 119, 118, 118, 117, 117, 117, 116, 441, 403,
157336 /* 510 */ 402, 241, 1176, 545, 501, 498, 497, 1468, 1143, 451,
157337 /* 520 */ 267, 267, 513, 1540, 496, 142, 1176, 6, 406, 530,
157338 /* 530 */ 194, 1143, 864, 560, 1143, 461, 182, 304, 554, 32,
157339 /* 540 */ 379, 119, 119, 119, 119, 118, 118, 117, 117, 117,
157340 /* 550 */ 116, 441, 122, 123, 113, 1200, 1200, 1035, 1038, 1028,
157341 /* 560 */ 1028, 120, 120, 121, 121, 121, 121, 406, 1176, 1177,
157342 /* 570 */ 1178, 857, 568, 1176, 1228, 925, 1176, 454, 361, 305,
157343 /* 580 */ 189, 140, 1176, 1177, 1178, 519, 529, 404, 1308, 183,
157344 /* 590 */ 1015, 122, 123, 113, 1200, 1200, 1035, 1038, 1028, 1028,
157345 /* 600 */ 120, 120, 121, 121, 121, 121, 1006, 16, 16, 370,
157346 /* 610 */ 1005, 119, 119, 119, 119, 118, 118, 117, 117, 117,
157347 /* 620 */ 116, 441, 273, 273, 1537, 150, 1176, 98, 6, 1176,
157348 /* 630 */ 1177, 1178, 1176, 1177, 1178, 560, 380, 406, 376, 438,
157349 /* 640 */ 437, 1161, 1005, 1005, 1007, 1025, 1025, 1036, 1039, 229,
157350 /* 650 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
157351 /* 660 */ 441, 122, 123, 113, 1200, 1200, 1035, 1038, 1028, 1028,
157352 /* 670 */ 120, 120, 121, 121, 121, 121, 406, 1143, 1619, 392,
157353 /* 680 */ 1016, 445, 1176, 1177, 1178, 1207, 525, 1207, 1530, 995,
157354 /* 690 */ 1143, 304, 554, 1143, 5, 563, 543, 3, 361, 216,
157355 /* 700 */ 122, 123, 113, 1200, 1200, 1035, 1038, 1028, 1028, 120,
157356 /* 710 */ 120, 121, 121, 121, 121, 143, 563, 13, 13, 1029,
157357 /* 720 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
157358 /* 730 */ 441, 1176, 426, 563, 1176, 563, 274, 274, 13, 13,
157359 /* 740 */ 1078, 1176, 328, 457, 316, 147, 406, 211, 361, 560,
157360 /* 750 */ 1000, 213, 511, 293, 477, 55, 55, 71, 71, 119,
157361 /* 760 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 441,
157362 /* 770 */ 122, 123, 113, 1200, 1200, 1035, 1038, 1028, 1028, 120,
157363 /* 780 */ 120, 121, 121, 121, 121, 406, 455, 1176, 1177, 1178,
157364 /* 790 */ 1176, 1177, 1178, 471, 526, 149, 404, 1176, 1177, 1178,
157365 /* 800 */ 105, 270, 103, 563, 944, 563, 116, 441, 1530, 122,
157366 /* 810 */ 123, 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120,
157367 /* 820 */ 121, 121, 121, 121, 945, 13, 13, 13, 13, 119,
157368 /* 830 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 441,
157369 /* 840 */ 191, 563, 192, 563, 416, 439, 439, 439, 1083, 1083,
157370 /* 850 */ 485, 561, 285, 914, 914, 406, 462, 330, 1530, 830,
157371 /* 860 */ 831, 832, 206, 71, 71, 71, 71, 286, 119, 119,
157372 /* 870 */ 119, 119, 118, 118, 117, 117, 117, 116, 441, 122,
157373 /* 880 */ 123, 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120,
157374 /* 890 */ 121, 121, 121, 121, 563, 217, 563, 1122, 1617, 406,
157375 /* 900 */ 300, 1617, 301, 416, 1278, 1473, 244, 243, 242, 1249,
157376 /* 910 */ 412, 556, 412, 282, 842, 279, 71, 71, 71, 71,
157377 /* 920 */ 944, 1415, 1473, 1475, 101, 113, 1200, 1200, 1035, 1038,
157378 /* 930 */ 1028, 1028, 120, 120, 121, 121, 121, 121, 119, 119,
157379 /* 940 */ 119, 119, 118, 118, 117, 117, 117, 116, 441, 273,
157380 /* 950 */ 273, 1099, 563, 436, 1143, 440, 563, 1122, 1618, 357,
157381 /* 960 */ 1558, 1618, 560, 546, 488, 197, 1100, 1143, 378, 290,
157382 /* 970 */ 1143, 1306, 284, 460, 71, 71, 1120, 405, 13, 13,
157383 /* 980 */ 145, 1101, 119, 119, 119, 119, 118, 118, 117, 117,
157384 /* 990 */ 117, 116, 441, 542, 104, 1473, 509, 273, 273, 294,
157385 /* 1000 */ 1514, 294, 900, 273, 273, 273, 273, 563, 1503, 563,
157386 /* 1010 */ 560, 545, 901, 464, 406, 1058, 560, 852, 560, 198,
157387 /* 1020 */ 547, 1080, 920, 404, 1400, 1080, 146, 919, 38, 56,
157388 /* 1030 */ 56, 15, 15, 563, 406, 12, 1120, 471, 122, 123,
157389 /* 1040 */ 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120, 121,
157390 /* 1050 */ 121, 121, 121, 1460, 406, 43, 43, 483, 122, 123,
157391 /* 1060 */ 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120, 121,
157392 /* 1070 */ 121, 121, 121, 563, 852, 9, 471, 251, 122, 111,
157393 /* 1080 */ 113, 1200, 1200, 1035, 1038, 1028, 1028, 120, 120, 121,
157394 /* 1090 */ 121, 121, 121, 563, 421, 57, 57, 119, 119, 119,
157395 /* 1100 */ 119, 118, 118, 117, 117, 117, 116, 441, 1176, 493,
157396 /* 1110 */ 563, 289, 1197, 478, 1516, 44, 44, 119, 119, 119,
157397 /* 1120 */ 119, 118, 118, 117, 117, 117, 116, 441, 880, 563,
157398 /* 1130 */ 536, 563, 58, 58, 488, 1414, 245, 119, 119, 119,
157399 /* 1140 */ 119, 118, 118, 117, 117, 117, 116, 441, 563, 535,
157400 /* 1150 */ 291, 59, 59, 60, 60, 438, 437, 406, 1154, 505,
157401 /* 1160 */ 304, 554, 477, 1204, 1176, 1177, 1178, 881, 1206, 1197,
157402 /* 1170 */ 61, 61, 1246, 357, 1558, 1538, 1205, 563, 1467, 6,
157403 /* 1180 */ 1176, 488, 123, 113, 1200, 1200, 1035, 1038, 1028, 1028,
157404 /* 1190 */ 120, 120, 121, 121, 121, 121, 1400, 1143, 410, 62,
157405 /* 1200 */ 62, 1207, 1099, 1207, 411, 447, 273, 273, 537, 1154,
157406 /* 1210 */ 1143, 108, 555, 1143, 4, 391, 1220, 1100, 1512, 560,
157407 /* 1220 */ 347, 516, 428, 548, 308, 1307, 1536, 1077, 558, 1077,
157408 /* 1230 */ 6, 488, 1101, 1400, 488, 309, 1176, 1177, 1178, 563,
157409 /* 1240 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116,
157410 /* 1250 */ 441, 442, 278, 551, 563, 273, 273, 273, 273, 563,
157411 /* 1260 */ 327, 45, 45, 552, 563, 528, 422, 563, 560, 1400,
157412 /* 1270 */ 560, 108, 555, 137, 4, 1303, 46, 46, 335, 563,
157413 /* 1280 */ 482, 47, 47, 477, 479, 307, 49, 49, 558, 50,
157414 /* 1290 */ 50, 563, 1015, 563, 1221, 563, 1400, 563, 106, 106,
157415 /* 1300 */ 8, 63, 63, 423, 563, 107, 312, 442, 565, 564,
157416 /* 1310 */ 563, 442, 1005, 64, 64, 65, 65, 14, 14, 66,
157417 /* 1320 */ 66, 391, 1121, 552, 1312, 1180, 128, 128, 563, 304,
157418 /* 1330 */ 554, 563, 67, 67, 563, 359, 560, 532, 563, 484,
157419 /* 1340 */ 563, 1196, 531, 222, 1005, 1005, 1007, 1008, 27, 522,
157420 /* 1350 */ 52, 52, 1015, 68, 68, 563, 69, 69, 106, 106,
157421 /* 1360 */ 53, 53, 156, 156, 563, 107, 434, 442, 565, 564,
157422 /* 1370 */ 272, 215, 1005, 425, 563, 359, 563, 157, 157, 563,
157423 /* 1380 */ 1535, 292, 1180, 98, 6, 1344, 76, 76, 1215, 475,
157424 /* 1390 */ 413, 169, 226, 563, 245, 563, 54, 54, 72, 72,
157425 /* 1400 */ 1221, 129, 129, 1343, 1005, 1005, 1007, 1008, 27, 1563,
157426 /* 1410 */ 1165, 444, 456, 433, 277, 73, 73, 130, 130, 389,
157427 /* 1420 */ 389, 388, 262, 386, 1165, 444, 839, 1519, 277, 108,
157428 /* 1430 */ 555, 321, 4, 389, 389, 388, 262, 386, 563, 223,
157429 /* 1440 */ 839, 311, 468, 84, 202, 523, 558, 1492, 303, 310,
157430 /* 1450 */ 563, 110, 404, 223, 563, 311, 206, 30, 404, 277,
157431 /* 1460 */ 131, 131, 411, 310, 389, 389, 388, 262, 386, 442,
157432 /* 1470 */ 920, 839, 127, 127, 563, 919, 155, 155, 1491, 225,
157433 /* 1480 */ 563, 552, 871, 563, 223, 476, 311, 161, 31, 563,
157434 /* 1490 */ 135, 563, 480, 225, 310, 532, 154, 154, 332, 17,
157435 /* 1500 */ 533, 161, 136, 136, 135, 134, 134, 224, 228, 355,
157436 /* 1510 */ 1015, 132, 132, 133, 133, 1589, 106, 106, 889, 354,
157437 /* 1520 */ 563, 224, 563, 107, 225, 442, 565, 564, 1117, 275,
157438 /* 1530 */ 1005, 393, 161, 518, 563, 135, 108, 555, 417, 4,
157439 /* 1540 */ 1340, 407, 75, 75, 77, 77, 304, 554, 867, 563,
157440 /* 1550 */ 336, 563, 224, 558, 463, 407, 74, 74, 465, 1065,
157441 /* 1560 */ 304, 554, 1005, 1005, 1007, 1008, 27, 962, 963, 543,
157442 /* 1570 */ 448, 42, 42, 48, 48, 326, 442, 325, 98, 997,
157443 /* 1580 */ 470, 287, 250, 250, 448, 1009, 407, 472, 552, 339,
157444 /* 1590 */ 250, 304, 554, 879, 878, 331, 108, 555, 98, 4,
157445 /* 1600 */ 1277, 494, 532, 345, 247, 867, 98, 531, 341, 886,
157446 /* 1610 */ 887, 1126, 1076, 558, 1076, 448, 1065, 1015, 1061, 953,
157447 /* 1620 */ 343, 247, 250, 106, 106, 1291, 917, 1276, 850, 110,
157448 /* 1630 */ 107, 144, 442, 565, 564, 918, 442, 1005, 110, 1275,
157449 /* 1640 */ 350, 360, 1009, 1331, 1352, 299, 1399, 1577, 552, 1327,
157450 /* 1650 */ 1552, 550, 1338, 549, 1405, 1256, 1248, 1237, 1236, 1238,
157451 /* 1660 */ 1571, 489, 265, 200, 1324, 363, 365, 367, 11, 1005,
157452 /* 1670 */ 1005, 1007, 1008, 27, 390, 221, 1386, 1015, 280, 1391,
157453 /* 1680 */ 1381, 208, 323, 106, 106, 924, 1374, 453, 283, 324,
157454 /* 1690 */ 107, 474, 442, 565, 564, 1390, 499, 1005, 212, 288,
157455 /* 1700 */ 1274, 397, 353, 108, 555, 195, 4, 1464, 369, 1463,
157456 /* 1710 */ 1574, 1215, 1212, 329, 553, 171, 207, 383, 1511, 196,
157457 /* 1720 */ 558, 254, 1509, 415, 100, 555, 83, 4, 204, 1005,
157458 /* 1730 */ 1005, 1007, 1008, 27, 219, 79, 82, 1469, 180, 166,
157459 /* 1740 */ 173, 558, 458, 442, 175, 176, 177, 178, 35, 1387,
157460 /* 1750 */ 492, 459, 231, 1395, 96, 552, 1393, 1392, 395, 184,
157461 /* 1760 */ 481, 466, 36, 235, 442, 89, 398, 266, 487, 1480,
157462 /* 1770 */ 1458, 237, 188, 338, 508, 429, 552, 490, 400, 238,
157463 /* 1780 */ 334, 1239, 239, 1294, 1015, 1293, 1292, 1285, 91, 871,
157464 /* 1790 */ 106, 106, 213, 431, 1588, 432, 524, 107, 517, 442,
157465 /* 1800 */ 565, 564, 401, 1264, 1005, 1015, 1263, 1587, 352, 1262,
157466 /* 1810 */ 1557, 106, 106, 1586, 1284, 297, 298, 358, 107, 1335,
157467 /* 1820 */ 442, 565, 564, 95, 362, 1005, 253, 252, 435, 125,
157468 /* 1830 */ 543, 10, 1444, 1543, 377, 1542, 1005, 1005, 1007, 1008,
157469 /* 1840 */ 27, 302, 102, 97, 527, 1336, 260, 1317, 364, 1245,
157470 /* 1850 */ 1334, 34, 566, 1171, 366, 381, 375, 1005, 1005, 1007,
157471 /* 1860 */ 1008, 27, 1333, 1359, 368, 1316, 199, 382, 261, 263,
157472 /* 1870 */ 264, 1358, 158, 1496, 141, 1497, 1495, 567, 1234, 1229,
157473 /* 1880 */ 1494, 295, 159, 209, 210, 78, 826, 443, 201, 306,
157474 /* 1890 */ 220, 1075, 138, 1073, 160, 314, 162, 172, 1196, 174,
157475 /* 1900 */ 903, 227, 230, 322, 1089, 179, 163, 164, 418, 85,
157476 /* 1910 */ 420, 181, 170, 408, 409, 86, 87, 165, 88, 1092,
157477 /* 1920 */ 232, 233, 1088, 151, 18, 234, 1081, 250, 333, 185,
157478 /* 1930 */ 1209, 486, 236, 186, 37, 841, 491, 354, 240, 346,
157479 /* 1940 */ 503, 187, 90, 167, 19, 495, 20, 869, 500, 349,
157480 /* 1950 */ 92, 882, 296, 152, 93, 510, 1127, 1159, 153, 1041,
157481 /* 1960 */ 214, 1128, 39, 94, 269, 271, 952, 190, 947, 110,
157482 /* 1970 */ 1149, 1145, 1153, 249, 1133, 1147, 7, 33, 21, 193,
157483 /* 1980 */ 22, 23, 24, 25, 1152, 539, 98, 1056, 26, 1042,
157484 /* 1990 */ 1040, 1044, 1098, 1045, 1097, 256, 255, 28, 40, 387,
157485 /* 2000 */ 1010, 851, 109, 29, 1167, 559, 384, 257, 913, 258,
157486 /* 2010 */ 1166, 1579, 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1578,
157487 };
157488 static const YYCODETYPE yy_lookahead[] = {
157489 /* 0 */ 191, 220, 191, 222, 191, 191, 271, 272, 273, 216,
157490 /* 10 */ 191, 230, 216, 191, 191, 191, 271, 272, 273, 19,
157491 /* 20 */ 232, 233, 213, 214, 213, 214, 202, 292, 202, 232,
157492 /* 30 */ 233, 31, 213, 214, 213, 213, 214, 213, 214, 39,
157493 /* 40 */ 207, 208, 209, 43, 44, 45, 46, 47, 48, 49,
157494 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 235, 19,
157495 /* 60 */ 236, 237, 236, 237, 271, 272, 273, 271, 272, 273,
157496 /* 70 */ 191, 210, 250, 249, 250, 249, 213, 191, 199, 253,
157497 /* 80 */ 254, 259, 203, 43, 44, 45, 46, 47, 48, 49,
157498 /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 191, 213,
157499 /* 100 */ 214, 213, 102, 103, 104, 105, 106, 107, 108, 109,
157500 /* 110 */ 110, 111, 112, 59, 228, 301, 293, 81, 305, 306,
157501 /* 120 */ 311, 312, 311, 310, 313, 59, 86, 212, 88, 19,
157502 /* 130 */ 311, 312, 271, 272, 273, 220, 26, 112, 54, 55,
157503 /* 140 */ 56, 57, 102, 103, 104, 105, 106, 107, 108, 109,
157504 /* 150 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
157505 /* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 191, 115,
157506 /* 170 */ 116, 117, 118, 137, 138, 121, 122, 123, 191, 69,
157507 /* 180 */ 203, 115, 116, 117, 59, 131, 102, 103, 104, 105,
157508 /* 190 */ 106, 107, 108, 109, 110, 111, 112, 72, 191, 19,
157509 /* 200 */ 54, 55, 56, 57, 58, 108, 109, 110, 111, 112,
157510 /* 210 */ 303, 304, 102, 103, 104, 105, 106, 107, 108, 109,
157511 /* 220 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49,
157512 /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 16,
157513 /* 240 */ 115, 116, 117, 24, 16, 227, 202, 67, 102, 103,
157514 /* 250 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 59,
157515 /* 260 */ 26, 191, 43, 44, 45, 46, 47, 48, 49, 50,
157516 /* 270 */ 51, 52, 53, 54, 55, 56, 57, 24, 208, 209,
157517 /* 280 */ 236, 237, 102, 103, 104, 105, 106, 107, 108, 109,
157518 /* 290 */ 110, 111, 112, 249, 183, 184, 185, 186, 187, 188,
157519 /* 300 */ 77, 59, 79, 191, 193, 77, 195, 79, 19, 19,
157520 /* 310 */ 266, 304, 59, 202, 24, 115, 116, 117, 191, 127,
157521 /* 320 */ 128, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157522 /* 330 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
157523 /* 340 */ 51, 52, 53, 54, 55, 56, 57, 236, 237, 191,
157524 /* 350 */ 150, 281, 191, 185, 186, 187, 188, 115, 116, 117,
157525 /* 360 */ 249, 193, 191, 195, 26, 73, 59, 191, 114, 116,
157526 /* 370 */ 202, 213, 214, 81, 263, 106, 107, 108, 109, 110,
157527 /* 380 */ 111, 112, 148, 160, 142, 95, 228, 191, 191, 213,
157528 /* 390 */ 214, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157529 /* 400 */ 111, 112, 112, 149, 236, 237, 295, 100, 118, 119,
157530 /* 410 */ 120, 121, 122, 123, 124, 19, 31, 249, 126, 23,
157531 /* 420 */ 130, 260, 115, 116, 39, 22, 250, 120, 191, 137,
157532 /* 430 */ 138, 263, 305, 306, 238, 259, 265, 310, 149, 43,
157533 /* 440 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
157534 /* 450 */ 54, 55, 56, 57, 191, 117, 191, 210, 19, 152,
157535 /* 460 */ 153, 154, 23, 295, 102, 103, 104, 105, 106, 107,
157536 /* 470 */ 108, 109, 110, 111, 112, 266, 213, 214, 213, 214,
157537 /* 480 */ 142, 81, 43, 44, 45, 46, 47, 48, 49, 50,
157538 /* 490 */ 51, 52, 53, 54, 55, 56, 57, 301, 102, 103,
157539 /* 500 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 106,
157540 /* 510 */ 107, 118, 59, 250, 121, 122, 123, 280, 76, 119,
157541 /* 520 */ 236, 237, 259, 306, 131, 72, 59, 310, 19, 87,
157542 /* 530 */ 283, 89, 23, 249, 92, 288, 22, 137, 138, 22,
157543 /* 540 */ 275, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157544 /* 550 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50,
157545 /* 560 */ 51, 52, 53, 54, 55, 56, 57, 19, 115, 116,
157546 /* 570 */ 117, 23, 186, 59, 188, 108, 59, 241, 191, 193,
157547 /* 580 */ 26, 195, 115, 116, 117, 191, 144, 251, 202, 22,
157548 /* 590 */ 100, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157549 /* 600 */ 52, 53, 54, 55, 56, 57, 116, 213, 214, 191,
157550 /* 610 */ 120, 102, 103, 104, 105, 106, 107, 108, 109, 110,
157551 /* 620 */ 111, 112, 236, 237, 306, 238, 59, 26, 310, 115,
157552 /* 630 */ 116, 117, 115, 116, 117, 249, 246, 19, 248, 106,
157553 /* 640 */ 107, 23, 152, 153, 154, 46, 47, 48, 49, 263,
157554 /* 650 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157555 /* 660 */ 112, 43, 44, 45, 46, 47, 48, 49, 50, 51,
157556 /* 670 */ 52, 53, 54, 55, 56, 57, 19, 76, 298, 299,
157557 /* 680 */ 23, 295, 115, 116, 117, 152, 191, 154, 301, 73,
157558 /* 690 */ 89, 137, 138, 92, 22, 191, 144, 22, 191, 191,
157559 /* 700 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
157560 /* 710 */ 53, 54, 55, 56, 57, 163, 191, 213, 214, 120,
157561 /* 720 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157562 /* 730 */ 112, 59, 228, 191, 59, 191, 236, 237, 213, 214,
157563 /* 740 */ 11, 59, 126, 127, 128, 238, 19, 26, 191, 249,
157564 /* 750 */ 23, 164, 165, 228, 191, 213, 214, 213, 214, 102,
157565 /* 760 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
157566 /* 770 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
157567 /* 780 */ 53, 54, 55, 56, 57, 19, 241, 115, 116, 117,
157568 /* 790 */ 115, 116, 117, 191, 250, 238, 251, 115, 116, 117,
157569 /* 800 */ 157, 23, 159, 191, 26, 191, 111, 112, 301, 43,
157570 /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
157571 /* 820 */ 54, 55, 56, 57, 142, 213, 214, 213, 214, 102,
157572 /* 830 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
157573 /* 840 */ 228, 191, 228, 191, 191, 207, 208, 209, 126, 127,
157574 /* 850 */ 128, 133, 289, 135, 136, 19, 127, 128, 301, 7,
157575 /* 860 */ 8, 9, 141, 213, 214, 213, 214, 265, 102, 103,
157576 /* 870 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 43,
157577 /* 880 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
157578 /* 890 */ 54, 55, 56, 57, 191, 117, 191, 22, 23, 19,
157579 /* 900 */ 250, 26, 250, 191, 223, 191, 126, 127, 128, 205,
157580 /* 910 */ 206, 205, 206, 260, 21, 202, 213, 214, 213, 214,
157581 /* 920 */ 142, 270, 208, 209, 158, 45, 46, 47, 48, 49,
157582 /* 930 */ 50, 51, 52, 53, 54, 55, 56, 57, 102, 103,
157583 /* 940 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 236,
157584 /* 950 */ 237, 12, 191, 250, 76, 250, 191, 22, 23, 308,
157585 /* 960 */ 309, 26, 249, 202, 191, 191, 27, 89, 191, 202,
157586 /* 970 */ 92, 202, 260, 80, 213, 214, 101, 203, 213, 214,
157587 /* 980 */ 22, 42, 102, 103, 104, 105, 106, 107, 108, 109,
157588 /* 990 */ 110, 111, 112, 228, 158, 281, 108, 236, 237, 225,
157589 /* 1000 */ 191, 227, 63, 236, 237, 236, 237, 191, 235, 191,
157590 /* 1010 */ 249, 250, 73, 241, 19, 122, 249, 59, 249, 24,
157591 /* 1020 */ 259, 29, 134, 251, 191, 33, 22, 139, 24, 213,
157592 /* 1030 */ 214, 213, 214, 191, 19, 210, 101, 191, 43, 44,
157593 /* 1040 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
157594 /* 1050 */ 55, 56, 57, 160, 19, 213, 214, 65, 43, 44,
157595 /* 1060 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
157596 /* 1070 */ 55, 56, 57, 191, 116, 22, 191, 24, 43, 44,
157597 /* 1080 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
157598 /* 1090 */ 55, 56, 57, 191, 261, 213, 214, 102, 103, 104,
157599 /* 1100 */ 105, 106, 107, 108, 109, 110, 111, 112, 59, 19,
157600 /* 1110 */ 191, 265, 59, 288, 191, 213, 214, 102, 103, 104,
157601 /* 1120 */ 105, 106, 107, 108, 109, 110, 111, 112, 35, 191,
157602 /* 1130 */ 66, 191, 213, 214, 191, 270, 46, 102, 103, 104,
157603 /* 1140 */ 105, 106, 107, 108, 109, 110, 111, 112, 191, 85,
157604 /* 1150 */ 265, 213, 214, 213, 214, 106, 107, 19, 94, 66,
157605 /* 1160 */ 137, 138, 191, 114, 115, 116, 117, 74, 119, 116,
157606 /* 1170 */ 213, 214, 202, 308, 309, 306, 127, 191, 235, 310,
157607 /* 1180 */ 59, 191, 44, 45, 46, 47, 48, 49, 50, 51,
157608 /* 1190 */ 52, 53, 54, 55, 56, 57, 191, 76, 196, 213,
157609 /* 1200 */ 214, 152, 12, 154, 114, 191, 236, 237, 87, 145,
157610 /* 1210 */ 89, 19, 20, 92, 22, 22, 23, 27, 191, 249,
157611 /* 1220 */ 130, 202, 129, 202, 191, 235, 306, 152, 36, 154,
157612 /* 1230 */ 310, 191, 42, 191, 191, 191, 115, 116, 117, 191,
157613 /* 1240 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
157614 /* 1250 */ 112, 59, 99, 63, 191, 236, 237, 236, 237, 191,
157615 /* 1260 */ 289, 213, 214, 71, 191, 144, 261, 191, 249, 191,
157616 /* 1270 */ 249, 19, 20, 81, 22, 235, 213, 214, 235, 191,
157617 /* 1280 */ 278, 213, 214, 191, 282, 132, 213, 214, 36, 213,
157618 /* 1290 */ 214, 191, 100, 191, 101, 191, 191, 191, 106, 107,
157619 /* 1300 */ 48, 213, 214, 261, 191, 113, 191, 115, 116, 117,
157620 /* 1310 */ 191, 59, 120, 213, 214, 213, 214, 213, 214, 213,
157621 /* 1320 */ 214, 22, 23, 71, 237, 59, 213, 214, 191, 137,
157622 /* 1330 */ 138, 191, 213, 214, 191, 191, 249, 85, 191, 261,
157623 /* 1340 */ 191, 26, 90, 15, 152, 153, 154, 155, 156, 19,
157624 /* 1350 */ 213, 214, 100, 213, 214, 191, 213, 214, 106, 107,
157625 /* 1360 */ 213, 214, 213, 214, 191, 113, 261, 115, 116, 117,
157626 /* 1370 */ 253, 254, 120, 229, 191, 191, 191, 213, 214, 191,
157627 /* 1380 */ 306, 289, 116, 26, 310, 191, 213, 214, 60, 19,
157628 /* 1390 */ 296, 297, 24, 191, 46, 191, 213, 214, 213, 214,
157629 /* 1400 */ 101, 213, 214, 191, 152, 153, 154, 155, 156, 0,
157630 /* 1410 */ 1, 2, 191, 229, 5, 213, 214, 213, 214, 10,
157631 /* 1420 */ 11, 12, 13, 14, 1, 2, 17, 191, 5, 19,
157632 /* 1430 */ 20, 191, 22, 10, 11, 12, 13, 14, 191, 30,
157633 /* 1440 */ 17, 32, 241, 148, 149, 115, 36, 191, 241, 40,
157634 /* 1450 */ 191, 26, 251, 30, 191, 32, 141, 22, 251, 5,
157635 /* 1460 */ 213, 214, 114, 40, 10, 11, 12, 13, 14, 59,
157636 /* 1470 */ 134, 17, 213, 214, 191, 139, 213, 214, 191, 70,
157637 /* 1480 */ 191, 71, 125, 191, 30, 115, 32, 78, 53, 191,
157638 /* 1490 */ 81, 191, 191, 70, 40, 85, 213, 214, 191, 22,
157639 /* 1500 */ 90, 78, 213, 214, 81, 213, 214, 98, 140, 120,
157640 /* 1510 */ 100, 213, 214, 213, 214, 23, 106, 107, 26, 130,
157641 /* 1520 */ 191, 98, 191, 113, 70, 115, 116, 117, 23, 22,
157642 /* 1530 */ 120, 26, 78, 19, 191, 81, 19, 20, 61, 22,
157643 /* 1540 */ 191, 132, 213, 214, 213, 214, 137, 138, 59, 191,
157644 /* 1550 */ 191, 191, 98, 36, 128, 132, 213, 214, 128, 59,
157645 /* 1560 */ 137, 138, 152, 153, 154, 155, 156, 83, 84, 144,
157646 /* 1570 */ 161, 213, 214, 213, 214, 23, 59, 151, 26, 23,
157647 /* 1580 */ 23, 151, 26, 26, 161, 59, 132, 23, 71, 191,
157648 /* 1590 */ 26, 137, 138, 119, 120, 23, 19, 20, 26, 22,
157649 /* 1600 */ 223, 23, 85, 23, 26, 116, 26, 90, 191, 7,
157650 /* 1610 */ 8, 97, 152, 36, 154, 161, 116, 100, 23, 23,
157651 /* 1620 */ 191, 26, 26, 106, 107, 191, 23, 223, 23, 26,
157652 /* 1630 */ 113, 26, 115, 116, 117, 23, 59, 120, 26, 191,
157653 /* 1640 */ 191, 191, 116, 255, 191, 252, 191, 140, 71, 191,
157654 /* 1650 */ 315, 233, 191, 191, 191, 191, 191, 191, 191, 191,
157655 /* 1660 */ 191, 285, 284, 239, 252, 252, 252, 252, 240, 152,
157656 /* 1670 */ 153, 154, 155, 156, 189, 294, 268, 100, 242, 268,
157657 /* 1680 */ 264, 211, 290, 106, 107, 108, 264, 256, 256, 243,
157658 /* 1690 */ 113, 290, 115, 116, 117, 268, 217, 120, 226, 243,
157659 /* 1700 */ 222, 268, 216, 19, 20, 246, 22, 216, 256, 216,
157660 /* 1710 */ 194, 60, 38, 242, 277, 294, 240, 242, 198, 246,
157661 /* 1720 */ 36, 140, 198, 198, 19, 20, 150, 22, 149, 152,
157662 /* 1730 */ 153, 154, 155, 156, 294, 291, 291, 280, 22, 43,
157663 /* 1740 */ 231, 36, 18, 59, 234, 234, 234, 234, 267, 269,
157664 /* 1750 */ 18, 198, 197, 231, 148, 71, 269, 269, 243, 231,
157665 /* 1760 */ 198, 243, 267, 197, 59, 157, 243, 198, 62, 287,
157666 /* 1770 */ 243, 197, 22, 198, 114, 64, 71, 218, 218, 197,
157667 /* 1780 */ 286, 198, 197, 215, 100, 215, 215, 224, 22, 125,
157668 /* 1790 */ 106, 107, 164, 24, 221, 112, 143, 113, 302, 115,
157669 /* 1800 */ 116, 117, 218, 215, 120, 100, 217, 221, 215, 215,
157670 /* 1810 */ 309, 106, 107, 215, 224, 279, 279, 218, 113, 258,
157671 /* 1820 */ 115, 116, 117, 114, 257, 120, 91, 198, 82, 147,
157672 /* 1830 */ 144, 22, 274, 314, 198, 314, 152, 153, 154, 155,
157673 /* 1840 */ 156, 276, 157, 146, 145, 258, 25, 247, 257, 201,
157674 /* 1850 */ 258, 26, 200, 13, 257, 244, 246, 152, 153, 154,
157675 /* 1860 */ 155, 156, 258, 262, 257, 247, 245, 243, 192, 192,
157676 /* 1870 */ 6, 262, 204, 210, 219, 210, 210, 190, 190, 190,
157677 /* 1880 */ 210, 219, 204, 211, 211, 210, 4, 3, 22, 162,
157678 /* 1890 */ 15, 23, 16, 23, 204, 138, 129, 150, 26, 141,
157679 /* 1900 */ 20, 24, 143, 16, 1, 141, 129, 129, 61, 53,
157680 /* 1910 */ 37, 150, 297, 300, 300, 53, 53, 129, 53, 115,
157681 /* 1920 */ 34, 140, 1, 5, 22, 114, 68, 26, 160, 68,
157682 /* 1930 */ 75, 41, 140, 114, 24, 20, 19, 130, 124, 23,
157683 /* 1940 */ 96, 22, 22, 37, 22, 67, 22, 59, 67, 24,
157684 /* 1950 */ 22, 28, 67, 23, 148, 22, 97, 23, 23, 23,
157685 /* 1960 */ 140, 23, 22, 26, 23, 23, 115, 22, 142, 26,
157686 /* 1970 */ 75, 88, 75, 34, 23, 86, 44, 22, 34, 26,
157687 /* 1980 */ 34, 34, 34, 34, 93, 24, 26, 23, 34, 23,
157688 /* 1990 */ 23, 23, 23, 11, 23, 22, 26, 22, 22, 15,
157689 /* 2000 */ 23, 23, 22, 22, 1, 26, 23, 140, 134, 140,
157690 /* 2010 */ 1, 140, 316, 316, 316, 316, 316, 316, 316, 140,
157691 /* 2020 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157692 /* 2030 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157693 /* 2040 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157694 /* 2050 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157695 /* 2060 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157696 /* 2070 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157697 /* 2080 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157698 /* 2090 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157699 /* 2100 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157700 /* 2110 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157701 /* 2120 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157702 /* 2130 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157703 /* 2140 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157704 /* 2150 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157705 /* 2160 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157706 /* 2170 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157707 /* 2180 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157708 /* 2190 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
157709 /* 2200 */ 316, 316, 316,
157710 };
157711 #define YY_SHIFT_COUNT (569)
157712 #define YY_SHIFT_MIN (0)
157713 #define YY_SHIFT_MAX (2009)
157714 static const unsigned short int yy_shift_ofst[] = {
157715 /* 0 */ 1423, 1409, 1454, 1192, 1192, 36, 1252, 1410, 1517, 1684,
157716 /* 10 */ 1684, 1684, 292, 0, 0, 180, 1015, 1684, 1684, 1684,
157717 /* 20 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
157718 /* 30 */ 1049, 1049, 1121, 1121, 54, 400, 36, 36, 36, 36,
157719 /* 40 */ 36, 40, 110, 219, 289, 396, 439, 509, 548, 618,
157720 /* 50 */ 657, 727, 766, 836, 995, 1015, 1015, 1015, 1015, 1015,
157721 /* 60 */ 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015,
157722 /* 70 */ 1015, 1015, 1015, 1035, 1015, 1138, 880, 880, 1577, 1684,
157723 /* 80 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
157724 /* 90 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
157725 /* 100 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684,
157726 /* 110 */ 1684, 1684, 1684, 1705, 1684, 1684, 1684, 1684, 1684, 1684,
157727 /* 120 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 146, 84, 84,
157728 /* 130 */ 84, 84, 84, 362, 269, 125, 97, 453, 66, 66,
157729 /* 140 */ 893, 1090, 66, 66, 533, 533, 66, 554, 554, 554,
157730 /* 150 */ 554, 192, 587, 587, 695, 25, 2020, 2020, 290, 290,
157731 /* 160 */ 290, 200, 514, 514, 514, 514, 939, 939, 442, 875,
157732 /* 170 */ 935, 66, 66, 66, 66, 66, 66, 66, 66, 66,
157733 /* 180 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
157734 /* 190 */ 66, 601, 601, 66, 729, 878, 878, 1266, 1266, 552,
157735 /* 200 */ 1023, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 307, 490,
157736 /* 210 */ 490, 567, 393, 517, 467, 672, 242, 682, 675, 66,
157737 /* 220 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 616,
157738 /* 230 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
157739 /* 240 */ 66, 66, 1093, 1093, 1093, 66, 66, 66, 778, 66,
157740 /* 250 */ 66, 66, 1053, 1064, 66, 66, 1190, 66, 66, 66,
157741 /* 260 */ 66, 66, 66, 66, 66, 722, 992, 718, 253, 253,
157742 /* 270 */ 253, 253, 338, 718, 718, 888, 403, 852, 1328, 254,
157743 /* 280 */ 1295, 721, 1330, 1295, 1330, 1370, 234, 254, 254, 234,
157744 /* 290 */ 254, 721, 1370, 1357, 1492, 1348, 385, 385, 385, 1330,
157745 /* 300 */ 1425, 1425, 643, 1315, 1336, 1004, 1651, 1651, 1581, 1581,
157746 /* 310 */ 1674, 1674, 1581, 1576, 1579, 1716, 1696, 1724, 1724, 1724,
157747 /* 320 */ 1724, 1581, 1732, 1606, 1579, 1579, 1606, 1716, 1696, 1606,
157748 /* 330 */ 1696, 1606, 1581, 1732, 1608, 1706, 1581, 1732, 1750, 1581,
157749 /* 340 */ 1732, 1581, 1732, 1750, 1660, 1660, 1660, 1711, 1766, 1766,
157750 /* 350 */ 1750, 1660, 1664, 1660, 1711, 1660, 1660, 1628, 1769, 1683,
157751 /* 360 */ 1683, 1750, 1653, 1709, 1653, 1709, 1653, 1709, 1653, 1709,
157752 /* 370 */ 1581, 1735, 1735, 1746, 1746, 1682, 1686, 1809, 1581, 1685,
157753 /* 380 */ 1682, 1697, 1699, 1606, 1821, 1825, 1840, 1840, 1864, 1864,
157754 /* 390 */ 1864, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020, 2020,
157755 /* 400 */ 2020, 2020, 2020, 2020, 2020, 2020, 599, 223, 1193, 1299,
157756 /* 410 */ 228, 780, 958, 1505, 1153, 1435, 1368, 1426, 1430, 1552,
157757 /* 420 */ 1477, 1556, 1557, 1564, 1572, 1578, 1580, 1489, 1474, 1602,
157758 /* 430 */ 1389, 1514, 1500, 1595, 1596, 1484, 1603, 1075, 1460, 1605,
157759 /* 440 */ 1612, 1526, 1507, 1882, 1884, 1866, 1727, 1875, 1876, 1868,
157760 /* 450 */ 1870, 1757, 1747, 1767, 1872, 1872, 1877, 1758, 1880, 1759,
157761 /* 460 */ 1887, 1903, 1764, 1777, 1872, 1778, 1847, 1873, 1872, 1761,
157762 /* 470 */ 1856, 1862, 1863, 1865, 1788, 1804, 1886, 1781, 1921, 1918,
157763 /* 480 */ 1902, 1811, 1768, 1858, 1901, 1861, 1855, 1890, 1792, 1819,
157764 /* 490 */ 1910, 1915, 1917, 1807, 1814, 1919, 1878, 1920, 1922, 1916,
157765 /* 500 */ 1924, 1881, 1888, 1925, 1844, 1923, 1928, 1885, 1906, 1930,
157766 /* 510 */ 1806, 1933, 1934, 1935, 1936, 1937, 1938, 1940, 1859, 1820,
157767 /* 520 */ 1941, 1942, 1851, 1939, 1945, 1826, 1943, 1944, 1946, 1947,
157768 /* 530 */ 1948, 1883, 1895, 1889, 1932, 1897, 1891, 1949, 1951, 1955,
157769 /* 540 */ 1961, 1953, 1960, 1954, 1964, 1943, 1966, 1967, 1968, 1969,
157770 /* 550 */ 1970, 1971, 1973, 1982, 1975, 1976, 1977, 1978, 1980, 1981,
157771 /* 560 */ 1979, 1874, 1867, 1869, 1871, 1879, 1983, 1984, 2003, 2009,
157772 };
157773 #define YY_REDUCE_COUNT (405)
157774 #define YY_REDUCE_MIN (-265)
157775 #define YY_REDUCE_MAX (1690)
 
157776 static const short yy_reduce_ofst[] = {
157777 /* 0 */ 111, 168, 386, 761, -176, -174, -191, -189, -181, -178,
157778 /* 10 */ 176, 263, 44, -207, -204, -265, -139, -114, 158, 504,
157779 /* 20 */ 525, 544, 612, 614, 650, 652, 765, 265, 703, 705,
157780 /* 30 */ 70, 714, -187, 127, 774, 713, 767, 769, 970, 1019,
157781 /* 40 */ 1021, -255, -255, -255, -255, -255, -255, -255, -255, -255,
157782 /* 50 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
157783 /* 60 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
157784 /* 70 */ -255, -255, -255, -255, -255, -255, -255, -255, 394, 542,
157785 /* 80 */ 816, 818, 842, 882, 902, 919, 938, 940, 957, 986,
157786 /* 90 */ 1048, 1063, 1068, 1073, 1076, 1088, 1100, 1102, 1104, 1106,
157787 /* 100 */ 1113, 1119, 1137, 1140, 1143, 1147, 1149, 1164, 1173, 1183,
157788 /* 110 */ 1185, 1188, 1202, 1204, 1247, 1259, 1263, 1283, 1289, 1292,
157789 /* 120 */ 1298, 1300, 1329, 1331, 1343, 1358, 1360, -255, -255, -255,
157790 /* 130 */ -255, -255, -255, -255, -255, 196, -255, 387, -177, 507,
157791 /* 140 */ 1002, -219, 557, -93, -167, 638, -121, 284, 500, 284,
157792 /* 150 */ 500, 247, 651, 865, -255, -255, -255, -255, -85, -85,
157793 /* 160 */ -85, 237, 171, 602, 846, 885, -212, -203, 217, 380,
157794 /* 170 */ 380, -23, 161, 653, 712, 773, 943, 990, 1040, 563,
157795 /* 180 */ 833, 971, 1005, 1042, 1092, 1078, 1043, 1144, 1184, -186,
157796 /* 190 */ 1105, 318, 869, 7, 825, 920, 1074, 704, 706, 390,
157797 /* 200 */ 1087, 1094, 336, 545, 772, 1201, 1117, 1207, -179, -137,
157798 /* 210 */ -112, -13, 18, 112, 197, 418, 495, 508, 777, 809,
157799 /* 220 */ 923, 1014, 1027, 1033, 1044, 1115, 1194, 1212, 1221, 209,
157800 /* 230 */ 1236, 1240, 1256, 1287, 1301, 1307, 1349, 1359, 1398, 1417,
157801 /* 240 */ 1429, 1434, 681, 1377, 1404, 1448, 1449, 1450, 1388, 1453,
157802 /* 250 */ 1455, 1458, 1393, 1335, 1461, 1462, 1418, 1463, 197, 1464,
157803 /* 260 */ 1465, 1466, 1467, 1468, 1469, 1376, 1378, 1424, 1412, 1413,
157804 /* 270 */ 1414, 1415, 1388, 1424, 1424, 1428, 1470, 1485, 1381, 1408,
157805 /* 280 */ 1416, 1436, 1431, 1422, 1432, 1392, 1446, 1411, 1427, 1456,
157806 /* 290 */ 1433, 1471, 1401, 1479, 1472, 1478, 1486, 1491, 1493, 1452,
157807 /* 300 */ 1459, 1473, 1437, 1475, 1476, 1516, 1421, 1440, 1520, 1524,
157808 /* 310 */ 1444, 1445, 1525, 1457, 1480, 1481, 1509, 1510, 1511, 1512,
157809 /* 320 */ 1513, 1553, 1555, 1515, 1487, 1488, 1518, 1495, 1522, 1523,
157810 /* 330 */ 1528, 1527, 1562, 1566, 1482, 1494, 1569, 1574, 1559, 1575,
157811 /* 340 */ 1582, 1583, 1585, 1560, 1568, 1570, 1571, 1563, 1573, 1586,
157812 /* 350 */ 1584, 1588, 1589, 1593, 1590, 1594, 1598, 1501, 1496, 1536,
157813 /* 360 */ 1537, 1599, 1561, 1567, 1587, 1591, 1592, 1597, 1604, 1607,
157814 /* 370 */ 1629, 1519, 1521, 1601, 1609, 1600, 1610, 1558, 1636, 1565,
157815 /* 380 */ 1618, 1621, 1611, 1624, 1648, 1652, 1676, 1677, 1687, 1688,
157816 /* 390 */ 1689, 1613, 1614, 1615, 1668, 1663, 1665, 1666, 1670, 1678,
157817 /* 400 */ 1655, 1662, 1672, 1673, 1675, 1690,
157818 };
157819 static const YYACTIONTYPE yy_default[] = {
157820 /* 0 */ 1623, 1623, 1623, 1453, 1223, 1332, 1223, 1223, 1223, 1453,
157821 /* 10 */ 1453, 1453, 1223, 1362, 1362, 1506, 1254, 1223, 1223, 1223,
157822 /* 20 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1452, 1223, 1223,
157823 /* 30 */ 1223, 1223, 1541, 1541, 1223, 1223, 1223, 1223, 1223, 1223,
157824 /* 40 */ 1223, 1223, 1371, 1223, 1378, 1223, 1223, 1223, 1223, 1223,
157825 /* 50 */ 1454, 1455, 1223, 1223, 1223, 1505, 1507, 1470, 1385, 1384,
157826 /* 60 */ 1383, 1382, 1488, 1349, 1376, 1369, 1373, 1448, 1449, 1447,
157827 /* 70 */ 1451, 1455, 1454, 1223, 1372, 1419, 1433, 1418, 1223, 1223,
157828 /* 80 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157829 /* 90 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157830 /* 100 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157831 /* 110 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157832 /* 120 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1427, 1432, 1438,
157833 /* 130 */ 1431, 1428, 1421, 1420, 1422, 1223, 1423, 1223, 1223, 1223,
157834 /* 140 */ 1244, 1296, 1223, 1223, 1223, 1223, 1223, 1525, 1524, 1223,
157835 /* 150 */ 1223, 1254, 1413, 1412, 1424, 1425, 1435, 1434, 1513, 1576,
157836 /* 160 */ 1575, 1471, 1223, 1223, 1223, 1223, 1223, 1223, 1541, 1223,
157837 /* 170 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157838 /* 180 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157839 /* 190 */ 1223, 1541, 1541, 1223, 1254, 1541, 1541, 1250, 1250, 1356,
157840 /* 200 */ 1223, 1520, 1323, 1323, 1323, 1323, 1332, 1323, 1223, 1223,
157841 /* 210 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157842 /* 220 */ 1223, 1223, 1223, 1510, 1508, 1223, 1223, 1223, 1223, 1223,
157843 /* 230 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157844 /* 240 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157845 /* 250 */ 1223, 1223, 1328, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157846 /* 260 */ 1223, 1223, 1223, 1223, 1570, 1223, 1483, 1310, 1328, 1328,
157847 /* 270 */ 1328, 1328, 1330, 1311, 1309, 1322, 1255, 1230, 1615, 1388,
157848 /* 280 */ 1377, 1329, 1351, 1377, 1351, 1612, 1375, 1388, 1388, 1375,
157849 /* 290 */ 1388, 1329, 1612, 1271, 1592, 1266, 1362, 1362, 1362, 1351,
157850 /* 300 */ 1356, 1356, 1450, 1329, 1322, 1223, 1615, 1615, 1337, 1337,
157851 /* 310 */ 1614, 1614, 1337, 1471, 1599, 1397, 1299, 1305, 1305, 1305,
157852 /* 320 */ 1305, 1337, 1241, 1375, 1599, 1599, 1375, 1397, 1299, 1375,
157853 /* 330 */ 1299, 1375, 1337, 1241, 1487, 1609, 1337, 1241, 1461, 1337,
157854 /* 340 */ 1241, 1337, 1241, 1461, 1297, 1297, 1297, 1286, 1223, 1223,
157855 /* 350 */ 1461, 1297, 1271, 1297, 1286, 1297, 1297, 1559, 1223, 1465,
157856 /* 360 */ 1465, 1461, 1355, 1350, 1355, 1350, 1355, 1350, 1355, 1350,
157857 /* 370 */ 1337, 1551, 1551, 1365, 1365, 1370, 1356, 1456, 1337, 1223,
157858 /* 380 */ 1370, 1368, 1366, 1375, 1247, 1289, 1573, 1573, 1569, 1569,
157859 /* 390 */ 1569, 1620, 1620, 1520, 1585, 1254, 1254, 1254, 1254, 1585,
157860 /* 400 */ 1273, 1273, 1255, 1255, 1254, 1585, 1223, 1223, 1223, 1223,
157861 /* 410 */ 1223, 1223, 1580, 1223, 1515, 1472, 1341, 1223, 1223, 1223,
157862 /* 420 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157863 /* 430 */ 1223, 1526, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157864 /* 440 */ 1223, 1223, 1402, 1223, 1226, 1517, 1223, 1223, 1223, 1223,
157865 /* 450 */ 1223, 1223, 1223, 1223, 1379, 1380, 1342, 1223, 1223, 1223,
157866 /* 460 */ 1223, 1223, 1223, 1223, 1394, 1223, 1223, 1223, 1389, 1223,
157867 /* 470 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1611, 1223, 1223,
157868 /* 480 */ 1223, 1223, 1223, 1223, 1486, 1485, 1223, 1223, 1339, 1223,
157869 /* 490 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157870 /* 500 */ 1223, 1223, 1269, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157871 /* 510 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157872 /* 520 */ 1223, 1223, 1223, 1223, 1223, 1223, 1367, 1223, 1223, 1223,
157873 /* 530 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157874 /* 540 */ 1223, 1556, 1357, 1223, 1223, 1602, 1223, 1223, 1223, 1223,
157875 /* 550 */ 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223, 1223,
157876 /* 560 */ 1596, 1313, 1404, 1223, 1403, 1407, 1223, 1235, 1223, 1223,
 
157877 };
157878 /********** End of lemon-generated parsing tables *****************************/
157879
157880 /* The next table maps tokens (terminal symbols) into fallback tokens.
157881 ** If a construct like the following:
@@ -157543,10 +157988,11 @@
157988 59, /* GROUPS => ID */
157989 59, /* OTHERS => ID */
157990 59, /* TIES => ID */
157991 59, /* GENERATED => ID */
157992 59, /* ALWAYS => ID */
157993 59, /* MATERIALIZED => ID */
157994 59, /* REINDEX => ID */
157995 59, /* RENAME => ID */
157996 59, /* CTIME_KW => ID */
157997 0, /* ANY => nothing */
157998 0, /* BITAND => nothing */
@@ -157813,226 +158259,229 @@
158259 /* 92 */ "GROUPS",
158260 /* 93 */ "OTHERS",
158261 /* 94 */ "TIES",
158262 /* 95 */ "GENERATED",
158263 /* 96 */ "ALWAYS",
158264 /* 97 */ "MATERIALIZED",
158265 /* 98 */ "REINDEX",
158266 /* 99 */ "RENAME",
158267 /* 100 */ "CTIME_KW",
158268 /* 101 */ "ANY",
158269 /* 102 */ "BITAND",
158270 /* 103 */ "BITOR",
158271 /* 104 */ "LSHIFT",
158272 /* 105 */ "RSHIFT",
158273 /* 106 */ "PLUS",
158274 /* 107 */ "MINUS",
158275 /* 108 */ "STAR",
158276 /* 109 */ "SLASH",
158277 /* 110 */ "REM",
158278 /* 111 */ "CONCAT",
158279 /* 112 */ "COLLATE",
158280 /* 113 */ "BITNOT",
158281 /* 114 */ "ON",
158282 /* 115 */ "INDEXED",
158283 /* 116 */ "STRING",
158284 /* 117 */ "JOIN_KW",
158285 /* 118 */ "CONSTRAINT",
158286 /* 119 */ "DEFAULT",
158287 /* 120 */ "NULL",
158288 /* 121 */ "PRIMARY",
158289 /* 122 */ "UNIQUE",
158290 /* 123 */ "CHECK",
158291 /* 124 */ "REFERENCES",
158292 /* 125 */ "AUTOINCR",
158293 /* 126 */ "INSERT",
158294 /* 127 */ "DELETE",
158295 /* 128 */ "UPDATE",
158296 /* 129 */ "SET",
158297 /* 130 */ "DEFERRABLE",
158298 /* 131 */ "FOREIGN",
158299 /* 132 */ "DROP",
158300 /* 133 */ "UNION",
158301 /* 134 */ "ALL",
158302 /* 135 */ "EXCEPT",
158303 /* 136 */ "INTERSECT",
158304 /* 137 */ "SELECT",
158305 /* 138 */ "VALUES",
158306 /* 139 */ "DISTINCT",
158307 /* 140 */ "DOT",
158308 /* 141 */ "FROM",
158309 /* 142 */ "JOIN",
158310 /* 143 */ "USING",
158311 /* 144 */ "ORDER",
158312 /* 145 */ "GROUP",
158313 /* 146 */ "HAVING",
158314 /* 147 */ "LIMIT",
158315 /* 148 */ "WHERE",
158316 /* 149 */ "RETURNING",
158317 /* 150 */ "INTO",
158318 /* 151 */ "NOTHING",
158319 /* 152 */ "FLOAT",
158320 /* 153 */ "BLOB",
158321 /* 154 */ "INTEGER",
158322 /* 155 */ "VARIABLE",
158323 /* 156 */ "CASE",
158324 /* 157 */ "WHEN",
158325 /* 158 */ "THEN",
158326 /* 159 */ "ELSE",
158327 /* 160 */ "INDEX",
158328 /* 161 */ "ALTER",
158329 /* 162 */ "ADD",
158330 /* 163 */ "WINDOW",
158331 /* 164 */ "OVER",
158332 /* 165 */ "FILTER",
158333 /* 166 */ "COLUMN",
158334 /* 167 */ "AGG_FUNCTION",
158335 /* 168 */ "AGG_COLUMN",
158336 /* 169 */ "TRUEFALSE",
158337 /* 170 */ "ISNOT",
158338 /* 171 */ "FUNCTION",
158339 /* 172 */ "UMINUS",
158340 /* 173 */ "UPLUS",
158341 /* 174 */ "TRUTH",
158342 /* 175 */ "REGISTER",
158343 /* 176 */ "VECTOR",
158344 /* 177 */ "SELECT_COLUMN",
158345 /* 178 */ "IF_NULL_ROW",
158346 /* 179 */ "ASTERISK",
158347 /* 180 */ "SPAN",
158348 /* 181 */ "SPACE",
158349 /* 182 */ "ILLEGAL",
158350 /* 183 */ "input",
158351 /* 184 */ "cmdlist",
158352 /* 185 */ "ecmd",
158353 /* 186 */ "cmdx",
158354 /* 187 */ "explain",
158355 /* 188 */ "cmd",
158356 /* 189 */ "transtype",
158357 /* 190 */ "trans_opt",
158358 /* 191 */ "nm",
158359 /* 192 */ "savepoint_opt",
158360 /* 193 */ "create_table",
158361 /* 194 */ "create_table_args",
158362 /* 195 */ "createkw",
158363 /* 196 */ "temp",
158364 /* 197 */ "ifnotexists",
158365 /* 198 */ "dbnm",
158366 /* 199 */ "columnlist",
158367 /* 200 */ "conslist_opt",
158368 /* 201 */ "table_options",
158369 /* 202 */ "select",
158370 /* 203 */ "columnname",
158371 /* 204 */ "carglist",
158372 /* 205 */ "typetoken",
158373 /* 206 */ "typename",
158374 /* 207 */ "signed",
158375 /* 208 */ "plus_num",
158376 /* 209 */ "minus_num",
158377 /* 210 */ "scanpt",
158378 /* 211 */ "scantok",
158379 /* 212 */ "ccons",
158380 /* 213 */ "term",
158381 /* 214 */ "expr",
158382 /* 215 */ "onconf",
158383 /* 216 */ "sortorder",
158384 /* 217 */ "autoinc",
158385 /* 218 */ "eidlist_opt",
158386 /* 219 */ "refargs",
158387 /* 220 */ "defer_subclause",
158388 /* 221 */ "generated",
158389 /* 222 */ "refarg",
158390 /* 223 */ "refact",
158391 /* 224 */ "init_deferred_pred_opt",
158392 /* 225 */ "conslist",
158393 /* 226 */ "tconscomma",
158394 /* 227 */ "tcons",
158395 /* 228 */ "sortlist",
158396 /* 229 */ "eidlist",
158397 /* 230 */ "defer_subclause_opt",
158398 /* 231 */ "orconf",
158399 /* 232 */ "resolvetype",
158400 /* 233 */ "raisetype",
158401 /* 234 */ "ifexists",
158402 /* 235 */ "fullname",
158403 /* 236 */ "selectnowith",
158404 /* 237 */ "oneselect",
158405 /* 238 */ "wqlist",
158406 /* 239 */ "multiselect_op",
158407 /* 240 */ "distinct",
158408 /* 241 */ "selcollist",
158409 /* 242 */ "from",
158410 /* 243 */ "where_opt",
158411 /* 244 */ "groupby_opt",
158412 /* 245 */ "having_opt",
158413 /* 246 */ "orderby_opt",
158414 /* 247 */ "limit_opt",
158415 /* 248 */ "window_clause",
158416 /* 249 */ "values",
158417 /* 250 */ "nexprlist",
158418 /* 251 */ "sclp",
158419 /* 252 */ "as",
158420 /* 253 */ "seltablist",
158421 /* 254 */ "stl_prefix",
158422 /* 255 */ "joinop",
158423 /* 256 */ "indexed_opt",
158424 /* 257 */ "on_opt",
158425 /* 258 */ "using_opt",
158426 /* 259 */ "exprlist",
158427 /* 260 */ "xfullname",
158428 /* 261 */ "idlist",
158429 /* 262 */ "nulls",
158430 /* 263 */ "with",
158431 /* 264 */ "where_opt_ret",
158432 /* 265 */ "setlist",
158433 /* 266 */ "insert_cmd",
158434 /* 267 */ "idlist_opt",
158435 /* 268 */ "upsert",
158436 /* 269 */ "returning",
158437 /* 270 */ "filter_over",
158438 /* 271 */ "likeop",
158439 /* 272 */ "between_op",
158440 /* 273 */ "in_op",
158441 /* 274 */ "paren_exprlist",
158442 /* 275 */ "case_operand",
158443 /* 276 */ "case_exprlist",
158444 /* 277 */ "case_else",
158445 /* 278 */ "uniqueflag",
158446 /* 279 */ "collate",
158447 /* 280 */ "vinto",
158448 /* 281 */ "nmnum",
158449 /* 282 */ "trigger_decl",
158450 /* 283 */ "trigger_cmd_list",
158451 /* 284 */ "trigger_time",
158452 /* 285 */ "trigger_event",
158453 /* 286 */ "foreach_clause",
158454 /* 287 */ "when_clause",
158455 /* 288 */ "trigger_cmd",
158456 /* 289 */ "trnm",
158457 /* 290 */ "tridxby",
158458 /* 291 */ "database_kw_opt",
158459 /* 292 */ "key_opt",
158460 /* 293 */ "add_column_fullname",
158461 /* 294 */ "kwcolumn_opt",
158462 /* 295 */ "create_vtab",
158463 /* 296 */ "vtabarglist",
158464 /* 297 */ "vtabarg",
158465 /* 298 */ "vtabargtoken",
158466 /* 299 */ "lp",
158467 /* 300 */ "anylist",
158468 /* 301 */ "wqitem",
158469 /* 302 */ "wqas",
158470 /* 303 */ "windowdefn_list",
158471 /* 304 */ "windowdefn",
158472 /* 305 */ "window",
158473 /* 306 */ "frame_opt",
158474 /* 307 */ "part_opt",
158475 /* 308 */ "filter_clause",
158476 /* 309 */ "over_clause",
158477 /* 310 */ "range_or_rows",
158478 /* 311 */ "frame_bound",
158479 /* 312 */ "frame_bound_s",
158480 /* 313 */ "frame_bound_e",
158481 /* 314 */ "frame_exclude_opt",
158482 /* 315 */ "frame_exclude",
158483 };
158484 #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
158485
158486 #ifndef NDEBUG
158487 /* For tracing reduce actions, the names of all rules are required.
@@ -158324,115 +158773,120 @@
158773 /* 283 */ "cmd ::= REINDEX nm dbnm",
158774 /* 284 */ "cmd ::= ANALYZE",
158775 /* 285 */ "cmd ::= ANALYZE nm dbnm",
158776 /* 286 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
158777 /* 287 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
158778 /* 288 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
158779 /* 289 */ "add_column_fullname ::= fullname",
158780 /* 290 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
158781 /* 291 */ "cmd ::= create_vtab",
158782 /* 292 */ "cmd ::= create_vtab LP vtabarglist RP",
158783 /* 293 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
158784 /* 294 */ "vtabarg ::=",
158785 /* 295 */ "vtabargtoken ::= ANY",
158786 /* 296 */ "vtabargtoken ::= lp anylist RP",
158787 /* 297 */ "lp ::= LP",
158788 /* 298 */ "with ::= WITH wqlist",
158789 /* 299 */ "with ::= WITH RECURSIVE wqlist",
158790 /* 300 */ "wqas ::= AS",
158791 /* 301 */ "wqas ::= AS MATERIALIZED",
158792 /* 302 */ "wqas ::= AS NOT MATERIALIZED",
158793 /* 303 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
158794 /* 304 */ "wqlist ::= wqitem",
158795 /* 305 */ "wqlist ::= wqlist COMMA wqitem",
158796 /* 306 */ "windowdefn_list ::= windowdefn",
158797 /* 307 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
158798 /* 308 */ "windowdefn ::= nm AS LP window RP",
158799 /* 309 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
158800 /* 310 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
158801 /* 311 */ "window ::= ORDER BY sortlist frame_opt",
158802 /* 312 */ "window ::= nm ORDER BY sortlist frame_opt",
158803 /* 313 */ "window ::= frame_opt",
158804 /* 314 */ "window ::= nm frame_opt",
158805 /* 315 */ "frame_opt ::=",
158806 /* 316 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
158807 /* 317 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
158808 /* 318 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
158809 /* 319 */ "frame_bound_s ::= frame_bound",
158810 /* 320 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
158811 /* 321 */ "frame_bound_e ::= frame_bound",
158812 /* 322 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
158813 /* 323 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
158814 /* 324 */ "frame_bound ::= CURRENT ROW",
158815 /* 325 */ "frame_exclude_opt ::=",
158816 /* 326 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
158817 /* 327 */ "frame_exclude ::= NO OTHERS",
158818 /* 328 */ "frame_exclude ::= CURRENT ROW",
158819 /* 329 */ "frame_exclude ::= GROUP|TIES",
158820 /* 330 */ "window_clause ::= WINDOW windowdefn_list",
158821 /* 331 */ "filter_over ::= filter_clause over_clause",
158822 /* 332 */ "filter_over ::= over_clause",
158823 /* 333 */ "filter_over ::= filter_clause",
158824 /* 334 */ "over_clause ::= OVER LP window RP",
158825 /* 335 */ "over_clause ::= OVER nm",
158826 /* 336 */ "filter_clause ::= FILTER LP WHERE expr RP",
158827 /* 337 */ "input ::= cmdlist",
158828 /* 338 */ "cmdlist ::= cmdlist ecmd",
158829 /* 339 */ "cmdlist ::= ecmd",
158830 /* 340 */ "ecmd ::= SEMI",
158831 /* 341 */ "ecmd ::= cmdx SEMI",
158832 /* 342 */ "ecmd ::= explain cmdx SEMI",
158833 /* 343 */ "trans_opt ::=",
158834 /* 344 */ "trans_opt ::= TRANSACTION",
158835 /* 345 */ "trans_opt ::= TRANSACTION nm",
158836 /* 346 */ "savepoint_opt ::= SAVEPOINT",
158837 /* 347 */ "savepoint_opt ::=",
158838 /* 348 */ "cmd ::= create_table create_table_args",
158839 /* 349 */ "columnlist ::= columnlist COMMA columnname carglist",
158840 /* 350 */ "columnlist ::= columnname carglist",
158841 /* 351 */ "nm ::= ID|INDEXED",
158842 /* 352 */ "nm ::= STRING",
158843 /* 353 */ "nm ::= JOIN_KW",
158844 /* 354 */ "typetoken ::= typename",
158845 /* 355 */ "typename ::= ID|STRING",
158846 /* 356 */ "signed ::= plus_num",
158847 /* 357 */ "signed ::= minus_num",
158848 /* 358 */ "carglist ::= carglist ccons",
158849 /* 359 */ "carglist ::=",
158850 /* 360 */ "ccons ::= NULL onconf",
158851 /* 361 */ "ccons ::= GENERATED ALWAYS AS generated",
158852 /* 362 */ "ccons ::= AS generated",
158853 /* 363 */ "conslist_opt ::= COMMA conslist",
158854 /* 364 */ "conslist ::= conslist tconscomma tcons",
158855 /* 365 */ "conslist ::= tcons",
158856 /* 366 */ "tconscomma ::=",
158857 /* 367 */ "defer_subclause_opt ::= defer_subclause",
158858 /* 368 */ "resolvetype ::= raisetype",
158859 /* 369 */ "selectnowith ::= oneselect",
158860 /* 370 */ "oneselect ::= values",
158861 /* 371 */ "sclp ::= selcollist COMMA",
158862 /* 372 */ "as ::= ID|STRING",
158863 /* 373 */ "returning ::=",
158864 /* 374 */ "expr ::= term",
158865 /* 375 */ "likeop ::= LIKE_KW|MATCH",
158866 /* 376 */ "exprlist ::= nexprlist",
158867 /* 377 */ "nmnum ::= plus_num",
158868 /* 378 */ "nmnum ::= nm",
158869 /* 379 */ "nmnum ::= ON",
158870 /* 380 */ "nmnum ::= DELETE",
158871 /* 381 */ "nmnum ::= DEFAULT",
158872 /* 382 */ "plus_num ::= INTEGER|FLOAT",
158873 /* 383 */ "foreach_clause ::=",
158874 /* 384 */ "foreach_clause ::= FOR EACH ROW",
158875 /* 385 */ "trnm ::= nm",
158876 /* 386 */ "tridxby ::=",
158877 /* 387 */ "database_kw_opt ::= DATABASE",
158878 /* 388 */ "database_kw_opt ::=",
158879 /* 389 */ "kwcolumn_opt ::=",
158880 /* 390 */ "kwcolumn_opt ::= COLUMNKW",
158881 /* 391 */ "vtabarglist ::= vtabarg",
158882 /* 392 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
158883 /* 393 */ "vtabarg ::= vtabarg vtabargtoken",
158884 /* 394 */ "anylist ::=",
158885 /* 395 */ "anylist ::= anylist LP anylist RP",
158886 /* 396 */ "anylist ::= anylist ANY",
158887 /* 397 */ "with ::=",
158888 };
158889 #endif /* NDEBUG */
158890
158891
158892 #if YYSTACKDEPTH<=0
@@ -158554,103 +159008,103 @@
159008 ** Note: during a reduce, the only symbols destroyed are those
159009 ** which appear on the RHS of the rule, but which are *not* used
159010 ** inside the C code.
159011 */
159012 /********* Begin destructor definitions ***************************************/
159013 case 202: /* select */
159014 case 236: /* selectnowith */
159015 case 237: /* oneselect */
159016 case 249: /* values */
159017 {
159018 sqlite3SelectDelete(pParse->db, (yypminor->yy307));
159019 }
159020 break;
159021 case 213: /* term */
159022 case 214: /* expr */
159023 case 243: /* where_opt */
159024 case 245: /* having_opt */
159025 case 257: /* on_opt */
159026 case 264: /* where_opt_ret */
159027 case 275: /* case_operand */
159028 case 277: /* case_else */
159029 case 280: /* vinto */
159030 case 287: /* when_clause */
159031 case 292: /* key_opt */
159032 case 308: /* filter_clause */
159033 {
159034 sqlite3ExprDelete(pParse->db, (yypminor->yy602));
159035 }
159036 break;
159037 case 218: /* eidlist_opt */
159038 case 228: /* sortlist */
159039 case 229: /* eidlist */
159040 case 241: /* selcollist */
159041 case 244: /* groupby_opt */
159042 case 246: /* orderby_opt */
159043 case 250: /* nexprlist */
159044 case 251: /* sclp */
159045 case 259: /* exprlist */
159046 case 265: /* setlist */
159047 case 274: /* paren_exprlist */
159048 case 276: /* case_exprlist */
159049 case 307: /* part_opt */
159050 {
159051 sqlite3ExprListDelete(pParse->db, (yypminor->yy338));
159052 }
159053 break;
159054 case 235: /* fullname */
159055 case 242: /* from */
159056 case 253: /* seltablist */
159057 case 254: /* stl_prefix */
159058 case 260: /* xfullname */
159059 {
159060 sqlite3SrcListDelete(pParse->db, (yypminor->yy291));
159061 }
159062 break;
159063 case 238: /* wqlist */
159064 {
159065 sqlite3WithDelete(pParse->db, (yypminor->yy195));
159066 }
159067 break;
159068 case 248: /* window_clause */
159069 case 303: /* windowdefn_list */
159070 {
159071 sqlite3WindowListDelete(pParse->db, (yypminor->yy19));
159072 }
159073 break;
159074 case 258: /* using_opt */
159075 case 261: /* idlist */
159076 case 267: /* idlist_opt */
159077 {
159078 sqlite3IdListDelete(pParse->db, (yypminor->yy288));
159079 }
159080 break;
159081 case 270: /* filter_over */
159082 case 304: /* windowdefn */
159083 case 305: /* window */
159084 case 306: /* frame_opt */
159085 case 309: /* over_clause */
159086 {
159087 sqlite3WindowDelete(pParse->db, (yypminor->yy19));
159088 }
159089 break;
159090 case 283: /* trigger_cmd_list */
159091 case 288: /* trigger_cmd */
159092 {
159093 sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy483));
159094 }
159095 break;
159096 case 285: /* trigger_event */
159097 {
159098 sqlite3IdListDelete(pParse->db, (yypminor->yy50).b);
159099 }
159100 break;
159101 case 311: /* frame_bound */
159102 case 312: /* frame_bound_s */
159103 case 313: /* frame_bound_e */
159104 {
159105 sqlite3ExprDelete(pParse->db, (yypminor->yy113).pExpr);
159106 }
159107 break;
159108 /********* End destructor definitions *****************************************/
159109 default: break; /* If no destructor action specified: do nothing */
159110 }
@@ -158937,403 +159391,408 @@
159391 }
159392
159393 /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
159394 ** of that rule */
159395 static const YYCODETYPE yyRuleInfoLhs[] = {
159396 187, /* (0) explain ::= EXPLAIN */
159397 187, /* (1) explain ::= EXPLAIN QUERY PLAN */
159398 186, /* (2) cmdx ::= cmd */
159399 188, /* (3) cmd ::= BEGIN transtype trans_opt */
159400 189, /* (4) transtype ::= */
159401 189, /* (5) transtype ::= DEFERRED */
159402 189, /* (6) transtype ::= IMMEDIATE */
159403 189, /* (7) transtype ::= EXCLUSIVE */
159404 188, /* (8) cmd ::= COMMIT|END trans_opt */
159405 188, /* (9) cmd ::= ROLLBACK trans_opt */
159406 188, /* (10) cmd ::= SAVEPOINT nm */
159407 188, /* (11) cmd ::= RELEASE savepoint_opt nm */
159408 188, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
159409 193, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
159410 195, /* (14) createkw ::= CREATE */
159411 197, /* (15) ifnotexists ::= */
159412 197, /* (16) ifnotexists ::= IF NOT EXISTS */
159413 196, /* (17) temp ::= TEMP */
159414 196, /* (18) temp ::= */
159415 194, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */
159416 194, /* (20) create_table_args ::= AS select */
159417 201, /* (21) table_options ::= */
159418 201, /* (22) table_options ::= WITHOUT nm */
159419 203, /* (23) columnname ::= nm typetoken */
159420 205, /* (24) typetoken ::= */
159421 205, /* (25) typetoken ::= typename LP signed RP */
159422 205, /* (26) typetoken ::= typename LP signed COMMA signed RP */
159423 206, /* (27) typename ::= typename ID|STRING */
159424 210, /* (28) scanpt ::= */
159425 211, /* (29) scantok ::= */
159426 212, /* (30) ccons ::= CONSTRAINT nm */
159427 212, /* (31) ccons ::= DEFAULT scantok term */
159428 212, /* (32) ccons ::= DEFAULT LP expr RP */
159429 212, /* (33) ccons ::= DEFAULT PLUS scantok term */
159430 212, /* (34) ccons ::= DEFAULT MINUS scantok term */
159431 212, /* (35) ccons ::= DEFAULT scantok ID|INDEXED */
159432 212, /* (36) ccons ::= NOT NULL onconf */
159433 212, /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */
159434 212, /* (38) ccons ::= UNIQUE onconf */
159435 212, /* (39) ccons ::= CHECK LP expr RP */
159436 212, /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */
159437 212, /* (41) ccons ::= defer_subclause */
159438 212, /* (42) ccons ::= COLLATE ID|STRING */
159439 221, /* (43) generated ::= LP expr RP */
159440 221, /* (44) generated ::= LP expr RP ID */
159441 217, /* (45) autoinc ::= */
159442 217, /* (46) autoinc ::= AUTOINCR */
159443 219, /* (47) refargs ::= */
159444 219, /* (48) refargs ::= refargs refarg */
159445 222, /* (49) refarg ::= MATCH nm */
159446 222, /* (50) refarg ::= ON INSERT refact */
159447 222, /* (51) refarg ::= ON DELETE refact */
159448 222, /* (52) refarg ::= ON UPDATE refact */
159449 223, /* (53) refact ::= SET NULL */
159450 223, /* (54) refact ::= SET DEFAULT */
159451 223, /* (55) refact ::= CASCADE */
159452 223, /* (56) refact ::= RESTRICT */
159453 223, /* (57) refact ::= NO ACTION */
159454 220, /* (58) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
159455 220, /* (59) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
159456 224, /* (60) init_deferred_pred_opt ::= */
159457 224, /* (61) init_deferred_pred_opt ::= INITIALLY DEFERRED */
159458 224, /* (62) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
159459 200, /* (63) conslist_opt ::= */
159460 226, /* (64) tconscomma ::= COMMA */
159461 227, /* (65) tcons ::= CONSTRAINT nm */
159462 227, /* (66) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
159463 227, /* (67) tcons ::= UNIQUE LP sortlist RP onconf */
159464 227, /* (68) tcons ::= CHECK LP expr RP onconf */
159465 227, /* (69) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
159466 230, /* (70) defer_subclause_opt ::= */
159467 215, /* (71) onconf ::= */
159468 215, /* (72) onconf ::= ON CONFLICT resolvetype */
159469 231, /* (73) orconf ::= */
159470 231, /* (74) orconf ::= OR resolvetype */
159471 232, /* (75) resolvetype ::= IGNORE */
159472 232, /* (76) resolvetype ::= REPLACE */
159473 188, /* (77) cmd ::= DROP TABLE ifexists fullname */
159474 234, /* (78) ifexists ::= IF EXISTS */
159475 234, /* (79) ifexists ::= */
159476 188, /* (80) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
159477 188, /* (81) cmd ::= DROP VIEW ifexists fullname */
159478 188, /* (82) cmd ::= select */
159479 202, /* (83) select ::= WITH wqlist selectnowith */
159480 202, /* (84) select ::= WITH RECURSIVE wqlist selectnowith */
159481 202, /* (85) select ::= selectnowith */
159482 236, /* (86) selectnowith ::= selectnowith multiselect_op oneselect */
159483 239, /* (87) multiselect_op ::= UNION */
159484 239, /* (88) multiselect_op ::= UNION ALL */
159485 239, /* (89) multiselect_op ::= EXCEPT|INTERSECT */
159486 237, /* (90) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
159487 237, /* (91) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
159488 249, /* (92) values ::= VALUES LP nexprlist RP */
159489 249, /* (93) values ::= values COMMA LP nexprlist RP */
159490 240, /* (94) distinct ::= DISTINCT */
159491 240, /* (95) distinct ::= ALL */
159492 240, /* (96) distinct ::= */
159493 251, /* (97) sclp ::= */
159494 241, /* (98) selcollist ::= sclp scanpt expr scanpt as */
159495 241, /* (99) selcollist ::= sclp scanpt STAR */
159496 241, /* (100) selcollist ::= sclp scanpt nm DOT STAR */
159497 252, /* (101) as ::= AS nm */
159498 252, /* (102) as ::= */
159499 242, /* (103) from ::= */
159500 242, /* (104) from ::= FROM seltablist */
159501 254, /* (105) stl_prefix ::= seltablist joinop */
159502 254, /* (106) stl_prefix ::= */
159503 253, /* (107) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
159504 253, /* (108) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
159505 253, /* (109) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
159506 253, /* (110) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
159507 198, /* (111) dbnm ::= */
159508 198, /* (112) dbnm ::= DOT nm */
159509 235, /* (113) fullname ::= nm */
159510 235, /* (114) fullname ::= nm DOT nm */
159511 260, /* (115) xfullname ::= nm */
159512 260, /* (116) xfullname ::= nm DOT nm */
159513 260, /* (117) xfullname ::= nm DOT nm AS nm */
159514 260, /* (118) xfullname ::= nm AS nm */
159515 255, /* (119) joinop ::= COMMA|JOIN */
159516 255, /* (120) joinop ::= JOIN_KW JOIN */
159517 255, /* (121) joinop ::= JOIN_KW nm JOIN */
159518 255, /* (122) joinop ::= JOIN_KW nm nm JOIN */
159519 257, /* (123) on_opt ::= ON expr */
159520 257, /* (124) on_opt ::= */
159521 256, /* (125) indexed_opt ::= */
159522 256, /* (126) indexed_opt ::= INDEXED BY nm */
159523 256, /* (127) indexed_opt ::= NOT INDEXED */
159524 258, /* (128) using_opt ::= USING LP idlist RP */
159525 258, /* (129) using_opt ::= */
159526 246, /* (130) orderby_opt ::= */
159527 246, /* (131) orderby_opt ::= ORDER BY sortlist */
159528 228, /* (132) sortlist ::= sortlist COMMA expr sortorder nulls */
159529 228, /* (133) sortlist ::= expr sortorder nulls */
159530 216, /* (134) sortorder ::= ASC */
159531 216, /* (135) sortorder ::= DESC */
159532 216, /* (136) sortorder ::= */
159533 262, /* (137) nulls ::= NULLS FIRST */
159534 262, /* (138) nulls ::= NULLS LAST */
159535 262, /* (139) nulls ::= */
159536 244, /* (140) groupby_opt ::= */
159537 244, /* (141) groupby_opt ::= GROUP BY nexprlist */
159538 245, /* (142) having_opt ::= */
159539 245, /* (143) having_opt ::= HAVING expr */
159540 247, /* (144) limit_opt ::= */
159541 247, /* (145) limit_opt ::= LIMIT expr */
159542 247, /* (146) limit_opt ::= LIMIT expr OFFSET expr */
159543 247, /* (147) limit_opt ::= LIMIT expr COMMA expr */
159544 188, /* (148) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
159545 243, /* (149) where_opt ::= */
159546 243, /* (150) where_opt ::= WHERE expr */
159547 264, /* (151) where_opt_ret ::= */
159548 264, /* (152) where_opt_ret ::= WHERE expr */
159549 264, /* (153) where_opt_ret ::= RETURNING selcollist */
159550 264, /* (154) where_opt_ret ::= WHERE expr RETURNING selcollist */
159551 188, /* (155) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
159552 265, /* (156) setlist ::= setlist COMMA nm EQ expr */
159553 265, /* (157) setlist ::= setlist COMMA LP idlist RP EQ expr */
159554 265, /* (158) setlist ::= nm EQ expr */
159555 265, /* (159) setlist ::= LP idlist RP EQ expr */
159556 188, /* (160) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
159557 188, /* (161) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
159558 268, /* (162) upsert ::= */
159559 268, /* (163) upsert ::= RETURNING selcollist */
159560 268, /* (164) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
159561 268, /* (165) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
159562 268, /* (166) upsert ::= ON CONFLICT DO NOTHING returning */
159563 268, /* (167) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
159564 269, /* (168) returning ::= RETURNING selcollist */
159565 266, /* (169) insert_cmd ::= INSERT orconf */
159566 266, /* (170) insert_cmd ::= REPLACE */
159567 267, /* (171) idlist_opt ::= */
159568 267, /* (172) idlist_opt ::= LP idlist RP */
159569 261, /* (173) idlist ::= idlist COMMA nm */
159570 261, /* (174) idlist ::= nm */
159571 214, /* (175) expr ::= LP expr RP */
159572 214, /* (176) expr ::= ID|INDEXED */
159573 214, /* (177) expr ::= JOIN_KW */
159574 214, /* (178) expr ::= nm DOT nm */
159575 214, /* (179) expr ::= nm DOT nm DOT nm */
159576 213, /* (180) term ::= NULL|FLOAT|BLOB */
159577 213, /* (181) term ::= STRING */
159578 213, /* (182) term ::= INTEGER */
159579 214, /* (183) expr ::= VARIABLE */
159580 214, /* (184) expr ::= expr COLLATE ID|STRING */
159581 214, /* (185) expr ::= CAST LP expr AS typetoken RP */
159582 214, /* (186) expr ::= ID|INDEXED LP distinct exprlist RP */
159583 214, /* (187) expr ::= ID|INDEXED LP STAR RP */
159584 214, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
159585 214, /* (189) expr ::= ID|INDEXED LP STAR RP filter_over */
159586 213, /* (190) term ::= CTIME_KW */
159587 214, /* (191) expr ::= LP nexprlist COMMA expr RP */
159588 214, /* (192) expr ::= expr AND expr */
159589 214, /* (193) expr ::= expr OR expr */
159590 214, /* (194) expr ::= expr LT|GT|GE|LE expr */
159591 214, /* (195) expr ::= expr EQ|NE expr */
159592 214, /* (196) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
159593 214, /* (197) expr ::= expr PLUS|MINUS expr */
159594 214, /* (198) expr ::= expr STAR|SLASH|REM expr */
159595 214, /* (199) expr ::= expr CONCAT expr */
159596 271, /* (200) likeop ::= NOT LIKE_KW|MATCH */
159597 214, /* (201) expr ::= expr likeop expr */
159598 214, /* (202) expr ::= expr likeop expr ESCAPE expr */
159599 214, /* (203) expr ::= expr ISNULL|NOTNULL */
159600 214, /* (204) expr ::= expr NOT NULL */
159601 214, /* (205) expr ::= expr IS expr */
159602 214, /* (206) expr ::= expr IS NOT expr */
159603 214, /* (207) expr ::= NOT expr */
159604 214, /* (208) expr ::= BITNOT expr */
159605 214, /* (209) expr ::= PLUS|MINUS expr */
159606 272, /* (210) between_op ::= BETWEEN */
159607 272, /* (211) between_op ::= NOT BETWEEN */
159608 214, /* (212) expr ::= expr between_op expr AND expr */
159609 273, /* (213) in_op ::= IN */
159610 273, /* (214) in_op ::= NOT IN */
159611 214, /* (215) expr ::= expr in_op LP exprlist RP */
159612 214, /* (216) expr ::= LP select RP */
159613 214, /* (217) expr ::= expr in_op LP select RP */
159614 214, /* (218) expr ::= expr in_op nm dbnm paren_exprlist */
159615 214, /* (219) expr ::= EXISTS LP select RP */
159616 214, /* (220) expr ::= CASE case_operand case_exprlist case_else END */
159617 276, /* (221) case_exprlist ::= case_exprlist WHEN expr THEN expr */
159618 276, /* (222) case_exprlist ::= WHEN expr THEN expr */
159619 277, /* (223) case_else ::= ELSE expr */
159620 277, /* (224) case_else ::= */
159621 275, /* (225) case_operand ::= expr */
159622 275, /* (226) case_operand ::= */
159623 259, /* (227) exprlist ::= */
159624 250, /* (228) nexprlist ::= nexprlist COMMA expr */
159625 250, /* (229) nexprlist ::= expr */
159626 274, /* (230) paren_exprlist ::= */
159627 274, /* (231) paren_exprlist ::= LP exprlist RP */
159628 188, /* (232) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
159629 278, /* (233) uniqueflag ::= UNIQUE */
159630 278, /* (234) uniqueflag ::= */
159631 218, /* (235) eidlist_opt ::= */
159632 218, /* (236) eidlist_opt ::= LP eidlist RP */
159633 229, /* (237) eidlist ::= eidlist COMMA nm collate sortorder */
159634 229, /* (238) eidlist ::= nm collate sortorder */
159635 279, /* (239) collate ::= */
159636 279, /* (240) collate ::= COLLATE ID|STRING */
159637 188, /* (241) cmd ::= DROP INDEX ifexists fullname */
159638 188, /* (242) cmd ::= VACUUM vinto */
159639 188, /* (243) cmd ::= VACUUM nm vinto */
159640 280, /* (244) vinto ::= INTO expr */
159641 280, /* (245) vinto ::= */
159642 188, /* (246) cmd ::= PRAGMA nm dbnm */
159643 188, /* (247) cmd ::= PRAGMA nm dbnm EQ nmnum */
159644 188, /* (248) cmd ::= PRAGMA nm dbnm LP nmnum RP */
159645 188, /* (249) cmd ::= PRAGMA nm dbnm EQ minus_num */
159646 188, /* (250) cmd ::= PRAGMA nm dbnm LP minus_num RP */
159647 208, /* (251) plus_num ::= PLUS INTEGER|FLOAT */
159648 209, /* (252) minus_num ::= MINUS INTEGER|FLOAT */
159649 188, /* (253) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
159650 282, /* (254) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
159651 284, /* (255) trigger_time ::= BEFORE|AFTER */
159652 284, /* (256) trigger_time ::= INSTEAD OF */
159653 284, /* (257) trigger_time ::= */
159654 285, /* (258) trigger_event ::= DELETE|INSERT */
159655 285, /* (259) trigger_event ::= UPDATE */
159656 285, /* (260) trigger_event ::= UPDATE OF idlist */
159657 287, /* (261) when_clause ::= */
159658 287, /* (262) when_clause ::= WHEN expr */
159659 283, /* (263) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
159660 283, /* (264) trigger_cmd_list ::= trigger_cmd SEMI */
159661 289, /* (265) trnm ::= nm DOT nm */
159662 290, /* (266) tridxby ::= INDEXED BY nm */
159663 290, /* (267) tridxby ::= NOT INDEXED */
159664 288, /* (268) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
159665 288, /* (269) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
159666 288, /* (270) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
159667 288, /* (271) trigger_cmd ::= scanpt select scanpt */
159668 214, /* (272) expr ::= RAISE LP IGNORE RP */
159669 214, /* (273) expr ::= RAISE LP raisetype COMMA nm RP */
159670 233, /* (274) raisetype ::= ROLLBACK */
159671 233, /* (275) raisetype ::= ABORT */
159672 233, /* (276) raisetype ::= FAIL */
159673 188, /* (277) cmd ::= DROP TRIGGER ifexists fullname */
159674 188, /* (278) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
159675 188, /* (279) cmd ::= DETACH database_kw_opt expr */
159676 292, /* (280) key_opt ::= */
159677 292, /* (281) key_opt ::= KEY expr */
159678 188, /* (282) cmd ::= REINDEX */
159679 188, /* (283) cmd ::= REINDEX nm dbnm */
159680 188, /* (284) cmd ::= ANALYZE */
159681 188, /* (285) cmd ::= ANALYZE nm dbnm */
159682 188, /* (286) cmd ::= ALTER TABLE fullname RENAME TO nm */
159683 188, /* (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
159684 188, /* (288) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
159685 293, /* (289) add_column_fullname ::= fullname */
159686 188, /* (290) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
159687 188, /* (291) cmd ::= create_vtab */
159688 188, /* (292) cmd ::= create_vtab LP vtabarglist RP */
159689 295, /* (293) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
159690 297, /* (294) vtabarg ::= */
159691 298, /* (295) vtabargtoken ::= ANY */
159692 298, /* (296) vtabargtoken ::= lp anylist RP */
159693 299, /* (297) lp ::= LP */
159694 263, /* (298) with ::= WITH wqlist */
159695 263, /* (299) with ::= WITH RECURSIVE wqlist */
159696 302, /* (300) wqas ::= AS */
159697 302, /* (301) wqas ::= AS MATERIALIZED */
159698 302, /* (302) wqas ::= AS NOT MATERIALIZED */
159699 301, /* (303) wqitem ::= nm eidlist_opt wqas LP select RP */
159700 238, /* (304) wqlist ::= wqitem */
159701 238, /* (305) wqlist ::= wqlist COMMA wqitem */
159702 303, /* (306) windowdefn_list ::= windowdefn */
159703 303, /* (307) windowdefn_list ::= windowdefn_list COMMA windowdefn */
159704 304, /* (308) windowdefn ::= nm AS LP window RP */
159705 305, /* (309) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
159706 305, /* (310) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
159707 305, /* (311) window ::= ORDER BY sortlist frame_opt */
159708 305, /* (312) window ::= nm ORDER BY sortlist frame_opt */
159709 305, /* (313) window ::= frame_opt */
159710 305, /* (314) window ::= nm frame_opt */
159711 306, /* (315) frame_opt ::= */
159712 306, /* (316) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
159713 306, /* (317) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
159714 310, /* (318) range_or_rows ::= RANGE|ROWS|GROUPS */
159715 312, /* (319) frame_bound_s ::= frame_bound */
159716 312, /* (320) frame_bound_s ::= UNBOUNDED PRECEDING */
159717 313, /* (321) frame_bound_e ::= frame_bound */
159718 313, /* (322) frame_bound_e ::= UNBOUNDED FOLLOWING */
159719 311, /* (323) frame_bound ::= expr PRECEDING|FOLLOWING */
159720 311, /* (324) frame_bound ::= CURRENT ROW */
159721 314, /* (325) frame_exclude_opt ::= */
159722 314, /* (326) frame_exclude_opt ::= EXCLUDE frame_exclude */
159723 315, /* (327) frame_exclude ::= NO OTHERS */
159724 315, /* (328) frame_exclude ::= CURRENT ROW */
159725 315, /* (329) frame_exclude ::= GROUP|TIES */
159726 248, /* (330) window_clause ::= WINDOW windowdefn_list */
159727 270, /* (331) filter_over ::= filter_clause over_clause */
159728 270, /* (332) filter_over ::= over_clause */
159729 270, /* (333) filter_over ::= filter_clause */
159730 309, /* (334) over_clause ::= OVER LP window RP */
159731 309, /* (335) over_clause ::= OVER nm */
159732 308, /* (336) filter_clause ::= FILTER LP WHERE expr RP */
159733 183, /* (337) input ::= cmdlist */
159734 184, /* (338) cmdlist ::= cmdlist ecmd */
159735 184, /* (339) cmdlist ::= ecmd */
159736 185, /* (340) ecmd ::= SEMI */
159737 185, /* (341) ecmd ::= cmdx SEMI */
159738 185, /* (342) ecmd ::= explain cmdx SEMI */
159739 190, /* (343) trans_opt ::= */
159740 190, /* (344) trans_opt ::= TRANSACTION */
159741 190, /* (345) trans_opt ::= TRANSACTION nm */
159742 192, /* (346) savepoint_opt ::= SAVEPOINT */
159743 192, /* (347) savepoint_opt ::= */
159744 188, /* (348) cmd ::= create_table create_table_args */
159745 199, /* (349) columnlist ::= columnlist COMMA columnname carglist */
159746 199, /* (350) columnlist ::= columnname carglist */
159747 191, /* (351) nm ::= ID|INDEXED */
159748 191, /* (352) nm ::= STRING */
159749 191, /* (353) nm ::= JOIN_KW */
159750 205, /* (354) typetoken ::= typename */
159751 206, /* (355) typename ::= ID|STRING */
159752 207, /* (356) signed ::= plus_num */
159753 207, /* (357) signed ::= minus_num */
159754 204, /* (358) carglist ::= carglist ccons */
159755 204, /* (359) carglist ::= */
159756 212, /* (360) ccons ::= NULL onconf */
159757 212, /* (361) ccons ::= GENERATED ALWAYS AS generated */
159758 212, /* (362) ccons ::= AS generated */
159759 200, /* (363) conslist_opt ::= COMMA conslist */
159760 225, /* (364) conslist ::= conslist tconscomma tcons */
159761 225, /* (365) conslist ::= tcons */
159762 226, /* (366) tconscomma ::= */
159763 230, /* (367) defer_subclause_opt ::= defer_subclause */
159764 232, /* (368) resolvetype ::= raisetype */
159765 236, /* (369) selectnowith ::= oneselect */
159766 237, /* (370) oneselect ::= values */
159767 251, /* (371) sclp ::= selcollist COMMA */
159768 252, /* (372) as ::= ID|STRING */
159769 269, /* (373) returning ::= */
159770 214, /* (374) expr ::= term */
159771 271, /* (375) likeop ::= LIKE_KW|MATCH */
159772 259, /* (376) exprlist ::= nexprlist */
159773 281, /* (377) nmnum ::= plus_num */
159774 281, /* (378) nmnum ::= nm */
159775 281, /* (379) nmnum ::= ON */
159776 281, /* (380) nmnum ::= DELETE */
159777 281, /* (381) nmnum ::= DEFAULT */
159778 208, /* (382) plus_num ::= INTEGER|FLOAT */
159779 286, /* (383) foreach_clause ::= */
159780 286, /* (384) foreach_clause ::= FOR EACH ROW */
159781 289, /* (385) trnm ::= nm */
159782 290, /* (386) tridxby ::= */
159783 291, /* (387) database_kw_opt ::= DATABASE */
159784 291, /* (388) database_kw_opt ::= */
159785 294, /* (389) kwcolumn_opt ::= */
159786 294, /* (390) kwcolumn_opt ::= COLUMNKW */
159787 296, /* (391) vtabarglist ::= vtabarg */
159788 296, /* (392) vtabarglist ::= vtabarglist COMMA vtabarg */
159789 297, /* (393) vtabarg ::= vtabarg vtabargtoken */
159790 300, /* (394) anylist ::= */
159791 300, /* (395) anylist ::= anylist LP anylist RP */
159792 300, /* (396) anylist ::= anylist ANY */
159793 263, /* (397) with ::= */
159794 };
159795
159796 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
159797 ** of symbols on the right-hand side of that rule. */
159798 static const signed char yyRuleInfoNRhs[] = {
@@ -159623,115 +160082,120 @@
160082 -3, /* (283) cmd ::= REINDEX nm dbnm */
160083 -1, /* (284) cmd ::= ANALYZE */
160084 -3, /* (285) cmd ::= ANALYZE nm dbnm */
160085 -6, /* (286) cmd ::= ALTER TABLE fullname RENAME TO nm */
160086 -7, /* (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
160087 -6, /* (288) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
160088 -1, /* (289) add_column_fullname ::= fullname */
160089 -8, /* (290) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
160090 -1, /* (291) cmd ::= create_vtab */
160091 -4, /* (292) cmd ::= create_vtab LP vtabarglist RP */
160092 -8, /* (293) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
160093 0, /* (294) vtabarg ::= */
160094 -1, /* (295) vtabargtoken ::= ANY */
160095 -3, /* (296) vtabargtoken ::= lp anylist RP */
160096 -1, /* (297) lp ::= LP */
160097 -2, /* (298) with ::= WITH wqlist */
160098 -3, /* (299) with ::= WITH RECURSIVE wqlist */
160099 -1, /* (300) wqas ::= AS */
160100 -2, /* (301) wqas ::= AS MATERIALIZED */
160101 -3, /* (302) wqas ::= AS NOT MATERIALIZED */
160102 -6, /* (303) wqitem ::= nm eidlist_opt wqas LP select RP */
160103 -1, /* (304) wqlist ::= wqitem */
160104 -3, /* (305) wqlist ::= wqlist COMMA wqitem */
160105 -1, /* (306) windowdefn_list ::= windowdefn */
160106 -3, /* (307) windowdefn_list ::= windowdefn_list COMMA windowdefn */
160107 -5, /* (308) windowdefn ::= nm AS LP window RP */
160108 -5, /* (309) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
160109 -6, /* (310) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
160110 -4, /* (311) window ::= ORDER BY sortlist frame_opt */
160111 -5, /* (312) window ::= nm ORDER BY sortlist frame_opt */
160112 -1, /* (313) window ::= frame_opt */
160113 -2, /* (314) window ::= nm frame_opt */
160114 0, /* (315) frame_opt ::= */
160115 -3, /* (316) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
160116 -6, /* (317) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
160117 -1, /* (318) range_or_rows ::= RANGE|ROWS|GROUPS */
160118 -1, /* (319) frame_bound_s ::= frame_bound */
160119 -2, /* (320) frame_bound_s ::= UNBOUNDED PRECEDING */
160120 -1, /* (321) frame_bound_e ::= frame_bound */
160121 -2, /* (322) frame_bound_e ::= UNBOUNDED FOLLOWING */
160122 -2, /* (323) frame_bound ::= expr PRECEDING|FOLLOWING */
160123 -2, /* (324) frame_bound ::= CURRENT ROW */
160124 0, /* (325) frame_exclude_opt ::= */
160125 -2, /* (326) frame_exclude_opt ::= EXCLUDE frame_exclude */
160126 -2, /* (327) frame_exclude ::= NO OTHERS */
160127 -2, /* (328) frame_exclude ::= CURRENT ROW */
160128 -1, /* (329) frame_exclude ::= GROUP|TIES */
160129 -2, /* (330) window_clause ::= WINDOW windowdefn_list */
160130 -2, /* (331) filter_over ::= filter_clause over_clause */
160131 -1, /* (332) filter_over ::= over_clause */
160132 -1, /* (333) filter_over ::= filter_clause */
160133 -4, /* (334) over_clause ::= OVER LP window RP */
160134 -2, /* (335) over_clause ::= OVER nm */
160135 -5, /* (336) filter_clause ::= FILTER LP WHERE expr RP */
160136 -1, /* (337) input ::= cmdlist */
160137 -2, /* (338) cmdlist ::= cmdlist ecmd */
160138 -1, /* (339) cmdlist ::= ecmd */
160139 -1, /* (340) ecmd ::= SEMI */
160140 -2, /* (341) ecmd ::= cmdx SEMI */
160141 -3, /* (342) ecmd ::= explain cmdx SEMI */
160142 0, /* (343) trans_opt ::= */
160143 -1, /* (344) trans_opt ::= TRANSACTION */
160144 -2, /* (345) trans_opt ::= TRANSACTION nm */
160145 -1, /* (346) savepoint_opt ::= SAVEPOINT */
160146 0, /* (347) savepoint_opt ::= */
160147 -2, /* (348) cmd ::= create_table create_table_args */
160148 -4, /* (349) columnlist ::= columnlist COMMA columnname carglist */
160149 -2, /* (350) columnlist ::= columnname carglist */
160150 -1, /* (351) nm ::= ID|INDEXED */
160151 -1, /* (352) nm ::= STRING */
160152 -1, /* (353) nm ::= JOIN_KW */
160153 -1, /* (354) typetoken ::= typename */
160154 -1, /* (355) typename ::= ID|STRING */
160155 -1, /* (356) signed ::= plus_num */
160156 -1, /* (357) signed ::= minus_num */
160157 -2, /* (358) carglist ::= carglist ccons */
160158 0, /* (359) carglist ::= */
160159 -2, /* (360) ccons ::= NULL onconf */
160160 -4, /* (361) ccons ::= GENERATED ALWAYS AS generated */
160161 -2, /* (362) ccons ::= AS generated */
160162 -2, /* (363) conslist_opt ::= COMMA conslist */
160163 -3, /* (364) conslist ::= conslist tconscomma tcons */
160164 -1, /* (365) conslist ::= tcons */
160165 0, /* (366) tconscomma ::= */
160166 -1, /* (367) defer_subclause_opt ::= defer_subclause */
160167 -1, /* (368) resolvetype ::= raisetype */
160168 -1, /* (369) selectnowith ::= oneselect */
160169 -1, /* (370) oneselect ::= values */
160170 -2, /* (371) sclp ::= selcollist COMMA */
160171 -1, /* (372) as ::= ID|STRING */
160172 0, /* (373) returning ::= */
160173 -1, /* (374) expr ::= term */
160174 -1, /* (375) likeop ::= LIKE_KW|MATCH */
160175 -1, /* (376) exprlist ::= nexprlist */
160176 -1, /* (377) nmnum ::= plus_num */
160177 -1, /* (378) nmnum ::= nm */
160178 -1, /* (379) nmnum ::= ON */
160179 -1, /* (380) nmnum ::= DELETE */
160180 -1, /* (381) nmnum ::= DEFAULT */
160181 -1, /* (382) plus_num ::= INTEGER|FLOAT */
160182 0, /* (383) foreach_clause ::= */
160183 -3, /* (384) foreach_clause ::= FOR EACH ROW */
160184 -1, /* (385) trnm ::= nm */
160185 0, /* (386) tridxby ::= */
160186 -1, /* (387) database_kw_opt ::= DATABASE */
160187 0, /* (388) database_kw_opt ::= */
160188 0, /* (389) kwcolumn_opt ::= */
160189 -1, /* (390) kwcolumn_opt ::= COLUMNKW */
160190 -1, /* (391) vtabarglist ::= vtabarg */
160191 -3, /* (392) vtabarglist ::= vtabarglist COMMA vtabarg */
160192 -2, /* (393) vtabarg ::= vtabarg vtabargtoken */
160193 0, /* (394) anylist ::= */
160194 -4, /* (395) anylist ::= anylist LP anylist RP */
160195 -2, /* (396) anylist ::= anylist ANY */
160196 0, /* (397) with ::= */
160197 };
160198
160199 static void yy_accept(yyParser*); /* Forward Declaration */
160200
160201 /*
@@ -159779,20 +160243,20 @@
160243 break;
160244 case 2: /* cmdx ::= cmd */
160245 { sqlite3FinishCoding(pParse); }
160246 break;
160247 case 3: /* cmd ::= BEGIN transtype trans_opt */
160248 {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy60);}
160249 break;
160250 case 4: /* transtype ::= */
160251 {yymsp[1].minor.yy60 = TK_DEFERRED;}
160252 break;
160253 case 5: /* transtype ::= DEFERRED */
160254 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
160255 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
160256 case 318: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==318);
160257 {yymsp[0].minor.yy60 = yymsp[0].major; /*A-overwrites-X*/}
160258 break;
160259 case 8: /* cmd ::= COMMIT|END trans_opt */
160260 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
160261 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
160262 break;
@@ -159811,11 +160275,11 @@
160275 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
160276 }
160277 break;
160278 case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
160279 {
160280 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy60,0,0,yymsp[-2].minor.yy60);
160281 }
160282 break;
160283 case 14: /* createkw ::= CREATE */
160284 {disableLookaside(pParse);}
160285 break;
@@ -159826,36 +160290,36 @@
160290 case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60);
160291 case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70);
160292 case 79: /* ifexists ::= */ yytestcase(yyruleno==79);
160293 case 96: /* distinct ::= */ yytestcase(yyruleno==96);
160294 case 239: /* collate ::= */ yytestcase(yyruleno==239);
160295 {yymsp[1].minor.yy60 = 0;}
160296 break;
160297 case 16: /* ifnotexists ::= IF NOT EXISTS */
160298 {yymsp[-2].minor.yy60 = 1;}
160299 break;
160300 case 17: /* temp ::= TEMP */
160301 case 46: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==46);
160302 {yymsp[0].minor.yy60 = 1;}
160303 break;
160304 case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
160305 {
160306 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy60,0);
160307 }
160308 break;
160309 case 20: /* create_table_args ::= AS select */
160310 {
160311 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy307);
160312 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy307);
160313 }
160314 break;
160315 case 22: /* table_options ::= WITHOUT nm */
160316 {
160317 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
160318 yymsp[-1].minor.yy60 = TF_WithoutRowid | TF_NoVisibleRowid;
160319 }else{
160320 yymsp[-1].minor.yy60 = 0;
160321 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
160322 }
160323 }
160324 break;
160325 case 23: /* columnname ::= nm typetoken */
@@ -159880,11 +160344,11 @@
160344 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
160345 break;
160346 case 28: /* scanpt ::= */
160347 {
160348 assert( yyLookahead!=YYNOCODE );
160349 yymsp[1].minor.yy528 = yyLookaheadToken.z;
160350 }
160351 break;
160352 case 29: /* scantok ::= */
160353 {
160354 assert( yyLookahead!=YYNOCODE );
@@ -159894,21 +160358,21 @@
160358 case 30: /* ccons ::= CONSTRAINT nm */
160359 case 65: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==65);
160360 {pParse->constraintName = yymsp[0].minor.yy0;}
160361 break;
160362 case 31: /* ccons ::= DEFAULT scantok term */
160363 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy602,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
160364 break;
160365 case 32: /* ccons ::= DEFAULT LP expr RP */
160366 {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy602,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);}
160367 break;
160368 case 33: /* ccons ::= DEFAULT PLUS scantok term */
160369 {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy602,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);}
160370 break;
160371 case 34: /* ccons ::= DEFAULT MINUS scantok term */
160372 {
160373 Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy602, 0);
160374 sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);
160375 }
160376 break;
160377 case 35: /* ccons ::= DEFAULT scantok ID|INDEXED */
160378 {
@@ -159919,274 +160383,256 @@
160383 }
160384 sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n);
160385 }
160386 break;
160387 case 36: /* ccons ::= NOT NULL onconf */
160388 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy60);}
160389 break;
160390 case 37: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
160391 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy60,yymsp[0].minor.yy60,yymsp[-2].minor.yy60);}
160392 break;
160393 case 38: /* ccons ::= UNIQUE onconf */
160394 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy60,0,0,0,0,
160395 SQLITE_IDXTYPE_UNIQUE);}
160396 break;
160397 case 39: /* ccons ::= CHECK LP expr RP */
160398 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy602,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);}
160399 break;
160400 case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */
160401 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy338,yymsp[0].minor.yy60);}
160402 break;
160403 case 41: /* ccons ::= defer_subclause */
160404 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy60);}
160405 break;
160406 case 42: /* ccons ::= COLLATE ID|STRING */
160407 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
160408 break;
160409 case 43: /* generated ::= LP expr RP */
160410 {sqlite3AddGenerated(pParse,yymsp[-1].minor.yy602,0);}
160411 break;
160412 case 44: /* generated ::= LP expr RP ID */
160413 {sqlite3AddGenerated(pParse,yymsp[-2].minor.yy602,&yymsp[0].minor.yy0);}
160414 break;
160415 case 47: /* refargs ::= */
160416 { yymsp[1].minor.yy60 = OE_None*0x0101; /* EV: R-19803-45884 */}
160417 break;
160418 case 48: /* refargs ::= refargs refarg */
160419 { yymsp[-1].minor.yy60 = (yymsp[-1].minor.yy60 & ~yymsp[0].minor.yy615.mask) | yymsp[0].minor.yy615.value; }
160420 break;
160421 case 49: /* refarg ::= MATCH nm */
160422 { yymsp[-1].minor.yy615.value = 0; yymsp[-1].minor.yy615.mask = 0x000000; }
160423 break;
160424 case 50: /* refarg ::= ON INSERT refact */
160425 { yymsp[-2].minor.yy615.value = 0; yymsp[-2].minor.yy615.mask = 0x000000; }
160426 break;
160427 case 51: /* refarg ::= ON DELETE refact */
160428 { yymsp[-2].minor.yy615.value = yymsp[0].minor.yy60; yymsp[-2].minor.yy615.mask = 0x0000ff; }
160429 break;
160430 case 52: /* refarg ::= ON UPDATE refact */
160431 { yymsp[-2].minor.yy615.value = yymsp[0].minor.yy60<<8; yymsp[-2].minor.yy615.mask = 0x00ff00; }
160432 break;
160433 case 53: /* refact ::= SET NULL */
160434 { yymsp[-1].minor.yy60 = OE_SetNull; /* EV: R-33326-45252 */}
160435 break;
160436 case 54: /* refact ::= SET DEFAULT */
160437 { yymsp[-1].minor.yy60 = OE_SetDflt; /* EV: R-33326-45252 */}
160438 break;
160439 case 55: /* refact ::= CASCADE */
160440 { yymsp[0].minor.yy60 = OE_Cascade; /* EV: R-33326-45252 */}
160441 break;
160442 case 56: /* refact ::= RESTRICT */
160443 { yymsp[0].minor.yy60 = OE_Restrict; /* EV: R-33326-45252 */}
160444 break;
160445 case 57: /* refact ::= NO ACTION */
160446 { yymsp[-1].minor.yy60 = OE_None; /* EV: R-33326-45252 */}
160447 break;
160448 case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
160449 {yymsp[-2].minor.yy60 = 0;}
160450 break;
160451 case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
160452 case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74);
160453 case 169: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==169);
160454 {yymsp[-1].minor.yy60 = yymsp[0].minor.yy60;}
160455 break;
160456 case 61: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
160457 case 78: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==78);
160458 case 211: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==211);
160459 case 214: /* in_op ::= NOT IN */ yytestcase(yyruleno==214);
160460 case 240: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==240);
160461 {yymsp[-1].minor.yy60 = 1;}
160462 break;
160463 case 62: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
160464 {yymsp[-1].minor.yy60 = 0;}
160465 break;
160466 case 64: /* tconscomma ::= COMMA */
160467 {pParse->constraintName.n = 0;}
160468 break;
160469 case 66: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
160470 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy338,yymsp[0].minor.yy60,yymsp[-2].minor.yy60,0);}
160471 break;
160472 case 67: /* tcons ::= UNIQUE LP sortlist RP onconf */
160473 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy338,yymsp[0].minor.yy60,0,0,0,0,
160474 SQLITE_IDXTYPE_UNIQUE);}
160475 break;
160476 case 68: /* tcons ::= CHECK LP expr RP onconf */
160477 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy602,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);}
160478 break;
160479 case 69: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
160480 {
160481 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy338, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy338, yymsp[-1].minor.yy60);
160482 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy60);
160483 }
160484 break;
160485 case 71: /* onconf ::= */
160486 case 73: /* orconf ::= */ yytestcase(yyruleno==73);
160487 {yymsp[1].minor.yy60 = OE_Default;}
160488 break;
160489 case 72: /* onconf ::= ON CONFLICT resolvetype */
160490 {yymsp[-2].minor.yy60 = yymsp[0].minor.yy60;}
160491 break;
160492 case 75: /* resolvetype ::= IGNORE */
160493 {yymsp[0].minor.yy60 = OE_Ignore;}
160494 break;
160495 case 76: /* resolvetype ::= REPLACE */
160496 case 170: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==170);
160497 {yymsp[0].minor.yy60 = OE_Replace;}
160498 break;
160499 case 77: /* cmd ::= DROP TABLE ifexists fullname */
160500 {
160501 sqlite3DropTable(pParse, yymsp[0].minor.yy291, 0, yymsp[-1].minor.yy60);
160502 }
160503 break;
160504 case 80: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
160505 {
160506 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy338, yymsp[0].minor.yy307, yymsp[-7].minor.yy60, yymsp[-5].minor.yy60);
160507 }
160508 break;
160509 case 81: /* cmd ::= DROP VIEW ifexists fullname */
160510 {
160511 sqlite3DropTable(pParse, yymsp[0].minor.yy291, 1, yymsp[-1].minor.yy60);
160512 }
160513 break;
160514 case 82: /* cmd ::= select */
160515 {
160516 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0};
160517 sqlite3Select(pParse, yymsp[0].minor.yy307, &dest);
160518 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy307);
160519 }
160520 break;
160521 case 83: /* select ::= WITH wqlist selectnowith */
160522 {yymsp[-2].minor.yy307 = attachWithToSelect(pParse,yymsp[0].minor.yy307,yymsp[-1].minor.yy195);}
 
 
 
 
 
 
 
 
 
160523 break;
160524 case 84: /* select ::= WITH RECURSIVE wqlist selectnowith */
160525 {yymsp[-3].minor.yy307 = attachWithToSelect(pParse,yymsp[0].minor.yy307,yymsp[-1].minor.yy195);}
 
 
 
 
 
 
 
 
 
160526 break;
160527 case 85: /* select ::= selectnowith */
160528 {
160529 Select *p = yymsp[0].minor.yy307;
160530 if( p ){
160531 parserDoubleLinkSelect(pParse, p);
160532 }
160533 yymsp[0].minor.yy307 = p; /*A-overwrites-X*/
160534 }
160535 break;
160536 case 86: /* selectnowith ::= selectnowith multiselect_op oneselect */
160537 {
160538 Select *pRhs = yymsp[0].minor.yy307;
160539 Select *pLhs = yymsp[-2].minor.yy307;
160540 if( pRhs && pRhs->pPrior ){
160541 SrcList *pFrom;
160542 Token x;
160543 x.n = 0;
160544 parserDoubleLinkSelect(pParse, pRhs);
160545 pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
160546 pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0);
160547 }
160548 if( pRhs ){
160549 pRhs->op = (u8)yymsp[-1].minor.yy60;
160550 pRhs->pPrior = pLhs;
160551 if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
160552 pRhs->selFlags &= ~SF_MultiValue;
160553 if( yymsp[-1].minor.yy60!=TK_ALL ) pParse->hasCompound = 1;
160554 }else{
160555 sqlite3SelectDelete(pParse->db, pLhs);
160556 }
160557 yymsp[-2].minor.yy307 = pRhs;
160558 }
160559 break;
160560 case 87: /* multiselect_op ::= UNION */
160561 case 89: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==89);
160562 {yymsp[0].minor.yy60 = yymsp[0].major; /*A-overwrites-OP*/}
160563 break;
160564 case 88: /* multiselect_op ::= UNION ALL */
160565 {yymsp[-1].minor.yy60 = TK_ALL;}
160566 break;
160567 case 90: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
160568 {
160569 yymsp[-8].minor.yy307 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy338,yymsp[-5].minor.yy291,yymsp[-4].minor.yy602,yymsp[-3].minor.yy338,yymsp[-2].minor.yy602,yymsp[-1].minor.yy338,yymsp[-7].minor.yy60,yymsp[0].minor.yy602);
160570 }
160571 break;
160572 case 91: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
160573 {
160574 yymsp[-9].minor.yy307 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy338,yymsp[-6].minor.yy291,yymsp[-5].minor.yy602,yymsp[-4].minor.yy338,yymsp[-3].minor.yy602,yymsp[-1].minor.yy338,yymsp[-8].minor.yy60,yymsp[0].minor.yy602);
160575 if( yymsp[-9].minor.yy307 ){
160576 yymsp[-9].minor.yy307->pWinDefn = yymsp[-2].minor.yy19;
160577 }else{
160578 sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy19);
160579 }
160580 }
160581 break;
160582 case 92: /* values ::= VALUES LP nexprlist RP */
160583 {
160584 yymsp[-3].minor.yy307 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy338,0,0,0,0,0,SF_Values,0);
160585 }
160586 break;
160587 case 93: /* values ::= values COMMA LP nexprlist RP */
160588 {
160589 Select *pRight, *pLeft = yymsp[-4].minor.yy307;
160590 pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy338,0,0,0,0,0,SF_Values|SF_MultiValue,0);
160591 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
160592 if( pRight ){
160593 pRight->op = TK_ALL;
160594 pRight->pPrior = pLeft;
160595 yymsp[-4].minor.yy307 = pRight;
160596 }else{
160597 yymsp[-4].minor.yy307 = pLeft;
160598 }
160599 }
160600 break;
160601 case 94: /* distinct ::= DISTINCT */
160602 {yymsp[0].minor.yy60 = SF_Distinct;}
160603 break;
160604 case 95: /* distinct ::= ALL */
160605 {yymsp[0].minor.yy60 = SF_All;}
160606 break;
160607 case 97: /* sclp ::= */
160608 case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130);
160609 case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140);
160610 case 227: /* exprlist ::= */ yytestcase(yyruleno==227);
160611 case 230: /* paren_exprlist ::= */ yytestcase(yyruleno==230);
160612 case 235: /* eidlist_opt ::= */ yytestcase(yyruleno==235);
160613 {yymsp[1].minor.yy338 = 0;}
160614 break;
160615 case 98: /* selcollist ::= sclp scanpt expr scanpt as */
160616 {
160617 yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy338, yymsp[-2].minor.yy602);
160618 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy338, &yymsp[0].minor.yy0, 1);
160619 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy338,yymsp[-3].minor.yy528,yymsp[-1].minor.yy528);
160620 }
160621 break;
160622 case 99: /* selcollist ::= sclp scanpt STAR */
160623 {
160624 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
160625 yymsp[-2].minor.yy338 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy338, p);
160626 }
160627 break;
160628 case 100: /* selcollist ::= sclp scanpt nm DOT STAR */
160629 {
160630 Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
160631 Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
160632 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
160633 yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy338, pDot);
160634 }
160635 break;
160636 case 101: /* as ::= AS nm */
160637 case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112);
160638 case 251: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==251);
@@ -160193,49 +160639,49 @@
160639 case 252: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==252);
160640 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
160641 break;
160642 case 103: /* from ::= */
160643 case 106: /* stl_prefix ::= */ yytestcase(yyruleno==106);
160644 {yymsp[1].minor.yy291 = 0;}
160645 break;
160646 case 104: /* from ::= FROM seltablist */
160647 {
160648 yymsp[-1].minor.yy291 = yymsp[0].minor.yy291;
160649 sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy291);
160650 }
160651 break;
160652 case 105: /* stl_prefix ::= seltablist joinop */
160653 {
160654 if( ALWAYS(yymsp[-1].minor.yy291 && yymsp[-1].minor.yy291->nSrc>0) ) yymsp[-1].minor.yy291->a[yymsp[-1].minor.yy291->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy60;
160655 }
160656 break;
160657 case 107: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
160658 {
160659 yymsp[-6].minor.yy291 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy291,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy602,yymsp[0].minor.yy288);
160660 sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy291, &yymsp[-2].minor.yy0);
160661 }
160662 break;
160663 case 108: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
160664 {
160665 yymsp[-8].minor.yy291 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy291,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy602,yymsp[0].minor.yy288);
160666 sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy291, yymsp[-4].minor.yy338);
160667 }
160668 break;
160669 case 109: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
160670 {
160671 yymsp[-6].minor.yy291 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy291,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy307,yymsp[-1].minor.yy602,yymsp[0].minor.yy288);
160672 }
160673 break;
160674 case 110: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
160675 {
160676 if( yymsp[-6].minor.yy291==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy602==0 && yymsp[0].minor.yy288==0 ){
160677 yymsp[-6].minor.yy291 = yymsp[-4].minor.yy291;
160678 }else if( yymsp[-4].minor.yy291->nSrc==1 ){
160679 yymsp[-6].minor.yy291 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy291,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy602,yymsp[0].minor.yy288);
160680 if( yymsp[-6].minor.yy291 ){
160681 SrcItem *pNew = &yymsp[-6].minor.yy291->a[yymsp[-6].minor.yy291->nSrc-1];
160682 SrcItem *pOld = yymsp[-4].minor.yy291->a;
160683 pNew->zName = pOld->zName;
160684 pNew->zDatabase = pOld->zDatabase;
160685 pNew->pSelect = pOld->pSelect;
160686 if( pOld->fg.isTabFunc ){
160687 pNew->u1.pFuncArg = pOld->u1.pFuncArg;
@@ -160244,240 +160690,240 @@
160690 pNew->fg.isTabFunc = 1;
160691 }
160692 pOld->zName = pOld->zDatabase = 0;
160693 pOld->pSelect = 0;
160694 }
160695 sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy291);
160696 }else{
160697 Select *pSubquery;
160698 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy291);
160699 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy291,0,0,0,0,SF_NestedFrom,0);
160700 yymsp[-6].minor.yy291 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy291,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy602,yymsp[0].minor.yy288);
160701 }
160702 }
160703 break;
160704 case 111: /* dbnm ::= */
160705 case 125: /* indexed_opt ::= */ yytestcase(yyruleno==125);
160706 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
160707 break;
160708 case 113: /* fullname ::= nm */
160709 {
160710 yylhsminor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
160711 if( IN_RENAME_OBJECT && yylhsminor.yy291 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy291->a[0].zName, &yymsp[0].minor.yy0);
160712 }
160713 yymsp[0].minor.yy291 = yylhsminor.yy291;
160714 break;
160715 case 114: /* fullname ::= nm DOT nm */
160716 {
160717 yylhsminor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
160718 if( IN_RENAME_OBJECT && yylhsminor.yy291 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy291->a[0].zName, &yymsp[0].minor.yy0);
160719 }
160720 yymsp[-2].minor.yy291 = yylhsminor.yy291;
160721 break;
160722 case 115: /* xfullname ::= nm */
160723 {yymsp[0].minor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
160724 break;
160725 case 116: /* xfullname ::= nm DOT nm */
160726 {yymsp[-2].minor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
160727 break;
160728 case 117: /* xfullname ::= nm DOT nm AS nm */
160729 {
160730 yymsp[-4].minor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
160731 if( yymsp[-4].minor.yy291 ) yymsp[-4].minor.yy291->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
160732 }
160733 break;
160734 case 118: /* xfullname ::= nm AS nm */
160735 {
160736 yymsp[-2].minor.yy291 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
160737 if( yymsp[-2].minor.yy291 ) yymsp[-2].minor.yy291->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
160738 }
160739 break;
160740 case 119: /* joinop ::= COMMA|JOIN */
160741 { yymsp[0].minor.yy60 = JT_INNER; }
160742 break;
160743 case 120: /* joinop ::= JOIN_KW JOIN */
160744 {yymsp[-1].minor.yy60 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
160745 break;
160746 case 121: /* joinop ::= JOIN_KW nm JOIN */
160747 {yymsp[-2].minor.yy60 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
160748 break;
160749 case 122: /* joinop ::= JOIN_KW nm nm JOIN */
160750 {yymsp[-3].minor.yy60 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
160751 break;
160752 case 123: /* on_opt ::= ON expr */
160753 case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143);
160754 case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150);
160755 case 152: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==152);
160756 case 223: /* case_else ::= ELSE expr */ yytestcase(yyruleno==223);
160757 case 244: /* vinto ::= INTO expr */ yytestcase(yyruleno==244);
160758 {yymsp[-1].minor.yy602 = yymsp[0].minor.yy602;}
160759 break;
160760 case 124: /* on_opt ::= */
160761 case 142: /* having_opt ::= */ yytestcase(yyruleno==142);
160762 case 144: /* limit_opt ::= */ yytestcase(yyruleno==144);
160763 case 149: /* where_opt ::= */ yytestcase(yyruleno==149);
160764 case 151: /* where_opt_ret ::= */ yytestcase(yyruleno==151);
160765 case 224: /* case_else ::= */ yytestcase(yyruleno==224);
160766 case 226: /* case_operand ::= */ yytestcase(yyruleno==226);
160767 case 245: /* vinto ::= */ yytestcase(yyruleno==245);
160768 {yymsp[1].minor.yy602 = 0;}
160769 break;
160770 case 126: /* indexed_opt ::= INDEXED BY nm */
160771 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
160772 break;
160773 case 127: /* indexed_opt ::= NOT INDEXED */
160774 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
160775 break;
160776 case 128: /* using_opt ::= USING LP idlist RP */
160777 {yymsp[-3].minor.yy288 = yymsp[-1].minor.yy288;}
160778 break;
160779 case 129: /* using_opt ::= */
160780 case 171: /* idlist_opt ::= */ yytestcase(yyruleno==171);
160781 {yymsp[1].minor.yy288 = 0;}
160782 break;
160783 case 131: /* orderby_opt ::= ORDER BY sortlist */
160784 case 141: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==141);
160785 {yymsp[-2].minor.yy338 = yymsp[0].minor.yy338;}
160786 break;
160787 case 132: /* sortlist ::= sortlist COMMA expr sortorder nulls */
160788 {
160789 yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy338,yymsp[-2].minor.yy602);
160790 sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy338,yymsp[-1].minor.yy60,yymsp[0].minor.yy60);
160791 }
160792 break;
160793 case 133: /* sortlist ::= expr sortorder nulls */
160794 {
160795 yymsp[-2].minor.yy338 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy602); /*A-overwrites-Y*/
160796 sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy338,yymsp[-1].minor.yy60,yymsp[0].minor.yy60);
160797 }
160798 break;
160799 case 134: /* sortorder ::= ASC */
160800 {yymsp[0].minor.yy60 = SQLITE_SO_ASC;}
160801 break;
160802 case 135: /* sortorder ::= DESC */
160803 {yymsp[0].minor.yy60 = SQLITE_SO_DESC;}
160804 break;
160805 case 136: /* sortorder ::= */
160806 case 139: /* nulls ::= */ yytestcase(yyruleno==139);
160807 {yymsp[1].minor.yy60 = SQLITE_SO_UNDEFINED;}
160808 break;
160809 case 137: /* nulls ::= NULLS FIRST */
160810 {yymsp[-1].minor.yy60 = SQLITE_SO_ASC;}
160811 break;
160812 case 138: /* nulls ::= NULLS LAST */
160813 {yymsp[-1].minor.yy60 = SQLITE_SO_DESC;}
160814 break;
160815 case 145: /* limit_opt ::= LIMIT expr */
160816 {yymsp[-1].minor.yy602 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy602,0);}
160817 break;
160818 case 146: /* limit_opt ::= LIMIT expr OFFSET expr */
160819 {yymsp[-3].minor.yy602 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy602,yymsp[0].minor.yy602);}
160820 break;
160821 case 147: /* limit_opt ::= LIMIT expr COMMA expr */
160822 {yymsp[-3].minor.yy602 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy602,yymsp[-2].minor.yy602);}
160823 break;
160824 case 148: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
160825 {
160826 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy291, &yymsp[-1].minor.yy0);
160827 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy291,yymsp[0].minor.yy602,0,0);
160828 }
160829 break;
160830 case 153: /* where_opt_ret ::= RETURNING selcollist */
160831 {sqlite3AddReturning(pParse,yymsp[0].minor.yy338); yymsp[-1].minor.yy602 = 0;}
160832 break;
160833 case 154: /* where_opt_ret ::= WHERE expr RETURNING selcollist */
160834 {sqlite3AddReturning(pParse,yymsp[0].minor.yy338); yymsp[-3].minor.yy602 = yymsp[-2].minor.yy602;}
160835 break;
160836 case 155: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */
160837 {
160838 sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy291, &yymsp[-4].minor.yy0);
160839 sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy338,"set list");
160840 yymsp[-5].minor.yy291 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy291, yymsp[-1].minor.yy291);
160841 sqlite3Update(pParse,yymsp[-5].minor.yy291,yymsp[-2].minor.yy338,yymsp[0].minor.yy602,yymsp[-6].minor.yy60,0,0,0);
160842 }
160843 break;
160844 case 156: /* setlist ::= setlist COMMA nm EQ expr */
160845 {
160846 yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy338, yymsp[0].minor.yy602);
160847 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy338, &yymsp[-2].minor.yy0, 1);
160848 }
160849 break;
160850 case 157: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
160851 {
160852 yymsp[-6].minor.yy338 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy338, yymsp[-3].minor.yy288, yymsp[0].minor.yy602);
160853 }
160854 break;
160855 case 158: /* setlist ::= nm EQ expr */
160856 {
160857 yylhsminor.yy338 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy602);
160858 sqlite3ExprListSetName(pParse, yylhsminor.yy338, &yymsp[-2].minor.yy0, 1);
160859 }
160860 yymsp[-2].minor.yy338 = yylhsminor.yy338;
160861 break;
160862 case 159: /* setlist ::= LP idlist RP EQ expr */
160863 {
160864 yymsp[-4].minor.yy338 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy288, yymsp[0].minor.yy602);
160865 }
160866 break;
160867 case 160: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
160868 {
160869 sqlite3Insert(pParse, yymsp[-3].minor.yy291, yymsp[-1].minor.yy307, yymsp[-2].minor.yy288, yymsp[-5].minor.yy60, yymsp[0].minor.yy178);
160870 }
160871 break;
160872 case 161: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
160873 {
160874 sqlite3Insert(pParse, yymsp[-4].minor.yy291, 0, yymsp[-3].minor.yy288, yymsp[-6].minor.yy60, 0);
160875 }
160876 break;
160877 case 162: /* upsert ::= */
160878 { yymsp[1].minor.yy178 = 0; }
160879 break;
160880 case 163: /* upsert ::= RETURNING selcollist */
160881 { yymsp[-1].minor.yy178 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy338); }
160882 break;
160883 case 164: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
160884 { yymsp[-11].minor.yy178 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy338,yymsp[-6].minor.yy602,yymsp[-2].minor.yy338,yymsp[-1].minor.yy602,yymsp[0].minor.yy178);}
160885 break;
160886 case 165: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
160887 { yymsp[-8].minor.yy178 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy338,yymsp[-3].minor.yy602,0,0,yymsp[0].minor.yy178); }
160888 break;
160889 case 166: /* upsert ::= ON CONFLICT DO NOTHING returning */
160890 { yymsp[-4].minor.yy178 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
160891 break;
160892 case 167: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
160893 { yymsp[-7].minor.yy178 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy338,yymsp[-1].minor.yy602,0);}
160894 break;
160895 case 168: /* returning ::= RETURNING selcollist */
160896 {sqlite3AddReturning(pParse,yymsp[0].minor.yy338);}
160897 break;
160898 case 172: /* idlist_opt ::= LP idlist RP */
160899 {yymsp[-2].minor.yy288 = yymsp[-1].minor.yy288;}
160900 break;
160901 case 173: /* idlist ::= idlist COMMA nm */
160902 {yymsp[-2].minor.yy288 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy288,&yymsp[0].minor.yy0);}
160903 break;
160904 case 174: /* idlist ::= nm */
160905 {yymsp[0].minor.yy288 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
160906 break;
160907 case 175: /* expr ::= LP expr RP */
160908 {yymsp[-2].minor.yy602 = yymsp[-1].minor.yy602;}
160909 break;
160910 case 176: /* expr ::= ID|INDEXED */
160911 case 177: /* expr ::= JOIN_KW */ yytestcase(yyruleno==177);
160912 {yymsp[0].minor.yy602=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
160913 break;
160914 case 178: /* expr ::= nm DOT nm */
160915 {
160916 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
160917 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
160918 if( IN_RENAME_OBJECT ){
160919 sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
160920 sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0);
160921 }
160922 yylhsminor.yy602 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
160923 }
160924 yymsp[-2].minor.yy602 = yylhsminor.yy602;
160925 break;
160926 case 179: /* expr ::= nm DOT nm DOT nm */
160927 {
160928 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
160929 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
@@ -160485,322 +160931,322 @@
160931 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
160932 if( IN_RENAME_OBJECT ){
160933 sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0);
160934 sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0);
160935 }
160936 yylhsminor.yy602 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
160937 }
160938 yymsp[-4].minor.yy602 = yylhsminor.yy602;
160939 break;
160940 case 180: /* term ::= NULL|FLOAT|BLOB */
160941 case 181: /* term ::= STRING */ yytestcase(yyruleno==181);
160942 {yymsp[0].minor.yy602=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
160943 break;
160944 case 182: /* term ::= INTEGER */
160945 {
160946 yylhsminor.yy602 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
160947 }
160948 yymsp[0].minor.yy602 = yylhsminor.yy602;
160949 break;
160950 case 183: /* expr ::= VARIABLE */
160951 {
160952 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
160953 u32 n = yymsp[0].minor.yy0.n;
160954 yymsp[0].minor.yy602 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
160955 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy602, n);
160956 }else{
160957 /* When doing a nested parse, one can include terms in an expression
160958 ** that look like this: #1 #2 ... These terms refer to registers
160959 ** in the virtual machine. #N is the N-th register. */
160960 Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/
160961 assert( t.n>=2 );
160962 if( pParse->nested==0 ){
160963 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t);
160964 yymsp[0].minor.yy602 = 0;
160965 }else{
160966 yymsp[0].minor.yy602 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
160967 if( yymsp[0].minor.yy602 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy602->iTable);
160968 }
160969 }
160970 }
160971 break;
160972 case 184: /* expr ::= expr COLLATE ID|STRING */
160973 {
160974 yymsp[-2].minor.yy602 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy602, &yymsp[0].minor.yy0, 1);
160975 }
160976 break;
160977 case 185: /* expr ::= CAST LP expr AS typetoken RP */
160978 {
160979 yymsp[-5].minor.yy602 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
160980 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy602, yymsp[-3].minor.yy602, 0);
160981 }
160982 break;
160983 case 186: /* expr ::= ID|INDEXED LP distinct exprlist RP */
160984 {
160985 yylhsminor.yy602 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy338, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy60);
160986 }
160987 yymsp[-4].minor.yy602 = yylhsminor.yy602;
160988 break;
160989 case 187: /* expr ::= ID|INDEXED LP STAR RP */
160990 {
160991 yylhsminor.yy602 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
160992 }
160993 yymsp[-3].minor.yy602 = yylhsminor.yy602;
160994 break;
160995 case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
160996 {
160997 yylhsminor.yy602 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy338, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy60);
160998 sqlite3WindowAttach(pParse, yylhsminor.yy602, yymsp[0].minor.yy19);
160999 }
161000 yymsp[-5].minor.yy602 = yylhsminor.yy602;
161001 break;
161002 case 189: /* expr ::= ID|INDEXED LP STAR RP filter_over */
161003 {
161004 yylhsminor.yy602 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
161005 sqlite3WindowAttach(pParse, yylhsminor.yy602, yymsp[0].minor.yy19);
161006 }
161007 yymsp[-4].minor.yy602 = yylhsminor.yy602;
161008 break;
161009 case 190: /* term ::= CTIME_KW */
161010 {
161011 yylhsminor.yy602 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
161012 }
161013 yymsp[0].minor.yy602 = yylhsminor.yy602;
161014 break;
161015 case 191: /* expr ::= LP nexprlist COMMA expr RP */
161016 {
161017 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy338, yymsp[-1].minor.yy602);
161018 yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
161019 if( yymsp[-4].minor.yy602 ){
161020 yymsp[-4].minor.yy602->x.pList = pList;
161021 if( ALWAYS(pList->nExpr) ){
161022 yymsp[-4].minor.yy602->flags |= pList->a[0].pExpr->flags & EP_Propagate;
161023 }
161024 }else{
161025 sqlite3ExprListDelete(pParse->db, pList);
161026 }
161027 }
161028 break;
161029 case 192: /* expr ::= expr AND expr */
161030 {yymsp[-2].minor.yy602=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy602,yymsp[0].minor.yy602);}
161031 break;
161032 case 193: /* expr ::= expr OR expr */
161033 case 194: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==194);
161034 case 195: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==195);
161035 case 196: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==196);
161036 case 197: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==197);
161037 case 198: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==198);
161038 case 199: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==199);
161039 {yymsp[-2].minor.yy602=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy602,yymsp[0].minor.yy602);}
161040 break;
161041 case 200: /* likeop ::= NOT LIKE_KW|MATCH */
161042 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
161043 break;
161044 case 201: /* expr ::= expr likeop expr */
161045 {
161046 ExprList *pList;
161047 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
161048 yymsp[-1].minor.yy0.n &= 0x7fffffff;
161049 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy602);
161050 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy602);
161051 yymsp[-2].minor.yy602 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
161052 if( bNot ) yymsp[-2].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy602, 0);
161053 if( yymsp[-2].minor.yy602 ) yymsp[-2].minor.yy602->flags |= EP_InfixFunc;
161054 }
161055 break;
161056 case 202: /* expr ::= expr likeop expr ESCAPE expr */
161057 {
161058 ExprList *pList;
161059 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
161060 yymsp[-3].minor.yy0.n &= 0x7fffffff;
161061 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy602);
161062 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy602);
161063 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy602);
161064 yymsp[-4].minor.yy602 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
161065 if( bNot ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
161066 if( yymsp[-4].minor.yy602 ) yymsp[-4].minor.yy602->flags |= EP_InfixFunc;
161067 }
161068 break;
161069 case 203: /* expr ::= expr ISNULL|NOTNULL */
161070 {yymsp[-1].minor.yy602 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy602,0);}
161071 break;
161072 case 204: /* expr ::= expr NOT NULL */
161073 {yymsp[-2].minor.yy602 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy602,0);}
161074 break;
161075 case 205: /* expr ::= expr IS expr */
161076 {
161077 yymsp[-2].minor.yy602 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy602,yymsp[0].minor.yy602);
161078 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy602, yymsp[-2].minor.yy602, TK_ISNULL);
161079 }
161080 break;
161081 case 206: /* expr ::= expr IS NOT expr */
161082 {
161083 yymsp[-3].minor.yy602 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy602,yymsp[0].minor.yy602);
161084 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy602, yymsp[-3].minor.yy602, TK_NOTNULL);
161085 }
161086 break;
161087 case 207: /* expr ::= NOT expr */
161088 case 208: /* expr ::= BITNOT expr */ yytestcase(yyruleno==208);
161089 {yymsp[-1].minor.yy602 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy602, 0);/*A-overwrites-B*/}
161090 break;
161091 case 209: /* expr ::= PLUS|MINUS expr */
161092 {
161093 yymsp[-1].minor.yy602 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy602, 0);
161094 /*A-overwrites-B*/
161095 }
161096 break;
161097 case 210: /* between_op ::= BETWEEN */
161098 case 213: /* in_op ::= IN */ yytestcase(yyruleno==213);
161099 {yymsp[0].minor.yy60 = 0;}
161100 break;
161101 case 212: /* expr ::= expr between_op expr AND expr */
161102 {
161103 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy602);
161104 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy602);
161105 yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy602, 0);
161106 if( yymsp[-4].minor.yy602 ){
161107 yymsp[-4].minor.yy602->x.pList = pList;
161108 }else{
161109 sqlite3ExprListDelete(pParse->db, pList);
161110 }
161111 if( yymsp[-3].minor.yy60 ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
161112 }
161113 break;
161114 case 215: /* expr ::= expr in_op LP exprlist RP */
161115 {
161116 if( yymsp[-1].minor.yy338==0 ){
161117 /* Expressions of the form
161118 **
161119 ** expr1 IN ()
161120 ** expr1 NOT IN ()
161121 **
161122 ** simplify to constants 0 (false) and 1 (true), respectively,
161123 ** regardless of the value of expr1.
161124 */
161125 sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy602);
161126 yymsp[-4].minor.yy602 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy60 ? "1" : "0");
161127 }else if( yymsp[-1].minor.yy338->nExpr==1 && sqlite3ExprIsConstant(yymsp[-1].minor.yy338->a[0].pExpr) ){
161128 Expr *pRHS = yymsp[-1].minor.yy338->a[0].pExpr;
161129 yymsp[-1].minor.yy338->a[0].pExpr = 0;
161130 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy338);
161131 pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0);
161132 yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy602, pRHS);
161133 if( yymsp[-3].minor.yy60 ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
161134 }else{
161135 yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy602, 0);
161136 if( yymsp[-4].minor.yy602 ){
161137 yymsp[-4].minor.yy602->x.pList = yymsp[-1].minor.yy338;
161138 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy602);
161139 }else{
161140 sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy338);
161141 }
161142 if( yymsp[-3].minor.yy60 ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
161143 }
161144 }
161145 break;
161146 case 216: /* expr ::= LP select RP */
161147 {
161148 yymsp[-2].minor.yy602 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
161149 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy602, yymsp[-1].minor.yy307);
161150 }
161151 break;
161152 case 217: /* expr ::= expr in_op LP select RP */
161153 {
161154 yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy602, 0);
161155 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy602, yymsp[-1].minor.yy307);
161156 if( yymsp[-3].minor.yy60 ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
161157 }
161158 break;
161159 case 218: /* expr ::= expr in_op nm dbnm paren_exprlist */
161160 {
161161 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
161162 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
161163 if( yymsp[0].minor.yy338 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy338);
161164 yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy602, 0);
161165 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy602, pSelect);
161166 if( yymsp[-3].minor.yy60 ) yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy602, 0);
161167 }
161168 break;
161169 case 219: /* expr ::= EXISTS LP select RP */
161170 {
161171 Expr *p;
161172 p = yymsp[-3].minor.yy602 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
161173 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy307);
161174 }
161175 break;
161176 case 220: /* expr ::= CASE case_operand case_exprlist case_else END */
161177 {
161178 yymsp[-4].minor.yy602 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy602, 0);
161179 if( yymsp[-4].minor.yy602 ){
161180 yymsp[-4].minor.yy602->x.pList = yymsp[-1].minor.yy602 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy338,yymsp[-1].minor.yy602) : yymsp[-2].minor.yy338;
161181 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy602);
161182 }else{
161183 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy338);
161184 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy602);
161185 }
161186 }
161187 break;
161188 case 221: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
161189 {
161190 yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy338, yymsp[-2].minor.yy602);
161191 yymsp[-4].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy338, yymsp[0].minor.yy602);
161192 }
161193 break;
161194 case 222: /* case_exprlist ::= WHEN expr THEN expr */
161195 {
161196 yymsp[-3].minor.yy338 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy602);
161197 yymsp[-3].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy338, yymsp[0].minor.yy602);
161198 }
161199 break;
161200 case 225: /* case_operand ::= expr */
161201 {yymsp[0].minor.yy602 = yymsp[0].minor.yy602; /*A-overwrites-X*/}
161202 break;
161203 case 228: /* nexprlist ::= nexprlist COMMA expr */
161204 {yymsp[-2].minor.yy338 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy338,yymsp[0].minor.yy602);}
161205 break;
161206 case 229: /* nexprlist ::= expr */
161207 {yymsp[0].minor.yy338 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy602); /*A-overwrites-Y*/}
161208 break;
161209 case 231: /* paren_exprlist ::= LP exprlist RP */
161210 case 236: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==236);
161211 {yymsp[-2].minor.yy338 = yymsp[-1].minor.yy338;}
161212 break;
161213 case 232: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
161214 {
161215 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
161216 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy338, yymsp[-10].minor.yy60,
161217 &yymsp[-11].minor.yy0, yymsp[0].minor.yy602, SQLITE_SO_ASC, yymsp[-8].minor.yy60, SQLITE_IDXTYPE_APPDEF);
161218 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
161219 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
161220 }
161221 }
161222 break;
161223 case 233: /* uniqueflag ::= UNIQUE */
161224 case 275: /* raisetype ::= ABORT */ yytestcase(yyruleno==275);
161225 {yymsp[0].minor.yy60 = OE_Abort;}
161226 break;
161227 case 234: /* uniqueflag ::= */
161228 {yymsp[1].minor.yy60 = OE_None;}
161229 break;
161230 case 237: /* eidlist ::= eidlist COMMA nm collate sortorder */
161231 {
161232 yymsp[-4].minor.yy338 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy338, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy60, yymsp[0].minor.yy60);
161233 }
161234 break;
161235 case 238: /* eidlist ::= nm collate sortorder */
161236 {
161237 yymsp[-2].minor.yy338 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy60, yymsp[0].minor.yy60); /*A-overwrites-Y*/
161238 }
161239 break;
161240 case 241: /* cmd ::= DROP INDEX ifexists fullname */
161241 {sqlite3DropIndex(pParse, yymsp[0].minor.yy291, yymsp[-1].minor.yy60);}
161242 break;
161243 case 242: /* cmd ::= VACUUM vinto */
161244 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy602);}
161245 break;
161246 case 243: /* cmd ::= VACUUM nm vinto */
161247 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy602);}
161248 break;
161249 case 246: /* cmd ::= PRAGMA nm dbnm */
161250 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
161251 break;
161252 case 247: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
@@ -160818,54 +161264,54 @@
161264 case 253: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
161265 {
161266 Token all;
161267 all.z = yymsp[-3].minor.yy0.z;
161268 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
161269 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy483, &all);
161270 }
161271 break;
161272 case 254: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
161273 {
161274 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy60, yymsp[-4].minor.yy50.a, yymsp[-4].minor.yy50.b, yymsp[-2].minor.yy291, yymsp[0].minor.yy602, yymsp[-10].minor.yy60, yymsp[-8].minor.yy60);
161275 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
161276 }
161277 break;
161278 case 255: /* trigger_time ::= BEFORE|AFTER */
161279 { yymsp[0].minor.yy60 = yymsp[0].major; /*A-overwrites-X*/ }
161280 break;
161281 case 256: /* trigger_time ::= INSTEAD OF */
161282 { yymsp[-1].minor.yy60 = TK_INSTEAD;}
161283 break;
161284 case 257: /* trigger_time ::= */
161285 { yymsp[1].minor.yy60 = TK_BEFORE; }
161286 break;
161287 case 258: /* trigger_event ::= DELETE|INSERT */
161288 case 259: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==259);
161289 {yymsp[0].minor.yy50.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy50.b = 0;}
161290 break;
161291 case 260: /* trigger_event ::= UPDATE OF idlist */
161292 {yymsp[-2].minor.yy50.a = TK_UPDATE; yymsp[-2].minor.yy50.b = yymsp[0].minor.yy288;}
161293 break;
161294 case 261: /* when_clause ::= */
161295 case 280: /* key_opt ::= */ yytestcase(yyruleno==280);
161296 { yymsp[1].minor.yy602 = 0; }
161297 break;
161298 case 262: /* when_clause ::= WHEN expr */
161299 case 281: /* key_opt ::= KEY expr */ yytestcase(yyruleno==281);
161300 { yymsp[-1].minor.yy602 = yymsp[0].minor.yy602; }
161301 break;
161302 case 263: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
161303 {
161304 assert( yymsp[-2].minor.yy483!=0 );
161305 yymsp[-2].minor.yy483->pLast->pNext = yymsp[-1].minor.yy483;
161306 yymsp[-2].minor.yy483->pLast = yymsp[-1].minor.yy483;
161307 }
161308 break;
161309 case 264: /* trigger_cmd_list ::= trigger_cmd SEMI */
161310 {
161311 assert( yymsp[-1].minor.yy483!=0 );
161312 yymsp[-1].minor.yy483->pLast = yymsp[-1].minor.yy483;
161313 }
161314 break;
161315 case 265: /* trnm ::= nm DOT nm */
161316 {
161317 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
@@ -160887,62 +161333,62 @@
161333 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
161334 "within triggers");
161335 }
161336 break;
161337 case 268: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
161338 {yylhsminor.yy483 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy291, yymsp[-3].minor.yy338, yymsp[-1].minor.yy602, yymsp[-7].minor.yy60, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy528);}
161339 yymsp[-8].minor.yy483 = yylhsminor.yy483;
161340 break;
161341 case 269: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
161342 {
161343 yylhsminor.yy483 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy288,yymsp[-2].minor.yy307,yymsp[-6].minor.yy60,yymsp[-1].minor.yy178,yymsp[-7].minor.yy528,yymsp[0].minor.yy528);/*yylhsminor.yy483-overwrites-yymsp[-6].minor.yy60*/
161344 }
161345 yymsp[-7].minor.yy483 = yylhsminor.yy483;
161346 break;
161347 case 270: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
161348 {yylhsminor.yy483 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy602, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy528);}
161349 yymsp[-5].minor.yy483 = yylhsminor.yy483;
161350 break;
161351 case 271: /* trigger_cmd ::= scanpt select scanpt */
161352 {yylhsminor.yy483 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy307, yymsp[-2].minor.yy528, yymsp[0].minor.yy528); /*yylhsminor.yy483-overwrites-yymsp[-1].minor.yy307*/}
161353 yymsp[-2].minor.yy483 = yylhsminor.yy483;
161354 break;
161355 case 272: /* expr ::= RAISE LP IGNORE RP */
161356 {
161357 yymsp[-3].minor.yy602 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
161358 if( yymsp[-3].minor.yy602 ){
161359 yymsp[-3].minor.yy602->affExpr = OE_Ignore;
161360 }
161361 }
161362 break;
161363 case 273: /* expr ::= RAISE LP raisetype COMMA nm RP */
161364 {
161365 yymsp[-5].minor.yy602 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
161366 if( yymsp[-5].minor.yy602 ) {
161367 yymsp[-5].minor.yy602->affExpr = (char)yymsp[-3].minor.yy60;
161368 }
161369 }
161370 break;
161371 case 274: /* raisetype ::= ROLLBACK */
161372 {yymsp[0].minor.yy60 = OE_Rollback;}
161373 break;
161374 case 276: /* raisetype ::= FAIL */
161375 {yymsp[0].minor.yy60 = OE_Fail;}
161376 break;
161377 case 277: /* cmd ::= DROP TRIGGER ifexists fullname */
161378 {
161379 sqlite3DropTrigger(pParse,yymsp[0].minor.yy291,yymsp[-1].minor.yy60);
161380 }
161381 break;
161382 case 278: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
161383 {
161384 sqlite3Attach(pParse, yymsp[-3].minor.yy602, yymsp[-1].minor.yy602, yymsp[0].minor.yy602);
161385 }
161386 break;
161387 case 279: /* cmd ::= DETACH database_kw_opt expr */
161388 {
161389 sqlite3Detach(pParse, yymsp[0].minor.yy602);
161390 }
161391 break;
161392 case 282: /* cmd ::= REINDEX */
161393 {sqlite3Reindex(pParse, 0, 0);}
161394 break;
@@ -160955,266 +161401,285 @@
161401 case 285: /* cmd ::= ANALYZE nm dbnm */
161402 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
161403 break;
161404 case 286: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
161405 {
161406 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy291,&yymsp[0].minor.yy0);
161407 }
161408 break;
161409 case 287: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
161410 {
161411 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
161412 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
161413 }
161414 break;
161415 case 288: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
161416 {
161417 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy291, &yymsp[0].minor.yy0);
161418 }
161419 break;
161420 case 289: /* add_column_fullname ::= fullname */
161421 {
161422 disableLookaside(pParse);
161423 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy291);
161424 }
161425 break;
161426 case 290: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
161427 {
161428 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy291, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
161429 }
161430 break;
161431 case 291: /* cmd ::= create_vtab */
161432 {sqlite3VtabFinishParse(pParse,0);}
161433 break;
161434 case 292: /* cmd ::= create_vtab LP vtabarglist RP */
161435 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
161436 break;
161437 case 293: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
161438 {
161439 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy60);
161440 }
161441 break;
161442 case 294: /* vtabarg ::= */
161443 {sqlite3VtabArgInit(pParse);}
161444 break;
161445 case 295: /* vtabargtoken ::= ANY */
161446 case 296: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==296);
161447 case 297: /* lp ::= LP */ yytestcase(yyruleno==297);
161448 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
161449 break;
161450 case 298: /* with ::= WITH wqlist */
161451 case 299: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==299);
161452 { sqlite3WithPush(pParse, yymsp[0].minor.yy195, 1); }
161453 break;
161454 case 300: /* wqas ::= AS */
161455 {yymsp[0].minor.yy570 = M10d_Any;}
161456 break;
161457 case 301: /* wqas ::= AS MATERIALIZED */
161458 {yymsp[-1].minor.yy570 = M10d_Yes;}
161459 break;
161460 case 302: /* wqas ::= AS NOT MATERIALIZED */
161461 {yymsp[-2].minor.yy570 = M10d_No;}
161462 break;
161463 case 303: /* wqitem ::= nm eidlist_opt wqas LP select RP */
161464 {
161465 yymsp[-5].minor.yy607 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy338, yymsp[-1].minor.yy307, yymsp[-3].minor.yy570); /*A-overwrites-X*/
161466 }
161467 break;
161468 case 304: /* wqlist ::= wqitem */
161469 {
161470 yymsp[0].minor.yy195 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy607); /*A-overwrites-X*/
161471 }
161472 break;
161473 case 305: /* wqlist ::= wqlist COMMA wqitem */
161474 {
161475 yymsp[-2].minor.yy195 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy195, yymsp[0].minor.yy607);
161476 }
161477 break;
161478 case 306: /* windowdefn_list ::= windowdefn */
161479 { yylhsminor.yy19 = yymsp[0].minor.yy19; }
161480 yymsp[0].minor.yy19 = yylhsminor.yy19;
161481 break;
161482 case 307: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
161483 {
161484 assert( yymsp[0].minor.yy19!=0 );
161485 sqlite3WindowChain(pParse, yymsp[0].minor.yy19, yymsp[-2].minor.yy19);
161486 yymsp[0].minor.yy19->pNextWin = yymsp[-2].minor.yy19;
161487 yylhsminor.yy19 = yymsp[0].minor.yy19;
161488 }
161489 yymsp[-2].minor.yy19 = yylhsminor.yy19;
161490 break;
161491 case 308: /* windowdefn ::= nm AS LP window RP */
161492 {
161493 if( ALWAYS(yymsp[-1].minor.yy19) ){
161494 yymsp[-1].minor.yy19->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
161495 }
161496 yylhsminor.yy19 = yymsp[-1].minor.yy19;
161497 }
161498 yymsp[-4].minor.yy19 = yylhsminor.yy19;
161499 break;
161500 case 309: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
161501 {
161502 yymsp[-4].minor.yy19 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy19, yymsp[-2].minor.yy338, yymsp[-1].minor.yy338, 0);
161503 }
161504 break;
161505 case 310: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
161506 {
161507 yylhsminor.yy19 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy19, yymsp[-2].minor.yy338, yymsp[-1].minor.yy338, &yymsp[-5].minor.yy0);
161508 }
161509 yymsp[-5].minor.yy19 = yylhsminor.yy19;
161510 break;
161511 case 311: /* window ::= ORDER BY sortlist frame_opt */
161512 {
161513 yymsp[-3].minor.yy19 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy19, 0, yymsp[-1].minor.yy338, 0);
161514 }
161515 break;
161516 case 312: /* window ::= nm ORDER BY sortlist frame_opt */
161517 {
161518 yylhsminor.yy19 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy19, 0, yymsp[-1].minor.yy338, &yymsp[-4].minor.yy0);
161519 }
161520 yymsp[-4].minor.yy19 = yylhsminor.yy19;
161521 break;
161522 case 313: /* window ::= frame_opt */
161523 case 332: /* filter_over ::= over_clause */ yytestcase(yyruleno==332);
161524 {
161525 yylhsminor.yy19 = yymsp[0].minor.yy19;
161526 }
161527 yymsp[0].minor.yy19 = yylhsminor.yy19;
161528 break;
161529 case 314: /* window ::= nm frame_opt */
161530 {
161531 yylhsminor.yy19 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy19, 0, 0, &yymsp[-1].minor.yy0);
161532 }
161533 yymsp[-1].minor.yy19 = yylhsminor.yy19;
161534 break;
161535 case 315: /* frame_opt ::= */
161536 {
161537 yymsp[1].minor.yy19 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
161538 }
161539 break;
161540 case 316: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
161541 {
161542 yylhsminor.yy19 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy60, yymsp[-1].minor.yy113.eType, yymsp[-1].minor.yy113.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy570);
161543 }
161544 yymsp[-2].minor.yy19 = yylhsminor.yy19;
161545 break;
161546 case 317: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
161547 {
161548 yylhsminor.yy19 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy60, yymsp[-3].minor.yy113.eType, yymsp[-3].minor.yy113.pExpr, yymsp[-1].minor.yy113.eType, yymsp[-1].minor.yy113.pExpr, yymsp[0].minor.yy570);
161549 }
161550 yymsp[-5].minor.yy19 = yylhsminor.yy19;
161551 break;
161552 case 319: /* frame_bound_s ::= frame_bound */
161553 case 321: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==321);
161554 {yylhsminor.yy113 = yymsp[0].minor.yy113;}
161555 yymsp[0].minor.yy113 = yylhsminor.yy113;
161556 break;
161557 case 320: /* frame_bound_s ::= UNBOUNDED PRECEDING */
161558 case 322: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==322);
161559 case 324: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==324);
161560 {yylhsminor.yy113.eType = yymsp[-1].major; yylhsminor.yy113.pExpr = 0;}
161561 yymsp[-1].minor.yy113 = yylhsminor.yy113;
161562 break;
161563 case 323: /* frame_bound ::= expr PRECEDING|FOLLOWING */
161564 {yylhsminor.yy113.eType = yymsp[0].major; yylhsminor.yy113.pExpr = yymsp[-1].minor.yy602;}
161565 yymsp[-1].minor.yy113 = yylhsminor.yy113;
161566 break;
161567 case 325: /* frame_exclude_opt ::= */
161568 {yymsp[1].minor.yy570 = 0;}
161569 break;
161570 case 326: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
161571 {yymsp[-1].minor.yy570 = yymsp[0].minor.yy570;}
161572 break;
161573 case 327: /* frame_exclude ::= NO OTHERS */
161574 case 328: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==328);
161575 {yymsp[-1].minor.yy570 = yymsp[-1].major; /*A-overwrites-X*/}
161576 break;
161577 case 329: /* frame_exclude ::= GROUP|TIES */
161578 {yymsp[0].minor.yy570 = yymsp[0].major; /*A-overwrites-X*/}
161579 break;
161580 case 330: /* window_clause ::= WINDOW windowdefn_list */
161581 { yymsp[-1].minor.yy19 = yymsp[0].minor.yy19; }
161582 break;
161583 case 331: /* filter_over ::= filter_clause over_clause */
161584 {
161585 yymsp[0].minor.yy19->pFilter = yymsp[-1].minor.yy602;
161586 yylhsminor.yy19 = yymsp[0].minor.yy19;
161587 }
161588 yymsp[-1].minor.yy19 = yylhsminor.yy19;
161589 break;
161590 case 333: /* filter_over ::= filter_clause */
161591 {
161592 yylhsminor.yy19 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
161593 if( yylhsminor.yy19 ){
161594 yylhsminor.yy19->eFrmType = TK_FILTER;
161595 yylhsminor.yy19->pFilter = yymsp[0].minor.yy602;
161596 }else{
161597 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy602);
161598 }
161599 }
161600 yymsp[0].minor.yy19 = yylhsminor.yy19;
161601 break;
161602 case 334: /* over_clause ::= OVER LP window RP */
161603 {
161604 yymsp[-3].minor.yy19 = yymsp[-1].minor.yy19;
161605 assert( yymsp[-3].minor.yy19!=0 );
161606 }
161607 break;
161608 case 335: /* over_clause ::= OVER nm */
161609 {
161610 yymsp[-1].minor.yy19 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
161611 if( yymsp[-1].minor.yy19 ){
161612 yymsp[-1].minor.yy19->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
161613 }
161614 }
161615 break;
161616 case 336: /* filter_clause ::= FILTER LP WHERE expr RP */
161617 { yymsp[-4].minor.yy602 = yymsp[-1].minor.yy602; }
161618 break;
161619 default:
161620 /* (337) input ::= cmdlist */ yytestcase(yyruleno==337);
161621 /* (338) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==338);
161622 /* (339) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=339);
161623 /* (340) ecmd ::= SEMI */ yytestcase(yyruleno==340);
161624 /* (341) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==341);
161625 /* (342) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=342);
161626 /* (343) trans_opt ::= */ yytestcase(yyruleno==343);
161627 /* (344) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==344);
161628 /* (345) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==345);
161629 /* (346) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==346);
161630 /* (347) savepoint_opt ::= */ yytestcase(yyruleno==347);
161631 /* (348) cmd ::= create_table create_table_args */ yytestcase(yyruleno==348);
161632 /* (349) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==349);
161633 /* (350) columnlist ::= columnname carglist */ yytestcase(yyruleno==350);
161634 /* (351) nm ::= ID|INDEXED */ yytestcase(yyruleno==351);
161635 /* (352) nm ::= STRING */ yytestcase(yyruleno==352);
161636 /* (353) nm ::= JOIN_KW */ yytestcase(yyruleno==353);
161637 /* (354) typetoken ::= typename */ yytestcase(yyruleno==354);
161638 /* (355) typename ::= ID|STRING */ yytestcase(yyruleno==355);
161639 /* (356) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=356);
161640 /* (357) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=357);
161641 /* (358) carglist ::= carglist ccons */ yytestcase(yyruleno==358);
161642 /* (359) carglist ::= */ yytestcase(yyruleno==359);
161643 /* (360) ccons ::= NULL onconf */ yytestcase(yyruleno==360);
161644 /* (361) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==361);
161645 /* (362) ccons ::= AS generated */ yytestcase(yyruleno==362);
161646 /* (363) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==363);
161647 /* (364) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==364);
161648 /* (365) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=365);
161649 /* (366) tconscomma ::= */ yytestcase(yyruleno==366);
161650 /* (367) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=367);
161651 /* (368) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=368);
161652 /* (369) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=369);
161653 /* (370) oneselect ::= values */ yytestcase(yyruleno==370);
161654 /* (371) sclp ::= selcollist COMMA */ yytestcase(yyruleno==371);
161655 /* (372) as ::= ID|STRING */ yytestcase(yyruleno==372);
161656 /* (373) returning ::= */ yytestcase(yyruleno==373);
161657 /* (374) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=374);
161658 /* (375) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==375);
161659 /* (376) exprlist ::= nexprlist */ yytestcase(yyruleno==376);
161660 /* (377) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=377);
161661 /* (378) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=378);
161662 /* (379) nmnum ::= ON */ yytestcase(yyruleno==379);
161663 /* (380) nmnum ::= DELETE */ yytestcase(yyruleno==380);
161664 /* (381) nmnum ::= DEFAULT */ yytestcase(yyruleno==381);
161665 /* (382) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==382);
161666 /* (383) foreach_clause ::= */ yytestcase(yyruleno==383);
161667 /* (384) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==384);
161668 /* (385) trnm ::= nm */ yytestcase(yyruleno==385);
161669 /* (386) tridxby ::= */ yytestcase(yyruleno==386);
161670 /* (387) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==387);
161671 /* (388) database_kw_opt ::= */ yytestcase(yyruleno==388);
161672 /* (389) kwcolumn_opt ::= */ yytestcase(yyruleno==389);
161673 /* (390) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==390);
161674 /* (391) vtabarglist ::= vtabarg */ yytestcase(yyruleno==391);
161675 /* (392) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==392);
161676 /* (393) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==393);
161677 /* (394) anylist ::= */ yytestcase(yyruleno==394);
161678 /* (395) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==395);
161679 /* (396) anylist ::= anylist ANY */ yytestcase(yyruleno==396);
161680 /* (397) with ::= */ yytestcase(yyruleno==397);
161681 break;
161682 /********** End reduce actions ************************************************/
161683 };
161684 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
161685 yygoto = yyRuleInfoLhs[yyruleno];
@@ -161717,25 +162182,25 @@
162182 ** might be implemented more directly using a hand-written hash table.
162183 ** But by using this automatically generated code, the size of the code
162184 ** is substantially reduced. This is important for embedded applications
162185 ** on platforms with limited memory.
162186 */
162187 /* Hash score: 231 */
162188 /* zKWText[] encodes 1007 bytes of keyword text in 667 bytes */
162189 /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
162190 /* ABLEFTHENDEFERRABLELSEXCLUDELETEMPORARYISNULLSAVEPOINTERSECT */
162191 /* IESNOTNULLIKEXCEPTRANSACTIONATURALTERAISEXCLUSIVEXISTS */
162192 /* CONSTRAINTOFFSETRIGGERANGENERATEDETACHAVINGLOBEGINNEREFERENCES */
162193 /* UNIQUERYWITHOUTERELEASEATTACHBETWEENOTHINGROUPSCASCADEFAULT */
162194 /* CASECOLLATECREATECURRENT_DATEIMMEDIATEJOINSERTMATCHPLANALYZE */
162195 /* PRAGMATERIALIZEDEFERREDISTINCTUPDATEVALUESVIRTUALWAYSWHENWHERE */
162196 /* CURSIVEABORTAFTERENAMEANDROPARTITIONAUTOINCREMENTCASTCOLUMN */
162197 /* COMMITCONFLICTCROSSCURRENT_TIMESTAMPRECEDINGFAILASTFILTER */
162198 /* EPLACEFIRSTFOLLOWINGFROMFULLIMITIFORDERESTRICTOTHERSOVER */
162199 /* ETURNINGRIGHTROLLBACKROWSUNBOUNDEDUNIONUSINGVACUUMVIEWINDOWBY */
162200 /* INITIALLYPRIMARY */
162201 static const char zKWText[666] = {
162202 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
162203 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
162204 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
162205 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
162206 'E','R','R','A','B','L','E','L','S','E','X','C','L','U','D','E','L','E',
@@ -161752,91 +162217,91 @@
162217 'E','N','O','T','H','I','N','G','R','O','U','P','S','C','A','S','C','A',
162218 'D','E','F','A','U','L','T','C','A','S','E','C','O','L','L','A','T','E',
162219 'C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A','T','E',
162220 'I','M','M','E','D','I','A','T','E','J','O','I','N','S','E','R','T','M',
162221 'A','T','C','H','P','L','A','N','A','L','Y','Z','E','P','R','A','G','M',
162222 'A','T','E','R','I','A','L','I','Z','E','D','E','F','E','R','R','E','D',
162223 'I','S','T','I','N','C','T','U','P','D','A','T','E','V','A','L','U','E',
162224 'S','V','I','R','T','U','A','L','W','A','Y','S','W','H','E','N','W','H',
162225 'E','R','E','C','U','R','S','I','V','E','A','B','O','R','T','A','F','T',
162226 'E','R','E','N','A','M','E','A','N','D','R','O','P','A','R','T','I','T',
162227 'I','O','N','A','U','T','O','I','N','C','R','E','M','E','N','T','C','A',
162228 'S','T','C','O','L','U','M','N','C','O','M','M','I','T','C','O','N','F',
162229 'L','I','C','T','C','R','O','S','S','C','U','R','R','E','N','T','_','T',
162230 'I','M','E','S','T','A','M','P','R','E','C','E','D','I','N','G','F','A',
162231 'I','L','A','S','T','F','I','L','T','E','R','E','P','L','A','C','E','F',
162232 'I','R','S','T','F','O','L','L','O','W','I','N','G','F','R','O','M','F',
162233 'U','L','L','I','M','I','T','I','F','O','R','D','E','R','E','S','T','R',
162234 'I','C','T','O','T','H','E','R','S','O','V','E','R','E','T','U','R','N',
162235 'I','N','G','R','I','G','H','T','R','O','L','L','B','A','C','K','R','O',
162236 'W','S','U','N','B','O','U','N','D','E','D','U','N','I','O','N','U','S',
162237 'I','N','G','V','A','C','U','U','M','V','I','E','W','I','N','D','O','W',
162238 'B','Y','I','N','I','T','I','A','L','L','Y','P','R','I','M','A','R','Y',
162239 };
162240 /* aKWHash[i] is the hash value for the i-th keyword */
162241 static const unsigned char aKWHash[127] = {
162242 84, 92, 134, 82, 105, 29, 0, 0, 94, 0, 85, 72, 0,
162243 53, 35, 86, 15, 0, 42, 97, 54, 89, 135, 19, 0, 0,
162244 140, 0, 40, 129, 0, 22, 107, 0, 9, 0, 0, 123, 80,
162245 0, 78, 6, 0, 65, 103, 147, 0, 136, 115, 0, 0, 48,
162246 0, 90, 24, 0, 17, 0, 27, 70, 23, 26, 5, 60, 142,
162247 110, 122, 0, 73, 91, 71, 145, 61, 120, 74, 0, 49, 0,
162248 11, 41, 0, 113, 0, 0, 0, 109, 10, 111, 116, 125, 14,
162249 50, 124, 0, 100, 0, 18, 121, 144, 56, 130, 139, 88, 83,
162250 37, 30, 126, 0, 0, 108, 51, 131, 128, 0, 34, 0, 0,
162251 132, 0, 98, 38, 39, 0, 20, 45, 117, 93,
162252 };
162253 /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
162254 ** then the i-th keyword has no more hash collisions. Otherwise,
162255 ** the next keyword with the same hash is aKWHash[i]-1. */
162256 static const unsigned char aKWNext[147] = {
162257 0, 0, 0, 0, 4, 0, 43, 0, 0, 106, 114, 0, 0,
162258 0, 2, 0, 0, 143, 0, 0, 0, 13, 0, 0, 0, 0,
162259 141, 0, 0, 119, 52, 0, 0, 137, 12, 0, 0, 62, 0,
162260 138, 0, 133, 0, 0, 36, 0, 0, 28, 77, 0, 0, 0,
162261 0, 59, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0,
162262 0, 69, 0, 0, 0, 0, 0, 146, 3, 0, 58, 0, 1,
162263 75, 0, 0, 0, 31, 0, 0, 0, 0, 0, 127, 0, 104,
162264 0, 64, 66, 63, 0, 0, 0, 0, 0, 46, 0, 16, 8,
162265 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 101, 0,
162266 112, 21, 7, 67, 0, 79, 96, 118, 0, 0, 68, 0, 0,
162267 99, 44, 0, 55, 0, 76, 0, 95, 32, 33, 57, 25, 0,
162268 102, 0, 0, 87,
162269 };
162270 /* aKWLen[i] is the length (in bytes) of the i-th keyword */
162271 static const unsigned char aKWLen[147] = {
162272 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
162273 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 7,
162274 6, 9, 4, 2, 6, 5, 9, 9, 4, 7, 3, 2, 4,
162275 4, 6, 11, 6, 2, 7, 5, 5, 9, 6, 10, 4, 6,
162276 2, 3, 7, 5, 9, 6, 6, 4, 5, 5, 10, 6, 5,
162277 7, 4, 5, 7, 6, 7, 7, 6, 5, 7, 3, 7, 4,
162278 7, 6, 12, 9, 4, 6, 5, 4, 7, 6, 12, 8, 8,
162279 2, 6, 6, 7, 6, 4, 5, 9, 5, 5, 6, 3, 4,
162280 9, 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 9,
162281 4, 4, 6, 7, 5, 9, 4, 4, 5, 2, 5, 8, 6,
162282 4, 9, 5, 8, 4, 3, 9, 5, 5, 6, 4, 6, 2,
162283 2, 9, 3, 7,
162284 };
162285 /* aKWOffset[i] is the index into zKWText[] of the start of
162286 ** the text for the i-th keyword. */
162287 static const unsigned short int aKWOffset[147] = {
162288 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
162289 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
162290 86, 90, 90, 94, 99, 101, 105, 111, 119, 123, 123, 123, 126,
162291 129, 132, 137, 142, 146, 147, 152, 156, 160, 168, 174, 181, 184,
162292 184, 187, 189, 195, 198, 206, 211, 216, 219, 222, 226, 236, 239,
162293 244, 244, 248, 252, 259, 265, 271, 277, 277, 283, 284, 288, 295,
162294 299, 306, 312, 324, 333, 335, 341, 346, 348, 355, 359, 370, 377,
162295 378, 385, 391, 397, 402, 408, 412, 415, 424, 429, 433, 439, 441,
162296 444, 453, 455, 457, 466, 470, 476, 482, 490, 495, 495, 495, 511,
162297 520, 523, 527, 532, 539, 544, 553, 557, 560, 565, 567, 571, 579,
162298 585, 588, 597, 602, 610, 610, 614, 623, 628, 633, 639, 642, 645,
162299 648, 650, 655, 659,
162300 };
162301 /* aKWCode[i] is the parser symbol code for the i-th keyword */
162302 static const unsigned char aKWCode[147] = {
162303 TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
162304 TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
162305 TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
162306 TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
162307 TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
@@ -161850,23 +162315,23 @@
162315 TK_BEGIN, TK_JOIN_KW, TK_REFERENCES, TK_UNIQUE, TK_QUERY,
162316 TK_WITHOUT, TK_WITH, TK_JOIN_KW, TK_RELEASE, TK_ATTACH,
162317 TK_BETWEEN, TK_NOTHING, TK_GROUPS, TK_GROUP, TK_CASCADE,
162318 TK_ASC, TK_DEFAULT, TK_CASE, TK_COLLATE, TK_CREATE,
162319 TK_CTIME_KW, TK_IMMEDIATE, TK_JOIN, TK_INSERT, TK_MATCH,
162320 TK_PLAN, TK_ANALYZE, TK_PRAGMA, TK_MATERIALIZED, TK_DEFERRED,
162321 TK_DISTINCT, TK_IS, TK_UPDATE, TK_VALUES, TK_VIRTUAL,
162322 TK_ALWAYS, TK_WHEN, TK_WHERE, TK_RECURSIVE, TK_ABORT,
162323 TK_AFTER, TK_RENAME, TK_AND, TK_DROP, TK_PARTITION,
162324 TK_AUTOINCR, TK_TO, TK_IN, TK_CAST, TK_COLUMNKW,
162325 TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW,
162326 TK_CURRENT, TK_PRECEDING, TK_FAIL, TK_LAST, TK_FILTER,
162327 TK_REPLACE, TK_FIRST, TK_FOLLOWING, TK_FROM, TK_JOIN_KW,
162328 TK_LIMIT, TK_IF, TK_ORDER, TK_RESTRICT, TK_OTHERS,
162329 TK_OVER, TK_RETURNING, TK_JOIN_KW, TK_ROLLBACK, TK_ROWS,
162330 TK_ROW, TK_UNBOUNDED, TK_UNION, TK_USING, TK_VACUUM,
162331 TK_VIEW, TK_WINDOW, TK_DO, TK_BY, TK_INITIALLY,
162332 TK_ALL, TK_PRIMARY,
162333 };
162334 /* Hash table decoded:
162335 ** 0: INSERT
162336 ** 1: IS
162337 ** 2: ROLLBACK TRIGGER
@@ -161886,11 +162351,11 @@
162351 ** 16: INSTEAD INDEXED
162352 ** 17:
162353 ** 18: TRANSACTION RIGHT
162354 ** 19: WHEN
162355 ** 20: SET HAVING
162356 ** 21: MATERIALIZED IF
162357 ** 22: ROWS
162358 ** 23: SELECT
162359 ** 24:
162360 ** 25:
162361 ** 26: VACUUM SAVEPOINT
@@ -162105,68 +162570,69 @@
162570 testcase( i==83 ); /* INSERT */
162571 testcase( i==84 ); /* MATCH */
162572 testcase( i==85 ); /* PLAN */
162573 testcase( i==86 ); /* ANALYZE */
162574 testcase( i==87 ); /* PRAGMA */
162575 testcase( i==88 ); /* MATERIALIZED */
162576 testcase( i==89 ); /* DEFERRED */
162577 testcase( i==90 ); /* DISTINCT */
162578 testcase( i==91 ); /* IS */
162579 testcase( i==92 ); /* UPDATE */
162580 testcase( i==93 ); /* VALUES */
162581 testcase( i==94 ); /* VIRTUAL */
162582 testcase( i==95 ); /* ALWAYS */
162583 testcase( i==96 ); /* WHEN */
162584 testcase( i==97 ); /* WHERE */
162585 testcase( i==98 ); /* RECURSIVE */
162586 testcase( i==99 ); /* ABORT */
162587 testcase( i==100 ); /* AFTER */
162588 testcase( i==101 ); /* RENAME */
162589 testcase( i==102 ); /* AND */
162590 testcase( i==103 ); /* DROP */
162591 testcase( i==104 ); /* PARTITION */
162592 testcase( i==105 ); /* AUTOINCREMENT */
162593 testcase( i==106 ); /* TO */
162594 testcase( i==107 ); /* IN */
162595 testcase( i==108 ); /* CAST */
162596 testcase( i==109 ); /* COLUMN */
162597 testcase( i==110 ); /* COMMIT */
162598 testcase( i==111 ); /* CONFLICT */
162599 testcase( i==112 ); /* CROSS */
162600 testcase( i==113 ); /* CURRENT_TIMESTAMP */
162601 testcase( i==114 ); /* CURRENT_TIME */
162602 testcase( i==115 ); /* CURRENT */
162603 testcase( i==116 ); /* PRECEDING */
162604 testcase( i==117 ); /* FAIL */
162605 testcase( i==118 ); /* LAST */
162606 testcase( i==119 ); /* FILTER */
162607 testcase( i==120 ); /* REPLACE */
162608 testcase( i==121 ); /* FIRST */
162609 testcase( i==122 ); /* FOLLOWING */
162610 testcase( i==123 ); /* FROM */
162611 testcase( i==124 ); /* FULL */
162612 testcase( i==125 ); /* LIMIT */
162613 testcase( i==126 ); /* IF */
162614 testcase( i==127 ); /* ORDER */
162615 testcase( i==128 ); /* RESTRICT */
162616 testcase( i==129 ); /* OTHERS */
162617 testcase( i==130 ); /* OVER */
162618 testcase( i==131 ); /* RETURNING */
162619 testcase( i==132 ); /* RIGHT */
162620 testcase( i==133 ); /* ROLLBACK */
162621 testcase( i==134 ); /* ROWS */
162622 testcase( i==135 ); /* ROW */
162623 testcase( i==136 ); /* UNBOUNDED */
162624 testcase( i==137 ); /* UNION */
162625 testcase( i==138 ); /* USING */
162626 testcase( i==139 ); /* VACUUM */
162627 testcase( i==140 ); /* VIEW */
162628 testcase( i==141 ); /* WINDOW */
162629 testcase( i==142 ); /* DO */
162630 testcase( i==143 ); /* BY */
162631 testcase( i==144 ); /* INITIALLY */
162632 testcase( i==145 ); /* ALL */
162633 testcase( i==146 ); /* PRIMARY */
162634 *pType = aKWCode[i];
162635 break;
162636 }
162637 }
162638 return n;
@@ -162174,11 +162640,11 @@
162640 SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){
162641 int id = TK_ID;
162642 keywordCode((char*)z, n, &id);
162643 return id;
162644 }
162645 #define SQLITE_N_KEYWORD 147
162646 SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){
162647 if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
162648 *pzName = zKWText + aKWOffset[i];
162649 *pnName = aKWLen[i];
162650 return SQLITE_OK;
@@ -183787,27 +184253,31 @@
184253 if( pNode->block.a){
184254 rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n);
184255 while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
184256 blobGrowBuffer(&pNode->key, reader.term.n, &rc);
184257 if( rc==SQLITE_OK ){
184258 if( reader.term.n<=0 ){
184259 rc = FTS_CORRUPT_VTAB;
184260 }else{
184261 memcpy(pNode->key.a, reader.term.a, reader.term.n);
184262 pNode->key.n = reader.term.n;
184263 if( i>0 ){
184264 char *aBlock = 0;
184265 int nBlock = 0;
184266 pNode = &pWriter->aNodeWriter[i-1];
184267 pNode->iBlock = reader.iChild;
184268 rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock,0);
184269 blobGrowBuffer(&pNode->block,
184270 MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc
184271 );
184272 if( rc==SQLITE_OK ){
184273 memcpy(pNode->block.a, aBlock, nBlock);
184274 pNode->block.n = nBlock;
184275 memset(&pNode->block.a[nBlock], 0, FTS3_NODE_PADDING);
184276 }
184277 sqlite3_free(aBlock);
184278 }
184279 }
184280 }
184281 }
184282 nodeReaderRelease(&reader);
184283 }
@@ -203040,26 +203510,28 @@
203510 #ifdef SQLITE_AMALGAMATION
203511 assert( WAL_CKPT_LOCK==1 );
203512 #endif
203513
203514 assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) );
203515 if( pRbu && (
203516 pRbu->eStage==RBU_STAGE_OAL
203517 || pRbu->eStage==RBU_STAGE_MOVE
203518 || pRbu->eStage==RBU_STAGE_DONE
203519 )){
203520 /* Prevent SQLite from taking a shm-lock on the target file when it
203521 ** is supplying heap memory to the upper layer in place of *-shm
203522 ** segments. */
203523 if( ofst==WAL_LOCK_CKPT && n==1 ) rc = SQLITE_BUSY;
203524 }else{
203525 int bCapture = 0;
203526 if( pRbu && pRbu->eStage==RBU_STAGE_CAPTURE ){
203527 bCapture = 1;
203528 }
 
203529 if( bCapture==0 || 0==(flags & SQLITE_SHM_UNLOCK) ){
203530 rc = p->pReal->pMethods->xShmLock(p->pReal, ofst, n, flags);
203531 if( bCapture && rc==SQLITE_OK ){
203532 pRbu->mLock |= ((1<<n) - 1) << ofst;
203533 }
203534 }
203535 }
203536
203537 return rc;
@@ -204885,10 +205357,11 @@
205357 struct sqlite3_changeset_iter {
205358 SessionInput in; /* Input buffer or stream */
205359 SessionBuffer tblhdr; /* Buffer to hold apValue/zTab/abPK/ */
205360 int bPatchset; /* True if this is a patchset */
205361 int bInvert; /* True to invert changeset */
205362 int bSkipEmpty; /* Skip noop UPDATE changes */
205363 int rc; /* Iterator error code */
205364 sqlite3_stmt *pConflict; /* Points to conflicting row, if any */
205365 char *zTab; /* Current table */
205366 int nCol; /* Number of columns in zTab */
205367 int op; /* Current operation */
@@ -207414,11 +207887,12 @@
207887 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207888 int (*xInput)(void *pIn, void *pData, int *pnData),
207889 void *pIn,
207890 int nChangeset, /* Size of buffer pChangeset in bytes */
207891 void *pChangeset, /* Pointer to buffer containing changeset */
207892 int bInvert, /* True to invert changeset */
207893 int bSkipEmpty /* True to skip empty UPDATE changes */
207894 ){
207895 sqlite3_changeset_iter *pRet; /* Iterator to return */
207896 int nByte; /* Number of bytes to allocate for iterator */
207897
207898 assert( xInput==0 || (pChangeset==0 && nChangeset==0) );
@@ -207435,10 +207909,11 @@
207909 pRet->in.nData = nChangeset;
207910 pRet->in.xInput = xInput;
207911 pRet->in.pIn = pIn;
207912 pRet->in.bEof = (xInput ? 0 : 1);
207913 pRet->bInvert = bInvert;
207914 pRet->bSkipEmpty = bSkipEmpty;
207915
207916 /* Populate the output variable and return success. */
207917 *pp = pRet;
207918 return SQLITE_OK;
207919 }
@@ -207449,20 +207924,20 @@
207924 SQLITE_API int sqlite3changeset_start(
207925 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207926 int nChangeset, /* Size of buffer pChangeset in bytes */
207927 void *pChangeset /* Pointer to buffer containing changeset */
207928 ){
207929 return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset, 0, 0);
207930 }
207931 SQLITE_API int sqlite3changeset_start_v2(
207932 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207933 int nChangeset, /* Size of buffer pChangeset in bytes */
207934 void *pChangeset, /* Pointer to buffer containing changeset */
207935 int flags
207936 ){
207937 int bInvert = !!(flags & SQLITE_CHANGESETSTART_INVERT);
207938 return sessionChangesetStart(pp, 0, 0, nChangeset, pChangeset, bInvert, 0);
207939 }
207940
207941 /*
207942 ** Streaming version of sqlite3changeset_start().
207943 */
@@ -207469,20 +207944,20 @@
207944 SQLITE_API int sqlite3changeset_start_strm(
207945 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207946 int (*xInput)(void *pIn, void *pData, int *pnData),
207947 void *pIn
207948 ){
207949 return sessionChangesetStart(pp, xInput, pIn, 0, 0, 0, 0);
207950 }
207951 SQLITE_API int sqlite3changeset_start_v2_strm(
207952 sqlite3_changeset_iter **pp, /* OUT: Changeset iterator handle */
207953 int (*xInput)(void *pIn, void *pData, int *pnData),
207954 void *pIn,
207955 int flags
207956 ){
207957 int bInvert = !!(flags & SQLITE_CHANGESETSTART_INVERT);
207958 return sessionChangesetStart(pp, xInput, pIn, 0, 0, bInvert, 0);
207959 }
207960
207961 /*
207962 ** If the SessionInput object passed as the only argument is a streaming
207963 ** object and the buffer is full, discard some data to free up space.
@@ -207604,15 +208079,18 @@
208079 */
208080 static int sessionReadRecord(
208081 SessionInput *pIn, /* Input data */
208082 int nCol, /* Number of values in record */
208083 u8 *abPK, /* Array of primary key flags, or NULL */
208084 sqlite3_value **apOut, /* Write values to this array */
208085 int *pbEmpty
208086 ){
208087 int i; /* Used to iterate through columns */
208088 int rc = SQLITE_OK;
208089
208090 assert( pbEmpty==0 || *pbEmpty==0 );
208091 if( pbEmpty ) *pbEmpty = 1;
208092 for(i=0; i<nCol && rc==SQLITE_OK; i++){
208093 int eType = 0; /* Type of value (SQLITE_NULL, TEXT etc.) */
208094 if( abPK && abPK[i]==0 ) continue;
208095 rc = sessionInputBuffer(pIn, 9);
208096 if( rc==SQLITE_OK ){
@@ -207620,10 +208098,11 @@
208098 rc = SQLITE_CORRUPT_BKPT;
208099 }else{
208100 eType = pIn->aData[pIn->iNext++];
208101 assert( apOut[i]==0 );
208102 if( eType ){
208103 if( pbEmpty ) *pbEmpty = 0;
208104 apOut[i] = sqlite3ValueNew(0);
208105 if( !apOut[i] ) rc = SQLITE_NOMEM;
208106 }
208107 }
208108 }
@@ -207799,35 +208278,31 @@
208278 }
208279 return (p->rc = rc);
208280 }
208281
208282 /*
208283 ** Advance the changeset iterator to the next change. The differences between
208284 ** this function and sessionChangesetNext() are that
208285 **
208286 ** * If pbEmpty is not NULL and the change is a no-op UPDATE (an UPDATE
208287 ** that modifies no columns), this function sets (*pbEmpty) to 1.
208288 **
208289 ** * If the iterator is configured to skip no-op UPDATEs,
208290 ** sessionChangesetNext() does that. This function does not.
208291 */
208292 static int sessionChangesetNextOne(
 
 
 
 
 
 
208293 sqlite3_changeset_iter *p, /* Changeset iterator */
208294 u8 **paRec, /* If non-NULL, store record pointer here */
208295 int *pnRec, /* If non-NULL, store size of record here */
208296 int *pbNew, /* If non-NULL, true if new table */
208297 int *pbEmpty
208298 ){
208299 int i;
208300 u8 op;
208301
208302 assert( (paRec==0 && pnRec==0) || (paRec && pnRec) );
208303 assert( pbEmpty==0 || *pbEmpty==0 );
208304
208305 /* If the iterator is in the error-state, return immediately. */
208306 if( p->rc!=SQLITE_OK ) return p->rc;
208307
208308 /* Free the current contents of p->apValue[], if any. */
@@ -207896,17 +208371,17 @@
208371 sqlite3_value **apNew = (p->bInvert ? p->apValue : &p->apValue[p->nCol]);
208372
208373 /* If this is an UPDATE or DELETE, read the old.* record. */
208374 if( p->op!=SQLITE_INSERT && (p->bPatchset==0 || p->op==SQLITE_DELETE) ){
208375 u8 *abPK = p->bPatchset ? p->abPK : 0;
208376 p->rc = sessionReadRecord(&p->in, p->nCol, abPK, apOld, 0);
208377 if( p->rc!=SQLITE_OK ) return p->rc;
208378 }
208379
208380 /* If this is an INSERT or UPDATE, read the new.* record. */
208381 if( p->op!=SQLITE_DELETE ){
208382 p->rc = sessionReadRecord(&p->in, p->nCol, 0, apNew, pbEmpty);
208383 if( p->rc!=SQLITE_OK ) return p->rc;
208384 }
208385
208386 if( (p->bPatchset || p->bInvert) && p->op==SQLITE_UPDATE ){
208387 /* If this is an UPDATE that is part of a patchset, then all PK and
@@ -207928,10 +208403,41 @@
208403 }
208404 }
208405
208406 return SQLITE_ROW;
208407 }
208408
208409 /*
208410 ** Advance the changeset iterator to the next change.
208411 **
208412 ** If both paRec and pnRec are NULL, then this function works like the public
208413 ** API sqlite3changeset_next(). If SQLITE_ROW is returned, then the
208414 ** sqlite3changeset_new() and old() APIs may be used to query for values.
208415 **
208416 ** Otherwise, if paRec and pnRec are not NULL, then a pointer to the change
208417 ** record is written to *paRec before returning and the number of bytes in
208418 ** the record to *pnRec.
208419 **
208420 ** Either way, this function returns SQLITE_ROW if the iterator is
208421 ** successfully advanced to the next change in the changeset, an SQLite
208422 ** error code if an error occurs, or SQLITE_DONE if there are no further
208423 ** changes in the changeset.
208424 */
208425 static int sessionChangesetNext(
208426 sqlite3_changeset_iter *p, /* Changeset iterator */
208427 u8 **paRec, /* If non-NULL, store record pointer here */
208428 int *pnRec, /* If non-NULL, store size of record here */
208429 int *pbNew /* If non-NULL, true if new table */
208430 ){
208431 int bEmpty;
208432 int rc;
208433 do {
208434 bEmpty = 0;
208435 rc = sessionChangesetNextOne(p, paRec, pnRec, pbNew, &bEmpty);
208436 }while( rc==SQLITE_ROW && p->bSkipEmpty && bEmpty);
208437 return rc;
208438 }
208439
208440 /*
208441 ** Advance an iterator created by sqlite3changeset_start() to the next
208442 ** change in the changeset. This function may return SQLITE_ROW, SQLITE_DONE
208443 ** or SQLITE_CORRUPT.
@@ -208201,13 +208707,13 @@
208707 sessionAppendByte(&sOut, eType, &rc);
208708 sessionAppendByte(&sOut, pInput->aData[pInput->iNext+1], &rc);
208709
208710 /* Read the old.* and new.* records for the update change. */
208711 pInput->iNext += 2;
208712 rc = sessionReadRecord(pInput, nCol, 0, &apVal[0], 0);
208713 if( rc==SQLITE_OK ){
208714 rc = sessionReadRecord(pInput, nCol, 0, &apVal[nCol], 0);
208715 }
208716
208717 /* Write the new old.* record. Consists of the PK columns from the
208718 ** original old.* record, and the other values from the original
208719 ** new.* record. */
@@ -209151,11 +209657,11 @@
209657 sqlite3_changeset_iter *pIter2 = 0;
209658 SessionBuffer cons = pApply->constraints;
209659 memset(&pApply->constraints, 0, sizeof(SessionBuffer));
209660
209661 rc = sessionChangesetStart(
209662 &pIter2, 0, 0, cons.nBuf, cons.aBuf, pApply->bInvertConstraints, 1
209663 );
209664 if( rc==SQLITE_OK ){
209665 size_t nByte = 2*pApply->nCol*sizeof(sqlite3_value*);
209666 int rc2;
209667 pIter2->bPatchset = bPatchset;
@@ -209407,12 +209913,12 @@
209913 void *pCtx, /* First argument passed to xConflict */
209914 void **ppRebase, int *pnRebase,
209915 int flags
209916 ){
209917 sqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */
209918 int bInv = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
209919 int rc = sessionChangesetStart(&pIter, 0, 0, nChangeset, pChangeset, bInv, 1);
209920 if( rc==SQLITE_OK ){
209921 rc = sessionChangesetApply(
209922 db, pIter, xFilter, xConflict, pCtx, ppRebase, pnRebase, flags
209923 );
209924 }
@@ -209466,11 +209972,11 @@
209972 void **ppRebase, int *pnRebase,
209973 int flags
209974 ){
209975 sqlite3_changeset_iter *pIter; /* Iterator to skip through changeset */
209976 int bInverse = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
209977 int rc = sessionChangesetStart(&pIter, xInput, pIn, 0, 0, bInverse, 1);
209978 if( rc==SQLITE_OK ){
209979 rc = sessionChangesetApply(
209980 db, pIter, xFilter, xConflict, pCtx, ppRebase, pnRebase, flags
209981 );
209982 }
@@ -210086,11 +210592,11 @@
210592 *pOut++ = pIter->bIndirect;
210593 for(i=0; i<pIter->nCol; i++){
210594 int n1 = sessionSerialLen(a1);
210595 int n2 = sessionSerialLen(a2);
210596 if( pIter->abPK[i] || a2[0]==0 ){
210597 if( !pIter->abPK[i] && a1[0] ) bData = 1;
210598 memcpy(pOut, a1, n1);
210599 pOut += n1;
210600 }else if( a2[0]!=0xFF ){
210601 bData = 1;
210602 memcpy(pOut, a2, n2);
@@ -228484,11 +228990,11 @@
228990 int nArg, /* Number of args */
228991 sqlite3_value **apUnused /* Function arguments */
228992 ){
228993 assert( nArg==0 );
228994 UNUSED_PARAM2(nArg, apUnused);
228995 sqlite3_result_text(pCtx, "fts5: 2021-02-22 11:07:25 b66a49570852cf118a372a6ac44be3070cf9b4254696f16315b7c79a614e6c35", -1, SQLITE_TRANSIENT);
228996 }
228997
228998 /*
228999 ** Return true if zName is the extension on one of the shadow tables used
229000 ** by this module.
@@ -233410,12 +233916,12 @@
233916 }
233917 #endif /* SQLITE_CORE */
233918 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
233919
233920 /************** End of stmt.c ************************************************/
233921 #if __LINE__!=233921
233922 #undef SQLITE_SOURCE_ID
233923 #define SQLITE_SOURCE_ID "2021-02-22 16:42:09 b5a0778cc5a98a864bea72670f83262da940aceb91fa4cdf46ec097337a3alt2"
233924 #endif
233925 /* Return the source-id for this library */
233926 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
233927 /************************** End of sqlite3.c ******************************/
233928
+2 -2
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -108,11 +108,11 @@
108108
** be held constant and Z will be incremented or else Y will be incremented
109109
** and Z will be reset to zero.
110110
**
111111
** Since [version 3.6.18] ([dateof:3.6.18]),
112112
** SQLite source code has been stored in the
113
-** <a href="http://fossil-scm.org/">Fossil configuration management
113
+** <a href="http://www.fossil-scm.org/">Fossil configuration management
114114
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
115115
** a string which identifies a particular check-in of SQLite
116116
** within its configuration management system. ^The SQLITE_SOURCE_ID
117117
** string contains the date and time of the check-in (UTC) and a SHA1
118118
** or SHA3-256 hash of the entire source tree. If the source code has
@@ -123,11 +123,11 @@
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126126
#define SQLITE_VERSION "3.35.0"
127127
#define SQLITE_VERSION_NUMBER 3035000
128
-#define SQLITE_SOURCE_ID "2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398f17d"
128
+#define SQLITE_SOURCE_ID "2021-02-22 16:42:09 b5a0778cc5a98a864bea72670f83262da940aceb91fa4cdf46ec097337a3alt1"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
134134
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -108,11 +108,11 @@
108 ** be held constant and Z will be incremented or else Y will be incremented
109 ** and Z will be reset to zero.
110 **
111 ** Since [version 3.6.18] ([dateof:3.6.18]),
112 ** SQLite source code has been stored in the
113 ** <a href="http://fossil-scm.org/">Fossil configuration management
114 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
115 ** a string which identifies a particular check-in of SQLite
116 ** within its configuration management system. ^The SQLITE_SOURCE_ID
117 ** string contains the date and time of the check-in (UTC) and a SHA1
118 ** or SHA3-256 hash of the entire source tree. If the source code has
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.35.0"
127 #define SQLITE_VERSION_NUMBER 3035000
128 #define SQLITE_SOURCE_ID "2021-02-07 12:59:43 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398f17d"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
134
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -108,11 +108,11 @@
108 ** be held constant and Z will be incremented or else Y will be incremented
109 ** and Z will be reset to zero.
110 **
111 ** Since [version 3.6.18] ([dateof:3.6.18]),
112 ** SQLite source code has been stored in the
113 ** <a href="http://www.fossil-scm.org/">Fossil configuration management
114 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
115 ** a string which identifies a particular check-in of SQLite
116 ** within its configuration management system. ^The SQLITE_SOURCE_ID
117 ** string contains the date and time of the check-in (UTC) and a SHA1
118 ** or SHA3-256 hash of the entire source tree. If the source code has
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.35.0"
127 #define SQLITE_VERSION_NUMBER 3035000
128 #define SQLITE_SOURCE_ID "2021-02-22 16:42:09 b5a0778cc5a98a864bea72670f83262da940aceb91fa4cdf46ec097337a3alt1"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
134
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -14,10 +14,11 @@
1414
OBJDIR = $(T)
1515
OX = $(OBJDIR)
1616
O = .obj
1717
E = .exe
1818
P = .pdb
19
+OPTLEVEL= /Os
1920
2021
INSTALLDIR = .
2122
!ifdef DESTDIR
2223
INSTALLDIR = $(DESTDIR)\$(INSTALLDIR)
2324
!endif
@@ -213,11 +214,11 @@
213214
214215
!if $(DEBUG)!=0
215216
CFLAGS = $(CFLAGS) /Zi $(CRTFLAGS) /Od /DFOSSIL_DEBUG
216217
LDFLAGS = $(LDFLAGS) /DEBUG
217218
!else
218
-CFLAGS = $(CFLAGS) $(CRTFLAGS) /Os
219
+CFLAGS = $(CFLAGS) $(CRTFLAGS) $(OPTLEVEL)
219220
!endif
220221
221222
BCC = $(CC) $(CFLAGS)
222223
TCC = $(CC) /c $(CFLAGS) $(MSCDEF) $(INCL)
223224
RCC = $(RC) /D_WIN32 /D_MSC_VER $(MSCDEF) $(INCL)
224225
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -14,10 +14,11 @@
14 OBJDIR = $(T)
15 OX = $(OBJDIR)
16 O = .obj
17 E = .exe
18 P = .pdb
 
19
20 INSTALLDIR = .
21 !ifdef DESTDIR
22 INSTALLDIR = $(DESTDIR)\$(INSTALLDIR)
23 !endif
@@ -213,11 +214,11 @@
213
214 !if $(DEBUG)!=0
215 CFLAGS = $(CFLAGS) /Zi $(CRTFLAGS) /Od /DFOSSIL_DEBUG
216 LDFLAGS = $(LDFLAGS) /DEBUG
217 !else
218 CFLAGS = $(CFLAGS) $(CRTFLAGS) /Os
219 !endif
220
221 BCC = $(CC) $(CFLAGS)
222 TCC = $(CC) /c $(CFLAGS) $(MSCDEF) $(INCL)
223 RCC = $(RC) /D_WIN32 /D_MSC_VER $(MSCDEF) $(INCL)
224
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -14,10 +14,11 @@
14 OBJDIR = $(T)
15 OX = $(OBJDIR)
16 O = .obj
17 E = .exe
18 P = .pdb
19 OPTLEVEL= /Os
20
21 INSTALLDIR = .
22 !ifdef DESTDIR
23 INSTALLDIR = $(DESTDIR)\$(INSTALLDIR)
24 !endif
@@ -213,11 +214,11 @@
214
215 !if $(DEBUG)!=0
216 CFLAGS = $(CFLAGS) /Zi $(CRTFLAGS) /Od /DFOSSIL_DEBUG
217 LDFLAGS = $(LDFLAGS) /DEBUG
218 !else
219 CFLAGS = $(CFLAGS) $(CRTFLAGS) $(OPTLEVEL)
220 !endif
221
222 BCC = $(CC) $(CFLAGS)
223 TCC = $(CC) /c $(CFLAGS) $(MSCDEF) $(INCL)
224 RCC = $(RC) /D_WIN32 /D_MSC_VER $(MSCDEF) $(INCL)
225
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -32,11 +32,11 @@
3232
with the global state.
3333
The local state is not composed of artifacts and is not intended to be enduring.
3434
This document is concerned with global state only. Local state is only
3535
mentioned here in order to distinguish it from global state.
3636
37
-<a name="names"></a>
37
+<a id="names"></a>
3838
<h2>1.0 Artifact Names</h2>
3939
4040
Each artifact in the repository is named by a hash of its content.
4141
No prefixes, suffixes, or other information is added to an artifact before
4242
the hash is computed. The artifact name is just the (lower-case
@@ -54,11 +54,11 @@
5454
5555
Prior to Fossil version 2.0, all names were formed from the SHA1 hash of
5656
the artifact. The key innovation in Fossil 2.0 was adding support for
5757
alternative hash algorithms.
5858
59
-<a name="structural"></a>
59
+<a id="structural"></a>
6060
<h2>2.0 Structural Artifacts</h2>
6161
6262
A structural artifact is an artifact with a particular format
6363
that is used to define the relationships between other artifacts in the
6464
repository.
@@ -100,11 +100,11 @@
100100
not how the artifacts are stored on disk. It is the artifact format that
101101
is intended to be enduring. The specifics of how artifacts are stored on
102102
disk, though stable, is not intended to live as long as the
103103
artifact format.
104104
105
-<a name="manifest"></a>
105
+<a id="manifest"></a>
106106
<h3>2.1 The Manifest</h3>
107107
108108
A manifest defines a check-in.
109109
A manifest contains a list of artifacts for
110110
each file in the project and the corresponding filenames, as
@@ -256,11 +256,11 @@
256256
consistent.
257257
258258
A sample manifest from Fossil itself can be seen
259259
[/artifact/28987096ac | here].
260260
261
-<a name="cluster"></a>
261
+<a id="cluster"></a>
262262
<h3>2.2 Clusters</h3>
263263
264264
A cluster is an artifact that declares the existence of other artifacts.
265265
Clusters are used during repository synchronization to help
266266
reduce network traffic. As such, clusters are an optimization and
@@ -282,11 +282,11 @@
282282
prior cards in the cluster. The <b>Z</b> card is required.
283283
284284
An example cluster from Fossil can be seen
285285
[/artifact/d03dbdd73a2a8 | here].
286286
287
-<a name="ctrl"></a>
287
+<a id="ctrl"></a>
288288
<h3>2.3 Control Artifacts</h3>
289289
290290
Control artifacts are used to assign properties to other artifacts
291291
within the repository.
292292
Allowed cards in a control artifact are as follows:
@@ -336,11 +336,11 @@
336336
artifact. The <b>Z</b> card is the usual required artifact checksum.
337337
338338
An example control artifacts can be seen [/info/9d302ccda8 | here].
339339
340340
341
-<a name="wikichng"></a>
341
+<a id="wikichng"></a>
342342
<h3>2.4 Wiki Pages</h3>
343343
344344
A wiki artifact defines a single version of a
345345
single wiki page.
346346
Wiki artifacts accept
@@ -380,11 +380,11 @@
380380
artifact that includes a <b>C</b> card.
381381
382382
An example wiki artifact can be seen
383383
[/artifact?name=7b2f5fd0e0&txt=1 | here].
384384
385
-<a name="tktchng"></a>
385
+<a id="tktchng"></a>
386386
<h3>2.5 Ticket Changes</h3>
387387
388388
A ticket-change artifact represents a change to a trouble ticket.
389389
The following cards are allowed on a ticket change artifact:
390390
@@ -426,11 +426,11 @@
426426
escapes defined for the <b>C</b> card of a manifest.
427427
428428
An example ticket-change artifact can be seen
429429
[/artifact/91f1ec6af053 | here].
430430
431
-<a name="attachment"></a>
431
+<a id="attachment"></a>
432432
<h3>2.6 Attachments</h3>
433433
434434
An attachment artifact associates some other artifact that is the
435435
attachment (the source artifact) with a ticket or wiki page or
436436
technical note to which
@@ -468,11 +468,11 @@
468468
469469
The <b>Z</b> card is the usual checksum over the rest of the attachment artifact.
470470
The <b>Z</b> card is required.
471471
472472
473
-<a name="event"></a>
473
+<a id="event"></a>
474474
<h3>2.7 Technical Notes</h3>
475475
476476
A technical note or "technote" artifact (formerly known as an "event" artifact)
477477
associates a timeline comment and a page of text
478478
(similar to a wiki page) with a point in time. Technotes can be used
@@ -536,11 +536,11 @@
536536
technote. The format of the <b>W</b> card is exactly the same as for a
537537
[#wikichng | wiki artifact].
538538
539539
The <b>Z</b> card is the required checksum over the rest of the artifact.
540540
541
-<a name="forum"></a>
541
+<a id="forum"></a>
542542
<h3>2.8 Forum Posts</h3>
543543
544544
Forum posts are intended as a mechanism for users and developers to
545545
discuss a project. Forum posts are like messages on a mailing list.
546546
@@ -611,11 +611,11 @@
611611
[#wikichng | wiki artifact].
612612
613613
The <b>Z</b> card is the required checksum over the rest of the artifact.
614614
615615
616
-<a name="summary"></a>
616
+<a id="summary"></a>
617617
<h2>3.0 Card Summary</h2>
618618
619619
The following table summarizes the various kinds of cards that appear
620620
on Fossil artifacts. A blank entry means that combination of card and
621621
artifact is not legal. A number or range of numbers indicates the number
@@ -722,11 +722,11 @@
722722
<td>&nbsp;</td>
723723
<td>&nbsp;</td>
724724
<td>&nbsp;</td>
725725
<td>&nbsp;</td>
726726
<td>&nbsp;</td>
727
-<td align=center><b>0-1</b></td>
727
+<td align=center><b>0-1</b><sup><nowiki>[4]</nowiki></sup></td>
728728
</tr>
729729
<tr>
730730
<td><b>I</b> <i>in-reply-to</i></td>
731731
<td>&nbsp;</td>
732732
<td>&nbsp;</td>
@@ -733,11 +733,11 @@
733733
<td>&nbsp;</td>
734734
<td>&nbsp;</td>
735735
<td>&nbsp;</td>
736736
<td>&nbsp;</td>
737737
<td>&nbsp;</td>
738
-<td align=center><b>0-1</b></td>
738
+<td align=center><b>0-1</b><sup><nowiki>[4]</nowiki></sup></td>
739739
</tr>
740740
<tr>
741741
<td><b>J</b> <i>name</i> ?<i>value</i>?</td>
742742
<td>&nbsp;</td>
743743
<td>&nbsp;</td>
@@ -799,11 +799,11 @@
799799
<td>&nbsp;</td>
800800
<td align=center><b>0-1</b></td>
801801
<td>&nbsp;</td>
802802
<td>&nbsp;</td>
803803
<td align=center><b>0-1</b></td>
804
-<td align=center><b>0-1</b></td>
804
+<td align=center><b>0-1</b><sup><nowiki>[5]</nowiki></sup></td>
805805
</tr>
806806
<tr>
807807
<td><b>Q</b> (<b>+</b>|<b>-</b>)<i>uuid</i> ?<i>uuid</i>?</td>
808808
<td align=center><b>0+</b></td>
809809
<td>&nbsp;</td>
@@ -823,18 +823,18 @@
823823
<td>&nbsp;</td>
824824
<td>&nbsp;</td>
825825
<td>&nbsp;</td>
826826
<td>&nbsp;</td>
827827
<tr>
828
-<td><b>T</b> (<b>+</b>|<b>*</b>|<b>-</b>)<i>tagname</i> <i>uuid</i> ?<i>value</i>?</td>
828
+<td><b>T</b> (<b>+</b>|<b>*</b>|<b>-</b>)<i>tagname</i> <i>uuid</i> ?<i>value</i>?<sup><nowiki>[1]</nowiki></sup></td>
829829
<td align=center><b>0+</b></td>
830830
<td>&nbsp;</td>
831
-<td align=center><b>1+</b></td>
831
+<td align=center><b>1+</b><sup><nowiki>[2]</nowiki></sup></td>
832832
<td>&nbsp;</td>
833833
<td>&nbsp;</td>
834834
<td>&nbsp;</td>
835
-<td align=center><b>0+</b></td>
835
+<td align=center><b>0+</b><sup><nowiki>[3]</nowiki></sup></td>
836836
<td>&nbsp;</td>
837837
</tr>
838838
<tr>
839839
<td><b>U</b> <i>username</i></td>
840840
<td align=center><b>1</b></td>
@@ -868,18 +868,34 @@
868868
<td align=center><b>1</b></td>
869869
<td align=center><b>1</b></td>
870870
</tr>
871871
</table>
872872
873
+Footnotes:
874
+
875
+1) T-card names may not be made up of only hexadecimal characters, as
876
+ they would be indistinguishable from a hash prefix.
877
+
878
+2) Tags in [#ctrl | Control Artifacts] may not be
879
+ self-referential. i.e. they may not start with <tt>*</tt>.
880
+
881
+3) Tags in [#event | Technotes] must be self-referential. i.e. they
882
+ must start with <tt>*</tt>.
883
+
884
+4) [#forum | Forum Posts] must have either one H-card or one
885
+ I-card, not both.
886
+
887
+5) [#forum | Forum Post] P-cards must have only a single parent
888
+ hash. i.e. they may not have merge parents.
873889
874
-<a name="addenda"></a>
890
+<a id="addenda"></a>
875891
<h2>4.0 Addenda</h2>
876892
877893
This section contains additional information which may be useful when
878894
implementing algorithms described above.
879895
880
-<a name="outofordercards"></a>
896
+<a id="outofordercards"></a>
881897
<h3>4.1 Relaxed Card Ordering Due To An Historical Bug</h3>
882898
883899
All cards of a structural artifact should be in lexicographical order.
884900
The Fossil implementation verifies this and rejects any structural
885901
artifact which has out-of-order cards. Futhermore, when Fossil is
886902
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -32,11 +32,11 @@
32 with the global state.
33 The local state is not composed of artifacts and is not intended to be enduring.
34 This document is concerned with global state only. Local state is only
35 mentioned here in order to distinguish it from global state.
36
37 <a name="names"></a>
38 <h2>1.0 Artifact Names</h2>
39
40 Each artifact in the repository is named by a hash of its content.
41 No prefixes, suffixes, or other information is added to an artifact before
42 the hash is computed. The artifact name is just the (lower-case
@@ -54,11 +54,11 @@
54
55 Prior to Fossil version 2.0, all names were formed from the SHA1 hash of
56 the artifact. The key innovation in Fossil 2.0 was adding support for
57 alternative hash algorithms.
58
59 <a name="structural"></a>
60 <h2>2.0 Structural Artifacts</h2>
61
62 A structural artifact is an artifact with a particular format
63 that is used to define the relationships between other artifacts in the
64 repository.
@@ -100,11 +100,11 @@
100 not how the artifacts are stored on disk. It is the artifact format that
101 is intended to be enduring. The specifics of how artifacts are stored on
102 disk, though stable, is not intended to live as long as the
103 artifact format.
104
105 <a name="manifest"></a>
106 <h3>2.1 The Manifest</h3>
107
108 A manifest defines a check-in.
109 A manifest contains a list of artifacts for
110 each file in the project and the corresponding filenames, as
@@ -256,11 +256,11 @@
256 consistent.
257
258 A sample manifest from Fossil itself can be seen
259 [/artifact/28987096ac | here].
260
261 <a name="cluster"></a>
262 <h3>2.2 Clusters</h3>
263
264 A cluster is an artifact that declares the existence of other artifacts.
265 Clusters are used during repository synchronization to help
266 reduce network traffic. As such, clusters are an optimization and
@@ -282,11 +282,11 @@
282 prior cards in the cluster. The <b>Z</b> card is required.
283
284 An example cluster from Fossil can be seen
285 [/artifact/d03dbdd73a2a8 | here].
286
287 <a name="ctrl"></a>
288 <h3>2.3 Control Artifacts</h3>
289
290 Control artifacts are used to assign properties to other artifacts
291 within the repository.
292 Allowed cards in a control artifact are as follows:
@@ -336,11 +336,11 @@
336 artifact. The <b>Z</b> card is the usual required artifact checksum.
337
338 An example control artifacts can be seen [/info/9d302ccda8 | here].
339
340
341 <a name="wikichng"></a>
342 <h3>2.4 Wiki Pages</h3>
343
344 A wiki artifact defines a single version of a
345 single wiki page.
346 Wiki artifacts accept
@@ -380,11 +380,11 @@
380 artifact that includes a <b>C</b> card.
381
382 An example wiki artifact can be seen
383 [/artifact?name=7b2f5fd0e0&txt=1 | here].
384
385 <a name="tktchng"></a>
386 <h3>2.5 Ticket Changes</h3>
387
388 A ticket-change artifact represents a change to a trouble ticket.
389 The following cards are allowed on a ticket change artifact:
390
@@ -426,11 +426,11 @@
426 escapes defined for the <b>C</b> card of a manifest.
427
428 An example ticket-change artifact can be seen
429 [/artifact/91f1ec6af053 | here].
430
431 <a name="attachment"></a>
432 <h3>2.6 Attachments</h3>
433
434 An attachment artifact associates some other artifact that is the
435 attachment (the source artifact) with a ticket or wiki page or
436 technical note to which
@@ -468,11 +468,11 @@
468
469 The <b>Z</b> card is the usual checksum over the rest of the attachment artifact.
470 The <b>Z</b> card is required.
471
472
473 <a name="event"></a>
474 <h3>2.7 Technical Notes</h3>
475
476 A technical note or "technote" artifact (formerly known as an "event" artifact)
477 associates a timeline comment and a page of text
478 (similar to a wiki page) with a point in time. Technotes can be used
@@ -536,11 +536,11 @@
536 technote. The format of the <b>W</b> card is exactly the same as for a
537 [#wikichng | wiki artifact].
538
539 The <b>Z</b> card is the required checksum over the rest of the artifact.
540
541 <a name="forum"></a>
542 <h3>2.8 Forum Posts</h3>
543
544 Forum posts are intended as a mechanism for users and developers to
545 discuss a project. Forum posts are like messages on a mailing list.
546
@@ -611,11 +611,11 @@
611 [#wikichng | wiki artifact].
612
613 The <b>Z</b> card is the required checksum over the rest of the artifact.
614
615
616 <a name="summary"></a>
617 <h2>3.0 Card Summary</h2>
618
619 The following table summarizes the various kinds of cards that appear
620 on Fossil artifacts. A blank entry means that combination of card and
621 artifact is not legal. A number or range of numbers indicates the number
@@ -722,11 +722,11 @@
722 <td>&nbsp;</td>
723 <td>&nbsp;</td>
724 <td>&nbsp;</td>
725 <td>&nbsp;</td>
726 <td>&nbsp;</td>
727 <td align=center><b>0-1</b></td>
728 </tr>
729 <tr>
730 <td><b>I</b> <i>in-reply-to</i></td>
731 <td>&nbsp;</td>
732 <td>&nbsp;</td>
@@ -733,11 +733,11 @@
733 <td>&nbsp;</td>
734 <td>&nbsp;</td>
735 <td>&nbsp;</td>
736 <td>&nbsp;</td>
737 <td>&nbsp;</td>
738 <td align=center><b>0-1</b></td>
739 </tr>
740 <tr>
741 <td><b>J</b> <i>name</i> ?<i>value</i>?</td>
742 <td>&nbsp;</td>
743 <td>&nbsp;</td>
@@ -799,11 +799,11 @@
799 <td>&nbsp;</td>
800 <td align=center><b>0-1</b></td>
801 <td>&nbsp;</td>
802 <td>&nbsp;</td>
803 <td align=center><b>0-1</b></td>
804 <td align=center><b>0-1</b></td>
805 </tr>
806 <tr>
807 <td><b>Q</b> (<b>+</b>|<b>-</b>)<i>uuid</i> ?<i>uuid</i>?</td>
808 <td align=center><b>0+</b></td>
809 <td>&nbsp;</td>
@@ -823,18 +823,18 @@
823 <td>&nbsp;</td>
824 <td>&nbsp;</td>
825 <td>&nbsp;</td>
826 <td>&nbsp;</td>
827 <tr>
828 <td><b>T</b> (<b>+</b>|<b>*</b>|<b>-</b>)<i>tagname</i> <i>uuid</i> ?<i>value</i>?</td>
829 <td align=center><b>0+</b></td>
830 <td>&nbsp;</td>
831 <td align=center><b>1+</b></td>
832 <td>&nbsp;</td>
833 <td>&nbsp;</td>
834 <td>&nbsp;</td>
835 <td align=center><b>0+</b></td>
836 <td>&nbsp;</td>
837 </tr>
838 <tr>
839 <td><b>U</b> <i>username</i></td>
840 <td align=center><b>1</b></td>
@@ -868,18 +868,34 @@
868 <td align=center><b>1</b></td>
869 <td align=center><b>1</b></td>
870 </tr>
871 </table>
872
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
873
874 <a name="addenda"></a>
875 <h2>4.0 Addenda</h2>
876
877 This section contains additional information which may be useful when
878 implementing algorithms described above.
879
880 <a name="outofordercards"></a>
881 <h3>4.1 Relaxed Card Ordering Due To An Historical Bug</h3>
882
883 All cards of a structural artifact should be in lexicographical order.
884 The Fossil implementation verifies this and rejects any structural
885 artifact which has out-of-order cards. Futhermore, when Fossil is
886
--- www/fileformat.wiki
+++ www/fileformat.wiki
@@ -32,11 +32,11 @@
32 with the global state.
33 The local state is not composed of artifacts and is not intended to be enduring.
34 This document is concerned with global state only. Local state is only
35 mentioned here in order to distinguish it from global state.
36
37 <a id="names"></a>
38 <h2>1.0 Artifact Names</h2>
39
40 Each artifact in the repository is named by a hash of its content.
41 No prefixes, suffixes, or other information is added to an artifact before
42 the hash is computed. The artifact name is just the (lower-case
@@ -54,11 +54,11 @@
54
55 Prior to Fossil version 2.0, all names were formed from the SHA1 hash of
56 the artifact. The key innovation in Fossil 2.0 was adding support for
57 alternative hash algorithms.
58
59 <a id="structural"></a>
60 <h2>2.0 Structural Artifacts</h2>
61
62 A structural artifact is an artifact with a particular format
63 that is used to define the relationships between other artifacts in the
64 repository.
@@ -100,11 +100,11 @@
100 not how the artifacts are stored on disk. It is the artifact format that
101 is intended to be enduring. The specifics of how artifacts are stored on
102 disk, though stable, is not intended to live as long as the
103 artifact format.
104
105 <a id="manifest"></a>
106 <h3>2.1 The Manifest</h3>
107
108 A manifest defines a check-in.
109 A manifest contains a list of artifacts for
110 each file in the project and the corresponding filenames, as
@@ -256,11 +256,11 @@
256 consistent.
257
258 A sample manifest from Fossil itself can be seen
259 [/artifact/28987096ac | here].
260
261 <a id="cluster"></a>
262 <h3>2.2 Clusters</h3>
263
264 A cluster is an artifact that declares the existence of other artifacts.
265 Clusters are used during repository synchronization to help
266 reduce network traffic. As such, clusters are an optimization and
@@ -282,11 +282,11 @@
282 prior cards in the cluster. The <b>Z</b> card is required.
283
284 An example cluster from Fossil can be seen
285 [/artifact/d03dbdd73a2a8 | here].
286
287 <a id="ctrl"></a>
288 <h3>2.3 Control Artifacts</h3>
289
290 Control artifacts are used to assign properties to other artifacts
291 within the repository.
292 Allowed cards in a control artifact are as follows:
@@ -336,11 +336,11 @@
336 artifact. The <b>Z</b> card is the usual required artifact checksum.
337
338 An example control artifacts can be seen [/info/9d302ccda8 | here].
339
340
341 <a id="wikichng"></a>
342 <h3>2.4 Wiki Pages</h3>
343
344 A wiki artifact defines a single version of a
345 single wiki page.
346 Wiki artifacts accept
@@ -380,11 +380,11 @@
380 artifact that includes a <b>C</b> card.
381
382 An example wiki artifact can be seen
383 [/artifact?name=7b2f5fd0e0&txt=1 | here].
384
385 <a id="tktchng"></a>
386 <h3>2.5 Ticket Changes</h3>
387
388 A ticket-change artifact represents a change to a trouble ticket.
389 The following cards are allowed on a ticket change artifact:
390
@@ -426,11 +426,11 @@
426 escapes defined for the <b>C</b> card of a manifest.
427
428 An example ticket-change artifact can be seen
429 [/artifact/91f1ec6af053 | here].
430
431 <a id="attachment"></a>
432 <h3>2.6 Attachments</h3>
433
434 An attachment artifact associates some other artifact that is the
435 attachment (the source artifact) with a ticket or wiki page or
436 technical note to which
@@ -468,11 +468,11 @@
468
469 The <b>Z</b> card is the usual checksum over the rest of the attachment artifact.
470 The <b>Z</b> card is required.
471
472
473 <a id="event"></a>
474 <h3>2.7 Technical Notes</h3>
475
476 A technical note or "technote" artifact (formerly known as an "event" artifact)
477 associates a timeline comment and a page of text
478 (similar to a wiki page) with a point in time. Technotes can be used
@@ -536,11 +536,11 @@
536 technote. The format of the <b>W</b> card is exactly the same as for a
537 [#wikichng | wiki artifact].
538
539 The <b>Z</b> card is the required checksum over the rest of the artifact.
540
541 <a id="forum"></a>
542 <h3>2.8 Forum Posts</h3>
543
544 Forum posts are intended as a mechanism for users and developers to
545 discuss a project. Forum posts are like messages on a mailing list.
546
@@ -611,11 +611,11 @@
611 [#wikichng | wiki artifact].
612
613 The <b>Z</b> card is the required checksum over the rest of the artifact.
614
615
616 <a id="summary"></a>
617 <h2>3.0 Card Summary</h2>
618
619 The following table summarizes the various kinds of cards that appear
620 on Fossil artifacts. A blank entry means that combination of card and
621 artifact is not legal. A number or range of numbers indicates the number
@@ -722,11 +722,11 @@
722 <td>&nbsp;</td>
723 <td>&nbsp;</td>
724 <td>&nbsp;</td>
725 <td>&nbsp;</td>
726 <td>&nbsp;</td>
727 <td align=center><b>0-1</b><sup><nowiki>[4]</nowiki></sup></td>
728 </tr>
729 <tr>
730 <td><b>I</b> <i>in-reply-to</i></td>
731 <td>&nbsp;</td>
732 <td>&nbsp;</td>
@@ -733,11 +733,11 @@
733 <td>&nbsp;</td>
734 <td>&nbsp;</td>
735 <td>&nbsp;</td>
736 <td>&nbsp;</td>
737 <td>&nbsp;</td>
738 <td align=center><b>0-1</b><sup><nowiki>[4]</nowiki></sup></td>
739 </tr>
740 <tr>
741 <td><b>J</b> <i>name</i> ?<i>value</i>?</td>
742 <td>&nbsp;</td>
743 <td>&nbsp;</td>
@@ -799,11 +799,11 @@
799 <td>&nbsp;</td>
800 <td align=center><b>0-1</b></td>
801 <td>&nbsp;</td>
802 <td>&nbsp;</td>
803 <td align=center><b>0-1</b></td>
804 <td align=center><b>0-1</b><sup><nowiki>[5]</nowiki></sup></td>
805 </tr>
806 <tr>
807 <td><b>Q</b> (<b>+</b>|<b>-</b>)<i>uuid</i> ?<i>uuid</i>?</td>
808 <td align=center><b>0+</b></td>
809 <td>&nbsp;</td>
@@ -823,18 +823,18 @@
823 <td>&nbsp;</td>
824 <td>&nbsp;</td>
825 <td>&nbsp;</td>
826 <td>&nbsp;</td>
827 <tr>
828 <td><b>T</b> (<b>+</b>|<b>*</b>|<b>-</b>)<i>tagname</i> <i>uuid</i> ?<i>value</i>?<sup><nowiki>[1]</nowiki></sup></td>
829 <td align=center><b>0+</b></td>
830 <td>&nbsp;</td>
831 <td align=center><b>1+</b><sup><nowiki>[2]</nowiki></sup></td>
832 <td>&nbsp;</td>
833 <td>&nbsp;</td>
834 <td>&nbsp;</td>
835 <td align=center><b>0+</b><sup><nowiki>[3]</nowiki></sup></td>
836 <td>&nbsp;</td>
837 </tr>
838 <tr>
839 <td><b>U</b> <i>username</i></td>
840 <td align=center><b>1</b></td>
@@ -868,18 +868,34 @@
868 <td align=center><b>1</b></td>
869 <td align=center><b>1</b></td>
870 </tr>
871 </table>
872
873 Footnotes:
874
875 1) T-card names may not be made up of only hexadecimal characters, as
876 they would be indistinguishable from a hash prefix.
877
878 2) Tags in [#ctrl | Control Artifacts] may not be
879 self-referential. i.e. they may not start with <tt>*</tt>.
880
881 3) Tags in [#event | Technotes] must be self-referential. i.e. they
882 must start with <tt>*</tt>.
883
884 4) [#forum | Forum Posts] must have either one H-card or one
885 I-card, not both.
886
887 5) [#forum | Forum Post] P-cards must have only a single parent
888 hash. i.e. they may not have merge parents.
889
890 <a id="addenda"></a>
891 <h2>4.0 Addenda</h2>
892
893 This section contains additional information which may be useful when
894 implementing algorithms described above.
895
896 <a id="outofordercards"></a>
897 <h3>4.1 Relaxed Card Ordering Due To An Historical Bug</h3>
898
899 All cards of a structural artifact should be in lexicographical order.
900 The Fossil implementation verifies this and rejects any structural
901 artifact which has out-of-order cards. Futhermore, when Fossil is
902
--- www/fossil-is-not-relational.md
+++ www/fossil-is-not-relational.md
@@ -3,11 +3,11 @@
33
***An Introduction to the Fossil Data Model***
44
55
Upon hearing that Fossil is based on sqlite, it's natural for people
66
unfamiliar with its internals to assume that Fossil stores its
77
SCM-relevant data in a database-friendly way and that the SCM history
8
-could be modified via SQL. The truth, however, is *far stranger than
8
+can be modified via SQL. The truth, however, is *far stranger than
99
that.*
1010
1111
This presentation introduces, at a relatively high level:
1212
1313
1) The underlying enduring and immutable data format, which is
@@ -19,31 +19,10 @@
1919
3) The transformation of (1) from its immutable raw form to a
2020
*transient* database-friendly form.
2121
2222
4) Some of the consequences of this model.
2323
24
-<!--
25
-```pikchr center
26
-AllObjects: [
27
-A: file "Artifacts";
28
-down; move to A.s; move 50%;
29
-F: file "Client" "files";
30
-right; move 1; up; move 50%;
31
-B: cylinder "blob table"
32
-right;
33
-arrow from A.e to B.w;
34
-arrow from F.e to B.w;
35
-arrow from B.e;
36
-C: box rad 0.1 "Crosslink" "process";
37
-arrow
38
-AUX: cylinder "Auxiliary" "tables"
39
-arc -> cw dotted from AUX.s to B.s;
40
-] # end of AllObjects
41
-// text "Architecture Overview" big bold at .1cm above north of AllObjects
42
-```
--->
43
-
4424
4525
# Part 1: Artifacts
4626
4727
```pikchr center
4828
AllObjects: [
@@ -98,11 +77,11 @@
9877
makes no attempt at providing a generic format. It contains *only*
9978
what it *needs* to function, with zero bloat.
10079
10180
- It <u>**holds all SCM-relevant data except for client-level file
10281
content**</u>, the latter instead being referenced by their unique
103
- hash values. Storage of the client-side content as an implementation
82
+ hash values. Storage of the client-side content is an implementation
10483
detail delegated to higher-level applications.
10584
10685
- <u>**Auditability**</u>. By following the hash references in
10786
artifacts it is possible to unambiguously trace the origin of any
10887
modification to the SCM state. Combined with higher-level tools
10988
11089
ADDED www/gsoc-ideas.md
--- www/fossil-is-not-relational.md
+++ www/fossil-is-not-relational.md
@@ -3,11 +3,11 @@
3 ***An Introduction to the Fossil Data Model***
4
5 Upon hearing that Fossil is based on sqlite, it's natural for people
6 unfamiliar with its internals to assume that Fossil stores its
7 SCM-relevant data in a database-friendly way and that the SCM history
8 could be modified via SQL. The truth, however, is *far stranger than
9 that.*
10
11 This presentation introduces, at a relatively high level:
12
13 1) The underlying enduring and immutable data format, which is
@@ -19,31 +19,10 @@
19 3) The transformation of (1) from its immutable raw form to a
20 *transient* database-friendly form.
21
22 4) Some of the consequences of this model.
23
24 <!--
25 ```pikchr center
26 AllObjects: [
27 A: file "Artifacts";
28 down; move to A.s; move 50%;
29 F: file "Client" "files";
30 right; move 1; up; move 50%;
31 B: cylinder "blob table"
32 right;
33 arrow from A.e to B.w;
34 arrow from F.e to B.w;
35 arrow from B.e;
36 C: box rad 0.1 "Crosslink" "process";
37 arrow
38 AUX: cylinder "Auxiliary" "tables"
39 arc -> cw dotted from AUX.s to B.s;
40 ] # end of AllObjects
41 // text "Architecture Overview" big bold at .1cm above north of AllObjects
42 ```
--->
43
44
45 # Part 1: Artifacts
46
47 ```pikchr center
48 AllObjects: [
@@ -98,11 +77,11 @@
98 makes no attempt at providing a generic format. It contains *only*
99 what it *needs* to function, with zero bloat.
100
101 - It <u>**holds all SCM-relevant data except for client-level file
102 content**</u>, the latter instead being referenced by their unique
103 hash values. Storage of the client-side content as an implementation
104 detail delegated to higher-level applications.
105
106 - <u>**Auditability**</u>. By following the hash references in
107 artifacts it is possible to unambiguously trace the origin of any
108 modification to the SCM state. Combined with higher-level tools
109
110 DDED www/gsoc-ideas.md
--- www/fossil-is-not-relational.md
+++ www/fossil-is-not-relational.md
@@ -3,11 +3,11 @@
3 ***An Introduction to the Fossil Data Model***
4
5 Upon hearing that Fossil is based on sqlite, it's natural for people
6 unfamiliar with its internals to assume that Fossil stores its
7 SCM-relevant data in a database-friendly way and that the SCM history
8 can be modified via SQL. The truth, however, is *far stranger than
9 that.*
10
11 This presentation introduces, at a relatively high level:
12
13 1) The underlying enduring and immutable data format, which is
@@ -19,31 +19,10 @@
19 3) The transformation of (1) from its immutable raw form to a
20 *transient* database-friendly form.
21
22 4) Some of the consequences of this model.
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--->
 
24
25 # Part 1: Artifacts
26
27 ```pikchr center
28 AllObjects: [
@@ -98,11 +77,11 @@
77 makes no attempt at providing a generic format. It contains *only*
78 what it *needs* to function, with zero bloat.
79
80 - It <u>**holds all SCM-relevant data except for client-level file
81 content**</u>, the latter instead being referenced by their unique
82 hash values. Storage of the client-side content is an implementation
83 detail delegated to higher-level applications.
84
85 - <u>**Auditability**</u>. By following the hash references in
86 artifacts it is possible to unambiguously trace the origin of any
87 modification to the SCM state. Combined with higher-level tools
88
89 DDED www/gsoc-ideas.md
--- a/www/gsoc-ideas.md
+++ b/www/gsoc-ideas.md
@@ -0,0 +1,5 @@
1
+point in
2
+ developers. The
3
+ guarapoint in
4
+ developers. The
5
+ guaraa
--- a/www/gsoc-ideas.md
+++ b/www/gsoc-ideas.md
@@ -0,0 +1,5 @@
 
 
 
 
 
--- a/www/gsoc-ideas.md
+++ b/www/gsoc-ideas.md
@@ -0,0 +1,5 @@
1 point in
2 developers. The
3 guarapoint in
4 developers. The
5 guaraa
+1 -1
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -54,11 +54,11 @@
5454
fileformat.wiki {Fossil File Format}
5555
fiveminutes.wiki {Up and Running in 5 Minutes as a Single User}
5656
forum.wiki {Fossil Forums}
5757
foss-cklist.wiki {Checklist For Successful Open-Source Projects}
5858
fossil-from-msvc.wiki {Integrating Fossil in the Microsoft Express 2010 IDE}
59
- fossil-is-not-relational.md {Introduction to the Fossil Data Model}
59
+ fossil-is-not-relational.md {Introduction to the (Non-relational) Fossil Data Model}
6060
fossil_prompt.wiki {Fossilized Bash Prompt}
6161
fossil-v-git.wiki {Fossil Versus Git}
6262
globs.md {File Name Glob Patterns}
6363
gitusers.md {Git to Fossil Translation Guide}
6464
grep.md {Fossil grep vs POSIX grep}
6565
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -54,11 +54,11 @@
54 fileformat.wiki {Fossil File Format}
55 fiveminutes.wiki {Up and Running in 5 Minutes as a Single User}
56 forum.wiki {Fossil Forums}
57 foss-cklist.wiki {Checklist For Successful Open-Source Projects}
58 fossil-from-msvc.wiki {Integrating Fossil in the Microsoft Express 2010 IDE}
59 fossil-is-not-relational.md {Introduction to the Fossil Data Model}
60 fossil_prompt.wiki {Fossilized Bash Prompt}
61 fossil-v-git.wiki {Fossil Versus Git}
62 globs.md {File Name Glob Patterns}
63 gitusers.md {Git to Fossil Translation Guide}
64 grep.md {Fossil grep vs POSIX grep}
65
--- www/mkindex.tcl
+++ www/mkindex.tcl
@@ -54,11 +54,11 @@
54 fileformat.wiki {Fossil File Format}
55 fiveminutes.wiki {Up and Running in 5 Minutes as a Single User}
56 forum.wiki {Fossil Forums}
57 foss-cklist.wiki {Checklist For Successful Open-Source Projects}
58 fossil-from-msvc.wiki {Integrating Fossil in the Microsoft Express 2010 IDE}
59 fossil-is-not-relational.md {Introduction to the (Non-relational) Fossil Data Model}
60 fossil_prompt.wiki {Fossilized Bash Prompt}
61 fossil-v-git.wiki {Fossil Versus Git}
62 globs.md {File Name Glob Patterns}
63 gitusers.md {Git to Fossil Translation Guide}
64 grep.md {Fossil grep vs POSIX grep}
65
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -20,10 +20,11 @@
2020
book</a>
2121
</ul>
2222
<a name="pindex"></a>
2323
<h2>Permuted Index:</h2>
2424
<ul>
25
+<li><a href="fossil-is-not-relational.md">(Non-relational) Fossil Data Model &mdash; Introduction to the</a></li>
2526
<li><a href="fiveminutes.wiki">5 Minutes as a Single User &mdash; Up and Running in</a></li>
2627
<li><a href="fossil-from-msvc.wiki">2010 IDE &mdash; Integrating Fossil in the Microsoft Express</a></li>
2728
<li><a href="tech_overview.wiki"><b>A Technical Overview Of The Design And Implementation Of Fossil</b></a></li>
2829
<li><a href="serverext.wiki"><b>Adding Extensions To A Fossil Server Using CGI Scripts</b></a></li>
2930
<li><a href="adding_code.wiki"><b>Adding New Features To Fossil</b></a></li>
@@ -91,11 +92,11 @@
9192
<li><a href="css-tricks.md">CSS Tips and Tricks &mdash; Fossil</a></li>
9293
<li><a href="customskin.md"><b>Custom Skins</b></a></li>
9394
<li><a href="customskin.md">Customizing The Appearance of Web Pages &mdash; Theming:</a></li>
9495
<li><a href="custom_ticket.wiki"><b>Customizing The Ticket System</b></a></li>
9596
<li><a href="customgraph.md">Customizing the Timeline Graph &mdash; Theming:</a></li>
96
-<li><a href="fossil-is-not-relational.md">Data Model &mdash; Introduction to the Fossil</a></li>
97
+<li><a href="fossil-is-not-relational.md">Data Model &mdash; Introduction to the (Non-relational) Fossil</a></li>
9798
<li><a href="tech_overview.wiki">Databases Used By Fossil &mdash; SQLite</a></li>
9899
<li><a href="defcsp.md">Default Content Security Policy &mdash; The</a></li>
99100
<li><a href="antibot.wiki"><b>Defense against Spiders and Bots</b></a></li>
100101
<li><a href="shunning.wiki">Deleting Content From Fossil &mdash; Shunning:</a></li>
101102
<li><a href="private.wiki">Deleting Private Branches &mdash; Creating, Syncing, and</a></li>
@@ -196,11 +197,11 @@
196197
<li><a href="build.wiki">Installing Fossil &mdash; Compiling and</a></li>
197198
<li><a href="fossil-from-msvc.wiki"><b>Integrating Fossil in the Microsoft Express 2010 IDE</b></a></li>
198199
<li><a href="selfcheck.wiki">Integrity Self Checks &mdash; Fossil Repository</a></li>
199200
<li><a href="webui.wiki">Interface &mdash; The Fossil Web</a></li>
200201
<li><a href="interwiki.md"><b>Interwiki Links</b></a></li>
201
-<li><a href="fossil-is-not-relational.md"><b>Introduction to the Fossil Data Model</b></a></li>
202
+<li><a href="fossil-is-not-relational.md"><b>Introduction to the (Non-relational) Fossil Data Model</b></a></li>
202203
<li><a href="blockchain.md"><b>Is Fossil A Blockchain?</b></a></li>
203204
<li><a href="chroot.md">Jail &mdash; Server Chroot</a></li>
204205
<li><a href="javascript.md">JavaScript in Fossil &mdash; Use of</a></li>
205206
<li><a href="pikchr.md">Language &mdash; The Pikchr Diagram</a></li>
206207
<li><a href="th1.md">Language &mdash; The TH1 Scripting</a></li>
@@ -217,11 +218,11 @@
217218
<li><a href="branching.wiki">Merging, and Tagging &mdash; Branching, Forking,</a></li>
218219
<li><a href="fossil-from-msvc.wiki">Microsoft Express 2010 IDE &mdash; Integrating Fossil in the</a></li>
219220
<li><a href="fiveminutes.wiki">Minutes as a Single User &mdash; Up and Running in 5</a></li>
220221
<li><a href="mirrortogithub.md">Mirror A Fossil Repository On GitHub &mdash; How To</a></li>
221222
<li><a href="mirrorlimitations.md">Mirrors &mdash; Limitations On Git</a></li>
222
-<li><a href="fossil-is-not-relational.md">Model &mdash; Introduction to the Fossil Data</a></li>
223
+<li><a href="fossil-is-not-relational.md">Model &mdash; Introduction to the (Non-relational) Fossil Data</a></li>
223224
<li><a href="globs.md">Name Glob Patterns &mdash; File</a></li>
224225
<li><a href="checkin_names.wiki">Names &mdash; Check-in And Version</a></li>
225226
<li><a href="adding_code.wiki">New Features To Fossil &mdash; Adding</a></li>
226227
<li><a href="newrepo.wiki">New Fossil Repository &mdash; How To Create A</a></li>
227228
<li><a href="alerts.md">Notifications &mdash; Email Alerts And</a></li>
228229
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -20,10 +20,11 @@
20 book</a>
21 </ul>
22 <a name="pindex"></a>
23 <h2>Permuted Index:</h2>
24 <ul>
 
25 <li><a href="fiveminutes.wiki">5 Minutes as a Single User &mdash; Up and Running in</a></li>
26 <li><a href="fossil-from-msvc.wiki">2010 IDE &mdash; Integrating Fossil in the Microsoft Express</a></li>
27 <li><a href="tech_overview.wiki"><b>A Technical Overview Of The Design And Implementation Of Fossil</b></a></li>
28 <li><a href="serverext.wiki"><b>Adding Extensions To A Fossil Server Using CGI Scripts</b></a></li>
29 <li><a href="adding_code.wiki"><b>Adding New Features To Fossil</b></a></li>
@@ -91,11 +92,11 @@
91 <li><a href="css-tricks.md">CSS Tips and Tricks &mdash; Fossil</a></li>
92 <li><a href="customskin.md"><b>Custom Skins</b></a></li>
93 <li><a href="customskin.md">Customizing The Appearance of Web Pages &mdash; Theming:</a></li>
94 <li><a href="custom_ticket.wiki"><b>Customizing The Ticket System</b></a></li>
95 <li><a href="customgraph.md">Customizing the Timeline Graph &mdash; Theming:</a></li>
96 <li><a href="fossil-is-not-relational.md">Data Model &mdash; Introduction to the Fossil</a></li>
97 <li><a href="tech_overview.wiki">Databases Used By Fossil &mdash; SQLite</a></li>
98 <li><a href="defcsp.md">Default Content Security Policy &mdash; The</a></li>
99 <li><a href="antibot.wiki"><b>Defense against Spiders and Bots</b></a></li>
100 <li><a href="shunning.wiki">Deleting Content From Fossil &mdash; Shunning:</a></li>
101 <li><a href="private.wiki">Deleting Private Branches &mdash; Creating, Syncing, and</a></li>
@@ -196,11 +197,11 @@
196 <li><a href="build.wiki">Installing Fossil &mdash; Compiling and</a></li>
197 <li><a href="fossil-from-msvc.wiki"><b>Integrating Fossil in the Microsoft Express 2010 IDE</b></a></li>
198 <li><a href="selfcheck.wiki">Integrity Self Checks &mdash; Fossil Repository</a></li>
199 <li><a href="webui.wiki">Interface &mdash; The Fossil Web</a></li>
200 <li><a href="interwiki.md"><b>Interwiki Links</b></a></li>
201 <li><a href="fossil-is-not-relational.md"><b>Introduction to the Fossil Data Model</b></a></li>
202 <li><a href="blockchain.md"><b>Is Fossil A Blockchain?</b></a></li>
203 <li><a href="chroot.md">Jail &mdash; Server Chroot</a></li>
204 <li><a href="javascript.md">JavaScript in Fossil &mdash; Use of</a></li>
205 <li><a href="pikchr.md">Language &mdash; The Pikchr Diagram</a></li>
206 <li><a href="th1.md">Language &mdash; The TH1 Scripting</a></li>
@@ -217,11 +218,11 @@
217 <li><a href="branching.wiki">Merging, and Tagging &mdash; Branching, Forking,</a></li>
218 <li><a href="fossil-from-msvc.wiki">Microsoft Express 2010 IDE &mdash; Integrating Fossil in the</a></li>
219 <li><a href="fiveminutes.wiki">Minutes as a Single User &mdash; Up and Running in 5</a></li>
220 <li><a href="mirrortogithub.md">Mirror A Fossil Repository On GitHub &mdash; How To</a></li>
221 <li><a href="mirrorlimitations.md">Mirrors &mdash; Limitations On Git</a></li>
222 <li><a href="fossil-is-not-relational.md">Model &mdash; Introduction to the Fossil Data</a></li>
223 <li><a href="globs.md">Name Glob Patterns &mdash; File</a></li>
224 <li><a href="checkin_names.wiki">Names &mdash; Check-in And Version</a></li>
225 <li><a href="adding_code.wiki">New Features To Fossil &mdash; Adding</a></li>
226 <li><a href="newrepo.wiki">New Fossil Repository &mdash; How To Create A</a></li>
227 <li><a href="alerts.md">Notifications &mdash; Email Alerts And</a></li>
228
--- www/permutedindex.html
+++ www/permutedindex.html
@@ -20,10 +20,11 @@
20 book</a>
21 </ul>
22 <a name="pindex"></a>
23 <h2>Permuted Index:</h2>
24 <ul>
25 <li><a href="fossil-is-not-relational.md">(Non-relational) Fossil Data Model &mdash; Introduction to the</a></li>
26 <li><a href="fiveminutes.wiki">5 Minutes as a Single User &mdash; Up and Running in</a></li>
27 <li><a href="fossil-from-msvc.wiki">2010 IDE &mdash; Integrating Fossil in the Microsoft Express</a></li>
28 <li><a href="tech_overview.wiki"><b>A Technical Overview Of The Design And Implementation Of Fossil</b></a></li>
29 <li><a href="serverext.wiki"><b>Adding Extensions To A Fossil Server Using CGI Scripts</b></a></li>
30 <li><a href="adding_code.wiki"><b>Adding New Features To Fossil</b></a></li>
@@ -91,11 +92,11 @@
92 <li><a href="css-tricks.md">CSS Tips and Tricks &mdash; Fossil</a></li>
93 <li><a href="customskin.md"><b>Custom Skins</b></a></li>
94 <li><a href="customskin.md">Customizing The Appearance of Web Pages &mdash; Theming:</a></li>
95 <li><a href="custom_ticket.wiki"><b>Customizing The Ticket System</b></a></li>
96 <li><a href="customgraph.md">Customizing the Timeline Graph &mdash; Theming:</a></li>
97 <li><a href="fossil-is-not-relational.md">Data Model &mdash; Introduction to the (Non-relational) Fossil</a></li>
98 <li><a href="tech_overview.wiki">Databases Used By Fossil &mdash; SQLite</a></li>
99 <li><a href="defcsp.md">Default Content Security Policy &mdash; The</a></li>
100 <li><a href="antibot.wiki"><b>Defense against Spiders and Bots</b></a></li>
101 <li><a href="shunning.wiki">Deleting Content From Fossil &mdash; Shunning:</a></li>
102 <li><a href="private.wiki">Deleting Private Branches &mdash; Creating, Syncing, and</a></li>
@@ -196,11 +197,11 @@
197 <li><a href="build.wiki">Installing Fossil &mdash; Compiling and</a></li>
198 <li><a href="fossil-from-msvc.wiki"><b>Integrating Fossil in the Microsoft Express 2010 IDE</b></a></li>
199 <li><a href="selfcheck.wiki">Integrity Self Checks &mdash; Fossil Repository</a></li>
200 <li><a href="webui.wiki">Interface &mdash; The Fossil Web</a></li>
201 <li><a href="interwiki.md"><b>Interwiki Links</b></a></li>
202 <li><a href="fossil-is-not-relational.md"><b>Introduction to the (Non-relational) Fossil Data Model</b></a></li>
203 <li><a href="blockchain.md"><b>Is Fossil A Blockchain?</b></a></li>
204 <li><a href="chroot.md">Jail &mdash; Server Chroot</a></li>
205 <li><a href="javascript.md">JavaScript in Fossil &mdash; Use of</a></li>
206 <li><a href="pikchr.md">Language &mdash; The Pikchr Diagram</a></li>
207 <li><a href="th1.md">Language &mdash; The TH1 Scripting</a></li>
@@ -217,11 +218,11 @@
218 <li><a href="branching.wiki">Merging, and Tagging &mdash; Branching, Forking,</a></li>
219 <li><a href="fossil-from-msvc.wiki">Microsoft Express 2010 IDE &mdash; Integrating Fossil in the</a></li>
220 <li><a href="fiveminutes.wiki">Minutes as a Single User &mdash; Up and Running in 5</a></li>
221 <li><a href="mirrortogithub.md">Mirror A Fossil Repository On GitHub &mdash; How To</a></li>
222 <li><a href="mirrorlimitations.md">Mirrors &mdash; Limitations On Git</a></li>
223 <li><a href="fossil-is-not-relational.md">Model &mdash; Introduction to the (Non-relational) Fossil Data</a></li>
224 <li><a href="globs.md">Name Glob Patterns &mdash; File</a></li>
225 <li><a href="checkin_names.wiki">Names &mdash; Check-in And Version</a></li>
226 <li><a href="adding_code.wiki">New Features To Fossil &mdash; Adding</a></li>
227 <li><a href="newrepo.wiki">New Fossil Repository &mdash; How To Create A</a></li>
228 <li><a href="alerts.md">Notifications &mdash; Email Alerts And</a></li>
229

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button