Fossil SCM

Update the built-in SQLite to the latest trunk version which includes the fix for EXPLAIN QUERY PLAN for the query that runs the /forum page.

drh 2018-08-16 16:26 trunk
Commit f8994f8975d86d224965b89d5a616fef7ec55a3760b066a5c91058a1f921638e
3 files changed +27 -16 +2205 -2249 +28 -17
+27 -16
--- src/shell.c
+++ src/shell.c
@@ -584,11 +584,11 @@
584584
585585
while( 1 ){
586586
if( n+100>nLine ){
587587
nLine = nLine*2 + 100;
588588
zLine = realloc(zLine, nLine);
589
- if( zLine==0 ) return 0;
589
+ if( zLine==0 ) shell_out_of_memory();
590590
}
591591
if( fgets(&zLine[n], nLine - n, in)==0 ){
592592
if( n==0 ){
593593
free(zLine);
594594
return 0;
@@ -611,14 +611,11 @@
611611
char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
612612
if( zTrans ){
613613
int nTrans = strlen30(zTrans)+1;
614614
if( nTrans>nLine ){
615615
zLine = realloc(zLine, nTrans);
616
- if( zLine==0 ){
617
- sqlite3_free(zTrans);
618
- return 0;
619
- }
616
+ if( zLine==0 ) shell_out_of_memory();
620617
}
621618
memcpy(zLine, zTrans, nTrans);
622619
sqlite3_free(zTrans);
623620
}
624621
}
@@ -761,14 +758,11 @@
761758
}
762759
763760
if( p->n+len>=p->nAlloc ){
764761
p->nAlloc = p->nAlloc*2 + len + 20;
765762
p->z = realloc(p->z, p->nAlloc);
766
- if( p->z==0 ){
767
- memset(p, 0, sizeof(*p));
768
- return;
769
- }
763
+ if( p->z==0 ) shell_out_of_memory();
770764
}
771765
772766
if( quote ){
773767
char *zCsr = p->z+p->n;
774768
*zCsr++ = quote;
@@ -8690,10 +8684,11 @@
86908684
char *zTempFile = 0;
86918685
sqlite3 *db;
86928686
char *zCmd = 0;
86938687
int bBin;
86948688
int rc;
8689
+ int hasCRNL = 0;
86958690
FILE *f = 0;
86968691
sqlite3_int64 sz;
86978692
sqlite3_int64 x;
86988693
unsigned char *p = 0;
86998694
@@ -8721,19 +8716,24 @@
87218716
sqlite3_result_error_nomem(context);
87228717
return;
87238718
}
87248719
}
87258720
bBin = sqlite3_value_type(argv[0])==SQLITE_BLOB;
8721
+ /* When writing the file to be edited, do \n to \r\n conversions on systems
8722
+ ** that want \r\n line endings */
87268723
f = fopen(zTempFile, bBin ? "wb" : "w");
87278724
if( f==0 ){
87288725
sqlite3_result_error(context, "edit() cannot open temp file", -1);
87298726
goto edit_func_end;
87308727
}
87318728
sz = sqlite3_value_bytes(argv[0]);
87328729
if( bBin ){
87338730
x = fwrite(sqlite3_value_blob(argv[0]), 1, sz, f);
87348731
}else{
8732
+ const char *z = (const char*)sqlite3_value_text(argv[0]);
8733
+ /* Remember whether or not the value originally contained \r\n */
8734
+ if( z && strstr(z,"\r\n")!=0 ) hasCRNL = 1;
87358735
x = fwrite(sqlite3_value_text(argv[0]), 1, sz, f);
87368736
}
87378737
fclose(f);
87388738
f = 0;
87398739
if( x!=sz ){
@@ -8749,11 +8749,11 @@
87498749
sqlite3_free(zCmd);
87508750
if( rc ){
87518751
sqlite3_result_error(context, "EDITOR returned non-zero", -1);
87528752
goto edit_func_end;
87538753
}
8754
- f = fopen(zTempFile, bBin ? "rb" : "r");
8754
+ f = fopen(zTempFile, "rb");
87558755
if( f==0 ){
87568756
sqlite3_result_error(context,
87578757
"edit() cannot reopen temp file after edit", -1);
87588758
goto edit_func_end;
87598759
}
@@ -8763,25 +8763,34 @@
87638763
p = sqlite3_malloc64( sz+(bBin==0) );
87648764
if( p==0 ){
87658765
sqlite3_result_error_nomem(context);
87668766
goto edit_func_end;
87678767
}
8768
- if( bBin ){
8769
- x = fread(p, 1, sz, f);
8770
- }else{
8771
- x = fread(p, 1, sz, f);
8772
- p[sz] = 0;
8773
- }
8768
+ x = fread(p, 1, sz, f);
87748769
fclose(f);
87758770
f = 0;
87768771
if( x!=sz ){
87778772
sqlite3_result_error(context, "could not read back the whole file", -1);
87788773
goto edit_func_end;
87798774
}
87808775
if( bBin ){
87818776
sqlite3_result_blob64(context, p, sz, sqlite3_free);
87828777
}else{
8778
+ int i, j;
8779
+ if( hasCRNL ){
8780
+ /* If the original contains \r\n then do no conversions back to \n */
8781
+ j = sz;
8782
+ }else{
8783
+ /* If the file did not originally contain \r\n then convert any new
8784
+ ** \r\n back into \n */
8785
+ for(i=j=0; i<sz; i++){
8786
+ if( p[i]=='\r' && p[i+1]=='\n' ) i++;
8787
+ p[j++] = p[i];
8788
+ }
8789
+ sz = j;
8790
+ p[sz] = 0;
8791
+ }
87838792
sqlite3_result_text64(context, (const char*)p, sz,
87848793
sqlite3_free, SQLITE_UTF8);
87858794
}
87868795
p = 0;
87878796
@@ -10128,11 +10137,13 @@
1012810137
}
1012910138
}
1013010139
}
1013110140
nAlloc += 100;
1013210141
p->aiIndent = (int*)sqlite3_realloc64(p->aiIndent, nAlloc*sizeof(int));
10142
+ if( p->aiIndent==0 ) shell_out_of_memory();
1013310143
abYield = (int*)sqlite3_realloc64(abYield, nAlloc*sizeof(int));
10144
+ if( abYield==0 ) shell_out_of_memory();
1013410145
}
1013510146
abYield[iOp] = str_in_array(zOp, azYield);
1013610147
p->aiIndent[iOp] = 0;
1013710148
p->nIndent = iOp+1;
1013810149
1013910150
--- src/shell.c
+++ src/shell.c
@@ -584,11 +584,11 @@
584
585 while( 1 ){
586 if( n+100>nLine ){
587 nLine = nLine*2 + 100;
588 zLine = realloc(zLine, nLine);
589 if( zLine==0 ) return 0;
590 }
591 if( fgets(&zLine[n], nLine - n, in)==0 ){
592 if( n==0 ){
593 free(zLine);
594 return 0;
@@ -611,14 +611,11 @@
611 char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
612 if( zTrans ){
613 int nTrans = strlen30(zTrans)+1;
614 if( nTrans>nLine ){
615 zLine = realloc(zLine, nTrans);
616 if( zLine==0 ){
617 sqlite3_free(zTrans);
618 return 0;
619 }
620 }
621 memcpy(zLine, zTrans, nTrans);
622 sqlite3_free(zTrans);
623 }
624 }
@@ -761,14 +758,11 @@
761 }
762
763 if( p->n+len>=p->nAlloc ){
764 p->nAlloc = p->nAlloc*2 + len + 20;
765 p->z = realloc(p->z, p->nAlloc);
766 if( p->z==0 ){
767 memset(p, 0, sizeof(*p));
768 return;
769 }
770 }
771
772 if( quote ){
773 char *zCsr = p->z+p->n;
774 *zCsr++ = quote;
@@ -8690,10 +8684,11 @@
8690 char *zTempFile = 0;
8691 sqlite3 *db;
8692 char *zCmd = 0;
8693 int bBin;
8694 int rc;
 
8695 FILE *f = 0;
8696 sqlite3_int64 sz;
8697 sqlite3_int64 x;
8698 unsigned char *p = 0;
8699
@@ -8721,19 +8716,24 @@
8721 sqlite3_result_error_nomem(context);
8722 return;
8723 }
8724 }
8725 bBin = sqlite3_value_type(argv[0])==SQLITE_BLOB;
 
 
8726 f = fopen(zTempFile, bBin ? "wb" : "w");
8727 if( f==0 ){
8728 sqlite3_result_error(context, "edit() cannot open temp file", -1);
8729 goto edit_func_end;
8730 }
8731 sz = sqlite3_value_bytes(argv[0]);
8732 if( bBin ){
8733 x = fwrite(sqlite3_value_blob(argv[0]), 1, sz, f);
8734 }else{
 
 
 
8735 x = fwrite(sqlite3_value_text(argv[0]), 1, sz, f);
8736 }
8737 fclose(f);
8738 f = 0;
8739 if( x!=sz ){
@@ -8749,11 +8749,11 @@
8749 sqlite3_free(zCmd);
8750 if( rc ){
8751 sqlite3_result_error(context, "EDITOR returned non-zero", -1);
8752 goto edit_func_end;
8753 }
8754 f = fopen(zTempFile, bBin ? "rb" : "r");
8755 if( f==0 ){
8756 sqlite3_result_error(context,
8757 "edit() cannot reopen temp file after edit", -1);
8758 goto edit_func_end;
8759 }
@@ -8763,25 +8763,34 @@
8763 p = sqlite3_malloc64( sz+(bBin==0) );
8764 if( p==0 ){
8765 sqlite3_result_error_nomem(context);
8766 goto edit_func_end;
8767 }
8768 if( bBin ){
8769 x = fread(p, 1, sz, f);
8770 }else{
8771 x = fread(p, 1, sz, f);
8772 p[sz] = 0;
8773 }
8774 fclose(f);
8775 f = 0;
8776 if( x!=sz ){
8777 sqlite3_result_error(context, "could not read back the whole file", -1);
8778 goto edit_func_end;
8779 }
8780 if( bBin ){
8781 sqlite3_result_blob64(context, p, sz, sqlite3_free);
8782 }else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8783 sqlite3_result_text64(context, (const char*)p, sz,
8784 sqlite3_free, SQLITE_UTF8);
8785 }
8786 p = 0;
8787
@@ -10128,11 +10137,13 @@
10128 }
10129 }
10130 }
10131 nAlloc += 100;
10132 p->aiIndent = (int*)sqlite3_realloc64(p->aiIndent, nAlloc*sizeof(int));
 
10133 abYield = (int*)sqlite3_realloc64(abYield, nAlloc*sizeof(int));
 
10134 }
10135 abYield[iOp] = str_in_array(zOp, azYield);
10136 p->aiIndent[iOp] = 0;
10137 p->nIndent = iOp+1;
10138
10139
--- src/shell.c
+++ src/shell.c
@@ -584,11 +584,11 @@
584
585 while( 1 ){
586 if( n+100>nLine ){
587 nLine = nLine*2 + 100;
588 zLine = realloc(zLine, nLine);
589 if( zLine==0 ) shell_out_of_memory();
590 }
591 if( fgets(&zLine[n], nLine - n, in)==0 ){
592 if( n==0 ){
593 free(zLine);
594 return 0;
@@ -611,14 +611,11 @@
611 char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
612 if( zTrans ){
613 int nTrans = strlen30(zTrans)+1;
614 if( nTrans>nLine ){
615 zLine = realloc(zLine, nTrans);
616 if( zLine==0 ) shell_out_of_memory();
 
 
 
617 }
618 memcpy(zLine, zTrans, nTrans);
619 sqlite3_free(zTrans);
620 }
621 }
@@ -761,14 +758,11 @@
758 }
759
760 if( p->n+len>=p->nAlloc ){
761 p->nAlloc = p->nAlloc*2 + len + 20;
762 p->z = realloc(p->z, p->nAlloc);
763 if( p->z==0 ) shell_out_of_memory();
 
 
 
764 }
765
766 if( quote ){
767 char *zCsr = p->z+p->n;
768 *zCsr++ = quote;
@@ -8690,10 +8684,11 @@
8684 char *zTempFile = 0;
8685 sqlite3 *db;
8686 char *zCmd = 0;
8687 int bBin;
8688 int rc;
8689 int hasCRNL = 0;
8690 FILE *f = 0;
8691 sqlite3_int64 sz;
8692 sqlite3_int64 x;
8693 unsigned char *p = 0;
8694
@@ -8721,19 +8716,24 @@
8716 sqlite3_result_error_nomem(context);
8717 return;
8718 }
8719 }
8720 bBin = sqlite3_value_type(argv[0])==SQLITE_BLOB;
8721 /* When writing the file to be edited, do \n to \r\n conversions on systems
8722 ** that want \r\n line endings */
8723 f = fopen(zTempFile, bBin ? "wb" : "w");
8724 if( f==0 ){
8725 sqlite3_result_error(context, "edit() cannot open temp file", -1);
8726 goto edit_func_end;
8727 }
8728 sz = sqlite3_value_bytes(argv[0]);
8729 if( bBin ){
8730 x = fwrite(sqlite3_value_blob(argv[0]), 1, sz, f);
8731 }else{
8732 const char *z = (const char*)sqlite3_value_text(argv[0]);
8733 /* Remember whether or not the value originally contained \r\n */
8734 if( z && strstr(z,"\r\n")!=0 ) hasCRNL = 1;
8735 x = fwrite(sqlite3_value_text(argv[0]), 1, sz, f);
8736 }
8737 fclose(f);
8738 f = 0;
8739 if( x!=sz ){
@@ -8749,11 +8749,11 @@
8749 sqlite3_free(zCmd);
8750 if( rc ){
8751 sqlite3_result_error(context, "EDITOR returned non-zero", -1);
8752 goto edit_func_end;
8753 }
8754 f = fopen(zTempFile, "rb");
8755 if( f==0 ){
8756 sqlite3_result_error(context,
8757 "edit() cannot reopen temp file after edit", -1);
8758 goto edit_func_end;
8759 }
@@ -8763,25 +8763,34 @@
8763 p = sqlite3_malloc64( sz+(bBin==0) );
8764 if( p==0 ){
8765 sqlite3_result_error_nomem(context);
8766 goto edit_func_end;
8767 }
8768 x = fread(p, 1, sz, f);
 
 
 
 
 
8769 fclose(f);
8770 f = 0;
8771 if( x!=sz ){
8772 sqlite3_result_error(context, "could not read back the whole file", -1);
8773 goto edit_func_end;
8774 }
8775 if( bBin ){
8776 sqlite3_result_blob64(context, p, sz, sqlite3_free);
8777 }else{
8778 int i, j;
8779 if( hasCRNL ){
8780 /* If the original contains \r\n then do no conversions back to \n */
8781 j = sz;
8782 }else{
8783 /* If the file did not originally contain \r\n then convert any new
8784 ** \r\n back into \n */
8785 for(i=j=0; i<sz; i++){
8786 if( p[i]=='\r' && p[i+1]=='\n' ) i++;
8787 p[j++] = p[i];
8788 }
8789 sz = j;
8790 p[sz] = 0;
8791 }
8792 sqlite3_result_text64(context, (const char*)p, sz,
8793 sqlite3_free, SQLITE_UTF8);
8794 }
8795 p = 0;
8796
@@ -10128,11 +10137,13 @@
10137 }
10138 }
10139 }
10140 nAlloc += 100;
10141 p->aiIndent = (int*)sqlite3_realloc64(p->aiIndent, nAlloc*sizeof(int));
10142 if( p->aiIndent==0 ) shell_out_of_memory();
10143 abYield = (int*)sqlite3_realloc64(abYield, nAlloc*sizeof(int));
10144 if( abYield==0 ) shell_out_of_memory();
10145 }
10146 abYield[iOp] = str_in_array(zOp, azYield);
10147 p->aiIndent[iOp] = 0;
10148 p->nIndent = iOp+1;
10149
10150
+2205 -2249
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1156,11 +1156,11 @@
11561156
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11571157
** [sqlite_version()] and [sqlite_source_id()].
11581158
*/
11591159
#define SQLITE_VERSION "3.25.0"
11601160
#define SQLITE_VERSION_NUMBER 3025000
1161
-#define SQLITE_SOURCE_ID "2018-07-24 22:02:12 2bd593332da0aade467e7a4ee89e966aa6302f37540a2c5e23671f98a6cb599c"
1161
+#define SQLITE_SOURCE_ID "2018-08-16 16:24:24 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0cfb61"
11621162
11631163
/*
11641164
** CAPI3REF: Run-Time Library Version Numbers
11651165
** KEYWORDS: sqlite3_version sqlite3_sourceid
11661166
**
@@ -10031,11 +10031,11 @@
1003110031
** the following statements are false when sqlite3_snapshot_get() is
1003210032
** called, SQLITE_ERROR is returned. The final value of *P is undefined
1003310033
** in this case.
1003410034
**
1003510035
** <ul>
10036
-** <li> The database handle must be in [autocommit mode].
10036
+** <li> The database handle must not be in [autocommit mode].
1003710037
**
1003810038
** <li> Schema S of [database connection] D must be a [WAL mode] database.
1003910039
**
1004010040
** <li> There must not be a write transaction open on schema S of database
1004110041
** connection D.
@@ -10066,26 +10066,37 @@
1006610066
1006710067
/*
1006810068
** CAPI3REF: Start a read transaction on an historical snapshot
1006910069
** METHOD: sqlite3_snapshot
1007010070
**
10071
-** ^The [sqlite3_snapshot_open(D,S,P)] interface starts a
10072
-** read transaction for schema S of
10073
-** [database connection] D such that the read transaction
10074
-** refers to historical [snapshot] P, rather than the most
10075
-** recent change to the database.
10076
-** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success
10077
-** or an appropriate [error code] if it fails.
10071
+** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read
10072
+** transaction or upgrades an existing one for schema S of
10073
+** [database connection] D such that the read transaction refers to
10074
+** historical [snapshot] P, rather than the most recent change to the
10075
+** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK
10076
+** on success or an appropriate [error code] if it fails.
1007810077
**
10079
-** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be
10080
-** the first operation following the [BEGIN] that takes the schema S
10081
-** out of [autocommit mode].
10082
-** ^In other words, schema S must not currently be in
10083
-** a transaction for [sqlite3_snapshot_open(D,S,P)] to work, but the
10084
-** database connection D must be out of [autocommit mode].
10085
-** ^A [snapshot] will fail to open if it has been overwritten by a
10086
-** [checkpoint].
10078
+** ^In order to succeed, the database connection must not be in
10079
+** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there
10080
+** is already a read transaction open on schema S, then the database handle
10081
+** must have no active statements (SELECT statements that have been passed
10082
+** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()).
10083
+** SQLITE_ERROR is returned if either of these conditions is violated, or
10084
+** if schema S does not exist, or if the snapshot object is invalid.
10085
+**
10086
+** ^A call to sqlite3_snapshot_open() will fail to open if the specified
10087
+** snapshot has been overwritten by a [checkpoint]. In this case
10088
+** SQLITE_BUSY_SNAPSHOT is returned.
10089
+**
10090
+** If there is already a read transaction open when this function is
10091
+** invoked, then the same read transaction remains open (on the same
10092
+** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_BUSY_SNAPSHOT
10093
+** is returned. If another error code - for example SQLITE_PROTOCOL or an
10094
+** SQLITE_IOERR error code - is returned, then the final state of the
10095
+** read transaction is undefined. If SQLITE_OK is returned, then the
10096
+** read transaction is now open on database snapshot P.
10097
+**
1008710098
** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the
1008810099
** database connection D does not know that the database file for
1008910100
** schema S is in [WAL mode]. A database connection might not know
1009010101
** that the database file is in [WAL mode] if there has been no prior
1009110102
** I/O on that database connection, or if the database entered [WAL mode]
@@ -13008,21 +13019,10 @@
1300813019
#endif
1300913020
#if defined(NDEBUG) && defined(SQLITE_DEBUG)
1301013021
# undef NDEBUG
1301113022
#endif
1301213023
13013
-/* SQLITE_DEBUG_COLUMNCACHE is synomous with SQLITE_DEBUG. The
13014
-** SQLITE_DEBUG_COLUMNCACHE symbol only exists to provide a convenient
13015
-** way to search for all code that deals with verifying correct behavior
13016
-** of the column cache.
13017
-*/
13018
-#ifdef SQLITE_DEBUG
13019
-# define SQLITE_DEBUG_COLUMNCACHE 1
13020
-#else
13021
-# undef SQLIT_DEBUG_COLUMNCACHE
13022
-#endif
13023
-
1302413024
/*
1302513025
** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on.
1302613026
*/
1302713027
#if !defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) && defined(SQLITE_DEBUG)
1302813028
# define SQLITE_ENABLE_EXPLAIN_COMMENTS 1
@@ -14720,40 +14720,40 @@
1472014720
#define OP_Ge 57 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
1472114721
#define OP_ElseNotEq 58 /* jump, same as TK_ESCAPE */
1472214722
#define OP_IncrVacuum 59 /* jump */
1472314723
#define OP_VNext 60 /* jump */
1472414724
#define OP_Init 61 /* jump, synopsis: Start at P2 */
14725
-#define OP_Return 62
14726
-#define OP_EndCoroutine 63
14727
-#define OP_HaltIfNull 64 /* synopsis: if r[P3]=null halt */
14728
-#define OP_Halt 65
14729
-#define OP_Integer 66 /* synopsis: r[P2]=P1 */
14730
-#define OP_Int64 67 /* synopsis: r[P2]=P4 */
14731
-#define OP_String 68 /* synopsis: r[P2]='P4' (len=P1) */
14732
-#define OP_Null 69 /* synopsis: r[P2..P3]=NULL */
14733
-#define OP_SoftNull 70 /* synopsis: r[P1]=NULL */
14734
-#define OP_Blob 71 /* synopsis: r[P2]=P4 (len=P1) */
14735
-#define OP_Variable 72 /* synopsis: r[P2]=parameter(P1,P4) */
14736
-#define OP_Move 73 /* synopsis: r[P2@P3]=r[P1@P3] */
14737
-#define OP_Copy 74 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
14738
-#define OP_SCopy 75 /* synopsis: r[P2]=r[P1] */
14739
-#define OP_IntCopy 76 /* synopsis: r[P2]=r[P1] */
14740
-#define OP_ResultRow 77 /* synopsis: output=r[P1@P2] */
14741
-#define OP_CollSeq 78
14742
-#define OP_AddImm 79 /* synopsis: r[P1]=r[P1]+P2 */
14743
-#define OP_RealAffinity 80
14744
-#define OP_Cast 81 /* synopsis: affinity(r[P1]) */
14745
-#define OP_Permutation 82
14746
-#define OP_Compare 83 /* synopsis: r[P1@P3] <-> r[P2@P3] */
14747
-#define OP_IsTrue 84 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
14748
-#define OP_Offset 85 /* synopsis: r[P3] = sqlite_offset(P1) */
14749
-#define OP_Column 86 /* synopsis: r[P3]=PX */
14750
-#define OP_Affinity 87 /* synopsis: affinity(r[P1@P2]) */
14751
-#define OP_MakeRecord 88 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
14752
-#define OP_Count 89 /* synopsis: r[P2]=count() */
14753
-#define OP_ReadCookie 90
14754
-#define OP_SetCookie 91
14725
+#define OP_PureFunc0 62
14726
+#define OP_Function0 63 /* synopsis: r[P3]=func(r[P2@P5]) */
14727
+#define OP_PureFunc 64
14728
+#define OP_Function 65 /* synopsis: r[P3]=func(r[P2@P5]) */
14729
+#define OP_Return 66
14730
+#define OP_EndCoroutine 67
14731
+#define OP_HaltIfNull 68 /* synopsis: if r[P3]=null halt */
14732
+#define OP_Halt 69
14733
+#define OP_Integer 70 /* synopsis: r[P2]=P1 */
14734
+#define OP_Int64 71 /* synopsis: r[P2]=P4 */
14735
+#define OP_String 72 /* synopsis: r[P2]='P4' (len=P1) */
14736
+#define OP_Null 73 /* synopsis: r[P2..P3]=NULL */
14737
+#define OP_SoftNull 74 /* synopsis: r[P1]=NULL */
14738
+#define OP_Blob 75 /* synopsis: r[P2]=P4 (len=P1) */
14739
+#define OP_Variable 76 /* synopsis: r[P2]=parameter(P1,P4) */
14740
+#define OP_Move 77 /* synopsis: r[P2@P3]=r[P1@P3] */
14741
+#define OP_Copy 78 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
14742
+#define OP_SCopy 79 /* synopsis: r[P2]=r[P1] */
14743
+#define OP_IntCopy 80 /* synopsis: r[P2]=r[P1] */
14744
+#define OP_ResultRow 81 /* synopsis: output=r[P1@P2] */
14745
+#define OP_CollSeq 82
14746
+#define OP_AddImm 83 /* synopsis: r[P1]=r[P1]+P2 */
14747
+#define OP_RealAffinity 84
14748
+#define OP_Cast 85 /* synopsis: affinity(r[P1]) */
14749
+#define OP_Permutation 86
14750
+#define OP_Compare 87 /* synopsis: r[P1@P3] <-> r[P2@P3] */
14751
+#define OP_IsTrue 88 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
14752
+#define OP_Offset 89 /* synopsis: r[P3] = sqlite_offset(P1) */
14753
+#define OP_Column 90 /* synopsis: r[P3]=PX */
14754
+#define OP_Affinity 91 /* synopsis: affinity(r[P1@P2]) */
1475514755
#define OP_BitAnd 92 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
1475614756
#define OP_BitOr 93 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
1475714757
#define OP_ShiftLeft 94 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
1475814758
#define OP_ShiftRight 95 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
1475914759
#define OP_Add 96 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
@@ -14760,84 +14760,82 @@
1476014760
#define OP_Subtract 97 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
1476114761
#define OP_Multiply 98 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
1476214762
#define OP_Divide 99 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
1476314763
#define OP_Remainder 100 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
1476414764
#define OP_Concat 101 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
14765
-#define OP_ReopenIdx 102 /* synopsis: root=P2 iDb=P3 */
14765
+#define OP_MakeRecord 102 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
1476614766
#define OP_BitNot 103 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
14767
-#define OP_OpenRead 104 /* synopsis: root=P2 iDb=P3 */
14768
-#define OP_OpenWrite 105 /* synopsis: root=P2 iDb=P3 */
14767
+#define OP_Count 104 /* synopsis: r[P2]=count() */
14768
+#define OP_ReadCookie 105
1476914769
#define OP_String8 106 /* same as TK_STRING, synopsis: r[P2]='P4' */
14770
-#define OP_OpenDup 107
14771
-#define OP_OpenAutoindex 108 /* synopsis: nColumn=P2 */
14772
-#define OP_OpenEphemeral 109 /* synopsis: nColumn=P2 */
14773
-#define OP_SorterOpen 110
14774
-#define OP_SequenceTest 111 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
14775
-#define OP_OpenPseudo 112 /* synopsis: P3 columns in r[P2] */
14776
-#define OP_Close 113
14777
-#define OP_ColumnsUsed 114
14778
-#define OP_SeekHit 115 /* synopsis: seekHit=P2 */
14779
-#define OP_Sequence 116 /* synopsis: r[P2]=cursor[P1].ctr++ */
14780
-#define OP_NewRowid 117 /* synopsis: r[P2]=rowid */
14781
-#define OP_Insert 118 /* synopsis: intkey=r[P3] data=r[P2] */
14782
-#define OP_InsertInt 119 /* synopsis: intkey=P3 data=r[P2] */
14783
-#define OP_Delete 120
14784
-#define OP_ResetCount 121
14785
-#define OP_SorterCompare 122 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
14786
-#define OP_SorterData 123 /* synopsis: r[P2]=data */
14787
-#define OP_RowData 124 /* synopsis: r[P2]=data */
14788
-#define OP_Rowid 125 /* synopsis: r[P2]=rowid */
14789
-#define OP_NullRow 126
14790
-#define OP_SeekEnd 127
14791
-#define OP_SorterInsert 128 /* synopsis: key=r[P2] */
14792
-#define OP_IdxInsert 129 /* synopsis: key=r[P2] */
14793
-#define OP_IdxDelete 130 /* synopsis: key=r[P2@P3] */
14794
-#define OP_DeferredSeek 131 /* synopsis: Move P3 to P1.rowid if needed */
14795
-#define OP_IdxRowid 132 /* synopsis: r[P2]=rowid */
14796
-#define OP_Destroy 133
14797
-#define OP_Clear 134
14798
-#define OP_ResetSorter 135
14799
-#define OP_CreateBtree 136 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
14800
-#define OP_SqlExec 137
14801
-#define OP_ParseSchema 138
14802
-#define OP_LoadAnalysis 139
14803
-#define OP_DropTable 140
14770
+#define OP_SetCookie 107
14771
+#define OP_ReopenIdx 108 /* synopsis: root=P2 iDb=P3 */
14772
+#define OP_OpenRead 109 /* synopsis: root=P2 iDb=P3 */
14773
+#define OP_OpenWrite 110 /* synopsis: root=P2 iDb=P3 */
14774
+#define OP_OpenDup 111
14775
+#define OP_OpenAutoindex 112 /* synopsis: nColumn=P2 */
14776
+#define OP_OpenEphemeral 113 /* synopsis: nColumn=P2 */
14777
+#define OP_SorterOpen 114
14778
+#define OP_SequenceTest 115 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
14779
+#define OP_OpenPseudo 116 /* synopsis: P3 columns in r[P2] */
14780
+#define OP_Close 117
14781
+#define OP_ColumnsUsed 118
14782
+#define OP_SeekHit 119 /* synopsis: seekHit=P2 */
14783
+#define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */
14784
+#define OP_NewRowid 121 /* synopsis: r[P2]=rowid */
14785
+#define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */
14786
+#define OP_InsertInt 123 /* synopsis: intkey=P3 data=r[P2] */
14787
+#define OP_Delete 124
14788
+#define OP_ResetCount 125
14789
+#define OP_SorterCompare 126 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
14790
+#define OP_SorterData 127 /* synopsis: r[P2]=data */
14791
+#define OP_RowData 128 /* synopsis: r[P2]=data */
14792
+#define OP_Rowid 129 /* synopsis: r[P2]=rowid */
14793
+#define OP_NullRow 130
14794
+#define OP_SeekEnd 131
14795
+#define OP_SorterInsert 132 /* synopsis: key=r[P2] */
14796
+#define OP_IdxInsert 133 /* synopsis: key=r[P2] */
14797
+#define OP_IdxDelete 134 /* synopsis: key=r[P2@P3] */
14798
+#define OP_DeferredSeek 135 /* synopsis: Move P3 to P1.rowid if needed */
14799
+#define OP_IdxRowid 136 /* synopsis: r[P2]=rowid */
14800
+#define OP_Destroy 137
14801
+#define OP_Clear 138
14802
+#define OP_ResetSorter 139
14803
+#define OP_CreateBtree 140 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
1480414804
#define OP_Real 141 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
14805
-#define OP_DropIndex 142
14806
-#define OP_DropTrigger 143
14807
-#define OP_IntegrityCk 144
14808
-#define OP_RowSetAdd 145 /* synopsis: rowset(P1)=r[P2] */
14809
-#define OP_Param 146
14810
-#define OP_FkCounter 147 /* synopsis: fkctr[P1]+=P2 */
14811
-#define OP_MemMax 148 /* synopsis: r[P1]=max(r[P1],r[P2]) */
14812
-#define OP_OffsetLimit 149 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
14813
-#define OP_AggInverse 150 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
14814
-#define OP_AggStep 151 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14815
-#define OP_AggStep1 152 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14816
-#define OP_AggValue 153 /* synopsis: r[P3]=value N=P2 */
14817
-#define OP_AggFinal 154 /* synopsis: accum=r[P1] N=P2 */
14818
-#define OP_Expire 155
14819
-#define OP_TableLock 156 /* synopsis: iDb=P1 root=P2 write=P3 */
14820
-#define OP_VBegin 157
14821
-#define OP_VCreate 158
14822
-#define OP_VDestroy 159
14823
-#define OP_VOpen 160
14824
-#define OP_VColumn 161 /* synopsis: r[P3]=vcolumn(P2) */
14825
-#define OP_VRename 162
14826
-#define OP_Pagecount 163
14827
-#define OP_MaxPgcnt 164
14828
-#define OP_PureFunc0 165
14829
-#define OP_Function0 166 /* synopsis: r[P3]=func(r[P2@P5]) */
14830
-#define OP_PureFunc 167
14831
-#define OP_Function 168 /* synopsis: r[P3]=func(r[P2@P5]) */
14805
+#define OP_SqlExec 142
14806
+#define OP_ParseSchema 143
14807
+#define OP_LoadAnalysis 144
14808
+#define OP_DropTable 145
14809
+#define OP_DropIndex 146
14810
+#define OP_DropTrigger 147
14811
+#define OP_IntegrityCk 148
14812
+#define OP_RowSetAdd 149 /* synopsis: rowset(P1)=r[P2] */
14813
+#define OP_Param 150
14814
+#define OP_FkCounter 151 /* synopsis: fkctr[P1]+=P2 */
14815
+#define OP_MemMax 152 /* synopsis: r[P1]=max(r[P1],r[P2]) */
14816
+#define OP_OffsetLimit 153 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
14817
+#define OP_AggInverse 154 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
14818
+#define OP_AggStep 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14819
+#define OP_AggStep1 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14820
+#define OP_AggValue 157 /* synopsis: r[P3]=value N=P2 */
14821
+#define OP_AggFinal 158 /* synopsis: accum=r[P1] N=P2 */
14822
+#define OP_Expire 159
14823
+#define OP_TableLock 160 /* synopsis: iDb=P1 root=P2 write=P3 */
14824
+#define OP_VBegin 161
14825
+#define OP_VCreate 162
14826
+#define OP_VDestroy 163
14827
+#define OP_VOpen 164
14828
+#define OP_VColumn 165 /* synopsis: r[P3]=vcolumn(P2) */
14829
+#define OP_VRename 166
14830
+#define OP_Pagecount 167
14831
+#define OP_MaxPgcnt 168
1483214832
#define OP_Trace 169
1483314833
#define OP_CursorHint 170
14834
-#define OP_SetTabCol 171
14835
-#define OP_VerifyTabCol 172
14836
-#define OP_Noop 173
14837
-#define OP_Explain 174
14838
-#define OP_Abortable 175
14834
+#define OP_Noop 171
14835
+#define OP_Explain 172
14836
+#define OP_Abortable 173
1483914837
1484014838
/* Properties such as "out2" or "jump" that are specified in
1484114839
** comments following the "case" for each opcode in the vdbe.c
1484214840
** are encoded into bitvectors as follows:
1484314841
*/
@@ -14853,26 +14851,25 @@
1485314851
/* 16 */ 0x01, 0x01, 0x03, 0x12, 0x03, 0x01, 0x09, 0x09,\
1485414852
/* 24 */ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,\
1485514853
/* 32 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
1485614854
/* 40 */ 0x01, 0x23, 0x0b, 0x26, 0x26, 0x01, 0x01, 0x03,\
1485714855
/* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
14858
-/* 56 */ 0x0b, 0x0b, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,\
14859
-/* 64 */ 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10,\
14860
-/* 72 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x02,\
14861
-/* 80 */ 0x02, 0x02, 0x00, 0x00, 0x12, 0x20, 0x00, 0x00,\
14862
-/* 88 */ 0x00, 0x10, 0x10, 0x00, 0x26, 0x26, 0x26, 0x26,\
14856
+/* 56 */ 0x0b, 0x0b, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,\
14857
+/* 64 */ 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10,\
14858
+/* 72 */ 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10,\
14859
+/* 80 */ 0x10, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\
14860
+/* 88 */ 0x12, 0x20, 0x00, 0x00, 0x26, 0x26, 0x26, 0x26,\
1486314861
/* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\
14864
-/* 104 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
14865
-/* 112 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
14866
-/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\
14867
-/* 128 */ 0x04, 0x04, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
14868
-/* 136 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\
14869
-/* 144 */ 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00,\
14870
-/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14871
-/* 160 */ 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\
14872
-/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14873
-}
14862
+/* 104 */ 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
14863
+/* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14864
+/* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14865
+/* 128 */ 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,\
14866
+/* 136 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
14867
+/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\
14868
+/* 152 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14869
+/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
14870
+/* 168 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,}
1487414871
1487514872
/* The sqlite3P2Values() routine is able to run faster if it knows
1487614873
** the value of the largest JUMP opcode. The smaller the maximum
1487714874
** JUMP opcode the better, so the mkopcodeh.tcl script that
1487814875
** generated this include file strives to group all JUMP opcodes
@@ -14950,13 +14947,10 @@
1495014947
SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*);
1495114948
SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*);
1495214949
SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*);
1495314950
SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*);
1495414951
SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int);
14955
-#ifdef SQLITE_COVERAGE_TEST
14956
-SQLITE_PRIVATE int sqlite3VdbeLabelHasBeenResolved(Vdbe*,int);
14957
-#endif
1495814952
SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*);
1495914953
#ifdef SQLITE_DEBUG
1496014954
SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int);
1496114955
#endif
1496214956
SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*);
@@ -15283,10 +15277,12 @@
1528315277
# endif
1528415278
# ifdef SQLITE_ENABLE_SNAPSHOT
1528515279
SQLITE_PRIVATE int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot);
1528615280
SQLITE_PRIVATE int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot);
1528715281
SQLITE_PRIVATE int sqlite3PagerSnapshotRecover(Pager *pPager);
15282
+SQLITE_PRIVATE int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot);
15283
+SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager);
1528815284
# endif
1528915285
#else
1529015286
# define sqlite3PagerUseWal(x,y) 0
1529115287
#endif
1529215288
@@ -16290,11 +16286,11 @@
1629016286
** Bits of the sqlite3.dbOptFlags field that are used by the
1629116287
** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
1629216288
** selectively disable various optimizations.
1629316289
*/
1629416290
#define SQLITE_QueryFlattener 0x0001 /* Query flattening */
16295
-#define SQLITE_ColumnCache 0x0002 /* Column cache */
16291
+ /* 0x0002 available for reuse */
1629616292
#define SQLITE_GroupByOrder 0x0004 /* GROUPBY cover of ORDERBY */
1629716293
#define SQLITE_FactorOutConst 0x0008 /* Constant factoring */
1629816294
#define SQLITE_DistinctOpt 0x0010 /* DISTINCT using indexes */
1629916295
#define SQLITE_CoverIdxScan 0x0020 /* Covering index scans */
1630016296
#define SQLITE_OrderByIdxJoin 0x0040 /* ORDER BY of joins via index */
@@ -16305,10 +16301,11 @@
1630516301
#define SQLITE_Stat34 0x0800 /* Use STAT3 or STAT4 data */
1630616302
/* TH3 expects the Stat34 ^^^^^^ value to be 0x0800. Don't change it */
1630716303
#define SQLITE_PushDown 0x1000 /* The push-down optimization */
1630816304
#define SQLITE_SimplifyJoin 0x2000 /* Convert LEFT JOIN to JOIN */
1630916305
#define SQLITE_SkipScan 0x4000 /* Skip-scans */
16306
+#define SQLITE_PropagateConst 0x8000 /* The constant propagation opt */
1631016307
#define SQLITE_AllOpts 0xffff /* All optimizations */
1631116308
1631216309
/*
1631316310
** Macros for testing whether or not optimizations are enabled or disabled.
1631416311
*/
@@ -17199,11 +17196,11 @@
1719917196
** The following are the meanings of bits in the Expr.flags field.
1720017197
*/
1720117198
#define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
1720217199
#define EP_Agg 0x000002 /* Contains one or more aggregate functions */
1720317200
#define EP_HasFunc 0x000004 /* Contains one or more functions of any kind */
17204
- /* 0x000008 // available for use */
17201
+#define EP_FixedCol 0x000008 /* TK_Column with a known fixed value */
1720517202
#define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */
1720617203
#define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
1720717204
#define EP_DblQuoted 0x000040 /* token.z was originally in "..." */
1720817205
#define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */
1720917206
#define EP_Collate 0x000100 /* Tree contains a TK_COLLATE operator */
@@ -17688,17 +17685,10 @@
1768817685
Table *pTab; /* Table this info block refers to */
1768917686
int iDb; /* Index in sqlite3.aDb[] of database holding pTab */
1769017687
int regCtr; /* Memory register holding the rowid counter */
1769117688
};
1769217689
17693
-/*
17694
-** Size of the column cache
17695
-*/
17696
-#ifndef SQLITE_N_COLCACHE
17697
-# define SQLITE_N_COLCACHE 10
17698
-#endif
17699
-
1770017690
/*
1770117691
** At least one instance of the following structure is created for each
1770217692
** trigger that may be fired while parsing an INSERT, UPDATE or DELETE
1770317693
** statement. All such objects are stored in the linked list headed at
1770417694
** Parse.pTriggerPrg and deleted once statement compilation has been
@@ -17770,22 +17760,19 @@
1777017760
u8 isMultiWrite; /* True if statement may modify/insert multiple rows */
1777117761
u8 mayAbort; /* True if statement may throw an ABORT exception */
1777217762
u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
1777317763
u8 okConstFactor; /* OK to factor out constants */
1777417764
u8 disableLookaside; /* Number of times lookaside has been disabled */
17775
- u8 nColCache; /* Number of entries in aColCache[] */
1777617765
int nRangeReg; /* Size of the temporary register block */
1777717766
int iRangeReg; /* First register in temporary register block */
1777817767
int nErr; /* Number of errors seen */
1777917768
int nTab; /* Number of previously allocated VDBE cursors */
1778017769
int nMem; /* Number of memory cells used so far */
1778117770
int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
1778217771
int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
1778317772
int iSelfTab; /* Table associated with an index on expr, or negative
1778417773
** of the base register during check-constraint eval */
17785
- int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
17786
- int iCacheCnt; /* Counter used to generate aColCache[].lru values */
1778717774
int nLabel; /* Number of labels used */
1778817775
int *aLabel; /* Space to hold the labels */
1778917776
ExprList *pConstExpr;/* Constant expressions */
1779017777
Token constraintName;/* Name of the constraint currently being parsed */
1779117778
yDbMask writeMask; /* Start a write transaction on these databases */
@@ -17811,21 +17798,13 @@
1781117798
1781217799
/**************************************************************************
1781317800
** Fields above must be initialized to zero. The fields that follow,
1781417801
** down to the beginning of the recursive section, do not need to be
1781517802
** initialized as they will be set before being used. The boundary is
17816
- ** determined by offsetof(Parse,aColCache).
17803
+ ** determined by offsetof(Parse,aTempReg).
1781717804
**************************************************************************/
1781817805
17819
- struct yColCache {
17820
- int iTable; /* Table cursor number */
17821
- i16 iColumn; /* Table column number */
17822
- u8 tempReg; /* iReg is a temp register that needs to be freed */
17823
- int iLevel; /* Nesting level */
17824
- int iReg; /* Reg with value of this column. 0 means none. */
17825
- int lru; /* Least recently used entry has the smallest value */
17826
- } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */
1782717806
int aTempReg[8]; /* Holding area for temporary registers */
1782817807
Token sNameToken; /* Token with unqualified schema object name */
1782917808
1783017809
/************************************************************************
1783117810
** Above is constant between recursions. Below is reset before and after
@@ -17863,11 +17842,11 @@
1786317842
};
1786417843
1786517844
/*
1786617845
** Sizes and pointers of various parts of the Parse object.
1786717846
*/
17868
-#define PARSE_HDR_SZ offsetof(Parse,aColCache) /* Recursive part w/o aColCache*/
17847
+#define PARSE_HDR_SZ offsetof(Parse,aTempReg) /* Recursive part w/o aColCache*/
1786917848
#define PARSE_RECURSE_SZ offsetof(Parse,sLastToken) /* Recursive part */
1787017849
#define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */
1787117850
#define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */
1787217851
1787317852
/*
@@ -18157,10 +18136,11 @@
1815718136
struct IdxCover *pIdxCover; /* Check for index coverage */
1815818137
struct IdxExprTrans *pIdxTrans; /* Convert idxed expr to column */
1815918138
ExprList *pGroupBy; /* GROUP BY clause */
1816018139
Select *pSelect; /* HAVING to WHERE clause ctx */
1816118140
struct WindowRewrite *pRewrite; /* Window rewrite context */
18141
+ struct WhereConst *pConst; /* WHERE clause constants */
1816218142
} u;
1816318143
};
1816418144
1816518145
/* Forward declarations */
1816618146
SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*);
@@ -18511,11 +18491,11 @@
1851118491
SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
1851218492
SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
1851318493
SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
1851418494
SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
1851518495
SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);
18516
-SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*);
18496
+SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int);
1851718497
SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
1851818498
SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*);
1851918499
SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
1852018500
SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
1852118501
SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int);
@@ -18646,19 +18626,12 @@
1864618626
#define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */
1864718627
#define ONEPASS_SINGLE 1 /* ONEPASS valid for a single row update */
1864818628
#define ONEPASS_MULTI 2 /* ONEPASS is valid for multiple rows */
1864918629
SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(Parse*, Index*, int, int, int);
1865018630
SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8);
18651
-SQLITE_PRIVATE void sqlite3ExprCodeGetColumnToReg(Parse*, Table*, int, int, int);
1865218631
SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int);
1865318632
SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int);
18654
-SQLITE_PRIVATE void sqlite3ExprCacheStore(Parse*, int, int, int);
18655
-SQLITE_PRIVATE void sqlite3ExprCachePush(Parse*);
18656
-SQLITE_PRIVATE void sqlite3ExprCachePop(Parse*);
18657
-SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse*, int, int);
18658
-SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse*);
18659
-SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse*, int, int);
1866018633
SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int);
1866118634
SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int);
1866218635
SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int);
1866318636
SQLITE_PRIVATE int sqlite3ExprCodeAtInit(Parse*, Expr*, int);
1866418637
SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
@@ -18890,10 +18863,11 @@
1889018863
#endif
1889118864
1889218865
SQLITE_PRIVATE const char *sqlite3ErrStr(int);
1889318866
SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse);
1889418867
SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int);
18868
+SQLITE_PRIVATE int sqlite3IsBinary(const CollSeq*);
1889518869
SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName);
1889618870
SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr);
1889718871
SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr);
1889818872
SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse*,Expr*,Expr*);
1889918873
SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int);
@@ -19853,14 +19827,10 @@
1985319827
void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */
1985419828
#ifdef SQLITE_DEBUG
1985519829
Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */
1985619830
u16 mScopyFlags; /* flags value immediately after the shallow copy */
1985719831
#endif
19858
-#ifdef SQLITE_DEBUG_COLUMNCACHE
19859
- u32 iTabColHash; /* Hash of table.column that is origin of this value */
19860
- u32 iPadding; /* sqlite3_value objects must be 8-byte aligned */
19861
-#endif
1986219832
};
1986319833
1986419834
/*
1986519835
** Size of struct Mem not including the Mem.zMalloc member or anything that
1986619836
** follows.
@@ -28513,10 +28483,13 @@
2851328483
sqlite3TreeViewLine(pView, "COLUMN(%d)%s", pExpr->iColumn, zFlgs);
2851428484
}else{
2851528485
sqlite3TreeViewLine(pView, "{%d:%d}%s",
2851628486
pExpr->iTable, pExpr->iColumn, zFlgs);
2851728487
}
28488
+ if( ExprHasProperty(pExpr, EP_FixedCol) ){
28489
+ sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
28490
+ }
2851828491
break;
2851928492
}
2852028493
case TK_INTEGER: {
2852128494
if( pExpr->flags & EP_IntValue ){
2852228495
sqlite3TreeViewLine(pView, "%d", pExpr->u.iValue);
@@ -31741,40 +31714,40 @@
3174131714
/* 57 */ "Ge" OpHelp("IF r[P3]>=r[P1]"),
3174231715
/* 58 */ "ElseNotEq" OpHelp(""),
3174331716
/* 59 */ "IncrVacuum" OpHelp(""),
3174431717
/* 60 */ "VNext" OpHelp(""),
3174531718
/* 61 */ "Init" OpHelp("Start at P2"),
31746
- /* 62 */ "Return" OpHelp(""),
31747
- /* 63 */ "EndCoroutine" OpHelp(""),
31748
- /* 64 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
31749
- /* 65 */ "Halt" OpHelp(""),
31750
- /* 66 */ "Integer" OpHelp("r[P2]=P1"),
31751
- /* 67 */ "Int64" OpHelp("r[P2]=P4"),
31752
- /* 68 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
31753
- /* 69 */ "Null" OpHelp("r[P2..P3]=NULL"),
31754
- /* 70 */ "SoftNull" OpHelp("r[P1]=NULL"),
31755
- /* 71 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
31756
- /* 72 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
31757
- /* 73 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
31758
- /* 74 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
31759
- /* 75 */ "SCopy" OpHelp("r[P2]=r[P1]"),
31760
- /* 76 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
31761
- /* 77 */ "ResultRow" OpHelp("output=r[P1@P2]"),
31762
- /* 78 */ "CollSeq" OpHelp(""),
31763
- /* 79 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
31764
- /* 80 */ "RealAffinity" OpHelp(""),
31765
- /* 81 */ "Cast" OpHelp("affinity(r[P1])"),
31766
- /* 82 */ "Permutation" OpHelp(""),
31767
- /* 83 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
31768
- /* 84 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
31769
- /* 85 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
31770
- /* 86 */ "Column" OpHelp("r[P3]=PX"),
31771
- /* 87 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
31772
- /* 88 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
31773
- /* 89 */ "Count" OpHelp("r[P2]=count()"),
31774
- /* 90 */ "ReadCookie" OpHelp(""),
31775
- /* 91 */ "SetCookie" OpHelp(""),
31719
+ /* 62 */ "PureFunc0" OpHelp(""),
31720
+ /* 63 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"),
31721
+ /* 64 */ "PureFunc" OpHelp(""),
31722
+ /* 65 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"),
31723
+ /* 66 */ "Return" OpHelp(""),
31724
+ /* 67 */ "EndCoroutine" OpHelp(""),
31725
+ /* 68 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
31726
+ /* 69 */ "Halt" OpHelp(""),
31727
+ /* 70 */ "Integer" OpHelp("r[P2]=P1"),
31728
+ /* 71 */ "Int64" OpHelp("r[P2]=P4"),
31729
+ /* 72 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
31730
+ /* 73 */ "Null" OpHelp("r[P2..P3]=NULL"),
31731
+ /* 74 */ "SoftNull" OpHelp("r[P1]=NULL"),
31732
+ /* 75 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
31733
+ /* 76 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
31734
+ /* 77 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
31735
+ /* 78 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
31736
+ /* 79 */ "SCopy" OpHelp("r[P2]=r[P1]"),
31737
+ /* 80 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
31738
+ /* 81 */ "ResultRow" OpHelp("output=r[P1@P2]"),
31739
+ /* 82 */ "CollSeq" OpHelp(""),
31740
+ /* 83 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
31741
+ /* 84 */ "RealAffinity" OpHelp(""),
31742
+ /* 85 */ "Cast" OpHelp("affinity(r[P1])"),
31743
+ /* 86 */ "Permutation" OpHelp(""),
31744
+ /* 87 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
31745
+ /* 88 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
31746
+ /* 89 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
31747
+ /* 90 */ "Column" OpHelp("r[P3]=PX"),
31748
+ /* 91 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
3177631749
/* 92 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
3177731750
/* 93 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
3177831751
/* 94 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
3177931752
/* 95 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
3178031753
/* 96 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
@@ -31781,84 +31754,82 @@
3178131754
/* 97 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
3178231755
/* 98 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
3178331756
/* 99 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
3178431757
/* 100 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
3178531758
/* 101 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
31786
- /* 102 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
31759
+ /* 102 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
3178731760
/* 103 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
31788
- /* 104 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
31789
- /* 105 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
31761
+ /* 104 */ "Count" OpHelp("r[P2]=count()"),
31762
+ /* 105 */ "ReadCookie" OpHelp(""),
3179031763
/* 106 */ "String8" OpHelp("r[P2]='P4'"),
31791
- /* 107 */ "OpenDup" OpHelp(""),
31792
- /* 108 */ "OpenAutoindex" OpHelp("nColumn=P2"),
31793
- /* 109 */ "OpenEphemeral" OpHelp("nColumn=P2"),
31794
- /* 110 */ "SorterOpen" OpHelp(""),
31795
- /* 111 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
31796
- /* 112 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
31797
- /* 113 */ "Close" OpHelp(""),
31798
- /* 114 */ "ColumnsUsed" OpHelp(""),
31799
- /* 115 */ "SeekHit" OpHelp("seekHit=P2"),
31800
- /* 116 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
31801
- /* 117 */ "NewRowid" OpHelp("r[P2]=rowid"),
31802
- /* 118 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
31803
- /* 119 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
31804
- /* 120 */ "Delete" OpHelp(""),
31805
- /* 121 */ "ResetCount" OpHelp(""),
31806
- /* 122 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
31807
- /* 123 */ "SorterData" OpHelp("r[P2]=data"),
31808
- /* 124 */ "RowData" OpHelp("r[P2]=data"),
31809
- /* 125 */ "Rowid" OpHelp("r[P2]=rowid"),
31810
- /* 126 */ "NullRow" OpHelp(""),
31811
- /* 127 */ "SeekEnd" OpHelp(""),
31812
- /* 128 */ "SorterInsert" OpHelp("key=r[P2]"),
31813
- /* 129 */ "IdxInsert" OpHelp("key=r[P2]"),
31814
- /* 130 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
31815
- /* 131 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
31816
- /* 132 */ "IdxRowid" OpHelp("r[P2]=rowid"),
31817
- /* 133 */ "Destroy" OpHelp(""),
31818
- /* 134 */ "Clear" OpHelp(""),
31819
- /* 135 */ "ResetSorter" OpHelp(""),
31820
- /* 136 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
31821
- /* 137 */ "SqlExec" OpHelp(""),
31822
- /* 138 */ "ParseSchema" OpHelp(""),
31823
- /* 139 */ "LoadAnalysis" OpHelp(""),
31824
- /* 140 */ "DropTable" OpHelp(""),
31764
+ /* 107 */ "SetCookie" OpHelp(""),
31765
+ /* 108 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
31766
+ /* 109 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
31767
+ /* 110 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
31768
+ /* 111 */ "OpenDup" OpHelp(""),
31769
+ /* 112 */ "OpenAutoindex" OpHelp("nColumn=P2"),
31770
+ /* 113 */ "OpenEphemeral" OpHelp("nColumn=P2"),
31771
+ /* 114 */ "SorterOpen" OpHelp(""),
31772
+ /* 115 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
31773
+ /* 116 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
31774
+ /* 117 */ "Close" OpHelp(""),
31775
+ /* 118 */ "ColumnsUsed" OpHelp(""),
31776
+ /* 119 */ "SeekHit" OpHelp("seekHit=P2"),
31777
+ /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
31778
+ /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"),
31779
+ /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
31780
+ /* 123 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
31781
+ /* 124 */ "Delete" OpHelp(""),
31782
+ /* 125 */ "ResetCount" OpHelp(""),
31783
+ /* 126 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
31784
+ /* 127 */ "SorterData" OpHelp("r[P2]=data"),
31785
+ /* 128 */ "RowData" OpHelp("r[P2]=data"),
31786
+ /* 129 */ "Rowid" OpHelp("r[P2]=rowid"),
31787
+ /* 130 */ "NullRow" OpHelp(""),
31788
+ /* 131 */ "SeekEnd" OpHelp(""),
31789
+ /* 132 */ "SorterInsert" OpHelp("key=r[P2]"),
31790
+ /* 133 */ "IdxInsert" OpHelp("key=r[P2]"),
31791
+ /* 134 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
31792
+ /* 135 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
31793
+ /* 136 */ "IdxRowid" OpHelp("r[P2]=rowid"),
31794
+ /* 137 */ "Destroy" OpHelp(""),
31795
+ /* 138 */ "Clear" OpHelp(""),
31796
+ /* 139 */ "ResetSorter" OpHelp(""),
31797
+ /* 140 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
3182531798
/* 141 */ "Real" OpHelp("r[P2]=P4"),
31826
- /* 142 */ "DropIndex" OpHelp(""),
31827
- /* 143 */ "DropTrigger" OpHelp(""),
31828
- /* 144 */ "IntegrityCk" OpHelp(""),
31829
- /* 145 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
31830
- /* 146 */ "Param" OpHelp(""),
31831
- /* 147 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
31832
- /* 148 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
31833
- /* 149 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
31834
- /* 150 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
31835
- /* 151 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
31836
- /* 152 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
31837
- /* 153 */ "AggValue" OpHelp("r[P3]=value N=P2"),
31838
- /* 154 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
31839
- /* 155 */ "Expire" OpHelp(""),
31840
- /* 156 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
31841
- /* 157 */ "VBegin" OpHelp(""),
31842
- /* 158 */ "VCreate" OpHelp(""),
31843
- /* 159 */ "VDestroy" OpHelp(""),
31844
- /* 160 */ "VOpen" OpHelp(""),
31845
- /* 161 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
31846
- /* 162 */ "VRename" OpHelp(""),
31847
- /* 163 */ "Pagecount" OpHelp(""),
31848
- /* 164 */ "MaxPgcnt" OpHelp(""),
31849
- /* 165 */ "PureFunc0" OpHelp(""),
31850
- /* 166 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"),
31851
- /* 167 */ "PureFunc" OpHelp(""),
31852
- /* 168 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"),
31799
+ /* 142 */ "SqlExec" OpHelp(""),
31800
+ /* 143 */ "ParseSchema" OpHelp(""),
31801
+ /* 144 */ "LoadAnalysis" OpHelp(""),
31802
+ /* 145 */ "DropTable" OpHelp(""),
31803
+ /* 146 */ "DropIndex" OpHelp(""),
31804
+ /* 147 */ "DropTrigger" OpHelp(""),
31805
+ /* 148 */ "IntegrityCk" OpHelp(""),
31806
+ /* 149 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
31807
+ /* 150 */ "Param" OpHelp(""),
31808
+ /* 151 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
31809
+ /* 152 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
31810
+ /* 153 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
31811
+ /* 154 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
31812
+ /* 155 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
31813
+ /* 156 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
31814
+ /* 157 */ "AggValue" OpHelp("r[P3]=value N=P2"),
31815
+ /* 158 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
31816
+ /* 159 */ "Expire" OpHelp(""),
31817
+ /* 160 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
31818
+ /* 161 */ "VBegin" OpHelp(""),
31819
+ /* 162 */ "VCreate" OpHelp(""),
31820
+ /* 163 */ "VDestroy" OpHelp(""),
31821
+ /* 164 */ "VOpen" OpHelp(""),
31822
+ /* 165 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
31823
+ /* 166 */ "VRename" OpHelp(""),
31824
+ /* 167 */ "Pagecount" OpHelp(""),
31825
+ /* 168 */ "MaxPgcnt" OpHelp(""),
3185331826
/* 169 */ "Trace" OpHelp(""),
3185431827
/* 170 */ "CursorHint" OpHelp(""),
31855
- /* 171 */ "SetTabCol" OpHelp(""),
31856
- /* 172 */ "VerifyTabCol" OpHelp(""),
31857
- /* 173 */ "Noop" OpHelp(""),
31858
- /* 174 */ "Explain" OpHelp(""),
31859
- /* 175 */ "Abortable" OpHelp(""),
31828
+ /* 171 */ "Noop" OpHelp(""),
31829
+ /* 172 */ "Explain" OpHelp(""),
31830
+ /* 173 */ "Abortable" OpHelp(""),
3186031831
};
3186131832
return azName[i];
3186231833
}
3186331834
#endif
3186431835
@@ -32764,16 +32735,29 @@
3276432735
** statements. e.g.
3276532736
**
3276632737
** unixEnterMutex()
3276732738
** assert( unixMutexHeld() );
3276832739
** unixEnterLeave()
32740
+**
32741
+** To prevent deadlock, the global unixBigLock must must be acquired
32742
+** before the unixInodeInfo.pLockMutex mutex, if both are held. It is
32743
+** OK to get the pLockMutex without holding unixBigLock first, but if
32744
+** that happens, the unixBigLock mutex must not be acquired until after
32745
+** pLockMutex is released.
32746
+**
32747
+** OK: enter(unixBigLock), enter(pLockInfo)
32748
+** OK: enter(unixBigLock)
32749
+** OK: enter(pLockInfo)
32750
+** ERROR: enter(pLockInfo), enter(unixBigLock)
3276932751
*/
3277032752
static sqlite3_mutex *unixBigLock = 0;
3277132753
static void unixEnterMutex(void){
32754
+ assert( sqlite3_mutex_notheld(unixBigLock) ); /* Not a recursive mutex */
3277232755
sqlite3_mutex_enter(unixBigLock);
3277332756
}
3277432757
static void unixLeaveMutex(void){
32758
+ assert( sqlite3_mutex_held(unixBigLock) );
3277532759
sqlite3_mutex_leave(unixBigLock);
3277632760
}
3277732761
#ifdef SQLITE_DEBUG
3277832762
static int unixMutexHeld(void) {
3277932763
return sqlite3_mutex_held(unixBigLock);
@@ -33170,20 +33154,38 @@
3317033154
** each inode opened by each thread.
3317133155
**
3317233156
** A single inode can have multiple file descriptors, so each unixFile
3317333157
** structure contains a pointer to an instance of this object and this
3317433158
** object keeps a count of the number of unixFile pointing to it.
33159
+**
33160
+** Mutex rules:
33161
+**
33162
+** (1) Only the pLockMutex mutex must be held in order to read or write
33163
+** any of the locking fields:
33164
+** nShared, nLock, eFileLock, bProcessLock, pUnused
33165
+**
33166
+** (2) When nRef>0, then the following fields are unchanging and can
33167
+** be read (but not written) without holding any mutex:
33168
+** fileId, pLockMutex
33169
+**
33170
+** (3) With the exceptions above, all the fields may only be read
33171
+** or written while holding the global unixBigLock mutex.
33172
+**
33173
+** Deadlock prevention: The global unixBigLock mutex may not
33174
+** be acquired while holding the pLockMutex mutex. If both unixBigLock
33175
+** and pLockMutex are needed, then unixBigLock must be acquired first.
3317533176
*/
3317633177
struct unixInodeInfo {
3317733178
struct unixFileId fileId; /* The lookup key */
33178
- int nShared; /* Number of SHARED locks held */
33179
- unsigned char eFileLock; /* One of SHARED_LOCK, RESERVED_LOCK etc. */
33180
- unsigned char bProcessLock; /* An exclusive process lock is held */
33179
+ sqlite3_mutex *pLockMutex; /* Hold this mutex for... */
33180
+ int nShared; /* Number of SHARED locks held */
33181
+ int nLock; /* Number of outstanding file locks */
33182
+ unsigned char eFileLock; /* One of SHARED_LOCK, RESERVED_LOCK etc. */
33183
+ unsigned char bProcessLock; /* An exclusive process lock is held */
33184
+ UnixUnusedFd *pUnused; /* Unused file descriptors to close */
3318133185
int nRef; /* Number of pointers to this structure */
3318233186
unixShmNode *pShmNode; /* Shared memory associated with this inode */
33183
- int nLock; /* Number of outstanding file locks */
33184
- UnixUnusedFd *pUnused; /* Unused file descriptors to close */
3318533187
unixInodeInfo *pNext; /* List of all unixInodeInfo objects */
3318633188
unixInodeInfo *pPrev; /* .... doubly linked */
3318733189
#if SQLITE_ENABLE_LOCKING_STYLE
3318833190
unsigned long long sharedByte; /* for AFP simulated shared lock */
3318933191
#endif
@@ -33195,11 +33197,25 @@
3319533197
3319633198
/*
3319733199
** A lists of all unixInodeInfo objects.
3319833200
*/
3319933201
static unixInodeInfo *inodeList = 0; /* All unixInodeInfo objects */
33200
-static unsigned int nUnusedFd = 0; /* Total unused file descriptors */
33202
+
33203
+#ifdef SQLITE_DEBUG
33204
+/*
33205
+** True if the inode mutex is held, or not. Used only within assert()
33206
+** to help verify correct mutex usage.
33207
+*/
33208
+int unixFileMutexHeld(unixFile *pFile){
33209
+ assert( pFile->pInode );
33210
+ return sqlite3_mutex_held(pFile->pInode->pLockMutex);
33211
+}
33212
+int unixFileMutexNotheld(unixFile *pFile){
33213
+ assert( pFile->pInode );
33214
+ return sqlite3_mutex_notheld(pFile->pInode->pLockMutex);
33215
+}
33216
+#endif
3320133217
3320233218
/*
3320333219
**
3320433220
** This function - unixLogErrorAtLine(), is only ever called via the macro
3320533221
** unixLogError().
@@ -33301,15 +33317,15 @@
3330133317
*/
3330233318
static void closePendingFds(unixFile *pFile){
3330333319
unixInodeInfo *pInode = pFile->pInode;
3330433320
UnixUnusedFd *p;
3330533321
UnixUnusedFd *pNext;
33322
+ assert( unixFileMutexHeld(pFile) );
3330633323
for(p=pInode->pUnused; p; p=pNext){
3330733324
pNext = p->pNext;
3330833325
robust_close(pFile, p->fd, __LINE__);
3330933326
sqlite3_free(p);
33310
- nUnusedFd--;
3331133327
}
3331233328
pInode->pUnused = 0;
3331333329
}
3331433330
3331533331
/*
@@ -33319,15 +33335,18 @@
3331933335
** when this function is called.
3332033336
*/
3332133337
static void releaseInodeInfo(unixFile *pFile){
3332233338
unixInodeInfo *pInode = pFile->pInode;
3332333339
assert( unixMutexHeld() );
33340
+ assert( unixFileMutexNotheld(pFile) );
3332433341
if( ALWAYS(pInode) ){
3332533342
pInode->nRef--;
3332633343
if( pInode->nRef==0 ){
3332733344
assert( pInode->pShmNode==0 );
33345
+ sqlite3_mutex_enter(pInode->pLockMutex);
3332833346
closePendingFds(pFile);
33347
+ sqlite3_mutex_leave(pInode->pLockMutex);
3332933348
if( pInode->pPrev ){
3333033349
assert( pInode->pPrev->pNext==pInode );
3333133350
pInode->pPrev->pNext = pInode->pNext;
3333233351
}else{
3333333352
assert( inodeList==pInode );
@@ -33335,14 +33354,14 @@
3333533354
}
3333633355
if( pInode->pNext ){
3333733356
assert( pInode->pNext->pPrev==pInode );
3333833357
pInode->pNext->pPrev = pInode->pPrev;
3333933358
}
33359
+ sqlite3_mutex_free(pInode->pLockMutex);
3334033360
sqlite3_free(pInode);
3334133361
}
3334233362
}
33343
- assert( inodeList!=0 || nUnusedFd==0 );
3334433363
}
3334533364
3334633365
/*
3334733366
** Given a file descriptor, locate the unixInodeInfo object that
3334833367
** describes that file descriptor. Create a new one if necessary. The
@@ -33408,11 +33427,10 @@
3340833427
#if OS_VXWORKS
3340933428
fileId.pId = pFile->pId;
3341033429
#else
3341133430
fileId.ino = (u64)statbuf.st_ino;
3341233431
#endif
33413
- assert( inodeList!=0 || nUnusedFd==0 );
3341433432
pInode = inodeList;
3341533433
while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){
3341633434
pInode = pInode->pNext;
3341733435
}
3341833436
if( pInode==0 ){
@@ -33420,10 +33438,17 @@
3342033438
if( pInode==0 ){
3342133439
return SQLITE_NOMEM_BKPT;
3342233440
}
3342333441
memset(pInode, 0, sizeof(*pInode));
3342433442
memcpy(&pInode->fileId, &fileId, sizeof(fileId));
33443
+ if( sqlite3GlobalConfig.bCoreMutex ){
33444
+ pInode->pLockMutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
33445
+ if( pInode->pLockMutex==0 ){
33446
+ sqlite3_free(pInode);
33447
+ return SQLITE_NOMEM_BKPT;
33448
+ }
33449
+ }
3342533450
pInode->nRef = 1;
3342633451
pInode->pNext = inodeList;
3342733452
pInode->pPrev = 0;
3342833453
if( inodeList ) inodeList->pPrev = pInode;
3342933454
inodeList = pInode;
@@ -33498,11 +33523,11 @@
3349833523
3349933524
SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
3350033525
3350133526
assert( pFile );
3350233527
assert( pFile->eFileLock<=SHARED_LOCK );
33503
- unixEnterMutex(); /* Because pFile->pInode is shared across threads */
33528
+ sqlite3_mutex_enter(pFile->pInode->pLockMutex);
3350433529
3350533530
/* Check if a thread in this process holds such a lock */
3350633531
if( pFile->pInode->eFileLock>SHARED_LOCK ){
3350733532
reserved = 1;
3350833533
}
@@ -33523,11 +33548,11 @@
3352333548
reserved = 1;
3352433549
}
3352533550
}
3352633551
#endif
3352733552
33528
- unixLeaveMutex();
33553
+ sqlite3_mutex_leave(pFile->pInode->pLockMutex);
3352933554
OSTRACE(("TEST WR-LOCK %d %d %d (unix)\n", pFile->h, rc, reserved));
3353033555
3353133556
*pResOut = reserved;
3353233557
return rc;
3353333558
}
@@ -33589,12 +33614,12 @@
3358933614
** to fcntl() fails. In this case, errno is set appropriately (by fcntl()).
3359033615
*/
3359133616
static int unixFileLock(unixFile *pFile, struct flock *pLock){
3359233617
int rc;
3359333618
unixInodeInfo *pInode = pFile->pInode;
33594
- assert( unixMutexHeld() );
3359533619
assert( pInode!=0 );
33620
+ assert( sqlite3_mutex_held(pInode->pLockMutex) );
3359633621
if( (pFile->ctrlFlags & (UNIXFILE_EXCL|UNIXFILE_RDONLY))==UNIXFILE_EXCL ){
3359733622
if( pInode->bProcessLock==0 ){
3359833623
struct flock lock;
3359933624
assert( pInode->nLock==0 );
3360033625
lock.l_whence = SEEK_SET;
@@ -33709,12 +33734,12 @@
3370933734
assert( eFileLock!=PENDING_LOCK );
3371033735
assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );
3371133736
3371233737
/* This mutex is needed because pFile->pInode is shared across threads
3371333738
*/
33714
- unixEnterMutex();
3371533739
pInode = pFile->pInode;
33740
+ sqlite3_mutex_enter(pInode->pLockMutex);
3371633741
3371733742
/* If some thread using this PID has a lock via a different unixFile*
3371833743
** handle that precludes the requested lock, return BUSY.
3371933744
*/
3372033745
if( (pFile->eFileLock!=pInode->eFileLock &&
@@ -33853,11 +33878,11 @@
3385333878
pFile->eFileLock = PENDING_LOCK;
3385433879
pInode->eFileLock = PENDING_LOCK;
3385533880
}
3385633881
3385733882
end_lock:
33858
- unixLeaveMutex();
33883
+ sqlite3_mutex_leave(pInode->pLockMutex);
3385933884
OSTRACE(("LOCK %d %s %s (unix)\n", pFile->h, azFileLock(eFileLock),
3386033885
rc==SQLITE_OK ? "ok" : "failed"));
3386133886
return rc;
3386233887
}
3386333888
@@ -33866,15 +33891,15 @@
3386633891
** pUnused list.
3386733892
*/
3386833893
static void setPendingFd(unixFile *pFile){
3386933894
unixInodeInfo *pInode = pFile->pInode;
3387033895
UnixUnusedFd *p = pFile->pPreallocatedUnused;
33896
+ assert( unixFileMutexHeld(pFile) );
3387133897
p->pNext = pInode->pUnused;
3387233898
pInode->pUnused = p;
3387333899
pFile->h = -1;
3387433900
pFile->pPreallocatedUnused = 0;
33875
- nUnusedFd++;
3387633901
}
3387733902
3387833903
/*
3387933904
** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
3388033905
** must be either NO_LOCK or SHARED_LOCK.
@@ -33901,12 +33926,12 @@
3390133926
3390233927
assert( eFileLock<=SHARED_LOCK );
3390333928
if( pFile->eFileLock<=eFileLock ){
3390433929
return SQLITE_OK;
3390533930
}
33906
- unixEnterMutex();
3390733931
pInode = pFile->pInode;
33932
+ sqlite3_mutex_enter(pInode->pLockMutex);
3390833933
assert( pInode->nShared!=0 );
3390933934
if( pFile->eFileLock>SHARED_LOCK ){
3391033935
assert( pInode->eFileLock==pFile->eFileLock );
3391133936
3391233937
#ifdef SQLITE_DEBUG
@@ -34028,18 +34053,18 @@
3402834053
** count reaches zero, close any other file descriptors whose close
3402934054
** was deferred because of outstanding locks.
3403034055
*/
3403134056
pInode->nLock--;
3403234057
assert( pInode->nLock>=0 );
34033
- if( pInode->nLock==0 ){
34034
- closePendingFds(pFile);
34035
- }
34058
+ if( pInode->nLock==0 ) closePendingFds(pFile);
3403634059
}
3403734060
3403834061
end_unlock:
34039
- unixLeaveMutex();
34040
- if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock;
34062
+ sqlite3_mutex_leave(pInode->pLockMutex);
34063
+ if( rc==SQLITE_OK ){
34064
+ pFile->eFileLock = eFileLock;
34065
+ }
3404134066
return rc;
3404234067
}
3404334068
3404434069
/*
3404534070
** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
@@ -34106,26 +34131,32 @@
3410634131
** Close a file.
3410734132
*/
3410834133
static int unixClose(sqlite3_file *id){
3410934134
int rc = SQLITE_OK;
3411034135
unixFile *pFile = (unixFile *)id;
34136
+ unixInodeInfo *pInode = pFile->pInode;
34137
+
34138
+ assert( pInode!=0 );
3411134139
verifyDbFile(pFile);
3411234140
unixUnlock(id, NO_LOCK);
34141
+ assert( unixFileMutexNotheld(pFile) );
3411334142
unixEnterMutex();
3411434143
3411534144
/* unixFile.pInode is always valid here. Otherwise, a different close
3411634145
** routine (e.g. nolockClose()) would be called instead.
3411734146
*/
3411834147
assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 );
34119
- if( ALWAYS(pFile->pInode) && pFile->pInode->nLock ){
34148
+ sqlite3_mutex_enter(pInode->pLockMutex);
34149
+ if( pInode->nLock ){
3412034150
/* If there are outstanding locks, do not actually close the file just
3412134151
** yet because that would clear those locks. Instead, add the file
3412234152
** descriptor to pInode->pUnused list. It will be automatically closed
3412334153
** when the last lock is cleared.
3412434154
*/
3412534155
setPendingFd(pFile);
3412634156
}
34157
+ sqlite3_mutex_leave(pInode->pLockMutex);
3412734158
releaseInodeInfo(pFile);
3412834159
rc = closeUnixFile(id);
3412934160
unixLeaveMutex();
3413034161
return rc;
3413134162
}
@@ -34719,10 +34750,11 @@
3471934750
static int semXClose(sqlite3_file *id) {
3472034751
if( id ){
3472134752
unixFile *pFile = (unixFile*)id;
3472234753
semXUnlock(id, NO_LOCK);
3472334754
assert( pFile );
34755
+ assert( unixFileMutexNotheld(pFile) );
3472434756
unixEnterMutex();
3472534757
releaseInodeInfo(pFile);
3472634758
unixLeaveMutex();
3472734759
closeUnixFile(id);
3472834760
}
@@ -34833,12 +34865,11 @@
3483334865
context = (afpLockingContext *) pFile->lockingContext;
3483434866
if( context->reserved ){
3483534867
*pResOut = 1;
3483634868
return SQLITE_OK;
3483734869
}
34838
- unixEnterMutex(); /* Because pFile->pInode is shared across threads */
34839
-
34870
+ sqlite3_mutex_enter(pFile->pInode->pLockMutex);
3484034871
/* Check if a thread in this process holds such a lock */
3484134872
if( pFile->pInode->eFileLock>SHARED_LOCK ){
3484234873
reserved = 1;
3484334874
}
3484434875
@@ -34858,11 +34889,11 @@
3485834889
if( IS_LOCK_ERROR(lrc) ){
3485934890
rc=lrc;
3486034891
}
3486134892
}
3486234893
34863
- unixLeaveMutex();
34894
+ sqlite3_mutex_leave(pFile->pInode->pLockMutex);
3486434895
OSTRACE(("TEST WR-LOCK %d %d %d (afp)\n", pFile->h, rc, reserved));
3486534896
3486634897
*pResOut = reserved;
3486734898
return rc;
3486834899
}
@@ -34921,12 +34952,12 @@
3492134952
assert( eFileLock!=PENDING_LOCK );
3492234953
assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );
3492334954
3492434955
/* This mutex is needed because pFile->pInode is shared across threads
3492534956
*/
34926
- unixEnterMutex();
3492734957
pInode = pFile->pInode;
34958
+ sqlite3_mutex_enter(pInode->pLockMutex);
3492834959
3492934960
/* If some thread using this PID has a lock via a different unixFile*
3493034961
** handle that precludes the requested lock, return BUSY.
3493134962
*/
3493234963
if( (pFile->eFileLock!=pInode->eFileLock &&
@@ -35058,11 +35089,11 @@
3505835089
pFile->eFileLock = PENDING_LOCK;
3505935090
pInode->eFileLock = PENDING_LOCK;
3506035091
}
3506135092
3506235093
afp_end_lock:
35063
- unixLeaveMutex();
35094
+ sqlite3_mutex_leave(pInode->pLockMutex);
3506435095
OSTRACE(("LOCK %d %s %s (afp)\n", pFile->h, azFileLock(eFileLock),
3506535096
rc==SQLITE_OK ? "ok" : "failed"));
3506635097
return rc;
3506735098
}
3506835099
@@ -35090,12 +35121,12 @@
3509035121
3509135122
assert( eFileLock<=SHARED_LOCK );
3509235123
if( pFile->eFileLock<=eFileLock ){
3509335124
return SQLITE_OK;
3509435125
}
35095
- unixEnterMutex();
3509635126
pInode = pFile->pInode;
35127
+ sqlite3_mutex_enter(pInode->pLockMutex);
3509735128
assert( pInode->nShared!=0 );
3509835129
if( pFile->eFileLock>SHARED_LOCK ){
3509935130
assert( pInode->eFileLock==pFile->eFileLock );
3510035131
SimulateIOErrorBenign(1);
3510135132
SimulateIOError( h=(-1) )
@@ -35160,18 +35191,18 @@
3516035191
}
3516135192
}
3516235193
if( rc==SQLITE_OK ){
3516335194
pInode->nLock--;
3516435195
assert( pInode->nLock>=0 );
35165
- if( pInode->nLock==0 ){
35166
- closePendingFds(pFile);
35167
- }
35196
+ if( pInode->nLock==0 ) closePendingFds(pFile);
3516835197
}
3516935198
}
3517035199
35171
- unixLeaveMutex();
35172
- if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock;
35200
+ sqlite3_mutex_leave(pInode->pLockMutex);
35201
+ if( rc==SQLITE_OK ){
35202
+ pFile->eFileLock = eFileLock;
35203
+ }
3517335204
return rc;
3517435205
}
3517535206
3517635207
/*
3517735208
** Close a file & cleanup AFP specific locking context
@@ -35179,18 +35210,24 @@
3517935210
static int afpClose(sqlite3_file *id) {
3518035211
int rc = SQLITE_OK;
3518135212
unixFile *pFile = (unixFile*)id;
3518235213
assert( id!=0 );
3518335214
afpUnlock(id, NO_LOCK);
35215
+ assert( unixFileMutexNotheld(pFile) );
3518435216
unixEnterMutex();
35185
- if( pFile->pInode && pFile->pInode->nLock ){
35186
- /* If there are outstanding locks, do not actually close the file just
35187
- ** yet because that would clear those locks. Instead, add the file
35188
- ** descriptor to pInode->aPending. It will be automatically closed when
35189
- ** the last lock is cleared.
35190
- */
35191
- setPendingFd(pFile);
35217
+ if( pFile->pInode ){
35218
+ unixInodeInfo *pInode = pFile->pInode;
35219
+ sqlite3_mutex_enter(pInode->pLockMutex);
35220
+ if( pFile->pInode->nLock ){
35221
+ /* If there are outstanding locks, do not actually close the file just
35222
+ ** yet because that would clear those locks. Instead, add the file
35223
+ ** descriptor to pInode->aPending. It will be automatically closed when
35224
+ ** the last lock is cleared.
35225
+ */
35226
+ setPendingFd(pFile);
35227
+ }
35228
+ sqlite3_mutex_leave(pInode->pLockMutex);
3519235229
}
3519335230
releaseInodeInfo(pFile);
3519435231
sqlite3_free(pFile->lockingContext);
3519535232
rc = closeUnixFile(id);
3519635233
unixLeaveMutex();
@@ -36492,10 +36529,11 @@
3649236529
assert( pDbFd->pShm==0 );
3649336530
3649436531
/* Check to see if a unixShmNode object already exists. Reuse an existing
3649536532
** one if present. Create a new one if necessary.
3649636533
*/
36534
+ assert( unixFileMutexNotheld(pDbFd) );
3649736535
unixEnterMutex();
3649836536
pInode = pDbFd->pInode;
3649936537
pShmNode = pInode->pShmNode;
3650036538
if( pShmNode==0 ){
3650136539
struct stat sStat; /* fstat() info for database file */
@@ -36874,10 +36912,11 @@
3687436912
static void unixShmBarrier(
3687536913
sqlite3_file *fd /* Database file holding the shared memory */
3687636914
){
3687736915
UNUSED_PARAMETER(fd);
3687836916
sqlite3MemoryBarrier(); /* compiler-defined memory barrier */
36917
+ assert( unixFileMutexNotheld((unixFile*)fd) );
3687936918
unixEnterMutex(); /* Also mutex, for redundancy */
3688036919
unixLeaveMutex();
3688136920
}
3688236921
3688336922
/*
@@ -36915,10 +36954,11 @@
3691536954
pDbFd->pShm = 0;
3691636955
sqlite3_mutex_leave(pShmNode->mutex);
3691736956
3691836957
/* If pShmNode->nRef has reached 0, then close the underlying
3691936958
** shared-memory file, too */
36959
+ assert( unixFileMutexNotheld(pDbFd) );
3692036960
unixEnterMutex();
3692136961
assert( pShmNode->nRef>0 );
3692236962
pShmNode->nRef--;
3692336963
if( pShmNode->nRef==0 ){
3692436964
if( deleteFlag && pShmNode->h>=0 ){
@@ -37241,11 +37281,11 @@
3724137281
unixShmMap /* xShmMap method */
3724237282
)
3724337283
IOMETHODS(
3724437284
nolockIoFinder, /* Finder function name */
3724537285
nolockIoMethods, /* sqlite3_io_methods object name */
37246
- 3, /* shared memory is disabled */
37286
+ 3, /* shared memory and mmap are enabled */
3724737287
nolockClose, /* xClose method */
3724837288
nolockLock, /* xLock method */
3724937289
nolockUnlock, /* xUnlock method */
3725037290
nolockCheckReservedLock, /* xCheckReservedLock method */
3725137291
0 /* xShmMap method */
@@ -37737,26 +37777,28 @@
3773737777
** ignored and -1 is returned. The caller will try to open a new file
3773837778
** descriptor on the same path, fail, and return an error to SQLite.
3773937779
**
3774037780
** Even if a subsequent open() call does succeed, the consequences of
3774137781
** not searching for a reusable file descriptor are not dire. */
37742
- if( nUnusedFd>0 && 0==osStat(zPath, &sStat) ){
37782
+ if( inodeList!=0 && 0==osStat(zPath, &sStat) ){
3774337783
unixInodeInfo *pInode;
3774437784
3774537785
pInode = inodeList;
3774637786
while( pInode && (pInode->fileId.dev!=sStat.st_dev
3774737787
|| pInode->fileId.ino!=(u64)sStat.st_ino) ){
3774837788
pInode = pInode->pNext;
3774937789
}
3775037790
if( pInode ){
3775137791
UnixUnusedFd **pp;
37792
+ assert( sqlite3_mutex_notheld(pInode->pLockMutex) );
37793
+ sqlite3_mutex_enter(pInode->pLockMutex);
3775237794
for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext));
3775337795
pUnused = *pp;
3775437796
if( pUnused ){
37755
- nUnusedFd--;
3775637797
*pp = pUnused->pNext;
3775737798
}
37799
+ sqlite3_mutex_leave(pInode->pLockMutex);
3775837800
}
3775937801
}
3776037802
unixLeaveMutex();
3776137803
#endif /* if !OS_VXWORKS */
3776237804
return pUnused;
@@ -49969,10 +50011,12 @@
4996950011
4997050012
#ifdef SQLITE_ENABLE_SNAPSHOT
4997150013
SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot);
4997250014
SQLITE_PRIVATE void sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapshot);
4997350015
SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal);
50016
+SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot);
50017
+SQLITE_PRIVATE void sqlite3WalSnapshotUnlock(Wal *pWal);
4997450018
#endif
4997550019
4997650020
#ifdef SQLITE_ENABLE_ZIPVFS
4997750021
/* If the WAL file is not empty, return the number of bytes of content
4997850022
** stored in each frame (i.e. the db page-size when the WAL was created).
@@ -57618,10 +57662,42 @@
5761857662
}else{
5761957663
rc = SQLITE_ERROR;
5762057664
}
5762157665
return rc;
5762257666
}
57667
+
57668
+/*
57669
+** The caller currently has a read transaction open on the database.
57670
+** If this is not a WAL database, SQLITE_ERROR is returned. Otherwise,
57671
+** this function takes a SHARED lock on the CHECKPOINTER slot and then
57672
+** checks if the snapshot passed as the second argument is still
57673
+** available. If so, SQLITE_OK is returned.
57674
+**
57675
+** If the snapshot is not available, SQLITE_ERROR is returned. Or, if
57676
+** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error
57677
+** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER
57678
+** lock is released before returning.
57679
+*/
57680
+SQLITE_PRIVATE int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot){
57681
+ int rc;
57682
+ if( pPager->pWal ){
57683
+ rc = sqlite3WalSnapshotCheck(pPager->pWal, pSnapshot);
57684
+ }else{
57685
+ rc = SQLITE_ERROR;
57686
+ }
57687
+ return rc;
57688
+}
57689
+
57690
+/*
57691
+** Release a lock obtained by an earlier successful call to
57692
+** sqlite3PagerSnapshotCheck().
57693
+*/
57694
+SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager){
57695
+ assert( pPager->pWal );
57696
+ return sqlite3WalSnapshotUnlock(pPager->pWal);
57697
+}
57698
+
5762357699
#endif /* SQLITE_ENABLE_SNAPSHOT */
5762457700
#endif /* !SQLITE_OMIT_WAL */
5762557701
5762657702
#ifdef SQLITE_ENABLE_ZIPVFS
5762757703
/*
@@ -59476,11 +59552,10 @@
5947659552
}
5947759553
5947859554
if( pIter
5947959555
&& (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0),1))==SQLITE_OK
5948059556
){
59481
- i64 nSize; /* Current size of database file */
5948259557
u32 nBackfill = pInfo->nBackfill;
5948359558
5948459559
pInfo->nBackfillAttempted = mxSafeFrame;
5948559560
5948659561
/* Sync the WAL to disk */
@@ -59489,10 +59564,11 @@
5948959564
/* If the database may grow as a result of this checkpoint, hint
5949059565
** about the eventual size of the db file to the VFS layer.
5949159566
*/
5949259567
if( rc==SQLITE_OK ){
5949359568
i64 nReq = ((i64)mxPage * szPage);
59569
+ i64 nSize; /* Current size of database file */
5949459570
rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);
5949559571
if( rc==SQLITE_OK && nSize<nReq ){
5949659572
sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq);
5949759573
}
5949859574
}
@@ -61410,10 +61486,47 @@
6141061486
if( pHdr1->aSalt[0]>pHdr2->aSalt[0] ) return +1;
6141161487
if( pHdr1->mxFrame<pHdr2->mxFrame ) return -1;
6141261488
if( pHdr1->mxFrame>pHdr2->mxFrame ) return +1;
6141361489
return 0;
6141461490
}
61491
+
61492
+/*
61493
+** The caller currently has a read transaction open on the database.
61494
+** This function takes a SHARED lock on the CHECKPOINTER slot and then
61495
+** checks if the snapshot passed as the second argument is still
61496
+** available. If so, SQLITE_OK is returned.
61497
+**
61498
+** If the snapshot is not available, SQLITE_ERROR is returned. Or, if
61499
+** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error
61500
+** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER
61501
+** lock is released before returning.
61502
+*/
61503
+SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot){
61504
+ int rc;
61505
+ rc = walLockShared(pWal, WAL_CKPT_LOCK);
61506
+ if( rc==SQLITE_OK ){
61507
+ WalIndexHdr *pNew = (WalIndexHdr*)pSnapshot;
61508
+ if( memcmp(pNew->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt))
61509
+ || pNew->mxFrame<walCkptInfo(pWal)->nBackfillAttempted
61510
+ ){
61511
+ rc = SQLITE_BUSY_SNAPSHOT;
61512
+ walUnlockShared(pWal, WAL_CKPT_LOCK);
61513
+ }
61514
+ }
61515
+ return rc;
61516
+}
61517
+
61518
+/*
61519
+** Release a lock obtained by an earlier successful call to
61520
+** sqlite3WalSnapshotCheck().
61521
+*/
61522
+SQLITE_PRIVATE void sqlite3WalSnapshotUnlock(Wal *pWal){
61523
+ assert( pWal );
61524
+ walUnlockShared(pWal, WAL_CKPT_LOCK);
61525
+}
61526
+
61527
+
6141561528
#endif /* SQLITE_ENABLE_SNAPSHOT */
6141661529
6141761530
#ifdef SQLITE_ENABLE_ZIPVFS
6141861531
/*
6141961532
** If the argument is not NULL, it points to a Wal object that holds a
@@ -74393,13 +74506,10 @@
7439374506
pX->flags = MEM_Undefined;
7439474507
pX->pScopyFrom = 0;
7439574508
}
7439674509
}
7439774510
pMem->pScopyFrom = 0;
74398
-#ifdef SQLITE_DEBUG_COLUMN_CACHE
74399
- pMem->iTabColHash = 0;
74400
-#endif
7440174511
}
7440274512
#endif /* SQLITE_DEBUG */
7440374513
7440474514
7440574515
/*
@@ -74416,13 +74526,10 @@
7441674526
SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
7441774527
assert( (pFrom->flags & MEM_RowSet)==0 );
7441874528
assert( pTo->db==pFrom->db );
7441974529
if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; }
7442074530
memcpy(pTo, pFrom, MEMCELLSIZE);
74421
-#ifdef SQLITE_DEBUG_COLUMNCACHE
74422
- pTo->iTabColHash = pFrom->iTabColHash;
74423
-#endif
7442474531
if( (pFrom->flags&MEM_Static)==0 ){
7442574532
pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);
7442674533
assert( srcType==MEM_Ephem || srcType==MEM_Static );
7442774534
pTo->flags |= srcType;
7442874535
}
@@ -74436,13 +74543,10 @@
7443674543
int rc = SQLITE_OK;
7443774544
7443874545
assert( (pFrom->flags & MEM_RowSet)==0 );
7443974546
if( VdbeMemDynamic(pTo) ) vdbeMemClearExternAndSetNull(pTo);
7444074547
memcpy(pTo, pFrom, MEMCELLSIZE);
74441
-#ifdef SQLITE_DEBUG_COLUMNCACHE
74442
- pTo->iTabColHash = pFrom->iTabColHash;
74443
-#endif
7444474548
pTo->flags &= ~MEM_Dyn;
7444574549
if( pTo->flags&(MEM_Str|MEM_Blob) ){
7444674550
if( 0==(pFrom->flags&MEM_Static) ){
7444774551
pTo->flags |= MEM_Ephem;
7444874552
rc = sqlite3VdbeMemMakeWriteable(pTo);
@@ -75547,18 +75651,10 @@
7554775651
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
7554875652
pOp->zComment = 0;
7554975653
#endif
7555075654
#ifdef SQLITE_DEBUG
7555175655
if( p->db->flags & SQLITE_VdbeAddopTrace ){
75552
- int jj, kk;
75553
- Parse *pParse = p->pParse;
75554
- for(jj=kk=0; jj<pParse->nColCache; jj++){
75555
- struct yColCache *x = pParse->aColCache + jj;
75556
- printf(" r[%d]={%d:%d}", x->iReg, x->iTable, x->iColumn);
75557
- kk++;
75558
- }
75559
- if( kk ) printf("\n");
7556075656
sqlite3VdbePrintOp(0, i, &p->aOp[i]);
7556175657
test_addop_breakpoint();
7556275658
}
7556375659
#endif
7556475660
#ifdef VDBE_PROFILE
@@ -75799,23 +75895,10 @@
7579975895
assert( p->aLabel[j]==(-1) ); /* Labels may only be resolved once */
7580075896
p->aLabel[j] = v->nOp;
7580175897
}
7580275898
}
7580375899
75804
-#ifdef SQLITE_COVERAGE_TEST
75805
-/*
75806
-** Return TRUE if and only if the label x has already been resolved.
75807
-** Return FALSE (zero) if label x is still unresolved.
75808
-**
75809
-** This routine is only used inside of testcase() macros, and so it
75810
-** only exists when measuring test coverage.
75811
-*/
75812
-SQLITE_PRIVATE int sqlite3VdbeLabelHasBeenResolved(Vdbe *v, int x){
75813
- return v->pParse->aLabel && v->pParse->aLabel[ADDR(x)]>=0;
75814
-}
75815
-#endif /* SQLITE_COVERAGE_TEST */
75816
-
7581775900
/*
7581875901
** Mark the VDBE as one that can only be run one time.
7581975902
*/
7582075903
SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){
7582175904
p->runOnlyOnce = 1;
@@ -77001,13 +77084,10 @@
7700177084
p->flags = flags;
7700277085
p->szMalloc = 0;
7700377086
#ifdef SQLITE_DEBUG
7700477087
p->pScopyFrom = 0;
7700577088
#endif
77006
-#ifdef SQLITE_DEBUG_COLUMNCACHE
77007
- p->iTabColHash = 0;
77008
-#endif
7700977089
p++;
7701077090
}
7701177091
}
7701277092
7701377093
/*
@@ -81187,13 +81267,10 @@
8118781267
/* .xDel = */ (void(*)(void*))0,
8118881268
#ifdef SQLITE_DEBUG
8118981269
/* .pScopyFrom = */ (Mem*)0,
8119081270
/* .mScopyFlags= */ 0,
8119181271
#endif
81192
-#ifdef SQLITE_DEBUG_COLUMNCACHE
81193
- /* .iTabColHash= */ 0,
81194
-#endif
8119581272
};
8119681273
return &nullMem;
8119781274
}
8119881275
8119981276
/*
@@ -82412,22 +82489,10 @@
8241282489
# define memAboutToChange(P,M) sqlite3VdbeMemAboutToChange(P,M)
8241382490
#else
8241482491
# define memAboutToChange(P,M)
8241582492
#endif
8241682493
82417
-/*
82418
-** Given a cursor number and a column for a table or index, compute a
82419
-** hash value for use in the Mem.iTabColHash value. The iTabColHash
82420
-** column is only used for verification - it is omitted from production
82421
-** builds. Collisions are harmless in the sense that the correct answer
82422
-** still results. The only harm of collisions is that they can potential
82423
-** reduce column-cache error detection during SQLITE_DEBUG builds.
82424
-**
82425
-** No valid hash should be 0.
82426
-*/
82427
-#define TableColumnHash(T,C) (((u32)(T)<<16)^(u32)(C+2))
82428
-
8242982494
/*
8243082495
** The following global variable is incremented every time a cursor
8243182496
** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test
8243282497
** procedures use this information to make sure that indices are
8243382498
** working correctly. This variable has no function other than to
@@ -83773,11 +83838,10 @@
8377383838
memAboutToChange(p, pOut);
8377483839
sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);
8377583840
Deephemeralize(pOut);
8377683841
#ifdef SQLITE_DEBUG
8377783842
pOut->pScopyFrom = 0;
83778
- pOut->iTabColHash = 0;
8377983843
#endif
8378083844
REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut);
8378183845
if( (n--)==0 ) break;
8378283846
pOut++;
8378383847
pIn1++;
@@ -84437,11 +84501,16 @@
8443784501
affinity = pOp->p5 & SQLITE_AFF_MASK;
8443884502
if( affinity>=SQLITE_AFF_NUMERIC ){
8443984503
if( (flags1 | flags3)&MEM_Str ){
8444084504
if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
8444184505
applyNumericAffinity(pIn1,0);
84442
- testcase( flags3!=pIn3->flags ); /* Possible if pIn1==pIn3 */
84506
+ assert( flags3==pIn3->flags );
84507
+ /* testcase( flags3!=pIn3->flags );
84508
+ ** this used to be possible with pIn1==pIn3, but not since
84509
+ ** the column cache was removed. The following assignment
84510
+ ** is essentially a no-op. But, it provides defense-in-depth
84511
+ ** in case our analysis is incorrect, so it is left in. */
8444384512
flags3 = pIn3->flags;
8444484513
}
8444584514
if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
8444684515
applyNumericAffinity(pIn3,0);
8444784516
}
@@ -86357,14 +86426,14 @@
8635786426
** The IdxGE opcode will be skipped if this opcode succeeds, but the
8635886427
** IdxGE opcode will be used on subsequent loop iterations.
8635986428
**
8636086429
** See also: Found, NotFound, SeekGt, SeekGe, SeekLt
8636186430
*/
86362
-case OP_SeekLT: /* jump, in3 */
86363
-case OP_SeekLE: /* jump, in3 */
86364
-case OP_SeekGE: /* jump, in3 */
86365
-case OP_SeekGT: { /* jump, in3 */
86431
+case OP_SeekLT: /* jump, in3, group */
86432
+case OP_SeekLE: /* jump, in3, group */
86433
+case OP_SeekGE: /* jump, in3, group */
86434
+case OP_SeekGT: { /* jump, in3, group */
8636686435
int res; /* Comparison result */
8636786436
int oc; /* Opcode */
8636886437
VdbeCursor *pC; /* The cursor to seek */
8636986438
UnpackedRecord r; /* The key to seek for */
8637086439
int nField; /* Number of columns or fields in the key */
@@ -86788,17 +86857,25 @@
8678886857
int res;
8678986858
u64 iKey;
8679086859
8679186860
pIn3 = &aMem[pOp->p3];
8679286861
if( (pIn3->flags & MEM_Int)==0 ){
86862
+ /* Make sure pIn3->u.i contains a valid integer representation of
86863
+ ** the key value, but do not change the datatype of the register, as
86864
+ ** other parts of the perpared statement might be depending on the
86865
+ ** current datatype. */
86866
+ u16 origFlags = pIn3->flags;
86867
+ int isNotInt;
8679386868
applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding);
86794
- if( (pIn3->flags & MEM_Int)==0 ) goto jump_to_p2;
86869
+ isNotInt = (pIn3->flags & MEM_Int)==0;
86870
+ pIn3->flags = origFlags;
86871
+ if( isNotInt ) goto jump_to_p2;
8679586872
}
8679686873
/* Fall through into OP_NotExists */
8679786874
case OP_NotExists: /* jump, in3 */
8679886875
pIn3 = &aMem[pOp->p3];
86799
- assert( pIn3->flags & MEM_Int );
86876
+ assert( (pIn3->flags & MEM_Int)!=0 || pOp->opcode==OP_SeekRowid );
8680086877
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
8680186878
pC = p->apCsr[pOp->p1];
8680286879
assert( pC!=0 );
8680386880
#ifdef SQLITE_DEBUG
8680486881
pC->seekOp = OP_SeekRowid;
@@ -87994,11 +88071,17 @@
8799488071
assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxLT );
8799588072
r.default_rc = 0;
8799688073
}
8799788074
r.aMem = &aMem[pOp->p3];
8799888075
#ifdef SQLITE_DEBUG
87999
- { int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }
88076
+ {
88077
+ int i;
88078
+ for(i=0; i<r.nField; i++){
88079
+ assert( memIsValid(&r.aMem[i]) );
88080
+ REGISTER_TRACE(pOp->p3+i, &aMem[pOp->p3+i]);
88081
+ }
88082
+ }
8800088083
#endif
8800188084
res = 0; /* Not needed. Only used to silence a warning. */
8800288085
rc = sqlite3VdbeIdxKeyCompare(db, pC, &r, &res);
8800388086
assert( (OP_IdxLE&1)==(OP_IdxLT&1) && (OP_IdxGE&1)==(OP_IdxGT&1) );
8800488087
if( (pOp->opcode&1)==(OP_IdxLT&1) ){
@@ -89684,12 +89767,12 @@
8968489767
** the sqlite3_context object occurs only once, rather than once for each
8968589768
** evaluation of the function.
8968689769
**
8968789770
** See also: Function0, AggStep, AggFinal
8968889771
*/
89689
-case OP_PureFunc0:
89690
-case OP_Function0: {
89772
+case OP_PureFunc0: /* group */
89773
+case OP_Function0: { /* group */
8969189774
int n;
8969289775
sqlite3_context *pCtx;
8969389776
8969489777
assert( pOp->p4type==P4_FUNCDEF );
8969589778
n = pOp->p5;
@@ -89709,12 +89792,12 @@
8970989792
assert( OP_PureFunc == OP_PureFunc0+2 );
8971089793
assert( OP_Function == OP_Function0+2 );
8971189794
pOp->opcode += 2;
8971289795
/* Fall through into OP_Function */
8971389796
}
89714
-case OP_PureFunc:
89715
-case OP_Function: {
89797
+case OP_PureFunc: /* group */
89798
+case OP_Function: { /* group */
8971689799
int i;
8971789800
sqlite3_context *pCtx;
8971889801
8971989802
assert( pOp->p4type==P4_FUNCCTX );
8972089803
pCtx = pOp->p4.pCtx;
@@ -89895,38 +89978,10 @@
8989589978
*/
8989689979
case OP_Abortable: {
8989789980
sqlite3VdbeAssertAbortable(p);
8989889981
break;
8989989982
}
89900
-#endif
89901
-
89902
-#ifdef SQLITE_DEBUG_COLUMNCACHE
89903
-/* Opcode: SetTabCol P1 P2 P3 * *
89904
-**
89905
-** Set a flag in register REG[P3] indicating that it holds the value
89906
-** of column P2 from the table on cursor P1. This flag is checked
89907
-** by a subsequent VerifyTabCol opcode.
89908
-**
89909
-** This opcode only appears SQLITE_DEBUG builds. It is used to verify
89910
-** that the expression table column cache is working correctly.
89911
-*/
89912
-case OP_SetTabCol: {
89913
- aMem[pOp->p3].iTabColHash = TableColumnHash(pOp->p1,pOp->p2);
89914
- break;
89915
-}
89916
-/* Opcode: VerifyTabCol P1 P2 P3 * *
89917
-**
89918
-** Verify that register REG[P3] contains the value of column P2 from
89919
-** cursor P1. Assert() if this is not the case.
89920
-**
89921
-** This opcode only appears SQLITE_DEBUG builds. It is used to verify
89922
-** that the expression table column cache is working correctly.
89923
-*/
89924
-case OP_VerifyTabCol: {
89925
- assert( aMem[pOp->p3].iTabColHash == TableColumnHash(pOp->p1,pOp->p2) );
89926
- break;
89927
-}
8992889983
#endif
8992989984
8993089985
/* Opcode: Noop * * * * *
8993189986
**
8993289987
** Do nothing. This instruction is often useful as a jump
@@ -95712,18 +95767,10 @@
9571295767
CollSeq *pColl = 0;
9571395768
Expr *p = pExpr;
9571495769
while( p ){
9571595770
int op = p->op;
9571695771
if( p->flags & EP_Generic ) break;
95717
- if( op==TK_CAST || op==TK_UPLUS ){
95718
- p = p->pLeft;
95719
- continue;
95720
- }
95721
- if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
95722
- pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
95723
- break;
95724
- }
9572595772
if( (op==TK_AGG_COLUMN || op==TK_COLUMN
9572695773
|| op==TK_REGISTER || op==TK_TRIGGER)
9572795774
&& p->pTab!=0
9572895775
){
9572995776
/* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally
@@ -95732,10 +95779,18 @@
9573295779
if( j>=0 ){
9573395780
const char *zColl = p->pTab->aCol[j].zColl;
9573495781
pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0);
9573595782
}
9573695783
break;
95784
+ }
95785
+ if( op==TK_CAST || op==TK_UPLUS ){
95786
+ p = p->pLeft;
95787
+ continue;
95788
+ }
95789
+ if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
95790
+ pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
95791
+ break;
9573795792
}
9573895793
if( p->flags & EP_Collate ){
9573995794
if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
9574095795
p = p->pLeft;
9574195796
}else{
@@ -96152,11 +96207,10 @@
9615296207
for(i=0; 1 /*Loop exits by "break"*/; i++){
9615396208
int regFree1 = 0, regFree2 = 0;
9615496209
Expr *pL, *pR;
9615596210
int r1, r2;
9615696211
assert( i>=0 && i<nLeft );
96157
- if( i>0 ) sqlite3ExprCachePush(pParse);
9615896212
r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, &regFree1);
9615996213
r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, &regFree2);
9616096214
codeCompare(pParse, pL, pR, opx, r1, r2, dest, p5);
9616196215
testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
9616296216
testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);
@@ -96164,11 +96218,10 @@
9616496218
testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge);
9616596219
testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq);
9616696220
testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne);
9616796221
sqlite3ReleaseTempReg(pParse, regFree1);
9616896222
sqlite3ReleaseTempReg(pParse, regFree2);
96169
- if( i>0 ) sqlite3ExprCachePop(pParse);
9617096223
if( i==nLeft-1 ){
9617196224
break;
9617296225
}
9617396226
if( opx==TK_EQ ){
9617496227
sqlite3VdbeAddOp2(v, OP_IfNot, dest, addrDone); VdbeCoverage(v);
@@ -96512,23 +96565,32 @@
9651296565
9651396566
/*
9651496567
** Construct a new expression node for a function with multiple
9651596568
** arguments.
9651696569
*/
96517
-SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){
96570
+SQLITE_PRIVATE Expr *sqlite3ExprFunction(
96571
+ Parse *pParse, /* Parsing context */
96572
+ ExprList *pList, /* Argument list */
96573
+ Token *pToken, /* Name of the function */
96574
+ int eDistinct /* SF_Distinct or SF_ALL or 0 */
96575
+){
9651896576
Expr *pNew;
9651996577
sqlite3 *db = pParse->db;
9652096578
assert( pToken );
9652196579
pNew = sqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1);
9652296580
if( pNew==0 ){
9652396581
sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */
9652496582
return 0;
9652596583
}
96584
+ if( pList && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
96585
+ sqlite3ErrorMsg(pParse, "too many arguments on function %T", pToken);
96586
+ }
9652696587
pNew->x.pList = pList;
9652796588
ExprSetProperty(pNew, EP_HasFunc);
9652896589
assert( !ExprHasProperty(pNew, EP_xIsSelect) );
9652996590
sqlite3ExprSetHeightAndFlags(pParse, pNew);
96591
+ if( eDistinct==SF_Distinct ) ExprSetProperty(pNew, EP_Distinct);
9653096592
return pNew;
9653196593
}
9653296594
9653396595
/*
9653496596
** Assign a variable number to an expression that encodes a wildcard
@@ -97410,10 +97472,13 @@
9741097472
case TK_AGG_COLUMN:
9741197473
testcase( pExpr->op==TK_ID );
9741297474
testcase( pExpr->op==TK_COLUMN );
9741397475
testcase( pExpr->op==TK_AGG_FUNCTION );
9741497476
testcase( pExpr->op==TK_AGG_COLUMN );
97477
+ if( ExprHasProperty(pExpr, EP_FixedCol) && pWalker->eCode!=2 ){
97478
+ return WRC_Continue;
97479
+ }
9741597480
if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){
9741697481
return WRC_Continue;
9741797482
}
9741897483
/* Fall through */
9741997484
case TK_IF_NULL_ROW:
@@ -97465,14 +97530,21 @@
9746597530
SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){
9746697531
return exprIsConst(p, 1, 0);
9746797532
}
9746897533
9746997534
/*
97470
-** Walk an expression tree. Return non-zero if the expression is constant
97471
-** that does no originate from the ON or USING clauses of a join.
97472
-** Return 0 if it involves variables or function calls or terms from
97473
-** an ON or USING clause.
97535
+** Walk an expression tree. Return non-zero if
97536
+**
97537
+** (1) the expression is constant, and
97538
+** (2) the expression does originate in the ON or USING clause
97539
+** of a LEFT JOIN, and
97540
+** (3) the expression does not contain any EP_FixedCol TK_COLUMN
97541
+** operands created by the constant propagation optimization.
97542
+**
97543
+** When this routine returns true, it indicates that the expression
97544
+** can be added to the pParse->pConstExpr list and evaluated once when
97545
+** the prepared statement starts up. See sqlite3ExprCodeAtInit().
9747497546
*/
9747597547
SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){
9747697548
return exprIsConst(p, 2, 0);
9747797549
}
9747897550
@@ -97498,11 +97570,11 @@
9749897570
** it constant. */
9749997571
for(i=0; i<pGroupBy->nExpr; i++){
9750097572
Expr *p = pGroupBy->a[i].pExpr;
9750197573
if( sqlite3ExprCompare(0, pExpr, p, -1)<2 ){
9750297574
CollSeq *pColl = sqlite3ExprNNCollSeq(pWalker->pParse, p);
97503
- if( sqlite3_stricmp("BINARY", pColl->zName)==0 ){
97575
+ if( sqlite3IsBinary(pColl) ){
9750497576
return WRC_Prune;
9750597577
}
9750697578
}
9750797579
}
9750897580
@@ -97920,11 +97992,12 @@
9792097992
int iAddr = sqlite3VdbeAddOp0(v, OP_Once);
9792197993
VdbeCoverage(v);
9792297994
9792397995
sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
9792497996
eType = IN_INDEX_ROWID;
97925
-
97997
+ ExplainQueryPlan((pParse, 0,
97998
+ "USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR",pTab->zName));
9792697999
sqlite3VdbeJumpHere(v, iAddr);
9792798000
}else{
9792898001
Index *pIdx; /* Iterator variable */
9792998002
int affinity_ok = 1;
9793098003
int i;
@@ -98179,11 +98252,10 @@
9817998252
){
9818098253
int jmpIfDynamic = -1; /* One-time test address */
9818198254
int rReg = 0; /* Register storing resulting */
9818298255
Vdbe *v = sqlite3GetVdbe(pParse);
9818398256
if( NEVER(v==0) ) return 0;
98184
- sqlite3ExprCachePush(pParse);
9818598257
9818698258
/* The evaluation of the IN/EXISTS/SELECT must be repeated every time it
9818798259
** is encountered if any of the following is true:
9818898260
**
9818998261
** * The right-hand side is a correlated subquery
@@ -98315,11 +98387,10 @@
9831598387
sqlite3VdbeCurrentAddr(v)+2);
9831698388
VdbeCoverage(v);
9831798389
sqlite3VdbeAddOp3(v, OP_Insert, pExpr->iTable, r2, r3);
9831898390
}else{
9831998391
sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
98320
- sqlite3ExprCacheAffinityChange(pParse, r3, 1);
9832198392
sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pExpr->iTable, r2, r3, 1);
9832298393
}
9832398394
}
9832498395
}
9832598396
sqlite3ReleaseTempReg(pParse, r1);
@@ -98396,11 +98467,10 @@
9839698467
}
9839798468
9839898469
if( jmpIfDynamic>=0 ){
9839998470
sqlite3VdbeJumpHere(v, jmpIfDynamic);
9840098471
}
98401
- sqlite3ExprCachePop(pParse);
9840298472
9840398473
return rReg;
9840498474
}
9840598475
#endif /* SQLITE_OMIT_SUBQUERY */
9840698476
@@ -98515,11 +98585,10 @@
9851598585
** sqlite3FindInIndex() might have reordered the fields of the LHS vector
9851698586
** so that the fields are in the same order as an existing index. The
9851798587
** aiMap[] array contains a mapping from the original LHS field order to
9851898588
** the field order that matches the RHS index.
9851998589
*/
98520
- sqlite3ExprCachePush(pParse);
9852198590
rLhsOrig = exprCodeVector(pParse, pLeft, &iDummy);
9852298591
for(i=0; i<nVector && aiMap[i]==i; i++){} /* Are LHS fields reordered? */
9852398592
if( i==nVector ){
9852498593
/* LHS fields are not reordered */
9852598594
rLhs = rLhsOrig;
@@ -98674,11 +98743,10 @@
9867498743
/* Jumps here in order to return true. */
9867598744
sqlite3VdbeJumpHere(v, addrTruthOp);
9867698745
9867798746
sqlite3ExprCodeIN_finished:
9867898747
if( rLhs!=rLhsOrig ) sqlite3ReleaseTempReg(pParse, rLhs);
98679
- sqlite3ExprCachePop(pParse);
9868098748
VdbeComment((v, "end IN expr"));
9868198749
sqlite3ExprCodeIN_oom_error:
9868298750
sqlite3DbFree(pParse->db, aiMap);
9868398751
sqlite3DbFree(pParse->db, zAff);
9868498752
}
@@ -98742,156 +98810,10 @@
9874298810
sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, iMem, 0, (u8*)&value, P4_INT64);
9874398811
}
9874498812
}
9874598813
}
9874698814
98747
-/*
98748
-** Erase column-cache entry number i
98749
-*/
98750
-static void cacheEntryClear(Parse *pParse, int i){
98751
- if( pParse->aColCache[i].tempReg ){
98752
- if( pParse->nTempReg<ArraySize(pParse->aTempReg) ){
98753
- pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;
98754
- }
98755
- }
98756
- pParse->nColCache--;
98757
- if( i<pParse->nColCache ){
98758
- pParse->aColCache[i] = pParse->aColCache[pParse->nColCache];
98759
- }
98760
-}
98761
-
98762
-
98763
-/*
98764
-** Record in the column cache that a particular column from a
98765
-** particular table is stored in a particular register.
98766
-*/
98767
-SQLITE_PRIVATE void sqlite3ExprCacheStore(Parse *pParse, int iTab, int iCol, int iReg){
98768
- int i;
98769
- int minLru;
98770
- int idxLru;
98771
- struct yColCache *p;
98772
-
98773
- /* Unless an error has occurred, register numbers are always positive. */
98774
- assert( iReg>0 || pParse->nErr || pParse->db->mallocFailed );
98775
- assert( iCol>=-1 && iCol<32768 ); /* Finite column numbers */
98776
-
98777
- /* The SQLITE_ColumnCache flag disables the column cache. This is used
98778
- ** for testing only - to verify that SQLite always gets the same answer
98779
- ** with and without the column cache.
98780
- */
98781
- if( OptimizationDisabled(pParse->db, SQLITE_ColumnCache) ) return;
98782
-
98783
- /* First replace any existing entry.
98784
- **
98785
- ** Actually, the way the column cache is currently used, we are guaranteed
98786
- ** that the object will never already be in cache. Verify this guarantee.
98787
- */
98788
-#ifndef NDEBUG
98789
- for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
98790
- assert( p->iTable!=iTab || p->iColumn!=iCol );
98791
- }
98792
-#endif
98793
-
98794
-#ifdef SQLITE_DEBUG_COLUMNCACHE
98795
- /* Add a SetTabCol opcode for run-time verification that the column
98796
- ** cache is working correctly.
98797
- */
98798
- sqlite3VdbeAddOp3(pParse->pVdbe, OP_SetTabCol, iTab, iCol, iReg);
98799
-#endif
98800
-
98801
- /* If the cache is already full, delete the least recently used entry */
98802
- if( pParse->nColCache>=SQLITE_N_COLCACHE ){
98803
- minLru = 0x7fffffff;
98804
- idxLru = -1;
98805
- for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
98806
- if( p->lru<minLru ){
98807
- idxLru = i;
98808
- minLru = p->lru;
98809
- }
98810
- }
98811
- p = &pParse->aColCache[idxLru];
98812
- }else{
98813
- p = &pParse->aColCache[pParse->nColCache++];
98814
- }
98815
-
98816
- /* Add the new entry to the end of the cache */
98817
- p->iLevel = pParse->iCacheLevel;
98818
- p->iTable = iTab;
98819
- p->iColumn = iCol;
98820
- p->iReg = iReg;
98821
- p->tempReg = 0;
98822
- p->lru = pParse->iCacheCnt++;
98823
-}
98824
-
98825
-/*
98826
-** Indicate that registers between iReg..iReg+nReg-1 are being overwritten.
98827
-** Purge the range of registers from the column cache.
98828
-*/
98829
-SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse *pParse, int iReg, int nReg){
98830
- int i = 0;
98831
- while( i<pParse->nColCache ){
98832
- struct yColCache *p = &pParse->aColCache[i];
98833
- if( p->iReg >= iReg && p->iReg < iReg+nReg ){
98834
- cacheEntryClear(pParse, i);
98835
- }else{
98836
- i++;
98837
- }
98838
- }
98839
-}
98840
-
98841
-/*
98842
-** Remember the current column cache context. Any new entries added
98843
-** added to the column cache after this call are removed when the
98844
-** corresponding pop occurs.
98845
-*/
98846
-SQLITE_PRIVATE void sqlite3ExprCachePush(Parse *pParse){
98847
- pParse->iCacheLevel++;
98848
-#ifdef SQLITE_DEBUG
98849
- if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
98850
- printf("PUSH to %d\n", pParse->iCacheLevel);
98851
- }
98852
-#endif
98853
-}
98854
-
98855
-/*
98856
-** Remove from the column cache any entries that were added since the
98857
-** the previous sqlite3ExprCachePush operation. In other words, restore
98858
-** the cache to the state it was in prior the most recent Push.
98859
-*/
98860
-SQLITE_PRIVATE void sqlite3ExprCachePop(Parse *pParse){
98861
- int i = 0;
98862
- assert( pParse->iCacheLevel>=1 );
98863
- pParse->iCacheLevel--;
98864
-#ifdef SQLITE_DEBUG
98865
- if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
98866
- printf("POP to %d\n", pParse->iCacheLevel);
98867
- }
98868
-#endif
98869
- while( i<pParse->nColCache ){
98870
- if( pParse->aColCache[i].iLevel>pParse->iCacheLevel ){
98871
- cacheEntryClear(pParse, i);
98872
- }else{
98873
- i++;
98874
- }
98875
- }
98876
-}
98877
-
98878
-/*
98879
-** When a cached column is reused, make sure that its register is
98880
-** no longer available as a temp register. ticket #3879: that same
98881
-** register might be in the cache in multiple places, so be sure to
98882
-** get them all.
98883
-*/
98884
-static void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){
98885
- int i;
98886
- struct yColCache *p;
98887
- for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
98888
- if( p->iReg==iReg ){
98889
- p->tempReg = 0;
98890
- }
98891
- }
98892
-}
9889398815
9889498816
/* Generate code that will load into register regOut a value that is
9889598817
** appropriate for the iIdxCol-th column of index pIdx.
9889698818
*/
9889798819
SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(
@@ -98943,16 +98865,11 @@
9894398865
}
9894498866
}
9894598867
9894698868
/*
9894798869
** Generate code that will extract the iColumn-th column from
98948
-** table pTab and store the column value in a register.
98949
-**
98950
-** An effort is made to store the column value in register iReg. This
98951
-** is not garanteeed for GetColumn() - the result can be stored in
98952
-** any register. But the result is guaranteed to land in register iReg
98953
-** for GetColumnToReg().
98870
+** table pTab and store the column value in register iReg.
9895498871
**
9895598872
** There must be an open cursor to pTab in iTable when this routine
9895698873
** is called. If iColumn<0 then code is generated that extracts the rowid.
9895798874
*/
9895898875
SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(
@@ -98962,102 +98879,26 @@
9896298879
int iTable, /* The cursor pointing to the table */
9896398880
int iReg, /* Store results here */
9896498881
u8 p5 /* P5 value for OP_Column + FLAGS */
9896598882
){
9896698883
Vdbe *v = pParse->pVdbe;
98967
- int i;
98968
- struct yColCache *p;
98969
-
98970
- for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
98971
- if( p->iTable==iTable && p->iColumn==iColumn ){
98972
- p->lru = pParse->iCacheCnt++;
98973
- sqlite3ExprCachePinRegister(pParse, p->iReg);
98974
-#ifdef SQLITE_DEBUG_COLUMNCACHE
98975
- sqlite3VdbeAddOp3(v, OP_VerifyTabCol, iTable, iColumn, p->iReg);
98976
-#endif
98977
- return p->iReg;
98978
- }
98979
- }
9898098884
assert( v!=0 );
9898198885
sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg);
9898298886
if( p5 ){
9898398887
sqlite3VdbeChangeP5(v, p5);
98984
- }else{
98985
- sqlite3ExprCacheStore(pParse, iTable, iColumn, iReg);
9898698888
}
9898798889
return iReg;
9898898890
}
98989
-SQLITE_PRIVATE void sqlite3ExprCodeGetColumnToReg(
98990
- Parse *pParse, /* Parsing and code generating context */
98991
- Table *pTab, /* Description of the table we are reading from */
98992
- int iColumn, /* Index of the table column */
98993
- int iTable, /* The cursor pointing to the table */
98994
- int iReg /* Store results here */
98995
-){
98996
- int r1 = sqlite3ExprCodeGetColumn(pParse, pTab, iColumn, iTable, iReg, 0);
98997
- if( r1!=iReg ) sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, r1, iReg);
98998
-}
98999
-
99000
-
99001
-/*
99002
-** Clear all column cache entries.
99003
-*/
99004
-SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
99005
- int i;
99006
-
99007
-#ifdef SQLITE_DEBUG
99008
- if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
99009
- printf("CLEAR\n");
99010
- }
99011
-#endif
99012
- for(i=0; i<pParse->nColCache; i++){
99013
- if( pParse->aColCache[i].tempReg
99014
- && pParse->nTempReg<ArraySize(pParse->aTempReg)
99015
- ){
99016
- pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;
99017
- }
99018
- }
99019
- pParse->nColCache = 0;
99020
-}
99021
-
99022
-/*
99023
-** Record the fact that an affinity change has occurred on iCount
99024
-** registers starting with iStart.
99025
-*/
99026
-SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse *pParse, int iStart, int iCount){
99027
- sqlite3ExprCacheRemove(pParse, iStart, iCount);
99028
-}
9902998891
9903098892
/*
9903198893
** Generate code to move content from registers iFrom...iFrom+nReg-1
99032
-** over to iTo..iTo+nReg-1. Keep the column cache up-to-date.
98894
+** over to iTo..iTo+nReg-1.
9903398895
*/
9903498896
SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){
9903598897
assert( iFrom>=iTo+nReg || iFrom+nReg<=iTo );
9903698898
sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg);
99037
- sqlite3ExprCacheRemove(pParse, iFrom, nReg);
99038
-}
99039
-
99040
-#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
99041
-/*
99042
-** Return true if any register in the range iFrom..iTo (inclusive)
99043
-** is used as part of the column cache.
99044
-**
99045
-** This routine is used within assert() and testcase() macros only
99046
-** and does not appear in a normal build.
99047
-*/
99048
-static int usedAsColumnCache(Parse *pParse, int iFrom, int iTo){
99049
- int i;
99050
- struct yColCache *p;
99051
- for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
99052
- int r = p->iReg;
99053
- if( r>=iFrom && r<=iTo ) return 1; /*NO_TEST*/
99054
- }
99055
- return 0;
99056
-}
99057
-#endif /* SQLITE_DEBUG || SQLITE_COVERAGE_TEST */
99058
-
98899
+}
9905998900
9906098901
/*
9906198902
** Convert a scalar expression node to a TK_REGISTER referencing
9906298903
** register iReg. The caller must ensure that iReg already contains
9906398904
** the correct value for the expression.
@@ -99152,10 +98993,32 @@
9915298993
}
9915398994
/* Otherwise, fall thru into the TK_COLUMN case */
9915498995
}
9915598996
case TK_COLUMN: {
9915698997
int iTab = pExpr->iTable;
98998
+ if( ExprHasProperty(pExpr, EP_FixedCol) ){
98999
+ /* This COLUMN expression is really a constant due to WHERE clause
99000
+ ** constraints, and that constant is coded by the pExpr->pLeft
99001
+ ** expresssion. However, make sure the constant has the correct
99002
+ ** datatype by applying the Affinity of the table column to the
99003
+ ** constant.
99004
+ */
99005
+ int iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target);
99006
+ int aff = sqlite3TableColumnAffinity(pExpr->pTab, pExpr->iColumn);
99007
+ if( aff!=SQLITE_AFF_BLOB ){
99008
+ static const char zAff[] = "B\000C\000D\000E";
99009
+ assert( SQLITE_AFF_BLOB=='A' );
99010
+ assert( SQLITE_AFF_TEXT=='B' );
99011
+ if( iReg!=target ){
99012
+ sqlite3VdbeAddOp2(v, OP_SCopy, iReg, target);
99013
+ iReg = target;
99014
+ }
99015
+ sqlite3VdbeAddOp4(v, OP_Affinity, iReg, 1, 0,
99016
+ &zAff[(aff-'B')*2], P4_STATIC);
99017
+ }
99018
+ return iReg;
99019
+ }
9915799020
if( iTab<0 ){
9915899021
if( pParse->iSelfTab<0 ){
9915999022
/* Generating CHECK constraints or inserting into partial index */
9916099023
return pExpr->iColumn - pParse->iSelfTab;
9916199024
}else{
@@ -99232,12 +99095,10 @@
9923299095
sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
9923399096
inReg = target;
9923499097
}
9923599098
sqlite3VdbeAddOp2(v, OP_Cast, target,
9923699099
sqlite3AffinityType(pExpr->u.zToken, 0));
99237
- testcase( usedAsColumnCache(pParse, inReg, inReg) );
99238
- sqlite3ExprCacheAffinityChange(pParse, inReg, 1);
9923999100
return inReg;
9924099101
}
9924199102
#endif /* SQLITE_OMIT_CAST */
9924299103
case TK_IS:
9924399104
case TK_ISNOT:
@@ -99419,14 +99280,11 @@
9941999280
assert( nFarg>=2 );
9942099281
sqlite3ExprCode(pParse, pFarg->a[0].pExpr, target);
9942199282
for(i=1; i<nFarg; i++){
9942299283
sqlite3VdbeAddOp2(v, OP_NotNull, target, endCoalesce);
9942399284
VdbeCoverage(v);
99424
- sqlite3ExprCacheRemove(pParse, target, 1);
99425
- sqlite3ExprCachePush(pParse);
9942699285
sqlite3ExprCode(pParse, pFarg->a[i].pExpr, target);
99427
- sqlite3ExprCachePop(pParse);
9942899286
}
9942999287
sqlite3VdbeResolveLabel(v, endCoalesce);
9943099288
break;
9943199289
}
9943299290
@@ -99488,14 +99346,12 @@
9948899346
pFarg->a[0].pExpr->op2 =
9948999347
pDef->funcFlags & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG);
9949099348
}
9949199349
}
9949299350
99493
- sqlite3ExprCachePush(pParse); /* Ticket 2ea2425d34be */
9949499351
sqlite3ExprCodeExprList(pParse, pFarg, r1, 0,
9949599352
SQLITE_ECEL_DUP|SQLITE_ECEL_FACTOR);
99496
- sqlite3ExprCachePop(pParse); /* Ticket 2ea2425d34be */
9949799353
}else{
9949899354
r1 = 0;
9949999355
}
9950099356
#ifndef SQLITE_OMIT_VIRTUALTABLE
9950199357
/* Possibly overload the function if the first argument is
@@ -99664,13 +99520,11 @@
9966499520
}
9966599521
9966699522
case TK_IF_NULL_ROW: {
9966799523
int addrINR;
9966899524
addrINR = sqlite3VdbeAddOp1(v, OP_IfNullRow, pExpr->iTable);
99669
- sqlite3ExprCachePush(pParse);
9967099525
inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
99671
- sqlite3ExprCachePop(pParse);
9967299526
sqlite3VdbeJumpHere(v, addrINR);
9967399527
sqlite3VdbeChangeP3(v, addrINR, inReg);
9967499528
break;
9967599529
}
9967699530
@@ -99703,11 +99557,10 @@
9970399557
ExprList *pEList; /* List of WHEN terms */
9970499558
struct ExprList_item *aListelem; /* Array of WHEN terms */
9970599559
Expr opCompare; /* The X==Ei expression */
9970699560
Expr *pX; /* The X expression */
9970799561
Expr *pTest = 0; /* X==Ei (form A) or just Ei (form B) */
99708
- VVA_ONLY( int iCacheLevel = pParse->iCacheLevel; )
9970999562
9971099563
assert( !ExprHasProperty(pExpr, EP_xIsSelect) && pExpr->x.pList );
9971199564
assert(pExpr->x.pList->nExpr > 0);
9971299565
pEList = pExpr->x.pList;
9971399566
aListelem = pEList->a;
@@ -99727,11 +99580,10 @@
9972799580
** So make sure that the regFree1 register is not reused for other
9972899581
** purposes and possibly overwritten. */
9972999582
regFree1 = 0;
9973099583
}
9973199584
for(i=0; i<nExpr-1; i=i+2){
99732
- sqlite3ExprCachePush(pParse);
9973399585
if( pX ){
9973499586
assert( pTest!=0 );
9973599587
opCompare.pRight = aListelem[i].pExpr;
9973699588
}else{
9973799589
pTest = aListelem[i].pExpr;
@@ -99740,22 +99592,17 @@
9974099592
testcase( pTest->op==TK_COLUMN );
9974199593
sqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL);
9974299594
testcase( aListelem[i+1].pExpr->op==TK_COLUMN );
9974399595
sqlite3ExprCode(pParse, aListelem[i+1].pExpr, target);
9974499596
sqlite3VdbeGoto(v, endLabel);
99745
- sqlite3ExprCachePop(pParse);
9974699597
sqlite3VdbeResolveLabel(v, nextCase);
9974799598
}
9974899599
if( (nExpr&1)!=0 ){
99749
- sqlite3ExprCachePush(pParse);
9975099600
sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target);
99751
- sqlite3ExprCachePop(pParse);
9975299601
}else{
9975399602
sqlite3VdbeAddOp2(v, OP_Null, 0, target);
9975499603
}
99755
- assert( pParse->db->mallocFailed || pParse->nErr>0
99756
- || pParse->iCacheLevel==iCacheLevel );
9975799604
sqlite3VdbeResolveLabel(v, endLabel);
9975899605
break;
9975999606
}
9976099607
#ifndef SQLITE_OMIT_TRIGGER
9976199608
case TK_RAISE: {
@@ -99901,11 +99748,11 @@
9990199748
** results in register target. The results are guaranteed to appear
9990299749
** in register target. If the expression is constant, then this routine
9990399750
** might choose to code the expression at initialization time.
9990499751
*/
9990599752
SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){
99906
- if( pParse->okConstFactor && sqlite3ExprIsConstant(pExpr) ){
99753
+ if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pExpr) ){
9990799754
sqlite3ExprCodeAtInit(pParse, pExpr, target);
9990899755
}else{
9990999756
sqlite3ExprCode(pParse, pExpr, target);
9991099757
}
9991199758
}
@@ -99983,11 +99830,13 @@
9998399830
i--;
9998499831
n--;
9998599832
}else{
9998699833
sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i);
9998799834
}
99988
- }else if( (flags & SQLITE_ECEL_FACTOR)!=0 && sqlite3ExprIsConstant(pExpr) ){
99835
+ }else if( (flags & SQLITE_ECEL_FACTOR)!=0
99836
+ && sqlite3ExprIsConstantNotJoin(pExpr)
99837
+ ){
9998999838
sqlite3ExprCodeAtInit(pParse, pExpr, target+i);
9999099839
}else{
9999199840
int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);
9999299841
if( inReg!=target+i ){
9999399842
VdbeOp *pOp;
@@ -100109,22 +99958,18 @@
10010999958
switch( op ){
10011099959
case TK_AND: {
10011199960
int d2 = sqlite3VdbeMakeLabel(v);
10011299961
testcase( jumpIfNull==0 );
10011399962
sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL);
100114
- sqlite3ExprCachePush(pParse);
10011599963
sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
10011699964
sqlite3VdbeResolveLabel(v, d2);
100117
- sqlite3ExprCachePop(pParse);
10011899965
break;
10011999966
}
10012099967
case TK_OR: {
10012199968
testcase( jumpIfNull==0 );
10012299969
sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
100123
- sqlite3ExprCachePush(pParse);
10012499970
sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
100125
- sqlite3ExprCachePop(pParse);
10012699971
break;
10012799972
}
10012899973
case TK_NOT: {
10012999974
testcase( jumpIfNull==0 );
10013099975
sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
@@ -100279,23 +100124,19 @@
100279100124
100280100125
switch( pExpr->op ){
100281100126
case TK_AND: {
100282100127
testcase( jumpIfNull==0 );
100283100128
sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
100284
- sqlite3ExprCachePush(pParse);
100285100129
sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
100286
- sqlite3ExprCachePop(pParse);
100287100130
break;
100288100131
}
100289100132
case TK_OR: {
100290100133
int d2 = sqlite3VdbeMakeLabel(v);
100291100134
testcase( jumpIfNull==0 );
100292100135
sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL);
100293
- sqlite3ExprCachePush(pParse);
100294100136
sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
100295100137
sqlite3VdbeResolveLabel(v, d2);
100296
- sqlite3ExprCachePop(pParse);
100297100138
break;
100298100139
}
100299100140
case TK_NOT: {
100300100141
testcase( jumpIfNull==0 );
100301100142
sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
@@ -100513,11 +100354,12 @@
100513100354
}
100514100355
}
100515100356
if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;
100516100357
if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){
100517100358
if( combinedFlags & EP_xIsSelect ) return 2;
100518
- if( sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2;
100359
+ if( (combinedFlags & EP_FixedCol)==0
100360
+ && sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2;
100519100361
if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2;
100520100362
if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
100521100363
assert( (combinedFlags & EP_Reduced)==0 );
100522100364
if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){
100523100365
if( pA->iColumn!=pB->iColumn ) return 2;
@@ -101058,25 +100900,13 @@
101058100900
}
101059100901
101060100902
/*
101061100903
** Deallocate a register, making available for reuse for some other
101062100904
** purpose.
101063
-**
101064
-** If a register is currently being used by the column cache, then
101065
-** the deallocation is deferred until the column cache line that uses
101066
-** the register becomes stale.
101067100905
*/
101068100906
SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
101069100907
if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
101070
- int i;
101071
- struct yColCache *p;
101072
- for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
101073
- if( p->iReg==iReg ){
101074
- p->tempReg = 1;
101075
- return;
101076
- }
101077
- }
101078100908
pParse->aTempReg[pParse->nTempReg++] = iReg;
101079100909
}
101080100910
}
101081100911
101082100912
/*
@@ -101086,11 +100916,10 @@
101086100916
int i, n;
101087100917
if( nReg==1 ) return sqlite3GetTempReg(pParse);
101088100918
i = pParse->iRangeReg;
101089100919
n = pParse->nRangeReg;
101090100920
if( nReg<=n ){
101091
- assert( !usedAsColumnCache(pParse, i, i+n-1) );
101092100921
pParse->iRangeReg += nReg;
101093100922
pParse->nRangeReg -= nReg;
101094100923
}else{
101095100924
i = pParse->nMem+1;
101096100925
pParse->nMem += nReg;
@@ -101100,11 +100929,10 @@
101100100929
SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){
101101100930
if( nReg==1 ){
101102100931
sqlite3ReleaseTempReg(pParse, iReg);
101103100932
return;
101104100933
}
101105
- sqlite3ExprCacheRemove(pParse, iReg, nReg);
101106100934
if( nReg>pParse->nRangeReg ){
101107100935
pParse->nRangeReg = nReg;
101108100936
pParse->iRangeReg = iReg;
101109100937
}
101110100938
}
@@ -105020,11 +104848,10 @@
105020104848
105021104849
105022104850
/* Get the VDBE program ready for execution
105023104851
*/
105024104852
if( v && pParse->nErr==0 && !db->mallocFailed ){
105025
- assert( pParse->iCacheLevel==0 ); /* Disables and re-enables match */
105026104853
/* A minimum of one cursor is required if autoincrement is used
105027104854
* See ticket [a696379c1f08866] */
105028104855
if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1;
105029104856
sqlite3VdbeMakeReady(v, pParse);
105030104857
pParse->rc = SQLITE_DONE;
@@ -107457,12 +107284,14 @@
107457107284
** on disk.
107458107285
*/
107459107286
v = sqlite3GetVdbe(pParse);
107460107287
if( v ){
107461107288
sqlite3BeginWriteOperation(pParse, 1, iDb);
107462
- sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName);
107463
- sqlite3FkDropTable(pParse, pName, pTab);
107289
+ if( !isView ){
107290
+ sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName);
107291
+ sqlite3FkDropTable(pParse, pName, pTab);
107292
+ }
107464107293
sqlite3CodeDropTable(pParse, pTab, iDb, isView);
107465107294
}
107466107295
107467107296
exit_drop_table:
107468107297
sqlite3SrcListDelete(db, pName);
@@ -110279,13 +110108,12 @@
110279110108
sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur,
110280110109
pPk->aiColumn[i], iPk+i);
110281110110
}
110282110111
iKey = iPk;
110283110112
}else{
110284
- iKey = pParse->nMem + 1;
110285
- iKey = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iTabCur, iKey, 0);
110286
- if( iKey>pParse->nMem ) pParse->nMem = iKey;
110113
+ iKey = ++pParse->nMem;
110114
+ sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, -1, iKey);
110287110115
}
110288110116
110289110117
if( eOnePass!=ONEPASS_OFF ){
110290110118
/* For ONEPASS, no need to store the rowid/primary-key. There is only
110291110119
** one, so just keep it in its register(s) and fall through to the
@@ -110714,11 +110542,10 @@
110714110542
110715110543
if( piPartIdxLabel ){
110716110544
if( pIdx->pPartIdxWhere ){
110717110545
*piPartIdxLabel = sqlite3VdbeMakeLabel(v);
110718110546
pParse->iSelfTab = iDataCur + 1;
110719
- sqlite3ExprCachePush(pParse);
110720110547
sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel,
110721110548
SQLITE_JUMPIFNULL);
110722110549
pParse->iSelfTab = 0;
110723110550
}else{
110724110551
*piPartIdxLabel = 0;
@@ -110761,11 +110588,10 @@
110761110588
** resolve that label.
110762110589
*/
110763110590
SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel){
110764110591
if( iLabel ){
110765110592
sqlite3VdbeResolveLabel(pParse->pVdbe, iLabel);
110766
- sqlite3ExprCachePop(pParse);
110767110593
}
110768110594
}
110769110595
110770110596
/************** End of delete.c **********************************************/
110771110597
/************** Begin file func.c ********************************************/
@@ -113500,15 +113326,16 @@
113500113326
** the table from the database. Triggers are disabled while running this
113501113327
** DELETE, but foreign key actions are not.
113502113328
*/
113503113329
SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){
113504113330
sqlite3 *db = pParse->db;
113505
- if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) && !pTab->pSelect ){
113331
+ if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) ){
113506113332
int iSkip = 0;
113507113333
Vdbe *v = sqlite3GetVdbe(pParse);
113508113334
113509113335
assert( v ); /* VDBE has already been allocated */
113336
+ assert( pTab->pSelect==0 ); /* Not a view */
113510113337
if( sqlite3FkReferences(pTab)==0 ){
113511113338
/* Search for a deferred foreign key constraint for which this table
113512113339
** is the child table. If one cannot be found, return without
113513113340
** generating any VDBE code. If one can be found, then jump over
113514113341
** the entire DELETE if there are no outstanding deferred constraints
@@ -115399,48 +115226,10 @@
115399115226
testcase( w.eCode==CKCNSTRNT_ROWID );
115400115227
testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
115401115228
return !w.eCode;
115402115229
}
115403115230
115404
-/*
115405
-** An instance of the ConstraintAddr object remembers the byte-code addresses
115406
-** for sections of the constraint checks that deal with uniqueness constraints
115407
-** on the rowid and on the upsert constraint.
115408
-**
115409
-** This information is passed into checkReorderConstraintChecks() to insert
115410
-** some OP_Goto operations so that the rowid and upsert constraints occur
115411
-** in the correct order relative to other constraints.
115412
-*/
115413
-typedef struct ConstraintAddr ConstraintAddr;
115414
-struct ConstraintAddr {
115415
- int ipkTop; /* Subroutine for rowid constraint check */
115416
- int upsertTop; /* Label for upsert constraint check subroutine */
115417
- int upsertTop2; /* Copy of upsertTop not cleared by the call */
115418
- int upsertBtm; /* upsert constraint returns to this label */
115419
- int ipkBtm; /* Return opcode rowid constraint check */
115420
-};
115421
-
115422
-/*
115423
-** Generate any OP_Goto operations needed to cause constraints to be
115424
-** run that haven't already been run.
115425
-*/
115426
-static void reorderConstraintChecks(Vdbe *v, ConstraintAddr *p){
115427
- if( p->upsertTop ){
115428
- testcase( sqlite3VdbeLabelHasBeenResolved(v, p->upsertTop) );
115429
- sqlite3VdbeGoto(v, p->upsertTop);
115430
- VdbeComment((v, "call upsert subroutine"));
115431
- sqlite3VdbeResolveLabel(v, p->upsertBtm);
115432
- p->upsertTop = 0;
115433
- }
115434
- if( p->ipkTop ){
115435
- sqlite3VdbeGoto(v, p->ipkTop);
115436
- VdbeComment((v, "call rowid unique-check subroutine"));
115437
- sqlite3VdbeJumpHere(v, p->ipkBtm);
115438
- p->ipkTop = 0;
115439
- }
115440
-}
115441
-
115442115231
/*
115443115232
** Generate code to do constraint checks prior to an INSERT or an UPDATE
115444115233
** on table pTab.
115445115234
**
115446115235
** The regNewData parameter is the first register in a range that contains
@@ -115546,23 +115335,24 @@
115546115335
int nCol; /* Number of columns */
115547115336
int onError; /* Conflict resolution strategy */
115548115337
int addr1; /* Address of jump instruction */
115549115338
int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
115550115339
int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
115551
- ConstraintAddr sAddr;/* Address information for constraint reordering */
115552115340
Index *pUpIdx = 0; /* Index to which to apply the upsert */
115553115341
u8 isUpdate; /* True if this is an UPDATE operation */
115554115342
u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */
115555115343
int upsertBypass = 0; /* Address of Goto to bypass upsert subroutine */
115344
+ int upsertJump = 0; /* Address of Goto that jumps into upsert subroutine */
115345
+ int ipkTop = 0; /* Top of the IPK uniqueness check */
115346
+ int ipkBottom = 0; /* OP_Goto at the end of the IPK uniqueness check */
115556115347
115557115348
isUpdate = regOldData!=0;
115558115349
db = pParse->db;
115559115350
v = sqlite3GetVdbe(pParse);
115560115351
assert( v!=0 );
115561115352
assert( pTab->pSelect==0 ); /* This table is not a VIEW */
115562115353
nCol = pTab->nCol;
115563
- memset(&sAddr, 0, sizeof(sAddr));
115564115354
115565115355
/* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for
115566115356
** normal rowid tables. nPkField is the number of key fields in the
115567115357
** pPk index or 1 for a rowid table. In other words, nPkField is the
115568115358
** number of fields in the true primary key of the table. */
@@ -115662,19 +115452,24 @@
115662115452
#endif /* !defined(SQLITE_OMIT_CHECK) */
115663115453
115664115454
/* UNIQUE and PRIMARY KEY constraints should be handled in the following
115665115455
** order:
115666115456
**
115667
- ** (1) OE_Abort, OE_Fail, OE_Rollback, OE_Ignore
115668
- ** (2) OE_Update
115457
+ ** (1) OE_Update
115458
+ ** (2) OE_Abort, OE_Fail, OE_Rollback, OE_Ignore
115669115459
** (3) OE_Replace
115670115460
**
115671115461
** OE_Fail and OE_Ignore must happen before any changes are made.
115672115462
** OE_Update guarantees that only a single row will change, so it
115673115463
** must happen before OE_Replace. Technically, OE_Abort and OE_Rollback
115674115464
** could happen in any order, but they are grouped up front for
115675115465
** convenience.
115466
+ **
115467
+ ** 2018-08-14: Ticket https://www.sqlite.org/src/info/908f001483982c43
115468
+ ** The order of constraints used to have OE_Update as (2) and OE_Abort
115469
+ ** and so forth as (1). But apparently PostgreSQL checks the OE_Update
115470
+ ** constraint before any others, so it had to be moved.
115676115471
**
115677115472
** Constraint checking code is generated in this order:
115678115473
** (A) The rowid constraint
115679115474
** (B) Unique index constraints that do not have OE_Replace as their
115680115475
** default conflict resolution strategy
@@ -115691,15 +115486,14 @@
115691115486
** Make all unique constraint resolution be OE_Ignore */
115692115487
assert( pUpsert->pUpsertSet==0 );
115693115488
overrideError = OE_Ignore;
115694115489
pUpsert = 0;
115695115490
}else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){
115696
- /* If the constraint-target is on some column other than
115697
- ** then ROWID, then we might need to move the UPSERT around
115698
- ** so that it occurs in the correct order. */
115699
- sAddr.upsertTop = sAddr.upsertTop2 = sqlite3VdbeMakeLabel(v);
115700
- sAddr.upsertBtm = sqlite3VdbeMakeLabel(v);
115491
+ /* If the constraint-target uniqueness check must be run first.
115492
+ ** Jump to that uniqueness check now */
115493
+ upsertJump = sqlite3VdbeAddOp0(v, OP_Goto);
115494
+ VdbeComment((v, "UPSERT constraint goes first"));
115701115495
}
115702115496
}
115703115497
115704115498
/* If rowid is changing, make sure the new rowid does not previously
115705115499
** exist in the table.
@@ -115727,20 +115521,16 @@
115727115521
/* If the response to a rowid conflict is REPLACE but the response
115728115522
** to some other UNIQUE constraint is FAIL or IGNORE, then we need
115729115523
** to defer the running of the rowid conflict checking until after
115730115524
** the UNIQUE constraints have run.
115731115525
*/
115732
- assert( OE_Update>OE_Replace );
115733
- assert( OE_Ignore<OE_Replace );
115734
- assert( OE_Fail<OE_Replace );
115735
- assert( OE_Abort<OE_Replace );
115736
- assert( OE_Rollback<OE_Replace );
115737
- if( onError>=OE_Replace
115738
- && (pUpsert || onError!=overrideError)
115739
- && pTab->pIndex
115526
+ if( onError==OE_Replace /* IPK rule is REPLACE */
115527
+ && onError!=overrideError /* Rules for other contraints are different */
115528
+ && pTab->pIndex /* There exist other constraints */
115740115529
){
115741
- sAddr.ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
115530
+ ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
115531
+ VdbeComment((v, "defer IPK REPLACE until last"));
115742115532
}
115743115533
115744115534
if( isUpdate ){
115745115535
/* pkChng!=0 does not mean that the rowid has changed, only that
115746115536
** it might have changed. Skip the conflict logic below if the rowid
@@ -115754,11 +115544,10 @@
115754115544
** the following conflict logic if it does not. */
115755115545
VdbeNoopComment((v, "uniqueness check for ROWID"));
115756115546
sqlite3VdbeVerifyAbortable(v, onError);
115757115547
sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData);
115758115548
VdbeCoverage(v);
115759
- sqlite3ExprCachePush(pParse);
115760115549
115761115550
switch( onError ){
115762115551
default: {
115763115552
onError = OE_Abort;
115764115553
/* Fall thru into the next case */
@@ -115831,15 +115620,14 @@
115831115620
testcase( onError==OE_Ignore );
115832115621
sqlite3VdbeGoto(v, ignoreDest);
115833115622
break;
115834115623
}
115835115624
}
115836
- sqlite3ExprCachePop(pParse);
115837115625
sqlite3VdbeResolveLabel(v, addrRowidOk);
115838
- if( sAddr.ipkTop ){
115839
- sAddr.ipkBtm = sqlite3VdbeAddOp0(v, OP_Goto);
115840
- sqlite3VdbeJumpHere(v, sAddr.ipkTop-1);
115626
+ if( ipkTop ){
115627
+ ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);
115628
+ sqlite3VdbeJumpHere(v, ipkTop-1);
115841115629
}
115842115630
}
115843115631
115844115632
/* Test all UNIQUE constraints by creating entries for each UNIQUE
115845115633
** index and making sure that duplicate entries do not already exist.
@@ -115853,21 +115641,21 @@
115853115641
int regR; /* Range of registers holding conflicting PK */
115854115642
int iThisCur; /* Cursor for this UNIQUE index */
115855115643
int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */
115856115644
115857115645
if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */
115858
- if( bAffinityDone==0 ){
115859
- sqlite3TableAffinity(v, pTab, regNewData+1);
115860
- bAffinityDone = 1;
115861
- }
115862115646
if( pUpIdx==pIdx ){
115863
- addrUniqueOk = sAddr.upsertBtm;
115647
+ addrUniqueOk = upsertJump+1;
115864115648
upsertBypass = sqlite3VdbeGoto(v, 0);
115865115649
VdbeComment((v, "Skip upsert subroutine"));
115866
- sqlite3VdbeResolveLabel(v, sAddr.upsertTop2);
115650
+ sqlite3VdbeJumpHere(v, upsertJump);
115867115651
}else{
115868115652
addrUniqueOk = sqlite3VdbeMakeLabel(v);
115653
+ }
115654
+ if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){
115655
+ sqlite3TableAffinity(v, pTab, regNewData+1);
115656
+ bAffinityDone = 1;
115869115657
}
115870115658
VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName));
115871115659
iThisCur = iIdxCur+ix;
115872115660
115873115661
@@ -115936,19 +115724,10 @@
115936115724
}else{
115937115725
onError = OE_Update; /* DO UPDATE */
115938115726
}
115939115727
}
115940115728
115941
- /* Invoke subroutines to handle IPK replace and upsert prior to running
115942
- ** the first REPLACE constraint check. */
115943
- if( onError==OE_Replace ){
115944
- testcase( sAddr.ipkTop );
115945
- testcase( sAddr.upsertTop
115946
- && sqlite3VdbeLabelHasBeenResolved(v,sAddr.upsertTop) );
115947
- reorderConstraintChecks(v, &sAddr);
115948
- }
115949
-
115950115729
/* Collision detection may be omitted if all of the following are true:
115951115730
** (1) The conflict resolution algorithm is REPLACE
115952115731
** (2) The table is a WITHOUT ROWID table
115953115732
** (3) There are no secondary indexes on the table
115954115733
** (4) No delete triggers need to be fired if there is a conflict
@@ -115965,11 +115744,10 @@
115965115744
sqlite3VdbeResolveLabel(v, addrUniqueOk);
115966115745
continue;
115967115746
}
115968115747
115969115748
/* Check to see if the new index entry will be unique */
115970
- sqlite3ExprCachePush(pParse);
115971115749
sqlite3VdbeVerifyAbortable(v, onError);
115972115750
sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
115973115751
regIdx, pIdx->nKeyCol); VdbeCoverage(v);
115974115752
115975115753
/* Generate code to handle collisions */
@@ -116067,23 +115845,25 @@
116067115845
seenReplace = 1;
116068115846
break;
116069115847
}
116070115848
}
116071115849
if( pUpIdx==pIdx ){
115850
+ sqlite3VdbeGoto(v, upsertJump+1);
116072115851
sqlite3VdbeJumpHere(v, upsertBypass);
116073115852
}else{
116074115853
sqlite3VdbeResolveLabel(v, addrUniqueOk);
116075115854
}
116076
- sqlite3ExprCachePop(pParse);
116077115855
if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
115856
+ }
116078115857
115858
+ /* If the IPK constraint is a REPLACE, run it last */
115859
+ if( ipkTop ){
115860
+ sqlite3VdbeGoto(v, ipkTop+1);
115861
+ VdbeComment((v, "Do IPK REPLACE"));
115862
+ sqlite3VdbeJumpHere(v, ipkBottom);
116079115863
}
116080
- testcase( sAddr.ipkTop!=0 );
116081
- testcase( sAddr.upsertTop
116082
- && sqlite3VdbeLabelHasBeenResolved(v,sAddr.upsertTop) );
116083
- reorderConstraintChecks(v, &sAddr);
116084
-
115864
+
116085115865
*pbMayReplace = seenReplace;
116086115866
VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace));
116087115867
}
116088115868
116089115869
#ifdef SQLITE_ENABLE_NULL_TRIM
@@ -116175,11 +115955,10 @@
116175115955
regRec = sqlite3GetTempReg(pParse);
116176115956
sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);
116177115957
sqlite3SetMakeRecordP5(v, pTab);
116178115958
if( !bAffinityDone ){
116179115959
sqlite3TableAffinity(v, pTab, 0);
116180
- sqlite3ExprCacheAffinityChange(pParse, regData, pTab->nCol);
116181115960
}
116182115961
if( pParse->nested ){
116183115962
pik_flags = 0;
116184115963
}else{
116185115964
pik_flags = OPFLAG_NCHANGE;
@@ -120462,11 +120241,10 @@
120462120241
int iDataCur, iIdxCur;
120463120242
int r1 = -1;
120464120243
120465120244
if( pTab->tnum<1 ) continue; /* Skip VIEWs or VIRTUAL TABLEs */
120466120245
pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
120467
- sqlite3ExprCacheClear(pParse);
120468120246
sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0,
120469120247
1, 0, &iDataCur, &iIdxCur);
120470120248
/* reg[7] counts the number of entries in the table.
120471120249
** reg[8+i] counts the number of entries in the i-th index
120472120250
*/
@@ -120505,11 +120283,10 @@
120505120283
int addrCkFault = sqlite3VdbeMakeLabel(v);
120506120284
int addrCkOk = sqlite3VdbeMakeLabel(v);
120507120285
char *zErr;
120508120286
int k;
120509120287
pParse->iSelfTab = iDataCur + 1;
120510
- sqlite3ExprCachePush(pParse);
120511120288
for(k=pCheck->nExpr-1; k>0; k--){
120512120289
sqlite3ExprIfFalse(pParse, pCheck->a[k].pExpr, addrCkFault, 0);
120513120290
}
120514120291
sqlite3ExprIfTrue(pParse, pCheck->a[0].pExpr, addrCkOk,
120515120292
SQLITE_JUMPIFNULL);
@@ -120518,11 +120295,10 @@
120518120295
zErr = sqlite3MPrintf(db, "CHECK constraint failed in %s",
120519120296
pTab->zName);
120520120297
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
120521120298
integrityCheckResultRow(v);
120522120299
sqlite3VdbeResolveLabel(v, addrCkOk);
120523
- sqlite3ExprCachePop(pParse);
120524120300
}
120525120301
sqlite3ExprListDelete(db, pCheck);
120526120302
}
120527120303
if( !isQuick ){ /* Omit the remaining tests for quick_check */
120528120304
/* Validate index entries for the current row */
@@ -123463,11 +123239,10 @@
123463123239
}else{
123464123240
int r1 = sqlite3GetTempReg(pParse);
123465123241
assert( sqlite3Strlen30(pDest->zAffSdst)==nResultCol );
123466123242
sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, nResultCol,
123467123243
r1, pDest->zAffSdst, nResultCol);
123468
- sqlite3ExprCacheAffinityChange(pParse, regResult, nResultCol);
123469123244
sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, regResult, nResultCol);
123470123245
sqlite3ReleaseTempReg(pParse, r1);
123471123246
}
123472123247
break;
123473123248
}
@@ -123507,11 +123282,10 @@
123507123282
nPrefixReg);
123508123283
}else if( eDest==SRT_Coroutine ){
123509123284
sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm);
123510123285
}else{
123511123286
sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nResultCol);
123512
- sqlite3ExprCacheAffinityChange(pParse, regResult, nResultCol);
123513123287
}
123514123288
break;
123515123289
}
123516123290
123517123291
#ifndef SQLITE_OMIT_CTE
@@ -123864,11 +123638,10 @@
123864123638
#ifndef SQLITE_OMIT_SUBQUERY
123865123639
case SRT_Set: {
123866123640
assert( nColumn==sqlite3Strlen30(pDest->zAffSdst) );
123867123641
sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, nColumn, regRowid,
123868123642
pDest->zAffSdst, nColumn);
123869
- sqlite3ExprCacheAffinityChange(pParse, regRow, nColumn);
123870123643
sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, regRowid, regRow, nColumn);
123871123644
break;
123872123645
}
123873123646
case SRT_Mem: {
123874123647
/* The LIMIT clause will terminate the loop for us */
@@ -123879,11 +123652,10 @@
123879123652
assert( eDest==SRT_Output || eDest==SRT_Coroutine );
123880123653
testcase( eDest==SRT_Output );
123881123654
testcase( eDest==SRT_Coroutine );
123882123655
if( eDest==SRT_Output ){
123883123656
sqlite3VdbeAddOp2(v, OP_ResultRow, pDest->iSdst, nColumn);
123884
- sqlite3ExprCacheAffinityChange(pParse, pDest->iSdst, nColumn);
123885123657
}else{
123886123658
sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm);
123887123659
}
123888123660
break;
123889123661
}
@@ -124480,11 +124252,10 @@
124480124252
** "LIMIT -1" always shows all rows. There is some
124481124253
** controversy about what the correct behavior should be.
124482124254
** The current implementation interprets "LIMIT 0" to mean
124483124255
** no rows.
124484124256
*/
124485
- sqlite3ExprCacheClear(pParse);
124486124257
if( pLimit ){
124487124258
assert( pLimit->op==TK_LIMIT );
124488124259
assert( pLimit->pLeft!=0 );
124489124260
p->iLimit = iLimit = ++pParse->nMem;
124490124261
v = sqlite3GetVdbe(pParse);
@@ -125266,11 +125037,10 @@
125266125037
int r1;
125267125038
testcase( pIn->nSdst>1 );
125268125039
r1 = sqlite3GetTempReg(pParse);
125269125040
sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst,
125270125041
r1, pDest->zAffSdst, pIn->nSdst);
125271
- sqlite3ExprCacheAffinityChange(pParse, pIn->iSdst, pIn->nSdst);
125272125042
sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pDest->iSDParm, r1,
125273125043
pIn->iSdst, pIn->nSdst);
125274125044
sqlite3ReleaseTempReg(pParse, r1);
125275125045
break;
125276125046
}
@@ -125309,11 +125079,10 @@
125309125079
** return the next row of result.
125310125080
*/
125311125081
default: {
125312125082
assert( pDest->eDest==SRT_Output );
125313125083
sqlite3VdbeAddOp2(v, OP_ResultRow, pIn->iSdst, pIn->nSdst);
125314
- sqlite3ExprCacheAffinityChange(pParse, pIn->iSdst, pIn->nSdst);
125315125084
break;
125316125085
}
125317125086
}
125318125087
125319125088
/* Jump to the end of the loop if the LIMIT is reached.
@@ -125764,11 +125533,11 @@
125764125533
}else{
125765125534
Expr *pNew;
125766125535
Expr *pCopy = pSubst->pEList->a[pExpr->iColumn].pExpr;
125767125536
Expr ifNullRow;
125768125537
assert( pSubst->pEList!=0 && pExpr->iColumn<pSubst->pEList->nExpr );
125769
- assert( pExpr->pLeft==0 && pExpr->pRight==0 );
125538
+ assert( pExpr->pRight==0 );
125770125539
if( sqlite3ExprIsVector(pCopy) ){
125771125540
sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
125772125541
}else{
125773125542
sqlite3 *db = pSubst->pParse->db;
125774125543
if( pSubst->isLeftJoin && pCopy->op!=TK_COLUMN ){
@@ -126388,11 +126157,172 @@
126388126157
126389126158
return 1;
126390126159
}
126391126160
#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
126392126161
126162
+/*
126163
+** A structure to keep track of all of the column values that fixed to
126164
+** a known value due to WHERE clause constraints of the form COLUMN=VALUE.
126165
+*/
126166
+typedef struct WhereConst WhereConst;
126167
+struct WhereConst {
126168
+ Parse *pParse; /* Parsing context */
126169
+ int nConst; /* Number for COLUMN=CONSTANT terms */
126170
+ int nChng; /* Number of times a constant is propagated */
126171
+ Expr **apExpr; /* [i*2] is COLUMN and [i*2+1] is VALUE */
126172
+};
126393126173
126174
+/*
126175
+** Add a new entry to the pConst object
126176
+*/
126177
+static void constInsert(
126178
+ WhereConst *pConst,
126179
+ Expr *pColumn,
126180
+ Expr *pValue
126181
+){
126182
+
126183
+ pConst->nConst++;
126184
+ pConst->apExpr = sqlite3DbReallocOrFree(pConst->pParse->db, pConst->apExpr,
126185
+ pConst->nConst*2*sizeof(Expr*));
126186
+ if( pConst->apExpr==0 ){
126187
+ pConst->nConst = 0;
126188
+ }else{
126189
+ if( ExprHasProperty(pValue, EP_FixedCol) ) pValue = pValue->pLeft;
126190
+ pConst->apExpr[pConst->nConst*2-2] = pColumn;
126191
+ pConst->apExpr[pConst->nConst*2-1] = pValue;
126192
+ }
126193
+}
126194
+
126195
+/*
126196
+** Find all terms of COLUMN=VALUE or VALUE=COLUMN in pExpr where VALUE
126197
+** is a constant expression and where the term must be true because it
126198
+** is part of the AND-connected terms of the expression. For each term
126199
+** found, add it to the pConst structure.
126200
+*/
126201
+static void findConstInWhere(WhereConst *pConst, Expr *pExpr){
126202
+ Expr *pRight, *pLeft;
126203
+ if( pExpr==0 ) return;
126204
+ if( ExprHasProperty(pExpr, EP_FromJoin) ) return;
126205
+ if( pExpr->op==TK_AND ){
126206
+ findConstInWhere(pConst, pExpr->pRight);
126207
+ findConstInWhere(pConst, pExpr->pLeft);
126208
+ return;
126209
+ }
126210
+ if( pExpr->op!=TK_EQ ) return;
126211
+ pRight = pExpr->pRight;
126212
+ pLeft = pExpr->pLeft;
126213
+ assert( pRight!=0 );
126214
+ assert( pLeft!=0 );
126215
+ if( pRight->op==TK_COLUMN
126216
+ && !ExprHasProperty(pRight, EP_FixedCol)
126217
+ && sqlite3ExprIsConstant(pLeft)
126218
+ && sqlite3IsBinary(sqlite3BinaryCompareCollSeq(pConst->pParse,pLeft,pRight))
126219
+ ){
126220
+ constInsert(pConst, pRight, pLeft);
126221
+ }else
126222
+ if( pLeft->op==TK_COLUMN
126223
+ && !ExprHasProperty(pLeft, EP_FixedCol)
126224
+ && sqlite3ExprIsConstant(pRight)
126225
+ && sqlite3IsBinary(sqlite3BinaryCompareCollSeq(pConst->pParse,pLeft,pRight))
126226
+ ){
126227
+ constInsert(pConst, pLeft, pRight);
126228
+ }
126229
+}
126230
+
126231
+/*
126232
+** This is a Walker expression callback. pExpr is a candidate expression
126233
+** to be replaced by a value. If pExpr is equivalent to one of the
126234
+** columns named in pWalker->u.pConst, then overwrite it with its
126235
+** corresponding value.
126236
+*/
126237
+static int propagateConstantExprRewrite(Walker *pWalker, Expr *pExpr){
126238
+ int i;
126239
+ WhereConst *pConst;
126240
+ if( pExpr->op!=TK_COLUMN ) return WRC_Continue;
126241
+ if( ExprHasProperty(pExpr, EP_FixedCol) ) return WRC_Continue;
126242
+ pConst = pWalker->u.pConst;
126243
+ for(i=0; i<pConst->nConst; i++){
126244
+ Expr *pColumn = pConst->apExpr[i*2];
126245
+ if( pColumn==pExpr ) continue;
126246
+ if( pColumn->iTable!=pExpr->iTable ) continue;
126247
+ if( pColumn->iColumn!=pExpr->iColumn ) continue;
126248
+ /* A match is found. Add the EP_FixedCol property */
126249
+ pConst->nChng++;
126250
+ ExprClearProperty(pExpr, EP_Leaf);
126251
+ ExprSetProperty(pExpr, EP_FixedCol);
126252
+ assert( pExpr->pLeft==0 );
126253
+ pExpr->pLeft = sqlite3ExprDup(pConst->pParse->db, pConst->apExpr[i*2+1], 0);
126254
+ break;
126255
+ }
126256
+ return WRC_Prune;
126257
+}
126258
+
126259
+/*
126260
+** The WHERE-clause constant propagation optimization.
126261
+**
126262
+** If the WHERE clause contains terms of the form COLUMN=CONSTANT or
126263
+** CONSTANT=COLUMN that must be tree (in other words, if the terms top-level
126264
+** AND-connected terms that are not part of a ON clause from a LEFT JOIN)
126265
+** then throughout the query replace all other occurrences of COLUMN
126266
+** with CONSTANT within the WHERE clause.
126267
+**
126268
+** For example, the query:
126269
+**
126270
+** SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=t1.a AND t3.c=t2.b
126271
+**
126272
+** Is transformed into
126273
+**
126274
+** SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=39 AND t3.c=39
126275
+**
126276
+** Return true if any transformations where made and false if not.
126277
+**
126278
+** Implementation note: Constant propagation is tricky due to affinity
126279
+** and collating sequence interactions. Consider this example:
126280
+**
126281
+** CREATE TABLE t1(a INT,b TEXT);
126282
+** INSERT INTO t1 VALUES(123,'0123');
126283
+** SELECT * FROM t1 WHERE a=123 AND b=a;
126284
+** SELECT * FROM t1 WHERE a=123 AND b=123;
126285
+**
126286
+** The two SELECT statements above should return different answers. b=a
126287
+** is alway true because the comparison uses numeric affinity, but b=123
126288
+** is false because it uses text affinity and '0123' is not the same as '123'.
126289
+** To work around this, the expression tree is not actually changed from
126290
+** "b=a" to "b=123" but rather the "a" in "b=a" is tagged with EP_FixedCol
126291
+** and the "123" value is hung off of the pLeft pointer. Code generator
126292
+** routines know to generate the constant "123" instead of looking up the
126293
+** column value. Also, to avoid collation problems, this optimization is
126294
+** only attempted if the "a=123" term uses the default BINARY collation.
126295
+*/
126296
+static int propagateConstants(
126297
+ Parse *pParse, /* The parsing context */
126298
+ Select *p /* The query in which to propagate constants */
126299
+){
126300
+ WhereConst x;
126301
+ Walker w;
126302
+ int nChng = 0;
126303
+ x.pParse = pParse;
126304
+ do{
126305
+ x.nConst = 0;
126306
+ x.nChng = 0;
126307
+ x.apExpr = 0;
126308
+ findConstInWhere(&x, p->pWhere);
126309
+ if( x.nConst ){
126310
+ memset(&w, 0, sizeof(w));
126311
+ w.pParse = pParse;
126312
+ w.xExprCallback = propagateConstantExprRewrite;
126313
+ w.xSelectCallback = sqlite3SelectWalkNoop;
126314
+ w.xSelectCallback2 = 0;
126315
+ w.walkerDepth = 0;
126316
+ w.u.pConst = &x;
126317
+ sqlite3WalkExpr(&w, p->pWhere);
126318
+ sqlite3DbFree(x.pParse->db, x.apExpr);
126319
+ nChng += x.nChng;
126320
+ }
126321
+ }while( x.nChng );
126322
+ return nChng;
126323
+}
126394126324
126395126325
#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
126396126326
/*
126397126327
** Make copies of relevant WHERE clause terms of the outer query into
126398126328
** the WHERE clause of subquery. Example:
@@ -127489,40 +127419,25 @@
127489127419
sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ);
127490127420
}
127491127421
sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, pF->iMem);
127492127422
sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF);
127493127423
sqlite3VdbeChangeP5(v, (u8)nArg);
127494
- sqlite3ExprCacheAffinityChange(pParse, regAgg, nArg);
127495127424
sqlite3ReleaseTempRange(pParse, regAgg, nArg);
127496127425
if( addrNext ){
127497127426
sqlite3VdbeResolveLabel(v, addrNext);
127498
- sqlite3ExprCacheClear(pParse);
127499127427
}
127500127428
}
127501
-
127502
- /* Before populating the accumulator registers, clear the column cache.
127503
- ** Otherwise, if any of the required column values are already present
127504
- ** in registers, sqlite3ExprCode() may use OP_SCopy to copy the value
127505
- ** to pC->iMem. But by the time the value is used, the original register
127506
- ** may have been used, invalidating the underlying buffer holding the
127507
- ** text or blob value. See ticket [883034dcb5].
127508
- **
127509
- ** Another solution would be to change the OP_SCopy used to copy cached
127510
- ** values to an OP_Copy.
127511
- */
127512127429
if( regHit==0 && pAggInfo->nAccumulator ){
127513127430
regHit = regAcc;
127514127431
}
127515127432
if( regHit ){
127516127433
addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit); VdbeCoverage(v);
127517127434
}
127518
- sqlite3ExprCacheClear(pParse);
127519127435
for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
127520127436
sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);
127521127437
}
127522127438
pAggInfo->directMode = 0;
127523
- sqlite3ExprCacheClear(pParse);
127524127439
if( addrHitTest ){
127525127440
sqlite3VdbeJumpHere(v, addrHitTest);
127526127441
}
127527127442
}
127528127443
@@ -127648,10 +127563,11 @@
127648127563
** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2)
127649127564
**
127650127565
** The transformation only works if all of the following are true:
127651127566
**
127652127567
** * The subquery is a UNION ALL of two or more terms
127568
+** * The subquery does not have a LIMIT clause
127653127569
** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries
127654127570
** * The outer query is a simple count(*)
127655127571
**
127656127572
** Return TRUE if the optimization is undertaken.
127657127573
*/
@@ -127671,10 +127587,11 @@
127671127587
if( pSub==0 ) return 0; /* The FROM is a subquery */
127672127588
if( pSub->pPrior==0 ) return 0; /* Must be a compound ry */
127673127589
do{
127674127590
if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
127675127591
if( pSub->pWhere ) return 0; /* No WHERE clause */
127592
+ if( pSub->pLimit ) return 0; /* No LIMIT clause */
127676127593
if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
127677127594
pSub = pSub->pPrior; /* Repeat over compound */
127678127595
}while( pSub );
127679127596
127680127597
/* If we reach this point then it is OK to perform the transformation */
@@ -127912,10 +127829,39 @@
127912127829
#endif
127913127830
if( p->pNext==0 ) ExplainQueryPlanPop(pParse);
127914127831
return rc;
127915127832
}
127916127833
#endif
127834
+
127835
+ /* Do the WHERE-clause constant propagation optimization if this is
127836
+ ** a join. No need to speed time on this operation for non-join queries
127837
+ ** as the equivalent optimization will be handled by query planner in
127838
+ ** sqlite3WhereBegin().
127839
+ */
127840
+ if( pTabList->nSrc>1
127841
+ && OptimizationEnabled(db, SQLITE_PropagateConst)
127842
+ && propagateConstants(pParse, p)
127843
+ ){
127844
+#if SELECTTRACE_ENABLED
127845
+ if( sqlite3SelectTrace & 0x100 ){
127846
+ SELECTTRACE(0x100,pParse,p,("After constant propagation:\n"));
127847
+ sqlite3TreeViewSelect(0, p, 0);
127848
+ }
127849
+#endif
127850
+ }else{
127851
+ SELECTTRACE(0x100,pParse,p,("Constant propagation not helpful\n"));
127852
+ }
127853
+
127854
+#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
127855
+ if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
127856
+ && countOfViewOptimization(pParse, p)
127857
+ ){
127858
+ if( db->mallocFailed ) goto select_end;
127859
+ pEList = p->pEList;
127860
+ pTabList = p->pSrc;
127861
+ }
127862
+#endif
127917127863
127918127864
/* For each term in the FROM clause, do two things:
127919127865
** (1) Authorized unreferenced tables
127920127866
** (2) Generate code for all sub-queries
127921127867
*/
@@ -127986,11 +127932,12 @@
127986127932
&& pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
127987127933
(pItem->fg.jointype & JT_OUTER)!=0)
127988127934
){
127989127935
#if SELECTTRACE_ENABLED
127990127936
if( sqlite3SelectTrace & 0x100 ){
127991
- SELECTTRACE(0x100,pParse,p,("After WHERE-clause push-down:\n"));
127937
+ SELECTTRACE(0x100,pParse,p,
127938
+ ("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
127992127939
sqlite3TreeViewSelect(0, p, 0);
127993127940
}
127994127941
#endif
127995127942
}else{
127996127943
SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));
@@ -128088,20 +128035,10 @@
128088128035
#if SELECTTRACE_ENABLED
128089128036
if( sqlite3SelectTrace & 0x400 ){
128090128037
SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
128091128038
sqlite3TreeViewSelect(0, p, 0);
128092128039
}
128093
-#endif
128094
-
128095
-#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
128096
- if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
128097
- && countOfViewOptimization(pParse, p)
128098
- ){
128099
- if( db->mallocFailed ) goto select_end;
128100
- pEList = p->pEList;
128101
- pTabList = p->pSrc;
128102
- }
128103128040
#endif
128104128041
128105128042
/* If the query is DISTINCT with an ORDER BY but is not an aggregate, and
128106128043
** if the select-list is the same as the ORDER BY list, then this query
128107128044
** can be rewritten as a GROUP BY. In other words, this:
@@ -128449,19 +128386,18 @@
128449128386
nCol++;
128450128387
j++;
128451128388
}
128452128389
}
128453128390
regBase = sqlite3GetTempRange(pParse, nCol);
128454
- sqlite3ExprCacheClear(pParse);
128455128391
sqlite3ExprCodeExprList(pParse, pGroupBy, regBase, 0, 0);
128456128392
j = nGroupBy;
128457128393
for(i=0; i<sAggInfo.nColumn; i++){
128458128394
struct AggInfo_col *pCol = &sAggInfo.aCol[i];
128459128395
if( pCol->iSorterColumn>=j ){
128460128396
int r1 = j + regBase;
128461
- sqlite3ExprCodeGetColumnToReg(pParse,
128462
- pCol->pTab, pCol->iColumn, pCol->iTable, r1);
128397
+ sqlite3ExprCodeGetColumnOfTable(v,
128398
+ pCol->pTab, pCol->iTable, pCol->iColumn, r1);
128463128399
j++;
128464128400
}
128465128401
}
128466128402
regRecord = sqlite3GetTempReg(pParse);
128467128403
sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord);
@@ -128473,12 +128409,10 @@
128473128409
sortOut = sqlite3GetTempReg(pParse);
128474128410
sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol);
128475128411
sqlite3VdbeAddOp2(v, OP_SorterSort, sAggInfo.sortingIdx, addrEnd);
128476128412
VdbeComment((v, "GROUP BY sort")); VdbeCoverage(v);
128477128413
sAggInfo.useSortingIdx = 1;
128478
- sqlite3ExprCacheClear(pParse);
128479
-
128480128414
}
128481128415
128482128416
/* If the index or temporary table used by the GROUP BY sort
128483128417
** will naturally deliver rows in the order required by the ORDER BY
128484128418
** clause, cancel the ephemeral table open coded earlier.
@@ -128497,11 +128431,10 @@
128497128431
** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth)
128498128432
** Then compare the current GROUP BY terms against the GROUP BY terms
128499128433
** from the previous row currently stored in a0, a1, a2...
128500128434
*/
128501128435
addrTopOfLoop = sqlite3VdbeCurrentAddr(v);
128502
- sqlite3ExprCacheClear(pParse);
128503128436
if( groupBySort ){
128504128437
sqlite3VdbeAddOp3(v, OP_SorterData, sAggInfo.sortingIdx,
128505128438
sortOut, sortPTab);
128506128439
}
128507128440
for(j=0; j<pGroupBy->nExpr; j++){
@@ -130714,17 +130647,11 @@
130714130647
** if there are one or more BEFORE triggers that use this value via
130715130648
** a new.* reference in a trigger program.
130716130649
*/
130717130650
testcase( i==31 );
130718130651
testcase( i==32 );
130719
- sqlite3ExprCodeGetColumnToReg(pParse, pTab, i, iDataCur, regNew+i);
130720
- if( tmask & TRIGGER_BEFORE ){
130721
- /* This value will be recomputed in After-BEFORE-trigger-reload-loop
130722
- ** below, so make sure that it is not cached and reused.
130723
- ** Ticket d85fffd6ffe856092ed8daefa811b1e399706b28. */
130724
- sqlite3ExprCacheRemove(pParse, regNew+i, 1);
130725
- }
130652
+ sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
130726130653
}else{
130727130654
sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);
130728130655
}
130729130656
}
130730130657
}
@@ -133848,11 +133775,10 @@
133848133775
}
133849133776
133850133777
/* Code the OP_Affinity opcode if there is anything left to do. */
133851133778
if( n>0 ){
133852133779
sqlite3VdbeAddOp4(v, OP_Affinity, base, n, 0, zAff, n);
133853
- sqlite3ExprCacheAffinityChange(pParse, base, n);
133854133780
}
133855133781
}
133856133782
133857133783
/*
133858133784
** Expression pRight, which is the RHS of a comparison operation, is
@@ -134384,11 +134310,11 @@
134384134310
** an access of the index rather than the original table.
134385134311
*/
134386134312
static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){
134387134313
int rc = WRC_Continue;
134388134314
struct CCurHint *pHint = pWalker->u.pCCurHint;
134389
- if( pExpr->op==TK_COLUMN ){
134315
+ if( pExpr->op==TK_COLUMN && !ExprHasProperty(pExpr, EP_FixedCol) ){
134390134316
if( pExpr->iTable!=pHint->iTabCur ){
134391134317
Vdbe *v = pWalker->pParse->pVdbe;
134392134318
int reg = ++pWalker->pParse->nMem; /* Register for column value */
134393134319
sqlite3ExprCodeGetColumnOfTable(
134394134320
v, pExpr->pTab, pExpr->iTable, pExpr->iColumn, reg
@@ -134757,11 +134683,10 @@
134757134683
int iReg; /* P3 Value for OP_VFilter */
134758134684
int addrNotFound;
134759134685
int nConstraint = pLoop->nLTerm;
134760134686
int iIn; /* Counter for IN constraints */
134761134687
134762
- sqlite3ExprCachePush(pParse);
134763134688
iReg = sqlite3GetTempRange(pParse, nConstraint+2);
134764134689
addrNotFound = pLevel->addrBrk;
134765134690
for(j=0; j<nConstraint; j++){
134766134691
int iTarget = iReg+j+2;
134767134692
pTerm = pLoop->aLTerm[j];
@@ -134830,11 +134755,10 @@
134830134755
** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems
134831134756
** simpler and safer to simply not reuse the registers.
134832134757
**
134833134758
** sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2);
134834134759
*/
134835
- sqlite3ExprCachePop(pParse);
134836134760
}else
134837134761
#endif /* SQLITE_OMIT_VIRTUALTABLE */
134838134762
134839134763
if( (pLoop->wsFlags & WHERE_IPK)!=0
134840134764
&& (pLoop->wsFlags & (WHERE_COLUMN_IN|WHERE_COLUMN_EQ))!=0
@@ -134854,13 +134778,10 @@
134854134778
iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg);
134855134779
if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);
134856134780
addrNxt = pLevel->addrNxt;
134857134781
sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg);
134858134782
VdbeCoverage(v);
134859
- sqlite3ExprCacheAffinityChange(pParse, iRowidReg, 1);
134860
- sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
134861
- VdbeComment((v, "pk"));
134862134783
pLevel->op = OP_Noop;
134863134784
}else if( (pLoop->wsFlags & WHERE_IPK)!=0
134864134785
&& (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0
134865134786
){
134866134787
/* Case 3: We have an inequality comparison against the ROWID field.
@@ -134926,11 +134847,10 @@
134926134847
VdbeComment((v, "pk"));
134927134848
VdbeCoverageIf(v, pX->op==TK_GT);
134928134849
VdbeCoverageIf(v, pX->op==TK_LE);
134929134850
VdbeCoverageIf(v, pX->op==TK_LT);
134930134851
VdbeCoverageIf(v, pX->op==TK_GE);
134931
- sqlite3ExprCacheAffinityChange(pParse, r1, 1);
134932134852
sqlite3ReleaseTempReg(pParse, rTemp);
134933134853
}else{
134934134854
sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrHalt);
134935134855
VdbeCoverageIf(v, bRev==0);
134936134856
VdbeCoverageIf(v, bRev!=0);
@@ -134961,11 +134881,10 @@
134961134881
pLevel->p2 = start;
134962134882
assert( pLevel->p5==0 );
134963134883
if( testOp!=OP_Noop ){
134964134884
iRowidReg = ++pParse->nMem;
134965134885
sqlite3VdbeAddOp2(v, OP_Rowid, iCur, iRowidReg);
134966
- sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
134967134886
sqlite3VdbeAddOp3(v, testOp, memEndValue, addrBrk, iRowidReg);
134968134887
VdbeCoverageIf(v, testOp==OP_Le);
134969134888
VdbeCoverageIf(v, testOp==OP_Lt);
134970134889
VdbeCoverageIf(v, testOp==OP_Ge);
134971134890
VdbeCoverageIf(v, testOp==OP_Gt);
@@ -135187,11 +135106,10 @@
135187135106
** range (if any).
135188135107
*/
135189135108
nConstraint = nEq;
135190135109
if( pRangeEnd ){
135191135110
Expr *pRight = pRangeEnd->pExpr->pRight;
135192
- sqlite3ExprCacheRemove(pParse, regBase+nEq, 1);
135193135111
codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
135194135112
whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
135195135113
if( (pRangeEnd->wtFlags & TERM_VNULL)==0
135196135114
&& sqlite3ExprCanBeNull(pRight)
135197135115
){
@@ -135212,11 +135130,10 @@
135212135130
}else{
135213135131
endEq = 1;
135214135132
}
135215135133
}else if( bStopAtNull ){
135216135134
sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
135217
- sqlite3ExprCacheRemove(pParse, regBase+nEq, 1);
135218135135
endEq = 0;
135219135136
nConstraint++;
135220135137
}
135221135138
sqlite3DbFree(db, zStartAff);
135222135139
sqlite3DbFree(db, zEndAff);
@@ -135246,11 +135163,10 @@
135246135163
(pWInfo->wctrlFlags & WHERE_SEEK_UNIQ_TABLE)
135247135164
&& (pWInfo->eOnePass==ONEPASS_SINGLE)
135248135165
)){
135249135166
iRowidReg = ++pParse->nMem;
135250135167
sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
135251
- sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
135252135168
sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg);
135253135169
VdbeCoverage(v);
135254135170
}else{
135255135171
codeDeferredSeek(pWInfo, pIdx, iCur, iIdxCur);
135256135172
}
@@ -135481,27 +135397,27 @@
135481135397
** duplicate rows from prior sub-WHERE clauses, and record the
135482135398
** rowid (or PRIMARY KEY) for the current row so that the same
135483135399
** row will be skipped in subsequent sub-WHERE clauses.
135484135400
*/
135485135401
if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){
135486
- int r;
135487135402
int iSet = ((ii==pOrWc->nTerm-1)?-1:ii);
135488135403
if( HasRowid(pTab) ){
135489
- r = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iCur, regRowid, 0);
135404
+ sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, -1, regRowid);
135490135405
jmp1 = sqlite3VdbeAddOp4Int(v, OP_RowSetTest, regRowset, 0,
135491
- r,iSet);
135406
+ regRowid, iSet);
135492135407
VdbeCoverage(v);
135493135408
}else{
135494135409
Index *pPk = sqlite3PrimaryKeyIndex(pTab);
135495135410
int nPk = pPk->nKeyCol;
135496135411
int iPk;
135412
+ int r;
135497135413
135498135414
/* Read the PK into an array of temp registers. */
135499135415
r = sqlite3GetTempRange(pParse, nPk);
135500135416
for(iPk=0; iPk<nPk; iPk++){
135501135417
int iCol = pPk->aiColumn[iPk];
135502
- sqlite3ExprCodeGetColumnToReg(pParse, pTab, iCol, iCur, r+iPk);
135418
+ sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, iCol, r+iPk);
135503135419
}
135504135420
135505135421
/* Check if the temp table already contains this key. If so,
135506135422
** the row has already been included in the result set and
135507135423
** can be ignored (by jumping past the Gosub below). Otherwise,
@@ -135730,11 +135646,10 @@
135730135646
*/
135731135647
if( pLevel->iLeftJoin ){
135732135648
pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
135733135649
sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
135734135650
VdbeComment((v, "record LEFT JOIN hit"));
135735
- sqlite3ExprCacheClear(pParse);
135736135651
for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){
135737135652
testcase( pTerm->wtFlags & TERM_VIRTUAL );
135738135653
testcase( pTerm->wtFlags & TERM_CODED );
135739135654
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
135740135655
if( (pTerm->prereqAll & pLevel->notReady)!=0 ){
@@ -135946,22 +135861,22 @@
135946135861
Expr *pExpr, /* Test this expression */
135947135862
Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */
135948135863
int *pisComplete, /* True if the only wildcard is % in the last character */
135949135864
int *pnoCase /* True if uppercase is equivalent to lowercase */
135950135865
){
135951
- const u8 *z = 0; /* String on RHS of LIKE operator */
135866
+ const u8 *z = 0; /* String on RHS of LIKE operator */
135952135867
Expr *pRight, *pLeft; /* Right and left size of LIKE operator */
135953135868
ExprList *pList; /* List of operands to the LIKE operator */
135954
- int c; /* One character in z[] */
135869
+ u8 c; /* One character in z[] */
135955135870
int cnt; /* Number of non-wildcard prefix characters */
135956
- char wc[4]; /* Wildcard characters */
135871
+ u8 wc[4]; /* Wildcard characters */
135957135872
sqlite3 *db = pParse->db; /* Database connection */
135958135873
sqlite3_value *pVal = 0;
135959135874
int op; /* Opcode of pRight */
135960135875
int rc; /* Result code to return */
135961135876
135962
- if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, wc) ){
135877
+ if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, (char*)wc) ){
135963135878
return 0;
135964135879
}
135965135880
#ifdef SQLITE_EBCDIC
135966135881
if( *pnoCase ) return 0;
135967135882
#endif
@@ -136611,11 +136526,11 @@
136611136526
&& (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2))
136612136527
){
136613136528
return 0;
136614136529
}
136615136530
pColl = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight);
136616
- if( pColl==0 || sqlite3StrICmp(pColl->zName, "BINARY")==0 ) return 1;
136531
+ if( sqlite3IsBinary(pColl) ) return 1;
136617136532
return sqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight);
136618136533
}
136619136534
136620136535
/*
136621136536
** Recursively walk the expressions of a SELECT statement and generate
@@ -136952,11 +136867,11 @@
136952136867
if( c=='A'-1 ) isComplete = 0;
136953136868
c = sqlite3UpperToLower[c];
136954136869
}
136955136870
*pC = c + 1;
136956136871
}
136957
- zCollSeqName = noCase ? "NOCASE" : "BINARY";
136872
+ zCollSeqName = noCase ? "NOCASE" : sqlite3StrBINARY;
136958136873
pNewExpr1 = sqlite3ExprDup(db, pLeft, 0);
136959136874
pNewExpr1 = sqlite3PExpr(pParse, TK_GE,
136960136875
sqlite3ExprAddCollateString(pParse,pNewExpr1,zCollSeqName),
136961136876
pStr1);
136962136877
transferJoinMarkings(pNewExpr1, pExpr);
@@ -137202,11 +137117,11 @@
137202137117
** a bitmask indicating which tables are used in that expression
137203137118
** tree.
137204137119
*/
137205137120
SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){
137206137121
Bitmask mask;
137207
- if( p->op==TK_COLUMN ){
137122
+ if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){
137208137123
return sqlite3WhereGetMask(pMaskSet, p->iTable);
137209137124
}else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
137210137125
assert( p->op!=TK_IF_NULL_ROW );
137211137126
return 0;
137212137127
}
@@ -138100,11 +138015,10 @@
138100138015
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
138101138016
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
138102138017
VdbeComment((v, "for %s", pTable->zName));
138103138018
138104138019
/* Fill the automatic index with content */
138105
- sqlite3ExprCachePush(pParse);
138106138020
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
138107138021
if( pTabItem->fg.viaCoroutine ){
138108138022
int regYield = pTabItem->regReturn;
138109138023
addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
138110138024
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
@@ -138137,11 +138051,10 @@
138137138051
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
138138138052
}
138139138053
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
138140138054
sqlite3VdbeJumpHere(v, addrTop);
138141138055
sqlite3ReleaseTempReg(pParse, regRecord);
138142
- sqlite3ExprCachePop(pParse);
138143138056
138144138057
/* Jump here when skipping the initialization */
138145138058
sqlite3VdbeJumpHere(v, addrInit);
138146138059
138147138060
end_auto_index_create:
@@ -140503,11 +140416,11 @@
140503140416
int iTerm = pIdxInfo->aConstraint[iCons].iTermOffset;
140504140417
Expr *pX = pHidden->pWC->a[iTerm].pExpr;
140505140418
if( pX->pLeft ){
140506140419
pC = sqlite3BinaryCompareCollSeq(pHidden->pParse, pX->pLeft, pX->pRight);
140507140420
}
140508
- zRet = (pC ? pC->zName : "BINARY");
140421
+ zRet = (pC ? pC->zName : sqlite3StrBINARY);
140509140422
}
140510140423
return zRet;
140511140424
}
140512140425
140513140426
/*
@@ -141354,11 +141267,15 @@
141354141267
if( aSortCost[isOrdered]==0 ){
141355141268
aSortCost[isOrdered] = whereSortingCost(
141356141269
pWInfo, nRowEst, nOrderBy, isOrdered
141357141270
);
141358141271
}
141359
- rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]);
141272
+ /* TUNING: Add a small extra penalty (5) to sorting as an
141273
+ ** extra encouragment to the query planner to select a plan
141274
+ ** where the rows emerge in the correct order without any sorting
141275
+ ** required. */
141276
+ rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]) + 5;
141360141277
141361141278
WHERETRACE(0x002,
141362141279
("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n",
141363141280
aSortCost[isOrdered], (nOrderBy-isOrdered), nOrderBy,
141364141281
rUnsorted, rCost));
@@ -142371,11 +142288,10 @@
142371142288
sqlite3 *db = pParse->db;
142372142289
142373142290
/* Generate loop termination code.
142374142291
*/
142375142292
VdbeModuleComment((v, "End WHERE-core"));
142376
- sqlite3ExprCacheClear(pParse);
142377142293
for(i=pWInfo->nLevel-1; i>=0; i--){
142378142294
int addr;
142379142295
pLevel = &pWInfo->a[i];
142380142296
pLoop = pLevel->pWLoop;
142381142297
if( pLevel->op!=OP_Noop ){
@@ -143536,11 +143452,14 @@
143536143452
/*
143537143453
** Attach window object pWin to expression p.
143538143454
*/
143539143455
SQLITE_PRIVATE void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){
143540143456
if( p ){
143541
- if( pWin ){
143457
+ /* This routine is only called for the parser. If pWin was not
143458
+ ** allocated due to an OOM, then the parser would fail before ever
143459
+ ** invoking this routine */
143460
+ if( ALWAYS(pWin) ){
143542143461
p->pWin = pWin;
143543143462
pWin->pOwner = p;
143544143463
if( p->flags & EP_Distinct ){
143545143464
sqlite3ErrorMsg(pParse,
143546143465
"DISTINCT is not supported for window functions");
@@ -145095,21 +145014,21 @@
145095145014
#define sqlite3ParserCTX_PDECL ,Parse *pParse
145096145015
#define sqlite3ParserCTX_PARAM ,pParse
145097145016
#define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
145098145017
#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
145099145018
#define YYFALLBACK 1
145100
-#define YYNSTATE 516
145101
-#define YYNRULE 365
145019
+#define YYNSTATE 518
145020
+#define YYNRULE 366
145102145021
#define YYNTOKEN 155
145103
-#define YY_MAX_SHIFT 515
145104
-#define YY_MIN_SHIFTREDUCE 750
145105
-#define YY_MAX_SHIFTREDUCE 1114
145106
-#define YY_ERROR_ACTION 1115
145107
-#define YY_ACCEPT_ACTION 1116
145108
-#define YY_NO_ACTION 1117
145109
-#define YY_MIN_REDUCE 1118
145110
-#define YY_MAX_REDUCE 1482
145022
+#define YY_MAX_SHIFT 517
145023
+#define YY_MIN_SHIFTREDUCE 752
145024
+#define YY_MAX_SHIFTREDUCE 1117
145025
+#define YY_ERROR_ACTION 1118
145026
+#define YY_ACCEPT_ACTION 1119
145027
+#define YY_NO_ACTION 1120
145028
+#define YY_MIN_REDUCE 1121
145029
+#define YY_MAX_REDUCE 1486
145111145030
/************* End control #defines *******************************************/
145112145031
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
145113145032
145114145033
/* Define the yytestcase() macro to be a no-op if is not already defined
145115145034
** otherwise.
@@ -145174,391 +145093,391 @@
145174145093
** yy_default[] Default action for each state.
145175145094
**
145176145095
*********** Begin parsing tables **********************************************/
145177145096
#define YY_ACTTAB_COUNT (2009)
145178145097
static const YYACTIONTYPE yy_action[] = {
145179
- /* 0 */ 510, 423, 364, 105, 102, 196, 14, 244, 1116, 1,
145180
- /* 10 */ 1, 515, 2, 1120, 510, 361, 1247, 362, 271, 366,
145181
- /* 20 */ 127, 37, 37, 1378, 105, 102, 196, 1197, 178, 472,
145182
- /* 30 */ 1246, 880, 1184, 1163, 423, 37, 37, 1189, 1189, 881,
145183
- /* 40 */ 353, 1184, 425, 112, 113, 103, 1092, 1092, 944, 947,
145184
- /* 50 */ 937, 937, 110, 110, 111, 111, 111, 111, 278, 249,
145185
- /* 60 */ 249, 249, 249, 105, 102, 196, 510, 105, 102, 196,
145186
- /* 70 */ 1071, 254, 507, 177, 507, 1187, 1187, 491, 415, 225,
145187
- /* 80 */ 193, 105, 102, 196, 510, 205, 906, 65, 65, 318,
145188
- /* 90 */ 249, 249, 109, 109, 109, 109, 108, 108, 107, 107,
145189
- /* 100 */ 107, 106, 396, 507, 258, 15, 15, 394, 393, 249,
145190
- /* 110 */ 249, 1413, 366, 1408, 400, 1096, 1071, 1072, 1073, 377,
145191
- /* 120 */ 1098, 178, 507, 493, 492, 1411, 1407, 396, 1097, 292,
145192
- /* 130 */ 411, 280, 366, 365, 134, 152, 112, 113, 103, 1092,
145193
- /* 140 */ 1092, 944, 947, 937, 937, 110, 110, 111, 111, 111,
145194
- /* 150 */ 111, 1450, 1099, 262, 1099, 262, 112, 113, 103, 1092,
145195
- /* 160 */ 1092, 944, 947, 937, 937, 110, 110, 111, 111, 111,
145196
- /* 170 */ 111, 107, 107, 107, 106, 396, 1049, 486, 1047, 509,
145197
- /* 180 */ 73, 270, 500, 416, 293, 109, 109, 109, 109, 108,
145198
- /* 190 */ 108, 107, 107, 107, 106, 396, 366, 111, 111, 111,
145199
- /* 200 */ 111, 104, 330, 89, 486, 109, 109, 109, 109, 108,
145200
- /* 210 */ 108, 107, 107, 107, 106, 396, 111, 111, 111, 111,
145201
- /* 220 */ 112, 113, 103, 1092, 1092, 944, 947, 937, 937, 110,
145098
+ /* 0 */ 365, 105, 102, 197, 105, 102, 197, 512, 1119, 1,
145099
+ /* 10 */ 1, 517, 2, 1123, 512, 1187, 1166, 1450, 272, 367,
145100
+ /* 20 */ 127, 1384, 1192, 1192, 1187, 1161, 178, 1200, 64, 64,
145101
+ /* 30 */ 474, 883, 319, 425, 345, 37, 37, 804, 359, 884,
145102
+ /* 40 */ 506, 506, 506, 112, 113, 103, 1095, 1095, 949, 952,
145103
+ /* 50 */ 942, 942, 110, 110, 111, 111, 111, 111, 362, 250,
145104
+ /* 60 */ 250, 512, 250, 250, 494, 512, 306, 512, 456, 512,
145105
+ /* 70 */ 1074, 488, 509, 475, 6, 509, 805, 134, 495, 226,
145106
+ /* 80 */ 194, 425, 37, 37, 512, 206, 64, 64, 64, 64,
145107
+ /* 90 */ 13, 13, 109, 109, 109, 109, 108, 108, 107, 107,
145108
+ /* 100 */ 107, 106, 398, 255, 378, 13, 13, 395, 394, 425,
145109
+ /* 110 */ 250, 250, 367, 473, 402, 1099, 1074, 1075, 1076, 383,
145110
+ /* 120 */ 1101, 387, 494, 509, 494, 1417, 1413, 301, 1100, 304,
145111
+ /* 130 */ 1251, 493, 367, 496, 16, 16, 112, 113, 103, 1095,
145112
+ /* 140 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111,
145113
+ /* 150 */ 111, 259, 1102, 492, 1102, 398, 112, 113, 103, 1095,
145114
+ /* 160 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111,
145115
+ /* 170 */ 111, 129, 1419, 340, 1414, 336, 1054, 489, 1052, 260,
145116
+ /* 180 */ 73, 105, 102, 197, 990, 109, 109, 109, 109, 108,
145117
+ /* 190 */ 108, 107, 107, 107, 106, 398, 367, 111, 111, 111,
145118
+ /* 200 */ 111, 104, 489, 89, 1426, 109, 109, 109, 109, 108,
145119
+ /* 210 */ 108, 107, 107, 107, 106, 398, 111, 111, 111, 111,
145120
+ /* 220 */ 112, 113, 103, 1095, 1095, 949, 952, 942, 942, 110,
145202145121
/* 230 */ 110, 111, 111, 111, 111, 109, 109, 109, 109, 108,
145203
- /* 240 */ 108, 107, 107, 107, 106, 396, 114, 108, 108, 107,
145204
- /* 250 */ 107, 107, 106, 396, 109, 109, 109, 109, 108, 108,
145205
- /* 260 */ 107, 107, 107, 106, 396, 394, 393, 106, 396, 109,
145206
- /* 270 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 396,
145207
- /* 280 */ 217, 487, 1400, 453, 450, 449, 510, 1278, 423, 366,
145208
- /* 290 */ 503, 503, 503, 448, 74, 1071, 109, 109, 109, 109,
145209
- /* 300 */ 108, 108, 107, 107, 107, 106, 396, 37, 37, 1401,
145210
- /* 310 */ 1099, 440, 1099, 112, 113, 103, 1092, 1092, 944, 947,
145211
- /* 320 */ 937, 937, 110, 110, 111, 111, 111, 111, 1426, 515,
145212
- /* 330 */ 2, 1120, 934, 934, 945, 948, 271, 1071, 127, 477,
145213
- /* 340 */ 924, 1071, 1072, 1073, 217, 1197, 906, 453, 450, 449,
145214
- /* 350 */ 388, 167, 510, 1377, 152, 379, 917, 448, 259, 510,
145215
- /* 360 */ 916, 285, 109, 109, 109, 109, 108, 108, 107, 107,
145216
- /* 370 */ 107, 106, 396, 15, 15, 429, 846, 249, 249, 224,
145217
- /* 380 */ 15, 15, 366, 1071, 1072, 1073, 307, 382, 1071, 292,
145218
- /* 390 */ 507, 916, 916, 918, 384, 27, 938, 1411, 484, 408,
145219
- /* 400 */ 270, 500, 508, 205, 836, 836, 112, 113, 103, 1092,
145220
- /* 410 */ 1092, 944, 947, 937, 937, 110, 110, 111, 111, 111,
145221
- /* 420 */ 111, 1430, 282, 1120, 284, 1071, 28, 510, 271, 318,
145222
- /* 430 */ 127, 1422, 400, 385, 1071, 1072, 1073, 1197, 159, 235,
145223
- /* 440 */ 252, 317, 456, 312, 455, 222, 784, 375, 65, 65,
145224
- /* 450 */ 332, 310, 194, 243, 243, 109, 109, 109, 109, 108,
145225
- /* 460 */ 108, 107, 107, 107, 106, 396, 507, 257, 510, 249,
145226
- /* 470 */ 249, 1071, 1072, 1073, 136, 366, 335, 924, 440, 788,
145227
- /* 480 */ 270, 500, 507, 1446, 493, 473, 319, 1071, 429, 65,
145228
- /* 490 */ 65, 1158, 784, 917, 283, 205, 510, 916, 440, 112,
145229
- /* 500 */ 113, 103, 1092, 1092, 944, 947, 937, 937, 110, 110,
145230
- /* 510 */ 111, 111, 111, 111, 279, 1027, 1476, 15, 15, 1476,
145231
- /* 520 */ 403, 510, 383, 1071, 400, 493, 1404, 1386, 916, 916,
145232
- /* 530 */ 918, 261, 463, 1071, 1072, 1073, 173, 1421, 510, 1071,
145233
- /* 540 */ 1343, 510, 45, 45, 168, 990, 990, 437, 109, 109,
145234
- /* 550 */ 109, 109, 108, 108, 107, 107, 107, 106, 396, 63,
145235
- /* 560 */ 63, 510, 15, 15, 249, 249, 375, 510, 366, 1071,
145236
- /* 570 */ 1072, 1073, 781, 5, 401, 355, 488, 507, 464, 3,
145237
- /* 580 */ 291, 1071, 65, 65, 1025, 1071, 1072, 1073, 65, 65,
145238
- /* 590 */ 350, 1112, 112, 113, 103, 1092, 1092, 944, 947, 937,
145239
- /* 600 */ 937, 110, 110, 111, 111, 111, 111, 249, 249, 510,
145240
- /* 610 */ 1071, 1042, 867, 395, 395, 395, 1071, 336, 493, 490,
145241
- /* 620 */ 507, 1041, 1006, 318, 493, 505, 178, 1071, 1072, 1073,
145242
- /* 630 */ 65, 65, 1071, 255, 344, 421, 273, 1007, 358, 290,
145243
- /* 640 */ 88, 109, 109, 109, 109, 108, 108, 107, 107, 107,
145244
- /* 650 */ 106, 396, 1008, 510, 375, 1071, 1071, 1072, 1073, 1113,
145245
- /* 660 */ 510, 366, 1071, 1072, 1073, 1056, 493, 462, 133, 1478,
145246
- /* 670 */ 351, 249, 249, 822, 65, 65, 152, 440, 1071, 1072,
145247
- /* 680 */ 1073, 65, 65, 823, 507, 112, 113, 103, 1092, 1092,
145248
- /* 690 */ 944, 947, 937, 937, 110, 110, 111, 111, 111, 111,
145249
- /* 700 */ 274, 1071, 1072, 1073, 407, 866, 471, 1219, 1027, 1477,
145250
- /* 710 */ 478, 767, 1477, 406, 1195, 1347, 1138, 392, 465, 1196,
145251
- /* 720 */ 987, 256, 270, 500, 987, 445, 1075, 18, 18, 793,
145252
- /* 730 */ 406, 405, 1347, 1349, 109, 109, 109, 109, 108, 108,
145253
- /* 740 */ 107, 107, 107, 106, 396, 510, 249, 249, 249, 249,
145254
- /* 750 */ 249, 249, 221, 510, 366, 251, 435, 246, 925, 507,
145255
- /* 760 */ 865, 507, 468, 507, 318, 429, 49, 49, 494, 9,
145256
- /* 770 */ 414, 228, 802, 1075, 50, 50, 277, 1025, 112, 113,
145257
- /* 780 */ 103, 1092, 1092, 944, 947, 937, 937, 110, 110, 111,
145258
- /* 790 */ 111, 111, 111, 1006, 249, 249, 510, 406, 1345, 1347,
145259
- /* 800 */ 249, 249, 967, 454, 1141, 372, 1090, 507, 1007, 135,
145260
- /* 810 */ 371, 803, 440, 507, 220, 219, 218, 17, 17, 1423,
145261
- /* 820 */ 460, 510, 440, 1008, 510, 1232, 310, 109, 109, 109,
145262
- /* 830 */ 109, 108, 108, 107, 107, 107, 106, 396, 510, 1336,
145263
- /* 840 */ 510, 195, 39, 39, 497, 51, 51, 366, 510, 485,
145264
- /* 850 */ 1278, 911, 6, 1090, 1192, 985, 386, 260, 221, 52,
145265
- /* 860 */ 52, 53, 53, 1439, 298, 510, 865, 366, 510, 54,
145266
- /* 870 */ 54, 112, 113, 103, 1092, 1092, 944, 947, 937, 937,
145267
- /* 880 */ 110, 110, 111, 111, 111, 111, 55, 55, 865, 40,
145268
- /* 890 */ 40, 112, 113, 103, 1092, 1092, 944, 947, 937, 937,
145269
- /* 900 */ 110, 110, 111, 111, 111, 111, 250, 250, 755, 756,
145270
- /* 910 */ 757, 510, 95, 510, 93, 510, 371, 510, 380, 507,
145122
+ /* 240 */ 108, 107, 107, 107, 106, 398, 114, 108, 108, 107,
145123
+ /* 250 */ 107, 107, 106, 398, 109, 109, 109, 109, 108, 108,
145124
+ /* 260 */ 107, 107, 107, 106, 398, 152, 396, 396, 396, 109,
145125
+ /* 270 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398,
145126
+ /* 280 */ 178, 490, 1406, 431, 1032, 1480, 1074, 512, 1480, 367,
145127
+ /* 290 */ 418, 294, 354, 409, 74, 1074, 109, 109, 109, 109,
145128
+ /* 300 */ 108, 108, 107, 107, 107, 106, 398, 1407, 37, 37,
145129
+ /* 310 */ 1425, 271, 503, 112, 113, 103, 1095, 1095, 949, 952,
145130
+ /* 320 */ 942, 942, 110, 110, 111, 111, 111, 111, 1430, 517,
145131
+ /* 330 */ 2, 1123, 1074, 1075, 1076, 427, 272, 1074, 127, 363,
145132
+ /* 340 */ 929, 1074, 1075, 1076, 218, 1200, 909, 455, 452, 451,
145133
+ /* 350 */ 389, 167, 512, 1030, 152, 442, 920, 450, 152, 870,
145134
+ /* 360 */ 919, 286, 109, 109, 109, 109, 108, 108, 107, 107,
145135
+ /* 370 */ 107, 106, 398, 13, 13, 258, 849, 250, 250, 225,
145136
+ /* 380 */ 106, 398, 367, 1074, 1075, 1076, 308, 385, 1074, 293,
145137
+ /* 390 */ 509, 919, 919, 921, 229, 320, 1250, 1383, 1417, 487,
145138
+ /* 400 */ 271, 503, 12, 206, 271, 503, 112, 113, 103, 1095,
145139
+ /* 410 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111,
145140
+ /* 420 */ 111, 1434, 283, 1123, 285, 1074, 1092, 245, 272, 1093,
145141
+ /* 430 */ 127, 384, 402, 386, 1074, 1075, 1076, 1200, 159, 236,
145142
+ /* 440 */ 253, 318, 458, 313, 457, 223, 786, 105, 102, 197,
145143
+ /* 450 */ 510, 311, 838, 838, 442, 109, 109, 109, 109, 108,
145144
+ /* 460 */ 108, 107, 107, 107, 106, 398, 512, 511, 512, 250,
145145
+ /* 470 */ 250, 1074, 1075, 1076, 432, 367, 1093, 929, 1454, 790,
145146
+ /* 480 */ 271, 503, 509, 105, 102, 197, 333, 63, 63, 64,
145147
+ /* 490 */ 64, 27, 786, 920, 284, 206, 1349, 919, 512, 112,
145148
+ /* 500 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110,
145149
+ /* 510 */ 111, 111, 111, 111, 107, 107, 107, 106, 398, 49,
145150
+ /* 520 */ 49, 512, 28, 1074, 402, 494, 418, 294, 919, 919,
145151
+ /* 530 */ 921, 186, 465, 1074, 464, 995, 995, 439, 512, 1074,
145152
+ /* 540 */ 331, 512, 45, 45, 1078, 339, 173, 168, 109, 109,
145153
+ /* 550 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 13,
145154
+ /* 560 */ 13, 203, 13, 13, 250, 250, 1190, 1190, 367, 1074,
145155
+ /* 570 */ 1075, 1076, 783, 262, 5, 356, 491, 509, 466, 1074,
145156
+ /* 580 */ 1075, 1076, 395, 394, 1074, 1074, 1075, 1076, 3, 279,
145157
+ /* 590 */ 1074, 1078, 112, 113, 103, 1095, 1095, 949, 952, 942,
145158
+ /* 600 */ 942, 110, 110, 111, 111, 111, 111, 250, 250, 1011,
145159
+ /* 610 */ 218, 1074, 869, 455, 452, 451, 939, 939, 950, 953,
145160
+ /* 620 */ 509, 250, 250, 450, 1012, 1074, 442, 1102, 1204, 1102,
145161
+ /* 630 */ 1074, 1075, 1076, 512, 509, 423, 1074, 1075, 1076, 1013,
145162
+ /* 640 */ 509, 109, 109, 109, 109, 108, 108, 107, 107, 107,
145163
+ /* 650 */ 106, 398, 1047, 512, 50, 50, 512, 1074, 1075, 1076,
145164
+ /* 660 */ 824, 367, 1046, 376, 408, 1059, 1353, 205, 405, 769,
145165
+ /* 670 */ 825, 1074, 1075, 1076, 64, 64, 319, 64, 64, 1297,
145166
+ /* 680 */ 943, 408, 407, 1353, 1355, 112, 113, 103, 1095, 1095,
145167
+ /* 690 */ 949, 952, 942, 942, 110, 110, 111, 111, 111, 111,
145168
+ /* 700 */ 291, 479, 512, 1032, 1481, 512, 431, 1481, 351, 1115,
145169
+ /* 710 */ 480, 992, 909, 482, 463, 992, 132, 178, 33, 447,
145170
+ /* 720 */ 1198, 136, 403, 64, 64, 476, 64, 64, 416, 366,
145171
+ /* 730 */ 280, 1141, 250, 250, 109, 109, 109, 109, 108, 108,
145172
+ /* 740 */ 107, 107, 107, 106, 398, 509, 222, 437, 408, 263,
145173
+ /* 750 */ 1353, 263, 250, 250, 367, 293, 413, 281, 930, 393,
145174
+ /* 760 */ 972, 467, 397, 250, 250, 509, 9, 470, 229, 497,
145175
+ /* 770 */ 351, 1031, 1030, 1482, 352, 371, 509, 1116, 112, 113,
145176
+ /* 780 */ 103, 1095, 1095, 949, 952, 942, 942, 110, 110, 111,
145177
+ /* 790 */ 111, 111, 111, 250, 250, 1011, 512, 1342, 292, 250,
145178
+ /* 800 */ 250, 250, 250, 1093, 372, 247, 509, 442, 868, 319,
145179
+ /* 810 */ 1012, 477, 509, 195, 509, 431, 270, 15, 15, 512,
145180
+ /* 820 */ 311, 512, 95, 512, 93, 1013, 364, 109, 109, 109,
145181
+ /* 830 */ 109, 108, 108, 107, 107, 107, 106, 398, 512, 1116,
145182
+ /* 840 */ 39, 39, 51, 51, 52, 52, 500, 367, 512, 1199,
145183
+ /* 850 */ 1093, 914, 436, 338, 133, 433, 221, 220, 219, 53,
145184
+ /* 860 */ 53, 319, 1392, 757, 758, 759, 512, 367, 88, 54,
145185
+ /* 870 */ 54, 112, 113, 103, 1095, 1095, 949, 952, 942, 942,
145186
+ /* 880 */ 110, 110, 111, 111, 111, 111, 274, 55, 55, 196,
145187
+ /* 890 */ 512, 112, 113, 103, 1095, 1095, 949, 952, 942, 942,
145188
+ /* 900 */ 110, 110, 111, 111, 111, 111, 135, 261, 1144, 373,
145189
+ /* 910 */ 512, 40, 40, 512, 868, 512, 989, 512, 989, 116,
145271145190
/* 920 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106,
145272
- /* 930 */ 396, 510, 41, 41, 43, 43, 44, 44, 56, 56,
145191
+ /* 930 */ 398, 41, 41, 512, 43, 43, 44, 44, 56, 56,
145273145192
/* 940 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106,
145274
- /* 950 */ 396, 510, 57, 57, 510, 1231, 510, 370, 510, 410,
145275
- /* 960 */ 510, 416, 293, 510, 1291, 510, 1290, 510, 190, 195,
145276
- /* 970 */ 510, 319, 58, 58, 1391, 16, 16, 59, 59, 118,
145277
- /* 980 */ 118, 60, 60, 458, 46, 46, 61, 61, 62, 62,
145278
- /* 990 */ 510, 47, 47, 1201, 865, 91, 510, 474, 510, 461,
145279
- /* 1000 */ 510, 461, 510, 228, 510, 507, 510, 390, 510, 841,
145280
- /* 1010 */ 510, 64, 64, 1449, 840, 366, 811, 140, 140, 141,
145281
- /* 1020 */ 141, 69, 69, 48, 48, 119, 119, 66, 66, 120,
145282
- /* 1030 */ 120, 121, 121, 510, 434, 366, 510, 431, 1090, 112,
145283
- /* 1040 */ 113, 103, 1092, 1092, 944, 947, 937, 937, 110, 110,
145284
- /* 1050 */ 111, 111, 111, 111, 117, 117, 510, 139, 139, 112,
145285
- /* 1060 */ 113, 103, 1092, 1092, 944, 947, 937, 937, 110, 110,
145286
- /* 1070 */ 111, 111, 111, 111, 305, 427, 116, 138, 138, 510,
145287
- /* 1080 */ 86, 510, 131, 475, 510, 1090, 350, 1026, 109, 109,
145288
- /* 1090 */ 109, 109, 108, 108, 107, 107, 107, 106, 396, 510,
145289
- /* 1100 */ 125, 125, 124, 124, 510, 122, 122, 510, 109, 109,
145290
- /* 1110 */ 109, 109, 108, 108, 107, 107, 107, 106, 396, 777,
145291
- /* 1120 */ 123, 123, 502, 372, 510, 68, 68, 510, 70, 70,
145292
- /* 1130 */ 1089, 510, 286, 14, 1278, 300, 1278, 303, 270, 500,
145293
- /* 1140 */ 373, 153, 841, 94, 202, 67, 67, 840, 38, 38,
145294
- /* 1150 */ 189, 188, 42, 42, 1278, 1113, 248, 193, 269, 880,
145295
- /* 1160 */ 132, 428, 33, 366, 418, 1366, 777, 881, 182, 363,
145296
- /* 1170 */ 1022, 289, 908, 352, 88, 227, 422, 424, 294, 227,
145297
- /* 1180 */ 227, 88, 446, 366, 19, 223, 903, 112, 113, 103,
145298
- /* 1190 */ 1092, 1092, 944, 947, 937, 937, 110, 110, 111, 111,
145299
- /* 1200 */ 111, 111, 381, 308, 436, 430, 88, 112, 101, 103,
145300
- /* 1210 */ 1092, 1092, 944, 947, 937, 937, 110, 110, 111, 111,
145301
- /* 1220 */ 111, 111, 391, 417, 791, 801, 800, 808, 809, 970,
145302
- /* 1230 */ 874, 974, 223, 227, 920, 185, 109, 109, 109, 109,
145303
- /* 1240 */ 108, 108, 107, 107, 107, 106, 396, 984, 838, 984,
145304
- /* 1250 */ 204, 96, 983, 1365, 983, 432, 109, 109, 109, 109,
145305
- /* 1260 */ 108, 108, 107, 107, 107, 106, 396, 316, 295, 775,
145306
- /* 1270 */ 1228, 791, 130, 299, 1167, 302, 366, 315, 974, 1166,
145307
- /* 1280 */ 304, 920, 306, 496, 1180, 1164, 1165, 311, 320, 321,
145308
- /* 1290 */ 1240, 267, 1277, 1215, 1226, 495, 366, 1283, 1147, 1140,
145309
- /* 1300 */ 1129, 113, 103, 1092, 1092, 944, 947, 937, 937, 110,
145310
- /* 1310 */ 110, 111, 111, 111, 111, 1128, 441, 241, 183, 1130,
145311
- /* 1320 */ 1212, 1433, 103, 1092, 1092, 944, 947, 937, 937, 110,
145312
- /* 1330 */ 110, 111, 111, 111, 111, 349, 323, 325, 327, 288,
145313
- /* 1340 */ 426, 191, 187, 99, 501, 409, 4, 499, 314, 109,
145314
- /* 1350 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 396,
145315
- /* 1360 */ 504, 13, 1163, 1262, 451, 1340, 281, 329, 1339, 109,
145316
- /* 1370 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 396,
145317
- /* 1380 */ 1270, 357, 1436, 397, 230, 342, 1107, 186, 1385, 1383,
145318
- /* 1390 */ 1104, 374, 420, 99, 501, 498, 4, 165, 30, 72,
145319
- /* 1400 */ 75, 155, 1267, 149, 157, 152, 86, 1259, 412, 160,
145320
- /* 1410 */ 504, 413, 161, 162, 924, 163, 444, 207, 356, 31,
145321
- /* 1420 */ 97, 97, 8, 354, 1273, 419, 1334, 98, 169, 397,
145322
- /* 1430 */ 512, 511, 433, 397, 916, 211, 80, 242, 1354, 439,
145323
- /* 1440 */ 297, 213, 174, 301, 442, 498, 1131, 214, 215, 359,
145324
- /* 1450 */ 457, 270, 500, 387, 360, 1183, 482, 1182, 1174, 793,
145325
- /* 1460 */ 1181, 481, 476, 1154, 924, 916, 916, 918, 919, 25,
145326
- /* 1470 */ 97, 97, 1155, 313, 1173, 1153, 265, 98, 1448, 397,
145327
- /* 1480 */ 512, 511, 467, 389, 916, 266, 470, 1223, 99, 501,
145328
- /* 1490 */ 85, 4, 1224, 229, 480, 489, 332, 331, 322, 181,
145329
- /* 1500 */ 1402, 11, 1320, 334, 92, 504, 115, 129, 337, 99,
145330
- /* 1510 */ 501, 324, 4, 1222, 1221, 916, 916, 918, 919, 25,
145331
- /* 1520 */ 1425, 1060, 399, 326, 328, 253, 504, 1205, 397, 338,
145332
- /* 1530 */ 348, 348, 347, 238, 345, 87, 339, 764, 479, 340,
145333
- /* 1540 */ 498, 268, 236, 341, 1137, 29, 1066, 237, 513, 397,
145334
- /* 1550 */ 198, 482, 276, 240, 514, 239, 483, 1126, 1121, 924,
145335
- /* 1560 */ 275, 498, 154, 142, 1370, 97, 97, 368, 369, 143,
145336
- /* 1570 */ 1371, 751, 98, 144, 397, 512, 511, 398, 184, 916,
145337
- /* 1580 */ 924, 272, 1369, 1368, 128, 197, 97, 97, 845, 1151,
145338
- /* 1590 */ 200, 1150, 263, 98, 71, 397, 512, 511, 201, 1148,
145339
- /* 1600 */ 916, 146, 402, 126, 982, 980, 900, 156, 199, 203,
145340
- /* 1610 */ 916, 916, 918, 919, 25, 145, 158, 825, 996, 206,
145341
- /* 1620 */ 287, 99, 501, 164, 4, 147, 376, 904, 378, 76,
145342
- /* 1630 */ 166, 916, 916, 918, 919, 25, 77, 78, 504, 79,
145343
- /* 1640 */ 148, 999, 367, 208, 209, 995, 137, 270, 500, 20,
145344
- /* 1650 */ 210, 296, 227, 1101, 438, 212, 988, 170, 171, 32,
145345
- /* 1660 */ 766, 397, 443, 315, 216, 447, 452, 172, 81, 21,
145346
- /* 1670 */ 404, 309, 22, 498, 82, 264, 150, 804, 179, 83,
145347
- /* 1680 */ 459, 151, 180, 950, 482, 1030, 34, 84, 1031, 481,
145348
- /* 1690 */ 466, 35, 924, 192, 469, 245, 247, 873, 97, 97,
145349
- /* 1700 */ 175, 226, 96, 868, 1044, 98, 1048, 397, 512, 511,
145350
- /* 1710 */ 1060, 399, 916, 23, 253, 10, 1046, 1035, 7, 348,
145351
- /* 1720 */ 348, 347, 238, 345, 333, 176, 764, 88, 965, 24,
145352
- /* 1730 */ 951, 99, 501, 949, 4, 954, 953, 1005, 1004, 198,
145353
- /* 1740 */ 232, 276, 231, 916, 916, 918, 919, 25, 504, 275,
145354
- /* 1750 */ 26, 36, 506, 921, 776, 100, 835, 839, 12, 233,
145355
- /* 1760 */ 234, 90, 501, 343, 4, 346, 1441, 1440, 1061, 1117,
145356
- /* 1770 */ 1117, 397, 1117, 1117, 1117, 1117, 1117, 1117, 504, 200,
145357
- /* 1780 */ 1117, 1117, 1117, 498, 1117, 1117, 1117, 201, 1117, 1117,
145358
- /* 1790 */ 146, 1117, 1117, 1117, 1117, 1117, 1117, 199, 1117, 1117,
145359
- /* 1800 */ 1117, 397, 924, 1117, 1117, 1117, 1117, 1117, 97, 97,
145360
- /* 1810 */ 1117, 1117, 1117, 498, 1117, 98, 1117, 397, 512, 511,
145361
- /* 1820 */ 1117, 1117, 916, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145362
- /* 1830 */ 1117, 367, 924, 1117, 1117, 1117, 270, 500, 97, 97,
145363
- /* 1840 */ 1117, 1117, 1117, 1117, 1117, 98, 1117, 397, 512, 511,
145364
- /* 1850 */ 1117, 1117, 916, 916, 916, 918, 919, 25, 1117, 404,
145365
- /* 1860 */ 1117, 1117, 1117, 253, 1117, 1117, 1117, 1117, 348, 348,
145366
- /* 1870 */ 347, 238, 345, 1117, 1117, 764, 1117, 1117, 1117, 1117,
145367
- /* 1880 */ 1117, 1117, 1117, 916, 916, 918, 919, 25, 198, 1117,
145368
- /* 1890 */ 276, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 275, 1117,
145369
- /* 1900 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145370
- /* 1910 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145371
- /* 1920 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 200, 1117,
145372
- /* 1930 */ 1117, 1117, 1117, 1117, 1117, 1117, 201, 1117, 1117, 146,
145373
- /* 1940 */ 1117, 1117, 1117, 1117, 1117, 1117, 199, 1117, 1117, 1117,
145374
- /* 1950 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145375
- /* 1960 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145376
- /* 1970 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145377
- /* 1980 */ 367, 1117, 1117, 1117, 1117, 270, 500, 1117, 1117, 1117,
145378
- /* 1990 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145379
- /* 2000 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 404,
145193
+ /* 950 */ 398, 512, 376, 512, 57, 57, 512, 795, 512, 376,
145194
+ /* 960 */ 512, 442, 793, 512, 320, 512, 275, 512, 1453, 512,
145195
+ /* 970 */ 1282, 813, 58, 58, 14, 14, 512, 59, 59, 118,
145196
+ /* 980 */ 118, 60, 60, 512, 46, 46, 61, 61, 62, 62,
145197
+ /* 990 */ 47, 47, 512, 190, 189, 91, 512, 140, 140, 512,
145198
+ /* 1000 */ 391, 512, 844, 1195, 141, 141, 512, 843, 512, 793,
145199
+ /* 1010 */ 512, 410, 512, 69, 69, 367, 278, 48, 48, 256,
145200
+ /* 1020 */ 65, 65, 119, 119, 244, 244, 257, 66, 66, 120,
145201
+ /* 1030 */ 120, 121, 121, 117, 117, 367, 512, 509, 380, 112,
145202
+ /* 1040 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110,
145203
+ /* 1050 */ 111, 111, 111, 111, 512, 868, 512, 139, 139, 112,
145204
+ /* 1060 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110,
145205
+ /* 1070 */ 111, 111, 111, 111, 1282, 138, 138, 125, 125, 512,
145206
+ /* 1080 */ 12, 512, 1351, 1282, 512, 442, 131, 1282, 109, 109,
145207
+ /* 1090 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 512,
145208
+ /* 1100 */ 124, 124, 122, 122, 512, 123, 123, 512, 109, 109,
145209
+ /* 1110 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 512,
145210
+ /* 1120 */ 68, 68, 460, 779, 512, 70, 70, 299, 67, 67,
145211
+ /* 1130 */ 1027, 251, 251, 353, 1282, 191, 196, 1427, 462, 1296,
145212
+ /* 1140 */ 38, 38, 381, 94, 509, 42, 42, 177, 844, 271,
145213
+ /* 1150 */ 503, 382, 417, 843, 420, 438, 505, 373, 374, 153,
145214
+ /* 1160 */ 252, 868, 429, 367, 222, 249, 194, 883, 182, 290,
145215
+ /* 1170 */ 779, 988, 88, 988, 463, 884, 906, 911, 424, 426,
145216
+ /* 1180 */ 228, 228, 228, 367, 17, 803, 802, 112, 113, 103,
145217
+ /* 1190 */ 1095, 1095, 949, 952, 942, 942, 110, 110, 111, 111,
145218
+ /* 1200 */ 111, 111, 392, 295, 810, 811, 88, 112, 101, 103,
145219
+ /* 1210 */ 1095, 1095, 949, 952, 942, 942, 110, 110, 111, 111,
145220
+ /* 1220 */ 111, 111, 372, 419, 448, 309, 979, 224, 88, 975,
145221
+ /* 1230 */ 877, 841, 224, 228, 100, 923, 109, 109, 109, 109,
145222
+ /* 1240 */ 108, 108, 107, 107, 107, 106, 398, 86, 430, 777,
145223
+ /* 1250 */ 842, 1236, 130, 100, 1235, 412, 109, 109, 109, 109,
145224
+ /* 1260 */ 108, 108, 107, 107, 107, 106, 398, 317, 1443, 1397,
145225
+ /* 1270 */ 1170, 287, 1169, 979, 1372, 1371, 367, 316, 434, 296,
145226
+ /* 1280 */ 1232, 1223, 923, 300, 303, 305, 307, 1183, 1168, 1167,
145227
+ /* 1290 */ 312, 321, 322, 1244, 1281, 1219, 367, 268, 1230, 499,
145228
+ /* 1300 */ 498, 113, 103, 1095, 1095, 949, 952, 942, 942, 110,
145229
+ /* 1310 */ 110, 111, 111, 111, 111, 1287, 1150, 443, 242, 184,
145230
+ /* 1320 */ 1216, 1143, 103, 1095, 1095, 949, 952, 942, 942, 110,
145231
+ /* 1330 */ 110, 111, 111, 111, 111, 1132, 1131, 1133, 1437, 350,
145232
+ /* 1340 */ 411, 324, 188, 98, 504, 289, 4, 326, 315, 109,
145233
+ /* 1350 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398,
145234
+ /* 1360 */ 507, 328, 1266, 1274, 358, 453, 282, 192, 1346, 109,
145235
+ /* 1370 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398,
145236
+ /* 1380 */ 11, 1166, 1345, 399, 1440, 330, 502, 1110, 231, 428,
145237
+ /* 1390 */ 1391, 343, 187, 98, 504, 501, 4, 1107, 1389, 375,
145238
+ /* 1400 */ 422, 155, 72, 165, 75, 152, 149, 86, 414, 1263,
145239
+ /* 1410 */ 507, 157, 415, 160, 929, 161, 162, 163, 446, 1271,
145240
+ /* 1420 */ 96, 96, 8, 30, 208, 1277, 357, 97, 355, 399,
145241
+ /* 1430 */ 514, 513, 421, 399, 919, 31, 169, 435, 1340, 212,
145242
+ /* 1440 */ 80, 441, 243, 214, 1360, 501, 298, 174, 444, 302,
145243
+ /* 1450 */ 215, 271, 503, 1134, 216, 360, 485, 459, 388, 1186,
145244
+ /* 1460 */ 361, 484, 1185, 795, 929, 919, 919, 921, 922, 24,
145245
+ /* 1470 */ 96, 96, 1184, 1158, 1177, 314, 1157, 97, 1176, 399,
145246
+ /* 1480 */ 514, 513, 469, 1156, 919, 1452, 390, 266, 98, 504,
145247
+ /* 1490 */ 267, 4, 472, 478, 483, 85, 1227, 333, 230, 492,
145248
+ /* 1500 */ 1408, 332, 323, 115, 10, 507, 1228, 181, 335, 98,
145249
+ /* 1510 */ 504, 337, 4, 92, 87, 919, 919, 921, 922, 24,
145250
+ /* 1520 */ 1429, 1063, 401, 1226, 481, 254, 507, 325, 399, 327,
145251
+ /* 1530 */ 349, 349, 348, 239, 346, 1225, 329, 766, 1209, 1326,
145252
+ /* 1540 */ 501, 183, 1208, 341, 269, 342, 237, 1069, 1140, 399,
145253
+ /* 1550 */ 199, 485, 277, 29, 515, 241, 486, 238, 516, 929,
145254
+ /* 1560 */ 276, 501, 240, 1129, 1124, 96, 96, 1376, 142, 154,
145255
+ /* 1570 */ 369, 370, 97, 143, 399, 514, 513, 1377, 128, 919,
145256
+ /* 1580 */ 929, 1375, 144, 753, 400, 1374, 96, 96, 848, 1154,
145257
+ /* 1590 */ 201, 1153, 185, 97, 264, 399, 514, 513, 202, 71,
145258
+ /* 1600 */ 919, 146, 1151, 273, 198, 404, 126, 987, 200, 985,
145259
+ /* 1610 */ 919, 919, 921, 922, 24, 903, 156, 145, 204, 158,
145260
+ /* 1620 */ 827, 98, 504, 288, 4, 207, 1001, 164, 147, 907,
145261
+ /* 1630 */ 377, 919, 919, 921, 922, 24, 379, 148, 507, 166,
145262
+ /* 1640 */ 76, 77, 368, 1004, 78, 79, 209, 271, 503, 210,
145263
+ /* 1650 */ 1000, 137, 18, 297, 211, 228, 440, 1104, 213, 171,
145264
+ /* 1660 */ 32, 399, 768, 993, 170, 316, 445, 217, 449, 806,
145265
+ /* 1670 */ 406, 310, 172, 501, 81, 19, 20, 454, 82, 83,
145266
+ /* 1680 */ 265, 150, 179, 461, 485, 151, 180, 955, 84, 484,
145267
+ /* 1690 */ 1035, 34, 929, 35, 468, 1036, 193, 471, 96, 96,
145268
+ /* 1700 */ 246, 248, 876, 175, 871, 97, 100, 399, 514, 513,
145269
+ /* 1710 */ 1063, 401, 919, 227, 254, 1053, 21, 22, 1049, 349,
145270
+ /* 1720 */ 349, 348, 239, 346, 1040, 176, 766, 334, 1051, 7,
145271
+ /* 1730 */ 88, 98, 504, 970, 4, 233, 23, 956, 954, 199,
145272
+ /* 1740 */ 958, 277, 1010, 919, 919, 921, 922, 24, 507, 276,
145273
+ /* 1750 */ 232, 1009, 959, 25, 36, 508, 924, 778, 99, 26,
145274
+ /* 1760 */ 347, 90, 504, 837, 4, 234, 344, 235, 1445, 1064,
145275
+ /* 1770 */ 1120, 399, 1120, 1444, 1120, 1120, 1120, 1120, 507, 201,
145276
+ /* 1780 */ 1120, 1120, 1120, 501, 1120, 1120, 1120, 202, 1120, 1120,
145277
+ /* 1790 */ 146, 1120, 1120, 1120, 1120, 1120, 1120, 200, 1120, 1120,
145278
+ /* 1800 */ 1120, 399, 929, 1120, 1120, 1120, 1120, 1120, 96, 96,
145279
+ /* 1810 */ 1120, 1120, 1120, 501, 1120, 97, 1120, 399, 514, 513,
145280
+ /* 1820 */ 1120, 1120, 919, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145281
+ /* 1830 */ 1120, 368, 929, 1120, 1120, 1120, 271, 503, 96, 96,
145282
+ /* 1840 */ 1120, 1120, 1120, 1120, 1120, 97, 1120, 399, 514, 513,
145283
+ /* 1850 */ 1120, 1120, 919, 919, 919, 921, 922, 24, 1120, 406,
145284
+ /* 1860 */ 1120, 1120, 1120, 254, 1120, 1120, 1120, 1120, 349, 349,
145285
+ /* 1870 */ 348, 239, 346, 1120, 1120, 766, 1120, 1120, 1120, 1120,
145286
+ /* 1880 */ 1120, 1120, 1120, 919, 919, 921, 922, 24, 199, 1120,
145287
+ /* 1890 */ 277, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 276, 1120,
145288
+ /* 1900 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145289
+ /* 1910 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145290
+ /* 1920 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 201, 1120,
145291
+ /* 1930 */ 1120, 1120, 1120, 1120, 1120, 1120, 202, 1120, 1120, 146,
145292
+ /* 1940 */ 1120, 1120, 1120, 1120, 1120, 1120, 200, 1120, 1120, 1120,
145293
+ /* 1950 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145294
+ /* 1960 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145295
+ /* 1970 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145296
+ /* 1980 */ 368, 1120, 1120, 1120, 1120, 271, 503, 1120, 1120, 1120,
145297
+ /* 1990 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145298
+ /* 2000 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 406,
145380145299
};
145381145300
static const YYCODETYPE yy_lookahead[] = {
145382
- /* 0 */ 163, 163, 184, 238, 239, 240, 182, 182, 155, 156,
145383
- /* 10 */ 157, 158, 159, 160, 163, 184, 187, 184, 165, 19,
145384
- /* 20 */ 167, 184, 185, 258, 238, 239, 240, 174, 163, 174,
145385
- /* 30 */ 187, 31, 191, 192, 163, 184, 185, 202, 203, 39,
145386
- /* 40 */ 175, 200, 163, 43, 44, 45, 46, 47, 48, 49,
145387
- /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 174, 206,
145388
- /* 60 */ 207, 206, 207, 238, 239, 240, 163, 238, 239, 240,
145389
- /* 70 */ 59, 233, 219, 249, 219, 202, 203, 174, 254, 224,
145390
- /* 80 */ 225, 238, 239, 240, 163, 232, 73, 184, 185, 163,
145391
- /* 90 */ 206, 207, 92, 93, 94, 95, 96, 97, 98, 99,
145392
- /* 100 */ 100, 101, 102, 219, 233, 184, 185, 96, 97, 206,
145393
- /* 110 */ 207, 274, 19, 276, 261, 104, 105, 106, 107, 198,
145394
- /* 120 */ 109, 163, 219, 220, 221, 274, 275, 102, 117, 116,
145395
- /* 130 */ 117, 118, 19, 175, 208, 81, 43, 44, 45, 46,
145301
+ /* 0 */ 184, 238, 239, 240, 238, 239, 240, 163, 155, 156,
145302
+ /* 10 */ 157, 158, 159, 160, 163, 191, 192, 183, 165, 19,
145303
+ /* 20 */ 167, 258, 202, 203, 200, 191, 163, 174, 184, 185,
145304
+ /* 30 */ 174, 31, 163, 163, 171, 184, 185, 35, 175, 39,
145305
+ /* 40 */ 179, 180, 181, 43, 44, 45, 46, 47, 48, 49,
145306
+ /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 184, 206,
145307
+ /* 60 */ 207, 163, 206, 207, 220, 163, 16, 163, 66, 163,
145308
+ /* 70 */ 59, 270, 219, 229, 273, 219, 74, 208, 174, 223,
145309
+ /* 80 */ 224, 163, 184, 185, 163, 232, 184, 185, 184, 185,
145310
+ /* 90 */ 184, 185, 92, 93, 94, 95, 96, 97, 98, 99,
145311
+ /* 100 */ 100, 101, 102, 233, 198, 184, 185, 96, 97, 163,
145312
+ /* 110 */ 206, 207, 19, 163, 261, 104, 105, 106, 107, 198,
145313
+ /* 120 */ 109, 119, 220, 219, 220, 274, 275, 77, 117, 79,
145314
+ /* 130 */ 187, 229, 19, 229, 184, 185, 43, 44, 45, 46,
145396145315
/* 140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
145397
- /* 150 */ 57, 197, 141, 195, 143, 197, 43, 44, 45, 46,
145316
+ /* 150 */ 57, 233, 141, 134, 143, 102, 43, 44, 45, 46,
145398145317
/* 160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
145399
- /* 170 */ 57, 98, 99, 100, 101, 102, 83, 163, 85, 163,
145400
- /* 180 */ 67, 127, 128, 117, 118, 92, 93, 94, 95, 96,
145318
+ /* 170 */ 57, 152, 274, 216, 276, 218, 83, 163, 85, 233,
145319
+ /* 180 */ 67, 238, 239, 240, 11, 92, 93, 94, 95, 96,
145401145320
/* 190 */ 97, 98, 99, 100, 101, 102, 19, 54, 55, 56,
145402145321
/* 200 */ 57, 58, 163, 26, 163, 92, 93, 94, 95, 96,
145403145322
/* 210 */ 97, 98, 99, 100, 101, 102, 54, 55, 56, 57,
145404145323
/* 220 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
145405145324
/* 230 */ 53, 54, 55, 56, 57, 92, 93, 94, 95, 96,
145406145325
/* 240 */ 97, 98, 99, 100, 101, 102, 69, 96, 97, 98,
145407145326
/* 250 */ 99, 100, 101, 102, 92, 93, 94, 95, 96, 97,
145408
- /* 260 */ 98, 99, 100, 101, 102, 96, 97, 101, 102, 92,
145327
+ /* 260 */ 98, 99, 100, 101, 102, 81, 179, 180, 181, 92,
145409145328
/* 270 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
145410
- /* 280 */ 108, 267, 268, 111, 112, 113, 163, 163, 163, 19,
145411
- /* 290 */ 179, 180, 181, 121, 24, 59, 92, 93, 94, 95,
145412
- /* 300 */ 96, 97, 98, 99, 100, 101, 102, 184, 185, 268,
145413
- /* 310 */ 141, 163, 143, 43, 44, 45, 46, 47, 48, 49,
145329
+ /* 280 */ 163, 267, 268, 163, 22, 23, 59, 163, 26, 19,
145330
+ /* 290 */ 117, 118, 175, 109, 24, 59, 92, 93, 94, 95,
145331
+ /* 300 */ 96, 97, 98, 99, 100, 101, 102, 268, 184, 185,
145332
+ /* 310 */ 269, 127, 128, 43, 44, 45, 46, 47, 48, 49,
145414145333
/* 320 */ 50, 51, 52, 53, 54, 55, 56, 57, 157, 158,
145415
- /* 330 */ 159, 160, 46, 47, 48, 49, 165, 59, 167, 163,
145334
+ /* 330 */ 159, 160, 105, 106, 107, 163, 165, 59, 167, 184,
145416145335
/* 340 */ 90, 105, 106, 107, 108, 174, 73, 111, 112, 113,
145417
- /* 350 */ 19, 22, 163, 205, 81, 231, 106, 121, 233, 163,
145336
+ /* 350 */ 19, 22, 163, 91, 81, 163, 106, 121, 81, 132,
145418145337
/* 360 */ 110, 16, 92, 93, 94, 95, 96, 97, 98, 99,
145419
- /* 370 */ 100, 101, 102, 184, 185, 163, 98, 206, 207, 26,
145420
- /* 380 */ 184, 185, 19, 105, 106, 107, 23, 198, 59, 116,
145421
- /* 390 */ 219, 141, 142, 143, 198, 22, 110, 274, 275, 234,
145422
- /* 400 */ 127, 128, 123, 232, 125, 126, 43, 44, 45, 46,
145338
+ /* 370 */ 100, 101, 102, 184, 185, 255, 98, 206, 207, 26,
145339
+ /* 380 */ 101, 102, 19, 105, 106, 107, 23, 198, 59, 116,
145340
+ /* 390 */ 219, 141, 142, 143, 24, 163, 187, 205, 274, 275,
145341
+ /* 400 */ 127, 128, 182, 232, 127, 128, 43, 44, 45, 46,
145423145342
/* 410 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
145424
- /* 420 */ 57, 158, 77, 160, 79, 59, 53, 163, 165, 163,
145425
- /* 430 */ 167, 163, 261, 102, 105, 106, 107, 174, 72, 108,
145426
- /* 440 */ 109, 110, 111, 112, 113, 114, 59, 163, 184, 185,
145427
- /* 450 */ 22, 120, 163, 206, 207, 92, 93, 94, 95, 96,
145428
- /* 460 */ 97, 98, 99, 100, 101, 102, 219, 255, 163, 206,
145429
- /* 470 */ 207, 105, 106, 107, 208, 19, 163, 90, 163, 23,
145430
- /* 480 */ 127, 128, 219, 183, 220, 221, 163, 59, 163, 184,
145431
- /* 490 */ 185, 191, 105, 106, 149, 232, 163, 110, 163, 43,
145343
+ /* 420 */ 57, 158, 77, 160, 79, 59, 26, 182, 165, 59,
145344
+ /* 430 */ 167, 199, 261, 102, 105, 106, 107, 174, 72, 108,
145345
+ /* 440 */ 109, 110, 111, 112, 113, 114, 59, 238, 239, 240,
145346
+ /* 450 */ 123, 120, 125, 126, 163, 92, 93, 94, 95, 96,
145347
+ /* 460 */ 97, 98, 99, 100, 101, 102, 163, 163, 163, 206,
145348
+ /* 470 */ 207, 105, 106, 107, 254, 19, 106, 90, 197, 23,
145349
+ /* 480 */ 127, 128, 219, 238, 239, 240, 22, 184, 185, 184,
145350
+ /* 490 */ 185, 22, 105, 106, 149, 232, 205, 110, 163, 43,
145432145351
/* 500 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
145433
- /* 510 */ 54, 55, 56, 57, 230, 22, 23, 184, 185, 26,
145434
- /* 520 */ 205, 163, 199, 59, 261, 220, 221, 163, 141, 142,
145435
- /* 530 */ 143, 198, 174, 105, 106, 107, 72, 269, 163, 59,
145436
- /* 540 */ 205, 163, 184, 185, 22, 116, 117, 118, 92, 93,
145352
+ /* 510 */ 54, 55, 56, 57, 98, 99, 100, 101, 102, 184,
145353
+ /* 520 */ 185, 163, 53, 59, 261, 220, 117, 118, 141, 142,
145354
+ /* 530 */ 143, 131, 174, 59, 229, 116, 117, 118, 163, 59,
145355
+ /* 540 */ 163, 163, 184, 185, 59, 242, 72, 22, 92, 93,
145437145356
/* 550 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 184,
145438
- /* 560 */ 185, 163, 184, 185, 206, 207, 163, 163, 19, 105,
145439
- /* 570 */ 106, 107, 23, 22, 259, 174, 198, 219, 220, 22,
145440
- /* 580 */ 255, 59, 184, 185, 91, 105, 106, 107, 184, 185,
145441
- /* 590 */ 22, 23, 43, 44, 45, 46, 47, 48, 49, 50,
145442
- /* 600 */ 51, 52, 53, 54, 55, 56, 57, 206, 207, 163,
145443
- /* 610 */ 59, 76, 132, 179, 180, 181, 59, 242, 220, 221,
145444
- /* 620 */ 219, 86, 12, 163, 220, 221, 163, 105, 106, 107,
145445
- /* 630 */ 184, 185, 59, 230, 171, 234, 163, 27, 175, 174,
145446
- /* 640 */ 26, 92, 93, 94, 95, 96, 97, 98, 99, 100,
145447
- /* 650 */ 101, 102, 42, 163, 163, 59, 105, 106, 107, 91,
145448
- /* 660 */ 163, 19, 105, 106, 107, 23, 220, 221, 208, 264,
145449
- /* 670 */ 265, 206, 207, 63, 184, 185, 81, 163, 105, 106,
145450
- /* 680 */ 107, 184, 185, 73, 219, 43, 44, 45, 46, 47,
145357
+ /* 560 */ 185, 24, 184, 185, 206, 207, 202, 203, 19, 105,
145358
+ /* 570 */ 106, 107, 23, 198, 22, 174, 198, 219, 220, 105,
145359
+ /* 580 */ 106, 107, 96, 97, 59, 105, 106, 107, 22, 174,
145360
+ /* 590 */ 59, 106, 43, 44, 45, 46, 47, 48, 49, 50,
145361
+ /* 600 */ 51, 52, 53, 54, 55, 56, 57, 206, 207, 12,
145362
+ /* 610 */ 108, 59, 132, 111, 112, 113, 46, 47, 48, 49,
145363
+ /* 620 */ 219, 206, 207, 121, 27, 59, 163, 141, 207, 143,
145364
+ /* 630 */ 105, 106, 107, 163, 219, 234, 105, 106, 107, 42,
145365
+ /* 640 */ 219, 92, 93, 94, 95, 96, 97, 98, 99, 100,
145366
+ /* 650 */ 101, 102, 76, 163, 184, 185, 163, 105, 106, 107,
145367
+ /* 660 */ 63, 19, 86, 163, 163, 23, 163, 130, 205, 21,
145368
+ /* 670 */ 73, 105, 106, 107, 184, 185, 163, 184, 185, 237,
145369
+ /* 680 */ 110, 180, 181, 180, 181, 43, 44, 45, 46, 47,
145451145370
/* 690 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
145452
- /* 700 */ 163, 105, 106, 107, 109, 132, 163, 226, 22, 23,
145453
- /* 710 */ 220, 21, 26, 163, 174, 163, 174, 220, 174, 205,
145454
- /* 720 */ 29, 230, 127, 128, 33, 19, 59, 184, 185, 115,
145455
- /* 730 */ 180, 181, 180, 181, 92, 93, 94, 95, 96, 97,
145456
- /* 740 */ 98, 99, 100, 101, 102, 163, 206, 207, 206, 207,
145457
- /* 750 */ 206, 207, 46, 163, 19, 22, 65, 23, 23, 219,
145458
- /* 760 */ 26, 219, 174, 219, 163, 163, 184, 185, 174, 22,
145459
- /* 770 */ 80, 24, 35, 106, 184, 185, 163, 91, 43, 44,
145371
+ /* 700 */ 174, 163, 163, 22, 23, 163, 163, 26, 22, 23,
145372
+ /* 710 */ 220, 29, 73, 220, 272, 33, 22, 163, 24, 19,
145373
+ /* 720 */ 174, 208, 259, 184, 185, 19, 184, 185, 80, 175,
145374
+ /* 730 */ 230, 174, 206, 207, 92, 93, 94, 95, 96, 97,
145375
+ /* 740 */ 98, 99, 100, 101, 102, 219, 46, 65, 247, 195,
145376
+ /* 750 */ 247, 197, 206, 207, 19, 116, 117, 118, 23, 220,
145377
+ /* 760 */ 112, 174, 220, 206, 207, 219, 22, 174, 24, 174,
145378
+ /* 770 */ 22, 23, 91, 264, 265, 168, 219, 91, 43, 44,
145460145379
/* 780 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
145461
- /* 790 */ 55, 56, 57, 12, 206, 207, 163, 247, 163, 247,
145462
- /* 800 */ 206, 207, 112, 66, 177, 178, 59, 219, 27, 208,
145463
- /* 810 */ 104, 74, 163, 219, 116, 117, 118, 184, 185, 153,
145464
- /* 820 */ 154, 163, 163, 42, 163, 163, 120, 92, 93, 94,
145465
- /* 830 */ 95, 96, 97, 98, 99, 100, 101, 102, 163, 149,
145466
- /* 840 */ 163, 107, 184, 185, 63, 184, 185, 19, 163, 270,
145467
- /* 850 */ 163, 23, 273, 106, 205, 11, 119, 255, 46, 184,
145468
- /* 860 */ 185, 184, 185, 130, 205, 163, 132, 19, 163, 184,
145380
+ /* 790 */ 55, 56, 57, 206, 207, 12, 163, 149, 255, 206,
145381
+ /* 800 */ 207, 206, 207, 59, 104, 23, 219, 163, 26, 163,
145382
+ /* 810 */ 27, 105, 219, 163, 219, 163, 211, 184, 185, 163,
145383
+ /* 820 */ 120, 163, 146, 163, 148, 42, 221, 92, 93, 94,
145384
+ /* 830 */ 95, 96, 97, 98, 99, 100, 101, 102, 163, 91,
145385
+ /* 840 */ 184, 185, 184, 185, 184, 185, 63, 19, 163, 205,
145386
+ /* 850 */ 106, 23, 245, 163, 208, 248, 116, 117, 118, 184,
145387
+ /* 860 */ 185, 163, 163, 7, 8, 9, 163, 19, 26, 184,
145469145388
/* 870 */ 185, 43, 44, 45, 46, 47, 48, 49, 50, 51,
145470
- /* 880 */ 52, 53, 54, 55, 56, 57, 184, 185, 26, 184,
145471
- /* 890 */ 185, 43, 44, 45, 46, 47, 48, 49, 50, 51,
145472
- /* 900 */ 52, 53, 54, 55, 56, 57, 206, 207, 7, 8,
145473
- /* 910 */ 9, 163, 146, 163, 148, 163, 104, 163, 231, 219,
145389
+ /* 880 */ 52, 53, 54, 55, 56, 57, 163, 184, 185, 107,
145390
+ /* 890 */ 163, 43, 44, 45, 46, 47, 48, 49, 50, 51,
145391
+ /* 900 */ 52, 53, 54, 55, 56, 57, 208, 255, 177, 178,
145392
+ /* 910 */ 163, 184, 185, 163, 132, 163, 141, 163, 143, 22,
145474145393
/* 920 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
145475
- /* 930 */ 102, 163, 184, 185, 184, 185, 184, 185, 184, 185,
145394
+ /* 930 */ 102, 184, 185, 163, 184, 185, 184, 185, 184, 185,
145476145395
/* 940 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
145477
- /* 950 */ 102, 163, 184, 185, 163, 163, 163, 168, 163, 163,
145478
- /* 960 */ 163, 117, 118, 163, 237, 163, 237, 163, 26, 107,
145479
- /* 970 */ 163, 163, 184, 185, 163, 184, 185, 184, 185, 184,
145480
- /* 980 */ 185, 184, 185, 98, 184, 185, 184, 185, 184, 185,
145481
- /* 990 */ 163, 184, 185, 207, 132, 147, 163, 19, 163, 272,
145482
- /* 1000 */ 163, 272, 163, 24, 163, 219, 163, 199, 163, 124,
145483
- /* 1010 */ 163, 184, 185, 23, 129, 19, 26, 184, 185, 184,
145484
- /* 1020 */ 185, 184, 185, 184, 185, 184, 185, 184, 185, 184,
145485
- /* 1030 */ 185, 184, 185, 163, 245, 19, 163, 248, 59, 43,
145396
+ /* 950 */ 102, 163, 163, 163, 184, 185, 163, 115, 163, 163,
145397
+ /* 960 */ 163, 163, 59, 163, 163, 163, 163, 163, 23, 163,
145398
+ /* 970 */ 163, 26, 184, 185, 184, 185, 163, 184, 185, 184,
145399
+ /* 980 */ 185, 184, 185, 163, 184, 185, 184, 185, 184, 185,
145400
+ /* 990 */ 184, 185, 163, 96, 97, 147, 163, 184, 185, 163,
145401
+ /* 1000 */ 199, 163, 124, 205, 184, 185, 163, 129, 163, 106,
145402
+ /* 1010 */ 163, 234, 163, 184, 185, 19, 163, 184, 185, 230,
145403
+ /* 1020 */ 184, 185, 184, 185, 206, 207, 230, 184, 185, 184,
145404
+ /* 1030 */ 185, 184, 185, 184, 185, 19, 163, 219, 231, 43,
145486145405
/* 1040 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
145487
- /* 1050 */ 54, 55, 56, 57, 184, 185, 163, 184, 185, 43,
145406
+ /* 1050 */ 54, 55, 56, 57, 163, 26, 163, 184, 185, 43,
145488145407
/* 1060 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
145489
- /* 1070 */ 54, 55, 56, 57, 16, 19, 22, 184, 185, 163,
145490
- /* 1080 */ 138, 163, 22, 105, 163, 106, 22, 23, 92, 93,
145408
+ /* 1070 */ 54, 55, 56, 57, 163, 184, 185, 184, 185, 163,
145409
+ /* 1080 */ 182, 163, 163, 163, 163, 163, 22, 163, 92, 93,
145491145410
/* 1090 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 163,
145492145411
/* 1100 */ 184, 185, 184, 185, 163, 184, 185, 163, 92, 93,
145493
- /* 1110 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 59,
145494
- /* 1120 */ 184, 185, 177, 178, 163, 184, 185, 163, 184, 185,
145495
- /* 1130 */ 26, 163, 163, 182, 163, 77, 163, 79, 127, 128,
145496
- /* 1140 */ 262, 263, 124, 147, 24, 184, 185, 129, 184, 185,
145497
- /* 1150 */ 96, 97, 184, 185, 163, 91, 224, 225, 211, 31,
145498
- /* 1160 */ 22, 105, 24, 19, 118, 163, 106, 39, 24, 222,
145499
- /* 1170 */ 23, 23, 23, 26, 26, 26, 23, 23, 23, 26,
145500
- /* 1180 */ 26, 26, 23, 19, 22, 26, 140, 43, 44, 45,
145412
+ /* 1110 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 163,
145413
+ /* 1120 */ 184, 185, 98, 59, 163, 184, 185, 205, 184, 185,
145414
+ /* 1130 */ 23, 206, 207, 26, 163, 26, 107, 153, 154, 237,
145415
+ /* 1140 */ 184, 185, 231, 147, 219, 184, 185, 249, 124, 127,
145416
+ /* 1150 */ 128, 231, 254, 129, 118, 231, 177, 178, 262, 263,
145417
+ /* 1160 */ 22, 132, 19, 19, 46, 223, 224, 31, 24, 23,
145418
+ /* 1170 */ 106, 141, 26, 143, 272, 39, 140, 23, 23, 23,
145419
+ /* 1180 */ 26, 26, 26, 19, 22, 109, 110, 43, 44, 45,
145501145420
/* 1190 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
145502
- /* 1200 */ 56, 57, 231, 23, 231, 254, 26, 43, 44, 45,
145421
+ /* 1200 */ 56, 57, 231, 23, 7, 8, 26, 43, 44, 45,
145503145422
/* 1210 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
145504
- /* 1220 */ 56, 57, 231, 61, 59, 109, 110, 7, 8, 23,
145505
- /* 1230 */ 23, 59, 26, 26, 59, 131, 92, 93, 94, 95,
145506
- /* 1240 */ 96, 97, 98, 99, 100, 101, 102, 141, 23, 143,
145507
- /* 1250 */ 130, 26, 141, 163, 143, 163, 92, 93, 94, 95,
145508
- /* 1260 */ 96, 97, 98, 99, 100, 101, 102, 110, 163, 23,
145509
- /* 1270 */ 163, 106, 26, 163, 193, 163, 19, 120, 106, 193,
145510
- /* 1280 */ 163, 106, 163, 203, 163, 163, 193, 163, 163, 163,
145511
- /* 1290 */ 163, 223, 163, 163, 163, 163, 19, 163, 163, 163,
145423
+ /* 1220 */ 56, 57, 104, 61, 23, 23, 59, 26, 26, 23,
145424
+ /* 1230 */ 23, 23, 26, 26, 26, 59, 92, 93, 94, 95,
145425
+ /* 1240 */ 96, 97, 98, 99, 100, 101, 102, 138, 105, 23,
145426
+ /* 1250 */ 23, 163, 26, 26, 163, 163, 92, 93, 94, 95,
145427
+ /* 1260 */ 96, 97, 98, 99, 100, 101, 102, 110, 130, 163,
145428
+ /* 1270 */ 193, 163, 193, 106, 163, 163, 19, 120, 163, 163,
145429
+ /* 1280 */ 163, 225, 106, 163, 163, 163, 163, 163, 193, 163,
145430
+ /* 1290 */ 163, 163, 163, 163, 163, 163, 19, 222, 163, 203,
145512145431
/* 1300 */ 163, 44, 45, 46, 47, 48, 49, 50, 51, 52,
145513
- /* 1310 */ 53, 54, 55, 56, 57, 163, 251, 250, 209, 163,
145514
- /* 1320 */ 223, 163, 45, 46, 47, 48, 49, 50, 51, 52,
145515
- /* 1330 */ 53, 54, 55, 56, 57, 161, 223, 223, 223, 256,
145516
- /* 1340 */ 256, 196, 182, 19, 20, 227, 22, 244, 187, 92,
145432
+ /* 1310 */ 53, 54, 55, 56, 57, 163, 163, 251, 250, 209,
145433
+ /* 1320 */ 222, 163, 45, 46, 47, 48, 49, 50, 51, 52,
145434
+ /* 1330 */ 53, 54, 55, 56, 57, 163, 163, 163, 163, 161,
145435
+ /* 1340 */ 226, 222, 182, 19, 20, 256, 22, 222, 187, 92,
145517145436
/* 1350 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
145518
- /* 1360 */ 36, 210, 192, 213, 188, 187, 227, 227, 187, 92,
145437
+ /* 1360 */ 36, 222, 213, 213, 213, 188, 226, 196, 187, 92,
145519145438
/* 1370 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
145520
- /* 1380 */ 213, 213, 166, 59, 130, 212, 60, 210, 170, 170,
145521
- /* 1390 */ 38, 170, 104, 19, 20, 71, 22, 22, 235, 257,
145522
- /* 1400 */ 257, 260, 236, 43, 201, 81, 138, 213, 18, 204,
145523
- /* 1410 */ 36, 170, 204, 204, 90, 204, 18, 169, 236, 235,
145524
- /* 1420 */ 96, 97, 48, 213, 201, 213, 213, 103, 201, 105,
145525
- /* 1430 */ 106, 107, 170, 59, 110, 169, 146, 170, 253, 62,
145526
- /* 1440 */ 252, 169, 22, 170, 189, 71, 170, 169, 169, 189,
145527
- /* 1450 */ 104, 127, 128, 64, 189, 186, 82, 186, 194, 115,
145528
- /* 1460 */ 186, 87, 133, 188, 90, 141, 142, 143, 144, 145,
145529
- /* 1470 */ 96, 97, 186, 186, 194, 186, 246, 103, 186, 105,
145530
- /* 1480 */ 106, 107, 189, 102, 110, 246, 189, 229, 19, 20,
145531
- /* 1490 */ 104, 22, 229, 170, 84, 134, 22, 271, 228, 217,
145532
- /* 1500 */ 269, 22, 241, 170, 146, 36, 137, 152, 217, 19,
145533
- /* 1510 */ 20, 228, 22, 229, 229, 141, 142, 143, 144, 145,
145534
- /* 1520 */ 0, 1, 2, 228, 228, 5, 36, 218, 59, 216,
145535
- /* 1530 */ 10, 11, 12, 13, 14, 136, 215, 17, 135, 214,
145536
- /* 1540 */ 71, 243, 25, 213, 173, 26, 13, 164, 172, 59,
145537
- /* 1550 */ 30, 82, 32, 6, 162, 164, 87, 162, 162, 90,
145538
- /* 1560 */ 40, 71, 263, 176, 182, 96, 97, 266, 266, 176,
145539
- /* 1570 */ 182, 4, 103, 176, 105, 106, 107, 3, 22, 110,
145540
- /* 1580 */ 90, 151, 182, 182, 190, 15, 96, 97, 98, 182,
145541
- /* 1590 */ 70, 182, 190, 103, 182, 105, 106, 107, 78, 182,
145542
- /* 1600 */ 110, 81, 89, 16, 23, 23, 128, 139, 88, 24,
145543
- /* 1610 */ 141, 142, 143, 144, 145, 119, 131, 20, 1, 133,
145544
- /* 1620 */ 16, 19, 20, 131, 22, 119, 61, 140, 37, 53,
145545
- /* 1630 */ 139, 141, 142, 143, 144, 145, 53, 53, 36, 53,
145546
- /* 1640 */ 119, 105, 122, 34, 130, 1, 5, 127, 128, 22,
145547
- /* 1650 */ 104, 149, 26, 75, 41, 130, 68, 68, 104, 24,
145548
- /* 1660 */ 20, 59, 19, 120, 114, 67, 67, 22, 22, 22,
145549
- /* 1670 */ 150, 23, 22, 71, 22, 67, 37, 28, 23, 138,
145550
- /* 1680 */ 22, 153, 23, 23, 82, 23, 22, 26, 23, 87,
145551
- /* 1690 */ 24, 22, 90, 130, 24, 23, 23, 105, 96, 97,
145552
- /* 1700 */ 22, 34, 26, 132, 85, 103, 75, 105, 106, 107,
145553
- /* 1710 */ 1, 2, 110, 34, 5, 34, 83, 23, 44, 10,
145554
- /* 1720 */ 11, 12, 13, 14, 24, 26, 17, 26, 23, 34,
145555
- /* 1730 */ 23, 19, 20, 23, 22, 11, 23, 23, 23, 30,
145556
- /* 1740 */ 22, 32, 26, 141, 142, 143, 144, 145, 36, 40,
145557
- /* 1750 */ 22, 22, 26, 23, 23, 22, 124, 23, 22, 130,
145558
- /* 1760 */ 130, 19, 20, 23, 22, 15, 130, 130, 1, 277,
145559
- /* 1770 */ 277, 59, 277, 277, 277, 277, 277, 277, 36, 70,
145439
+ /* 1380 */ 210, 192, 187, 59, 166, 226, 244, 60, 130, 256,
145440
+ /* 1390 */ 170, 212, 210, 19, 20, 71, 22, 38, 170, 170,
145441
+ /* 1400 */ 104, 260, 257, 22, 257, 81, 43, 138, 18, 213,
145442
+ /* 1410 */ 36, 201, 170, 204, 90, 204, 204, 204, 18, 236,
145443
+ /* 1420 */ 96, 97, 48, 235, 169, 201, 236, 103, 213, 105,
145444
+ /* 1430 */ 106, 107, 213, 59, 110, 235, 201, 170, 213, 169,
145445
+ /* 1440 */ 146, 62, 170, 169, 253, 71, 252, 22, 189, 170,
145446
+ /* 1450 */ 169, 127, 128, 170, 169, 189, 82, 104, 64, 186,
145447
+ /* 1460 */ 189, 87, 186, 115, 90, 141, 142, 143, 144, 145,
145448
+ /* 1470 */ 96, 97, 186, 186, 194, 186, 188, 103, 194, 105,
145449
+ /* 1480 */ 106, 107, 189, 186, 110, 186, 102, 246, 19, 20,
145450
+ /* 1490 */ 246, 22, 189, 133, 84, 104, 228, 22, 170, 134,
145451
+ /* 1500 */ 269, 271, 227, 137, 22, 36, 228, 216, 216, 19,
145452
+ /* 1510 */ 20, 170, 22, 146, 136, 141, 142, 143, 144, 145,
145453
+ /* 1520 */ 0, 1, 2, 228, 135, 5, 36, 227, 59, 227,
145454
+ /* 1530 */ 10, 11, 12, 13, 14, 228, 227, 17, 217, 241,
145455
+ /* 1540 */ 71, 215, 217, 214, 243, 213, 25, 13, 173, 59,
145456
+ /* 1550 */ 30, 82, 32, 26, 172, 6, 87, 164, 162, 90,
145457
+ /* 1560 */ 40, 71, 164, 162, 162, 96, 97, 182, 176, 263,
145458
+ /* 1570 */ 266, 266, 103, 176, 105, 106, 107, 182, 190, 110,
145459
+ /* 1580 */ 90, 182, 176, 4, 3, 182, 96, 97, 98, 182,
145460
+ /* 1590 */ 70, 182, 22, 103, 190, 105, 106, 107, 78, 182,
145461
+ /* 1600 */ 110, 81, 182, 151, 15, 89, 16, 23, 88, 23,
145462
+ /* 1610 */ 141, 142, 143, 144, 145, 128, 139, 119, 24, 131,
145463
+ /* 1620 */ 20, 19, 20, 16, 22, 133, 1, 131, 119, 140,
145464
+ /* 1630 */ 61, 141, 142, 143, 144, 145, 37, 119, 36, 139,
145465
+ /* 1640 */ 53, 53, 122, 105, 53, 53, 34, 127, 128, 130,
145466
+ /* 1650 */ 1, 5, 22, 149, 104, 26, 41, 75, 130, 104,
145467
+ /* 1660 */ 24, 59, 20, 68, 68, 120, 19, 114, 67, 28,
145468
+ /* 1670 */ 150, 23, 22, 71, 22, 22, 22, 67, 22, 138,
145469
+ /* 1680 */ 67, 37, 23, 22, 82, 153, 23, 23, 26, 87,
145470
+ /* 1690 */ 23, 22, 90, 22, 24, 23, 130, 24, 96, 97,
145471
+ /* 1700 */ 23, 23, 105, 22, 132, 103, 26, 105, 106, 107,
145472
+ /* 1710 */ 1, 2, 110, 34, 5, 75, 34, 34, 85, 10,
145473
+ /* 1720 */ 11, 12, 13, 14, 23, 26, 17, 24, 83, 44,
145474
+ /* 1730 */ 26, 19, 20, 23, 22, 22, 34, 23, 23, 30,
145475
+ /* 1740 */ 23, 32, 23, 141, 142, 143, 144, 145, 36, 40,
145476
+ /* 1750 */ 26, 23, 11, 22, 22, 26, 23, 23, 22, 22,
145477
+ /* 1760 */ 15, 19, 20, 124, 22, 130, 23, 130, 130, 1,
145478
+ /* 1770 */ 277, 59, 277, 130, 277, 277, 277, 277, 36, 70,
145560145479
/* 1780 */ 277, 277, 277, 71, 277, 277, 277, 78, 277, 277,
145561145480
/* 1790 */ 81, 277, 277, 277, 277, 277, 277, 88, 277, 277,
145562145481
/* 1800 */ 277, 59, 90, 277, 277, 277, 277, 277, 96, 97,
145563145482
/* 1810 */ 277, 277, 277, 71, 277, 103, 277, 105, 106, 107,
145564145483
/* 1820 */ 277, 277, 110, 277, 277, 277, 277, 277, 277, 277,
@@ -145580,162 +145499,162 @@
145580145499
/* 1980 */ 122, 277, 277, 277, 277, 127, 128, 277, 277, 277,
145581145500
/* 1990 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
145582145501
/* 2000 */ 277, 277, 277, 277, 277, 277, 277, 277, 150, 277,
145583145502
/* 2010 */ 277, 277, 277, 277, 277, 277, 277, 277, 277,
145584145503
};
145585
-#define YY_SHIFT_COUNT (515)
145504
+#define YY_SHIFT_COUNT (517)
145586145505
#define YY_SHIFT_MIN (0)
145587145506
#define YY_SHIFT_MAX (1858)
145588145507
static const unsigned short int yy_shift_ofst[] = {
145589
- /* 0 */ 1709, 1520, 1858, 1324, 1324, 54, 1374, 1469, 1602, 1712,
145590
- /* 10 */ 1712, 1712, 1712, 1712, 273, 0, 0, 113, 1016, 1712,
145508
+ /* 0 */ 1709, 1520, 1858, 1324, 1324, 277, 1374, 1469, 1602, 1712,
145509
+ /* 10 */ 1712, 1712, 273, 0, 0, 113, 1016, 1712, 1712, 1712,
145591145510
/* 20 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 11, 11, 236,
145592
- /* 30 */ 595, 54, 54, 54, 54, 54, 54, 93, 177, 270,
145511
+ /* 30 */ 184, 277, 277, 277, 277, 277, 277, 93, 177, 270,
145593145512
/* 40 */ 363, 456, 549, 642, 735, 828, 848, 996, 1144, 1016,
145594145513
/* 50 */ 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016,
145595145514
/* 60 */ 1016, 1016, 1016, 1016, 1016, 1016, 1164, 1016, 1257, 1277,
145596145515
/* 70 */ 1277, 1490, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712,
145597145516
/* 80 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712,
145598145517
/* 90 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712,
145599145518
/* 100 */ 1712, 1712, 1712, 1742, 1712, 1712, 1712, 1712, 1712, 1712,
145600145519
/* 110 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 143, 162, 162,
145601
- /* 120 */ 162, 162, 162, 204, 151, 73, 596, 690, 706, 596,
145602
- /* 130 */ 169, 169, 596, 353, 353, 353, 353, 66, 166, 25,
145603
- /* 140 */ 2009, 2009, 331, 331, 331, 329, 366, 329, 329, 610,
145604
- /* 150 */ 610, 428, 464, 493, 686, 596, 596, 596, 596, 596,
145605
- /* 160 */ 596, 596, 596, 596, 596, 596, 596, 596, 596, 596,
145606
- /* 170 */ 596, 596, 596, 596, 596, 596, 596, 844, 667, 666,
145607
- /* 180 */ 666, 535, 667, 1011, 2009, 2009, 2009, 387, 250, 250,
145608
- /* 190 */ 522, 172, 278, 551, 480, 573, 557, 596, 596, 596,
145609
- /* 200 */ 596, 596, 596, 596, 596, 13, 596, 596, 596, 596,
145610
- /* 210 */ 596, 596, 596, 596, 596, 596, 596, 596, 737, 737,
145611
- /* 220 */ 737, 596, 596, 596, 596, 734, 596, 596, 596, 747,
145612
- /* 230 */ 596, 596, 781, 596, 596, 596, 596, 596, 596, 596,
145613
- /* 240 */ 596, 429, 691, 279, 979, 979, 979, 979, 862, 279,
145614
- /* 250 */ 279, 885, 1054, 901, 942, 978, 978, 1056, 942, 942,
145615
- /* 260 */ 1056, 614, 990, 812, 1128, 1128, 1128, 978, 766, 1104,
145616
- /* 270 */ 1018, 1138, 1326, 1254, 1254, 1352, 1352, 1254, 1288, 1375,
145617
- /* 280 */ 1360, 1268, 1390, 1390, 1390, 1390, 1254, 1398, 1268, 1268,
145618
- /* 290 */ 1288, 1375, 1360, 1360, 1268, 1254, 1398, 1290, 1377, 1254,
145619
- /* 300 */ 1398, 1420, 1254, 1398, 1254, 1398, 1420, 1346, 1346, 1346,
145620
- /* 310 */ 1389, 1420, 1346, 1344, 1346, 1389, 1346, 1346, 1420, 1381,
145621
- /* 320 */ 1381, 1420, 1329, 1386, 1329, 1386, 1329, 1386, 1329, 1386,
145622
- /* 330 */ 1254, 1361, 1410, 1474, 1479, 1254, 1358, 1369, 1361, 1355,
145623
- /* 340 */ 1399, 1403, 1268, 1517, 1519, 1533, 1533, 1547, 1547, 1547,
145624
- /* 350 */ 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009,
145625
- /* 360 */ 2009, 2009, 2009, 2009, 2009, 2009, 286, 345, 568, 1064,
145626
- /* 370 */ 1058, 698, 1060, 1147, 373, 1120, 1046, 1148, 1162, 1149,
145627
- /* 380 */ 1153, 1154, 1155, 1159, 1180, 1165, 1116, 1220, 1157, 1172,
145628
- /* 390 */ 1206, 1207, 1225, 1106, 1111, 1246, 1175, 733, 1567, 1574,
145629
- /* 400 */ 1556, 1430, 1570, 1513, 1587, 1581, 1582, 1478, 1468, 1496,
145630
- /* 410 */ 1585, 1485, 1597, 1486, 1604, 1617, 1492, 1487, 1506, 1565,
145631
- /* 420 */ 1591, 1491, 1576, 1583, 1584, 1586, 1521, 1536, 1609, 1514,
145632
- /* 430 */ 1644, 1641, 1627, 1546, 1502, 1588, 1626, 1589, 1578, 1613,
145633
- /* 440 */ 1525, 1554, 1635, 1640, 1643, 1543, 1550, 1645, 1598, 1646,
145634
- /* 450 */ 1647, 1648, 1650, 1599, 1649, 1652, 1608, 1639, 1655, 1541,
145635
- /* 460 */ 1658, 1528, 1659, 1660, 1661, 1662, 1664, 1666, 1665, 1669,
145636
- /* 470 */ 1670, 1563, 1672, 1673, 1592, 1667, 1678, 1571, 1676, 1679,
145637
- /* 480 */ 1681, 1619, 1631, 1633, 1674, 1694, 1700, 1699, 1701, 1695,
145638
- /* 490 */ 1705, 1707, 1710, 1676, 1713, 1714, 1716, 1715, 1718, 1724,
145639
- /* 500 */ 1728, 1729, 1730, 1731, 1733, 1734, 1736, 1726, 1632, 1629,
145640
- /* 510 */ 1630, 1636, 1637, 1740, 1750, 1767,
145520
+ /* 120 */ 162, 162, 162, 204, 151, 416, 531, 648, 700, 531,
145521
+ /* 130 */ 486, 486, 531, 353, 353, 353, 353, 409, 279, 53,
145522
+ /* 140 */ 2009, 2009, 331, 331, 331, 329, 366, 329, 329, 597,
145523
+ /* 150 */ 597, 464, 474, 262, 681, 531, 531, 531, 531, 531,
145524
+ /* 160 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
145525
+ /* 170 */ 531, 531, 531, 531, 531, 531, 531, 173, 485, 984,
145526
+ /* 180 */ 984, 576, 485, 19, 1022, 2009, 2009, 2009, 387, 250,
145527
+ /* 190 */ 250, 525, 502, 278, 552, 227, 480, 566, 531, 531,
145528
+ /* 200 */ 531, 531, 531, 531, 531, 531, 639, 531, 531, 531,
145529
+ /* 210 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 2,
145530
+ /* 220 */ 2, 2, 531, 531, 531, 531, 782, 531, 531, 531,
145531
+ /* 230 */ 744, 531, 531, 783, 531, 531, 531, 531, 531, 531,
145532
+ /* 240 */ 531, 531, 419, 682, 327, 370, 370, 370, 370, 1029,
145533
+ /* 250 */ 327, 327, 1024, 897, 856, 1109, 706, 706, 1143, 1109,
145534
+ /* 260 */ 1109, 1143, 842, 945, 1118, 1136, 1136, 1136, 706, 676,
145535
+ /* 270 */ 400, 878, 694, 1327, 1258, 1258, 1359, 1359, 1258, 1296,
145536
+ /* 280 */ 1381, 1363, 1269, 1390, 1390, 1390, 1390, 1258, 1400, 1269,
145537
+ /* 290 */ 1269, 1296, 1381, 1363, 1363, 1269, 1258, 1400, 1294, 1379,
145538
+ /* 300 */ 1258, 1400, 1425, 1258, 1400, 1258, 1400, 1425, 1353, 1353,
145539
+ /* 310 */ 1353, 1394, 1425, 1353, 1348, 1353, 1394, 1353, 1353, 1425,
145540
+ /* 320 */ 1384, 1384, 1425, 1360, 1391, 1360, 1391, 1360, 1391, 1360,
145541
+ /* 330 */ 1391, 1258, 1365, 1410, 1475, 1366, 1365, 1482, 1258, 1367,
145542
+ /* 340 */ 1366, 1378, 1389, 1269, 1521, 1527, 1534, 1534, 1549, 1549,
145543
+ /* 350 */ 1549, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009,
145544
+ /* 360 */ 2009, 2009, 2009, 2009, 2009, 2009, 2009, 570, 345, 686,
145545
+ /* 370 */ 748, 50, 740, 1064, 1107, 469, 537, 1036, 1146, 1162,
145546
+ /* 380 */ 1154, 1155, 1156, 1180, 1201, 1202, 903, 1076, 1197, 1157,
145547
+ /* 390 */ 1167, 1206, 1207, 1208, 775, 1030, 1226, 1227, 1176, 1138,
145548
+ /* 400 */ 1579, 1581, 1570, 1452, 1589, 1516, 1590, 1584, 1586, 1487,
145549
+ /* 410 */ 1477, 1498, 1594, 1488, 1600, 1492, 1607, 1625, 1496, 1489,
145550
+ /* 420 */ 1509, 1569, 1599, 1500, 1587, 1588, 1591, 1592, 1518, 1538,
145551
+ /* 430 */ 1612, 1519, 1649, 1646, 1630, 1550, 1504, 1595, 1629, 1596,
145552
+ /* 440 */ 1582, 1615, 1528, 1555, 1636, 1642, 1647, 1545, 1553, 1650,
145553
+ /* 450 */ 1601, 1652, 1653, 1648, 1654, 1610, 1641, 1656, 1613, 1644,
145554
+ /* 460 */ 1659, 1541, 1661, 1532, 1663, 1664, 1662, 1667, 1669, 1670,
145555
+ /* 470 */ 1672, 1671, 1673, 1566, 1677, 1678, 1597, 1679, 1681, 1572,
145556
+ /* 480 */ 1680, 1682, 1680, 1683, 1633, 1640, 1645, 1685, 1701, 1703,
145557
+ /* 490 */ 1699, 1704, 1702, 1710, 1680, 1714, 1715, 1717, 1719, 1724,
145558
+ /* 500 */ 1728, 1713, 1741, 1731, 1732, 1733, 1734, 1736, 1737, 1729,
145559
+ /* 510 */ 1639, 1635, 1637, 1638, 1643, 1743, 1745, 1768,
145641145560
};
145642
-#define YY_REDUCE_COUNT (365)
145643
-#define YY_REDUCE_MIN (-235)
145644
-#define YY_REDUCE_MAX (1417)
145561
+#define YY_REDUCE_COUNT (366)
145562
+#define YY_REDUCE_MIN (-237)
145563
+#define YY_REDUCE_MAX (1420)
145645145564
static const short yy_reduce_ofst[] = {
145646
- /* 0 */ -147, 171, 263, -97, 358, -145, -149, -163, 123, 264,
145647
- /* 10 */ 305, 398, 404, 446, 401, -171, -157, -235, -175, -79,
145648
- /* 20 */ 189, 196, 333, 490, 378, 375, 497, 550, 552, -42,
145649
- /* 30 */ -116, 465, 540, 542, 544, 588, 594, -214, -214, -214,
145650
- /* 40 */ -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,
145651
- /* 50 */ -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,
145652
- /* 60 */ -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,
145653
- /* 70 */ -214, 543, 582, 590, 633, 658, 661, 675, 677, 685,
145654
- /* 80 */ 702, 705, 748, 750, 752, 754, 768, 788, 791, 793,
145655
- /* 90 */ 795, 797, 800, 802, 804, 807, 827, 833, 835, 837,
145656
- /* 100 */ 839, 841, 843, 845, 847, 870, 873, 893, 916, 918,
145657
- /* 110 */ 921, 936, 941, 944, 961, 964, 968, -214, -214, -214,
145658
- /* 120 */ -214, -214, -214, -214, -214, -214, 315, 789, -159, 14,
145659
- /* 130 */ 111, 434, 463, 247, 700, 247, 700, -176, -214, -214,
145660
- /* 140 */ -214, -214, 300, 300, 300, -162, -74, -129, 125, -165,
145661
- /* 150 */ -127, 268, 266, 405, 405, -135, 284, 403, 491, 460,
145662
- /* 160 */ 148, 335, 514, 649, 212, 124, 325, 687, 971, 602,
145663
- /* 170 */ 973, 659, 323, 601, 808, 991, 41, 951, 627, 727,
145664
- /* 180 */ 729, 579, 945, 786, 878, 932, 947, -182, -169, -167,
145665
- /* 190 */ -121, -46, 16, 39, 176, 289, 313, 364, 473, 537,
145666
- /* 200 */ 613, 635, 662, 792, 796, 165, 811, 969, 1002, 1090,
145667
- /* 210 */ 1092, 1105, 1107, 1110, 1112, 1117, 1119, 1121, 1081, 1086,
145668
- /* 220 */ 1093, 1122, 1124, 1125, 1126, 481, 1127, 1129, 1130, 1068,
145669
- /* 230 */ 1131, 1132, 1080, 1134, 16, 1135, 1136, 1137, 1152, 1156,
145670
- /* 240 */ 1158, 1065, 1067, 1109, 1097, 1113, 1114, 1115, 481, 1109,
145671
- /* 250 */ 1109, 1151, 1160, 1174, 1150, 1118, 1139, 1083, 1167, 1168,
145672
- /* 260 */ 1084, 1176, 1145, 1170, 1161, 1178, 1181, 1140, 1103, 1173,
145673
- /* 270 */ 1177, 1216, 1141, 1218, 1219, 1142, 1143, 1221, 1166, 1163,
145674
- /* 280 */ 1203, 1194, 1205, 1208, 1209, 1211, 1241, 1248, 1210, 1212,
145675
- /* 290 */ 1182, 1184, 1223, 1227, 1213, 1262, 1266, 1185, 1188, 1267,
145676
- /* 300 */ 1272, 1255, 1273, 1278, 1276, 1279, 1260, 1269, 1271, 1274,
145677
- /* 310 */ 1264, 1265, 1286, 1275, 1287, 1280, 1289, 1292, 1293, 1230,
145678
- /* 320 */ 1239, 1297, 1258, 1270, 1263, 1283, 1284, 1295, 1285, 1296,
145679
- /* 330 */ 1323, 1282, 1226, 1231, 1261, 1333, 1298, 1309, 1291, 1313,
145680
- /* 340 */ 1321, 1325, 1330, 1371, 1376, 1383, 1391, 1392, 1395, 1396,
145681
- /* 350 */ 1301, 1302, 1299, 1387, 1382, 1388, 1400, 1401, 1393, 1394,
145682
- /* 360 */ 1402, 1407, 1409, 1412, 1417, 1397,
145565
+ /* 0 */ -147, 171, 263, -96, 358, -144, -149, -102, 124, -156,
145566
+ /* 10 */ -98, 305, 401, -57, 209, -237, 245, -94, -79, 189,
145567
+ /* 20 */ 375, 490, 493, 378, 303, 539, 542, 501, 503, 554,
145568
+ /* 30 */ 415, 526, 546, 557, 587, 593, 595, -234, -234, -234,
145569
+ /* 40 */ -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,
145570
+ /* 50 */ -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,
145571
+ /* 60 */ -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,
145572
+ /* 70 */ -234, -50, 335, 470, 633, 656, 658, 660, 675, 685,
145573
+ /* 80 */ 703, 727, 747, 750, 752, 754, 770, 788, 790, 793,
145574
+ /* 90 */ 795, 797, 800, 802, 804, 806, 813, 820, 829, 833,
145575
+ /* 100 */ 836, 838, 843, 845, 847, 849, 873, 891, 893, 916,
145576
+ /* 110 */ 918, 921, 936, 941, 944, 956, 961, -234, -234, -234,
145577
+ /* 120 */ -234, -234, -234, -234, -234, -234, 463, 607, -176, 14,
145578
+ /* 130 */ -139, 87, -137, 818, 925, 818, 925, 898, -234, -234,
145579
+ /* 140 */ -234, -234, -166, -166, -166, -130, -131, -82, -54, -180,
145580
+ /* 150 */ 364, 41, 513, 509, 509, 117, 500, 789, 796, 646,
145581
+ /* 160 */ 192, 291, 644, 798, 120, 807, 543, 911, 920, 652,
145582
+ /* 170 */ 924, 922, 232, 698, 801, 971, 39, 220, 731, 442,
145583
+ /* 180 */ 902, -199, 979, -43, 421, 896, 942, 605, -184, -126,
145584
+ /* 190 */ 155, 172, 281, 304, 377, 538, 650, 690, 699, 723,
145585
+ /* 200 */ 803, 853, 919, 1088, 1091, 1092, 777, 1106, 1108, 1111,
145586
+ /* 210 */ 1112, 1115, 1116, 1117, 1120, 1121, 1122, 1123, 1124, 1077,
145587
+ /* 220 */ 1079, 1095, 1126, 1127, 1128, 1129, 1056, 1130, 1131, 1132,
145588
+ /* 230 */ 1075, 1135, 1137, 1096, 1152, 304, 1153, 1158, 1172, 1173,
145589
+ /* 240 */ 1174, 1175, 1066, 1068, 1110, 1098, 1119, 1125, 1139, 1056,
145590
+ /* 250 */ 1110, 1110, 1170, 1160, 1178, 1149, 1114, 1140, 1089, 1150,
145591
+ /* 260 */ 1151, 1133, 1177, 1171, 1189, 1161, 1181, 1195, 1159, 1142,
145592
+ /* 270 */ 1179, 1182, 1218, 1141, 1220, 1228, 1145, 1147, 1229, 1183,
145593
+ /* 280 */ 1188, 1210, 1196, 1209, 1211, 1212, 1213, 1242, 1255, 1215,
145594
+ /* 290 */ 1219, 1190, 1200, 1224, 1235, 1225, 1267, 1270, 1191, 1194,
145595
+ /* 300 */ 1272, 1274, 1259, 1279, 1281, 1283, 1285, 1266, 1273, 1276,
145596
+ /* 310 */ 1286, 1280, 1271, 1287, 1288, 1289, 1284, 1297, 1299, 1293,
145597
+ /* 320 */ 1241, 1244, 1303, 1268, 1275, 1278, 1300, 1295, 1302, 1307,
145598
+ /* 330 */ 1309, 1328, 1291, 1230, 1231, 1321, 1292, 1298, 1341, 1301,
145599
+ /* 340 */ 1325, 1326, 1329, 1332, 1375, 1382, 1393, 1398, 1396, 1401,
145600
+ /* 350 */ 1402, 1304, 1305, 1306, 1392, 1385, 1395, 1399, 1403, 1397,
145601
+ /* 360 */ 1388, 1404, 1407, 1409, 1417, 1420, 1406,
145683145602
};
145684145603
static const YYACTIONTYPE yy_default[] = {
145685
- /* 0 */ 1482, 1482, 1482, 1329, 1115, 1220, 1115, 1115, 1115, 1329,
145686
- /* 10 */ 1329, 1329, 1329, 1329, 1115, 1250, 1250, 1380, 1146, 1115,
145687
- /* 20 */ 1115, 1115, 1115, 1115, 1115, 1328, 1115, 1115, 1115, 1115,
145688
- /* 30 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1256, 1115,
145689
- /* 40 */ 1115, 1115, 1115, 1115, 1330, 1331, 1115, 1115, 1115, 1379,
145690
- /* 50 */ 1381, 1266, 1265, 1264, 1263, 1362, 1237, 1261, 1254, 1258,
145691
- /* 60 */ 1324, 1325, 1323, 1327, 1330, 1331, 1115, 1257, 1295, 1309,
145692
- /* 70 */ 1294, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145693
- /* 80 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145694
- /* 90 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145695
- /* 100 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145696
- /* 110 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1303, 1308, 1314,
145697
- /* 120 */ 1307, 1304, 1297, 1296, 1298, 1299, 1115, 1136, 1185, 1115,
145698
- /* 130 */ 1115, 1115, 1115, 1397, 1396, 1115, 1115, 1146, 1300, 1301,
145699
- /* 140 */ 1311, 1310, 1387, 1438, 1437, 1115, 1115, 1115, 1115, 1115,
145700
- /* 150 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145701
- /* 160 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145702
- /* 170 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1146, 1142, 1420,
145703
- /* 180 */ 1420, 1406, 1142, 1115, 1392, 1220, 1211, 1115, 1115, 1115,
145704
- /* 190 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1384, 1382,
145705
- /* 200 */ 1115, 1344, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145706
- /* 210 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145707
- /* 220 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1216,
145708
- /* 230 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145709
- /* 240 */ 1432, 1115, 1357, 1199, 1216, 1216, 1216, 1216, 1218, 1200,
145710
- /* 250 */ 1198, 1210, 1146, 1122, 1260, 1239, 1239, 1471, 1260, 1260,
145711
- /* 260 */ 1471, 1160, 1452, 1157, 1250, 1250, 1250, 1239, 1326, 1217,
145712
- /* 270 */ 1210, 1115, 1474, 1225, 1225, 1473, 1473, 1225, 1269, 1275,
145713
- /* 280 */ 1188, 1260, 1194, 1194, 1194, 1194, 1225, 1133, 1260, 1260,
145714
- /* 290 */ 1269, 1275, 1188, 1188, 1260, 1225, 1133, 1361, 1468, 1225,
145715
- /* 300 */ 1133, 1337, 1225, 1133, 1225, 1133, 1337, 1186, 1186, 1186,
145716
- /* 310 */ 1175, 1337, 1186, 1160, 1186, 1175, 1186, 1186, 1337, 1341,
145717
- /* 320 */ 1341, 1337, 1243, 1238, 1243, 1238, 1243, 1238, 1243, 1238,
145718
- /* 330 */ 1225, 1244, 1405, 1115, 1332, 1225, 1115, 1255, 1244, 1418,
145719
- /* 340 */ 1253, 1251, 1260, 1139, 1178, 1435, 1435, 1431, 1431, 1431,
145720
- /* 350 */ 1479, 1479, 1392, 1447, 1146, 1146, 1146, 1146, 1447, 1162,
145721
- /* 360 */ 1162, 1146, 1146, 1146, 1146, 1447, 1115, 1115, 1115, 1115,
145722
- /* 370 */ 1115, 1115, 1442, 1115, 1346, 1229, 1115, 1115, 1115, 1115,
145723
- /* 380 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145724
- /* 390 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1280, 1115, 1118,
145725
- /* 400 */ 1389, 1115, 1115, 1388, 1115, 1115, 1115, 1115, 1115, 1115,
145726
- /* 410 */ 1230, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145727
- /* 420 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1470,
145728
- /* 430 */ 1115, 1115, 1115, 1115, 1115, 1115, 1360, 1359, 1115, 1115,
145729
- /* 440 */ 1227, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145730
- /* 450 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145731
- /* 460 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145732
- /* 470 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1252, 1115,
145733
- /* 480 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1419, 1245, 1115,
145734
- /* 490 */ 1115, 1115, 1115, 1461, 1115, 1115, 1115, 1115, 1115, 1115,
145735
- /* 500 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1456, 1202, 1282,
145736
- /* 510 */ 1115, 1281, 1285, 1115, 1127, 1115,
145604
+ /* 0 */ 1486, 1486, 1486, 1335, 1118, 1224, 1118, 1118, 1118, 1335,
145605
+ /* 10 */ 1335, 1335, 1118, 1254, 1254, 1386, 1149, 1118, 1118, 1118,
145606
+ /* 20 */ 1118, 1118, 1118, 1118, 1334, 1118, 1118, 1118, 1118, 1118,
145607
+ /* 30 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1260, 1118,
145608
+ /* 40 */ 1118, 1118, 1118, 1118, 1336, 1337, 1118, 1118, 1118, 1385,
145609
+ /* 50 */ 1387, 1270, 1269, 1268, 1267, 1368, 1241, 1265, 1258, 1262,
145610
+ /* 60 */ 1330, 1331, 1329, 1333, 1337, 1336, 1118, 1261, 1301, 1315,
145611
+ /* 70 */ 1300, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145612
+ /* 80 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145613
+ /* 90 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145614
+ /* 100 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145615
+ /* 110 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1309, 1314, 1320,
145616
+ /* 120 */ 1313, 1310, 1303, 1302, 1304, 1305, 1118, 1139, 1188, 1118,
145617
+ /* 130 */ 1118, 1118, 1118, 1403, 1402, 1118, 1118, 1149, 1306, 1307,
145618
+ /* 140 */ 1317, 1316, 1393, 1442, 1441, 1118, 1118, 1118, 1118, 1118,
145619
+ /* 150 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145620
+ /* 160 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145621
+ /* 170 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1149, 1145, 1295,
145622
+ /* 180 */ 1294, 1412, 1145, 1248, 1118, 1398, 1224, 1215, 1118, 1118,
145623
+ /* 190 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1390,
145624
+ /* 200 */ 1388, 1118, 1350, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145625
+ /* 210 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145626
+ /* 220 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145627
+ /* 230 */ 1220, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145628
+ /* 240 */ 1118, 1436, 1118, 1363, 1202, 1220, 1220, 1220, 1220, 1222,
145629
+ /* 250 */ 1203, 1201, 1214, 1149, 1125, 1264, 1243, 1243, 1475, 1264,
145630
+ /* 260 */ 1264, 1475, 1163, 1456, 1160, 1254, 1254, 1254, 1243, 1332,
145631
+ /* 270 */ 1221, 1214, 1118, 1478, 1229, 1229, 1477, 1477, 1229, 1273,
145632
+ /* 280 */ 1279, 1191, 1264, 1197, 1197, 1197, 1197, 1229, 1136, 1264,
145633
+ /* 290 */ 1264, 1273, 1279, 1191, 1191, 1264, 1229, 1136, 1367, 1472,
145634
+ /* 300 */ 1229, 1136, 1343, 1229, 1136, 1229, 1136, 1343, 1189, 1189,
145635
+ /* 310 */ 1189, 1178, 1343, 1189, 1163, 1189, 1178, 1189, 1189, 1343,
145636
+ /* 320 */ 1347, 1347, 1343, 1247, 1242, 1247, 1242, 1247, 1242, 1247,
145637
+ /* 330 */ 1242, 1229, 1248, 1411, 1118, 1259, 1248, 1338, 1229, 1118,
145638
+ /* 340 */ 1259, 1257, 1255, 1264, 1142, 1181, 1439, 1439, 1435, 1435,
145639
+ /* 350 */ 1435, 1483, 1483, 1398, 1451, 1149, 1149, 1149, 1149, 1451,
145640
+ /* 360 */ 1165, 1165, 1149, 1149, 1149, 1149, 1451, 1118, 1118, 1118,
145641
+ /* 370 */ 1118, 1118, 1118, 1446, 1118, 1352, 1233, 1118, 1118, 1118,
145642
+ /* 380 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145643
+ /* 390 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1284,
145644
+ /* 400 */ 1118, 1121, 1395, 1118, 1118, 1394, 1118, 1118, 1118, 1118,
145645
+ /* 410 */ 1118, 1118, 1234, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145646
+ /* 420 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145647
+ /* 430 */ 1118, 1474, 1118, 1118, 1118, 1118, 1118, 1118, 1366, 1365,
145648
+ /* 440 */ 1118, 1118, 1231, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145649
+ /* 450 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145650
+ /* 460 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145651
+ /* 470 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145652
+ /* 480 */ 1256, 1118, 1410, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145653
+ /* 490 */ 1424, 1249, 1118, 1118, 1465, 1118, 1118, 1118, 1118, 1118,
145654
+ /* 500 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1460,
145655
+ /* 510 */ 1205, 1286, 1118, 1285, 1289, 1118, 1130, 1118,
145737145656
};
145738145657
/********** End of lemon-generated parsing tables *****************************/
145739145658
145740145659
/* The next table maps tokens (terminal symbols) into fallback tokens.
145741145660
** If a construct like the following:
@@ -146145,32 +146064,32 @@
146145146064
/* 211 */ "selcollist",
146146146065
/* 212 */ "from",
146147146066
/* 213 */ "where_opt",
146148146067
/* 214 */ "groupby_opt",
146149146068
/* 215 */ "having_opt",
146150
- /* 216 */ "windowdefn_opt",
146151
- /* 217 */ "orderby_opt",
146152
- /* 218 */ "limit_opt",
146069
+ /* 216 */ "orderby_opt",
146070
+ /* 217 */ "limit_opt",
146071
+ /* 218 */ "window_clause",
146153146072
/* 219 */ "values",
146154146073
/* 220 */ "nexprlist",
146155
- /* 221 */ "exprlist",
146156
- /* 222 */ "sclp",
146157
- /* 223 */ "as",
146158
- /* 224 */ "seltablist",
146159
- /* 225 */ "stl_prefix",
146160
- /* 226 */ "joinop",
146161
- /* 227 */ "indexed_opt",
146162
- /* 228 */ "on_opt",
146163
- /* 229 */ "using_opt",
146074
+ /* 221 */ "sclp",
146075
+ /* 222 */ "as",
146076
+ /* 223 */ "seltablist",
146077
+ /* 224 */ "stl_prefix",
146078
+ /* 225 */ "joinop",
146079
+ /* 226 */ "indexed_opt",
146080
+ /* 227 */ "on_opt",
146081
+ /* 228 */ "using_opt",
146082
+ /* 229 */ "exprlist",
146164146083
/* 230 */ "xfullname",
146165146084
/* 231 */ "idlist",
146166146085
/* 232 */ "with",
146167146086
/* 233 */ "setlist",
146168146087
/* 234 */ "insert_cmd",
146169146088
/* 235 */ "idlist_opt",
146170146089
/* 236 */ "upsert",
146171
- /* 237 */ "over_opt",
146090
+ /* 237 */ "over_clause",
146172146091
/* 238 */ "likeop",
146173146092
/* 239 */ "between_op",
146174146093
/* 240 */ "in_op",
146175146094
/* 241 */ "paren_exprlist",
146176146095
/* 242 */ "case_operand",
@@ -146300,288 +146219,289 @@
146300146219
/* 82 */ "select ::= selectnowith",
146301146220
/* 83 */ "selectnowith ::= selectnowith multiselect_op oneselect",
146302146221
/* 84 */ "multiselect_op ::= UNION",
146303146222
/* 85 */ "multiselect_op ::= UNION ALL",
146304146223
/* 86 */ "multiselect_op ::= EXCEPT|INTERSECT",
146305
- /* 87 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt windowdefn_opt orderby_opt limit_opt",
146306
- /* 88 */ "values ::= VALUES LP nexprlist RP",
146307
- /* 89 */ "values ::= values COMMA LP exprlist RP",
146308
- /* 90 */ "distinct ::= DISTINCT",
146309
- /* 91 */ "distinct ::= ALL",
146310
- /* 92 */ "distinct ::=",
146311
- /* 93 */ "sclp ::=",
146312
- /* 94 */ "selcollist ::= sclp scanpt expr scanpt as",
146313
- /* 95 */ "selcollist ::= sclp scanpt STAR",
146314
- /* 96 */ "selcollist ::= sclp scanpt nm DOT STAR",
146315
- /* 97 */ "as ::= AS nm",
146316
- /* 98 */ "as ::=",
146317
- /* 99 */ "from ::=",
146318
- /* 100 */ "from ::= FROM seltablist",
146319
- /* 101 */ "stl_prefix ::= seltablist joinop",
146320
- /* 102 */ "stl_prefix ::=",
146321
- /* 103 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
146322
- /* 104 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
146323
- /* 105 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
146324
- /* 106 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
146325
- /* 107 */ "dbnm ::=",
146326
- /* 108 */ "dbnm ::= DOT nm",
146327
- /* 109 */ "fullname ::= nm",
146328
- /* 110 */ "fullname ::= nm DOT nm",
146329
- /* 111 */ "xfullname ::= nm",
146330
- /* 112 */ "xfullname ::= nm DOT nm",
146331
- /* 113 */ "xfullname ::= nm DOT nm AS nm",
146332
- /* 114 */ "xfullname ::= nm AS nm",
146333
- /* 115 */ "joinop ::= COMMA|JOIN",
146334
- /* 116 */ "joinop ::= JOIN_KW JOIN",
146335
- /* 117 */ "joinop ::= JOIN_KW nm JOIN",
146336
- /* 118 */ "joinop ::= JOIN_KW nm nm JOIN",
146337
- /* 119 */ "on_opt ::= ON expr",
146338
- /* 120 */ "on_opt ::=",
146339
- /* 121 */ "indexed_opt ::=",
146340
- /* 122 */ "indexed_opt ::= INDEXED BY nm",
146341
- /* 123 */ "indexed_opt ::= NOT INDEXED",
146342
- /* 124 */ "using_opt ::= USING LP idlist RP",
146343
- /* 125 */ "using_opt ::=",
146344
- /* 126 */ "orderby_opt ::=",
146345
- /* 127 */ "orderby_opt ::= ORDER BY sortlist",
146346
- /* 128 */ "sortlist ::= sortlist COMMA expr sortorder",
146347
- /* 129 */ "sortlist ::= expr sortorder",
146348
- /* 130 */ "sortorder ::= ASC",
146349
- /* 131 */ "sortorder ::= DESC",
146350
- /* 132 */ "sortorder ::=",
146351
- /* 133 */ "groupby_opt ::=",
146352
- /* 134 */ "groupby_opt ::= GROUP BY nexprlist",
146353
- /* 135 */ "having_opt ::=",
146354
- /* 136 */ "having_opt ::= HAVING expr",
146355
- /* 137 */ "limit_opt ::=",
146356
- /* 138 */ "limit_opt ::= LIMIT expr",
146357
- /* 139 */ "limit_opt ::= LIMIT expr OFFSET expr",
146358
- /* 140 */ "limit_opt ::= LIMIT expr COMMA expr",
146359
- /* 141 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
146360
- /* 142 */ "where_opt ::=",
146361
- /* 143 */ "where_opt ::= WHERE expr",
146362
- /* 144 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
146363
- /* 145 */ "setlist ::= setlist COMMA nm EQ expr",
146364
- /* 146 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
146365
- /* 147 */ "setlist ::= nm EQ expr",
146366
- /* 148 */ "setlist ::= LP idlist RP EQ expr",
146367
- /* 149 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
146368
- /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
146369
- /* 151 */ "upsert ::=",
146370
- /* 152 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
146371
- /* 153 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
146372
- /* 154 */ "upsert ::= ON CONFLICT DO NOTHING",
146373
- /* 155 */ "insert_cmd ::= INSERT orconf",
146374
- /* 156 */ "insert_cmd ::= REPLACE",
146375
- /* 157 */ "idlist_opt ::=",
146376
- /* 158 */ "idlist_opt ::= LP idlist RP",
146377
- /* 159 */ "idlist ::= idlist COMMA nm",
146378
- /* 160 */ "idlist ::= nm",
146379
- /* 161 */ "expr ::= LP expr RP",
146380
- /* 162 */ "expr ::= ID|INDEXED",
146381
- /* 163 */ "expr ::= JOIN_KW",
146382
- /* 164 */ "expr ::= nm DOT nm",
146383
- /* 165 */ "expr ::= nm DOT nm DOT nm",
146384
- /* 166 */ "term ::= NULL|FLOAT|BLOB",
146385
- /* 167 */ "term ::= STRING",
146386
- /* 168 */ "term ::= INTEGER",
146387
- /* 169 */ "expr ::= VARIABLE",
146388
- /* 170 */ "expr ::= expr COLLATE ID|STRING",
146389
- /* 171 */ "expr ::= CAST LP expr AS typetoken RP",
146390
- /* 172 */ "expr ::= ID|INDEXED LP distinct exprlist RP over_opt",
146391
- /* 173 */ "expr ::= ID|INDEXED LP STAR RP over_opt",
146392
- /* 174 */ "term ::= CTIME_KW",
146393
- /* 175 */ "expr ::= LP nexprlist COMMA expr RP",
146394
- /* 176 */ "expr ::= expr AND expr",
146395
- /* 177 */ "expr ::= expr OR expr",
146396
- /* 178 */ "expr ::= expr LT|GT|GE|LE expr",
146397
- /* 179 */ "expr ::= expr EQ|NE expr",
146398
- /* 180 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
146399
- /* 181 */ "expr ::= expr PLUS|MINUS expr",
146400
- /* 182 */ "expr ::= expr STAR|SLASH|REM expr",
146401
- /* 183 */ "expr ::= expr CONCAT expr",
146402
- /* 184 */ "likeop ::= NOT LIKE_KW|MATCH",
146403
- /* 185 */ "expr ::= expr likeop expr",
146404
- /* 186 */ "expr ::= expr likeop expr ESCAPE expr",
146405
- /* 187 */ "expr ::= expr ISNULL|NOTNULL",
146406
- /* 188 */ "expr ::= expr NOT NULL",
146407
- /* 189 */ "expr ::= expr IS expr",
146408
- /* 190 */ "expr ::= expr IS NOT expr",
146409
- /* 191 */ "expr ::= NOT expr",
146410
- /* 192 */ "expr ::= BITNOT expr",
146411
- /* 193 */ "expr ::= PLUS|MINUS expr",
146412
- /* 194 */ "between_op ::= BETWEEN",
146413
- /* 195 */ "between_op ::= NOT BETWEEN",
146414
- /* 196 */ "expr ::= expr between_op expr AND expr",
146415
- /* 197 */ "in_op ::= IN",
146416
- /* 198 */ "in_op ::= NOT IN",
146417
- /* 199 */ "expr ::= expr in_op LP exprlist RP",
146418
- /* 200 */ "expr ::= LP select RP",
146419
- /* 201 */ "expr ::= expr in_op LP select RP",
146420
- /* 202 */ "expr ::= expr in_op nm dbnm paren_exprlist",
146421
- /* 203 */ "expr ::= EXISTS LP select RP",
146422
- /* 204 */ "expr ::= CASE case_operand case_exprlist case_else END",
146423
- /* 205 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
146424
- /* 206 */ "case_exprlist ::= WHEN expr THEN expr",
146425
- /* 207 */ "case_else ::= ELSE expr",
146426
- /* 208 */ "case_else ::=",
146427
- /* 209 */ "case_operand ::= expr",
146428
- /* 210 */ "case_operand ::=",
146429
- /* 211 */ "exprlist ::=",
146430
- /* 212 */ "nexprlist ::= nexprlist COMMA expr",
146431
- /* 213 */ "nexprlist ::= expr",
146432
- /* 214 */ "paren_exprlist ::=",
146433
- /* 215 */ "paren_exprlist ::= LP exprlist RP",
146434
- /* 216 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
146435
- /* 217 */ "uniqueflag ::= UNIQUE",
146436
- /* 218 */ "uniqueflag ::=",
146437
- /* 219 */ "eidlist_opt ::=",
146438
- /* 220 */ "eidlist_opt ::= LP eidlist RP",
146439
- /* 221 */ "eidlist ::= eidlist COMMA nm collate sortorder",
146440
- /* 222 */ "eidlist ::= nm collate sortorder",
146441
- /* 223 */ "collate ::=",
146442
- /* 224 */ "collate ::= COLLATE ID|STRING",
146443
- /* 225 */ "cmd ::= DROP INDEX ifexists fullname",
146444
- /* 226 */ "cmd ::= VACUUM",
146445
- /* 227 */ "cmd ::= VACUUM nm",
146446
- /* 228 */ "cmd ::= PRAGMA nm dbnm",
146447
- /* 229 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
146448
- /* 230 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
146449
- /* 231 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
146450
- /* 232 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
146451
- /* 233 */ "plus_num ::= PLUS INTEGER|FLOAT",
146452
- /* 234 */ "minus_num ::= MINUS INTEGER|FLOAT",
146453
- /* 235 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
146454
- /* 236 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
146455
- /* 237 */ "trigger_time ::= BEFORE|AFTER",
146456
- /* 238 */ "trigger_time ::= INSTEAD OF",
146457
- /* 239 */ "trigger_time ::=",
146458
- /* 240 */ "trigger_event ::= DELETE|INSERT",
146459
- /* 241 */ "trigger_event ::= UPDATE",
146460
- /* 242 */ "trigger_event ::= UPDATE OF idlist",
146461
- /* 243 */ "when_clause ::=",
146462
- /* 244 */ "when_clause ::= WHEN expr",
146463
- /* 245 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
146464
- /* 246 */ "trigger_cmd_list ::= trigger_cmd SEMI",
146465
- /* 247 */ "trnm ::= nm DOT nm",
146466
- /* 248 */ "tridxby ::= INDEXED BY nm",
146467
- /* 249 */ "tridxby ::= NOT INDEXED",
146468
- /* 250 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
146469
- /* 251 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
146470
- /* 252 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
146471
- /* 253 */ "trigger_cmd ::= scanpt select scanpt",
146472
- /* 254 */ "expr ::= RAISE LP IGNORE RP",
146473
- /* 255 */ "expr ::= RAISE LP raisetype COMMA nm RP",
146474
- /* 256 */ "raisetype ::= ROLLBACK",
146475
- /* 257 */ "raisetype ::= ABORT",
146476
- /* 258 */ "raisetype ::= FAIL",
146477
- /* 259 */ "cmd ::= DROP TRIGGER ifexists fullname",
146478
- /* 260 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
146479
- /* 261 */ "cmd ::= DETACH database_kw_opt expr",
146480
- /* 262 */ "key_opt ::=",
146481
- /* 263 */ "key_opt ::= KEY expr",
146482
- /* 264 */ "cmd ::= REINDEX",
146483
- /* 265 */ "cmd ::= REINDEX nm dbnm",
146484
- /* 266 */ "cmd ::= ANALYZE",
146485
- /* 267 */ "cmd ::= ANALYZE nm dbnm",
146486
- /* 268 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
146487
- /* 269 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
146488
- /* 270 */ "add_column_fullname ::= fullname",
146489
- /* 271 */ "cmd ::= create_vtab",
146490
- /* 272 */ "cmd ::= create_vtab LP vtabarglist RP",
146491
- /* 273 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
146492
- /* 274 */ "vtabarg ::=",
146493
- /* 275 */ "vtabargtoken ::= ANY",
146494
- /* 276 */ "vtabargtoken ::= lp anylist RP",
146495
- /* 277 */ "lp ::= LP",
146496
- /* 278 */ "with ::= WITH wqlist",
146497
- /* 279 */ "with ::= WITH RECURSIVE wqlist",
146498
- /* 280 */ "wqlist ::= nm eidlist_opt AS LP select RP",
146499
- /* 281 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
146500
- /* 282 */ "windowdefn_list ::= windowdefn",
146501
- /* 283 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
146502
- /* 284 */ "windowdefn ::= nm AS window",
146503
- /* 285 */ "window ::= LP part_opt orderby_opt frame_opt RP",
146504
- /* 286 */ "part_opt ::= PARTITION BY exprlist",
146505
- /* 287 */ "part_opt ::=",
146506
- /* 288 */ "frame_opt ::=",
146507
- /* 289 */ "frame_opt ::= range_or_rows frame_bound_s",
146508
- /* 290 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e",
146509
- /* 291 */ "range_or_rows ::= RANGE",
146510
- /* 292 */ "range_or_rows ::= ROWS",
146511
- /* 293 */ "frame_bound_s ::= frame_bound",
146512
- /* 294 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
146513
- /* 295 */ "frame_bound_e ::= frame_bound",
146514
- /* 296 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
146515
- /* 297 */ "frame_bound ::= expr PRECEDING",
146516
- /* 298 */ "frame_bound ::= CURRENT ROW",
146517
- /* 299 */ "frame_bound ::= expr FOLLOWING",
146518
- /* 300 */ "windowdefn_opt ::=",
146519
- /* 301 */ "windowdefn_opt ::= WINDOW windowdefn_list",
146520
- /* 302 */ "over_opt ::=",
146521
- /* 303 */ "over_opt ::= filter_opt OVER window",
146522
- /* 304 */ "over_opt ::= filter_opt OVER nm",
146523
- /* 305 */ "filter_opt ::=",
146524
- /* 306 */ "filter_opt ::= FILTER LP WHERE expr RP",
146525
- /* 307 */ "input ::= cmdlist",
146526
- /* 308 */ "cmdlist ::= cmdlist ecmd",
146527
- /* 309 */ "cmdlist ::= ecmd",
146528
- /* 310 */ "ecmd ::= SEMI",
146529
- /* 311 */ "ecmd ::= cmdx SEMI",
146530
- /* 312 */ "ecmd ::= explain cmdx",
146531
- /* 313 */ "trans_opt ::=",
146532
- /* 314 */ "trans_opt ::= TRANSACTION",
146533
- /* 315 */ "trans_opt ::= TRANSACTION nm",
146534
- /* 316 */ "savepoint_opt ::= SAVEPOINT",
146535
- /* 317 */ "savepoint_opt ::=",
146536
- /* 318 */ "cmd ::= create_table create_table_args",
146537
- /* 319 */ "columnlist ::= columnlist COMMA columnname carglist",
146538
- /* 320 */ "columnlist ::= columnname carglist",
146539
- /* 321 */ "nm ::= ID|INDEXED",
146540
- /* 322 */ "nm ::= STRING",
146541
- /* 323 */ "nm ::= JOIN_KW",
146542
- /* 324 */ "typetoken ::= typename",
146543
- /* 325 */ "typename ::= ID|STRING",
146544
- /* 326 */ "signed ::= plus_num",
146545
- /* 327 */ "signed ::= minus_num",
146546
- /* 328 */ "carglist ::= carglist ccons",
146547
- /* 329 */ "carglist ::=",
146548
- /* 330 */ "ccons ::= NULL onconf",
146549
- /* 331 */ "conslist_opt ::= COMMA conslist",
146550
- /* 332 */ "conslist ::= conslist tconscomma tcons",
146551
- /* 333 */ "conslist ::= tcons",
146552
- /* 334 */ "tconscomma ::=",
146553
- /* 335 */ "defer_subclause_opt ::= defer_subclause",
146554
- /* 336 */ "resolvetype ::= raisetype",
146555
- /* 337 */ "selectnowith ::= oneselect",
146556
- /* 338 */ "oneselect ::= values",
146557
- /* 339 */ "sclp ::= selcollist COMMA",
146558
- /* 340 */ "as ::= ID|STRING",
146559
- /* 341 */ "expr ::= term",
146560
- /* 342 */ "likeop ::= LIKE_KW|MATCH",
146561
- /* 343 */ "exprlist ::= nexprlist",
146562
- /* 344 */ "nmnum ::= plus_num",
146563
- /* 345 */ "nmnum ::= nm",
146564
- /* 346 */ "nmnum ::= ON",
146565
- /* 347 */ "nmnum ::= DELETE",
146566
- /* 348 */ "nmnum ::= DEFAULT",
146567
- /* 349 */ "plus_num ::= INTEGER|FLOAT",
146568
- /* 350 */ "foreach_clause ::=",
146569
- /* 351 */ "foreach_clause ::= FOR EACH ROW",
146570
- /* 352 */ "trnm ::= nm",
146571
- /* 353 */ "tridxby ::=",
146572
- /* 354 */ "database_kw_opt ::= DATABASE",
146573
- /* 355 */ "database_kw_opt ::=",
146574
- /* 356 */ "kwcolumn_opt ::=",
146575
- /* 357 */ "kwcolumn_opt ::= COLUMNKW",
146576
- /* 358 */ "vtabarglist ::= vtabarg",
146577
- /* 359 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
146578
- /* 360 */ "vtabarg ::= vtabarg vtabargtoken",
146579
- /* 361 */ "anylist ::=",
146580
- /* 362 */ "anylist ::= anylist LP anylist RP",
146581
- /* 363 */ "anylist ::= anylist ANY",
146582
- /* 364 */ "with ::=",
146224
+ /* 87 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
146225
+ /* 88 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt",
146226
+ /* 89 */ "values ::= VALUES LP nexprlist RP",
146227
+ /* 90 */ "values ::= values COMMA LP nexprlist RP",
146228
+ /* 91 */ "distinct ::= DISTINCT",
146229
+ /* 92 */ "distinct ::= ALL",
146230
+ /* 93 */ "distinct ::=",
146231
+ /* 94 */ "sclp ::=",
146232
+ /* 95 */ "selcollist ::= sclp scanpt expr scanpt as",
146233
+ /* 96 */ "selcollist ::= sclp scanpt STAR",
146234
+ /* 97 */ "selcollist ::= sclp scanpt nm DOT STAR",
146235
+ /* 98 */ "as ::= AS nm",
146236
+ /* 99 */ "as ::=",
146237
+ /* 100 */ "from ::=",
146238
+ /* 101 */ "from ::= FROM seltablist",
146239
+ /* 102 */ "stl_prefix ::= seltablist joinop",
146240
+ /* 103 */ "stl_prefix ::=",
146241
+ /* 104 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
146242
+ /* 105 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
146243
+ /* 106 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
146244
+ /* 107 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
146245
+ /* 108 */ "dbnm ::=",
146246
+ /* 109 */ "dbnm ::= DOT nm",
146247
+ /* 110 */ "fullname ::= nm",
146248
+ /* 111 */ "fullname ::= nm DOT nm",
146249
+ /* 112 */ "xfullname ::= nm",
146250
+ /* 113 */ "xfullname ::= nm DOT nm",
146251
+ /* 114 */ "xfullname ::= nm DOT nm AS nm",
146252
+ /* 115 */ "xfullname ::= nm AS nm",
146253
+ /* 116 */ "joinop ::= COMMA|JOIN",
146254
+ /* 117 */ "joinop ::= JOIN_KW JOIN",
146255
+ /* 118 */ "joinop ::= JOIN_KW nm JOIN",
146256
+ /* 119 */ "joinop ::= JOIN_KW nm nm JOIN",
146257
+ /* 120 */ "on_opt ::= ON expr",
146258
+ /* 121 */ "on_opt ::=",
146259
+ /* 122 */ "indexed_opt ::=",
146260
+ /* 123 */ "indexed_opt ::= INDEXED BY nm",
146261
+ /* 124 */ "indexed_opt ::= NOT INDEXED",
146262
+ /* 125 */ "using_opt ::= USING LP idlist RP",
146263
+ /* 126 */ "using_opt ::=",
146264
+ /* 127 */ "orderby_opt ::=",
146265
+ /* 128 */ "orderby_opt ::= ORDER BY sortlist",
146266
+ /* 129 */ "sortlist ::= sortlist COMMA expr sortorder",
146267
+ /* 130 */ "sortlist ::= expr sortorder",
146268
+ /* 131 */ "sortorder ::= ASC",
146269
+ /* 132 */ "sortorder ::= DESC",
146270
+ /* 133 */ "sortorder ::=",
146271
+ /* 134 */ "groupby_opt ::=",
146272
+ /* 135 */ "groupby_opt ::= GROUP BY nexprlist",
146273
+ /* 136 */ "having_opt ::=",
146274
+ /* 137 */ "having_opt ::= HAVING expr",
146275
+ /* 138 */ "limit_opt ::=",
146276
+ /* 139 */ "limit_opt ::= LIMIT expr",
146277
+ /* 140 */ "limit_opt ::= LIMIT expr OFFSET expr",
146278
+ /* 141 */ "limit_opt ::= LIMIT expr COMMA expr",
146279
+ /* 142 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
146280
+ /* 143 */ "where_opt ::=",
146281
+ /* 144 */ "where_opt ::= WHERE expr",
146282
+ /* 145 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
146283
+ /* 146 */ "setlist ::= setlist COMMA nm EQ expr",
146284
+ /* 147 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
146285
+ /* 148 */ "setlist ::= nm EQ expr",
146286
+ /* 149 */ "setlist ::= LP idlist RP EQ expr",
146287
+ /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
146288
+ /* 151 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
146289
+ /* 152 */ "upsert ::=",
146290
+ /* 153 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
146291
+ /* 154 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
146292
+ /* 155 */ "upsert ::= ON CONFLICT DO NOTHING",
146293
+ /* 156 */ "insert_cmd ::= INSERT orconf",
146294
+ /* 157 */ "insert_cmd ::= REPLACE",
146295
+ /* 158 */ "idlist_opt ::=",
146296
+ /* 159 */ "idlist_opt ::= LP idlist RP",
146297
+ /* 160 */ "idlist ::= idlist COMMA nm",
146298
+ /* 161 */ "idlist ::= nm",
146299
+ /* 162 */ "expr ::= LP expr RP",
146300
+ /* 163 */ "expr ::= ID|INDEXED",
146301
+ /* 164 */ "expr ::= JOIN_KW",
146302
+ /* 165 */ "expr ::= nm DOT nm",
146303
+ /* 166 */ "expr ::= nm DOT nm DOT nm",
146304
+ /* 167 */ "term ::= NULL|FLOAT|BLOB",
146305
+ /* 168 */ "term ::= STRING",
146306
+ /* 169 */ "term ::= INTEGER",
146307
+ /* 170 */ "expr ::= VARIABLE",
146308
+ /* 171 */ "expr ::= expr COLLATE ID|STRING",
146309
+ /* 172 */ "expr ::= CAST LP expr AS typetoken RP",
146310
+ /* 173 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
146311
+ /* 174 */ "expr ::= ID|INDEXED LP STAR RP",
146312
+ /* 175 */ "expr ::= ID|INDEXED LP distinct exprlist RP over_clause",
146313
+ /* 176 */ "expr ::= ID|INDEXED LP STAR RP over_clause",
146314
+ /* 177 */ "term ::= CTIME_KW",
146315
+ /* 178 */ "expr ::= LP nexprlist COMMA expr RP",
146316
+ /* 179 */ "expr ::= expr AND expr",
146317
+ /* 180 */ "expr ::= expr OR expr",
146318
+ /* 181 */ "expr ::= expr LT|GT|GE|LE expr",
146319
+ /* 182 */ "expr ::= expr EQ|NE expr",
146320
+ /* 183 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
146321
+ /* 184 */ "expr ::= expr PLUS|MINUS expr",
146322
+ /* 185 */ "expr ::= expr STAR|SLASH|REM expr",
146323
+ /* 186 */ "expr ::= expr CONCAT expr",
146324
+ /* 187 */ "likeop ::= NOT LIKE_KW|MATCH",
146325
+ /* 188 */ "expr ::= expr likeop expr",
146326
+ /* 189 */ "expr ::= expr likeop expr ESCAPE expr",
146327
+ /* 190 */ "expr ::= expr ISNULL|NOTNULL",
146328
+ /* 191 */ "expr ::= expr NOT NULL",
146329
+ /* 192 */ "expr ::= expr IS expr",
146330
+ /* 193 */ "expr ::= expr IS NOT expr",
146331
+ /* 194 */ "expr ::= NOT expr",
146332
+ /* 195 */ "expr ::= BITNOT expr",
146333
+ /* 196 */ "expr ::= PLUS|MINUS expr",
146334
+ /* 197 */ "between_op ::= BETWEEN",
146335
+ /* 198 */ "between_op ::= NOT BETWEEN",
146336
+ /* 199 */ "expr ::= expr between_op expr AND expr",
146337
+ /* 200 */ "in_op ::= IN",
146338
+ /* 201 */ "in_op ::= NOT IN",
146339
+ /* 202 */ "expr ::= expr in_op LP exprlist RP",
146340
+ /* 203 */ "expr ::= LP select RP",
146341
+ /* 204 */ "expr ::= expr in_op LP select RP",
146342
+ /* 205 */ "expr ::= expr in_op nm dbnm paren_exprlist",
146343
+ /* 206 */ "expr ::= EXISTS LP select RP",
146344
+ /* 207 */ "expr ::= CASE case_operand case_exprlist case_else END",
146345
+ /* 208 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
146346
+ /* 209 */ "case_exprlist ::= WHEN expr THEN expr",
146347
+ /* 210 */ "case_else ::= ELSE expr",
146348
+ /* 211 */ "case_else ::=",
146349
+ /* 212 */ "case_operand ::= expr",
146350
+ /* 213 */ "case_operand ::=",
146351
+ /* 214 */ "exprlist ::=",
146352
+ /* 215 */ "nexprlist ::= nexprlist COMMA expr",
146353
+ /* 216 */ "nexprlist ::= expr",
146354
+ /* 217 */ "paren_exprlist ::=",
146355
+ /* 218 */ "paren_exprlist ::= LP exprlist RP",
146356
+ /* 219 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
146357
+ /* 220 */ "uniqueflag ::= UNIQUE",
146358
+ /* 221 */ "uniqueflag ::=",
146359
+ /* 222 */ "eidlist_opt ::=",
146360
+ /* 223 */ "eidlist_opt ::= LP eidlist RP",
146361
+ /* 224 */ "eidlist ::= eidlist COMMA nm collate sortorder",
146362
+ /* 225 */ "eidlist ::= nm collate sortorder",
146363
+ /* 226 */ "collate ::=",
146364
+ /* 227 */ "collate ::= COLLATE ID|STRING",
146365
+ /* 228 */ "cmd ::= DROP INDEX ifexists fullname",
146366
+ /* 229 */ "cmd ::= VACUUM",
146367
+ /* 230 */ "cmd ::= VACUUM nm",
146368
+ /* 231 */ "cmd ::= PRAGMA nm dbnm",
146369
+ /* 232 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
146370
+ /* 233 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
146371
+ /* 234 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
146372
+ /* 235 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
146373
+ /* 236 */ "plus_num ::= PLUS INTEGER|FLOAT",
146374
+ /* 237 */ "minus_num ::= MINUS INTEGER|FLOAT",
146375
+ /* 238 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
146376
+ /* 239 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
146377
+ /* 240 */ "trigger_time ::= BEFORE|AFTER",
146378
+ /* 241 */ "trigger_time ::= INSTEAD OF",
146379
+ /* 242 */ "trigger_time ::=",
146380
+ /* 243 */ "trigger_event ::= DELETE|INSERT",
146381
+ /* 244 */ "trigger_event ::= UPDATE",
146382
+ /* 245 */ "trigger_event ::= UPDATE OF idlist",
146383
+ /* 246 */ "when_clause ::=",
146384
+ /* 247 */ "when_clause ::= WHEN expr",
146385
+ /* 248 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
146386
+ /* 249 */ "trigger_cmd_list ::= trigger_cmd SEMI",
146387
+ /* 250 */ "trnm ::= nm DOT nm",
146388
+ /* 251 */ "tridxby ::= INDEXED BY nm",
146389
+ /* 252 */ "tridxby ::= NOT INDEXED",
146390
+ /* 253 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
146391
+ /* 254 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
146392
+ /* 255 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
146393
+ /* 256 */ "trigger_cmd ::= scanpt select scanpt",
146394
+ /* 257 */ "expr ::= RAISE LP IGNORE RP",
146395
+ /* 258 */ "expr ::= RAISE LP raisetype COMMA nm RP",
146396
+ /* 259 */ "raisetype ::= ROLLBACK",
146397
+ /* 260 */ "raisetype ::= ABORT",
146398
+ /* 261 */ "raisetype ::= FAIL",
146399
+ /* 262 */ "cmd ::= DROP TRIGGER ifexists fullname",
146400
+ /* 263 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
146401
+ /* 264 */ "cmd ::= DETACH database_kw_opt expr",
146402
+ /* 265 */ "key_opt ::=",
146403
+ /* 266 */ "key_opt ::= KEY expr",
146404
+ /* 267 */ "cmd ::= REINDEX",
146405
+ /* 268 */ "cmd ::= REINDEX nm dbnm",
146406
+ /* 269 */ "cmd ::= ANALYZE",
146407
+ /* 270 */ "cmd ::= ANALYZE nm dbnm",
146408
+ /* 271 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
146409
+ /* 272 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
146410
+ /* 273 */ "add_column_fullname ::= fullname",
146411
+ /* 274 */ "cmd ::= create_vtab",
146412
+ /* 275 */ "cmd ::= create_vtab LP vtabarglist RP",
146413
+ /* 276 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
146414
+ /* 277 */ "vtabarg ::=",
146415
+ /* 278 */ "vtabargtoken ::= ANY",
146416
+ /* 279 */ "vtabargtoken ::= lp anylist RP",
146417
+ /* 280 */ "lp ::= LP",
146418
+ /* 281 */ "with ::= WITH wqlist",
146419
+ /* 282 */ "with ::= WITH RECURSIVE wqlist",
146420
+ /* 283 */ "wqlist ::= nm eidlist_opt AS LP select RP",
146421
+ /* 284 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
146422
+ /* 285 */ "windowdefn_list ::= windowdefn",
146423
+ /* 286 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
146424
+ /* 287 */ "windowdefn ::= nm AS window",
146425
+ /* 288 */ "window ::= LP part_opt orderby_opt frame_opt RP",
146426
+ /* 289 */ "part_opt ::= PARTITION BY nexprlist",
146427
+ /* 290 */ "part_opt ::=",
146428
+ /* 291 */ "frame_opt ::=",
146429
+ /* 292 */ "frame_opt ::= range_or_rows frame_bound_s",
146430
+ /* 293 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e",
146431
+ /* 294 */ "range_or_rows ::= RANGE",
146432
+ /* 295 */ "range_or_rows ::= ROWS",
146433
+ /* 296 */ "frame_bound_s ::= frame_bound",
146434
+ /* 297 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
146435
+ /* 298 */ "frame_bound_e ::= frame_bound",
146436
+ /* 299 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
146437
+ /* 300 */ "frame_bound ::= expr PRECEDING",
146438
+ /* 301 */ "frame_bound ::= CURRENT ROW",
146439
+ /* 302 */ "frame_bound ::= expr FOLLOWING",
146440
+ /* 303 */ "window_clause ::= WINDOW windowdefn_list",
146441
+ /* 304 */ "over_clause ::= filter_opt OVER window",
146442
+ /* 305 */ "over_clause ::= filter_opt OVER nm",
146443
+ /* 306 */ "filter_opt ::=",
146444
+ /* 307 */ "filter_opt ::= FILTER LP WHERE expr RP",
146445
+ /* 308 */ "input ::= cmdlist",
146446
+ /* 309 */ "cmdlist ::= cmdlist ecmd",
146447
+ /* 310 */ "cmdlist ::= ecmd",
146448
+ /* 311 */ "ecmd ::= SEMI",
146449
+ /* 312 */ "ecmd ::= cmdx SEMI",
146450
+ /* 313 */ "ecmd ::= explain cmdx",
146451
+ /* 314 */ "trans_opt ::=",
146452
+ /* 315 */ "trans_opt ::= TRANSACTION",
146453
+ /* 316 */ "trans_opt ::= TRANSACTION nm",
146454
+ /* 317 */ "savepoint_opt ::= SAVEPOINT",
146455
+ /* 318 */ "savepoint_opt ::=",
146456
+ /* 319 */ "cmd ::= create_table create_table_args",
146457
+ /* 320 */ "columnlist ::= columnlist COMMA columnname carglist",
146458
+ /* 321 */ "columnlist ::= columnname carglist",
146459
+ /* 322 */ "nm ::= ID|INDEXED",
146460
+ /* 323 */ "nm ::= STRING",
146461
+ /* 324 */ "nm ::= JOIN_KW",
146462
+ /* 325 */ "typetoken ::= typename",
146463
+ /* 326 */ "typename ::= ID|STRING",
146464
+ /* 327 */ "signed ::= plus_num",
146465
+ /* 328 */ "signed ::= minus_num",
146466
+ /* 329 */ "carglist ::= carglist ccons",
146467
+ /* 330 */ "carglist ::=",
146468
+ /* 331 */ "ccons ::= NULL onconf",
146469
+ /* 332 */ "conslist_opt ::= COMMA conslist",
146470
+ /* 333 */ "conslist ::= conslist tconscomma tcons",
146471
+ /* 334 */ "conslist ::= tcons",
146472
+ /* 335 */ "tconscomma ::=",
146473
+ /* 336 */ "defer_subclause_opt ::= defer_subclause",
146474
+ /* 337 */ "resolvetype ::= raisetype",
146475
+ /* 338 */ "selectnowith ::= oneselect",
146476
+ /* 339 */ "oneselect ::= values",
146477
+ /* 340 */ "sclp ::= selcollist COMMA",
146478
+ /* 341 */ "as ::= ID|STRING",
146479
+ /* 342 */ "expr ::= term",
146480
+ /* 343 */ "likeop ::= LIKE_KW|MATCH",
146481
+ /* 344 */ "exprlist ::= nexprlist",
146482
+ /* 345 */ "nmnum ::= plus_num",
146483
+ /* 346 */ "nmnum ::= nm",
146484
+ /* 347 */ "nmnum ::= ON",
146485
+ /* 348 */ "nmnum ::= DELETE",
146486
+ /* 349 */ "nmnum ::= DEFAULT",
146487
+ /* 350 */ "plus_num ::= INTEGER|FLOAT",
146488
+ /* 351 */ "foreach_clause ::=",
146489
+ /* 352 */ "foreach_clause ::= FOR EACH ROW",
146490
+ /* 353 */ "trnm ::= nm",
146491
+ /* 354 */ "tridxby ::=",
146492
+ /* 355 */ "database_kw_opt ::= DATABASE",
146493
+ /* 356 */ "database_kw_opt ::=",
146494
+ /* 357 */ "kwcolumn_opt ::=",
146495
+ /* 358 */ "kwcolumn_opt ::= COLUMNKW",
146496
+ /* 359 */ "vtabarglist ::= vtabarg",
146497
+ /* 360 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
146498
+ /* 361 */ "vtabarg ::= vtabarg vtabargtoken",
146499
+ /* 362 */ "anylist ::=",
146500
+ /* 363 */ "anylist ::= anylist LP anylist RP",
146501
+ /* 364 */ "anylist ::= anylist ANY",
146502
+ /* 365 */ "with ::=",
146583146503
};
146584146504
#endif /* NDEBUG */
146585146505
146586146506
146587146507
#if YYSTACKDEPTH<=0
@@ -146715,11 +146635,11 @@
146715146635
break;
146716146636
case 184: /* term */
146717146637
case 185: /* expr */
146718146638
case 213: /* where_opt */
146719146639
case 215: /* having_opt */
146720
- case 228: /* on_opt */
146640
+ case 227: /* on_opt */
146721146641
case 242: /* case_operand */
146722146642
case 244: /* case_else */
146723146643
case 253: /* when_clause */
146724146644
case 258: /* key_opt */
146725146645
case 272: /* filter_opt */
@@ -146730,14 +146650,14 @@
146730146650
case 189: /* eidlist_opt */
146731146651
case 198: /* sortlist */
146732146652
case 199: /* eidlist */
146733146653
case 211: /* selcollist */
146734146654
case 214: /* groupby_opt */
146735
- case 217: /* orderby_opt */
146655
+ case 216: /* orderby_opt */
146736146656
case 220: /* nexprlist */
146737
- case 221: /* exprlist */
146738
- case 222: /* sclp */
146657
+ case 221: /* sclp */
146658
+ case 229: /* exprlist */
146739146659
case 233: /* setlist */
146740146660
case 241: /* paren_exprlist */
146741146661
case 243: /* case_exprlist */
146742146662
case 271: /* part_opt */
146743146663
{
@@ -146744,12 +146664,12 @@
146744146664
sqlite3ExprListDelete(pParse->db, (yypminor->yy420));
146745146665
}
146746146666
break;
146747146667
case 205: /* fullname */
146748146668
case 212: /* from */
146749
- case 224: /* seltablist */
146750
- case 225: /* stl_prefix */
146669
+ case 223: /* seltablist */
146670
+ case 224: /* stl_prefix */
146751146671
case 230: /* xfullname */
146752146672
{
146753146673
sqlite3SrcListDelete(pParse->db, (yypminor->yy135));
146754146674
}
146755146675
break;
@@ -146756,24 +146676,24 @@
146756146676
case 208: /* wqlist */
146757146677
{
146758146678
sqlite3WithDelete(pParse->db, (yypminor->yy449));
146759146679
}
146760146680
break;
146761
- case 216: /* windowdefn_opt */
146681
+ case 218: /* window_clause */
146762146682
case 267: /* windowdefn_list */
146763146683
{
146764146684
sqlite3WindowListDelete(pParse->db, (yypminor->yy327));
146765146685
}
146766146686
break;
146767
- case 229: /* using_opt */
146687
+ case 228: /* using_opt */
146768146688
case 231: /* idlist */
146769146689
case 235: /* idlist_opt */
146770146690
{
146771146691
sqlite3IdListDelete(pParse->db, (yypminor->yy48));
146772146692
}
146773146693
break;
146774
- case 237: /* over_opt */
146694
+ case 237: /* over_clause */
146775146695
case 268: /* windowdefn */
146776146696
case 269: /* window */
146777146697
case 270: /* frame_opt */
146778146698
{
146779146699
sqlite3WindowDelete(pParse->db, (yypminor->yy327));
@@ -147178,288 +147098,289 @@
147178147098
{ 174, -1 }, /* (82) select ::= selectnowith */
147179147099
{ 206, -3 }, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
147180147100
{ 209, -1 }, /* (84) multiselect_op ::= UNION */
147181147101
{ 209, -2 }, /* (85) multiselect_op ::= UNION ALL */
147182147102
{ 209, -1 }, /* (86) multiselect_op ::= EXCEPT|INTERSECT */
147183
- { 207, -10 }, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt windowdefn_opt orderby_opt limit_opt */
147184
- { 219, -4 }, /* (88) values ::= VALUES LP nexprlist RP */
147185
- { 219, -5 }, /* (89) values ::= values COMMA LP exprlist RP */
147186
- { 210, -1 }, /* (90) distinct ::= DISTINCT */
147187
- { 210, -1 }, /* (91) distinct ::= ALL */
147188
- { 210, 0 }, /* (92) distinct ::= */
147189
- { 222, 0 }, /* (93) sclp ::= */
147190
- { 211, -5 }, /* (94) selcollist ::= sclp scanpt expr scanpt as */
147191
- { 211, -3 }, /* (95) selcollist ::= sclp scanpt STAR */
147192
- { 211, -5 }, /* (96) selcollist ::= sclp scanpt nm DOT STAR */
147193
- { 223, -2 }, /* (97) as ::= AS nm */
147194
- { 223, 0 }, /* (98) as ::= */
147195
- { 212, 0 }, /* (99) from ::= */
147196
- { 212, -2 }, /* (100) from ::= FROM seltablist */
147197
- { 225, -2 }, /* (101) stl_prefix ::= seltablist joinop */
147198
- { 225, 0 }, /* (102) stl_prefix ::= */
147199
- { 224, -7 }, /* (103) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
147200
- { 224, -9 }, /* (104) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
147201
- { 224, -7 }, /* (105) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
147202
- { 224, -7 }, /* (106) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
147203
- { 170, 0 }, /* (107) dbnm ::= */
147204
- { 170, -2 }, /* (108) dbnm ::= DOT nm */
147205
- { 205, -1 }, /* (109) fullname ::= nm */
147206
- { 205, -3 }, /* (110) fullname ::= nm DOT nm */
147207
- { 230, -1 }, /* (111) xfullname ::= nm */
147208
- { 230, -3 }, /* (112) xfullname ::= nm DOT nm */
147209
- { 230, -5 }, /* (113) xfullname ::= nm DOT nm AS nm */
147210
- { 230, -3 }, /* (114) xfullname ::= nm AS nm */
147211
- { 226, -1 }, /* (115) joinop ::= COMMA|JOIN */
147212
- { 226, -2 }, /* (116) joinop ::= JOIN_KW JOIN */
147213
- { 226, -3 }, /* (117) joinop ::= JOIN_KW nm JOIN */
147214
- { 226, -4 }, /* (118) joinop ::= JOIN_KW nm nm JOIN */
147215
- { 228, -2 }, /* (119) on_opt ::= ON expr */
147216
- { 228, 0 }, /* (120) on_opt ::= */
147217
- { 227, 0 }, /* (121) indexed_opt ::= */
147218
- { 227, -3 }, /* (122) indexed_opt ::= INDEXED BY nm */
147219
- { 227, -2 }, /* (123) indexed_opt ::= NOT INDEXED */
147220
- { 229, -4 }, /* (124) using_opt ::= USING LP idlist RP */
147221
- { 229, 0 }, /* (125) using_opt ::= */
147222
- { 217, 0 }, /* (126) orderby_opt ::= */
147223
- { 217, -3 }, /* (127) orderby_opt ::= ORDER BY sortlist */
147224
- { 198, -4 }, /* (128) sortlist ::= sortlist COMMA expr sortorder */
147225
- { 198, -2 }, /* (129) sortlist ::= expr sortorder */
147226
- { 187, -1 }, /* (130) sortorder ::= ASC */
147227
- { 187, -1 }, /* (131) sortorder ::= DESC */
147228
- { 187, 0 }, /* (132) sortorder ::= */
147229
- { 214, 0 }, /* (133) groupby_opt ::= */
147230
- { 214, -3 }, /* (134) groupby_opt ::= GROUP BY nexprlist */
147231
- { 215, 0 }, /* (135) having_opt ::= */
147232
- { 215, -2 }, /* (136) having_opt ::= HAVING expr */
147233
- { 218, 0 }, /* (137) limit_opt ::= */
147234
- { 218, -2 }, /* (138) limit_opt ::= LIMIT expr */
147235
- { 218, -4 }, /* (139) limit_opt ::= LIMIT expr OFFSET expr */
147236
- { 218, -4 }, /* (140) limit_opt ::= LIMIT expr COMMA expr */
147237
- { 160, -6 }, /* (141) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
147238
- { 213, 0 }, /* (142) where_opt ::= */
147239
- { 213, -2 }, /* (143) where_opt ::= WHERE expr */
147240
- { 160, -8 }, /* (144) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
147241
- { 233, -5 }, /* (145) setlist ::= setlist COMMA nm EQ expr */
147242
- { 233, -7 }, /* (146) setlist ::= setlist COMMA LP idlist RP EQ expr */
147243
- { 233, -3 }, /* (147) setlist ::= nm EQ expr */
147244
- { 233, -5 }, /* (148) setlist ::= LP idlist RP EQ expr */
147245
- { 160, -7 }, /* (149) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
147246
- { 160, -7 }, /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
147247
- { 236, 0 }, /* (151) upsert ::= */
147248
- { 236, -11 }, /* (152) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
147249
- { 236, -8 }, /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
147250
- { 236, -4 }, /* (154) upsert ::= ON CONFLICT DO NOTHING */
147251
- { 234, -2 }, /* (155) insert_cmd ::= INSERT orconf */
147252
- { 234, -1 }, /* (156) insert_cmd ::= REPLACE */
147253
- { 235, 0 }, /* (157) idlist_opt ::= */
147254
- { 235, -3 }, /* (158) idlist_opt ::= LP idlist RP */
147255
- { 231, -3 }, /* (159) idlist ::= idlist COMMA nm */
147256
- { 231, -1 }, /* (160) idlist ::= nm */
147257
- { 185, -3 }, /* (161) expr ::= LP expr RP */
147258
- { 185, -1 }, /* (162) expr ::= ID|INDEXED */
147259
- { 185, -1 }, /* (163) expr ::= JOIN_KW */
147260
- { 185, -3 }, /* (164) expr ::= nm DOT nm */
147261
- { 185, -5 }, /* (165) expr ::= nm DOT nm DOT nm */
147262
- { 184, -1 }, /* (166) term ::= NULL|FLOAT|BLOB */
147263
- { 184, -1 }, /* (167) term ::= STRING */
147264
- { 184, -1 }, /* (168) term ::= INTEGER */
147265
- { 185, -1 }, /* (169) expr ::= VARIABLE */
147266
- { 185, -3 }, /* (170) expr ::= expr COLLATE ID|STRING */
147267
- { 185, -6 }, /* (171) expr ::= CAST LP expr AS typetoken RP */
147268
- { 185, -6 }, /* (172) expr ::= ID|INDEXED LP distinct exprlist RP over_opt */
147269
- { 185, -5 }, /* (173) expr ::= ID|INDEXED LP STAR RP over_opt */
147270
- { 184, -1 }, /* (174) term ::= CTIME_KW */
147271
- { 185, -5 }, /* (175) expr ::= LP nexprlist COMMA expr RP */
147272
- { 185, -3 }, /* (176) expr ::= expr AND expr */
147273
- { 185, -3 }, /* (177) expr ::= expr OR expr */
147274
- { 185, -3 }, /* (178) expr ::= expr LT|GT|GE|LE expr */
147275
- { 185, -3 }, /* (179) expr ::= expr EQ|NE expr */
147276
- { 185, -3 }, /* (180) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
147277
- { 185, -3 }, /* (181) expr ::= expr PLUS|MINUS expr */
147278
- { 185, -3 }, /* (182) expr ::= expr STAR|SLASH|REM expr */
147279
- { 185, -3 }, /* (183) expr ::= expr CONCAT expr */
147280
- { 238, -2 }, /* (184) likeop ::= NOT LIKE_KW|MATCH */
147281
- { 185, -3 }, /* (185) expr ::= expr likeop expr */
147282
- { 185, -5 }, /* (186) expr ::= expr likeop expr ESCAPE expr */
147283
- { 185, -2 }, /* (187) expr ::= expr ISNULL|NOTNULL */
147284
- { 185, -3 }, /* (188) expr ::= expr NOT NULL */
147285
- { 185, -3 }, /* (189) expr ::= expr IS expr */
147286
- { 185, -4 }, /* (190) expr ::= expr IS NOT expr */
147287
- { 185, -2 }, /* (191) expr ::= NOT expr */
147288
- { 185, -2 }, /* (192) expr ::= BITNOT expr */
147289
- { 185, -2 }, /* (193) expr ::= PLUS|MINUS expr */
147290
- { 239, -1 }, /* (194) between_op ::= BETWEEN */
147291
- { 239, -2 }, /* (195) between_op ::= NOT BETWEEN */
147292
- { 185, -5 }, /* (196) expr ::= expr between_op expr AND expr */
147293
- { 240, -1 }, /* (197) in_op ::= IN */
147294
- { 240, -2 }, /* (198) in_op ::= NOT IN */
147295
- { 185, -5 }, /* (199) expr ::= expr in_op LP exprlist RP */
147296
- { 185, -3 }, /* (200) expr ::= LP select RP */
147297
- { 185, -5 }, /* (201) expr ::= expr in_op LP select RP */
147298
- { 185, -5 }, /* (202) expr ::= expr in_op nm dbnm paren_exprlist */
147299
- { 185, -4 }, /* (203) expr ::= EXISTS LP select RP */
147300
- { 185, -5 }, /* (204) expr ::= CASE case_operand case_exprlist case_else END */
147301
- { 243, -5 }, /* (205) case_exprlist ::= case_exprlist WHEN expr THEN expr */
147302
- { 243, -4 }, /* (206) case_exprlist ::= WHEN expr THEN expr */
147303
- { 244, -2 }, /* (207) case_else ::= ELSE expr */
147304
- { 244, 0 }, /* (208) case_else ::= */
147305
- { 242, -1 }, /* (209) case_operand ::= expr */
147306
- { 242, 0 }, /* (210) case_operand ::= */
147307
- { 221, 0 }, /* (211) exprlist ::= */
147308
- { 220, -3 }, /* (212) nexprlist ::= nexprlist COMMA expr */
147309
- { 220, -1 }, /* (213) nexprlist ::= expr */
147310
- { 241, 0 }, /* (214) paren_exprlist ::= */
147311
- { 241, -3 }, /* (215) paren_exprlist ::= LP exprlist RP */
147312
- { 160, -12 }, /* (216) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
147313
- { 245, -1 }, /* (217) uniqueflag ::= UNIQUE */
147314
- { 245, 0 }, /* (218) uniqueflag ::= */
147315
- { 189, 0 }, /* (219) eidlist_opt ::= */
147316
- { 189, -3 }, /* (220) eidlist_opt ::= LP eidlist RP */
147317
- { 199, -5 }, /* (221) eidlist ::= eidlist COMMA nm collate sortorder */
147318
- { 199, -3 }, /* (222) eidlist ::= nm collate sortorder */
147319
- { 246, 0 }, /* (223) collate ::= */
147320
- { 246, -2 }, /* (224) collate ::= COLLATE ID|STRING */
147321
- { 160, -4 }, /* (225) cmd ::= DROP INDEX ifexists fullname */
147322
- { 160, -1 }, /* (226) cmd ::= VACUUM */
147323
- { 160, -2 }, /* (227) cmd ::= VACUUM nm */
147324
- { 160, -3 }, /* (228) cmd ::= PRAGMA nm dbnm */
147325
- { 160, -5 }, /* (229) cmd ::= PRAGMA nm dbnm EQ nmnum */
147326
- { 160, -6 }, /* (230) cmd ::= PRAGMA nm dbnm LP nmnum RP */
147327
- { 160, -5 }, /* (231) cmd ::= PRAGMA nm dbnm EQ minus_num */
147328
- { 160, -6 }, /* (232) cmd ::= PRAGMA nm dbnm LP minus_num RP */
147329
- { 180, -2 }, /* (233) plus_num ::= PLUS INTEGER|FLOAT */
147330
- { 181, -2 }, /* (234) minus_num ::= MINUS INTEGER|FLOAT */
147331
- { 160, -5 }, /* (235) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
147332
- { 248, -11 }, /* (236) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
147333
- { 250, -1 }, /* (237) trigger_time ::= BEFORE|AFTER */
147334
- { 250, -2 }, /* (238) trigger_time ::= INSTEAD OF */
147335
- { 250, 0 }, /* (239) trigger_time ::= */
147336
- { 251, -1 }, /* (240) trigger_event ::= DELETE|INSERT */
147337
- { 251, -1 }, /* (241) trigger_event ::= UPDATE */
147338
- { 251, -3 }, /* (242) trigger_event ::= UPDATE OF idlist */
147339
- { 253, 0 }, /* (243) when_clause ::= */
147340
- { 253, -2 }, /* (244) when_clause ::= WHEN expr */
147341
- { 249, -3 }, /* (245) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
147342
- { 249, -2 }, /* (246) trigger_cmd_list ::= trigger_cmd SEMI */
147343
- { 255, -3 }, /* (247) trnm ::= nm DOT nm */
147344
- { 256, -3 }, /* (248) tridxby ::= INDEXED BY nm */
147345
- { 256, -2 }, /* (249) tridxby ::= NOT INDEXED */
147346
- { 254, -8 }, /* (250) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
147347
- { 254, -8 }, /* (251) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
147348
- { 254, -6 }, /* (252) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
147349
- { 254, -3 }, /* (253) trigger_cmd ::= scanpt select scanpt */
147350
- { 185, -4 }, /* (254) expr ::= RAISE LP IGNORE RP */
147351
- { 185, -6 }, /* (255) expr ::= RAISE LP raisetype COMMA nm RP */
147352
- { 203, -1 }, /* (256) raisetype ::= ROLLBACK */
147353
- { 203, -1 }, /* (257) raisetype ::= ABORT */
147354
- { 203, -1 }, /* (258) raisetype ::= FAIL */
147355
- { 160, -4 }, /* (259) cmd ::= DROP TRIGGER ifexists fullname */
147356
- { 160, -6 }, /* (260) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
147357
- { 160, -3 }, /* (261) cmd ::= DETACH database_kw_opt expr */
147358
- { 258, 0 }, /* (262) key_opt ::= */
147359
- { 258, -2 }, /* (263) key_opt ::= KEY expr */
147360
- { 160, -1 }, /* (264) cmd ::= REINDEX */
147361
- { 160, -3 }, /* (265) cmd ::= REINDEX nm dbnm */
147362
- { 160, -1 }, /* (266) cmd ::= ANALYZE */
147363
- { 160, -3 }, /* (267) cmd ::= ANALYZE nm dbnm */
147364
- { 160, -6 }, /* (268) cmd ::= ALTER TABLE fullname RENAME TO nm */
147365
- { 160, -7 }, /* (269) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
147366
- { 259, -1 }, /* (270) add_column_fullname ::= fullname */
147367
- { 160, -1 }, /* (271) cmd ::= create_vtab */
147368
- { 160, -4 }, /* (272) cmd ::= create_vtab LP vtabarglist RP */
147369
- { 261, -8 }, /* (273) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
147370
- { 263, 0 }, /* (274) vtabarg ::= */
147371
- { 264, -1 }, /* (275) vtabargtoken ::= ANY */
147372
- { 264, -3 }, /* (276) vtabargtoken ::= lp anylist RP */
147373
- { 265, -1 }, /* (277) lp ::= LP */
147374
- { 232, -2 }, /* (278) with ::= WITH wqlist */
147375
- { 232, -3 }, /* (279) with ::= WITH RECURSIVE wqlist */
147376
- { 208, -6 }, /* (280) wqlist ::= nm eidlist_opt AS LP select RP */
147377
- { 208, -8 }, /* (281) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
147378
- { 267, -1 }, /* (282) windowdefn_list ::= windowdefn */
147379
- { 267, -3 }, /* (283) windowdefn_list ::= windowdefn_list COMMA windowdefn */
147380
- { 268, -3 }, /* (284) windowdefn ::= nm AS window */
147381
- { 269, -5 }, /* (285) window ::= LP part_opt orderby_opt frame_opt RP */
147382
- { 271, -3 }, /* (286) part_opt ::= PARTITION BY exprlist */
147383
- { 271, 0 }, /* (287) part_opt ::= */
147384
- { 270, 0 }, /* (288) frame_opt ::= */
147385
- { 270, -2 }, /* (289) frame_opt ::= range_or_rows frame_bound_s */
147386
- { 270, -5 }, /* (290) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */
147387
- { 273, -1 }, /* (291) range_or_rows ::= RANGE */
147388
- { 273, -1 }, /* (292) range_or_rows ::= ROWS */
147389
- { 275, -1 }, /* (293) frame_bound_s ::= frame_bound */
147390
- { 275, -2 }, /* (294) frame_bound_s ::= UNBOUNDED PRECEDING */
147391
- { 276, -1 }, /* (295) frame_bound_e ::= frame_bound */
147392
- { 276, -2 }, /* (296) frame_bound_e ::= UNBOUNDED FOLLOWING */
147393
- { 274, -2 }, /* (297) frame_bound ::= expr PRECEDING */
147394
- { 274, -2 }, /* (298) frame_bound ::= CURRENT ROW */
147395
- { 274, -2 }, /* (299) frame_bound ::= expr FOLLOWING */
147396
- { 216, 0 }, /* (300) windowdefn_opt ::= */
147397
- { 216, -2 }, /* (301) windowdefn_opt ::= WINDOW windowdefn_list */
147398
- { 237, 0 }, /* (302) over_opt ::= */
147399
- { 237, -3 }, /* (303) over_opt ::= filter_opt OVER window */
147400
- { 237, -3 }, /* (304) over_opt ::= filter_opt OVER nm */
147401
- { 272, 0 }, /* (305) filter_opt ::= */
147402
- { 272, -5 }, /* (306) filter_opt ::= FILTER LP WHERE expr RP */
147403
- { 155, -1 }, /* (307) input ::= cmdlist */
147404
- { 156, -2 }, /* (308) cmdlist ::= cmdlist ecmd */
147405
- { 156, -1 }, /* (309) cmdlist ::= ecmd */
147406
- { 157, -1 }, /* (310) ecmd ::= SEMI */
147407
- { 157, -2 }, /* (311) ecmd ::= cmdx SEMI */
147408
- { 157, -2 }, /* (312) ecmd ::= explain cmdx */
147409
- { 162, 0 }, /* (313) trans_opt ::= */
147410
- { 162, -1 }, /* (314) trans_opt ::= TRANSACTION */
147411
- { 162, -2 }, /* (315) trans_opt ::= TRANSACTION nm */
147412
- { 164, -1 }, /* (316) savepoint_opt ::= SAVEPOINT */
147413
- { 164, 0 }, /* (317) savepoint_opt ::= */
147414
- { 160, -2 }, /* (318) cmd ::= create_table create_table_args */
147415
- { 171, -4 }, /* (319) columnlist ::= columnlist COMMA columnname carglist */
147416
- { 171, -2 }, /* (320) columnlist ::= columnname carglist */
147417
- { 163, -1 }, /* (321) nm ::= ID|INDEXED */
147418
- { 163, -1 }, /* (322) nm ::= STRING */
147419
- { 163, -1 }, /* (323) nm ::= JOIN_KW */
147420
- { 177, -1 }, /* (324) typetoken ::= typename */
147421
- { 178, -1 }, /* (325) typename ::= ID|STRING */
147422
- { 179, -1 }, /* (326) signed ::= plus_num */
147423
- { 179, -1 }, /* (327) signed ::= minus_num */
147424
- { 176, -2 }, /* (328) carglist ::= carglist ccons */
147425
- { 176, 0 }, /* (329) carglist ::= */
147426
- { 183, -2 }, /* (330) ccons ::= NULL onconf */
147427
- { 172, -2 }, /* (331) conslist_opt ::= COMMA conslist */
147428
- { 195, -3 }, /* (332) conslist ::= conslist tconscomma tcons */
147429
- { 195, -1 }, /* (333) conslist ::= tcons */
147430
- { 196, 0 }, /* (334) tconscomma ::= */
147431
- { 200, -1 }, /* (335) defer_subclause_opt ::= defer_subclause */
147432
- { 202, -1 }, /* (336) resolvetype ::= raisetype */
147433
- { 206, -1 }, /* (337) selectnowith ::= oneselect */
147434
- { 207, -1 }, /* (338) oneselect ::= values */
147435
- { 222, -2 }, /* (339) sclp ::= selcollist COMMA */
147436
- { 223, -1 }, /* (340) as ::= ID|STRING */
147437
- { 185, -1 }, /* (341) expr ::= term */
147438
- { 238, -1 }, /* (342) likeop ::= LIKE_KW|MATCH */
147439
- { 221, -1 }, /* (343) exprlist ::= nexprlist */
147440
- { 247, -1 }, /* (344) nmnum ::= plus_num */
147441
- { 247, -1 }, /* (345) nmnum ::= nm */
147442
- { 247, -1 }, /* (346) nmnum ::= ON */
147443
- { 247, -1 }, /* (347) nmnum ::= DELETE */
147444
- { 247, -1 }, /* (348) nmnum ::= DEFAULT */
147445
- { 180, -1 }, /* (349) plus_num ::= INTEGER|FLOAT */
147446
- { 252, 0 }, /* (350) foreach_clause ::= */
147447
- { 252, -3 }, /* (351) foreach_clause ::= FOR EACH ROW */
147448
- { 255, -1 }, /* (352) trnm ::= nm */
147449
- { 256, 0 }, /* (353) tridxby ::= */
147450
- { 257, -1 }, /* (354) database_kw_opt ::= DATABASE */
147451
- { 257, 0 }, /* (355) database_kw_opt ::= */
147452
- { 260, 0 }, /* (356) kwcolumn_opt ::= */
147453
- { 260, -1 }, /* (357) kwcolumn_opt ::= COLUMNKW */
147454
- { 262, -1 }, /* (358) vtabarglist ::= vtabarg */
147455
- { 262, -3 }, /* (359) vtabarglist ::= vtabarglist COMMA vtabarg */
147456
- { 263, -2 }, /* (360) vtabarg ::= vtabarg vtabargtoken */
147457
- { 266, 0 }, /* (361) anylist ::= */
147458
- { 266, -4 }, /* (362) anylist ::= anylist LP anylist RP */
147459
- { 266, -2 }, /* (363) anylist ::= anylist ANY */
147460
- { 232, 0 }, /* (364) with ::= */
147103
+ { 207, -9 }, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
147104
+ { 207, -10 }, /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
147105
+ { 219, -4 }, /* (89) values ::= VALUES LP nexprlist RP */
147106
+ { 219, -5 }, /* (90) values ::= values COMMA LP nexprlist RP */
147107
+ { 210, -1 }, /* (91) distinct ::= DISTINCT */
147108
+ { 210, -1 }, /* (92) distinct ::= ALL */
147109
+ { 210, 0 }, /* (93) distinct ::= */
147110
+ { 221, 0 }, /* (94) sclp ::= */
147111
+ { 211, -5 }, /* (95) selcollist ::= sclp scanpt expr scanpt as */
147112
+ { 211, -3 }, /* (96) selcollist ::= sclp scanpt STAR */
147113
+ { 211, -5 }, /* (97) selcollist ::= sclp scanpt nm DOT STAR */
147114
+ { 222, -2 }, /* (98) as ::= AS nm */
147115
+ { 222, 0 }, /* (99) as ::= */
147116
+ { 212, 0 }, /* (100) from ::= */
147117
+ { 212, -2 }, /* (101) from ::= FROM seltablist */
147118
+ { 224, -2 }, /* (102) stl_prefix ::= seltablist joinop */
147119
+ { 224, 0 }, /* (103) stl_prefix ::= */
147120
+ { 223, -7 }, /* (104) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
147121
+ { 223, -9 }, /* (105) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
147122
+ { 223, -7 }, /* (106) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
147123
+ { 223, -7 }, /* (107) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
147124
+ { 170, 0 }, /* (108) dbnm ::= */
147125
+ { 170, -2 }, /* (109) dbnm ::= DOT nm */
147126
+ { 205, -1 }, /* (110) fullname ::= nm */
147127
+ { 205, -3 }, /* (111) fullname ::= nm DOT nm */
147128
+ { 230, -1 }, /* (112) xfullname ::= nm */
147129
+ { 230, -3 }, /* (113) xfullname ::= nm DOT nm */
147130
+ { 230, -5 }, /* (114) xfullname ::= nm DOT nm AS nm */
147131
+ { 230, -3 }, /* (115) xfullname ::= nm AS nm */
147132
+ { 225, -1 }, /* (116) joinop ::= COMMA|JOIN */
147133
+ { 225, -2 }, /* (117) joinop ::= JOIN_KW JOIN */
147134
+ { 225, -3 }, /* (118) joinop ::= JOIN_KW nm JOIN */
147135
+ { 225, -4 }, /* (119) joinop ::= JOIN_KW nm nm JOIN */
147136
+ { 227, -2 }, /* (120) on_opt ::= ON expr */
147137
+ { 227, 0 }, /* (121) on_opt ::= */
147138
+ { 226, 0 }, /* (122) indexed_opt ::= */
147139
+ { 226, -3 }, /* (123) indexed_opt ::= INDEXED BY nm */
147140
+ { 226, -2 }, /* (124) indexed_opt ::= NOT INDEXED */
147141
+ { 228, -4 }, /* (125) using_opt ::= USING LP idlist RP */
147142
+ { 228, 0 }, /* (126) using_opt ::= */
147143
+ { 216, 0 }, /* (127) orderby_opt ::= */
147144
+ { 216, -3 }, /* (128) orderby_opt ::= ORDER BY sortlist */
147145
+ { 198, -4 }, /* (129) sortlist ::= sortlist COMMA expr sortorder */
147146
+ { 198, -2 }, /* (130) sortlist ::= expr sortorder */
147147
+ { 187, -1 }, /* (131) sortorder ::= ASC */
147148
+ { 187, -1 }, /* (132) sortorder ::= DESC */
147149
+ { 187, 0 }, /* (133) sortorder ::= */
147150
+ { 214, 0 }, /* (134) groupby_opt ::= */
147151
+ { 214, -3 }, /* (135) groupby_opt ::= GROUP BY nexprlist */
147152
+ { 215, 0 }, /* (136) having_opt ::= */
147153
+ { 215, -2 }, /* (137) having_opt ::= HAVING expr */
147154
+ { 217, 0 }, /* (138) limit_opt ::= */
147155
+ { 217, -2 }, /* (139) limit_opt ::= LIMIT expr */
147156
+ { 217, -4 }, /* (140) limit_opt ::= LIMIT expr OFFSET expr */
147157
+ { 217, -4 }, /* (141) limit_opt ::= LIMIT expr COMMA expr */
147158
+ { 160, -6 }, /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
147159
+ { 213, 0 }, /* (143) where_opt ::= */
147160
+ { 213, -2 }, /* (144) where_opt ::= WHERE expr */
147161
+ { 160, -8 }, /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
147162
+ { 233, -5 }, /* (146) setlist ::= setlist COMMA nm EQ expr */
147163
+ { 233, -7 }, /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */
147164
+ { 233, -3 }, /* (148) setlist ::= nm EQ expr */
147165
+ { 233, -5 }, /* (149) setlist ::= LP idlist RP EQ expr */
147166
+ { 160, -7 }, /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
147167
+ { 160, -7 }, /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
147168
+ { 236, 0 }, /* (152) upsert ::= */
147169
+ { 236, -11 }, /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
147170
+ { 236, -8 }, /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
147171
+ { 236, -4 }, /* (155) upsert ::= ON CONFLICT DO NOTHING */
147172
+ { 234, -2 }, /* (156) insert_cmd ::= INSERT orconf */
147173
+ { 234, -1 }, /* (157) insert_cmd ::= REPLACE */
147174
+ { 235, 0 }, /* (158) idlist_opt ::= */
147175
+ { 235, -3 }, /* (159) idlist_opt ::= LP idlist RP */
147176
+ { 231, -3 }, /* (160) idlist ::= idlist COMMA nm */
147177
+ { 231, -1 }, /* (161) idlist ::= nm */
147178
+ { 185, -3 }, /* (162) expr ::= LP expr RP */
147179
+ { 185, -1 }, /* (163) expr ::= ID|INDEXED */
147180
+ { 185, -1 }, /* (164) expr ::= JOIN_KW */
147181
+ { 185, -3 }, /* (165) expr ::= nm DOT nm */
147182
+ { 185, -5 }, /* (166) expr ::= nm DOT nm DOT nm */
147183
+ { 184, -1 }, /* (167) term ::= NULL|FLOAT|BLOB */
147184
+ { 184, -1 }, /* (168) term ::= STRING */
147185
+ { 184, -1 }, /* (169) term ::= INTEGER */
147186
+ { 185, -1 }, /* (170) expr ::= VARIABLE */
147187
+ { 185, -3 }, /* (171) expr ::= expr COLLATE ID|STRING */
147188
+ { 185, -6 }, /* (172) expr ::= CAST LP expr AS typetoken RP */
147189
+ { 185, -5 }, /* (173) expr ::= ID|INDEXED LP distinct exprlist RP */
147190
+ { 185, -4 }, /* (174) expr ::= ID|INDEXED LP STAR RP */
147191
+ { 185, -6 }, /* (175) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
147192
+ { 185, -5 }, /* (176) expr ::= ID|INDEXED LP STAR RP over_clause */
147193
+ { 184, -1 }, /* (177) term ::= CTIME_KW */
147194
+ { 185, -5 }, /* (178) expr ::= LP nexprlist COMMA expr RP */
147195
+ { 185, -3 }, /* (179) expr ::= expr AND expr */
147196
+ { 185, -3 }, /* (180) expr ::= expr OR expr */
147197
+ { 185, -3 }, /* (181) expr ::= expr LT|GT|GE|LE expr */
147198
+ { 185, -3 }, /* (182) expr ::= expr EQ|NE expr */
147199
+ { 185, -3 }, /* (183) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
147200
+ { 185, -3 }, /* (184) expr ::= expr PLUS|MINUS expr */
147201
+ { 185, -3 }, /* (185) expr ::= expr STAR|SLASH|REM expr */
147202
+ { 185, -3 }, /* (186) expr ::= expr CONCAT expr */
147203
+ { 238, -2 }, /* (187) likeop ::= NOT LIKE_KW|MATCH */
147204
+ { 185, -3 }, /* (188) expr ::= expr likeop expr */
147205
+ { 185, -5 }, /* (189) expr ::= expr likeop expr ESCAPE expr */
147206
+ { 185, -2 }, /* (190) expr ::= expr ISNULL|NOTNULL */
147207
+ { 185, -3 }, /* (191) expr ::= expr NOT NULL */
147208
+ { 185, -3 }, /* (192) expr ::= expr IS expr */
147209
+ { 185, -4 }, /* (193) expr ::= expr IS NOT expr */
147210
+ { 185, -2 }, /* (194) expr ::= NOT expr */
147211
+ { 185, -2 }, /* (195) expr ::= BITNOT expr */
147212
+ { 185, -2 }, /* (196) expr ::= PLUS|MINUS expr */
147213
+ { 239, -1 }, /* (197) between_op ::= BETWEEN */
147214
+ { 239, -2 }, /* (198) between_op ::= NOT BETWEEN */
147215
+ { 185, -5 }, /* (199) expr ::= expr between_op expr AND expr */
147216
+ { 240, -1 }, /* (200) in_op ::= IN */
147217
+ { 240, -2 }, /* (201) in_op ::= NOT IN */
147218
+ { 185, -5 }, /* (202) expr ::= expr in_op LP exprlist RP */
147219
+ { 185, -3 }, /* (203) expr ::= LP select RP */
147220
+ { 185, -5 }, /* (204) expr ::= expr in_op LP select RP */
147221
+ { 185, -5 }, /* (205) expr ::= expr in_op nm dbnm paren_exprlist */
147222
+ { 185, -4 }, /* (206) expr ::= EXISTS LP select RP */
147223
+ { 185, -5 }, /* (207) expr ::= CASE case_operand case_exprlist case_else END */
147224
+ { 243, -5 }, /* (208) case_exprlist ::= case_exprlist WHEN expr THEN expr */
147225
+ { 243, -4 }, /* (209) case_exprlist ::= WHEN expr THEN expr */
147226
+ { 244, -2 }, /* (210) case_else ::= ELSE expr */
147227
+ { 244, 0 }, /* (211) case_else ::= */
147228
+ { 242, -1 }, /* (212) case_operand ::= expr */
147229
+ { 242, 0 }, /* (213) case_operand ::= */
147230
+ { 229, 0 }, /* (214) exprlist ::= */
147231
+ { 220, -3 }, /* (215) nexprlist ::= nexprlist COMMA expr */
147232
+ { 220, -1 }, /* (216) nexprlist ::= expr */
147233
+ { 241, 0 }, /* (217) paren_exprlist ::= */
147234
+ { 241, -3 }, /* (218) paren_exprlist ::= LP exprlist RP */
147235
+ { 160, -12 }, /* (219) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
147236
+ { 245, -1 }, /* (220) uniqueflag ::= UNIQUE */
147237
+ { 245, 0 }, /* (221) uniqueflag ::= */
147238
+ { 189, 0 }, /* (222) eidlist_opt ::= */
147239
+ { 189, -3 }, /* (223) eidlist_opt ::= LP eidlist RP */
147240
+ { 199, -5 }, /* (224) eidlist ::= eidlist COMMA nm collate sortorder */
147241
+ { 199, -3 }, /* (225) eidlist ::= nm collate sortorder */
147242
+ { 246, 0 }, /* (226) collate ::= */
147243
+ { 246, -2 }, /* (227) collate ::= COLLATE ID|STRING */
147244
+ { 160, -4 }, /* (228) cmd ::= DROP INDEX ifexists fullname */
147245
+ { 160, -1 }, /* (229) cmd ::= VACUUM */
147246
+ { 160, -2 }, /* (230) cmd ::= VACUUM nm */
147247
+ { 160, -3 }, /* (231) cmd ::= PRAGMA nm dbnm */
147248
+ { 160, -5 }, /* (232) cmd ::= PRAGMA nm dbnm EQ nmnum */
147249
+ { 160, -6 }, /* (233) cmd ::= PRAGMA nm dbnm LP nmnum RP */
147250
+ { 160, -5 }, /* (234) cmd ::= PRAGMA nm dbnm EQ minus_num */
147251
+ { 160, -6 }, /* (235) cmd ::= PRAGMA nm dbnm LP minus_num RP */
147252
+ { 180, -2 }, /* (236) plus_num ::= PLUS INTEGER|FLOAT */
147253
+ { 181, -2 }, /* (237) minus_num ::= MINUS INTEGER|FLOAT */
147254
+ { 160, -5 }, /* (238) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
147255
+ { 248, -11 }, /* (239) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
147256
+ { 250, -1 }, /* (240) trigger_time ::= BEFORE|AFTER */
147257
+ { 250, -2 }, /* (241) trigger_time ::= INSTEAD OF */
147258
+ { 250, 0 }, /* (242) trigger_time ::= */
147259
+ { 251, -1 }, /* (243) trigger_event ::= DELETE|INSERT */
147260
+ { 251, -1 }, /* (244) trigger_event ::= UPDATE */
147261
+ { 251, -3 }, /* (245) trigger_event ::= UPDATE OF idlist */
147262
+ { 253, 0 }, /* (246) when_clause ::= */
147263
+ { 253, -2 }, /* (247) when_clause ::= WHEN expr */
147264
+ { 249, -3 }, /* (248) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
147265
+ { 249, -2 }, /* (249) trigger_cmd_list ::= trigger_cmd SEMI */
147266
+ { 255, -3 }, /* (250) trnm ::= nm DOT nm */
147267
+ { 256, -3 }, /* (251) tridxby ::= INDEXED BY nm */
147268
+ { 256, -2 }, /* (252) tridxby ::= NOT INDEXED */
147269
+ { 254, -8 }, /* (253) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
147270
+ { 254, -8 }, /* (254) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
147271
+ { 254, -6 }, /* (255) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
147272
+ { 254, -3 }, /* (256) trigger_cmd ::= scanpt select scanpt */
147273
+ { 185, -4 }, /* (257) expr ::= RAISE LP IGNORE RP */
147274
+ { 185, -6 }, /* (258) expr ::= RAISE LP raisetype COMMA nm RP */
147275
+ { 203, -1 }, /* (259) raisetype ::= ROLLBACK */
147276
+ { 203, -1 }, /* (260) raisetype ::= ABORT */
147277
+ { 203, -1 }, /* (261) raisetype ::= FAIL */
147278
+ { 160, -4 }, /* (262) cmd ::= DROP TRIGGER ifexists fullname */
147279
+ { 160, -6 }, /* (263) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
147280
+ { 160, -3 }, /* (264) cmd ::= DETACH database_kw_opt expr */
147281
+ { 258, 0 }, /* (265) key_opt ::= */
147282
+ { 258, -2 }, /* (266) key_opt ::= KEY expr */
147283
+ { 160, -1 }, /* (267) cmd ::= REINDEX */
147284
+ { 160, -3 }, /* (268) cmd ::= REINDEX nm dbnm */
147285
+ { 160, -1 }, /* (269) cmd ::= ANALYZE */
147286
+ { 160, -3 }, /* (270) cmd ::= ANALYZE nm dbnm */
147287
+ { 160, -6 }, /* (271) cmd ::= ALTER TABLE fullname RENAME TO nm */
147288
+ { 160, -7 }, /* (272) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
147289
+ { 259, -1 }, /* (273) add_column_fullname ::= fullname */
147290
+ { 160, -1 }, /* (274) cmd ::= create_vtab */
147291
+ { 160, -4 }, /* (275) cmd ::= create_vtab LP vtabarglist RP */
147292
+ { 261, -8 }, /* (276) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
147293
+ { 263, 0 }, /* (277) vtabarg ::= */
147294
+ { 264, -1 }, /* (278) vtabargtoken ::= ANY */
147295
+ { 264, -3 }, /* (279) vtabargtoken ::= lp anylist RP */
147296
+ { 265, -1 }, /* (280) lp ::= LP */
147297
+ { 232, -2 }, /* (281) with ::= WITH wqlist */
147298
+ { 232, -3 }, /* (282) with ::= WITH RECURSIVE wqlist */
147299
+ { 208, -6 }, /* (283) wqlist ::= nm eidlist_opt AS LP select RP */
147300
+ { 208, -8 }, /* (284) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
147301
+ { 267, -1 }, /* (285) windowdefn_list ::= windowdefn */
147302
+ { 267, -3 }, /* (286) windowdefn_list ::= windowdefn_list COMMA windowdefn */
147303
+ { 268, -3 }, /* (287) windowdefn ::= nm AS window */
147304
+ { 269, -5 }, /* (288) window ::= LP part_opt orderby_opt frame_opt RP */
147305
+ { 271, -3 }, /* (289) part_opt ::= PARTITION BY nexprlist */
147306
+ { 271, 0 }, /* (290) part_opt ::= */
147307
+ { 270, 0 }, /* (291) frame_opt ::= */
147308
+ { 270, -2 }, /* (292) frame_opt ::= range_or_rows frame_bound_s */
147309
+ { 270, -5 }, /* (293) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */
147310
+ { 273, -1 }, /* (294) range_or_rows ::= RANGE */
147311
+ { 273, -1 }, /* (295) range_or_rows ::= ROWS */
147312
+ { 275, -1 }, /* (296) frame_bound_s ::= frame_bound */
147313
+ { 275, -2 }, /* (297) frame_bound_s ::= UNBOUNDED PRECEDING */
147314
+ { 276, -1 }, /* (298) frame_bound_e ::= frame_bound */
147315
+ { 276, -2 }, /* (299) frame_bound_e ::= UNBOUNDED FOLLOWING */
147316
+ { 274, -2 }, /* (300) frame_bound ::= expr PRECEDING */
147317
+ { 274, -2 }, /* (301) frame_bound ::= CURRENT ROW */
147318
+ { 274, -2 }, /* (302) frame_bound ::= expr FOLLOWING */
147319
+ { 218, -2 }, /* (303) window_clause ::= WINDOW windowdefn_list */
147320
+ { 237, -3 }, /* (304) over_clause ::= filter_opt OVER window */
147321
+ { 237, -3 }, /* (305) over_clause ::= filter_opt OVER nm */
147322
+ { 272, 0 }, /* (306) filter_opt ::= */
147323
+ { 272, -5 }, /* (307) filter_opt ::= FILTER LP WHERE expr RP */
147324
+ { 155, -1 }, /* (308) input ::= cmdlist */
147325
+ { 156, -2 }, /* (309) cmdlist ::= cmdlist ecmd */
147326
+ { 156, -1 }, /* (310) cmdlist ::= ecmd */
147327
+ { 157, -1 }, /* (311) ecmd ::= SEMI */
147328
+ { 157, -2 }, /* (312) ecmd ::= cmdx SEMI */
147329
+ { 157, -2 }, /* (313) ecmd ::= explain cmdx */
147330
+ { 162, 0 }, /* (314) trans_opt ::= */
147331
+ { 162, -1 }, /* (315) trans_opt ::= TRANSACTION */
147332
+ { 162, -2 }, /* (316) trans_opt ::= TRANSACTION nm */
147333
+ { 164, -1 }, /* (317) savepoint_opt ::= SAVEPOINT */
147334
+ { 164, 0 }, /* (318) savepoint_opt ::= */
147335
+ { 160, -2 }, /* (319) cmd ::= create_table create_table_args */
147336
+ { 171, -4 }, /* (320) columnlist ::= columnlist COMMA columnname carglist */
147337
+ { 171, -2 }, /* (321) columnlist ::= columnname carglist */
147338
+ { 163, -1 }, /* (322) nm ::= ID|INDEXED */
147339
+ { 163, -1 }, /* (323) nm ::= STRING */
147340
+ { 163, -1 }, /* (324) nm ::= JOIN_KW */
147341
+ { 177, -1 }, /* (325) typetoken ::= typename */
147342
+ { 178, -1 }, /* (326) typename ::= ID|STRING */
147343
+ { 179, -1 }, /* (327) signed ::= plus_num */
147344
+ { 179, -1 }, /* (328) signed ::= minus_num */
147345
+ { 176, -2 }, /* (329) carglist ::= carglist ccons */
147346
+ { 176, 0 }, /* (330) carglist ::= */
147347
+ { 183, -2 }, /* (331) ccons ::= NULL onconf */
147348
+ { 172, -2 }, /* (332) conslist_opt ::= COMMA conslist */
147349
+ { 195, -3 }, /* (333) conslist ::= conslist tconscomma tcons */
147350
+ { 195, -1 }, /* (334) conslist ::= tcons */
147351
+ { 196, 0 }, /* (335) tconscomma ::= */
147352
+ { 200, -1 }, /* (336) defer_subclause_opt ::= defer_subclause */
147353
+ { 202, -1 }, /* (337) resolvetype ::= raisetype */
147354
+ { 206, -1 }, /* (338) selectnowith ::= oneselect */
147355
+ { 207, -1 }, /* (339) oneselect ::= values */
147356
+ { 221, -2 }, /* (340) sclp ::= selcollist COMMA */
147357
+ { 222, -1 }, /* (341) as ::= ID|STRING */
147358
+ { 185, -1 }, /* (342) expr ::= term */
147359
+ { 238, -1 }, /* (343) likeop ::= LIKE_KW|MATCH */
147360
+ { 229, -1 }, /* (344) exprlist ::= nexprlist */
147361
+ { 247, -1 }, /* (345) nmnum ::= plus_num */
147362
+ { 247, -1 }, /* (346) nmnum ::= nm */
147363
+ { 247, -1 }, /* (347) nmnum ::= ON */
147364
+ { 247, -1 }, /* (348) nmnum ::= DELETE */
147365
+ { 247, -1 }, /* (349) nmnum ::= DEFAULT */
147366
+ { 180, -1 }, /* (350) plus_num ::= INTEGER|FLOAT */
147367
+ { 252, 0 }, /* (351) foreach_clause ::= */
147368
+ { 252, -3 }, /* (352) foreach_clause ::= FOR EACH ROW */
147369
+ { 255, -1 }, /* (353) trnm ::= nm */
147370
+ { 256, 0 }, /* (354) tridxby ::= */
147371
+ { 257, -1 }, /* (355) database_kw_opt ::= DATABASE */
147372
+ { 257, 0 }, /* (356) database_kw_opt ::= */
147373
+ { 260, 0 }, /* (357) kwcolumn_opt ::= */
147374
+ { 260, -1 }, /* (358) kwcolumn_opt ::= COLUMNKW */
147375
+ { 262, -1 }, /* (359) vtabarglist ::= vtabarg */
147376
+ { 262, -3 }, /* (360) vtabarglist ::= vtabarglist COMMA vtabarg */
147377
+ { 263, -2 }, /* (361) vtabarg ::= vtabarg vtabargtoken */
147378
+ { 266, 0 }, /* (362) anylist ::= */
147379
+ { 266, -4 }, /* (363) anylist ::= anylist LP anylist RP */
147380
+ { 266, -2 }, /* (364) anylist ::= anylist ANY */
147381
+ { 232, 0 }, /* (365) with ::= */
147461147382
};
147462147383
147463147384
static void yy_accept(yyParser*); /* Forward Declaration */
147464147385
147465147386
/*
@@ -147596,12 +147517,12 @@
147596147517
case 21: /* table_options ::= */ yytestcase(yyruleno==21);
147597147518
case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
147598147519
case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
147599147520
case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
147600147521
case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
147601
- case 92: /* distinct ::= */ yytestcase(yyruleno==92);
147602
- case 223: /* collate ::= */ yytestcase(yyruleno==223);
147522
+ case 93: /* distinct ::= */ yytestcase(yyruleno==93);
147523
+ case 226: /* collate ::= */ yytestcase(yyruleno==226);
147603147524
{yymsp[1].minor.yy70 = 0;}
147604147525
break;
147605147526
case 16: /* ifnotexists ::= IF NOT EXISTS */
147606147527
{yymsp[-2].minor.yy70 = 1;}
147607147528
break;
@@ -147633,11 +147554,11 @@
147633147554
case 23: /* columnname ::= nm typetoken */
147634147555
{sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
147635147556
break;
147636147557
case 24: /* typetoken ::= */
147637147558
case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60);
147638
- case 98: /* as ::= */ yytestcase(yyruleno==98);
147559
+ case 99: /* as ::= */ yytestcase(yyruleno==99);
147639147560
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
147640147561
break;
147641147562
case 25: /* typetoken ::= typename LP signed RP */
147642147563
{
147643147564
yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
@@ -147744,18 +147665,18 @@
147744147665
case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
147745147666
{yymsp[-2].minor.yy70 = 0;}
147746147667
break;
147747147668
case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
147748147669
case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
147749
- case 155: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==155);
147670
+ case 156: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==156);
147750147671
{yymsp[-1].minor.yy70 = yymsp[0].minor.yy70;}
147751147672
break;
147752147673
case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
147753147674
case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
147754
- case 195: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==195);
147755
- case 198: /* in_op ::= NOT IN */ yytestcase(yyruleno==198);
147756
- case 224: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==224);
147675
+ case 198: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==198);
147676
+ case 201: /* in_op ::= NOT IN */ yytestcase(yyruleno==201);
147677
+ case 227: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==227);
147757147678
{yymsp[-1].minor.yy70 = 1;}
147758147679
break;
147759147680
case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
147760147681
{yymsp[-1].minor.yy70 = 0;}
147761147682
break;
@@ -147787,11 +147708,11 @@
147787147708
break;
147788147709
case 72: /* resolvetype ::= IGNORE */
147789147710
{yymsp[0].minor.yy70 = OE_Ignore;}
147790147711
break;
147791147712
case 73: /* resolvetype ::= REPLACE */
147792
- case 156: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==156);
147713
+ case 157: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==157);
147793147714
{yymsp[0].minor.yy70 = OE_Replace;}
147794147715
break;
147795147716
case 74: /* cmd ::= DROP TABLE ifexists fullname */
147796147717
{
147797147718
sqlite3DropTable(pParse, yymsp[0].minor.yy135, 0, yymsp[-1].minor.yy70);
@@ -147876,28 +147797,31 @@
147876147797
{yymsp[0].minor.yy70 = yymsp[0].major; /*A-overwrites-OP*/}
147877147798
break;
147878147799
case 85: /* multiselect_op ::= UNION ALL */
147879147800
{yymsp[-1].minor.yy70 = TK_ALL;}
147880147801
break;
147881
- case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt windowdefn_opt orderby_opt limit_opt */
147802
+ case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
147803
+{
147804
+ yymsp[-8].minor.yy489 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy420,yymsp[-5].minor.yy135,yymsp[-4].minor.yy18,yymsp[-3].minor.yy420,yymsp[-2].minor.yy18,yymsp[-1].minor.yy420,yymsp[-7].minor.yy70,yymsp[0].minor.yy18);
147805
+}
147806
+ break;
147807
+ case 88: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
147882147808
{
147883147809
yymsp[-9].minor.yy489 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy420,yymsp[-6].minor.yy135,yymsp[-5].minor.yy18,yymsp[-4].minor.yy420,yymsp[-3].minor.yy18,yymsp[-1].minor.yy420,yymsp[-8].minor.yy70,yymsp[0].minor.yy18);
147884
-#ifndef SQLITE_OMIT_WINDOWFUNC
147885147810
if( yymsp[-9].minor.yy489 ){
147886147811
yymsp[-9].minor.yy489->pWinDefn = yymsp[-2].minor.yy327;
147887147812
}else{
147888147813
sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy327);
147889147814
}
147890
-#endif /* SQLITE_OMIT_WINDOWFUNC */
147891147815
}
147892147816
break;
147893
- case 88: /* values ::= VALUES LP nexprlist RP */
147817
+ case 89: /* values ::= VALUES LP nexprlist RP */
147894147818
{
147895147819
yymsp[-3].minor.yy489 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy420,0,0,0,0,0,SF_Values,0);
147896147820
}
147897147821
break;
147898
- case 89: /* values ::= values COMMA LP exprlist RP */
147822
+ case 90: /* values ::= values COMMA LP nexprlist RP */
147899147823
{
147900147824
Select *pRight, *pLeft = yymsp[-4].minor.yy489;
147901147825
pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy420,0,0,0,0,0,SF_Values|SF_MultiValue,0);
147902147826
if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
147903147827
if( pRight ){
@@ -147907,86 +147831,86 @@
147907147831
}else{
147908147832
yymsp[-4].minor.yy489 = pLeft;
147909147833
}
147910147834
}
147911147835
break;
147912
- case 90: /* distinct ::= DISTINCT */
147836
+ case 91: /* distinct ::= DISTINCT */
147913147837
{yymsp[0].minor.yy70 = SF_Distinct;}
147914147838
break;
147915
- case 91: /* distinct ::= ALL */
147839
+ case 92: /* distinct ::= ALL */
147916147840
{yymsp[0].minor.yy70 = SF_All;}
147917147841
break;
147918
- case 93: /* sclp ::= */
147919
- case 126: /* orderby_opt ::= */ yytestcase(yyruleno==126);
147920
- case 133: /* groupby_opt ::= */ yytestcase(yyruleno==133);
147921
- case 211: /* exprlist ::= */ yytestcase(yyruleno==211);
147922
- case 214: /* paren_exprlist ::= */ yytestcase(yyruleno==214);
147923
- case 219: /* eidlist_opt ::= */ yytestcase(yyruleno==219);
147842
+ case 94: /* sclp ::= */
147843
+ case 127: /* orderby_opt ::= */ yytestcase(yyruleno==127);
147844
+ case 134: /* groupby_opt ::= */ yytestcase(yyruleno==134);
147845
+ case 214: /* exprlist ::= */ yytestcase(yyruleno==214);
147846
+ case 217: /* paren_exprlist ::= */ yytestcase(yyruleno==217);
147847
+ case 222: /* eidlist_opt ::= */ yytestcase(yyruleno==222);
147924147848
{yymsp[1].minor.yy420 = 0;}
147925147849
break;
147926
- case 94: /* selcollist ::= sclp scanpt expr scanpt as */
147850
+ case 95: /* selcollist ::= sclp scanpt expr scanpt as */
147927147851
{
147928147852
yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy420, yymsp[-2].minor.yy18);
147929147853
if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy420, &yymsp[0].minor.yy0, 1);
147930147854
sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy420,yymsp[-3].minor.yy392,yymsp[-1].minor.yy392);
147931147855
}
147932147856
break;
147933
- case 95: /* selcollist ::= sclp scanpt STAR */
147857
+ case 96: /* selcollist ::= sclp scanpt STAR */
147934147858
{
147935147859
Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
147936147860
yymsp[-2].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy420, p);
147937147861
}
147938147862
break;
147939
- case 96: /* selcollist ::= sclp scanpt nm DOT STAR */
147863
+ case 97: /* selcollist ::= sclp scanpt nm DOT STAR */
147940147864
{
147941147865
Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
147942147866
Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
147943147867
Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
147944147868
yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, pDot);
147945147869
}
147946147870
break;
147947
- case 97: /* as ::= AS nm */
147948
- case 108: /* dbnm ::= DOT nm */ yytestcase(yyruleno==108);
147949
- case 233: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==233);
147950
- case 234: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==234);
147871
+ case 98: /* as ::= AS nm */
147872
+ case 109: /* dbnm ::= DOT nm */ yytestcase(yyruleno==109);
147873
+ case 236: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==236);
147874
+ case 237: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==237);
147951147875
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
147952147876
break;
147953
- case 99: /* from ::= */
147877
+ case 100: /* from ::= */
147954147878
{yymsp[1].minor.yy135 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy135));}
147955147879
break;
147956
- case 100: /* from ::= FROM seltablist */
147880
+ case 101: /* from ::= FROM seltablist */
147957147881
{
147958147882
yymsp[-1].minor.yy135 = yymsp[0].minor.yy135;
147959147883
sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy135);
147960147884
}
147961147885
break;
147962
- case 101: /* stl_prefix ::= seltablist joinop */
147886
+ case 102: /* stl_prefix ::= seltablist joinop */
147963147887
{
147964147888
if( ALWAYS(yymsp[-1].minor.yy135 && yymsp[-1].minor.yy135->nSrc>0) ) yymsp[-1].minor.yy135->a[yymsp[-1].minor.yy135->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy70;
147965147889
}
147966147890
break;
147967
- case 102: /* stl_prefix ::= */
147891
+ case 103: /* stl_prefix ::= */
147968147892
{yymsp[1].minor.yy135 = 0;}
147969147893
break;
147970
- case 103: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
147894
+ case 104: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
147971147895
{
147972147896
yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
147973147897
sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy135, &yymsp[-2].minor.yy0);
147974147898
}
147975147899
break;
147976
- case 104: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
147900
+ case 105: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
147977147901
{
147978147902
yymsp[-8].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy135,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
147979147903
sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy135, yymsp[-4].minor.yy420);
147980147904
}
147981147905
break;
147982
- case 105: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
147906
+ case 106: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
147983147907
{
147984147908
yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy489,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
147985147909
}
147986147910
break;
147987
- case 106: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
147911
+ case 107: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
147988147912
{
147989147913
if( yymsp[-6].minor.yy135==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy18==0 && yymsp[0].minor.yy48==0 ){
147990147914
yymsp[-6].minor.yy135 = yymsp[-4].minor.yy135;
147991147915
}else if( yymsp[-4].minor.yy135->nSrc==1 ){
147992147916
yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
@@ -148006,210 +147930,210 @@
148006147930
pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy135,0,0,0,0,SF_NestedFrom,0);
148007147931
yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
148008147932
}
148009147933
}
148010147934
break;
148011
- case 107: /* dbnm ::= */
148012
- case 121: /* indexed_opt ::= */ yytestcase(yyruleno==121);
147935
+ case 108: /* dbnm ::= */
147936
+ case 122: /* indexed_opt ::= */ yytestcase(yyruleno==122);
148013147937
{yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
148014147938
break;
148015
- case 109: /* fullname ::= nm */
148016
- case 111: /* xfullname ::= nm */ yytestcase(yyruleno==111);
147939
+ case 110: /* fullname ::= nm */
147940
+ case 112: /* xfullname ::= nm */ yytestcase(yyruleno==112);
148017147941
{yymsp[0].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
148018147942
break;
148019
- case 110: /* fullname ::= nm DOT nm */
148020
- case 112: /* xfullname ::= nm DOT nm */ yytestcase(yyruleno==112);
147943
+ case 111: /* fullname ::= nm DOT nm */
147944
+ case 113: /* xfullname ::= nm DOT nm */ yytestcase(yyruleno==113);
148021147945
{yymsp[-2].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
148022147946
break;
148023
- case 113: /* xfullname ::= nm DOT nm AS nm */
147947
+ case 114: /* xfullname ::= nm DOT nm AS nm */
148024147948
{
148025147949
yymsp[-4].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
148026147950
if( yymsp[-4].minor.yy135 ) yymsp[-4].minor.yy135->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
148027147951
}
148028147952
break;
148029
- case 114: /* xfullname ::= nm AS nm */
147953
+ case 115: /* xfullname ::= nm AS nm */
148030147954
{
148031147955
yymsp[-2].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
148032147956
if( yymsp[-2].minor.yy135 ) yymsp[-2].minor.yy135->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
148033147957
}
148034147958
break;
148035
- case 115: /* joinop ::= COMMA|JOIN */
147959
+ case 116: /* joinop ::= COMMA|JOIN */
148036147960
{ yymsp[0].minor.yy70 = JT_INNER; }
148037147961
break;
148038
- case 116: /* joinop ::= JOIN_KW JOIN */
147962
+ case 117: /* joinop ::= JOIN_KW JOIN */
148039147963
{yymsp[-1].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
148040147964
break;
148041
- case 117: /* joinop ::= JOIN_KW nm JOIN */
147965
+ case 118: /* joinop ::= JOIN_KW nm JOIN */
148042147966
{yymsp[-2].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
148043147967
break;
148044
- case 118: /* joinop ::= JOIN_KW nm nm JOIN */
147968
+ case 119: /* joinop ::= JOIN_KW nm nm JOIN */
148045147969
{yymsp[-3].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
148046147970
break;
148047
- case 119: /* on_opt ::= ON expr */
148048
- case 136: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==136);
148049
- case 143: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==143);
148050
- case 207: /* case_else ::= ELSE expr */ yytestcase(yyruleno==207);
147971
+ case 120: /* on_opt ::= ON expr */
147972
+ case 137: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==137);
147973
+ case 144: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==144);
147974
+ case 210: /* case_else ::= ELSE expr */ yytestcase(yyruleno==210);
148051147975
{yymsp[-1].minor.yy18 = yymsp[0].minor.yy18;}
148052147976
break;
148053
- case 120: /* on_opt ::= */
148054
- case 135: /* having_opt ::= */ yytestcase(yyruleno==135);
148055
- case 137: /* limit_opt ::= */ yytestcase(yyruleno==137);
148056
- case 142: /* where_opt ::= */ yytestcase(yyruleno==142);
148057
- case 208: /* case_else ::= */ yytestcase(yyruleno==208);
148058
- case 210: /* case_operand ::= */ yytestcase(yyruleno==210);
147977
+ case 121: /* on_opt ::= */
147978
+ case 136: /* having_opt ::= */ yytestcase(yyruleno==136);
147979
+ case 138: /* limit_opt ::= */ yytestcase(yyruleno==138);
147980
+ case 143: /* where_opt ::= */ yytestcase(yyruleno==143);
147981
+ case 211: /* case_else ::= */ yytestcase(yyruleno==211);
147982
+ case 213: /* case_operand ::= */ yytestcase(yyruleno==213);
148059147983
{yymsp[1].minor.yy18 = 0;}
148060147984
break;
148061
- case 122: /* indexed_opt ::= INDEXED BY nm */
147985
+ case 123: /* indexed_opt ::= INDEXED BY nm */
148062147986
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
148063147987
break;
148064
- case 123: /* indexed_opt ::= NOT INDEXED */
147988
+ case 124: /* indexed_opt ::= NOT INDEXED */
148065147989
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
148066147990
break;
148067
- case 124: /* using_opt ::= USING LP idlist RP */
147991
+ case 125: /* using_opt ::= USING LP idlist RP */
148068147992
{yymsp[-3].minor.yy48 = yymsp[-1].minor.yy48;}
148069147993
break;
148070
- case 125: /* using_opt ::= */
148071
- case 157: /* idlist_opt ::= */ yytestcase(yyruleno==157);
147994
+ case 126: /* using_opt ::= */
147995
+ case 158: /* idlist_opt ::= */ yytestcase(yyruleno==158);
148072147996
{yymsp[1].minor.yy48 = 0;}
148073147997
break;
148074
- case 127: /* orderby_opt ::= ORDER BY sortlist */
148075
- case 134: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==134);
147998
+ case 128: /* orderby_opt ::= ORDER BY sortlist */
147999
+ case 135: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==135);
148076148000
{yymsp[-2].minor.yy420 = yymsp[0].minor.yy420;}
148077148001
break;
148078
- case 128: /* sortlist ::= sortlist COMMA expr sortorder */
148002
+ case 129: /* sortlist ::= sortlist COMMA expr sortorder */
148079148003
{
148080148004
yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy420,yymsp[-1].minor.yy18);
148081148005
sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy420,yymsp[0].minor.yy70);
148082148006
}
148083148007
break;
148084
- case 129: /* sortlist ::= expr sortorder */
148008
+ case 130: /* sortlist ::= expr sortorder */
148085148009
{
148086148010
yymsp[-1].minor.yy420 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy18); /*A-overwrites-Y*/
148087148011
sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy420,yymsp[0].minor.yy70);
148088148012
}
148089148013
break;
148090
- case 130: /* sortorder ::= ASC */
148014
+ case 131: /* sortorder ::= ASC */
148091148015
{yymsp[0].minor.yy70 = SQLITE_SO_ASC;}
148092148016
break;
148093
- case 131: /* sortorder ::= DESC */
148017
+ case 132: /* sortorder ::= DESC */
148094148018
{yymsp[0].minor.yy70 = SQLITE_SO_DESC;}
148095148019
break;
148096
- case 132: /* sortorder ::= */
148020
+ case 133: /* sortorder ::= */
148097148021
{yymsp[1].minor.yy70 = SQLITE_SO_UNDEFINED;}
148098148022
break;
148099
- case 138: /* limit_opt ::= LIMIT expr */
148023
+ case 139: /* limit_opt ::= LIMIT expr */
148100148024
{yymsp[-1].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy18,0);}
148101148025
break;
148102
- case 139: /* limit_opt ::= LIMIT expr OFFSET expr */
148026
+ case 140: /* limit_opt ::= LIMIT expr OFFSET expr */
148103148027
{yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);}
148104148028
break;
148105
- case 140: /* limit_opt ::= LIMIT expr COMMA expr */
148029
+ case 141: /* limit_opt ::= LIMIT expr COMMA expr */
148106148030
{yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy18,yymsp[-2].minor.yy18);}
148107148031
break;
148108
- case 141: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
148032
+ case 142: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
148109148033
{
148110148034
sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy135, &yymsp[-1].minor.yy0);
148111148035
sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy135,yymsp[0].minor.yy18,0,0);
148112148036
}
148113148037
break;
148114
- case 144: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
148038
+ case 145: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
148115148039
{
148116148040
sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy135, &yymsp[-3].minor.yy0);
148117148041
sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy420,"set list");
148118148042
sqlite3Update(pParse,yymsp[-4].minor.yy135,yymsp[-1].minor.yy420,yymsp[0].minor.yy18,yymsp[-5].minor.yy70,0,0,0);
148119148043
}
148120148044
break;
148121
- case 145: /* setlist ::= setlist COMMA nm EQ expr */
148045
+ case 146: /* setlist ::= setlist COMMA nm EQ expr */
148122148046
{
148123148047
yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy420, yymsp[0].minor.yy18);
148124148048
sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy420, &yymsp[-2].minor.yy0, 1);
148125148049
}
148126148050
break;
148127
- case 146: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
148051
+ case 147: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
148128148052
{
148129148053
yymsp[-6].minor.yy420 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy420, yymsp[-3].minor.yy48, yymsp[0].minor.yy18);
148130148054
}
148131148055
break;
148132
- case 147: /* setlist ::= nm EQ expr */
148056
+ case 148: /* setlist ::= nm EQ expr */
148133148057
{
148134148058
yylhsminor.yy420 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy18);
148135148059
sqlite3ExprListSetName(pParse, yylhsminor.yy420, &yymsp[-2].minor.yy0, 1);
148136148060
}
148137148061
yymsp[-2].minor.yy420 = yylhsminor.yy420;
148138148062
break;
148139
- case 148: /* setlist ::= LP idlist RP EQ expr */
148063
+ case 149: /* setlist ::= LP idlist RP EQ expr */
148140148064
{
148141148065
yymsp[-4].minor.yy420 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy48, yymsp[0].minor.yy18);
148142148066
}
148143148067
break;
148144
- case 149: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
148068
+ case 150: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
148145148069
{
148146148070
sqlite3Insert(pParse, yymsp[-3].minor.yy135, yymsp[-1].minor.yy489, yymsp[-2].minor.yy48, yymsp[-5].minor.yy70, yymsp[0].minor.yy340);
148147148071
}
148148148072
break;
148149
- case 150: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
148073
+ case 151: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
148150148074
{
148151148075
sqlite3Insert(pParse, yymsp[-3].minor.yy135, 0, yymsp[-2].minor.yy48, yymsp[-5].minor.yy70, 0);
148152148076
}
148153148077
break;
148154
- case 151: /* upsert ::= */
148078
+ case 152: /* upsert ::= */
148155148079
{ yymsp[1].minor.yy340 = 0; }
148156148080
break;
148157
- case 152: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
148081
+ case 153: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
148158148082
{ yymsp[-10].minor.yy340 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy420,yymsp[-5].minor.yy18,yymsp[-1].minor.yy420,yymsp[0].minor.yy18);}
148159148083
break;
148160
- case 153: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
148084
+ case 154: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
148161148085
{ yymsp[-7].minor.yy340 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy420,yymsp[-2].minor.yy18,0,0); }
148162148086
break;
148163
- case 154: /* upsert ::= ON CONFLICT DO NOTHING */
148087
+ case 155: /* upsert ::= ON CONFLICT DO NOTHING */
148164148088
{ yymsp[-3].minor.yy340 = sqlite3UpsertNew(pParse->db,0,0,0,0); }
148165148089
break;
148166
- case 158: /* idlist_opt ::= LP idlist RP */
148090
+ case 159: /* idlist_opt ::= LP idlist RP */
148167148091
{yymsp[-2].minor.yy48 = yymsp[-1].minor.yy48;}
148168148092
break;
148169
- case 159: /* idlist ::= idlist COMMA nm */
148093
+ case 160: /* idlist ::= idlist COMMA nm */
148170148094
{yymsp[-2].minor.yy48 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy48,&yymsp[0].minor.yy0);}
148171148095
break;
148172
- case 160: /* idlist ::= nm */
148096
+ case 161: /* idlist ::= nm */
148173148097
{yymsp[0].minor.yy48 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
148174148098
break;
148175
- case 161: /* expr ::= LP expr RP */
148099
+ case 162: /* expr ::= LP expr RP */
148176148100
{yymsp[-2].minor.yy18 = yymsp[-1].minor.yy18;}
148177148101
break;
148178
- case 162: /* expr ::= ID|INDEXED */
148179
- case 163: /* expr ::= JOIN_KW */ yytestcase(yyruleno==163);
148102
+ case 163: /* expr ::= ID|INDEXED */
148103
+ case 164: /* expr ::= JOIN_KW */ yytestcase(yyruleno==164);
148180148104
{yymsp[0].minor.yy18=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
148181148105
break;
148182
- case 164: /* expr ::= nm DOT nm */
148106
+ case 165: /* expr ::= nm DOT nm */
148183148107
{
148184148108
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
148185148109
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
148186148110
yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
148187148111
}
148188148112
yymsp[-2].minor.yy18 = yylhsminor.yy18;
148189148113
break;
148190
- case 165: /* expr ::= nm DOT nm DOT nm */
148114
+ case 166: /* expr ::= nm DOT nm DOT nm */
148191148115
{
148192148116
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
148193148117
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
148194148118
Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
148195148119
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
148196148120
yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
148197148121
}
148198148122
yymsp[-4].minor.yy18 = yylhsminor.yy18;
148199148123
break;
148200
- case 166: /* term ::= NULL|FLOAT|BLOB */
148201
- case 167: /* term ::= STRING */ yytestcase(yyruleno==167);
148124
+ case 167: /* term ::= NULL|FLOAT|BLOB */
148125
+ case 168: /* term ::= STRING */ yytestcase(yyruleno==168);
148202148126
{yymsp[0].minor.yy18=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
148203148127
break;
148204
- case 168: /* term ::= INTEGER */
148128
+ case 169: /* term ::= INTEGER */
148205148129
{
148206148130
yylhsminor.yy18 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
148207148131
}
148208148132
yymsp[0].minor.yy18 = yylhsminor.yy18;
148209148133
break;
148210
- case 169: /* expr ::= VARIABLE */
148134
+ case 170: /* expr ::= VARIABLE */
148211148135
{
148212148136
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
148213148137
u32 n = yymsp[0].minor.yy0.n;
148214148138
yymsp[0].minor.yy18 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
148215148139
sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy18, n);
@@ -148227,48 +148151,54 @@
148227148151
if( yymsp[0].minor.yy18 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy18->iTable);
148228148152
}
148229148153
}
148230148154
}
148231148155
break;
148232
- case 170: /* expr ::= expr COLLATE ID|STRING */
148156
+ case 171: /* expr ::= expr COLLATE ID|STRING */
148233148157
{
148234148158
yymsp[-2].minor.yy18 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy18, &yymsp[0].minor.yy0, 1);
148235148159
}
148236148160
break;
148237
- case 171: /* expr ::= CAST LP expr AS typetoken RP */
148161
+ case 172: /* expr ::= CAST LP expr AS typetoken RP */
148238148162
{
148239148163
yymsp[-5].minor.yy18 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
148240148164
sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy18, yymsp[-3].minor.yy18, 0);
148241148165
}
148242148166
break;
148243
- case 172: /* expr ::= ID|INDEXED LP distinct exprlist RP over_opt */
148244
-{
148245
- if( yymsp[-2].minor.yy420 && yymsp[-2].minor.yy420->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
148246
- sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-5].minor.yy0);
148247
- }
148248
- yylhsminor.yy18 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy420, &yymsp[-5].minor.yy0);
148249
- if( yymsp[-3].minor.yy70==SF_Distinct && yylhsminor.yy18 ){
148250
- yylhsminor.yy18->flags |= EP_Distinct;
148251
- }
148167
+ case 173: /* expr ::= ID|INDEXED LP distinct exprlist RP */
148168
+{
148169
+ yylhsminor.yy18 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy420, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy70);
148170
+}
148171
+ yymsp[-4].minor.yy18 = yylhsminor.yy18;
148172
+ break;
148173
+ case 174: /* expr ::= ID|INDEXED LP STAR RP */
148174
+{
148175
+ yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
148176
+}
148177
+ yymsp[-3].minor.yy18 = yylhsminor.yy18;
148178
+ break;
148179
+ case 175: /* expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
148180
+{
148181
+ yylhsminor.yy18 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy420, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy70);
148252148182
sqlite3WindowAttach(pParse, yylhsminor.yy18, yymsp[0].minor.yy327);
148253148183
}
148254148184
yymsp[-5].minor.yy18 = yylhsminor.yy18;
148255148185
break;
148256
- case 173: /* expr ::= ID|INDEXED LP STAR RP over_opt */
148186
+ case 176: /* expr ::= ID|INDEXED LP STAR RP over_clause */
148257148187
{
148258
- yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0);
148188
+ yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
148259148189
sqlite3WindowAttach(pParse, yylhsminor.yy18, yymsp[0].minor.yy327);
148260148190
}
148261148191
yymsp[-4].minor.yy18 = yylhsminor.yy18;
148262148192
break;
148263
- case 174: /* term ::= CTIME_KW */
148193
+ case 177: /* term ::= CTIME_KW */
148264148194
{
148265
- yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
148195
+ yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
148266148196
}
148267148197
yymsp[0].minor.yy18 = yylhsminor.yy18;
148268148198
break;
148269
- case 175: /* expr ::= LP nexprlist COMMA expr RP */
148199
+ case 178: /* expr ::= LP nexprlist COMMA expr RP */
148270148200
{
148271148201
ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy420, yymsp[-1].minor.yy18);
148272148202
yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
148273148203
if( yymsp[-4].minor.yy18 ){
148274148204
yymsp[-4].minor.yy18->x.pList = pList;
@@ -148275,81 +148205,81 @@
148275148205
}else{
148276148206
sqlite3ExprListDelete(pParse->db, pList);
148277148207
}
148278148208
}
148279148209
break;
148280
- case 176: /* expr ::= expr AND expr */
148281
- case 177: /* expr ::= expr OR expr */ yytestcase(yyruleno==177);
148282
- case 178: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==178);
148283
- case 179: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==179);
148284
- case 180: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==180);
148285
- case 181: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==181);
148286
- case 182: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==182);
148287
- case 183: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==183);
148210
+ case 179: /* expr ::= expr AND expr */
148211
+ case 180: /* expr ::= expr OR expr */ yytestcase(yyruleno==180);
148212
+ case 181: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==181);
148213
+ case 182: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==182);
148214
+ case 183: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==183);
148215
+ case 184: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==184);
148216
+ case 185: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==185);
148217
+ case 186: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==186);
148288148218
{yymsp[-2].minor.yy18=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);}
148289148219
break;
148290
- case 184: /* likeop ::= NOT LIKE_KW|MATCH */
148220
+ case 187: /* likeop ::= NOT LIKE_KW|MATCH */
148291148221
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
148292148222
break;
148293
- case 185: /* expr ::= expr likeop expr */
148223
+ case 188: /* expr ::= expr likeop expr */
148294148224
{
148295148225
ExprList *pList;
148296148226
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
148297148227
yymsp[-1].minor.yy0.n &= 0x7fffffff;
148298148228
pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy18);
148299148229
pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy18);
148300
- yymsp[-2].minor.yy18 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0);
148230
+ yymsp[-2].minor.yy18 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
148301148231
if( bNot ) yymsp[-2].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy18, 0);
148302148232
if( yymsp[-2].minor.yy18 ) yymsp[-2].minor.yy18->flags |= EP_InfixFunc;
148303148233
}
148304148234
break;
148305
- case 186: /* expr ::= expr likeop expr ESCAPE expr */
148235
+ case 189: /* expr ::= expr likeop expr ESCAPE expr */
148306148236
{
148307148237
ExprList *pList;
148308148238
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
148309148239
yymsp[-3].minor.yy0.n &= 0x7fffffff;
148310148240
pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18);
148311148241
pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy18);
148312148242
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy18);
148313
- yymsp[-4].minor.yy18 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0);
148243
+ yymsp[-4].minor.yy18 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
148314148244
if( bNot ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148315148245
if( yymsp[-4].minor.yy18 ) yymsp[-4].minor.yy18->flags |= EP_InfixFunc;
148316148246
}
148317148247
break;
148318
- case 187: /* expr ::= expr ISNULL|NOTNULL */
148248
+ case 190: /* expr ::= expr ISNULL|NOTNULL */
148319148249
{yymsp[-1].minor.yy18 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy18,0);}
148320148250
break;
148321
- case 188: /* expr ::= expr NOT NULL */
148251
+ case 191: /* expr ::= expr NOT NULL */
148322148252
{yymsp[-2].minor.yy18 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy18,0);}
148323148253
break;
148324
- case 189: /* expr ::= expr IS expr */
148254
+ case 192: /* expr ::= expr IS expr */
148325148255
{
148326148256
yymsp[-2].minor.yy18 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);
148327148257
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy18, yymsp[-2].minor.yy18, TK_ISNULL);
148328148258
}
148329148259
break;
148330
- case 190: /* expr ::= expr IS NOT expr */
148260
+ case 193: /* expr ::= expr IS NOT expr */
148331148261
{
148332148262
yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy18,yymsp[0].minor.yy18);
148333148263
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy18, yymsp[-3].minor.yy18, TK_NOTNULL);
148334148264
}
148335148265
break;
148336
- case 191: /* expr ::= NOT expr */
148337
- case 192: /* expr ::= BITNOT expr */ yytestcase(yyruleno==192);
148266
+ case 194: /* expr ::= NOT expr */
148267
+ case 195: /* expr ::= BITNOT expr */ yytestcase(yyruleno==195);
148338148268
{yymsp[-1].minor.yy18 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy18, 0);/*A-overwrites-B*/}
148339148269
break;
148340
- case 193: /* expr ::= PLUS|MINUS expr */
148270
+ case 196: /* expr ::= PLUS|MINUS expr */
148341148271
{
148342148272
yymsp[-1].minor.yy18 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy18, 0);
148343148273
/*A-overwrites-B*/
148344148274
}
148345148275
break;
148346
- case 194: /* between_op ::= BETWEEN */
148347
- case 197: /* in_op ::= IN */ yytestcase(yyruleno==197);
148276
+ case 197: /* between_op ::= BETWEEN */
148277
+ case 200: /* in_op ::= IN */ yytestcase(yyruleno==200);
148348148278
{yymsp[0].minor.yy70 = 0;}
148349148279
break;
148350
- case 196: /* expr ::= expr between_op expr AND expr */
148280
+ case 199: /* expr ::= expr between_op expr AND expr */
148351148281
{
148352148282
ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18);
148353148283
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy18);
148354148284
yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy18, 0);
148355148285
if( yymsp[-4].minor.yy18 ){
@@ -148358,11 +148288,11 @@
148358148288
sqlite3ExprListDelete(pParse->db, pList);
148359148289
}
148360148290
if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148361148291
}
148362148292
break;
148363
- case 199: /* expr ::= expr in_op LP exprlist RP */
148293
+ case 202: /* expr ::= expr in_op LP exprlist RP */
148364148294
{
148365148295
if( yymsp[-1].minor.yy420==0 ){
148366148296
/* Expressions of the form
148367148297
**
148368148298
** expr1 IN ()
@@ -148410,41 +148340,41 @@
148410148340
}
148411148341
if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148412148342
}
148413148343
}
148414148344
break;
148415
- case 200: /* expr ::= LP select RP */
148345
+ case 203: /* expr ::= LP select RP */
148416148346
{
148417148347
yymsp[-2].minor.yy18 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
148418148348
sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy18, yymsp[-1].minor.yy489);
148419148349
}
148420148350
break;
148421
- case 201: /* expr ::= expr in_op LP select RP */
148351
+ case 204: /* expr ::= expr in_op LP select RP */
148422148352
{
148423148353
yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy18, 0);
148424148354
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy18, yymsp[-1].minor.yy489);
148425148355
if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148426148356
}
148427148357
break;
148428
- case 202: /* expr ::= expr in_op nm dbnm paren_exprlist */
148358
+ case 205: /* expr ::= expr in_op nm dbnm paren_exprlist */
148429148359
{
148430148360
SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
148431148361
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
148432148362
if( yymsp[0].minor.yy420 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy420);
148433148363
yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy18, 0);
148434148364
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy18, pSelect);
148435148365
if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148436148366
}
148437148367
break;
148438
- case 203: /* expr ::= EXISTS LP select RP */
148368
+ case 206: /* expr ::= EXISTS LP select RP */
148439148369
{
148440148370
Expr *p;
148441148371
p = yymsp[-3].minor.yy18 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
148442148372
sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy489);
148443148373
}
148444148374
break;
148445
- case 204: /* expr ::= CASE case_operand case_exprlist case_else END */
148375
+ case 207: /* expr ::= CASE case_operand case_exprlist case_else END */
148446148376
{
148447148377
yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy18, 0);
148448148378
if( yymsp[-4].minor.yy18 ){
148449148379
yymsp[-4].minor.yy18->x.pList = yymsp[-1].minor.yy18 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy420,yymsp[-1].minor.yy18) : yymsp[-2].minor.yy420;
148450148380
sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy18);
@@ -148452,369 +148382,365 @@
148452148382
sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy420);
148453148383
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy18);
148454148384
}
148455148385
}
148456148386
break;
148457
- case 205: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
148387
+ case 208: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
148458148388
{
148459148389
yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, yymsp[-2].minor.yy18);
148460148390
yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, yymsp[0].minor.yy18);
148461148391
}
148462148392
break;
148463
- case 206: /* case_exprlist ::= WHEN expr THEN expr */
148393
+ case 209: /* case_exprlist ::= WHEN expr THEN expr */
148464148394
{
148465148395
yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18);
148466148396
yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy420, yymsp[0].minor.yy18);
148467148397
}
148468148398
break;
148469
- case 209: /* case_operand ::= expr */
148399
+ case 212: /* case_operand ::= expr */
148470148400
{yymsp[0].minor.yy18 = yymsp[0].minor.yy18; /*A-overwrites-X*/}
148471148401
break;
148472
- case 212: /* nexprlist ::= nexprlist COMMA expr */
148402
+ case 215: /* nexprlist ::= nexprlist COMMA expr */
148473148403
{yymsp[-2].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy420,yymsp[0].minor.yy18);}
148474148404
break;
148475
- case 213: /* nexprlist ::= expr */
148405
+ case 216: /* nexprlist ::= expr */
148476148406
{yymsp[0].minor.yy420 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy18); /*A-overwrites-Y*/}
148477148407
break;
148478
- case 215: /* paren_exprlist ::= LP exprlist RP */
148479
- case 220: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==220);
148408
+ case 218: /* paren_exprlist ::= LP exprlist RP */
148409
+ case 223: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==223);
148480148410
{yymsp[-2].minor.yy420 = yymsp[-1].minor.yy420;}
148481148411
break;
148482
- case 216: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
148412
+ case 219: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
148483148413
{
148484148414
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
148485148415
sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy420, yymsp[-10].minor.yy70,
148486148416
&yymsp[-11].minor.yy0, yymsp[0].minor.yy18, SQLITE_SO_ASC, yymsp[-8].minor.yy70, SQLITE_IDXTYPE_APPDEF);
148487148417
}
148488148418
break;
148489
- case 217: /* uniqueflag ::= UNIQUE */
148490
- case 257: /* raisetype ::= ABORT */ yytestcase(yyruleno==257);
148419
+ case 220: /* uniqueflag ::= UNIQUE */
148420
+ case 260: /* raisetype ::= ABORT */ yytestcase(yyruleno==260);
148491148421
{yymsp[0].minor.yy70 = OE_Abort;}
148492148422
break;
148493
- case 218: /* uniqueflag ::= */
148423
+ case 221: /* uniqueflag ::= */
148494148424
{yymsp[1].minor.yy70 = OE_None;}
148495148425
break;
148496
- case 221: /* eidlist ::= eidlist COMMA nm collate sortorder */
148426
+ case 224: /* eidlist ::= eidlist COMMA nm collate sortorder */
148497148427
{
148498148428
yymsp[-4].minor.yy420 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy420, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy70, yymsp[0].minor.yy70);
148499148429
}
148500148430
break;
148501
- case 222: /* eidlist ::= nm collate sortorder */
148431
+ case 225: /* eidlist ::= nm collate sortorder */
148502148432
{
148503148433
yymsp[-2].minor.yy420 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy70, yymsp[0].minor.yy70); /*A-overwrites-Y*/
148504148434
}
148505148435
break;
148506
- case 225: /* cmd ::= DROP INDEX ifexists fullname */
148436
+ case 228: /* cmd ::= DROP INDEX ifexists fullname */
148507148437
{sqlite3DropIndex(pParse, yymsp[0].minor.yy135, yymsp[-1].minor.yy70);}
148508148438
break;
148509
- case 226: /* cmd ::= VACUUM */
148439
+ case 229: /* cmd ::= VACUUM */
148510148440
{sqlite3Vacuum(pParse,0);}
148511148441
break;
148512
- case 227: /* cmd ::= VACUUM nm */
148442
+ case 230: /* cmd ::= VACUUM nm */
148513148443
{sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
148514148444
break;
148515
- case 228: /* cmd ::= PRAGMA nm dbnm */
148445
+ case 231: /* cmd ::= PRAGMA nm dbnm */
148516148446
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
148517148447
break;
148518
- case 229: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
148448
+ case 232: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
148519148449
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
148520148450
break;
148521
- case 230: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
148451
+ case 233: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
148522148452
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
148523148453
break;
148524
- case 231: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
148454
+ case 234: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
148525148455
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
148526148456
break;
148527
- case 232: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
148457
+ case 235: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
148528148458
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
148529148459
break;
148530
- case 235: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
148460
+ case 238: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
148531148461
{
148532148462
Token all;
148533148463
all.z = yymsp[-3].minor.yy0.z;
148534148464
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
148535148465
sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy207, &all);
148536148466
}
148537148467
break;
148538
- case 236: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
148468
+ case 239: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
148539148469
{
148540148470
sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy70, yymsp[-4].minor.yy34.a, yymsp[-4].minor.yy34.b, yymsp[-2].minor.yy135, yymsp[0].minor.yy18, yymsp[-10].minor.yy70, yymsp[-8].minor.yy70);
148541148471
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
148542148472
}
148543148473
break;
148544
- case 237: /* trigger_time ::= BEFORE|AFTER */
148474
+ case 240: /* trigger_time ::= BEFORE|AFTER */
148545148475
{ yymsp[0].minor.yy70 = yymsp[0].major; /*A-overwrites-X*/ }
148546148476
break;
148547
- case 238: /* trigger_time ::= INSTEAD OF */
148477
+ case 241: /* trigger_time ::= INSTEAD OF */
148548148478
{ yymsp[-1].minor.yy70 = TK_INSTEAD;}
148549148479
break;
148550
- case 239: /* trigger_time ::= */
148480
+ case 242: /* trigger_time ::= */
148551148481
{ yymsp[1].minor.yy70 = TK_BEFORE; }
148552148482
break;
148553
- case 240: /* trigger_event ::= DELETE|INSERT */
148554
- case 241: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==241);
148483
+ case 243: /* trigger_event ::= DELETE|INSERT */
148484
+ case 244: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==244);
148555148485
{yymsp[0].minor.yy34.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy34.b = 0;}
148556148486
break;
148557
- case 242: /* trigger_event ::= UPDATE OF idlist */
148487
+ case 245: /* trigger_event ::= UPDATE OF idlist */
148558148488
{yymsp[-2].minor.yy34.a = TK_UPDATE; yymsp[-2].minor.yy34.b = yymsp[0].minor.yy48;}
148559148489
break;
148560
- case 243: /* when_clause ::= */
148561
- case 262: /* key_opt ::= */ yytestcase(yyruleno==262);
148562
- case 305: /* filter_opt ::= */ yytestcase(yyruleno==305);
148490
+ case 246: /* when_clause ::= */
148491
+ case 265: /* key_opt ::= */ yytestcase(yyruleno==265);
148492
+ case 306: /* filter_opt ::= */ yytestcase(yyruleno==306);
148563148493
{ yymsp[1].minor.yy18 = 0; }
148564148494
break;
148565
- case 244: /* when_clause ::= WHEN expr */
148566
- case 263: /* key_opt ::= KEY expr */ yytestcase(yyruleno==263);
148495
+ case 247: /* when_clause ::= WHEN expr */
148496
+ case 266: /* key_opt ::= KEY expr */ yytestcase(yyruleno==266);
148567148497
{ yymsp[-1].minor.yy18 = yymsp[0].minor.yy18; }
148568148498
break;
148569
- case 245: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
148499
+ case 248: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
148570148500
{
148571148501
assert( yymsp[-2].minor.yy207!=0 );
148572148502
yymsp[-2].minor.yy207->pLast->pNext = yymsp[-1].minor.yy207;
148573148503
yymsp[-2].minor.yy207->pLast = yymsp[-1].minor.yy207;
148574148504
}
148575148505
break;
148576
- case 246: /* trigger_cmd_list ::= trigger_cmd SEMI */
148506
+ case 249: /* trigger_cmd_list ::= trigger_cmd SEMI */
148577148507
{
148578148508
assert( yymsp[-1].minor.yy207!=0 );
148579148509
yymsp[-1].minor.yy207->pLast = yymsp[-1].minor.yy207;
148580148510
}
148581148511
break;
148582
- case 247: /* trnm ::= nm DOT nm */
148512
+ case 250: /* trnm ::= nm DOT nm */
148583148513
{
148584148514
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
148585148515
sqlite3ErrorMsg(pParse,
148586148516
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
148587148517
"statements within triggers");
148588148518
}
148589148519
break;
148590
- case 248: /* tridxby ::= INDEXED BY nm */
148520
+ case 251: /* tridxby ::= INDEXED BY nm */
148591148521
{
148592148522
sqlite3ErrorMsg(pParse,
148593148523
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
148594148524
"within triggers");
148595148525
}
148596148526
break;
148597
- case 249: /* tridxby ::= NOT INDEXED */
148527
+ case 252: /* tridxby ::= NOT INDEXED */
148598148528
{
148599148529
sqlite3ErrorMsg(pParse,
148600148530
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
148601148531
"within triggers");
148602148532
}
148603148533
break;
148604
- case 250: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
148534
+ case 253: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
148605148535
{yylhsminor.yy207 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy420, yymsp[-1].minor.yy18, yymsp[-6].minor.yy70, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy392);}
148606148536
yymsp[-7].minor.yy207 = yylhsminor.yy207;
148607148537
break;
148608
- case 251: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
148538
+ case 254: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
148609148539
{
148610148540
yylhsminor.yy207 = sqlite3TriggerInsertStep(pParse->db,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy48,yymsp[-2].minor.yy489,yymsp[-6].minor.yy70,yymsp[-1].minor.yy340,yymsp[-7].minor.yy392,yymsp[0].minor.yy392);/*yylhsminor.yy207-overwrites-yymsp[-6].minor.yy70*/
148611148541
}
148612148542
yymsp[-7].minor.yy207 = yylhsminor.yy207;
148613148543
break;
148614
- case 252: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
148544
+ case 255: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
148615148545
{yylhsminor.yy207 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy18, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy392);}
148616148546
yymsp[-5].minor.yy207 = yylhsminor.yy207;
148617148547
break;
148618
- case 253: /* trigger_cmd ::= scanpt select scanpt */
148548
+ case 256: /* trigger_cmd ::= scanpt select scanpt */
148619148549
{yylhsminor.yy207 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy489, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); /*yylhsminor.yy207-overwrites-yymsp[-1].minor.yy489*/}
148620148550
yymsp[-2].minor.yy207 = yylhsminor.yy207;
148621148551
break;
148622
- case 254: /* expr ::= RAISE LP IGNORE RP */
148552
+ case 257: /* expr ::= RAISE LP IGNORE RP */
148623148553
{
148624148554
yymsp[-3].minor.yy18 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
148625148555
if( yymsp[-3].minor.yy18 ){
148626148556
yymsp[-3].minor.yy18->affinity = OE_Ignore;
148627148557
}
148628148558
}
148629148559
break;
148630
- case 255: /* expr ::= RAISE LP raisetype COMMA nm RP */
148560
+ case 258: /* expr ::= RAISE LP raisetype COMMA nm RP */
148631148561
{
148632148562
yymsp[-5].minor.yy18 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
148633148563
if( yymsp[-5].minor.yy18 ) {
148634148564
yymsp[-5].minor.yy18->affinity = (char)yymsp[-3].minor.yy70;
148635148565
}
148636148566
}
148637148567
break;
148638
- case 256: /* raisetype ::= ROLLBACK */
148568
+ case 259: /* raisetype ::= ROLLBACK */
148639148569
{yymsp[0].minor.yy70 = OE_Rollback;}
148640148570
break;
148641
- case 258: /* raisetype ::= FAIL */
148571
+ case 261: /* raisetype ::= FAIL */
148642148572
{yymsp[0].minor.yy70 = OE_Fail;}
148643148573
break;
148644
- case 259: /* cmd ::= DROP TRIGGER ifexists fullname */
148574
+ case 262: /* cmd ::= DROP TRIGGER ifexists fullname */
148645148575
{
148646148576
sqlite3DropTrigger(pParse,yymsp[0].minor.yy135,yymsp[-1].minor.yy70);
148647148577
}
148648148578
break;
148649
- case 260: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
148579
+ case 263: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
148650148580
{
148651148581
sqlite3Attach(pParse, yymsp[-3].minor.yy18, yymsp[-1].minor.yy18, yymsp[0].minor.yy18);
148652148582
}
148653148583
break;
148654
- case 261: /* cmd ::= DETACH database_kw_opt expr */
148584
+ case 264: /* cmd ::= DETACH database_kw_opt expr */
148655148585
{
148656148586
sqlite3Detach(pParse, yymsp[0].minor.yy18);
148657148587
}
148658148588
break;
148659
- case 264: /* cmd ::= REINDEX */
148589
+ case 267: /* cmd ::= REINDEX */
148660148590
{sqlite3Reindex(pParse, 0, 0);}
148661148591
break;
148662
- case 265: /* cmd ::= REINDEX nm dbnm */
148592
+ case 268: /* cmd ::= REINDEX nm dbnm */
148663148593
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
148664148594
break;
148665
- case 266: /* cmd ::= ANALYZE */
148595
+ case 269: /* cmd ::= ANALYZE */
148666148596
{sqlite3Analyze(pParse, 0, 0);}
148667148597
break;
148668
- case 267: /* cmd ::= ANALYZE nm dbnm */
148598
+ case 270: /* cmd ::= ANALYZE nm dbnm */
148669148599
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
148670148600
break;
148671
- case 268: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
148601
+ case 271: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
148672148602
{
148673148603
sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy135,&yymsp[0].minor.yy0);
148674148604
}
148675148605
break;
148676
- case 269: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
148606
+ case 272: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
148677148607
{
148678148608
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
148679148609
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
148680148610
}
148681148611
break;
148682
- case 270: /* add_column_fullname ::= fullname */
148612
+ case 273: /* add_column_fullname ::= fullname */
148683148613
{
148684148614
disableLookaside(pParse);
148685148615
sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy135);
148686148616
}
148687148617
break;
148688
- case 271: /* cmd ::= create_vtab */
148618
+ case 274: /* cmd ::= create_vtab */
148689148619
{sqlite3VtabFinishParse(pParse,0);}
148690148620
break;
148691
- case 272: /* cmd ::= create_vtab LP vtabarglist RP */
148621
+ case 275: /* cmd ::= create_vtab LP vtabarglist RP */
148692148622
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
148693148623
break;
148694
- case 273: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
148624
+ case 276: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
148695148625
{
148696148626
sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy70);
148697148627
}
148698148628
break;
148699
- case 274: /* vtabarg ::= */
148629
+ case 277: /* vtabarg ::= */
148700148630
{sqlite3VtabArgInit(pParse);}
148701148631
break;
148702
- case 275: /* vtabargtoken ::= ANY */
148703
- case 276: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==276);
148704
- case 277: /* lp ::= LP */ yytestcase(yyruleno==277);
148632
+ case 278: /* vtabargtoken ::= ANY */
148633
+ case 279: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==279);
148634
+ case 280: /* lp ::= LP */ yytestcase(yyruleno==280);
148705148635
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
148706148636
break;
148707
- case 278: /* with ::= WITH wqlist */
148708
- case 279: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==279);
148637
+ case 281: /* with ::= WITH wqlist */
148638
+ case 282: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==282);
148709148639
{ sqlite3WithPush(pParse, yymsp[0].minor.yy449, 1); }
148710148640
break;
148711
- case 280: /* wqlist ::= nm eidlist_opt AS LP select RP */
148641
+ case 283: /* wqlist ::= nm eidlist_opt AS LP select RP */
148712148642
{
148713148643
yymsp[-5].minor.yy449 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489); /*A-overwrites-X*/
148714148644
}
148715148645
break;
148716
- case 281: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
148646
+ case 284: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
148717148647
{
148718148648
yymsp[-7].minor.yy449 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy449, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489);
148719148649
}
148720148650
break;
148721
- case 282: /* windowdefn_list ::= windowdefn */
148651
+ case 285: /* windowdefn_list ::= windowdefn */
148722148652
{ yylhsminor.yy327 = yymsp[0].minor.yy327; }
148723148653
yymsp[0].minor.yy327 = yylhsminor.yy327;
148724148654
break;
148725
- case 283: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
148655
+ case 286: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
148726148656
{
148727148657
assert( yymsp[0].minor.yy327!=0 );
148728148658
yymsp[0].minor.yy327->pNextWin = yymsp[-2].minor.yy327;
148729148659
yylhsminor.yy327 = yymsp[0].minor.yy327;
148730148660
}
148731148661
yymsp[-2].minor.yy327 = yylhsminor.yy327;
148732148662
break;
148733
- case 284: /* windowdefn ::= nm AS window */
148663
+ case 287: /* windowdefn ::= nm AS window */
148734148664
{
148735148665
if( ALWAYS(yymsp[0].minor.yy327) ){
148736148666
yymsp[0].minor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[-2].minor.yy0.z, yymsp[-2].minor.yy0.n);
148737148667
}
148738148668
yylhsminor.yy327 = yymsp[0].minor.yy327;
148739148669
}
148740148670
yymsp[-2].minor.yy327 = yylhsminor.yy327;
148741148671
break;
148742
- case 285: /* window ::= LP part_opt orderby_opt frame_opt RP */
148672
+ case 288: /* window ::= LP part_opt orderby_opt frame_opt RP */
148743148673
{
148744148674
yymsp[-4].minor.yy327 = yymsp[-1].minor.yy327;
148745148675
if( ALWAYS(yymsp[-4].minor.yy327) ){
148746148676
yymsp[-4].minor.yy327->pPartition = yymsp[-3].minor.yy420;
148747148677
yymsp[-4].minor.yy327->pOrderBy = yymsp[-2].minor.yy420;
148748148678
}
148749148679
}
148750148680
break;
148751
- case 286: /* part_opt ::= PARTITION BY exprlist */
148681
+ case 289: /* part_opt ::= PARTITION BY nexprlist */
148752148682
{ yymsp[-2].minor.yy420 = yymsp[0].minor.yy420; }
148753148683
break;
148754
- case 287: /* part_opt ::= */
148684
+ case 290: /* part_opt ::= */
148755148685
{ yymsp[1].minor.yy420 = 0; }
148756148686
break;
148757
- case 288: /* frame_opt ::= */
148687
+ case 291: /* frame_opt ::= */
148758148688
{
148759148689
yymsp[1].minor.yy327 = sqlite3WindowAlloc(pParse, TK_RANGE, TK_UNBOUNDED, 0, TK_CURRENT, 0);
148760148690
}
148761148691
break;
148762
- case 289: /* frame_opt ::= range_or_rows frame_bound_s */
148692
+ case 292: /* frame_opt ::= range_or_rows frame_bound_s */
148763148693
{
148764148694
yylhsminor.yy327 = sqlite3WindowAlloc(pParse, yymsp[-1].minor.yy70, yymsp[0].minor.yy119.eType, yymsp[0].minor.yy119.pExpr, TK_CURRENT, 0);
148765148695
}
148766148696
yymsp[-1].minor.yy327 = yylhsminor.yy327;
148767148697
break;
148768
- case 290: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */
148698
+ case 293: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */
148769148699
{
148770148700
yylhsminor.yy327 = sqlite3WindowAlloc(pParse, yymsp[-4].minor.yy70, yymsp[-2].minor.yy119.eType, yymsp[-2].minor.yy119.pExpr, yymsp[0].minor.yy119.eType, yymsp[0].minor.yy119.pExpr);
148771148701
}
148772148702
yymsp[-4].minor.yy327 = yylhsminor.yy327;
148773148703
break;
148774
- case 291: /* range_or_rows ::= RANGE */
148704
+ case 294: /* range_or_rows ::= RANGE */
148775148705
{ yymsp[0].minor.yy70 = TK_RANGE; }
148776148706
break;
148777
- case 292: /* range_or_rows ::= ROWS */
148707
+ case 295: /* range_or_rows ::= ROWS */
148778148708
{ yymsp[0].minor.yy70 = TK_ROWS; }
148779148709
break;
148780
- case 293: /* frame_bound_s ::= frame_bound */
148781
- case 295: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==295);
148710
+ case 296: /* frame_bound_s ::= frame_bound */
148711
+ case 298: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==298);
148782148712
{ yylhsminor.yy119 = yymsp[0].minor.yy119; }
148783148713
yymsp[0].minor.yy119 = yylhsminor.yy119;
148784148714
break;
148785
- case 294: /* frame_bound_s ::= UNBOUNDED PRECEDING */
148786
- case 296: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==296);
148715
+ case 297: /* frame_bound_s ::= UNBOUNDED PRECEDING */
148716
+ case 299: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==299);
148787148717
{yymsp[-1].minor.yy119.eType = TK_UNBOUNDED; yymsp[-1].minor.yy119.pExpr = 0;}
148788148718
break;
148789
- case 297: /* frame_bound ::= expr PRECEDING */
148719
+ case 300: /* frame_bound ::= expr PRECEDING */
148790148720
{ yylhsminor.yy119.eType = TK_PRECEDING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; }
148791148721
yymsp[-1].minor.yy119 = yylhsminor.yy119;
148792148722
break;
148793
- case 298: /* frame_bound ::= CURRENT ROW */
148723
+ case 301: /* frame_bound ::= CURRENT ROW */
148794148724
{ yymsp[-1].minor.yy119.eType = TK_CURRENT ; yymsp[-1].minor.yy119.pExpr = 0; }
148795148725
break;
148796
- case 299: /* frame_bound ::= expr FOLLOWING */
148726
+ case 302: /* frame_bound ::= expr FOLLOWING */
148797148727
{ yylhsminor.yy119.eType = TK_FOLLOWING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; }
148798148728
yymsp[-1].minor.yy119 = yylhsminor.yy119;
148799148729
break;
148800
- case 300: /* windowdefn_opt ::= */
148801
- case 302: /* over_opt ::= */ yytestcase(yyruleno==302);
148802
-{ yymsp[1].minor.yy327 = 0; }
148803
- break;
148804
- case 301: /* windowdefn_opt ::= WINDOW windowdefn_list */
148730
+ case 303: /* window_clause ::= WINDOW windowdefn_list */
148805148731
{ yymsp[-1].minor.yy327 = yymsp[0].minor.yy327; }
148806148732
break;
148807
- case 303: /* over_opt ::= filter_opt OVER window */
148733
+ case 304: /* over_clause ::= filter_opt OVER window */
148808148734
{
148809148735
yylhsminor.yy327 = yymsp[0].minor.yy327;
148810148736
assert( yylhsminor.yy327!=0 );
148811148737
yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18;
148812148738
}
148813148739
yymsp[-2].minor.yy327 = yylhsminor.yy327;
148814148740
break;
148815
- case 304: /* over_opt ::= filter_opt OVER nm */
148741
+ case 305: /* over_clause ::= filter_opt OVER nm */
148816148742
{
148817148743
yylhsminor.yy327 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
148818148744
if( yylhsminor.yy327 ){
148819148745
yylhsminor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
148820148746
yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18;
@@ -148822,72 +148748,72 @@
148822148748
sqlite3ExprDelete(pParse->db, yymsp[-2].minor.yy18);
148823148749
}
148824148750
}
148825148751
yymsp[-2].minor.yy327 = yylhsminor.yy327;
148826148752
break;
148827
- case 306: /* filter_opt ::= FILTER LP WHERE expr RP */
148753
+ case 307: /* filter_opt ::= FILTER LP WHERE expr RP */
148828148754
{ yymsp[-4].minor.yy18 = yymsp[-1].minor.yy18; }
148829148755
break;
148830148756
default:
148831
- /* (307) input ::= cmdlist */ yytestcase(yyruleno==307);
148832
- /* (308) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==308);
148833
- /* (309) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=309);
148834
- /* (310) ecmd ::= SEMI */ yytestcase(yyruleno==310);
148835
- /* (311) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==311);
148836
- /* (312) ecmd ::= explain cmdx */ yytestcase(yyruleno==312);
148837
- /* (313) trans_opt ::= */ yytestcase(yyruleno==313);
148838
- /* (314) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==314);
148839
- /* (315) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==315);
148840
- /* (316) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==316);
148841
- /* (317) savepoint_opt ::= */ yytestcase(yyruleno==317);
148842
- /* (318) cmd ::= create_table create_table_args */ yytestcase(yyruleno==318);
148843
- /* (319) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==319);
148844
- /* (320) columnlist ::= columnname carglist */ yytestcase(yyruleno==320);
148845
- /* (321) nm ::= ID|INDEXED */ yytestcase(yyruleno==321);
148846
- /* (322) nm ::= STRING */ yytestcase(yyruleno==322);
148847
- /* (323) nm ::= JOIN_KW */ yytestcase(yyruleno==323);
148848
- /* (324) typetoken ::= typename */ yytestcase(yyruleno==324);
148849
- /* (325) typename ::= ID|STRING */ yytestcase(yyruleno==325);
148850
- /* (326) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=326);
148851
- /* (327) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=327);
148852
- /* (328) carglist ::= carglist ccons */ yytestcase(yyruleno==328);
148853
- /* (329) carglist ::= */ yytestcase(yyruleno==329);
148854
- /* (330) ccons ::= NULL onconf */ yytestcase(yyruleno==330);
148855
- /* (331) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==331);
148856
- /* (332) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==332);
148857
- /* (333) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=333);
148858
- /* (334) tconscomma ::= */ yytestcase(yyruleno==334);
148859
- /* (335) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=335);
148860
- /* (336) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=336);
148861
- /* (337) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=337);
148862
- /* (338) oneselect ::= values */ yytestcase(yyruleno==338);
148863
- /* (339) sclp ::= selcollist COMMA */ yytestcase(yyruleno==339);
148864
- /* (340) as ::= ID|STRING */ yytestcase(yyruleno==340);
148865
- /* (341) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=341);
148866
- /* (342) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==342);
148867
- /* (343) exprlist ::= nexprlist */ yytestcase(yyruleno==343);
148868
- /* (344) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=344);
148869
- /* (345) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=345);
148870
- /* (346) nmnum ::= ON */ yytestcase(yyruleno==346);
148871
- /* (347) nmnum ::= DELETE */ yytestcase(yyruleno==347);
148872
- /* (348) nmnum ::= DEFAULT */ yytestcase(yyruleno==348);
148873
- /* (349) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==349);
148874
- /* (350) foreach_clause ::= */ yytestcase(yyruleno==350);
148875
- /* (351) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==351);
148876
- /* (352) trnm ::= nm */ yytestcase(yyruleno==352);
148877
- /* (353) tridxby ::= */ yytestcase(yyruleno==353);
148878
- /* (354) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==354);
148879
- /* (355) database_kw_opt ::= */ yytestcase(yyruleno==355);
148880
- /* (356) kwcolumn_opt ::= */ yytestcase(yyruleno==356);
148881
- /* (357) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==357);
148882
- /* (358) vtabarglist ::= vtabarg */ yytestcase(yyruleno==358);
148883
- /* (359) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==359);
148884
- /* (360) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==360);
148885
- /* (361) anylist ::= */ yytestcase(yyruleno==361);
148886
- /* (362) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==362);
148887
- /* (363) anylist ::= anylist ANY */ yytestcase(yyruleno==363);
148888
- /* (364) with ::= */ yytestcase(yyruleno==364);
148757
+ /* (308) input ::= cmdlist */ yytestcase(yyruleno==308);
148758
+ /* (309) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==309);
148759
+ /* (310) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=310);
148760
+ /* (311) ecmd ::= SEMI */ yytestcase(yyruleno==311);
148761
+ /* (312) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==312);
148762
+ /* (313) ecmd ::= explain cmdx */ yytestcase(yyruleno==313);
148763
+ /* (314) trans_opt ::= */ yytestcase(yyruleno==314);
148764
+ /* (315) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==315);
148765
+ /* (316) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==316);
148766
+ /* (317) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==317);
148767
+ /* (318) savepoint_opt ::= */ yytestcase(yyruleno==318);
148768
+ /* (319) cmd ::= create_table create_table_args */ yytestcase(yyruleno==319);
148769
+ /* (320) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==320);
148770
+ /* (321) columnlist ::= columnname carglist */ yytestcase(yyruleno==321);
148771
+ /* (322) nm ::= ID|INDEXED */ yytestcase(yyruleno==322);
148772
+ /* (323) nm ::= STRING */ yytestcase(yyruleno==323);
148773
+ /* (324) nm ::= JOIN_KW */ yytestcase(yyruleno==324);
148774
+ /* (325) typetoken ::= typename */ yytestcase(yyruleno==325);
148775
+ /* (326) typename ::= ID|STRING */ yytestcase(yyruleno==326);
148776
+ /* (327) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=327);
148777
+ /* (328) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=328);
148778
+ /* (329) carglist ::= carglist ccons */ yytestcase(yyruleno==329);
148779
+ /* (330) carglist ::= */ yytestcase(yyruleno==330);
148780
+ /* (331) ccons ::= NULL onconf */ yytestcase(yyruleno==331);
148781
+ /* (332) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==332);
148782
+ /* (333) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==333);
148783
+ /* (334) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=334);
148784
+ /* (335) tconscomma ::= */ yytestcase(yyruleno==335);
148785
+ /* (336) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=336);
148786
+ /* (337) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=337);
148787
+ /* (338) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=338);
148788
+ /* (339) oneselect ::= values */ yytestcase(yyruleno==339);
148789
+ /* (340) sclp ::= selcollist COMMA */ yytestcase(yyruleno==340);
148790
+ /* (341) as ::= ID|STRING */ yytestcase(yyruleno==341);
148791
+ /* (342) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=342);
148792
+ /* (343) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==343);
148793
+ /* (344) exprlist ::= nexprlist */ yytestcase(yyruleno==344);
148794
+ /* (345) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=345);
148795
+ /* (346) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=346);
148796
+ /* (347) nmnum ::= ON */ yytestcase(yyruleno==347);
148797
+ /* (348) nmnum ::= DELETE */ yytestcase(yyruleno==348);
148798
+ /* (349) nmnum ::= DEFAULT */ yytestcase(yyruleno==349);
148799
+ /* (350) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==350);
148800
+ /* (351) foreach_clause ::= */ yytestcase(yyruleno==351);
148801
+ /* (352) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==352);
148802
+ /* (353) trnm ::= nm */ yytestcase(yyruleno==353);
148803
+ /* (354) tridxby ::= */ yytestcase(yyruleno==354);
148804
+ /* (355) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==355);
148805
+ /* (356) database_kw_opt ::= */ yytestcase(yyruleno==356);
148806
+ /* (357) kwcolumn_opt ::= */ yytestcase(yyruleno==357);
148807
+ /* (358) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==358);
148808
+ /* (359) vtabarglist ::= vtabarg */ yytestcase(yyruleno==359);
148809
+ /* (360) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==360);
148810
+ /* (361) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==361);
148811
+ /* (362) anylist ::= */ yytestcase(yyruleno==362);
148812
+ /* (363) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==363);
148813
+ /* (364) anylist ::= anylist ANY */ yytestcase(yyruleno==364);
148814
+ /* (365) with ::= */ yytestcase(yyruleno==365);
148889148815
break;
148890148816
/********** End reduce actions ************************************************/
148891148817
};
148892148818
assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
148893148819
yygoto = yyRuleInfo[yyruleno].lhs;
@@ -151538,10 +151464,19 @@
151538151464
rc = nKey1 - nKey2;
151539151465
}
151540151466
}
151541151467
return rc;
151542151468
}
151469
+
151470
+/*
151471
+** Return true if CollSeq is the default built-in BINARY.
151472
+*/
151473
+SQLITE_PRIVATE int sqlite3IsBinary(const CollSeq *p){
151474
+ assert( p==0 || p->xCmp!=binCollFunc || p->pUser!=0
151475
+ || strcmp(p->zName,"BINARY")==0 );
151476
+ return p==0 || (p->xCmp==binCollFunc && p->pUser==0);
151477
+}
151543151478
151544151479
/*
151545151480
** Another built-in collating sequence: NOCASE.
151546151481
**
151547151482
** This collating sequence is intended to be used for "case independent
@@ -151660,11 +151595,11 @@
151660151595
int i;
151661151596
HashElem *p;
151662151597
sqlite3BtreeEnterAll(db);
151663151598
for(i=0; i<db->nDb; i++){
151664151599
Schema *pSchema = db->aDb[i].pSchema;
151665
- if( db->aDb[i].pSchema ){
151600
+ if( pSchema ){
151666151601
for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
151667151602
Table *pTab = (Table *)sqliteHashData(p);
151668151603
if( IsVirtual(pTab) ) sqlite3VtabDisconnect(db, pTab);
151669151604
}
151670151605
}
@@ -154829,15 +154764,33 @@
154829154764
if( db->autoCommit==0 ){
154830154765
int iDb;
154831154766
iDb = sqlite3FindDbName(db, zDb);
154832154767
if( iDb==0 || iDb>1 ){
154833154768
Btree *pBt = db->aDb[iDb].pBt;
154834
- if( 0==sqlite3BtreeIsInReadTrans(pBt) ){
154835
- rc = sqlite3PagerSnapshotOpen(sqlite3BtreePager(pBt), pSnapshot);
154769
+ if( sqlite3BtreeIsInTrans(pBt)==0 ){
154770
+ Pager *pPager = sqlite3BtreePager(pBt);
154771
+ int bUnlock = 0;
154772
+ if( sqlite3BtreeIsInReadTrans(pBt) ){
154773
+ if( db->nVdbeActive==0 ){
154774
+ rc = sqlite3PagerSnapshotCheck(pPager, pSnapshot);
154775
+ if( rc==SQLITE_OK ){
154776
+ bUnlock = 1;
154777
+ rc = sqlite3BtreeCommit(pBt);
154778
+ }
154779
+ }
154780
+ }else{
154781
+ rc = SQLITE_OK;
154782
+ }
154783
+ if( rc==SQLITE_OK ){
154784
+ rc = sqlite3PagerSnapshotOpen(pPager, pSnapshot);
154785
+ }
154836154786
if( rc==SQLITE_OK ){
154837154787
rc = sqlite3BtreeBeginTrans(pBt, 0, 0);
154838
- sqlite3PagerSnapshotOpen(sqlite3BtreePager(pBt), 0);
154788
+ sqlite3PagerSnapshotOpen(pPager, 0);
154789
+ }
154790
+ if( bUnlock ){
154791
+ sqlite3PagerSnapshotUnlock(pPager);
154839154792
}
154840154793
}
154841154794
}
154842154795
}
154843154796
@@ -207692,11 +207645,14 @@
207692207645
int n = 0;
207693207646
int i;
207694207647
for(i=0; i<nChar; i++){
207695207648
if( n>=nByte ) return 0; /* Input contains fewer than nChar chars */
207696207649
if( (unsigned char)p[n++]>=0xc0 ){
207697
- while( (p[n] & 0xc0)==0x80 ) n++;
207650
+ while( (p[n] & 0xc0)==0x80 ){
207651
+ n++;
207652
+ if( n>=nByte ) break;
207653
+ }
207698207654
}
207699207655
}
207700207656
return n;
207701207657
}
207702207658
@@ -211572,11 +211528,11 @@
211572211528
int nArg, /* Number of args */
211573211529
sqlite3_value **apUnused /* Function arguments */
211574211530
){
211575211531
assert( nArg==0 );
211576211532
UNUSED_PARAM2(nArg, apUnused);
211577
- sqlite3_result_text(pCtx, "fts5: 2018-07-24 22:02:12 2bd593332da0aade467e7a4ee89e966aa6302f37540a2c5e23671f98a6cb599c", -1, SQLITE_TRANSIENT);
211533
+ sqlite3_result_text(pCtx, "fts5: 2018-08-16 15:29:40 60045fbf52162f15f2e18a4e392e80fab19bdbce242728b5e62b0894eac49dfd", -1, SQLITE_TRANSIENT);
211578211534
}
211579211535
211580211536
static int fts5Init(sqlite3 *db){
211581211537
static const sqlite3_module fts5Mod = {
211582211538
/* iVersion */ 2,
@@ -216282,12 +216238,12 @@
216282216238
}
216283216239
#endif /* SQLITE_CORE */
216284216240
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
216285216241
216286216242
/************** End of stmt.c ************************************************/
216287
-#if __LINE__!=216287
216243
+#if __LINE__!=216243
216288216244
#undef SQLITE_SOURCE_ID
216289
-#define SQLITE_SOURCE_ID "2018-07-24 22:02:12 2bd593332da0aade467e7a4ee89e966aa6302f37540a2c5e23671f98a6cbalt2"
216245
+#define SQLITE_SOURCE_ID "2018-08-16 16:24:24 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0calt2"
216290216246
#endif
216291216247
/* Return the source-id for this library */
216292216248
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
216293216249
/************************** End of sqlite3.c ******************************/
216294216250
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1156,11 +1156,11 @@
1156 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1157 ** [sqlite_version()] and [sqlite_source_id()].
1158 */
1159 #define SQLITE_VERSION "3.25.0"
1160 #define SQLITE_VERSION_NUMBER 3025000
1161 #define SQLITE_SOURCE_ID "2018-07-24 22:02:12 2bd593332da0aade467e7a4ee89e966aa6302f37540a2c5e23671f98a6cb599c"
1162
1163 /*
1164 ** CAPI3REF: Run-Time Library Version Numbers
1165 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1166 **
@@ -10031,11 +10031,11 @@
10031 ** the following statements are false when sqlite3_snapshot_get() is
10032 ** called, SQLITE_ERROR is returned. The final value of *P is undefined
10033 ** in this case.
10034 **
10035 ** <ul>
10036 ** <li> The database handle must be in [autocommit mode].
10037 **
10038 ** <li> Schema S of [database connection] D must be a [WAL mode] database.
10039 **
10040 ** <li> There must not be a write transaction open on schema S of database
10041 ** connection D.
@@ -10066,26 +10066,37 @@
10066
10067 /*
10068 ** CAPI3REF: Start a read transaction on an historical snapshot
10069 ** METHOD: sqlite3_snapshot
10070 **
10071 ** ^The [sqlite3_snapshot_open(D,S,P)] interface starts a
10072 ** read transaction for schema S of
10073 ** [database connection] D such that the read transaction
10074 ** refers to historical [snapshot] P, rather than the most
10075 ** recent change to the database.
10076 ** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success
10077 ** or an appropriate [error code] if it fails.
10078 **
10079 ** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be
10080 ** the first operation following the [BEGIN] that takes the schema S
10081 ** out of [autocommit mode].
10082 ** ^In other words, schema S must not currently be in
10083 ** a transaction for [sqlite3_snapshot_open(D,S,P)] to work, but the
10084 ** database connection D must be out of [autocommit mode].
10085 ** ^A [snapshot] will fail to open if it has been overwritten by a
10086 ** [checkpoint].
 
 
 
 
 
 
 
 
 
 
 
 
10087 ** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the
10088 ** database connection D does not know that the database file for
10089 ** schema S is in [WAL mode]. A database connection might not know
10090 ** that the database file is in [WAL mode] if there has been no prior
10091 ** I/O on that database connection, or if the database entered [WAL mode]
@@ -13008,21 +13019,10 @@
13008 #endif
13009 #if defined(NDEBUG) && defined(SQLITE_DEBUG)
13010 # undef NDEBUG
13011 #endif
13012
13013 /* SQLITE_DEBUG_COLUMNCACHE is synomous with SQLITE_DEBUG. The
13014 ** SQLITE_DEBUG_COLUMNCACHE symbol only exists to provide a convenient
13015 ** way to search for all code that deals with verifying correct behavior
13016 ** of the column cache.
13017 */
13018 #ifdef SQLITE_DEBUG
13019 # define SQLITE_DEBUG_COLUMNCACHE 1
13020 #else
13021 # undef SQLIT_DEBUG_COLUMNCACHE
13022 #endif
13023
13024 /*
13025 ** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on.
13026 */
13027 #if !defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) && defined(SQLITE_DEBUG)
13028 # define SQLITE_ENABLE_EXPLAIN_COMMENTS 1
@@ -14720,40 +14720,40 @@
14720 #define OP_Ge 57 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
14721 #define OP_ElseNotEq 58 /* jump, same as TK_ESCAPE */
14722 #define OP_IncrVacuum 59 /* jump */
14723 #define OP_VNext 60 /* jump */
14724 #define OP_Init 61 /* jump, synopsis: Start at P2 */
14725 #define OP_Return 62
14726 #define OP_EndCoroutine 63
14727 #define OP_HaltIfNull 64 /* synopsis: if r[P3]=null halt */
14728 #define OP_Halt 65
14729 #define OP_Integer 66 /* synopsis: r[P2]=P1 */
14730 #define OP_Int64 67 /* synopsis: r[P2]=P4 */
14731 #define OP_String 68 /* synopsis: r[P2]='P4' (len=P1) */
14732 #define OP_Null 69 /* synopsis: r[P2..P3]=NULL */
14733 #define OP_SoftNull 70 /* synopsis: r[P1]=NULL */
14734 #define OP_Blob 71 /* synopsis: r[P2]=P4 (len=P1) */
14735 #define OP_Variable 72 /* synopsis: r[P2]=parameter(P1,P4) */
14736 #define OP_Move 73 /* synopsis: r[P2@P3]=r[P1@P3] */
14737 #define OP_Copy 74 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
14738 #define OP_SCopy 75 /* synopsis: r[P2]=r[P1] */
14739 #define OP_IntCopy 76 /* synopsis: r[P2]=r[P1] */
14740 #define OP_ResultRow 77 /* synopsis: output=r[P1@P2] */
14741 #define OP_CollSeq 78
14742 #define OP_AddImm 79 /* synopsis: r[P1]=r[P1]+P2 */
14743 #define OP_RealAffinity 80
14744 #define OP_Cast 81 /* synopsis: affinity(r[P1]) */
14745 #define OP_Permutation 82
14746 #define OP_Compare 83 /* synopsis: r[P1@P3] <-> r[P2@P3] */
14747 #define OP_IsTrue 84 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
14748 #define OP_Offset 85 /* synopsis: r[P3] = sqlite_offset(P1) */
14749 #define OP_Column 86 /* synopsis: r[P3]=PX */
14750 #define OP_Affinity 87 /* synopsis: affinity(r[P1@P2]) */
14751 #define OP_MakeRecord 88 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
14752 #define OP_Count 89 /* synopsis: r[P2]=count() */
14753 #define OP_ReadCookie 90
14754 #define OP_SetCookie 91
14755 #define OP_BitAnd 92 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
14756 #define OP_BitOr 93 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
14757 #define OP_ShiftLeft 94 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
14758 #define OP_ShiftRight 95 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
14759 #define OP_Add 96 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
@@ -14760,84 +14760,82 @@
14760 #define OP_Subtract 97 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
14761 #define OP_Multiply 98 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
14762 #define OP_Divide 99 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
14763 #define OP_Remainder 100 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
14764 #define OP_Concat 101 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
14765 #define OP_ReopenIdx 102 /* synopsis: root=P2 iDb=P3 */
14766 #define OP_BitNot 103 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
14767 #define OP_OpenRead 104 /* synopsis: root=P2 iDb=P3 */
14768 #define OP_OpenWrite 105 /* synopsis: root=P2 iDb=P3 */
14769 #define OP_String8 106 /* same as TK_STRING, synopsis: r[P2]='P4' */
14770 #define OP_OpenDup 107
14771 #define OP_OpenAutoindex 108 /* synopsis: nColumn=P2 */
14772 #define OP_OpenEphemeral 109 /* synopsis: nColumn=P2 */
14773 #define OP_SorterOpen 110
14774 #define OP_SequenceTest 111 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
14775 #define OP_OpenPseudo 112 /* synopsis: P3 columns in r[P2] */
14776 #define OP_Close 113
14777 #define OP_ColumnsUsed 114
14778 #define OP_SeekHit 115 /* synopsis: seekHit=P2 */
14779 #define OP_Sequence 116 /* synopsis: r[P2]=cursor[P1].ctr++ */
14780 #define OP_NewRowid 117 /* synopsis: r[P2]=rowid */
14781 #define OP_Insert 118 /* synopsis: intkey=r[P3] data=r[P2] */
14782 #define OP_InsertInt 119 /* synopsis: intkey=P3 data=r[P2] */
14783 #define OP_Delete 120
14784 #define OP_ResetCount 121
14785 #define OP_SorterCompare 122 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
14786 #define OP_SorterData 123 /* synopsis: r[P2]=data */
14787 #define OP_RowData 124 /* synopsis: r[P2]=data */
14788 #define OP_Rowid 125 /* synopsis: r[P2]=rowid */
14789 #define OP_NullRow 126
14790 #define OP_SeekEnd 127
14791 #define OP_SorterInsert 128 /* synopsis: key=r[P2] */
14792 #define OP_IdxInsert 129 /* synopsis: key=r[P2] */
14793 #define OP_IdxDelete 130 /* synopsis: key=r[P2@P3] */
14794 #define OP_DeferredSeek 131 /* synopsis: Move P3 to P1.rowid if needed */
14795 #define OP_IdxRowid 132 /* synopsis: r[P2]=rowid */
14796 #define OP_Destroy 133
14797 #define OP_Clear 134
14798 #define OP_ResetSorter 135
14799 #define OP_CreateBtree 136 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
14800 #define OP_SqlExec 137
14801 #define OP_ParseSchema 138
14802 #define OP_LoadAnalysis 139
14803 #define OP_DropTable 140
14804 #define OP_Real 141 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
14805 #define OP_DropIndex 142
14806 #define OP_DropTrigger 143
14807 #define OP_IntegrityCk 144
14808 #define OP_RowSetAdd 145 /* synopsis: rowset(P1)=r[P2] */
14809 #define OP_Param 146
14810 #define OP_FkCounter 147 /* synopsis: fkctr[P1]+=P2 */
14811 #define OP_MemMax 148 /* synopsis: r[P1]=max(r[P1],r[P2]) */
14812 #define OP_OffsetLimit 149 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
14813 #define OP_AggInverse 150 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
14814 #define OP_AggStep 151 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14815 #define OP_AggStep1 152 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14816 #define OP_AggValue 153 /* synopsis: r[P3]=value N=P2 */
14817 #define OP_AggFinal 154 /* synopsis: accum=r[P1] N=P2 */
14818 #define OP_Expire 155
14819 #define OP_TableLock 156 /* synopsis: iDb=P1 root=P2 write=P3 */
14820 #define OP_VBegin 157
14821 #define OP_VCreate 158
14822 #define OP_VDestroy 159
14823 #define OP_VOpen 160
14824 #define OP_VColumn 161 /* synopsis: r[P3]=vcolumn(P2) */
14825 #define OP_VRename 162
14826 #define OP_Pagecount 163
14827 #define OP_MaxPgcnt 164
14828 #define OP_PureFunc0 165
14829 #define OP_Function0 166 /* synopsis: r[P3]=func(r[P2@P5]) */
14830 #define OP_PureFunc 167
14831 #define OP_Function 168 /* synopsis: r[P3]=func(r[P2@P5]) */
14832 #define OP_Trace 169
14833 #define OP_CursorHint 170
14834 #define OP_SetTabCol 171
14835 #define OP_VerifyTabCol 172
14836 #define OP_Noop 173
14837 #define OP_Explain 174
14838 #define OP_Abortable 175
14839
14840 /* Properties such as "out2" or "jump" that are specified in
14841 ** comments following the "case" for each opcode in the vdbe.c
14842 ** are encoded into bitvectors as follows:
14843 */
@@ -14853,26 +14851,25 @@
14853 /* 16 */ 0x01, 0x01, 0x03, 0x12, 0x03, 0x01, 0x09, 0x09,\
14854 /* 24 */ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,\
14855 /* 32 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
14856 /* 40 */ 0x01, 0x23, 0x0b, 0x26, 0x26, 0x01, 0x01, 0x03,\
14857 /* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
14858 /* 56 */ 0x0b, 0x0b, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02,\
14859 /* 64 */ 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10,\
14860 /* 72 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x02,\
14861 /* 80 */ 0x02, 0x02, 0x00, 0x00, 0x12, 0x20, 0x00, 0x00,\
14862 /* 88 */ 0x00, 0x10, 0x10, 0x00, 0x26, 0x26, 0x26, 0x26,\
14863 /* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\
14864 /* 104 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
14865 /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
14866 /* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\
14867 /* 128 */ 0x04, 0x04, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
14868 /* 136 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\
14869 /* 144 */ 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00,\
14870 /* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14871 /* 160 */ 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\
14872 /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14873 }
14874
14875 /* The sqlite3P2Values() routine is able to run faster if it knows
14876 ** the value of the largest JUMP opcode. The smaller the maximum
14877 ** JUMP opcode the better, so the mkopcodeh.tcl script that
14878 ** generated this include file strives to group all JUMP opcodes
@@ -14950,13 +14947,10 @@
14950 SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*);
14951 SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*);
14952 SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*);
14953 SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*);
14954 SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int);
14955 #ifdef SQLITE_COVERAGE_TEST
14956 SQLITE_PRIVATE int sqlite3VdbeLabelHasBeenResolved(Vdbe*,int);
14957 #endif
14958 SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*);
14959 #ifdef SQLITE_DEBUG
14960 SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int);
14961 #endif
14962 SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*);
@@ -15283,10 +15277,12 @@
15283 # endif
15284 # ifdef SQLITE_ENABLE_SNAPSHOT
15285 SQLITE_PRIVATE int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot);
15286 SQLITE_PRIVATE int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot);
15287 SQLITE_PRIVATE int sqlite3PagerSnapshotRecover(Pager *pPager);
 
 
15288 # endif
15289 #else
15290 # define sqlite3PagerUseWal(x,y) 0
15291 #endif
15292
@@ -16290,11 +16286,11 @@
16290 ** Bits of the sqlite3.dbOptFlags field that are used by the
16291 ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
16292 ** selectively disable various optimizations.
16293 */
16294 #define SQLITE_QueryFlattener 0x0001 /* Query flattening */
16295 #define SQLITE_ColumnCache 0x0002 /* Column cache */
16296 #define SQLITE_GroupByOrder 0x0004 /* GROUPBY cover of ORDERBY */
16297 #define SQLITE_FactorOutConst 0x0008 /* Constant factoring */
16298 #define SQLITE_DistinctOpt 0x0010 /* DISTINCT using indexes */
16299 #define SQLITE_CoverIdxScan 0x0020 /* Covering index scans */
16300 #define SQLITE_OrderByIdxJoin 0x0040 /* ORDER BY of joins via index */
@@ -16305,10 +16301,11 @@
16305 #define SQLITE_Stat34 0x0800 /* Use STAT3 or STAT4 data */
16306 /* TH3 expects the Stat34 ^^^^^^ value to be 0x0800. Don't change it */
16307 #define SQLITE_PushDown 0x1000 /* The push-down optimization */
16308 #define SQLITE_SimplifyJoin 0x2000 /* Convert LEFT JOIN to JOIN */
16309 #define SQLITE_SkipScan 0x4000 /* Skip-scans */
 
16310 #define SQLITE_AllOpts 0xffff /* All optimizations */
16311
16312 /*
16313 ** Macros for testing whether or not optimizations are enabled or disabled.
16314 */
@@ -17199,11 +17196,11 @@
17199 ** The following are the meanings of bits in the Expr.flags field.
17200 */
17201 #define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
17202 #define EP_Agg 0x000002 /* Contains one or more aggregate functions */
17203 #define EP_HasFunc 0x000004 /* Contains one or more functions of any kind */
17204 /* 0x000008 // available for use */
17205 #define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */
17206 #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
17207 #define EP_DblQuoted 0x000040 /* token.z was originally in "..." */
17208 #define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */
17209 #define EP_Collate 0x000100 /* Tree contains a TK_COLLATE operator */
@@ -17688,17 +17685,10 @@
17688 Table *pTab; /* Table this info block refers to */
17689 int iDb; /* Index in sqlite3.aDb[] of database holding pTab */
17690 int regCtr; /* Memory register holding the rowid counter */
17691 };
17692
17693 /*
17694 ** Size of the column cache
17695 */
17696 #ifndef SQLITE_N_COLCACHE
17697 # define SQLITE_N_COLCACHE 10
17698 #endif
17699
17700 /*
17701 ** At least one instance of the following structure is created for each
17702 ** trigger that may be fired while parsing an INSERT, UPDATE or DELETE
17703 ** statement. All such objects are stored in the linked list headed at
17704 ** Parse.pTriggerPrg and deleted once statement compilation has been
@@ -17770,22 +17760,19 @@
17770 u8 isMultiWrite; /* True if statement may modify/insert multiple rows */
17771 u8 mayAbort; /* True if statement may throw an ABORT exception */
17772 u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
17773 u8 okConstFactor; /* OK to factor out constants */
17774 u8 disableLookaside; /* Number of times lookaside has been disabled */
17775 u8 nColCache; /* Number of entries in aColCache[] */
17776 int nRangeReg; /* Size of the temporary register block */
17777 int iRangeReg; /* First register in temporary register block */
17778 int nErr; /* Number of errors seen */
17779 int nTab; /* Number of previously allocated VDBE cursors */
17780 int nMem; /* Number of memory cells used so far */
17781 int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
17782 int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
17783 int iSelfTab; /* Table associated with an index on expr, or negative
17784 ** of the base register during check-constraint eval */
17785 int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
17786 int iCacheCnt; /* Counter used to generate aColCache[].lru values */
17787 int nLabel; /* Number of labels used */
17788 int *aLabel; /* Space to hold the labels */
17789 ExprList *pConstExpr;/* Constant expressions */
17790 Token constraintName;/* Name of the constraint currently being parsed */
17791 yDbMask writeMask; /* Start a write transaction on these databases */
@@ -17811,21 +17798,13 @@
17811
17812 /**************************************************************************
17813 ** Fields above must be initialized to zero. The fields that follow,
17814 ** down to the beginning of the recursive section, do not need to be
17815 ** initialized as they will be set before being used. The boundary is
17816 ** determined by offsetof(Parse,aColCache).
17817 **************************************************************************/
17818
17819 struct yColCache {
17820 int iTable; /* Table cursor number */
17821 i16 iColumn; /* Table column number */
17822 u8 tempReg; /* iReg is a temp register that needs to be freed */
17823 int iLevel; /* Nesting level */
17824 int iReg; /* Reg with value of this column. 0 means none. */
17825 int lru; /* Least recently used entry has the smallest value */
17826 } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */
17827 int aTempReg[8]; /* Holding area for temporary registers */
17828 Token sNameToken; /* Token with unqualified schema object name */
17829
17830 /************************************************************************
17831 ** Above is constant between recursions. Below is reset before and after
@@ -17863,11 +17842,11 @@
17863 };
17864
17865 /*
17866 ** Sizes and pointers of various parts of the Parse object.
17867 */
17868 #define PARSE_HDR_SZ offsetof(Parse,aColCache) /* Recursive part w/o aColCache*/
17869 #define PARSE_RECURSE_SZ offsetof(Parse,sLastToken) /* Recursive part */
17870 #define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */
17871 #define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */
17872
17873 /*
@@ -18157,10 +18136,11 @@
18157 struct IdxCover *pIdxCover; /* Check for index coverage */
18158 struct IdxExprTrans *pIdxTrans; /* Convert idxed expr to column */
18159 ExprList *pGroupBy; /* GROUP BY clause */
18160 Select *pSelect; /* HAVING to WHERE clause ctx */
18161 struct WindowRewrite *pRewrite; /* Window rewrite context */
 
18162 } u;
18163 };
18164
18165 /* Forward declarations */
18166 SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*);
@@ -18511,11 +18491,11 @@
18511 SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
18512 SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
18513 SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
18514 SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
18515 SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);
18516 SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*);
18517 SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
18518 SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*);
18519 SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
18520 SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
18521 SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int);
@@ -18646,19 +18626,12 @@
18646 #define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */
18647 #define ONEPASS_SINGLE 1 /* ONEPASS valid for a single row update */
18648 #define ONEPASS_MULTI 2 /* ONEPASS is valid for multiple rows */
18649 SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(Parse*, Index*, int, int, int);
18650 SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8);
18651 SQLITE_PRIVATE void sqlite3ExprCodeGetColumnToReg(Parse*, Table*, int, int, int);
18652 SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int);
18653 SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int);
18654 SQLITE_PRIVATE void sqlite3ExprCacheStore(Parse*, int, int, int);
18655 SQLITE_PRIVATE void sqlite3ExprCachePush(Parse*);
18656 SQLITE_PRIVATE void sqlite3ExprCachePop(Parse*);
18657 SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse*, int, int);
18658 SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse*);
18659 SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse*, int, int);
18660 SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int);
18661 SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int);
18662 SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int);
18663 SQLITE_PRIVATE int sqlite3ExprCodeAtInit(Parse*, Expr*, int);
18664 SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
@@ -18890,10 +18863,11 @@
18890 #endif
18891
18892 SQLITE_PRIVATE const char *sqlite3ErrStr(int);
18893 SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse);
18894 SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int);
 
18895 SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName);
18896 SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr);
18897 SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr);
18898 SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse*,Expr*,Expr*);
18899 SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int);
@@ -19853,14 +19827,10 @@
19853 void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */
19854 #ifdef SQLITE_DEBUG
19855 Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */
19856 u16 mScopyFlags; /* flags value immediately after the shallow copy */
19857 #endif
19858 #ifdef SQLITE_DEBUG_COLUMNCACHE
19859 u32 iTabColHash; /* Hash of table.column that is origin of this value */
19860 u32 iPadding; /* sqlite3_value objects must be 8-byte aligned */
19861 #endif
19862 };
19863
19864 /*
19865 ** Size of struct Mem not including the Mem.zMalloc member or anything that
19866 ** follows.
@@ -28513,10 +28483,13 @@
28513 sqlite3TreeViewLine(pView, "COLUMN(%d)%s", pExpr->iColumn, zFlgs);
28514 }else{
28515 sqlite3TreeViewLine(pView, "{%d:%d}%s",
28516 pExpr->iTable, pExpr->iColumn, zFlgs);
28517 }
 
 
 
28518 break;
28519 }
28520 case TK_INTEGER: {
28521 if( pExpr->flags & EP_IntValue ){
28522 sqlite3TreeViewLine(pView, "%d", pExpr->u.iValue);
@@ -31741,40 +31714,40 @@
31741 /* 57 */ "Ge" OpHelp("IF r[P3]>=r[P1]"),
31742 /* 58 */ "ElseNotEq" OpHelp(""),
31743 /* 59 */ "IncrVacuum" OpHelp(""),
31744 /* 60 */ "VNext" OpHelp(""),
31745 /* 61 */ "Init" OpHelp("Start at P2"),
31746 /* 62 */ "Return" OpHelp(""),
31747 /* 63 */ "EndCoroutine" OpHelp(""),
31748 /* 64 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
31749 /* 65 */ "Halt" OpHelp(""),
31750 /* 66 */ "Integer" OpHelp("r[P2]=P1"),
31751 /* 67 */ "Int64" OpHelp("r[P2]=P4"),
31752 /* 68 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
31753 /* 69 */ "Null" OpHelp("r[P2..P3]=NULL"),
31754 /* 70 */ "SoftNull" OpHelp("r[P1]=NULL"),
31755 /* 71 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
31756 /* 72 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
31757 /* 73 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
31758 /* 74 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
31759 /* 75 */ "SCopy" OpHelp("r[P2]=r[P1]"),
31760 /* 76 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
31761 /* 77 */ "ResultRow" OpHelp("output=r[P1@P2]"),
31762 /* 78 */ "CollSeq" OpHelp(""),
31763 /* 79 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
31764 /* 80 */ "RealAffinity" OpHelp(""),
31765 /* 81 */ "Cast" OpHelp("affinity(r[P1])"),
31766 /* 82 */ "Permutation" OpHelp(""),
31767 /* 83 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
31768 /* 84 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
31769 /* 85 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
31770 /* 86 */ "Column" OpHelp("r[P3]=PX"),
31771 /* 87 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
31772 /* 88 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
31773 /* 89 */ "Count" OpHelp("r[P2]=count()"),
31774 /* 90 */ "ReadCookie" OpHelp(""),
31775 /* 91 */ "SetCookie" OpHelp(""),
31776 /* 92 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
31777 /* 93 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
31778 /* 94 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
31779 /* 95 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
31780 /* 96 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
@@ -31781,84 +31754,82 @@
31781 /* 97 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
31782 /* 98 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
31783 /* 99 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
31784 /* 100 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
31785 /* 101 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
31786 /* 102 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
31787 /* 103 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
31788 /* 104 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
31789 /* 105 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
31790 /* 106 */ "String8" OpHelp("r[P2]='P4'"),
31791 /* 107 */ "OpenDup" OpHelp(""),
31792 /* 108 */ "OpenAutoindex" OpHelp("nColumn=P2"),
31793 /* 109 */ "OpenEphemeral" OpHelp("nColumn=P2"),
31794 /* 110 */ "SorterOpen" OpHelp(""),
31795 /* 111 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
31796 /* 112 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
31797 /* 113 */ "Close" OpHelp(""),
31798 /* 114 */ "ColumnsUsed" OpHelp(""),
31799 /* 115 */ "SeekHit" OpHelp("seekHit=P2"),
31800 /* 116 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
31801 /* 117 */ "NewRowid" OpHelp("r[P2]=rowid"),
31802 /* 118 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
31803 /* 119 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
31804 /* 120 */ "Delete" OpHelp(""),
31805 /* 121 */ "ResetCount" OpHelp(""),
31806 /* 122 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
31807 /* 123 */ "SorterData" OpHelp("r[P2]=data"),
31808 /* 124 */ "RowData" OpHelp("r[P2]=data"),
31809 /* 125 */ "Rowid" OpHelp("r[P2]=rowid"),
31810 /* 126 */ "NullRow" OpHelp(""),
31811 /* 127 */ "SeekEnd" OpHelp(""),
31812 /* 128 */ "SorterInsert" OpHelp("key=r[P2]"),
31813 /* 129 */ "IdxInsert" OpHelp("key=r[P2]"),
31814 /* 130 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
31815 /* 131 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
31816 /* 132 */ "IdxRowid" OpHelp("r[P2]=rowid"),
31817 /* 133 */ "Destroy" OpHelp(""),
31818 /* 134 */ "Clear" OpHelp(""),
31819 /* 135 */ "ResetSorter" OpHelp(""),
31820 /* 136 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
31821 /* 137 */ "SqlExec" OpHelp(""),
31822 /* 138 */ "ParseSchema" OpHelp(""),
31823 /* 139 */ "LoadAnalysis" OpHelp(""),
31824 /* 140 */ "DropTable" OpHelp(""),
31825 /* 141 */ "Real" OpHelp("r[P2]=P4"),
31826 /* 142 */ "DropIndex" OpHelp(""),
31827 /* 143 */ "DropTrigger" OpHelp(""),
31828 /* 144 */ "IntegrityCk" OpHelp(""),
31829 /* 145 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
31830 /* 146 */ "Param" OpHelp(""),
31831 /* 147 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
31832 /* 148 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
31833 /* 149 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
31834 /* 150 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
31835 /* 151 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
31836 /* 152 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
31837 /* 153 */ "AggValue" OpHelp("r[P3]=value N=P2"),
31838 /* 154 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
31839 /* 155 */ "Expire" OpHelp(""),
31840 /* 156 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
31841 /* 157 */ "VBegin" OpHelp(""),
31842 /* 158 */ "VCreate" OpHelp(""),
31843 /* 159 */ "VDestroy" OpHelp(""),
31844 /* 160 */ "VOpen" OpHelp(""),
31845 /* 161 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
31846 /* 162 */ "VRename" OpHelp(""),
31847 /* 163 */ "Pagecount" OpHelp(""),
31848 /* 164 */ "MaxPgcnt" OpHelp(""),
31849 /* 165 */ "PureFunc0" OpHelp(""),
31850 /* 166 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"),
31851 /* 167 */ "PureFunc" OpHelp(""),
31852 /* 168 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"),
31853 /* 169 */ "Trace" OpHelp(""),
31854 /* 170 */ "CursorHint" OpHelp(""),
31855 /* 171 */ "SetTabCol" OpHelp(""),
31856 /* 172 */ "VerifyTabCol" OpHelp(""),
31857 /* 173 */ "Noop" OpHelp(""),
31858 /* 174 */ "Explain" OpHelp(""),
31859 /* 175 */ "Abortable" OpHelp(""),
31860 };
31861 return azName[i];
31862 }
31863 #endif
31864
@@ -32764,16 +32735,29 @@
32764 ** statements. e.g.
32765 **
32766 ** unixEnterMutex()
32767 ** assert( unixMutexHeld() );
32768 ** unixEnterLeave()
 
 
 
 
 
 
 
 
 
 
 
32769 */
32770 static sqlite3_mutex *unixBigLock = 0;
32771 static void unixEnterMutex(void){
 
32772 sqlite3_mutex_enter(unixBigLock);
32773 }
32774 static void unixLeaveMutex(void){
 
32775 sqlite3_mutex_leave(unixBigLock);
32776 }
32777 #ifdef SQLITE_DEBUG
32778 static int unixMutexHeld(void) {
32779 return sqlite3_mutex_held(unixBigLock);
@@ -33170,20 +33154,38 @@
33170 ** each inode opened by each thread.
33171 **
33172 ** A single inode can have multiple file descriptors, so each unixFile
33173 ** structure contains a pointer to an instance of this object and this
33174 ** object keeps a count of the number of unixFile pointing to it.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33175 */
33176 struct unixInodeInfo {
33177 struct unixFileId fileId; /* The lookup key */
33178 int nShared; /* Number of SHARED locks held */
33179 unsigned char eFileLock; /* One of SHARED_LOCK, RESERVED_LOCK etc. */
33180 unsigned char bProcessLock; /* An exclusive process lock is held */
 
 
 
33181 int nRef; /* Number of pointers to this structure */
33182 unixShmNode *pShmNode; /* Shared memory associated with this inode */
33183 int nLock; /* Number of outstanding file locks */
33184 UnixUnusedFd *pUnused; /* Unused file descriptors to close */
33185 unixInodeInfo *pNext; /* List of all unixInodeInfo objects */
33186 unixInodeInfo *pPrev; /* .... doubly linked */
33187 #if SQLITE_ENABLE_LOCKING_STYLE
33188 unsigned long long sharedByte; /* for AFP simulated shared lock */
33189 #endif
@@ -33195,11 +33197,25 @@
33195
33196 /*
33197 ** A lists of all unixInodeInfo objects.
33198 */
33199 static unixInodeInfo *inodeList = 0; /* All unixInodeInfo objects */
33200 static unsigned int nUnusedFd = 0; /* Total unused file descriptors */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33201
33202 /*
33203 **
33204 ** This function - unixLogErrorAtLine(), is only ever called via the macro
33205 ** unixLogError().
@@ -33301,15 +33317,15 @@
33301 */
33302 static void closePendingFds(unixFile *pFile){
33303 unixInodeInfo *pInode = pFile->pInode;
33304 UnixUnusedFd *p;
33305 UnixUnusedFd *pNext;
 
33306 for(p=pInode->pUnused; p; p=pNext){
33307 pNext = p->pNext;
33308 robust_close(pFile, p->fd, __LINE__);
33309 sqlite3_free(p);
33310 nUnusedFd--;
33311 }
33312 pInode->pUnused = 0;
33313 }
33314
33315 /*
@@ -33319,15 +33335,18 @@
33319 ** when this function is called.
33320 */
33321 static void releaseInodeInfo(unixFile *pFile){
33322 unixInodeInfo *pInode = pFile->pInode;
33323 assert( unixMutexHeld() );
 
33324 if( ALWAYS(pInode) ){
33325 pInode->nRef--;
33326 if( pInode->nRef==0 ){
33327 assert( pInode->pShmNode==0 );
 
33328 closePendingFds(pFile);
 
33329 if( pInode->pPrev ){
33330 assert( pInode->pPrev->pNext==pInode );
33331 pInode->pPrev->pNext = pInode->pNext;
33332 }else{
33333 assert( inodeList==pInode );
@@ -33335,14 +33354,14 @@
33335 }
33336 if( pInode->pNext ){
33337 assert( pInode->pNext->pPrev==pInode );
33338 pInode->pNext->pPrev = pInode->pPrev;
33339 }
 
33340 sqlite3_free(pInode);
33341 }
33342 }
33343 assert( inodeList!=0 || nUnusedFd==0 );
33344 }
33345
33346 /*
33347 ** Given a file descriptor, locate the unixInodeInfo object that
33348 ** describes that file descriptor. Create a new one if necessary. The
@@ -33408,11 +33427,10 @@
33408 #if OS_VXWORKS
33409 fileId.pId = pFile->pId;
33410 #else
33411 fileId.ino = (u64)statbuf.st_ino;
33412 #endif
33413 assert( inodeList!=0 || nUnusedFd==0 );
33414 pInode = inodeList;
33415 while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){
33416 pInode = pInode->pNext;
33417 }
33418 if( pInode==0 ){
@@ -33420,10 +33438,17 @@
33420 if( pInode==0 ){
33421 return SQLITE_NOMEM_BKPT;
33422 }
33423 memset(pInode, 0, sizeof(*pInode));
33424 memcpy(&pInode->fileId, &fileId, sizeof(fileId));
 
 
 
 
 
 
 
33425 pInode->nRef = 1;
33426 pInode->pNext = inodeList;
33427 pInode->pPrev = 0;
33428 if( inodeList ) inodeList->pPrev = pInode;
33429 inodeList = pInode;
@@ -33498,11 +33523,11 @@
33498
33499 SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
33500
33501 assert( pFile );
33502 assert( pFile->eFileLock<=SHARED_LOCK );
33503 unixEnterMutex(); /* Because pFile->pInode is shared across threads */
33504
33505 /* Check if a thread in this process holds such a lock */
33506 if( pFile->pInode->eFileLock>SHARED_LOCK ){
33507 reserved = 1;
33508 }
@@ -33523,11 +33548,11 @@
33523 reserved = 1;
33524 }
33525 }
33526 #endif
33527
33528 unixLeaveMutex();
33529 OSTRACE(("TEST WR-LOCK %d %d %d (unix)\n", pFile->h, rc, reserved));
33530
33531 *pResOut = reserved;
33532 return rc;
33533 }
@@ -33589,12 +33614,12 @@
33589 ** to fcntl() fails. In this case, errno is set appropriately (by fcntl()).
33590 */
33591 static int unixFileLock(unixFile *pFile, struct flock *pLock){
33592 int rc;
33593 unixInodeInfo *pInode = pFile->pInode;
33594 assert( unixMutexHeld() );
33595 assert( pInode!=0 );
 
33596 if( (pFile->ctrlFlags & (UNIXFILE_EXCL|UNIXFILE_RDONLY))==UNIXFILE_EXCL ){
33597 if( pInode->bProcessLock==0 ){
33598 struct flock lock;
33599 assert( pInode->nLock==0 );
33600 lock.l_whence = SEEK_SET;
@@ -33709,12 +33734,12 @@
33709 assert( eFileLock!=PENDING_LOCK );
33710 assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );
33711
33712 /* This mutex is needed because pFile->pInode is shared across threads
33713 */
33714 unixEnterMutex();
33715 pInode = pFile->pInode;
 
33716
33717 /* If some thread using this PID has a lock via a different unixFile*
33718 ** handle that precludes the requested lock, return BUSY.
33719 */
33720 if( (pFile->eFileLock!=pInode->eFileLock &&
@@ -33853,11 +33878,11 @@
33853 pFile->eFileLock = PENDING_LOCK;
33854 pInode->eFileLock = PENDING_LOCK;
33855 }
33856
33857 end_lock:
33858 unixLeaveMutex();
33859 OSTRACE(("LOCK %d %s %s (unix)\n", pFile->h, azFileLock(eFileLock),
33860 rc==SQLITE_OK ? "ok" : "failed"));
33861 return rc;
33862 }
33863
@@ -33866,15 +33891,15 @@
33866 ** pUnused list.
33867 */
33868 static void setPendingFd(unixFile *pFile){
33869 unixInodeInfo *pInode = pFile->pInode;
33870 UnixUnusedFd *p = pFile->pPreallocatedUnused;
 
33871 p->pNext = pInode->pUnused;
33872 pInode->pUnused = p;
33873 pFile->h = -1;
33874 pFile->pPreallocatedUnused = 0;
33875 nUnusedFd++;
33876 }
33877
33878 /*
33879 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
33880 ** must be either NO_LOCK or SHARED_LOCK.
@@ -33901,12 +33926,12 @@
33901
33902 assert( eFileLock<=SHARED_LOCK );
33903 if( pFile->eFileLock<=eFileLock ){
33904 return SQLITE_OK;
33905 }
33906 unixEnterMutex();
33907 pInode = pFile->pInode;
 
33908 assert( pInode->nShared!=0 );
33909 if( pFile->eFileLock>SHARED_LOCK ){
33910 assert( pInode->eFileLock==pFile->eFileLock );
33911
33912 #ifdef SQLITE_DEBUG
@@ -34028,18 +34053,18 @@
34028 ** count reaches zero, close any other file descriptors whose close
34029 ** was deferred because of outstanding locks.
34030 */
34031 pInode->nLock--;
34032 assert( pInode->nLock>=0 );
34033 if( pInode->nLock==0 ){
34034 closePendingFds(pFile);
34035 }
34036 }
34037
34038 end_unlock:
34039 unixLeaveMutex();
34040 if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock;
 
 
34041 return rc;
34042 }
34043
34044 /*
34045 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
@@ -34106,26 +34131,32 @@
34106 ** Close a file.
34107 */
34108 static int unixClose(sqlite3_file *id){
34109 int rc = SQLITE_OK;
34110 unixFile *pFile = (unixFile *)id;
 
 
 
34111 verifyDbFile(pFile);
34112 unixUnlock(id, NO_LOCK);
 
34113 unixEnterMutex();
34114
34115 /* unixFile.pInode is always valid here. Otherwise, a different close
34116 ** routine (e.g. nolockClose()) would be called instead.
34117 */
34118 assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 );
34119 if( ALWAYS(pFile->pInode) && pFile->pInode->nLock ){
 
34120 /* If there are outstanding locks, do not actually close the file just
34121 ** yet because that would clear those locks. Instead, add the file
34122 ** descriptor to pInode->pUnused list. It will be automatically closed
34123 ** when the last lock is cleared.
34124 */
34125 setPendingFd(pFile);
34126 }
 
34127 releaseInodeInfo(pFile);
34128 rc = closeUnixFile(id);
34129 unixLeaveMutex();
34130 return rc;
34131 }
@@ -34719,10 +34750,11 @@
34719 static int semXClose(sqlite3_file *id) {
34720 if( id ){
34721 unixFile *pFile = (unixFile*)id;
34722 semXUnlock(id, NO_LOCK);
34723 assert( pFile );
 
34724 unixEnterMutex();
34725 releaseInodeInfo(pFile);
34726 unixLeaveMutex();
34727 closeUnixFile(id);
34728 }
@@ -34833,12 +34865,11 @@
34833 context = (afpLockingContext *) pFile->lockingContext;
34834 if( context->reserved ){
34835 *pResOut = 1;
34836 return SQLITE_OK;
34837 }
34838 unixEnterMutex(); /* Because pFile->pInode is shared across threads */
34839
34840 /* Check if a thread in this process holds such a lock */
34841 if( pFile->pInode->eFileLock>SHARED_LOCK ){
34842 reserved = 1;
34843 }
34844
@@ -34858,11 +34889,11 @@
34858 if( IS_LOCK_ERROR(lrc) ){
34859 rc=lrc;
34860 }
34861 }
34862
34863 unixLeaveMutex();
34864 OSTRACE(("TEST WR-LOCK %d %d %d (afp)\n", pFile->h, rc, reserved));
34865
34866 *pResOut = reserved;
34867 return rc;
34868 }
@@ -34921,12 +34952,12 @@
34921 assert( eFileLock!=PENDING_LOCK );
34922 assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );
34923
34924 /* This mutex is needed because pFile->pInode is shared across threads
34925 */
34926 unixEnterMutex();
34927 pInode = pFile->pInode;
 
34928
34929 /* If some thread using this PID has a lock via a different unixFile*
34930 ** handle that precludes the requested lock, return BUSY.
34931 */
34932 if( (pFile->eFileLock!=pInode->eFileLock &&
@@ -35058,11 +35089,11 @@
35058 pFile->eFileLock = PENDING_LOCK;
35059 pInode->eFileLock = PENDING_LOCK;
35060 }
35061
35062 afp_end_lock:
35063 unixLeaveMutex();
35064 OSTRACE(("LOCK %d %s %s (afp)\n", pFile->h, azFileLock(eFileLock),
35065 rc==SQLITE_OK ? "ok" : "failed"));
35066 return rc;
35067 }
35068
@@ -35090,12 +35121,12 @@
35090
35091 assert( eFileLock<=SHARED_LOCK );
35092 if( pFile->eFileLock<=eFileLock ){
35093 return SQLITE_OK;
35094 }
35095 unixEnterMutex();
35096 pInode = pFile->pInode;
 
35097 assert( pInode->nShared!=0 );
35098 if( pFile->eFileLock>SHARED_LOCK ){
35099 assert( pInode->eFileLock==pFile->eFileLock );
35100 SimulateIOErrorBenign(1);
35101 SimulateIOError( h=(-1) )
@@ -35160,18 +35191,18 @@
35160 }
35161 }
35162 if( rc==SQLITE_OK ){
35163 pInode->nLock--;
35164 assert( pInode->nLock>=0 );
35165 if( pInode->nLock==0 ){
35166 closePendingFds(pFile);
35167 }
35168 }
35169 }
35170
35171 unixLeaveMutex();
35172 if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock;
 
 
35173 return rc;
35174 }
35175
35176 /*
35177 ** Close a file & cleanup AFP specific locking context
@@ -35179,18 +35210,24 @@
35179 static int afpClose(sqlite3_file *id) {
35180 int rc = SQLITE_OK;
35181 unixFile *pFile = (unixFile*)id;
35182 assert( id!=0 );
35183 afpUnlock(id, NO_LOCK);
 
35184 unixEnterMutex();
35185 if( pFile->pInode && pFile->pInode->nLock ){
35186 /* If there are outstanding locks, do not actually close the file just
35187 ** yet because that would clear those locks. Instead, add the file
35188 ** descriptor to pInode->aPending. It will be automatically closed when
35189 ** the last lock is cleared.
35190 */
35191 setPendingFd(pFile);
 
 
 
 
 
35192 }
35193 releaseInodeInfo(pFile);
35194 sqlite3_free(pFile->lockingContext);
35195 rc = closeUnixFile(id);
35196 unixLeaveMutex();
@@ -36492,10 +36529,11 @@
36492 assert( pDbFd->pShm==0 );
36493
36494 /* Check to see if a unixShmNode object already exists. Reuse an existing
36495 ** one if present. Create a new one if necessary.
36496 */
 
36497 unixEnterMutex();
36498 pInode = pDbFd->pInode;
36499 pShmNode = pInode->pShmNode;
36500 if( pShmNode==0 ){
36501 struct stat sStat; /* fstat() info for database file */
@@ -36874,10 +36912,11 @@
36874 static void unixShmBarrier(
36875 sqlite3_file *fd /* Database file holding the shared memory */
36876 ){
36877 UNUSED_PARAMETER(fd);
36878 sqlite3MemoryBarrier(); /* compiler-defined memory barrier */
 
36879 unixEnterMutex(); /* Also mutex, for redundancy */
36880 unixLeaveMutex();
36881 }
36882
36883 /*
@@ -36915,10 +36954,11 @@
36915 pDbFd->pShm = 0;
36916 sqlite3_mutex_leave(pShmNode->mutex);
36917
36918 /* If pShmNode->nRef has reached 0, then close the underlying
36919 ** shared-memory file, too */
 
36920 unixEnterMutex();
36921 assert( pShmNode->nRef>0 );
36922 pShmNode->nRef--;
36923 if( pShmNode->nRef==0 ){
36924 if( deleteFlag && pShmNode->h>=0 ){
@@ -37241,11 +37281,11 @@
37241 unixShmMap /* xShmMap method */
37242 )
37243 IOMETHODS(
37244 nolockIoFinder, /* Finder function name */
37245 nolockIoMethods, /* sqlite3_io_methods object name */
37246 3, /* shared memory is disabled */
37247 nolockClose, /* xClose method */
37248 nolockLock, /* xLock method */
37249 nolockUnlock, /* xUnlock method */
37250 nolockCheckReservedLock, /* xCheckReservedLock method */
37251 0 /* xShmMap method */
@@ -37737,26 +37777,28 @@
37737 ** ignored and -1 is returned. The caller will try to open a new file
37738 ** descriptor on the same path, fail, and return an error to SQLite.
37739 **
37740 ** Even if a subsequent open() call does succeed, the consequences of
37741 ** not searching for a reusable file descriptor are not dire. */
37742 if( nUnusedFd>0 && 0==osStat(zPath, &sStat) ){
37743 unixInodeInfo *pInode;
37744
37745 pInode = inodeList;
37746 while( pInode && (pInode->fileId.dev!=sStat.st_dev
37747 || pInode->fileId.ino!=(u64)sStat.st_ino) ){
37748 pInode = pInode->pNext;
37749 }
37750 if( pInode ){
37751 UnixUnusedFd **pp;
 
 
37752 for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext));
37753 pUnused = *pp;
37754 if( pUnused ){
37755 nUnusedFd--;
37756 *pp = pUnused->pNext;
37757 }
 
37758 }
37759 }
37760 unixLeaveMutex();
37761 #endif /* if !OS_VXWORKS */
37762 return pUnused;
@@ -49969,10 +50011,12 @@
49969
49970 #ifdef SQLITE_ENABLE_SNAPSHOT
49971 SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot);
49972 SQLITE_PRIVATE void sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapshot);
49973 SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal);
 
 
49974 #endif
49975
49976 #ifdef SQLITE_ENABLE_ZIPVFS
49977 /* If the WAL file is not empty, return the number of bytes of content
49978 ** stored in each frame (i.e. the db page-size when the WAL was created).
@@ -57618,10 +57662,42 @@
57618 }else{
57619 rc = SQLITE_ERROR;
57620 }
57621 return rc;
57622 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57623 #endif /* SQLITE_ENABLE_SNAPSHOT */
57624 #endif /* !SQLITE_OMIT_WAL */
57625
57626 #ifdef SQLITE_ENABLE_ZIPVFS
57627 /*
@@ -59476,11 +59552,10 @@
59476 }
59477
59478 if( pIter
59479 && (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0),1))==SQLITE_OK
59480 ){
59481 i64 nSize; /* Current size of database file */
59482 u32 nBackfill = pInfo->nBackfill;
59483
59484 pInfo->nBackfillAttempted = mxSafeFrame;
59485
59486 /* Sync the WAL to disk */
@@ -59489,10 +59564,11 @@
59489 /* If the database may grow as a result of this checkpoint, hint
59490 ** about the eventual size of the db file to the VFS layer.
59491 */
59492 if( rc==SQLITE_OK ){
59493 i64 nReq = ((i64)mxPage * szPage);
 
59494 rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);
59495 if( rc==SQLITE_OK && nSize<nReq ){
59496 sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq);
59497 }
59498 }
@@ -61410,10 +61486,47 @@
61410 if( pHdr1->aSalt[0]>pHdr2->aSalt[0] ) return +1;
61411 if( pHdr1->mxFrame<pHdr2->mxFrame ) return -1;
61412 if( pHdr1->mxFrame>pHdr2->mxFrame ) return +1;
61413 return 0;
61414 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61415 #endif /* SQLITE_ENABLE_SNAPSHOT */
61416
61417 #ifdef SQLITE_ENABLE_ZIPVFS
61418 /*
61419 ** If the argument is not NULL, it points to a Wal object that holds a
@@ -74393,13 +74506,10 @@
74393 pX->flags = MEM_Undefined;
74394 pX->pScopyFrom = 0;
74395 }
74396 }
74397 pMem->pScopyFrom = 0;
74398 #ifdef SQLITE_DEBUG_COLUMN_CACHE
74399 pMem->iTabColHash = 0;
74400 #endif
74401 }
74402 #endif /* SQLITE_DEBUG */
74403
74404
74405 /*
@@ -74416,13 +74526,10 @@
74416 SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
74417 assert( (pFrom->flags & MEM_RowSet)==0 );
74418 assert( pTo->db==pFrom->db );
74419 if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; }
74420 memcpy(pTo, pFrom, MEMCELLSIZE);
74421 #ifdef SQLITE_DEBUG_COLUMNCACHE
74422 pTo->iTabColHash = pFrom->iTabColHash;
74423 #endif
74424 if( (pFrom->flags&MEM_Static)==0 ){
74425 pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);
74426 assert( srcType==MEM_Ephem || srcType==MEM_Static );
74427 pTo->flags |= srcType;
74428 }
@@ -74436,13 +74543,10 @@
74436 int rc = SQLITE_OK;
74437
74438 assert( (pFrom->flags & MEM_RowSet)==0 );
74439 if( VdbeMemDynamic(pTo) ) vdbeMemClearExternAndSetNull(pTo);
74440 memcpy(pTo, pFrom, MEMCELLSIZE);
74441 #ifdef SQLITE_DEBUG_COLUMNCACHE
74442 pTo->iTabColHash = pFrom->iTabColHash;
74443 #endif
74444 pTo->flags &= ~MEM_Dyn;
74445 if( pTo->flags&(MEM_Str|MEM_Blob) ){
74446 if( 0==(pFrom->flags&MEM_Static) ){
74447 pTo->flags |= MEM_Ephem;
74448 rc = sqlite3VdbeMemMakeWriteable(pTo);
@@ -75547,18 +75651,10 @@
75547 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
75548 pOp->zComment = 0;
75549 #endif
75550 #ifdef SQLITE_DEBUG
75551 if( p->db->flags & SQLITE_VdbeAddopTrace ){
75552 int jj, kk;
75553 Parse *pParse = p->pParse;
75554 for(jj=kk=0; jj<pParse->nColCache; jj++){
75555 struct yColCache *x = pParse->aColCache + jj;
75556 printf(" r[%d]={%d:%d}", x->iReg, x->iTable, x->iColumn);
75557 kk++;
75558 }
75559 if( kk ) printf("\n");
75560 sqlite3VdbePrintOp(0, i, &p->aOp[i]);
75561 test_addop_breakpoint();
75562 }
75563 #endif
75564 #ifdef VDBE_PROFILE
@@ -75799,23 +75895,10 @@
75799 assert( p->aLabel[j]==(-1) ); /* Labels may only be resolved once */
75800 p->aLabel[j] = v->nOp;
75801 }
75802 }
75803
75804 #ifdef SQLITE_COVERAGE_TEST
75805 /*
75806 ** Return TRUE if and only if the label x has already been resolved.
75807 ** Return FALSE (zero) if label x is still unresolved.
75808 **
75809 ** This routine is only used inside of testcase() macros, and so it
75810 ** only exists when measuring test coverage.
75811 */
75812 SQLITE_PRIVATE int sqlite3VdbeLabelHasBeenResolved(Vdbe *v, int x){
75813 return v->pParse->aLabel && v->pParse->aLabel[ADDR(x)]>=0;
75814 }
75815 #endif /* SQLITE_COVERAGE_TEST */
75816
75817 /*
75818 ** Mark the VDBE as one that can only be run one time.
75819 */
75820 SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){
75821 p->runOnlyOnce = 1;
@@ -77001,13 +77084,10 @@
77001 p->flags = flags;
77002 p->szMalloc = 0;
77003 #ifdef SQLITE_DEBUG
77004 p->pScopyFrom = 0;
77005 #endif
77006 #ifdef SQLITE_DEBUG_COLUMNCACHE
77007 p->iTabColHash = 0;
77008 #endif
77009 p++;
77010 }
77011 }
77012
77013 /*
@@ -81187,13 +81267,10 @@
81187 /* .xDel = */ (void(*)(void*))0,
81188 #ifdef SQLITE_DEBUG
81189 /* .pScopyFrom = */ (Mem*)0,
81190 /* .mScopyFlags= */ 0,
81191 #endif
81192 #ifdef SQLITE_DEBUG_COLUMNCACHE
81193 /* .iTabColHash= */ 0,
81194 #endif
81195 };
81196 return &nullMem;
81197 }
81198
81199 /*
@@ -82412,22 +82489,10 @@
82412 # define memAboutToChange(P,M) sqlite3VdbeMemAboutToChange(P,M)
82413 #else
82414 # define memAboutToChange(P,M)
82415 #endif
82416
82417 /*
82418 ** Given a cursor number and a column for a table or index, compute a
82419 ** hash value for use in the Mem.iTabColHash value. The iTabColHash
82420 ** column is only used for verification - it is omitted from production
82421 ** builds. Collisions are harmless in the sense that the correct answer
82422 ** still results. The only harm of collisions is that they can potential
82423 ** reduce column-cache error detection during SQLITE_DEBUG builds.
82424 **
82425 ** No valid hash should be 0.
82426 */
82427 #define TableColumnHash(T,C) (((u32)(T)<<16)^(u32)(C+2))
82428
82429 /*
82430 ** The following global variable is incremented every time a cursor
82431 ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test
82432 ** procedures use this information to make sure that indices are
82433 ** working correctly. This variable has no function other than to
@@ -83773,11 +83838,10 @@
83773 memAboutToChange(p, pOut);
83774 sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);
83775 Deephemeralize(pOut);
83776 #ifdef SQLITE_DEBUG
83777 pOut->pScopyFrom = 0;
83778 pOut->iTabColHash = 0;
83779 #endif
83780 REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut);
83781 if( (n--)==0 ) break;
83782 pOut++;
83783 pIn1++;
@@ -84437,11 +84501,16 @@
84437 affinity = pOp->p5 & SQLITE_AFF_MASK;
84438 if( affinity>=SQLITE_AFF_NUMERIC ){
84439 if( (flags1 | flags3)&MEM_Str ){
84440 if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
84441 applyNumericAffinity(pIn1,0);
84442 testcase( flags3!=pIn3->flags ); /* Possible if pIn1==pIn3 */
 
 
 
 
 
84443 flags3 = pIn3->flags;
84444 }
84445 if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
84446 applyNumericAffinity(pIn3,0);
84447 }
@@ -86357,14 +86426,14 @@
86357 ** The IdxGE opcode will be skipped if this opcode succeeds, but the
86358 ** IdxGE opcode will be used on subsequent loop iterations.
86359 **
86360 ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt
86361 */
86362 case OP_SeekLT: /* jump, in3 */
86363 case OP_SeekLE: /* jump, in3 */
86364 case OP_SeekGE: /* jump, in3 */
86365 case OP_SeekGT: { /* jump, in3 */
86366 int res; /* Comparison result */
86367 int oc; /* Opcode */
86368 VdbeCursor *pC; /* The cursor to seek */
86369 UnpackedRecord r; /* The key to seek for */
86370 int nField; /* Number of columns or fields in the key */
@@ -86788,17 +86857,25 @@
86788 int res;
86789 u64 iKey;
86790
86791 pIn3 = &aMem[pOp->p3];
86792 if( (pIn3->flags & MEM_Int)==0 ){
 
 
 
 
 
 
86793 applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding);
86794 if( (pIn3->flags & MEM_Int)==0 ) goto jump_to_p2;
 
 
86795 }
86796 /* Fall through into OP_NotExists */
86797 case OP_NotExists: /* jump, in3 */
86798 pIn3 = &aMem[pOp->p3];
86799 assert( pIn3->flags & MEM_Int );
86800 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
86801 pC = p->apCsr[pOp->p1];
86802 assert( pC!=0 );
86803 #ifdef SQLITE_DEBUG
86804 pC->seekOp = OP_SeekRowid;
@@ -87994,11 +88071,17 @@
87994 assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxLT );
87995 r.default_rc = 0;
87996 }
87997 r.aMem = &aMem[pOp->p3];
87998 #ifdef SQLITE_DEBUG
87999 { int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }
 
 
 
 
 
 
88000 #endif
88001 res = 0; /* Not needed. Only used to silence a warning. */
88002 rc = sqlite3VdbeIdxKeyCompare(db, pC, &r, &res);
88003 assert( (OP_IdxLE&1)==(OP_IdxLT&1) && (OP_IdxGE&1)==(OP_IdxGT&1) );
88004 if( (pOp->opcode&1)==(OP_IdxLT&1) ){
@@ -89684,12 +89767,12 @@
89684 ** the sqlite3_context object occurs only once, rather than once for each
89685 ** evaluation of the function.
89686 **
89687 ** See also: Function0, AggStep, AggFinal
89688 */
89689 case OP_PureFunc0:
89690 case OP_Function0: {
89691 int n;
89692 sqlite3_context *pCtx;
89693
89694 assert( pOp->p4type==P4_FUNCDEF );
89695 n = pOp->p5;
@@ -89709,12 +89792,12 @@
89709 assert( OP_PureFunc == OP_PureFunc0+2 );
89710 assert( OP_Function == OP_Function0+2 );
89711 pOp->opcode += 2;
89712 /* Fall through into OP_Function */
89713 }
89714 case OP_PureFunc:
89715 case OP_Function: {
89716 int i;
89717 sqlite3_context *pCtx;
89718
89719 assert( pOp->p4type==P4_FUNCCTX );
89720 pCtx = pOp->p4.pCtx;
@@ -89895,38 +89978,10 @@
89895 */
89896 case OP_Abortable: {
89897 sqlite3VdbeAssertAbortable(p);
89898 break;
89899 }
89900 #endif
89901
89902 #ifdef SQLITE_DEBUG_COLUMNCACHE
89903 /* Opcode: SetTabCol P1 P2 P3 * *
89904 **
89905 ** Set a flag in register REG[P3] indicating that it holds the value
89906 ** of column P2 from the table on cursor P1. This flag is checked
89907 ** by a subsequent VerifyTabCol opcode.
89908 **
89909 ** This opcode only appears SQLITE_DEBUG builds. It is used to verify
89910 ** that the expression table column cache is working correctly.
89911 */
89912 case OP_SetTabCol: {
89913 aMem[pOp->p3].iTabColHash = TableColumnHash(pOp->p1,pOp->p2);
89914 break;
89915 }
89916 /* Opcode: VerifyTabCol P1 P2 P3 * *
89917 **
89918 ** Verify that register REG[P3] contains the value of column P2 from
89919 ** cursor P1. Assert() if this is not the case.
89920 **
89921 ** This opcode only appears SQLITE_DEBUG builds. It is used to verify
89922 ** that the expression table column cache is working correctly.
89923 */
89924 case OP_VerifyTabCol: {
89925 assert( aMem[pOp->p3].iTabColHash == TableColumnHash(pOp->p1,pOp->p2) );
89926 break;
89927 }
89928 #endif
89929
89930 /* Opcode: Noop * * * * *
89931 **
89932 ** Do nothing. This instruction is often useful as a jump
@@ -95712,18 +95767,10 @@
95712 CollSeq *pColl = 0;
95713 Expr *p = pExpr;
95714 while( p ){
95715 int op = p->op;
95716 if( p->flags & EP_Generic ) break;
95717 if( op==TK_CAST || op==TK_UPLUS ){
95718 p = p->pLeft;
95719 continue;
95720 }
95721 if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
95722 pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
95723 break;
95724 }
95725 if( (op==TK_AGG_COLUMN || op==TK_COLUMN
95726 || op==TK_REGISTER || op==TK_TRIGGER)
95727 && p->pTab!=0
95728 ){
95729 /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally
@@ -95732,10 +95779,18 @@
95732 if( j>=0 ){
95733 const char *zColl = p->pTab->aCol[j].zColl;
95734 pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0);
95735 }
95736 break;
 
 
 
 
 
 
 
 
95737 }
95738 if( p->flags & EP_Collate ){
95739 if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
95740 p = p->pLeft;
95741 }else{
@@ -96152,11 +96207,10 @@
96152 for(i=0; 1 /*Loop exits by "break"*/; i++){
96153 int regFree1 = 0, regFree2 = 0;
96154 Expr *pL, *pR;
96155 int r1, r2;
96156 assert( i>=0 && i<nLeft );
96157 if( i>0 ) sqlite3ExprCachePush(pParse);
96158 r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, &regFree1);
96159 r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, &regFree2);
96160 codeCompare(pParse, pL, pR, opx, r1, r2, dest, p5);
96161 testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
96162 testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);
@@ -96164,11 +96218,10 @@
96164 testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge);
96165 testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq);
96166 testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne);
96167 sqlite3ReleaseTempReg(pParse, regFree1);
96168 sqlite3ReleaseTempReg(pParse, regFree2);
96169 if( i>0 ) sqlite3ExprCachePop(pParse);
96170 if( i==nLeft-1 ){
96171 break;
96172 }
96173 if( opx==TK_EQ ){
96174 sqlite3VdbeAddOp2(v, OP_IfNot, dest, addrDone); VdbeCoverage(v);
@@ -96512,23 +96565,32 @@
96512
96513 /*
96514 ** Construct a new expression node for a function with multiple
96515 ** arguments.
96516 */
96517 SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){
 
 
 
 
 
96518 Expr *pNew;
96519 sqlite3 *db = pParse->db;
96520 assert( pToken );
96521 pNew = sqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1);
96522 if( pNew==0 ){
96523 sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */
96524 return 0;
96525 }
 
 
 
96526 pNew->x.pList = pList;
96527 ExprSetProperty(pNew, EP_HasFunc);
96528 assert( !ExprHasProperty(pNew, EP_xIsSelect) );
96529 sqlite3ExprSetHeightAndFlags(pParse, pNew);
 
96530 return pNew;
96531 }
96532
96533 /*
96534 ** Assign a variable number to an expression that encodes a wildcard
@@ -97410,10 +97472,13 @@
97410 case TK_AGG_COLUMN:
97411 testcase( pExpr->op==TK_ID );
97412 testcase( pExpr->op==TK_COLUMN );
97413 testcase( pExpr->op==TK_AGG_FUNCTION );
97414 testcase( pExpr->op==TK_AGG_COLUMN );
 
 
 
97415 if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){
97416 return WRC_Continue;
97417 }
97418 /* Fall through */
97419 case TK_IF_NULL_ROW:
@@ -97465,14 +97530,21 @@
97465 SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){
97466 return exprIsConst(p, 1, 0);
97467 }
97468
97469 /*
97470 ** Walk an expression tree. Return non-zero if the expression is constant
97471 ** that does no originate from the ON or USING clauses of a join.
97472 ** Return 0 if it involves variables or function calls or terms from
97473 ** an ON or USING clause.
 
 
 
 
 
 
 
97474 */
97475 SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){
97476 return exprIsConst(p, 2, 0);
97477 }
97478
@@ -97498,11 +97570,11 @@
97498 ** it constant. */
97499 for(i=0; i<pGroupBy->nExpr; i++){
97500 Expr *p = pGroupBy->a[i].pExpr;
97501 if( sqlite3ExprCompare(0, pExpr, p, -1)<2 ){
97502 CollSeq *pColl = sqlite3ExprNNCollSeq(pWalker->pParse, p);
97503 if( sqlite3_stricmp("BINARY", pColl->zName)==0 ){
97504 return WRC_Prune;
97505 }
97506 }
97507 }
97508
@@ -97920,11 +97992,12 @@
97920 int iAddr = sqlite3VdbeAddOp0(v, OP_Once);
97921 VdbeCoverage(v);
97922
97923 sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
97924 eType = IN_INDEX_ROWID;
97925
 
97926 sqlite3VdbeJumpHere(v, iAddr);
97927 }else{
97928 Index *pIdx; /* Iterator variable */
97929 int affinity_ok = 1;
97930 int i;
@@ -98179,11 +98252,10 @@
98179 ){
98180 int jmpIfDynamic = -1; /* One-time test address */
98181 int rReg = 0; /* Register storing resulting */
98182 Vdbe *v = sqlite3GetVdbe(pParse);
98183 if( NEVER(v==0) ) return 0;
98184 sqlite3ExprCachePush(pParse);
98185
98186 /* The evaluation of the IN/EXISTS/SELECT must be repeated every time it
98187 ** is encountered if any of the following is true:
98188 **
98189 ** * The right-hand side is a correlated subquery
@@ -98315,11 +98387,10 @@
98315 sqlite3VdbeCurrentAddr(v)+2);
98316 VdbeCoverage(v);
98317 sqlite3VdbeAddOp3(v, OP_Insert, pExpr->iTable, r2, r3);
98318 }else{
98319 sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
98320 sqlite3ExprCacheAffinityChange(pParse, r3, 1);
98321 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pExpr->iTable, r2, r3, 1);
98322 }
98323 }
98324 }
98325 sqlite3ReleaseTempReg(pParse, r1);
@@ -98396,11 +98467,10 @@
98396 }
98397
98398 if( jmpIfDynamic>=0 ){
98399 sqlite3VdbeJumpHere(v, jmpIfDynamic);
98400 }
98401 sqlite3ExprCachePop(pParse);
98402
98403 return rReg;
98404 }
98405 #endif /* SQLITE_OMIT_SUBQUERY */
98406
@@ -98515,11 +98585,10 @@
98515 ** sqlite3FindInIndex() might have reordered the fields of the LHS vector
98516 ** so that the fields are in the same order as an existing index. The
98517 ** aiMap[] array contains a mapping from the original LHS field order to
98518 ** the field order that matches the RHS index.
98519 */
98520 sqlite3ExprCachePush(pParse);
98521 rLhsOrig = exprCodeVector(pParse, pLeft, &iDummy);
98522 for(i=0; i<nVector && aiMap[i]==i; i++){} /* Are LHS fields reordered? */
98523 if( i==nVector ){
98524 /* LHS fields are not reordered */
98525 rLhs = rLhsOrig;
@@ -98674,11 +98743,10 @@
98674 /* Jumps here in order to return true. */
98675 sqlite3VdbeJumpHere(v, addrTruthOp);
98676
98677 sqlite3ExprCodeIN_finished:
98678 if( rLhs!=rLhsOrig ) sqlite3ReleaseTempReg(pParse, rLhs);
98679 sqlite3ExprCachePop(pParse);
98680 VdbeComment((v, "end IN expr"));
98681 sqlite3ExprCodeIN_oom_error:
98682 sqlite3DbFree(pParse->db, aiMap);
98683 sqlite3DbFree(pParse->db, zAff);
98684 }
@@ -98742,156 +98810,10 @@
98742 sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, iMem, 0, (u8*)&value, P4_INT64);
98743 }
98744 }
98745 }
98746
98747 /*
98748 ** Erase column-cache entry number i
98749 */
98750 static void cacheEntryClear(Parse *pParse, int i){
98751 if( pParse->aColCache[i].tempReg ){
98752 if( pParse->nTempReg<ArraySize(pParse->aTempReg) ){
98753 pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;
98754 }
98755 }
98756 pParse->nColCache--;
98757 if( i<pParse->nColCache ){
98758 pParse->aColCache[i] = pParse->aColCache[pParse->nColCache];
98759 }
98760 }
98761
98762
98763 /*
98764 ** Record in the column cache that a particular column from a
98765 ** particular table is stored in a particular register.
98766 */
98767 SQLITE_PRIVATE void sqlite3ExprCacheStore(Parse *pParse, int iTab, int iCol, int iReg){
98768 int i;
98769 int minLru;
98770 int idxLru;
98771 struct yColCache *p;
98772
98773 /* Unless an error has occurred, register numbers are always positive. */
98774 assert( iReg>0 || pParse->nErr || pParse->db->mallocFailed );
98775 assert( iCol>=-1 && iCol<32768 ); /* Finite column numbers */
98776
98777 /* The SQLITE_ColumnCache flag disables the column cache. This is used
98778 ** for testing only - to verify that SQLite always gets the same answer
98779 ** with and without the column cache.
98780 */
98781 if( OptimizationDisabled(pParse->db, SQLITE_ColumnCache) ) return;
98782
98783 /* First replace any existing entry.
98784 **
98785 ** Actually, the way the column cache is currently used, we are guaranteed
98786 ** that the object will never already be in cache. Verify this guarantee.
98787 */
98788 #ifndef NDEBUG
98789 for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
98790 assert( p->iTable!=iTab || p->iColumn!=iCol );
98791 }
98792 #endif
98793
98794 #ifdef SQLITE_DEBUG_COLUMNCACHE
98795 /* Add a SetTabCol opcode for run-time verification that the column
98796 ** cache is working correctly.
98797 */
98798 sqlite3VdbeAddOp3(pParse->pVdbe, OP_SetTabCol, iTab, iCol, iReg);
98799 #endif
98800
98801 /* If the cache is already full, delete the least recently used entry */
98802 if( pParse->nColCache>=SQLITE_N_COLCACHE ){
98803 minLru = 0x7fffffff;
98804 idxLru = -1;
98805 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
98806 if( p->lru<minLru ){
98807 idxLru = i;
98808 minLru = p->lru;
98809 }
98810 }
98811 p = &pParse->aColCache[idxLru];
98812 }else{
98813 p = &pParse->aColCache[pParse->nColCache++];
98814 }
98815
98816 /* Add the new entry to the end of the cache */
98817 p->iLevel = pParse->iCacheLevel;
98818 p->iTable = iTab;
98819 p->iColumn = iCol;
98820 p->iReg = iReg;
98821 p->tempReg = 0;
98822 p->lru = pParse->iCacheCnt++;
98823 }
98824
98825 /*
98826 ** Indicate that registers between iReg..iReg+nReg-1 are being overwritten.
98827 ** Purge the range of registers from the column cache.
98828 */
98829 SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse *pParse, int iReg, int nReg){
98830 int i = 0;
98831 while( i<pParse->nColCache ){
98832 struct yColCache *p = &pParse->aColCache[i];
98833 if( p->iReg >= iReg && p->iReg < iReg+nReg ){
98834 cacheEntryClear(pParse, i);
98835 }else{
98836 i++;
98837 }
98838 }
98839 }
98840
98841 /*
98842 ** Remember the current column cache context. Any new entries added
98843 ** added to the column cache after this call are removed when the
98844 ** corresponding pop occurs.
98845 */
98846 SQLITE_PRIVATE void sqlite3ExprCachePush(Parse *pParse){
98847 pParse->iCacheLevel++;
98848 #ifdef SQLITE_DEBUG
98849 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
98850 printf("PUSH to %d\n", pParse->iCacheLevel);
98851 }
98852 #endif
98853 }
98854
98855 /*
98856 ** Remove from the column cache any entries that were added since the
98857 ** the previous sqlite3ExprCachePush operation. In other words, restore
98858 ** the cache to the state it was in prior the most recent Push.
98859 */
98860 SQLITE_PRIVATE void sqlite3ExprCachePop(Parse *pParse){
98861 int i = 0;
98862 assert( pParse->iCacheLevel>=1 );
98863 pParse->iCacheLevel--;
98864 #ifdef SQLITE_DEBUG
98865 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
98866 printf("POP to %d\n", pParse->iCacheLevel);
98867 }
98868 #endif
98869 while( i<pParse->nColCache ){
98870 if( pParse->aColCache[i].iLevel>pParse->iCacheLevel ){
98871 cacheEntryClear(pParse, i);
98872 }else{
98873 i++;
98874 }
98875 }
98876 }
98877
98878 /*
98879 ** When a cached column is reused, make sure that its register is
98880 ** no longer available as a temp register. ticket #3879: that same
98881 ** register might be in the cache in multiple places, so be sure to
98882 ** get them all.
98883 */
98884 static void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){
98885 int i;
98886 struct yColCache *p;
98887 for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
98888 if( p->iReg==iReg ){
98889 p->tempReg = 0;
98890 }
98891 }
98892 }
98893
98894 /* Generate code that will load into register regOut a value that is
98895 ** appropriate for the iIdxCol-th column of index pIdx.
98896 */
98897 SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(
@@ -98943,16 +98865,11 @@
98943 }
98944 }
98945
98946 /*
98947 ** Generate code that will extract the iColumn-th column from
98948 ** table pTab and store the column value in a register.
98949 **
98950 ** An effort is made to store the column value in register iReg. This
98951 ** is not garanteeed for GetColumn() - the result can be stored in
98952 ** any register. But the result is guaranteed to land in register iReg
98953 ** for GetColumnToReg().
98954 **
98955 ** There must be an open cursor to pTab in iTable when this routine
98956 ** is called. If iColumn<0 then code is generated that extracts the rowid.
98957 */
98958 SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(
@@ -98962,102 +98879,26 @@
98962 int iTable, /* The cursor pointing to the table */
98963 int iReg, /* Store results here */
98964 u8 p5 /* P5 value for OP_Column + FLAGS */
98965 ){
98966 Vdbe *v = pParse->pVdbe;
98967 int i;
98968 struct yColCache *p;
98969
98970 for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
98971 if( p->iTable==iTable && p->iColumn==iColumn ){
98972 p->lru = pParse->iCacheCnt++;
98973 sqlite3ExprCachePinRegister(pParse, p->iReg);
98974 #ifdef SQLITE_DEBUG_COLUMNCACHE
98975 sqlite3VdbeAddOp3(v, OP_VerifyTabCol, iTable, iColumn, p->iReg);
98976 #endif
98977 return p->iReg;
98978 }
98979 }
98980 assert( v!=0 );
98981 sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg);
98982 if( p5 ){
98983 sqlite3VdbeChangeP5(v, p5);
98984 }else{
98985 sqlite3ExprCacheStore(pParse, iTable, iColumn, iReg);
98986 }
98987 return iReg;
98988 }
98989 SQLITE_PRIVATE void sqlite3ExprCodeGetColumnToReg(
98990 Parse *pParse, /* Parsing and code generating context */
98991 Table *pTab, /* Description of the table we are reading from */
98992 int iColumn, /* Index of the table column */
98993 int iTable, /* The cursor pointing to the table */
98994 int iReg /* Store results here */
98995 ){
98996 int r1 = sqlite3ExprCodeGetColumn(pParse, pTab, iColumn, iTable, iReg, 0);
98997 if( r1!=iReg ) sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, r1, iReg);
98998 }
98999
99000
99001 /*
99002 ** Clear all column cache entries.
99003 */
99004 SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
99005 int i;
99006
99007 #ifdef SQLITE_DEBUG
99008 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
99009 printf("CLEAR\n");
99010 }
99011 #endif
99012 for(i=0; i<pParse->nColCache; i++){
99013 if( pParse->aColCache[i].tempReg
99014 && pParse->nTempReg<ArraySize(pParse->aTempReg)
99015 ){
99016 pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;
99017 }
99018 }
99019 pParse->nColCache = 0;
99020 }
99021
99022 /*
99023 ** Record the fact that an affinity change has occurred on iCount
99024 ** registers starting with iStart.
99025 */
99026 SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse *pParse, int iStart, int iCount){
99027 sqlite3ExprCacheRemove(pParse, iStart, iCount);
99028 }
99029
99030 /*
99031 ** Generate code to move content from registers iFrom...iFrom+nReg-1
99032 ** over to iTo..iTo+nReg-1. Keep the column cache up-to-date.
99033 */
99034 SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){
99035 assert( iFrom>=iTo+nReg || iFrom+nReg<=iTo );
99036 sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg);
99037 sqlite3ExprCacheRemove(pParse, iFrom, nReg);
99038 }
99039
99040 #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
99041 /*
99042 ** Return true if any register in the range iFrom..iTo (inclusive)
99043 ** is used as part of the column cache.
99044 **
99045 ** This routine is used within assert() and testcase() macros only
99046 ** and does not appear in a normal build.
99047 */
99048 static int usedAsColumnCache(Parse *pParse, int iFrom, int iTo){
99049 int i;
99050 struct yColCache *p;
99051 for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
99052 int r = p->iReg;
99053 if( r>=iFrom && r<=iTo ) return 1; /*NO_TEST*/
99054 }
99055 return 0;
99056 }
99057 #endif /* SQLITE_DEBUG || SQLITE_COVERAGE_TEST */
99058
99059
99060 /*
99061 ** Convert a scalar expression node to a TK_REGISTER referencing
99062 ** register iReg. The caller must ensure that iReg already contains
99063 ** the correct value for the expression.
@@ -99152,10 +98993,32 @@
99152 }
99153 /* Otherwise, fall thru into the TK_COLUMN case */
99154 }
99155 case TK_COLUMN: {
99156 int iTab = pExpr->iTable;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99157 if( iTab<0 ){
99158 if( pParse->iSelfTab<0 ){
99159 /* Generating CHECK constraints or inserting into partial index */
99160 return pExpr->iColumn - pParse->iSelfTab;
99161 }else{
@@ -99232,12 +99095,10 @@
99232 sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
99233 inReg = target;
99234 }
99235 sqlite3VdbeAddOp2(v, OP_Cast, target,
99236 sqlite3AffinityType(pExpr->u.zToken, 0));
99237 testcase( usedAsColumnCache(pParse, inReg, inReg) );
99238 sqlite3ExprCacheAffinityChange(pParse, inReg, 1);
99239 return inReg;
99240 }
99241 #endif /* SQLITE_OMIT_CAST */
99242 case TK_IS:
99243 case TK_ISNOT:
@@ -99419,14 +99280,11 @@
99419 assert( nFarg>=2 );
99420 sqlite3ExprCode(pParse, pFarg->a[0].pExpr, target);
99421 for(i=1; i<nFarg; i++){
99422 sqlite3VdbeAddOp2(v, OP_NotNull, target, endCoalesce);
99423 VdbeCoverage(v);
99424 sqlite3ExprCacheRemove(pParse, target, 1);
99425 sqlite3ExprCachePush(pParse);
99426 sqlite3ExprCode(pParse, pFarg->a[i].pExpr, target);
99427 sqlite3ExprCachePop(pParse);
99428 }
99429 sqlite3VdbeResolveLabel(v, endCoalesce);
99430 break;
99431 }
99432
@@ -99488,14 +99346,12 @@
99488 pFarg->a[0].pExpr->op2 =
99489 pDef->funcFlags & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG);
99490 }
99491 }
99492
99493 sqlite3ExprCachePush(pParse); /* Ticket 2ea2425d34be */
99494 sqlite3ExprCodeExprList(pParse, pFarg, r1, 0,
99495 SQLITE_ECEL_DUP|SQLITE_ECEL_FACTOR);
99496 sqlite3ExprCachePop(pParse); /* Ticket 2ea2425d34be */
99497 }else{
99498 r1 = 0;
99499 }
99500 #ifndef SQLITE_OMIT_VIRTUALTABLE
99501 /* Possibly overload the function if the first argument is
@@ -99664,13 +99520,11 @@
99664 }
99665
99666 case TK_IF_NULL_ROW: {
99667 int addrINR;
99668 addrINR = sqlite3VdbeAddOp1(v, OP_IfNullRow, pExpr->iTable);
99669 sqlite3ExprCachePush(pParse);
99670 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
99671 sqlite3ExprCachePop(pParse);
99672 sqlite3VdbeJumpHere(v, addrINR);
99673 sqlite3VdbeChangeP3(v, addrINR, inReg);
99674 break;
99675 }
99676
@@ -99703,11 +99557,10 @@
99703 ExprList *pEList; /* List of WHEN terms */
99704 struct ExprList_item *aListelem; /* Array of WHEN terms */
99705 Expr opCompare; /* The X==Ei expression */
99706 Expr *pX; /* The X expression */
99707 Expr *pTest = 0; /* X==Ei (form A) or just Ei (form B) */
99708 VVA_ONLY( int iCacheLevel = pParse->iCacheLevel; )
99709
99710 assert( !ExprHasProperty(pExpr, EP_xIsSelect) && pExpr->x.pList );
99711 assert(pExpr->x.pList->nExpr > 0);
99712 pEList = pExpr->x.pList;
99713 aListelem = pEList->a;
@@ -99727,11 +99580,10 @@
99727 ** So make sure that the regFree1 register is not reused for other
99728 ** purposes and possibly overwritten. */
99729 regFree1 = 0;
99730 }
99731 for(i=0; i<nExpr-1; i=i+2){
99732 sqlite3ExprCachePush(pParse);
99733 if( pX ){
99734 assert( pTest!=0 );
99735 opCompare.pRight = aListelem[i].pExpr;
99736 }else{
99737 pTest = aListelem[i].pExpr;
@@ -99740,22 +99592,17 @@
99740 testcase( pTest->op==TK_COLUMN );
99741 sqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL);
99742 testcase( aListelem[i+1].pExpr->op==TK_COLUMN );
99743 sqlite3ExprCode(pParse, aListelem[i+1].pExpr, target);
99744 sqlite3VdbeGoto(v, endLabel);
99745 sqlite3ExprCachePop(pParse);
99746 sqlite3VdbeResolveLabel(v, nextCase);
99747 }
99748 if( (nExpr&1)!=0 ){
99749 sqlite3ExprCachePush(pParse);
99750 sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target);
99751 sqlite3ExprCachePop(pParse);
99752 }else{
99753 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
99754 }
99755 assert( pParse->db->mallocFailed || pParse->nErr>0
99756 || pParse->iCacheLevel==iCacheLevel );
99757 sqlite3VdbeResolveLabel(v, endLabel);
99758 break;
99759 }
99760 #ifndef SQLITE_OMIT_TRIGGER
99761 case TK_RAISE: {
@@ -99901,11 +99748,11 @@
99901 ** results in register target. The results are guaranteed to appear
99902 ** in register target. If the expression is constant, then this routine
99903 ** might choose to code the expression at initialization time.
99904 */
99905 SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){
99906 if( pParse->okConstFactor && sqlite3ExprIsConstant(pExpr) ){
99907 sqlite3ExprCodeAtInit(pParse, pExpr, target);
99908 }else{
99909 sqlite3ExprCode(pParse, pExpr, target);
99910 }
99911 }
@@ -99983,11 +99830,13 @@
99983 i--;
99984 n--;
99985 }else{
99986 sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i);
99987 }
99988 }else if( (flags & SQLITE_ECEL_FACTOR)!=0 && sqlite3ExprIsConstant(pExpr) ){
 
 
99989 sqlite3ExprCodeAtInit(pParse, pExpr, target+i);
99990 }else{
99991 int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);
99992 if( inReg!=target+i ){
99993 VdbeOp *pOp;
@@ -100109,22 +99958,18 @@
100109 switch( op ){
100110 case TK_AND: {
100111 int d2 = sqlite3VdbeMakeLabel(v);
100112 testcase( jumpIfNull==0 );
100113 sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL);
100114 sqlite3ExprCachePush(pParse);
100115 sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
100116 sqlite3VdbeResolveLabel(v, d2);
100117 sqlite3ExprCachePop(pParse);
100118 break;
100119 }
100120 case TK_OR: {
100121 testcase( jumpIfNull==0 );
100122 sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
100123 sqlite3ExprCachePush(pParse);
100124 sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
100125 sqlite3ExprCachePop(pParse);
100126 break;
100127 }
100128 case TK_NOT: {
100129 testcase( jumpIfNull==0 );
100130 sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
@@ -100279,23 +100124,19 @@
100279
100280 switch( pExpr->op ){
100281 case TK_AND: {
100282 testcase( jumpIfNull==0 );
100283 sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
100284 sqlite3ExprCachePush(pParse);
100285 sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
100286 sqlite3ExprCachePop(pParse);
100287 break;
100288 }
100289 case TK_OR: {
100290 int d2 = sqlite3VdbeMakeLabel(v);
100291 testcase( jumpIfNull==0 );
100292 sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL);
100293 sqlite3ExprCachePush(pParse);
100294 sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
100295 sqlite3VdbeResolveLabel(v, d2);
100296 sqlite3ExprCachePop(pParse);
100297 break;
100298 }
100299 case TK_NOT: {
100300 testcase( jumpIfNull==0 );
100301 sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
@@ -100513,11 +100354,12 @@
100513 }
100514 }
100515 if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;
100516 if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){
100517 if( combinedFlags & EP_xIsSelect ) return 2;
100518 if( sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2;
 
100519 if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2;
100520 if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
100521 assert( (combinedFlags & EP_Reduced)==0 );
100522 if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){
100523 if( pA->iColumn!=pB->iColumn ) return 2;
@@ -101058,25 +100900,13 @@
101058 }
101059
101060 /*
101061 ** Deallocate a register, making available for reuse for some other
101062 ** purpose.
101063 **
101064 ** If a register is currently being used by the column cache, then
101065 ** the deallocation is deferred until the column cache line that uses
101066 ** the register becomes stale.
101067 */
101068 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
101069 if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
101070 int i;
101071 struct yColCache *p;
101072 for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
101073 if( p->iReg==iReg ){
101074 p->tempReg = 1;
101075 return;
101076 }
101077 }
101078 pParse->aTempReg[pParse->nTempReg++] = iReg;
101079 }
101080 }
101081
101082 /*
@@ -101086,11 +100916,10 @@
101086 int i, n;
101087 if( nReg==1 ) return sqlite3GetTempReg(pParse);
101088 i = pParse->iRangeReg;
101089 n = pParse->nRangeReg;
101090 if( nReg<=n ){
101091 assert( !usedAsColumnCache(pParse, i, i+n-1) );
101092 pParse->iRangeReg += nReg;
101093 pParse->nRangeReg -= nReg;
101094 }else{
101095 i = pParse->nMem+1;
101096 pParse->nMem += nReg;
@@ -101100,11 +100929,10 @@
101100 SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){
101101 if( nReg==1 ){
101102 sqlite3ReleaseTempReg(pParse, iReg);
101103 return;
101104 }
101105 sqlite3ExprCacheRemove(pParse, iReg, nReg);
101106 if( nReg>pParse->nRangeReg ){
101107 pParse->nRangeReg = nReg;
101108 pParse->iRangeReg = iReg;
101109 }
101110 }
@@ -105020,11 +104848,10 @@
105020
105021
105022 /* Get the VDBE program ready for execution
105023 */
105024 if( v && pParse->nErr==0 && !db->mallocFailed ){
105025 assert( pParse->iCacheLevel==0 ); /* Disables and re-enables match */
105026 /* A minimum of one cursor is required if autoincrement is used
105027 * See ticket [a696379c1f08866] */
105028 if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1;
105029 sqlite3VdbeMakeReady(v, pParse);
105030 pParse->rc = SQLITE_DONE;
@@ -107457,12 +107284,14 @@
107457 ** on disk.
107458 */
107459 v = sqlite3GetVdbe(pParse);
107460 if( v ){
107461 sqlite3BeginWriteOperation(pParse, 1, iDb);
107462 sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName);
107463 sqlite3FkDropTable(pParse, pName, pTab);
 
 
107464 sqlite3CodeDropTable(pParse, pTab, iDb, isView);
107465 }
107466
107467 exit_drop_table:
107468 sqlite3SrcListDelete(db, pName);
@@ -110279,13 +110108,12 @@
110279 sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur,
110280 pPk->aiColumn[i], iPk+i);
110281 }
110282 iKey = iPk;
110283 }else{
110284 iKey = pParse->nMem + 1;
110285 iKey = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iTabCur, iKey, 0);
110286 if( iKey>pParse->nMem ) pParse->nMem = iKey;
110287 }
110288
110289 if( eOnePass!=ONEPASS_OFF ){
110290 /* For ONEPASS, no need to store the rowid/primary-key. There is only
110291 ** one, so just keep it in its register(s) and fall through to the
@@ -110714,11 +110542,10 @@
110714
110715 if( piPartIdxLabel ){
110716 if( pIdx->pPartIdxWhere ){
110717 *piPartIdxLabel = sqlite3VdbeMakeLabel(v);
110718 pParse->iSelfTab = iDataCur + 1;
110719 sqlite3ExprCachePush(pParse);
110720 sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel,
110721 SQLITE_JUMPIFNULL);
110722 pParse->iSelfTab = 0;
110723 }else{
110724 *piPartIdxLabel = 0;
@@ -110761,11 +110588,10 @@
110761 ** resolve that label.
110762 */
110763 SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel){
110764 if( iLabel ){
110765 sqlite3VdbeResolveLabel(pParse->pVdbe, iLabel);
110766 sqlite3ExprCachePop(pParse);
110767 }
110768 }
110769
110770 /************** End of delete.c **********************************************/
110771 /************** Begin file func.c ********************************************/
@@ -113500,15 +113326,16 @@
113500 ** the table from the database. Triggers are disabled while running this
113501 ** DELETE, but foreign key actions are not.
113502 */
113503 SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){
113504 sqlite3 *db = pParse->db;
113505 if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) && !pTab->pSelect ){
113506 int iSkip = 0;
113507 Vdbe *v = sqlite3GetVdbe(pParse);
113508
113509 assert( v ); /* VDBE has already been allocated */
 
113510 if( sqlite3FkReferences(pTab)==0 ){
113511 /* Search for a deferred foreign key constraint for which this table
113512 ** is the child table. If one cannot be found, return without
113513 ** generating any VDBE code. If one can be found, then jump over
113514 ** the entire DELETE if there are no outstanding deferred constraints
@@ -115399,48 +115226,10 @@
115399 testcase( w.eCode==CKCNSTRNT_ROWID );
115400 testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
115401 return !w.eCode;
115402 }
115403
115404 /*
115405 ** An instance of the ConstraintAddr object remembers the byte-code addresses
115406 ** for sections of the constraint checks that deal with uniqueness constraints
115407 ** on the rowid and on the upsert constraint.
115408 **
115409 ** This information is passed into checkReorderConstraintChecks() to insert
115410 ** some OP_Goto operations so that the rowid and upsert constraints occur
115411 ** in the correct order relative to other constraints.
115412 */
115413 typedef struct ConstraintAddr ConstraintAddr;
115414 struct ConstraintAddr {
115415 int ipkTop; /* Subroutine for rowid constraint check */
115416 int upsertTop; /* Label for upsert constraint check subroutine */
115417 int upsertTop2; /* Copy of upsertTop not cleared by the call */
115418 int upsertBtm; /* upsert constraint returns to this label */
115419 int ipkBtm; /* Return opcode rowid constraint check */
115420 };
115421
115422 /*
115423 ** Generate any OP_Goto operations needed to cause constraints to be
115424 ** run that haven't already been run.
115425 */
115426 static void reorderConstraintChecks(Vdbe *v, ConstraintAddr *p){
115427 if( p->upsertTop ){
115428 testcase( sqlite3VdbeLabelHasBeenResolved(v, p->upsertTop) );
115429 sqlite3VdbeGoto(v, p->upsertTop);
115430 VdbeComment((v, "call upsert subroutine"));
115431 sqlite3VdbeResolveLabel(v, p->upsertBtm);
115432 p->upsertTop = 0;
115433 }
115434 if( p->ipkTop ){
115435 sqlite3VdbeGoto(v, p->ipkTop);
115436 VdbeComment((v, "call rowid unique-check subroutine"));
115437 sqlite3VdbeJumpHere(v, p->ipkBtm);
115438 p->ipkTop = 0;
115439 }
115440 }
115441
115442 /*
115443 ** Generate code to do constraint checks prior to an INSERT or an UPDATE
115444 ** on table pTab.
115445 **
115446 ** The regNewData parameter is the first register in a range that contains
@@ -115546,23 +115335,24 @@
115546 int nCol; /* Number of columns */
115547 int onError; /* Conflict resolution strategy */
115548 int addr1; /* Address of jump instruction */
115549 int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
115550 int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
115551 ConstraintAddr sAddr;/* Address information for constraint reordering */
115552 Index *pUpIdx = 0; /* Index to which to apply the upsert */
115553 u8 isUpdate; /* True if this is an UPDATE operation */
115554 u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */
115555 int upsertBypass = 0; /* Address of Goto to bypass upsert subroutine */
 
 
 
115556
115557 isUpdate = regOldData!=0;
115558 db = pParse->db;
115559 v = sqlite3GetVdbe(pParse);
115560 assert( v!=0 );
115561 assert( pTab->pSelect==0 ); /* This table is not a VIEW */
115562 nCol = pTab->nCol;
115563 memset(&sAddr, 0, sizeof(sAddr));
115564
115565 /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for
115566 ** normal rowid tables. nPkField is the number of key fields in the
115567 ** pPk index or 1 for a rowid table. In other words, nPkField is the
115568 ** number of fields in the true primary key of the table. */
@@ -115662,19 +115452,24 @@
115662 #endif /* !defined(SQLITE_OMIT_CHECK) */
115663
115664 /* UNIQUE and PRIMARY KEY constraints should be handled in the following
115665 ** order:
115666 **
115667 ** (1) OE_Abort, OE_Fail, OE_Rollback, OE_Ignore
115668 ** (2) OE_Update
115669 ** (3) OE_Replace
115670 **
115671 ** OE_Fail and OE_Ignore must happen before any changes are made.
115672 ** OE_Update guarantees that only a single row will change, so it
115673 ** must happen before OE_Replace. Technically, OE_Abort and OE_Rollback
115674 ** could happen in any order, but they are grouped up front for
115675 ** convenience.
 
 
 
 
 
115676 **
115677 ** Constraint checking code is generated in this order:
115678 ** (A) The rowid constraint
115679 ** (B) Unique index constraints that do not have OE_Replace as their
115680 ** default conflict resolution strategy
@@ -115691,15 +115486,14 @@
115691 ** Make all unique constraint resolution be OE_Ignore */
115692 assert( pUpsert->pUpsertSet==0 );
115693 overrideError = OE_Ignore;
115694 pUpsert = 0;
115695 }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){
115696 /* If the constraint-target is on some column other than
115697 ** then ROWID, then we might need to move the UPSERT around
115698 ** so that it occurs in the correct order. */
115699 sAddr.upsertTop = sAddr.upsertTop2 = sqlite3VdbeMakeLabel(v);
115700 sAddr.upsertBtm = sqlite3VdbeMakeLabel(v);
115701 }
115702 }
115703
115704 /* If rowid is changing, make sure the new rowid does not previously
115705 ** exist in the table.
@@ -115727,20 +115521,16 @@
115727 /* If the response to a rowid conflict is REPLACE but the response
115728 ** to some other UNIQUE constraint is FAIL or IGNORE, then we need
115729 ** to defer the running of the rowid conflict checking until after
115730 ** the UNIQUE constraints have run.
115731 */
115732 assert( OE_Update>OE_Replace );
115733 assert( OE_Ignore<OE_Replace );
115734 assert( OE_Fail<OE_Replace );
115735 assert( OE_Abort<OE_Replace );
115736 assert( OE_Rollback<OE_Replace );
115737 if( onError>=OE_Replace
115738 && (pUpsert || onError!=overrideError)
115739 && pTab->pIndex
115740 ){
115741 sAddr.ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
 
115742 }
115743
115744 if( isUpdate ){
115745 /* pkChng!=0 does not mean that the rowid has changed, only that
115746 ** it might have changed. Skip the conflict logic below if the rowid
@@ -115754,11 +115544,10 @@
115754 ** the following conflict logic if it does not. */
115755 VdbeNoopComment((v, "uniqueness check for ROWID"));
115756 sqlite3VdbeVerifyAbortable(v, onError);
115757 sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData);
115758 VdbeCoverage(v);
115759 sqlite3ExprCachePush(pParse);
115760
115761 switch( onError ){
115762 default: {
115763 onError = OE_Abort;
115764 /* Fall thru into the next case */
@@ -115831,15 +115620,14 @@
115831 testcase( onError==OE_Ignore );
115832 sqlite3VdbeGoto(v, ignoreDest);
115833 break;
115834 }
115835 }
115836 sqlite3ExprCachePop(pParse);
115837 sqlite3VdbeResolveLabel(v, addrRowidOk);
115838 if( sAddr.ipkTop ){
115839 sAddr.ipkBtm = sqlite3VdbeAddOp0(v, OP_Goto);
115840 sqlite3VdbeJumpHere(v, sAddr.ipkTop-1);
115841 }
115842 }
115843
115844 /* Test all UNIQUE constraints by creating entries for each UNIQUE
115845 ** index and making sure that duplicate entries do not already exist.
@@ -115853,21 +115641,21 @@
115853 int regR; /* Range of registers holding conflicting PK */
115854 int iThisCur; /* Cursor for this UNIQUE index */
115855 int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */
115856
115857 if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */
115858 if( bAffinityDone==0 ){
115859 sqlite3TableAffinity(v, pTab, regNewData+1);
115860 bAffinityDone = 1;
115861 }
115862 if( pUpIdx==pIdx ){
115863 addrUniqueOk = sAddr.upsertBtm;
115864 upsertBypass = sqlite3VdbeGoto(v, 0);
115865 VdbeComment((v, "Skip upsert subroutine"));
115866 sqlite3VdbeResolveLabel(v, sAddr.upsertTop2);
115867 }else{
115868 addrUniqueOk = sqlite3VdbeMakeLabel(v);
 
 
 
 
115869 }
115870 VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName));
115871 iThisCur = iIdxCur+ix;
115872
115873
@@ -115936,19 +115724,10 @@
115936 }else{
115937 onError = OE_Update; /* DO UPDATE */
115938 }
115939 }
115940
115941 /* Invoke subroutines to handle IPK replace and upsert prior to running
115942 ** the first REPLACE constraint check. */
115943 if( onError==OE_Replace ){
115944 testcase( sAddr.ipkTop );
115945 testcase( sAddr.upsertTop
115946 && sqlite3VdbeLabelHasBeenResolved(v,sAddr.upsertTop) );
115947 reorderConstraintChecks(v, &sAddr);
115948 }
115949
115950 /* Collision detection may be omitted if all of the following are true:
115951 ** (1) The conflict resolution algorithm is REPLACE
115952 ** (2) The table is a WITHOUT ROWID table
115953 ** (3) There are no secondary indexes on the table
115954 ** (4) No delete triggers need to be fired if there is a conflict
@@ -115965,11 +115744,10 @@
115965 sqlite3VdbeResolveLabel(v, addrUniqueOk);
115966 continue;
115967 }
115968
115969 /* Check to see if the new index entry will be unique */
115970 sqlite3ExprCachePush(pParse);
115971 sqlite3VdbeVerifyAbortable(v, onError);
115972 sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
115973 regIdx, pIdx->nKeyCol); VdbeCoverage(v);
115974
115975 /* Generate code to handle collisions */
@@ -116067,23 +115845,25 @@
116067 seenReplace = 1;
116068 break;
116069 }
116070 }
116071 if( pUpIdx==pIdx ){
 
116072 sqlite3VdbeJumpHere(v, upsertBypass);
116073 }else{
116074 sqlite3VdbeResolveLabel(v, addrUniqueOk);
116075 }
116076 sqlite3ExprCachePop(pParse);
116077 if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
 
116078
 
 
 
 
 
116079 }
116080 testcase( sAddr.ipkTop!=0 );
116081 testcase( sAddr.upsertTop
116082 && sqlite3VdbeLabelHasBeenResolved(v,sAddr.upsertTop) );
116083 reorderConstraintChecks(v, &sAddr);
116084
116085 *pbMayReplace = seenReplace;
116086 VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace));
116087 }
116088
116089 #ifdef SQLITE_ENABLE_NULL_TRIM
@@ -116175,11 +115955,10 @@
116175 regRec = sqlite3GetTempReg(pParse);
116176 sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);
116177 sqlite3SetMakeRecordP5(v, pTab);
116178 if( !bAffinityDone ){
116179 sqlite3TableAffinity(v, pTab, 0);
116180 sqlite3ExprCacheAffinityChange(pParse, regData, pTab->nCol);
116181 }
116182 if( pParse->nested ){
116183 pik_flags = 0;
116184 }else{
116185 pik_flags = OPFLAG_NCHANGE;
@@ -120462,11 +120241,10 @@
120462 int iDataCur, iIdxCur;
120463 int r1 = -1;
120464
120465 if( pTab->tnum<1 ) continue; /* Skip VIEWs or VIRTUAL TABLEs */
120466 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
120467 sqlite3ExprCacheClear(pParse);
120468 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0,
120469 1, 0, &iDataCur, &iIdxCur);
120470 /* reg[7] counts the number of entries in the table.
120471 ** reg[8+i] counts the number of entries in the i-th index
120472 */
@@ -120505,11 +120283,10 @@
120505 int addrCkFault = sqlite3VdbeMakeLabel(v);
120506 int addrCkOk = sqlite3VdbeMakeLabel(v);
120507 char *zErr;
120508 int k;
120509 pParse->iSelfTab = iDataCur + 1;
120510 sqlite3ExprCachePush(pParse);
120511 for(k=pCheck->nExpr-1; k>0; k--){
120512 sqlite3ExprIfFalse(pParse, pCheck->a[k].pExpr, addrCkFault, 0);
120513 }
120514 sqlite3ExprIfTrue(pParse, pCheck->a[0].pExpr, addrCkOk,
120515 SQLITE_JUMPIFNULL);
@@ -120518,11 +120295,10 @@
120518 zErr = sqlite3MPrintf(db, "CHECK constraint failed in %s",
120519 pTab->zName);
120520 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
120521 integrityCheckResultRow(v);
120522 sqlite3VdbeResolveLabel(v, addrCkOk);
120523 sqlite3ExprCachePop(pParse);
120524 }
120525 sqlite3ExprListDelete(db, pCheck);
120526 }
120527 if( !isQuick ){ /* Omit the remaining tests for quick_check */
120528 /* Validate index entries for the current row */
@@ -123463,11 +123239,10 @@
123463 }else{
123464 int r1 = sqlite3GetTempReg(pParse);
123465 assert( sqlite3Strlen30(pDest->zAffSdst)==nResultCol );
123466 sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, nResultCol,
123467 r1, pDest->zAffSdst, nResultCol);
123468 sqlite3ExprCacheAffinityChange(pParse, regResult, nResultCol);
123469 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, regResult, nResultCol);
123470 sqlite3ReleaseTempReg(pParse, r1);
123471 }
123472 break;
123473 }
@@ -123507,11 +123282,10 @@
123507 nPrefixReg);
123508 }else if( eDest==SRT_Coroutine ){
123509 sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm);
123510 }else{
123511 sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nResultCol);
123512 sqlite3ExprCacheAffinityChange(pParse, regResult, nResultCol);
123513 }
123514 break;
123515 }
123516
123517 #ifndef SQLITE_OMIT_CTE
@@ -123864,11 +123638,10 @@
123864 #ifndef SQLITE_OMIT_SUBQUERY
123865 case SRT_Set: {
123866 assert( nColumn==sqlite3Strlen30(pDest->zAffSdst) );
123867 sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, nColumn, regRowid,
123868 pDest->zAffSdst, nColumn);
123869 sqlite3ExprCacheAffinityChange(pParse, regRow, nColumn);
123870 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, regRowid, regRow, nColumn);
123871 break;
123872 }
123873 case SRT_Mem: {
123874 /* The LIMIT clause will terminate the loop for us */
@@ -123879,11 +123652,10 @@
123879 assert( eDest==SRT_Output || eDest==SRT_Coroutine );
123880 testcase( eDest==SRT_Output );
123881 testcase( eDest==SRT_Coroutine );
123882 if( eDest==SRT_Output ){
123883 sqlite3VdbeAddOp2(v, OP_ResultRow, pDest->iSdst, nColumn);
123884 sqlite3ExprCacheAffinityChange(pParse, pDest->iSdst, nColumn);
123885 }else{
123886 sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm);
123887 }
123888 break;
123889 }
@@ -124480,11 +124252,10 @@
124480 ** "LIMIT -1" always shows all rows. There is some
124481 ** controversy about what the correct behavior should be.
124482 ** The current implementation interprets "LIMIT 0" to mean
124483 ** no rows.
124484 */
124485 sqlite3ExprCacheClear(pParse);
124486 if( pLimit ){
124487 assert( pLimit->op==TK_LIMIT );
124488 assert( pLimit->pLeft!=0 );
124489 p->iLimit = iLimit = ++pParse->nMem;
124490 v = sqlite3GetVdbe(pParse);
@@ -125266,11 +125037,10 @@
125266 int r1;
125267 testcase( pIn->nSdst>1 );
125268 r1 = sqlite3GetTempReg(pParse);
125269 sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst,
125270 r1, pDest->zAffSdst, pIn->nSdst);
125271 sqlite3ExprCacheAffinityChange(pParse, pIn->iSdst, pIn->nSdst);
125272 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pDest->iSDParm, r1,
125273 pIn->iSdst, pIn->nSdst);
125274 sqlite3ReleaseTempReg(pParse, r1);
125275 break;
125276 }
@@ -125309,11 +125079,10 @@
125309 ** return the next row of result.
125310 */
125311 default: {
125312 assert( pDest->eDest==SRT_Output );
125313 sqlite3VdbeAddOp2(v, OP_ResultRow, pIn->iSdst, pIn->nSdst);
125314 sqlite3ExprCacheAffinityChange(pParse, pIn->iSdst, pIn->nSdst);
125315 break;
125316 }
125317 }
125318
125319 /* Jump to the end of the loop if the LIMIT is reached.
@@ -125764,11 +125533,11 @@
125764 }else{
125765 Expr *pNew;
125766 Expr *pCopy = pSubst->pEList->a[pExpr->iColumn].pExpr;
125767 Expr ifNullRow;
125768 assert( pSubst->pEList!=0 && pExpr->iColumn<pSubst->pEList->nExpr );
125769 assert( pExpr->pLeft==0 && pExpr->pRight==0 );
125770 if( sqlite3ExprIsVector(pCopy) ){
125771 sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
125772 }else{
125773 sqlite3 *db = pSubst->pParse->db;
125774 if( pSubst->isLeftJoin && pCopy->op!=TK_COLUMN ){
@@ -126388,11 +126157,172 @@
126388
126389 return 1;
126390 }
126391 #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
126392
 
 
 
 
 
 
 
 
 
 
 
126393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126394
126395 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
126396 /*
126397 ** Make copies of relevant WHERE clause terms of the outer query into
126398 ** the WHERE clause of subquery. Example:
@@ -127489,40 +127419,25 @@
127489 sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ);
127490 }
127491 sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, pF->iMem);
127492 sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF);
127493 sqlite3VdbeChangeP5(v, (u8)nArg);
127494 sqlite3ExprCacheAffinityChange(pParse, regAgg, nArg);
127495 sqlite3ReleaseTempRange(pParse, regAgg, nArg);
127496 if( addrNext ){
127497 sqlite3VdbeResolveLabel(v, addrNext);
127498 sqlite3ExprCacheClear(pParse);
127499 }
127500 }
127501
127502 /* Before populating the accumulator registers, clear the column cache.
127503 ** Otherwise, if any of the required column values are already present
127504 ** in registers, sqlite3ExprCode() may use OP_SCopy to copy the value
127505 ** to pC->iMem. But by the time the value is used, the original register
127506 ** may have been used, invalidating the underlying buffer holding the
127507 ** text or blob value. See ticket [883034dcb5].
127508 **
127509 ** Another solution would be to change the OP_SCopy used to copy cached
127510 ** values to an OP_Copy.
127511 */
127512 if( regHit==0 && pAggInfo->nAccumulator ){
127513 regHit = regAcc;
127514 }
127515 if( regHit ){
127516 addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit); VdbeCoverage(v);
127517 }
127518 sqlite3ExprCacheClear(pParse);
127519 for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
127520 sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);
127521 }
127522 pAggInfo->directMode = 0;
127523 sqlite3ExprCacheClear(pParse);
127524 if( addrHitTest ){
127525 sqlite3VdbeJumpHere(v, addrHitTest);
127526 }
127527 }
127528
@@ -127648,10 +127563,11 @@
127648 ** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2)
127649 **
127650 ** The transformation only works if all of the following are true:
127651 **
127652 ** * The subquery is a UNION ALL of two or more terms
 
127653 ** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries
127654 ** * The outer query is a simple count(*)
127655 **
127656 ** Return TRUE if the optimization is undertaken.
127657 */
@@ -127671,10 +127587,11 @@
127671 if( pSub==0 ) return 0; /* The FROM is a subquery */
127672 if( pSub->pPrior==0 ) return 0; /* Must be a compound ry */
127673 do{
127674 if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
127675 if( pSub->pWhere ) return 0; /* No WHERE clause */
 
127676 if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
127677 pSub = pSub->pPrior; /* Repeat over compound */
127678 }while( pSub );
127679
127680 /* If we reach this point then it is OK to perform the transformation */
@@ -127912,10 +127829,39 @@
127912 #endif
127913 if( p->pNext==0 ) ExplainQueryPlanPop(pParse);
127914 return rc;
127915 }
127916 #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127917
127918 /* For each term in the FROM clause, do two things:
127919 ** (1) Authorized unreferenced tables
127920 ** (2) Generate code for all sub-queries
127921 */
@@ -127986,11 +127932,12 @@
127986 && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
127987 (pItem->fg.jointype & JT_OUTER)!=0)
127988 ){
127989 #if SELECTTRACE_ENABLED
127990 if( sqlite3SelectTrace & 0x100 ){
127991 SELECTTRACE(0x100,pParse,p,("After WHERE-clause push-down:\n"));
 
127992 sqlite3TreeViewSelect(0, p, 0);
127993 }
127994 #endif
127995 }else{
127996 SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));
@@ -128088,20 +128035,10 @@
128088 #if SELECTTRACE_ENABLED
128089 if( sqlite3SelectTrace & 0x400 ){
128090 SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
128091 sqlite3TreeViewSelect(0, p, 0);
128092 }
128093 #endif
128094
128095 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
128096 if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
128097 && countOfViewOptimization(pParse, p)
128098 ){
128099 if( db->mallocFailed ) goto select_end;
128100 pEList = p->pEList;
128101 pTabList = p->pSrc;
128102 }
128103 #endif
128104
128105 /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and
128106 ** if the select-list is the same as the ORDER BY list, then this query
128107 ** can be rewritten as a GROUP BY. In other words, this:
@@ -128449,19 +128386,18 @@
128449 nCol++;
128450 j++;
128451 }
128452 }
128453 regBase = sqlite3GetTempRange(pParse, nCol);
128454 sqlite3ExprCacheClear(pParse);
128455 sqlite3ExprCodeExprList(pParse, pGroupBy, regBase, 0, 0);
128456 j = nGroupBy;
128457 for(i=0; i<sAggInfo.nColumn; i++){
128458 struct AggInfo_col *pCol = &sAggInfo.aCol[i];
128459 if( pCol->iSorterColumn>=j ){
128460 int r1 = j + regBase;
128461 sqlite3ExprCodeGetColumnToReg(pParse,
128462 pCol->pTab, pCol->iColumn, pCol->iTable, r1);
128463 j++;
128464 }
128465 }
128466 regRecord = sqlite3GetTempReg(pParse);
128467 sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord);
@@ -128473,12 +128409,10 @@
128473 sortOut = sqlite3GetTempReg(pParse);
128474 sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol);
128475 sqlite3VdbeAddOp2(v, OP_SorterSort, sAggInfo.sortingIdx, addrEnd);
128476 VdbeComment((v, "GROUP BY sort")); VdbeCoverage(v);
128477 sAggInfo.useSortingIdx = 1;
128478 sqlite3ExprCacheClear(pParse);
128479
128480 }
128481
128482 /* If the index or temporary table used by the GROUP BY sort
128483 ** will naturally deliver rows in the order required by the ORDER BY
128484 ** clause, cancel the ephemeral table open coded earlier.
@@ -128497,11 +128431,10 @@
128497 ** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth)
128498 ** Then compare the current GROUP BY terms against the GROUP BY terms
128499 ** from the previous row currently stored in a0, a1, a2...
128500 */
128501 addrTopOfLoop = sqlite3VdbeCurrentAddr(v);
128502 sqlite3ExprCacheClear(pParse);
128503 if( groupBySort ){
128504 sqlite3VdbeAddOp3(v, OP_SorterData, sAggInfo.sortingIdx,
128505 sortOut, sortPTab);
128506 }
128507 for(j=0; j<pGroupBy->nExpr; j++){
@@ -130714,17 +130647,11 @@
130714 ** if there are one or more BEFORE triggers that use this value via
130715 ** a new.* reference in a trigger program.
130716 */
130717 testcase( i==31 );
130718 testcase( i==32 );
130719 sqlite3ExprCodeGetColumnToReg(pParse, pTab, i, iDataCur, regNew+i);
130720 if( tmask & TRIGGER_BEFORE ){
130721 /* This value will be recomputed in After-BEFORE-trigger-reload-loop
130722 ** below, so make sure that it is not cached and reused.
130723 ** Ticket d85fffd6ffe856092ed8daefa811b1e399706b28. */
130724 sqlite3ExprCacheRemove(pParse, regNew+i, 1);
130725 }
130726 }else{
130727 sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);
130728 }
130729 }
130730 }
@@ -133848,11 +133775,10 @@
133848 }
133849
133850 /* Code the OP_Affinity opcode if there is anything left to do. */
133851 if( n>0 ){
133852 sqlite3VdbeAddOp4(v, OP_Affinity, base, n, 0, zAff, n);
133853 sqlite3ExprCacheAffinityChange(pParse, base, n);
133854 }
133855 }
133856
133857 /*
133858 ** Expression pRight, which is the RHS of a comparison operation, is
@@ -134384,11 +134310,11 @@
134384 ** an access of the index rather than the original table.
134385 */
134386 static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){
134387 int rc = WRC_Continue;
134388 struct CCurHint *pHint = pWalker->u.pCCurHint;
134389 if( pExpr->op==TK_COLUMN ){
134390 if( pExpr->iTable!=pHint->iTabCur ){
134391 Vdbe *v = pWalker->pParse->pVdbe;
134392 int reg = ++pWalker->pParse->nMem; /* Register for column value */
134393 sqlite3ExprCodeGetColumnOfTable(
134394 v, pExpr->pTab, pExpr->iTable, pExpr->iColumn, reg
@@ -134757,11 +134683,10 @@
134757 int iReg; /* P3 Value for OP_VFilter */
134758 int addrNotFound;
134759 int nConstraint = pLoop->nLTerm;
134760 int iIn; /* Counter for IN constraints */
134761
134762 sqlite3ExprCachePush(pParse);
134763 iReg = sqlite3GetTempRange(pParse, nConstraint+2);
134764 addrNotFound = pLevel->addrBrk;
134765 for(j=0; j<nConstraint; j++){
134766 int iTarget = iReg+j+2;
134767 pTerm = pLoop->aLTerm[j];
@@ -134830,11 +134755,10 @@
134830 ** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems
134831 ** simpler and safer to simply not reuse the registers.
134832 **
134833 ** sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2);
134834 */
134835 sqlite3ExprCachePop(pParse);
134836 }else
134837 #endif /* SQLITE_OMIT_VIRTUALTABLE */
134838
134839 if( (pLoop->wsFlags & WHERE_IPK)!=0
134840 && (pLoop->wsFlags & (WHERE_COLUMN_IN|WHERE_COLUMN_EQ))!=0
@@ -134854,13 +134778,10 @@
134854 iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg);
134855 if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);
134856 addrNxt = pLevel->addrNxt;
134857 sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg);
134858 VdbeCoverage(v);
134859 sqlite3ExprCacheAffinityChange(pParse, iRowidReg, 1);
134860 sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
134861 VdbeComment((v, "pk"));
134862 pLevel->op = OP_Noop;
134863 }else if( (pLoop->wsFlags & WHERE_IPK)!=0
134864 && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0
134865 ){
134866 /* Case 3: We have an inequality comparison against the ROWID field.
@@ -134926,11 +134847,10 @@
134926 VdbeComment((v, "pk"));
134927 VdbeCoverageIf(v, pX->op==TK_GT);
134928 VdbeCoverageIf(v, pX->op==TK_LE);
134929 VdbeCoverageIf(v, pX->op==TK_LT);
134930 VdbeCoverageIf(v, pX->op==TK_GE);
134931 sqlite3ExprCacheAffinityChange(pParse, r1, 1);
134932 sqlite3ReleaseTempReg(pParse, rTemp);
134933 }else{
134934 sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrHalt);
134935 VdbeCoverageIf(v, bRev==0);
134936 VdbeCoverageIf(v, bRev!=0);
@@ -134961,11 +134881,10 @@
134961 pLevel->p2 = start;
134962 assert( pLevel->p5==0 );
134963 if( testOp!=OP_Noop ){
134964 iRowidReg = ++pParse->nMem;
134965 sqlite3VdbeAddOp2(v, OP_Rowid, iCur, iRowidReg);
134966 sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
134967 sqlite3VdbeAddOp3(v, testOp, memEndValue, addrBrk, iRowidReg);
134968 VdbeCoverageIf(v, testOp==OP_Le);
134969 VdbeCoverageIf(v, testOp==OP_Lt);
134970 VdbeCoverageIf(v, testOp==OP_Ge);
134971 VdbeCoverageIf(v, testOp==OP_Gt);
@@ -135187,11 +135106,10 @@
135187 ** range (if any).
135188 */
135189 nConstraint = nEq;
135190 if( pRangeEnd ){
135191 Expr *pRight = pRangeEnd->pExpr->pRight;
135192 sqlite3ExprCacheRemove(pParse, regBase+nEq, 1);
135193 codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
135194 whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
135195 if( (pRangeEnd->wtFlags & TERM_VNULL)==0
135196 && sqlite3ExprCanBeNull(pRight)
135197 ){
@@ -135212,11 +135130,10 @@
135212 }else{
135213 endEq = 1;
135214 }
135215 }else if( bStopAtNull ){
135216 sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
135217 sqlite3ExprCacheRemove(pParse, regBase+nEq, 1);
135218 endEq = 0;
135219 nConstraint++;
135220 }
135221 sqlite3DbFree(db, zStartAff);
135222 sqlite3DbFree(db, zEndAff);
@@ -135246,11 +135163,10 @@
135246 (pWInfo->wctrlFlags & WHERE_SEEK_UNIQ_TABLE)
135247 && (pWInfo->eOnePass==ONEPASS_SINGLE)
135248 )){
135249 iRowidReg = ++pParse->nMem;
135250 sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
135251 sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
135252 sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg);
135253 VdbeCoverage(v);
135254 }else{
135255 codeDeferredSeek(pWInfo, pIdx, iCur, iIdxCur);
135256 }
@@ -135481,27 +135397,27 @@
135481 ** duplicate rows from prior sub-WHERE clauses, and record the
135482 ** rowid (or PRIMARY KEY) for the current row so that the same
135483 ** row will be skipped in subsequent sub-WHERE clauses.
135484 */
135485 if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){
135486 int r;
135487 int iSet = ((ii==pOrWc->nTerm-1)?-1:ii);
135488 if( HasRowid(pTab) ){
135489 r = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iCur, regRowid, 0);
135490 jmp1 = sqlite3VdbeAddOp4Int(v, OP_RowSetTest, regRowset, 0,
135491 r,iSet);
135492 VdbeCoverage(v);
135493 }else{
135494 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
135495 int nPk = pPk->nKeyCol;
135496 int iPk;
 
135497
135498 /* Read the PK into an array of temp registers. */
135499 r = sqlite3GetTempRange(pParse, nPk);
135500 for(iPk=0; iPk<nPk; iPk++){
135501 int iCol = pPk->aiColumn[iPk];
135502 sqlite3ExprCodeGetColumnToReg(pParse, pTab, iCol, iCur, r+iPk);
135503 }
135504
135505 /* Check if the temp table already contains this key. If so,
135506 ** the row has already been included in the result set and
135507 ** can be ignored (by jumping past the Gosub below). Otherwise,
@@ -135730,11 +135646,10 @@
135730 */
135731 if( pLevel->iLeftJoin ){
135732 pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
135733 sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
135734 VdbeComment((v, "record LEFT JOIN hit"));
135735 sqlite3ExprCacheClear(pParse);
135736 for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){
135737 testcase( pTerm->wtFlags & TERM_VIRTUAL );
135738 testcase( pTerm->wtFlags & TERM_CODED );
135739 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
135740 if( (pTerm->prereqAll & pLevel->notReady)!=0 ){
@@ -135946,22 +135861,22 @@
135946 Expr *pExpr, /* Test this expression */
135947 Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */
135948 int *pisComplete, /* True if the only wildcard is % in the last character */
135949 int *pnoCase /* True if uppercase is equivalent to lowercase */
135950 ){
135951 const u8 *z = 0; /* String on RHS of LIKE operator */
135952 Expr *pRight, *pLeft; /* Right and left size of LIKE operator */
135953 ExprList *pList; /* List of operands to the LIKE operator */
135954 int c; /* One character in z[] */
135955 int cnt; /* Number of non-wildcard prefix characters */
135956 char wc[4]; /* Wildcard characters */
135957 sqlite3 *db = pParse->db; /* Database connection */
135958 sqlite3_value *pVal = 0;
135959 int op; /* Opcode of pRight */
135960 int rc; /* Result code to return */
135961
135962 if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, wc) ){
135963 return 0;
135964 }
135965 #ifdef SQLITE_EBCDIC
135966 if( *pnoCase ) return 0;
135967 #endif
@@ -136611,11 +136526,11 @@
136611 && (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2))
136612 ){
136613 return 0;
136614 }
136615 pColl = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight);
136616 if( pColl==0 || sqlite3StrICmp(pColl->zName, "BINARY")==0 ) return 1;
136617 return sqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight);
136618 }
136619
136620 /*
136621 ** Recursively walk the expressions of a SELECT statement and generate
@@ -136952,11 +136867,11 @@
136952 if( c=='A'-1 ) isComplete = 0;
136953 c = sqlite3UpperToLower[c];
136954 }
136955 *pC = c + 1;
136956 }
136957 zCollSeqName = noCase ? "NOCASE" : "BINARY";
136958 pNewExpr1 = sqlite3ExprDup(db, pLeft, 0);
136959 pNewExpr1 = sqlite3PExpr(pParse, TK_GE,
136960 sqlite3ExprAddCollateString(pParse,pNewExpr1,zCollSeqName),
136961 pStr1);
136962 transferJoinMarkings(pNewExpr1, pExpr);
@@ -137202,11 +137117,11 @@
137202 ** a bitmask indicating which tables are used in that expression
137203 ** tree.
137204 */
137205 SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){
137206 Bitmask mask;
137207 if( p->op==TK_COLUMN ){
137208 return sqlite3WhereGetMask(pMaskSet, p->iTable);
137209 }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
137210 assert( p->op!=TK_IF_NULL_ROW );
137211 return 0;
137212 }
@@ -138100,11 +138015,10 @@
138100 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
138101 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
138102 VdbeComment((v, "for %s", pTable->zName));
138103
138104 /* Fill the automatic index with content */
138105 sqlite3ExprCachePush(pParse);
138106 pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
138107 if( pTabItem->fg.viaCoroutine ){
138108 int regYield = pTabItem->regReturn;
138109 addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
138110 sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
@@ -138137,11 +138051,10 @@
138137 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
138138 }
138139 sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
138140 sqlite3VdbeJumpHere(v, addrTop);
138141 sqlite3ReleaseTempReg(pParse, regRecord);
138142 sqlite3ExprCachePop(pParse);
138143
138144 /* Jump here when skipping the initialization */
138145 sqlite3VdbeJumpHere(v, addrInit);
138146
138147 end_auto_index_create:
@@ -140503,11 +140416,11 @@
140503 int iTerm = pIdxInfo->aConstraint[iCons].iTermOffset;
140504 Expr *pX = pHidden->pWC->a[iTerm].pExpr;
140505 if( pX->pLeft ){
140506 pC = sqlite3BinaryCompareCollSeq(pHidden->pParse, pX->pLeft, pX->pRight);
140507 }
140508 zRet = (pC ? pC->zName : "BINARY");
140509 }
140510 return zRet;
140511 }
140512
140513 /*
@@ -141354,11 +141267,15 @@
141354 if( aSortCost[isOrdered]==0 ){
141355 aSortCost[isOrdered] = whereSortingCost(
141356 pWInfo, nRowEst, nOrderBy, isOrdered
141357 );
141358 }
141359 rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]);
 
 
 
 
141360
141361 WHERETRACE(0x002,
141362 ("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n",
141363 aSortCost[isOrdered], (nOrderBy-isOrdered), nOrderBy,
141364 rUnsorted, rCost));
@@ -142371,11 +142288,10 @@
142371 sqlite3 *db = pParse->db;
142372
142373 /* Generate loop termination code.
142374 */
142375 VdbeModuleComment((v, "End WHERE-core"));
142376 sqlite3ExprCacheClear(pParse);
142377 for(i=pWInfo->nLevel-1; i>=0; i--){
142378 int addr;
142379 pLevel = &pWInfo->a[i];
142380 pLoop = pLevel->pWLoop;
142381 if( pLevel->op!=OP_Noop ){
@@ -143536,11 +143452,14 @@
143536 /*
143537 ** Attach window object pWin to expression p.
143538 */
143539 SQLITE_PRIVATE void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){
143540 if( p ){
143541 if( pWin ){
 
 
 
143542 p->pWin = pWin;
143543 pWin->pOwner = p;
143544 if( p->flags & EP_Distinct ){
143545 sqlite3ErrorMsg(pParse,
143546 "DISTINCT is not supported for window functions");
@@ -145095,21 +145014,21 @@
145095 #define sqlite3ParserCTX_PDECL ,Parse *pParse
145096 #define sqlite3ParserCTX_PARAM ,pParse
145097 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
145098 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
145099 #define YYFALLBACK 1
145100 #define YYNSTATE 516
145101 #define YYNRULE 365
145102 #define YYNTOKEN 155
145103 #define YY_MAX_SHIFT 515
145104 #define YY_MIN_SHIFTREDUCE 750
145105 #define YY_MAX_SHIFTREDUCE 1114
145106 #define YY_ERROR_ACTION 1115
145107 #define YY_ACCEPT_ACTION 1116
145108 #define YY_NO_ACTION 1117
145109 #define YY_MIN_REDUCE 1118
145110 #define YY_MAX_REDUCE 1482
145111 /************* End control #defines *******************************************/
145112 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
145113
145114 /* Define the yytestcase() macro to be a no-op if is not already defined
145115 ** otherwise.
@@ -145174,391 +145093,391 @@
145174 ** yy_default[] Default action for each state.
145175 **
145176 *********** Begin parsing tables **********************************************/
145177 #define YY_ACTTAB_COUNT (2009)
145178 static const YYACTIONTYPE yy_action[] = {
145179 /* 0 */ 510, 423, 364, 105, 102, 196, 14, 244, 1116, 1,
145180 /* 10 */ 1, 515, 2, 1120, 510, 361, 1247, 362, 271, 366,
145181 /* 20 */ 127, 37, 37, 1378, 105, 102, 196, 1197, 178, 472,
145182 /* 30 */ 1246, 880, 1184, 1163, 423, 37, 37, 1189, 1189, 881,
145183 /* 40 */ 353, 1184, 425, 112, 113, 103, 1092, 1092, 944, 947,
145184 /* 50 */ 937, 937, 110, 110, 111, 111, 111, 111, 278, 249,
145185 /* 60 */ 249, 249, 249, 105, 102, 196, 510, 105, 102, 196,
145186 /* 70 */ 1071, 254, 507, 177, 507, 1187, 1187, 491, 415, 225,
145187 /* 80 */ 193, 105, 102, 196, 510, 205, 906, 65, 65, 318,
145188 /* 90 */ 249, 249, 109, 109, 109, 109, 108, 108, 107, 107,
145189 /* 100 */ 107, 106, 396, 507, 258, 15, 15, 394, 393, 249,
145190 /* 110 */ 249, 1413, 366, 1408, 400, 1096, 1071, 1072, 1073, 377,
145191 /* 120 */ 1098, 178, 507, 493, 492, 1411, 1407, 396, 1097, 292,
145192 /* 130 */ 411, 280, 366, 365, 134, 152, 112, 113, 103, 1092,
145193 /* 140 */ 1092, 944, 947, 937, 937, 110, 110, 111, 111, 111,
145194 /* 150 */ 111, 1450, 1099, 262, 1099, 262, 112, 113, 103, 1092,
145195 /* 160 */ 1092, 944, 947, 937, 937, 110, 110, 111, 111, 111,
145196 /* 170 */ 111, 107, 107, 107, 106, 396, 1049, 486, 1047, 509,
145197 /* 180 */ 73, 270, 500, 416, 293, 109, 109, 109, 109, 108,
145198 /* 190 */ 108, 107, 107, 107, 106, 396, 366, 111, 111, 111,
145199 /* 200 */ 111, 104, 330, 89, 486, 109, 109, 109, 109, 108,
145200 /* 210 */ 108, 107, 107, 107, 106, 396, 111, 111, 111, 111,
145201 /* 220 */ 112, 113, 103, 1092, 1092, 944, 947, 937, 937, 110,
145202 /* 230 */ 110, 111, 111, 111, 111, 109, 109, 109, 109, 108,
145203 /* 240 */ 108, 107, 107, 107, 106, 396, 114, 108, 108, 107,
145204 /* 250 */ 107, 107, 106, 396, 109, 109, 109, 109, 108, 108,
145205 /* 260 */ 107, 107, 107, 106, 396, 394, 393, 106, 396, 109,
145206 /* 270 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 396,
145207 /* 280 */ 217, 487, 1400, 453, 450, 449, 510, 1278, 423, 366,
145208 /* 290 */ 503, 503, 503, 448, 74, 1071, 109, 109, 109, 109,
145209 /* 300 */ 108, 108, 107, 107, 107, 106, 396, 37, 37, 1401,
145210 /* 310 */ 1099, 440, 1099, 112, 113, 103, 1092, 1092, 944, 947,
145211 /* 320 */ 937, 937, 110, 110, 111, 111, 111, 111, 1426, 515,
145212 /* 330 */ 2, 1120, 934, 934, 945, 948, 271, 1071, 127, 477,
145213 /* 340 */ 924, 1071, 1072, 1073, 217, 1197, 906, 453, 450, 449,
145214 /* 350 */ 388, 167, 510, 1377, 152, 379, 917, 448, 259, 510,
145215 /* 360 */ 916, 285, 109, 109, 109, 109, 108, 108, 107, 107,
145216 /* 370 */ 107, 106, 396, 15, 15, 429, 846, 249, 249, 224,
145217 /* 380 */ 15, 15, 366, 1071, 1072, 1073, 307, 382, 1071, 292,
145218 /* 390 */ 507, 916, 916, 918, 384, 27, 938, 1411, 484, 408,
145219 /* 400 */ 270, 500, 508, 205, 836, 836, 112, 113, 103, 1092,
145220 /* 410 */ 1092, 944, 947, 937, 937, 110, 110, 111, 111, 111,
145221 /* 420 */ 111, 1430, 282, 1120, 284, 1071, 28, 510, 271, 318,
145222 /* 430 */ 127, 1422, 400, 385, 1071, 1072, 1073, 1197, 159, 235,
145223 /* 440 */ 252, 317, 456, 312, 455, 222, 784, 375, 65, 65,
145224 /* 450 */ 332, 310, 194, 243, 243, 109, 109, 109, 109, 108,
145225 /* 460 */ 108, 107, 107, 107, 106, 396, 507, 257, 510, 249,
145226 /* 470 */ 249, 1071, 1072, 1073, 136, 366, 335, 924, 440, 788,
145227 /* 480 */ 270, 500, 507, 1446, 493, 473, 319, 1071, 429, 65,
145228 /* 490 */ 65, 1158, 784, 917, 283, 205, 510, 916, 440, 112,
145229 /* 500 */ 113, 103, 1092, 1092, 944, 947, 937, 937, 110, 110,
145230 /* 510 */ 111, 111, 111, 111, 279, 1027, 1476, 15, 15, 1476,
145231 /* 520 */ 403, 510, 383, 1071, 400, 493, 1404, 1386, 916, 916,
145232 /* 530 */ 918, 261, 463, 1071, 1072, 1073, 173, 1421, 510, 1071,
145233 /* 540 */ 1343, 510, 45, 45, 168, 990, 990, 437, 109, 109,
145234 /* 550 */ 109, 109, 108, 108, 107, 107, 107, 106, 396, 63,
145235 /* 560 */ 63, 510, 15, 15, 249, 249, 375, 510, 366, 1071,
145236 /* 570 */ 1072, 1073, 781, 5, 401, 355, 488, 507, 464, 3,
145237 /* 580 */ 291, 1071, 65, 65, 1025, 1071, 1072, 1073, 65, 65,
145238 /* 590 */ 350, 1112, 112, 113, 103, 1092, 1092, 944, 947, 937,
145239 /* 600 */ 937, 110, 110, 111, 111, 111, 111, 249, 249, 510,
145240 /* 610 */ 1071, 1042, 867, 395, 395, 395, 1071, 336, 493, 490,
145241 /* 620 */ 507, 1041, 1006, 318, 493, 505, 178, 1071, 1072, 1073,
145242 /* 630 */ 65, 65, 1071, 255, 344, 421, 273, 1007, 358, 290,
145243 /* 640 */ 88, 109, 109, 109, 109, 108, 108, 107, 107, 107,
145244 /* 650 */ 106, 396, 1008, 510, 375, 1071, 1071, 1072, 1073, 1113,
145245 /* 660 */ 510, 366, 1071, 1072, 1073, 1056, 493, 462, 133, 1478,
145246 /* 670 */ 351, 249, 249, 822, 65, 65, 152, 440, 1071, 1072,
145247 /* 680 */ 1073, 65, 65, 823, 507, 112, 113, 103, 1092, 1092,
145248 /* 690 */ 944, 947, 937, 937, 110, 110, 111, 111, 111, 111,
145249 /* 700 */ 274, 1071, 1072, 1073, 407, 866, 471, 1219, 1027, 1477,
145250 /* 710 */ 478, 767, 1477, 406, 1195, 1347, 1138, 392, 465, 1196,
145251 /* 720 */ 987, 256, 270, 500, 987, 445, 1075, 18, 18, 793,
145252 /* 730 */ 406, 405, 1347, 1349, 109, 109, 109, 109, 108, 108,
145253 /* 740 */ 107, 107, 107, 106, 396, 510, 249, 249, 249, 249,
145254 /* 750 */ 249, 249, 221, 510, 366, 251, 435, 246, 925, 507,
145255 /* 760 */ 865, 507, 468, 507, 318, 429, 49, 49, 494, 9,
145256 /* 770 */ 414, 228, 802, 1075, 50, 50, 277, 1025, 112, 113,
145257 /* 780 */ 103, 1092, 1092, 944, 947, 937, 937, 110, 110, 111,
145258 /* 790 */ 111, 111, 111, 1006, 249, 249, 510, 406, 1345, 1347,
145259 /* 800 */ 249, 249, 967, 454, 1141, 372, 1090, 507, 1007, 135,
145260 /* 810 */ 371, 803, 440, 507, 220, 219, 218, 17, 17, 1423,
145261 /* 820 */ 460, 510, 440, 1008, 510, 1232, 310, 109, 109, 109,
145262 /* 830 */ 109, 108, 108, 107, 107, 107, 106, 396, 510, 1336,
145263 /* 840 */ 510, 195, 39, 39, 497, 51, 51, 366, 510, 485,
145264 /* 850 */ 1278, 911, 6, 1090, 1192, 985, 386, 260, 221, 52,
145265 /* 860 */ 52, 53, 53, 1439, 298, 510, 865, 366, 510, 54,
145266 /* 870 */ 54, 112, 113, 103, 1092, 1092, 944, 947, 937, 937,
145267 /* 880 */ 110, 110, 111, 111, 111, 111, 55, 55, 865, 40,
145268 /* 890 */ 40, 112, 113, 103, 1092, 1092, 944, 947, 937, 937,
145269 /* 900 */ 110, 110, 111, 111, 111, 111, 250, 250, 755, 756,
145270 /* 910 */ 757, 510, 95, 510, 93, 510, 371, 510, 380, 507,
145271 /* 920 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106,
145272 /* 930 */ 396, 510, 41, 41, 43, 43, 44, 44, 56, 56,
145273 /* 940 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106,
145274 /* 950 */ 396, 510, 57, 57, 510, 1231, 510, 370, 510, 410,
145275 /* 960 */ 510, 416, 293, 510, 1291, 510, 1290, 510, 190, 195,
145276 /* 970 */ 510, 319, 58, 58, 1391, 16, 16, 59, 59, 118,
145277 /* 980 */ 118, 60, 60, 458, 46, 46, 61, 61, 62, 62,
145278 /* 990 */ 510, 47, 47, 1201, 865, 91, 510, 474, 510, 461,
145279 /* 1000 */ 510, 461, 510, 228, 510, 507, 510, 390, 510, 841,
145280 /* 1010 */ 510, 64, 64, 1449, 840, 366, 811, 140, 140, 141,
145281 /* 1020 */ 141, 69, 69, 48, 48, 119, 119, 66, 66, 120,
145282 /* 1030 */ 120, 121, 121, 510, 434, 366, 510, 431, 1090, 112,
145283 /* 1040 */ 113, 103, 1092, 1092, 944, 947, 937, 937, 110, 110,
145284 /* 1050 */ 111, 111, 111, 111, 117, 117, 510, 139, 139, 112,
145285 /* 1060 */ 113, 103, 1092, 1092, 944, 947, 937, 937, 110, 110,
145286 /* 1070 */ 111, 111, 111, 111, 305, 427, 116, 138, 138, 510,
145287 /* 1080 */ 86, 510, 131, 475, 510, 1090, 350, 1026, 109, 109,
145288 /* 1090 */ 109, 109, 108, 108, 107, 107, 107, 106, 396, 510,
145289 /* 1100 */ 125, 125, 124, 124, 510, 122, 122, 510, 109, 109,
145290 /* 1110 */ 109, 109, 108, 108, 107, 107, 107, 106, 396, 777,
145291 /* 1120 */ 123, 123, 502, 372, 510, 68, 68, 510, 70, 70,
145292 /* 1130 */ 1089, 510, 286, 14, 1278, 300, 1278, 303, 270, 500,
145293 /* 1140 */ 373, 153, 841, 94, 202, 67, 67, 840, 38, 38,
145294 /* 1150 */ 189, 188, 42, 42, 1278, 1113, 248, 193, 269, 880,
145295 /* 1160 */ 132, 428, 33, 366, 418, 1366, 777, 881, 182, 363,
145296 /* 1170 */ 1022, 289, 908, 352, 88, 227, 422, 424, 294, 227,
145297 /* 1180 */ 227, 88, 446, 366, 19, 223, 903, 112, 113, 103,
145298 /* 1190 */ 1092, 1092, 944, 947, 937, 937, 110, 110, 111, 111,
145299 /* 1200 */ 111, 111, 381, 308, 436, 430, 88, 112, 101, 103,
145300 /* 1210 */ 1092, 1092, 944, 947, 937, 937, 110, 110, 111, 111,
145301 /* 1220 */ 111, 111, 391, 417, 791, 801, 800, 808, 809, 970,
145302 /* 1230 */ 874, 974, 223, 227, 920, 185, 109, 109, 109, 109,
145303 /* 1240 */ 108, 108, 107, 107, 107, 106, 396, 984, 838, 984,
145304 /* 1250 */ 204, 96, 983, 1365, 983, 432, 109, 109, 109, 109,
145305 /* 1260 */ 108, 108, 107, 107, 107, 106, 396, 316, 295, 775,
145306 /* 1270 */ 1228, 791, 130, 299, 1167, 302, 366, 315, 974, 1166,
145307 /* 1280 */ 304, 920, 306, 496, 1180, 1164, 1165, 311, 320, 321,
145308 /* 1290 */ 1240, 267, 1277, 1215, 1226, 495, 366, 1283, 1147, 1140,
145309 /* 1300 */ 1129, 113, 103, 1092, 1092, 944, 947, 937, 937, 110,
145310 /* 1310 */ 110, 111, 111, 111, 111, 1128, 441, 241, 183, 1130,
145311 /* 1320 */ 1212, 1433, 103, 1092, 1092, 944, 947, 937, 937, 110,
145312 /* 1330 */ 110, 111, 111, 111, 111, 349, 323, 325, 327, 288,
145313 /* 1340 */ 426, 191, 187, 99, 501, 409, 4, 499, 314, 109,
145314 /* 1350 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 396,
145315 /* 1360 */ 504, 13, 1163, 1262, 451, 1340, 281, 329, 1339, 109,
145316 /* 1370 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 396,
145317 /* 1380 */ 1270, 357, 1436, 397, 230, 342, 1107, 186, 1385, 1383,
145318 /* 1390 */ 1104, 374, 420, 99, 501, 498, 4, 165, 30, 72,
145319 /* 1400 */ 75, 155, 1267, 149, 157, 152, 86, 1259, 412, 160,
145320 /* 1410 */ 504, 413, 161, 162, 924, 163, 444, 207, 356, 31,
145321 /* 1420 */ 97, 97, 8, 354, 1273, 419, 1334, 98, 169, 397,
145322 /* 1430 */ 512, 511, 433, 397, 916, 211, 80, 242, 1354, 439,
145323 /* 1440 */ 297, 213, 174, 301, 442, 498, 1131, 214, 215, 359,
145324 /* 1450 */ 457, 270, 500, 387, 360, 1183, 482, 1182, 1174, 793,
145325 /* 1460 */ 1181, 481, 476, 1154, 924, 916, 916, 918, 919, 25,
145326 /* 1470 */ 97, 97, 1155, 313, 1173, 1153, 265, 98, 1448, 397,
145327 /* 1480 */ 512, 511, 467, 389, 916, 266, 470, 1223, 99, 501,
145328 /* 1490 */ 85, 4, 1224, 229, 480, 489, 332, 331, 322, 181,
145329 /* 1500 */ 1402, 11, 1320, 334, 92, 504, 115, 129, 337, 99,
145330 /* 1510 */ 501, 324, 4, 1222, 1221, 916, 916, 918, 919, 25,
145331 /* 1520 */ 1425, 1060, 399, 326, 328, 253, 504, 1205, 397, 338,
145332 /* 1530 */ 348, 348, 347, 238, 345, 87, 339, 764, 479, 340,
145333 /* 1540 */ 498, 268, 236, 341, 1137, 29, 1066, 237, 513, 397,
145334 /* 1550 */ 198, 482, 276, 240, 514, 239, 483, 1126, 1121, 924,
145335 /* 1560 */ 275, 498, 154, 142, 1370, 97, 97, 368, 369, 143,
145336 /* 1570 */ 1371, 751, 98, 144, 397, 512, 511, 398, 184, 916,
145337 /* 1580 */ 924, 272, 1369, 1368, 128, 197, 97, 97, 845, 1151,
145338 /* 1590 */ 200, 1150, 263, 98, 71, 397, 512, 511, 201, 1148,
145339 /* 1600 */ 916, 146, 402, 126, 982, 980, 900, 156, 199, 203,
145340 /* 1610 */ 916, 916, 918, 919, 25, 145, 158, 825, 996, 206,
145341 /* 1620 */ 287, 99, 501, 164, 4, 147, 376, 904, 378, 76,
145342 /* 1630 */ 166, 916, 916, 918, 919, 25, 77, 78, 504, 79,
145343 /* 1640 */ 148, 999, 367, 208, 209, 995, 137, 270, 500, 20,
145344 /* 1650 */ 210, 296, 227, 1101, 438, 212, 988, 170, 171, 32,
145345 /* 1660 */ 766, 397, 443, 315, 216, 447, 452, 172, 81, 21,
145346 /* 1670 */ 404, 309, 22, 498, 82, 264, 150, 804, 179, 83,
145347 /* 1680 */ 459, 151, 180, 950, 482, 1030, 34, 84, 1031, 481,
145348 /* 1690 */ 466, 35, 924, 192, 469, 245, 247, 873, 97, 97,
145349 /* 1700 */ 175, 226, 96, 868, 1044, 98, 1048, 397, 512, 511,
145350 /* 1710 */ 1060, 399, 916, 23, 253, 10, 1046, 1035, 7, 348,
145351 /* 1720 */ 348, 347, 238, 345, 333, 176, 764, 88, 965, 24,
145352 /* 1730 */ 951, 99, 501, 949, 4, 954, 953, 1005, 1004, 198,
145353 /* 1740 */ 232, 276, 231, 916, 916, 918, 919, 25, 504, 275,
145354 /* 1750 */ 26, 36, 506, 921, 776, 100, 835, 839, 12, 233,
145355 /* 1760 */ 234, 90, 501, 343, 4, 346, 1441, 1440, 1061, 1117,
145356 /* 1770 */ 1117, 397, 1117, 1117, 1117, 1117, 1117, 1117, 504, 200,
145357 /* 1780 */ 1117, 1117, 1117, 498, 1117, 1117, 1117, 201, 1117, 1117,
145358 /* 1790 */ 146, 1117, 1117, 1117, 1117, 1117, 1117, 199, 1117, 1117,
145359 /* 1800 */ 1117, 397, 924, 1117, 1117, 1117, 1117, 1117, 97, 97,
145360 /* 1810 */ 1117, 1117, 1117, 498, 1117, 98, 1117, 397, 512, 511,
145361 /* 1820 */ 1117, 1117, 916, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145362 /* 1830 */ 1117, 367, 924, 1117, 1117, 1117, 270, 500, 97, 97,
145363 /* 1840 */ 1117, 1117, 1117, 1117, 1117, 98, 1117, 397, 512, 511,
145364 /* 1850 */ 1117, 1117, 916, 916, 916, 918, 919, 25, 1117, 404,
145365 /* 1860 */ 1117, 1117, 1117, 253, 1117, 1117, 1117, 1117, 348, 348,
145366 /* 1870 */ 347, 238, 345, 1117, 1117, 764, 1117, 1117, 1117, 1117,
145367 /* 1880 */ 1117, 1117, 1117, 916, 916, 918, 919, 25, 198, 1117,
145368 /* 1890 */ 276, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 275, 1117,
145369 /* 1900 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145370 /* 1910 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145371 /* 1920 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 200, 1117,
145372 /* 1930 */ 1117, 1117, 1117, 1117, 1117, 1117, 201, 1117, 1117, 146,
145373 /* 1940 */ 1117, 1117, 1117, 1117, 1117, 1117, 199, 1117, 1117, 1117,
145374 /* 1950 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145375 /* 1960 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145376 /* 1970 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145377 /* 1980 */ 367, 1117, 1117, 1117, 1117, 270, 500, 1117, 1117, 1117,
145378 /* 1990 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117,
145379 /* 2000 */ 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 404,
145380 };
145381 static const YYCODETYPE yy_lookahead[] = {
145382 /* 0 */ 163, 163, 184, 238, 239, 240, 182, 182, 155, 156,
145383 /* 10 */ 157, 158, 159, 160, 163, 184, 187, 184, 165, 19,
145384 /* 20 */ 167, 184, 185, 258, 238, 239, 240, 174, 163, 174,
145385 /* 30 */ 187, 31, 191, 192, 163, 184, 185, 202, 203, 39,
145386 /* 40 */ 175, 200, 163, 43, 44, 45, 46, 47, 48, 49,
145387 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 174, 206,
145388 /* 60 */ 207, 206, 207, 238, 239, 240, 163, 238, 239, 240,
145389 /* 70 */ 59, 233, 219, 249, 219, 202, 203, 174, 254, 224,
145390 /* 80 */ 225, 238, 239, 240, 163, 232, 73, 184, 185, 163,
145391 /* 90 */ 206, 207, 92, 93, 94, 95, 96, 97, 98, 99,
145392 /* 100 */ 100, 101, 102, 219, 233, 184, 185, 96, 97, 206,
145393 /* 110 */ 207, 274, 19, 276, 261, 104, 105, 106, 107, 198,
145394 /* 120 */ 109, 163, 219, 220, 221, 274, 275, 102, 117, 116,
145395 /* 130 */ 117, 118, 19, 175, 208, 81, 43, 44, 45, 46,
145396 /* 140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
145397 /* 150 */ 57, 197, 141, 195, 143, 197, 43, 44, 45, 46,
145398 /* 160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
145399 /* 170 */ 57, 98, 99, 100, 101, 102, 83, 163, 85, 163,
145400 /* 180 */ 67, 127, 128, 117, 118, 92, 93, 94, 95, 96,
145401 /* 190 */ 97, 98, 99, 100, 101, 102, 19, 54, 55, 56,
145402 /* 200 */ 57, 58, 163, 26, 163, 92, 93, 94, 95, 96,
145403 /* 210 */ 97, 98, 99, 100, 101, 102, 54, 55, 56, 57,
145404 /* 220 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
145405 /* 230 */ 53, 54, 55, 56, 57, 92, 93, 94, 95, 96,
145406 /* 240 */ 97, 98, 99, 100, 101, 102, 69, 96, 97, 98,
145407 /* 250 */ 99, 100, 101, 102, 92, 93, 94, 95, 96, 97,
145408 /* 260 */ 98, 99, 100, 101, 102, 96, 97, 101, 102, 92,
145409 /* 270 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
145410 /* 280 */ 108, 267, 268, 111, 112, 113, 163, 163, 163, 19,
145411 /* 290 */ 179, 180, 181, 121, 24, 59, 92, 93, 94, 95,
145412 /* 300 */ 96, 97, 98, 99, 100, 101, 102, 184, 185, 268,
145413 /* 310 */ 141, 163, 143, 43, 44, 45, 46, 47, 48, 49,
145414 /* 320 */ 50, 51, 52, 53, 54, 55, 56, 57, 157, 158,
145415 /* 330 */ 159, 160, 46, 47, 48, 49, 165, 59, 167, 163,
145416 /* 340 */ 90, 105, 106, 107, 108, 174, 73, 111, 112, 113,
145417 /* 350 */ 19, 22, 163, 205, 81, 231, 106, 121, 233, 163,
145418 /* 360 */ 110, 16, 92, 93, 94, 95, 96, 97, 98, 99,
145419 /* 370 */ 100, 101, 102, 184, 185, 163, 98, 206, 207, 26,
145420 /* 380 */ 184, 185, 19, 105, 106, 107, 23, 198, 59, 116,
145421 /* 390 */ 219, 141, 142, 143, 198, 22, 110, 274, 275, 234,
145422 /* 400 */ 127, 128, 123, 232, 125, 126, 43, 44, 45, 46,
145423 /* 410 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
145424 /* 420 */ 57, 158, 77, 160, 79, 59, 53, 163, 165, 163,
145425 /* 430 */ 167, 163, 261, 102, 105, 106, 107, 174, 72, 108,
145426 /* 440 */ 109, 110, 111, 112, 113, 114, 59, 163, 184, 185,
145427 /* 450 */ 22, 120, 163, 206, 207, 92, 93, 94, 95, 96,
145428 /* 460 */ 97, 98, 99, 100, 101, 102, 219, 255, 163, 206,
145429 /* 470 */ 207, 105, 106, 107, 208, 19, 163, 90, 163, 23,
145430 /* 480 */ 127, 128, 219, 183, 220, 221, 163, 59, 163, 184,
145431 /* 490 */ 185, 191, 105, 106, 149, 232, 163, 110, 163, 43,
145432 /* 500 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
145433 /* 510 */ 54, 55, 56, 57, 230, 22, 23, 184, 185, 26,
145434 /* 520 */ 205, 163, 199, 59, 261, 220, 221, 163, 141, 142,
145435 /* 530 */ 143, 198, 174, 105, 106, 107, 72, 269, 163, 59,
145436 /* 540 */ 205, 163, 184, 185, 22, 116, 117, 118, 92, 93,
145437 /* 550 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 184,
145438 /* 560 */ 185, 163, 184, 185, 206, 207, 163, 163, 19, 105,
145439 /* 570 */ 106, 107, 23, 22, 259, 174, 198, 219, 220, 22,
145440 /* 580 */ 255, 59, 184, 185, 91, 105, 106, 107, 184, 185,
145441 /* 590 */ 22, 23, 43, 44, 45, 46, 47, 48, 49, 50,
145442 /* 600 */ 51, 52, 53, 54, 55, 56, 57, 206, 207, 163,
145443 /* 610 */ 59, 76, 132, 179, 180, 181, 59, 242, 220, 221,
145444 /* 620 */ 219, 86, 12, 163, 220, 221, 163, 105, 106, 107,
145445 /* 630 */ 184, 185, 59, 230, 171, 234, 163, 27, 175, 174,
145446 /* 640 */ 26, 92, 93, 94, 95, 96, 97, 98, 99, 100,
145447 /* 650 */ 101, 102, 42, 163, 163, 59, 105, 106, 107, 91,
145448 /* 660 */ 163, 19, 105, 106, 107, 23, 220, 221, 208, 264,
145449 /* 670 */ 265, 206, 207, 63, 184, 185, 81, 163, 105, 106,
145450 /* 680 */ 107, 184, 185, 73, 219, 43, 44, 45, 46, 47,
145451 /* 690 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
145452 /* 700 */ 163, 105, 106, 107, 109, 132, 163, 226, 22, 23,
145453 /* 710 */ 220, 21, 26, 163, 174, 163, 174, 220, 174, 205,
145454 /* 720 */ 29, 230, 127, 128, 33, 19, 59, 184, 185, 115,
145455 /* 730 */ 180, 181, 180, 181, 92, 93, 94, 95, 96, 97,
145456 /* 740 */ 98, 99, 100, 101, 102, 163, 206, 207, 206, 207,
145457 /* 750 */ 206, 207, 46, 163, 19, 22, 65, 23, 23, 219,
145458 /* 760 */ 26, 219, 174, 219, 163, 163, 184, 185, 174, 22,
145459 /* 770 */ 80, 24, 35, 106, 184, 185, 163, 91, 43, 44,
145460 /* 780 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
145461 /* 790 */ 55, 56, 57, 12, 206, 207, 163, 247, 163, 247,
145462 /* 800 */ 206, 207, 112, 66, 177, 178, 59, 219, 27, 208,
145463 /* 810 */ 104, 74, 163, 219, 116, 117, 118, 184, 185, 153,
145464 /* 820 */ 154, 163, 163, 42, 163, 163, 120, 92, 93, 94,
145465 /* 830 */ 95, 96, 97, 98, 99, 100, 101, 102, 163, 149,
145466 /* 840 */ 163, 107, 184, 185, 63, 184, 185, 19, 163, 270,
145467 /* 850 */ 163, 23, 273, 106, 205, 11, 119, 255, 46, 184,
145468 /* 860 */ 185, 184, 185, 130, 205, 163, 132, 19, 163, 184,
145469 /* 870 */ 185, 43, 44, 45, 46, 47, 48, 49, 50, 51,
145470 /* 880 */ 52, 53, 54, 55, 56, 57, 184, 185, 26, 184,
145471 /* 890 */ 185, 43, 44, 45, 46, 47, 48, 49, 50, 51,
145472 /* 900 */ 52, 53, 54, 55, 56, 57, 206, 207, 7, 8,
145473 /* 910 */ 9, 163, 146, 163, 148, 163, 104, 163, 231, 219,
145474 /* 920 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
145475 /* 930 */ 102, 163, 184, 185, 184, 185, 184, 185, 184, 185,
145476 /* 940 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
145477 /* 950 */ 102, 163, 184, 185, 163, 163, 163, 168, 163, 163,
145478 /* 960 */ 163, 117, 118, 163, 237, 163, 237, 163, 26, 107,
145479 /* 970 */ 163, 163, 184, 185, 163, 184, 185, 184, 185, 184,
145480 /* 980 */ 185, 184, 185, 98, 184, 185, 184, 185, 184, 185,
145481 /* 990 */ 163, 184, 185, 207, 132, 147, 163, 19, 163, 272,
145482 /* 1000 */ 163, 272, 163, 24, 163, 219, 163, 199, 163, 124,
145483 /* 1010 */ 163, 184, 185, 23, 129, 19, 26, 184, 185, 184,
145484 /* 1020 */ 185, 184, 185, 184, 185, 184, 185, 184, 185, 184,
145485 /* 1030 */ 185, 184, 185, 163, 245, 19, 163, 248, 59, 43,
145486 /* 1040 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
145487 /* 1050 */ 54, 55, 56, 57, 184, 185, 163, 184, 185, 43,
145488 /* 1060 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
145489 /* 1070 */ 54, 55, 56, 57, 16, 19, 22, 184, 185, 163,
145490 /* 1080 */ 138, 163, 22, 105, 163, 106, 22, 23, 92, 93,
145491 /* 1090 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 163,
145492 /* 1100 */ 184, 185, 184, 185, 163, 184, 185, 163, 92, 93,
145493 /* 1110 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 59,
145494 /* 1120 */ 184, 185, 177, 178, 163, 184, 185, 163, 184, 185,
145495 /* 1130 */ 26, 163, 163, 182, 163, 77, 163, 79, 127, 128,
145496 /* 1140 */ 262, 263, 124, 147, 24, 184, 185, 129, 184, 185,
145497 /* 1150 */ 96, 97, 184, 185, 163, 91, 224, 225, 211, 31,
145498 /* 1160 */ 22, 105, 24, 19, 118, 163, 106, 39, 24, 222,
145499 /* 1170 */ 23, 23, 23, 26, 26, 26, 23, 23, 23, 26,
145500 /* 1180 */ 26, 26, 23, 19, 22, 26, 140, 43, 44, 45,
145501 /* 1190 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
145502 /* 1200 */ 56, 57, 231, 23, 231, 254, 26, 43, 44, 45,
145503 /* 1210 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
145504 /* 1220 */ 56, 57, 231, 61, 59, 109, 110, 7, 8, 23,
145505 /* 1230 */ 23, 59, 26, 26, 59, 131, 92, 93, 94, 95,
145506 /* 1240 */ 96, 97, 98, 99, 100, 101, 102, 141, 23, 143,
145507 /* 1250 */ 130, 26, 141, 163, 143, 163, 92, 93, 94, 95,
145508 /* 1260 */ 96, 97, 98, 99, 100, 101, 102, 110, 163, 23,
145509 /* 1270 */ 163, 106, 26, 163, 193, 163, 19, 120, 106, 193,
145510 /* 1280 */ 163, 106, 163, 203, 163, 163, 193, 163, 163, 163,
145511 /* 1290 */ 163, 223, 163, 163, 163, 163, 19, 163, 163, 163,
145512 /* 1300 */ 163, 44, 45, 46, 47, 48, 49, 50, 51, 52,
145513 /* 1310 */ 53, 54, 55, 56, 57, 163, 251, 250, 209, 163,
145514 /* 1320 */ 223, 163, 45, 46, 47, 48, 49, 50, 51, 52,
145515 /* 1330 */ 53, 54, 55, 56, 57, 161, 223, 223, 223, 256,
145516 /* 1340 */ 256, 196, 182, 19, 20, 227, 22, 244, 187, 92,
145517 /* 1350 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
145518 /* 1360 */ 36, 210, 192, 213, 188, 187, 227, 227, 187, 92,
145519 /* 1370 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
145520 /* 1380 */ 213, 213, 166, 59, 130, 212, 60, 210, 170, 170,
145521 /* 1390 */ 38, 170, 104, 19, 20, 71, 22, 22, 235, 257,
145522 /* 1400 */ 257, 260, 236, 43, 201, 81, 138, 213, 18, 204,
145523 /* 1410 */ 36, 170, 204, 204, 90, 204, 18, 169, 236, 235,
145524 /* 1420 */ 96, 97, 48, 213, 201, 213, 213, 103, 201, 105,
145525 /* 1430 */ 106, 107, 170, 59, 110, 169, 146, 170, 253, 62,
145526 /* 1440 */ 252, 169, 22, 170, 189, 71, 170, 169, 169, 189,
145527 /* 1450 */ 104, 127, 128, 64, 189, 186, 82, 186, 194, 115,
145528 /* 1460 */ 186, 87, 133, 188, 90, 141, 142, 143, 144, 145,
145529 /* 1470 */ 96, 97, 186, 186, 194, 186, 246, 103, 186, 105,
145530 /* 1480 */ 106, 107, 189, 102, 110, 246, 189, 229, 19, 20,
145531 /* 1490 */ 104, 22, 229, 170, 84, 134, 22, 271, 228, 217,
145532 /* 1500 */ 269, 22, 241, 170, 146, 36, 137, 152, 217, 19,
145533 /* 1510 */ 20, 228, 22, 229, 229, 141, 142, 143, 144, 145,
145534 /* 1520 */ 0, 1, 2, 228, 228, 5, 36, 218, 59, 216,
145535 /* 1530 */ 10, 11, 12, 13, 14, 136, 215, 17, 135, 214,
145536 /* 1540 */ 71, 243, 25, 213, 173, 26, 13, 164, 172, 59,
145537 /* 1550 */ 30, 82, 32, 6, 162, 164, 87, 162, 162, 90,
145538 /* 1560 */ 40, 71, 263, 176, 182, 96, 97, 266, 266, 176,
145539 /* 1570 */ 182, 4, 103, 176, 105, 106, 107, 3, 22, 110,
145540 /* 1580 */ 90, 151, 182, 182, 190, 15, 96, 97, 98, 182,
145541 /* 1590 */ 70, 182, 190, 103, 182, 105, 106, 107, 78, 182,
145542 /* 1600 */ 110, 81, 89, 16, 23, 23, 128, 139, 88, 24,
145543 /* 1610 */ 141, 142, 143, 144, 145, 119, 131, 20, 1, 133,
145544 /* 1620 */ 16, 19, 20, 131, 22, 119, 61, 140, 37, 53,
145545 /* 1630 */ 139, 141, 142, 143, 144, 145, 53, 53, 36, 53,
145546 /* 1640 */ 119, 105, 122, 34, 130, 1, 5, 127, 128, 22,
145547 /* 1650 */ 104, 149, 26, 75, 41, 130, 68, 68, 104, 24,
145548 /* 1660 */ 20, 59, 19, 120, 114, 67, 67, 22, 22, 22,
145549 /* 1670 */ 150, 23, 22, 71, 22, 67, 37, 28, 23, 138,
145550 /* 1680 */ 22, 153, 23, 23, 82, 23, 22, 26, 23, 87,
145551 /* 1690 */ 24, 22, 90, 130, 24, 23, 23, 105, 96, 97,
145552 /* 1700 */ 22, 34, 26, 132, 85, 103, 75, 105, 106, 107,
145553 /* 1710 */ 1, 2, 110, 34, 5, 34, 83, 23, 44, 10,
145554 /* 1720 */ 11, 12, 13, 14, 24, 26, 17, 26, 23, 34,
145555 /* 1730 */ 23, 19, 20, 23, 22, 11, 23, 23, 23, 30,
145556 /* 1740 */ 22, 32, 26, 141, 142, 143, 144, 145, 36, 40,
145557 /* 1750 */ 22, 22, 26, 23, 23, 22, 124, 23, 22, 130,
145558 /* 1760 */ 130, 19, 20, 23, 22, 15, 130, 130, 1, 277,
145559 /* 1770 */ 277, 59, 277, 277, 277, 277, 277, 277, 36, 70,
145560 /* 1780 */ 277, 277, 277, 71, 277, 277, 277, 78, 277, 277,
145561 /* 1790 */ 81, 277, 277, 277, 277, 277, 277, 88, 277, 277,
145562 /* 1800 */ 277, 59, 90, 277, 277, 277, 277, 277, 96, 97,
145563 /* 1810 */ 277, 277, 277, 71, 277, 103, 277, 105, 106, 107,
145564 /* 1820 */ 277, 277, 110, 277, 277, 277, 277, 277, 277, 277,
@@ -145580,162 +145499,162 @@
145580 /* 1980 */ 122, 277, 277, 277, 277, 127, 128, 277, 277, 277,
145581 /* 1990 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
145582 /* 2000 */ 277, 277, 277, 277, 277, 277, 277, 277, 150, 277,
145583 /* 2010 */ 277, 277, 277, 277, 277, 277, 277, 277, 277,
145584 };
145585 #define YY_SHIFT_COUNT (515)
145586 #define YY_SHIFT_MIN (0)
145587 #define YY_SHIFT_MAX (1858)
145588 static const unsigned short int yy_shift_ofst[] = {
145589 /* 0 */ 1709, 1520, 1858, 1324, 1324, 54, 1374, 1469, 1602, 1712,
145590 /* 10 */ 1712, 1712, 1712, 1712, 273, 0, 0, 113, 1016, 1712,
145591 /* 20 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 11, 11, 236,
145592 /* 30 */ 595, 54, 54, 54, 54, 54, 54, 93, 177, 270,
145593 /* 40 */ 363, 456, 549, 642, 735, 828, 848, 996, 1144, 1016,
145594 /* 50 */ 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016,
145595 /* 60 */ 1016, 1016, 1016, 1016, 1016, 1016, 1164, 1016, 1257, 1277,
145596 /* 70 */ 1277, 1490, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712,
145597 /* 80 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712,
145598 /* 90 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712,
145599 /* 100 */ 1712, 1712, 1712, 1742, 1712, 1712, 1712, 1712, 1712, 1712,
145600 /* 110 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 143, 162, 162,
145601 /* 120 */ 162, 162, 162, 204, 151, 73, 596, 690, 706, 596,
145602 /* 130 */ 169, 169, 596, 353, 353, 353, 353, 66, 166, 25,
145603 /* 140 */ 2009, 2009, 331, 331, 331, 329, 366, 329, 329, 610,
145604 /* 150 */ 610, 428, 464, 493, 686, 596, 596, 596, 596, 596,
145605 /* 160 */ 596, 596, 596, 596, 596, 596, 596, 596, 596, 596,
145606 /* 170 */ 596, 596, 596, 596, 596, 596, 596, 844, 667, 666,
145607 /* 180 */ 666, 535, 667, 1011, 2009, 2009, 2009, 387, 250, 250,
145608 /* 190 */ 522, 172, 278, 551, 480, 573, 557, 596, 596, 596,
145609 /* 200 */ 596, 596, 596, 596, 596, 13, 596, 596, 596, 596,
145610 /* 210 */ 596, 596, 596, 596, 596, 596, 596, 596, 737, 737,
145611 /* 220 */ 737, 596, 596, 596, 596, 734, 596, 596, 596, 747,
145612 /* 230 */ 596, 596, 781, 596, 596, 596, 596, 596, 596, 596,
145613 /* 240 */ 596, 429, 691, 279, 979, 979, 979, 979, 862, 279,
145614 /* 250 */ 279, 885, 1054, 901, 942, 978, 978, 1056, 942, 942,
145615 /* 260 */ 1056, 614, 990, 812, 1128, 1128, 1128, 978, 766, 1104,
145616 /* 270 */ 1018, 1138, 1326, 1254, 1254, 1352, 1352, 1254, 1288, 1375,
145617 /* 280 */ 1360, 1268, 1390, 1390, 1390, 1390, 1254, 1398, 1268, 1268,
145618 /* 290 */ 1288, 1375, 1360, 1360, 1268, 1254, 1398, 1290, 1377, 1254,
145619 /* 300 */ 1398, 1420, 1254, 1398, 1254, 1398, 1420, 1346, 1346, 1346,
145620 /* 310 */ 1389, 1420, 1346, 1344, 1346, 1389, 1346, 1346, 1420, 1381,
145621 /* 320 */ 1381, 1420, 1329, 1386, 1329, 1386, 1329, 1386, 1329, 1386,
145622 /* 330 */ 1254, 1361, 1410, 1474, 1479, 1254, 1358, 1369, 1361, 1355,
145623 /* 340 */ 1399, 1403, 1268, 1517, 1519, 1533, 1533, 1547, 1547, 1547,
145624 /* 350 */ 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009,
145625 /* 360 */ 2009, 2009, 2009, 2009, 2009, 2009, 286, 345, 568, 1064,
145626 /* 370 */ 1058, 698, 1060, 1147, 373, 1120, 1046, 1148, 1162, 1149,
145627 /* 380 */ 1153, 1154, 1155, 1159, 1180, 1165, 1116, 1220, 1157, 1172,
145628 /* 390 */ 1206, 1207, 1225, 1106, 1111, 1246, 1175, 733, 1567, 1574,
145629 /* 400 */ 1556, 1430, 1570, 1513, 1587, 1581, 1582, 1478, 1468, 1496,
145630 /* 410 */ 1585, 1485, 1597, 1486, 1604, 1617, 1492, 1487, 1506, 1565,
145631 /* 420 */ 1591, 1491, 1576, 1583, 1584, 1586, 1521, 1536, 1609, 1514,
145632 /* 430 */ 1644, 1641, 1627, 1546, 1502, 1588, 1626, 1589, 1578, 1613,
145633 /* 440 */ 1525, 1554, 1635, 1640, 1643, 1543, 1550, 1645, 1598, 1646,
145634 /* 450 */ 1647, 1648, 1650, 1599, 1649, 1652, 1608, 1639, 1655, 1541,
145635 /* 460 */ 1658, 1528, 1659, 1660, 1661, 1662, 1664, 1666, 1665, 1669,
145636 /* 470 */ 1670, 1563, 1672, 1673, 1592, 1667, 1678, 1571, 1676, 1679,
145637 /* 480 */ 1681, 1619, 1631, 1633, 1674, 1694, 1700, 1699, 1701, 1695,
145638 /* 490 */ 1705, 1707, 1710, 1676, 1713, 1714, 1716, 1715, 1718, 1724,
145639 /* 500 */ 1728, 1729, 1730, 1731, 1733, 1734, 1736, 1726, 1632, 1629,
145640 /* 510 */ 1630, 1636, 1637, 1740, 1750, 1767,
145641 };
145642 #define YY_REDUCE_COUNT (365)
145643 #define YY_REDUCE_MIN (-235)
145644 #define YY_REDUCE_MAX (1417)
145645 static const short yy_reduce_ofst[] = {
145646 /* 0 */ -147, 171, 263, -97, 358, -145, -149, -163, 123, 264,
145647 /* 10 */ 305, 398, 404, 446, 401, -171, -157, -235, -175, -79,
145648 /* 20 */ 189, 196, 333, 490, 378, 375, 497, 550, 552, -42,
145649 /* 30 */ -116, 465, 540, 542, 544, 588, 594, -214, -214, -214,
145650 /* 40 */ -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,
145651 /* 50 */ -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,
145652 /* 60 */ -214, -214, -214, -214, -214, -214, -214, -214, -214, -214,
145653 /* 70 */ -214, 543, 582, 590, 633, 658, 661, 675, 677, 685,
145654 /* 80 */ 702, 705, 748, 750, 752, 754, 768, 788, 791, 793,
145655 /* 90 */ 795, 797, 800, 802, 804, 807, 827, 833, 835, 837,
145656 /* 100 */ 839, 841, 843, 845, 847, 870, 873, 893, 916, 918,
145657 /* 110 */ 921, 936, 941, 944, 961, 964, 968, -214, -214, -214,
145658 /* 120 */ -214, -214, -214, -214, -214, -214, 315, 789, -159, 14,
145659 /* 130 */ 111, 434, 463, 247, 700, 247, 700, -176, -214, -214,
145660 /* 140 */ -214, -214, 300, 300, 300, -162, -74, -129, 125, -165,
145661 /* 150 */ -127, 268, 266, 405, 405, -135, 284, 403, 491, 460,
145662 /* 160 */ 148, 335, 514, 649, 212, 124, 325, 687, 971, 602,
145663 /* 170 */ 973, 659, 323, 601, 808, 991, 41, 951, 627, 727,
145664 /* 180 */ 729, 579, 945, 786, 878, 932, 947, -182, -169, -167,
145665 /* 190 */ -121, -46, 16, 39, 176, 289, 313, 364, 473, 537,
145666 /* 200 */ 613, 635, 662, 792, 796, 165, 811, 969, 1002, 1090,
145667 /* 210 */ 1092, 1105, 1107, 1110, 1112, 1117, 1119, 1121, 1081, 1086,
145668 /* 220 */ 1093, 1122, 1124, 1125, 1126, 481, 1127, 1129, 1130, 1068,
145669 /* 230 */ 1131, 1132, 1080, 1134, 16, 1135, 1136, 1137, 1152, 1156,
145670 /* 240 */ 1158, 1065, 1067, 1109, 1097, 1113, 1114, 1115, 481, 1109,
145671 /* 250 */ 1109, 1151, 1160, 1174, 1150, 1118, 1139, 1083, 1167, 1168,
145672 /* 260 */ 1084, 1176, 1145, 1170, 1161, 1178, 1181, 1140, 1103, 1173,
145673 /* 270 */ 1177, 1216, 1141, 1218, 1219, 1142, 1143, 1221, 1166, 1163,
145674 /* 280 */ 1203, 1194, 1205, 1208, 1209, 1211, 1241, 1248, 1210, 1212,
145675 /* 290 */ 1182, 1184, 1223, 1227, 1213, 1262, 1266, 1185, 1188, 1267,
145676 /* 300 */ 1272, 1255, 1273, 1278, 1276, 1279, 1260, 1269, 1271, 1274,
145677 /* 310 */ 1264, 1265, 1286, 1275, 1287, 1280, 1289, 1292, 1293, 1230,
145678 /* 320 */ 1239, 1297, 1258, 1270, 1263, 1283, 1284, 1295, 1285, 1296,
145679 /* 330 */ 1323, 1282, 1226, 1231, 1261, 1333, 1298, 1309, 1291, 1313,
145680 /* 340 */ 1321, 1325, 1330, 1371, 1376, 1383, 1391, 1392, 1395, 1396,
145681 /* 350 */ 1301, 1302, 1299, 1387, 1382, 1388, 1400, 1401, 1393, 1394,
145682 /* 360 */ 1402, 1407, 1409, 1412, 1417, 1397,
145683 };
145684 static const YYACTIONTYPE yy_default[] = {
145685 /* 0 */ 1482, 1482, 1482, 1329, 1115, 1220, 1115, 1115, 1115, 1329,
145686 /* 10 */ 1329, 1329, 1329, 1329, 1115, 1250, 1250, 1380, 1146, 1115,
145687 /* 20 */ 1115, 1115, 1115, 1115, 1115, 1328, 1115, 1115, 1115, 1115,
145688 /* 30 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1256, 1115,
145689 /* 40 */ 1115, 1115, 1115, 1115, 1330, 1331, 1115, 1115, 1115, 1379,
145690 /* 50 */ 1381, 1266, 1265, 1264, 1263, 1362, 1237, 1261, 1254, 1258,
145691 /* 60 */ 1324, 1325, 1323, 1327, 1330, 1331, 1115, 1257, 1295, 1309,
145692 /* 70 */ 1294, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145693 /* 80 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145694 /* 90 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145695 /* 100 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145696 /* 110 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1303, 1308, 1314,
145697 /* 120 */ 1307, 1304, 1297, 1296, 1298, 1299, 1115, 1136, 1185, 1115,
145698 /* 130 */ 1115, 1115, 1115, 1397, 1396, 1115, 1115, 1146, 1300, 1301,
145699 /* 140 */ 1311, 1310, 1387, 1438, 1437, 1115, 1115, 1115, 1115, 1115,
145700 /* 150 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145701 /* 160 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145702 /* 170 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1146, 1142, 1420,
145703 /* 180 */ 1420, 1406, 1142, 1115, 1392, 1220, 1211, 1115, 1115, 1115,
145704 /* 190 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1384, 1382,
145705 /* 200 */ 1115, 1344, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145706 /* 210 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145707 /* 220 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1216,
145708 /* 230 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145709 /* 240 */ 1432, 1115, 1357, 1199, 1216, 1216, 1216, 1216, 1218, 1200,
145710 /* 250 */ 1198, 1210, 1146, 1122, 1260, 1239, 1239, 1471, 1260, 1260,
145711 /* 260 */ 1471, 1160, 1452, 1157, 1250, 1250, 1250, 1239, 1326, 1217,
145712 /* 270 */ 1210, 1115, 1474, 1225, 1225, 1473, 1473, 1225, 1269, 1275,
145713 /* 280 */ 1188, 1260, 1194, 1194, 1194, 1194, 1225, 1133, 1260, 1260,
145714 /* 290 */ 1269, 1275, 1188, 1188, 1260, 1225, 1133, 1361, 1468, 1225,
145715 /* 300 */ 1133, 1337, 1225, 1133, 1225, 1133, 1337, 1186, 1186, 1186,
145716 /* 310 */ 1175, 1337, 1186, 1160, 1186, 1175, 1186, 1186, 1337, 1341,
145717 /* 320 */ 1341, 1337, 1243, 1238, 1243, 1238, 1243, 1238, 1243, 1238,
145718 /* 330 */ 1225, 1244, 1405, 1115, 1332, 1225, 1115, 1255, 1244, 1418,
145719 /* 340 */ 1253, 1251, 1260, 1139, 1178, 1435, 1435, 1431, 1431, 1431,
145720 /* 350 */ 1479, 1479, 1392, 1447, 1146, 1146, 1146, 1146, 1447, 1162,
145721 /* 360 */ 1162, 1146, 1146, 1146, 1146, 1447, 1115, 1115, 1115, 1115,
145722 /* 370 */ 1115, 1115, 1442, 1115, 1346, 1229, 1115, 1115, 1115, 1115,
145723 /* 380 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145724 /* 390 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1280, 1115, 1118,
145725 /* 400 */ 1389, 1115, 1115, 1388, 1115, 1115, 1115, 1115, 1115, 1115,
145726 /* 410 */ 1230, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145727 /* 420 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1470,
145728 /* 430 */ 1115, 1115, 1115, 1115, 1115, 1115, 1360, 1359, 1115, 1115,
145729 /* 440 */ 1227, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145730 /* 450 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145731 /* 460 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115,
145732 /* 470 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1252, 1115,
145733 /* 480 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1419, 1245, 1115,
145734 /* 490 */ 1115, 1115, 1115, 1461, 1115, 1115, 1115, 1115, 1115, 1115,
145735 /* 500 */ 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1456, 1202, 1282,
145736 /* 510 */ 1115, 1281, 1285, 1115, 1127, 1115,
145737 };
145738 /********** End of lemon-generated parsing tables *****************************/
145739
145740 /* The next table maps tokens (terminal symbols) into fallback tokens.
145741 ** If a construct like the following:
@@ -146145,32 +146064,32 @@
146145 /* 211 */ "selcollist",
146146 /* 212 */ "from",
146147 /* 213 */ "where_opt",
146148 /* 214 */ "groupby_opt",
146149 /* 215 */ "having_opt",
146150 /* 216 */ "windowdefn_opt",
146151 /* 217 */ "orderby_opt",
146152 /* 218 */ "limit_opt",
146153 /* 219 */ "values",
146154 /* 220 */ "nexprlist",
146155 /* 221 */ "exprlist",
146156 /* 222 */ "sclp",
146157 /* 223 */ "as",
146158 /* 224 */ "seltablist",
146159 /* 225 */ "stl_prefix",
146160 /* 226 */ "joinop",
146161 /* 227 */ "indexed_opt",
146162 /* 228 */ "on_opt",
146163 /* 229 */ "using_opt",
146164 /* 230 */ "xfullname",
146165 /* 231 */ "idlist",
146166 /* 232 */ "with",
146167 /* 233 */ "setlist",
146168 /* 234 */ "insert_cmd",
146169 /* 235 */ "idlist_opt",
146170 /* 236 */ "upsert",
146171 /* 237 */ "over_opt",
146172 /* 238 */ "likeop",
146173 /* 239 */ "between_op",
146174 /* 240 */ "in_op",
146175 /* 241 */ "paren_exprlist",
146176 /* 242 */ "case_operand",
@@ -146300,288 +146219,289 @@
146300 /* 82 */ "select ::= selectnowith",
146301 /* 83 */ "selectnowith ::= selectnowith multiselect_op oneselect",
146302 /* 84 */ "multiselect_op ::= UNION",
146303 /* 85 */ "multiselect_op ::= UNION ALL",
146304 /* 86 */ "multiselect_op ::= EXCEPT|INTERSECT",
146305 /* 87 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt windowdefn_opt orderby_opt limit_opt",
146306 /* 88 */ "values ::= VALUES LP nexprlist RP",
146307 /* 89 */ "values ::= values COMMA LP exprlist RP",
146308 /* 90 */ "distinct ::= DISTINCT",
146309 /* 91 */ "distinct ::= ALL",
146310 /* 92 */ "distinct ::=",
146311 /* 93 */ "sclp ::=",
146312 /* 94 */ "selcollist ::= sclp scanpt expr scanpt as",
146313 /* 95 */ "selcollist ::= sclp scanpt STAR",
146314 /* 96 */ "selcollist ::= sclp scanpt nm DOT STAR",
146315 /* 97 */ "as ::= AS nm",
146316 /* 98 */ "as ::=",
146317 /* 99 */ "from ::=",
146318 /* 100 */ "from ::= FROM seltablist",
146319 /* 101 */ "stl_prefix ::= seltablist joinop",
146320 /* 102 */ "stl_prefix ::=",
146321 /* 103 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
146322 /* 104 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
146323 /* 105 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
146324 /* 106 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
146325 /* 107 */ "dbnm ::=",
146326 /* 108 */ "dbnm ::= DOT nm",
146327 /* 109 */ "fullname ::= nm",
146328 /* 110 */ "fullname ::= nm DOT nm",
146329 /* 111 */ "xfullname ::= nm",
146330 /* 112 */ "xfullname ::= nm DOT nm",
146331 /* 113 */ "xfullname ::= nm DOT nm AS nm",
146332 /* 114 */ "xfullname ::= nm AS nm",
146333 /* 115 */ "joinop ::= COMMA|JOIN",
146334 /* 116 */ "joinop ::= JOIN_KW JOIN",
146335 /* 117 */ "joinop ::= JOIN_KW nm JOIN",
146336 /* 118 */ "joinop ::= JOIN_KW nm nm JOIN",
146337 /* 119 */ "on_opt ::= ON expr",
146338 /* 120 */ "on_opt ::=",
146339 /* 121 */ "indexed_opt ::=",
146340 /* 122 */ "indexed_opt ::= INDEXED BY nm",
146341 /* 123 */ "indexed_opt ::= NOT INDEXED",
146342 /* 124 */ "using_opt ::= USING LP idlist RP",
146343 /* 125 */ "using_opt ::=",
146344 /* 126 */ "orderby_opt ::=",
146345 /* 127 */ "orderby_opt ::= ORDER BY sortlist",
146346 /* 128 */ "sortlist ::= sortlist COMMA expr sortorder",
146347 /* 129 */ "sortlist ::= expr sortorder",
146348 /* 130 */ "sortorder ::= ASC",
146349 /* 131 */ "sortorder ::= DESC",
146350 /* 132 */ "sortorder ::=",
146351 /* 133 */ "groupby_opt ::=",
146352 /* 134 */ "groupby_opt ::= GROUP BY nexprlist",
146353 /* 135 */ "having_opt ::=",
146354 /* 136 */ "having_opt ::= HAVING expr",
146355 /* 137 */ "limit_opt ::=",
146356 /* 138 */ "limit_opt ::= LIMIT expr",
146357 /* 139 */ "limit_opt ::= LIMIT expr OFFSET expr",
146358 /* 140 */ "limit_opt ::= LIMIT expr COMMA expr",
146359 /* 141 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
146360 /* 142 */ "where_opt ::=",
146361 /* 143 */ "where_opt ::= WHERE expr",
146362 /* 144 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
146363 /* 145 */ "setlist ::= setlist COMMA nm EQ expr",
146364 /* 146 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
146365 /* 147 */ "setlist ::= nm EQ expr",
146366 /* 148 */ "setlist ::= LP idlist RP EQ expr",
146367 /* 149 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
146368 /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
146369 /* 151 */ "upsert ::=",
146370 /* 152 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
146371 /* 153 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
146372 /* 154 */ "upsert ::= ON CONFLICT DO NOTHING",
146373 /* 155 */ "insert_cmd ::= INSERT orconf",
146374 /* 156 */ "insert_cmd ::= REPLACE",
146375 /* 157 */ "idlist_opt ::=",
146376 /* 158 */ "idlist_opt ::= LP idlist RP",
146377 /* 159 */ "idlist ::= idlist COMMA nm",
146378 /* 160 */ "idlist ::= nm",
146379 /* 161 */ "expr ::= LP expr RP",
146380 /* 162 */ "expr ::= ID|INDEXED",
146381 /* 163 */ "expr ::= JOIN_KW",
146382 /* 164 */ "expr ::= nm DOT nm",
146383 /* 165 */ "expr ::= nm DOT nm DOT nm",
146384 /* 166 */ "term ::= NULL|FLOAT|BLOB",
146385 /* 167 */ "term ::= STRING",
146386 /* 168 */ "term ::= INTEGER",
146387 /* 169 */ "expr ::= VARIABLE",
146388 /* 170 */ "expr ::= expr COLLATE ID|STRING",
146389 /* 171 */ "expr ::= CAST LP expr AS typetoken RP",
146390 /* 172 */ "expr ::= ID|INDEXED LP distinct exprlist RP over_opt",
146391 /* 173 */ "expr ::= ID|INDEXED LP STAR RP over_opt",
146392 /* 174 */ "term ::= CTIME_KW",
146393 /* 175 */ "expr ::= LP nexprlist COMMA expr RP",
146394 /* 176 */ "expr ::= expr AND expr",
146395 /* 177 */ "expr ::= expr OR expr",
146396 /* 178 */ "expr ::= expr LT|GT|GE|LE expr",
146397 /* 179 */ "expr ::= expr EQ|NE expr",
146398 /* 180 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
146399 /* 181 */ "expr ::= expr PLUS|MINUS expr",
146400 /* 182 */ "expr ::= expr STAR|SLASH|REM expr",
146401 /* 183 */ "expr ::= expr CONCAT expr",
146402 /* 184 */ "likeop ::= NOT LIKE_KW|MATCH",
146403 /* 185 */ "expr ::= expr likeop expr",
146404 /* 186 */ "expr ::= expr likeop expr ESCAPE expr",
146405 /* 187 */ "expr ::= expr ISNULL|NOTNULL",
146406 /* 188 */ "expr ::= expr NOT NULL",
146407 /* 189 */ "expr ::= expr IS expr",
146408 /* 190 */ "expr ::= expr IS NOT expr",
146409 /* 191 */ "expr ::= NOT expr",
146410 /* 192 */ "expr ::= BITNOT expr",
146411 /* 193 */ "expr ::= PLUS|MINUS expr",
146412 /* 194 */ "between_op ::= BETWEEN",
146413 /* 195 */ "between_op ::= NOT BETWEEN",
146414 /* 196 */ "expr ::= expr between_op expr AND expr",
146415 /* 197 */ "in_op ::= IN",
146416 /* 198 */ "in_op ::= NOT IN",
146417 /* 199 */ "expr ::= expr in_op LP exprlist RP",
146418 /* 200 */ "expr ::= LP select RP",
146419 /* 201 */ "expr ::= expr in_op LP select RP",
146420 /* 202 */ "expr ::= expr in_op nm dbnm paren_exprlist",
146421 /* 203 */ "expr ::= EXISTS LP select RP",
146422 /* 204 */ "expr ::= CASE case_operand case_exprlist case_else END",
146423 /* 205 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
146424 /* 206 */ "case_exprlist ::= WHEN expr THEN expr",
146425 /* 207 */ "case_else ::= ELSE expr",
146426 /* 208 */ "case_else ::=",
146427 /* 209 */ "case_operand ::= expr",
146428 /* 210 */ "case_operand ::=",
146429 /* 211 */ "exprlist ::=",
146430 /* 212 */ "nexprlist ::= nexprlist COMMA expr",
146431 /* 213 */ "nexprlist ::= expr",
146432 /* 214 */ "paren_exprlist ::=",
146433 /* 215 */ "paren_exprlist ::= LP exprlist RP",
146434 /* 216 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
146435 /* 217 */ "uniqueflag ::= UNIQUE",
146436 /* 218 */ "uniqueflag ::=",
146437 /* 219 */ "eidlist_opt ::=",
146438 /* 220 */ "eidlist_opt ::= LP eidlist RP",
146439 /* 221 */ "eidlist ::= eidlist COMMA nm collate sortorder",
146440 /* 222 */ "eidlist ::= nm collate sortorder",
146441 /* 223 */ "collate ::=",
146442 /* 224 */ "collate ::= COLLATE ID|STRING",
146443 /* 225 */ "cmd ::= DROP INDEX ifexists fullname",
146444 /* 226 */ "cmd ::= VACUUM",
146445 /* 227 */ "cmd ::= VACUUM nm",
146446 /* 228 */ "cmd ::= PRAGMA nm dbnm",
146447 /* 229 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
146448 /* 230 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
146449 /* 231 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
146450 /* 232 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
146451 /* 233 */ "plus_num ::= PLUS INTEGER|FLOAT",
146452 /* 234 */ "minus_num ::= MINUS INTEGER|FLOAT",
146453 /* 235 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
146454 /* 236 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
146455 /* 237 */ "trigger_time ::= BEFORE|AFTER",
146456 /* 238 */ "trigger_time ::= INSTEAD OF",
146457 /* 239 */ "trigger_time ::=",
146458 /* 240 */ "trigger_event ::= DELETE|INSERT",
146459 /* 241 */ "trigger_event ::= UPDATE",
146460 /* 242 */ "trigger_event ::= UPDATE OF idlist",
146461 /* 243 */ "when_clause ::=",
146462 /* 244 */ "when_clause ::= WHEN expr",
146463 /* 245 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
146464 /* 246 */ "trigger_cmd_list ::= trigger_cmd SEMI",
146465 /* 247 */ "trnm ::= nm DOT nm",
146466 /* 248 */ "tridxby ::= INDEXED BY nm",
146467 /* 249 */ "tridxby ::= NOT INDEXED",
146468 /* 250 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
146469 /* 251 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
146470 /* 252 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
146471 /* 253 */ "trigger_cmd ::= scanpt select scanpt",
146472 /* 254 */ "expr ::= RAISE LP IGNORE RP",
146473 /* 255 */ "expr ::= RAISE LP raisetype COMMA nm RP",
146474 /* 256 */ "raisetype ::= ROLLBACK",
146475 /* 257 */ "raisetype ::= ABORT",
146476 /* 258 */ "raisetype ::= FAIL",
146477 /* 259 */ "cmd ::= DROP TRIGGER ifexists fullname",
146478 /* 260 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
146479 /* 261 */ "cmd ::= DETACH database_kw_opt expr",
146480 /* 262 */ "key_opt ::=",
146481 /* 263 */ "key_opt ::= KEY expr",
146482 /* 264 */ "cmd ::= REINDEX",
146483 /* 265 */ "cmd ::= REINDEX nm dbnm",
146484 /* 266 */ "cmd ::= ANALYZE",
146485 /* 267 */ "cmd ::= ANALYZE nm dbnm",
146486 /* 268 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
146487 /* 269 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
146488 /* 270 */ "add_column_fullname ::= fullname",
146489 /* 271 */ "cmd ::= create_vtab",
146490 /* 272 */ "cmd ::= create_vtab LP vtabarglist RP",
146491 /* 273 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
146492 /* 274 */ "vtabarg ::=",
146493 /* 275 */ "vtabargtoken ::= ANY",
146494 /* 276 */ "vtabargtoken ::= lp anylist RP",
146495 /* 277 */ "lp ::= LP",
146496 /* 278 */ "with ::= WITH wqlist",
146497 /* 279 */ "with ::= WITH RECURSIVE wqlist",
146498 /* 280 */ "wqlist ::= nm eidlist_opt AS LP select RP",
146499 /* 281 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
146500 /* 282 */ "windowdefn_list ::= windowdefn",
146501 /* 283 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
146502 /* 284 */ "windowdefn ::= nm AS window",
146503 /* 285 */ "window ::= LP part_opt orderby_opt frame_opt RP",
146504 /* 286 */ "part_opt ::= PARTITION BY exprlist",
146505 /* 287 */ "part_opt ::=",
146506 /* 288 */ "frame_opt ::=",
146507 /* 289 */ "frame_opt ::= range_or_rows frame_bound_s",
146508 /* 290 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e",
146509 /* 291 */ "range_or_rows ::= RANGE",
146510 /* 292 */ "range_or_rows ::= ROWS",
146511 /* 293 */ "frame_bound_s ::= frame_bound",
146512 /* 294 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
146513 /* 295 */ "frame_bound_e ::= frame_bound",
146514 /* 296 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
146515 /* 297 */ "frame_bound ::= expr PRECEDING",
146516 /* 298 */ "frame_bound ::= CURRENT ROW",
146517 /* 299 */ "frame_bound ::= expr FOLLOWING",
146518 /* 300 */ "windowdefn_opt ::=",
146519 /* 301 */ "windowdefn_opt ::= WINDOW windowdefn_list",
146520 /* 302 */ "over_opt ::=",
146521 /* 303 */ "over_opt ::= filter_opt OVER window",
146522 /* 304 */ "over_opt ::= filter_opt OVER nm",
146523 /* 305 */ "filter_opt ::=",
146524 /* 306 */ "filter_opt ::= FILTER LP WHERE expr RP",
146525 /* 307 */ "input ::= cmdlist",
146526 /* 308 */ "cmdlist ::= cmdlist ecmd",
146527 /* 309 */ "cmdlist ::= ecmd",
146528 /* 310 */ "ecmd ::= SEMI",
146529 /* 311 */ "ecmd ::= cmdx SEMI",
146530 /* 312 */ "ecmd ::= explain cmdx",
146531 /* 313 */ "trans_opt ::=",
146532 /* 314 */ "trans_opt ::= TRANSACTION",
146533 /* 315 */ "trans_opt ::= TRANSACTION nm",
146534 /* 316 */ "savepoint_opt ::= SAVEPOINT",
146535 /* 317 */ "savepoint_opt ::=",
146536 /* 318 */ "cmd ::= create_table create_table_args",
146537 /* 319 */ "columnlist ::= columnlist COMMA columnname carglist",
146538 /* 320 */ "columnlist ::= columnname carglist",
146539 /* 321 */ "nm ::= ID|INDEXED",
146540 /* 322 */ "nm ::= STRING",
146541 /* 323 */ "nm ::= JOIN_KW",
146542 /* 324 */ "typetoken ::= typename",
146543 /* 325 */ "typename ::= ID|STRING",
146544 /* 326 */ "signed ::= plus_num",
146545 /* 327 */ "signed ::= minus_num",
146546 /* 328 */ "carglist ::= carglist ccons",
146547 /* 329 */ "carglist ::=",
146548 /* 330 */ "ccons ::= NULL onconf",
146549 /* 331 */ "conslist_opt ::= COMMA conslist",
146550 /* 332 */ "conslist ::= conslist tconscomma tcons",
146551 /* 333 */ "conslist ::= tcons",
146552 /* 334 */ "tconscomma ::=",
146553 /* 335 */ "defer_subclause_opt ::= defer_subclause",
146554 /* 336 */ "resolvetype ::= raisetype",
146555 /* 337 */ "selectnowith ::= oneselect",
146556 /* 338 */ "oneselect ::= values",
146557 /* 339 */ "sclp ::= selcollist COMMA",
146558 /* 340 */ "as ::= ID|STRING",
146559 /* 341 */ "expr ::= term",
146560 /* 342 */ "likeop ::= LIKE_KW|MATCH",
146561 /* 343 */ "exprlist ::= nexprlist",
146562 /* 344 */ "nmnum ::= plus_num",
146563 /* 345 */ "nmnum ::= nm",
146564 /* 346 */ "nmnum ::= ON",
146565 /* 347 */ "nmnum ::= DELETE",
146566 /* 348 */ "nmnum ::= DEFAULT",
146567 /* 349 */ "plus_num ::= INTEGER|FLOAT",
146568 /* 350 */ "foreach_clause ::=",
146569 /* 351 */ "foreach_clause ::= FOR EACH ROW",
146570 /* 352 */ "trnm ::= nm",
146571 /* 353 */ "tridxby ::=",
146572 /* 354 */ "database_kw_opt ::= DATABASE",
146573 /* 355 */ "database_kw_opt ::=",
146574 /* 356 */ "kwcolumn_opt ::=",
146575 /* 357 */ "kwcolumn_opt ::= COLUMNKW",
146576 /* 358 */ "vtabarglist ::= vtabarg",
146577 /* 359 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
146578 /* 360 */ "vtabarg ::= vtabarg vtabargtoken",
146579 /* 361 */ "anylist ::=",
146580 /* 362 */ "anylist ::= anylist LP anylist RP",
146581 /* 363 */ "anylist ::= anylist ANY",
146582 /* 364 */ "with ::=",
 
146583 };
146584 #endif /* NDEBUG */
146585
146586
146587 #if YYSTACKDEPTH<=0
@@ -146715,11 +146635,11 @@
146715 break;
146716 case 184: /* term */
146717 case 185: /* expr */
146718 case 213: /* where_opt */
146719 case 215: /* having_opt */
146720 case 228: /* on_opt */
146721 case 242: /* case_operand */
146722 case 244: /* case_else */
146723 case 253: /* when_clause */
146724 case 258: /* key_opt */
146725 case 272: /* filter_opt */
@@ -146730,14 +146650,14 @@
146730 case 189: /* eidlist_opt */
146731 case 198: /* sortlist */
146732 case 199: /* eidlist */
146733 case 211: /* selcollist */
146734 case 214: /* groupby_opt */
146735 case 217: /* orderby_opt */
146736 case 220: /* nexprlist */
146737 case 221: /* exprlist */
146738 case 222: /* sclp */
146739 case 233: /* setlist */
146740 case 241: /* paren_exprlist */
146741 case 243: /* case_exprlist */
146742 case 271: /* part_opt */
146743 {
@@ -146744,12 +146664,12 @@
146744 sqlite3ExprListDelete(pParse->db, (yypminor->yy420));
146745 }
146746 break;
146747 case 205: /* fullname */
146748 case 212: /* from */
146749 case 224: /* seltablist */
146750 case 225: /* stl_prefix */
146751 case 230: /* xfullname */
146752 {
146753 sqlite3SrcListDelete(pParse->db, (yypminor->yy135));
146754 }
146755 break;
@@ -146756,24 +146676,24 @@
146756 case 208: /* wqlist */
146757 {
146758 sqlite3WithDelete(pParse->db, (yypminor->yy449));
146759 }
146760 break;
146761 case 216: /* windowdefn_opt */
146762 case 267: /* windowdefn_list */
146763 {
146764 sqlite3WindowListDelete(pParse->db, (yypminor->yy327));
146765 }
146766 break;
146767 case 229: /* using_opt */
146768 case 231: /* idlist */
146769 case 235: /* idlist_opt */
146770 {
146771 sqlite3IdListDelete(pParse->db, (yypminor->yy48));
146772 }
146773 break;
146774 case 237: /* over_opt */
146775 case 268: /* windowdefn */
146776 case 269: /* window */
146777 case 270: /* frame_opt */
146778 {
146779 sqlite3WindowDelete(pParse->db, (yypminor->yy327));
@@ -147178,288 +147098,289 @@
147178 { 174, -1 }, /* (82) select ::= selectnowith */
147179 { 206, -3 }, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
147180 { 209, -1 }, /* (84) multiselect_op ::= UNION */
147181 { 209, -2 }, /* (85) multiselect_op ::= UNION ALL */
147182 { 209, -1 }, /* (86) multiselect_op ::= EXCEPT|INTERSECT */
147183 { 207, -10 }, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt windowdefn_opt orderby_opt limit_opt */
147184 { 219, -4 }, /* (88) values ::= VALUES LP nexprlist RP */
147185 { 219, -5 }, /* (89) values ::= values COMMA LP exprlist RP */
147186 { 210, -1 }, /* (90) distinct ::= DISTINCT */
147187 { 210, -1 }, /* (91) distinct ::= ALL */
147188 { 210, 0 }, /* (92) distinct ::= */
147189 { 222, 0 }, /* (93) sclp ::= */
147190 { 211, -5 }, /* (94) selcollist ::= sclp scanpt expr scanpt as */
147191 { 211, -3 }, /* (95) selcollist ::= sclp scanpt STAR */
147192 { 211, -5 }, /* (96) selcollist ::= sclp scanpt nm DOT STAR */
147193 { 223, -2 }, /* (97) as ::= AS nm */
147194 { 223, 0 }, /* (98) as ::= */
147195 { 212, 0 }, /* (99) from ::= */
147196 { 212, -2 }, /* (100) from ::= FROM seltablist */
147197 { 225, -2 }, /* (101) stl_prefix ::= seltablist joinop */
147198 { 225, 0 }, /* (102) stl_prefix ::= */
147199 { 224, -7 }, /* (103) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
147200 { 224, -9 }, /* (104) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
147201 { 224, -7 }, /* (105) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
147202 { 224, -7 }, /* (106) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
147203 { 170, 0 }, /* (107) dbnm ::= */
147204 { 170, -2 }, /* (108) dbnm ::= DOT nm */
147205 { 205, -1 }, /* (109) fullname ::= nm */
147206 { 205, -3 }, /* (110) fullname ::= nm DOT nm */
147207 { 230, -1 }, /* (111) xfullname ::= nm */
147208 { 230, -3 }, /* (112) xfullname ::= nm DOT nm */
147209 { 230, -5 }, /* (113) xfullname ::= nm DOT nm AS nm */
147210 { 230, -3 }, /* (114) xfullname ::= nm AS nm */
147211 { 226, -1 }, /* (115) joinop ::= COMMA|JOIN */
147212 { 226, -2 }, /* (116) joinop ::= JOIN_KW JOIN */
147213 { 226, -3 }, /* (117) joinop ::= JOIN_KW nm JOIN */
147214 { 226, -4 }, /* (118) joinop ::= JOIN_KW nm nm JOIN */
147215 { 228, -2 }, /* (119) on_opt ::= ON expr */
147216 { 228, 0 }, /* (120) on_opt ::= */
147217 { 227, 0 }, /* (121) indexed_opt ::= */
147218 { 227, -3 }, /* (122) indexed_opt ::= INDEXED BY nm */
147219 { 227, -2 }, /* (123) indexed_opt ::= NOT INDEXED */
147220 { 229, -4 }, /* (124) using_opt ::= USING LP idlist RP */
147221 { 229, 0 }, /* (125) using_opt ::= */
147222 { 217, 0 }, /* (126) orderby_opt ::= */
147223 { 217, -3 }, /* (127) orderby_opt ::= ORDER BY sortlist */
147224 { 198, -4 }, /* (128) sortlist ::= sortlist COMMA expr sortorder */
147225 { 198, -2 }, /* (129) sortlist ::= expr sortorder */
147226 { 187, -1 }, /* (130) sortorder ::= ASC */
147227 { 187, -1 }, /* (131) sortorder ::= DESC */
147228 { 187, 0 }, /* (132) sortorder ::= */
147229 { 214, 0 }, /* (133) groupby_opt ::= */
147230 { 214, -3 }, /* (134) groupby_opt ::= GROUP BY nexprlist */
147231 { 215, 0 }, /* (135) having_opt ::= */
147232 { 215, -2 }, /* (136) having_opt ::= HAVING expr */
147233 { 218, 0 }, /* (137) limit_opt ::= */
147234 { 218, -2 }, /* (138) limit_opt ::= LIMIT expr */
147235 { 218, -4 }, /* (139) limit_opt ::= LIMIT expr OFFSET expr */
147236 { 218, -4 }, /* (140) limit_opt ::= LIMIT expr COMMA expr */
147237 { 160, -6 }, /* (141) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
147238 { 213, 0 }, /* (142) where_opt ::= */
147239 { 213, -2 }, /* (143) where_opt ::= WHERE expr */
147240 { 160, -8 }, /* (144) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
147241 { 233, -5 }, /* (145) setlist ::= setlist COMMA nm EQ expr */
147242 { 233, -7 }, /* (146) setlist ::= setlist COMMA LP idlist RP EQ expr */
147243 { 233, -3 }, /* (147) setlist ::= nm EQ expr */
147244 { 233, -5 }, /* (148) setlist ::= LP idlist RP EQ expr */
147245 { 160, -7 }, /* (149) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
147246 { 160, -7 }, /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
147247 { 236, 0 }, /* (151) upsert ::= */
147248 { 236, -11 }, /* (152) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
147249 { 236, -8 }, /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
147250 { 236, -4 }, /* (154) upsert ::= ON CONFLICT DO NOTHING */
147251 { 234, -2 }, /* (155) insert_cmd ::= INSERT orconf */
147252 { 234, -1 }, /* (156) insert_cmd ::= REPLACE */
147253 { 235, 0 }, /* (157) idlist_opt ::= */
147254 { 235, -3 }, /* (158) idlist_opt ::= LP idlist RP */
147255 { 231, -3 }, /* (159) idlist ::= idlist COMMA nm */
147256 { 231, -1 }, /* (160) idlist ::= nm */
147257 { 185, -3 }, /* (161) expr ::= LP expr RP */
147258 { 185, -1 }, /* (162) expr ::= ID|INDEXED */
147259 { 185, -1 }, /* (163) expr ::= JOIN_KW */
147260 { 185, -3 }, /* (164) expr ::= nm DOT nm */
147261 { 185, -5 }, /* (165) expr ::= nm DOT nm DOT nm */
147262 { 184, -1 }, /* (166) term ::= NULL|FLOAT|BLOB */
147263 { 184, -1 }, /* (167) term ::= STRING */
147264 { 184, -1 }, /* (168) term ::= INTEGER */
147265 { 185, -1 }, /* (169) expr ::= VARIABLE */
147266 { 185, -3 }, /* (170) expr ::= expr COLLATE ID|STRING */
147267 { 185, -6 }, /* (171) expr ::= CAST LP expr AS typetoken RP */
147268 { 185, -6 }, /* (172) expr ::= ID|INDEXED LP distinct exprlist RP over_opt */
147269 { 185, -5 }, /* (173) expr ::= ID|INDEXED LP STAR RP over_opt */
147270 { 184, -1 }, /* (174) term ::= CTIME_KW */
147271 { 185, -5 }, /* (175) expr ::= LP nexprlist COMMA expr RP */
147272 { 185, -3 }, /* (176) expr ::= expr AND expr */
147273 { 185, -3 }, /* (177) expr ::= expr OR expr */
147274 { 185, -3 }, /* (178) expr ::= expr LT|GT|GE|LE expr */
147275 { 185, -3 }, /* (179) expr ::= expr EQ|NE expr */
147276 { 185, -3 }, /* (180) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
147277 { 185, -3 }, /* (181) expr ::= expr PLUS|MINUS expr */
147278 { 185, -3 }, /* (182) expr ::= expr STAR|SLASH|REM expr */
147279 { 185, -3 }, /* (183) expr ::= expr CONCAT expr */
147280 { 238, -2 }, /* (184) likeop ::= NOT LIKE_KW|MATCH */
147281 { 185, -3 }, /* (185) expr ::= expr likeop expr */
147282 { 185, -5 }, /* (186) expr ::= expr likeop expr ESCAPE expr */
147283 { 185, -2 }, /* (187) expr ::= expr ISNULL|NOTNULL */
147284 { 185, -3 }, /* (188) expr ::= expr NOT NULL */
147285 { 185, -3 }, /* (189) expr ::= expr IS expr */
147286 { 185, -4 }, /* (190) expr ::= expr IS NOT expr */
147287 { 185, -2 }, /* (191) expr ::= NOT expr */
147288 { 185, -2 }, /* (192) expr ::= BITNOT expr */
147289 { 185, -2 }, /* (193) expr ::= PLUS|MINUS expr */
147290 { 239, -1 }, /* (194) between_op ::= BETWEEN */
147291 { 239, -2 }, /* (195) between_op ::= NOT BETWEEN */
147292 { 185, -5 }, /* (196) expr ::= expr between_op expr AND expr */
147293 { 240, -1 }, /* (197) in_op ::= IN */
147294 { 240, -2 }, /* (198) in_op ::= NOT IN */
147295 { 185, -5 }, /* (199) expr ::= expr in_op LP exprlist RP */
147296 { 185, -3 }, /* (200) expr ::= LP select RP */
147297 { 185, -5 }, /* (201) expr ::= expr in_op LP select RP */
147298 { 185, -5 }, /* (202) expr ::= expr in_op nm dbnm paren_exprlist */
147299 { 185, -4 }, /* (203) expr ::= EXISTS LP select RP */
147300 { 185, -5 }, /* (204) expr ::= CASE case_operand case_exprlist case_else END */
147301 { 243, -5 }, /* (205) case_exprlist ::= case_exprlist WHEN expr THEN expr */
147302 { 243, -4 }, /* (206) case_exprlist ::= WHEN expr THEN expr */
147303 { 244, -2 }, /* (207) case_else ::= ELSE expr */
147304 { 244, 0 }, /* (208) case_else ::= */
147305 { 242, -1 }, /* (209) case_operand ::= expr */
147306 { 242, 0 }, /* (210) case_operand ::= */
147307 { 221, 0 }, /* (211) exprlist ::= */
147308 { 220, -3 }, /* (212) nexprlist ::= nexprlist COMMA expr */
147309 { 220, -1 }, /* (213) nexprlist ::= expr */
147310 { 241, 0 }, /* (214) paren_exprlist ::= */
147311 { 241, -3 }, /* (215) paren_exprlist ::= LP exprlist RP */
147312 { 160, -12 }, /* (216) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
147313 { 245, -1 }, /* (217) uniqueflag ::= UNIQUE */
147314 { 245, 0 }, /* (218) uniqueflag ::= */
147315 { 189, 0 }, /* (219) eidlist_opt ::= */
147316 { 189, -3 }, /* (220) eidlist_opt ::= LP eidlist RP */
147317 { 199, -5 }, /* (221) eidlist ::= eidlist COMMA nm collate sortorder */
147318 { 199, -3 }, /* (222) eidlist ::= nm collate sortorder */
147319 { 246, 0 }, /* (223) collate ::= */
147320 { 246, -2 }, /* (224) collate ::= COLLATE ID|STRING */
147321 { 160, -4 }, /* (225) cmd ::= DROP INDEX ifexists fullname */
147322 { 160, -1 }, /* (226) cmd ::= VACUUM */
147323 { 160, -2 }, /* (227) cmd ::= VACUUM nm */
147324 { 160, -3 }, /* (228) cmd ::= PRAGMA nm dbnm */
147325 { 160, -5 }, /* (229) cmd ::= PRAGMA nm dbnm EQ nmnum */
147326 { 160, -6 }, /* (230) cmd ::= PRAGMA nm dbnm LP nmnum RP */
147327 { 160, -5 }, /* (231) cmd ::= PRAGMA nm dbnm EQ minus_num */
147328 { 160, -6 }, /* (232) cmd ::= PRAGMA nm dbnm LP minus_num RP */
147329 { 180, -2 }, /* (233) plus_num ::= PLUS INTEGER|FLOAT */
147330 { 181, -2 }, /* (234) minus_num ::= MINUS INTEGER|FLOAT */
147331 { 160, -5 }, /* (235) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
147332 { 248, -11 }, /* (236) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
147333 { 250, -1 }, /* (237) trigger_time ::= BEFORE|AFTER */
147334 { 250, -2 }, /* (238) trigger_time ::= INSTEAD OF */
147335 { 250, 0 }, /* (239) trigger_time ::= */
147336 { 251, -1 }, /* (240) trigger_event ::= DELETE|INSERT */
147337 { 251, -1 }, /* (241) trigger_event ::= UPDATE */
147338 { 251, -3 }, /* (242) trigger_event ::= UPDATE OF idlist */
147339 { 253, 0 }, /* (243) when_clause ::= */
147340 { 253, -2 }, /* (244) when_clause ::= WHEN expr */
147341 { 249, -3 }, /* (245) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
147342 { 249, -2 }, /* (246) trigger_cmd_list ::= trigger_cmd SEMI */
147343 { 255, -3 }, /* (247) trnm ::= nm DOT nm */
147344 { 256, -3 }, /* (248) tridxby ::= INDEXED BY nm */
147345 { 256, -2 }, /* (249) tridxby ::= NOT INDEXED */
147346 { 254, -8 }, /* (250) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
147347 { 254, -8 }, /* (251) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
147348 { 254, -6 }, /* (252) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
147349 { 254, -3 }, /* (253) trigger_cmd ::= scanpt select scanpt */
147350 { 185, -4 }, /* (254) expr ::= RAISE LP IGNORE RP */
147351 { 185, -6 }, /* (255) expr ::= RAISE LP raisetype COMMA nm RP */
147352 { 203, -1 }, /* (256) raisetype ::= ROLLBACK */
147353 { 203, -1 }, /* (257) raisetype ::= ABORT */
147354 { 203, -1 }, /* (258) raisetype ::= FAIL */
147355 { 160, -4 }, /* (259) cmd ::= DROP TRIGGER ifexists fullname */
147356 { 160, -6 }, /* (260) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
147357 { 160, -3 }, /* (261) cmd ::= DETACH database_kw_opt expr */
147358 { 258, 0 }, /* (262) key_opt ::= */
147359 { 258, -2 }, /* (263) key_opt ::= KEY expr */
147360 { 160, -1 }, /* (264) cmd ::= REINDEX */
147361 { 160, -3 }, /* (265) cmd ::= REINDEX nm dbnm */
147362 { 160, -1 }, /* (266) cmd ::= ANALYZE */
147363 { 160, -3 }, /* (267) cmd ::= ANALYZE nm dbnm */
147364 { 160, -6 }, /* (268) cmd ::= ALTER TABLE fullname RENAME TO nm */
147365 { 160, -7 }, /* (269) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
147366 { 259, -1 }, /* (270) add_column_fullname ::= fullname */
147367 { 160, -1 }, /* (271) cmd ::= create_vtab */
147368 { 160, -4 }, /* (272) cmd ::= create_vtab LP vtabarglist RP */
147369 { 261, -8 }, /* (273) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
147370 { 263, 0 }, /* (274) vtabarg ::= */
147371 { 264, -1 }, /* (275) vtabargtoken ::= ANY */
147372 { 264, -3 }, /* (276) vtabargtoken ::= lp anylist RP */
147373 { 265, -1 }, /* (277) lp ::= LP */
147374 { 232, -2 }, /* (278) with ::= WITH wqlist */
147375 { 232, -3 }, /* (279) with ::= WITH RECURSIVE wqlist */
147376 { 208, -6 }, /* (280) wqlist ::= nm eidlist_opt AS LP select RP */
147377 { 208, -8 }, /* (281) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
147378 { 267, -1 }, /* (282) windowdefn_list ::= windowdefn */
147379 { 267, -3 }, /* (283) windowdefn_list ::= windowdefn_list COMMA windowdefn */
147380 { 268, -3 }, /* (284) windowdefn ::= nm AS window */
147381 { 269, -5 }, /* (285) window ::= LP part_opt orderby_opt frame_opt RP */
147382 { 271, -3 }, /* (286) part_opt ::= PARTITION BY exprlist */
147383 { 271, 0 }, /* (287) part_opt ::= */
147384 { 270, 0 }, /* (288) frame_opt ::= */
147385 { 270, -2 }, /* (289) frame_opt ::= range_or_rows frame_bound_s */
147386 { 270, -5 }, /* (290) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */
147387 { 273, -1 }, /* (291) range_or_rows ::= RANGE */
147388 { 273, -1 }, /* (292) range_or_rows ::= ROWS */
147389 { 275, -1 }, /* (293) frame_bound_s ::= frame_bound */
147390 { 275, -2 }, /* (294) frame_bound_s ::= UNBOUNDED PRECEDING */
147391 { 276, -1 }, /* (295) frame_bound_e ::= frame_bound */
147392 { 276, -2 }, /* (296) frame_bound_e ::= UNBOUNDED FOLLOWING */
147393 { 274, -2 }, /* (297) frame_bound ::= expr PRECEDING */
147394 { 274, -2 }, /* (298) frame_bound ::= CURRENT ROW */
147395 { 274, -2 }, /* (299) frame_bound ::= expr FOLLOWING */
147396 { 216, 0 }, /* (300) windowdefn_opt ::= */
147397 { 216, -2 }, /* (301) windowdefn_opt ::= WINDOW windowdefn_list */
147398 { 237, 0 }, /* (302) over_opt ::= */
147399 { 237, -3 }, /* (303) over_opt ::= filter_opt OVER window */
147400 { 237, -3 }, /* (304) over_opt ::= filter_opt OVER nm */
147401 { 272, 0 }, /* (305) filter_opt ::= */
147402 { 272, -5 }, /* (306) filter_opt ::= FILTER LP WHERE expr RP */
147403 { 155, -1 }, /* (307) input ::= cmdlist */
147404 { 156, -2 }, /* (308) cmdlist ::= cmdlist ecmd */
147405 { 156, -1 }, /* (309) cmdlist ::= ecmd */
147406 { 157, -1 }, /* (310) ecmd ::= SEMI */
147407 { 157, -2 }, /* (311) ecmd ::= cmdx SEMI */
147408 { 157, -2 }, /* (312) ecmd ::= explain cmdx */
147409 { 162, 0 }, /* (313) trans_opt ::= */
147410 { 162, -1 }, /* (314) trans_opt ::= TRANSACTION */
147411 { 162, -2 }, /* (315) trans_opt ::= TRANSACTION nm */
147412 { 164, -1 }, /* (316) savepoint_opt ::= SAVEPOINT */
147413 { 164, 0 }, /* (317) savepoint_opt ::= */
147414 { 160, -2 }, /* (318) cmd ::= create_table create_table_args */
147415 { 171, -4 }, /* (319) columnlist ::= columnlist COMMA columnname carglist */
147416 { 171, -2 }, /* (320) columnlist ::= columnname carglist */
147417 { 163, -1 }, /* (321) nm ::= ID|INDEXED */
147418 { 163, -1 }, /* (322) nm ::= STRING */
147419 { 163, -1 }, /* (323) nm ::= JOIN_KW */
147420 { 177, -1 }, /* (324) typetoken ::= typename */
147421 { 178, -1 }, /* (325) typename ::= ID|STRING */
147422 { 179, -1 }, /* (326) signed ::= plus_num */
147423 { 179, -1 }, /* (327) signed ::= minus_num */
147424 { 176, -2 }, /* (328) carglist ::= carglist ccons */
147425 { 176, 0 }, /* (329) carglist ::= */
147426 { 183, -2 }, /* (330) ccons ::= NULL onconf */
147427 { 172, -2 }, /* (331) conslist_opt ::= COMMA conslist */
147428 { 195, -3 }, /* (332) conslist ::= conslist tconscomma tcons */
147429 { 195, -1 }, /* (333) conslist ::= tcons */
147430 { 196, 0 }, /* (334) tconscomma ::= */
147431 { 200, -1 }, /* (335) defer_subclause_opt ::= defer_subclause */
147432 { 202, -1 }, /* (336) resolvetype ::= raisetype */
147433 { 206, -1 }, /* (337) selectnowith ::= oneselect */
147434 { 207, -1 }, /* (338) oneselect ::= values */
147435 { 222, -2 }, /* (339) sclp ::= selcollist COMMA */
147436 { 223, -1 }, /* (340) as ::= ID|STRING */
147437 { 185, -1 }, /* (341) expr ::= term */
147438 { 238, -1 }, /* (342) likeop ::= LIKE_KW|MATCH */
147439 { 221, -1 }, /* (343) exprlist ::= nexprlist */
147440 { 247, -1 }, /* (344) nmnum ::= plus_num */
147441 { 247, -1 }, /* (345) nmnum ::= nm */
147442 { 247, -1 }, /* (346) nmnum ::= ON */
147443 { 247, -1 }, /* (347) nmnum ::= DELETE */
147444 { 247, -1 }, /* (348) nmnum ::= DEFAULT */
147445 { 180, -1 }, /* (349) plus_num ::= INTEGER|FLOAT */
147446 { 252, 0 }, /* (350) foreach_clause ::= */
147447 { 252, -3 }, /* (351) foreach_clause ::= FOR EACH ROW */
147448 { 255, -1 }, /* (352) trnm ::= nm */
147449 { 256, 0 }, /* (353) tridxby ::= */
147450 { 257, -1 }, /* (354) database_kw_opt ::= DATABASE */
147451 { 257, 0 }, /* (355) database_kw_opt ::= */
147452 { 260, 0 }, /* (356) kwcolumn_opt ::= */
147453 { 260, -1 }, /* (357) kwcolumn_opt ::= COLUMNKW */
147454 { 262, -1 }, /* (358) vtabarglist ::= vtabarg */
147455 { 262, -3 }, /* (359) vtabarglist ::= vtabarglist COMMA vtabarg */
147456 { 263, -2 }, /* (360) vtabarg ::= vtabarg vtabargtoken */
147457 { 266, 0 }, /* (361) anylist ::= */
147458 { 266, -4 }, /* (362) anylist ::= anylist LP anylist RP */
147459 { 266, -2 }, /* (363) anylist ::= anylist ANY */
147460 { 232, 0 }, /* (364) with ::= */
 
147461 };
147462
147463 static void yy_accept(yyParser*); /* Forward Declaration */
147464
147465 /*
@@ -147596,12 +147517,12 @@
147596 case 21: /* table_options ::= */ yytestcase(yyruleno==21);
147597 case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
147598 case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
147599 case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
147600 case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
147601 case 92: /* distinct ::= */ yytestcase(yyruleno==92);
147602 case 223: /* collate ::= */ yytestcase(yyruleno==223);
147603 {yymsp[1].minor.yy70 = 0;}
147604 break;
147605 case 16: /* ifnotexists ::= IF NOT EXISTS */
147606 {yymsp[-2].minor.yy70 = 1;}
147607 break;
@@ -147633,11 +147554,11 @@
147633 case 23: /* columnname ::= nm typetoken */
147634 {sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
147635 break;
147636 case 24: /* typetoken ::= */
147637 case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60);
147638 case 98: /* as ::= */ yytestcase(yyruleno==98);
147639 {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
147640 break;
147641 case 25: /* typetoken ::= typename LP signed RP */
147642 {
147643 yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
@@ -147744,18 +147665,18 @@
147744 case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
147745 {yymsp[-2].minor.yy70 = 0;}
147746 break;
147747 case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
147748 case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
147749 case 155: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==155);
147750 {yymsp[-1].minor.yy70 = yymsp[0].minor.yy70;}
147751 break;
147752 case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
147753 case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
147754 case 195: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==195);
147755 case 198: /* in_op ::= NOT IN */ yytestcase(yyruleno==198);
147756 case 224: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==224);
147757 {yymsp[-1].minor.yy70 = 1;}
147758 break;
147759 case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
147760 {yymsp[-1].minor.yy70 = 0;}
147761 break;
@@ -147787,11 +147708,11 @@
147787 break;
147788 case 72: /* resolvetype ::= IGNORE */
147789 {yymsp[0].minor.yy70 = OE_Ignore;}
147790 break;
147791 case 73: /* resolvetype ::= REPLACE */
147792 case 156: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==156);
147793 {yymsp[0].minor.yy70 = OE_Replace;}
147794 break;
147795 case 74: /* cmd ::= DROP TABLE ifexists fullname */
147796 {
147797 sqlite3DropTable(pParse, yymsp[0].minor.yy135, 0, yymsp[-1].minor.yy70);
@@ -147876,28 +147797,31 @@
147876 {yymsp[0].minor.yy70 = yymsp[0].major; /*A-overwrites-OP*/}
147877 break;
147878 case 85: /* multiselect_op ::= UNION ALL */
147879 {yymsp[-1].minor.yy70 = TK_ALL;}
147880 break;
147881 case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt windowdefn_opt orderby_opt limit_opt */
 
 
 
 
 
147882 {
147883 yymsp[-9].minor.yy489 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy420,yymsp[-6].minor.yy135,yymsp[-5].minor.yy18,yymsp[-4].minor.yy420,yymsp[-3].minor.yy18,yymsp[-1].minor.yy420,yymsp[-8].minor.yy70,yymsp[0].minor.yy18);
147884 #ifndef SQLITE_OMIT_WINDOWFUNC
147885 if( yymsp[-9].minor.yy489 ){
147886 yymsp[-9].minor.yy489->pWinDefn = yymsp[-2].minor.yy327;
147887 }else{
147888 sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy327);
147889 }
147890 #endif /* SQLITE_OMIT_WINDOWFUNC */
147891 }
147892 break;
147893 case 88: /* values ::= VALUES LP nexprlist RP */
147894 {
147895 yymsp[-3].minor.yy489 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy420,0,0,0,0,0,SF_Values,0);
147896 }
147897 break;
147898 case 89: /* values ::= values COMMA LP exprlist RP */
147899 {
147900 Select *pRight, *pLeft = yymsp[-4].minor.yy489;
147901 pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy420,0,0,0,0,0,SF_Values|SF_MultiValue,0);
147902 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
147903 if( pRight ){
@@ -147907,86 +147831,86 @@
147907 }else{
147908 yymsp[-4].minor.yy489 = pLeft;
147909 }
147910 }
147911 break;
147912 case 90: /* distinct ::= DISTINCT */
147913 {yymsp[0].minor.yy70 = SF_Distinct;}
147914 break;
147915 case 91: /* distinct ::= ALL */
147916 {yymsp[0].minor.yy70 = SF_All;}
147917 break;
147918 case 93: /* sclp ::= */
147919 case 126: /* orderby_opt ::= */ yytestcase(yyruleno==126);
147920 case 133: /* groupby_opt ::= */ yytestcase(yyruleno==133);
147921 case 211: /* exprlist ::= */ yytestcase(yyruleno==211);
147922 case 214: /* paren_exprlist ::= */ yytestcase(yyruleno==214);
147923 case 219: /* eidlist_opt ::= */ yytestcase(yyruleno==219);
147924 {yymsp[1].minor.yy420 = 0;}
147925 break;
147926 case 94: /* selcollist ::= sclp scanpt expr scanpt as */
147927 {
147928 yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy420, yymsp[-2].minor.yy18);
147929 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy420, &yymsp[0].minor.yy0, 1);
147930 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy420,yymsp[-3].minor.yy392,yymsp[-1].minor.yy392);
147931 }
147932 break;
147933 case 95: /* selcollist ::= sclp scanpt STAR */
147934 {
147935 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
147936 yymsp[-2].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy420, p);
147937 }
147938 break;
147939 case 96: /* selcollist ::= sclp scanpt nm DOT STAR */
147940 {
147941 Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
147942 Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
147943 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
147944 yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, pDot);
147945 }
147946 break;
147947 case 97: /* as ::= AS nm */
147948 case 108: /* dbnm ::= DOT nm */ yytestcase(yyruleno==108);
147949 case 233: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==233);
147950 case 234: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==234);
147951 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
147952 break;
147953 case 99: /* from ::= */
147954 {yymsp[1].minor.yy135 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy135));}
147955 break;
147956 case 100: /* from ::= FROM seltablist */
147957 {
147958 yymsp[-1].minor.yy135 = yymsp[0].minor.yy135;
147959 sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy135);
147960 }
147961 break;
147962 case 101: /* stl_prefix ::= seltablist joinop */
147963 {
147964 if( ALWAYS(yymsp[-1].minor.yy135 && yymsp[-1].minor.yy135->nSrc>0) ) yymsp[-1].minor.yy135->a[yymsp[-1].minor.yy135->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy70;
147965 }
147966 break;
147967 case 102: /* stl_prefix ::= */
147968 {yymsp[1].minor.yy135 = 0;}
147969 break;
147970 case 103: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
147971 {
147972 yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
147973 sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy135, &yymsp[-2].minor.yy0);
147974 }
147975 break;
147976 case 104: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
147977 {
147978 yymsp[-8].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy135,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
147979 sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy135, yymsp[-4].minor.yy420);
147980 }
147981 break;
147982 case 105: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
147983 {
147984 yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy489,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
147985 }
147986 break;
147987 case 106: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
147988 {
147989 if( yymsp[-6].minor.yy135==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy18==0 && yymsp[0].minor.yy48==0 ){
147990 yymsp[-6].minor.yy135 = yymsp[-4].minor.yy135;
147991 }else if( yymsp[-4].minor.yy135->nSrc==1 ){
147992 yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
@@ -148006,210 +147930,210 @@
148006 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy135,0,0,0,0,SF_NestedFrom,0);
148007 yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
148008 }
148009 }
148010 break;
148011 case 107: /* dbnm ::= */
148012 case 121: /* indexed_opt ::= */ yytestcase(yyruleno==121);
148013 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
148014 break;
148015 case 109: /* fullname ::= nm */
148016 case 111: /* xfullname ::= nm */ yytestcase(yyruleno==111);
148017 {yymsp[0].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
148018 break;
148019 case 110: /* fullname ::= nm DOT nm */
148020 case 112: /* xfullname ::= nm DOT nm */ yytestcase(yyruleno==112);
148021 {yymsp[-2].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
148022 break;
148023 case 113: /* xfullname ::= nm DOT nm AS nm */
148024 {
148025 yymsp[-4].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
148026 if( yymsp[-4].minor.yy135 ) yymsp[-4].minor.yy135->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
148027 }
148028 break;
148029 case 114: /* xfullname ::= nm AS nm */
148030 {
148031 yymsp[-2].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
148032 if( yymsp[-2].minor.yy135 ) yymsp[-2].minor.yy135->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
148033 }
148034 break;
148035 case 115: /* joinop ::= COMMA|JOIN */
148036 { yymsp[0].minor.yy70 = JT_INNER; }
148037 break;
148038 case 116: /* joinop ::= JOIN_KW JOIN */
148039 {yymsp[-1].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
148040 break;
148041 case 117: /* joinop ::= JOIN_KW nm JOIN */
148042 {yymsp[-2].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
148043 break;
148044 case 118: /* joinop ::= JOIN_KW nm nm JOIN */
148045 {yymsp[-3].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
148046 break;
148047 case 119: /* on_opt ::= ON expr */
148048 case 136: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==136);
148049 case 143: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==143);
148050 case 207: /* case_else ::= ELSE expr */ yytestcase(yyruleno==207);
148051 {yymsp[-1].minor.yy18 = yymsp[0].minor.yy18;}
148052 break;
148053 case 120: /* on_opt ::= */
148054 case 135: /* having_opt ::= */ yytestcase(yyruleno==135);
148055 case 137: /* limit_opt ::= */ yytestcase(yyruleno==137);
148056 case 142: /* where_opt ::= */ yytestcase(yyruleno==142);
148057 case 208: /* case_else ::= */ yytestcase(yyruleno==208);
148058 case 210: /* case_operand ::= */ yytestcase(yyruleno==210);
148059 {yymsp[1].minor.yy18 = 0;}
148060 break;
148061 case 122: /* indexed_opt ::= INDEXED BY nm */
148062 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
148063 break;
148064 case 123: /* indexed_opt ::= NOT INDEXED */
148065 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
148066 break;
148067 case 124: /* using_opt ::= USING LP idlist RP */
148068 {yymsp[-3].minor.yy48 = yymsp[-1].minor.yy48;}
148069 break;
148070 case 125: /* using_opt ::= */
148071 case 157: /* idlist_opt ::= */ yytestcase(yyruleno==157);
148072 {yymsp[1].minor.yy48 = 0;}
148073 break;
148074 case 127: /* orderby_opt ::= ORDER BY sortlist */
148075 case 134: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==134);
148076 {yymsp[-2].minor.yy420 = yymsp[0].minor.yy420;}
148077 break;
148078 case 128: /* sortlist ::= sortlist COMMA expr sortorder */
148079 {
148080 yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy420,yymsp[-1].minor.yy18);
148081 sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy420,yymsp[0].minor.yy70);
148082 }
148083 break;
148084 case 129: /* sortlist ::= expr sortorder */
148085 {
148086 yymsp[-1].minor.yy420 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy18); /*A-overwrites-Y*/
148087 sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy420,yymsp[0].minor.yy70);
148088 }
148089 break;
148090 case 130: /* sortorder ::= ASC */
148091 {yymsp[0].minor.yy70 = SQLITE_SO_ASC;}
148092 break;
148093 case 131: /* sortorder ::= DESC */
148094 {yymsp[0].minor.yy70 = SQLITE_SO_DESC;}
148095 break;
148096 case 132: /* sortorder ::= */
148097 {yymsp[1].minor.yy70 = SQLITE_SO_UNDEFINED;}
148098 break;
148099 case 138: /* limit_opt ::= LIMIT expr */
148100 {yymsp[-1].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy18,0);}
148101 break;
148102 case 139: /* limit_opt ::= LIMIT expr OFFSET expr */
148103 {yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);}
148104 break;
148105 case 140: /* limit_opt ::= LIMIT expr COMMA expr */
148106 {yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy18,yymsp[-2].minor.yy18);}
148107 break;
148108 case 141: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
148109 {
148110 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy135, &yymsp[-1].minor.yy0);
148111 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy135,yymsp[0].minor.yy18,0,0);
148112 }
148113 break;
148114 case 144: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
148115 {
148116 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy135, &yymsp[-3].minor.yy0);
148117 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy420,"set list");
148118 sqlite3Update(pParse,yymsp[-4].minor.yy135,yymsp[-1].minor.yy420,yymsp[0].minor.yy18,yymsp[-5].minor.yy70,0,0,0);
148119 }
148120 break;
148121 case 145: /* setlist ::= setlist COMMA nm EQ expr */
148122 {
148123 yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy420, yymsp[0].minor.yy18);
148124 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy420, &yymsp[-2].minor.yy0, 1);
148125 }
148126 break;
148127 case 146: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
148128 {
148129 yymsp[-6].minor.yy420 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy420, yymsp[-3].minor.yy48, yymsp[0].minor.yy18);
148130 }
148131 break;
148132 case 147: /* setlist ::= nm EQ expr */
148133 {
148134 yylhsminor.yy420 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy18);
148135 sqlite3ExprListSetName(pParse, yylhsminor.yy420, &yymsp[-2].minor.yy0, 1);
148136 }
148137 yymsp[-2].minor.yy420 = yylhsminor.yy420;
148138 break;
148139 case 148: /* setlist ::= LP idlist RP EQ expr */
148140 {
148141 yymsp[-4].minor.yy420 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy48, yymsp[0].minor.yy18);
148142 }
148143 break;
148144 case 149: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
148145 {
148146 sqlite3Insert(pParse, yymsp[-3].minor.yy135, yymsp[-1].minor.yy489, yymsp[-2].minor.yy48, yymsp[-5].minor.yy70, yymsp[0].minor.yy340);
148147 }
148148 break;
148149 case 150: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
148150 {
148151 sqlite3Insert(pParse, yymsp[-3].minor.yy135, 0, yymsp[-2].minor.yy48, yymsp[-5].minor.yy70, 0);
148152 }
148153 break;
148154 case 151: /* upsert ::= */
148155 { yymsp[1].minor.yy340 = 0; }
148156 break;
148157 case 152: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
148158 { yymsp[-10].minor.yy340 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy420,yymsp[-5].minor.yy18,yymsp[-1].minor.yy420,yymsp[0].minor.yy18);}
148159 break;
148160 case 153: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
148161 { yymsp[-7].minor.yy340 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy420,yymsp[-2].minor.yy18,0,0); }
148162 break;
148163 case 154: /* upsert ::= ON CONFLICT DO NOTHING */
148164 { yymsp[-3].minor.yy340 = sqlite3UpsertNew(pParse->db,0,0,0,0); }
148165 break;
148166 case 158: /* idlist_opt ::= LP idlist RP */
148167 {yymsp[-2].minor.yy48 = yymsp[-1].minor.yy48;}
148168 break;
148169 case 159: /* idlist ::= idlist COMMA nm */
148170 {yymsp[-2].minor.yy48 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy48,&yymsp[0].minor.yy0);}
148171 break;
148172 case 160: /* idlist ::= nm */
148173 {yymsp[0].minor.yy48 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
148174 break;
148175 case 161: /* expr ::= LP expr RP */
148176 {yymsp[-2].minor.yy18 = yymsp[-1].minor.yy18;}
148177 break;
148178 case 162: /* expr ::= ID|INDEXED */
148179 case 163: /* expr ::= JOIN_KW */ yytestcase(yyruleno==163);
148180 {yymsp[0].minor.yy18=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
148181 break;
148182 case 164: /* expr ::= nm DOT nm */
148183 {
148184 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
148185 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
148186 yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
148187 }
148188 yymsp[-2].minor.yy18 = yylhsminor.yy18;
148189 break;
148190 case 165: /* expr ::= nm DOT nm DOT nm */
148191 {
148192 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
148193 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
148194 Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
148195 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
148196 yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
148197 }
148198 yymsp[-4].minor.yy18 = yylhsminor.yy18;
148199 break;
148200 case 166: /* term ::= NULL|FLOAT|BLOB */
148201 case 167: /* term ::= STRING */ yytestcase(yyruleno==167);
148202 {yymsp[0].minor.yy18=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
148203 break;
148204 case 168: /* term ::= INTEGER */
148205 {
148206 yylhsminor.yy18 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
148207 }
148208 yymsp[0].minor.yy18 = yylhsminor.yy18;
148209 break;
148210 case 169: /* expr ::= VARIABLE */
148211 {
148212 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
148213 u32 n = yymsp[0].minor.yy0.n;
148214 yymsp[0].minor.yy18 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
148215 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy18, n);
@@ -148227,48 +148151,54 @@
148227 if( yymsp[0].minor.yy18 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy18->iTable);
148228 }
148229 }
148230 }
148231 break;
148232 case 170: /* expr ::= expr COLLATE ID|STRING */
148233 {
148234 yymsp[-2].minor.yy18 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy18, &yymsp[0].minor.yy0, 1);
148235 }
148236 break;
148237 case 171: /* expr ::= CAST LP expr AS typetoken RP */
148238 {
148239 yymsp[-5].minor.yy18 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
148240 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy18, yymsp[-3].minor.yy18, 0);
148241 }
148242 break;
148243 case 172: /* expr ::= ID|INDEXED LP distinct exprlist RP over_opt */
148244 {
148245 if( yymsp[-2].minor.yy420 && yymsp[-2].minor.yy420->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
148246 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-5].minor.yy0);
148247 }
148248 yylhsminor.yy18 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy420, &yymsp[-5].minor.yy0);
148249 if( yymsp[-3].minor.yy70==SF_Distinct && yylhsminor.yy18 ){
148250 yylhsminor.yy18->flags |= EP_Distinct;
148251 }
 
 
 
 
 
 
148252 sqlite3WindowAttach(pParse, yylhsminor.yy18, yymsp[0].minor.yy327);
148253 }
148254 yymsp[-5].minor.yy18 = yylhsminor.yy18;
148255 break;
148256 case 173: /* expr ::= ID|INDEXED LP STAR RP over_opt */
148257 {
148258 yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0);
148259 sqlite3WindowAttach(pParse, yylhsminor.yy18, yymsp[0].minor.yy327);
148260 }
148261 yymsp[-4].minor.yy18 = yylhsminor.yy18;
148262 break;
148263 case 174: /* term ::= CTIME_KW */
148264 {
148265 yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
148266 }
148267 yymsp[0].minor.yy18 = yylhsminor.yy18;
148268 break;
148269 case 175: /* expr ::= LP nexprlist COMMA expr RP */
148270 {
148271 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy420, yymsp[-1].minor.yy18);
148272 yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
148273 if( yymsp[-4].minor.yy18 ){
148274 yymsp[-4].minor.yy18->x.pList = pList;
@@ -148275,81 +148205,81 @@
148275 }else{
148276 sqlite3ExprListDelete(pParse->db, pList);
148277 }
148278 }
148279 break;
148280 case 176: /* expr ::= expr AND expr */
148281 case 177: /* expr ::= expr OR expr */ yytestcase(yyruleno==177);
148282 case 178: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==178);
148283 case 179: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==179);
148284 case 180: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==180);
148285 case 181: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==181);
148286 case 182: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==182);
148287 case 183: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==183);
148288 {yymsp[-2].minor.yy18=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);}
148289 break;
148290 case 184: /* likeop ::= NOT LIKE_KW|MATCH */
148291 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
148292 break;
148293 case 185: /* expr ::= expr likeop expr */
148294 {
148295 ExprList *pList;
148296 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
148297 yymsp[-1].minor.yy0.n &= 0x7fffffff;
148298 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy18);
148299 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy18);
148300 yymsp[-2].minor.yy18 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0);
148301 if( bNot ) yymsp[-2].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy18, 0);
148302 if( yymsp[-2].minor.yy18 ) yymsp[-2].minor.yy18->flags |= EP_InfixFunc;
148303 }
148304 break;
148305 case 186: /* expr ::= expr likeop expr ESCAPE expr */
148306 {
148307 ExprList *pList;
148308 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
148309 yymsp[-3].minor.yy0.n &= 0x7fffffff;
148310 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18);
148311 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy18);
148312 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy18);
148313 yymsp[-4].minor.yy18 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0);
148314 if( bNot ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148315 if( yymsp[-4].minor.yy18 ) yymsp[-4].minor.yy18->flags |= EP_InfixFunc;
148316 }
148317 break;
148318 case 187: /* expr ::= expr ISNULL|NOTNULL */
148319 {yymsp[-1].minor.yy18 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy18,0);}
148320 break;
148321 case 188: /* expr ::= expr NOT NULL */
148322 {yymsp[-2].minor.yy18 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy18,0);}
148323 break;
148324 case 189: /* expr ::= expr IS expr */
148325 {
148326 yymsp[-2].minor.yy18 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);
148327 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy18, yymsp[-2].minor.yy18, TK_ISNULL);
148328 }
148329 break;
148330 case 190: /* expr ::= expr IS NOT expr */
148331 {
148332 yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy18,yymsp[0].minor.yy18);
148333 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy18, yymsp[-3].minor.yy18, TK_NOTNULL);
148334 }
148335 break;
148336 case 191: /* expr ::= NOT expr */
148337 case 192: /* expr ::= BITNOT expr */ yytestcase(yyruleno==192);
148338 {yymsp[-1].minor.yy18 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy18, 0);/*A-overwrites-B*/}
148339 break;
148340 case 193: /* expr ::= PLUS|MINUS expr */
148341 {
148342 yymsp[-1].minor.yy18 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy18, 0);
148343 /*A-overwrites-B*/
148344 }
148345 break;
148346 case 194: /* between_op ::= BETWEEN */
148347 case 197: /* in_op ::= IN */ yytestcase(yyruleno==197);
148348 {yymsp[0].minor.yy70 = 0;}
148349 break;
148350 case 196: /* expr ::= expr between_op expr AND expr */
148351 {
148352 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18);
148353 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy18);
148354 yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy18, 0);
148355 if( yymsp[-4].minor.yy18 ){
@@ -148358,11 +148288,11 @@
148358 sqlite3ExprListDelete(pParse->db, pList);
148359 }
148360 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148361 }
148362 break;
148363 case 199: /* expr ::= expr in_op LP exprlist RP */
148364 {
148365 if( yymsp[-1].minor.yy420==0 ){
148366 /* Expressions of the form
148367 **
148368 ** expr1 IN ()
@@ -148410,41 +148340,41 @@
148410 }
148411 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148412 }
148413 }
148414 break;
148415 case 200: /* expr ::= LP select RP */
148416 {
148417 yymsp[-2].minor.yy18 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
148418 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy18, yymsp[-1].minor.yy489);
148419 }
148420 break;
148421 case 201: /* expr ::= expr in_op LP select RP */
148422 {
148423 yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy18, 0);
148424 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy18, yymsp[-1].minor.yy489);
148425 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148426 }
148427 break;
148428 case 202: /* expr ::= expr in_op nm dbnm paren_exprlist */
148429 {
148430 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
148431 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
148432 if( yymsp[0].minor.yy420 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy420);
148433 yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy18, 0);
148434 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy18, pSelect);
148435 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148436 }
148437 break;
148438 case 203: /* expr ::= EXISTS LP select RP */
148439 {
148440 Expr *p;
148441 p = yymsp[-3].minor.yy18 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
148442 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy489);
148443 }
148444 break;
148445 case 204: /* expr ::= CASE case_operand case_exprlist case_else END */
148446 {
148447 yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy18, 0);
148448 if( yymsp[-4].minor.yy18 ){
148449 yymsp[-4].minor.yy18->x.pList = yymsp[-1].minor.yy18 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy420,yymsp[-1].minor.yy18) : yymsp[-2].minor.yy420;
148450 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy18);
@@ -148452,369 +148382,365 @@
148452 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy420);
148453 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy18);
148454 }
148455 }
148456 break;
148457 case 205: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
148458 {
148459 yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, yymsp[-2].minor.yy18);
148460 yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, yymsp[0].minor.yy18);
148461 }
148462 break;
148463 case 206: /* case_exprlist ::= WHEN expr THEN expr */
148464 {
148465 yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18);
148466 yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy420, yymsp[0].minor.yy18);
148467 }
148468 break;
148469 case 209: /* case_operand ::= expr */
148470 {yymsp[0].minor.yy18 = yymsp[0].minor.yy18; /*A-overwrites-X*/}
148471 break;
148472 case 212: /* nexprlist ::= nexprlist COMMA expr */
148473 {yymsp[-2].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy420,yymsp[0].minor.yy18);}
148474 break;
148475 case 213: /* nexprlist ::= expr */
148476 {yymsp[0].minor.yy420 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy18); /*A-overwrites-Y*/}
148477 break;
148478 case 215: /* paren_exprlist ::= LP exprlist RP */
148479 case 220: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==220);
148480 {yymsp[-2].minor.yy420 = yymsp[-1].minor.yy420;}
148481 break;
148482 case 216: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
148483 {
148484 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
148485 sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy420, yymsp[-10].minor.yy70,
148486 &yymsp[-11].minor.yy0, yymsp[0].minor.yy18, SQLITE_SO_ASC, yymsp[-8].minor.yy70, SQLITE_IDXTYPE_APPDEF);
148487 }
148488 break;
148489 case 217: /* uniqueflag ::= UNIQUE */
148490 case 257: /* raisetype ::= ABORT */ yytestcase(yyruleno==257);
148491 {yymsp[0].minor.yy70 = OE_Abort;}
148492 break;
148493 case 218: /* uniqueflag ::= */
148494 {yymsp[1].minor.yy70 = OE_None;}
148495 break;
148496 case 221: /* eidlist ::= eidlist COMMA nm collate sortorder */
148497 {
148498 yymsp[-4].minor.yy420 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy420, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy70, yymsp[0].minor.yy70);
148499 }
148500 break;
148501 case 222: /* eidlist ::= nm collate sortorder */
148502 {
148503 yymsp[-2].minor.yy420 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy70, yymsp[0].minor.yy70); /*A-overwrites-Y*/
148504 }
148505 break;
148506 case 225: /* cmd ::= DROP INDEX ifexists fullname */
148507 {sqlite3DropIndex(pParse, yymsp[0].minor.yy135, yymsp[-1].minor.yy70);}
148508 break;
148509 case 226: /* cmd ::= VACUUM */
148510 {sqlite3Vacuum(pParse,0);}
148511 break;
148512 case 227: /* cmd ::= VACUUM nm */
148513 {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
148514 break;
148515 case 228: /* cmd ::= PRAGMA nm dbnm */
148516 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
148517 break;
148518 case 229: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
148519 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
148520 break;
148521 case 230: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
148522 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
148523 break;
148524 case 231: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
148525 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
148526 break;
148527 case 232: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
148528 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
148529 break;
148530 case 235: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
148531 {
148532 Token all;
148533 all.z = yymsp[-3].minor.yy0.z;
148534 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
148535 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy207, &all);
148536 }
148537 break;
148538 case 236: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
148539 {
148540 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy70, yymsp[-4].minor.yy34.a, yymsp[-4].minor.yy34.b, yymsp[-2].minor.yy135, yymsp[0].minor.yy18, yymsp[-10].minor.yy70, yymsp[-8].minor.yy70);
148541 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
148542 }
148543 break;
148544 case 237: /* trigger_time ::= BEFORE|AFTER */
148545 { yymsp[0].minor.yy70 = yymsp[0].major; /*A-overwrites-X*/ }
148546 break;
148547 case 238: /* trigger_time ::= INSTEAD OF */
148548 { yymsp[-1].minor.yy70 = TK_INSTEAD;}
148549 break;
148550 case 239: /* trigger_time ::= */
148551 { yymsp[1].minor.yy70 = TK_BEFORE; }
148552 break;
148553 case 240: /* trigger_event ::= DELETE|INSERT */
148554 case 241: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==241);
148555 {yymsp[0].minor.yy34.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy34.b = 0;}
148556 break;
148557 case 242: /* trigger_event ::= UPDATE OF idlist */
148558 {yymsp[-2].minor.yy34.a = TK_UPDATE; yymsp[-2].minor.yy34.b = yymsp[0].minor.yy48;}
148559 break;
148560 case 243: /* when_clause ::= */
148561 case 262: /* key_opt ::= */ yytestcase(yyruleno==262);
148562 case 305: /* filter_opt ::= */ yytestcase(yyruleno==305);
148563 { yymsp[1].minor.yy18 = 0; }
148564 break;
148565 case 244: /* when_clause ::= WHEN expr */
148566 case 263: /* key_opt ::= KEY expr */ yytestcase(yyruleno==263);
148567 { yymsp[-1].minor.yy18 = yymsp[0].minor.yy18; }
148568 break;
148569 case 245: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
148570 {
148571 assert( yymsp[-2].minor.yy207!=0 );
148572 yymsp[-2].minor.yy207->pLast->pNext = yymsp[-1].minor.yy207;
148573 yymsp[-2].minor.yy207->pLast = yymsp[-1].minor.yy207;
148574 }
148575 break;
148576 case 246: /* trigger_cmd_list ::= trigger_cmd SEMI */
148577 {
148578 assert( yymsp[-1].minor.yy207!=0 );
148579 yymsp[-1].minor.yy207->pLast = yymsp[-1].minor.yy207;
148580 }
148581 break;
148582 case 247: /* trnm ::= nm DOT nm */
148583 {
148584 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
148585 sqlite3ErrorMsg(pParse,
148586 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
148587 "statements within triggers");
148588 }
148589 break;
148590 case 248: /* tridxby ::= INDEXED BY nm */
148591 {
148592 sqlite3ErrorMsg(pParse,
148593 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
148594 "within triggers");
148595 }
148596 break;
148597 case 249: /* tridxby ::= NOT INDEXED */
148598 {
148599 sqlite3ErrorMsg(pParse,
148600 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
148601 "within triggers");
148602 }
148603 break;
148604 case 250: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
148605 {yylhsminor.yy207 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy420, yymsp[-1].minor.yy18, yymsp[-6].minor.yy70, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy392);}
148606 yymsp[-7].minor.yy207 = yylhsminor.yy207;
148607 break;
148608 case 251: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
148609 {
148610 yylhsminor.yy207 = sqlite3TriggerInsertStep(pParse->db,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy48,yymsp[-2].minor.yy489,yymsp[-6].minor.yy70,yymsp[-1].minor.yy340,yymsp[-7].minor.yy392,yymsp[0].minor.yy392);/*yylhsminor.yy207-overwrites-yymsp[-6].minor.yy70*/
148611 }
148612 yymsp[-7].minor.yy207 = yylhsminor.yy207;
148613 break;
148614 case 252: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
148615 {yylhsminor.yy207 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy18, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy392);}
148616 yymsp[-5].minor.yy207 = yylhsminor.yy207;
148617 break;
148618 case 253: /* trigger_cmd ::= scanpt select scanpt */
148619 {yylhsminor.yy207 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy489, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); /*yylhsminor.yy207-overwrites-yymsp[-1].minor.yy489*/}
148620 yymsp[-2].minor.yy207 = yylhsminor.yy207;
148621 break;
148622 case 254: /* expr ::= RAISE LP IGNORE RP */
148623 {
148624 yymsp[-3].minor.yy18 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
148625 if( yymsp[-3].minor.yy18 ){
148626 yymsp[-3].minor.yy18->affinity = OE_Ignore;
148627 }
148628 }
148629 break;
148630 case 255: /* expr ::= RAISE LP raisetype COMMA nm RP */
148631 {
148632 yymsp[-5].minor.yy18 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
148633 if( yymsp[-5].minor.yy18 ) {
148634 yymsp[-5].minor.yy18->affinity = (char)yymsp[-3].minor.yy70;
148635 }
148636 }
148637 break;
148638 case 256: /* raisetype ::= ROLLBACK */
148639 {yymsp[0].minor.yy70 = OE_Rollback;}
148640 break;
148641 case 258: /* raisetype ::= FAIL */
148642 {yymsp[0].minor.yy70 = OE_Fail;}
148643 break;
148644 case 259: /* cmd ::= DROP TRIGGER ifexists fullname */
148645 {
148646 sqlite3DropTrigger(pParse,yymsp[0].minor.yy135,yymsp[-1].minor.yy70);
148647 }
148648 break;
148649 case 260: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
148650 {
148651 sqlite3Attach(pParse, yymsp[-3].minor.yy18, yymsp[-1].minor.yy18, yymsp[0].minor.yy18);
148652 }
148653 break;
148654 case 261: /* cmd ::= DETACH database_kw_opt expr */
148655 {
148656 sqlite3Detach(pParse, yymsp[0].minor.yy18);
148657 }
148658 break;
148659 case 264: /* cmd ::= REINDEX */
148660 {sqlite3Reindex(pParse, 0, 0);}
148661 break;
148662 case 265: /* cmd ::= REINDEX nm dbnm */
148663 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
148664 break;
148665 case 266: /* cmd ::= ANALYZE */
148666 {sqlite3Analyze(pParse, 0, 0);}
148667 break;
148668 case 267: /* cmd ::= ANALYZE nm dbnm */
148669 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
148670 break;
148671 case 268: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
148672 {
148673 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy135,&yymsp[0].minor.yy0);
148674 }
148675 break;
148676 case 269: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
148677 {
148678 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
148679 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
148680 }
148681 break;
148682 case 270: /* add_column_fullname ::= fullname */
148683 {
148684 disableLookaside(pParse);
148685 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy135);
148686 }
148687 break;
148688 case 271: /* cmd ::= create_vtab */
148689 {sqlite3VtabFinishParse(pParse,0);}
148690 break;
148691 case 272: /* cmd ::= create_vtab LP vtabarglist RP */
148692 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
148693 break;
148694 case 273: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
148695 {
148696 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy70);
148697 }
148698 break;
148699 case 274: /* vtabarg ::= */
148700 {sqlite3VtabArgInit(pParse);}
148701 break;
148702 case 275: /* vtabargtoken ::= ANY */
148703 case 276: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==276);
148704 case 277: /* lp ::= LP */ yytestcase(yyruleno==277);
148705 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
148706 break;
148707 case 278: /* with ::= WITH wqlist */
148708 case 279: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==279);
148709 { sqlite3WithPush(pParse, yymsp[0].minor.yy449, 1); }
148710 break;
148711 case 280: /* wqlist ::= nm eidlist_opt AS LP select RP */
148712 {
148713 yymsp[-5].minor.yy449 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489); /*A-overwrites-X*/
148714 }
148715 break;
148716 case 281: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
148717 {
148718 yymsp[-7].minor.yy449 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy449, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489);
148719 }
148720 break;
148721 case 282: /* windowdefn_list ::= windowdefn */
148722 { yylhsminor.yy327 = yymsp[0].minor.yy327; }
148723 yymsp[0].minor.yy327 = yylhsminor.yy327;
148724 break;
148725 case 283: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
148726 {
148727 assert( yymsp[0].minor.yy327!=0 );
148728 yymsp[0].minor.yy327->pNextWin = yymsp[-2].minor.yy327;
148729 yylhsminor.yy327 = yymsp[0].minor.yy327;
148730 }
148731 yymsp[-2].minor.yy327 = yylhsminor.yy327;
148732 break;
148733 case 284: /* windowdefn ::= nm AS window */
148734 {
148735 if( ALWAYS(yymsp[0].minor.yy327) ){
148736 yymsp[0].minor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[-2].minor.yy0.z, yymsp[-2].minor.yy0.n);
148737 }
148738 yylhsminor.yy327 = yymsp[0].minor.yy327;
148739 }
148740 yymsp[-2].minor.yy327 = yylhsminor.yy327;
148741 break;
148742 case 285: /* window ::= LP part_opt orderby_opt frame_opt RP */
148743 {
148744 yymsp[-4].minor.yy327 = yymsp[-1].minor.yy327;
148745 if( ALWAYS(yymsp[-4].minor.yy327) ){
148746 yymsp[-4].minor.yy327->pPartition = yymsp[-3].minor.yy420;
148747 yymsp[-4].minor.yy327->pOrderBy = yymsp[-2].minor.yy420;
148748 }
148749 }
148750 break;
148751 case 286: /* part_opt ::= PARTITION BY exprlist */
148752 { yymsp[-2].minor.yy420 = yymsp[0].minor.yy420; }
148753 break;
148754 case 287: /* part_opt ::= */
148755 { yymsp[1].minor.yy420 = 0; }
148756 break;
148757 case 288: /* frame_opt ::= */
148758 {
148759 yymsp[1].minor.yy327 = sqlite3WindowAlloc(pParse, TK_RANGE, TK_UNBOUNDED, 0, TK_CURRENT, 0);
148760 }
148761 break;
148762 case 289: /* frame_opt ::= range_or_rows frame_bound_s */
148763 {
148764 yylhsminor.yy327 = sqlite3WindowAlloc(pParse, yymsp[-1].minor.yy70, yymsp[0].minor.yy119.eType, yymsp[0].minor.yy119.pExpr, TK_CURRENT, 0);
148765 }
148766 yymsp[-1].minor.yy327 = yylhsminor.yy327;
148767 break;
148768 case 290: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */
148769 {
148770 yylhsminor.yy327 = sqlite3WindowAlloc(pParse, yymsp[-4].minor.yy70, yymsp[-2].minor.yy119.eType, yymsp[-2].minor.yy119.pExpr, yymsp[0].minor.yy119.eType, yymsp[0].minor.yy119.pExpr);
148771 }
148772 yymsp[-4].minor.yy327 = yylhsminor.yy327;
148773 break;
148774 case 291: /* range_or_rows ::= RANGE */
148775 { yymsp[0].minor.yy70 = TK_RANGE; }
148776 break;
148777 case 292: /* range_or_rows ::= ROWS */
148778 { yymsp[0].minor.yy70 = TK_ROWS; }
148779 break;
148780 case 293: /* frame_bound_s ::= frame_bound */
148781 case 295: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==295);
148782 { yylhsminor.yy119 = yymsp[0].minor.yy119; }
148783 yymsp[0].minor.yy119 = yylhsminor.yy119;
148784 break;
148785 case 294: /* frame_bound_s ::= UNBOUNDED PRECEDING */
148786 case 296: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==296);
148787 {yymsp[-1].minor.yy119.eType = TK_UNBOUNDED; yymsp[-1].minor.yy119.pExpr = 0;}
148788 break;
148789 case 297: /* frame_bound ::= expr PRECEDING */
148790 { yylhsminor.yy119.eType = TK_PRECEDING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; }
148791 yymsp[-1].minor.yy119 = yylhsminor.yy119;
148792 break;
148793 case 298: /* frame_bound ::= CURRENT ROW */
148794 { yymsp[-1].minor.yy119.eType = TK_CURRENT ; yymsp[-1].minor.yy119.pExpr = 0; }
148795 break;
148796 case 299: /* frame_bound ::= expr FOLLOWING */
148797 { yylhsminor.yy119.eType = TK_FOLLOWING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; }
148798 yymsp[-1].minor.yy119 = yylhsminor.yy119;
148799 break;
148800 case 300: /* windowdefn_opt ::= */
148801 case 302: /* over_opt ::= */ yytestcase(yyruleno==302);
148802 { yymsp[1].minor.yy327 = 0; }
148803 break;
148804 case 301: /* windowdefn_opt ::= WINDOW windowdefn_list */
148805 { yymsp[-1].minor.yy327 = yymsp[0].minor.yy327; }
148806 break;
148807 case 303: /* over_opt ::= filter_opt OVER window */
148808 {
148809 yylhsminor.yy327 = yymsp[0].minor.yy327;
148810 assert( yylhsminor.yy327!=0 );
148811 yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18;
148812 }
148813 yymsp[-2].minor.yy327 = yylhsminor.yy327;
148814 break;
148815 case 304: /* over_opt ::= filter_opt OVER nm */
148816 {
148817 yylhsminor.yy327 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
148818 if( yylhsminor.yy327 ){
148819 yylhsminor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
148820 yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18;
@@ -148822,72 +148748,72 @@
148822 sqlite3ExprDelete(pParse->db, yymsp[-2].minor.yy18);
148823 }
148824 }
148825 yymsp[-2].minor.yy327 = yylhsminor.yy327;
148826 break;
148827 case 306: /* filter_opt ::= FILTER LP WHERE expr RP */
148828 { yymsp[-4].minor.yy18 = yymsp[-1].minor.yy18; }
148829 break;
148830 default:
148831 /* (307) input ::= cmdlist */ yytestcase(yyruleno==307);
148832 /* (308) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==308);
148833 /* (309) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=309);
148834 /* (310) ecmd ::= SEMI */ yytestcase(yyruleno==310);
148835 /* (311) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==311);
148836 /* (312) ecmd ::= explain cmdx */ yytestcase(yyruleno==312);
148837 /* (313) trans_opt ::= */ yytestcase(yyruleno==313);
148838 /* (314) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==314);
148839 /* (315) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==315);
148840 /* (316) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==316);
148841 /* (317) savepoint_opt ::= */ yytestcase(yyruleno==317);
148842 /* (318) cmd ::= create_table create_table_args */ yytestcase(yyruleno==318);
148843 /* (319) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==319);
148844 /* (320) columnlist ::= columnname carglist */ yytestcase(yyruleno==320);
148845 /* (321) nm ::= ID|INDEXED */ yytestcase(yyruleno==321);
148846 /* (322) nm ::= STRING */ yytestcase(yyruleno==322);
148847 /* (323) nm ::= JOIN_KW */ yytestcase(yyruleno==323);
148848 /* (324) typetoken ::= typename */ yytestcase(yyruleno==324);
148849 /* (325) typename ::= ID|STRING */ yytestcase(yyruleno==325);
148850 /* (326) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=326);
148851 /* (327) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=327);
148852 /* (328) carglist ::= carglist ccons */ yytestcase(yyruleno==328);
148853 /* (329) carglist ::= */ yytestcase(yyruleno==329);
148854 /* (330) ccons ::= NULL onconf */ yytestcase(yyruleno==330);
148855 /* (331) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==331);
148856 /* (332) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==332);
148857 /* (333) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=333);
148858 /* (334) tconscomma ::= */ yytestcase(yyruleno==334);
148859 /* (335) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=335);
148860 /* (336) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=336);
148861 /* (337) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=337);
148862 /* (338) oneselect ::= values */ yytestcase(yyruleno==338);
148863 /* (339) sclp ::= selcollist COMMA */ yytestcase(yyruleno==339);
148864 /* (340) as ::= ID|STRING */ yytestcase(yyruleno==340);
148865 /* (341) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=341);
148866 /* (342) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==342);
148867 /* (343) exprlist ::= nexprlist */ yytestcase(yyruleno==343);
148868 /* (344) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=344);
148869 /* (345) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=345);
148870 /* (346) nmnum ::= ON */ yytestcase(yyruleno==346);
148871 /* (347) nmnum ::= DELETE */ yytestcase(yyruleno==347);
148872 /* (348) nmnum ::= DEFAULT */ yytestcase(yyruleno==348);
148873 /* (349) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==349);
148874 /* (350) foreach_clause ::= */ yytestcase(yyruleno==350);
148875 /* (351) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==351);
148876 /* (352) trnm ::= nm */ yytestcase(yyruleno==352);
148877 /* (353) tridxby ::= */ yytestcase(yyruleno==353);
148878 /* (354) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==354);
148879 /* (355) database_kw_opt ::= */ yytestcase(yyruleno==355);
148880 /* (356) kwcolumn_opt ::= */ yytestcase(yyruleno==356);
148881 /* (357) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==357);
148882 /* (358) vtabarglist ::= vtabarg */ yytestcase(yyruleno==358);
148883 /* (359) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==359);
148884 /* (360) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==360);
148885 /* (361) anylist ::= */ yytestcase(yyruleno==361);
148886 /* (362) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==362);
148887 /* (363) anylist ::= anylist ANY */ yytestcase(yyruleno==363);
148888 /* (364) with ::= */ yytestcase(yyruleno==364);
148889 break;
148890 /********** End reduce actions ************************************************/
148891 };
148892 assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
148893 yygoto = yyRuleInfo[yyruleno].lhs;
@@ -151538,10 +151464,19 @@
151538 rc = nKey1 - nKey2;
151539 }
151540 }
151541 return rc;
151542 }
 
 
 
 
 
 
 
 
 
151543
151544 /*
151545 ** Another built-in collating sequence: NOCASE.
151546 **
151547 ** This collating sequence is intended to be used for "case independent
@@ -151660,11 +151595,11 @@
151660 int i;
151661 HashElem *p;
151662 sqlite3BtreeEnterAll(db);
151663 for(i=0; i<db->nDb; i++){
151664 Schema *pSchema = db->aDb[i].pSchema;
151665 if( db->aDb[i].pSchema ){
151666 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
151667 Table *pTab = (Table *)sqliteHashData(p);
151668 if( IsVirtual(pTab) ) sqlite3VtabDisconnect(db, pTab);
151669 }
151670 }
@@ -154829,15 +154764,33 @@
154829 if( db->autoCommit==0 ){
154830 int iDb;
154831 iDb = sqlite3FindDbName(db, zDb);
154832 if( iDb==0 || iDb>1 ){
154833 Btree *pBt = db->aDb[iDb].pBt;
154834 if( 0==sqlite3BtreeIsInReadTrans(pBt) ){
154835 rc = sqlite3PagerSnapshotOpen(sqlite3BtreePager(pBt), pSnapshot);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154836 if( rc==SQLITE_OK ){
154837 rc = sqlite3BtreeBeginTrans(pBt, 0, 0);
154838 sqlite3PagerSnapshotOpen(sqlite3BtreePager(pBt), 0);
 
 
 
154839 }
154840 }
154841 }
154842 }
154843
@@ -207692,11 +207645,14 @@
207692 int n = 0;
207693 int i;
207694 for(i=0; i<nChar; i++){
207695 if( n>=nByte ) return 0; /* Input contains fewer than nChar chars */
207696 if( (unsigned char)p[n++]>=0xc0 ){
207697 while( (p[n] & 0xc0)==0x80 ) n++;
 
 
 
207698 }
207699 }
207700 return n;
207701 }
207702
@@ -211572,11 +211528,11 @@
211572 int nArg, /* Number of args */
211573 sqlite3_value **apUnused /* Function arguments */
211574 ){
211575 assert( nArg==0 );
211576 UNUSED_PARAM2(nArg, apUnused);
211577 sqlite3_result_text(pCtx, "fts5: 2018-07-24 22:02:12 2bd593332da0aade467e7a4ee89e966aa6302f37540a2c5e23671f98a6cb599c", -1, SQLITE_TRANSIENT);
211578 }
211579
211580 static int fts5Init(sqlite3 *db){
211581 static const sqlite3_module fts5Mod = {
211582 /* iVersion */ 2,
@@ -216282,12 +216238,12 @@
216282 }
216283 #endif /* SQLITE_CORE */
216284 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
216285
216286 /************** End of stmt.c ************************************************/
216287 #if __LINE__!=216287
216288 #undef SQLITE_SOURCE_ID
216289 #define SQLITE_SOURCE_ID "2018-07-24 22:02:12 2bd593332da0aade467e7a4ee89e966aa6302f37540a2c5e23671f98a6cbalt2"
216290 #endif
216291 /* Return the source-id for this library */
216292 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
216293 /************************** End of sqlite3.c ******************************/
216294
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1156,11 +1156,11 @@
1156 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1157 ** [sqlite_version()] and [sqlite_source_id()].
1158 */
1159 #define SQLITE_VERSION "3.25.0"
1160 #define SQLITE_VERSION_NUMBER 3025000
1161 #define SQLITE_SOURCE_ID "2018-08-16 16:24:24 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0cfb61"
1162
1163 /*
1164 ** CAPI3REF: Run-Time Library Version Numbers
1165 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1166 **
@@ -10031,11 +10031,11 @@
10031 ** the following statements are false when sqlite3_snapshot_get() is
10032 ** called, SQLITE_ERROR is returned. The final value of *P is undefined
10033 ** in this case.
10034 **
10035 ** <ul>
10036 ** <li> The database handle must not be in [autocommit mode].
10037 **
10038 ** <li> Schema S of [database connection] D must be a [WAL mode] database.
10039 **
10040 ** <li> There must not be a write transaction open on schema S of database
10041 ** connection D.
@@ -10066,26 +10066,37 @@
10066
10067 /*
10068 ** CAPI3REF: Start a read transaction on an historical snapshot
10069 ** METHOD: sqlite3_snapshot
10070 **
10071 ** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read
10072 ** transaction or upgrades an existing one for schema S of
10073 ** [database connection] D such that the read transaction refers to
10074 ** historical [snapshot] P, rather than the most recent change to the
10075 ** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK
10076 ** on success or an appropriate [error code] if it fails.
 
10077 **
10078 ** ^In order to succeed, the database connection must not be in
10079 ** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there
10080 ** is already a read transaction open on schema S, then the database handle
10081 ** must have no active statements (SELECT statements that have been passed
10082 ** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()).
10083 ** SQLITE_ERROR is returned if either of these conditions is violated, or
10084 ** if schema S does not exist, or if the snapshot object is invalid.
10085 **
10086 ** ^A call to sqlite3_snapshot_open() will fail to open if the specified
10087 ** snapshot has been overwritten by a [checkpoint]. In this case
10088 ** SQLITE_BUSY_SNAPSHOT is returned.
10089 **
10090 ** If there is already a read transaction open when this function is
10091 ** invoked, then the same read transaction remains open (on the same
10092 ** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_BUSY_SNAPSHOT
10093 ** is returned. If another error code - for example SQLITE_PROTOCOL or an
10094 ** SQLITE_IOERR error code - is returned, then the final state of the
10095 ** read transaction is undefined. If SQLITE_OK is returned, then the
10096 ** read transaction is now open on database snapshot P.
10097 **
10098 ** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the
10099 ** database connection D does not know that the database file for
10100 ** schema S is in [WAL mode]. A database connection might not know
10101 ** that the database file is in [WAL mode] if there has been no prior
10102 ** I/O on that database connection, or if the database entered [WAL mode]
@@ -13008,21 +13019,10 @@
13019 #endif
13020 #if defined(NDEBUG) && defined(SQLITE_DEBUG)
13021 # undef NDEBUG
13022 #endif
13023
 
 
 
 
 
 
 
 
 
 
 
13024 /*
13025 ** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on.
13026 */
13027 #if !defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) && defined(SQLITE_DEBUG)
13028 # define SQLITE_ENABLE_EXPLAIN_COMMENTS 1
@@ -14720,40 +14720,40 @@
14720 #define OP_Ge 57 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
14721 #define OP_ElseNotEq 58 /* jump, same as TK_ESCAPE */
14722 #define OP_IncrVacuum 59 /* jump */
14723 #define OP_VNext 60 /* jump */
14724 #define OP_Init 61 /* jump, synopsis: Start at P2 */
14725 #define OP_PureFunc0 62
14726 #define OP_Function0 63 /* synopsis: r[P3]=func(r[P2@P5]) */
14727 #define OP_PureFunc 64
14728 #define OP_Function 65 /* synopsis: r[P3]=func(r[P2@P5]) */
14729 #define OP_Return 66
14730 #define OP_EndCoroutine 67
14731 #define OP_HaltIfNull 68 /* synopsis: if r[P3]=null halt */
14732 #define OP_Halt 69
14733 #define OP_Integer 70 /* synopsis: r[P2]=P1 */
14734 #define OP_Int64 71 /* synopsis: r[P2]=P4 */
14735 #define OP_String 72 /* synopsis: r[P2]='P4' (len=P1) */
14736 #define OP_Null 73 /* synopsis: r[P2..P3]=NULL */
14737 #define OP_SoftNull 74 /* synopsis: r[P1]=NULL */
14738 #define OP_Blob 75 /* synopsis: r[P2]=P4 (len=P1) */
14739 #define OP_Variable 76 /* synopsis: r[P2]=parameter(P1,P4) */
14740 #define OP_Move 77 /* synopsis: r[P2@P3]=r[P1@P3] */
14741 #define OP_Copy 78 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
14742 #define OP_SCopy 79 /* synopsis: r[P2]=r[P1] */
14743 #define OP_IntCopy 80 /* synopsis: r[P2]=r[P1] */
14744 #define OP_ResultRow 81 /* synopsis: output=r[P1@P2] */
14745 #define OP_CollSeq 82
14746 #define OP_AddImm 83 /* synopsis: r[P1]=r[P1]+P2 */
14747 #define OP_RealAffinity 84
14748 #define OP_Cast 85 /* synopsis: affinity(r[P1]) */
14749 #define OP_Permutation 86
14750 #define OP_Compare 87 /* synopsis: r[P1@P3] <-> r[P2@P3] */
14751 #define OP_IsTrue 88 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
14752 #define OP_Offset 89 /* synopsis: r[P3] = sqlite_offset(P1) */
14753 #define OP_Column 90 /* synopsis: r[P3]=PX */
14754 #define OP_Affinity 91 /* synopsis: affinity(r[P1@P2]) */
14755 #define OP_BitAnd 92 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
14756 #define OP_BitOr 93 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
14757 #define OP_ShiftLeft 94 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
14758 #define OP_ShiftRight 95 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
14759 #define OP_Add 96 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
@@ -14760,84 +14760,82 @@
14760 #define OP_Subtract 97 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
14761 #define OP_Multiply 98 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
14762 #define OP_Divide 99 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
14763 #define OP_Remainder 100 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
14764 #define OP_Concat 101 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
14765 #define OP_MakeRecord 102 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
14766 #define OP_BitNot 103 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
14767 #define OP_Count 104 /* synopsis: r[P2]=count() */
14768 #define OP_ReadCookie 105
14769 #define OP_String8 106 /* same as TK_STRING, synopsis: r[P2]='P4' */
14770 #define OP_SetCookie 107
14771 #define OP_ReopenIdx 108 /* synopsis: root=P2 iDb=P3 */
14772 #define OP_OpenRead 109 /* synopsis: root=P2 iDb=P3 */
14773 #define OP_OpenWrite 110 /* synopsis: root=P2 iDb=P3 */
14774 #define OP_OpenDup 111
14775 #define OP_OpenAutoindex 112 /* synopsis: nColumn=P2 */
14776 #define OP_OpenEphemeral 113 /* synopsis: nColumn=P2 */
14777 #define OP_SorterOpen 114
14778 #define OP_SequenceTest 115 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
14779 #define OP_OpenPseudo 116 /* synopsis: P3 columns in r[P2] */
14780 #define OP_Close 117
14781 #define OP_ColumnsUsed 118
14782 #define OP_SeekHit 119 /* synopsis: seekHit=P2 */
14783 #define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */
14784 #define OP_NewRowid 121 /* synopsis: r[P2]=rowid */
14785 #define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */
14786 #define OP_InsertInt 123 /* synopsis: intkey=P3 data=r[P2] */
14787 #define OP_Delete 124
14788 #define OP_ResetCount 125
14789 #define OP_SorterCompare 126 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
14790 #define OP_SorterData 127 /* synopsis: r[P2]=data */
14791 #define OP_RowData 128 /* synopsis: r[P2]=data */
14792 #define OP_Rowid 129 /* synopsis: r[P2]=rowid */
14793 #define OP_NullRow 130
14794 #define OP_SeekEnd 131
14795 #define OP_SorterInsert 132 /* synopsis: key=r[P2] */
14796 #define OP_IdxInsert 133 /* synopsis: key=r[P2] */
14797 #define OP_IdxDelete 134 /* synopsis: key=r[P2@P3] */
14798 #define OP_DeferredSeek 135 /* synopsis: Move P3 to P1.rowid if needed */
14799 #define OP_IdxRowid 136 /* synopsis: r[P2]=rowid */
14800 #define OP_Destroy 137
14801 #define OP_Clear 138
14802 #define OP_ResetSorter 139
14803 #define OP_CreateBtree 140 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
14804 #define OP_Real 141 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
14805 #define OP_SqlExec 142
14806 #define OP_ParseSchema 143
14807 #define OP_LoadAnalysis 144
14808 #define OP_DropTable 145
14809 #define OP_DropIndex 146
14810 #define OP_DropTrigger 147
14811 #define OP_IntegrityCk 148
14812 #define OP_RowSetAdd 149 /* synopsis: rowset(P1)=r[P2] */
14813 #define OP_Param 150
14814 #define OP_FkCounter 151 /* synopsis: fkctr[P1]+=P2 */
14815 #define OP_MemMax 152 /* synopsis: r[P1]=max(r[P1],r[P2]) */
14816 #define OP_OffsetLimit 153 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
14817 #define OP_AggInverse 154 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
14818 #define OP_AggStep 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14819 #define OP_AggStep1 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */
14820 #define OP_AggValue 157 /* synopsis: r[P3]=value N=P2 */
14821 #define OP_AggFinal 158 /* synopsis: accum=r[P1] N=P2 */
14822 #define OP_Expire 159
14823 #define OP_TableLock 160 /* synopsis: iDb=P1 root=P2 write=P3 */
14824 #define OP_VBegin 161
14825 #define OP_VCreate 162
14826 #define OP_VDestroy 163
14827 #define OP_VOpen 164
14828 #define OP_VColumn 165 /* synopsis: r[P3]=vcolumn(P2) */
14829 #define OP_VRename 166
14830 #define OP_Pagecount 167
14831 #define OP_MaxPgcnt 168
14832 #define OP_Trace 169
14833 #define OP_CursorHint 170
14834 #define OP_Noop 171
14835 #define OP_Explain 172
14836 #define OP_Abortable 173
 
 
14837
14838 /* Properties such as "out2" or "jump" that are specified in
14839 ** comments following the "case" for each opcode in the vdbe.c
14840 ** are encoded into bitvectors as follows:
14841 */
@@ -14853,26 +14851,25 @@
14851 /* 16 */ 0x01, 0x01, 0x03, 0x12, 0x03, 0x01, 0x09, 0x09,\
14852 /* 24 */ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,\
14853 /* 32 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
14854 /* 40 */ 0x01, 0x23, 0x0b, 0x26, 0x26, 0x01, 0x01, 0x03,\
14855 /* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
14856 /* 56 */ 0x0b, 0x0b, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,\
14857 /* 64 */ 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10,\
14858 /* 72 */ 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10,\
14859 /* 80 */ 0x10, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\
14860 /* 88 */ 0x12, 0x20, 0x00, 0x00, 0x26, 0x26, 0x26, 0x26,\
14861 /* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\
14862 /* 104 */ 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
14863 /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14864 /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14865 /* 128 */ 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,\
14866 /* 136 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
14867 /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\
14868 /* 152 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
14869 /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
14870 /* 168 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,}
 
14871
14872 /* The sqlite3P2Values() routine is able to run faster if it knows
14873 ** the value of the largest JUMP opcode. The smaller the maximum
14874 ** JUMP opcode the better, so the mkopcodeh.tcl script that
14875 ** generated this include file strives to group all JUMP opcodes
@@ -14950,13 +14947,10 @@
14947 SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*);
14948 SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*);
14949 SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*);
14950 SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*);
14951 SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int);
 
 
 
14952 SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*);
14953 #ifdef SQLITE_DEBUG
14954 SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int);
14955 #endif
14956 SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*);
@@ -15283,10 +15277,12 @@
15277 # endif
15278 # ifdef SQLITE_ENABLE_SNAPSHOT
15279 SQLITE_PRIVATE int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot);
15280 SQLITE_PRIVATE int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot);
15281 SQLITE_PRIVATE int sqlite3PagerSnapshotRecover(Pager *pPager);
15282 SQLITE_PRIVATE int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot);
15283 SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager);
15284 # endif
15285 #else
15286 # define sqlite3PagerUseWal(x,y) 0
15287 #endif
15288
@@ -16290,11 +16286,11 @@
16286 ** Bits of the sqlite3.dbOptFlags field that are used by the
16287 ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to
16288 ** selectively disable various optimizations.
16289 */
16290 #define SQLITE_QueryFlattener 0x0001 /* Query flattening */
16291 /* 0x0002 available for reuse */
16292 #define SQLITE_GroupByOrder 0x0004 /* GROUPBY cover of ORDERBY */
16293 #define SQLITE_FactorOutConst 0x0008 /* Constant factoring */
16294 #define SQLITE_DistinctOpt 0x0010 /* DISTINCT using indexes */
16295 #define SQLITE_CoverIdxScan 0x0020 /* Covering index scans */
16296 #define SQLITE_OrderByIdxJoin 0x0040 /* ORDER BY of joins via index */
@@ -16305,10 +16301,11 @@
16301 #define SQLITE_Stat34 0x0800 /* Use STAT3 or STAT4 data */
16302 /* TH3 expects the Stat34 ^^^^^^ value to be 0x0800. Don't change it */
16303 #define SQLITE_PushDown 0x1000 /* The push-down optimization */
16304 #define SQLITE_SimplifyJoin 0x2000 /* Convert LEFT JOIN to JOIN */
16305 #define SQLITE_SkipScan 0x4000 /* Skip-scans */
16306 #define SQLITE_PropagateConst 0x8000 /* The constant propagation opt */
16307 #define SQLITE_AllOpts 0xffff /* All optimizations */
16308
16309 /*
16310 ** Macros for testing whether or not optimizations are enabled or disabled.
16311 */
@@ -17199,11 +17196,11 @@
17196 ** The following are the meanings of bits in the Expr.flags field.
17197 */
17198 #define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
17199 #define EP_Agg 0x000002 /* Contains one or more aggregate functions */
17200 #define EP_HasFunc 0x000004 /* Contains one or more functions of any kind */
17201 #define EP_FixedCol 0x000008 /* TK_Column with a known fixed value */
17202 #define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */
17203 #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
17204 #define EP_DblQuoted 0x000040 /* token.z was originally in "..." */
17205 #define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */
17206 #define EP_Collate 0x000100 /* Tree contains a TK_COLLATE operator */
@@ -17688,17 +17685,10 @@
17685 Table *pTab; /* Table this info block refers to */
17686 int iDb; /* Index in sqlite3.aDb[] of database holding pTab */
17687 int regCtr; /* Memory register holding the rowid counter */
17688 };
17689
 
 
 
 
 
 
 
17690 /*
17691 ** At least one instance of the following structure is created for each
17692 ** trigger that may be fired while parsing an INSERT, UPDATE or DELETE
17693 ** statement. All such objects are stored in the linked list headed at
17694 ** Parse.pTriggerPrg and deleted once statement compilation has been
@@ -17770,22 +17760,19 @@
17760 u8 isMultiWrite; /* True if statement may modify/insert multiple rows */
17761 u8 mayAbort; /* True if statement may throw an ABORT exception */
17762 u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
17763 u8 okConstFactor; /* OK to factor out constants */
17764 u8 disableLookaside; /* Number of times lookaside has been disabled */
 
17765 int nRangeReg; /* Size of the temporary register block */
17766 int iRangeReg; /* First register in temporary register block */
17767 int nErr; /* Number of errors seen */
17768 int nTab; /* Number of previously allocated VDBE cursors */
17769 int nMem; /* Number of memory cells used so far */
17770 int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
17771 int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
17772 int iSelfTab; /* Table associated with an index on expr, or negative
17773 ** of the base register during check-constraint eval */
 
 
17774 int nLabel; /* Number of labels used */
17775 int *aLabel; /* Space to hold the labels */
17776 ExprList *pConstExpr;/* Constant expressions */
17777 Token constraintName;/* Name of the constraint currently being parsed */
17778 yDbMask writeMask; /* Start a write transaction on these databases */
@@ -17811,21 +17798,13 @@
17798
17799 /**************************************************************************
17800 ** Fields above must be initialized to zero. The fields that follow,
17801 ** down to the beginning of the recursive section, do not need to be
17802 ** initialized as they will be set before being used. The boundary is
17803 ** determined by offsetof(Parse,aTempReg).
17804 **************************************************************************/
17805
 
 
 
 
 
 
 
 
17806 int aTempReg[8]; /* Holding area for temporary registers */
17807 Token sNameToken; /* Token with unqualified schema object name */
17808
17809 /************************************************************************
17810 ** Above is constant between recursions. Below is reset before and after
@@ -17863,11 +17842,11 @@
17842 };
17843
17844 /*
17845 ** Sizes and pointers of various parts of the Parse object.
17846 */
17847 #define PARSE_HDR_SZ offsetof(Parse,aTempReg) /* Recursive part w/o aColCache*/
17848 #define PARSE_RECURSE_SZ offsetof(Parse,sLastToken) /* Recursive part */
17849 #define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */
17850 #define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */
17851
17852 /*
@@ -18157,10 +18136,11 @@
18136 struct IdxCover *pIdxCover; /* Check for index coverage */
18137 struct IdxExprTrans *pIdxTrans; /* Convert idxed expr to column */
18138 ExprList *pGroupBy; /* GROUP BY clause */
18139 Select *pSelect; /* HAVING to WHERE clause ctx */
18140 struct WindowRewrite *pRewrite; /* Window rewrite context */
18141 struct WhereConst *pConst; /* WHERE clause constants */
18142 } u;
18143 };
18144
18145 /* Forward declarations */
18146 SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*);
@@ -18511,11 +18491,11 @@
18491 SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
18492 SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
18493 SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
18494 SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
18495 SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);
18496 SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int);
18497 SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
18498 SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*);
18499 SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
18500 SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
18501 SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int);
@@ -18646,19 +18626,12 @@
18626 #define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */
18627 #define ONEPASS_SINGLE 1 /* ONEPASS valid for a single row update */
18628 #define ONEPASS_MULTI 2 /* ONEPASS is valid for multiple rows */
18629 SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(Parse*, Index*, int, int, int);
18630 SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8);
 
18631 SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int);
18632 SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int);
 
 
 
 
 
 
18633 SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int);
18634 SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int);
18635 SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int);
18636 SQLITE_PRIVATE int sqlite3ExprCodeAtInit(Parse*, Expr*, int);
18637 SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
@@ -18890,10 +18863,11 @@
18863 #endif
18864
18865 SQLITE_PRIVATE const char *sqlite3ErrStr(int);
18866 SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse);
18867 SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int);
18868 SQLITE_PRIVATE int sqlite3IsBinary(const CollSeq*);
18869 SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName);
18870 SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr);
18871 SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr);
18872 SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse*,Expr*,Expr*);
18873 SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int);
@@ -19853,14 +19827,10 @@
19827 void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */
19828 #ifdef SQLITE_DEBUG
19829 Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */
19830 u16 mScopyFlags; /* flags value immediately after the shallow copy */
19831 #endif
 
 
 
 
19832 };
19833
19834 /*
19835 ** Size of struct Mem not including the Mem.zMalloc member or anything that
19836 ** follows.
@@ -28513,10 +28483,13 @@
28483 sqlite3TreeViewLine(pView, "COLUMN(%d)%s", pExpr->iColumn, zFlgs);
28484 }else{
28485 sqlite3TreeViewLine(pView, "{%d:%d}%s",
28486 pExpr->iTable, pExpr->iColumn, zFlgs);
28487 }
28488 if( ExprHasProperty(pExpr, EP_FixedCol) ){
28489 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
28490 }
28491 break;
28492 }
28493 case TK_INTEGER: {
28494 if( pExpr->flags & EP_IntValue ){
28495 sqlite3TreeViewLine(pView, "%d", pExpr->u.iValue);
@@ -31741,40 +31714,40 @@
31714 /* 57 */ "Ge" OpHelp("IF r[P3]>=r[P1]"),
31715 /* 58 */ "ElseNotEq" OpHelp(""),
31716 /* 59 */ "IncrVacuum" OpHelp(""),
31717 /* 60 */ "VNext" OpHelp(""),
31718 /* 61 */ "Init" OpHelp("Start at P2"),
31719 /* 62 */ "PureFunc0" OpHelp(""),
31720 /* 63 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"),
31721 /* 64 */ "PureFunc" OpHelp(""),
31722 /* 65 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"),
31723 /* 66 */ "Return" OpHelp(""),
31724 /* 67 */ "EndCoroutine" OpHelp(""),
31725 /* 68 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
31726 /* 69 */ "Halt" OpHelp(""),
31727 /* 70 */ "Integer" OpHelp("r[P2]=P1"),
31728 /* 71 */ "Int64" OpHelp("r[P2]=P4"),
31729 /* 72 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
31730 /* 73 */ "Null" OpHelp("r[P2..P3]=NULL"),
31731 /* 74 */ "SoftNull" OpHelp("r[P1]=NULL"),
31732 /* 75 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
31733 /* 76 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
31734 /* 77 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
31735 /* 78 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
31736 /* 79 */ "SCopy" OpHelp("r[P2]=r[P1]"),
31737 /* 80 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
31738 /* 81 */ "ResultRow" OpHelp("output=r[P1@P2]"),
31739 /* 82 */ "CollSeq" OpHelp(""),
31740 /* 83 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
31741 /* 84 */ "RealAffinity" OpHelp(""),
31742 /* 85 */ "Cast" OpHelp("affinity(r[P1])"),
31743 /* 86 */ "Permutation" OpHelp(""),
31744 /* 87 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
31745 /* 88 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
31746 /* 89 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
31747 /* 90 */ "Column" OpHelp("r[P3]=PX"),
31748 /* 91 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
31749 /* 92 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
31750 /* 93 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
31751 /* 94 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
31752 /* 95 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
31753 /* 96 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
@@ -31781,84 +31754,82 @@
31754 /* 97 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
31755 /* 98 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
31756 /* 99 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
31757 /* 100 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
31758 /* 101 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
31759 /* 102 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
31760 /* 103 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
31761 /* 104 */ "Count" OpHelp("r[P2]=count()"),
31762 /* 105 */ "ReadCookie" OpHelp(""),
31763 /* 106 */ "String8" OpHelp("r[P2]='P4'"),
31764 /* 107 */ "SetCookie" OpHelp(""),
31765 /* 108 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
31766 /* 109 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
31767 /* 110 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
31768 /* 111 */ "OpenDup" OpHelp(""),
31769 /* 112 */ "OpenAutoindex" OpHelp("nColumn=P2"),
31770 /* 113 */ "OpenEphemeral" OpHelp("nColumn=P2"),
31771 /* 114 */ "SorterOpen" OpHelp(""),
31772 /* 115 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
31773 /* 116 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
31774 /* 117 */ "Close" OpHelp(""),
31775 /* 118 */ "ColumnsUsed" OpHelp(""),
31776 /* 119 */ "SeekHit" OpHelp("seekHit=P2"),
31777 /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
31778 /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"),
31779 /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
31780 /* 123 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
31781 /* 124 */ "Delete" OpHelp(""),
31782 /* 125 */ "ResetCount" OpHelp(""),
31783 /* 126 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
31784 /* 127 */ "SorterData" OpHelp("r[P2]=data"),
31785 /* 128 */ "RowData" OpHelp("r[P2]=data"),
31786 /* 129 */ "Rowid" OpHelp("r[P2]=rowid"),
31787 /* 130 */ "NullRow" OpHelp(""),
31788 /* 131 */ "SeekEnd" OpHelp(""),
31789 /* 132 */ "SorterInsert" OpHelp("key=r[P2]"),
31790 /* 133 */ "IdxInsert" OpHelp("key=r[P2]"),
31791 /* 134 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
31792 /* 135 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
31793 /* 136 */ "IdxRowid" OpHelp("r[P2]=rowid"),
31794 /* 137 */ "Destroy" OpHelp(""),
31795 /* 138 */ "Clear" OpHelp(""),
31796 /* 139 */ "ResetSorter" OpHelp(""),
31797 /* 140 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
31798 /* 141 */ "Real" OpHelp("r[P2]=P4"),
31799 /* 142 */ "SqlExec" OpHelp(""),
31800 /* 143 */ "ParseSchema" OpHelp(""),
31801 /* 144 */ "LoadAnalysis" OpHelp(""),
31802 /* 145 */ "DropTable" OpHelp(""),
31803 /* 146 */ "DropIndex" OpHelp(""),
31804 /* 147 */ "DropTrigger" OpHelp(""),
31805 /* 148 */ "IntegrityCk" OpHelp(""),
31806 /* 149 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
31807 /* 150 */ "Param" OpHelp(""),
31808 /* 151 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
31809 /* 152 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
31810 /* 153 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
31811 /* 154 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
31812 /* 155 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
31813 /* 156 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
31814 /* 157 */ "AggValue" OpHelp("r[P3]=value N=P2"),
31815 /* 158 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
31816 /* 159 */ "Expire" OpHelp(""),
31817 /* 160 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
31818 /* 161 */ "VBegin" OpHelp(""),
31819 /* 162 */ "VCreate" OpHelp(""),
31820 /* 163 */ "VDestroy" OpHelp(""),
31821 /* 164 */ "VOpen" OpHelp(""),
31822 /* 165 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
31823 /* 166 */ "VRename" OpHelp(""),
31824 /* 167 */ "Pagecount" OpHelp(""),
31825 /* 168 */ "MaxPgcnt" OpHelp(""),
31826 /* 169 */ "Trace" OpHelp(""),
31827 /* 170 */ "CursorHint" OpHelp(""),
31828 /* 171 */ "Noop" OpHelp(""),
31829 /* 172 */ "Explain" OpHelp(""),
31830 /* 173 */ "Abortable" OpHelp(""),
 
 
31831 };
31832 return azName[i];
31833 }
31834 #endif
31835
@@ -32764,16 +32735,29 @@
32735 ** statements. e.g.
32736 **
32737 ** unixEnterMutex()
32738 ** assert( unixMutexHeld() );
32739 ** unixEnterLeave()
32740 **
32741 ** To prevent deadlock, the global unixBigLock must must be acquired
32742 ** before the unixInodeInfo.pLockMutex mutex, if both are held. It is
32743 ** OK to get the pLockMutex without holding unixBigLock first, but if
32744 ** that happens, the unixBigLock mutex must not be acquired until after
32745 ** pLockMutex is released.
32746 **
32747 ** OK: enter(unixBigLock), enter(pLockInfo)
32748 ** OK: enter(unixBigLock)
32749 ** OK: enter(pLockInfo)
32750 ** ERROR: enter(pLockInfo), enter(unixBigLock)
32751 */
32752 static sqlite3_mutex *unixBigLock = 0;
32753 static void unixEnterMutex(void){
32754 assert( sqlite3_mutex_notheld(unixBigLock) ); /* Not a recursive mutex */
32755 sqlite3_mutex_enter(unixBigLock);
32756 }
32757 static void unixLeaveMutex(void){
32758 assert( sqlite3_mutex_held(unixBigLock) );
32759 sqlite3_mutex_leave(unixBigLock);
32760 }
32761 #ifdef SQLITE_DEBUG
32762 static int unixMutexHeld(void) {
32763 return sqlite3_mutex_held(unixBigLock);
@@ -33170,20 +33154,38 @@
33154 ** each inode opened by each thread.
33155 **
33156 ** A single inode can have multiple file descriptors, so each unixFile
33157 ** structure contains a pointer to an instance of this object and this
33158 ** object keeps a count of the number of unixFile pointing to it.
33159 **
33160 ** Mutex rules:
33161 **
33162 ** (1) Only the pLockMutex mutex must be held in order to read or write
33163 ** any of the locking fields:
33164 ** nShared, nLock, eFileLock, bProcessLock, pUnused
33165 **
33166 ** (2) When nRef>0, then the following fields are unchanging and can
33167 ** be read (but not written) without holding any mutex:
33168 ** fileId, pLockMutex
33169 **
33170 ** (3) With the exceptions above, all the fields may only be read
33171 ** or written while holding the global unixBigLock mutex.
33172 **
33173 ** Deadlock prevention: The global unixBigLock mutex may not
33174 ** be acquired while holding the pLockMutex mutex. If both unixBigLock
33175 ** and pLockMutex are needed, then unixBigLock must be acquired first.
33176 */
33177 struct unixInodeInfo {
33178 struct unixFileId fileId; /* The lookup key */
33179 sqlite3_mutex *pLockMutex; /* Hold this mutex for... */
33180 int nShared; /* Number of SHARED locks held */
33181 int nLock; /* Number of outstanding file locks */
33182 unsigned char eFileLock; /* One of SHARED_LOCK, RESERVED_LOCK etc. */
33183 unsigned char bProcessLock; /* An exclusive process lock is held */
33184 UnixUnusedFd *pUnused; /* Unused file descriptors to close */
33185 int nRef; /* Number of pointers to this structure */
33186 unixShmNode *pShmNode; /* Shared memory associated with this inode */
 
 
33187 unixInodeInfo *pNext; /* List of all unixInodeInfo objects */
33188 unixInodeInfo *pPrev; /* .... doubly linked */
33189 #if SQLITE_ENABLE_LOCKING_STYLE
33190 unsigned long long sharedByte; /* for AFP simulated shared lock */
33191 #endif
@@ -33195,11 +33197,25 @@
33197
33198 /*
33199 ** A lists of all unixInodeInfo objects.
33200 */
33201 static unixInodeInfo *inodeList = 0; /* All unixInodeInfo objects */
33202
33203 #ifdef SQLITE_DEBUG
33204 /*
33205 ** True if the inode mutex is held, or not. Used only within assert()
33206 ** to help verify correct mutex usage.
33207 */
33208 int unixFileMutexHeld(unixFile *pFile){
33209 assert( pFile->pInode );
33210 return sqlite3_mutex_held(pFile->pInode->pLockMutex);
33211 }
33212 int unixFileMutexNotheld(unixFile *pFile){
33213 assert( pFile->pInode );
33214 return sqlite3_mutex_notheld(pFile->pInode->pLockMutex);
33215 }
33216 #endif
33217
33218 /*
33219 **
33220 ** This function - unixLogErrorAtLine(), is only ever called via the macro
33221 ** unixLogError().
@@ -33301,15 +33317,15 @@
33317 */
33318 static void closePendingFds(unixFile *pFile){
33319 unixInodeInfo *pInode = pFile->pInode;
33320 UnixUnusedFd *p;
33321 UnixUnusedFd *pNext;
33322 assert( unixFileMutexHeld(pFile) );
33323 for(p=pInode->pUnused; p; p=pNext){
33324 pNext = p->pNext;
33325 robust_close(pFile, p->fd, __LINE__);
33326 sqlite3_free(p);
 
33327 }
33328 pInode->pUnused = 0;
33329 }
33330
33331 /*
@@ -33319,15 +33335,18 @@
33335 ** when this function is called.
33336 */
33337 static void releaseInodeInfo(unixFile *pFile){
33338 unixInodeInfo *pInode = pFile->pInode;
33339 assert( unixMutexHeld() );
33340 assert( unixFileMutexNotheld(pFile) );
33341 if( ALWAYS(pInode) ){
33342 pInode->nRef--;
33343 if( pInode->nRef==0 ){
33344 assert( pInode->pShmNode==0 );
33345 sqlite3_mutex_enter(pInode->pLockMutex);
33346 closePendingFds(pFile);
33347 sqlite3_mutex_leave(pInode->pLockMutex);
33348 if( pInode->pPrev ){
33349 assert( pInode->pPrev->pNext==pInode );
33350 pInode->pPrev->pNext = pInode->pNext;
33351 }else{
33352 assert( inodeList==pInode );
@@ -33335,14 +33354,14 @@
33354 }
33355 if( pInode->pNext ){
33356 assert( pInode->pNext->pPrev==pInode );
33357 pInode->pNext->pPrev = pInode->pPrev;
33358 }
33359 sqlite3_mutex_free(pInode->pLockMutex);
33360 sqlite3_free(pInode);
33361 }
33362 }
 
33363 }
33364
33365 /*
33366 ** Given a file descriptor, locate the unixInodeInfo object that
33367 ** describes that file descriptor. Create a new one if necessary. The
@@ -33408,11 +33427,10 @@
33427 #if OS_VXWORKS
33428 fileId.pId = pFile->pId;
33429 #else
33430 fileId.ino = (u64)statbuf.st_ino;
33431 #endif
 
33432 pInode = inodeList;
33433 while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){
33434 pInode = pInode->pNext;
33435 }
33436 if( pInode==0 ){
@@ -33420,10 +33438,17 @@
33438 if( pInode==0 ){
33439 return SQLITE_NOMEM_BKPT;
33440 }
33441 memset(pInode, 0, sizeof(*pInode));
33442 memcpy(&pInode->fileId, &fileId, sizeof(fileId));
33443 if( sqlite3GlobalConfig.bCoreMutex ){
33444 pInode->pLockMutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
33445 if( pInode->pLockMutex==0 ){
33446 sqlite3_free(pInode);
33447 return SQLITE_NOMEM_BKPT;
33448 }
33449 }
33450 pInode->nRef = 1;
33451 pInode->pNext = inodeList;
33452 pInode->pPrev = 0;
33453 if( inodeList ) inodeList->pPrev = pInode;
33454 inodeList = pInode;
@@ -33498,11 +33523,11 @@
33523
33524 SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
33525
33526 assert( pFile );
33527 assert( pFile->eFileLock<=SHARED_LOCK );
33528 sqlite3_mutex_enter(pFile->pInode->pLockMutex);
33529
33530 /* Check if a thread in this process holds such a lock */
33531 if( pFile->pInode->eFileLock>SHARED_LOCK ){
33532 reserved = 1;
33533 }
@@ -33523,11 +33548,11 @@
33548 reserved = 1;
33549 }
33550 }
33551 #endif
33552
33553 sqlite3_mutex_leave(pFile->pInode->pLockMutex);
33554 OSTRACE(("TEST WR-LOCK %d %d %d (unix)\n", pFile->h, rc, reserved));
33555
33556 *pResOut = reserved;
33557 return rc;
33558 }
@@ -33589,12 +33614,12 @@
33614 ** to fcntl() fails. In this case, errno is set appropriately (by fcntl()).
33615 */
33616 static int unixFileLock(unixFile *pFile, struct flock *pLock){
33617 int rc;
33618 unixInodeInfo *pInode = pFile->pInode;
 
33619 assert( pInode!=0 );
33620 assert( sqlite3_mutex_held(pInode->pLockMutex) );
33621 if( (pFile->ctrlFlags & (UNIXFILE_EXCL|UNIXFILE_RDONLY))==UNIXFILE_EXCL ){
33622 if( pInode->bProcessLock==0 ){
33623 struct flock lock;
33624 assert( pInode->nLock==0 );
33625 lock.l_whence = SEEK_SET;
@@ -33709,12 +33734,12 @@
33734 assert( eFileLock!=PENDING_LOCK );
33735 assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );
33736
33737 /* This mutex is needed because pFile->pInode is shared across threads
33738 */
 
33739 pInode = pFile->pInode;
33740 sqlite3_mutex_enter(pInode->pLockMutex);
33741
33742 /* If some thread using this PID has a lock via a different unixFile*
33743 ** handle that precludes the requested lock, return BUSY.
33744 */
33745 if( (pFile->eFileLock!=pInode->eFileLock &&
@@ -33853,11 +33878,11 @@
33878 pFile->eFileLock = PENDING_LOCK;
33879 pInode->eFileLock = PENDING_LOCK;
33880 }
33881
33882 end_lock:
33883 sqlite3_mutex_leave(pInode->pLockMutex);
33884 OSTRACE(("LOCK %d %s %s (unix)\n", pFile->h, azFileLock(eFileLock),
33885 rc==SQLITE_OK ? "ok" : "failed"));
33886 return rc;
33887 }
33888
@@ -33866,15 +33891,15 @@
33891 ** pUnused list.
33892 */
33893 static void setPendingFd(unixFile *pFile){
33894 unixInodeInfo *pInode = pFile->pInode;
33895 UnixUnusedFd *p = pFile->pPreallocatedUnused;
33896 assert( unixFileMutexHeld(pFile) );
33897 p->pNext = pInode->pUnused;
33898 pInode->pUnused = p;
33899 pFile->h = -1;
33900 pFile->pPreallocatedUnused = 0;
 
33901 }
33902
33903 /*
33904 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
33905 ** must be either NO_LOCK or SHARED_LOCK.
@@ -33901,12 +33926,12 @@
33926
33927 assert( eFileLock<=SHARED_LOCK );
33928 if( pFile->eFileLock<=eFileLock ){
33929 return SQLITE_OK;
33930 }
 
33931 pInode = pFile->pInode;
33932 sqlite3_mutex_enter(pInode->pLockMutex);
33933 assert( pInode->nShared!=0 );
33934 if( pFile->eFileLock>SHARED_LOCK ){
33935 assert( pInode->eFileLock==pFile->eFileLock );
33936
33937 #ifdef SQLITE_DEBUG
@@ -34028,18 +34053,18 @@
34053 ** count reaches zero, close any other file descriptors whose close
34054 ** was deferred because of outstanding locks.
34055 */
34056 pInode->nLock--;
34057 assert( pInode->nLock>=0 );
34058 if( pInode->nLock==0 ) closePendingFds(pFile);
 
 
34059 }
34060
34061 end_unlock:
34062 sqlite3_mutex_leave(pInode->pLockMutex);
34063 if( rc==SQLITE_OK ){
34064 pFile->eFileLock = eFileLock;
34065 }
34066 return rc;
34067 }
34068
34069 /*
34070 ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock
@@ -34106,26 +34131,32 @@
34131 ** Close a file.
34132 */
34133 static int unixClose(sqlite3_file *id){
34134 int rc = SQLITE_OK;
34135 unixFile *pFile = (unixFile *)id;
34136 unixInodeInfo *pInode = pFile->pInode;
34137
34138 assert( pInode!=0 );
34139 verifyDbFile(pFile);
34140 unixUnlock(id, NO_LOCK);
34141 assert( unixFileMutexNotheld(pFile) );
34142 unixEnterMutex();
34143
34144 /* unixFile.pInode is always valid here. Otherwise, a different close
34145 ** routine (e.g. nolockClose()) would be called instead.
34146 */
34147 assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 );
34148 sqlite3_mutex_enter(pInode->pLockMutex);
34149 if( pInode->nLock ){
34150 /* If there are outstanding locks, do not actually close the file just
34151 ** yet because that would clear those locks. Instead, add the file
34152 ** descriptor to pInode->pUnused list. It will be automatically closed
34153 ** when the last lock is cleared.
34154 */
34155 setPendingFd(pFile);
34156 }
34157 sqlite3_mutex_leave(pInode->pLockMutex);
34158 releaseInodeInfo(pFile);
34159 rc = closeUnixFile(id);
34160 unixLeaveMutex();
34161 return rc;
34162 }
@@ -34719,10 +34750,11 @@
34750 static int semXClose(sqlite3_file *id) {
34751 if( id ){
34752 unixFile *pFile = (unixFile*)id;
34753 semXUnlock(id, NO_LOCK);
34754 assert( pFile );
34755 assert( unixFileMutexNotheld(pFile) );
34756 unixEnterMutex();
34757 releaseInodeInfo(pFile);
34758 unixLeaveMutex();
34759 closeUnixFile(id);
34760 }
@@ -34833,12 +34865,11 @@
34865 context = (afpLockingContext *) pFile->lockingContext;
34866 if( context->reserved ){
34867 *pResOut = 1;
34868 return SQLITE_OK;
34869 }
34870 sqlite3_mutex_enter(pFile->pInode->pLockMutex);
 
34871 /* Check if a thread in this process holds such a lock */
34872 if( pFile->pInode->eFileLock>SHARED_LOCK ){
34873 reserved = 1;
34874 }
34875
@@ -34858,11 +34889,11 @@
34889 if( IS_LOCK_ERROR(lrc) ){
34890 rc=lrc;
34891 }
34892 }
34893
34894 sqlite3_mutex_leave(pFile->pInode->pLockMutex);
34895 OSTRACE(("TEST WR-LOCK %d %d %d (afp)\n", pFile->h, rc, reserved));
34896
34897 *pResOut = reserved;
34898 return rc;
34899 }
@@ -34921,12 +34952,12 @@
34952 assert( eFileLock!=PENDING_LOCK );
34953 assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );
34954
34955 /* This mutex is needed because pFile->pInode is shared across threads
34956 */
 
34957 pInode = pFile->pInode;
34958 sqlite3_mutex_enter(pInode->pLockMutex);
34959
34960 /* If some thread using this PID has a lock via a different unixFile*
34961 ** handle that precludes the requested lock, return BUSY.
34962 */
34963 if( (pFile->eFileLock!=pInode->eFileLock &&
@@ -35058,11 +35089,11 @@
35089 pFile->eFileLock = PENDING_LOCK;
35090 pInode->eFileLock = PENDING_LOCK;
35091 }
35092
35093 afp_end_lock:
35094 sqlite3_mutex_leave(pInode->pLockMutex);
35095 OSTRACE(("LOCK %d %s %s (afp)\n", pFile->h, azFileLock(eFileLock),
35096 rc==SQLITE_OK ? "ok" : "failed"));
35097 return rc;
35098 }
35099
@@ -35090,12 +35121,12 @@
35121
35122 assert( eFileLock<=SHARED_LOCK );
35123 if( pFile->eFileLock<=eFileLock ){
35124 return SQLITE_OK;
35125 }
 
35126 pInode = pFile->pInode;
35127 sqlite3_mutex_enter(pInode->pLockMutex);
35128 assert( pInode->nShared!=0 );
35129 if( pFile->eFileLock>SHARED_LOCK ){
35130 assert( pInode->eFileLock==pFile->eFileLock );
35131 SimulateIOErrorBenign(1);
35132 SimulateIOError( h=(-1) )
@@ -35160,18 +35191,18 @@
35191 }
35192 }
35193 if( rc==SQLITE_OK ){
35194 pInode->nLock--;
35195 assert( pInode->nLock>=0 );
35196 if( pInode->nLock==0 ) closePendingFds(pFile);
 
 
35197 }
35198 }
35199
35200 sqlite3_mutex_leave(pInode->pLockMutex);
35201 if( rc==SQLITE_OK ){
35202 pFile->eFileLock = eFileLock;
35203 }
35204 return rc;
35205 }
35206
35207 /*
35208 ** Close a file & cleanup AFP specific locking context
@@ -35179,18 +35210,24 @@
35210 static int afpClose(sqlite3_file *id) {
35211 int rc = SQLITE_OK;
35212 unixFile *pFile = (unixFile*)id;
35213 assert( id!=0 );
35214 afpUnlock(id, NO_LOCK);
35215 assert( unixFileMutexNotheld(pFile) );
35216 unixEnterMutex();
35217 if( pFile->pInode ){
35218 unixInodeInfo *pInode = pFile->pInode;
35219 sqlite3_mutex_enter(pInode->pLockMutex);
35220 if( pFile->pInode->nLock ){
35221 /* If there are outstanding locks, do not actually close the file just
35222 ** yet because that would clear those locks. Instead, add the file
35223 ** descriptor to pInode->aPending. It will be automatically closed when
35224 ** the last lock is cleared.
35225 */
35226 setPendingFd(pFile);
35227 }
35228 sqlite3_mutex_leave(pInode->pLockMutex);
35229 }
35230 releaseInodeInfo(pFile);
35231 sqlite3_free(pFile->lockingContext);
35232 rc = closeUnixFile(id);
35233 unixLeaveMutex();
@@ -36492,10 +36529,11 @@
36529 assert( pDbFd->pShm==0 );
36530
36531 /* Check to see if a unixShmNode object already exists. Reuse an existing
36532 ** one if present. Create a new one if necessary.
36533 */
36534 assert( unixFileMutexNotheld(pDbFd) );
36535 unixEnterMutex();
36536 pInode = pDbFd->pInode;
36537 pShmNode = pInode->pShmNode;
36538 if( pShmNode==0 ){
36539 struct stat sStat; /* fstat() info for database file */
@@ -36874,10 +36912,11 @@
36912 static void unixShmBarrier(
36913 sqlite3_file *fd /* Database file holding the shared memory */
36914 ){
36915 UNUSED_PARAMETER(fd);
36916 sqlite3MemoryBarrier(); /* compiler-defined memory barrier */
36917 assert( unixFileMutexNotheld((unixFile*)fd) );
36918 unixEnterMutex(); /* Also mutex, for redundancy */
36919 unixLeaveMutex();
36920 }
36921
36922 /*
@@ -36915,10 +36954,11 @@
36954 pDbFd->pShm = 0;
36955 sqlite3_mutex_leave(pShmNode->mutex);
36956
36957 /* If pShmNode->nRef has reached 0, then close the underlying
36958 ** shared-memory file, too */
36959 assert( unixFileMutexNotheld(pDbFd) );
36960 unixEnterMutex();
36961 assert( pShmNode->nRef>0 );
36962 pShmNode->nRef--;
36963 if( pShmNode->nRef==0 ){
36964 if( deleteFlag && pShmNode->h>=0 ){
@@ -37241,11 +37281,11 @@
37281 unixShmMap /* xShmMap method */
37282 )
37283 IOMETHODS(
37284 nolockIoFinder, /* Finder function name */
37285 nolockIoMethods, /* sqlite3_io_methods object name */
37286 3, /* shared memory and mmap are enabled */
37287 nolockClose, /* xClose method */
37288 nolockLock, /* xLock method */
37289 nolockUnlock, /* xUnlock method */
37290 nolockCheckReservedLock, /* xCheckReservedLock method */
37291 0 /* xShmMap method */
@@ -37737,26 +37777,28 @@
37777 ** ignored and -1 is returned. The caller will try to open a new file
37778 ** descriptor on the same path, fail, and return an error to SQLite.
37779 **
37780 ** Even if a subsequent open() call does succeed, the consequences of
37781 ** not searching for a reusable file descriptor are not dire. */
37782 if( inodeList!=0 && 0==osStat(zPath, &sStat) ){
37783 unixInodeInfo *pInode;
37784
37785 pInode = inodeList;
37786 while( pInode && (pInode->fileId.dev!=sStat.st_dev
37787 || pInode->fileId.ino!=(u64)sStat.st_ino) ){
37788 pInode = pInode->pNext;
37789 }
37790 if( pInode ){
37791 UnixUnusedFd **pp;
37792 assert( sqlite3_mutex_notheld(pInode->pLockMutex) );
37793 sqlite3_mutex_enter(pInode->pLockMutex);
37794 for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext));
37795 pUnused = *pp;
37796 if( pUnused ){
 
37797 *pp = pUnused->pNext;
37798 }
37799 sqlite3_mutex_leave(pInode->pLockMutex);
37800 }
37801 }
37802 unixLeaveMutex();
37803 #endif /* if !OS_VXWORKS */
37804 return pUnused;
@@ -49969,10 +50011,12 @@
50011
50012 #ifdef SQLITE_ENABLE_SNAPSHOT
50013 SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot);
50014 SQLITE_PRIVATE void sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapshot);
50015 SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal);
50016 SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot);
50017 SQLITE_PRIVATE void sqlite3WalSnapshotUnlock(Wal *pWal);
50018 #endif
50019
50020 #ifdef SQLITE_ENABLE_ZIPVFS
50021 /* If the WAL file is not empty, return the number of bytes of content
50022 ** stored in each frame (i.e. the db page-size when the WAL was created).
@@ -57618,10 +57662,42 @@
57662 }else{
57663 rc = SQLITE_ERROR;
57664 }
57665 return rc;
57666 }
57667
57668 /*
57669 ** The caller currently has a read transaction open on the database.
57670 ** If this is not a WAL database, SQLITE_ERROR is returned. Otherwise,
57671 ** this function takes a SHARED lock on the CHECKPOINTER slot and then
57672 ** checks if the snapshot passed as the second argument is still
57673 ** available. If so, SQLITE_OK is returned.
57674 **
57675 ** If the snapshot is not available, SQLITE_ERROR is returned. Or, if
57676 ** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error
57677 ** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER
57678 ** lock is released before returning.
57679 */
57680 SQLITE_PRIVATE int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot){
57681 int rc;
57682 if( pPager->pWal ){
57683 rc = sqlite3WalSnapshotCheck(pPager->pWal, pSnapshot);
57684 }else{
57685 rc = SQLITE_ERROR;
57686 }
57687 return rc;
57688 }
57689
57690 /*
57691 ** Release a lock obtained by an earlier successful call to
57692 ** sqlite3PagerSnapshotCheck().
57693 */
57694 SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager){
57695 assert( pPager->pWal );
57696 return sqlite3WalSnapshotUnlock(pPager->pWal);
57697 }
57698
57699 #endif /* SQLITE_ENABLE_SNAPSHOT */
57700 #endif /* !SQLITE_OMIT_WAL */
57701
57702 #ifdef SQLITE_ENABLE_ZIPVFS
57703 /*
@@ -59476,11 +59552,10 @@
59552 }
59553
59554 if( pIter
59555 && (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0),1))==SQLITE_OK
59556 ){
 
59557 u32 nBackfill = pInfo->nBackfill;
59558
59559 pInfo->nBackfillAttempted = mxSafeFrame;
59560
59561 /* Sync the WAL to disk */
@@ -59489,10 +59564,11 @@
59564 /* If the database may grow as a result of this checkpoint, hint
59565 ** about the eventual size of the db file to the VFS layer.
59566 */
59567 if( rc==SQLITE_OK ){
59568 i64 nReq = ((i64)mxPage * szPage);
59569 i64 nSize; /* Current size of database file */
59570 rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);
59571 if( rc==SQLITE_OK && nSize<nReq ){
59572 sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq);
59573 }
59574 }
@@ -61410,10 +61486,47 @@
61486 if( pHdr1->aSalt[0]>pHdr2->aSalt[0] ) return +1;
61487 if( pHdr1->mxFrame<pHdr2->mxFrame ) return -1;
61488 if( pHdr1->mxFrame>pHdr2->mxFrame ) return +1;
61489 return 0;
61490 }
61491
61492 /*
61493 ** The caller currently has a read transaction open on the database.
61494 ** This function takes a SHARED lock on the CHECKPOINTER slot and then
61495 ** checks if the snapshot passed as the second argument is still
61496 ** available. If so, SQLITE_OK is returned.
61497 **
61498 ** If the snapshot is not available, SQLITE_ERROR is returned. Or, if
61499 ** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error
61500 ** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER
61501 ** lock is released before returning.
61502 */
61503 SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot){
61504 int rc;
61505 rc = walLockShared(pWal, WAL_CKPT_LOCK);
61506 if( rc==SQLITE_OK ){
61507 WalIndexHdr *pNew = (WalIndexHdr*)pSnapshot;
61508 if( memcmp(pNew->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt))
61509 || pNew->mxFrame<walCkptInfo(pWal)->nBackfillAttempted
61510 ){
61511 rc = SQLITE_BUSY_SNAPSHOT;
61512 walUnlockShared(pWal, WAL_CKPT_LOCK);
61513 }
61514 }
61515 return rc;
61516 }
61517
61518 /*
61519 ** Release a lock obtained by an earlier successful call to
61520 ** sqlite3WalSnapshotCheck().
61521 */
61522 SQLITE_PRIVATE void sqlite3WalSnapshotUnlock(Wal *pWal){
61523 assert( pWal );
61524 walUnlockShared(pWal, WAL_CKPT_LOCK);
61525 }
61526
61527
61528 #endif /* SQLITE_ENABLE_SNAPSHOT */
61529
61530 #ifdef SQLITE_ENABLE_ZIPVFS
61531 /*
61532 ** If the argument is not NULL, it points to a Wal object that holds a
@@ -74393,13 +74506,10 @@
74506 pX->flags = MEM_Undefined;
74507 pX->pScopyFrom = 0;
74508 }
74509 }
74510 pMem->pScopyFrom = 0;
 
 
 
74511 }
74512 #endif /* SQLITE_DEBUG */
74513
74514
74515 /*
@@ -74416,13 +74526,10 @@
74526 SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
74527 assert( (pFrom->flags & MEM_RowSet)==0 );
74528 assert( pTo->db==pFrom->db );
74529 if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; }
74530 memcpy(pTo, pFrom, MEMCELLSIZE);
 
 
 
74531 if( (pFrom->flags&MEM_Static)==0 ){
74532 pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);
74533 assert( srcType==MEM_Ephem || srcType==MEM_Static );
74534 pTo->flags |= srcType;
74535 }
@@ -74436,13 +74543,10 @@
74543 int rc = SQLITE_OK;
74544
74545 assert( (pFrom->flags & MEM_RowSet)==0 );
74546 if( VdbeMemDynamic(pTo) ) vdbeMemClearExternAndSetNull(pTo);
74547 memcpy(pTo, pFrom, MEMCELLSIZE);
 
 
 
74548 pTo->flags &= ~MEM_Dyn;
74549 if( pTo->flags&(MEM_Str|MEM_Blob) ){
74550 if( 0==(pFrom->flags&MEM_Static) ){
74551 pTo->flags |= MEM_Ephem;
74552 rc = sqlite3VdbeMemMakeWriteable(pTo);
@@ -75547,18 +75651,10 @@
75651 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
75652 pOp->zComment = 0;
75653 #endif
75654 #ifdef SQLITE_DEBUG
75655 if( p->db->flags & SQLITE_VdbeAddopTrace ){
 
 
 
 
 
 
 
 
75656 sqlite3VdbePrintOp(0, i, &p->aOp[i]);
75657 test_addop_breakpoint();
75658 }
75659 #endif
75660 #ifdef VDBE_PROFILE
@@ -75799,23 +75895,10 @@
75895 assert( p->aLabel[j]==(-1) ); /* Labels may only be resolved once */
75896 p->aLabel[j] = v->nOp;
75897 }
75898 }
75899
 
 
 
 
 
 
 
 
 
 
 
 
 
75900 /*
75901 ** Mark the VDBE as one that can only be run one time.
75902 */
75903 SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){
75904 p->runOnlyOnce = 1;
@@ -77001,13 +77084,10 @@
77084 p->flags = flags;
77085 p->szMalloc = 0;
77086 #ifdef SQLITE_DEBUG
77087 p->pScopyFrom = 0;
77088 #endif
 
 
 
77089 p++;
77090 }
77091 }
77092
77093 /*
@@ -81187,13 +81267,10 @@
81267 /* .xDel = */ (void(*)(void*))0,
81268 #ifdef SQLITE_DEBUG
81269 /* .pScopyFrom = */ (Mem*)0,
81270 /* .mScopyFlags= */ 0,
81271 #endif
 
 
 
81272 };
81273 return &nullMem;
81274 }
81275
81276 /*
@@ -82412,22 +82489,10 @@
82489 # define memAboutToChange(P,M) sqlite3VdbeMemAboutToChange(P,M)
82490 #else
82491 # define memAboutToChange(P,M)
82492 #endif
82493
 
 
 
 
 
 
 
 
 
 
 
 
82494 /*
82495 ** The following global variable is incremented every time a cursor
82496 ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test
82497 ** procedures use this information to make sure that indices are
82498 ** working correctly. This variable has no function other than to
@@ -83773,11 +83838,10 @@
83838 memAboutToChange(p, pOut);
83839 sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);
83840 Deephemeralize(pOut);
83841 #ifdef SQLITE_DEBUG
83842 pOut->pScopyFrom = 0;
 
83843 #endif
83844 REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut);
83845 if( (n--)==0 ) break;
83846 pOut++;
83847 pIn1++;
@@ -84437,11 +84501,16 @@
84501 affinity = pOp->p5 & SQLITE_AFF_MASK;
84502 if( affinity>=SQLITE_AFF_NUMERIC ){
84503 if( (flags1 | flags3)&MEM_Str ){
84504 if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
84505 applyNumericAffinity(pIn1,0);
84506 assert( flags3==pIn3->flags );
84507 /* testcase( flags3!=pIn3->flags );
84508 ** this used to be possible with pIn1==pIn3, but not since
84509 ** the column cache was removed. The following assignment
84510 ** is essentially a no-op. But, it provides defense-in-depth
84511 ** in case our analysis is incorrect, so it is left in. */
84512 flags3 = pIn3->flags;
84513 }
84514 if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
84515 applyNumericAffinity(pIn3,0);
84516 }
@@ -86357,14 +86426,14 @@
86426 ** The IdxGE opcode will be skipped if this opcode succeeds, but the
86427 ** IdxGE opcode will be used on subsequent loop iterations.
86428 **
86429 ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt
86430 */
86431 case OP_SeekLT: /* jump, in3, group */
86432 case OP_SeekLE: /* jump, in3, group */
86433 case OP_SeekGE: /* jump, in3, group */
86434 case OP_SeekGT: { /* jump, in3, group */
86435 int res; /* Comparison result */
86436 int oc; /* Opcode */
86437 VdbeCursor *pC; /* The cursor to seek */
86438 UnpackedRecord r; /* The key to seek for */
86439 int nField; /* Number of columns or fields in the key */
@@ -86788,17 +86857,25 @@
86857 int res;
86858 u64 iKey;
86859
86860 pIn3 = &aMem[pOp->p3];
86861 if( (pIn3->flags & MEM_Int)==0 ){
86862 /* Make sure pIn3->u.i contains a valid integer representation of
86863 ** the key value, but do not change the datatype of the register, as
86864 ** other parts of the perpared statement might be depending on the
86865 ** current datatype. */
86866 u16 origFlags = pIn3->flags;
86867 int isNotInt;
86868 applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding);
86869 isNotInt = (pIn3->flags & MEM_Int)==0;
86870 pIn3->flags = origFlags;
86871 if( isNotInt ) goto jump_to_p2;
86872 }
86873 /* Fall through into OP_NotExists */
86874 case OP_NotExists: /* jump, in3 */
86875 pIn3 = &aMem[pOp->p3];
86876 assert( (pIn3->flags & MEM_Int)!=0 || pOp->opcode==OP_SeekRowid );
86877 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
86878 pC = p->apCsr[pOp->p1];
86879 assert( pC!=0 );
86880 #ifdef SQLITE_DEBUG
86881 pC->seekOp = OP_SeekRowid;
@@ -87994,11 +88071,17 @@
88071 assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxLT );
88072 r.default_rc = 0;
88073 }
88074 r.aMem = &aMem[pOp->p3];
88075 #ifdef SQLITE_DEBUG
88076 {
88077 int i;
88078 for(i=0; i<r.nField; i++){
88079 assert( memIsValid(&r.aMem[i]) );
88080 REGISTER_TRACE(pOp->p3+i, &aMem[pOp->p3+i]);
88081 }
88082 }
88083 #endif
88084 res = 0; /* Not needed. Only used to silence a warning. */
88085 rc = sqlite3VdbeIdxKeyCompare(db, pC, &r, &res);
88086 assert( (OP_IdxLE&1)==(OP_IdxLT&1) && (OP_IdxGE&1)==(OP_IdxGT&1) );
88087 if( (pOp->opcode&1)==(OP_IdxLT&1) ){
@@ -89684,12 +89767,12 @@
89767 ** the sqlite3_context object occurs only once, rather than once for each
89768 ** evaluation of the function.
89769 **
89770 ** See also: Function0, AggStep, AggFinal
89771 */
89772 case OP_PureFunc0: /* group */
89773 case OP_Function0: { /* group */
89774 int n;
89775 sqlite3_context *pCtx;
89776
89777 assert( pOp->p4type==P4_FUNCDEF );
89778 n = pOp->p5;
@@ -89709,12 +89792,12 @@
89792 assert( OP_PureFunc == OP_PureFunc0+2 );
89793 assert( OP_Function == OP_Function0+2 );
89794 pOp->opcode += 2;
89795 /* Fall through into OP_Function */
89796 }
89797 case OP_PureFunc: /* group */
89798 case OP_Function: { /* group */
89799 int i;
89800 sqlite3_context *pCtx;
89801
89802 assert( pOp->p4type==P4_FUNCCTX );
89803 pCtx = pOp->p4.pCtx;
@@ -89895,38 +89978,10 @@
89978 */
89979 case OP_Abortable: {
89980 sqlite3VdbeAssertAbortable(p);
89981 break;
89982 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89983 #endif
89984
89985 /* Opcode: Noop * * * * *
89986 **
89987 ** Do nothing. This instruction is often useful as a jump
@@ -95712,18 +95767,10 @@
95767 CollSeq *pColl = 0;
95768 Expr *p = pExpr;
95769 while( p ){
95770 int op = p->op;
95771 if( p->flags & EP_Generic ) break;
 
 
 
 
 
 
 
 
95772 if( (op==TK_AGG_COLUMN || op==TK_COLUMN
95773 || op==TK_REGISTER || op==TK_TRIGGER)
95774 && p->pTab!=0
95775 ){
95776 /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally
@@ -95732,10 +95779,18 @@
95779 if( j>=0 ){
95780 const char *zColl = p->pTab->aCol[j].zColl;
95781 pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0);
95782 }
95783 break;
95784 }
95785 if( op==TK_CAST || op==TK_UPLUS ){
95786 p = p->pLeft;
95787 continue;
95788 }
95789 if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
95790 pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
95791 break;
95792 }
95793 if( p->flags & EP_Collate ){
95794 if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
95795 p = p->pLeft;
95796 }else{
@@ -96152,11 +96207,10 @@
96207 for(i=0; 1 /*Loop exits by "break"*/; i++){
96208 int regFree1 = 0, regFree2 = 0;
96209 Expr *pL, *pR;
96210 int r1, r2;
96211 assert( i>=0 && i<nLeft );
 
96212 r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, &regFree1);
96213 r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, &regFree2);
96214 codeCompare(pParse, pL, pR, opx, r1, r2, dest, p5);
96215 testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
96216 testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);
@@ -96164,11 +96218,10 @@
96218 testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge);
96219 testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq);
96220 testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne);
96221 sqlite3ReleaseTempReg(pParse, regFree1);
96222 sqlite3ReleaseTempReg(pParse, regFree2);
 
96223 if( i==nLeft-1 ){
96224 break;
96225 }
96226 if( opx==TK_EQ ){
96227 sqlite3VdbeAddOp2(v, OP_IfNot, dest, addrDone); VdbeCoverage(v);
@@ -96512,23 +96565,32 @@
96565
96566 /*
96567 ** Construct a new expression node for a function with multiple
96568 ** arguments.
96569 */
96570 SQLITE_PRIVATE Expr *sqlite3ExprFunction(
96571 Parse *pParse, /* Parsing context */
96572 ExprList *pList, /* Argument list */
96573 Token *pToken, /* Name of the function */
96574 int eDistinct /* SF_Distinct or SF_ALL or 0 */
96575 ){
96576 Expr *pNew;
96577 sqlite3 *db = pParse->db;
96578 assert( pToken );
96579 pNew = sqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1);
96580 if( pNew==0 ){
96581 sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */
96582 return 0;
96583 }
96584 if( pList && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
96585 sqlite3ErrorMsg(pParse, "too many arguments on function %T", pToken);
96586 }
96587 pNew->x.pList = pList;
96588 ExprSetProperty(pNew, EP_HasFunc);
96589 assert( !ExprHasProperty(pNew, EP_xIsSelect) );
96590 sqlite3ExprSetHeightAndFlags(pParse, pNew);
96591 if( eDistinct==SF_Distinct ) ExprSetProperty(pNew, EP_Distinct);
96592 return pNew;
96593 }
96594
96595 /*
96596 ** Assign a variable number to an expression that encodes a wildcard
@@ -97410,10 +97472,13 @@
97472 case TK_AGG_COLUMN:
97473 testcase( pExpr->op==TK_ID );
97474 testcase( pExpr->op==TK_COLUMN );
97475 testcase( pExpr->op==TK_AGG_FUNCTION );
97476 testcase( pExpr->op==TK_AGG_COLUMN );
97477 if( ExprHasProperty(pExpr, EP_FixedCol) && pWalker->eCode!=2 ){
97478 return WRC_Continue;
97479 }
97480 if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){
97481 return WRC_Continue;
97482 }
97483 /* Fall through */
97484 case TK_IF_NULL_ROW:
@@ -97465,14 +97530,21 @@
97530 SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){
97531 return exprIsConst(p, 1, 0);
97532 }
97533
97534 /*
97535 ** Walk an expression tree. Return non-zero if
97536 **
97537 ** (1) the expression is constant, and
97538 ** (2) the expression does originate in the ON or USING clause
97539 ** of a LEFT JOIN, and
97540 ** (3) the expression does not contain any EP_FixedCol TK_COLUMN
97541 ** operands created by the constant propagation optimization.
97542 **
97543 ** When this routine returns true, it indicates that the expression
97544 ** can be added to the pParse->pConstExpr list and evaluated once when
97545 ** the prepared statement starts up. See sqlite3ExprCodeAtInit().
97546 */
97547 SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){
97548 return exprIsConst(p, 2, 0);
97549 }
97550
@@ -97498,11 +97570,11 @@
97570 ** it constant. */
97571 for(i=0; i<pGroupBy->nExpr; i++){
97572 Expr *p = pGroupBy->a[i].pExpr;
97573 if( sqlite3ExprCompare(0, pExpr, p, -1)<2 ){
97574 CollSeq *pColl = sqlite3ExprNNCollSeq(pWalker->pParse, p);
97575 if( sqlite3IsBinary(pColl) ){
97576 return WRC_Prune;
97577 }
97578 }
97579 }
97580
@@ -97920,11 +97992,12 @@
97992 int iAddr = sqlite3VdbeAddOp0(v, OP_Once);
97993 VdbeCoverage(v);
97994
97995 sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
97996 eType = IN_INDEX_ROWID;
97997 ExplainQueryPlan((pParse, 0,
97998 "USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR",pTab->zName));
97999 sqlite3VdbeJumpHere(v, iAddr);
98000 }else{
98001 Index *pIdx; /* Iterator variable */
98002 int affinity_ok = 1;
98003 int i;
@@ -98179,11 +98252,10 @@
98252 ){
98253 int jmpIfDynamic = -1; /* One-time test address */
98254 int rReg = 0; /* Register storing resulting */
98255 Vdbe *v = sqlite3GetVdbe(pParse);
98256 if( NEVER(v==0) ) return 0;
 
98257
98258 /* The evaluation of the IN/EXISTS/SELECT must be repeated every time it
98259 ** is encountered if any of the following is true:
98260 **
98261 ** * The right-hand side is a correlated subquery
@@ -98315,11 +98387,10 @@
98387 sqlite3VdbeCurrentAddr(v)+2);
98388 VdbeCoverage(v);
98389 sqlite3VdbeAddOp3(v, OP_Insert, pExpr->iTable, r2, r3);
98390 }else{
98391 sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
 
98392 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pExpr->iTable, r2, r3, 1);
98393 }
98394 }
98395 }
98396 sqlite3ReleaseTempReg(pParse, r1);
@@ -98396,11 +98467,10 @@
98467 }
98468
98469 if( jmpIfDynamic>=0 ){
98470 sqlite3VdbeJumpHere(v, jmpIfDynamic);
98471 }
 
98472
98473 return rReg;
98474 }
98475 #endif /* SQLITE_OMIT_SUBQUERY */
98476
@@ -98515,11 +98585,10 @@
98585 ** sqlite3FindInIndex() might have reordered the fields of the LHS vector
98586 ** so that the fields are in the same order as an existing index. The
98587 ** aiMap[] array contains a mapping from the original LHS field order to
98588 ** the field order that matches the RHS index.
98589 */
 
98590 rLhsOrig = exprCodeVector(pParse, pLeft, &iDummy);
98591 for(i=0; i<nVector && aiMap[i]==i; i++){} /* Are LHS fields reordered? */
98592 if( i==nVector ){
98593 /* LHS fields are not reordered */
98594 rLhs = rLhsOrig;
@@ -98674,11 +98743,10 @@
98743 /* Jumps here in order to return true. */
98744 sqlite3VdbeJumpHere(v, addrTruthOp);
98745
98746 sqlite3ExprCodeIN_finished:
98747 if( rLhs!=rLhsOrig ) sqlite3ReleaseTempReg(pParse, rLhs);
 
98748 VdbeComment((v, "end IN expr"));
98749 sqlite3ExprCodeIN_oom_error:
98750 sqlite3DbFree(pParse->db, aiMap);
98751 sqlite3DbFree(pParse->db, zAff);
98752 }
@@ -98742,156 +98810,10 @@
98810 sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, iMem, 0, (u8*)&value, P4_INT64);
98811 }
98812 }
98813 }
98814
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98815
98816 /* Generate code that will load into register regOut a value that is
98817 ** appropriate for the iIdxCol-th column of index pIdx.
98818 */
98819 SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(
@@ -98943,16 +98865,11 @@
98865 }
98866 }
98867
98868 /*
98869 ** Generate code that will extract the iColumn-th column from
98870 ** table pTab and store the column value in register iReg.
 
 
 
 
 
98871 **
98872 ** There must be an open cursor to pTab in iTable when this routine
98873 ** is called. If iColumn<0 then code is generated that extracts the rowid.
98874 */
98875 SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(
@@ -98962,102 +98879,26 @@
98879 int iTable, /* The cursor pointing to the table */
98880 int iReg, /* Store results here */
98881 u8 p5 /* P5 value for OP_Column + FLAGS */
98882 ){
98883 Vdbe *v = pParse->pVdbe;
 
 
 
 
 
 
 
 
 
 
 
 
 
98884 assert( v!=0 );
98885 sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg);
98886 if( p5 ){
98887 sqlite3VdbeChangeP5(v, p5);
 
 
98888 }
98889 return iReg;
98890 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98891
98892 /*
98893 ** Generate code to move content from registers iFrom...iFrom+nReg-1
98894 ** over to iTo..iTo+nReg-1.
98895 */
98896 SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){
98897 assert( iFrom>=iTo+nReg || iFrom+nReg<=iTo );
98898 sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg);
98899 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98900
98901 /*
98902 ** Convert a scalar expression node to a TK_REGISTER referencing
98903 ** register iReg. The caller must ensure that iReg already contains
98904 ** the correct value for the expression.
@@ -99152,10 +98993,32 @@
98993 }
98994 /* Otherwise, fall thru into the TK_COLUMN case */
98995 }
98996 case TK_COLUMN: {
98997 int iTab = pExpr->iTable;
98998 if( ExprHasProperty(pExpr, EP_FixedCol) ){
98999 /* This COLUMN expression is really a constant due to WHERE clause
99000 ** constraints, and that constant is coded by the pExpr->pLeft
99001 ** expresssion. However, make sure the constant has the correct
99002 ** datatype by applying the Affinity of the table column to the
99003 ** constant.
99004 */
99005 int iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target);
99006 int aff = sqlite3TableColumnAffinity(pExpr->pTab, pExpr->iColumn);
99007 if( aff!=SQLITE_AFF_BLOB ){
99008 static const char zAff[] = "B\000C\000D\000E";
99009 assert( SQLITE_AFF_BLOB=='A' );
99010 assert( SQLITE_AFF_TEXT=='B' );
99011 if( iReg!=target ){
99012 sqlite3VdbeAddOp2(v, OP_SCopy, iReg, target);
99013 iReg = target;
99014 }
99015 sqlite3VdbeAddOp4(v, OP_Affinity, iReg, 1, 0,
99016 &zAff[(aff-'B')*2], P4_STATIC);
99017 }
99018 return iReg;
99019 }
99020 if( iTab<0 ){
99021 if( pParse->iSelfTab<0 ){
99022 /* Generating CHECK constraints or inserting into partial index */
99023 return pExpr->iColumn - pParse->iSelfTab;
99024 }else{
@@ -99232,12 +99095,10 @@
99095 sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
99096 inReg = target;
99097 }
99098 sqlite3VdbeAddOp2(v, OP_Cast, target,
99099 sqlite3AffinityType(pExpr->u.zToken, 0));
 
 
99100 return inReg;
99101 }
99102 #endif /* SQLITE_OMIT_CAST */
99103 case TK_IS:
99104 case TK_ISNOT:
@@ -99419,14 +99280,11 @@
99280 assert( nFarg>=2 );
99281 sqlite3ExprCode(pParse, pFarg->a[0].pExpr, target);
99282 for(i=1; i<nFarg; i++){
99283 sqlite3VdbeAddOp2(v, OP_NotNull, target, endCoalesce);
99284 VdbeCoverage(v);
 
 
99285 sqlite3ExprCode(pParse, pFarg->a[i].pExpr, target);
 
99286 }
99287 sqlite3VdbeResolveLabel(v, endCoalesce);
99288 break;
99289 }
99290
@@ -99488,14 +99346,12 @@
99346 pFarg->a[0].pExpr->op2 =
99347 pDef->funcFlags & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG);
99348 }
99349 }
99350
 
99351 sqlite3ExprCodeExprList(pParse, pFarg, r1, 0,
99352 SQLITE_ECEL_DUP|SQLITE_ECEL_FACTOR);
 
99353 }else{
99354 r1 = 0;
99355 }
99356 #ifndef SQLITE_OMIT_VIRTUALTABLE
99357 /* Possibly overload the function if the first argument is
@@ -99664,13 +99520,11 @@
99520 }
99521
99522 case TK_IF_NULL_ROW: {
99523 int addrINR;
99524 addrINR = sqlite3VdbeAddOp1(v, OP_IfNullRow, pExpr->iTable);
 
99525 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
 
99526 sqlite3VdbeJumpHere(v, addrINR);
99527 sqlite3VdbeChangeP3(v, addrINR, inReg);
99528 break;
99529 }
99530
@@ -99703,11 +99557,10 @@
99557 ExprList *pEList; /* List of WHEN terms */
99558 struct ExprList_item *aListelem; /* Array of WHEN terms */
99559 Expr opCompare; /* The X==Ei expression */
99560 Expr *pX; /* The X expression */
99561 Expr *pTest = 0; /* X==Ei (form A) or just Ei (form B) */
 
99562
99563 assert( !ExprHasProperty(pExpr, EP_xIsSelect) && pExpr->x.pList );
99564 assert(pExpr->x.pList->nExpr > 0);
99565 pEList = pExpr->x.pList;
99566 aListelem = pEList->a;
@@ -99727,11 +99580,10 @@
99580 ** So make sure that the regFree1 register is not reused for other
99581 ** purposes and possibly overwritten. */
99582 regFree1 = 0;
99583 }
99584 for(i=0; i<nExpr-1; i=i+2){
 
99585 if( pX ){
99586 assert( pTest!=0 );
99587 opCompare.pRight = aListelem[i].pExpr;
99588 }else{
99589 pTest = aListelem[i].pExpr;
@@ -99740,22 +99592,17 @@
99592 testcase( pTest->op==TK_COLUMN );
99593 sqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL);
99594 testcase( aListelem[i+1].pExpr->op==TK_COLUMN );
99595 sqlite3ExprCode(pParse, aListelem[i+1].pExpr, target);
99596 sqlite3VdbeGoto(v, endLabel);
 
99597 sqlite3VdbeResolveLabel(v, nextCase);
99598 }
99599 if( (nExpr&1)!=0 ){
 
99600 sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target);
 
99601 }else{
99602 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
99603 }
 
 
99604 sqlite3VdbeResolveLabel(v, endLabel);
99605 break;
99606 }
99607 #ifndef SQLITE_OMIT_TRIGGER
99608 case TK_RAISE: {
@@ -99901,11 +99748,11 @@
99748 ** results in register target. The results are guaranteed to appear
99749 ** in register target. If the expression is constant, then this routine
99750 ** might choose to code the expression at initialization time.
99751 */
99752 SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){
99753 if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pExpr) ){
99754 sqlite3ExprCodeAtInit(pParse, pExpr, target);
99755 }else{
99756 sqlite3ExprCode(pParse, pExpr, target);
99757 }
99758 }
@@ -99983,11 +99830,13 @@
99830 i--;
99831 n--;
99832 }else{
99833 sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i);
99834 }
99835 }else if( (flags & SQLITE_ECEL_FACTOR)!=0
99836 && sqlite3ExprIsConstantNotJoin(pExpr)
99837 ){
99838 sqlite3ExprCodeAtInit(pParse, pExpr, target+i);
99839 }else{
99840 int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);
99841 if( inReg!=target+i ){
99842 VdbeOp *pOp;
@@ -100109,22 +99958,18 @@
99958 switch( op ){
99959 case TK_AND: {
99960 int d2 = sqlite3VdbeMakeLabel(v);
99961 testcase( jumpIfNull==0 );
99962 sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL);
 
99963 sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
99964 sqlite3VdbeResolveLabel(v, d2);
 
99965 break;
99966 }
99967 case TK_OR: {
99968 testcase( jumpIfNull==0 );
99969 sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
 
99970 sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
 
99971 break;
99972 }
99973 case TK_NOT: {
99974 testcase( jumpIfNull==0 );
99975 sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
@@ -100279,23 +100124,19 @@
100124
100125 switch( pExpr->op ){
100126 case TK_AND: {
100127 testcase( jumpIfNull==0 );
100128 sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
 
100129 sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
 
100130 break;
100131 }
100132 case TK_OR: {
100133 int d2 = sqlite3VdbeMakeLabel(v);
100134 testcase( jumpIfNull==0 );
100135 sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL);
 
100136 sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
100137 sqlite3VdbeResolveLabel(v, d2);
 
100138 break;
100139 }
100140 case TK_NOT: {
100141 testcase( jumpIfNull==0 );
100142 sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
@@ -100513,11 +100354,12 @@
100354 }
100355 }
100356 if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;
100357 if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){
100358 if( combinedFlags & EP_xIsSelect ) return 2;
100359 if( (combinedFlags & EP_FixedCol)==0
100360 && sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2;
100361 if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2;
100362 if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
100363 assert( (combinedFlags & EP_Reduced)==0 );
100364 if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){
100365 if( pA->iColumn!=pB->iColumn ) return 2;
@@ -101058,25 +100900,13 @@
100900 }
100901
100902 /*
100903 ** Deallocate a register, making available for reuse for some other
100904 ** purpose.
 
 
 
 
100905 */
100906 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
100907 if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
 
 
 
 
 
 
 
 
100908 pParse->aTempReg[pParse->nTempReg++] = iReg;
100909 }
100910 }
100911
100912 /*
@@ -101086,11 +100916,10 @@
100916 int i, n;
100917 if( nReg==1 ) return sqlite3GetTempReg(pParse);
100918 i = pParse->iRangeReg;
100919 n = pParse->nRangeReg;
100920 if( nReg<=n ){
 
100921 pParse->iRangeReg += nReg;
100922 pParse->nRangeReg -= nReg;
100923 }else{
100924 i = pParse->nMem+1;
100925 pParse->nMem += nReg;
@@ -101100,11 +100929,10 @@
100929 SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){
100930 if( nReg==1 ){
100931 sqlite3ReleaseTempReg(pParse, iReg);
100932 return;
100933 }
 
100934 if( nReg>pParse->nRangeReg ){
100935 pParse->nRangeReg = nReg;
100936 pParse->iRangeReg = iReg;
100937 }
100938 }
@@ -105020,11 +104848,10 @@
104848
104849
104850 /* Get the VDBE program ready for execution
104851 */
104852 if( v && pParse->nErr==0 && !db->mallocFailed ){
 
104853 /* A minimum of one cursor is required if autoincrement is used
104854 * See ticket [a696379c1f08866] */
104855 if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1;
104856 sqlite3VdbeMakeReady(v, pParse);
104857 pParse->rc = SQLITE_DONE;
@@ -107457,12 +107284,14 @@
107284 ** on disk.
107285 */
107286 v = sqlite3GetVdbe(pParse);
107287 if( v ){
107288 sqlite3BeginWriteOperation(pParse, 1, iDb);
107289 if( !isView ){
107290 sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName);
107291 sqlite3FkDropTable(pParse, pName, pTab);
107292 }
107293 sqlite3CodeDropTable(pParse, pTab, iDb, isView);
107294 }
107295
107296 exit_drop_table:
107297 sqlite3SrcListDelete(db, pName);
@@ -110279,13 +110108,12 @@
110108 sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur,
110109 pPk->aiColumn[i], iPk+i);
110110 }
110111 iKey = iPk;
110112 }else{
110113 iKey = ++pParse->nMem;
110114 sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, -1, iKey);
 
110115 }
110116
110117 if( eOnePass!=ONEPASS_OFF ){
110118 /* For ONEPASS, no need to store the rowid/primary-key. There is only
110119 ** one, so just keep it in its register(s) and fall through to the
@@ -110714,11 +110542,10 @@
110542
110543 if( piPartIdxLabel ){
110544 if( pIdx->pPartIdxWhere ){
110545 *piPartIdxLabel = sqlite3VdbeMakeLabel(v);
110546 pParse->iSelfTab = iDataCur + 1;
 
110547 sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel,
110548 SQLITE_JUMPIFNULL);
110549 pParse->iSelfTab = 0;
110550 }else{
110551 *piPartIdxLabel = 0;
@@ -110761,11 +110588,10 @@
110588 ** resolve that label.
110589 */
110590 SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel){
110591 if( iLabel ){
110592 sqlite3VdbeResolveLabel(pParse->pVdbe, iLabel);
 
110593 }
110594 }
110595
110596 /************** End of delete.c **********************************************/
110597 /************** Begin file func.c ********************************************/
@@ -113500,15 +113326,16 @@
113326 ** the table from the database. Triggers are disabled while running this
113327 ** DELETE, but foreign key actions are not.
113328 */
113329 SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){
113330 sqlite3 *db = pParse->db;
113331 if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) ){
113332 int iSkip = 0;
113333 Vdbe *v = sqlite3GetVdbe(pParse);
113334
113335 assert( v ); /* VDBE has already been allocated */
113336 assert( pTab->pSelect==0 ); /* Not a view */
113337 if( sqlite3FkReferences(pTab)==0 ){
113338 /* Search for a deferred foreign key constraint for which this table
113339 ** is the child table. If one cannot be found, return without
113340 ** generating any VDBE code. If one can be found, then jump over
113341 ** the entire DELETE if there are no outstanding deferred constraints
@@ -115399,48 +115226,10 @@
115226 testcase( w.eCode==CKCNSTRNT_ROWID );
115227 testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
115228 return !w.eCode;
115229 }
115230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115231 /*
115232 ** Generate code to do constraint checks prior to an INSERT or an UPDATE
115233 ** on table pTab.
115234 **
115235 ** The regNewData parameter is the first register in a range that contains
@@ -115546,23 +115335,24 @@
115335 int nCol; /* Number of columns */
115336 int onError; /* Conflict resolution strategy */
115337 int addr1; /* Address of jump instruction */
115338 int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
115339 int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
 
115340 Index *pUpIdx = 0; /* Index to which to apply the upsert */
115341 u8 isUpdate; /* True if this is an UPDATE operation */
115342 u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */
115343 int upsertBypass = 0; /* Address of Goto to bypass upsert subroutine */
115344 int upsertJump = 0; /* Address of Goto that jumps into upsert subroutine */
115345 int ipkTop = 0; /* Top of the IPK uniqueness check */
115346 int ipkBottom = 0; /* OP_Goto at the end of the IPK uniqueness check */
115347
115348 isUpdate = regOldData!=0;
115349 db = pParse->db;
115350 v = sqlite3GetVdbe(pParse);
115351 assert( v!=0 );
115352 assert( pTab->pSelect==0 ); /* This table is not a VIEW */
115353 nCol = pTab->nCol;
 
115354
115355 /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for
115356 ** normal rowid tables. nPkField is the number of key fields in the
115357 ** pPk index or 1 for a rowid table. In other words, nPkField is the
115358 ** number of fields in the true primary key of the table. */
@@ -115662,19 +115452,24 @@
115452 #endif /* !defined(SQLITE_OMIT_CHECK) */
115453
115454 /* UNIQUE and PRIMARY KEY constraints should be handled in the following
115455 ** order:
115456 **
115457 ** (1) OE_Update
115458 ** (2) OE_Abort, OE_Fail, OE_Rollback, OE_Ignore
115459 ** (3) OE_Replace
115460 **
115461 ** OE_Fail and OE_Ignore must happen before any changes are made.
115462 ** OE_Update guarantees that only a single row will change, so it
115463 ** must happen before OE_Replace. Technically, OE_Abort and OE_Rollback
115464 ** could happen in any order, but they are grouped up front for
115465 ** convenience.
115466 **
115467 ** 2018-08-14: Ticket https://www.sqlite.org/src/info/908f001483982c43
115468 ** The order of constraints used to have OE_Update as (2) and OE_Abort
115469 ** and so forth as (1). But apparently PostgreSQL checks the OE_Update
115470 ** constraint before any others, so it had to be moved.
115471 **
115472 ** Constraint checking code is generated in this order:
115473 ** (A) The rowid constraint
115474 ** (B) Unique index constraints that do not have OE_Replace as their
115475 ** default conflict resolution strategy
@@ -115691,15 +115486,14 @@
115486 ** Make all unique constraint resolution be OE_Ignore */
115487 assert( pUpsert->pUpsertSet==0 );
115488 overrideError = OE_Ignore;
115489 pUpsert = 0;
115490 }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){
115491 /* If the constraint-target uniqueness check must be run first.
115492 ** Jump to that uniqueness check now */
115493 upsertJump = sqlite3VdbeAddOp0(v, OP_Goto);
115494 VdbeComment((v, "UPSERT constraint goes first"));
 
115495 }
115496 }
115497
115498 /* If rowid is changing, make sure the new rowid does not previously
115499 ** exist in the table.
@@ -115727,20 +115521,16 @@
115521 /* If the response to a rowid conflict is REPLACE but the response
115522 ** to some other UNIQUE constraint is FAIL or IGNORE, then we need
115523 ** to defer the running of the rowid conflict checking until after
115524 ** the UNIQUE constraints have run.
115525 */
115526 if( onError==OE_Replace /* IPK rule is REPLACE */
115527 && onError!=overrideError /* Rules for other contraints are different */
115528 && pTab->pIndex /* There exist other constraints */
 
 
 
 
 
115529 ){
115530 ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1;
115531 VdbeComment((v, "defer IPK REPLACE until last"));
115532 }
115533
115534 if( isUpdate ){
115535 /* pkChng!=0 does not mean that the rowid has changed, only that
115536 ** it might have changed. Skip the conflict logic below if the rowid
@@ -115754,11 +115544,10 @@
115544 ** the following conflict logic if it does not. */
115545 VdbeNoopComment((v, "uniqueness check for ROWID"));
115546 sqlite3VdbeVerifyAbortable(v, onError);
115547 sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData);
115548 VdbeCoverage(v);
 
115549
115550 switch( onError ){
115551 default: {
115552 onError = OE_Abort;
115553 /* Fall thru into the next case */
@@ -115831,15 +115620,14 @@
115620 testcase( onError==OE_Ignore );
115621 sqlite3VdbeGoto(v, ignoreDest);
115622 break;
115623 }
115624 }
 
115625 sqlite3VdbeResolveLabel(v, addrRowidOk);
115626 if( ipkTop ){
115627 ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);
115628 sqlite3VdbeJumpHere(v, ipkTop-1);
115629 }
115630 }
115631
115632 /* Test all UNIQUE constraints by creating entries for each UNIQUE
115633 ** index and making sure that duplicate entries do not already exist.
@@ -115853,21 +115641,21 @@
115641 int regR; /* Range of registers holding conflicting PK */
115642 int iThisCur; /* Cursor for this UNIQUE index */
115643 int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */
115644
115645 if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */
 
 
 
 
115646 if( pUpIdx==pIdx ){
115647 addrUniqueOk = upsertJump+1;
115648 upsertBypass = sqlite3VdbeGoto(v, 0);
115649 VdbeComment((v, "Skip upsert subroutine"));
115650 sqlite3VdbeJumpHere(v, upsertJump);
115651 }else{
115652 addrUniqueOk = sqlite3VdbeMakeLabel(v);
115653 }
115654 if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){
115655 sqlite3TableAffinity(v, pTab, regNewData+1);
115656 bAffinityDone = 1;
115657 }
115658 VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName));
115659 iThisCur = iIdxCur+ix;
115660
115661
@@ -115936,19 +115724,10 @@
115724 }else{
115725 onError = OE_Update; /* DO UPDATE */
115726 }
115727 }
115728
 
 
 
 
 
 
 
 
 
115729 /* Collision detection may be omitted if all of the following are true:
115730 ** (1) The conflict resolution algorithm is REPLACE
115731 ** (2) The table is a WITHOUT ROWID table
115732 ** (3) There are no secondary indexes on the table
115733 ** (4) No delete triggers need to be fired if there is a conflict
@@ -115965,11 +115744,10 @@
115744 sqlite3VdbeResolveLabel(v, addrUniqueOk);
115745 continue;
115746 }
115747
115748 /* Check to see if the new index entry will be unique */
 
115749 sqlite3VdbeVerifyAbortable(v, onError);
115750 sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
115751 regIdx, pIdx->nKeyCol); VdbeCoverage(v);
115752
115753 /* Generate code to handle collisions */
@@ -116067,23 +115845,25 @@
115845 seenReplace = 1;
115846 break;
115847 }
115848 }
115849 if( pUpIdx==pIdx ){
115850 sqlite3VdbeGoto(v, upsertJump+1);
115851 sqlite3VdbeJumpHere(v, upsertBypass);
115852 }else{
115853 sqlite3VdbeResolveLabel(v, addrUniqueOk);
115854 }
 
115855 if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
115856 }
115857
115858 /* If the IPK constraint is a REPLACE, run it last */
115859 if( ipkTop ){
115860 sqlite3VdbeGoto(v, ipkTop+1);
115861 VdbeComment((v, "Do IPK REPLACE"));
115862 sqlite3VdbeJumpHere(v, ipkBottom);
115863 }
115864
 
 
 
 
115865 *pbMayReplace = seenReplace;
115866 VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace));
115867 }
115868
115869 #ifdef SQLITE_ENABLE_NULL_TRIM
@@ -116175,11 +115955,10 @@
115955 regRec = sqlite3GetTempReg(pParse);
115956 sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);
115957 sqlite3SetMakeRecordP5(v, pTab);
115958 if( !bAffinityDone ){
115959 sqlite3TableAffinity(v, pTab, 0);
 
115960 }
115961 if( pParse->nested ){
115962 pik_flags = 0;
115963 }else{
115964 pik_flags = OPFLAG_NCHANGE;
@@ -120462,11 +120241,10 @@
120241 int iDataCur, iIdxCur;
120242 int r1 = -1;
120243
120244 if( pTab->tnum<1 ) continue; /* Skip VIEWs or VIRTUAL TABLEs */
120245 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
 
120246 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0,
120247 1, 0, &iDataCur, &iIdxCur);
120248 /* reg[7] counts the number of entries in the table.
120249 ** reg[8+i] counts the number of entries in the i-th index
120250 */
@@ -120505,11 +120283,10 @@
120283 int addrCkFault = sqlite3VdbeMakeLabel(v);
120284 int addrCkOk = sqlite3VdbeMakeLabel(v);
120285 char *zErr;
120286 int k;
120287 pParse->iSelfTab = iDataCur + 1;
 
120288 for(k=pCheck->nExpr-1; k>0; k--){
120289 sqlite3ExprIfFalse(pParse, pCheck->a[k].pExpr, addrCkFault, 0);
120290 }
120291 sqlite3ExprIfTrue(pParse, pCheck->a[0].pExpr, addrCkOk,
120292 SQLITE_JUMPIFNULL);
@@ -120518,11 +120295,10 @@
120295 zErr = sqlite3MPrintf(db, "CHECK constraint failed in %s",
120296 pTab->zName);
120297 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
120298 integrityCheckResultRow(v);
120299 sqlite3VdbeResolveLabel(v, addrCkOk);
 
120300 }
120301 sqlite3ExprListDelete(db, pCheck);
120302 }
120303 if( !isQuick ){ /* Omit the remaining tests for quick_check */
120304 /* Validate index entries for the current row */
@@ -123463,11 +123239,10 @@
123239 }else{
123240 int r1 = sqlite3GetTempReg(pParse);
123241 assert( sqlite3Strlen30(pDest->zAffSdst)==nResultCol );
123242 sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, nResultCol,
123243 r1, pDest->zAffSdst, nResultCol);
 
123244 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, regResult, nResultCol);
123245 sqlite3ReleaseTempReg(pParse, r1);
123246 }
123247 break;
123248 }
@@ -123507,11 +123282,10 @@
123282 nPrefixReg);
123283 }else if( eDest==SRT_Coroutine ){
123284 sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm);
123285 }else{
123286 sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nResultCol);
 
123287 }
123288 break;
123289 }
123290
123291 #ifndef SQLITE_OMIT_CTE
@@ -123864,11 +123638,10 @@
123638 #ifndef SQLITE_OMIT_SUBQUERY
123639 case SRT_Set: {
123640 assert( nColumn==sqlite3Strlen30(pDest->zAffSdst) );
123641 sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, nColumn, regRowid,
123642 pDest->zAffSdst, nColumn);
 
123643 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, regRowid, regRow, nColumn);
123644 break;
123645 }
123646 case SRT_Mem: {
123647 /* The LIMIT clause will terminate the loop for us */
@@ -123879,11 +123652,10 @@
123652 assert( eDest==SRT_Output || eDest==SRT_Coroutine );
123653 testcase( eDest==SRT_Output );
123654 testcase( eDest==SRT_Coroutine );
123655 if( eDest==SRT_Output ){
123656 sqlite3VdbeAddOp2(v, OP_ResultRow, pDest->iSdst, nColumn);
 
123657 }else{
123658 sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm);
123659 }
123660 break;
123661 }
@@ -124480,11 +124252,10 @@
124252 ** "LIMIT -1" always shows all rows. There is some
124253 ** controversy about what the correct behavior should be.
124254 ** The current implementation interprets "LIMIT 0" to mean
124255 ** no rows.
124256 */
 
124257 if( pLimit ){
124258 assert( pLimit->op==TK_LIMIT );
124259 assert( pLimit->pLeft!=0 );
124260 p->iLimit = iLimit = ++pParse->nMem;
124261 v = sqlite3GetVdbe(pParse);
@@ -125266,11 +125037,10 @@
125037 int r1;
125038 testcase( pIn->nSdst>1 );
125039 r1 = sqlite3GetTempReg(pParse);
125040 sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst,
125041 r1, pDest->zAffSdst, pIn->nSdst);
 
125042 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pDest->iSDParm, r1,
125043 pIn->iSdst, pIn->nSdst);
125044 sqlite3ReleaseTempReg(pParse, r1);
125045 break;
125046 }
@@ -125309,11 +125079,10 @@
125079 ** return the next row of result.
125080 */
125081 default: {
125082 assert( pDest->eDest==SRT_Output );
125083 sqlite3VdbeAddOp2(v, OP_ResultRow, pIn->iSdst, pIn->nSdst);
 
125084 break;
125085 }
125086 }
125087
125088 /* Jump to the end of the loop if the LIMIT is reached.
@@ -125764,11 +125533,11 @@
125533 }else{
125534 Expr *pNew;
125535 Expr *pCopy = pSubst->pEList->a[pExpr->iColumn].pExpr;
125536 Expr ifNullRow;
125537 assert( pSubst->pEList!=0 && pExpr->iColumn<pSubst->pEList->nExpr );
125538 assert( pExpr->pRight==0 );
125539 if( sqlite3ExprIsVector(pCopy) ){
125540 sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
125541 }else{
125542 sqlite3 *db = pSubst->pParse->db;
125543 if( pSubst->isLeftJoin && pCopy->op!=TK_COLUMN ){
@@ -126388,11 +126157,172 @@
126157
126158 return 1;
126159 }
126160 #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
126161
126162 /*
126163 ** A structure to keep track of all of the column values that fixed to
126164 ** a known value due to WHERE clause constraints of the form COLUMN=VALUE.
126165 */
126166 typedef struct WhereConst WhereConst;
126167 struct WhereConst {
126168 Parse *pParse; /* Parsing context */
126169 int nConst; /* Number for COLUMN=CONSTANT terms */
126170 int nChng; /* Number of times a constant is propagated */
126171 Expr **apExpr; /* [i*2] is COLUMN and [i*2+1] is VALUE */
126172 };
126173
126174 /*
126175 ** Add a new entry to the pConst object
126176 */
126177 static void constInsert(
126178 WhereConst *pConst,
126179 Expr *pColumn,
126180 Expr *pValue
126181 ){
126182
126183 pConst->nConst++;
126184 pConst->apExpr = sqlite3DbReallocOrFree(pConst->pParse->db, pConst->apExpr,
126185 pConst->nConst*2*sizeof(Expr*));
126186 if( pConst->apExpr==0 ){
126187 pConst->nConst = 0;
126188 }else{
126189 if( ExprHasProperty(pValue, EP_FixedCol) ) pValue = pValue->pLeft;
126190 pConst->apExpr[pConst->nConst*2-2] = pColumn;
126191 pConst->apExpr[pConst->nConst*2-1] = pValue;
126192 }
126193 }
126194
126195 /*
126196 ** Find all terms of COLUMN=VALUE or VALUE=COLUMN in pExpr where VALUE
126197 ** is a constant expression and where the term must be true because it
126198 ** is part of the AND-connected terms of the expression. For each term
126199 ** found, add it to the pConst structure.
126200 */
126201 static void findConstInWhere(WhereConst *pConst, Expr *pExpr){
126202 Expr *pRight, *pLeft;
126203 if( pExpr==0 ) return;
126204 if( ExprHasProperty(pExpr, EP_FromJoin) ) return;
126205 if( pExpr->op==TK_AND ){
126206 findConstInWhere(pConst, pExpr->pRight);
126207 findConstInWhere(pConst, pExpr->pLeft);
126208 return;
126209 }
126210 if( pExpr->op!=TK_EQ ) return;
126211 pRight = pExpr->pRight;
126212 pLeft = pExpr->pLeft;
126213 assert( pRight!=0 );
126214 assert( pLeft!=0 );
126215 if( pRight->op==TK_COLUMN
126216 && !ExprHasProperty(pRight, EP_FixedCol)
126217 && sqlite3ExprIsConstant(pLeft)
126218 && sqlite3IsBinary(sqlite3BinaryCompareCollSeq(pConst->pParse,pLeft,pRight))
126219 ){
126220 constInsert(pConst, pRight, pLeft);
126221 }else
126222 if( pLeft->op==TK_COLUMN
126223 && !ExprHasProperty(pLeft, EP_FixedCol)
126224 && sqlite3ExprIsConstant(pRight)
126225 && sqlite3IsBinary(sqlite3BinaryCompareCollSeq(pConst->pParse,pLeft,pRight))
126226 ){
126227 constInsert(pConst, pLeft, pRight);
126228 }
126229 }
126230
126231 /*
126232 ** This is a Walker expression callback. pExpr is a candidate expression
126233 ** to be replaced by a value. If pExpr is equivalent to one of the
126234 ** columns named in pWalker->u.pConst, then overwrite it with its
126235 ** corresponding value.
126236 */
126237 static int propagateConstantExprRewrite(Walker *pWalker, Expr *pExpr){
126238 int i;
126239 WhereConst *pConst;
126240 if( pExpr->op!=TK_COLUMN ) return WRC_Continue;
126241 if( ExprHasProperty(pExpr, EP_FixedCol) ) return WRC_Continue;
126242 pConst = pWalker->u.pConst;
126243 for(i=0; i<pConst->nConst; i++){
126244 Expr *pColumn = pConst->apExpr[i*2];
126245 if( pColumn==pExpr ) continue;
126246 if( pColumn->iTable!=pExpr->iTable ) continue;
126247 if( pColumn->iColumn!=pExpr->iColumn ) continue;
126248 /* A match is found. Add the EP_FixedCol property */
126249 pConst->nChng++;
126250 ExprClearProperty(pExpr, EP_Leaf);
126251 ExprSetProperty(pExpr, EP_FixedCol);
126252 assert( pExpr->pLeft==0 );
126253 pExpr->pLeft = sqlite3ExprDup(pConst->pParse->db, pConst->apExpr[i*2+1], 0);
126254 break;
126255 }
126256 return WRC_Prune;
126257 }
126258
126259 /*
126260 ** The WHERE-clause constant propagation optimization.
126261 **
126262 ** If the WHERE clause contains terms of the form COLUMN=CONSTANT or
126263 ** CONSTANT=COLUMN that must be tree (in other words, if the terms top-level
126264 ** AND-connected terms that are not part of a ON clause from a LEFT JOIN)
126265 ** then throughout the query replace all other occurrences of COLUMN
126266 ** with CONSTANT within the WHERE clause.
126267 **
126268 ** For example, the query:
126269 **
126270 ** SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=t1.a AND t3.c=t2.b
126271 **
126272 ** Is transformed into
126273 **
126274 ** SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=39 AND t3.c=39
126275 **
126276 ** Return true if any transformations where made and false if not.
126277 **
126278 ** Implementation note: Constant propagation is tricky due to affinity
126279 ** and collating sequence interactions. Consider this example:
126280 **
126281 ** CREATE TABLE t1(a INT,b TEXT);
126282 ** INSERT INTO t1 VALUES(123,'0123');
126283 ** SELECT * FROM t1 WHERE a=123 AND b=a;
126284 ** SELECT * FROM t1 WHERE a=123 AND b=123;
126285 **
126286 ** The two SELECT statements above should return different answers. b=a
126287 ** is alway true because the comparison uses numeric affinity, but b=123
126288 ** is false because it uses text affinity and '0123' is not the same as '123'.
126289 ** To work around this, the expression tree is not actually changed from
126290 ** "b=a" to "b=123" but rather the "a" in "b=a" is tagged with EP_FixedCol
126291 ** and the "123" value is hung off of the pLeft pointer. Code generator
126292 ** routines know to generate the constant "123" instead of looking up the
126293 ** column value. Also, to avoid collation problems, this optimization is
126294 ** only attempted if the "a=123" term uses the default BINARY collation.
126295 */
126296 static int propagateConstants(
126297 Parse *pParse, /* The parsing context */
126298 Select *p /* The query in which to propagate constants */
126299 ){
126300 WhereConst x;
126301 Walker w;
126302 int nChng = 0;
126303 x.pParse = pParse;
126304 do{
126305 x.nConst = 0;
126306 x.nChng = 0;
126307 x.apExpr = 0;
126308 findConstInWhere(&x, p->pWhere);
126309 if( x.nConst ){
126310 memset(&w, 0, sizeof(w));
126311 w.pParse = pParse;
126312 w.xExprCallback = propagateConstantExprRewrite;
126313 w.xSelectCallback = sqlite3SelectWalkNoop;
126314 w.xSelectCallback2 = 0;
126315 w.walkerDepth = 0;
126316 w.u.pConst = &x;
126317 sqlite3WalkExpr(&w, p->pWhere);
126318 sqlite3DbFree(x.pParse->db, x.apExpr);
126319 nChng += x.nChng;
126320 }
126321 }while( x.nChng );
126322 return nChng;
126323 }
126324
126325 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
126326 /*
126327 ** Make copies of relevant WHERE clause terms of the outer query into
126328 ** the WHERE clause of subquery. Example:
@@ -127489,40 +127419,25 @@
127419 sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ);
127420 }
127421 sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, pF->iMem);
127422 sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF);
127423 sqlite3VdbeChangeP5(v, (u8)nArg);
 
127424 sqlite3ReleaseTempRange(pParse, regAgg, nArg);
127425 if( addrNext ){
127426 sqlite3VdbeResolveLabel(v, addrNext);
 
127427 }
127428 }
 
 
 
 
 
 
 
 
 
 
 
127429 if( regHit==0 && pAggInfo->nAccumulator ){
127430 regHit = regAcc;
127431 }
127432 if( regHit ){
127433 addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit); VdbeCoverage(v);
127434 }
 
127435 for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
127436 sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);
127437 }
127438 pAggInfo->directMode = 0;
 
127439 if( addrHitTest ){
127440 sqlite3VdbeJumpHere(v, addrHitTest);
127441 }
127442 }
127443
@@ -127648,10 +127563,11 @@
127563 ** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2)
127564 **
127565 ** The transformation only works if all of the following are true:
127566 **
127567 ** * The subquery is a UNION ALL of two or more terms
127568 ** * The subquery does not have a LIMIT clause
127569 ** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries
127570 ** * The outer query is a simple count(*)
127571 **
127572 ** Return TRUE if the optimization is undertaken.
127573 */
@@ -127671,10 +127587,11 @@
127587 if( pSub==0 ) return 0; /* The FROM is a subquery */
127588 if( pSub->pPrior==0 ) return 0; /* Must be a compound ry */
127589 do{
127590 if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
127591 if( pSub->pWhere ) return 0; /* No WHERE clause */
127592 if( pSub->pLimit ) return 0; /* No LIMIT clause */
127593 if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
127594 pSub = pSub->pPrior; /* Repeat over compound */
127595 }while( pSub );
127596
127597 /* If we reach this point then it is OK to perform the transformation */
@@ -127912,10 +127829,39 @@
127829 #endif
127830 if( p->pNext==0 ) ExplainQueryPlanPop(pParse);
127831 return rc;
127832 }
127833 #endif
127834
127835 /* Do the WHERE-clause constant propagation optimization if this is
127836 ** a join. No need to speed time on this operation for non-join queries
127837 ** as the equivalent optimization will be handled by query planner in
127838 ** sqlite3WhereBegin().
127839 */
127840 if( pTabList->nSrc>1
127841 && OptimizationEnabled(db, SQLITE_PropagateConst)
127842 && propagateConstants(pParse, p)
127843 ){
127844 #if SELECTTRACE_ENABLED
127845 if( sqlite3SelectTrace & 0x100 ){
127846 SELECTTRACE(0x100,pParse,p,("After constant propagation:\n"));
127847 sqlite3TreeViewSelect(0, p, 0);
127848 }
127849 #endif
127850 }else{
127851 SELECTTRACE(0x100,pParse,p,("Constant propagation not helpful\n"));
127852 }
127853
127854 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
127855 if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
127856 && countOfViewOptimization(pParse, p)
127857 ){
127858 if( db->mallocFailed ) goto select_end;
127859 pEList = p->pEList;
127860 pTabList = p->pSrc;
127861 }
127862 #endif
127863
127864 /* For each term in the FROM clause, do two things:
127865 ** (1) Authorized unreferenced tables
127866 ** (2) Generate code for all sub-queries
127867 */
@@ -127986,11 +127932,12 @@
127932 && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
127933 (pItem->fg.jointype & JT_OUTER)!=0)
127934 ){
127935 #if SELECTTRACE_ENABLED
127936 if( sqlite3SelectTrace & 0x100 ){
127937 SELECTTRACE(0x100,pParse,p,
127938 ("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
127939 sqlite3TreeViewSelect(0, p, 0);
127940 }
127941 #endif
127942 }else{
127943 SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));
@@ -128088,20 +128035,10 @@
128035 #if SELECTTRACE_ENABLED
128036 if( sqlite3SelectTrace & 0x400 ){
128037 SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
128038 sqlite3TreeViewSelect(0, p, 0);
128039 }
 
 
 
 
 
 
 
 
 
 
128040 #endif
128041
128042 /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and
128043 ** if the select-list is the same as the ORDER BY list, then this query
128044 ** can be rewritten as a GROUP BY. In other words, this:
@@ -128449,19 +128386,18 @@
128386 nCol++;
128387 j++;
128388 }
128389 }
128390 regBase = sqlite3GetTempRange(pParse, nCol);
 
128391 sqlite3ExprCodeExprList(pParse, pGroupBy, regBase, 0, 0);
128392 j = nGroupBy;
128393 for(i=0; i<sAggInfo.nColumn; i++){
128394 struct AggInfo_col *pCol = &sAggInfo.aCol[i];
128395 if( pCol->iSorterColumn>=j ){
128396 int r1 = j + regBase;
128397 sqlite3ExprCodeGetColumnOfTable(v,
128398 pCol->pTab, pCol->iTable, pCol->iColumn, r1);
128399 j++;
128400 }
128401 }
128402 regRecord = sqlite3GetTempReg(pParse);
128403 sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord);
@@ -128473,12 +128409,10 @@
128409 sortOut = sqlite3GetTempReg(pParse);
128410 sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol);
128411 sqlite3VdbeAddOp2(v, OP_SorterSort, sAggInfo.sortingIdx, addrEnd);
128412 VdbeComment((v, "GROUP BY sort")); VdbeCoverage(v);
128413 sAggInfo.useSortingIdx = 1;
 
 
128414 }
128415
128416 /* If the index or temporary table used by the GROUP BY sort
128417 ** will naturally deliver rows in the order required by the ORDER BY
128418 ** clause, cancel the ephemeral table open coded earlier.
@@ -128497,11 +128431,10 @@
128431 ** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth)
128432 ** Then compare the current GROUP BY terms against the GROUP BY terms
128433 ** from the previous row currently stored in a0, a1, a2...
128434 */
128435 addrTopOfLoop = sqlite3VdbeCurrentAddr(v);
 
128436 if( groupBySort ){
128437 sqlite3VdbeAddOp3(v, OP_SorterData, sAggInfo.sortingIdx,
128438 sortOut, sortPTab);
128439 }
128440 for(j=0; j<pGroupBy->nExpr; j++){
@@ -130714,17 +130647,11 @@
130647 ** if there are one or more BEFORE triggers that use this value via
130648 ** a new.* reference in a trigger program.
130649 */
130650 testcase( i==31 );
130651 testcase( i==32 );
130652 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
 
 
 
 
 
 
130653 }else{
130654 sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);
130655 }
130656 }
130657 }
@@ -133848,11 +133775,10 @@
133775 }
133776
133777 /* Code the OP_Affinity opcode if there is anything left to do. */
133778 if( n>0 ){
133779 sqlite3VdbeAddOp4(v, OP_Affinity, base, n, 0, zAff, n);
 
133780 }
133781 }
133782
133783 /*
133784 ** Expression pRight, which is the RHS of a comparison operation, is
@@ -134384,11 +134310,11 @@
134310 ** an access of the index rather than the original table.
134311 */
134312 static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){
134313 int rc = WRC_Continue;
134314 struct CCurHint *pHint = pWalker->u.pCCurHint;
134315 if( pExpr->op==TK_COLUMN && !ExprHasProperty(pExpr, EP_FixedCol) ){
134316 if( pExpr->iTable!=pHint->iTabCur ){
134317 Vdbe *v = pWalker->pParse->pVdbe;
134318 int reg = ++pWalker->pParse->nMem; /* Register for column value */
134319 sqlite3ExprCodeGetColumnOfTable(
134320 v, pExpr->pTab, pExpr->iTable, pExpr->iColumn, reg
@@ -134757,11 +134683,10 @@
134683 int iReg; /* P3 Value for OP_VFilter */
134684 int addrNotFound;
134685 int nConstraint = pLoop->nLTerm;
134686 int iIn; /* Counter for IN constraints */
134687
 
134688 iReg = sqlite3GetTempRange(pParse, nConstraint+2);
134689 addrNotFound = pLevel->addrBrk;
134690 for(j=0; j<nConstraint; j++){
134691 int iTarget = iReg+j+2;
134692 pTerm = pLoop->aLTerm[j];
@@ -134830,11 +134755,10 @@
134755 ** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems
134756 ** simpler and safer to simply not reuse the registers.
134757 **
134758 ** sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2);
134759 */
 
134760 }else
134761 #endif /* SQLITE_OMIT_VIRTUALTABLE */
134762
134763 if( (pLoop->wsFlags & WHERE_IPK)!=0
134764 && (pLoop->wsFlags & (WHERE_COLUMN_IN|WHERE_COLUMN_EQ))!=0
@@ -134854,13 +134778,10 @@
134778 iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg);
134779 if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);
134780 addrNxt = pLevel->addrNxt;
134781 sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg);
134782 VdbeCoverage(v);
 
 
 
134783 pLevel->op = OP_Noop;
134784 }else if( (pLoop->wsFlags & WHERE_IPK)!=0
134785 && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0
134786 ){
134787 /* Case 3: We have an inequality comparison against the ROWID field.
@@ -134926,11 +134847,10 @@
134847 VdbeComment((v, "pk"));
134848 VdbeCoverageIf(v, pX->op==TK_GT);
134849 VdbeCoverageIf(v, pX->op==TK_LE);
134850 VdbeCoverageIf(v, pX->op==TK_LT);
134851 VdbeCoverageIf(v, pX->op==TK_GE);
 
134852 sqlite3ReleaseTempReg(pParse, rTemp);
134853 }else{
134854 sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrHalt);
134855 VdbeCoverageIf(v, bRev==0);
134856 VdbeCoverageIf(v, bRev!=0);
@@ -134961,11 +134881,10 @@
134881 pLevel->p2 = start;
134882 assert( pLevel->p5==0 );
134883 if( testOp!=OP_Noop ){
134884 iRowidReg = ++pParse->nMem;
134885 sqlite3VdbeAddOp2(v, OP_Rowid, iCur, iRowidReg);
 
134886 sqlite3VdbeAddOp3(v, testOp, memEndValue, addrBrk, iRowidReg);
134887 VdbeCoverageIf(v, testOp==OP_Le);
134888 VdbeCoverageIf(v, testOp==OP_Lt);
134889 VdbeCoverageIf(v, testOp==OP_Ge);
134890 VdbeCoverageIf(v, testOp==OP_Gt);
@@ -135187,11 +135106,10 @@
135106 ** range (if any).
135107 */
135108 nConstraint = nEq;
135109 if( pRangeEnd ){
135110 Expr *pRight = pRangeEnd->pExpr->pRight;
 
135111 codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
135112 whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
135113 if( (pRangeEnd->wtFlags & TERM_VNULL)==0
135114 && sqlite3ExprCanBeNull(pRight)
135115 ){
@@ -135212,11 +135130,10 @@
135130 }else{
135131 endEq = 1;
135132 }
135133 }else if( bStopAtNull ){
135134 sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
 
135135 endEq = 0;
135136 nConstraint++;
135137 }
135138 sqlite3DbFree(db, zStartAff);
135139 sqlite3DbFree(db, zEndAff);
@@ -135246,11 +135163,10 @@
135163 (pWInfo->wctrlFlags & WHERE_SEEK_UNIQ_TABLE)
135164 && (pWInfo->eOnePass==ONEPASS_SINGLE)
135165 )){
135166 iRowidReg = ++pParse->nMem;
135167 sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
 
135168 sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg);
135169 VdbeCoverage(v);
135170 }else{
135171 codeDeferredSeek(pWInfo, pIdx, iCur, iIdxCur);
135172 }
@@ -135481,27 +135397,27 @@
135397 ** duplicate rows from prior sub-WHERE clauses, and record the
135398 ** rowid (or PRIMARY KEY) for the current row so that the same
135399 ** row will be skipped in subsequent sub-WHERE clauses.
135400 */
135401 if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){
 
135402 int iSet = ((ii==pOrWc->nTerm-1)?-1:ii);
135403 if( HasRowid(pTab) ){
135404 sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, -1, regRowid);
135405 jmp1 = sqlite3VdbeAddOp4Int(v, OP_RowSetTest, regRowset, 0,
135406 regRowid, iSet);
135407 VdbeCoverage(v);
135408 }else{
135409 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
135410 int nPk = pPk->nKeyCol;
135411 int iPk;
135412 int r;
135413
135414 /* Read the PK into an array of temp registers. */
135415 r = sqlite3GetTempRange(pParse, nPk);
135416 for(iPk=0; iPk<nPk; iPk++){
135417 int iCol = pPk->aiColumn[iPk];
135418 sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, iCol, r+iPk);
135419 }
135420
135421 /* Check if the temp table already contains this key. If so,
135422 ** the row has already been included in the result set and
135423 ** can be ignored (by jumping past the Gosub below). Otherwise,
@@ -135730,11 +135646,10 @@
135646 */
135647 if( pLevel->iLeftJoin ){
135648 pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
135649 sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
135650 VdbeComment((v, "record LEFT JOIN hit"));
 
135651 for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){
135652 testcase( pTerm->wtFlags & TERM_VIRTUAL );
135653 testcase( pTerm->wtFlags & TERM_CODED );
135654 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
135655 if( (pTerm->prereqAll & pLevel->notReady)!=0 ){
@@ -135946,22 +135861,22 @@
135861 Expr *pExpr, /* Test this expression */
135862 Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */
135863 int *pisComplete, /* True if the only wildcard is % in the last character */
135864 int *pnoCase /* True if uppercase is equivalent to lowercase */
135865 ){
135866 const u8 *z = 0; /* String on RHS of LIKE operator */
135867 Expr *pRight, *pLeft; /* Right and left size of LIKE operator */
135868 ExprList *pList; /* List of operands to the LIKE operator */
135869 u8 c; /* One character in z[] */
135870 int cnt; /* Number of non-wildcard prefix characters */
135871 u8 wc[4]; /* Wildcard characters */
135872 sqlite3 *db = pParse->db; /* Database connection */
135873 sqlite3_value *pVal = 0;
135874 int op; /* Opcode of pRight */
135875 int rc; /* Result code to return */
135876
135877 if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, (char*)wc) ){
135878 return 0;
135879 }
135880 #ifdef SQLITE_EBCDIC
135881 if( *pnoCase ) return 0;
135882 #endif
@@ -136611,11 +136526,11 @@
136526 && (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2))
136527 ){
136528 return 0;
136529 }
136530 pColl = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight);
136531 if( sqlite3IsBinary(pColl) ) return 1;
136532 return sqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight);
136533 }
136534
136535 /*
136536 ** Recursively walk the expressions of a SELECT statement and generate
@@ -136952,11 +136867,11 @@
136867 if( c=='A'-1 ) isComplete = 0;
136868 c = sqlite3UpperToLower[c];
136869 }
136870 *pC = c + 1;
136871 }
136872 zCollSeqName = noCase ? "NOCASE" : sqlite3StrBINARY;
136873 pNewExpr1 = sqlite3ExprDup(db, pLeft, 0);
136874 pNewExpr1 = sqlite3PExpr(pParse, TK_GE,
136875 sqlite3ExprAddCollateString(pParse,pNewExpr1,zCollSeqName),
136876 pStr1);
136877 transferJoinMarkings(pNewExpr1, pExpr);
@@ -137202,11 +137117,11 @@
137117 ** a bitmask indicating which tables are used in that expression
137118 ** tree.
137119 */
137120 SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){
137121 Bitmask mask;
137122 if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){
137123 return sqlite3WhereGetMask(pMaskSet, p->iTable);
137124 }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
137125 assert( p->op!=TK_IF_NULL_ROW );
137126 return 0;
137127 }
@@ -138100,11 +138015,10 @@
138015 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
138016 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
138017 VdbeComment((v, "for %s", pTable->zName));
138018
138019 /* Fill the automatic index with content */
 
138020 pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
138021 if( pTabItem->fg.viaCoroutine ){
138022 int regYield = pTabItem->regReturn;
138023 addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
138024 sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
@@ -138137,11 +138051,10 @@
138051 sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
138052 }
138053 sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
138054 sqlite3VdbeJumpHere(v, addrTop);
138055 sqlite3ReleaseTempReg(pParse, regRecord);
 
138056
138057 /* Jump here when skipping the initialization */
138058 sqlite3VdbeJumpHere(v, addrInit);
138059
138060 end_auto_index_create:
@@ -140503,11 +140416,11 @@
140416 int iTerm = pIdxInfo->aConstraint[iCons].iTermOffset;
140417 Expr *pX = pHidden->pWC->a[iTerm].pExpr;
140418 if( pX->pLeft ){
140419 pC = sqlite3BinaryCompareCollSeq(pHidden->pParse, pX->pLeft, pX->pRight);
140420 }
140421 zRet = (pC ? pC->zName : sqlite3StrBINARY);
140422 }
140423 return zRet;
140424 }
140425
140426 /*
@@ -141354,11 +141267,15 @@
141267 if( aSortCost[isOrdered]==0 ){
141268 aSortCost[isOrdered] = whereSortingCost(
141269 pWInfo, nRowEst, nOrderBy, isOrdered
141270 );
141271 }
141272 /* TUNING: Add a small extra penalty (5) to sorting as an
141273 ** extra encouragment to the query planner to select a plan
141274 ** where the rows emerge in the correct order without any sorting
141275 ** required. */
141276 rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]) + 5;
141277
141278 WHERETRACE(0x002,
141279 ("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n",
141280 aSortCost[isOrdered], (nOrderBy-isOrdered), nOrderBy,
141281 rUnsorted, rCost));
@@ -142371,11 +142288,10 @@
142288 sqlite3 *db = pParse->db;
142289
142290 /* Generate loop termination code.
142291 */
142292 VdbeModuleComment((v, "End WHERE-core"));
 
142293 for(i=pWInfo->nLevel-1; i>=0; i--){
142294 int addr;
142295 pLevel = &pWInfo->a[i];
142296 pLoop = pLevel->pWLoop;
142297 if( pLevel->op!=OP_Noop ){
@@ -143536,11 +143452,14 @@
143452 /*
143453 ** Attach window object pWin to expression p.
143454 */
143455 SQLITE_PRIVATE void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){
143456 if( p ){
143457 /* This routine is only called for the parser. If pWin was not
143458 ** allocated due to an OOM, then the parser would fail before ever
143459 ** invoking this routine */
143460 if( ALWAYS(pWin) ){
143461 p->pWin = pWin;
143462 pWin->pOwner = p;
143463 if( p->flags & EP_Distinct ){
143464 sqlite3ErrorMsg(pParse,
143465 "DISTINCT is not supported for window functions");
@@ -145095,21 +145014,21 @@
145014 #define sqlite3ParserCTX_PDECL ,Parse *pParse
145015 #define sqlite3ParserCTX_PARAM ,pParse
145016 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
145017 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
145018 #define YYFALLBACK 1
145019 #define YYNSTATE 518
145020 #define YYNRULE 366
145021 #define YYNTOKEN 155
145022 #define YY_MAX_SHIFT 517
145023 #define YY_MIN_SHIFTREDUCE 752
145024 #define YY_MAX_SHIFTREDUCE 1117
145025 #define YY_ERROR_ACTION 1118
145026 #define YY_ACCEPT_ACTION 1119
145027 #define YY_NO_ACTION 1120
145028 #define YY_MIN_REDUCE 1121
145029 #define YY_MAX_REDUCE 1486
145030 /************* End control #defines *******************************************/
145031 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
145032
145033 /* Define the yytestcase() macro to be a no-op if is not already defined
145034 ** otherwise.
@@ -145174,391 +145093,391 @@
145093 ** yy_default[] Default action for each state.
145094 **
145095 *********** Begin parsing tables **********************************************/
145096 #define YY_ACTTAB_COUNT (2009)
145097 static const YYACTIONTYPE yy_action[] = {
145098 /* 0 */ 365, 105, 102, 197, 105, 102, 197, 512, 1119, 1,
145099 /* 10 */ 1, 517, 2, 1123, 512, 1187, 1166, 1450, 272, 367,
145100 /* 20 */ 127, 1384, 1192, 1192, 1187, 1161, 178, 1200, 64, 64,
145101 /* 30 */ 474, 883, 319, 425, 345, 37, 37, 804, 359, 884,
145102 /* 40 */ 506, 506, 506, 112, 113, 103, 1095, 1095, 949, 952,
145103 /* 50 */ 942, 942, 110, 110, 111, 111, 111, 111, 362, 250,
145104 /* 60 */ 250, 512, 250, 250, 494, 512, 306, 512, 456, 512,
145105 /* 70 */ 1074, 488, 509, 475, 6, 509, 805, 134, 495, 226,
145106 /* 80 */ 194, 425, 37, 37, 512, 206, 64, 64, 64, 64,
145107 /* 90 */ 13, 13, 109, 109, 109, 109, 108, 108, 107, 107,
145108 /* 100 */ 107, 106, 398, 255, 378, 13, 13, 395, 394, 425,
145109 /* 110 */ 250, 250, 367, 473, 402, 1099, 1074, 1075, 1076, 383,
145110 /* 120 */ 1101, 387, 494, 509, 494, 1417, 1413, 301, 1100, 304,
145111 /* 130 */ 1251, 493, 367, 496, 16, 16, 112, 113, 103, 1095,
145112 /* 140 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111,
145113 /* 150 */ 111, 259, 1102, 492, 1102, 398, 112, 113, 103, 1095,
145114 /* 160 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111,
145115 /* 170 */ 111, 129, 1419, 340, 1414, 336, 1054, 489, 1052, 260,
145116 /* 180 */ 73, 105, 102, 197, 990, 109, 109, 109, 109, 108,
145117 /* 190 */ 108, 107, 107, 107, 106, 398, 367, 111, 111, 111,
145118 /* 200 */ 111, 104, 489, 89, 1426, 109, 109, 109, 109, 108,
145119 /* 210 */ 108, 107, 107, 107, 106, 398, 111, 111, 111, 111,
145120 /* 220 */ 112, 113, 103, 1095, 1095, 949, 952, 942, 942, 110,
145121 /* 230 */ 110, 111, 111, 111, 111, 109, 109, 109, 109, 108,
145122 /* 240 */ 108, 107, 107, 107, 106, 398, 114, 108, 108, 107,
145123 /* 250 */ 107, 107, 106, 398, 109, 109, 109, 109, 108, 108,
145124 /* 260 */ 107, 107, 107, 106, 398, 152, 396, 396, 396, 109,
145125 /* 270 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398,
145126 /* 280 */ 178, 490, 1406, 431, 1032, 1480, 1074, 512, 1480, 367,
145127 /* 290 */ 418, 294, 354, 409, 74, 1074, 109, 109, 109, 109,
145128 /* 300 */ 108, 108, 107, 107, 107, 106, 398, 1407, 37, 37,
145129 /* 310 */ 1425, 271, 503, 112, 113, 103, 1095, 1095, 949, 952,
145130 /* 320 */ 942, 942, 110, 110, 111, 111, 111, 111, 1430, 517,
145131 /* 330 */ 2, 1123, 1074, 1075, 1076, 427, 272, 1074, 127, 363,
145132 /* 340 */ 929, 1074, 1075, 1076, 218, 1200, 909, 455, 452, 451,
145133 /* 350 */ 389, 167, 512, 1030, 152, 442, 920, 450, 152, 870,
145134 /* 360 */ 919, 286, 109, 109, 109, 109, 108, 108, 107, 107,
145135 /* 370 */ 107, 106, 398, 13, 13, 258, 849, 250, 250, 225,
145136 /* 380 */ 106, 398, 367, 1074, 1075, 1076, 308, 385, 1074, 293,
145137 /* 390 */ 509, 919, 919, 921, 229, 320, 1250, 1383, 1417, 487,
145138 /* 400 */ 271, 503, 12, 206, 271, 503, 112, 113, 103, 1095,
145139 /* 410 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111,
145140 /* 420 */ 111, 1434, 283, 1123, 285, 1074, 1092, 245, 272, 1093,
145141 /* 430 */ 127, 384, 402, 386, 1074, 1075, 1076, 1200, 159, 236,
145142 /* 440 */ 253, 318, 458, 313, 457, 223, 786, 105, 102, 197,
145143 /* 450 */ 510, 311, 838, 838, 442, 109, 109, 109, 109, 108,
145144 /* 460 */ 108, 107, 107, 107, 106, 398, 512, 511, 512, 250,
145145 /* 470 */ 250, 1074, 1075, 1076, 432, 367, 1093, 929, 1454, 790,
145146 /* 480 */ 271, 503, 509, 105, 102, 197, 333, 63, 63, 64,
145147 /* 490 */ 64, 27, 786, 920, 284, 206, 1349, 919, 512, 112,
145148 /* 500 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110,
145149 /* 510 */ 111, 111, 111, 111, 107, 107, 107, 106, 398, 49,
145150 /* 520 */ 49, 512, 28, 1074, 402, 494, 418, 294, 919, 919,
145151 /* 530 */ 921, 186, 465, 1074, 464, 995, 995, 439, 512, 1074,
145152 /* 540 */ 331, 512, 45, 45, 1078, 339, 173, 168, 109, 109,
145153 /* 550 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 13,
145154 /* 560 */ 13, 203, 13, 13, 250, 250, 1190, 1190, 367, 1074,
145155 /* 570 */ 1075, 1076, 783, 262, 5, 356, 491, 509, 466, 1074,
145156 /* 580 */ 1075, 1076, 395, 394, 1074, 1074, 1075, 1076, 3, 279,
145157 /* 590 */ 1074, 1078, 112, 113, 103, 1095, 1095, 949, 952, 942,
145158 /* 600 */ 942, 110, 110, 111, 111, 111, 111, 250, 250, 1011,
145159 /* 610 */ 218, 1074, 869, 455, 452, 451, 939, 939, 950, 953,
145160 /* 620 */ 509, 250, 250, 450, 1012, 1074, 442, 1102, 1204, 1102,
145161 /* 630 */ 1074, 1075, 1076, 512, 509, 423, 1074, 1075, 1076, 1013,
145162 /* 640 */ 509, 109, 109, 109, 109, 108, 108, 107, 107, 107,
145163 /* 650 */ 106, 398, 1047, 512, 50, 50, 512, 1074, 1075, 1076,
145164 /* 660 */ 824, 367, 1046, 376, 408, 1059, 1353, 205, 405, 769,
145165 /* 670 */ 825, 1074, 1075, 1076, 64, 64, 319, 64, 64, 1297,
145166 /* 680 */ 943, 408, 407, 1353, 1355, 112, 113, 103, 1095, 1095,
145167 /* 690 */ 949, 952, 942, 942, 110, 110, 111, 111, 111, 111,
145168 /* 700 */ 291, 479, 512, 1032, 1481, 512, 431, 1481, 351, 1115,
145169 /* 710 */ 480, 992, 909, 482, 463, 992, 132, 178, 33, 447,
145170 /* 720 */ 1198, 136, 403, 64, 64, 476, 64, 64, 416, 366,
145171 /* 730 */ 280, 1141, 250, 250, 109, 109, 109, 109, 108, 108,
145172 /* 740 */ 107, 107, 107, 106, 398, 509, 222, 437, 408, 263,
145173 /* 750 */ 1353, 263, 250, 250, 367, 293, 413, 281, 930, 393,
145174 /* 760 */ 972, 467, 397, 250, 250, 509, 9, 470, 229, 497,
145175 /* 770 */ 351, 1031, 1030, 1482, 352, 371, 509, 1116, 112, 113,
145176 /* 780 */ 103, 1095, 1095, 949, 952, 942, 942, 110, 110, 111,
145177 /* 790 */ 111, 111, 111, 250, 250, 1011, 512, 1342, 292, 250,
145178 /* 800 */ 250, 250, 250, 1093, 372, 247, 509, 442, 868, 319,
145179 /* 810 */ 1012, 477, 509, 195, 509, 431, 270, 15, 15, 512,
145180 /* 820 */ 311, 512, 95, 512, 93, 1013, 364, 109, 109, 109,
145181 /* 830 */ 109, 108, 108, 107, 107, 107, 106, 398, 512, 1116,
145182 /* 840 */ 39, 39, 51, 51, 52, 52, 500, 367, 512, 1199,
145183 /* 850 */ 1093, 914, 436, 338, 133, 433, 221, 220, 219, 53,
145184 /* 860 */ 53, 319, 1392, 757, 758, 759, 512, 367, 88, 54,
145185 /* 870 */ 54, 112, 113, 103, 1095, 1095, 949, 952, 942, 942,
145186 /* 880 */ 110, 110, 111, 111, 111, 111, 274, 55, 55, 196,
145187 /* 890 */ 512, 112, 113, 103, 1095, 1095, 949, 952, 942, 942,
145188 /* 900 */ 110, 110, 111, 111, 111, 111, 135, 261, 1144, 373,
145189 /* 910 */ 512, 40, 40, 512, 868, 512, 989, 512, 989, 116,
145190 /* 920 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106,
145191 /* 930 */ 398, 41, 41, 512, 43, 43, 44, 44, 56, 56,
145192 /* 940 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106,
145193 /* 950 */ 398, 512, 376, 512, 57, 57, 512, 795, 512, 376,
145194 /* 960 */ 512, 442, 793, 512, 320, 512, 275, 512, 1453, 512,
145195 /* 970 */ 1282, 813, 58, 58, 14, 14, 512, 59, 59, 118,
145196 /* 980 */ 118, 60, 60, 512, 46, 46, 61, 61, 62, 62,
145197 /* 990 */ 47, 47, 512, 190, 189, 91, 512, 140, 140, 512,
145198 /* 1000 */ 391, 512, 844, 1195, 141, 141, 512, 843, 512, 793,
145199 /* 1010 */ 512, 410, 512, 69, 69, 367, 278, 48, 48, 256,
145200 /* 1020 */ 65, 65, 119, 119, 244, 244, 257, 66, 66, 120,
145201 /* 1030 */ 120, 121, 121, 117, 117, 367, 512, 509, 380, 112,
145202 /* 1040 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110,
145203 /* 1050 */ 111, 111, 111, 111, 512, 868, 512, 139, 139, 112,
145204 /* 1060 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110,
145205 /* 1070 */ 111, 111, 111, 111, 1282, 138, 138, 125, 125, 512,
145206 /* 1080 */ 12, 512, 1351, 1282, 512, 442, 131, 1282, 109, 109,
145207 /* 1090 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 512,
145208 /* 1100 */ 124, 124, 122, 122, 512, 123, 123, 512, 109, 109,
145209 /* 1110 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 512,
145210 /* 1120 */ 68, 68, 460, 779, 512, 70, 70, 299, 67, 67,
145211 /* 1130 */ 1027, 251, 251, 353, 1282, 191, 196, 1427, 462, 1296,
145212 /* 1140 */ 38, 38, 381, 94, 509, 42, 42, 177, 844, 271,
145213 /* 1150 */ 503, 382, 417, 843, 420, 438, 505, 373, 374, 153,
145214 /* 1160 */ 252, 868, 429, 367, 222, 249, 194, 883, 182, 290,
145215 /* 1170 */ 779, 988, 88, 988, 463, 884, 906, 911, 424, 426,
145216 /* 1180 */ 228, 228, 228, 367, 17, 803, 802, 112, 113, 103,
145217 /* 1190 */ 1095, 1095, 949, 952, 942, 942, 110, 110, 111, 111,
145218 /* 1200 */ 111, 111, 392, 295, 810, 811, 88, 112, 101, 103,
145219 /* 1210 */ 1095, 1095, 949, 952, 942, 942, 110, 110, 111, 111,
145220 /* 1220 */ 111, 111, 372, 419, 448, 309, 979, 224, 88, 975,
145221 /* 1230 */ 877, 841, 224, 228, 100, 923, 109, 109, 109, 109,
145222 /* 1240 */ 108, 108, 107, 107, 107, 106, 398, 86, 430, 777,
145223 /* 1250 */ 842, 1236, 130, 100, 1235, 412, 109, 109, 109, 109,
145224 /* 1260 */ 108, 108, 107, 107, 107, 106, 398, 317, 1443, 1397,
145225 /* 1270 */ 1170, 287, 1169, 979, 1372, 1371, 367, 316, 434, 296,
145226 /* 1280 */ 1232, 1223, 923, 300, 303, 305, 307, 1183, 1168, 1167,
145227 /* 1290 */ 312, 321, 322, 1244, 1281, 1219, 367, 268, 1230, 499,
145228 /* 1300 */ 498, 113, 103, 1095, 1095, 949, 952, 942, 942, 110,
145229 /* 1310 */ 110, 111, 111, 111, 111, 1287, 1150, 443, 242, 184,
145230 /* 1320 */ 1216, 1143, 103, 1095, 1095, 949, 952, 942, 942, 110,
145231 /* 1330 */ 110, 111, 111, 111, 111, 1132, 1131, 1133, 1437, 350,
145232 /* 1340 */ 411, 324, 188, 98, 504, 289, 4, 326, 315, 109,
145233 /* 1350 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398,
145234 /* 1360 */ 507, 328, 1266, 1274, 358, 453, 282, 192, 1346, 109,
145235 /* 1370 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398,
145236 /* 1380 */ 11, 1166, 1345, 399, 1440, 330, 502, 1110, 231, 428,
145237 /* 1390 */ 1391, 343, 187, 98, 504, 501, 4, 1107, 1389, 375,
145238 /* 1400 */ 422, 155, 72, 165, 75, 152, 149, 86, 414, 1263,
145239 /* 1410 */ 507, 157, 415, 160, 929, 161, 162, 163, 446, 1271,
145240 /* 1420 */ 96, 96, 8, 30, 208, 1277, 357, 97, 355, 399,
145241 /* 1430 */ 514, 513, 421, 399, 919, 31, 169, 435, 1340, 212,
145242 /* 1440 */ 80, 441, 243, 214, 1360, 501, 298, 174, 444, 302,
145243 /* 1450 */ 215, 271, 503, 1134, 216, 360, 485, 459, 388, 1186,
145244 /* 1460 */ 361, 484, 1185, 795, 929, 919, 919, 921, 922, 24,
145245 /* 1470 */ 96, 96, 1184, 1158, 1177, 314, 1157, 97, 1176, 399,
145246 /* 1480 */ 514, 513, 469, 1156, 919, 1452, 390, 266, 98, 504,
145247 /* 1490 */ 267, 4, 472, 478, 483, 85, 1227, 333, 230, 492,
145248 /* 1500 */ 1408, 332, 323, 115, 10, 507, 1228, 181, 335, 98,
145249 /* 1510 */ 504, 337, 4, 92, 87, 919, 919, 921, 922, 24,
145250 /* 1520 */ 1429, 1063, 401, 1226, 481, 254, 507, 325, 399, 327,
145251 /* 1530 */ 349, 349, 348, 239, 346, 1225, 329, 766, 1209, 1326,
145252 /* 1540 */ 501, 183, 1208, 341, 269, 342, 237, 1069, 1140, 399,
145253 /* 1550 */ 199, 485, 277, 29, 515, 241, 486, 238, 516, 929,
145254 /* 1560 */ 276, 501, 240, 1129, 1124, 96, 96, 1376, 142, 154,
145255 /* 1570 */ 369, 370, 97, 143, 399, 514, 513, 1377, 128, 919,
145256 /* 1580 */ 929, 1375, 144, 753, 400, 1374, 96, 96, 848, 1154,
145257 /* 1590 */ 201, 1153, 185, 97, 264, 399, 514, 513, 202, 71,
145258 /* 1600 */ 919, 146, 1151, 273, 198, 404, 126, 987, 200, 985,
145259 /* 1610 */ 919, 919, 921, 922, 24, 903, 156, 145, 204, 158,
145260 /* 1620 */ 827, 98, 504, 288, 4, 207, 1001, 164, 147, 907,
145261 /* 1630 */ 377, 919, 919, 921, 922, 24, 379, 148, 507, 166,
145262 /* 1640 */ 76, 77, 368, 1004, 78, 79, 209, 271, 503, 210,
145263 /* 1650 */ 1000, 137, 18, 297, 211, 228, 440, 1104, 213, 171,
145264 /* 1660 */ 32, 399, 768, 993, 170, 316, 445, 217, 449, 806,
145265 /* 1670 */ 406, 310, 172, 501, 81, 19, 20, 454, 82, 83,
145266 /* 1680 */ 265, 150, 179, 461, 485, 151, 180, 955, 84, 484,
145267 /* 1690 */ 1035, 34, 929, 35, 468, 1036, 193, 471, 96, 96,
145268 /* 1700 */ 246, 248, 876, 175, 871, 97, 100, 399, 514, 513,
145269 /* 1710 */ 1063, 401, 919, 227, 254, 1053, 21, 22, 1049, 349,
145270 /* 1720 */ 349, 348, 239, 346, 1040, 176, 766, 334, 1051, 7,
145271 /* 1730 */ 88, 98, 504, 970, 4, 233, 23, 956, 954, 199,
145272 /* 1740 */ 958, 277, 1010, 919, 919, 921, 922, 24, 507, 276,
145273 /* 1750 */ 232, 1009, 959, 25, 36, 508, 924, 778, 99, 26,
145274 /* 1760 */ 347, 90, 504, 837, 4, 234, 344, 235, 1445, 1064,
145275 /* 1770 */ 1120, 399, 1120, 1444, 1120, 1120, 1120, 1120, 507, 201,
145276 /* 1780 */ 1120, 1120, 1120, 501, 1120, 1120, 1120, 202, 1120, 1120,
145277 /* 1790 */ 146, 1120, 1120, 1120, 1120, 1120, 1120, 200, 1120, 1120,
145278 /* 1800 */ 1120, 399, 929, 1120, 1120, 1120, 1120, 1120, 96, 96,
145279 /* 1810 */ 1120, 1120, 1120, 501, 1120, 97, 1120, 399, 514, 513,
145280 /* 1820 */ 1120, 1120, 919, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145281 /* 1830 */ 1120, 368, 929, 1120, 1120, 1120, 271, 503, 96, 96,
145282 /* 1840 */ 1120, 1120, 1120, 1120, 1120, 97, 1120, 399, 514, 513,
145283 /* 1850 */ 1120, 1120, 919, 919, 919, 921, 922, 24, 1120, 406,
145284 /* 1860 */ 1120, 1120, 1120, 254, 1120, 1120, 1120, 1120, 349, 349,
145285 /* 1870 */ 348, 239, 346, 1120, 1120, 766, 1120, 1120, 1120, 1120,
145286 /* 1880 */ 1120, 1120, 1120, 919, 919, 921, 922, 24, 199, 1120,
145287 /* 1890 */ 277, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 276, 1120,
145288 /* 1900 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145289 /* 1910 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145290 /* 1920 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 201, 1120,
145291 /* 1930 */ 1120, 1120, 1120, 1120, 1120, 1120, 202, 1120, 1120, 146,
145292 /* 1940 */ 1120, 1120, 1120, 1120, 1120, 1120, 200, 1120, 1120, 1120,
145293 /* 1950 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145294 /* 1960 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145295 /* 1970 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145296 /* 1980 */ 368, 1120, 1120, 1120, 1120, 271, 503, 1120, 1120, 1120,
145297 /* 1990 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120,
145298 /* 2000 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 406,
145299 };
145300 static const YYCODETYPE yy_lookahead[] = {
145301 /* 0 */ 184, 238, 239, 240, 238, 239, 240, 163, 155, 156,
145302 /* 10 */ 157, 158, 159, 160, 163, 191, 192, 183, 165, 19,
145303 /* 20 */ 167, 258, 202, 203, 200, 191, 163, 174, 184, 185,
145304 /* 30 */ 174, 31, 163, 163, 171, 184, 185, 35, 175, 39,
145305 /* 40 */ 179, 180, 181, 43, 44, 45, 46, 47, 48, 49,
145306 /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 184, 206,
145307 /* 60 */ 207, 163, 206, 207, 220, 163, 16, 163, 66, 163,
145308 /* 70 */ 59, 270, 219, 229, 273, 219, 74, 208, 174, 223,
145309 /* 80 */ 224, 163, 184, 185, 163, 232, 184, 185, 184, 185,
145310 /* 90 */ 184, 185, 92, 93, 94, 95, 96, 97, 98, 99,
145311 /* 100 */ 100, 101, 102, 233, 198, 184, 185, 96, 97, 163,
145312 /* 110 */ 206, 207, 19, 163, 261, 104, 105, 106, 107, 198,
145313 /* 120 */ 109, 119, 220, 219, 220, 274, 275, 77, 117, 79,
145314 /* 130 */ 187, 229, 19, 229, 184, 185, 43, 44, 45, 46,
145315 /* 140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
145316 /* 150 */ 57, 233, 141, 134, 143, 102, 43, 44, 45, 46,
145317 /* 160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
145318 /* 170 */ 57, 152, 274, 216, 276, 218, 83, 163, 85, 233,
145319 /* 180 */ 67, 238, 239, 240, 11, 92, 93, 94, 95, 96,
145320 /* 190 */ 97, 98, 99, 100, 101, 102, 19, 54, 55, 56,
145321 /* 200 */ 57, 58, 163, 26, 163, 92, 93, 94, 95, 96,
145322 /* 210 */ 97, 98, 99, 100, 101, 102, 54, 55, 56, 57,
145323 /* 220 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
145324 /* 230 */ 53, 54, 55, 56, 57, 92, 93, 94, 95, 96,
145325 /* 240 */ 97, 98, 99, 100, 101, 102, 69, 96, 97, 98,
145326 /* 250 */ 99, 100, 101, 102, 92, 93, 94, 95, 96, 97,
145327 /* 260 */ 98, 99, 100, 101, 102, 81, 179, 180, 181, 92,
145328 /* 270 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
145329 /* 280 */ 163, 267, 268, 163, 22, 23, 59, 163, 26, 19,
145330 /* 290 */ 117, 118, 175, 109, 24, 59, 92, 93, 94, 95,
145331 /* 300 */ 96, 97, 98, 99, 100, 101, 102, 268, 184, 185,
145332 /* 310 */ 269, 127, 128, 43, 44, 45, 46, 47, 48, 49,
145333 /* 320 */ 50, 51, 52, 53, 54, 55, 56, 57, 157, 158,
145334 /* 330 */ 159, 160, 105, 106, 107, 163, 165, 59, 167, 184,
145335 /* 340 */ 90, 105, 106, 107, 108, 174, 73, 111, 112, 113,
145336 /* 350 */ 19, 22, 163, 91, 81, 163, 106, 121, 81, 132,
145337 /* 360 */ 110, 16, 92, 93, 94, 95, 96, 97, 98, 99,
145338 /* 370 */ 100, 101, 102, 184, 185, 255, 98, 206, 207, 26,
145339 /* 380 */ 101, 102, 19, 105, 106, 107, 23, 198, 59, 116,
145340 /* 390 */ 219, 141, 142, 143, 24, 163, 187, 205, 274, 275,
145341 /* 400 */ 127, 128, 182, 232, 127, 128, 43, 44, 45, 46,
145342 /* 410 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
145343 /* 420 */ 57, 158, 77, 160, 79, 59, 26, 182, 165, 59,
145344 /* 430 */ 167, 199, 261, 102, 105, 106, 107, 174, 72, 108,
145345 /* 440 */ 109, 110, 111, 112, 113, 114, 59, 238, 239, 240,
145346 /* 450 */ 123, 120, 125, 126, 163, 92, 93, 94, 95, 96,
145347 /* 460 */ 97, 98, 99, 100, 101, 102, 163, 163, 163, 206,
145348 /* 470 */ 207, 105, 106, 107, 254, 19, 106, 90, 197, 23,
145349 /* 480 */ 127, 128, 219, 238, 239, 240, 22, 184, 185, 184,
145350 /* 490 */ 185, 22, 105, 106, 149, 232, 205, 110, 163, 43,
145351 /* 500 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
145352 /* 510 */ 54, 55, 56, 57, 98, 99, 100, 101, 102, 184,
145353 /* 520 */ 185, 163, 53, 59, 261, 220, 117, 118, 141, 142,
145354 /* 530 */ 143, 131, 174, 59, 229, 116, 117, 118, 163, 59,
145355 /* 540 */ 163, 163, 184, 185, 59, 242, 72, 22, 92, 93,
145356 /* 550 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 184,
145357 /* 560 */ 185, 24, 184, 185, 206, 207, 202, 203, 19, 105,
145358 /* 570 */ 106, 107, 23, 198, 22, 174, 198, 219, 220, 105,
145359 /* 580 */ 106, 107, 96, 97, 59, 105, 106, 107, 22, 174,
145360 /* 590 */ 59, 106, 43, 44, 45, 46, 47, 48, 49, 50,
145361 /* 600 */ 51, 52, 53, 54, 55, 56, 57, 206, 207, 12,
145362 /* 610 */ 108, 59, 132, 111, 112, 113, 46, 47, 48, 49,
145363 /* 620 */ 219, 206, 207, 121, 27, 59, 163, 141, 207, 143,
145364 /* 630 */ 105, 106, 107, 163, 219, 234, 105, 106, 107, 42,
145365 /* 640 */ 219, 92, 93, 94, 95, 96, 97, 98, 99, 100,
145366 /* 650 */ 101, 102, 76, 163, 184, 185, 163, 105, 106, 107,
145367 /* 660 */ 63, 19, 86, 163, 163, 23, 163, 130, 205, 21,
145368 /* 670 */ 73, 105, 106, 107, 184, 185, 163, 184, 185, 237,
145369 /* 680 */ 110, 180, 181, 180, 181, 43, 44, 45, 46, 47,
145370 /* 690 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
145371 /* 700 */ 174, 163, 163, 22, 23, 163, 163, 26, 22, 23,
145372 /* 710 */ 220, 29, 73, 220, 272, 33, 22, 163, 24, 19,
145373 /* 720 */ 174, 208, 259, 184, 185, 19, 184, 185, 80, 175,
145374 /* 730 */ 230, 174, 206, 207, 92, 93, 94, 95, 96, 97,
145375 /* 740 */ 98, 99, 100, 101, 102, 219, 46, 65, 247, 195,
145376 /* 750 */ 247, 197, 206, 207, 19, 116, 117, 118, 23, 220,
145377 /* 760 */ 112, 174, 220, 206, 207, 219, 22, 174, 24, 174,
145378 /* 770 */ 22, 23, 91, 264, 265, 168, 219, 91, 43, 44,
145379 /* 780 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
145380 /* 790 */ 55, 56, 57, 206, 207, 12, 163, 149, 255, 206,
145381 /* 800 */ 207, 206, 207, 59, 104, 23, 219, 163, 26, 163,
145382 /* 810 */ 27, 105, 219, 163, 219, 163, 211, 184, 185, 163,
145383 /* 820 */ 120, 163, 146, 163, 148, 42, 221, 92, 93, 94,
145384 /* 830 */ 95, 96, 97, 98, 99, 100, 101, 102, 163, 91,
145385 /* 840 */ 184, 185, 184, 185, 184, 185, 63, 19, 163, 205,
145386 /* 850 */ 106, 23, 245, 163, 208, 248, 116, 117, 118, 184,
145387 /* 860 */ 185, 163, 163, 7, 8, 9, 163, 19, 26, 184,
145388 /* 870 */ 185, 43, 44, 45, 46, 47, 48, 49, 50, 51,
145389 /* 880 */ 52, 53, 54, 55, 56, 57, 163, 184, 185, 107,
145390 /* 890 */ 163, 43, 44, 45, 46, 47, 48, 49, 50, 51,
145391 /* 900 */ 52, 53, 54, 55, 56, 57, 208, 255, 177, 178,
145392 /* 910 */ 163, 184, 185, 163, 132, 163, 141, 163, 143, 22,
145393 /* 920 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
145394 /* 930 */ 102, 184, 185, 163, 184, 185, 184, 185, 184, 185,
145395 /* 940 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
145396 /* 950 */ 102, 163, 163, 163, 184, 185, 163, 115, 163, 163,
145397 /* 960 */ 163, 163, 59, 163, 163, 163, 163, 163, 23, 163,
145398 /* 970 */ 163, 26, 184, 185, 184, 185, 163, 184, 185, 184,
145399 /* 980 */ 185, 184, 185, 163, 184, 185, 184, 185, 184, 185,
145400 /* 990 */ 184, 185, 163, 96, 97, 147, 163, 184, 185, 163,
145401 /* 1000 */ 199, 163, 124, 205, 184, 185, 163, 129, 163, 106,
145402 /* 1010 */ 163, 234, 163, 184, 185, 19, 163, 184, 185, 230,
145403 /* 1020 */ 184, 185, 184, 185, 206, 207, 230, 184, 185, 184,
145404 /* 1030 */ 185, 184, 185, 184, 185, 19, 163, 219, 231, 43,
145405 /* 1040 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
145406 /* 1050 */ 54, 55, 56, 57, 163, 26, 163, 184, 185, 43,
145407 /* 1060 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
145408 /* 1070 */ 54, 55, 56, 57, 163, 184, 185, 184, 185, 163,
145409 /* 1080 */ 182, 163, 163, 163, 163, 163, 22, 163, 92, 93,
145410 /* 1090 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 163,
145411 /* 1100 */ 184, 185, 184, 185, 163, 184, 185, 163, 92, 93,
145412 /* 1110 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 163,
145413 /* 1120 */ 184, 185, 98, 59, 163, 184, 185, 205, 184, 185,
145414 /* 1130 */ 23, 206, 207, 26, 163, 26, 107, 153, 154, 237,
145415 /* 1140 */ 184, 185, 231, 147, 219, 184, 185, 249, 124, 127,
145416 /* 1150 */ 128, 231, 254, 129, 118, 231, 177, 178, 262, 263,
145417 /* 1160 */ 22, 132, 19, 19, 46, 223, 224, 31, 24, 23,
145418 /* 1170 */ 106, 141, 26, 143, 272, 39, 140, 23, 23, 23,
145419 /* 1180 */ 26, 26, 26, 19, 22, 109, 110, 43, 44, 45,
145420 /* 1190 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
145421 /* 1200 */ 56, 57, 231, 23, 7, 8, 26, 43, 44, 45,
145422 /* 1210 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
145423 /* 1220 */ 56, 57, 104, 61, 23, 23, 59, 26, 26, 23,
145424 /* 1230 */ 23, 23, 26, 26, 26, 59, 92, 93, 94, 95,
145425 /* 1240 */ 96, 97, 98, 99, 100, 101, 102, 138, 105, 23,
145426 /* 1250 */ 23, 163, 26, 26, 163, 163, 92, 93, 94, 95,
145427 /* 1260 */ 96, 97, 98, 99, 100, 101, 102, 110, 130, 163,
145428 /* 1270 */ 193, 163, 193, 106, 163, 163, 19, 120, 163, 163,
145429 /* 1280 */ 163, 225, 106, 163, 163, 163, 163, 163, 193, 163,
145430 /* 1290 */ 163, 163, 163, 163, 163, 163, 19, 222, 163, 203,
145431 /* 1300 */ 163, 44, 45, 46, 47, 48, 49, 50, 51, 52,
145432 /* 1310 */ 53, 54, 55, 56, 57, 163, 163, 251, 250, 209,
145433 /* 1320 */ 222, 163, 45, 46, 47, 48, 49, 50, 51, 52,
145434 /* 1330 */ 53, 54, 55, 56, 57, 163, 163, 163, 163, 161,
145435 /* 1340 */ 226, 222, 182, 19, 20, 256, 22, 222, 187, 92,
145436 /* 1350 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
145437 /* 1360 */ 36, 222, 213, 213, 213, 188, 226, 196, 187, 92,
145438 /* 1370 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
145439 /* 1380 */ 210, 192, 187, 59, 166, 226, 244, 60, 130, 256,
145440 /* 1390 */ 170, 212, 210, 19, 20, 71, 22, 38, 170, 170,
145441 /* 1400 */ 104, 260, 257, 22, 257, 81, 43, 138, 18, 213,
145442 /* 1410 */ 36, 201, 170, 204, 90, 204, 204, 204, 18, 236,
145443 /* 1420 */ 96, 97, 48, 235, 169, 201, 236, 103, 213, 105,
145444 /* 1430 */ 106, 107, 213, 59, 110, 235, 201, 170, 213, 169,
145445 /* 1440 */ 146, 62, 170, 169, 253, 71, 252, 22, 189, 170,
145446 /* 1450 */ 169, 127, 128, 170, 169, 189, 82, 104, 64, 186,
145447 /* 1460 */ 189, 87, 186, 115, 90, 141, 142, 143, 144, 145,
145448 /* 1470 */ 96, 97, 186, 186, 194, 186, 188, 103, 194, 105,
145449 /* 1480 */ 106, 107, 189, 186, 110, 186, 102, 246, 19, 20,
145450 /* 1490 */ 246, 22, 189, 133, 84, 104, 228, 22, 170, 134,
145451 /* 1500 */ 269, 271, 227, 137, 22, 36, 228, 216, 216, 19,
145452 /* 1510 */ 20, 170, 22, 146, 136, 141, 142, 143, 144, 145,
145453 /* 1520 */ 0, 1, 2, 228, 135, 5, 36, 227, 59, 227,
145454 /* 1530 */ 10, 11, 12, 13, 14, 228, 227, 17, 217, 241,
145455 /* 1540 */ 71, 215, 217, 214, 243, 213, 25, 13, 173, 59,
145456 /* 1550 */ 30, 82, 32, 26, 172, 6, 87, 164, 162, 90,
145457 /* 1560 */ 40, 71, 164, 162, 162, 96, 97, 182, 176, 263,
145458 /* 1570 */ 266, 266, 103, 176, 105, 106, 107, 182, 190, 110,
145459 /* 1580 */ 90, 182, 176, 4, 3, 182, 96, 97, 98, 182,
145460 /* 1590 */ 70, 182, 22, 103, 190, 105, 106, 107, 78, 182,
145461 /* 1600 */ 110, 81, 182, 151, 15, 89, 16, 23, 88, 23,
145462 /* 1610 */ 141, 142, 143, 144, 145, 128, 139, 119, 24, 131,
145463 /* 1620 */ 20, 19, 20, 16, 22, 133, 1, 131, 119, 140,
145464 /* 1630 */ 61, 141, 142, 143, 144, 145, 37, 119, 36, 139,
145465 /* 1640 */ 53, 53, 122, 105, 53, 53, 34, 127, 128, 130,
145466 /* 1650 */ 1, 5, 22, 149, 104, 26, 41, 75, 130, 104,
145467 /* 1660 */ 24, 59, 20, 68, 68, 120, 19, 114, 67, 28,
145468 /* 1670 */ 150, 23, 22, 71, 22, 22, 22, 67, 22, 138,
145469 /* 1680 */ 67, 37, 23, 22, 82, 153, 23, 23, 26, 87,
145470 /* 1690 */ 23, 22, 90, 22, 24, 23, 130, 24, 96, 97,
145471 /* 1700 */ 23, 23, 105, 22, 132, 103, 26, 105, 106, 107,
145472 /* 1710 */ 1, 2, 110, 34, 5, 75, 34, 34, 85, 10,
145473 /* 1720 */ 11, 12, 13, 14, 23, 26, 17, 24, 83, 44,
145474 /* 1730 */ 26, 19, 20, 23, 22, 22, 34, 23, 23, 30,
145475 /* 1740 */ 23, 32, 23, 141, 142, 143, 144, 145, 36, 40,
145476 /* 1750 */ 26, 23, 11, 22, 22, 26, 23, 23, 22, 22,
145477 /* 1760 */ 15, 19, 20, 124, 22, 130, 23, 130, 130, 1,
145478 /* 1770 */ 277, 59, 277, 130, 277, 277, 277, 277, 36, 70,
145479 /* 1780 */ 277, 277, 277, 71, 277, 277, 277, 78, 277, 277,
145480 /* 1790 */ 81, 277, 277, 277, 277, 277, 277, 88, 277, 277,
145481 /* 1800 */ 277, 59, 90, 277, 277, 277, 277, 277, 96, 97,
145482 /* 1810 */ 277, 277, 277, 71, 277, 103, 277, 105, 106, 107,
145483 /* 1820 */ 277, 277, 110, 277, 277, 277, 277, 277, 277, 277,
@@ -145580,162 +145499,162 @@
145499 /* 1980 */ 122, 277, 277, 277, 277, 127, 128, 277, 277, 277,
145500 /* 1990 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
145501 /* 2000 */ 277, 277, 277, 277, 277, 277, 277, 277, 150, 277,
145502 /* 2010 */ 277, 277, 277, 277, 277, 277, 277, 277, 277,
145503 };
145504 #define YY_SHIFT_COUNT (517)
145505 #define YY_SHIFT_MIN (0)
145506 #define YY_SHIFT_MAX (1858)
145507 static const unsigned short int yy_shift_ofst[] = {
145508 /* 0 */ 1709, 1520, 1858, 1324, 1324, 277, 1374, 1469, 1602, 1712,
145509 /* 10 */ 1712, 1712, 273, 0, 0, 113, 1016, 1712, 1712, 1712,
145510 /* 20 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 11, 11, 236,
145511 /* 30 */ 184, 277, 277, 277, 277, 277, 277, 93, 177, 270,
145512 /* 40 */ 363, 456, 549, 642, 735, 828, 848, 996, 1144, 1016,
145513 /* 50 */ 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016,
145514 /* 60 */ 1016, 1016, 1016, 1016, 1016, 1016, 1164, 1016, 1257, 1277,
145515 /* 70 */ 1277, 1490, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712,
145516 /* 80 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712,
145517 /* 90 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712,
145518 /* 100 */ 1712, 1712, 1712, 1742, 1712, 1712, 1712, 1712, 1712, 1712,
145519 /* 110 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 143, 162, 162,
145520 /* 120 */ 162, 162, 162, 204, 151, 416, 531, 648, 700, 531,
145521 /* 130 */ 486, 486, 531, 353, 353, 353, 353, 409, 279, 53,
145522 /* 140 */ 2009, 2009, 331, 331, 331, 329, 366, 329, 329, 597,
145523 /* 150 */ 597, 464, 474, 262, 681, 531, 531, 531, 531, 531,
145524 /* 160 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531,
145525 /* 170 */ 531, 531, 531, 531, 531, 531, 531, 173, 485, 984,
145526 /* 180 */ 984, 576, 485, 19, 1022, 2009, 2009, 2009, 387, 250,
145527 /* 190 */ 250, 525, 502, 278, 552, 227, 480, 566, 531, 531,
145528 /* 200 */ 531, 531, 531, 531, 531, 531, 639, 531, 531, 531,
145529 /* 210 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 2,
145530 /* 220 */ 2, 2, 531, 531, 531, 531, 782, 531, 531, 531,
145531 /* 230 */ 744, 531, 531, 783, 531, 531, 531, 531, 531, 531,
145532 /* 240 */ 531, 531, 419, 682, 327, 370, 370, 370, 370, 1029,
145533 /* 250 */ 327, 327, 1024, 897, 856, 1109, 706, 706, 1143, 1109,
145534 /* 260 */ 1109, 1143, 842, 945, 1118, 1136, 1136, 1136, 706, 676,
145535 /* 270 */ 400, 878, 694, 1327, 1258, 1258, 1359, 1359, 1258, 1296,
145536 /* 280 */ 1381, 1363, 1269, 1390, 1390, 1390, 1390, 1258, 1400, 1269,
145537 /* 290 */ 1269, 1296, 1381, 1363, 1363, 1269, 1258, 1400, 1294, 1379,
145538 /* 300 */ 1258, 1400, 1425, 1258, 1400, 1258, 1400, 1425, 1353, 1353,
145539 /* 310 */ 1353, 1394, 1425, 1353, 1348, 1353, 1394, 1353, 1353, 1425,
145540 /* 320 */ 1384, 1384, 1425, 1360, 1391, 1360, 1391, 1360, 1391, 1360,
145541 /* 330 */ 1391, 1258, 1365, 1410, 1475, 1366, 1365, 1482, 1258, 1367,
145542 /* 340 */ 1366, 1378, 1389, 1269, 1521, 1527, 1534, 1534, 1549, 1549,
145543 /* 350 */ 1549, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009,
145544 /* 360 */ 2009, 2009, 2009, 2009, 2009, 2009, 2009, 570, 345, 686,
145545 /* 370 */ 748, 50, 740, 1064, 1107, 469, 537, 1036, 1146, 1162,
145546 /* 380 */ 1154, 1155, 1156, 1180, 1201, 1202, 903, 1076, 1197, 1157,
145547 /* 390 */ 1167, 1206, 1207, 1208, 775, 1030, 1226, 1227, 1176, 1138,
145548 /* 400 */ 1579, 1581, 1570, 1452, 1589, 1516, 1590, 1584, 1586, 1487,
145549 /* 410 */ 1477, 1498, 1594, 1488, 1600, 1492, 1607, 1625, 1496, 1489,
145550 /* 420 */ 1509, 1569, 1599, 1500, 1587, 1588, 1591, 1592, 1518, 1538,
145551 /* 430 */ 1612, 1519, 1649, 1646, 1630, 1550, 1504, 1595, 1629, 1596,
145552 /* 440 */ 1582, 1615, 1528, 1555, 1636, 1642, 1647, 1545, 1553, 1650,
145553 /* 450 */ 1601, 1652, 1653, 1648, 1654, 1610, 1641, 1656, 1613, 1644,
145554 /* 460 */ 1659, 1541, 1661, 1532, 1663, 1664, 1662, 1667, 1669, 1670,
145555 /* 470 */ 1672, 1671, 1673, 1566, 1677, 1678, 1597, 1679, 1681, 1572,
145556 /* 480 */ 1680, 1682, 1680, 1683, 1633, 1640, 1645, 1685, 1701, 1703,
145557 /* 490 */ 1699, 1704, 1702, 1710, 1680, 1714, 1715, 1717, 1719, 1724,
145558 /* 500 */ 1728, 1713, 1741, 1731, 1732, 1733, 1734, 1736, 1737, 1729,
145559 /* 510 */ 1639, 1635, 1637, 1638, 1643, 1743, 1745, 1768,
145560 };
145561 #define YY_REDUCE_COUNT (366)
145562 #define YY_REDUCE_MIN (-237)
145563 #define YY_REDUCE_MAX (1420)
145564 static const short yy_reduce_ofst[] = {
145565 /* 0 */ -147, 171, 263, -96, 358, -144, -149, -102, 124, -156,
145566 /* 10 */ -98, 305, 401, -57, 209, -237, 245, -94, -79, 189,
145567 /* 20 */ 375, 490, 493, 378, 303, 539, 542, 501, 503, 554,
145568 /* 30 */ 415, 526, 546, 557, 587, 593, 595, -234, -234, -234,
145569 /* 40 */ -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,
145570 /* 50 */ -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,
145571 /* 60 */ -234, -234, -234, -234, -234, -234, -234, -234, -234, -234,
145572 /* 70 */ -234, -50, 335, 470, 633, 656, 658, 660, 675, 685,
145573 /* 80 */ 703, 727, 747, 750, 752, 754, 770, 788, 790, 793,
145574 /* 90 */ 795, 797, 800, 802, 804, 806, 813, 820, 829, 833,
145575 /* 100 */ 836, 838, 843, 845, 847, 849, 873, 891, 893, 916,
145576 /* 110 */ 918, 921, 936, 941, 944, 956, 961, -234, -234, -234,
145577 /* 120 */ -234, -234, -234, -234, -234, -234, 463, 607, -176, 14,
145578 /* 130 */ -139, 87, -137, 818, 925, 818, 925, 898, -234, -234,
145579 /* 140 */ -234, -234, -166, -166, -166, -130, -131, -82, -54, -180,
145580 /* 150 */ 364, 41, 513, 509, 509, 117, 500, 789, 796, 646,
145581 /* 160 */ 192, 291, 644, 798, 120, 807, 543, 911, 920, 652,
145582 /* 170 */ 924, 922, 232, 698, 801, 971, 39, 220, 731, 442,
145583 /* 180 */ 902, -199, 979, -43, 421, 896, 942, 605, -184, -126,
145584 /* 190 */ 155, 172, 281, 304, 377, 538, 650, 690, 699, 723,
145585 /* 200 */ 803, 853, 919, 1088, 1091, 1092, 777, 1106, 1108, 1111,
145586 /* 210 */ 1112, 1115, 1116, 1117, 1120, 1121, 1122, 1123, 1124, 1077,
145587 /* 220 */ 1079, 1095, 1126, 1127, 1128, 1129, 1056, 1130, 1131, 1132,
145588 /* 230 */ 1075, 1135, 1137, 1096, 1152, 304, 1153, 1158, 1172, 1173,
145589 /* 240 */ 1174, 1175, 1066, 1068, 1110, 1098, 1119, 1125, 1139, 1056,
145590 /* 250 */ 1110, 1110, 1170, 1160, 1178, 1149, 1114, 1140, 1089, 1150,
145591 /* 260 */ 1151, 1133, 1177, 1171, 1189, 1161, 1181, 1195, 1159, 1142,
145592 /* 270 */ 1179, 1182, 1218, 1141, 1220, 1228, 1145, 1147, 1229, 1183,
145593 /* 280 */ 1188, 1210, 1196, 1209, 1211, 1212, 1213, 1242, 1255, 1215,
145594 /* 290 */ 1219, 1190, 1200, 1224, 1235, 1225, 1267, 1270, 1191, 1194,
145595 /* 300 */ 1272, 1274, 1259, 1279, 1281, 1283, 1285, 1266, 1273, 1276,
145596 /* 310 */ 1286, 1280, 1271, 1287, 1288, 1289, 1284, 1297, 1299, 1293,
145597 /* 320 */ 1241, 1244, 1303, 1268, 1275, 1278, 1300, 1295, 1302, 1307,
145598 /* 330 */ 1309, 1328, 1291, 1230, 1231, 1321, 1292, 1298, 1341, 1301,
145599 /* 340 */ 1325, 1326, 1329, 1332, 1375, 1382, 1393, 1398, 1396, 1401,
145600 /* 350 */ 1402, 1304, 1305, 1306, 1392, 1385, 1395, 1399, 1403, 1397,
145601 /* 360 */ 1388, 1404, 1407, 1409, 1417, 1420, 1406,
145602 };
145603 static const YYACTIONTYPE yy_default[] = {
145604 /* 0 */ 1486, 1486, 1486, 1335, 1118, 1224, 1118, 1118, 1118, 1335,
145605 /* 10 */ 1335, 1335, 1118, 1254, 1254, 1386, 1149, 1118, 1118, 1118,
145606 /* 20 */ 1118, 1118, 1118, 1118, 1334, 1118, 1118, 1118, 1118, 1118,
145607 /* 30 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1260, 1118,
145608 /* 40 */ 1118, 1118, 1118, 1118, 1336, 1337, 1118, 1118, 1118, 1385,
145609 /* 50 */ 1387, 1270, 1269, 1268, 1267, 1368, 1241, 1265, 1258, 1262,
145610 /* 60 */ 1330, 1331, 1329, 1333, 1337, 1336, 1118, 1261, 1301, 1315,
145611 /* 70 */ 1300, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145612 /* 80 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145613 /* 90 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145614 /* 100 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145615 /* 110 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1309, 1314, 1320,
145616 /* 120 */ 1313, 1310, 1303, 1302, 1304, 1305, 1118, 1139, 1188, 1118,
145617 /* 130 */ 1118, 1118, 1118, 1403, 1402, 1118, 1118, 1149, 1306, 1307,
145618 /* 140 */ 1317, 1316, 1393, 1442, 1441, 1118, 1118, 1118, 1118, 1118,
145619 /* 150 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145620 /* 160 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145621 /* 170 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1149, 1145, 1295,
145622 /* 180 */ 1294, 1412, 1145, 1248, 1118, 1398, 1224, 1215, 1118, 1118,
145623 /* 190 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1390,
145624 /* 200 */ 1388, 1118, 1350, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145625 /* 210 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145626 /* 220 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145627 /* 230 */ 1220, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145628 /* 240 */ 1118, 1436, 1118, 1363, 1202, 1220, 1220, 1220, 1220, 1222,
145629 /* 250 */ 1203, 1201, 1214, 1149, 1125, 1264, 1243, 1243, 1475, 1264,
145630 /* 260 */ 1264, 1475, 1163, 1456, 1160, 1254, 1254, 1254, 1243, 1332,
145631 /* 270 */ 1221, 1214, 1118, 1478, 1229, 1229, 1477, 1477, 1229, 1273,
145632 /* 280 */ 1279, 1191, 1264, 1197, 1197, 1197, 1197, 1229, 1136, 1264,
145633 /* 290 */ 1264, 1273, 1279, 1191, 1191, 1264, 1229, 1136, 1367, 1472,
145634 /* 300 */ 1229, 1136, 1343, 1229, 1136, 1229, 1136, 1343, 1189, 1189,
145635 /* 310 */ 1189, 1178, 1343, 1189, 1163, 1189, 1178, 1189, 1189, 1343,
145636 /* 320 */ 1347, 1347, 1343, 1247, 1242, 1247, 1242, 1247, 1242, 1247,
145637 /* 330 */ 1242, 1229, 1248, 1411, 1118, 1259, 1248, 1338, 1229, 1118,
145638 /* 340 */ 1259, 1257, 1255, 1264, 1142, 1181, 1439, 1439, 1435, 1435,
145639 /* 350 */ 1435, 1483, 1483, 1398, 1451, 1149, 1149, 1149, 1149, 1451,
145640 /* 360 */ 1165, 1165, 1149, 1149, 1149, 1149, 1451, 1118, 1118, 1118,
145641 /* 370 */ 1118, 1118, 1118, 1446, 1118, 1352, 1233, 1118, 1118, 1118,
145642 /* 380 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145643 /* 390 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1284,
145644 /* 400 */ 1118, 1121, 1395, 1118, 1118, 1394, 1118, 1118, 1118, 1118,
145645 /* 410 */ 1118, 1118, 1234, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145646 /* 420 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145647 /* 430 */ 1118, 1474, 1118, 1118, 1118, 1118, 1118, 1118, 1366, 1365,
145648 /* 440 */ 1118, 1118, 1231, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145649 /* 450 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145650 /* 460 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145651 /* 470 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145652 /* 480 */ 1256, 1118, 1410, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
145653 /* 490 */ 1424, 1249, 1118, 1118, 1465, 1118, 1118, 1118, 1118, 1118,
145654 /* 500 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1460,
145655 /* 510 */ 1205, 1286, 1118, 1285, 1289, 1118, 1130, 1118,
145656 };
145657 /********** End of lemon-generated parsing tables *****************************/
145658
145659 /* The next table maps tokens (terminal symbols) into fallback tokens.
145660 ** If a construct like the following:
@@ -146145,32 +146064,32 @@
146064 /* 211 */ "selcollist",
146065 /* 212 */ "from",
146066 /* 213 */ "where_opt",
146067 /* 214 */ "groupby_opt",
146068 /* 215 */ "having_opt",
146069 /* 216 */ "orderby_opt",
146070 /* 217 */ "limit_opt",
146071 /* 218 */ "window_clause",
146072 /* 219 */ "values",
146073 /* 220 */ "nexprlist",
146074 /* 221 */ "sclp",
146075 /* 222 */ "as",
146076 /* 223 */ "seltablist",
146077 /* 224 */ "stl_prefix",
146078 /* 225 */ "joinop",
146079 /* 226 */ "indexed_opt",
146080 /* 227 */ "on_opt",
146081 /* 228 */ "using_opt",
146082 /* 229 */ "exprlist",
146083 /* 230 */ "xfullname",
146084 /* 231 */ "idlist",
146085 /* 232 */ "with",
146086 /* 233 */ "setlist",
146087 /* 234 */ "insert_cmd",
146088 /* 235 */ "idlist_opt",
146089 /* 236 */ "upsert",
146090 /* 237 */ "over_clause",
146091 /* 238 */ "likeop",
146092 /* 239 */ "between_op",
146093 /* 240 */ "in_op",
146094 /* 241 */ "paren_exprlist",
146095 /* 242 */ "case_operand",
@@ -146300,288 +146219,289 @@
146219 /* 82 */ "select ::= selectnowith",
146220 /* 83 */ "selectnowith ::= selectnowith multiselect_op oneselect",
146221 /* 84 */ "multiselect_op ::= UNION",
146222 /* 85 */ "multiselect_op ::= UNION ALL",
146223 /* 86 */ "multiselect_op ::= EXCEPT|INTERSECT",
146224 /* 87 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
146225 /* 88 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt",
146226 /* 89 */ "values ::= VALUES LP nexprlist RP",
146227 /* 90 */ "values ::= values COMMA LP nexprlist RP",
146228 /* 91 */ "distinct ::= DISTINCT",
146229 /* 92 */ "distinct ::= ALL",
146230 /* 93 */ "distinct ::=",
146231 /* 94 */ "sclp ::=",
146232 /* 95 */ "selcollist ::= sclp scanpt expr scanpt as",
146233 /* 96 */ "selcollist ::= sclp scanpt STAR",
146234 /* 97 */ "selcollist ::= sclp scanpt nm DOT STAR",
146235 /* 98 */ "as ::= AS nm",
146236 /* 99 */ "as ::=",
146237 /* 100 */ "from ::=",
146238 /* 101 */ "from ::= FROM seltablist",
146239 /* 102 */ "stl_prefix ::= seltablist joinop",
146240 /* 103 */ "stl_prefix ::=",
146241 /* 104 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
146242 /* 105 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
146243 /* 106 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
146244 /* 107 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
146245 /* 108 */ "dbnm ::=",
146246 /* 109 */ "dbnm ::= DOT nm",
146247 /* 110 */ "fullname ::= nm",
146248 /* 111 */ "fullname ::= nm DOT nm",
146249 /* 112 */ "xfullname ::= nm",
146250 /* 113 */ "xfullname ::= nm DOT nm",
146251 /* 114 */ "xfullname ::= nm DOT nm AS nm",
146252 /* 115 */ "xfullname ::= nm AS nm",
146253 /* 116 */ "joinop ::= COMMA|JOIN",
146254 /* 117 */ "joinop ::= JOIN_KW JOIN",
146255 /* 118 */ "joinop ::= JOIN_KW nm JOIN",
146256 /* 119 */ "joinop ::= JOIN_KW nm nm JOIN",
146257 /* 120 */ "on_opt ::= ON expr",
146258 /* 121 */ "on_opt ::=",
146259 /* 122 */ "indexed_opt ::=",
146260 /* 123 */ "indexed_opt ::= INDEXED BY nm",
146261 /* 124 */ "indexed_opt ::= NOT INDEXED",
146262 /* 125 */ "using_opt ::= USING LP idlist RP",
146263 /* 126 */ "using_opt ::=",
146264 /* 127 */ "orderby_opt ::=",
146265 /* 128 */ "orderby_opt ::= ORDER BY sortlist",
146266 /* 129 */ "sortlist ::= sortlist COMMA expr sortorder",
146267 /* 130 */ "sortlist ::= expr sortorder",
146268 /* 131 */ "sortorder ::= ASC",
146269 /* 132 */ "sortorder ::= DESC",
146270 /* 133 */ "sortorder ::=",
146271 /* 134 */ "groupby_opt ::=",
146272 /* 135 */ "groupby_opt ::= GROUP BY nexprlist",
146273 /* 136 */ "having_opt ::=",
146274 /* 137 */ "having_opt ::= HAVING expr",
146275 /* 138 */ "limit_opt ::=",
146276 /* 139 */ "limit_opt ::= LIMIT expr",
146277 /* 140 */ "limit_opt ::= LIMIT expr OFFSET expr",
146278 /* 141 */ "limit_opt ::= LIMIT expr COMMA expr",
146279 /* 142 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt",
146280 /* 143 */ "where_opt ::=",
146281 /* 144 */ "where_opt ::= WHERE expr",
146282 /* 145 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt",
146283 /* 146 */ "setlist ::= setlist COMMA nm EQ expr",
146284 /* 147 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
146285 /* 148 */ "setlist ::= nm EQ expr",
146286 /* 149 */ "setlist ::= LP idlist RP EQ expr",
146287 /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert",
146288 /* 151 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES",
146289 /* 152 */ "upsert ::=",
146290 /* 153 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
146291 /* 154 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
146292 /* 155 */ "upsert ::= ON CONFLICT DO NOTHING",
146293 /* 156 */ "insert_cmd ::= INSERT orconf",
146294 /* 157 */ "insert_cmd ::= REPLACE",
146295 /* 158 */ "idlist_opt ::=",
146296 /* 159 */ "idlist_opt ::= LP idlist RP",
146297 /* 160 */ "idlist ::= idlist COMMA nm",
146298 /* 161 */ "idlist ::= nm",
146299 /* 162 */ "expr ::= LP expr RP",
146300 /* 163 */ "expr ::= ID|INDEXED",
146301 /* 164 */ "expr ::= JOIN_KW",
146302 /* 165 */ "expr ::= nm DOT nm",
146303 /* 166 */ "expr ::= nm DOT nm DOT nm",
146304 /* 167 */ "term ::= NULL|FLOAT|BLOB",
146305 /* 168 */ "term ::= STRING",
146306 /* 169 */ "term ::= INTEGER",
146307 /* 170 */ "expr ::= VARIABLE",
146308 /* 171 */ "expr ::= expr COLLATE ID|STRING",
146309 /* 172 */ "expr ::= CAST LP expr AS typetoken RP",
146310 /* 173 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
146311 /* 174 */ "expr ::= ID|INDEXED LP STAR RP",
146312 /* 175 */ "expr ::= ID|INDEXED LP distinct exprlist RP over_clause",
146313 /* 176 */ "expr ::= ID|INDEXED LP STAR RP over_clause",
146314 /* 177 */ "term ::= CTIME_KW",
146315 /* 178 */ "expr ::= LP nexprlist COMMA expr RP",
146316 /* 179 */ "expr ::= expr AND expr",
146317 /* 180 */ "expr ::= expr OR expr",
146318 /* 181 */ "expr ::= expr LT|GT|GE|LE expr",
146319 /* 182 */ "expr ::= expr EQ|NE expr",
146320 /* 183 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
146321 /* 184 */ "expr ::= expr PLUS|MINUS expr",
146322 /* 185 */ "expr ::= expr STAR|SLASH|REM expr",
146323 /* 186 */ "expr ::= expr CONCAT expr",
146324 /* 187 */ "likeop ::= NOT LIKE_KW|MATCH",
146325 /* 188 */ "expr ::= expr likeop expr",
146326 /* 189 */ "expr ::= expr likeop expr ESCAPE expr",
146327 /* 190 */ "expr ::= expr ISNULL|NOTNULL",
146328 /* 191 */ "expr ::= expr NOT NULL",
146329 /* 192 */ "expr ::= expr IS expr",
146330 /* 193 */ "expr ::= expr IS NOT expr",
146331 /* 194 */ "expr ::= NOT expr",
146332 /* 195 */ "expr ::= BITNOT expr",
146333 /* 196 */ "expr ::= PLUS|MINUS expr",
146334 /* 197 */ "between_op ::= BETWEEN",
146335 /* 198 */ "between_op ::= NOT BETWEEN",
146336 /* 199 */ "expr ::= expr between_op expr AND expr",
146337 /* 200 */ "in_op ::= IN",
146338 /* 201 */ "in_op ::= NOT IN",
146339 /* 202 */ "expr ::= expr in_op LP exprlist RP",
146340 /* 203 */ "expr ::= LP select RP",
146341 /* 204 */ "expr ::= expr in_op LP select RP",
146342 /* 205 */ "expr ::= expr in_op nm dbnm paren_exprlist",
146343 /* 206 */ "expr ::= EXISTS LP select RP",
146344 /* 207 */ "expr ::= CASE case_operand case_exprlist case_else END",
146345 /* 208 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
146346 /* 209 */ "case_exprlist ::= WHEN expr THEN expr",
146347 /* 210 */ "case_else ::= ELSE expr",
146348 /* 211 */ "case_else ::=",
146349 /* 212 */ "case_operand ::= expr",
146350 /* 213 */ "case_operand ::=",
146351 /* 214 */ "exprlist ::=",
146352 /* 215 */ "nexprlist ::= nexprlist COMMA expr",
146353 /* 216 */ "nexprlist ::= expr",
146354 /* 217 */ "paren_exprlist ::=",
146355 /* 218 */ "paren_exprlist ::= LP exprlist RP",
146356 /* 219 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
146357 /* 220 */ "uniqueflag ::= UNIQUE",
146358 /* 221 */ "uniqueflag ::=",
146359 /* 222 */ "eidlist_opt ::=",
146360 /* 223 */ "eidlist_opt ::= LP eidlist RP",
146361 /* 224 */ "eidlist ::= eidlist COMMA nm collate sortorder",
146362 /* 225 */ "eidlist ::= nm collate sortorder",
146363 /* 226 */ "collate ::=",
146364 /* 227 */ "collate ::= COLLATE ID|STRING",
146365 /* 228 */ "cmd ::= DROP INDEX ifexists fullname",
146366 /* 229 */ "cmd ::= VACUUM",
146367 /* 230 */ "cmd ::= VACUUM nm",
146368 /* 231 */ "cmd ::= PRAGMA nm dbnm",
146369 /* 232 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
146370 /* 233 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
146371 /* 234 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
146372 /* 235 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
146373 /* 236 */ "plus_num ::= PLUS INTEGER|FLOAT",
146374 /* 237 */ "minus_num ::= MINUS INTEGER|FLOAT",
146375 /* 238 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
146376 /* 239 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
146377 /* 240 */ "trigger_time ::= BEFORE|AFTER",
146378 /* 241 */ "trigger_time ::= INSTEAD OF",
146379 /* 242 */ "trigger_time ::=",
146380 /* 243 */ "trigger_event ::= DELETE|INSERT",
146381 /* 244 */ "trigger_event ::= UPDATE",
146382 /* 245 */ "trigger_event ::= UPDATE OF idlist",
146383 /* 246 */ "when_clause ::=",
146384 /* 247 */ "when_clause ::= WHEN expr",
146385 /* 248 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
146386 /* 249 */ "trigger_cmd_list ::= trigger_cmd SEMI",
146387 /* 250 */ "trnm ::= nm DOT nm",
146388 /* 251 */ "tridxby ::= INDEXED BY nm",
146389 /* 252 */ "tridxby ::= NOT INDEXED",
146390 /* 253 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt",
146391 /* 254 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
146392 /* 255 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
146393 /* 256 */ "trigger_cmd ::= scanpt select scanpt",
146394 /* 257 */ "expr ::= RAISE LP IGNORE RP",
146395 /* 258 */ "expr ::= RAISE LP raisetype COMMA nm RP",
146396 /* 259 */ "raisetype ::= ROLLBACK",
146397 /* 260 */ "raisetype ::= ABORT",
146398 /* 261 */ "raisetype ::= FAIL",
146399 /* 262 */ "cmd ::= DROP TRIGGER ifexists fullname",
146400 /* 263 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
146401 /* 264 */ "cmd ::= DETACH database_kw_opt expr",
146402 /* 265 */ "key_opt ::=",
146403 /* 266 */ "key_opt ::= KEY expr",
146404 /* 267 */ "cmd ::= REINDEX",
146405 /* 268 */ "cmd ::= REINDEX nm dbnm",
146406 /* 269 */ "cmd ::= ANALYZE",
146407 /* 270 */ "cmd ::= ANALYZE nm dbnm",
146408 /* 271 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
146409 /* 272 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
146410 /* 273 */ "add_column_fullname ::= fullname",
146411 /* 274 */ "cmd ::= create_vtab",
146412 /* 275 */ "cmd ::= create_vtab LP vtabarglist RP",
146413 /* 276 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
146414 /* 277 */ "vtabarg ::=",
146415 /* 278 */ "vtabargtoken ::= ANY",
146416 /* 279 */ "vtabargtoken ::= lp anylist RP",
146417 /* 280 */ "lp ::= LP",
146418 /* 281 */ "with ::= WITH wqlist",
146419 /* 282 */ "with ::= WITH RECURSIVE wqlist",
146420 /* 283 */ "wqlist ::= nm eidlist_opt AS LP select RP",
146421 /* 284 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
146422 /* 285 */ "windowdefn_list ::= windowdefn",
146423 /* 286 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
146424 /* 287 */ "windowdefn ::= nm AS window",
146425 /* 288 */ "window ::= LP part_opt orderby_opt frame_opt RP",
146426 /* 289 */ "part_opt ::= PARTITION BY nexprlist",
146427 /* 290 */ "part_opt ::=",
146428 /* 291 */ "frame_opt ::=",
146429 /* 292 */ "frame_opt ::= range_or_rows frame_bound_s",
146430 /* 293 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e",
146431 /* 294 */ "range_or_rows ::= RANGE",
146432 /* 295 */ "range_or_rows ::= ROWS",
146433 /* 296 */ "frame_bound_s ::= frame_bound",
146434 /* 297 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
146435 /* 298 */ "frame_bound_e ::= frame_bound",
146436 /* 299 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
146437 /* 300 */ "frame_bound ::= expr PRECEDING",
146438 /* 301 */ "frame_bound ::= CURRENT ROW",
146439 /* 302 */ "frame_bound ::= expr FOLLOWING",
146440 /* 303 */ "window_clause ::= WINDOW windowdefn_list",
146441 /* 304 */ "over_clause ::= filter_opt OVER window",
146442 /* 305 */ "over_clause ::= filter_opt OVER nm",
146443 /* 306 */ "filter_opt ::=",
146444 /* 307 */ "filter_opt ::= FILTER LP WHERE expr RP",
146445 /* 308 */ "input ::= cmdlist",
146446 /* 309 */ "cmdlist ::= cmdlist ecmd",
146447 /* 310 */ "cmdlist ::= ecmd",
146448 /* 311 */ "ecmd ::= SEMI",
146449 /* 312 */ "ecmd ::= cmdx SEMI",
146450 /* 313 */ "ecmd ::= explain cmdx",
146451 /* 314 */ "trans_opt ::=",
146452 /* 315 */ "trans_opt ::= TRANSACTION",
146453 /* 316 */ "trans_opt ::= TRANSACTION nm",
146454 /* 317 */ "savepoint_opt ::= SAVEPOINT",
146455 /* 318 */ "savepoint_opt ::=",
146456 /* 319 */ "cmd ::= create_table create_table_args",
146457 /* 320 */ "columnlist ::= columnlist COMMA columnname carglist",
146458 /* 321 */ "columnlist ::= columnname carglist",
146459 /* 322 */ "nm ::= ID|INDEXED",
146460 /* 323 */ "nm ::= STRING",
146461 /* 324 */ "nm ::= JOIN_KW",
146462 /* 325 */ "typetoken ::= typename",
146463 /* 326 */ "typename ::= ID|STRING",
146464 /* 327 */ "signed ::= plus_num",
146465 /* 328 */ "signed ::= minus_num",
146466 /* 329 */ "carglist ::= carglist ccons",
146467 /* 330 */ "carglist ::=",
146468 /* 331 */ "ccons ::= NULL onconf",
146469 /* 332 */ "conslist_opt ::= COMMA conslist",
146470 /* 333 */ "conslist ::= conslist tconscomma tcons",
146471 /* 334 */ "conslist ::= tcons",
146472 /* 335 */ "tconscomma ::=",
146473 /* 336 */ "defer_subclause_opt ::= defer_subclause",
146474 /* 337 */ "resolvetype ::= raisetype",
146475 /* 338 */ "selectnowith ::= oneselect",
146476 /* 339 */ "oneselect ::= values",
146477 /* 340 */ "sclp ::= selcollist COMMA",
146478 /* 341 */ "as ::= ID|STRING",
146479 /* 342 */ "expr ::= term",
146480 /* 343 */ "likeop ::= LIKE_KW|MATCH",
146481 /* 344 */ "exprlist ::= nexprlist",
146482 /* 345 */ "nmnum ::= plus_num",
146483 /* 346 */ "nmnum ::= nm",
146484 /* 347 */ "nmnum ::= ON",
146485 /* 348 */ "nmnum ::= DELETE",
146486 /* 349 */ "nmnum ::= DEFAULT",
146487 /* 350 */ "plus_num ::= INTEGER|FLOAT",
146488 /* 351 */ "foreach_clause ::=",
146489 /* 352 */ "foreach_clause ::= FOR EACH ROW",
146490 /* 353 */ "trnm ::= nm",
146491 /* 354 */ "tridxby ::=",
146492 /* 355 */ "database_kw_opt ::= DATABASE",
146493 /* 356 */ "database_kw_opt ::=",
146494 /* 357 */ "kwcolumn_opt ::=",
146495 /* 358 */ "kwcolumn_opt ::= COLUMNKW",
146496 /* 359 */ "vtabarglist ::= vtabarg",
146497 /* 360 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
146498 /* 361 */ "vtabarg ::= vtabarg vtabargtoken",
146499 /* 362 */ "anylist ::=",
146500 /* 363 */ "anylist ::= anylist LP anylist RP",
146501 /* 364 */ "anylist ::= anylist ANY",
146502 /* 365 */ "with ::=",
146503 };
146504 #endif /* NDEBUG */
146505
146506
146507 #if YYSTACKDEPTH<=0
@@ -146715,11 +146635,11 @@
146635 break;
146636 case 184: /* term */
146637 case 185: /* expr */
146638 case 213: /* where_opt */
146639 case 215: /* having_opt */
146640 case 227: /* on_opt */
146641 case 242: /* case_operand */
146642 case 244: /* case_else */
146643 case 253: /* when_clause */
146644 case 258: /* key_opt */
146645 case 272: /* filter_opt */
@@ -146730,14 +146650,14 @@
146650 case 189: /* eidlist_opt */
146651 case 198: /* sortlist */
146652 case 199: /* eidlist */
146653 case 211: /* selcollist */
146654 case 214: /* groupby_opt */
146655 case 216: /* orderby_opt */
146656 case 220: /* nexprlist */
146657 case 221: /* sclp */
146658 case 229: /* exprlist */
146659 case 233: /* setlist */
146660 case 241: /* paren_exprlist */
146661 case 243: /* case_exprlist */
146662 case 271: /* part_opt */
146663 {
@@ -146744,12 +146664,12 @@
146664 sqlite3ExprListDelete(pParse->db, (yypminor->yy420));
146665 }
146666 break;
146667 case 205: /* fullname */
146668 case 212: /* from */
146669 case 223: /* seltablist */
146670 case 224: /* stl_prefix */
146671 case 230: /* xfullname */
146672 {
146673 sqlite3SrcListDelete(pParse->db, (yypminor->yy135));
146674 }
146675 break;
@@ -146756,24 +146676,24 @@
146676 case 208: /* wqlist */
146677 {
146678 sqlite3WithDelete(pParse->db, (yypminor->yy449));
146679 }
146680 break;
146681 case 218: /* window_clause */
146682 case 267: /* windowdefn_list */
146683 {
146684 sqlite3WindowListDelete(pParse->db, (yypminor->yy327));
146685 }
146686 break;
146687 case 228: /* using_opt */
146688 case 231: /* idlist */
146689 case 235: /* idlist_opt */
146690 {
146691 sqlite3IdListDelete(pParse->db, (yypminor->yy48));
146692 }
146693 break;
146694 case 237: /* over_clause */
146695 case 268: /* windowdefn */
146696 case 269: /* window */
146697 case 270: /* frame_opt */
146698 {
146699 sqlite3WindowDelete(pParse->db, (yypminor->yy327));
@@ -147178,288 +147098,289 @@
147098 { 174, -1 }, /* (82) select ::= selectnowith */
147099 { 206, -3 }, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */
147100 { 209, -1 }, /* (84) multiselect_op ::= UNION */
147101 { 209, -2 }, /* (85) multiselect_op ::= UNION ALL */
147102 { 209, -1 }, /* (86) multiselect_op ::= EXCEPT|INTERSECT */
147103 { 207, -9 }, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
147104 { 207, -10 }, /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
147105 { 219, -4 }, /* (89) values ::= VALUES LP nexprlist RP */
147106 { 219, -5 }, /* (90) values ::= values COMMA LP nexprlist RP */
147107 { 210, -1 }, /* (91) distinct ::= DISTINCT */
147108 { 210, -1 }, /* (92) distinct ::= ALL */
147109 { 210, 0 }, /* (93) distinct ::= */
147110 { 221, 0 }, /* (94) sclp ::= */
147111 { 211, -5 }, /* (95) selcollist ::= sclp scanpt expr scanpt as */
147112 { 211, -3 }, /* (96) selcollist ::= sclp scanpt STAR */
147113 { 211, -5 }, /* (97) selcollist ::= sclp scanpt nm DOT STAR */
147114 { 222, -2 }, /* (98) as ::= AS nm */
147115 { 222, 0 }, /* (99) as ::= */
147116 { 212, 0 }, /* (100) from ::= */
147117 { 212, -2 }, /* (101) from ::= FROM seltablist */
147118 { 224, -2 }, /* (102) stl_prefix ::= seltablist joinop */
147119 { 224, 0 }, /* (103) stl_prefix ::= */
147120 { 223, -7 }, /* (104) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
147121 { 223, -9 }, /* (105) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
147122 { 223, -7 }, /* (106) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
147123 { 223, -7 }, /* (107) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
147124 { 170, 0 }, /* (108) dbnm ::= */
147125 { 170, -2 }, /* (109) dbnm ::= DOT nm */
147126 { 205, -1 }, /* (110) fullname ::= nm */
147127 { 205, -3 }, /* (111) fullname ::= nm DOT nm */
147128 { 230, -1 }, /* (112) xfullname ::= nm */
147129 { 230, -3 }, /* (113) xfullname ::= nm DOT nm */
147130 { 230, -5 }, /* (114) xfullname ::= nm DOT nm AS nm */
147131 { 230, -3 }, /* (115) xfullname ::= nm AS nm */
147132 { 225, -1 }, /* (116) joinop ::= COMMA|JOIN */
147133 { 225, -2 }, /* (117) joinop ::= JOIN_KW JOIN */
147134 { 225, -3 }, /* (118) joinop ::= JOIN_KW nm JOIN */
147135 { 225, -4 }, /* (119) joinop ::= JOIN_KW nm nm JOIN */
147136 { 227, -2 }, /* (120) on_opt ::= ON expr */
147137 { 227, 0 }, /* (121) on_opt ::= */
147138 { 226, 0 }, /* (122) indexed_opt ::= */
147139 { 226, -3 }, /* (123) indexed_opt ::= INDEXED BY nm */
147140 { 226, -2 }, /* (124) indexed_opt ::= NOT INDEXED */
147141 { 228, -4 }, /* (125) using_opt ::= USING LP idlist RP */
147142 { 228, 0 }, /* (126) using_opt ::= */
147143 { 216, 0 }, /* (127) orderby_opt ::= */
147144 { 216, -3 }, /* (128) orderby_opt ::= ORDER BY sortlist */
147145 { 198, -4 }, /* (129) sortlist ::= sortlist COMMA expr sortorder */
147146 { 198, -2 }, /* (130) sortlist ::= expr sortorder */
147147 { 187, -1 }, /* (131) sortorder ::= ASC */
147148 { 187, -1 }, /* (132) sortorder ::= DESC */
147149 { 187, 0 }, /* (133) sortorder ::= */
147150 { 214, 0 }, /* (134) groupby_opt ::= */
147151 { 214, -3 }, /* (135) groupby_opt ::= GROUP BY nexprlist */
147152 { 215, 0 }, /* (136) having_opt ::= */
147153 { 215, -2 }, /* (137) having_opt ::= HAVING expr */
147154 { 217, 0 }, /* (138) limit_opt ::= */
147155 { 217, -2 }, /* (139) limit_opt ::= LIMIT expr */
147156 { 217, -4 }, /* (140) limit_opt ::= LIMIT expr OFFSET expr */
147157 { 217, -4 }, /* (141) limit_opt ::= LIMIT expr COMMA expr */
147158 { 160, -6 }, /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
147159 { 213, 0 }, /* (143) where_opt ::= */
147160 { 213, -2 }, /* (144) where_opt ::= WHERE expr */
147161 { 160, -8 }, /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
147162 { 233, -5 }, /* (146) setlist ::= setlist COMMA nm EQ expr */
147163 { 233, -7 }, /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */
147164 { 233, -3 }, /* (148) setlist ::= nm EQ expr */
147165 { 233, -5 }, /* (149) setlist ::= LP idlist RP EQ expr */
147166 { 160, -7 }, /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
147167 { 160, -7 }, /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
147168 { 236, 0 }, /* (152) upsert ::= */
147169 { 236, -11 }, /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
147170 { 236, -8 }, /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
147171 { 236, -4 }, /* (155) upsert ::= ON CONFLICT DO NOTHING */
147172 { 234, -2 }, /* (156) insert_cmd ::= INSERT orconf */
147173 { 234, -1 }, /* (157) insert_cmd ::= REPLACE */
147174 { 235, 0 }, /* (158) idlist_opt ::= */
147175 { 235, -3 }, /* (159) idlist_opt ::= LP idlist RP */
147176 { 231, -3 }, /* (160) idlist ::= idlist COMMA nm */
147177 { 231, -1 }, /* (161) idlist ::= nm */
147178 { 185, -3 }, /* (162) expr ::= LP expr RP */
147179 { 185, -1 }, /* (163) expr ::= ID|INDEXED */
147180 { 185, -1 }, /* (164) expr ::= JOIN_KW */
147181 { 185, -3 }, /* (165) expr ::= nm DOT nm */
147182 { 185, -5 }, /* (166) expr ::= nm DOT nm DOT nm */
147183 { 184, -1 }, /* (167) term ::= NULL|FLOAT|BLOB */
147184 { 184, -1 }, /* (168) term ::= STRING */
147185 { 184, -1 }, /* (169) term ::= INTEGER */
147186 { 185, -1 }, /* (170) expr ::= VARIABLE */
147187 { 185, -3 }, /* (171) expr ::= expr COLLATE ID|STRING */
147188 { 185, -6 }, /* (172) expr ::= CAST LP expr AS typetoken RP */
147189 { 185, -5 }, /* (173) expr ::= ID|INDEXED LP distinct exprlist RP */
147190 { 185, -4 }, /* (174) expr ::= ID|INDEXED LP STAR RP */
147191 { 185, -6 }, /* (175) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
147192 { 185, -5 }, /* (176) expr ::= ID|INDEXED LP STAR RP over_clause */
147193 { 184, -1 }, /* (177) term ::= CTIME_KW */
147194 { 185, -5 }, /* (178) expr ::= LP nexprlist COMMA expr RP */
147195 { 185, -3 }, /* (179) expr ::= expr AND expr */
147196 { 185, -3 }, /* (180) expr ::= expr OR expr */
147197 { 185, -3 }, /* (181) expr ::= expr LT|GT|GE|LE expr */
147198 { 185, -3 }, /* (182) expr ::= expr EQ|NE expr */
147199 { 185, -3 }, /* (183) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
147200 { 185, -3 }, /* (184) expr ::= expr PLUS|MINUS expr */
147201 { 185, -3 }, /* (185) expr ::= expr STAR|SLASH|REM expr */
147202 { 185, -3 }, /* (186) expr ::= expr CONCAT expr */
147203 { 238, -2 }, /* (187) likeop ::= NOT LIKE_KW|MATCH */
147204 { 185, -3 }, /* (188) expr ::= expr likeop expr */
147205 { 185, -5 }, /* (189) expr ::= expr likeop expr ESCAPE expr */
147206 { 185, -2 }, /* (190) expr ::= expr ISNULL|NOTNULL */
147207 { 185, -3 }, /* (191) expr ::= expr NOT NULL */
147208 { 185, -3 }, /* (192) expr ::= expr IS expr */
147209 { 185, -4 }, /* (193) expr ::= expr IS NOT expr */
147210 { 185, -2 }, /* (194) expr ::= NOT expr */
147211 { 185, -2 }, /* (195) expr ::= BITNOT expr */
147212 { 185, -2 }, /* (196) expr ::= PLUS|MINUS expr */
147213 { 239, -1 }, /* (197) between_op ::= BETWEEN */
147214 { 239, -2 }, /* (198) between_op ::= NOT BETWEEN */
147215 { 185, -5 }, /* (199) expr ::= expr between_op expr AND expr */
147216 { 240, -1 }, /* (200) in_op ::= IN */
147217 { 240, -2 }, /* (201) in_op ::= NOT IN */
147218 { 185, -5 }, /* (202) expr ::= expr in_op LP exprlist RP */
147219 { 185, -3 }, /* (203) expr ::= LP select RP */
147220 { 185, -5 }, /* (204) expr ::= expr in_op LP select RP */
147221 { 185, -5 }, /* (205) expr ::= expr in_op nm dbnm paren_exprlist */
147222 { 185, -4 }, /* (206) expr ::= EXISTS LP select RP */
147223 { 185, -5 }, /* (207) expr ::= CASE case_operand case_exprlist case_else END */
147224 { 243, -5 }, /* (208) case_exprlist ::= case_exprlist WHEN expr THEN expr */
147225 { 243, -4 }, /* (209) case_exprlist ::= WHEN expr THEN expr */
147226 { 244, -2 }, /* (210) case_else ::= ELSE expr */
147227 { 244, 0 }, /* (211) case_else ::= */
147228 { 242, -1 }, /* (212) case_operand ::= expr */
147229 { 242, 0 }, /* (213) case_operand ::= */
147230 { 229, 0 }, /* (214) exprlist ::= */
147231 { 220, -3 }, /* (215) nexprlist ::= nexprlist COMMA expr */
147232 { 220, -1 }, /* (216) nexprlist ::= expr */
147233 { 241, 0 }, /* (217) paren_exprlist ::= */
147234 { 241, -3 }, /* (218) paren_exprlist ::= LP exprlist RP */
147235 { 160, -12 }, /* (219) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
147236 { 245, -1 }, /* (220) uniqueflag ::= UNIQUE */
147237 { 245, 0 }, /* (221) uniqueflag ::= */
147238 { 189, 0 }, /* (222) eidlist_opt ::= */
147239 { 189, -3 }, /* (223) eidlist_opt ::= LP eidlist RP */
147240 { 199, -5 }, /* (224) eidlist ::= eidlist COMMA nm collate sortorder */
147241 { 199, -3 }, /* (225) eidlist ::= nm collate sortorder */
147242 { 246, 0 }, /* (226) collate ::= */
147243 { 246, -2 }, /* (227) collate ::= COLLATE ID|STRING */
147244 { 160, -4 }, /* (228) cmd ::= DROP INDEX ifexists fullname */
147245 { 160, -1 }, /* (229) cmd ::= VACUUM */
147246 { 160, -2 }, /* (230) cmd ::= VACUUM nm */
147247 { 160, -3 }, /* (231) cmd ::= PRAGMA nm dbnm */
147248 { 160, -5 }, /* (232) cmd ::= PRAGMA nm dbnm EQ nmnum */
147249 { 160, -6 }, /* (233) cmd ::= PRAGMA nm dbnm LP nmnum RP */
147250 { 160, -5 }, /* (234) cmd ::= PRAGMA nm dbnm EQ minus_num */
147251 { 160, -6 }, /* (235) cmd ::= PRAGMA nm dbnm LP minus_num RP */
147252 { 180, -2 }, /* (236) plus_num ::= PLUS INTEGER|FLOAT */
147253 { 181, -2 }, /* (237) minus_num ::= MINUS INTEGER|FLOAT */
147254 { 160, -5 }, /* (238) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
147255 { 248, -11 }, /* (239) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
147256 { 250, -1 }, /* (240) trigger_time ::= BEFORE|AFTER */
147257 { 250, -2 }, /* (241) trigger_time ::= INSTEAD OF */
147258 { 250, 0 }, /* (242) trigger_time ::= */
147259 { 251, -1 }, /* (243) trigger_event ::= DELETE|INSERT */
147260 { 251, -1 }, /* (244) trigger_event ::= UPDATE */
147261 { 251, -3 }, /* (245) trigger_event ::= UPDATE OF idlist */
147262 { 253, 0 }, /* (246) when_clause ::= */
147263 { 253, -2 }, /* (247) when_clause ::= WHEN expr */
147264 { 249, -3 }, /* (248) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
147265 { 249, -2 }, /* (249) trigger_cmd_list ::= trigger_cmd SEMI */
147266 { 255, -3 }, /* (250) trnm ::= nm DOT nm */
147267 { 256, -3 }, /* (251) tridxby ::= INDEXED BY nm */
147268 { 256, -2 }, /* (252) tridxby ::= NOT INDEXED */
147269 { 254, -8 }, /* (253) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
147270 { 254, -8 }, /* (254) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
147271 { 254, -6 }, /* (255) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
147272 { 254, -3 }, /* (256) trigger_cmd ::= scanpt select scanpt */
147273 { 185, -4 }, /* (257) expr ::= RAISE LP IGNORE RP */
147274 { 185, -6 }, /* (258) expr ::= RAISE LP raisetype COMMA nm RP */
147275 { 203, -1 }, /* (259) raisetype ::= ROLLBACK */
147276 { 203, -1 }, /* (260) raisetype ::= ABORT */
147277 { 203, -1 }, /* (261) raisetype ::= FAIL */
147278 { 160, -4 }, /* (262) cmd ::= DROP TRIGGER ifexists fullname */
147279 { 160, -6 }, /* (263) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
147280 { 160, -3 }, /* (264) cmd ::= DETACH database_kw_opt expr */
147281 { 258, 0 }, /* (265) key_opt ::= */
147282 { 258, -2 }, /* (266) key_opt ::= KEY expr */
147283 { 160, -1 }, /* (267) cmd ::= REINDEX */
147284 { 160, -3 }, /* (268) cmd ::= REINDEX nm dbnm */
147285 { 160, -1 }, /* (269) cmd ::= ANALYZE */
147286 { 160, -3 }, /* (270) cmd ::= ANALYZE nm dbnm */
147287 { 160, -6 }, /* (271) cmd ::= ALTER TABLE fullname RENAME TO nm */
147288 { 160, -7 }, /* (272) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
147289 { 259, -1 }, /* (273) add_column_fullname ::= fullname */
147290 { 160, -1 }, /* (274) cmd ::= create_vtab */
147291 { 160, -4 }, /* (275) cmd ::= create_vtab LP vtabarglist RP */
147292 { 261, -8 }, /* (276) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
147293 { 263, 0 }, /* (277) vtabarg ::= */
147294 { 264, -1 }, /* (278) vtabargtoken ::= ANY */
147295 { 264, -3 }, /* (279) vtabargtoken ::= lp anylist RP */
147296 { 265, -1 }, /* (280) lp ::= LP */
147297 { 232, -2 }, /* (281) with ::= WITH wqlist */
147298 { 232, -3 }, /* (282) with ::= WITH RECURSIVE wqlist */
147299 { 208, -6 }, /* (283) wqlist ::= nm eidlist_opt AS LP select RP */
147300 { 208, -8 }, /* (284) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
147301 { 267, -1 }, /* (285) windowdefn_list ::= windowdefn */
147302 { 267, -3 }, /* (286) windowdefn_list ::= windowdefn_list COMMA windowdefn */
147303 { 268, -3 }, /* (287) windowdefn ::= nm AS window */
147304 { 269, -5 }, /* (288) window ::= LP part_opt orderby_opt frame_opt RP */
147305 { 271, -3 }, /* (289) part_opt ::= PARTITION BY nexprlist */
147306 { 271, 0 }, /* (290) part_opt ::= */
147307 { 270, 0 }, /* (291) frame_opt ::= */
147308 { 270, -2 }, /* (292) frame_opt ::= range_or_rows frame_bound_s */
147309 { 270, -5 }, /* (293) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */
147310 { 273, -1 }, /* (294) range_or_rows ::= RANGE */
147311 { 273, -1 }, /* (295) range_or_rows ::= ROWS */
147312 { 275, -1 }, /* (296) frame_bound_s ::= frame_bound */
147313 { 275, -2 }, /* (297) frame_bound_s ::= UNBOUNDED PRECEDING */
147314 { 276, -1 }, /* (298) frame_bound_e ::= frame_bound */
147315 { 276, -2 }, /* (299) frame_bound_e ::= UNBOUNDED FOLLOWING */
147316 { 274, -2 }, /* (300) frame_bound ::= expr PRECEDING */
147317 { 274, -2 }, /* (301) frame_bound ::= CURRENT ROW */
147318 { 274, -2 }, /* (302) frame_bound ::= expr FOLLOWING */
147319 { 218, -2 }, /* (303) window_clause ::= WINDOW windowdefn_list */
147320 { 237, -3 }, /* (304) over_clause ::= filter_opt OVER window */
147321 { 237, -3 }, /* (305) over_clause ::= filter_opt OVER nm */
147322 { 272, 0 }, /* (306) filter_opt ::= */
147323 { 272, -5 }, /* (307) filter_opt ::= FILTER LP WHERE expr RP */
147324 { 155, -1 }, /* (308) input ::= cmdlist */
147325 { 156, -2 }, /* (309) cmdlist ::= cmdlist ecmd */
147326 { 156, -1 }, /* (310) cmdlist ::= ecmd */
147327 { 157, -1 }, /* (311) ecmd ::= SEMI */
147328 { 157, -2 }, /* (312) ecmd ::= cmdx SEMI */
147329 { 157, -2 }, /* (313) ecmd ::= explain cmdx */
147330 { 162, 0 }, /* (314) trans_opt ::= */
147331 { 162, -1 }, /* (315) trans_opt ::= TRANSACTION */
147332 { 162, -2 }, /* (316) trans_opt ::= TRANSACTION nm */
147333 { 164, -1 }, /* (317) savepoint_opt ::= SAVEPOINT */
147334 { 164, 0 }, /* (318) savepoint_opt ::= */
147335 { 160, -2 }, /* (319) cmd ::= create_table create_table_args */
147336 { 171, -4 }, /* (320) columnlist ::= columnlist COMMA columnname carglist */
147337 { 171, -2 }, /* (321) columnlist ::= columnname carglist */
147338 { 163, -1 }, /* (322) nm ::= ID|INDEXED */
147339 { 163, -1 }, /* (323) nm ::= STRING */
147340 { 163, -1 }, /* (324) nm ::= JOIN_KW */
147341 { 177, -1 }, /* (325) typetoken ::= typename */
147342 { 178, -1 }, /* (326) typename ::= ID|STRING */
147343 { 179, -1 }, /* (327) signed ::= plus_num */
147344 { 179, -1 }, /* (328) signed ::= minus_num */
147345 { 176, -2 }, /* (329) carglist ::= carglist ccons */
147346 { 176, 0 }, /* (330) carglist ::= */
147347 { 183, -2 }, /* (331) ccons ::= NULL onconf */
147348 { 172, -2 }, /* (332) conslist_opt ::= COMMA conslist */
147349 { 195, -3 }, /* (333) conslist ::= conslist tconscomma tcons */
147350 { 195, -1 }, /* (334) conslist ::= tcons */
147351 { 196, 0 }, /* (335) tconscomma ::= */
147352 { 200, -1 }, /* (336) defer_subclause_opt ::= defer_subclause */
147353 { 202, -1 }, /* (337) resolvetype ::= raisetype */
147354 { 206, -1 }, /* (338) selectnowith ::= oneselect */
147355 { 207, -1 }, /* (339) oneselect ::= values */
147356 { 221, -2 }, /* (340) sclp ::= selcollist COMMA */
147357 { 222, -1 }, /* (341) as ::= ID|STRING */
147358 { 185, -1 }, /* (342) expr ::= term */
147359 { 238, -1 }, /* (343) likeop ::= LIKE_KW|MATCH */
147360 { 229, -1 }, /* (344) exprlist ::= nexprlist */
147361 { 247, -1 }, /* (345) nmnum ::= plus_num */
147362 { 247, -1 }, /* (346) nmnum ::= nm */
147363 { 247, -1 }, /* (347) nmnum ::= ON */
147364 { 247, -1 }, /* (348) nmnum ::= DELETE */
147365 { 247, -1 }, /* (349) nmnum ::= DEFAULT */
147366 { 180, -1 }, /* (350) plus_num ::= INTEGER|FLOAT */
147367 { 252, 0 }, /* (351) foreach_clause ::= */
147368 { 252, -3 }, /* (352) foreach_clause ::= FOR EACH ROW */
147369 { 255, -1 }, /* (353) trnm ::= nm */
147370 { 256, 0 }, /* (354) tridxby ::= */
147371 { 257, -1 }, /* (355) database_kw_opt ::= DATABASE */
147372 { 257, 0 }, /* (356) database_kw_opt ::= */
147373 { 260, 0 }, /* (357) kwcolumn_opt ::= */
147374 { 260, -1 }, /* (358) kwcolumn_opt ::= COLUMNKW */
147375 { 262, -1 }, /* (359) vtabarglist ::= vtabarg */
147376 { 262, -3 }, /* (360) vtabarglist ::= vtabarglist COMMA vtabarg */
147377 { 263, -2 }, /* (361) vtabarg ::= vtabarg vtabargtoken */
147378 { 266, 0 }, /* (362) anylist ::= */
147379 { 266, -4 }, /* (363) anylist ::= anylist LP anylist RP */
147380 { 266, -2 }, /* (364) anylist ::= anylist ANY */
147381 { 232, 0 }, /* (365) with ::= */
147382 };
147383
147384 static void yy_accept(yyParser*); /* Forward Declaration */
147385
147386 /*
@@ -147596,12 +147517,12 @@
147517 case 21: /* table_options ::= */ yytestcase(yyruleno==21);
147518 case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
147519 case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
147520 case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
147521 case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
147522 case 93: /* distinct ::= */ yytestcase(yyruleno==93);
147523 case 226: /* collate ::= */ yytestcase(yyruleno==226);
147524 {yymsp[1].minor.yy70 = 0;}
147525 break;
147526 case 16: /* ifnotexists ::= IF NOT EXISTS */
147527 {yymsp[-2].minor.yy70 = 1;}
147528 break;
@@ -147633,11 +147554,11 @@
147554 case 23: /* columnname ::= nm typetoken */
147555 {sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
147556 break;
147557 case 24: /* typetoken ::= */
147558 case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60);
147559 case 99: /* as ::= */ yytestcase(yyruleno==99);
147560 {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
147561 break;
147562 case 25: /* typetoken ::= typename LP signed RP */
147563 {
147564 yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
@@ -147744,18 +147665,18 @@
147665 case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
147666 {yymsp[-2].minor.yy70 = 0;}
147667 break;
147668 case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
147669 case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
147670 case 156: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==156);
147671 {yymsp[-1].minor.yy70 = yymsp[0].minor.yy70;}
147672 break;
147673 case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
147674 case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
147675 case 198: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==198);
147676 case 201: /* in_op ::= NOT IN */ yytestcase(yyruleno==201);
147677 case 227: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==227);
147678 {yymsp[-1].minor.yy70 = 1;}
147679 break;
147680 case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
147681 {yymsp[-1].minor.yy70 = 0;}
147682 break;
@@ -147787,11 +147708,11 @@
147708 break;
147709 case 72: /* resolvetype ::= IGNORE */
147710 {yymsp[0].minor.yy70 = OE_Ignore;}
147711 break;
147712 case 73: /* resolvetype ::= REPLACE */
147713 case 157: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==157);
147714 {yymsp[0].minor.yy70 = OE_Replace;}
147715 break;
147716 case 74: /* cmd ::= DROP TABLE ifexists fullname */
147717 {
147718 sqlite3DropTable(pParse, yymsp[0].minor.yy135, 0, yymsp[-1].minor.yy70);
@@ -147876,28 +147797,31 @@
147797 {yymsp[0].minor.yy70 = yymsp[0].major; /*A-overwrites-OP*/}
147798 break;
147799 case 85: /* multiselect_op ::= UNION ALL */
147800 {yymsp[-1].minor.yy70 = TK_ALL;}
147801 break;
147802 case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
147803 {
147804 yymsp[-8].minor.yy489 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy420,yymsp[-5].minor.yy135,yymsp[-4].minor.yy18,yymsp[-3].minor.yy420,yymsp[-2].minor.yy18,yymsp[-1].minor.yy420,yymsp[-7].minor.yy70,yymsp[0].minor.yy18);
147805 }
147806 break;
147807 case 88: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
147808 {
147809 yymsp[-9].minor.yy489 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy420,yymsp[-6].minor.yy135,yymsp[-5].minor.yy18,yymsp[-4].minor.yy420,yymsp[-3].minor.yy18,yymsp[-1].minor.yy420,yymsp[-8].minor.yy70,yymsp[0].minor.yy18);
 
147810 if( yymsp[-9].minor.yy489 ){
147811 yymsp[-9].minor.yy489->pWinDefn = yymsp[-2].minor.yy327;
147812 }else{
147813 sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy327);
147814 }
 
147815 }
147816 break;
147817 case 89: /* values ::= VALUES LP nexprlist RP */
147818 {
147819 yymsp[-3].minor.yy489 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy420,0,0,0,0,0,SF_Values,0);
147820 }
147821 break;
147822 case 90: /* values ::= values COMMA LP nexprlist RP */
147823 {
147824 Select *pRight, *pLeft = yymsp[-4].minor.yy489;
147825 pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy420,0,0,0,0,0,SF_Values|SF_MultiValue,0);
147826 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
147827 if( pRight ){
@@ -147907,86 +147831,86 @@
147831 }else{
147832 yymsp[-4].minor.yy489 = pLeft;
147833 }
147834 }
147835 break;
147836 case 91: /* distinct ::= DISTINCT */
147837 {yymsp[0].minor.yy70 = SF_Distinct;}
147838 break;
147839 case 92: /* distinct ::= ALL */
147840 {yymsp[0].minor.yy70 = SF_All;}
147841 break;
147842 case 94: /* sclp ::= */
147843 case 127: /* orderby_opt ::= */ yytestcase(yyruleno==127);
147844 case 134: /* groupby_opt ::= */ yytestcase(yyruleno==134);
147845 case 214: /* exprlist ::= */ yytestcase(yyruleno==214);
147846 case 217: /* paren_exprlist ::= */ yytestcase(yyruleno==217);
147847 case 222: /* eidlist_opt ::= */ yytestcase(yyruleno==222);
147848 {yymsp[1].minor.yy420 = 0;}
147849 break;
147850 case 95: /* selcollist ::= sclp scanpt expr scanpt as */
147851 {
147852 yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy420, yymsp[-2].minor.yy18);
147853 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy420, &yymsp[0].minor.yy0, 1);
147854 sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy420,yymsp[-3].minor.yy392,yymsp[-1].minor.yy392);
147855 }
147856 break;
147857 case 96: /* selcollist ::= sclp scanpt STAR */
147858 {
147859 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
147860 yymsp[-2].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy420, p);
147861 }
147862 break;
147863 case 97: /* selcollist ::= sclp scanpt nm DOT STAR */
147864 {
147865 Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
147866 Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
147867 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
147868 yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, pDot);
147869 }
147870 break;
147871 case 98: /* as ::= AS nm */
147872 case 109: /* dbnm ::= DOT nm */ yytestcase(yyruleno==109);
147873 case 236: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==236);
147874 case 237: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==237);
147875 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
147876 break;
147877 case 100: /* from ::= */
147878 {yymsp[1].minor.yy135 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy135));}
147879 break;
147880 case 101: /* from ::= FROM seltablist */
147881 {
147882 yymsp[-1].minor.yy135 = yymsp[0].minor.yy135;
147883 sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy135);
147884 }
147885 break;
147886 case 102: /* stl_prefix ::= seltablist joinop */
147887 {
147888 if( ALWAYS(yymsp[-1].minor.yy135 && yymsp[-1].minor.yy135->nSrc>0) ) yymsp[-1].minor.yy135->a[yymsp[-1].minor.yy135->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy70;
147889 }
147890 break;
147891 case 103: /* stl_prefix ::= */
147892 {yymsp[1].minor.yy135 = 0;}
147893 break;
147894 case 104: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
147895 {
147896 yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
147897 sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy135, &yymsp[-2].minor.yy0);
147898 }
147899 break;
147900 case 105: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
147901 {
147902 yymsp[-8].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy135,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
147903 sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy135, yymsp[-4].minor.yy420);
147904 }
147905 break;
147906 case 106: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
147907 {
147908 yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy489,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
147909 }
147910 break;
147911 case 107: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
147912 {
147913 if( yymsp[-6].minor.yy135==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy18==0 && yymsp[0].minor.yy48==0 ){
147914 yymsp[-6].minor.yy135 = yymsp[-4].minor.yy135;
147915 }else if( yymsp[-4].minor.yy135->nSrc==1 ){
147916 yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
@@ -148006,210 +147930,210 @@
147930 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy135,0,0,0,0,SF_NestedFrom,0);
147931 yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy18,yymsp[0].minor.yy48);
147932 }
147933 }
147934 break;
147935 case 108: /* dbnm ::= */
147936 case 122: /* indexed_opt ::= */ yytestcase(yyruleno==122);
147937 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
147938 break;
147939 case 110: /* fullname ::= nm */
147940 case 112: /* xfullname ::= nm */ yytestcase(yyruleno==112);
147941 {yymsp[0].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
147942 break;
147943 case 111: /* fullname ::= nm DOT nm */
147944 case 113: /* xfullname ::= nm DOT nm */ yytestcase(yyruleno==113);
147945 {yymsp[-2].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
147946 break;
147947 case 114: /* xfullname ::= nm DOT nm AS nm */
147948 {
147949 yymsp[-4].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/
147950 if( yymsp[-4].minor.yy135 ) yymsp[-4].minor.yy135->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
147951 }
147952 break;
147953 case 115: /* xfullname ::= nm AS nm */
147954 {
147955 yymsp[-2].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/
147956 if( yymsp[-2].minor.yy135 ) yymsp[-2].minor.yy135->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
147957 }
147958 break;
147959 case 116: /* joinop ::= COMMA|JOIN */
147960 { yymsp[0].minor.yy70 = JT_INNER; }
147961 break;
147962 case 117: /* joinop ::= JOIN_KW JOIN */
147963 {yymsp[-1].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
147964 break;
147965 case 118: /* joinop ::= JOIN_KW nm JOIN */
147966 {yymsp[-2].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
147967 break;
147968 case 119: /* joinop ::= JOIN_KW nm nm JOIN */
147969 {yymsp[-3].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
147970 break;
147971 case 120: /* on_opt ::= ON expr */
147972 case 137: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==137);
147973 case 144: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==144);
147974 case 210: /* case_else ::= ELSE expr */ yytestcase(yyruleno==210);
147975 {yymsp[-1].minor.yy18 = yymsp[0].minor.yy18;}
147976 break;
147977 case 121: /* on_opt ::= */
147978 case 136: /* having_opt ::= */ yytestcase(yyruleno==136);
147979 case 138: /* limit_opt ::= */ yytestcase(yyruleno==138);
147980 case 143: /* where_opt ::= */ yytestcase(yyruleno==143);
147981 case 211: /* case_else ::= */ yytestcase(yyruleno==211);
147982 case 213: /* case_operand ::= */ yytestcase(yyruleno==213);
147983 {yymsp[1].minor.yy18 = 0;}
147984 break;
147985 case 123: /* indexed_opt ::= INDEXED BY nm */
147986 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
147987 break;
147988 case 124: /* indexed_opt ::= NOT INDEXED */
147989 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
147990 break;
147991 case 125: /* using_opt ::= USING LP idlist RP */
147992 {yymsp[-3].minor.yy48 = yymsp[-1].minor.yy48;}
147993 break;
147994 case 126: /* using_opt ::= */
147995 case 158: /* idlist_opt ::= */ yytestcase(yyruleno==158);
147996 {yymsp[1].minor.yy48 = 0;}
147997 break;
147998 case 128: /* orderby_opt ::= ORDER BY sortlist */
147999 case 135: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==135);
148000 {yymsp[-2].minor.yy420 = yymsp[0].minor.yy420;}
148001 break;
148002 case 129: /* sortlist ::= sortlist COMMA expr sortorder */
148003 {
148004 yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy420,yymsp[-1].minor.yy18);
148005 sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy420,yymsp[0].minor.yy70);
148006 }
148007 break;
148008 case 130: /* sortlist ::= expr sortorder */
148009 {
148010 yymsp[-1].minor.yy420 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy18); /*A-overwrites-Y*/
148011 sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy420,yymsp[0].minor.yy70);
148012 }
148013 break;
148014 case 131: /* sortorder ::= ASC */
148015 {yymsp[0].minor.yy70 = SQLITE_SO_ASC;}
148016 break;
148017 case 132: /* sortorder ::= DESC */
148018 {yymsp[0].minor.yy70 = SQLITE_SO_DESC;}
148019 break;
148020 case 133: /* sortorder ::= */
148021 {yymsp[1].minor.yy70 = SQLITE_SO_UNDEFINED;}
148022 break;
148023 case 139: /* limit_opt ::= LIMIT expr */
148024 {yymsp[-1].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy18,0);}
148025 break;
148026 case 140: /* limit_opt ::= LIMIT expr OFFSET expr */
148027 {yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);}
148028 break;
148029 case 141: /* limit_opt ::= LIMIT expr COMMA expr */
148030 {yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy18,yymsp[-2].minor.yy18);}
148031 break;
148032 case 142: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */
148033 {
148034 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy135, &yymsp[-1].minor.yy0);
148035 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy135,yymsp[0].minor.yy18,0,0);
148036 }
148037 break;
148038 case 145: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */
148039 {
148040 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy135, &yymsp[-3].minor.yy0);
148041 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy420,"set list");
148042 sqlite3Update(pParse,yymsp[-4].minor.yy135,yymsp[-1].minor.yy420,yymsp[0].minor.yy18,yymsp[-5].minor.yy70,0,0,0);
148043 }
148044 break;
148045 case 146: /* setlist ::= setlist COMMA nm EQ expr */
148046 {
148047 yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy420, yymsp[0].minor.yy18);
148048 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy420, &yymsp[-2].minor.yy0, 1);
148049 }
148050 break;
148051 case 147: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
148052 {
148053 yymsp[-6].minor.yy420 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy420, yymsp[-3].minor.yy48, yymsp[0].minor.yy18);
148054 }
148055 break;
148056 case 148: /* setlist ::= nm EQ expr */
148057 {
148058 yylhsminor.yy420 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy18);
148059 sqlite3ExprListSetName(pParse, yylhsminor.yy420, &yymsp[-2].minor.yy0, 1);
148060 }
148061 yymsp[-2].minor.yy420 = yylhsminor.yy420;
148062 break;
148063 case 149: /* setlist ::= LP idlist RP EQ expr */
148064 {
148065 yymsp[-4].minor.yy420 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy48, yymsp[0].minor.yy18);
148066 }
148067 break;
148068 case 150: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
148069 {
148070 sqlite3Insert(pParse, yymsp[-3].minor.yy135, yymsp[-1].minor.yy489, yymsp[-2].minor.yy48, yymsp[-5].minor.yy70, yymsp[0].minor.yy340);
148071 }
148072 break;
148073 case 151: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
148074 {
148075 sqlite3Insert(pParse, yymsp[-3].minor.yy135, 0, yymsp[-2].minor.yy48, yymsp[-5].minor.yy70, 0);
148076 }
148077 break;
148078 case 152: /* upsert ::= */
148079 { yymsp[1].minor.yy340 = 0; }
148080 break;
148081 case 153: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
148082 { yymsp[-10].minor.yy340 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy420,yymsp[-5].minor.yy18,yymsp[-1].minor.yy420,yymsp[0].minor.yy18);}
148083 break;
148084 case 154: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
148085 { yymsp[-7].minor.yy340 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy420,yymsp[-2].minor.yy18,0,0); }
148086 break;
148087 case 155: /* upsert ::= ON CONFLICT DO NOTHING */
148088 { yymsp[-3].minor.yy340 = sqlite3UpsertNew(pParse->db,0,0,0,0); }
148089 break;
148090 case 159: /* idlist_opt ::= LP idlist RP */
148091 {yymsp[-2].minor.yy48 = yymsp[-1].minor.yy48;}
148092 break;
148093 case 160: /* idlist ::= idlist COMMA nm */
148094 {yymsp[-2].minor.yy48 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy48,&yymsp[0].minor.yy0);}
148095 break;
148096 case 161: /* idlist ::= nm */
148097 {yymsp[0].minor.yy48 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
148098 break;
148099 case 162: /* expr ::= LP expr RP */
148100 {yymsp[-2].minor.yy18 = yymsp[-1].minor.yy18;}
148101 break;
148102 case 163: /* expr ::= ID|INDEXED */
148103 case 164: /* expr ::= JOIN_KW */ yytestcase(yyruleno==164);
148104 {yymsp[0].minor.yy18=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
148105 break;
148106 case 165: /* expr ::= nm DOT nm */
148107 {
148108 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
148109 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
148110 yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
148111 }
148112 yymsp[-2].minor.yy18 = yylhsminor.yy18;
148113 break;
148114 case 166: /* expr ::= nm DOT nm DOT nm */
148115 {
148116 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
148117 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
148118 Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
148119 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
148120 yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
148121 }
148122 yymsp[-4].minor.yy18 = yylhsminor.yy18;
148123 break;
148124 case 167: /* term ::= NULL|FLOAT|BLOB */
148125 case 168: /* term ::= STRING */ yytestcase(yyruleno==168);
148126 {yymsp[0].minor.yy18=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
148127 break;
148128 case 169: /* term ::= INTEGER */
148129 {
148130 yylhsminor.yy18 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
148131 }
148132 yymsp[0].minor.yy18 = yylhsminor.yy18;
148133 break;
148134 case 170: /* expr ::= VARIABLE */
148135 {
148136 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
148137 u32 n = yymsp[0].minor.yy0.n;
148138 yymsp[0].minor.yy18 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
148139 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy18, n);
@@ -148227,48 +148151,54 @@
148151 if( yymsp[0].minor.yy18 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy18->iTable);
148152 }
148153 }
148154 }
148155 break;
148156 case 171: /* expr ::= expr COLLATE ID|STRING */
148157 {
148158 yymsp[-2].minor.yy18 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy18, &yymsp[0].minor.yy0, 1);
148159 }
148160 break;
148161 case 172: /* expr ::= CAST LP expr AS typetoken RP */
148162 {
148163 yymsp[-5].minor.yy18 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
148164 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy18, yymsp[-3].minor.yy18, 0);
148165 }
148166 break;
148167 case 173: /* expr ::= ID|INDEXED LP distinct exprlist RP */
148168 {
148169 yylhsminor.yy18 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy420, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy70);
148170 }
148171 yymsp[-4].minor.yy18 = yylhsminor.yy18;
148172 break;
148173 case 174: /* expr ::= ID|INDEXED LP STAR RP */
148174 {
148175 yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
148176 }
148177 yymsp[-3].minor.yy18 = yylhsminor.yy18;
148178 break;
148179 case 175: /* expr ::= ID|INDEXED LP distinct exprlist RP over_clause */
148180 {
148181 yylhsminor.yy18 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy420, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy70);
148182 sqlite3WindowAttach(pParse, yylhsminor.yy18, yymsp[0].minor.yy327);
148183 }
148184 yymsp[-5].minor.yy18 = yylhsminor.yy18;
148185 break;
148186 case 176: /* expr ::= ID|INDEXED LP STAR RP over_clause */
148187 {
148188 yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
148189 sqlite3WindowAttach(pParse, yylhsminor.yy18, yymsp[0].minor.yy327);
148190 }
148191 yymsp[-4].minor.yy18 = yylhsminor.yy18;
148192 break;
148193 case 177: /* term ::= CTIME_KW */
148194 {
148195 yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
148196 }
148197 yymsp[0].minor.yy18 = yylhsminor.yy18;
148198 break;
148199 case 178: /* expr ::= LP nexprlist COMMA expr RP */
148200 {
148201 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy420, yymsp[-1].minor.yy18);
148202 yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
148203 if( yymsp[-4].minor.yy18 ){
148204 yymsp[-4].minor.yy18->x.pList = pList;
@@ -148275,81 +148205,81 @@
148205 }else{
148206 sqlite3ExprListDelete(pParse->db, pList);
148207 }
148208 }
148209 break;
148210 case 179: /* expr ::= expr AND expr */
148211 case 180: /* expr ::= expr OR expr */ yytestcase(yyruleno==180);
148212 case 181: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==181);
148213 case 182: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==182);
148214 case 183: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==183);
148215 case 184: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==184);
148216 case 185: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==185);
148217 case 186: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==186);
148218 {yymsp[-2].minor.yy18=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);}
148219 break;
148220 case 187: /* likeop ::= NOT LIKE_KW|MATCH */
148221 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
148222 break;
148223 case 188: /* expr ::= expr likeop expr */
148224 {
148225 ExprList *pList;
148226 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
148227 yymsp[-1].minor.yy0.n &= 0x7fffffff;
148228 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy18);
148229 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy18);
148230 yymsp[-2].minor.yy18 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
148231 if( bNot ) yymsp[-2].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy18, 0);
148232 if( yymsp[-2].minor.yy18 ) yymsp[-2].minor.yy18->flags |= EP_InfixFunc;
148233 }
148234 break;
148235 case 189: /* expr ::= expr likeop expr ESCAPE expr */
148236 {
148237 ExprList *pList;
148238 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
148239 yymsp[-3].minor.yy0.n &= 0x7fffffff;
148240 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18);
148241 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy18);
148242 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy18);
148243 yymsp[-4].minor.yy18 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
148244 if( bNot ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148245 if( yymsp[-4].minor.yy18 ) yymsp[-4].minor.yy18->flags |= EP_InfixFunc;
148246 }
148247 break;
148248 case 190: /* expr ::= expr ISNULL|NOTNULL */
148249 {yymsp[-1].minor.yy18 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy18,0);}
148250 break;
148251 case 191: /* expr ::= expr NOT NULL */
148252 {yymsp[-2].minor.yy18 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy18,0);}
148253 break;
148254 case 192: /* expr ::= expr IS expr */
148255 {
148256 yymsp[-2].minor.yy18 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);
148257 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy18, yymsp[-2].minor.yy18, TK_ISNULL);
148258 }
148259 break;
148260 case 193: /* expr ::= expr IS NOT expr */
148261 {
148262 yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy18,yymsp[0].minor.yy18);
148263 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy18, yymsp[-3].minor.yy18, TK_NOTNULL);
148264 }
148265 break;
148266 case 194: /* expr ::= NOT expr */
148267 case 195: /* expr ::= BITNOT expr */ yytestcase(yyruleno==195);
148268 {yymsp[-1].minor.yy18 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy18, 0);/*A-overwrites-B*/}
148269 break;
148270 case 196: /* expr ::= PLUS|MINUS expr */
148271 {
148272 yymsp[-1].minor.yy18 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy18, 0);
148273 /*A-overwrites-B*/
148274 }
148275 break;
148276 case 197: /* between_op ::= BETWEEN */
148277 case 200: /* in_op ::= IN */ yytestcase(yyruleno==200);
148278 {yymsp[0].minor.yy70 = 0;}
148279 break;
148280 case 199: /* expr ::= expr between_op expr AND expr */
148281 {
148282 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18);
148283 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy18);
148284 yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy18, 0);
148285 if( yymsp[-4].minor.yy18 ){
@@ -148358,11 +148288,11 @@
148288 sqlite3ExprListDelete(pParse->db, pList);
148289 }
148290 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148291 }
148292 break;
148293 case 202: /* expr ::= expr in_op LP exprlist RP */
148294 {
148295 if( yymsp[-1].minor.yy420==0 ){
148296 /* Expressions of the form
148297 **
148298 ** expr1 IN ()
@@ -148410,41 +148340,41 @@
148340 }
148341 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148342 }
148343 }
148344 break;
148345 case 203: /* expr ::= LP select RP */
148346 {
148347 yymsp[-2].minor.yy18 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
148348 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy18, yymsp[-1].minor.yy489);
148349 }
148350 break;
148351 case 204: /* expr ::= expr in_op LP select RP */
148352 {
148353 yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy18, 0);
148354 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy18, yymsp[-1].minor.yy489);
148355 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148356 }
148357 break;
148358 case 205: /* expr ::= expr in_op nm dbnm paren_exprlist */
148359 {
148360 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
148361 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
148362 if( yymsp[0].minor.yy420 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy420);
148363 yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy18, 0);
148364 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy18, pSelect);
148365 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
148366 }
148367 break;
148368 case 206: /* expr ::= EXISTS LP select RP */
148369 {
148370 Expr *p;
148371 p = yymsp[-3].minor.yy18 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
148372 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy489);
148373 }
148374 break;
148375 case 207: /* expr ::= CASE case_operand case_exprlist case_else END */
148376 {
148377 yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy18, 0);
148378 if( yymsp[-4].minor.yy18 ){
148379 yymsp[-4].minor.yy18->x.pList = yymsp[-1].minor.yy18 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy420,yymsp[-1].minor.yy18) : yymsp[-2].minor.yy420;
148380 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy18);
@@ -148452,369 +148382,365 @@
148382 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy420);
148383 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy18);
148384 }
148385 }
148386 break;
148387 case 208: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
148388 {
148389 yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, yymsp[-2].minor.yy18);
148390 yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, yymsp[0].minor.yy18);
148391 }
148392 break;
148393 case 209: /* case_exprlist ::= WHEN expr THEN expr */
148394 {
148395 yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18);
148396 yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy420, yymsp[0].minor.yy18);
148397 }
148398 break;
148399 case 212: /* case_operand ::= expr */
148400 {yymsp[0].minor.yy18 = yymsp[0].minor.yy18; /*A-overwrites-X*/}
148401 break;
148402 case 215: /* nexprlist ::= nexprlist COMMA expr */
148403 {yymsp[-2].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy420,yymsp[0].minor.yy18);}
148404 break;
148405 case 216: /* nexprlist ::= expr */
148406 {yymsp[0].minor.yy420 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy18); /*A-overwrites-Y*/}
148407 break;
148408 case 218: /* paren_exprlist ::= LP exprlist RP */
148409 case 223: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==223);
148410 {yymsp[-2].minor.yy420 = yymsp[-1].minor.yy420;}
148411 break;
148412 case 219: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
148413 {
148414 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
148415 sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy420, yymsp[-10].minor.yy70,
148416 &yymsp[-11].minor.yy0, yymsp[0].minor.yy18, SQLITE_SO_ASC, yymsp[-8].minor.yy70, SQLITE_IDXTYPE_APPDEF);
148417 }
148418 break;
148419 case 220: /* uniqueflag ::= UNIQUE */
148420 case 260: /* raisetype ::= ABORT */ yytestcase(yyruleno==260);
148421 {yymsp[0].minor.yy70 = OE_Abort;}
148422 break;
148423 case 221: /* uniqueflag ::= */
148424 {yymsp[1].minor.yy70 = OE_None;}
148425 break;
148426 case 224: /* eidlist ::= eidlist COMMA nm collate sortorder */
148427 {
148428 yymsp[-4].minor.yy420 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy420, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy70, yymsp[0].minor.yy70);
148429 }
148430 break;
148431 case 225: /* eidlist ::= nm collate sortorder */
148432 {
148433 yymsp[-2].minor.yy420 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy70, yymsp[0].minor.yy70); /*A-overwrites-Y*/
148434 }
148435 break;
148436 case 228: /* cmd ::= DROP INDEX ifexists fullname */
148437 {sqlite3DropIndex(pParse, yymsp[0].minor.yy135, yymsp[-1].minor.yy70);}
148438 break;
148439 case 229: /* cmd ::= VACUUM */
148440 {sqlite3Vacuum(pParse,0);}
148441 break;
148442 case 230: /* cmd ::= VACUUM nm */
148443 {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
148444 break;
148445 case 231: /* cmd ::= PRAGMA nm dbnm */
148446 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
148447 break;
148448 case 232: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
148449 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
148450 break;
148451 case 233: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
148452 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
148453 break;
148454 case 234: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
148455 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
148456 break;
148457 case 235: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
148458 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
148459 break;
148460 case 238: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
148461 {
148462 Token all;
148463 all.z = yymsp[-3].minor.yy0.z;
148464 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
148465 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy207, &all);
148466 }
148467 break;
148468 case 239: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
148469 {
148470 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy70, yymsp[-4].minor.yy34.a, yymsp[-4].minor.yy34.b, yymsp[-2].minor.yy135, yymsp[0].minor.yy18, yymsp[-10].minor.yy70, yymsp[-8].minor.yy70);
148471 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
148472 }
148473 break;
148474 case 240: /* trigger_time ::= BEFORE|AFTER */
148475 { yymsp[0].minor.yy70 = yymsp[0].major; /*A-overwrites-X*/ }
148476 break;
148477 case 241: /* trigger_time ::= INSTEAD OF */
148478 { yymsp[-1].minor.yy70 = TK_INSTEAD;}
148479 break;
148480 case 242: /* trigger_time ::= */
148481 { yymsp[1].minor.yy70 = TK_BEFORE; }
148482 break;
148483 case 243: /* trigger_event ::= DELETE|INSERT */
148484 case 244: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==244);
148485 {yymsp[0].minor.yy34.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy34.b = 0;}
148486 break;
148487 case 245: /* trigger_event ::= UPDATE OF idlist */
148488 {yymsp[-2].minor.yy34.a = TK_UPDATE; yymsp[-2].minor.yy34.b = yymsp[0].minor.yy48;}
148489 break;
148490 case 246: /* when_clause ::= */
148491 case 265: /* key_opt ::= */ yytestcase(yyruleno==265);
148492 case 306: /* filter_opt ::= */ yytestcase(yyruleno==306);
148493 { yymsp[1].minor.yy18 = 0; }
148494 break;
148495 case 247: /* when_clause ::= WHEN expr */
148496 case 266: /* key_opt ::= KEY expr */ yytestcase(yyruleno==266);
148497 { yymsp[-1].minor.yy18 = yymsp[0].minor.yy18; }
148498 break;
148499 case 248: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
148500 {
148501 assert( yymsp[-2].minor.yy207!=0 );
148502 yymsp[-2].minor.yy207->pLast->pNext = yymsp[-1].minor.yy207;
148503 yymsp[-2].minor.yy207->pLast = yymsp[-1].minor.yy207;
148504 }
148505 break;
148506 case 249: /* trigger_cmd_list ::= trigger_cmd SEMI */
148507 {
148508 assert( yymsp[-1].minor.yy207!=0 );
148509 yymsp[-1].minor.yy207->pLast = yymsp[-1].minor.yy207;
148510 }
148511 break;
148512 case 250: /* trnm ::= nm DOT nm */
148513 {
148514 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
148515 sqlite3ErrorMsg(pParse,
148516 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
148517 "statements within triggers");
148518 }
148519 break;
148520 case 251: /* tridxby ::= INDEXED BY nm */
148521 {
148522 sqlite3ErrorMsg(pParse,
148523 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
148524 "within triggers");
148525 }
148526 break;
148527 case 252: /* tridxby ::= NOT INDEXED */
148528 {
148529 sqlite3ErrorMsg(pParse,
148530 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
148531 "within triggers");
148532 }
148533 break;
148534 case 253: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */
148535 {yylhsminor.yy207 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy420, yymsp[-1].minor.yy18, yymsp[-6].minor.yy70, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy392);}
148536 yymsp[-7].minor.yy207 = yylhsminor.yy207;
148537 break;
148538 case 254: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
148539 {
148540 yylhsminor.yy207 = sqlite3TriggerInsertStep(pParse->db,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy48,yymsp[-2].minor.yy489,yymsp[-6].minor.yy70,yymsp[-1].minor.yy340,yymsp[-7].minor.yy392,yymsp[0].minor.yy392);/*yylhsminor.yy207-overwrites-yymsp[-6].minor.yy70*/
148541 }
148542 yymsp[-7].minor.yy207 = yylhsminor.yy207;
148543 break;
148544 case 255: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
148545 {yylhsminor.yy207 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy18, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy392);}
148546 yymsp[-5].minor.yy207 = yylhsminor.yy207;
148547 break;
148548 case 256: /* trigger_cmd ::= scanpt select scanpt */
148549 {yylhsminor.yy207 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy489, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); /*yylhsminor.yy207-overwrites-yymsp[-1].minor.yy489*/}
148550 yymsp[-2].minor.yy207 = yylhsminor.yy207;
148551 break;
148552 case 257: /* expr ::= RAISE LP IGNORE RP */
148553 {
148554 yymsp[-3].minor.yy18 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
148555 if( yymsp[-3].minor.yy18 ){
148556 yymsp[-3].minor.yy18->affinity = OE_Ignore;
148557 }
148558 }
148559 break;
148560 case 258: /* expr ::= RAISE LP raisetype COMMA nm RP */
148561 {
148562 yymsp[-5].minor.yy18 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
148563 if( yymsp[-5].minor.yy18 ) {
148564 yymsp[-5].minor.yy18->affinity = (char)yymsp[-3].minor.yy70;
148565 }
148566 }
148567 break;
148568 case 259: /* raisetype ::= ROLLBACK */
148569 {yymsp[0].minor.yy70 = OE_Rollback;}
148570 break;
148571 case 261: /* raisetype ::= FAIL */
148572 {yymsp[0].minor.yy70 = OE_Fail;}
148573 break;
148574 case 262: /* cmd ::= DROP TRIGGER ifexists fullname */
148575 {
148576 sqlite3DropTrigger(pParse,yymsp[0].minor.yy135,yymsp[-1].minor.yy70);
148577 }
148578 break;
148579 case 263: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
148580 {
148581 sqlite3Attach(pParse, yymsp[-3].minor.yy18, yymsp[-1].minor.yy18, yymsp[0].minor.yy18);
148582 }
148583 break;
148584 case 264: /* cmd ::= DETACH database_kw_opt expr */
148585 {
148586 sqlite3Detach(pParse, yymsp[0].minor.yy18);
148587 }
148588 break;
148589 case 267: /* cmd ::= REINDEX */
148590 {sqlite3Reindex(pParse, 0, 0);}
148591 break;
148592 case 268: /* cmd ::= REINDEX nm dbnm */
148593 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
148594 break;
148595 case 269: /* cmd ::= ANALYZE */
148596 {sqlite3Analyze(pParse, 0, 0);}
148597 break;
148598 case 270: /* cmd ::= ANALYZE nm dbnm */
148599 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
148600 break;
148601 case 271: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
148602 {
148603 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy135,&yymsp[0].minor.yy0);
148604 }
148605 break;
148606 case 272: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
148607 {
148608 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
148609 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
148610 }
148611 break;
148612 case 273: /* add_column_fullname ::= fullname */
148613 {
148614 disableLookaside(pParse);
148615 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy135);
148616 }
148617 break;
148618 case 274: /* cmd ::= create_vtab */
148619 {sqlite3VtabFinishParse(pParse,0);}
148620 break;
148621 case 275: /* cmd ::= create_vtab LP vtabarglist RP */
148622 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
148623 break;
148624 case 276: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
148625 {
148626 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy70);
148627 }
148628 break;
148629 case 277: /* vtabarg ::= */
148630 {sqlite3VtabArgInit(pParse);}
148631 break;
148632 case 278: /* vtabargtoken ::= ANY */
148633 case 279: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==279);
148634 case 280: /* lp ::= LP */ yytestcase(yyruleno==280);
148635 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
148636 break;
148637 case 281: /* with ::= WITH wqlist */
148638 case 282: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==282);
148639 { sqlite3WithPush(pParse, yymsp[0].minor.yy449, 1); }
148640 break;
148641 case 283: /* wqlist ::= nm eidlist_opt AS LP select RP */
148642 {
148643 yymsp[-5].minor.yy449 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489); /*A-overwrites-X*/
148644 }
148645 break;
148646 case 284: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
148647 {
148648 yymsp[-7].minor.yy449 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy449, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489);
148649 }
148650 break;
148651 case 285: /* windowdefn_list ::= windowdefn */
148652 { yylhsminor.yy327 = yymsp[0].minor.yy327; }
148653 yymsp[0].minor.yy327 = yylhsminor.yy327;
148654 break;
148655 case 286: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
148656 {
148657 assert( yymsp[0].minor.yy327!=0 );
148658 yymsp[0].minor.yy327->pNextWin = yymsp[-2].minor.yy327;
148659 yylhsminor.yy327 = yymsp[0].minor.yy327;
148660 }
148661 yymsp[-2].minor.yy327 = yylhsminor.yy327;
148662 break;
148663 case 287: /* windowdefn ::= nm AS window */
148664 {
148665 if( ALWAYS(yymsp[0].minor.yy327) ){
148666 yymsp[0].minor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[-2].minor.yy0.z, yymsp[-2].minor.yy0.n);
148667 }
148668 yylhsminor.yy327 = yymsp[0].minor.yy327;
148669 }
148670 yymsp[-2].minor.yy327 = yylhsminor.yy327;
148671 break;
148672 case 288: /* window ::= LP part_opt orderby_opt frame_opt RP */
148673 {
148674 yymsp[-4].minor.yy327 = yymsp[-1].minor.yy327;
148675 if( ALWAYS(yymsp[-4].minor.yy327) ){
148676 yymsp[-4].minor.yy327->pPartition = yymsp[-3].minor.yy420;
148677 yymsp[-4].minor.yy327->pOrderBy = yymsp[-2].minor.yy420;
148678 }
148679 }
148680 break;
148681 case 289: /* part_opt ::= PARTITION BY nexprlist */
148682 { yymsp[-2].minor.yy420 = yymsp[0].minor.yy420; }
148683 break;
148684 case 290: /* part_opt ::= */
148685 { yymsp[1].minor.yy420 = 0; }
148686 break;
148687 case 291: /* frame_opt ::= */
148688 {
148689 yymsp[1].minor.yy327 = sqlite3WindowAlloc(pParse, TK_RANGE, TK_UNBOUNDED, 0, TK_CURRENT, 0);
148690 }
148691 break;
148692 case 292: /* frame_opt ::= range_or_rows frame_bound_s */
148693 {
148694 yylhsminor.yy327 = sqlite3WindowAlloc(pParse, yymsp[-1].minor.yy70, yymsp[0].minor.yy119.eType, yymsp[0].minor.yy119.pExpr, TK_CURRENT, 0);
148695 }
148696 yymsp[-1].minor.yy327 = yylhsminor.yy327;
148697 break;
148698 case 293: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */
148699 {
148700 yylhsminor.yy327 = sqlite3WindowAlloc(pParse, yymsp[-4].minor.yy70, yymsp[-2].minor.yy119.eType, yymsp[-2].minor.yy119.pExpr, yymsp[0].minor.yy119.eType, yymsp[0].minor.yy119.pExpr);
148701 }
148702 yymsp[-4].minor.yy327 = yylhsminor.yy327;
148703 break;
148704 case 294: /* range_or_rows ::= RANGE */
148705 { yymsp[0].minor.yy70 = TK_RANGE; }
148706 break;
148707 case 295: /* range_or_rows ::= ROWS */
148708 { yymsp[0].minor.yy70 = TK_ROWS; }
148709 break;
148710 case 296: /* frame_bound_s ::= frame_bound */
148711 case 298: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==298);
148712 { yylhsminor.yy119 = yymsp[0].minor.yy119; }
148713 yymsp[0].minor.yy119 = yylhsminor.yy119;
148714 break;
148715 case 297: /* frame_bound_s ::= UNBOUNDED PRECEDING */
148716 case 299: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==299);
148717 {yymsp[-1].minor.yy119.eType = TK_UNBOUNDED; yymsp[-1].minor.yy119.pExpr = 0;}
148718 break;
148719 case 300: /* frame_bound ::= expr PRECEDING */
148720 { yylhsminor.yy119.eType = TK_PRECEDING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; }
148721 yymsp[-1].minor.yy119 = yylhsminor.yy119;
148722 break;
148723 case 301: /* frame_bound ::= CURRENT ROW */
148724 { yymsp[-1].minor.yy119.eType = TK_CURRENT ; yymsp[-1].minor.yy119.pExpr = 0; }
148725 break;
148726 case 302: /* frame_bound ::= expr FOLLOWING */
148727 { yylhsminor.yy119.eType = TK_FOLLOWING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; }
148728 yymsp[-1].minor.yy119 = yylhsminor.yy119;
148729 break;
148730 case 303: /* window_clause ::= WINDOW windowdefn_list */
 
 
 
 
148731 { yymsp[-1].minor.yy327 = yymsp[0].minor.yy327; }
148732 break;
148733 case 304: /* over_clause ::= filter_opt OVER window */
148734 {
148735 yylhsminor.yy327 = yymsp[0].minor.yy327;
148736 assert( yylhsminor.yy327!=0 );
148737 yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18;
148738 }
148739 yymsp[-2].minor.yy327 = yylhsminor.yy327;
148740 break;
148741 case 305: /* over_clause ::= filter_opt OVER nm */
148742 {
148743 yylhsminor.yy327 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
148744 if( yylhsminor.yy327 ){
148745 yylhsminor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
148746 yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18;
@@ -148822,72 +148748,72 @@
148748 sqlite3ExprDelete(pParse->db, yymsp[-2].minor.yy18);
148749 }
148750 }
148751 yymsp[-2].minor.yy327 = yylhsminor.yy327;
148752 break;
148753 case 307: /* filter_opt ::= FILTER LP WHERE expr RP */
148754 { yymsp[-4].minor.yy18 = yymsp[-1].minor.yy18; }
148755 break;
148756 default:
148757 /* (308) input ::= cmdlist */ yytestcase(yyruleno==308);
148758 /* (309) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==309);
148759 /* (310) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=310);
148760 /* (311) ecmd ::= SEMI */ yytestcase(yyruleno==311);
148761 /* (312) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==312);
148762 /* (313) ecmd ::= explain cmdx */ yytestcase(yyruleno==313);
148763 /* (314) trans_opt ::= */ yytestcase(yyruleno==314);
148764 /* (315) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==315);
148765 /* (316) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==316);
148766 /* (317) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==317);
148767 /* (318) savepoint_opt ::= */ yytestcase(yyruleno==318);
148768 /* (319) cmd ::= create_table create_table_args */ yytestcase(yyruleno==319);
148769 /* (320) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==320);
148770 /* (321) columnlist ::= columnname carglist */ yytestcase(yyruleno==321);
148771 /* (322) nm ::= ID|INDEXED */ yytestcase(yyruleno==322);
148772 /* (323) nm ::= STRING */ yytestcase(yyruleno==323);
148773 /* (324) nm ::= JOIN_KW */ yytestcase(yyruleno==324);
148774 /* (325) typetoken ::= typename */ yytestcase(yyruleno==325);
148775 /* (326) typename ::= ID|STRING */ yytestcase(yyruleno==326);
148776 /* (327) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=327);
148777 /* (328) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=328);
148778 /* (329) carglist ::= carglist ccons */ yytestcase(yyruleno==329);
148779 /* (330) carglist ::= */ yytestcase(yyruleno==330);
148780 /* (331) ccons ::= NULL onconf */ yytestcase(yyruleno==331);
148781 /* (332) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==332);
148782 /* (333) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==333);
148783 /* (334) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=334);
148784 /* (335) tconscomma ::= */ yytestcase(yyruleno==335);
148785 /* (336) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=336);
148786 /* (337) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=337);
148787 /* (338) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=338);
148788 /* (339) oneselect ::= values */ yytestcase(yyruleno==339);
148789 /* (340) sclp ::= selcollist COMMA */ yytestcase(yyruleno==340);
148790 /* (341) as ::= ID|STRING */ yytestcase(yyruleno==341);
148791 /* (342) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=342);
148792 /* (343) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==343);
148793 /* (344) exprlist ::= nexprlist */ yytestcase(yyruleno==344);
148794 /* (345) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=345);
148795 /* (346) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=346);
148796 /* (347) nmnum ::= ON */ yytestcase(yyruleno==347);
148797 /* (348) nmnum ::= DELETE */ yytestcase(yyruleno==348);
148798 /* (349) nmnum ::= DEFAULT */ yytestcase(yyruleno==349);
148799 /* (350) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==350);
148800 /* (351) foreach_clause ::= */ yytestcase(yyruleno==351);
148801 /* (352) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==352);
148802 /* (353) trnm ::= nm */ yytestcase(yyruleno==353);
148803 /* (354) tridxby ::= */ yytestcase(yyruleno==354);
148804 /* (355) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==355);
148805 /* (356) database_kw_opt ::= */ yytestcase(yyruleno==356);
148806 /* (357) kwcolumn_opt ::= */ yytestcase(yyruleno==357);
148807 /* (358) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==358);
148808 /* (359) vtabarglist ::= vtabarg */ yytestcase(yyruleno==359);
148809 /* (360) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==360);
148810 /* (361) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==361);
148811 /* (362) anylist ::= */ yytestcase(yyruleno==362);
148812 /* (363) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==363);
148813 /* (364) anylist ::= anylist ANY */ yytestcase(yyruleno==364);
148814 /* (365) with ::= */ yytestcase(yyruleno==365);
148815 break;
148816 /********** End reduce actions ************************************************/
148817 };
148818 assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
148819 yygoto = yyRuleInfo[yyruleno].lhs;
@@ -151538,10 +151464,19 @@
151464 rc = nKey1 - nKey2;
151465 }
151466 }
151467 return rc;
151468 }
151469
151470 /*
151471 ** Return true if CollSeq is the default built-in BINARY.
151472 */
151473 SQLITE_PRIVATE int sqlite3IsBinary(const CollSeq *p){
151474 assert( p==0 || p->xCmp!=binCollFunc || p->pUser!=0
151475 || strcmp(p->zName,"BINARY")==0 );
151476 return p==0 || (p->xCmp==binCollFunc && p->pUser==0);
151477 }
151478
151479 /*
151480 ** Another built-in collating sequence: NOCASE.
151481 **
151482 ** This collating sequence is intended to be used for "case independent
@@ -151660,11 +151595,11 @@
151595 int i;
151596 HashElem *p;
151597 sqlite3BtreeEnterAll(db);
151598 for(i=0; i<db->nDb; i++){
151599 Schema *pSchema = db->aDb[i].pSchema;
151600 if( pSchema ){
151601 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
151602 Table *pTab = (Table *)sqliteHashData(p);
151603 if( IsVirtual(pTab) ) sqlite3VtabDisconnect(db, pTab);
151604 }
151605 }
@@ -154829,15 +154764,33 @@
154764 if( db->autoCommit==0 ){
154765 int iDb;
154766 iDb = sqlite3FindDbName(db, zDb);
154767 if( iDb==0 || iDb>1 ){
154768 Btree *pBt = db->aDb[iDb].pBt;
154769 if( sqlite3BtreeIsInTrans(pBt)==0 ){
154770 Pager *pPager = sqlite3BtreePager(pBt);
154771 int bUnlock = 0;
154772 if( sqlite3BtreeIsInReadTrans(pBt) ){
154773 if( db->nVdbeActive==0 ){
154774 rc = sqlite3PagerSnapshotCheck(pPager, pSnapshot);
154775 if( rc==SQLITE_OK ){
154776 bUnlock = 1;
154777 rc = sqlite3BtreeCommit(pBt);
154778 }
154779 }
154780 }else{
154781 rc = SQLITE_OK;
154782 }
154783 if( rc==SQLITE_OK ){
154784 rc = sqlite3PagerSnapshotOpen(pPager, pSnapshot);
154785 }
154786 if( rc==SQLITE_OK ){
154787 rc = sqlite3BtreeBeginTrans(pBt, 0, 0);
154788 sqlite3PagerSnapshotOpen(pPager, 0);
154789 }
154790 if( bUnlock ){
154791 sqlite3PagerSnapshotUnlock(pPager);
154792 }
154793 }
154794 }
154795 }
154796
@@ -207692,11 +207645,14 @@
207645 int n = 0;
207646 int i;
207647 for(i=0; i<nChar; i++){
207648 if( n>=nByte ) return 0; /* Input contains fewer than nChar chars */
207649 if( (unsigned char)p[n++]>=0xc0 ){
207650 while( (p[n] & 0xc0)==0x80 ){
207651 n++;
207652 if( n>=nByte ) break;
207653 }
207654 }
207655 }
207656 return n;
207657 }
207658
@@ -211572,11 +211528,11 @@
211528 int nArg, /* Number of args */
211529 sqlite3_value **apUnused /* Function arguments */
211530 ){
211531 assert( nArg==0 );
211532 UNUSED_PARAM2(nArg, apUnused);
211533 sqlite3_result_text(pCtx, "fts5: 2018-08-16 15:29:40 60045fbf52162f15f2e18a4e392e80fab19bdbce242728b5e62b0894eac49dfd", -1, SQLITE_TRANSIENT);
211534 }
211535
211536 static int fts5Init(sqlite3 *db){
211537 static const sqlite3_module fts5Mod = {
211538 /* iVersion */ 2,
@@ -216282,12 +216238,12 @@
216238 }
216239 #endif /* SQLITE_CORE */
216240 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
216241
216242 /************** End of stmt.c ************************************************/
216243 #if __LINE__!=216243
216244 #undef SQLITE_SOURCE_ID
216245 #define SQLITE_SOURCE_ID "2018-08-16 16:24:24 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0calt2"
216246 #endif
216247 /* Return the source-id for this library */
216248 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
216249 /************************** End of sqlite3.c ******************************/
216250
+28 -17
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126126
#define SQLITE_VERSION "3.25.0"
127127
#define SQLITE_VERSION_NUMBER 3025000
128
-#define SQLITE_SOURCE_ID "2018-07-24 22:02:12 2bd593332da0aade467e7a4ee89e966aa6302f37540a2c5e23671f98a6cb599c"
128
+#define SQLITE_SOURCE_ID "2018-08-16 16:24:24 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0cfb61"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
@@ -8998,11 +8998,11 @@
89988998
** the following statements are false when sqlite3_snapshot_get() is
89998999
** called, SQLITE_ERROR is returned. The final value of *P is undefined
90009000
** in this case.
90019001
**
90029002
** <ul>
9003
-** <li> The database handle must be in [autocommit mode].
9003
+** <li> The database handle must not be in [autocommit mode].
90049004
**
90059005
** <li> Schema S of [database connection] D must be a [WAL mode] database.
90069006
**
90079007
** <li> There must not be a write transaction open on schema S of database
90089008
** connection D.
@@ -9033,26 +9033,37 @@
90339033
90349034
/*
90359035
** CAPI3REF: Start a read transaction on an historical snapshot
90369036
** METHOD: sqlite3_snapshot
90379037
**
9038
-** ^The [sqlite3_snapshot_open(D,S,P)] interface starts a
9039
-** read transaction for schema S of
9040
-** [database connection] D such that the read transaction
9041
-** refers to historical [snapshot] P, rather than the most
9042
-** recent change to the database.
9043
-** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success
9044
-** or an appropriate [error code] if it fails.
9038
+** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read
9039
+** transaction or upgrades an existing one for schema S of
9040
+** [database connection] D such that the read transaction refers to
9041
+** historical [snapshot] P, rather than the most recent change to the
9042
+** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK
9043
+** on success or an appropriate [error code] if it fails.
90459044
**
9046
-** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be
9047
-** the first operation following the [BEGIN] that takes the schema S
9048
-** out of [autocommit mode].
9049
-** ^In other words, schema S must not currently be in
9050
-** a transaction for [sqlite3_snapshot_open(D,S,P)] to work, but the
9051
-** database connection D must be out of [autocommit mode].
9052
-** ^A [snapshot] will fail to open if it has been overwritten by a
9053
-** [checkpoint].
9045
+** ^In order to succeed, the database connection must not be in
9046
+** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there
9047
+** is already a read transaction open on schema S, then the database handle
9048
+** must have no active statements (SELECT statements that have been passed
9049
+** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()).
9050
+** SQLITE_ERROR is returned if either of these conditions is violated, or
9051
+** if schema S does not exist, or if the snapshot object is invalid.
9052
+**
9053
+** ^A call to sqlite3_snapshot_open() will fail to open if the specified
9054
+** snapshot has been overwritten by a [checkpoint]. In this case
9055
+** SQLITE_BUSY_SNAPSHOT is returned.
9056
+**
9057
+** If there is already a read transaction open when this function is
9058
+** invoked, then the same read transaction remains open (on the same
9059
+** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_BUSY_SNAPSHOT
9060
+** is returned. If another error code - for example SQLITE_PROTOCOL or an
9061
+** SQLITE_IOERR error code - is returned, then the final state of the
9062
+** read transaction is undefined. If SQLITE_OK is returned, then the
9063
+** read transaction is now open on database snapshot P.
9064
+**
90549065
** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the
90559066
** database connection D does not know that the database file for
90569067
** schema S is in [WAL mode]. A database connection might not know
90579068
** that the database file is in [WAL mode] if there has been no prior
90589069
** I/O on that database connection, or if the database entered [WAL mode]
90599070
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.25.0"
127 #define SQLITE_VERSION_NUMBER 3025000
128 #define SQLITE_SOURCE_ID "2018-07-24 22:02:12 2bd593332da0aade467e7a4ee89e966aa6302f37540a2c5e23671f98a6cb599c"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -8998,11 +8998,11 @@
8998 ** the following statements are false when sqlite3_snapshot_get() is
8999 ** called, SQLITE_ERROR is returned. The final value of *P is undefined
9000 ** in this case.
9001 **
9002 ** <ul>
9003 ** <li> The database handle must be in [autocommit mode].
9004 **
9005 ** <li> Schema S of [database connection] D must be a [WAL mode] database.
9006 **
9007 ** <li> There must not be a write transaction open on schema S of database
9008 ** connection D.
@@ -9033,26 +9033,37 @@
9033
9034 /*
9035 ** CAPI3REF: Start a read transaction on an historical snapshot
9036 ** METHOD: sqlite3_snapshot
9037 **
9038 ** ^The [sqlite3_snapshot_open(D,S,P)] interface starts a
9039 ** read transaction for schema S of
9040 ** [database connection] D such that the read transaction
9041 ** refers to historical [snapshot] P, rather than the most
9042 ** recent change to the database.
9043 ** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success
9044 ** or an appropriate [error code] if it fails.
9045 **
9046 ** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be
9047 ** the first operation following the [BEGIN] that takes the schema S
9048 ** out of [autocommit mode].
9049 ** ^In other words, schema S must not currently be in
9050 ** a transaction for [sqlite3_snapshot_open(D,S,P)] to work, but the
9051 ** database connection D must be out of [autocommit mode].
9052 ** ^A [snapshot] will fail to open if it has been overwritten by a
9053 ** [checkpoint].
 
 
 
 
 
 
 
 
 
 
 
 
9054 ** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the
9055 ** database connection D does not know that the database file for
9056 ** schema S is in [WAL mode]. A database connection might not know
9057 ** that the database file is in [WAL mode] if there has been no prior
9058 ** I/O on that database connection, or if the database entered [WAL mode]
9059
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.25.0"
127 #define SQLITE_VERSION_NUMBER 3025000
128 #define SQLITE_SOURCE_ID "2018-08-16 16:24:24 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0cfb61"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
@@ -8998,11 +8998,11 @@
8998 ** the following statements are false when sqlite3_snapshot_get() is
8999 ** called, SQLITE_ERROR is returned. The final value of *P is undefined
9000 ** in this case.
9001 **
9002 ** <ul>
9003 ** <li> The database handle must not be in [autocommit mode].
9004 **
9005 ** <li> Schema S of [database connection] D must be a [WAL mode] database.
9006 **
9007 ** <li> There must not be a write transaction open on schema S of database
9008 ** connection D.
@@ -9033,26 +9033,37 @@
9033
9034 /*
9035 ** CAPI3REF: Start a read transaction on an historical snapshot
9036 ** METHOD: sqlite3_snapshot
9037 **
9038 ** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read
9039 ** transaction or upgrades an existing one for schema S of
9040 ** [database connection] D such that the read transaction refers to
9041 ** historical [snapshot] P, rather than the most recent change to the
9042 ** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK
9043 ** on success or an appropriate [error code] if it fails.
 
9044 **
9045 ** ^In order to succeed, the database connection must not be in
9046 ** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there
9047 ** is already a read transaction open on schema S, then the database handle
9048 ** must have no active statements (SELECT statements that have been passed
9049 ** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()).
9050 ** SQLITE_ERROR is returned if either of these conditions is violated, or
9051 ** if schema S does not exist, or if the snapshot object is invalid.
9052 **
9053 ** ^A call to sqlite3_snapshot_open() will fail to open if the specified
9054 ** snapshot has been overwritten by a [checkpoint]. In this case
9055 ** SQLITE_BUSY_SNAPSHOT is returned.
9056 **
9057 ** If there is already a read transaction open when this function is
9058 ** invoked, then the same read transaction remains open (on the same
9059 ** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_BUSY_SNAPSHOT
9060 ** is returned. If another error code - for example SQLITE_PROTOCOL or an
9061 ** SQLITE_IOERR error code - is returned, then the final state of the
9062 ** read transaction is undefined. If SQLITE_OK is returned, then the
9063 ** read transaction is now open on database snapshot P.
9064 **
9065 ** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the
9066 ** database connection D does not know that the database file for
9067 ** schema S is in [WAL mode]. A database connection might not know
9068 ** that the database file is in [WAL mode] if there has been no prior
9069 ** I/O on that database connection, or if the database entered [WAL mode]
9070

Keyboard Shortcuts

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