| | @@ -452,11 +452,11 @@ |
| 452 | 452 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 453 | 453 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 454 | 454 | */ |
| 455 | 455 | #define SQLITE_VERSION "3.39.0" |
| 456 | 456 | #define SQLITE_VERSION_NUMBER 3039000 |
| 457 | | -#define SQLITE_SOURCE_ID "2022-04-21 19:38:17 f766dff012af0ea3c28a8ce4db850cd0205729a8283bce1e442992aded7c734b" |
| 457 | +#define SQLITE_SOURCE_ID "2022-06-03 14:08:40 d18818afc6021a32989499c26ab38fa442e5a55e662e39bb06e5c0daa9c65e25" |
| 458 | 458 | |
| 459 | 459 | /* |
| 460 | 460 | ** CAPI3REF: Run-Time Library Version Numbers |
| 461 | 461 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 462 | 462 | ** |
| | @@ -6580,10 +6580,32 @@ |
| 6580 | 6580 | ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to |
| 6581 | 6581 | ** create the statement in the first place. |
| 6582 | 6582 | */ |
| 6583 | 6583 | SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); |
| 6584 | 6584 | |
| 6585 | +/* |
| 6586 | +** CAPI3REF: Return The Schema Name For A Database Connection |
| 6587 | +** METHOD: sqlite3 |
| 6588 | +** |
| 6589 | +** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name |
| 6590 | +** for the N-th database on database connection D, or a NULL pointer of N is |
| 6591 | +** out of range. An N alue of 0 means the main database file. An N of 1 is |
| 6592 | +** the "temp" schema. Larger values of N correspond to various ATTACH-ed |
| 6593 | +** databases. |
| 6594 | +** |
| 6595 | +** Space to hold the string that is returned by sqlite3_db_name() is managed |
| 6596 | +** by SQLite itself. The string might be deallocated by any operation that |
| 6597 | +** changes the schema, including [ATTACH] or [DETACH] or calls to |
| 6598 | +** [sqlite3_serialize()] or [sqlite3_deserialize()], even operations that |
| 6599 | +** occur on a different thread. Applications that need to |
| 6600 | +** remember the string long-term should make their own copy. Applications that |
| 6601 | +** are accessing the same database connection simultaneously on multiple |
| 6602 | +** threads should mutex-protect calls to this API and should make their own |
| 6603 | +** private copy of the result prior to releasing the mutex. |
| 6604 | +*/ |
| 6605 | +SQLITE_API const char *sqlite3_db_name(sqlite3 *db, int N); |
| 6606 | + |
| 6585 | 6607 | /* |
| 6586 | 6608 | ** CAPI3REF: Return The Filename For A Database Connection |
| 6587 | 6609 | ** METHOD: sqlite3 |
| 6588 | 6610 | ** |
| 6589 | 6611 | ** ^The sqlite3_db_filename(D,N) interface returns a pointer to the filename |
| | @@ -15790,12 +15812,14 @@ |
| 15790 | 15812 | # define sqlite3VdbeVerifyNoMallocRequired(A,B) |
| 15791 | 15813 | # define sqlite3VdbeVerifyNoResultRow(A) |
| 15792 | 15814 | #endif |
| 15793 | 15815 | #if defined(SQLITE_DEBUG) |
| 15794 | 15816 | SQLITE_PRIVATE void sqlite3VdbeVerifyAbortable(Vdbe *p, int); |
| 15817 | +SQLITE_PRIVATE void sqlite3VdbeNoJumpsOutsideSubrtn(Vdbe*,int,int,int); |
| 15795 | 15818 | #else |
| 15796 | 15819 | # define sqlite3VdbeVerifyAbortable(A,B) |
| 15820 | +# define sqlite3VdbeNoJumpsOutsideSubrtn(A,B,C,D) |
| 15797 | 15821 | #endif |
| 15798 | 15822 | SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp,int iLineno); |
| 15799 | 15823 | #ifndef SQLITE_OMIT_EXPLAIN |
| 15800 | 15824 | SQLITE_PRIVATE void sqlite3VdbeExplain(Parse*,u8,const char*,...); |
| 15801 | 15825 | SQLITE_PRIVATE void sqlite3VdbeExplainPop(Parse*); |
| | @@ -16283,10 +16307,17 @@ |
| 16283 | 16307 | /* Maximum pathname length. Note: FILENAME_MAX defined by stdio.h |
| 16284 | 16308 | */ |
| 16285 | 16309 | #ifndef SQLITE_MAX_PATHLEN |
| 16286 | 16310 | # define SQLITE_MAX_PATHLEN FILENAME_MAX |
| 16287 | 16311 | #endif |
| 16312 | + |
| 16313 | +/* Maximum number of symlinks that will be resolved while trying to |
| 16314 | +** expand a filename in xFullPathname() in the VFS. |
| 16315 | +*/ |
| 16316 | +#ifndef SQLITE_MAX_SYMLINK |
| 16317 | +# define SQLITE_MAX_SYMLINK 200 |
| 16318 | +#endif |
| 16288 | 16319 | |
| 16289 | 16320 | /* |
| 16290 | 16321 | ** The default size of a disk sector |
| 16291 | 16322 | */ |
| 16292 | 16323 | #ifndef SQLITE_DEFAULT_SECTOR_SIZE |
| | @@ -17051,10 +17082,12 @@ |
| 17051 | 17082 | /* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */ |
| 17052 | 17083 | #define SQLITE_BloomFilter 0x00080000 /* Use a Bloom filter on searches */ |
| 17053 | 17084 | #define SQLITE_BloomPulldown 0x00100000 /* Run Bloom filters early */ |
| 17054 | 17085 | #define SQLITE_BalancedMerge 0x00200000 /* Balance multi-way merges */ |
| 17055 | 17086 | #define SQLITE_ReleaseReg 0x00400000 /* Use OP_ReleaseReg for testing */ |
| 17087 | +#define SQLITE_FlttnUnionAll 0x00800000 /* Disable the UNION ALL flattener */ |
| 17088 | + /* TH3 expects this value ^^^^^^^^^^ See flatten04.test */ |
| 17056 | 17089 | #define SQLITE_AllOpts 0xffffffff /* All optimizations */ |
| 17057 | 17090 | |
| 17058 | 17091 | /* |
| 17059 | 17092 | ** Macros for testing whether or not optimizations are enabled or disabled. |
| 17060 | 17093 | */ |
| | @@ -17153,11 +17186,11 @@ |
| 17153 | 17186 | #define SQLITE_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */ |
| 17154 | 17187 | #define SQLITE_FUNC_MINMAX 0x1000 /* True for min() and max() aggregates */ |
| 17155 | 17188 | #define SQLITE_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a |
| 17156 | 17189 | ** single query - might change over time */ |
| 17157 | 17190 | #define SQLITE_FUNC_TEST 0x4000 /* Built-in testing functions */ |
| 17158 | | -#define SQLITE_FUNC_OFFSET 0x8000 /* Built-in sqlite_offset() function */ |
| 17191 | +/* 0x8000 -- available for reuse */ |
| 17159 | 17192 | #define SQLITE_FUNC_WINDOW 0x00010000 /* Built-in window-only function */ |
| 17160 | 17193 | #define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */ |
| 17161 | 17194 | #define SQLITE_FUNC_DIRECT 0x00080000 /* Not for use in TRIGGERs or VIEWs */ |
| 17162 | 17195 | #define SQLITE_FUNC_SUBTYPE 0x00100000 /* Result likely to have sub-type */ |
| 17163 | 17196 | #define SQLITE_FUNC_UNSAFE 0x00200000 /* Function has side effects */ |
| | @@ -17170,10 +17203,11 @@ |
| 17170 | 17203 | #define INLINEFUNC_implies_nonnull_row 1 |
| 17171 | 17204 | #define INLINEFUNC_expr_implies_expr 2 |
| 17172 | 17205 | #define INLINEFUNC_expr_compare 3 |
| 17173 | 17206 | #define INLINEFUNC_affinity 4 |
| 17174 | 17207 | #define INLINEFUNC_iif 5 |
| 17208 | +#define INLINEFUNC_sqlite_offset 6 |
| 17175 | 17209 | #define INLINEFUNC_unlikely 99 /* Default case */ |
| 17176 | 17210 | |
| 17177 | 17211 | /* |
| 17178 | 17212 | ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are |
| 17179 | 17213 | ** used to create the initializers for the FuncDef structures. |
| | @@ -17396,10 +17430,11 @@ |
| 17396 | 17430 | #define COLFLAG_VIRTUAL 0x0020 /* GENERATED ALWAYS AS ... VIRTUAL */ |
| 17397 | 17431 | #define COLFLAG_STORED 0x0040 /* GENERATED ALWAYS AS ... STORED */ |
| 17398 | 17432 | #define COLFLAG_NOTAVAIL 0x0080 /* STORED column not yet calculated */ |
| 17399 | 17433 | #define COLFLAG_BUSY 0x0100 /* Blocks recursion on GENERATED columns */ |
| 17400 | 17434 | #define COLFLAG_HASCOLL 0x0200 /* Has collating sequence name in zCnName */ |
| 17435 | +#define COLFLAG_NOEXPAND 0x0400 /* Omit this column when expanding "*" */ |
| 17401 | 17436 | #define COLFLAG_GENERATED 0x0060 /* Combo: _STORED, _VIRTUAL */ |
| 17402 | 17437 | #define COLFLAG_NOINSERT 0x0062 /* Combo: _HIDDEN, _STORED, _VIRTUAL */ |
| 17403 | 17438 | |
| 17404 | 17439 | /* |
| 17405 | 17440 | ** A "Collating Sequence" is defined by an instance of the following |
| | @@ -18115,11 +18150,11 @@ |
| 18115 | 18150 | ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. |
| 18116 | 18151 | ** TK_VARIABLE: variable number (always >= 1). |
| 18117 | 18152 | ** TK_SELECT_COLUMN: column of the result vector */ |
| 18118 | 18153 | i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ |
| 18119 | 18154 | union { |
| 18120 | | - int iJoin; /* If EP_FromJoin, the right table of the join */ |
| 18155 | + int iJoin; /* If EP_OuterON or EP_InnerON, the right table */ |
| 18121 | 18156 | int iOfst; /* else: start of token from start of statement */ |
| 18122 | 18157 | } w; |
| 18123 | 18158 | AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ |
| 18124 | 18159 | union { |
| 18125 | 18160 | Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL |
| | @@ -18136,33 +18171,33 @@ |
| 18136 | 18171 | ** Value restrictions: |
| 18137 | 18172 | ** |
| 18138 | 18173 | ** EP_Agg == NC_HasAgg == SF_HasAgg |
| 18139 | 18174 | ** EP_Win == NC_HasWin |
| 18140 | 18175 | */ |
| 18141 | | -#define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */ |
| 18142 | | -#define EP_Distinct 0x000002 /* Aggregate function with DISTINCT keyword */ |
| 18143 | | -#define EP_HasFunc 0x000004 /* Contains one or more functions of any kind */ |
| 18144 | | -#define EP_FixedCol 0x000008 /* TK_Column with a known fixed value */ |
| 18176 | +#define EP_OuterON 0x000001 /* Originates in ON/USING clause of outer join */ |
| 18177 | +#define EP_InnerON 0x000002 /* Originates in ON/USING of an inner join */ |
| 18178 | +#define EP_Distinct 0x000004 /* Aggregate function with DISTINCT keyword */ |
| 18179 | +#define EP_HasFunc 0x000008 /* Contains one or more functions of any kind */ |
| 18145 | 18180 | #define EP_Agg 0x000010 /* Contains one or more aggregate functions */ |
| 18146 | | -#define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */ |
| 18147 | | -#define EP_DblQuoted 0x000040 /* token.z was originally in "..." */ |
| 18148 | | -#define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */ |
| 18149 | | -#define EP_Collate 0x000100 /* Tree contains a TK_COLLATE operator */ |
| 18150 | | -#define EP_Commuted 0x000200 /* Comparison operator has been commuted */ |
| 18151 | | -#define EP_IntValue 0x000400 /* Integer value contained in u.iValue */ |
| 18152 | | -#define EP_xIsSelect 0x000800 /* x.pSelect is valid (otherwise x.pList is) */ |
| 18153 | | -#define EP_Skip 0x001000 /* Operator does not contribute to affinity */ |
| 18154 | | -#define EP_Reduced 0x002000 /* Expr struct EXPR_REDUCEDSIZE bytes only */ |
| 18155 | | -#define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */ |
| 18181 | +#define EP_FixedCol 0x000020 /* TK_Column with a known fixed value */ |
| 18182 | +#define EP_VarSelect 0x000040 /* pSelect is correlated, not constant */ |
| 18183 | +#define EP_DblQuoted 0x000080 /* token.z was originally in "..." */ |
| 18184 | +#define EP_InfixFunc 0x000100 /* True for an infix function: LIKE, GLOB, etc */ |
| 18185 | +#define EP_Collate 0x000200 /* Tree contains a TK_COLLATE operator */ |
| 18186 | +#define EP_Commuted 0x000400 /* Comparison operator has been commuted */ |
| 18187 | +#define EP_IntValue 0x000800 /* Integer value contained in u.iValue */ |
| 18188 | +#define EP_xIsSelect 0x001000 /* x.pSelect is valid (otherwise x.pList is) */ |
| 18189 | +#define EP_Skip 0x002000 /* Operator does not contribute to affinity */ |
| 18190 | +#define EP_Reduced 0x004000 /* Expr struct EXPR_REDUCEDSIZE bytes only */ |
| 18156 | 18191 | #define EP_Win 0x008000 /* Contains window functions */ |
| 18157 | | -#define EP_MemToken 0x010000 /* Need to sqlite3DbFree() Expr.zToken */ |
| 18158 | | -#define EP_IfNullRow 0x020000 /* The TK_IF_NULL_ROW opcode */ |
| 18159 | | -#define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */ |
| 18160 | | -#define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */ |
| 18161 | | -#define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */ |
| 18162 | | -#define EP_Subquery 0x200000 /* Tree contains a TK_SELECT operator */ |
| 18163 | | -#define EP_InnerJoin 0x400000 /* Originates in ON/USING of an inner join */ |
| 18192 | +#define EP_TokenOnly 0x010000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */ |
| 18193 | +#define EP_MemToken 0x020000 /* Need to sqlite3DbFree() Expr.zToken */ |
| 18194 | +#define EP_IfNullRow 0x040000 /* The TK_IF_NULL_ROW opcode */ |
| 18195 | +#define EP_Unlikely 0x080000 /* unlikely() or likelihood() function */ |
| 18196 | +#define EP_ConstFunc 0x100000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */ |
| 18197 | +#define EP_CanBeNull 0x200000 /* Can be null despite NOT NULL constraint */ |
| 18198 | +#define EP_Subquery 0x400000 /* Tree contains a TK_SELECT operator */ |
| 18164 | 18199 | #define EP_Leaf 0x800000 /* Expr.pLeft, .pRight, .u.pSelect all NULL */ |
| 18165 | 18200 | #define EP_WinFunc 0x1000000 /* TK_FUNCTION with Expr.y.pWin set */ |
| 18166 | 18201 | #define EP_Subrtn 0x2000000 /* Uses Expr.y.sub. TK_IN, _SELECT, or _EXISTS */ |
| 18167 | 18202 | #define EP_Quoted 0x4000000 /* TK_ID was originally quoted */ |
| 18168 | 18203 | #define EP_Static 0x8000000 /* Held in memory not obtained from malloc() */ |
| | @@ -18181,12 +18216,12 @@ |
| 18181 | 18216 | */ |
| 18182 | 18217 | #define ExprHasProperty(E,P) (((E)->flags&(P))!=0) |
| 18183 | 18218 | #define ExprHasAllProperty(E,P) (((E)->flags&(P))==(P)) |
| 18184 | 18219 | #define ExprSetProperty(E,P) (E)->flags|=(P) |
| 18185 | 18220 | #define ExprClearProperty(E,P) (E)->flags&=~(P) |
| 18186 | | -#define ExprAlwaysTrue(E) (((E)->flags&(EP_FromJoin|EP_IsTrue))==EP_IsTrue) |
| 18187 | | -#define ExprAlwaysFalse(E) (((E)->flags&(EP_FromJoin|EP_IsFalse))==EP_IsFalse) |
| 18221 | +#define ExprAlwaysTrue(E) (((E)->flags&(EP_OuterON|EP_IsTrue))==EP_IsTrue) |
| 18222 | +#define ExprAlwaysFalse(E) (((E)->flags&(EP_OuterON|EP_IsFalse))==EP_IsFalse) |
| 18188 | 18223 | |
| 18189 | 18224 | /* Macros used to ensure that the correct members of unions are accessed |
| 18190 | 18225 | ** in Expr. |
| 18191 | 18226 | */ |
| 18192 | 18227 | #define ExprUseUToken(E) (((E)->flags&EP_IntValue)==0) |
| | @@ -18269,17 +18304,22 @@ |
| 18269 | 18304 | int nExpr; /* Number of expressions on the list */ |
| 18270 | 18305 | int nAlloc; /* Number of a[] slots allocated */ |
| 18271 | 18306 | struct ExprList_item { /* For each expression in the list */ |
| 18272 | 18307 | Expr *pExpr; /* The parse tree for this expression */ |
| 18273 | 18308 | char *zEName; /* Token associated with this expression */ |
| 18274 | | - u8 sortFlags; /* Mask of KEYINFO_ORDER_* flags */ |
| 18275 | | - unsigned eEName :2; /* Meaning of zEName */ |
| 18276 | | - unsigned done :1; /* A flag to indicate when processing is finished */ |
| 18277 | | - unsigned reusable :1; /* Constant expression is reusable */ |
| 18278 | | - unsigned bSorterRef :1; /* Defer evaluation until after sorting */ |
| 18279 | | - unsigned bNulls: 1; /* True if explicit "NULLS FIRST/LAST" */ |
| 18280 | | - unsigned bUsed: 1; /* This column used in a SF_NestedFrom subquery */ |
| 18309 | + struct { |
| 18310 | + u8 sortFlags; /* Mask of KEYINFO_ORDER_* flags */ |
| 18311 | + unsigned eEName :2; /* Meaning of zEName */ |
| 18312 | + unsigned done :1; /* Indicates when processing is finished */ |
| 18313 | + unsigned reusable :1; /* Constant expression is reusable */ |
| 18314 | + unsigned bSorterRef :1; /* Defer evaluation until after sorting */ |
| 18315 | + unsigned bNulls :1; /* True if explicit "NULLS FIRST/LAST" */ |
| 18316 | + unsigned bUsed :1; /* This column used in a SF_NestedFrom subquery */ |
| 18317 | + unsigned bUsingTerm:1; /* Term from the USING clause of a NestedFrom */ |
| 18318 | + unsigned bNoExpand: 1; /* Term is an auxiliary in NestedFrom and should |
| 18319 | + ** not be expanded by "*" in parent queries */ |
| 18320 | + } fg; |
| 18281 | 18321 | union { |
| 18282 | 18322 | struct { /* Used by any ExprList other than Parse.pConsExpr */ |
| 18283 | 18323 | u16 iOrderByCol; /* For ORDER BY, column number in result set */ |
| 18284 | 18324 | u16 iAlias; /* Index into Parse.aAlias[] for zName */ |
| 18285 | 18325 | } x; |
| | @@ -18356,10 +18396,11 @@ |
| 18356 | 18396 | u8 jointype; /* Type of join between this table and the previous */ |
| 18357 | 18397 | unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */ |
| 18358 | 18398 | unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */ |
| 18359 | 18399 | unsigned isTabFunc :1; /* True if table-valued-function syntax */ |
| 18360 | 18400 | unsigned isCorrelated :1; /* True if sub-query is correlated */ |
| 18401 | + unsigned isMaterialized:1; /* This is a materialized view */ |
| 18361 | 18402 | unsigned viaCoroutine :1; /* Implemented as a co-routine */ |
| 18362 | 18403 | unsigned isRecursive :1; /* True for recursive reference in WITH */ |
| 18363 | 18404 | unsigned fromDDL :1; /* Comes from sqlite_schema */ |
| 18364 | 18405 | unsigned isCte :1; /* This is a CTE */ |
| 18365 | 18406 | unsigned notCte :1; /* This item may not match a CTE */ |
| | @@ -19729,10 +19770,11 @@ |
| 19729 | 19770 | SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView*, const Expr*, u8); |
| 19730 | 19771 | SQLITE_PRIVATE void sqlite3TreeViewBareExprList(TreeView*, const ExprList*, const char*); |
| 19731 | 19772 | SQLITE_PRIVATE void sqlite3TreeViewExprList(TreeView*, const ExprList*, u8, const char*); |
| 19732 | 19773 | SQLITE_PRIVATE void sqlite3TreeViewBareIdList(TreeView*, const IdList*, const char*); |
| 19733 | 19774 | SQLITE_PRIVATE void sqlite3TreeViewIdList(TreeView*, const IdList*, u8, const char*); |
| 19775 | +SQLITE_PRIVATE void sqlite3TreeViewColumnList(TreeView*, const Column*, int, u8); |
| 19734 | 19776 | SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView*, const SrcList*); |
| 19735 | 19777 | SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView*, const Select*, u8); |
| 19736 | 19778 | SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView*, const With*, u8); |
| 19737 | 19779 | SQLITE_PRIVATE void sqlite3TreeViewUpsert(TreeView*, const Upsert*, u8); |
| 19738 | 19780 | SQLITE_PRIVATE void sqlite3TreeViewDelete(const With*, const SrcList*, const Expr*, |
| | @@ -20022,10 +20064,11 @@ |
| 20022 | 20064 | SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*); |
| 20023 | 20065 | SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*); |
| 20024 | 20066 | SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8); |
| 20025 | 20067 | SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*); |
| 20026 | 20068 | SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int); |
| 20069 | +SQLITE_PRIVATE int sqlite3ExprIsTableConstraint(Expr*,const SrcItem*); |
| 20027 | 20070 | #ifdef SQLITE_ENABLE_CURSOR_HINTS |
| 20028 | 20071 | SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*); |
| 20029 | 20072 | #endif |
| 20030 | 20073 | SQLITE_PRIVATE int sqlite3ExprIsInteger(const Expr*, int*); |
| 20031 | 20074 | SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*); |
| | @@ -30462,12 +30505,18 @@ |
| 30462 | 30505 | sqlite3_str_append(pAccum, ".", 1); |
| 30463 | 30506 | } |
| 30464 | 30507 | sqlite3_str_appendall(pAccum, pItem->zName); |
| 30465 | 30508 | }else if( pItem->zAlias ){ |
| 30466 | 30509 | sqlite3_str_appendall(pAccum, pItem->zAlias); |
| 30467 | | - }else if( ALWAYS(pItem->pSelect) ){ |
| 30468 | | - sqlite3_str_appendf(pAccum, "SUBQUERY %u", pItem->pSelect->selId); |
| 30510 | + }else{ |
| 30511 | + Select *pSel = pItem->pSelect; |
| 30512 | + assert( pSel!=0 ); |
| 30513 | + if( pSel->selFlags & SF_NestedFrom ){ |
| 30514 | + sqlite3_str_appendf(pAccum, "(join-%u)", pSel->selId); |
| 30515 | + }else{ |
| 30516 | + sqlite3_str_appendf(pAccum, "(subquery-%u)", pSel->selId); |
| 30517 | + } |
| 30469 | 30518 | } |
| 30470 | 30519 | length = width = 0; |
| 30471 | 30520 | break; |
| 30472 | 30521 | } |
| 30473 | 30522 | default: { |
| | @@ -30526,11 +30575,13 @@ |
| 30526 | 30575 | /* |
| 30527 | 30576 | ** If pExpr has a byte offset for the start of a token, record that as |
| 30528 | 30577 | ** as the error offset. |
| 30529 | 30578 | */ |
| 30530 | 30579 | SQLITE_PRIVATE void sqlite3RecordErrorOffsetOfExpr(sqlite3 *db, const Expr *pExpr){ |
| 30531 | | - while( pExpr && (ExprHasProperty(pExpr,EP_FromJoin) || pExpr->w.iOfst<=0) ){ |
| 30580 | + while( pExpr |
| 30581 | + && (ExprHasProperty(pExpr,EP_OuterON|EP_InnerON) || pExpr->w.iOfst<=0) |
| 30582 | + ){ |
| 30532 | 30583 | pExpr = pExpr->pLeft; |
| 30533 | 30584 | } |
| 30534 | 30585 | if( pExpr==0 ) return; |
| 30535 | 30586 | db->errByteOffset = pExpr->w.iOfst; |
| 30536 | 30587 | } |
| | @@ -31047,10 +31098,57 @@ |
| 31047 | 31098 | */ |
| 31048 | 31099 | static void sqlite3TreeViewItem(TreeView *p, const char *zLabel,u8 moreFollows){ |
| 31049 | 31100 | sqlite3TreeViewPush(&p, moreFollows); |
| 31050 | 31101 | sqlite3TreeViewLine(p, "%s", zLabel); |
| 31051 | 31102 | } |
| 31103 | + |
| 31104 | +/* |
| 31105 | +** Show a list of Column objects in tree format. |
| 31106 | +*/ |
| 31107 | +SQLITE_PRIVATE void sqlite3TreeViewColumnList( |
| 31108 | + TreeView *pView, |
| 31109 | + const Column *aCol, |
| 31110 | + int nCol, |
| 31111 | + u8 moreToFollow |
| 31112 | +){ |
| 31113 | + int i; |
| 31114 | + sqlite3TreeViewPush(&pView, moreToFollow); |
| 31115 | + sqlite3TreeViewLine(pView, "COLUMNS"); |
| 31116 | + for(i=0; i<nCol; i++){ |
| 31117 | + u16 flg = aCol[i].colFlags; |
| 31118 | + int moreToFollow = i<(nCol - 1); |
| 31119 | + sqlite3TreeViewPush(&pView, moreToFollow); |
| 31120 | + sqlite3TreeViewLine(pView, 0); |
| 31121 | + printf(" %s", aCol[i].zCnName); |
| 31122 | + switch( aCol[i].eCType ){ |
| 31123 | + case COLTYPE_ANY: printf(" ANY"); break; |
| 31124 | + case COLTYPE_BLOB: printf(" BLOB"); break; |
| 31125 | + case COLTYPE_INT: printf(" INT"); break; |
| 31126 | + case COLTYPE_INTEGER: printf(" INTEGER"); break; |
| 31127 | + case COLTYPE_REAL: printf(" REAL"); break; |
| 31128 | + case COLTYPE_TEXT: printf(" TEXT"); break; |
| 31129 | + case COLTYPE_CUSTOM: { |
| 31130 | + if( flg & COLFLAG_HASTYPE ){ |
| 31131 | + const char *z = aCol[i].zCnName; |
| 31132 | + z += strlen(z)+1; |
| 31133 | + printf(" X-%s", z); |
| 31134 | + break; |
| 31135 | + } |
| 31136 | + } |
| 31137 | + } |
| 31138 | + if( flg & COLFLAG_PRIMKEY ) printf(" PRIMARY KEY"); |
| 31139 | + if( flg & COLFLAG_HIDDEN ) printf(" HIDDEN"); |
| 31140 | +#ifdef COLFLAG_NOEXPAND |
| 31141 | + if( flg & COLFLAG_NOEXPAND ) printf(" NO-EXPAND"); |
| 31142 | +#endif |
| 31143 | + if( flg ) printf(" flags=%04x", flg); |
| 31144 | + printf("\n"); |
| 31145 | + fflush(stdout); |
| 31146 | + sqlite3TreeViewPop(&pView); |
| 31147 | + } |
| 31148 | + sqlite3TreeViewPop(&pView); |
| 31149 | +} |
| 31052 | 31150 | |
| 31053 | 31151 | /* |
| 31054 | 31152 | ** Generate a human-readable description of a WITH clause. |
| 31055 | 31153 | */ |
| 31056 | 31154 | SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView *pView, const With *pWith, u8 moreToFollow){ |
| | @@ -31077,10 +31175,14 @@ |
| 31077 | 31175 | sqlite3_str_appendf(&x, "%c%s", cSep, pCte->pCols->a[j].zEName); |
| 31078 | 31176 | cSep = ','; |
| 31079 | 31177 | } |
| 31080 | 31178 | sqlite3_str_appendf(&x, ")"); |
| 31081 | 31179 | } |
| 31180 | + if( pCte->eM10d!=M10d_Any ){ |
| 31181 | + sqlite3_str_appendf(&x, " %sMATERIALIZED", |
| 31182 | + pCte->eM10d==M10d_No ? "NOT " : ""); |
| 31183 | + } |
| 31082 | 31184 | if( pCte->pUse ){ |
| 31083 | 31185 | sqlite3_str_appendf(&x, " (pUse=0x%p, nUse=%d)", pCte->pUse, |
| 31084 | 31186 | pCte->pUse->nUse); |
| 31085 | 31187 | } |
| 31086 | 31188 | sqlite3StrAccumFinish(&x); |
| | @@ -31099,10 +31201,11 @@ |
| 31099 | 31201 | int i; |
| 31100 | 31202 | if( pSrc==0 ) return; |
| 31101 | 31203 | for(i=0; i<pSrc->nSrc; i++){ |
| 31102 | 31204 | const SrcItem *pItem = &pSrc->a[i]; |
| 31103 | 31205 | StrAccum x; |
| 31206 | + int n = 0; |
| 31104 | 31207 | char zLine[100]; |
| 31105 | 31208 | sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0); |
| 31106 | 31209 | x.printfFlags |= SQLITE_PRINTF_INTERNAL; |
| 31107 | 31210 | sqlite3_str_appendf(&x, "{%d:*} %!S", pItem->iCursor, pItem); |
| 31108 | 31211 | if( pItem->pTab ){ |
| | @@ -31127,13 +31230,24 @@ |
| 31127 | 31230 | if( pItem->fg.isCte ){ |
| 31128 | 31231 | sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse); |
| 31129 | 31232 | } |
| 31130 | 31233 | sqlite3StrAccumFinish(&x); |
| 31131 | 31234 | sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1); |
| 31235 | + n = 0; |
| 31236 | + if( pItem->pSelect ) n++; |
| 31237 | + if( pItem->fg.isTabFunc ) n++; |
| 31238 | + if( pItem->fg.isUsing ) n++; |
| 31239 | + if( pItem->fg.isUsing ){ |
| 31240 | + sqlite3TreeViewIdList(pView, pItem->u3.pUsing, (--n)>0, "USING"); |
| 31241 | + } |
| 31132 | 31242 | if( pItem->pSelect ){ |
| 31243 | + if( pItem->pTab ){ |
| 31244 | + Table *pTab = pItem->pTab; |
| 31245 | + sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1); |
| 31246 | + } |
| 31133 | 31247 | assert( pItem->fg.isNestedFrom == IsNestedFrom(pItem->pSelect) ); |
| 31134 | | - sqlite3TreeViewSelect(pView, pItem->pSelect, 0); |
| 31248 | + sqlite3TreeViewSelect(pView, pItem->pSelect, (--n)>0); |
| 31135 | 31249 | } |
| 31136 | 31250 | if( pItem->fg.isTabFunc ){ |
| 31137 | 31251 | sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:"); |
| 31138 | 31252 | } |
| 31139 | 31253 | sqlite3TreeViewPop(&pView); |
| | @@ -31296,10 +31410,11 @@ |
| 31296 | 31410 | /* |
| 31297 | 31411 | ** Generate a human-readable explanation for a Window object |
| 31298 | 31412 | */ |
| 31299 | 31413 | SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u8 more){ |
| 31300 | 31414 | int nElement = 0; |
| 31415 | + if( pWin==0 ) return; |
| 31301 | 31416 | if( pWin->pFilter ){ |
| 31302 | 31417 | sqlite3TreeViewItem(pView, "FILTER", 1); |
| 31303 | 31418 | sqlite3TreeViewExpr(pView, pWin->pFilter, 0); |
| 31304 | 31419 | sqlite3TreeViewPop(&pView); |
| 31305 | 31420 | } |
| | @@ -31360,10 +31475,11 @@ |
| 31360 | 31475 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 31361 | 31476 | /* |
| 31362 | 31477 | ** Generate a human-readable explanation for a Window Function object |
| 31363 | 31478 | */ |
| 31364 | 31479 | SQLITE_PRIVATE void sqlite3TreeViewWinFunc(TreeView *pView, const Window *pWin, u8 more){ |
| 31480 | + if( pWin==0 ) return; |
| 31365 | 31481 | sqlite3TreeViewPush(&pView, more); |
| 31366 | 31482 | sqlite3TreeViewLine(pView, "WINFUNC %s(%d)", |
| 31367 | 31483 | pWin->pWFunc->zName, pWin->pWFunc->nArg); |
| 31368 | 31484 | sqlite3TreeViewWindow(pView, pWin, 0); |
| 31369 | 31485 | sqlite3TreeViewPop(&pView); |
| | @@ -31386,12 +31502,15 @@ |
| 31386 | 31502 | if( pExpr->flags || pExpr->affExpr || pExpr->vvaFlags ){ |
| 31387 | 31503 | StrAccum x; |
| 31388 | 31504 | sqlite3StrAccumInit(&x, 0, zFlgs, sizeof(zFlgs), 0); |
| 31389 | 31505 | sqlite3_str_appendf(&x, " fg.af=%x.%c", |
| 31390 | 31506 | pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n'); |
| 31391 | | - if( ExprHasProperty(pExpr, EP_FromJoin) ){ |
| 31392 | | - sqlite3_str_appendf(&x, " iJoin=%d", pExpr->w.iJoin); |
| 31507 | + if( ExprHasProperty(pExpr, EP_OuterON) ){ |
| 31508 | + sqlite3_str_appendf(&x, " outer.iJoin=%d", pExpr->w.iJoin); |
| 31509 | + } |
| 31510 | + if( ExprHasProperty(pExpr, EP_InnerON) ){ |
| 31511 | + sqlite3_str_appendf(&x, " inner.iJoin=%d", pExpr->w.iJoin); |
| 31393 | 31512 | } |
| 31394 | 31513 | if( ExprHasProperty(pExpr, EP_FromDDL) ){ |
| 31395 | 31514 | sqlite3_str_appendf(&x, " DDL"); |
| 31396 | 31515 | } |
| 31397 | 31516 | if( ExprHasVVAProperty(pExpr, EP_Immutable) ){ |
| | @@ -31611,11 +31730,21 @@ |
| 31611 | 31730 | sqlite3TreeViewLine(pView, "subquery-expr flags=0x%x", pExpr->flags); |
| 31612 | 31731 | sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); |
| 31613 | 31732 | break; |
| 31614 | 31733 | } |
| 31615 | 31734 | case TK_IN: { |
| 31616 | | - sqlite3TreeViewLine(pView, "IN flags=0x%x", pExpr->flags); |
| 31735 | + sqlite3_str *pStr = sqlite3_str_new(0); |
| 31736 | + char *z; |
| 31737 | + sqlite3_str_appendf(pStr, "IN flags=0x%x", pExpr->flags); |
| 31738 | + if( pExpr->iTable ) sqlite3_str_appendf(pStr, " iTable=%d",pExpr->iTable); |
| 31739 | + if( ExprHasProperty(pExpr, EP_Subrtn) ){ |
| 31740 | + sqlite3_str_appendf(pStr, " subrtn(%d,%d)", |
| 31741 | + pExpr->y.sub.regReturn, pExpr->y.sub.iAddr); |
| 31742 | + } |
| 31743 | + z = sqlite3_str_finish(pStr); |
| 31744 | + sqlite3TreeViewLine(pView, z); |
| 31745 | + sqlite3_free(z); |
| 31617 | 31746 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 1); |
| 31618 | 31747 | if( ExprUseXSelect(pExpr) ){ |
| 31619 | 31748 | sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); |
| 31620 | 31749 | }else{ |
| 31621 | 31750 | sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0); |
| | @@ -31762,17 +31891,19 @@ |
| 31762 | 31891 | if( j || zName ){ |
| 31763 | 31892 | sqlite3TreeViewPush(&pView, moreToFollow); |
| 31764 | 31893 | moreToFollow = 0; |
| 31765 | 31894 | sqlite3TreeViewLine(pView, 0); |
| 31766 | 31895 | if( zName ){ |
| 31767 | | - switch( pList->a[i].eEName ){ |
| 31896 | + switch( pList->a[i].fg.eEName ){ |
| 31768 | 31897 | default: |
| 31769 | 31898 | fprintf(stdout, "AS %s ", zName); |
| 31770 | 31899 | break; |
| 31771 | 31900 | case ENAME_TAB: |
| 31772 | 31901 | fprintf(stdout, "TABLE-ALIAS-NAME(\"%s\") ", zName); |
| 31773 | | - if( pList->a[i].bUsed==0 ) fprintf(stdout, "(unused) "); |
| 31902 | + if( pList->a[i].fg.bUsed ) fprintf(stdout, "(used) "); |
| 31903 | + if( pList->a[i].fg.bUsingTerm ) fprintf(stdout, "(USING-term) "); |
| 31904 | + if( pList->a[i].fg.bNoExpand ) fprintf(stdout, "(NoExpand) "); |
| 31774 | 31905 | break; |
| 31775 | 31906 | case ENAME_SPAN: |
| 31776 | 31907 | fprintf(stdout, "SPAN(\"%s\") ", zName); |
| 31777 | 31908 | break; |
| 31778 | 31909 | } |
| | @@ -41741,90 +41872,103 @@ |
| 41741 | 41872 | } |
| 41742 | 41873 | return SQLITE_OK; |
| 41743 | 41874 | } |
| 41744 | 41875 | |
| 41745 | 41876 | /* |
| 41746 | | -** If the last component of the pathname in z[0]..z[j-1] is something |
| 41747 | | -** other than ".." then back it out and return true. If the last |
| 41748 | | -** component is empty or if it is ".." then return false. |
| 41749 | | -*/ |
| 41750 | | -static int unixBackupDir(const char *z, int *pJ){ |
| 41751 | | - int j = *pJ; |
| 41752 | | - int i; |
| 41753 | | - if( j<=0 ) return 0; |
| 41754 | | - for(i=j-1; i>0 && z[i-1]!='/'; i--){} |
| 41755 | | - if( i==0 ) return 0; |
| 41756 | | - if( z[i]=='.' && i==j-2 && z[i+1]=='.' ) return 0; |
| 41757 | | - *pJ = i-1; |
| 41758 | | - return 1; |
| 41759 | | -} |
| 41760 | | - |
| 41761 | | -/* |
| 41762 | | -** Convert a relative pathname into a full pathname. Also |
| 41763 | | -** simplify the pathname as follows: |
| 41764 | | -** |
| 41765 | | -** Remove all instances of /./ |
| 41766 | | -** Remove all isntances of /X/../ for any X |
| 41767 | | -*/ |
| 41768 | | -static int mkFullPathname( |
| 41769 | | - const char *zPath, /* Input path */ |
| 41770 | | - char *zOut, /* Output buffer */ |
| 41771 | | - int nOut /* Allocated size of buffer zOut */ |
| 41772 | | -){ |
| 41773 | | - int nPath = sqlite3Strlen30(zPath); |
| 41774 | | - int iOff = 0; |
| 41775 | | - int i, j; |
| 41776 | | - if( zPath[0]!='/' ){ |
| 41777 | | - if( osGetcwd(zOut, nOut-2)==0 ){ |
| 41778 | | - return unixLogError(SQLITE_CANTOPEN_BKPT, "getcwd", zPath); |
| 41779 | | - } |
| 41780 | | - iOff = sqlite3Strlen30(zOut); |
| 41781 | | - zOut[iOff++] = '/'; |
| 41782 | | - } |
| 41783 | | - if( (iOff+nPath+1)>nOut ){ |
| 41784 | | - /* SQLite assumes that xFullPathname() nul-terminates the output buffer |
| 41785 | | - ** even if it returns an error. */ |
| 41786 | | - zOut[iOff] = '\0'; |
| 41787 | | - return SQLITE_CANTOPEN_BKPT; |
| 41788 | | - } |
| 41789 | | - sqlite3_snprintf(nOut-iOff, &zOut[iOff], "%s", zPath); |
| 41790 | | - |
| 41791 | | - /* Remove duplicate '/' characters. Except, two // at the beginning |
| 41792 | | - ** of a pathname is allowed since this is important on windows. */ |
| 41793 | | - for(i=j=1; zOut[i]; i++){ |
| 41794 | | - zOut[j++] = zOut[i]; |
| 41795 | | - while( zOut[i]=='/' && zOut[i+1]=='/' ) i++; |
| 41796 | | - } |
| 41797 | | - zOut[j] = 0; |
| 41798 | | - |
| 41799 | | - assert( zOut[0]=='/' ); |
| 41800 | | - for(i=j=0; zOut[i]; i++){ |
| 41801 | | - if( zOut[i]=='/' ){ |
| 41802 | | - /* Skip over internal "/." directory components */ |
| 41803 | | - if( zOut[i+1]=='.' && zOut[i+2]=='/' ){ |
| 41804 | | - i += 1; |
| 41805 | | - continue; |
| 41806 | | - } |
| 41807 | | - |
| 41808 | | - /* If this is a "/.." directory component then back out the |
| 41809 | | - ** previous term of the directory if it is something other than "..". |
| 41810 | | - */ |
| 41811 | | - if( zOut[i+1]=='.' |
| 41812 | | - && zOut[i+2]=='.' |
| 41813 | | - && zOut[i+3]=='/' |
| 41814 | | - && unixBackupDir(zOut, &j) |
| 41815 | | - ){ |
| 41816 | | - i += 2; |
| 41817 | | - continue; |
| 41818 | | - } |
| 41819 | | - } |
| 41820 | | - if( ALWAYS(j>=0) ) zOut[j] = zOut[i]; |
| 41821 | | - j++; |
| 41822 | | - } |
| 41823 | | - if( NEVER(j==0) ) zOut[j++] = '/'; |
| 41824 | | - zOut[j] = 0; |
| 41825 | | - return SQLITE_OK; |
| 41877 | +** A pathname under construction |
| 41878 | +*/ |
| 41879 | +typedef struct DbPath DbPath; |
| 41880 | +struct DbPath { |
| 41881 | + int rc; /* Non-zero following any error */ |
| 41882 | + int nSymlink; /* Number of symlinks resolved */ |
| 41883 | + char *zOut; /* Write the pathname here */ |
| 41884 | + int nOut; /* Bytes of space available to zOut[] */ |
| 41885 | + int nUsed; /* Bytes of zOut[] currently being used */ |
| 41886 | +}; |
| 41887 | + |
| 41888 | +/* Forward reference */ |
| 41889 | +static void appendAllPathElements(DbPath*,const char*); |
| 41890 | + |
| 41891 | +/* |
| 41892 | +** Append a single path element to the DbPath under construction |
| 41893 | +*/ |
| 41894 | +static void appendOnePathElement( |
| 41895 | + DbPath *pPath, /* Path under construction, to which to append zName */ |
| 41896 | + const char *zName, /* Name to append to pPath. Not zero-terminated */ |
| 41897 | + int nName /* Number of significant bytes in zName */ |
| 41898 | +){ |
| 41899 | + assert( nName>0 ); |
| 41900 | + assert( zName!=0 ); |
| 41901 | + if( zName[0]=='.' ){ |
| 41902 | + if( nName==1 ) return; |
| 41903 | + if( zName[1]=='.' && nName==2 ){ |
| 41904 | + if( pPath->nUsed<=1 ){ |
| 41905 | + pPath->rc = SQLITE_ERROR; |
| 41906 | + return; |
| 41907 | + } |
| 41908 | + assert( pPath->zOut[0]=='/' ); |
| 41909 | + while( pPath->zOut[--pPath->nUsed]!='/' ){} |
| 41910 | + return; |
| 41911 | + } |
| 41912 | + } |
| 41913 | + if( pPath->nUsed + nName + 2 >= pPath->nOut ){ |
| 41914 | + pPath->rc = SQLITE_ERROR; |
| 41915 | + return; |
| 41916 | + } |
| 41917 | + pPath->zOut[pPath->nUsed++] = '/'; |
| 41918 | + memcpy(&pPath->zOut[pPath->nUsed], zName, nName); |
| 41919 | + pPath->nUsed += nName; |
| 41920 | +#if defined(HAVE_READLINK) && defined(HAVE_LSTAT) |
| 41921 | + if( pPath->rc==SQLITE_OK ){ |
| 41922 | + const char *zIn; |
| 41923 | + struct stat buf; |
| 41924 | + pPath->zOut[pPath->nUsed] = 0; |
| 41925 | + zIn = pPath->zOut; |
| 41926 | + if( osLstat(zIn, &buf)!=0 ){ |
| 41927 | + if( errno!=ENOENT ){ |
| 41928 | + pPath->rc = unixLogError(SQLITE_CANTOPEN_BKPT, "lstat", zIn); |
| 41929 | + } |
| 41930 | + }else if( S_ISLNK(buf.st_mode) ){ |
| 41931 | + ssize_t got; |
| 41932 | + char zLnk[SQLITE_MAX_PATHLEN+2]; |
| 41933 | + if( pPath->nSymlink++ > SQLITE_MAX_SYMLINK ){ |
| 41934 | + pPath->rc = SQLITE_CANTOPEN_BKPT; |
| 41935 | + return; |
| 41936 | + } |
| 41937 | + got = osReadlink(zIn, zLnk, sizeof(zLnk)-2); |
| 41938 | + if( got<=0 || got>=(ssize_t)sizeof(zLnk)-2 ){ |
| 41939 | + pPath->rc = unixLogError(SQLITE_CANTOPEN_BKPT, "readlink", zIn); |
| 41940 | + return; |
| 41941 | + } |
| 41942 | + zLnk[got] = 0; |
| 41943 | + if( zLnk[0]=='/' ){ |
| 41944 | + pPath->nUsed = 0; |
| 41945 | + }else{ |
| 41946 | + pPath->nUsed -= nName + 1; |
| 41947 | + } |
| 41948 | + appendAllPathElements(pPath, zLnk); |
| 41949 | + } |
| 41950 | + } |
| 41951 | +#endif |
| 41952 | +} |
| 41953 | + |
| 41954 | +/* |
| 41955 | +** Append all path elements in zPath to the DbPath under construction. |
| 41956 | +*/ |
| 41957 | +static void appendAllPathElements( |
| 41958 | + DbPath *pPath, /* Path under construction, to which to append zName */ |
| 41959 | + const char *zPath /* Path to append to pPath. Is zero-terminated */ |
| 41960 | +){ |
| 41961 | + int i = 0; |
| 41962 | + int j = 0; |
| 41963 | + do{ |
| 41964 | + while( zPath[i] && zPath[i]!='/' ){ i++; } |
| 41965 | + if( i>j ){ |
| 41966 | + appendOnePathElement(pPath, &zPath[j], i-j); |
| 41967 | + } |
| 41968 | + j = i+1; |
| 41969 | + }while( zPath[i++] ); |
| 41826 | 41970 | } |
| 41827 | 41971 | |
| 41828 | 41972 | /* |
| 41829 | 41973 | ** Turn a relative pathname into a full pathname. The relative path |
| 41830 | 41974 | ** is stored as a nul-terminated string in the buffer pointed to by |
| | @@ -41838,89 +41982,30 @@ |
| 41838 | 41982 | sqlite3_vfs *pVfs, /* Pointer to vfs object */ |
| 41839 | 41983 | const char *zPath, /* Possibly relative input path */ |
| 41840 | 41984 | int nOut, /* Size of output buffer in bytes */ |
| 41841 | 41985 | char *zOut /* Output buffer */ |
| 41842 | 41986 | ){ |
| 41843 | | -#if !defined(HAVE_READLINK) || !defined(HAVE_LSTAT) |
| 41844 | | - return mkFullPathname(zPath, zOut, nOut); |
| 41845 | | -#else |
| 41846 | | - int rc = SQLITE_OK; |
| 41847 | | - int nByte; |
| 41848 | | - int nLink = 0; /* Number of symbolic links followed so far */ |
| 41849 | | - const char *zIn = zPath; /* Input path for each iteration of loop */ |
| 41850 | | - char *zDel = 0; |
| 41851 | | - |
| 41852 | | - assert( pVfs->mxPathname==MAX_PATHNAME ); |
| 41987 | + DbPath path; |
| 41853 | 41988 | UNUSED_PARAMETER(pVfs); |
| 41854 | | - |
| 41855 | | - /* It's odd to simulate an io-error here, but really this is just |
| 41856 | | - ** using the io-error infrastructure to test that SQLite handles this |
| 41857 | | - ** function failing. This function could fail if, for example, the |
| 41858 | | - ** current working directory has been unlinked. |
| 41859 | | - */ |
| 41860 | | - SimulateIOError( return SQLITE_ERROR ); |
| 41861 | | - |
| 41862 | | - do { |
| 41863 | | - |
| 41864 | | - /* Call stat() on path zIn. Set bLink to true if the path is a symbolic |
| 41865 | | - ** link, or false otherwise. */ |
| 41866 | | - int bLink = 0; |
| 41867 | | - struct stat buf; |
| 41868 | | - if( osLstat(zIn, &buf)!=0 ){ |
| 41869 | | - if( errno!=ENOENT ){ |
| 41870 | | - rc = unixLogError(SQLITE_CANTOPEN_BKPT, "lstat", zIn); |
| 41871 | | - } |
| 41872 | | - }else{ |
| 41873 | | - bLink = S_ISLNK(buf.st_mode); |
| 41874 | | - } |
| 41875 | | - |
| 41876 | | - if( bLink ){ |
| 41877 | | - nLink++; |
| 41878 | | - if( zDel==0 ){ |
| 41879 | | - zDel = sqlite3_malloc(nOut); |
| 41880 | | - if( zDel==0 ) rc = SQLITE_NOMEM_BKPT; |
| 41881 | | - }else if( nLink>=SQLITE_MAX_SYMLINKS ){ |
| 41882 | | - rc = SQLITE_CANTOPEN_BKPT; |
| 41883 | | - } |
| 41884 | | - |
| 41885 | | - if( rc==SQLITE_OK ){ |
| 41886 | | - nByte = osReadlink(zIn, zDel, nOut-1); |
| 41887 | | - if( nByte<0 ){ |
| 41888 | | - rc = unixLogError(SQLITE_CANTOPEN_BKPT, "readlink", zIn); |
| 41889 | | - }else{ |
| 41890 | | - if( zDel[0]!='/' ){ |
| 41891 | | - int n; |
| 41892 | | - for(n = sqlite3Strlen30(zIn); n>0 && zIn[n-1]!='/'; n--); |
| 41893 | | - if( nByte+n+1>nOut ){ |
| 41894 | | - rc = SQLITE_CANTOPEN_BKPT; |
| 41895 | | - }else{ |
| 41896 | | - memmove(&zDel[n], zDel, nByte+1); |
| 41897 | | - memcpy(zDel, zIn, n); |
| 41898 | | - nByte += n; |
| 41899 | | - } |
| 41900 | | - } |
| 41901 | | - zDel[nByte] = '\0'; |
| 41902 | | - } |
| 41903 | | - } |
| 41904 | | - |
| 41905 | | - zIn = zDel; |
| 41906 | | - } |
| 41907 | | - |
| 41908 | | - assert( rc!=SQLITE_OK || zIn!=zOut || zIn[0]=='/' ); |
| 41909 | | - if( rc==SQLITE_OK && zIn!=zOut ){ |
| 41910 | | - rc = mkFullPathname(zIn, zOut, nOut); |
| 41911 | | - } |
| 41912 | | - if( bLink==0 ) break; |
| 41913 | | - zIn = zOut; |
| 41914 | | - }while( rc==SQLITE_OK ); |
| 41915 | | - |
| 41916 | | - sqlite3_free(zDel); |
| 41917 | | - if( rc==SQLITE_OK && nLink ) rc = SQLITE_OK_SYMLINK; |
| 41918 | | - return rc; |
| 41919 | | -#endif /* HAVE_READLINK && HAVE_LSTAT */ |
| 41920 | | -} |
| 41921 | | - |
| 41989 | + path.rc = 0; |
| 41990 | + path.nUsed = 0; |
| 41991 | + path.nSymlink = 0; |
| 41992 | + path.nOut = nOut; |
| 41993 | + path.zOut = zOut; |
| 41994 | + if( zPath[0]!='/' ){ |
| 41995 | + char zPwd[SQLITE_MAX_PATHLEN+2]; |
| 41996 | + if( osGetcwd(zPwd, sizeof(zPwd)-2)==0 ){ |
| 41997 | + return unixLogError(SQLITE_CANTOPEN_BKPT, "getcwd", zPath); |
| 41998 | + } |
| 41999 | + appendAllPathElements(&path, zPwd); |
| 42000 | + } |
| 42001 | + appendAllPathElements(&path, zPath); |
| 42002 | + zOut[path.nUsed] = 0; |
| 42003 | + if( path.rc || path.nUsed<2 ) return SQLITE_CANTOPEN_BKPT; |
| 42004 | + if( path.nSymlink ) return SQLITE_OK_SYMLINK; |
| 42005 | + return SQLITE_OK; |
| 42006 | +} |
| 41922 | 42007 | |
| 41923 | 42008 | #ifndef SQLITE_OMIT_LOAD_EXTENSION |
| 41924 | 42009 | /* |
| 41925 | 42010 | ** Interfaces for opening a shared library, finding entry points |
| 41926 | 42011 | ** within the shared library, and closing the shared library. |
| | @@ -75861,11 +75946,11 @@ |
| 75861 | 75946 | } |
| 75862 | 75947 | |
| 75863 | 75948 | TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n", |
| 75864 | 75949 | pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno, |
| 75865 | 75950 | loc==0 ? "overwrite" : "new entry")); |
| 75866 | | - assert( pPage->isInit ); |
| 75951 | + assert( pPage->isInit || CORRUPT_DB ); |
| 75867 | 75952 | newCell = pBt->pTmpSpace; |
| 75868 | 75953 | assert( newCell!=0 ); |
| 75869 | 75954 | if( flags & BTREE_PREFORMAT ){ |
| 75870 | 75955 | rc = SQLITE_OK; |
| 75871 | 75956 | szNew = pBt->nPreformatSize; |
| | @@ -81423,10 +81508,94 @@ |
| 81423 | 81508 | pParse->nLabel = 0; |
| 81424 | 81509 | *pMaxFuncArgs = nMaxArgs; |
| 81425 | 81510 | assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) ); |
| 81426 | 81511 | } |
| 81427 | 81512 | |
| 81513 | +#ifdef SQLITE_DEBUG |
| 81514 | +/* |
| 81515 | +** Check to see if a subroutine contains a jump to a location outside of |
| 81516 | +** the subroutine. If a jump outside the subroutine is detected, add code |
| 81517 | +** that will cause the program to halt with an error message. |
| 81518 | +** |
| 81519 | +** The subroutine consists of opcodes between iFirst and iLast. Jumps to |
| 81520 | +** locations within the subroutine are acceptable. iRetReg is a register |
| 81521 | +** that contains the return address. Jumps to outside the range of iFirst |
| 81522 | +** through iLast are also acceptable as long as the jump destination is |
| 81523 | +** an OP_Return to iReturnAddr. |
| 81524 | +** |
| 81525 | +** A jump to an unresolved label means that the jump destination will be |
| 81526 | +** beyond the current address. That is normally a jump to an early |
| 81527 | +** termination and is consider acceptable. |
| 81528 | +** |
| 81529 | +** This routine only runs during debug builds. The purpose is (of course) |
| 81530 | +** to detect invalid escapes out of a subroutine. The OP_Halt opcode |
| 81531 | +** is generated rather than an assert() or other error, so that ".eqp full" |
| 81532 | +** will still work to show the original bytecode, to aid in debugging. |
| 81533 | +*/ |
| 81534 | +SQLITE_PRIVATE void sqlite3VdbeNoJumpsOutsideSubrtn( |
| 81535 | + Vdbe *v, /* The byte-code program under construction */ |
| 81536 | + int iFirst, /* First opcode of the subroutine */ |
| 81537 | + int iLast, /* Last opcode of the subroutine */ |
| 81538 | + int iRetReg /* Subroutine return address register */ |
| 81539 | +){ |
| 81540 | + VdbeOp *pOp; |
| 81541 | + Parse *pParse; |
| 81542 | + int i; |
| 81543 | + sqlite3_str *pErr = 0; |
| 81544 | + assert( v!=0 ); |
| 81545 | + pParse = v->pParse; |
| 81546 | + assert( pParse!=0 ); |
| 81547 | + if( pParse->nErr ) return; |
| 81548 | + assert( iLast>=iFirst ); |
| 81549 | + assert( iLast<v->nOp ); |
| 81550 | + pOp = &v->aOp[iFirst]; |
| 81551 | + for(i=iFirst; i<=iLast; i++, pOp++){ |
| 81552 | + if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 ){ |
| 81553 | + int iDest = pOp->p2; /* Jump destination */ |
| 81554 | + if( iDest==0 ) continue; |
| 81555 | + if( pOp->opcode==OP_Gosub ) continue; |
| 81556 | + if( iDest<0 ){ |
| 81557 | + int j = ADDR(iDest); |
| 81558 | + assert( j>=0 ); |
| 81559 | + if( j>=-pParse->nLabel || pParse->aLabel[j]<0 ){ |
| 81560 | + continue; |
| 81561 | + } |
| 81562 | + iDest = pParse->aLabel[j]; |
| 81563 | + } |
| 81564 | + if( iDest<iFirst || iDest>iLast ){ |
| 81565 | + int j = iDest; |
| 81566 | + for(; j<v->nOp; j++){ |
| 81567 | + VdbeOp *pX = &v->aOp[j]; |
| 81568 | + if( pX->opcode==OP_Return ){ |
| 81569 | + if( pX->p1==iRetReg ) break; |
| 81570 | + continue; |
| 81571 | + } |
| 81572 | + if( pX->opcode==OP_Noop ) continue; |
| 81573 | + if( pX->opcode==OP_Explain ) continue; |
| 81574 | + if( pErr==0 ){ |
| 81575 | + pErr = sqlite3_str_new(0); |
| 81576 | + }else{ |
| 81577 | + sqlite3_str_appendchar(pErr, 1, '\n'); |
| 81578 | + } |
| 81579 | + sqlite3_str_appendf(pErr, |
| 81580 | + "Opcode at %d jumps to %d which is outside the " |
| 81581 | + "subroutine at %d..%d", |
| 81582 | + i, iDest, iFirst, iLast); |
| 81583 | + break; |
| 81584 | + } |
| 81585 | + } |
| 81586 | + } |
| 81587 | + } |
| 81588 | + if( pErr ){ |
| 81589 | + char *zErr = sqlite3_str_finish(pErr); |
| 81590 | + sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_INTERNAL, OE_Abort, 0, zErr, 0); |
| 81591 | + sqlite3_free(zErr); |
| 81592 | + sqlite3MayAbort(pParse); |
| 81593 | + } |
| 81594 | +} |
| 81595 | +#endif /* SQLITE_DEBUG */ |
| 81596 | + |
| 81428 | 81597 | /* |
| 81429 | 81598 | ** Return the address of the next instruction to be inserted. |
| 81430 | 81599 | */ |
| 81431 | 81600 | SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){ |
| 81432 | 81601 | assert( p->eVdbeState==VDBE_INIT_STATE ); |
| | @@ -82035,15 +82204,13 @@ |
| 82035 | 82204 | if( c=='4' ){ |
| 82036 | 82205 | sqlite3_str_appendall(&x, zP4); |
| 82037 | 82206 | }else if( c=='X' ){ |
| 82038 | 82207 | if( pOp->zComment && pOp->zComment[0] ){ |
| 82039 | 82208 | sqlite3_str_appendall(&x, pOp->zComment); |
| 82040 | | - }else{ |
| 82041 | | - sqlite3_str_appendall(&x, zSynopsis+1); |
| 82209 | + seenCom = 1; |
| 82210 | + break; |
| 82042 | 82211 | } |
| 82043 | | - seenCom = 1; |
| 82044 | | - break; |
| 82045 | 82212 | }else{ |
| 82046 | 82213 | int v1 = translateP(c, pOp); |
| 82047 | 82214 | int v2; |
| 82048 | 82215 | if( strncmp(zSynopsis+ii+1, "@P", 2)==0 ){ |
| 82049 | 82216 | ii += 3; |
| | @@ -89154,10 +89321,12 @@ |
| 89154 | 89321 | if( pOp->p2==0 ) break; |
| 89155 | 89322 | |
| 89156 | 89323 | /* Most jump operations do a goto to this spot in order to update |
| 89157 | 89324 | ** the pOp pointer. */ |
| 89158 | 89325 | jump_to_p2: |
| 89326 | + assert( pOp->p2>0 ); /* There are never any jumps to instruction 0 */ |
| 89327 | + assert( pOp->p2<p->nOp ); /* Jumps must be in range */ |
| 89159 | 89328 | pOp = &aOp[pOp->p2 - 1]; |
| 89160 | 89329 | break; |
| 89161 | 89330 | } |
| 89162 | 89331 | |
| 89163 | 89332 | /* Opcode: EndCoroutine P1 * * * * |
| | @@ -101365,11 +101534,11 @@ |
| 101365 | 101534 | const char *zTab, |
| 101366 | 101535 | const char *zDb |
| 101367 | 101536 | ){ |
| 101368 | 101537 | int n; |
| 101369 | 101538 | const char *zSpan; |
| 101370 | | - if( pItem->eEName!=ENAME_TAB ) return 0; |
| 101539 | + if( pItem->fg.eEName!=ENAME_TAB ) return 0; |
| 101371 | 101540 | zSpan = pItem->zEName; |
| 101372 | 101541 | for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){} |
| 101373 | 101542 | if( zDb && (sqlite3StrNICmp(zSpan, zDb, n)!=0 || zDb[n]!=0) ){ |
| 101374 | 101543 | return 0; |
| 101375 | 101544 | } |
| | @@ -101594,12 +101763,13 @@ |
| 101594 | 101763 | } |
| 101595 | 101764 | cnt++; |
| 101596 | 101765 | cntTab = 2; |
| 101597 | 101766 | pMatch = pItem; |
| 101598 | 101767 | pExpr->iColumn = j; |
| 101599 | | - pEList->a[j].bUsed = 1; |
| 101768 | + pEList->a[j].fg.bUsed = 1; |
| 101600 | 101769 | hit = 1; |
| 101770 | + if( pEList->a[j].fg.bUsingTerm ) break; |
| 101601 | 101771 | } |
| 101602 | 101772 | if( hit || zTab==0 ) continue; |
| 101603 | 101773 | } |
| 101604 | 101774 | assert( zDb==0 || zTab!=0 ); |
| 101605 | 101775 | if( zTab ){ |
| | @@ -101818,11 +101988,11 @@ |
| 101818 | 101988 | ){ |
| 101819 | 101989 | pEList = pNC->uNC.pEList; |
| 101820 | 101990 | assert( pEList!=0 ); |
| 101821 | 101991 | for(j=0; j<pEList->nExpr; j++){ |
| 101822 | 101992 | char *zAs = pEList->a[j].zEName; |
| 101823 | | - if( pEList->a[j].eEName==ENAME_NAME |
| 101993 | + if( pEList->a[j].fg.eEName==ENAME_NAME |
| 101824 | 101994 | && sqlite3_stricmp(zAs, zCol)==0 |
| 101825 | 101995 | ){ |
| 101826 | 101996 | Expr *pOrig; |
| 101827 | 101997 | assert( pExpr->pLeft==0 && pExpr->pRight==0 ); |
| 101828 | 101998 | assert( ExprUseXList(pExpr)==0 || pExpr->x.pList==0 ); |
| | @@ -102162,11 +102332,11 @@ |
| 102162 | 102332 | for(i=0, p=pNC; p && i<ArraySize(anRef); p=p->pNext, i++){ |
| 102163 | 102333 | anRef[i] = p->nRef; |
| 102164 | 102334 | } |
| 102165 | 102335 | sqlite3WalkExpr(pWalker, pExpr->pLeft); |
| 102166 | 102336 | if( 0==sqlite3ExprCanBeNull(pExpr->pLeft) && !IN_RENAME_OBJECT ){ |
| 102167 | | - testcase( ExprHasProperty(pExpr, EP_FromJoin) ); |
| 102337 | + testcase( ExprHasProperty(pExpr, EP_OuterON) ); |
| 102168 | 102338 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 102169 | 102339 | if( pExpr->op==TK_NOTNULL ){ |
| 102170 | 102340 | pExpr->u.zToken = "true"; |
| 102171 | 102341 | ExprSetProperty(pExpr, EP_IsTrue); |
| 102172 | 102342 | }else{ |
| | @@ -102571,11 +102741,11 @@ |
| 102571 | 102741 | if( pE->op==TK_ID ){ |
| 102572 | 102742 | const char *zCol; |
| 102573 | 102743 | assert( !ExprHasProperty(pE, EP_IntValue) ); |
| 102574 | 102744 | zCol = pE->u.zToken; |
| 102575 | 102745 | for(i=0; i<pEList->nExpr; i++){ |
| 102576 | | - if( pEList->a[i].eEName==ENAME_NAME |
| 102746 | + if( pEList->a[i].fg.eEName==ENAME_NAME |
| 102577 | 102747 | && sqlite3_stricmp(pEList->a[i].zEName, zCol)==0 |
| 102578 | 102748 | ){ |
| 102579 | 102749 | return i+1; |
| 102580 | 102750 | } |
| 102581 | 102751 | } |
| | @@ -102692,11 +102862,11 @@ |
| 102692 | 102862 | if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){ |
| 102693 | 102863 | sqlite3ErrorMsg(pParse, "too many terms in ORDER BY clause"); |
| 102694 | 102864 | return 1; |
| 102695 | 102865 | } |
| 102696 | 102866 | for(i=0; i<pOrderBy->nExpr; i++){ |
| 102697 | | - pOrderBy->a[i].done = 0; |
| 102867 | + pOrderBy->a[i].fg.done = 0; |
| 102698 | 102868 | } |
| 102699 | 102869 | pSelect->pNext = 0; |
| 102700 | 102870 | while( pSelect->pPrior ){ |
| 102701 | 102871 | pSelect->pPrior->pNext = pSelect; |
| 102702 | 102872 | pSelect = pSelect->pPrior; |
| | @@ -102707,11 +102877,11 @@ |
| 102707 | 102877 | pEList = pSelect->pEList; |
| 102708 | 102878 | assert( pEList!=0 ); |
| 102709 | 102879 | for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){ |
| 102710 | 102880 | int iCol = -1; |
| 102711 | 102881 | Expr *pE, *pDup; |
| 102712 | | - if( pItem->done ) continue; |
| 102882 | + if( pItem->fg.done ) continue; |
| 102713 | 102883 | pE = sqlite3ExprSkipCollateAndLikely(pItem->pExpr); |
| 102714 | 102884 | if( NEVER(pE==0) ) continue; |
| 102715 | 102885 | if( sqlite3ExprIsInteger(pE, &iCol) ){ |
| 102716 | 102886 | if( iCol<=0 || iCol>pEList->nExpr ){ |
| 102717 | 102887 | resolveOutOfRangeError(pParse, "ORDER", i+1, pEList->nExpr, pE); |
| | @@ -102760,19 +102930,19 @@ |
| 102760 | 102930 | pParent->pLeft = pNew; |
| 102761 | 102931 | } |
| 102762 | 102932 | sqlite3ExprDelete(db, pE); |
| 102763 | 102933 | pItem->u.x.iOrderByCol = (u16)iCol; |
| 102764 | 102934 | } |
| 102765 | | - pItem->done = 1; |
| 102935 | + pItem->fg.done = 1; |
| 102766 | 102936 | }else{ |
| 102767 | 102937 | moreToDo = 1; |
| 102768 | 102938 | } |
| 102769 | 102939 | } |
| 102770 | 102940 | pSelect = pSelect->pNext; |
| 102771 | 102941 | } |
| 102772 | 102942 | for(i=0; i<pOrderBy->nExpr; i++){ |
| 102773 | | - if( pOrderBy->a[i].done==0 ){ |
| 102943 | + if( pOrderBy->a[i].fg.done==0 ){ |
| 102774 | 102944 | sqlite3ErrorMsg(pParse, "%r ORDER BY term does not match any " |
| 102775 | 102945 | "column in the result set", i+1); |
| 102776 | 102946 | return 1; |
| 102777 | 102947 | } |
| 102778 | 102948 | } |
| | @@ -104453,10 +104623,11 @@ |
| 104453 | 104623 | pNew = sqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1); |
| 104454 | 104624 | if( pNew==0 ){ |
| 104455 | 104625 | sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */ |
| 104456 | 104626 | return 0; |
| 104457 | 104627 | } |
| 104628 | + assert( !ExprHasProperty(pNew, EP_InnerON|EP_OuterON) ); |
| 104458 | 104629 | pNew->w.iOfst = (int)(pToken->z - pParse->zTail); |
| 104459 | 104630 | if( pList |
| 104460 | 104631 | && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] |
| 104461 | 104632 | && !pParse->nested |
| 104462 | 104633 | ){ |
| | @@ -104731,11 +104902,11 @@ |
| 104731 | 104902 | #endif |
| 104732 | 104903 | ){ |
| 104733 | 104904 | nSize = EXPR_FULLSIZE; |
| 104734 | 104905 | }else{ |
| 104735 | 104906 | assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); |
| 104736 | | - assert( !ExprHasProperty(p, EP_FromJoin) ); |
| 104907 | + assert( !ExprHasProperty(p, EP_OuterON) ); |
| 104737 | 104908 | assert( !ExprHasProperty(p, EP_MemToken) ); |
| 104738 | 104909 | assert( !ExprHasVVAProperty(p, EP_NoReduce) ); |
| 104739 | 104910 | if( p->pLeft || p->x.pList ){ |
| 104740 | 104911 | nSize = EXPR_REDUCEDSIZE | EP_Reduced; |
| 104741 | 104912 | }else{ |
| | @@ -104911,10 +105082,11 @@ |
| 104911 | 105082 | pRet->nCte = p->nCte; |
| 104912 | 105083 | for(i=0; i<p->nCte; i++){ |
| 104913 | 105084 | pRet->a[i].pSelect = sqlite3SelectDup(db, p->a[i].pSelect, 0); |
| 104914 | 105085 | pRet->a[i].pCols = sqlite3ExprListDup(db, p->a[i].pCols, 0); |
| 104915 | 105086 | pRet->a[i].zName = sqlite3DbStrDup(db, p->a[i].zName); |
| 105087 | + pRet->a[i].eM10d = p->a[i].eM10d; |
| 104916 | 105088 | } |
| 104917 | 105089 | } |
| 104918 | 105090 | } |
| 104919 | 105091 | return pRet; |
| 104920 | 105092 | } |
| | @@ -105011,16 +105183,12 @@ |
| 105011 | 105183 | } |
| 105012 | 105184 | pNewExpr->pLeft = pPriorSelectColNew; |
| 105013 | 105185 | } |
| 105014 | 105186 | } |
| 105015 | 105187 | pItem->zEName = sqlite3DbStrDup(db, pOldItem->zEName); |
| 105016 | | - pItem->sortFlags = pOldItem->sortFlags; |
| 105017 | | - pItem->eEName = pOldItem->eEName; |
| 105018 | | - pItem->done = 0; |
| 105019 | | - pItem->bNulls = pOldItem->bNulls; |
| 105020 | | - pItem->bUsed = pOldItem->bUsed; |
| 105021 | | - pItem->bSorterRef = pOldItem->bSorterRef; |
| 105188 | + pItem->fg = pOldItem->fg; |
| 105189 | + pItem->fg.done = 0; |
| 105022 | 105190 | pItem->u = pOldItem->u; |
| 105023 | 105191 | } |
| 105024 | 105192 | return pNew; |
| 105025 | 105193 | } |
| 105026 | 105194 | |
| | @@ -105316,20 +105484,20 @@ |
| 105316 | 105484 | || eNulls==SQLITE_SO_ASC |
| 105317 | 105485 | || eNulls==SQLITE_SO_DESC |
| 105318 | 105486 | ); |
| 105319 | 105487 | |
| 105320 | 105488 | pItem = &p->a[p->nExpr-1]; |
| 105321 | | - assert( pItem->bNulls==0 ); |
| 105489 | + assert( pItem->fg.bNulls==0 ); |
| 105322 | 105490 | if( iSortOrder==SQLITE_SO_UNDEFINED ){ |
| 105323 | 105491 | iSortOrder = SQLITE_SO_ASC; |
| 105324 | 105492 | } |
| 105325 | | - pItem->sortFlags = (u8)iSortOrder; |
| 105493 | + pItem->fg.sortFlags = (u8)iSortOrder; |
| 105326 | 105494 | |
| 105327 | 105495 | if( eNulls!=SQLITE_SO_UNDEFINED ){ |
| 105328 | | - pItem->bNulls = 1; |
| 105496 | + pItem->fg.bNulls = 1; |
| 105329 | 105497 | if( iSortOrder!=eNulls ){ |
| 105330 | | - pItem->sortFlags |= KEYINFO_ORDER_BIGNULL; |
| 105498 | + pItem->fg.sortFlags |= KEYINFO_ORDER_BIGNULL; |
| 105331 | 105499 | } |
| 105332 | 105500 | } |
| 105333 | 105501 | } |
| 105334 | 105502 | |
| 105335 | 105503 | /* |
| | @@ -105351,11 +105519,11 @@ |
| 105351 | 105519 | if( pList ){ |
| 105352 | 105520 | struct ExprList_item *pItem; |
| 105353 | 105521 | assert( pList->nExpr>0 ); |
| 105354 | 105522 | pItem = &pList->a[pList->nExpr-1]; |
| 105355 | 105523 | assert( pItem->zEName==0 ); |
| 105356 | | - assert( pItem->eEName==ENAME_NAME ); |
| 105524 | + assert( pItem->fg.eEName==ENAME_NAME ); |
| 105357 | 105525 | pItem->zEName = sqlite3DbStrNDup(pParse->db, pName->z, pName->n); |
| 105358 | 105526 | if( dequote ){ |
| 105359 | 105527 | /* If dequote==0, then pName->z does not point to part of a DDL |
| 105360 | 105528 | ** statement handled by the parser. And so no token need be added |
| 105361 | 105529 | ** to the token-map. */ |
| | @@ -105386,11 +105554,11 @@ |
| 105386 | 105554 | if( pList ){ |
| 105387 | 105555 | struct ExprList_item *pItem = &pList->a[pList->nExpr-1]; |
| 105388 | 105556 | assert( pList->nExpr>0 ); |
| 105389 | 105557 | if( pItem->zEName==0 ){ |
| 105390 | 105558 | pItem->zEName = sqlite3DbSpanDup(db, zStart, zEnd); |
| 105391 | | - pItem->eEName = ENAME_SPAN; |
| 105559 | + pItem->fg.eEName = ENAME_SPAN; |
| 105392 | 105560 | } |
| 105393 | 105561 | } |
| 105394 | 105562 | } |
| 105395 | 105563 | |
| 105396 | 105564 | /* |
| | @@ -105560,11 +105728,11 @@ |
| 105560 | 105728 | static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ |
| 105561 | 105729 | |
| 105562 | 105730 | /* If pWalker->eCode is 2 then any term of the expression that comes from |
| 105563 | 105731 | ** the ON or USING clauses of an outer join disqualifies the expression |
| 105564 | 105732 | ** from being considered constant. */ |
| 105565 | | - if( pWalker->eCode==2 && ExprHasProperty(pExpr, EP_FromJoin) ){ |
| 105733 | + if( pWalker->eCode==2 && ExprHasProperty(pExpr, EP_OuterON) ){ |
| 105566 | 105734 | pWalker->eCode = 0; |
| 105567 | 105735 | return WRC_Abort; |
| 105568 | 105736 | } |
| 105569 | 105737 | |
| 105570 | 105738 | switch( pExpr->op ){ |
| | @@ -105678,10 +105846,46 @@ |
| 105678 | 105846 | ** table other than iCur. |
| 105679 | 105847 | */ |
| 105680 | 105848 | SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){ |
| 105681 | 105849 | return exprIsConst(p, 3, iCur); |
| 105682 | 105850 | } |
| 105851 | + |
| 105852 | +/* |
| 105853 | +** Check pExpr to see if it is an invariant constraint on data source pSrc. |
| 105854 | +** This is an optimization. False negatives will perhaps cause slower |
| 105855 | +** queries, but false positives will yield incorrect answers. So when in |
| 105856 | +** doubt, return 0. |
| 105857 | +** |
| 105858 | +** To be an invariant constraint, the following must be true: |
| 105859 | +** |
| 105860 | +** (1) pExpr cannot refer to any table other than pSrc->iCursor. |
| 105861 | +** |
| 105862 | +** (2) pExpr cannot use subqueries or non-deterministic functions. |
| 105863 | +** |
| 105864 | +** (3) pSrc cannot be part of the left operand for a RIGHT JOIN. |
| 105865 | +** (Is there some way to relax this constraint?) |
| 105866 | +** |
| 105867 | +** (4) If pSrc is the right operand of a LEFT JOIN, then... |
| 105868 | +** (4a) pExpr must come from an ON clause.. |
| 105869 | + (4b) and specifically the ON clause associated with the LEFT JOIN. |
| 105870 | +** |
| 105871 | +** (5) If pSrc is not the right operand of a LEFT JOIN or the left |
| 105872 | +** operand of a RIGHT JOIN, then pExpr must be from the WHERE |
| 105873 | +** clause, not an ON clause. |
| 105874 | +*/ |
| 105875 | +SQLITE_PRIVATE int sqlite3ExprIsTableConstraint(Expr *pExpr, const SrcItem *pSrc){ |
| 105876 | + if( pSrc->fg.jointype & JT_LTORJ ){ |
| 105877 | + return 0; /* rule (3) */ |
| 105878 | + } |
| 105879 | + if( pSrc->fg.jointype & JT_LEFT ){ |
| 105880 | + if( !ExprHasProperty(pExpr, EP_OuterON) ) return 0; /* rule (4a) */ |
| 105881 | + if( pExpr->w.iJoin!=pSrc->iCursor ) return 0; /* rule (4b) */ |
| 105882 | + }else{ |
| 105883 | + if( ExprHasProperty(pExpr, EP_OuterON) ) return 0; /* rule (5) */ |
| 105884 | + } |
| 105885 | + return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */ |
| 105886 | +} |
| 105683 | 105887 | |
| 105684 | 105888 | |
| 105685 | 105889 | /* |
| 105686 | 105890 | ** sqlite3WalkExpr() callback used by sqlite3ExprIsConstantOrGroupBy(). |
| 105687 | 105891 | */ |
| | @@ -106006,11 +106210,11 @@ |
| 106006 | 106210 | ** The job of this routine is to find or create a b-tree object that can |
| 106007 | 106211 | ** be used either to test for membership in the RHS set or to iterate through |
| 106008 | 106212 | ** all members of the RHS set, skipping duplicates. |
| 106009 | 106213 | ** |
| 106010 | 106214 | ** A cursor is opened on the b-tree object that is the RHS of the IN operator |
| 106011 | | -** and pX->iTable is set to the index of that cursor. |
| 106215 | +** and the *piTab parameter is set to the index of that cursor. |
| 106012 | 106216 | ** |
| 106013 | 106217 | ** The returned value of this function indicates the b-tree type, as follows: |
| 106014 | 106218 | ** |
| 106015 | 106219 | ** IN_INDEX_ROWID - The cursor was opened on a database table. |
| 106016 | 106220 | ** IN_INDEX_INDEX_ASC - The cursor was opened on an ascending index. |
| | @@ -106026,11 +106230,14 @@ |
| 106026 | 106230 | ** SELECT <column1>, <column2>... FROM <table> |
| 106027 | 106231 | ** |
| 106028 | 106232 | ** If the RHS of the IN operator is a list or a more complex subquery, then |
| 106029 | 106233 | ** an ephemeral table might need to be generated from the RHS and then |
| 106030 | 106234 | ** pX->iTable made to point to the ephemeral table instead of an |
| 106031 | | -** existing table. |
| 106235 | +** existing table. In this case, the creation and initialization of the |
| 106236 | +** ephmeral table might be put inside of a subroutine, the EP_Subrtn flag |
| 106237 | +** will be set on pX and the pX->y.sub fields will be set to show where |
| 106238 | +** the subroutine is coded. |
| 106032 | 106239 | ** |
| 106033 | 106240 | ** The inFlags parameter must contain, at a minimum, one of the bits |
| 106034 | 106241 | ** IN_INDEX_MEMBERSHIP or IN_INDEX_LOOP but not both. If inFlags contains |
| 106035 | 106242 | ** IN_INDEX_MEMBERSHIP, then the generated table will be used for a fast |
| 106036 | 106243 | ** membership test. When the IN_INDEX_LOOP bit is set, the IN index will |
| | @@ -106087,16 +106294,17 @@ |
| 106087 | 106294 | int *aiMap, /* Mapping from Index fields to RHS fields */ |
| 106088 | 106295 | int *piTab /* OUT: index to use */ |
| 106089 | 106296 | ){ |
| 106090 | 106297 | Select *p; /* SELECT to the right of IN operator */ |
| 106091 | 106298 | int eType = 0; /* Type of RHS table. IN_INDEX_* */ |
| 106092 | | - int iTab = pParse->nTab++; /* Cursor of the RHS table */ |
| 106299 | + int iTab; /* Cursor of the RHS table */ |
| 106093 | 106300 | int mustBeUnique; /* True if RHS must be unique */ |
| 106094 | 106301 | Vdbe *v = sqlite3GetVdbe(pParse); /* Virtual machine being coded */ |
| 106095 | 106302 | |
| 106096 | 106303 | assert( pX->op==TK_IN ); |
| 106097 | 106304 | mustBeUnique = (inFlags & IN_INDEX_LOOP)!=0; |
| 106305 | + iTab = pParse->nTab++; |
| 106098 | 106306 | |
| 106099 | 106307 | /* If the RHS of this IN(...) operator is a SELECT, and if it matters |
| 106100 | 106308 | ** whether or not the SELECT result contains NULL values, check whether |
| 106101 | 106309 | ** or not NULL is actually possible (it may not be, for example, due |
| 106102 | 106310 | ** to NOT NULL constraints in the schema). If no NULL values are possible, |
| | @@ -106258,10 +106466,12 @@ |
| 106258 | 106466 | if( eType==0 |
| 106259 | 106467 | && (inFlags & IN_INDEX_NOOP_OK) |
| 106260 | 106468 | && ExprUseXList(pX) |
| 106261 | 106469 | && (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2) |
| 106262 | 106470 | ){ |
| 106471 | + pParse->nTab--; /* Back out the allocation of the unused cursor */ |
| 106472 | + iTab = -1; /* Cursor is not allocated */ |
| 106263 | 106473 | eType = IN_INDEX_NOOP; |
| 106264 | 106474 | } |
| 106265 | 106475 | |
| 106266 | 106476 | if( eType==0 ){ |
| 106267 | 106477 | /* Could not find an existing table or index to use as the RHS b-tree. |
| | @@ -106424,10 +106634,11 @@ |
| 106424 | 106634 | pExpr->x.pSelect->selId)); |
| 106425 | 106635 | } |
| 106426 | 106636 | assert( ExprUseYSub(pExpr) ); |
| 106427 | 106637 | sqlite3VdbeAddOp2(v, OP_Gosub, pExpr->y.sub.regReturn, |
| 106428 | 106638 | pExpr->y.sub.iAddr); |
| 106639 | + assert( iTab!=pExpr->iTable ); |
| 106429 | 106640 | sqlite3VdbeAddOp2(v, OP_OpenDup, iTab, pExpr->iTable); |
| 106430 | 106641 | sqlite3VdbeJumpHere(v, addrOnce); |
| 106431 | 106642 | return; |
| 106432 | 106643 | } |
| 106433 | 106644 | |
| | @@ -107298,11 +107509,21 @@ |
| 107298 | 107509 | memset(&caseExpr, 0, sizeof(caseExpr)); |
| 107299 | 107510 | caseExpr.op = TK_CASE; |
| 107300 | 107511 | caseExpr.x.pList = pFarg; |
| 107301 | 107512 | return sqlite3ExprCodeTarget(pParse, &caseExpr, target); |
| 107302 | 107513 | } |
| 107303 | | - |
| 107514 | +#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC |
| 107515 | + case INLINEFUNC_sqlite_offset: { |
| 107516 | + Expr *pArg = pFarg->a[0].pExpr; |
| 107517 | + if( pArg->op==TK_COLUMN && pArg->iTable>=0 ){ |
| 107518 | + sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target); |
| 107519 | + }else{ |
| 107520 | + sqlite3VdbeAddOp2(v, OP_Null, 0, target); |
| 107521 | + } |
| 107522 | + break; |
| 107523 | + } |
| 107524 | +#endif |
| 107304 | 107525 | default: { |
| 107305 | 107526 | /* The UNLIKELY() function is a no-op. The result is the value |
| 107306 | 107527 | ** of the first argument. |
| 107307 | 107528 | */ |
| 107308 | 107529 | assert( nFarg==1 || nFarg==2 ); |
| | @@ -107837,24 +108058,12 @@ |
| 107837 | 108058 | #endif |
| 107838 | 108059 | if( pDef->funcFlags & SQLITE_FUNC_NEEDCOLL ){ |
| 107839 | 108060 | if( !pColl ) pColl = db->pDfltColl; |
| 107840 | 108061 | sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ); |
| 107841 | 108062 | } |
| 107842 | | -#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC |
| 107843 | | - if( (pDef->funcFlags & SQLITE_FUNC_OFFSET)!=0 && ALWAYS(pFarg!=0) ){ |
| 107844 | | - Expr *pArg = pFarg->a[0].pExpr; |
| 107845 | | - if( pArg->op==TK_COLUMN ){ |
| 107846 | | - sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target); |
| 107847 | | - }else{ |
| 107848 | | - sqlite3VdbeAddOp2(v, OP_Null, 0, target); |
| 107849 | | - } |
| 107850 | | - }else |
| 107851 | | -#endif |
| 107852 | | - { |
| 107853 | | - sqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg, |
| 107854 | | - pDef, pExpr->op2); |
| 107855 | | - } |
| 108063 | + sqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg, |
| 108064 | + pDef, pExpr->op2); |
| 107856 | 108065 | if( nFarg ){ |
| 107857 | 108066 | if( constMask==0 ){ |
| 107858 | 108067 | sqlite3ReleaseTempRange(pParse, r1, nFarg); |
| 107859 | 108068 | }else{ |
| 107860 | 108069 | sqlite3VdbeReleaseRegisters(pParse, r1, nFarg, constMask, 1); |
| | @@ -108164,11 +108373,13 @@ |
| 108164 | 108373 | p = pParse->pConstExpr; |
| 108165 | 108374 | if( regDest<0 && p ){ |
| 108166 | 108375 | struct ExprList_item *pItem; |
| 108167 | 108376 | int i; |
| 108168 | 108377 | for(pItem=p->a, i=p->nExpr; i>0; pItem++, i--){ |
| 108169 | | - if( pItem->reusable && sqlite3ExprCompare(0,pItem->pExpr,pExpr,-1)==0 ){ |
| 108378 | + if( pItem->fg.reusable |
| 108379 | + && sqlite3ExprCompare(0,pItem->pExpr,pExpr,-1)==0 |
| 108380 | + ){ |
| 108170 | 108381 | return pItem->u.iConstExprReg; |
| 108171 | 108382 | } |
| 108172 | 108383 | } |
| 108173 | 108384 | } |
| 108174 | 108385 | pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); |
| | @@ -108187,11 +108398,11 @@ |
| 108187 | 108398 | sqlite3VdbeJumpHere(v, addr); |
| 108188 | 108399 | }else{ |
| 108189 | 108400 | p = sqlite3ExprListAppend(pParse, p, pExpr); |
| 108190 | 108401 | if( p ){ |
| 108191 | 108402 | struct ExprList_item *pItem = &p->a[p->nExpr-1]; |
| 108192 | | - pItem->reusable = regDest<0; |
| 108403 | + pItem->fg.reusable = regDest<0; |
| 108193 | 108404 | if( regDest<0 ) regDest = ++pParse->nMem; |
| 108194 | 108405 | pItem->u.iConstExprReg = regDest; |
| 108195 | 108406 | } |
| 108196 | 108407 | pParse->pConstExpr = p; |
| 108197 | 108408 | } |
| | @@ -108321,11 +108532,11 @@ |
| 108321 | 108532 | n = pList->nExpr; |
| 108322 | 108533 | if( !ConstFactorOk(pParse) ) flags &= ~SQLITE_ECEL_FACTOR; |
| 108323 | 108534 | for(pItem=pList->a, i=0; i<n; i++, pItem++){ |
| 108324 | 108535 | Expr *pExpr = pItem->pExpr; |
| 108325 | 108536 | #ifdef SQLITE_ENABLE_SORTER_REFERENCES |
| 108326 | | - if( pItem->bSorterRef ){ |
| 108537 | + if( pItem->fg.bSorterRef ){ |
| 108327 | 108538 | i--; |
| 108328 | 108539 | n--; |
| 108329 | 108540 | }else |
| 108330 | 108541 | #endif |
| 108331 | 108542 | if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){ |
| | @@ -108415,12 +108626,12 @@ |
| 108415 | 108626 | }else{ |
| 108416 | 108627 | /* Mark the expression is being from the ON or USING clause of a join |
| 108417 | 108628 | ** so that the sqlite3ExprCodeTarget() routine will not attempt to move |
| 108418 | 108629 | ** it into the Parse.pConstExpr list. We should use a new bit for this, |
| 108419 | 108630 | ** for clarity, but we are out of bits in the Expr.flags field so we |
| 108420 | | - ** have to reuse the EP_FromJoin bit. Bummer. */ |
| 108421 | | - pDel->flags |= EP_FromJoin; |
| 108631 | + ** have to reuse the EP_OuterON bit. Bummer. */ |
| 108632 | + pDel->flags |= EP_OuterON; |
| 108422 | 108633 | sqlite3ExprCodeTarget(pParse, &exprAnd, dest); |
| 108423 | 108634 | } |
| 108424 | 108635 | sqlite3ReleaseTempReg(pParse, regFree1); |
| 108425 | 108636 | } |
| 108426 | 108637 | sqlite3ExprDelete(db, pDel); |
| | @@ -108946,11 +109157,11 @@ |
| 108946 | 109157 | if( pA->nExpr!=pB->nExpr ) return 1; |
| 108947 | 109158 | for(i=0; i<pA->nExpr; i++){ |
| 108948 | 109159 | int res; |
| 108949 | 109160 | Expr *pExprA = pA->a[i].pExpr; |
| 108950 | 109161 | Expr *pExprB = pB->a[i].pExpr; |
| 108951 | | - if( pA->a[i].sortFlags!=pB->a[i].sortFlags ) return 1; |
| 109162 | + if( pA->a[i].fg.sortFlags!=pB->a[i].fg.sortFlags ) return 1; |
| 108952 | 109163 | if( (res = sqlite3ExprCompare(0, pExprA, pExprB, iTab)) ) return res; |
| 108953 | 109164 | } |
| 108954 | 109165 | return 0; |
| 108955 | 109166 | } |
| 108956 | 109167 | |
| | @@ -109101,11 +109312,11 @@ |
| 109101 | 109312 | ** (never setting pWalker->eCode) is a harmless missed optimization. |
| 109102 | 109313 | */ |
| 109103 | 109314 | static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ |
| 109104 | 109315 | testcase( pExpr->op==TK_AGG_COLUMN ); |
| 109105 | 109316 | testcase( pExpr->op==TK_AGG_FUNCTION ); |
| 109106 | | - if( ExprHasProperty(pExpr, EP_FromJoin) ) return WRC_Prune; |
| 109317 | + if( ExprHasProperty(pExpr, EP_OuterON) ) return WRC_Prune; |
| 109107 | 109318 | switch( pExpr->op ){ |
| 109108 | 109319 | case TK_ISNOT: |
| 109109 | 109320 | case TK_ISNULL: |
| 109110 | 109321 | case TK_NOTNULL: |
| 109111 | 109322 | case TK_IS: |
| | @@ -109198,11 +109409,11 @@ |
| 109198 | 109409 | ** is NULL. A false negative is merely a missed optimization opportunity. |
| 109199 | 109410 | ** |
| 109200 | 109411 | ** False positives are not allowed, however. A false positive may result |
| 109201 | 109412 | ** in an incorrect answer. |
| 109202 | 109413 | ** |
| 109203 | | -** Terms of p that are marked with EP_FromJoin (and hence that come from |
| 109414 | +** Terms of p that are marked with EP_OuterON (and hence that come from |
| 109204 | 109415 | ** the ON or USING clauses of OUTER JOINS) are excluded from the analysis. |
| 109205 | 109416 | ** |
| 109206 | 109417 | ** This routine is used to check if a LEFT JOIN can be converted into |
| 109207 | 109418 | ** an ordinary JOIN. The p argument is the WHERE clause. If the WHERE |
| 109208 | 109419 | ** clause requires that some column of the right table of the LEFT JOIN |
| | @@ -110635,11 +110846,11 @@ |
| 110635 | 110846 | return WRC_Prune; |
| 110636 | 110847 | } |
| 110637 | 110848 | if( ALWAYS(p->pEList) ){ |
| 110638 | 110849 | ExprList *pList = p->pEList; |
| 110639 | 110850 | for(i=0; i<pList->nExpr; i++){ |
| 110640 | | - if( pList->a[i].zEName && pList->a[i].eEName==ENAME_NAME ){ |
| 110851 | + if( pList->a[i].zEName && pList->a[i].fg.eEName==ENAME_NAME ){ |
| 110641 | 110852 | sqlite3RenameTokenRemap(pParse, 0, (void*)pList->a[i].zEName); |
| 110642 | 110853 | } |
| 110643 | 110854 | } |
| 110644 | 110855 | } |
| 110645 | 110856 | if( ALWAYS(p->pSrc) ){ /* Every Select as a SrcList, even if it is empty */ |
| | @@ -110684,11 +110895,11 @@ |
| 110684 | 110895 | memset(&sWalker, 0, sizeof(Walker)); |
| 110685 | 110896 | sWalker.pParse = pParse; |
| 110686 | 110897 | sWalker.xExprCallback = renameUnmapExprCb; |
| 110687 | 110898 | sqlite3WalkExprList(&sWalker, pEList); |
| 110688 | 110899 | for(i=0; i<pEList->nExpr; i++){ |
| 110689 | | - if( ALWAYS(pEList->a[i].eEName==ENAME_NAME) ){ |
| 110900 | + if( ALWAYS(pEList->a[i].fg.eEName==ENAME_NAME) ){ |
| 110690 | 110901 | sqlite3RenameTokenRemap(pParse, 0, (void*)pEList->a[i].zEName); |
| 110691 | 110902 | } |
| 110692 | 110903 | } |
| 110693 | 110904 | } |
| 110694 | 110905 | } |
| | @@ -110842,11 +111053,11 @@ |
| 110842 | 111053 | ){ |
| 110843 | 111054 | if( pEList ){ |
| 110844 | 111055 | int i; |
| 110845 | 111056 | for(i=0; i<pEList->nExpr; i++){ |
| 110846 | 111057 | const char *zName = pEList->a[i].zEName; |
| 110847 | | - if( ALWAYS(pEList->a[i].eEName==ENAME_NAME) |
| 111058 | + if( ALWAYS(pEList->a[i].fg.eEName==ENAME_NAME) |
| 110848 | 111059 | && ALWAYS(zName!=0) |
| 110849 | 111060 | && 0==sqlite3_stricmp(zName, zOld) |
| 110850 | 111061 | ){ |
| 110851 | 111062 | renameTokenFind(pParse, pCtx, (const void*)zName); |
| 110852 | 111063 | } |
| | @@ -111072,31 +111283,37 @@ |
| 111072 | 111283 | if( pParse->nErr ) rc = pParse->rc; |
| 111073 | 111284 | } |
| 111074 | 111285 | if( rc==SQLITE_OK && pStep->zTarget ){ |
| 111075 | 111286 | SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep); |
| 111076 | 111287 | if( pSrc ){ |
| 111077 | | - int i; |
| 111078 | | - for(i=0; i<pSrc->nSrc && rc==SQLITE_OK; i++){ |
| 111079 | | - SrcItem *p = &pSrc->a[i]; |
| 111080 | | - p->iCursor = pParse->nTab++; |
| 111081 | | - if( p->pSelect ){ |
| 111082 | | - sqlite3SelectPrep(pParse, p->pSelect, 0); |
| 111083 | | - sqlite3ExpandSubquery(pParse, p); |
| 111084 | | - assert( i>0 ); |
| 111085 | | - assert( pStep->pFrom->a[i-1].pSelect ); |
| 111086 | | - sqlite3SelectPrep(pParse, pStep->pFrom->a[i-1].pSelect, 0); |
| 111087 | | - }else{ |
| 111088 | | - p->pTab = sqlite3LocateTableItem(pParse, 0, p); |
| 111089 | | - if( p->pTab==0 ){ |
| 111090 | | - rc = SQLITE_ERROR; |
| 111091 | | - }else{ |
| 111092 | | - p->pTab->nTabRef++; |
| 111093 | | - rc = sqlite3ViewGetColumnNames(pParse, p->pTab); |
| 111288 | + Select *pSel = sqlite3SelectNew( |
| 111289 | + pParse, pStep->pExprList, pSrc, 0, 0, 0, 0, 0, 0 |
| 111290 | + ); |
| 111291 | + if( pSel==0 ){ |
| 111292 | + pStep->pExprList = 0; |
| 111293 | + pSrc = 0; |
| 111294 | + rc = SQLITE_NOMEM; |
| 111295 | + }else{ |
| 111296 | + sqlite3SelectPrep(pParse, pSel, 0); |
| 111297 | + rc = pParse->nErr ? SQLITE_ERROR : SQLITE_OK; |
| 111298 | + assert( pStep->pExprList==0 || pStep->pExprList==pSel->pEList ); |
| 111299 | + assert( pSrc==pSel->pSrc ); |
| 111300 | + if( pStep->pExprList ) pSel->pEList = 0; |
| 111301 | + pSel->pSrc = 0; |
| 111302 | + sqlite3SelectDelete(db, pSel); |
| 111303 | + } |
| 111304 | + if( pStep->pFrom ){ |
| 111305 | + int i; |
| 111306 | + for(i=0; i<pStep->pFrom->nSrc && rc==SQLITE_OK; i++){ |
| 111307 | + SrcItem *p = &pStep->pFrom->a[i]; |
| 111308 | + if( p->pSelect ){ |
| 111309 | + sqlite3SelectPrep(pParse, p->pSelect, 0); |
| 111094 | 111310 | } |
| 111095 | 111311 | } |
| 111096 | 111312 | } |
| 111097 | | - if( rc==SQLITE_OK && db->mallocFailed ){ |
| 111313 | + |
| 111314 | + if( db->mallocFailed ){ |
| 111098 | 111315 | rc = SQLITE_NOMEM; |
| 111099 | 111316 | } |
| 111100 | 111317 | sNC.pSrcList = pSrc; |
| 111101 | 111318 | if( rc==SQLITE_OK && pStep->pWhere ){ |
| 111102 | 111319 | rc = sqlite3ResolveExprNames(&sNC, pStep->pWhere); |
| | @@ -111543,10 +111760,19 @@ |
| 111543 | 111760 | if( rc==SQLITE_OK ){ |
| 111544 | 111761 | renameWalkTrigger(&sWalker, pTrigger); |
| 111545 | 111762 | for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){ |
| 111546 | 111763 | if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){ |
| 111547 | 111764 | renameTokenFind(&sParse, &sCtx, pStep->zTarget); |
| 111765 | + } |
| 111766 | + if( pStep->pFrom ){ |
| 111767 | + int i; |
| 111768 | + for(i=0; i<pStep->pFrom->nSrc; i++){ |
| 111769 | + SrcItem *pItem = &pStep->pFrom->a[i]; |
| 111770 | + if( 0==sqlite3_stricmp(pItem->zName, zOld) ){ |
| 111771 | + renameTokenFind(&sParse, &sCtx, pItem->zName); |
| 111772 | + } |
| 111773 | + } |
| 111548 | 111774 | } |
| 111549 | 111775 | } |
| 111550 | 111776 | } |
| 111551 | 111777 | } |
| 111552 | 111778 | } |
| | @@ -112867,13 +113093,18 @@ |
| 112867 | 113093 | ** * the index contains 100 rows, |
| 112868 | 113094 | ** * "WHERE a=?" matches 10 rows, and |
| 112869 | 113095 | ** * "WHERE a=? AND b=?" matches 2 rows. |
| 112870 | 113096 | ** |
| 112871 | 113097 | ** If D is the count of distinct values and K is the total number of |
| 112872 | | - ** rows, then each estimate is computed as: |
| 113098 | + ** rows, then each estimate is usually computed as: |
| 112873 | 113099 | ** |
| 112874 | 113100 | ** I = (K+D-1)/D |
| 113101 | + ** |
| 113102 | + ** In other words, I is K/D rounded up to the next whole integer. |
| 113103 | + ** However, if I is between 1.0 and 1.1 (in other words if I is |
| 113104 | + ** close to 1.0 but just a little larger) then do not round up but |
| 113105 | + ** instead keep the I value at 1.0. |
| 112875 | 113106 | */ |
| 112876 | 113107 | sqlite3_str sStat; /* Text of the constructed "stat" line */ |
| 112877 | 113108 | int i; /* Loop counter */ |
| 112878 | 113109 | |
| 112879 | 113110 | sqlite3StrAccumInit(&sStat, 0, 0, 0, (p->nKeyCol+1)*100); |
| | @@ -112880,10 +113111,11 @@ |
| 112880 | 113111 | sqlite3_str_appendf(&sStat, "%llu", |
| 112881 | 113112 | p->nSkipAhead ? (u64)p->nEst : (u64)p->nRow); |
| 112882 | 113113 | for(i=0; i<p->nKeyCol; i++){ |
| 112883 | 113114 | u64 nDistinct = p->current.anDLt[i] + 1; |
| 112884 | 113115 | u64 iVal = (p->nRow + nDistinct - 1) / nDistinct; |
| 113116 | + if( iVal==2 && p->nRow*10 <= nDistinct*11 ) iVal = 1; |
| 112885 | 113117 | sqlite3_str_appendf(&sStat, " %llu", iVal); |
| 112886 | 113118 | assert( p->current.anEq[i] ); |
| 112887 | 113119 | } |
| 112888 | 113120 | sqlite3ResultStrAccum(context, &sStat); |
| 112889 | 113121 | } |
| | @@ -115001,13 +115233,11 @@ |
| 115001 | 115233 | Returning *pReturning = pParse->u1.pReturning; |
| 115002 | 115234 | int addrRewind; |
| 115003 | 115235 | int i; |
| 115004 | 115236 | int reg; |
| 115005 | 115237 | |
| 115006 | | - if( NEVER(pReturning->nRetCol==0) ){ |
| 115007 | | - assert( CORRUPT_DB ); |
| 115008 | | - }else{ |
| 115238 | + if( pReturning->nRetCol ){ |
| 115009 | 115239 | sqlite3VdbeAddOp0(v, OP_FkCheck); |
| 115010 | 115240 | addrRewind = |
| 115011 | 115241 | sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur); |
| 115012 | 115242 | VdbeCoverage(v); |
| 115013 | 115243 | reg = pReturning->iRetReg; |
| | @@ -115099,13 +115329,11 @@ |
| 115099 | 115329 | } |
| 115100 | 115330 | } |
| 115101 | 115331 | |
| 115102 | 115332 | if( pParse->bReturning ){ |
| 115103 | 115333 | Returning *pRet = pParse->u1.pReturning; |
| 115104 | | - if( NEVER(pRet->nRetCol==0) ){ |
| 115105 | | - assert( CORRUPT_DB ); |
| 115106 | | - }else{ |
| 115334 | + if( pRet->nRetCol ){ |
| 115107 | 115335 | sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol); |
| 115108 | 115336 | } |
| 115109 | 115337 | } |
| 115110 | 115338 | |
| 115111 | 115339 | /* Finally, jump back to the beginning of the executable code. */ |
| | @@ -116723,11 +116951,11 @@ |
| 116723 | 116951 | } |
| 116724 | 116952 | pTab->iPKey = iCol; |
| 116725 | 116953 | pTab->keyConf = (u8)onError; |
| 116726 | 116954 | assert( autoInc==0 || autoInc==1 ); |
| 116727 | 116955 | pTab->tabFlags |= autoInc*TF_Autoincrement; |
| 116728 | | - if( pList ) pParse->iPkSortOrder = pList->a[0].sortFlags; |
| 116956 | + if( pList ) pParse->iPkSortOrder = pList->a[0].fg.sortFlags; |
| 116729 | 116957 | (void)sqlite3HasExplicitNulls(pParse, pList); |
| 116730 | 116958 | }else if( autoInc ){ |
| 116731 | 116959 | #ifndef SQLITE_OMIT_AUTOINCREMENT |
| 116732 | 116960 | sqlite3ErrorMsg(pParse, "AUTOINCREMENT is only allowed on an " |
| 116733 | 116961 | "INTEGER PRIMARY KEY"); |
| | @@ -117217,11 +117445,11 @@ |
| 117217 | 117445 | return; |
| 117218 | 117446 | } |
| 117219 | 117447 | if( IN_RENAME_OBJECT ){ |
| 117220 | 117448 | sqlite3RenameTokenRemap(pParse, pList->a[0].pExpr, &pTab->iPKey); |
| 117221 | 117449 | } |
| 117222 | | - pList->a[0].sortFlags = pParse->iPkSortOrder; |
| 117450 | + pList->a[0].fg.sortFlags = pParse->iPkSortOrder; |
| 117223 | 117451 | assert( pParse->pNewTable==pTab ); |
| 117224 | 117452 | pTab->iPKey = -1; |
| 117225 | 117453 | sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, |
| 117226 | 117454 | SQLITE_IDXTYPE_PRIMARYKEY); |
| 117227 | 117455 | if( pParse->nErr ){ |
| | @@ -117888,11 +118116,10 @@ |
| 117888 | 118116 | */ |
| 117889 | 118117 | SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ |
| 117890 | 118118 | Table *pSelTab; /* A fake table from which we get the result set */ |
| 117891 | 118119 | Select *pSel; /* Copy of the SELECT that implements the view */ |
| 117892 | 118120 | int nErr = 0; /* Number of errors encountered */ |
| 117893 | | - int n; /* Temporarily holds the number of cursors assigned */ |
| 117894 | 118121 | sqlite3 *db = pParse->db; /* Database connection for malloc errors */ |
| 117895 | 118122 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 117896 | 118123 | int rc; |
| 117897 | 118124 | #endif |
| 117898 | 118125 | #ifndef SQLITE_OMIT_AUTHORIZATION |
| | @@ -117946,12 +118173,13 @@ |
| 117946 | 118173 | */ |
| 117947 | 118174 | assert( IsView(pTable) ); |
| 117948 | 118175 | pSel = sqlite3SelectDup(db, pTable->u.view.pSelect, 0); |
| 117949 | 118176 | if( pSel ){ |
| 117950 | 118177 | u8 eParseMode = pParse->eParseMode; |
| 118178 | + int nTab = pParse->nTab; |
| 118179 | + int nSelect = pParse->nSelect; |
| 117951 | 118180 | pParse->eParseMode = PARSE_MODE_NORMAL; |
| 117952 | | - n = pParse->nTab; |
| 117953 | 118181 | sqlite3SrcListAssignCursors(pParse, pSel->pSrc); |
| 117954 | 118182 | pTable->nCol = -1; |
| 117955 | 118183 | DisableLookaside; |
| 117956 | 118184 | #ifndef SQLITE_OMIT_AUTHORIZATION |
| 117957 | 118185 | xAuth = db->xAuth; |
| | @@ -117959,11 +118187,12 @@ |
| 117959 | 118187 | pSelTab = sqlite3ResultSetOfSelect(pParse, pSel, SQLITE_AFF_NONE); |
| 117960 | 118188 | db->xAuth = xAuth; |
| 117961 | 118189 | #else |
| 117962 | 118190 | pSelTab = sqlite3ResultSetOfSelect(pParse, pSel, SQLITE_AFF_NONE); |
| 117963 | 118191 | #endif |
| 117964 | | - pParse->nTab = n; |
| 118192 | + pParse->nTab = nTab; |
| 118193 | + pParse->nSelect = nSelect; |
| 117965 | 118194 | if( pSelTab==0 ){ |
| 117966 | 118195 | pTable->nCol = 0; |
| 117967 | 118196 | nErr++; |
| 117968 | 118197 | }else if( pTable->pCheck ){ |
| 117969 | 118198 | /* CREATE VIEW name(arglist) AS ... |
| | @@ -118704,12 +118933,12 @@ |
| 118704 | 118933 | */ |
| 118705 | 118934 | SQLITE_PRIVATE int sqlite3HasExplicitNulls(Parse *pParse, ExprList *pList){ |
| 118706 | 118935 | if( pList ){ |
| 118707 | 118936 | int i; |
| 118708 | 118937 | for(i=0; i<pList->nExpr; i++){ |
| 118709 | | - if( pList->a[i].bNulls ){ |
| 118710 | | - u8 sf = pList->a[i].sortFlags; |
| 118938 | + if( pList->a[i].fg.bNulls ){ |
| 118939 | + u8 sf = pList->a[i].fg.sortFlags; |
| 118711 | 118940 | sqlite3ErrorMsg(pParse, "unsupported use of NULLS %s", |
| 118712 | 118941 | (sf==0 || sf==3) ? "FIRST" : "LAST" |
| 118713 | 118942 | ); |
| 118714 | 118943 | return 1; |
| 118715 | 118944 | } |
| | @@ -119058,11 +119287,11 @@ |
| 119058 | 119287 | if( !zColl ) zColl = sqlite3StrBINARY; |
| 119059 | 119288 | if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){ |
| 119060 | 119289 | goto exit_create_index; |
| 119061 | 119290 | } |
| 119062 | 119291 | pIndex->azColl[i] = zColl; |
| 119063 | | - requestedSortOrder = pListItem->sortFlags & sortOrderMask; |
| 119292 | + requestedSortOrder = pListItem->fg.sortFlags & sortOrderMask; |
| 119064 | 119293 | pIndex->aSortOrder[i] = (u8)requestedSortOrder; |
| 119065 | 119294 | } |
| 119066 | 119295 | |
| 119067 | 119296 | /* Append the table key to the end of the index. For WITHOUT ROWID |
| 119068 | 119297 | ** tables (when pPk!=0) this will be the declared PRIMARY KEY. For |
| | @@ -124139,15 +124368,15 @@ |
| 124139 | 124368 | }else{ |
| 124140 | 124369 | ans = log(x); |
| 124141 | 124370 | switch( SQLITE_PTR_TO_INT(sqlite3_user_data(context)) ){ |
| 124142 | 124371 | case 1: |
| 124143 | 124372 | /* Convert from natural logarithm to log base 10 */ |
| 124144 | | - ans *= 1.0/M_LN10; |
| 124373 | + ans /= M_LN10; |
| 124145 | 124374 | break; |
| 124146 | 124375 | case 2: |
| 124147 | 124376 | /* Convert from natural logarithm to log base 2 */ |
| 124148 | | - ans *= 1.0/M_LN2; |
| 124377 | + ans /= M_LN2; |
| 124149 | 124378 | break; |
| 124150 | 124379 | default: |
| 124151 | 124380 | break; |
| 124152 | 124381 | } |
| 124153 | 124382 | } |
| | @@ -124282,12 +124511,11 @@ |
| 124282 | 124511 | #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ |
| 124283 | 124512 | INLINE_FUNC(unlikely, 1, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY), |
| 124284 | 124513 | INLINE_FUNC(likelihood, 2, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY), |
| 124285 | 124514 | INLINE_FUNC(likely, 1, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY), |
| 124286 | 124515 | #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC |
| 124287 | | - {1, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_FUNC_OFFSET|SQLITE_FUNC_TYPEOF, |
| 124288 | | - 0, 0, noopFunc, 0, 0, 0, "sqlite_offset", {0} }, |
| 124516 | + INLINE_FUNC(sqlite_offset, 1, INLINEFUNC_sqlite_offset, 0 ), |
| 124289 | 124517 | #endif |
| 124290 | 124518 | FUNCTION(ltrim, 1, 1, 0, trimFunc ), |
| 124291 | 124519 | FUNCTION(ltrim, 2, 1, 0, trimFunc ), |
| 124292 | 124520 | FUNCTION(rtrim, 1, 2, 0, trimFunc ), |
| 124293 | 124521 | FUNCTION(rtrim, 2, 2, 0, trimFunc ), |
| | @@ -129567,10 +129795,11 @@ |
| 129567 | 129795 | /* Version 3.39.0 and later */ |
| 129568 | 129796 | int (*deserialize)(sqlite3*,const char*,unsigned char*, |
| 129569 | 129797 | sqlite3_int64,sqlite3_int64,unsigned); |
| 129570 | 129798 | unsigned char *(*serialize)(sqlite3*,const char *,sqlite3_int64*, |
| 129571 | 129799 | unsigned int); |
| 129800 | + const char *(*db_name)(sqlite3*,int); |
| 129572 | 129801 | }; |
| 129573 | 129802 | |
| 129574 | 129803 | /* |
| 129575 | 129804 | ** This is the function signature used for all extension entry points. It |
| 129576 | 129805 | ** is also defined in the file "loadext.c". |
| | @@ -129885,14 +130114,16 @@ |
| 129885 | 130114 | #define sqlite3_vtab_rhs_value sqlite3_api->vtab_rhs_value |
| 129886 | 130115 | #define sqlite3_vtab_distinct sqlite3_api->vtab_distinct |
| 129887 | 130116 | #define sqlite3_vtab_in sqlite3_api->vtab_in |
| 129888 | 130117 | #define sqlite3_vtab_in_first sqlite3_api->vtab_in_first |
| 129889 | 130118 | #define sqlite3_vtab_in_next sqlite3_api->vtab_in_next |
| 130119 | +/* Version 3.39.0 and later */ |
| 129890 | 130120 | #ifndef SQLITE_OMIT_DESERIALIZE |
| 129891 | 130121 | #define sqlite3_deserialize sqlite3_api->deserialize |
| 129892 | 130122 | #define sqlite3_serialize sqlite3_api->serialize |
| 129893 | 130123 | #endif |
| 130124 | +#define sqlite3_db_name sqlite3_api->db_name |
| 129894 | 130125 | #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ |
| 129895 | 130126 | |
| 129896 | 130127 | #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) |
| 129897 | 130128 | /* This case when the file really is being compiled as a loadable |
| 129898 | 130129 | ** extension */ |
| | @@ -130380,23 +130611,32 @@ |
| 130380 | 130611 | sqlite3_total_changes64, |
| 130381 | 130612 | /* Version 3.37.0 and later */ |
| 130382 | 130613 | sqlite3_autovacuum_pages, |
| 130383 | 130614 | /* Version 3.38.0 and later */ |
| 130384 | 130615 | sqlite3_error_offset, |
| 130616 | +#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 130385 | 130617 | sqlite3_vtab_rhs_value, |
| 130386 | 130618 | sqlite3_vtab_distinct, |
| 130387 | 130619 | sqlite3_vtab_in, |
| 130388 | 130620 | sqlite3_vtab_in_first, |
| 130389 | 130621 | sqlite3_vtab_in_next, |
| 130622 | +#else |
| 130623 | + 0, |
| 130624 | + 0, |
| 130625 | + 0, |
| 130626 | + 0, |
| 130627 | + 0, |
| 130628 | +#endif |
| 130390 | 130629 | /* Version 3.39.0 and later */ |
| 130391 | 130630 | #ifndef SQLITE_OMIT_DESERIALIZE |
| 130392 | 130631 | sqlite3_deserialize, |
| 130393 | | - sqlite3_serialize |
| 130632 | + sqlite3_serialize, |
| 130394 | 130633 | #else |
| 130634 | + 0, |
| 130395 | 130635 | 0, |
| 130396 | | - 0 |
| 130397 | 130636 | #endif |
| 130637 | + sqlite3_db_name |
| 130398 | 130638 | }; |
| 130399 | 130639 | |
| 130400 | 130640 | /* True if x is the directory separator character |
| 130401 | 130641 | */ |
| 130402 | 130642 | #if SQLITE_OS_WIN |
| | @@ -134828,10 +135068,18 @@ |
| 134828 | 135068 | db->pParse = pParse; |
| 134829 | 135069 | pParse->db = db; |
| 134830 | 135070 | if( db->mallocFailed ) sqlite3ErrorMsg(pParse, "out of memory"); |
| 134831 | 135071 | } |
| 134832 | 135072 | |
| 135073 | +/* |
| 135074 | +** Maximum number of times that we will try again to prepare a statement |
| 135075 | +** that returns SQLITE_ERROR_RETRY. |
| 135076 | +*/ |
| 135077 | +#ifndef SQLITE_MAX_PREPARE_RETRY |
| 135078 | +# define SQLITE_MAX_PREPARE_RETRY 25 |
| 135079 | +#endif |
| 135080 | + |
| 134833 | 135081 | /* |
| 134834 | 135082 | ** Compile the UTF-8 encoded SQL statement zSql into a statement handle. |
| 134835 | 135083 | */ |
| 134836 | 135084 | static int sqlite3Prepare( |
| 134837 | 135085 | sqlite3 *db, /* Database handle. */ |
| | @@ -135002,11 +135250,11 @@ |
| 135002 | 135250 | ** or encounters a permanent error. A schema problem after one schema |
| 135003 | 135251 | ** reset is considered a permanent error. */ |
| 135004 | 135252 | rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail); |
| 135005 | 135253 | assert( rc==SQLITE_OK || *ppStmt==0 ); |
| 135006 | 135254 | if( rc==SQLITE_OK || db->mallocFailed ) break; |
| 135007 | | - }while( rc==SQLITE_ERROR_RETRY |
| 135255 | + }while( (rc==SQLITE_ERROR_RETRY && (cnt++)<SQLITE_MAX_PREPARE_RETRY) |
| 135008 | 135256 | || (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) ); |
| 135009 | 135257 | sqlite3BtreeLeaveAll(db); |
| 135010 | 135258 | rc = sqlite3ApiExit(db, rc); |
| 135011 | 135259 | assert( (rc&db->errMask)==rc ); |
| 135012 | 135260 | db->busyHandler.nBusy = 0; |
| | @@ -135553,11 +135801,11 @@ |
| 135553 | 135801 | ExprList *pResults; |
| 135554 | 135802 | assert( pItem->pSelect!=0 ); |
| 135555 | 135803 | pResults = pItem->pSelect->pEList; |
| 135556 | 135804 | assert( pResults!=0 ); |
| 135557 | 135805 | assert( iCol>=0 && iCol<pResults->nExpr ); |
| 135558 | | - pResults->a[iCol].bUsed = 1; |
| 135806 | + pResults->a[iCol].fg.bUsed = 1; |
| 135559 | 135807 | } |
| 135560 | 135808 | } |
| 135561 | 135809 | |
| 135562 | 135810 | /* |
| 135563 | 135811 | ** Search the tables iStart..iEnd (inclusive) in pSrc, looking for a |
| | @@ -135600,15 +135848,15 @@ |
| 135600 | 135848 | } |
| 135601 | 135849 | return 0; |
| 135602 | 135850 | } |
| 135603 | 135851 | |
| 135604 | 135852 | /* |
| 135605 | | -** Set the EP_FromJoin property on all terms of the given expression. |
| 135853 | +** Set the EP_OuterON property on all terms of the given expression. |
| 135606 | 135854 | ** And set the Expr.w.iJoin to iTable for every term in the |
| 135607 | 135855 | ** expression. |
| 135608 | 135856 | ** |
| 135609 | | -** The EP_FromJoin property is used on terms of an expression to tell |
| 135857 | +** The EP_OuterON property is used on terms of an expression to tell |
| 135610 | 135858 | ** the OUTER JOIN processing logic that this term is part of the |
| 135611 | 135859 | ** join restriction specified in the ON or USING clause and not a part |
| 135612 | 135860 | ** of the more general WHERE clause. These terms are moved over to the |
| 135613 | 135861 | ** WHERE clause during join processing but we need to remember that they |
| 135614 | 135862 | ** originated in the ON or USING clause. |
| | @@ -135626,11 +135874,11 @@ |
| 135626 | 135874 | ** defer the handling of t1.x=5, it will be processed immediately |
| 135627 | 135875 | ** after the t1 loop and rows with t1.x!=5 will never appear in |
| 135628 | 135876 | ** the output, which is incorrect. |
| 135629 | 135877 | */ |
| 135630 | 135878 | SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable, u32 joinFlag){ |
| 135631 | | - assert( joinFlag==EP_FromJoin || joinFlag==EP_InnerJoin ); |
| 135879 | + assert( joinFlag==EP_OuterON || joinFlag==EP_InnerON ); |
| 135632 | 135880 | while( p ){ |
| 135633 | 135881 | ExprSetProperty(p, joinFlag); |
| 135634 | 135882 | assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); |
| 135635 | 135883 | ExprSetVVAProperty(p, EP_NoReduce); |
| 135636 | 135884 | p->w.iJoin = iTable; |
| | @@ -135647,21 +135895,21 @@ |
| 135647 | 135895 | p = p->pRight; |
| 135648 | 135896 | } |
| 135649 | 135897 | } |
| 135650 | 135898 | |
| 135651 | 135899 | /* Undo the work of sqlite3SetJoinExpr(). In the expression p, convert every |
| 135652 | | -** term that is marked with EP_FromJoin and w.iJoin==iTable into |
| 135653 | | -** an ordinary term that omits the EP_FromJoin mark. |
| 135900 | +** term that is marked with EP_OuterON and w.iJoin==iTable into |
| 135901 | +** an ordinary term that omits the EP_OuterON mark. |
| 135654 | 135902 | ** |
| 135655 | 135903 | ** This happens when a LEFT JOIN is simplified into an ordinary JOIN. |
| 135656 | 135904 | */ |
| 135657 | 135905 | static void unsetJoinExpr(Expr *p, int iTable){ |
| 135658 | 135906 | while( p ){ |
| 135659 | | - if( ExprHasProperty(p, EP_FromJoin) |
| 135907 | + if( ExprHasProperty(p, EP_OuterON) |
| 135660 | 135908 | && (iTable<0 || p->w.iJoin==iTable) ){ |
| 135661 | | - ExprClearProperty(p, EP_FromJoin); |
| 135662 | | - ExprSetProperty(p, EP_InnerJoin); |
| 135909 | + ExprClearProperty(p, EP_OuterON); |
| 135910 | + ExprSetProperty(p, EP_InnerON); |
| 135663 | 135911 | } |
| 135664 | 135912 | if( p->op==TK_COLUMN && p->iTable==iTable ){ |
| 135665 | 135913 | ExprClearProperty(p, EP_CanBeNull); |
| 135666 | 135914 | } |
| 135667 | 135915 | if( p->op==TK_FUNCTION ){ |
| | @@ -135685,12 +135933,12 @@ |
| 135685 | 135933 | ** do not need to be concerned with NATURAL joins and we only have |
| 135686 | 135934 | ** think about USING joins. |
| 135687 | 135935 | ** |
| 135688 | 135936 | ** * ON and USING clauses result in extra terms being added to the |
| 135689 | 135937 | ** WHERE clause to enforce the specified constraints. The extra |
| 135690 | | -** WHERE clause terms will be tagged with EP_FromJoin or |
| 135691 | | -** EP_InnerJoin so that we know that they originated in ON/USING. |
| 135938 | +** WHERE clause terms will be tagged with EP_OuterON or |
| 135939 | +** EP_InnerON so that we know that they originated in ON/USING. |
| 135692 | 135940 | ** |
| 135693 | 135941 | ** The terms of a FROM clause are contained in the Select.pSrc structure. |
| 135694 | 135942 | ** The left most table is the first entry in Select.pSrc. The right-most |
| 135695 | 135943 | ** table is the last entry. The join operator is held in the entry to |
| 135696 | 135944 | ** the right. Thus entry 1 contains the join operator for the join between |
| | @@ -135711,11 +135959,11 @@ |
| 135711 | 135959 | for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){ |
| 135712 | 135960 | Table *pRightTab = pRight->pTab; |
| 135713 | 135961 | u32 joinType; |
| 135714 | 135962 | |
| 135715 | 135963 | if( NEVER(pLeft->pTab==0 || pRightTab==0) ) continue; |
| 135716 | | - joinType = (pRight->fg.jointype & JT_OUTER)!=0 ? EP_FromJoin : EP_InnerJoin; |
| 135964 | + joinType = (pRight->fg.jointype & JT_OUTER)!=0 ? EP_OuterON : EP_InnerON; |
| 135717 | 135965 | |
| 135718 | 135966 | /* If this is a NATURAL join, synthesize an approprate USING clause |
| 135719 | 135967 | ** to specify which columns should be joined. |
| 135720 | 135968 | */ |
| 135721 | 135969 | if( pRight->fg.jointype & JT_NATURAL ){ |
| | @@ -136221,11 +136469,11 @@ |
| 136221 | 136469 | ** the row from table t1 is stored instead. Then, as records are extracted from |
| 136222 | 136470 | ** the sorter to return to the user, the required value of bigblob is |
| 136223 | 136471 | ** retrieved directly from table t1. If the values are very large, this |
| 136224 | 136472 | ** can be more efficient than storing them directly in the sorter records. |
| 136225 | 136473 | ** |
| 136226 | | -** The ExprList_item.bSorterRef flag is set for each expression in pEList |
| 136474 | +** The ExprList_item.fg.bSorterRef flag is set for each expression in pEList |
| 136227 | 136475 | ** for which the sorter-reference optimization should be enabled. |
| 136228 | 136476 | ** Additionally, the pSort->aDefer[] array is populated with entries |
| 136229 | 136477 | ** for all cursors required to evaluate all selected expressions. Finally. |
| 136230 | 136478 | ** output variable (*ppExtra) is set to an expression list containing |
| 136231 | 136479 | ** expressions for all extra PK values that should be stored in the |
| | @@ -136281,11 +136529,11 @@ |
| 136281 | 136529 | pSort->aDefer[nDefer].iCsr = pExpr->iTable; |
| 136282 | 136530 | pSort->aDefer[nDefer].nKey = nKey; |
| 136283 | 136531 | nDefer++; |
| 136284 | 136532 | } |
| 136285 | 136533 | } |
| 136286 | | - pItem->bSorterRef = 1; |
| 136534 | + pItem->fg.bSorterRef = 1; |
| 136287 | 136535 | } |
| 136288 | 136536 | } |
| 136289 | 136537 | } |
| 136290 | 136538 | pSort->nDefer = (u8)nDefer; |
| 136291 | 136539 | *ppExtra = pExtra; |
| | @@ -136412,11 +136660,11 @@ |
| 136412 | 136660 | ** from the sorter by the optimizations in this branch */ |
| 136413 | 136661 | pEList = p->pEList; |
| 136414 | 136662 | for(i=0; i<pEList->nExpr; i++){ |
| 136415 | 136663 | if( pEList->a[i].u.x.iOrderByCol>0 |
| 136416 | 136664 | #ifdef SQLITE_ENABLE_SORTER_REFERENCES |
| 136417 | | - || pEList->a[i].bSorterRef |
| 136665 | + || pEList->a[i].fg.bSorterRef |
| 136418 | 136666 | #endif |
| 136419 | 136667 | ){ |
| 136420 | 136668 | nResultCol--; |
| 136421 | 136669 | regOrig = 0; |
| 136422 | 136670 | } |
| | @@ -136774,11 +137022,11 @@ |
| 136774 | 137022 | pInfo = sqlite3KeyInfoAlloc(db, nExpr-iStart, nExtra+1); |
| 136775 | 137023 | if( pInfo ){ |
| 136776 | 137024 | assert( sqlite3KeyInfoIsWriteable(pInfo) ); |
| 136777 | 137025 | for(i=iStart, pItem=pList->a+iStart; i<nExpr; i++, pItem++){ |
| 136778 | 137026 | pInfo->aColl[i-iStart] = sqlite3ExprNNCollSeq(pParse, pItem->pExpr); |
| 136779 | | - pInfo->aSortFlags[i-iStart] = pItem->sortFlags; |
| 137027 | + pInfo->aSortFlags[i-iStart] = pItem->fg.sortFlags; |
| 136780 | 137028 | } |
| 136781 | 137029 | } |
| 136782 | 137030 | return pInfo; |
| 136783 | 137031 | } |
| 136784 | 137032 | |
| | @@ -136913,11 +137161,11 @@ |
| 136913 | 137161 | iSortTab = iTab; |
| 136914 | 137162 | bSeq = 1; |
| 136915 | 137163 | } |
| 136916 | 137164 | for(i=0, iCol=nKey+bSeq-1; i<nColumn; i++){ |
| 136917 | 137165 | #ifdef SQLITE_ENABLE_SORTER_REFERENCES |
| 136918 | | - if( aOutEx[i].bSorterRef ) continue; |
| 137166 | + if( aOutEx[i].fg.bSorterRef ) continue; |
| 136919 | 137167 | #endif |
| 136920 | 137168 | if( aOutEx[i].u.x.iOrderByCol==0 ) iCol++; |
| 136921 | 137169 | } |
| 136922 | 137170 | #ifdef SQLITE_ENABLE_SORTER_REFERENCES |
| 136923 | 137171 | if( pSort->nDefer ){ |
| | @@ -136950,11 +137198,11 @@ |
| 136950 | 137198 | sqlite3ReleaseTempRange(pParse, regKey, nRefKey); |
| 136951 | 137199 | } |
| 136952 | 137200 | #endif |
| 136953 | 137201 | for(i=nColumn-1; i>=0; i--){ |
| 136954 | 137202 | #ifdef SQLITE_ENABLE_SORTER_REFERENCES |
| 136955 | | - if( aOutEx[i].bSorterRef ){ |
| 137203 | + if( aOutEx[i].fg.bSorterRef ){ |
| 136956 | 137204 | sqlite3ExprCode(pParse, aOutEx[i].pExpr, regRow+i); |
| 136957 | 137205 | }else |
| 136958 | 137206 | #endif |
| 136959 | 137207 | { |
| 136960 | 137208 | int iRead; |
| | @@ -137316,11 +137564,11 @@ |
| 137316 | 137564 | |
| 137317 | 137565 | assert( p!=0 ); |
| 137318 | 137566 | assert( p->op!=TK_AGG_COLUMN ); /* Agg processing has not run yet */ |
| 137319 | 137567 | assert( p->op!=TK_COLUMN |
| 137320 | 137568 | || (ExprUseYTab(p) && p->y.pTab!=0) ); /* Covering idx not yet coded */ |
| 137321 | | - if( pEList->a[i].zEName && pEList->a[i].eEName==ENAME_NAME ){ |
| 137569 | + if( pEList->a[i].zEName && pEList->a[i].fg.eEName==ENAME_NAME ){ |
| 137322 | 137570 | /* An AS clause always takes first priority */ |
| 137323 | 137571 | char *zName = pEList->a[i].zEName; |
| 137324 | 137572 | sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT); |
| 137325 | 137573 | }else if( srcName && p->op==TK_COLUMN ){ |
| 137326 | 137574 | char *zCol; |
| | @@ -137402,26 +137650,28 @@ |
| 137402 | 137650 | *pnCol = nCol; |
| 137403 | 137651 | *paCol = aCol; |
| 137404 | 137652 | |
| 137405 | 137653 | for(i=0, pCol=aCol; i<nCol && !db->mallocFailed; i++, pCol++){ |
| 137406 | 137654 | struct ExprList_item *pX = &pEList->a[i]; |
| 137655 | + struct ExprList_item *pCollide; |
| 137407 | 137656 | /* Get an appropriate name for the column |
| 137408 | 137657 | */ |
| 137409 | | - if( (zName = pX->zEName)!=0 && pX->eEName==ENAME_NAME ){ |
| 137658 | + if( (zName = pX->zEName)!=0 && pX->fg.eEName==ENAME_NAME ){ |
| 137410 | 137659 | /* If the column contains an "AS <name>" phrase, use <name> as the name */ |
| 137411 | 137660 | }else{ |
| 137412 | 137661 | Expr *pColExpr = sqlite3ExprSkipCollateAndLikely(pX->pExpr); |
| 137413 | 137662 | while( ALWAYS(pColExpr!=0) && pColExpr->op==TK_DOT ){ |
| 137414 | 137663 | pColExpr = pColExpr->pRight; |
| 137415 | 137664 | assert( pColExpr!=0 ); |
| 137416 | 137665 | } |
| 137417 | 137666 | if( pColExpr->op==TK_COLUMN |
| 137418 | 137667 | && ALWAYS( ExprUseYTab(pColExpr) ) |
| 137419 | | - && (pTab = pColExpr->y.pTab)!=0 |
| 137668 | + && ALWAYS( pColExpr->y.pTab!=0 ) |
| 137420 | 137669 | ){ |
| 137421 | 137670 | /* For columns use the column name name */ |
| 137422 | 137671 | int iCol = pColExpr->iColumn; |
| 137672 | + pTab = pColExpr->y.pTab; |
| 137423 | 137673 | if( iCol<0 ) iCol = pTab->iPKey; |
| 137424 | 137674 | zName = iCol>=0 ? pTab->aCol[iCol].zCnName : "rowid"; |
| 137425 | 137675 | }else if( pColExpr->op==TK_ID ){ |
| 137426 | 137676 | assert( !ExprHasProperty(pColExpr, EP_IntValue) ); |
| 137427 | 137677 | zName = pColExpr->u.zToken; |
| | @@ -137438,11 +137688,14 @@ |
| 137438 | 137688 | |
| 137439 | 137689 | /* Make sure the column name is unique. If the name is not unique, |
| 137440 | 137690 | ** append an integer to the name so that it becomes unique. |
| 137441 | 137691 | */ |
| 137442 | 137692 | cnt = 0; |
| 137443 | | - while( zName && sqlite3HashFind(&ht, zName)!=0 ){ |
| 137693 | + while( zName && (pCollide = sqlite3HashFind(&ht, zName))!=0 ){ |
| 137694 | + if( pCollide->fg.bUsingTerm ){ |
| 137695 | + pCol->colFlags |= COLFLAG_NOEXPAND; |
| 137696 | + } |
| 137444 | 137697 | nName = sqlite3Strlen30(zName); |
| 137445 | 137698 | if( nName>0 ){ |
| 137446 | 137699 | for(j=nName-1; j>0 && sqlite3Isdigit(zName[j]); j--){} |
| 137447 | 137700 | if( zName[j]==':' ) nName = j; |
| 137448 | 137701 | } |
| | @@ -137449,12 +137702,15 @@ |
| 137449 | 137702 | zName = sqlite3MPrintf(db, "%.*z:%u", nName, zName, ++cnt); |
| 137450 | 137703 | if( cnt>3 ) sqlite3_randomness(sizeof(cnt), &cnt); |
| 137451 | 137704 | } |
| 137452 | 137705 | pCol->zCnName = zName; |
| 137453 | 137706 | pCol->hName = sqlite3StrIHash(zName); |
| 137707 | + if( pX->fg.bNoExpand ){ |
| 137708 | + pCol->colFlags |= COLFLAG_NOEXPAND; |
| 137709 | + } |
| 137454 | 137710 | sqlite3ColumnPropertiesFromName(0, pCol); |
| 137455 | | - if( zName && sqlite3HashInsert(&ht, zName, pCol)==pCol ){ |
| 137711 | + if( zName && sqlite3HashInsert(&ht, zName, pX)==pX ){ |
| 137456 | 137712 | sqlite3OomFault(db); |
| 137457 | 137713 | } |
| 137458 | 137714 | } |
| 137459 | 137715 | sqlite3HashClear(&ht); |
| 137460 | 137716 | if( db->mallocFailed ){ |
| | @@ -137707,11 +137963,11 @@ |
| 137707 | 137963 | pOrderBy->a[i].pExpr = |
| 137708 | 137964 | sqlite3ExprAddCollateString(pParse, pTerm, pColl->zName); |
| 137709 | 137965 | } |
| 137710 | 137966 | assert( sqlite3KeyInfoIsWriteable(pRet) ); |
| 137711 | 137967 | pRet->aColl[i] = pColl; |
| 137712 | | - pRet->aSortFlags[i] = pOrderBy->a[i].sortFlags; |
| 137968 | + pRet->aSortFlags[i] = pOrderBy->a[i].fg.sortFlags; |
| 137713 | 137969 | } |
| 137714 | 137970 | } |
| 137715 | 137971 | |
| 137716 | 137972 | return pRet; |
| 137717 | 137973 | } |
| | @@ -138977,11 +139233,11 @@ |
| 138977 | 139233 | static Expr *substExpr( |
| 138978 | 139234 | SubstContext *pSubst, /* Description of the substitution */ |
| 138979 | 139235 | Expr *pExpr /* Expr in which substitution occurs */ |
| 138980 | 139236 | ){ |
| 138981 | 139237 | if( pExpr==0 ) return 0; |
| 138982 | | - if( ExprHasProperty(pExpr, EP_FromJoin) |
| 139238 | + if( ExprHasProperty(pExpr, EP_OuterON) |
| 138983 | 139239 | && pExpr->w.iJoin==pSubst->iTable |
| 138984 | 139240 | ){ |
| 138985 | 139241 | pExpr->w.iJoin = pSubst->iNewTable; |
| 138986 | 139242 | } |
| 138987 | 139243 | if( pExpr->op==TK_COLUMN |
| | @@ -139018,16 +139274,21 @@ |
| 139018 | 139274 | return pExpr; |
| 139019 | 139275 | } |
| 139020 | 139276 | if( pSubst->isOuterJoin ){ |
| 139021 | 139277 | ExprSetProperty(pNew, EP_CanBeNull); |
| 139022 | 139278 | } |
| 139023 | | - if( ExprHasProperty(pExpr,EP_FromJoin|EP_InnerJoin) ){ |
| 139279 | + if( ExprHasProperty(pExpr,EP_OuterON|EP_InnerON) ){ |
| 139024 | 139280 | sqlite3SetJoinExpr(pNew, pExpr->w.iJoin, |
| 139025 | | - pExpr->flags & (EP_FromJoin|EP_InnerJoin)); |
| 139281 | + pExpr->flags & (EP_OuterON|EP_InnerON)); |
| 139026 | 139282 | } |
| 139027 | 139283 | sqlite3ExprDelete(db, pExpr); |
| 139028 | 139284 | pExpr = pNew; |
| 139285 | + if( pExpr->op==TK_TRUEFALSE ){ |
| 139286 | + pExpr->u.iValue = sqlite3ExprTruthValue(pExpr); |
| 139287 | + pExpr->op = TK_INTEGER; |
| 139288 | + ExprSetProperty(pExpr, EP_IntValue); |
| 139289 | + } |
| 139029 | 139290 | |
| 139030 | 139291 | /* Ensure that the expression now has an implicit collation sequence, |
| 139031 | 139292 | ** just as it did when it was a column of a view or sub-query. */ |
| 139032 | 139293 | if( pExpr->op!=TK_COLUMN && pExpr->op!=TK_COLLATE ){ |
| 139033 | 139294 | CollSeq *pColl = sqlite3ExprCollSeq(pSubst->pParse, pExpr); |
| | @@ -139184,11 +139445,11 @@ |
| 139184 | 139445 | static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){ |
| 139185 | 139446 | int op = pExpr->op; |
| 139186 | 139447 | if( op==TK_COLUMN || op==TK_IF_NULL_ROW ){ |
| 139187 | 139448 | renumberCursorDoMapping(pWalker, &pExpr->iTable); |
| 139188 | 139449 | } |
| 139189 | | - if( ExprHasProperty(pExpr, EP_FromJoin) ){ |
| 139450 | + if( ExprHasProperty(pExpr, EP_OuterON) ){ |
| 139190 | 139451 | renumberCursorDoMapping(pWalker, &pExpr->w.iJoin); |
| 139191 | 139452 | } |
| 139192 | 139453 | return WRC_Continue; |
| 139193 | 139454 | } |
| 139194 | 139455 | |
| | @@ -139375,10 +139636,12 @@ |
| 139375 | 139636 | ** See also (3) for restrictions on LEFT JOIN. |
| 139376 | 139637 | ** |
| 139377 | 139638 | ** (27) The subquery may not contain a FULL or RIGHT JOIN unless it |
| 139378 | 139639 | ** is the first element of the parent query. |
| 139379 | 139640 | ** |
| 139641 | +** (28) The subquery is not a MATERIALIZED CTE. |
| 139642 | +** |
| 139380 | 139643 | ** |
| 139381 | 139644 | ** In this routine, the "p" parameter is a pointer to the outer query. |
| 139382 | 139645 | ** The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query |
| 139383 | 139646 | ** uses aggregates. |
| 139384 | 139647 | ** |
| | @@ -139498,10 +139761,13 @@ |
| 139498 | 139761 | |
| 139499 | 139762 | assert( pSubSrc->nSrc>0 ); /* True by restriction (7) */ |
| 139500 | 139763 | if( iFrom>0 && (pSubSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){ |
| 139501 | 139764 | return 0; /* Restriction (27) */ |
| 139502 | 139765 | } |
| 139766 | + if( pSubitem->fg.isCte && pSubitem->u2.pCteUse->eM10d==M10d_Yes ){ |
| 139767 | + return 0; /* (28) */ |
| 139768 | + } |
| 139503 | 139769 | |
| 139504 | 139770 | /* Restriction (17): If the sub-query is a compound SELECT, then it must |
| 139505 | 139771 | ** use only the UNION ALL operator. And none of the simple select queries |
| 139506 | 139772 | ** that make up the compound SELECT are allowed to be aggregate or distinct |
| 139507 | 139773 | ** queries. |
| | @@ -139542,10 +139808,11 @@ |
| 139542 | 139808 | /* Restriction (23) */ |
| 139543 | 139809 | if( (p->selFlags & SF_Recursive) ) return 0; |
| 139544 | 139810 | |
| 139545 | 139811 | if( pSrc->nSrc>1 ){ |
| 139546 | 139812 | if( pParse->nSelect>500 ) return 0; |
| 139813 | + if( OptimizationDisabled(db, SQLITE_FlttnUnionAll) ) return 0; |
| 139547 | 139814 | aCsrMap = sqlite3DbMallocZero(db, ((i64)pParse->nTab+1)*sizeof(int)); |
| 139548 | 139815 | if( aCsrMap ) aCsrMap[0] = pParse->nTab; |
| 139549 | 139816 | } |
| 139550 | 139817 | } |
| 139551 | 139818 | |
| | @@ -139756,11 +140023,11 @@ |
| 139756 | 140023 | pSub->pOrderBy = 0; |
| 139757 | 140024 | } |
| 139758 | 140025 | pWhere = pSub->pWhere; |
| 139759 | 140026 | pSub->pWhere = 0; |
| 139760 | 140027 | if( isOuterJoin>0 ){ |
| 139761 | | - sqlite3SetJoinExpr(pWhere, iNewParent, EP_FromJoin); |
| 140028 | + sqlite3SetJoinExpr(pWhere, iNewParent, EP_OuterON); |
| 139762 | 140029 | } |
| 139763 | 140030 | if( pWhere ){ |
| 139764 | 140031 | if( pParent->pWhere ){ |
| 139765 | 140032 | pParent->pWhere = sqlite3PExpr(pParse, TK_AND, pWhere, pParent->pWhere); |
| 139766 | 140033 | }else{ |
| | @@ -139889,11 +140156,11 @@ |
| 139889 | 140156 | ** found, add it to the pConst structure. |
| 139890 | 140157 | */ |
| 139891 | 140158 | static void findConstInWhere(WhereConst *pConst, Expr *pExpr){ |
| 139892 | 140159 | Expr *pRight, *pLeft; |
| 139893 | 140160 | if( NEVER(pExpr==0) ) return; |
| 139894 | | - if( ExprHasProperty(pExpr, EP_FromJoin) ) return; |
| 140161 | + if( ExprHasProperty(pExpr, EP_OuterON) ) return; |
| 139895 | 140162 | if( pExpr->op==TK_AND ){ |
| 139896 | 140163 | findConstInWhere(pConst, pExpr->pRight); |
| 139897 | 140164 | findConstInWhere(pConst, pExpr->pLeft); |
| 139898 | 140165 | return; |
| 139899 | 140166 | } |
| | @@ -139925,13 +140192,13 @@ |
| 139925 | 140192 | int bIgnoreAffBlob |
| 139926 | 140193 | ){ |
| 139927 | 140194 | int i; |
| 139928 | 140195 | if( pConst->pOomFault[0] ) return WRC_Prune; |
| 139929 | 140196 | if( pExpr->op!=TK_COLUMN ) return WRC_Continue; |
| 139930 | | - if( ExprHasProperty(pExpr, EP_FixedCol|EP_FromJoin) ){ |
| 140197 | + if( ExprHasProperty(pExpr, EP_FixedCol|EP_OuterON) ){ |
| 139931 | 140198 | testcase( ExprHasProperty(pExpr, EP_FixedCol) ); |
| 139932 | | - testcase( ExprHasProperty(pExpr, EP_FromJoin) ); |
| 140199 | + testcase( ExprHasProperty(pExpr, EP_OuterON) ); |
| 139933 | 140200 | return WRC_Continue; |
| 139934 | 140201 | } |
| 139935 | 140202 | for(i=0; i<pConst->nConst; i++){ |
| 139936 | 140203 | Expr *pColumn = pConst->apExpr[i*2]; |
| 139937 | 140204 | if( pColumn==pExpr ) continue; |
| | @@ -140170,17 +140437,17 @@ |
| 140170 | 140437 | */ |
| 140171 | 140438 | static int pushDownWhereTerms( |
| 140172 | 140439 | Parse *pParse, /* Parse context (for malloc() and error reporting) */ |
| 140173 | 140440 | Select *pSubq, /* The subquery whose WHERE clause is to be augmented */ |
| 140174 | 140441 | Expr *pWhere, /* The WHERE clause of the outer query */ |
| 140175 | | - int iCursor, /* Cursor number of the subquery */ |
| 140176 | | - int isLeftJoin /* True if pSubq is the right term of a LEFT JOIN */ |
| 140442 | + SrcItem *pSrc /* The subquery term of the outer FROM clause */ |
| 140177 | 140443 | ){ |
| 140178 | 140444 | Expr *pNew; |
| 140179 | 140445 | int nChng = 0; |
| 140180 | 140446 | if( pWhere==0 ) return 0; |
| 140181 | 140447 | if( pSubq->selFlags & (SF_Recursive|SF_MultiPart) ) return 0; |
| 140448 | + if( pSrc->fg.jointype & (JT_LTORJ|JT_RIGHT) ) return 0; |
| 140182 | 140449 | |
| 140183 | 140450 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 140184 | 140451 | if( pSubq->pPrior ){ |
| 140185 | 140452 | Select *pSel; |
| 140186 | 140453 | for(pSel=pSubq; pSel; pSel=pSel->pPrior){ |
| | @@ -140206,35 +140473,38 @@ |
| 140206 | 140473 | |
| 140207 | 140474 | if( pSubq->pLimit!=0 ){ |
| 140208 | 140475 | return 0; /* restriction (3) */ |
| 140209 | 140476 | } |
| 140210 | 140477 | while( pWhere->op==TK_AND ){ |
| 140211 | | - nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, |
| 140212 | | - iCursor, isLeftJoin); |
| 140478 | + nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, pSrc); |
| 140213 | 140479 | pWhere = pWhere->pLeft; |
| 140214 | 140480 | } |
| 140481 | + |
| 140482 | +#if 0 /* Legacy code. Checks now done by sqlite3ExprIsTableConstraint() */ |
| 140215 | 140483 | if( isLeftJoin |
| 140216 | | - && (ExprHasProperty(pWhere,EP_FromJoin)==0 |
| 140484 | + && (ExprHasProperty(pWhere,EP_OuterON)==0 |
| 140217 | 140485 | || pWhere->w.iJoin!=iCursor) |
| 140218 | 140486 | ){ |
| 140219 | 140487 | return 0; /* restriction (4) */ |
| 140220 | 140488 | } |
| 140221 | | - if( ExprHasProperty(pWhere,EP_FromJoin) |
| 140489 | + if( ExprHasProperty(pWhere,EP_OuterON) |
| 140222 | 140490 | && pWhere->w.iJoin!=iCursor |
| 140223 | 140491 | ){ |
| 140224 | 140492 | return 0; /* restriction (5) */ |
| 140225 | 140493 | } |
| 140226 | | - if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){ |
| 140494 | +#endif |
| 140495 | + |
| 140496 | + if( sqlite3ExprIsTableConstraint(pWhere, pSrc) ){ |
| 140227 | 140497 | nChng++; |
| 140228 | 140498 | pSubq->selFlags |= SF_PushDown; |
| 140229 | 140499 | while( pSubq ){ |
| 140230 | 140500 | SubstContext x; |
| 140231 | 140501 | pNew = sqlite3ExprDup(pParse->db, pWhere, 0); |
| 140232 | 140502 | unsetJoinExpr(pNew, -1); |
| 140233 | 140503 | x.pParse = pParse; |
| 140234 | | - x.iTable = iCursor; |
| 140235 | | - x.iNewTable = iCursor; |
| 140504 | + x.iTable = pSrc->iCursor; |
| 140505 | + x.iNewTable = pSrc->iCursor; |
| 140236 | 140506 | x.isOuterJoin = 0; |
| 140237 | 140507 | x.pEList = pSubq->pEList; |
| 140238 | 140508 | pNew = substExpr(&x, pNew); |
| 140239 | 140509 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 140240 | 140510 | if( pSubq->pWin && 0==pushDownWindowCheck(pParse, pSubq, pNew) ){ |
| | @@ -140304,11 +140574,11 @@ |
| 140304 | 140574 | }else{ |
| 140305 | 140575 | return eRet; |
| 140306 | 140576 | } |
| 140307 | 140577 | *ppMinMax = pOrderBy = sqlite3ExprListDup(db, pEList, 0); |
| 140308 | 140578 | assert( pOrderBy!=0 || db->mallocFailed ); |
| 140309 | | - if( pOrderBy ) pOrderBy->a[0].sortFlags = sortFlags; |
| 140579 | + if( pOrderBy ) pOrderBy->a[0].fg.sortFlags = sortFlags; |
| 140310 | 140580 | return eRet; |
| 140311 | 140581 | } |
| 140312 | 140582 | |
| 140313 | 140583 | /* |
| 140314 | 140584 | ** The select statement passed as the first argument is an aggregate query. |
| | @@ -140773,11 +141043,11 @@ |
| 140773 | 141043 | if( pTab==0 ) return SQLITE_NOMEM; |
| 140774 | 141044 | pTab->nTabRef = 1; |
| 140775 | 141045 | if( pFrom->zAlias ){ |
| 140776 | 141046 | pTab->zName = sqlite3DbStrDup(pParse->db, pFrom->zAlias); |
| 140777 | 141047 | }else{ |
| 140778 | | - pTab->zName = sqlite3MPrintf(pParse->db, "subquery_%u", pSel->selId); |
| 141048 | + pTab->zName = sqlite3MPrintf(pParse->db, "%!S", pFrom); |
| 140779 | 141049 | } |
| 140780 | 141050 | while( pSel->pPrior ){ pSel = pSel->pPrior; } |
| 140781 | 141051 | sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol); |
| 140782 | 141052 | pTab->iPKey = -1; |
| 140783 | 141053 | pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) ); |
| | @@ -141011,11 +141281,11 @@ |
| 141011 | 141281 | /* This particular expression does not need to be expanded. |
| 141012 | 141282 | */ |
| 141013 | 141283 | pNew = sqlite3ExprListAppend(pParse, pNew, a[k].pExpr); |
| 141014 | 141284 | if( pNew ){ |
| 141015 | 141285 | pNew->a[pNew->nExpr-1].zEName = a[k].zEName; |
| 141016 | | - pNew->a[pNew->nExpr-1].eEName = a[k].eEName; |
| 141286 | + pNew->a[pNew->nExpr-1].fg.eEName = a[k].fg.eEName; |
| 141017 | 141287 | a[k].zEName = 0; |
| 141018 | 141288 | } |
| 141019 | 141289 | a[k].pExpr = 0; |
| 141020 | 141290 | }else{ |
| 141021 | 141291 | /* This expression is a "*" or a "TABLE.*" and needs to be |
| | @@ -141026,39 +141296,64 @@ |
| 141026 | 141296 | assert( pE->pLeft!=0 ); |
| 141027 | 141297 | assert( !ExprHasProperty(pE->pLeft, EP_IntValue) ); |
| 141028 | 141298 | zTName = pE->pLeft->u.zToken; |
| 141029 | 141299 | } |
| 141030 | 141300 | for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){ |
| 141031 | | - Table *pTab = pFrom->pTab; |
| 141032 | | - Select *pSub; |
| 141033 | | - char *zTabName = pFrom->zAlias; |
| 141034 | | - const char *zSchemaName = 0; |
| 141035 | | - int iDb; |
| 141036 | | - if( zTabName==0 ){ |
| 141301 | + Table *pTab = pFrom->pTab; /* Table for this data source */ |
| 141302 | + ExprList *pNestedFrom; /* Result-set of a nested FROM clause */ |
| 141303 | + char *zTabName; /* AS name for this data source */ |
| 141304 | + const char *zSchemaName = 0; /* Schema name for this data source */ |
| 141305 | + int iDb; /* Schema index for this data src */ |
| 141306 | + IdList *pUsing; /* USING clause for pFrom[1] */ |
| 141307 | + |
| 141308 | + if( (zTabName = pFrom->zAlias)==0 ){ |
| 141037 | 141309 | zTabName = pTab->zName; |
| 141038 | 141310 | } |
| 141039 | 141311 | if( db->mallocFailed ) break; |
| 141040 | 141312 | assert( pFrom->fg.isNestedFrom == IsNestedFrom(pFrom->pSelect) ); |
| 141041 | 141313 | if( pFrom->fg.isNestedFrom ){ |
| 141042 | | - pSub = pFrom->pSelect; |
| 141043 | | - assert( pSub->pEList!=0 ); |
| 141044 | | - assert( pSub->pEList->nExpr==pTab->nCol ); |
| 141314 | + assert( pFrom->pSelect!=0 ); |
| 141315 | + pNestedFrom = pFrom->pSelect->pEList; |
| 141316 | + assert( pNestedFrom!=0 ); |
| 141317 | + assert( pNestedFrom->nExpr==pTab->nCol ); |
| 141045 | 141318 | }else{ |
| 141046 | | - pSub = 0; |
| 141047 | 141319 | if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){ |
| 141048 | 141320 | continue; |
| 141049 | 141321 | } |
| 141322 | + pNestedFrom = 0; |
| 141050 | 141323 | iDb = sqlite3SchemaToIndex(db, pTab->pSchema); |
| 141051 | 141324 | zSchemaName = iDb>=0 ? db->aDb[iDb].zDbSName : "*"; |
| 141325 | + } |
| 141326 | + if( i+1<pTabList->nSrc |
| 141327 | + && pFrom[1].fg.isUsing |
| 141328 | + && (selFlags & SF_NestedFrom)!=0 |
| 141329 | + ){ |
| 141330 | + int ii; |
| 141331 | + pUsing = pFrom[1].u3.pUsing; |
| 141332 | + for(ii=0; ii<pUsing->nId; ii++){ |
| 141333 | + const char *zUName = pUsing->a[ii].zName; |
| 141334 | + pRight = sqlite3Expr(db, TK_ID, zUName); |
| 141335 | + pNew = sqlite3ExprListAppend(pParse, pNew, pRight); |
| 141336 | + if( pNew ){ |
| 141337 | + struct ExprList_item *pX = &pNew->a[pNew->nExpr-1]; |
| 141338 | + assert( pX->zEName==0 ); |
| 141339 | + pX->zEName = sqlite3MPrintf(db,"..%s", zUName); |
| 141340 | + pX->fg.eEName = ENAME_TAB; |
| 141341 | + pX->fg.bUsingTerm = 1; |
| 141342 | + } |
| 141343 | + } |
| 141344 | + }else{ |
| 141345 | + pUsing = 0; |
| 141052 | 141346 | } |
| 141053 | 141347 | for(j=0; j<pTab->nCol; j++){ |
| 141054 | 141348 | char *zName = pTab->aCol[j].zCnName; |
| 141055 | 141349 | struct ExprList_item *pX; /* Newly added ExprList term */ |
| 141056 | 141350 | |
| 141057 | 141351 | assert( zName ); |
| 141058 | | - if( zTName && pSub |
| 141059 | | - && sqlite3MatchEName(&pSub->pEList->a[j], 0, zTName, 0)==0 |
| 141352 | + if( zTName |
| 141353 | + && pNestedFrom |
| 141354 | + && sqlite3MatchEName(&pNestedFrom->a[j], 0, zTName, 0)==0 |
| 141060 | 141355 | ){ |
| 141061 | 141356 | continue; |
| 141062 | 141357 | } |
| 141063 | 141358 | |
| 141064 | 141359 | /* If a column is marked as 'hidden', omit it from the expanded |
| | @@ -141067,14 +141362,20 @@ |
| 141067 | 141362 | */ |
| 141068 | 141363 | if( (p->selFlags & SF_IncludeHidden)==0 |
| 141069 | 141364 | && IsHiddenColumn(&pTab->aCol[j]) |
| 141070 | 141365 | ){ |
| 141071 | 141366 | continue; |
| 141367 | + } |
| 141368 | + if( (pTab->aCol[j].colFlags & COLFLAG_NOEXPAND)!=0 |
| 141369 | + && zTName==0 |
| 141370 | + && (selFlags & (SF_NestedFrom))==0 |
| 141371 | + ){ |
| 141372 | + continue; |
| 141072 | 141373 | } |
| 141073 | 141374 | tableSeen = 1; |
| 141074 | 141375 | |
| 141075 | | - if( i>0 && zTName==0 ){ |
| 141376 | + if( i>0 && zTName==0 && (selFlags & SF_NestedFrom)==0 ){ |
| 141076 | 141377 | if( pFrom->fg.isUsing |
| 141077 | 141378 | && sqlite3IdListIndex(pFrom->u3.pUsing, zName)>=0 |
| 141078 | 141379 | ){ |
| 141079 | 141380 | /* In a join with a USING clause, omit columns in the |
| 141080 | 141381 | ** using clause from the table on the right. */ |
| | @@ -141082,10 +141383,11 @@ |
| 141082 | 141383 | } |
| 141083 | 141384 | } |
| 141084 | 141385 | pRight = sqlite3Expr(db, TK_ID, zName); |
| 141085 | 141386 | if( (pTabList->nSrc>1 |
| 141086 | 141387 | && ( (pFrom->fg.jointype & JT_LTORJ)==0 |
| 141388 | + || (selFlags & SF_NestedFrom)!=0 |
| 141087 | 141389 | || !inAnyUsingClause(zName,pFrom,pTabList->nSrc-i-1) |
| 141088 | 141390 | ) |
| 141089 | 141391 | ) |
| 141090 | 141392 | || IN_RENAME_OBJECT |
| 141091 | 141393 | ){ |
| | @@ -141107,25 +141409,32 @@ |
| 141107 | 141409 | break; /* OOM */ |
| 141108 | 141410 | } |
| 141109 | 141411 | pX = &pNew->a[pNew->nExpr-1]; |
| 141110 | 141412 | assert( pX->zEName==0 ); |
| 141111 | 141413 | if( (selFlags & SF_NestedFrom)!=0 && !IN_RENAME_OBJECT ){ |
| 141112 | | - if( pSub ){ |
| 141113 | | - pX->zEName = sqlite3DbStrDup(db, pSub->pEList->a[j].zEName); |
| 141414 | + if( pNestedFrom ){ |
| 141415 | + pX->zEName = sqlite3DbStrDup(db, pNestedFrom->a[j].zEName); |
| 141114 | 141416 | testcase( pX->zEName==0 ); |
| 141115 | 141417 | }else{ |
| 141116 | 141418 | pX->zEName = sqlite3MPrintf(db, "%s.%s.%s", |
| 141117 | 141419 | zSchemaName, zTabName, zName); |
| 141118 | 141420 | testcase( pX->zEName==0 ); |
| 141119 | 141421 | } |
| 141120 | | - pX->eEName = ENAME_TAB; |
| 141422 | + pX->fg.eEName = ENAME_TAB; |
| 141423 | + if( (pFrom->fg.isUsing |
| 141424 | + && sqlite3IdListIndex(pFrom->u3.pUsing, zName)>=0) |
| 141425 | + || (pUsing && sqlite3IdListIndex(pUsing, zName)>=0) |
| 141426 | + || (pTab->aCol[j].colFlags & COLFLAG_NOEXPAND)!=0 |
| 141427 | + ){ |
| 141428 | + pX->fg.bNoExpand = 1; |
| 141429 | + } |
| 141121 | 141430 | }else if( longNames ){ |
| 141122 | 141431 | pX->zEName = sqlite3MPrintf(db, "%s.%s", zTabName, zName); |
| 141123 | | - pX->eEName = ENAME_NAME; |
| 141432 | + pX->fg.eEName = ENAME_NAME; |
| 141124 | 141433 | }else{ |
| 141125 | 141434 | pX->zEName = sqlite3DbStrDup(db, zName); |
| 141126 | | - pX->eEName = ENAME_NAME; |
| 141435 | + pX->fg.eEName = ENAME_NAME; |
| 141127 | 141436 | } |
| 141128 | 141437 | } |
| 141129 | 141438 | } |
| 141130 | 141439 | if( !tableSeen ){ |
| 141131 | 141440 | if( zTName ){ |
| | @@ -141684,10 +141993,33 @@ |
| 141684 | 141993 | } |
| 141685 | 141994 | #endif |
| 141686 | 141995 | return 1; |
| 141687 | 141996 | } |
| 141688 | 141997 | #endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */ |
| 141998 | + |
| 141999 | +/* |
| 142000 | +** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same |
| 142001 | +** as pSrcItem but has the same alias as p0, then return true. |
| 142002 | +** Otherwise return false. |
| 142003 | +*/ |
| 142004 | +static int sameSrcAlias(SrcItem *p0, SrcList *pSrc){ |
| 142005 | + int i; |
| 142006 | + for(i=0; i<pSrc->nSrc; i++){ |
| 142007 | + SrcItem *p1 = &pSrc->a[i]; |
| 142008 | + if( p1==p0 ) continue; |
| 142009 | + if( p0->pTab==p1->pTab && 0==sqlite3_stricmp(p0->zAlias, p1->zAlias) ){ |
| 142010 | + return 1; |
| 142011 | + } |
| 142012 | + if( p1->pSelect |
| 142013 | + && (p1->pSelect->selFlags & SF_NestedFrom)!=0 |
| 142014 | + && sameSrcAlias(p0, p1->pSelect->pSrc) |
| 142015 | + ){ |
| 142016 | + return 1; |
| 142017 | + } |
| 142018 | + } |
| 142019 | + return 0; |
| 142020 | +} |
| 141689 | 142021 | |
| 141690 | 142022 | /* |
| 141691 | 142023 | ** Generate code for the SELECT statement given in the p argument. |
| 141692 | 142024 | ** |
| 141693 | 142025 | ** The results are returned according to the SelectDest structure. |
| | @@ -141789,19 +142121,16 @@ |
| 141789 | 142121 | ** systems handle this case differently, and not all the same way, |
| 141790 | 142122 | ** which is just confusing. To avoid this, we follow PG's lead and |
| 141791 | 142123 | ** disallow it altogether. */ |
| 141792 | 142124 | if( p->selFlags & SF_UFSrcCheck ){ |
| 141793 | 142125 | SrcItem *p0 = &p->pSrc->a[0]; |
| 141794 | | - for(i=1; i<p->pSrc->nSrc; i++){ |
| 141795 | | - SrcItem *p1 = &p->pSrc->a[i]; |
| 141796 | | - if( p0->pTab==p1->pTab && 0==sqlite3_stricmp(p0->zAlias, p1->zAlias) ){ |
| 141797 | | - sqlite3ErrorMsg(pParse, |
| 141798 | | - "target object/alias may not appear in FROM clause: %s", |
| 141799 | | - p0->zAlias ? p0->zAlias : p0->pTab->zName |
| 141800 | | - ); |
| 141801 | | - goto select_end; |
| 141802 | | - } |
| 142126 | + if( sameSrcAlias(p0, p->pSrc) ){ |
| 142127 | + sqlite3ErrorMsg(pParse, |
| 142128 | + "target object/alias may not appear in FROM clause: %s", |
| 142129 | + p0->zAlias ? p0->zAlias : p0->pTab->zName |
| 142130 | + ); |
| 142131 | + goto select_end; |
| 141803 | 142132 | } |
| 141804 | 142133 | |
| 141805 | 142134 | /* Clear the SF_UFSrcCheck flag. The check has already been performed, |
| 141806 | 142135 | ** and leaving this flag set can cause errors if a compound sub-query |
| 141807 | 142136 | ** in p->pSrc is flattened into this query and this function called |
| | @@ -142053,13 +142382,11 @@ |
| 142053 | 142382 | ** inside the subquery. This can help the subquery to run more efficiently. |
| 142054 | 142383 | */ |
| 142055 | 142384 | if( OptimizationEnabled(db, SQLITE_PushDown) |
| 142056 | 142385 | && (pItem->fg.isCte==0 |
| 142057 | 142386 | || (pItem->u2.pCteUse->eM10d!=M10d_Yes && pItem->u2.pCteUse->nUse<2)) |
| 142058 | | - && (pItem->fg.jointype & JT_RIGHT)==0 |
| 142059 | | - && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor, |
| 142060 | | - (pItem->fg.jointype & JT_OUTER)!=0) |
| 142387 | + && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem) |
| 142061 | 142388 | ){ |
| 142062 | 142389 | #if TREETRACE_ENABLED |
| 142063 | 142390 | if( sqlite3TreeTrace & 0x100 ){ |
| 142064 | 142391 | SELECTTRACE(0x100,pParse,p, |
| 142065 | 142392 | ("After WHERE-clause push-down into subquery %d:\n", pSub->selId)); |
| | @@ -142074,11 +142401,11 @@ |
| 142074 | 142401 | zSavedAuthContext = pParse->zAuthContext; |
| 142075 | 142402 | pParse->zAuthContext = pItem->zName; |
| 142076 | 142403 | |
| 142077 | 142404 | /* Generate code to implement the subquery |
| 142078 | 142405 | ** |
| 142079 | | - ** The subquery is implemented as a co-routine all of the following are |
| 142406 | + ** The subquery is implemented as a co-routine all if the following are |
| 142080 | 142407 | ** true: |
| 142081 | 142408 | ** |
| 142082 | 142409 | ** (1) the subquery is guaranteed to be the outer loop (so that |
| 142083 | 142410 | ** it does not need to be computed more than once), and |
| 142084 | 142411 | ** (2) the subquery is not a CTE that should be materialized |
| | @@ -142132,15 +142459,15 @@ |
| 142132 | 142459 | /* Materialize the view. If the view is not correlated, generate a |
| 142133 | 142460 | ** subroutine to do the materialization so that subsequent uses of |
| 142134 | 142461 | ** the same view can reuse the materialization. */ |
| 142135 | 142462 | int topAddr; |
| 142136 | 142463 | int onceAddr = 0; |
| 142137 | | - int retAddr; |
| 142138 | 142464 | |
| 142139 | 142465 | pItem->regReturn = ++pParse->nMem; |
| 142140 | | - topAddr = sqlite3VdbeAddOp2(v, OP_Integer, 0, pItem->regReturn); |
| 142466 | + topAddr = sqlite3VdbeAddOp0(v, OP_Goto); |
| 142141 | 142467 | pItem->addrFillSub = topAddr+1; |
| 142468 | + pItem->fg.isMaterialized = 1; |
| 142142 | 142469 | if( pItem->fg.isCorrelated==0 ){ |
| 142143 | 142470 | /* If the subquery is not correlated and if we are not inside of |
| 142144 | 142471 | ** a trigger, then we only need to compute the value of the subquery |
| 142145 | 142472 | ** once. */ |
| 142146 | 142473 | onceAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); |
| | @@ -142151,13 +142478,13 @@ |
| 142151 | 142478 | sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor); |
| 142152 | 142479 | ExplainQueryPlan((pParse, 1, "MATERIALIZE %!S", pItem)); |
| 142153 | 142480 | sqlite3Select(pParse, pSub, &dest); |
| 142154 | 142481 | pItem->pTab->nRowLogEst = pSub->nSelectRow; |
| 142155 | 142482 | if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr); |
| 142156 | | - retAddr = sqlite3VdbeAddOp1(v, OP_Return, pItem->regReturn); |
| 142483 | + sqlite3VdbeAddOp2(v, OP_Return, pItem->regReturn, topAddr+1); |
| 142157 | 142484 | VdbeComment((v, "end %!S", pItem)); |
| 142158 | | - sqlite3VdbeChangeP1(v, topAddr, retAddr); |
| 142485 | + sqlite3VdbeJumpHere(v, topAddr); |
| 142159 | 142486 | sqlite3ClearTempRegCache(pParse); |
| 142160 | 142487 | if( pItem->fg.isCte && pItem->fg.isCorrelated==0 ){ |
| 142161 | 142488 | CteUse *pCteUse = pItem->u2.pCteUse; |
| 142162 | 142489 | pCteUse->addrM9e = pItem->addrFillSub; |
| 142163 | 142490 | pCteUse->regRtn = pItem->regReturn; |
| | @@ -142251,17 +142578,17 @@ |
| 142251 | 142578 | if( pDest->eDest==SRT_EphemTab ){ |
| 142252 | 142579 | sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pDest->iSDParm, pEList->nExpr); |
| 142253 | 142580 | if( p->selFlags & SF_NestedFrom ){ |
| 142254 | 142581 | /* Delete or NULL-out result columns that will never be used */ |
| 142255 | 142582 | int ii; |
| 142256 | | - for(ii=pEList->nExpr-1; ii>0 && pEList->a[ii].bUsed==0; ii--){ |
| 142583 | + for(ii=pEList->nExpr-1; ii>0 && pEList->a[ii].fg.bUsed==0; ii--){ |
| 142257 | 142584 | sqlite3ExprDelete(db, pEList->a[ii].pExpr); |
| 142258 | 142585 | sqlite3DbFree(db, pEList->a[ii].zEName); |
| 142259 | 142586 | pEList->nExpr--; |
| 142260 | 142587 | } |
| 142261 | 142588 | for(ii=0; ii<pEList->nExpr; ii++){ |
| 142262 | | - if( pEList->a[ii].bUsed==0 ) pEList->a[ii].pExpr->op = TK_NULL; |
| 142589 | + if( pEList->a[ii].fg.bUsed==0 ) pEList->a[ii].pExpr->op = TK_NULL; |
| 142263 | 142590 | } |
| 142264 | 142591 | } |
| 142265 | 142592 | } |
| 142266 | 142593 | |
| 142267 | 142594 | /* Set the limiter. |
| | @@ -142409,12 +142736,13 @@ |
| 142409 | 142736 | ** ASC or DESC order - only that each group is returned contiguously. |
| 142410 | 142737 | ** So set the ASC/DESC flags in the GROUP BY to match those in the |
| 142411 | 142738 | ** ORDER BY to maximize the chances of rows being delivered in an |
| 142412 | 142739 | ** order that makes the ORDER BY redundant. */ |
| 142413 | 142740 | for(ii=0; ii<pGroupBy->nExpr; ii++){ |
| 142414 | | - u8 sortFlags = sSort.pOrderBy->a[ii].sortFlags & KEYINFO_ORDER_DESC; |
| 142415 | | - pGroupBy->a[ii].sortFlags = sortFlags; |
| 142741 | + u8 sortFlags; |
| 142742 | + sortFlags = sSort.pOrderBy->a[ii].fg.sortFlags & KEYINFO_ORDER_DESC; |
| 142743 | + pGroupBy->a[ii].fg.sortFlags = sortFlags; |
| 142416 | 142744 | } |
| 142417 | 142745 | if( sqlite3ExprListCompare(pGroupBy, sSort.pOrderBy, -1)==0 ){ |
| 142418 | 142746 | orderByGrp = 1; |
| 142419 | 142747 | } |
| 142420 | 142748 | } |
| | @@ -142875,11 +143203,11 @@ |
| 142875 | 143203 | } |
| 142876 | 143204 | SELECTTRACE(1,pParse,p,("WhereBegin returns\n")); |
| 142877 | 143205 | eDist = sqlite3WhereIsDistinct(pWInfo); |
| 142878 | 143206 | updateAccumulator(pParse, regAcc, pAggInfo, eDist); |
| 142879 | 143207 | if( eDist!=WHERE_DISTINCT_NOOP ){ |
| 142880 | | - struct AggInfo_func *pF = &pAggInfo->aFunc[0]; |
| 143208 | + struct AggInfo_func *pF = pAggInfo->aFunc; |
| 142881 | 143209 | if( pF ){ |
| 142882 | 143210 | fixDistinctOpenEph(pParse, eDist, pF->iDistinct, pF->iDistAddr); |
| 142883 | 143211 | } |
| 142884 | 143212 | } |
| 142885 | 143213 | |
| | @@ -143674,11 +144002,11 @@ |
| 143674 | 144002 | ** sees an UPDATE statement inside the body of a CREATE TRIGGER. |
| 143675 | 144003 | */ |
| 143676 | 144004 | SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep( |
| 143677 | 144005 | Parse *pParse, /* Parser */ |
| 143678 | 144006 | Token *pTableName, /* Name of the table to be updated */ |
| 143679 | | - SrcList *pFrom, |
| 144007 | + SrcList *pFrom, /* FROM clause for an UPDATE-FROM, or NULL */ |
| 143680 | 144008 | ExprList *pEList, /* The SET clause: list of column and new values */ |
| 143681 | 144009 | Expr *pWhere, /* The WHERE clause */ |
| 143682 | 144010 | u8 orconf, /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */ |
| 143683 | 144011 | const char *zStart, /* Start of SQL text */ |
| 143684 | 144012 | const char *zEnd /* End of SQL text */ |
| | @@ -144010,10 +144338,18 @@ |
| 144010 | 144338 | if( pSchema!=db->aDb[1].pSchema ){ |
| 144011 | 144339 | pSrc->a[0].pSchema = pSchema; |
| 144012 | 144340 | } |
| 144013 | 144341 | if( pStep->pFrom ){ |
| 144014 | 144342 | SrcList *pDup = sqlite3SrcListDup(db, pStep->pFrom, 0); |
| 144343 | + if( pDup && pDup->nSrc>1 && !IN_RENAME_OBJECT ){ |
| 144344 | + Select *pSubquery; |
| 144345 | + Token as; |
| 144346 | + pSubquery = sqlite3SelectNew(pParse,0,pDup,0,0,0,0,SF_NestedFrom,0); |
| 144347 | + as.n = 0; |
| 144348 | + as.z = 0; |
| 144349 | + pDup = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0); |
| 144350 | + } |
| 144015 | 144351 | pSrc = sqlite3SrcListAppendList(pParse, pSrc, pDup); |
| 144016 | 144352 | } |
| 144017 | 144353 | }else{ |
| 144018 | 144354 | sqlite3DbFree(db, zName); |
| 144019 | 144355 | } |
| | @@ -144065,20 +144401,20 @@ |
| 144065 | 144401 | pNewExpr = sqlite3Expr(db, TK_ID, pTab->aCol[jj].zCnName); |
| 144066 | 144402 | pNew = sqlite3ExprListAppend(pParse, pNew, pNewExpr); |
| 144067 | 144403 | if( !db->mallocFailed ){ |
| 144068 | 144404 | struct ExprList_item *pItem = &pNew->a[pNew->nExpr-1]; |
| 144069 | 144405 | pItem->zEName = sqlite3DbStrDup(db, pTab->aCol[jj].zCnName); |
| 144070 | | - pItem->eEName = ENAME_NAME; |
| 144406 | + pItem->fg.eEName = ENAME_NAME; |
| 144071 | 144407 | } |
| 144072 | 144408 | } |
| 144073 | 144409 | }else{ |
| 144074 | 144410 | Expr *pNewExpr = sqlite3ExprDup(db, pOldExpr, 0); |
| 144075 | 144411 | pNew = sqlite3ExprListAppend(pParse, pNew, pNewExpr); |
| 144076 | 144412 | if( !db->mallocFailed && ALWAYS(pList->a[i].zEName!=0) ){ |
| 144077 | 144413 | struct ExprList_item *pItem = &pNew->a[pNew->nExpr-1]; |
| 144078 | 144414 | pItem->zEName = sqlite3DbStrDup(db, pList->a[i].zEName); |
| 144079 | | - pItem->eEName = pList->a[i].eEName; |
| 144415 | + pItem->fg.eEName = pList->a[i].fg.eEName; |
| 144080 | 144416 | } |
| 144081 | 144417 | } |
| 144082 | 144418 | } |
| 144083 | 144419 | return pNew; |
| 144084 | 144420 | } |
| | @@ -146647,10 +146983,11 @@ |
| 146647 | 146983 | #endif |
| 146648 | 146984 | } |
| 146649 | 146985 | |
| 146650 | 146986 | assert( rc==SQLITE_OK ); |
| 146651 | 146987 | if( pOut==0 ){ |
| 146988 | + nRes = sqlite3BtreeGetRequestedReserve(pTemp); |
| 146652 | 146989 | rc = sqlite3BtreeSetPageSize(pMain, sqlite3BtreeGetPageSize(pTemp), nRes,1); |
| 146653 | 146990 | } |
| 146654 | 146991 | |
| 146655 | 146992 | end_of_vacuum: |
| 146656 | 146993 | /* Restore the original value of db->flags */ |
| | @@ -148098,11 +148435,11 @@ |
| 148098 | 148435 | ** This object is a header on a block of allocated memory that will be |
| 148099 | 148436 | ** automatically freed when its WInfo oject is destructed. |
| 148100 | 148437 | */ |
| 148101 | 148438 | struct WhereMemBlock { |
| 148102 | 148439 | WhereMemBlock *pNext; /* Next block in the chain */ |
| 148103 | | - u8 sz; /* Bytes of space */ |
| 148440 | + u64 sz; /* Bytes of space */ |
| 148104 | 148441 | }; |
| 148105 | 148442 | |
| 148106 | 148443 | /* |
| 148107 | 148444 | ** Extra information attached to a WhereLevel that is a RIGHT JOIN. |
| 148108 | 148445 | */ |
| | @@ -148109,10 +148446,11 @@ |
| 148109 | 148446 | struct WhereRightJoin { |
| 148110 | 148447 | int iMatch; /* Cursor used to determine prior matched rows */ |
| 148111 | 148448 | int regBloom; /* Bloom filter for iRJMatch */ |
| 148112 | 148449 | int regReturn; /* Return register for the interior subroutine */ |
| 148113 | 148450 | int addrSubrtn; /* Starting address for the interior subroutine */ |
| 148451 | + int endSubrtn; /* The last opcode in the interior subroutine */ |
| 148114 | 148452 | }; |
| 148115 | 148453 | |
| 148116 | 148454 | /* |
| 148117 | 148455 | ** This object contains information needed to implement a single nested |
| 148118 | 148456 | ** loop in WHERE clause. |
| | @@ -148668,12 +149006,13 @@ |
| 148668 | 149006 | #define WO_ISNULL 0x0100 |
| 148669 | 149007 | #define WO_OR 0x0200 /* Two or more OR-connected terms */ |
| 148670 | 149008 | #define WO_AND 0x0400 /* Two or more AND-connected terms */ |
| 148671 | 149009 | #define WO_EQUIV 0x0800 /* Of the form A==B, both columns */ |
| 148672 | 149010 | #define WO_NOOP 0x1000 /* This term does not restrict search space */ |
| 149011 | +#define WO_ROWVAL 0x2000 /* A row-value term */ |
| 148673 | 149012 | |
| 148674 | | -#define WO_ALL 0x1fff /* Mask of all possible WO_* values */ |
| 149013 | +#define WO_ALL 0x3fff /* Mask of all possible WO_* values */ |
| 148675 | 149014 | #define WO_SINGLE 0x01ff /* Mask of all non-compound WO_* values */ |
| 148676 | 149015 | |
| 148677 | 149016 | /* |
| 148678 | 149017 | ** These are definitions of bits in the WhereLoop.wsFlags field. |
| 148679 | 149018 | ** The particular combination of bits in each WhereLoop help to |
| | @@ -149039,11 +149378,11 @@ |
| 149039 | 149378 | */ |
| 149040 | 149379 | static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){ |
| 149041 | 149380 | int nLoop = 0; |
| 149042 | 149381 | assert( pTerm!=0 ); |
| 149043 | 149382 | while( (pTerm->wtFlags & TERM_CODED)==0 |
| 149044 | | - && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin)) |
| 149383 | + && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_OuterON)) |
| 149045 | 149384 | && (pLevel->notReady & pTerm->prereqAll)==0 |
| 149046 | 149385 | ){ |
| 149047 | 149386 | if( nLoop && (pTerm->wtFlags & TERM_LIKE)!=0 ){ |
| 149048 | 149387 | pTerm->wtFlags |= TERM_LIKECOND; |
| 149049 | 149388 | }else{ |
| | @@ -149300,20 +149639,25 @@ |
| 149300 | 149639 | |
| 149301 | 149640 | iTab = 0; |
| 149302 | 149641 | if( !ExprUseXSelect(pX) || pX->x.pSelect->pEList->nExpr==1 ){ |
| 149303 | 149642 | eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab); |
| 149304 | 149643 | }else{ |
| 149305 | | - sqlite3 *db = pParse->db; |
| 149306 | | - pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX); |
| 149307 | | - |
| 149308 | | - if( !db->mallocFailed ){ |
| 149644 | + Expr *pExpr = pTerm->pExpr; |
| 149645 | + if( pExpr->iTable==0 || !ExprHasProperty(pExpr, EP_Subrtn) ){ |
| 149646 | + sqlite3 *db = pParse->db; |
| 149647 | + pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX); |
| 149648 | + if( !db->mallocFailed ){ |
| 149649 | + aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq); |
| 149650 | + eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap,&iTab); |
| 149651 | + pExpr->iTable = iTab; |
| 149652 | + } |
| 149653 | + sqlite3ExprDelete(db, pX); |
| 149654 | + }else{ |
| 149309 | 149655 | aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq); |
| 149310 | 149656 | eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab); |
| 149311 | | - pTerm->pExpr->iTable = iTab; |
| 149312 | 149657 | } |
| 149313 | | - sqlite3ExprDelete(db, pX); |
| 149314 | | - pX = pTerm->pExpr; |
| 149658 | + pX = pExpr; |
| 149315 | 149659 | } |
| 149316 | 149660 | |
| 149317 | 149661 | if( eType==IN_INDEX_INDEX_DESC ){ |
| 149318 | 149662 | testcase( bRev ); |
| 149319 | 149663 | bRev = !bRev; |
| | @@ -149755,20 +150099,20 @@ |
| 149755 | 150099 | ** |
| 149756 | 150100 | ** are also excluded. See codeCursorHintIsOrFunction() for details. |
| 149757 | 150101 | */ |
| 149758 | 150102 | if( pTabItem->fg.jointype & JT_LEFT ){ |
| 149759 | 150103 | Expr *pExpr = pTerm->pExpr; |
| 149760 | | - if( !ExprHasProperty(pExpr, EP_FromJoin) |
| 150104 | + if( !ExprHasProperty(pExpr, EP_OuterON) |
| 149761 | 150105 | || pExpr->w.iJoin!=pTabItem->iCursor |
| 149762 | 150106 | ){ |
| 149763 | 150107 | sWalker.eCode = 0; |
| 149764 | 150108 | sWalker.xExprCallback = codeCursorHintIsOrFunction; |
| 149765 | 150109 | sqlite3WalkExpr(&sWalker, pTerm->pExpr); |
| 149766 | 150110 | if( sWalker.eCode ) continue; |
| 149767 | 150111 | } |
| 149768 | 150112 | }else{ |
| 149769 | | - if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) continue; |
| 150113 | + if( ExprHasProperty(pTerm->pExpr, EP_OuterON) ) continue; |
| 149770 | 150114 | } |
| 149771 | 150115 | |
| 149772 | 150116 | /* All terms in pWLoop->aLTerm[] except pEndRange are used to initialize |
| 149773 | 150117 | ** the cursor. These terms are not needed as hints for a pure range |
| 149774 | 150118 | ** scan (that has no == terms) so omit them. */ |
| | @@ -149936,16 +150280,16 @@ |
| 149936 | 150280 | ** that contains the value of pExpr. |
| 149937 | 150281 | */ |
| 149938 | 150282 | static int whereIndexExprTransNode(Walker *p, Expr *pExpr){ |
| 149939 | 150283 | IdxExprTrans *pX = p->u.pIdxTrans; |
| 149940 | 150284 | if( sqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){ |
| 150285 | + pExpr = sqlite3ExprSkipCollate(pExpr); |
| 149941 | 150286 | preserveExpr(pX, pExpr); |
| 149942 | 150287 | pExpr->affExpr = sqlite3ExprAffinity(pExpr); |
| 149943 | 150288 | pExpr->op = TK_COLUMN; |
| 149944 | 150289 | pExpr->iTable = pX->iIdxCur; |
| 149945 | 150290 | pExpr->iColumn = pX->iIdxCol; |
| 149946 | | - testcase( ExprHasProperty(pExpr, EP_Skip) ); |
| 149947 | 150291 | testcase( ExprHasProperty(pExpr, EP_Unlikely) ); |
| 149948 | 150292 | ExprClearProperty(pExpr, EP_Skip|EP_Unlikely|EP_WinFunc|EP_Subrtn); |
| 149949 | 150293 | pExpr->y.pTab = 0; |
| 149950 | 150294 | return WRC_Prune; |
| 149951 | 150295 | }else{ |
| | @@ -150095,10 +150439,12 @@ |
| 150095 | 150439 | if( pLevel->regFilter==0 ) continue; |
| 150096 | 150440 | if( pLevel->pWLoop->nSkip ) continue; |
| 150097 | 150441 | /* ,--- Because sqlite3ConstructBloomFilter() has will not have set |
| 150098 | 150442 | ** vvvvv--' pLevel->regFilter if this were true. */ |
| 150099 | 150443 | if( NEVER(pLoop->prereq & notReady) ) continue; |
| 150444 | + assert( pLevel->addrBrk==0 ); |
| 150445 | + pLevel->addrBrk = addrNxt; |
| 150100 | 150446 | if( pLoop->wsFlags & WHERE_IPK ){ |
| 150101 | 150447 | WhereTerm *pTerm = pLoop->aLTerm[0]; |
| 150102 | 150448 | int regRowid; |
| 150103 | 150449 | assert( pTerm!=0 ); |
| 150104 | 150450 | assert( pTerm->pExpr!=0 ); |
| | @@ -150121,10 +150467,11 @@ |
| 150121 | 150467 | sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter, |
| 150122 | 150468 | addrNxt, r1, nEq); |
| 150123 | 150469 | VdbeCoverage(pParse->pVdbe); |
| 150124 | 150470 | } |
| 150125 | 150471 | pLevel->regFilter = 0; |
| 150472 | + pLevel->addrBrk = 0; |
| 150126 | 150473 | } |
| 150127 | 150474 | } |
| 150128 | 150475 | |
| 150129 | 150476 | /* |
| 150130 | 150477 | ** Generate code for the start of the iLevel-th loop in the WHERE clause |
| | @@ -151092,11 +151439,11 @@ |
| 151092 | 151439 | WhereInfo *pSubWInfo; /* Info for single OR-term scan */ |
| 151093 | 151440 | Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */ |
| 151094 | 151441 | Expr *pDelete; /* Local copy of OR clause term */ |
| 151095 | 151442 | int jmp1 = 0; /* Address of jump operation */ |
| 151096 | 151443 | testcase( (pTabItem[0].fg.jointype & JT_LEFT)!=0 |
| 151097 | | - && !ExprHasProperty(pOrExpr, EP_FromJoin) |
| 151444 | + && !ExprHasProperty(pOrExpr, EP_OuterON) |
| 151098 | 151445 | ); /* See TH3 vtab25.400 and ticket 614b25314c766238 */ |
| 151099 | 151446 | pDelete = pOrExpr = sqlite3ExprDup(db, pOrExpr, 0); |
| 151100 | 151447 | if( db->mallocFailed ){ |
| 151101 | 151448 | sqlite3ExprDelete(db, pDelete); |
| 151102 | 151449 | continue; |
| | @@ -151300,16 +151647,26 @@ |
| 151300 | 151647 | pWInfo->untestedTerms = 1; |
| 151301 | 151648 | continue; |
| 151302 | 151649 | } |
| 151303 | 151650 | pE = pTerm->pExpr; |
| 151304 | 151651 | assert( pE!=0 ); |
| 151305 | | - if( (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ)) |
| 151306 | | - && !ExprHasProperty(pE,EP_FromJoin) |
| 151307 | | - ){ |
| 151308 | | - continue; |
| 151652 | + if( pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ){ |
| 151653 | + if( !ExprHasProperty(pE,EP_OuterON|EP_InnerON) ){ |
| 151654 | + /* Defer processing WHERE clause constraints until after outer |
| 151655 | + ** join processing. tag-20220513a */ |
| 151656 | + continue; |
| 151657 | + }else if( (pTabItem->fg.jointype & JT_LEFT)==JT_LEFT |
| 151658 | + && !ExprHasProperty(pE,EP_OuterON) ){ |
| 151659 | + continue; |
| 151660 | + }else{ |
| 151661 | + Bitmask m = sqlite3WhereGetMask(&pWInfo->sMaskSet, pE->w.iJoin); |
| 151662 | + if( m & pLevel->notReady ){ |
| 151663 | + /* An ON clause that is not ripe */ |
| 151664 | + continue; |
| 151665 | + } |
| 151666 | + } |
| 151309 | 151667 | } |
| 151310 | | - |
| 151311 | 151668 | if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){ |
| 151312 | 151669 | iNext = 2; |
| 151313 | 151670 | continue; |
| 151314 | 151671 | } |
| 151315 | 151672 | if( iLoop<3 && (pTerm->wtFlags & TERM_VARSELECT) ){ |
| | @@ -151364,19 +151721,19 @@ |
| 151364 | 151721 | WhereTerm *pAlt; |
| 151365 | 151722 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 151366 | 151723 | if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) continue; |
| 151367 | 151724 | if( (pTerm->eOperator & WO_EQUIV)==0 ) continue; |
| 151368 | 151725 | if( pTerm->leftCursor!=iCur ) continue; |
| 151369 | | - if( pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ) ) continue; |
| 151726 | + if( pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ) continue; |
| 151370 | 151727 | pE = pTerm->pExpr; |
| 151371 | 151728 | #ifdef WHERETRACE_ENABLED /* 0x800 */ |
| 151372 | 151729 | if( sqlite3WhereTrace & 0x800 ){ |
| 151373 | 151730 | sqlite3DebugPrintf("Coding transitive constraint:\n"); |
| 151374 | 151731 | sqlite3WhereTermPrint(pTerm, pWC->nTerm-j); |
| 151375 | 151732 | } |
| 151376 | 151733 | #endif |
| 151377 | | - assert( !ExprHasProperty(pE, EP_FromJoin) ); |
| 151734 | + assert( !ExprHasProperty(pE, EP_OuterON) ); |
| 151378 | 151735 | assert( (pTerm->prereqRight & pLevel->notReady)!=0 ); |
| 151379 | 151736 | assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); |
| 151380 | 151737 | pAlt = sqlite3WhereFindTerm(pWC, iCur, pTerm->u.x.leftColumn, notReady, |
| 151381 | 151738 | WO_EQ|WO_IN|WO_IS, 0); |
| 151382 | 151739 | if( pAlt==0 ) continue; |
| | @@ -151443,22 +151800,12 @@ |
| 151443 | 151800 | */ |
| 151444 | 151801 | if( pLevel->iLeftJoin ){ |
| 151445 | 151802 | pLevel->addrFirst = sqlite3VdbeCurrentAddr(v); |
| 151446 | 151803 | sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin); |
| 151447 | 151804 | VdbeComment((v, "record LEFT JOIN hit")); |
| 151448 | | - for(pTerm=pWC->a, j=0; j<pWC->nBase; j++, pTerm++){ |
| 151449 | | - testcase( pTerm->wtFlags & TERM_VIRTUAL ); |
| 151450 | | - testcase( pTerm->wtFlags & TERM_CODED ); |
| 151451 | | - if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 151452 | | - if( (pTerm->prereqAll & pLevel->notReady)!=0 ){ |
| 151453 | | - assert( pWInfo->untestedTerms ); |
| 151454 | | - continue; |
| 151455 | | - } |
| 151456 | | - if( pTabItem->fg.jointype & JT_LTORJ ) continue; |
| 151457 | | - assert( pTerm->pExpr ); |
| 151458 | | - sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL); |
| 151459 | | - pTerm->wtFlags |= TERM_CODED; |
| 151805 | + if( pLevel->pRJ==0 ){ |
| 151806 | + goto code_outer_join_constraints; /* WHERE clause constraints */ |
| 151460 | 151807 | } |
| 151461 | 151808 | } |
| 151462 | 151809 | |
| 151463 | 151810 | if( pLevel->pRJ ){ |
| 151464 | 151811 | /* Create a subroutine used to process all interior loops and code |
| | @@ -151470,10 +151817,30 @@ |
| 151470 | 151817 | WhereRightJoin *pRJ = pLevel->pRJ; |
| 151471 | 151818 | sqlite3VdbeAddOp2(v, OP_BeginSubrtn, 0, pRJ->regReturn); |
| 151472 | 151819 | pRJ->addrSubrtn = sqlite3VdbeCurrentAddr(v); |
| 151473 | 151820 | assert( pParse->withinRJSubrtn < 255 ); |
| 151474 | 151821 | pParse->withinRJSubrtn++; |
| 151822 | + |
| 151823 | + /* WHERE clause constraints must be deferred until after outer join |
| 151824 | + ** row elimination has completed, since WHERE clause constraints apply |
| 151825 | + ** to the results of the OUTER JOIN. The following loop generates the |
| 151826 | + ** appropriate WHERE clause constraint checks. tag-20220513a. |
| 151827 | + */ |
| 151828 | + code_outer_join_constraints: |
| 151829 | + for(pTerm=pWC->a, j=0; j<pWC->nBase; j++, pTerm++){ |
| 151830 | + testcase( pTerm->wtFlags & TERM_VIRTUAL ); |
| 151831 | + testcase( pTerm->wtFlags & TERM_CODED ); |
| 151832 | + if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 151833 | + if( (pTerm->prereqAll & pLevel->notReady)!=0 ){ |
| 151834 | + assert( pWInfo->untestedTerms ); |
| 151835 | + continue; |
| 151836 | + } |
| 151837 | + if( pTabItem->fg.jointype & JT_LTORJ ) continue; |
| 151838 | + assert( pTerm->pExpr ); |
| 151839 | + sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL); |
| 151840 | + pTerm->wtFlags |= TERM_CODED; |
| 151841 | + } |
| 151475 | 151842 | } |
| 151476 | 151843 | |
| 151477 | 151844 | #if WHERETRACE_ENABLED /* 0x20800 */ |
| 151478 | 151845 | if( sqlite3WhereTrace & 0x20000 ){ |
| 151479 | 151846 | sqlite3DebugPrintf("All WHERE-clause terms after coding level %d:\n", |
| | @@ -151508,10 +151875,12 @@ |
| 151508 | 151875 | SrcList sFrom; |
| 151509 | 151876 | Bitmask mAll = 0; |
| 151510 | 151877 | int k; |
| 151511 | 151878 | |
| 151512 | 151879 | ExplainQueryPlan((pParse, 1, "RIGHT-JOIN %s", pTabItem->pTab->zName)); |
| 151880 | + sqlite3VdbeNoJumpsOutsideSubrtn(v, pRJ->addrSubrtn, pRJ->endSubrtn, |
| 151881 | + pRJ->regReturn); |
| 151513 | 151882 | for(k=0; k<iLevel; k++){ |
| 151514 | 151883 | int iIdxCur; |
| 151515 | 151884 | mAll |= pWInfo->a[k].pWLoop->maskSelf; |
| 151516 | 151885 | sqlite3VdbeAddOp1(v, OP_NullRow, pWInfo->a[k].iTabCur); |
| 151517 | 151886 | iIdxCur = pWInfo->a[k].iIdxCur; |
| | @@ -151521,13 +151890,17 @@ |
| 151521 | 151890 | } |
| 151522 | 151891 | if( (pTabItem->fg.jointype & JT_LTORJ)==0 ){ |
| 151523 | 151892 | mAll |= pLoop->maskSelf; |
| 151524 | 151893 | for(k=0; k<pWC->nTerm; k++){ |
| 151525 | 151894 | WhereTerm *pTerm = &pWC->a[k]; |
| 151526 | | - if( pTerm->wtFlags & TERM_VIRTUAL ) break; |
| 151895 | + if( (pTerm->wtFlags & (TERM_VIRTUAL|TERM_SLICE))!=0 |
| 151896 | + && pTerm->eOperator!=WO_ROWVAL |
| 151897 | + ){ |
| 151898 | + break; |
| 151899 | + } |
| 151527 | 151900 | if( pTerm->prereqAll & ~mAll ) continue; |
| 151528 | | - if( ExprHasProperty(pTerm->pExpr, EP_FromJoin|EP_InnerJoin) ) continue; |
| 151901 | + if( ExprHasProperty(pTerm->pExpr, EP_OuterON|EP_InnerON) ) continue; |
| 151529 | 151902 | pSubWhere = sqlite3ExprAnd(pParse, pSubWhere, |
| 151530 | 151903 | sqlite3ExprDup(pParse->db, pTerm->pExpr, 0)); |
| 151531 | 151904 | } |
| 151532 | 151905 | } |
| 151533 | 151906 | sFrom.nSrc = 1; |
| | @@ -152035,12 +152408,12 @@ |
| 152035 | 152408 | /* |
| 152036 | 152409 | ** If the pBase expression originated in the ON or USING clause of |
| 152037 | 152410 | ** a join, then transfer the appropriate markings over to derived. |
| 152038 | 152411 | */ |
| 152039 | 152412 | static void transferJoinMarkings(Expr *pDerived, Expr *pBase){ |
| 152040 | | - if( pDerived ){ |
| 152041 | | - pDerived->flags |= pBase->flags & EP_FromJoin; |
| 152413 | + if( pDerived && ExprHasProperty(pBase, EP_OuterON|EP_InnerON) ){ |
| 152414 | + pDerived->flags |= pBase->flags & (EP_OuterON|EP_InnerON); |
| 152042 | 152415 | pDerived->w.iJoin = pBase->w.iJoin; |
| 152043 | 152416 | } |
| 152044 | 152417 | } |
| 152045 | 152418 | |
| 152046 | 152419 | /* |
| | @@ -152491,11 +152864,11 @@ |
| 152491 | 152864 | static int termIsEquivalence(Parse *pParse, Expr *pExpr){ |
| 152492 | 152865 | char aff1, aff2; |
| 152493 | 152866 | CollSeq *pColl; |
| 152494 | 152867 | if( !OptimizationEnabled(pParse->db, SQLITE_Transitive) ) return 0; |
| 152495 | 152868 | if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0; |
| 152496 | | - if( ExprHasProperty(pExpr, EP_FromJoin) ) return 0; |
| 152869 | + if( ExprHasProperty(pExpr, EP_OuterON) ) return 0; |
| 152497 | 152870 | aff1 = sqlite3ExprAffinity(pExpr->pLeft); |
| 152498 | 152871 | aff2 = sqlite3ExprAffinity(pExpr->pRight); |
| 152499 | 152872 | if( aff1!=aff2 |
| 152500 | 152873 | && (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2)) |
| 152501 | 152874 | ){ |
| | @@ -152679,22 +153052,30 @@ |
| 152679 | 153052 | |
| 152680 | 153053 | #ifdef SQLITE_DEBUG |
| 152681 | 153054 | if( prereqAll!=sqlite3WhereExprUsageNN(pMaskSet, pExpr) ){ |
| 152682 | 153055 | printf("\n*** Incorrect prereqAll computed for:\n"); |
| 152683 | 153056 | sqlite3TreeViewExpr(0,pExpr,0); |
| 152684 | | - abort(); |
| 153057 | + assert( 0 ); |
| 152685 | 153058 | } |
| 152686 | 153059 | #endif |
| 152687 | 153060 | |
| 152688 | | - if( ExprHasProperty(pExpr, EP_FromJoin) ){ |
| 153061 | + if( ExprHasProperty(pExpr, EP_OuterON|EP_InnerON) ){ |
| 152689 | 153062 | Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->w.iJoin); |
| 152690 | | - prereqAll |= x; |
| 152691 | | - extraRight = x-1; /* ON clause terms may not be used with an index |
| 152692 | | - ** on left table of a LEFT JOIN. Ticket #3015 */ |
| 152693 | | - if( (prereqAll>>1)>=x ){ |
| 152694 | | - sqlite3ErrorMsg(pParse, "ON clause references tables to its right"); |
| 152695 | | - return; |
| 153063 | + if( ExprHasProperty(pExpr, EP_OuterON) ){ |
| 153064 | + prereqAll |= x; |
| 153065 | + extraRight = x-1; /* ON clause terms may not be used with an index |
| 153066 | + ** on left table of a LEFT JOIN. Ticket #3015 */ |
| 153067 | + if( (prereqAll>>1)>=x ){ |
| 153068 | + sqlite3ErrorMsg(pParse, "ON clause references tables to its right"); |
| 153069 | + return; |
| 153070 | + } |
| 153071 | + }else if( (prereqAll>>1)>=x ){ |
| 153072 | + /* The ON clause of an INNER JOIN references a table to its right. |
| 153073 | + ** Most other SQL database engines raise an error. But all versions |
| 153074 | + ** of SQLite going back to 3.0.0 have just put the ON clause constraint |
| 153075 | + ** into the WHERE clause and carried on. */ |
| 153076 | + ExprClearProperty(pExpr, EP_InnerON); |
| 152696 | 153077 | } |
| 152697 | 153078 | } |
| 152698 | 153079 | pTerm->prereqAll = prereqAll; |
| 152699 | 153080 | pTerm->leftCursor = -1; |
| 152700 | 153081 | pTerm->iParent = -1; |
| | @@ -152758,11 +153139,11 @@ |
| 152758 | 153139 | pNew->prereqRight = prereqLeft | extraRight; |
| 152759 | 153140 | pNew->prereqAll = prereqAll; |
| 152760 | 153141 | pNew->eOperator = (operatorMask(pDup->op) + eExtraOp) & opMask; |
| 152761 | 153142 | }else |
| 152762 | 153143 | if( op==TK_ISNULL |
| 152763 | | - && !ExprHasProperty(pExpr,EP_FromJoin) |
| 153144 | + && !ExprHasProperty(pExpr,EP_OuterON) |
| 152764 | 153145 | && 0==sqlite3ExprCanBeNull(pLeft) |
| 152765 | 153146 | ){ |
| 152766 | 153147 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 152767 | 153148 | pExpr->op = TK_TRUEFALSE; |
| 152768 | 153149 | pExpr->u.zToken = "false"; |
| | @@ -152829,11 +153210,11 @@ |
| 152829 | 153210 | ** The virtual term must be tagged with TERM_VNULL. |
| 152830 | 153211 | */ |
| 152831 | 153212 | else if( pExpr->op==TK_NOTNULL ){ |
| 152832 | 153213 | if( pExpr->pLeft->op==TK_COLUMN |
| 152833 | 153214 | && pExpr->pLeft->iColumn>=0 |
| 152834 | | - && !ExprHasProperty(pExpr, EP_FromJoin) |
| 153215 | + && !ExprHasProperty(pExpr, EP_OuterON) |
| 152835 | 153216 | ){ |
| 152836 | 153217 | Expr *pNewExpr; |
| 152837 | 153218 | Expr *pLeft = pExpr->pLeft; |
| 152838 | 153219 | int idxNew; |
| 152839 | 153220 | WhereTerm *pNewTerm; |
| | @@ -152977,11 +153358,11 @@ |
| 152977 | 153358 | idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC|TERM_SLICE); |
| 152978 | 153359 | exprAnalyze(pSrc, pWC, idxNew); |
| 152979 | 153360 | } |
| 152980 | 153361 | pTerm = &pWC->a[idxTerm]; |
| 152981 | 153362 | pTerm->wtFlags |= TERM_CODED|TERM_VIRTUAL; /* Disable the original */ |
| 152982 | | - pTerm->eOperator = 0; |
| 153363 | + pTerm->eOperator = WO_ROWVAL; |
| 152983 | 153364 | } |
| 152984 | 153365 | |
| 152985 | 153366 | /* If there is a vector IN term - e.g. "(a, b) IN (SELECT ...)" - create |
| 152986 | 153367 | ** a virtual term for each vector component. The expression object |
| 152987 | 153368 | ** used by each such virtual term is pExpr (the full vector IN(...) |
| | @@ -153033,12 +153414,12 @@ |
| 153033 | 153414 | prereqColumn = sqlite3WhereExprUsage(pMaskSet, pLeft); |
| 153034 | 153415 | if( (prereqExpr & prereqColumn)==0 ){ |
| 153035 | 153416 | Expr *pNewExpr; |
| 153036 | 153417 | pNewExpr = sqlite3PExpr(pParse, TK_MATCH, |
| 153037 | 153418 | 0, sqlite3ExprDup(db, pRight, 0)); |
| 153038 | | - if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){ |
| 153039 | | - ExprSetProperty(pNewExpr, EP_FromJoin); |
| 153419 | + if( ExprHasProperty(pExpr, EP_OuterON) && pNewExpr ){ |
| 153420 | + ExprSetProperty(pNewExpr, EP_OuterON); |
| 153040 | 153421 | pNewExpr->w.iJoin = pExpr->w.iJoin; |
| 153041 | 153422 | } |
| 153042 | 153423 | idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC); |
| 153043 | 153424 | testcase( idxNew==0 ); |
| 153044 | 153425 | pNewTerm = &pWC->a[idxNew]; |
| | @@ -153178,11 +153559,11 @@ |
| 153178 | 153559 | for(ii=0; ii<pWC->nTerm; ii++){ |
| 153179 | 153560 | if( pWC->a[ii].wtFlags & TERM_CODED ){ |
| 153180 | 153561 | /* This term is a vector operation that has been decomposed into |
| 153181 | 153562 | ** other, subsequent terms. It can be ignored. See tag-20220128a */ |
| 153182 | 153563 | assert( pWC->a[ii].wtFlags & TERM_VIRTUAL ); |
| 153183 | | - assert( pWC->a[ii].eOperator==0 ); |
| 153564 | + assert( pWC->a[ii].eOperator==WO_ROWVAL ); |
| 153184 | 153565 | continue; |
| 153185 | 153566 | } |
| 153186 | 153567 | if( pWC->a[ii].leftCursor!=iCsr ) return; |
| 153187 | 153568 | } |
| 153188 | 153569 | |
| | @@ -153190,11 +153571,11 @@ |
| 153190 | 153571 | if( pOrderBy ){ |
| 153191 | 153572 | for(ii=0; ii<pOrderBy->nExpr; ii++){ |
| 153192 | 153573 | Expr *pExpr = pOrderBy->a[ii].pExpr; |
| 153193 | 153574 | if( pExpr->op!=TK_COLUMN ) return; |
| 153194 | 153575 | if( pExpr->iTable!=iCsr ) return; |
| 153195 | | - if( pOrderBy->a[ii].sortFlags & KEYINFO_ORDER_BIGNULL ) return; |
| 153576 | + if( pOrderBy->a[ii].fg.sortFlags & KEYINFO_ORDER_BIGNULL ) return; |
| 153196 | 153577 | } |
| 153197 | 153578 | } |
| 153198 | 153579 | |
| 153199 | 153580 | /* All conditions are met. Add the terms to the where-clause object. */ |
| 153200 | 153581 | assert( p->pLimit->op==TK_LIMIT ); |
| | @@ -153401,13 +153782,13 @@ |
| 153401 | 153782 | pItem->colUsed |= sqlite3ExprColUsed(pColRef); |
| 153402 | 153783 | pRhs = sqlite3PExpr(pParse, TK_UPLUS, |
| 153403 | 153784 | sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0); |
| 153404 | 153785 | pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs); |
| 153405 | 153786 | if( pItem->fg.jointype & (JT_LEFT|JT_LTORJ) ){ |
| 153406 | | - joinType = EP_FromJoin; |
| 153787 | + joinType = EP_OuterON; |
| 153407 | 153788 | }else{ |
| 153408 | | - joinType = EP_InnerJoin; |
| 153789 | + joinType = EP_InnerON; |
| 153409 | 153790 | } |
| 153410 | 153791 | sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType); |
| 153411 | 153792 | whereClauseInsert(pWC, pTerm, TERM_DYNAMIC); |
| 153412 | 153793 | } |
| 153413 | 153794 | } |
| | @@ -153516,11 +153897,11 @@ |
| 153516 | 153897 | ** continuation of the inner-most loop. */ |
| 153517 | 153898 | return pWInfo->iContinue; |
| 153518 | 153899 | } |
| 153519 | 153900 | pInner = &pWInfo->a[pWInfo->nLevel-1]; |
| 153520 | 153901 | assert( pInner->addrNxt!=0 ); |
| 153521 | | - return pInner->addrNxt; |
| 153902 | + return pInner->pRJ ? pWInfo->iContinue : pInner->addrNxt; |
| 153522 | 153903 | } |
| 153523 | 153904 | |
| 153524 | 153905 | /* |
| 153525 | 153906 | ** While generating code for the min/max optimization, after handling |
| 153526 | 153907 | ** the aggregate-step call to min() or max(), check to see if any |
| | @@ -153744,11 +154125,11 @@ |
| 153744 | 154125 | if( pTerm->leftCursor==iCur |
| 153745 | 154126 | && pTerm->u.x.leftColumn==iColumn |
| 153746 | 154127 | && (iColumn!=XN_EXPR |
| 153747 | 154128 | || sqlite3ExprCompareSkip(pTerm->pExpr->pLeft, |
| 153748 | 154129 | pScan->pIdxExpr,iCur)==0) |
| 153749 | | - && (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin)) |
| 154130 | + && (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_OuterON)) |
| 153750 | 154131 | ){ |
| 153751 | 154132 | if( (pTerm->eOperator & WO_EQUIV)!=0 |
| 153752 | 154133 | && pScan->nEquiv<ArraySize(pScan->aiCur) |
| 153753 | 154134 | && (pX = whereRightSubexprIsColumn(pTerm->pExpr))!=0 |
| 153754 | 154135 | ){ |
| | @@ -154171,11 +154552,11 @@ |
| 154171 | 154552 | ){ |
| 154172 | 154553 | char aff; |
| 154173 | 154554 | if( pTerm->leftCursor!=pSrc->iCursor ) return 0; |
| 154174 | 154555 | if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) return 0; |
| 154175 | 154556 | if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ))!=0 |
| 154176 | | - && !ExprHasProperty(pTerm->pExpr, EP_FromJoin) |
| 154557 | + && !ExprHasProperty(pTerm->pExpr, EP_OuterON) |
| 154177 | 154558 | && (pTerm->eOperator & WO_IS) |
| 154178 | 154559 | ){ |
| 154179 | 154560 | /* Cannot use an IS term from the WHERE clause as an index driver for |
| 154180 | 154561 | ** the RHS of a LEFT JOIN or for the LHS of a RIGHT JOIN. Such a term |
| 154181 | 154562 | ** can only be used if it is from the ON clause. */ |
| | @@ -154246,13 +154627,11 @@ |
| 154246 | 154627 | Expr *pExpr = pTerm->pExpr; |
| 154247 | 154628 | /* Make the automatic index a partial index if there are terms in the |
| 154248 | 154629 | ** WHERE clause (or the ON clause of a LEFT join) that constrain which |
| 154249 | 154630 | ** rows of the target table (pSrc) that can be used. */ |
| 154250 | 154631 | if( (pTerm->wtFlags & TERM_VIRTUAL)==0 |
| 154251 | | - && ((pSrc->fg.jointype&(JT_LEFT|JT_LTORJ))==0 |
| 154252 | | - || ExprHasProperty(pExpr,EP_FromJoin)) |
| 154253 | | - && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) |
| 154632 | + && sqlite3ExprIsTableConstraint(pExpr, pSrc) |
| 154254 | 154633 | ){ |
| 154255 | 154634 | pPartial = sqlite3ExprAnd(pParse, pPartial, |
| 154256 | 154635 | sqlite3ExprDup(pParse->db, pExpr, 0)); |
| 154257 | 154636 | } |
| 154258 | 154637 | if( termCanDriveIndex(pTerm, pSrc, notReady) ){ |
| | @@ -154487,11 +154866,11 @@ |
| 154487 | 154866 | addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v); |
| 154488 | 154867 | pWCEnd = &pWInfo->sWC.a[pWInfo->sWC.nTerm]; |
| 154489 | 154868 | for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){ |
| 154490 | 154869 | Expr *pExpr = pTerm->pExpr; |
| 154491 | 154870 | if( (pTerm->wtFlags & TERM_VIRTUAL)==0 |
| 154492 | | - && sqlite3ExprIsTableConstant(pExpr, iCur) |
| 154871 | + && sqlite3ExprIsTableConstraint(pExpr, pItem) |
| 154493 | 154872 | ){ |
| 154494 | 154873 | sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL); |
| 154495 | 154874 | } |
| 154496 | 154875 | } |
| 154497 | 154876 | if( pLoop->wsFlags & WHERE_IPK ){ |
| | @@ -154597,11 +154976,11 @@ |
| 154597 | 154976 | /* tag-20191211-002: WHERE-clause constraints are not useful to the |
| 154598 | 154977 | ** right-hand table of a LEFT JOIN nor to the left-hand table of a |
| 154599 | 154978 | ** RIGHT JOIN. See tag-20191211-001 for the |
| 154600 | 154979 | ** equivalent restriction for ordinary tables. */ |
| 154601 | 154980 | if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ))!=0 |
| 154602 | | - && !ExprHasProperty(pTerm->pExpr, EP_FromJoin) |
| 154981 | + && !ExprHasProperty(pTerm->pExpr, EP_OuterON) |
| 154603 | 154982 | ){ |
| 154604 | 154983 | continue; |
| 154605 | 154984 | } |
| 154606 | 154985 | nTerm++; |
| 154607 | 154986 | pTerm->wtFlags |= TERM_OK; |
| | @@ -154622,11 +155001,11 @@ |
| 154622 | 155001 | if( sqlite3ExprIsConstant(pExpr) ){ |
| 154623 | 155002 | continue; |
| 154624 | 155003 | } |
| 154625 | 155004 | |
| 154626 | 155005 | /* Virtual tables are unable to deal with NULLS FIRST */ |
| 154627 | | - if( pOrderBy->a[i].sortFlags & KEYINFO_ORDER_BIGNULL ) break; |
| 155006 | + if( pOrderBy->a[i].fg.sortFlags & KEYINFO_ORDER_BIGNULL ) break; |
| 154628 | 155007 | |
| 154629 | 155008 | /* First case - a direct column references without a COLLATE operator */ |
| 154630 | 155009 | if( pExpr->op==TK_COLUMN && pExpr->iTable==pSrc->iCursor ){ |
| 154631 | 155010 | assert( pExpr->iColumn>=XN_ROWID && pExpr->iColumn<pTab->nCol ); |
| 154632 | 155011 | continue; |
| | @@ -154734,11 +155113,11 @@ |
| 154734 | 155113 | if( sqlite3ExprIsConstant(pExpr) ) continue; |
| 154735 | 155114 | assert( pExpr->op==TK_COLUMN |
| 154736 | 155115 | || (pExpr->op==TK_COLLATE && pExpr->pLeft->op==TK_COLUMN |
| 154737 | 155116 | && pExpr->iColumn==pExpr->pLeft->iColumn) ); |
| 154738 | 155117 | pIdxOrderBy[j].iColumn = pExpr->iColumn; |
| 154739 | | - pIdxOrderBy[j].desc = pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC; |
| 155118 | + pIdxOrderBy[j].desc = pOrderBy->a[i].fg.sortFlags & KEYINFO_ORDER_DESC; |
| 154740 | 155119 | j++; |
| 154741 | 155120 | } |
| 154742 | 155121 | pIdxInfo->nOrderBy = j; |
| 154743 | 155122 | |
| 154744 | 155123 | *pmNoOmit = mNoOmit; |
| | @@ -155475,11 +155854,11 @@ |
| 155475 | 155854 | char zType[8]; |
| 155476 | 155855 | char zLeft[50]; |
| 155477 | 155856 | memcpy(zType, "....", 5); |
| 155478 | 155857 | if( pTerm->wtFlags & TERM_VIRTUAL ) zType[0] = 'V'; |
| 155479 | 155858 | if( pTerm->eOperator & WO_EQUIV ) zType[1] = 'E'; |
| 155480 | | - if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L'; |
| 155859 | + if( ExprHasProperty(pTerm->pExpr, EP_OuterON) ) zType[2] = 'L'; |
| 155481 | 155860 | if( pTerm->wtFlags & TERM_CODED ) zType[3] = 'C'; |
| 155482 | 155861 | if( pTerm->eOperator & WO_SINGLE ){ |
| 155483 | 155862 | assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); |
| 155484 | 155863 | sqlite3_snprintf(sizeof(zLeft),zLeft,"left={%d:%d}", |
| 155485 | 155864 | pTerm->leftCursor, pTerm->u.x.leftColumn); |
| | @@ -156252,11 +156631,11 @@ |
| 156252 | 156631 | /* tag-20191211-001: Do not allow constraints from the WHERE clause to |
| 156253 | 156632 | ** be used by the right table of a LEFT JOIN nor by the left table of a |
| 156254 | 156633 | ** RIGHT JOIN. Only constraints in the |
| 156255 | 156634 | ** ON clause are allowed. See tag-20191211-002 for the vtab equivalent. */ |
| 156256 | 156635 | if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ))!=0 |
| 156257 | | - && !ExprHasProperty(pTerm->pExpr, EP_FromJoin) |
| 156636 | + && !ExprHasProperty(pTerm->pExpr, EP_OuterON|EP_InnerON) |
| 156258 | 156637 | ){ |
| 156259 | 156638 | continue; |
| 156260 | 156639 | } |
| 156261 | 156640 | |
| 156262 | 156641 | if( IsUniqueIndex(pProbe) && saved_nEq==pProbe->nKeyCol-1 ){ |
| | @@ -156621,12 +157000,12 @@ |
| 156621 | 157000 | } |
| 156622 | 157001 | if( pParse->db->flags & SQLITE_EnableQPSG ) pParse = 0; |
| 156623 | 157002 | for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 156624 | 157003 | Expr *pExpr; |
| 156625 | 157004 | pExpr = pTerm->pExpr; |
| 156626 | | - if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->w.iJoin==iTab) |
| 156627 | | - && (isLeft==0 || ExprHasProperty(pExpr, EP_FromJoin)) |
| 157005 | + if( (!ExprHasProperty(pExpr, EP_OuterON) || pExpr->w.iJoin==iTab) |
| 157006 | + && (isLeft==0 || ExprHasProperty(pExpr, EP_OuterON)) |
| 156628 | 157007 | && sqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab) |
| 156629 | 157008 | && (pTerm->wtFlags & TERM_VNULL)==0 |
| 156630 | 157009 | ){ |
| 156631 | 157010 | return 1; |
| 156632 | 157011 | } |
| | @@ -156898,11 +157277,18 @@ |
| 156898 | 157277 | |
| 156899 | 157278 | pNew->rRun = sqlite3LogEstAdd(pNew->rRun, nLookup); |
| 156900 | 157279 | } |
| 156901 | 157280 | ApplyCostMultiplier(pNew->rRun, pTab->costMult); |
| 156902 | 157281 | whereLoopOutputAdjust(pWC, pNew, rSize); |
| 156903 | | - rc = whereLoopInsert(pBuilder, pNew); |
| 157282 | + if( (pSrc->fg.jointype & JT_RIGHT)!=0 && pProbe->aColExpr ){ |
| 157283 | + /* Do not do an SCAN of a index-on-expression in a RIGHT JOIN |
| 157284 | + ** because the cursor used to access the index might not be |
| 157285 | + ** positioned to the correct row during the right-join no-match |
| 157286 | + ** loop. */ |
| 157287 | + }else{ |
| 157288 | + rc = whereLoopInsert(pBuilder, pNew); |
| 157289 | + } |
| 156904 | 157290 | pNew->nOut = rSize; |
| 156905 | 157291 | if( rc ) break; |
| 156906 | 157292 | } |
| 156907 | 157293 | } |
| 156908 | 157294 | |
| | @@ -157073,10 +157459,11 @@ |
| 157073 | 157459 | pIdxInfo->orderByConsumed = 0; |
| 157074 | 157460 | pIdxInfo->idxFlags &= ~SQLITE_INDEX_SCAN_UNIQUE; |
| 157075 | 157461 | *pbIn = 1; assert( (mExclude & WO_IN)==0 ); |
| 157076 | 157462 | } |
| 157077 | 157463 | |
| 157464 | + assert( pbRetryLimit || !isLimitTerm(pTerm) ); |
| 157078 | 157465 | if( isLimitTerm(pTerm) && *pbIn ){ |
| 157079 | 157466 | /* If there is an IN(...) term handled as an == (separate call to |
| 157080 | 157467 | ** xFilter for each value on the RHS of the IN) and a LIMIT or |
| 157081 | 157468 | ** OFFSET term handled as well, the plan is unusable. Set output |
| 157082 | 157469 | ** variable *pbRetryLimit to true to tell the caller to retry with |
| | @@ -157546,11 +157933,13 @@ |
| 157546 | 157933 | SrcList *pTabList = pWInfo->pTabList; |
| 157547 | 157934 | SrcItem *pItem; |
| 157548 | 157935 | SrcItem *pEnd = &pTabList->a[pWInfo->nLevel]; |
| 157549 | 157936 | sqlite3 *db = pWInfo->pParse->db; |
| 157550 | 157937 | int rc = SQLITE_OK; |
| 157938 | + int bFirstPastRJ = 0; |
| 157551 | 157939 | WhereLoop *pNew; |
| 157940 | + |
| 157552 | 157941 | |
| 157553 | 157942 | /* Loop over the tables in the join, from left to right */ |
| 157554 | 157943 | pNew = pBuilder->pNew; |
| 157555 | 157944 | whereLoopInit(pNew); |
| 157556 | 157945 | pBuilder->iPlanLimit = SQLITE_QUERY_PLANNER_LIMIT; |
| | @@ -157557,16 +157946,17 @@ |
| 157557 | 157946 | for(iTab=0, pItem=pTabList->a; pItem<pEnd; iTab++, pItem++){ |
| 157558 | 157947 | Bitmask mUnusable = 0; |
| 157559 | 157948 | pNew->iTab = iTab; |
| 157560 | 157949 | pBuilder->iPlanLimit += SQLITE_QUERY_PLANNER_LIMIT_INCR; |
| 157561 | 157950 | pNew->maskSelf = sqlite3WhereGetMask(&pWInfo->sMaskSet, pItem->iCursor); |
| 157562 | | - if( (pItem->fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){ |
| 157563 | | - /* This condition is true when pItem is the FROM clause term on the |
| 157564 | | - ** right-hand-side of a OUTER or CROSS JOIN. */ |
| 157565 | | - mPrereq = mPrior; |
| 157566 | | - }else{ |
| 157567 | | - mPrereq = 0; |
| 157951 | + if( bFirstPastRJ || (pItem->fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){ |
| 157952 | + /* Add prerequisites to prevent reordering of FROM clause terms |
| 157953 | + ** across CROSS joins and outer joins. The bFirstPastRJ boolean |
| 157954 | + ** prevents the right operand of a RIGHT JOIN from being swapped with |
| 157955 | + ** other elements even further to the right. */ |
| 157956 | + mPrereq |= mPrior; |
| 157957 | + bFirstPastRJ = (pItem->fg.jointype & JT_RIGHT)!=0; |
| 157568 | 157958 | } |
| 157569 | 157959 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 157570 | 157960 | if( IsVirtual(pItem->pTab) ){ |
| 157571 | 157961 | SrcItem *p; |
| 157572 | 157962 | for(p=&pItem[1]; p<pEnd; p++){ |
| | @@ -157873,20 +158263,22 @@ |
| 157873 | 158263 | } |
| 157874 | 158264 | if( isMatch && (wctrlFlags & WHERE_GROUPBY)==0 ){ |
| 157875 | 158265 | /* Make sure the sort order is compatible in an ORDER BY clause. |
| 157876 | 158266 | ** Sort order is irrelevant for a GROUP BY clause. */ |
| 157877 | 158267 | if( revSet ){ |
| 157878 | | - if( (rev ^ revIdx)!=(pOrderBy->a[i].sortFlags&KEYINFO_ORDER_DESC) ){ |
| 158268 | + if( (rev ^ revIdx) |
| 158269 | + != (pOrderBy->a[i].fg.sortFlags&KEYINFO_ORDER_DESC) |
| 158270 | + ){ |
| 157879 | 158271 | isMatch = 0; |
| 157880 | 158272 | } |
| 157881 | 158273 | }else{ |
| 157882 | | - rev = revIdx ^ (pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC); |
| 158274 | + rev = revIdx ^ (pOrderBy->a[i].fg.sortFlags & KEYINFO_ORDER_DESC); |
| 157883 | 158275 | if( rev ) *pRevMask |= MASKBIT(iLoop); |
| 157884 | 158276 | revSet = 1; |
| 157885 | 158277 | } |
| 157886 | 158278 | } |
| 157887 | | - if( isMatch && (pOrderBy->a[i].sortFlags & KEYINFO_ORDER_BIGNULL) ){ |
| 158279 | + if( isMatch && (pOrderBy->a[i].fg.sortFlags & KEYINFO_ORDER_BIGNULL) ){ |
| 157888 | 158280 | if( j==pLoop->u.btree.nEq ){ |
| 157889 | 158281 | pLoop->wsFlags |= WHERE_BIGNULL_SORT; |
| 157890 | 158282 | }else{ |
| 157891 | 158283 | isMatch = 0; |
| 157892 | 158284 | } |
| | @@ -158630,11 +159022,11 @@ |
| 158630 | 159022 | } |
| 158631 | 159023 | if( (tabUsed & pLoop->maskSelf)!=0 ) continue; |
| 158632 | 159024 | pEnd = pWInfo->sWC.a + pWInfo->sWC.nTerm; |
| 158633 | 159025 | for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){ |
| 158634 | 159026 | if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){ |
| 158635 | | - if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin) |
| 159027 | + if( !ExprHasProperty(pTerm->pExpr, EP_OuterON) |
| 158636 | 159028 | || pTerm->pExpr->w.iJoin!=pItem->iCursor |
| 158637 | 159029 | ){ |
| 158638 | 159030 | break; |
| 158639 | 159031 | } |
| 158640 | 159032 | } |
| | @@ -159256,10 +159648,11 @@ |
| 159256 | 159648 | op = OP_ReopenIdx; |
| 159257 | 159649 | }else{ |
| 159258 | 159650 | iIndexCur = pParse->nTab++; |
| 159259 | 159651 | } |
| 159260 | 159652 | pLevel->iIdxCur = iIndexCur; |
| 159653 | + assert( pIx!=0 ); |
| 159261 | 159654 | assert( pIx->pSchema==pTab->pSchema ); |
| 159262 | 159655 | assert( iIndexCur>=0 ); |
| 159263 | 159656 | if( op ){ |
| 159264 | 159657 | sqlite3VdbeAddOp3(v, op, iIndexCur, pIx->tnum, iDb); |
| 159265 | 159658 | sqlite3VdbeSetP4KeyInfo(pParse, pIx); |
| | @@ -159331,13 +159724,24 @@ |
| 159331 | 159724 | ** program. |
| 159332 | 159725 | */ |
| 159333 | 159726 | for(ii=0; ii<nTabList; ii++){ |
| 159334 | 159727 | int addrExplain; |
| 159335 | 159728 | int wsFlags; |
| 159729 | + SrcItem *pSrc; |
| 159336 | 159730 | if( pParse->nErr ) goto whereBeginError; |
| 159337 | 159731 | pLevel = &pWInfo->a[ii]; |
| 159338 | 159732 | wsFlags = pLevel->pWLoop->wsFlags; |
| 159733 | + pSrc = &pTabList->a[pLevel->iFrom]; |
| 159734 | + if( pSrc->fg.isMaterialized ){ |
| 159735 | + if( pSrc->fg.isCorrelated ){ |
| 159736 | + sqlite3VdbeAddOp2(v, OP_Gosub, pSrc->regReturn, pSrc->addrFillSub); |
| 159737 | + }else{ |
| 159738 | + int iOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); |
| 159739 | + sqlite3VdbeAddOp2(v, OP_Gosub, pSrc->regReturn, pSrc->addrFillSub); |
| 159740 | + sqlite3VdbeJumpHere(v, iOnce); |
| 159741 | + } |
| 159742 | + } |
| 159339 | 159743 | if( (wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))!=0 ){ |
| 159340 | 159744 | if( (wsFlags & WHERE_AUTO_INDEX)!=0 ){ |
| 159341 | 159745 | #ifndef SQLITE_OMIT_AUTOMATIC_INDEX |
| 159342 | 159746 | constructAutomaticIndex(pParse, &pWInfo->sWC, |
| 159343 | 159747 | &pTabList->a[pLevel->iFrom], notReady, pLevel); |
| | @@ -159425,10 +159829,11 @@ |
| 159425 | 159829 | WhereLevel *pLevel; |
| 159426 | 159830 | WhereLoop *pLoop; |
| 159427 | 159831 | SrcList *pTabList = pWInfo->pTabList; |
| 159428 | 159832 | sqlite3 *db = pParse->db; |
| 159429 | 159833 | int iEnd = sqlite3VdbeCurrentAddr(v); |
| 159834 | + int nRJ = 0; |
| 159430 | 159835 | |
| 159431 | 159836 | /* Generate loop termination code. |
| 159432 | 159837 | */ |
| 159433 | 159838 | VdbeModuleComment((v, "End WHERE-core")); |
| 159434 | 159839 | for(i=pWInfo->nLevel-1; i>=0; i--){ |
| | @@ -159438,14 +159843,14 @@ |
| 159438 | 159843 | /* Terminate the subroutine that forms the interior of the loop of |
| 159439 | 159844 | ** the RIGHT JOIN table */ |
| 159440 | 159845 | WhereRightJoin *pRJ = pLevel->pRJ; |
| 159441 | 159846 | sqlite3VdbeResolveLabel(v, pLevel->addrCont); |
| 159442 | 159847 | pLevel->addrCont = 0; |
| 159848 | + pRJ->endSubrtn = sqlite3VdbeCurrentAddr(v); |
| 159443 | 159849 | sqlite3VdbeAddOp3(v, OP_Return, pRJ->regReturn, pRJ->addrSubrtn, 1); |
| 159444 | 159850 | VdbeCoverage(v); |
| 159445 | | - assert( pParse->withinRJSubrtn>0 ); |
| 159446 | | - pParse->withinRJSubrtn--; |
| 159851 | + nRJ++; |
| 159447 | 159852 | } |
| 159448 | 159853 | pLoop = pLevel->pWLoop; |
| 159449 | 159854 | if( pLevel->op!=OP_Noop ){ |
| 159450 | 159855 | #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT |
| 159451 | 159856 | int addrSeek = 0; |
| | @@ -159583,10 +159988,11 @@ |
| 159583 | 159988 | VdbeModuleComment((v, "End WHERE-loop%d: %s", i, |
| 159584 | 159989 | pWInfo->pTabList->a[pLevel->iFrom].pTab->zName)); |
| 159585 | 159990 | } |
| 159586 | 159991 | |
| 159587 | 159992 | assert( pWInfo->nLevel<=pTabList->nSrc ); |
| 159993 | + if( pWInfo->pExprMods ) whereUndoExprMods(pWInfo); |
| 159588 | 159994 | for(i=0, pLevel=pWInfo->a; i<pWInfo->nLevel; i++, pLevel++){ |
| 159589 | 159995 | int k, last; |
| 159590 | 159996 | VdbeOp *pOp, *pLastOp; |
| 159591 | 159997 | Index *pIdx = 0; |
| 159592 | 159998 | SrcItem *pTabItem = &pTabList->a[pLevel->iFrom]; |
| | @@ -159719,13 +160125,13 @@ |
| 159719 | 160125 | */ |
| 159720 | 160126 | sqlite3VdbeResolveLabel(v, pWInfo->iBreak); |
| 159721 | 160127 | |
| 159722 | 160128 | /* Final cleanup |
| 159723 | 160129 | */ |
| 159724 | | - if( pWInfo->pExprMods ) whereUndoExprMods(pWInfo); |
| 159725 | 160130 | pParse->nQueryLoop = pWInfo->savedNQueryLoop; |
| 159726 | 160131 | whereInfoFree(db, pWInfo); |
| 160132 | + pParse->withinRJSubrtn -= nRJ; |
| 159727 | 160133 | return; |
| 159728 | 160134 | } |
| 159729 | 160135 | |
| 159730 | 160136 | /************** End of where.c ***********************************************/ |
| 159731 | 160137 | /************** Begin file window.c ******************************************/ |
| | @@ -160645,11 +161051,11 @@ |
| 160645 | 161051 | pSub->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse); |
| 160646 | 161052 | pSub->u.zToken = 0; |
| 160647 | 161053 | } |
| 160648 | 161054 | } |
| 160649 | 161055 | pList = sqlite3ExprListAppend(pParse, pList, pDup); |
| 160650 | | - if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags; |
| 161056 | + if( pList ) pList->a[nInit+i].fg.sortFlags = pAppend->a[i].fg.sortFlags; |
| 160651 | 161057 | } |
| 160652 | 161058 | } |
| 160653 | 161059 | return pList; |
| 160654 | 161060 | } |
| 160655 | 161061 | |
| | @@ -161846,11 +162252,11 @@ |
| 161846 | 162252 | windowReadPeerValues(p, csr1, reg1); |
| 161847 | 162253 | windowReadPeerValues(p, csr2, reg2); |
| 161848 | 162254 | |
| 161849 | 162255 | assert( op==OP_Ge || op==OP_Gt || op==OP_Le ); |
| 161850 | 162256 | assert( pOrderBy && pOrderBy->nExpr==1 ); |
| 161851 | | - if( pOrderBy->a[0].sortFlags & KEYINFO_ORDER_DESC ){ |
| 162257 | + if( pOrderBy->a[0].fg.sortFlags & KEYINFO_ORDER_DESC ){ |
| 161852 | 162258 | switch( op ){ |
| 161853 | 162259 | case OP_Ge: op = OP_Le; break; |
| 161854 | 162260 | case OP_Gt: op = OP_Lt; break; |
| 161855 | 162261 | default: assert( op==OP_Le ); op = OP_Ge; break; |
| 161856 | 162262 | } |
| | @@ -161879,11 +162285,11 @@ |
| 161879 | 162285 | ** } |
| 161880 | 162286 | ** |
| 161881 | 162287 | ** Additionally, if either reg1 or reg2 are NULL but the jump to lbl is |
| 161882 | 162288 | ** not taken, control jumps over the comparison operator coded below this |
| 161883 | 162289 | ** block. */ |
| 161884 | | - if( pOrderBy->a[0].sortFlags & KEYINFO_ORDER_BIGNULL ){ |
| 162290 | + if( pOrderBy->a[0].fg.sortFlags & KEYINFO_ORDER_BIGNULL ){ |
| 161885 | 162291 | /* This block runs if reg1 contains a NULL. */ |
| 161886 | 162292 | int addr = sqlite3VdbeAddOp1(v, OP_NotNull, reg1); VdbeCoverage(v); |
| 161887 | 162293 | switch( op ){ |
| 161888 | 162294 | case OP_Ge: |
| 161889 | 162295 | sqlite3VdbeAddOp2(v, OP_Goto, 0, lbl); |
| | @@ -163347,22 +163753,22 @@ |
| 163347 | 163753 | #define sqlite3ParserCTX_PDECL ,Parse *pParse |
| 163348 | 163754 | #define sqlite3ParserCTX_PARAM ,pParse |
| 163349 | 163755 | #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; |
| 163350 | 163756 | #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; |
| 163351 | 163757 | #define YYFALLBACK 1 |
| 163352 | | -#define YYNSTATE 570 |
| 163353 | | -#define YYNRULE 403 |
| 163354 | | -#define YYNRULE_WITH_ACTION 340 |
| 163758 | +#define YYNSTATE 576 |
| 163759 | +#define YYNRULE 405 |
| 163760 | +#define YYNRULE_WITH_ACTION 342 |
| 163355 | 163761 | #define YYNTOKEN 185 |
| 163356 | | -#define YY_MAX_SHIFT 569 |
| 163357 | | -#define YY_MIN_SHIFTREDUCE 829 |
| 163358 | | -#define YY_MAX_SHIFTREDUCE 1231 |
| 163359 | | -#define YY_ERROR_ACTION 1232 |
| 163360 | | -#define YY_ACCEPT_ACTION 1233 |
| 163361 | | -#define YY_NO_ACTION 1234 |
| 163362 | | -#define YY_MIN_REDUCE 1235 |
| 163363 | | -#define YY_MAX_REDUCE 1637 |
| 163762 | +#define YY_MAX_SHIFT 575 |
| 163763 | +#define YY_MIN_SHIFTREDUCE 835 |
| 163764 | +#define YY_MAX_SHIFTREDUCE 1239 |
| 163765 | +#define YY_ERROR_ACTION 1240 |
| 163766 | +#define YY_ACCEPT_ACTION 1241 |
| 163767 | +#define YY_NO_ACTION 1242 |
| 163768 | +#define YY_MIN_REDUCE 1243 |
| 163769 | +#define YY_MAX_REDUCE 1647 |
| 163364 | 163770 | /************* End control #defines *******************************************/ |
| 163365 | 163771 | #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) |
| 163366 | 163772 | |
| 163367 | 163773 | /* Define the yytestcase() macro to be a no-op if is not already defined |
| 163368 | 163774 | ** otherwise. |
| | @@ -163425,219 +163831,222 @@ |
| 163425 | 163831 | ** yy_reduce_ofst[] For each state, the offset into yy_action for |
| 163426 | 163832 | ** shifting non-terminals after a reduce. |
| 163427 | 163833 | ** yy_default[] Default action for each state. |
| 163428 | 163834 | ** |
| 163429 | 163835 | *********** Begin parsing tables **********************************************/ |
| 163430 | | -#define YY_ACTTAB_COUNT (2064) |
| 163836 | +#define YY_ACTTAB_COUNT (2098) |
| 163431 | 163837 | static const YYACTIONTYPE yy_action[] = { |
| 163432 | | - /* 0 */ 562, 204, 562, 116, 112, 225, 562, 116, 112, 225, |
| 163433 | | - /* 10 */ 562, 1306, 373, 1285, 404, 556, 556, 556, 562, 405, |
| 163434 | | - /* 20 */ 374, 1306, 1268, 41, 41, 41, 41, 204, 1516, 71, |
| 163435 | | - /* 30 */ 71, 965, 415, 41, 41, 487, 299, 275, 299, 966, |
| 163436 | | - /* 40 */ 393, 71, 71, 123, 124, 114, 1209, 1209, 1042, 1045, |
| 163437 | | - /* 50 */ 1034, 1034, 121, 121, 122, 122, 122, 122, 472, 405, |
| 163438 | | - /* 60 */ 1233, 1, 1, 569, 2, 1237, 544, 116, 112, 225, |
| 163439 | | - /* 70 */ 313, 476, 142, 476, 520, 116, 112, 225, 525, 1319, |
| 163440 | | - /* 80 */ 413, 519, 138, 123, 124, 114, 1209, 1209, 1042, 1045, |
| 163441 | | - /* 90 */ 1034, 1034, 121, 121, 122, 122, 122, 122, 116, 112, |
| 163442 | | - /* 100 */ 225, 323, 120, 120, 120, 120, 119, 119, 118, 118, |
| 163443 | | - /* 110 */ 118, 117, 113, 440, 280, 280, 280, 280, 438, 438, |
| 163444 | | - /* 120 */ 438, 1557, 372, 1559, 1184, 371, 1155, 559, 1155, 559, |
| 163445 | | - /* 130 */ 405, 1557, 533, 255, 222, 440, 99, 141, 445, 312, |
| 163446 | | - /* 140 */ 553, 236, 120, 120, 120, 120, 119, 119, 118, 118, |
| 163447 | | - /* 150 */ 118, 117, 113, 440, 123, 124, 114, 1209, 1209, 1042, |
| 163448 | | - /* 160 */ 1045, 1034, 1034, 121, 121, 122, 122, 122, 122, 138, |
| 163449 | | - /* 170 */ 290, 1184, 335, 444, 118, 118, 118, 117, 113, 440, |
| 163450 | | - /* 180 */ 125, 1184, 1185, 1186, 144, 437, 436, 562, 117, 113, |
| 163451 | | - /* 190 */ 440, 122, 122, 122, 122, 115, 120, 120, 120, 120, |
| 163452 | | - /* 200 */ 119, 119, 118, 118, 118, 117, 113, 440, 450, 110, |
| 163453 | | - /* 210 */ 13, 13, 542, 120, 120, 120, 120, 119, 119, 118, |
| 163454 | | - /* 220 */ 118, 118, 117, 113, 440, 418, 312, 553, 1184, 1185, |
| 163455 | | - /* 230 */ 1186, 145, 1216, 405, 1216, 122, 122, 122, 122, 120, |
| 163456 | | - /* 240 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 113, |
| 163457 | | - /* 250 */ 440, 461, 338, 1031, 1031, 1043, 1046, 123, 124, 114, |
| 163458 | | - /* 260 */ 1209, 1209, 1042, 1045, 1034, 1034, 121, 121, 122, 122, |
| 163459 | | - /* 270 */ 122, 122, 1271, 518, 218, 1184, 562, 405, 220, 510, |
| 163460 | | - /* 280 */ 171, 80, 81, 120, 120, 120, 120, 119, 119, 118, |
| 163461 | | - /* 290 */ 118, 118, 117, 113, 440, 1001, 16, 16, 1184, 55, |
| 163462 | | - /* 300 */ 55, 123, 124, 114, 1209, 1209, 1042, 1045, 1034, 1034, |
| 163463 | | - /* 310 */ 121, 121, 122, 122, 122, 122, 120, 120, 120, 120, |
| 163464 | | - /* 320 */ 119, 119, 118, 118, 118, 117, 113, 440, 1035, 542, |
| 163465 | | - /* 330 */ 1184, 369, 1184, 1185, 1186, 248, 1426, 395, 500, 497, |
| 163466 | | - /* 340 */ 496, 108, 554, 560, 4, 920, 920, 429, 495, 336, |
| 163467 | | - /* 350 */ 456, 324, 356, 390, 1229, 1184, 1185, 1186, 557, 562, |
| 163468 | | - /* 360 */ 120, 120, 120, 120, 119, 119, 118, 118, 118, 117, |
| 163469 | | - /* 370 */ 113, 440, 280, 280, 365, 1570, 1597, 437, 436, 150, |
| 163470 | | - /* 380 */ 405, 441, 71, 71, 1278, 559, 1213, 1184, 1185, 1186, |
| 163471 | | - /* 390 */ 83, 1215, 267, 551, 539, 511, 1551, 562, 96, 1214, |
| 163472 | | - /* 400 */ 6, 1270, 468, 138, 123, 124, 114, 1209, 1209, 1042, |
| 163473 | | - /* 410 */ 1045, 1034, 1034, 121, 121, 122, 122, 122, 122, 544, |
| 163474 | | - /* 420 */ 13, 13, 1021, 503, 1216, 1184, 1216, 543, 106, 106, |
| 163475 | | - /* 430 */ 218, 562, 1230, 171, 562, 423, 107, 193, 441, 564, |
| 163476 | | - /* 440 */ 563, 426, 1542, 1011, 321, 545, 1184, 266, 283, 364, |
| 163477 | | - /* 450 */ 506, 359, 505, 253, 71, 71, 539, 71, 71, 355, |
| 163478 | | - /* 460 */ 312, 553, 1603, 120, 120, 120, 120, 119, 119, 118, |
| 163479 | | - /* 470 */ 118, 118, 117, 113, 440, 1011, 1011, 1013, 1014, 27, |
| 163480 | | - /* 480 */ 280, 280, 1184, 1185, 1186, 1150, 562, 1602, 405, 895, |
| 163481 | | - /* 490 */ 186, 544, 352, 559, 544, 931, 529, 513, 1150, 512, |
| 163482 | | - /* 500 */ 409, 1150, 546, 1184, 1185, 1186, 562, 540, 1544, 51, |
| 163483 | | - /* 510 */ 51, 210, 123, 124, 114, 1209, 1209, 1042, 1045, 1034, |
| 163484 | | - /* 520 */ 1034, 121, 121, 122, 122, 122, 122, 1184, 470, 56, |
| 163485 | | - /* 530 */ 56, 405, 280, 280, 1480, 501, 119, 119, 118, 118, |
| 163486 | | - /* 540 */ 118, 117, 113, 440, 1001, 559, 514, 213, 537, 1551, |
| 163487 | | - /* 550 */ 312, 553, 138, 6, 528, 123, 124, 114, 1209, 1209, |
| 163488 | | - /* 560 */ 1042, 1045, 1034, 1034, 121, 121, 122, 122, 122, 122, |
| 163489 | | - /* 570 */ 1545, 120, 120, 120, 120, 119, 119, 118, 118, 118, |
| 163490 | | - /* 580 */ 117, 113, 440, 481, 1184, 1185, 1186, 478, 277, 1259, |
| 163491 | | - /* 590 */ 951, 248, 1184, 369, 500, 497, 496, 1184, 336, 565, |
| 163492 | | - /* 600 */ 1184, 565, 405, 288, 495, 951, 870, 187, 476, 312, |
| 163493 | | - /* 610 */ 553, 380, 286, 376, 120, 120, 120, 120, 119, 119, |
| 163494 | | - /* 620 */ 118, 118, 118, 117, 113, 440, 123, 124, 114, 1209, |
| 163495 | | - /* 630 */ 1209, 1042, 1045, 1034, 1034, 121, 121, 122, 122, 122, |
| 163496 | | - /* 640 */ 122, 405, 390, 1128, 1184, 863, 98, 280, 280, 1184, |
| 163497 | | - /* 650 */ 1185, 1186, 369, 1085, 1184, 1185, 1186, 1184, 1185, 1186, |
| 163498 | | - /* 660 */ 559, 451, 32, 369, 229, 123, 124, 114, 1209, 1209, |
| 163499 | | - /* 670 */ 1042, 1045, 1034, 1034, 121, 121, 122, 122, 122, 122, |
| 163500 | | - /* 680 */ 1425, 953, 562, 224, 952, 120, 120, 120, 120, 119, |
| 163501 | | - /* 690 */ 119, 118, 118, 118, 117, 113, 440, 1150, 224, 1184, |
| 163502 | | - /* 700 */ 153, 1184, 1185, 1186, 1543, 13, 13, 297, 951, 1224, |
| 163503 | | - /* 710 */ 1150, 149, 405, 1150, 369, 1573, 1168, 5, 365, 1570, |
| 163504 | | - /* 720 */ 425, 1230, 3, 951, 120, 120, 120, 120, 119, 119, |
| 163505 | | - /* 730 */ 118, 118, 118, 117, 113, 440, 123, 124, 114, 1209, |
| 163506 | | - /* 740 */ 1209, 1042, 1045, 1034, 1034, 121, 121, 122, 122, 122, |
| 163507 | | - /* 750 */ 122, 405, 204, 561, 1184, 1022, 1184, 1185, 1186, 1184, |
| 163508 | | - /* 760 */ 384, 846, 151, 1542, 282, 398, 1090, 1090, 484, 562, |
| 163509 | | - /* 770 */ 461, 338, 1311, 1311, 1542, 123, 124, 114, 1209, 1209, |
| 163510 | | - /* 780 */ 1042, 1045, 1034, 1034, 121, 121, 122, 122, 122, 122, |
| 163511 | | - /* 790 */ 127, 562, 13, 13, 370, 120, 120, 120, 120, 119, |
| 163512 | | - /* 800 */ 119, 118, 118, 118, 117, 113, 440, 298, 562, 449, |
| 163513 | | - /* 810 */ 524, 1184, 1185, 1186, 13, 13, 1184, 1185, 1186, 1289, |
| 163514 | | - /* 820 */ 459, 1259, 405, 1309, 1309, 1542, 1006, 449, 448, 196, |
| 163515 | | - /* 830 */ 295, 71, 71, 1257, 120, 120, 120, 120, 119, 119, |
| 163516 | | - /* 840 */ 118, 118, 118, 117, 113, 440, 123, 124, 114, 1209, |
| 163517 | | - /* 850 */ 1209, 1042, 1045, 1034, 1034, 121, 121, 122, 122, 122, |
| 163518 | | - /* 860 */ 122, 405, 223, 1065, 1150, 280, 280, 415, 308, 274, |
| 163519 | | - /* 870 */ 274, 281, 281, 1411, 402, 401, 378, 1150, 559, 562, |
| 163520 | | - /* 880 */ 1150, 1188, 559, 1590, 559, 123, 124, 114, 1209, 1209, |
| 163521 | | - /* 890 */ 1042, 1045, 1034, 1034, 121, 121, 122, 122, 122, 122, |
| 163522 | | - /* 900 */ 449, 1472, 13, 13, 1526, 120, 120, 120, 120, 119, |
| 163523 | | - /* 910 */ 119, 118, 118, 118, 117, 113, 440, 197, 562, 350, |
| 163524 | | - /* 920 */ 1576, 569, 2, 1237, 834, 835, 836, 1552, 313, 1204, |
| 163525 | | - /* 930 */ 142, 6, 405, 251, 250, 249, 202, 1319, 9, 1188, |
| 163526 | | - /* 940 */ 258, 71, 71, 420, 120, 120, 120, 120, 119, 119, |
| 163527 | | - /* 950 */ 118, 118, 118, 117, 113, 440, 123, 124, 114, 1209, |
| 163528 | | - /* 960 */ 1209, 1042, 1045, 1034, 1034, 121, 121, 122, 122, 122, |
| 163529 | | - /* 970 */ 122, 562, 280, 280, 562, 1205, 405, 568, 309, 1237, |
| 163530 | | - /* 980 */ 345, 1288, 348, 415, 313, 559, 142, 487, 521, 1633, |
| 163531 | | - /* 990 */ 391, 367, 487, 1319, 70, 70, 1287, 71, 71, 236, |
| 163532 | | - /* 1000 */ 1317, 101, 114, 1209, 1209, 1042, 1045, 1034, 1034, 121, |
| 163533 | | - /* 1010 */ 121, 122, 122, 122, 122, 120, 120, 120, 120, 119, |
| 163534 | | - /* 1020 */ 119, 118, 118, 118, 117, 113, 440, 1106, 280, 280, |
| 163535 | | - /* 1030 */ 424, 444, 1515, 1205, 435, 280, 280, 1479, 1344, 307, |
| 163536 | | - /* 1040 */ 470, 559, 1107, 965, 487, 487, 213, 1255, 559, 1528, |
| 163537 | | - /* 1050 */ 562, 966, 203, 562, 1021, 236, 379, 1108, 515, 120, |
| 163538 | | - /* 1060 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 113, |
| 163539 | | - /* 1070 */ 440, 1012, 104, 71, 71, 1011, 13, 13, 906, 562, |
| 163540 | | - /* 1080 */ 1485, 562, 280, 280, 95, 522, 487, 444, 907, 1318, |
| 163541 | | - /* 1090 */ 1314, 541, 405, 280, 280, 559, 147, 205, 1485, 1487, |
| 163542 | | - /* 1100 */ 258, 446, 15, 15, 43, 43, 559, 1011, 1011, 1013, |
| 163543 | | - /* 1110 */ 439, 328, 405, 523, 12, 291, 123, 124, 114, 1209, |
| 163544 | | - /* 1120 */ 1209, 1042, 1045, 1034, 1034, 121, 121, 122, 122, 122, |
| 163545 | | - /* 1130 */ 122, 343, 405, 858, 1524, 1205, 123, 124, 114, 1209, |
| 163546 | | - /* 1140 */ 1209, 1042, 1045, 1034, 1034, 121, 121, 122, 122, 122, |
| 163547 | | - /* 1150 */ 122, 1129, 1631, 470, 1631, 367, 123, 111, 114, 1209, |
| 163548 | | - /* 1160 */ 1209, 1042, 1045, 1034, 1034, 121, 121, 122, 122, 122, |
| 163549 | | - /* 1170 */ 122, 1485, 325, 470, 327, 120, 120, 120, 120, 119, |
| 163550 | | - /* 1180 */ 119, 118, 118, 118, 117, 113, 440, 199, 1411, 562, |
| 163551 | | - /* 1190 */ 1286, 858, 460, 1205, 432, 120, 120, 120, 120, 119, |
| 163552 | | - /* 1200 */ 119, 118, 118, 118, 117, 113, 440, 547, 1129, 1632, |
| 163553 | | - /* 1210 */ 535, 1632, 57, 57, 886, 120, 120, 120, 120, 119, |
| 163554 | | - /* 1220 */ 119, 118, 118, 118, 117, 113, 440, 562, 294, 534, |
| 163555 | | - /* 1230 */ 1127, 1411, 1549, 1550, 1323, 405, 6, 6, 1161, 1260, |
| 163556 | | - /* 1240 */ 411, 316, 280, 280, 1411, 504, 559, 521, 296, 453, |
| 163557 | | - /* 1250 */ 44, 44, 562, 887, 12, 559, 326, 474, 421, 403, |
| 163558 | | - /* 1260 */ 124, 114, 1209, 1209, 1042, 1045, 1034, 1034, 121, 121, |
| 163559 | | - /* 1270 */ 122, 122, 122, 122, 562, 58, 58, 284, 1184, 1411, |
| 163560 | | - /* 1280 */ 492, 454, 388, 388, 387, 269, 385, 1127, 1548, 843, |
| 163561 | | - /* 1290 */ 1161, 403, 6, 562, 317, 1150, 466, 59, 59, 1547, |
| 163562 | | - /* 1300 */ 1106, 422, 230, 6, 319, 252, 536, 252, 1150, 427, |
| 163563 | | - /* 1310 */ 562, 1150, 318, 17, 483, 1107, 60, 60, 120, 120, |
| 163564 | | - /* 1320 */ 120, 120, 119, 119, 118, 118, 118, 117, 113, 440, |
| 163565 | | - /* 1330 */ 1108, 212, 477, 61, 61, 1184, 1185, 1186, 108, 554, |
| 163566 | | - /* 1340 */ 320, 4, 232, 452, 522, 562, 233, 452, 562, 433, |
| 163567 | | - /* 1350 */ 164, 550, 416, 137, 475, 557, 562, 289, 562, 1087, |
| 163568 | | - /* 1360 */ 562, 289, 562, 1087, 527, 562, 866, 8, 62, 62, |
| 163569 | | - /* 1370 */ 231, 45, 45, 562, 410, 562, 410, 562, 441, 46, |
| 163570 | | - /* 1380 */ 46, 47, 47, 49, 49, 50, 50, 195, 63, 63, |
| 163571 | | - /* 1390 */ 551, 562, 355, 562, 98, 482, 64, 64, 65, 65, |
| 163572 | | - /* 1400 */ 14, 14, 555, 411, 531, 406, 562, 1021, 562, 530, |
| 163573 | | - /* 1410 */ 312, 553, 312, 553, 66, 66, 129, 129, 562, 1021, |
| 163574 | | - /* 1420 */ 562, 508, 926, 866, 1012, 106, 106, 925, 1011, 67, |
| 163575 | | - /* 1430 */ 67, 52, 52, 107, 447, 441, 564, 563, 412, 173, |
| 163576 | | - /* 1440 */ 1011, 68, 68, 69, 69, 562, 463, 562, 926, 467, |
| 163577 | | - /* 1450 */ 1356, 279, 222, 925, 311, 1355, 403, 562, 455, 403, |
| 163578 | | - /* 1460 */ 1011, 1011, 1013, 235, 403, 84, 209, 1342, 53, 53, |
| 163579 | | - /* 1470 */ 159, 159, 1011, 1011, 1013, 1014, 27, 1575, 1172, 443, |
| 163580 | | - /* 1480 */ 160, 160, 284, 95, 105, 1531, 103, 388, 388, 387, |
| 163581 | | - /* 1490 */ 269, 385, 562, 873, 843, 877, 562, 108, 554, 462, |
| 163582 | | - /* 1500 */ 4, 562, 148, 30, 38, 562, 1124, 230, 392, 319, |
| 163583 | | - /* 1510 */ 108, 554, 523, 4, 557, 76, 76, 318, 562, 54, |
| 163584 | | - /* 1520 */ 54, 562, 333, 464, 72, 72, 329, 557, 130, 130, |
| 163585 | | - /* 1530 */ 562, 285, 1504, 562, 31, 1503, 562, 441, 334, 479, |
| 163586 | | - /* 1540 */ 98, 73, 73, 340, 157, 157, 292, 232, 1072, 551, |
| 163587 | | - /* 1550 */ 441, 873, 1352, 131, 131, 164, 132, 132, 137, 128, |
| 163588 | | - /* 1560 */ 128, 1564, 551, 531, 562, 315, 562, 344, 532, 1003, |
| 163589 | | - /* 1570 */ 469, 257, 257, 885, 884, 231, 531, 562, 1021, 562, |
| 163590 | | - /* 1580 */ 471, 530, 257, 363, 106, 106, 517, 158, 158, 152, |
| 163591 | | - /* 1590 */ 152, 1021, 107, 362, 441, 564, 563, 106, 106, 1011, |
| 163592 | | - /* 1600 */ 136, 136, 135, 135, 562, 107, 1072, 441, 564, 563, |
| 163593 | | - /* 1610 */ 406, 347, 1011, 562, 349, 312, 553, 562, 339, 562, |
| 163594 | | - /* 1620 */ 98, 493, 353, 254, 98, 892, 893, 133, 133, 351, |
| 163595 | | - /* 1630 */ 1302, 1011, 1011, 1013, 1014, 27, 134, 134, 1015, 447, |
| 163596 | | - /* 1640 */ 75, 75, 77, 77, 1011, 1011, 1013, 1014, 27, 1172, |
| 163597 | | - /* 1650 */ 443, 562, 358, 284, 108, 554, 368, 4, 388, 388, |
| 163598 | | - /* 1660 */ 387, 269, 385, 562, 1133, 843, 562, 1068, 956, 254, |
| 163599 | | - /* 1670 */ 257, 557, 968, 969, 74, 74, 549, 923, 230, 110, |
| 163600 | | - /* 1680 */ 319, 108, 554, 1084, 4, 1084, 42, 42, 318, 48, |
| 163601 | | - /* 1690 */ 48, 1083, 1365, 1083, 441, 856, 1015, 146, 557, 924, |
| 163602 | | - /* 1700 */ 1410, 110, 1338, 1350, 548, 1416, 551, 1267, 207, 1258, |
| 163603 | | - /* 1710 */ 1246, 1245, 1247, 1583, 11, 488, 272, 215, 232, 1335, |
| 163604 | | - /* 1720 */ 304, 441, 305, 306, 389, 228, 164, 1397, 1392, 137, |
| 163605 | | - /* 1730 */ 287, 331, 332, 551, 293, 1021, 1385, 337, 473, 200, |
| 163606 | | - /* 1740 */ 361, 106, 106, 930, 498, 1402, 231, 1401, 1285, 107, |
| 163607 | | - /* 1750 */ 396, 441, 564, 563, 219, 1476, 1011, 1347, 1475, 1348, |
| 163608 | | - /* 1760 */ 1346, 1345, 1021, 1224, 552, 1586, 261, 1221, 106, 106, |
| 163609 | | - /* 1770 */ 1523, 201, 383, 1521, 214, 414, 107, 83, 441, 564, |
| 163610 | | - /* 1780 */ 563, 406, 211, 1011, 175, 1398, 312, 553, 1011, 1011, |
| 163611 | | - /* 1790 */ 1013, 1014, 27, 226, 184, 169, 100, 554, 79, 4, |
| 163612 | | - /* 1800 */ 82, 457, 35, 179, 458, 177, 491, 238, 96, 1481, |
| 163613 | | - /* 1810 */ 447, 180, 1404, 557, 181, 1011, 1011, 1013, 1014, 27, |
| 163614 | | - /* 1820 */ 182, 1403, 394, 36, 465, 1406, 397, 188, 1470, 480, |
| 163615 | | - /* 1830 */ 242, 89, 1492, 486, 342, 244, 441, 273, 192, 346, |
| 163616 | | - /* 1840 */ 489, 245, 399, 1248, 428, 246, 507, 1296, 551, 91, |
| 163617 | | - /* 1850 */ 877, 1305, 1304, 220, 1601, 1295, 1303, 430, 431, 516, |
| 163618 | | - /* 1860 */ 1569, 259, 400, 302, 1600, 1275, 303, 260, 360, 1274, |
| 163619 | | - /* 1870 */ 1273, 1599, 366, 1555, 434, 1554, 1370, 1021, 1369, 542, |
| 163620 | | - /* 1880 */ 126, 10, 1456, 106, 106, 377, 102, 97, 310, 526, |
| 163621 | | - /* 1890 */ 34, 107, 566, 441, 564, 563, 1178, 271, 1011, 268, |
| 163622 | | - /* 1900 */ 270, 567, 1243, 1238, 206, 1328, 375, 381, 1327, 382, |
| 163623 | | - /* 1910 */ 407, 161, 174, 408, 1508, 1509, 143, 300, 830, 162, |
| 163624 | | - /* 1920 */ 1507, 1506, 163, 442, 208, 314, 227, 216, 217, 78, |
| 163625 | | - /* 1930 */ 1011, 1011, 1013, 1014, 27, 140, 1082, 322, 1080, 165, |
| 163626 | | - /* 1940 */ 176, 1204, 234, 178, 909, 330, 237, 1096, 183, 166, |
| 163627 | | - /* 1950 */ 167, 417, 85, 86, 419, 185, 87, 88, 168, 1099, |
| 163628 | | - /* 1960 */ 239, 1095, 240, 154, 18, 241, 341, 1218, 257, 1088, |
| 163629 | | - /* 1970 */ 243, 485, 190, 189, 37, 845, 490, 362, 247, 494, |
| 163630 | | - /* 1980 */ 357, 191, 875, 90, 19, 502, 354, 20, 499, 92, |
| 163631 | | - /* 1990 */ 170, 155, 888, 93, 301, 509, 94, 1166, 156, 1048, |
| 163632 | | - /* 2000 */ 1135, 39, 221, 1134, 276, 278, 256, 194, 110, 960, |
| 163633 | | - /* 2010 */ 954, 1156, 21, 1152, 22, 1160, 1140, 1154, 23, 33, |
| 163634 | | - /* 2020 */ 24, 1159, 25, 538, 26, 198, 98, 1063, 1049, 1047, |
| 163635 | | - /* 2030 */ 1051, 7, 1105, 262, 1104, 263, 1052, 28, 40, 558, |
| 163636 | | - /* 2040 */ 1016, 857, 109, 29, 919, 386, 139, 172, 264, 265, |
| 163637 | | - /* 2050 */ 1174, 1592, 1173, 1234, 1234, 1234, 1234, 1234, 1234, 1234, |
| 163638 | | - /* 2060 */ 1234, 1234, 1234, 1591, |
| 163838 | + /* 0 */ 568, 208, 568, 118, 115, 229, 568, 118, 115, 229, |
| 163839 | + /* 10 */ 568, 1314, 377, 1293, 408, 562, 562, 562, 568, 409, |
| 163840 | + /* 20 */ 378, 1314, 1276, 41, 41, 41, 41, 208, 1526, 71, |
| 163841 | + /* 30 */ 71, 971, 419, 41, 41, 491, 303, 279, 303, 972, |
| 163842 | + /* 40 */ 397, 71, 71, 125, 126, 80, 1217, 1217, 1050, 1053, |
| 163843 | + /* 50 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 476, 409, |
| 163844 | + /* 60 */ 1241, 1, 1, 575, 2, 1245, 550, 118, 115, 229, |
| 163845 | + /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1327, |
| 163846 | + /* 80 */ 417, 523, 142, 125, 126, 80, 1217, 1217, 1050, 1053, |
| 163847 | + /* 90 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 118, 115, |
| 163848 | + /* 100 */ 229, 327, 122, 122, 122, 122, 121, 121, 120, 120, |
| 163849 | + /* 110 */ 120, 119, 116, 444, 284, 284, 284, 284, 442, 442, |
| 163850 | + /* 120 */ 442, 1567, 376, 1569, 1192, 375, 1163, 565, 1163, 565, |
| 163851 | + /* 130 */ 409, 1567, 537, 259, 226, 444, 101, 145, 449, 316, |
| 163852 | + /* 140 */ 559, 240, 122, 122, 122, 122, 121, 121, 120, 120, |
| 163853 | + /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1217, 1217, 1050, |
| 163854 | + /* 160 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 142, |
| 163855 | + /* 170 */ 294, 1192, 339, 448, 120, 120, 120, 119, 116, 444, |
| 163856 | + /* 180 */ 127, 1192, 1193, 1194, 148, 441, 440, 568, 119, 116, |
| 163857 | + /* 190 */ 444, 124, 124, 124, 124, 117, 122, 122, 122, 122, |
| 163858 | + /* 200 */ 121, 121, 120, 120, 120, 119, 116, 444, 454, 113, |
| 163859 | + /* 210 */ 13, 13, 546, 122, 122, 122, 122, 121, 121, 120, |
| 163860 | + /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1192, 1193, |
| 163861 | + /* 230 */ 1194, 149, 1224, 409, 1224, 124, 124, 124, 124, 122, |
| 163862 | + /* 240 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116, |
| 163863 | + /* 250 */ 444, 465, 342, 1037, 1037, 1051, 1054, 125, 126, 80, |
| 163864 | + /* 260 */ 1217, 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, |
| 163865 | + /* 270 */ 124, 124, 1279, 522, 222, 1192, 568, 409, 224, 514, |
| 163866 | + /* 280 */ 175, 82, 83, 122, 122, 122, 122, 121, 121, 120, |
| 163867 | + /* 290 */ 120, 120, 119, 116, 444, 1007, 16, 16, 1192, 133, |
| 163868 | + /* 300 */ 133, 125, 126, 80, 1217, 1217, 1050, 1053, 1040, 1040, |
| 163869 | + /* 310 */ 123, 123, 124, 124, 124, 124, 122, 122, 122, 122, |
| 163870 | + /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1041, 546, |
| 163871 | + /* 330 */ 1192, 373, 1192, 1193, 1194, 252, 1434, 399, 504, 501, |
| 163872 | + /* 340 */ 500, 111, 560, 566, 4, 926, 926, 433, 499, 340, |
| 163873 | + /* 350 */ 460, 328, 360, 394, 1237, 1192, 1193, 1194, 563, 568, |
| 163874 | + /* 360 */ 122, 122, 122, 122, 121, 121, 120, 120, 120, 119, |
| 163875 | + /* 370 */ 116, 444, 284, 284, 369, 1580, 1607, 441, 440, 154, |
| 163876 | + /* 380 */ 409, 445, 71, 71, 1286, 565, 1221, 1192, 1193, 1194, |
| 163877 | + /* 390 */ 85, 1223, 271, 557, 543, 515, 1561, 568, 98, 1222, |
| 163878 | + /* 400 */ 6, 1278, 472, 142, 125, 126, 80, 1217, 1217, 1050, |
| 163879 | + /* 410 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 550, |
| 163880 | + /* 420 */ 13, 13, 1027, 507, 1224, 1192, 1224, 549, 109, 109, |
| 163881 | + /* 430 */ 222, 568, 1238, 175, 568, 427, 110, 197, 445, 570, |
| 163882 | + /* 440 */ 569, 430, 1552, 1017, 325, 551, 1192, 270, 287, 368, |
| 163883 | + /* 450 */ 510, 363, 509, 257, 71, 71, 543, 71, 71, 359, |
| 163884 | + /* 460 */ 316, 559, 1613, 122, 122, 122, 122, 121, 121, 120, |
| 163885 | + /* 470 */ 120, 120, 119, 116, 444, 1017, 1017, 1019, 1020, 27, |
| 163886 | + /* 480 */ 284, 284, 1192, 1193, 1194, 1158, 568, 1612, 409, 901, |
| 163887 | + /* 490 */ 190, 550, 356, 565, 550, 937, 533, 517, 1158, 516, |
| 163888 | + /* 500 */ 413, 1158, 552, 1192, 1193, 1194, 568, 544, 1554, 51, |
| 163889 | + /* 510 */ 51, 214, 125, 126, 80, 1217, 1217, 1050, 1053, 1040, |
| 163890 | + /* 520 */ 1040, 123, 123, 124, 124, 124, 124, 1192, 474, 135, |
| 163891 | + /* 530 */ 135, 409, 284, 284, 1490, 505, 121, 121, 120, 120, |
| 163892 | + /* 540 */ 120, 119, 116, 444, 1007, 565, 518, 217, 541, 1561, |
| 163893 | + /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1217, 1217, |
| 163894 | + /* 560 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, |
| 163895 | + /* 570 */ 1555, 122, 122, 122, 122, 121, 121, 120, 120, 120, |
| 163896 | + /* 580 */ 119, 116, 444, 485, 1192, 1193, 1194, 482, 281, 1267, |
| 163897 | + /* 590 */ 957, 252, 1192, 373, 504, 501, 500, 1192, 340, 571, |
| 163898 | + /* 600 */ 1192, 571, 409, 292, 499, 957, 876, 191, 480, 316, |
| 163899 | + /* 610 */ 559, 384, 290, 380, 122, 122, 122, 122, 121, 121, |
| 163900 | + /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217, |
| 163901 | + /* 630 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 163902 | + /* 640 */ 124, 409, 394, 1136, 1192, 869, 100, 284, 284, 1192, |
| 163903 | + /* 650 */ 1193, 1194, 373, 1093, 1192, 1193, 1194, 1192, 1193, 1194, |
| 163904 | + /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1217, 1217, |
| 163905 | + /* 670 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, |
| 163906 | + /* 680 */ 1433, 959, 568, 228, 958, 122, 122, 122, 122, 121, |
| 163907 | + /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1158, 228, 1192, |
| 163908 | + /* 700 */ 157, 1192, 1193, 1194, 1553, 13, 13, 301, 957, 1232, |
| 163909 | + /* 710 */ 1158, 153, 409, 1158, 373, 1583, 1176, 5, 369, 1580, |
| 163910 | + /* 720 */ 429, 1238, 3, 957, 122, 122, 122, 122, 121, 121, |
| 163911 | + /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217, |
| 163912 | + /* 740 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 163913 | + /* 750 */ 124, 409, 208, 567, 1192, 1028, 1192, 1193, 1194, 1192, |
| 163914 | + /* 760 */ 388, 852, 155, 1552, 286, 402, 1098, 1098, 488, 568, |
| 163915 | + /* 770 */ 465, 342, 1319, 1319, 1552, 125, 126, 80, 1217, 1217, |
| 163916 | + /* 780 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, |
| 163917 | + /* 790 */ 129, 568, 13, 13, 374, 122, 122, 122, 122, 121, |
| 163918 | + /* 800 */ 121, 120, 120, 120, 119, 116, 444, 302, 568, 453, |
| 163919 | + /* 810 */ 528, 1192, 1193, 1194, 13, 13, 1192, 1193, 1194, 1297, |
| 163920 | + /* 820 */ 463, 1267, 409, 1317, 1317, 1552, 1012, 453, 452, 200, |
| 163921 | + /* 830 */ 299, 71, 71, 1265, 122, 122, 122, 122, 121, 121, |
| 163922 | + /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217, |
| 163923 | + /* 850 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 163924 | + /* 860 */ 124, 409, 227, 1073, 1158, 284, 284, 419, 312, 278, |
| 163925 | + /* 870 */ 278, 285, 285, 1419, 406, 405, 382, 1158, 565, 568, |
| 163926 | + /* 880 */ 1158, 1196, 565, 1600, 565, 125, 126, 80, 1217, 1217, |
| 163927 | + /* 890 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, |
| 163928 | + /* 900 */ 453, 1482, 13, 13, 1536, 122, 122, 122, 122, 121, |
| 163929 | + /* 910 */ 121, 120, 120, 120, 119, 116, 444, 201, 568, 354, |
| 163930 | + /* 920 */ 1586, 575, 2, 1245, 840, 841, 842, 1562, 317, 1212, |
| 163931 | + /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1327, 9, 1196, |
| 163932 | + /* 940 */ 262, 71, 71, 424, 122, 122, 122, 122, 121, 121, |
| 163933 | + /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217, |
| 163934 | + /* 960 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 163935 | + /* 970 */ 124, 568, 284, 284, 568, 1213, 409, 574, 313, 1245, |
| 163936 | + /* 980 */ 349, 1296, 352, 419, 317, 565, 146, 491, 525, 1643, |
| 163937 | + /* 990 */ 395, 371, 491, 1327, 70, 70, 1295, 71, 71, 240, |
| 163938 | + /* 1000 */ 1325, 104, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123, |
| 163939 | + /* 1010 */ 123, 124, 124, 124, 124, 122, 122, 122, 122, 121, |
| 163940 | + /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1114, 284, 284, |
| 163941 | + /* 1030 */ 428, 448, 1525, 1213, 439, 284, 284, 1489, 1352, 311, |
| 163942 | + /* 1040 */ 474, 565, 1115, 971, 491, 491, 217, 1263, 565, 1538, |
| 163943 | + /* 1050 */ 568, 972, 207, 568, 1027, 240, 383, 1116, 519, 122, |
| 163944 | + /* 1060 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116, |
| 163945 | + /* 1070 */ 444, 1018, 107, 71, 71, 1017, 13, 13, 912, 568, |
| 163946 | + /* 1080 */ 1495, 568, 284, 284, 97, 526, 491, 448, 913, 1326, |
| 163947 | + /* 1090 */ 1322, 545, 409, 284, 284, 565, 151, 209, 1495, 1497, |
| 163948 | + /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1017, 1017, 1019, |
| 163949 | + /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1217, |
| 163950 | + /* 1120 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 163951 | + /* 1130 */ 124, 347, 409, 864, 1534, 1213, 125, 126, 80, 1217, |
| 163952 | + /* 1140 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 163953 | + /* 1150 */ 124, 1137, 1641, 474, 1641, 371, 125, 114, 80, 1217, |
| 163954 | + /* 1160 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 163955 | + /* 1170 */ 124, 1495, 329, 474, 331, 122, 122, 122, 122, 121, |
| 163956 | + /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1419, 568, |
| 163957 | + /* 1190 */ 1294, 864, 464, 1213, 436, 122, 122, 122, 122, 121, |
| 163958 | + /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1137, 1642, |
| 163959 | + /* 1210 */ 539, 1642, 15, 15, 892, 122, 122, 122, 122, 121, |
| 163960 | + /* 1220 */ 121, 120, 120, 120, 119, 116, 444, 568, 298, 538, |
| 163961 | + /* 1230 */ 1135, 1419, 1559, 1560, 1331, 409, 6, 6, 1169, 1268, |
| 163962 | + /* 1240 */ 415, 320, 284, 284, 1419, 508, 565, 525, 300, 457, |
| 163963 | + /* 1250 */ 43, 43, 568, 893, 12, 565, 330, 478, 425, 407, |
| 163964 | + /* 1260 */ 126, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123, 123, |
| 163965 | + /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1192, 1419, |
| 163966 | + /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1135, 1558, 849, |
| 163967 | + /* 1290 */ 1169, 407, 6, 568, 321, 1158, 470, 44, 44, 1557, |
| 163968 | + /* 1300 */ 1114, 426, 234, 6, 323, 256, 540, 256, 1158, 431, |
| 163969 | + /* 1310 */ 568, 1158, 322, 17, 487, 1115, 58, 58, 122, 122, |
| 163970 | + /* 1320 */ 122, 122, 121, 121, 120, 120, 120, 119, 116, 444, |
| 163971 | + /* 1330 */ 1116, 216, 481, 59, 59, 1192, 1193, 1194, 111, 560, |
| 163972 | + /* 1340 */ 324, 4, 236, 456, 526, 568, 237, 456, 568, 437, |
| 163973 | + /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1095, |
| 163974 | + /* 1360 */ 568, 293, 568, 1095, 531, 568, 872, 8, 60, 60, |
| 163975 | + /* 1370 */ 235, 61, 61, 568, 414, 568, 414, 568, 445, 62, |
| 163976 | + /* 1380 */ 62, 45, 45, 46, 46, 47, 47, 199, 49, 49, |
| 163977 | + /* 1390 */ 557, 568, 359, 568, 100, 486, 50, 50, 63, 63, |
| 163978 | + /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1027, 568, 534, |
| 163979 | + /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1027, |
| 163980 | + /* 1420 */ 568, 512, 932, 872, 1018, 109, 109, 931, 1017, 66, |
| 163981 | + /* 1430 */ 66, 131, 131, 110, 451, 445, 570, 569, 416, 177, |
| 163982 | + /* 1440 */ 1017, 132, 132, 67, 67, 568, 467, 568, 932, 471, |
| 163983 | + /* 1450 */ 1364, 283, 226, 931, 315, 1363, 407, 568, 459, 407, |
| 163984 | + /* 1460 */ 1017, 1017, 1019, 239, 407, 86, 213, 1350, 52, 52, |
| 163985 | + /* 1470 */ 68, 68, 1017, 1017, 1019, 1020, 27, 1585, 1180, 447, |
| 163986 | + /* 1480 */ 69, 69, 288, 97, 108, 1541, 106, 392, 392, 391, |
| 163987 | + /* 1490 */ 273, 389, 568, 879, 849, 883, 568, 111, 560, 466, |
| 163988 | + /* 1500 */ 4, 568, 152, 30, 38, 568, 1132, 234, 396, 323, |
| 163989 | + /* 1510 */ 111, 560, 527, 4, 563, 53, 53, 322, 568, 163, |
| 163990 | + /* 1520 */ 163, 568, 337, 468, 164, 164, 333, 563, 76, 76, |
| 163991 | + /* 1530 */ 568, 289, 1514, 568, 31, 1513, 568, 445, 338, 483, |
| 163992 | + /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1080, 557, |
| 163993 | + /* 1550 */ 445, 879, 1360, 134, 134, 168, 73, 73, 141, 161, |
| 163994 | + /* 1560 */ 161, 1574, 557, 535, 568, 319, 568, 348, 536, 1009, |
| 163995 | + /* 1570 */ 473, 261, 261, 891, 890, 235, 535, 568, 1027, 568, |
| 163996 | + /* 1580 */ 475, 534, 261, 367, 109, 109, 521, 136, 136, 130, |
| 163997 | + /* 1590 */ 130, 1027, 110, 366, 445, 570, 569, 109, 109, 1017, |
| 163998 | + /* 1600 */ 162, 162, 156, 156, 568, 110, 1080, 445, 570, 569, |
| 163999 | + /* 1610 */ 410, 351, 1017, 568, 353, 316, 559, 568, 343, 568, |
| 164000 | + /* 1620 */ 100, 497, 357, 258, 100, 898, 899, 140, 140, 355, |
| 164001 | + /* 1630 */ 1310, 1017, 1017, 1019, 1020, 27, 139, 139, 362, 451, |
| 164002 | + /* 1640 */ 137, 137, 138, 138, 1017, 1017, 1019, 1020, 27, 1180, |
| 164003 | + /* 1650 */ 447, 568, 372, 288, 111, 560, 1021, 4, 392, 392, |
| 164004 | + /* 1660 */ 391, 273, 389, 568, 1141, 849, 568, 1076, 568, 258, |
| 164005 | + /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 962, 234, 261, |
| 164006 | + /* 1680 */ 323, 111, 560, 929, 4, 113, 77, 77, 322, 74, |
| 164007 | + /* 1690 */ 74, 42, 42, 1373, 445, 48, 48, 1418, 563, 974, |
| 164008 | + /* 1700 */ 975, 1092, 1091, 1092, 1091, 862, 557, 150, 930, 1346, |
| 164009 | + /* 1710 */ 113, 1358, 554, 1424, 1021, 1275, 1266, 1254, 236, 1253, |
| 164010 | + /* 1720 */ 1255, 445, 1593, 1343, 308, 276, 168, 309, 11, 141, |
| 164011 | + /* 1730 */ 393, 310, 232, 557, 1405, 1027, 335, 291, 1400, 219, |
| 164012 | + /* 1740 */ 336, 109, 109, 936, 297, 1410, 235, 341, 477, 110, |
| 164013 | + /* 1750 */ 502, 445, 570, 569, 1393, 1409, 1017, 400, 1293, 365, |
| 164014 | + /* 1760 */ 223, 1486, 1027, 1485, 1355, 1356, 1354, 1353, 109, 109, |
| 164015 | + /* 1770 */ 204, 1596, 1232, 558, 265, 218, 110, 205, 445, 570, |
| 164016 | + /* 1780 */ 569, 410, 387, 1017, 1533, 179, 316, 559, 1017, 1017, |
| 164017 | + /* 1790 */ 1019, 1020, 27, 230, 1531, 1229, 79, 560, 85, 4, |
| 164018 | + /* 1800 */ 418, 215, 548, 81, 84, 188, 1406, 173, 181, 461, |
| 164019 | + /* 1810 */ 451, 35, 462, 563, 183, 1017, 1017, 1019, 1020, 27, |
| 164020 | + /* 1820 */ 184, 1491, 185, 186, 495, 242, 98, 398, 1412, 36, |
| 164021 | + /* 1830 */ 1411, 484, 91, 469, 401, 1414, 445, 192, 1480, 246, |
| 164022 | + /* 1840 */ 1502, 490, 346, 277, 248, 196, 493, 511, 557, 350, |
| 164023 | + /* 1850 */ 1256, 249, 250, 403, 1313, 1312, 111, 560, 432, 4, |
| 164024 | + /* 1860 */ 1311, 1304, 93, 1611, 883, 1610, 224, 404, 434, 520, |
| 164025 | + /* 1870 */ 263, 435, 1579, 563, 1283, 1282, 364, 1027, 306, 1281, |
| 164026 | + /* 1880 */ 264, 1609, 1565, 109, 109, 370, 1303, 307, 1564, 438, |
| 164027 | + /* 1890 */ 128, 110, 1378, 445, 570, 569, 445, 546, 1017, 10, |
| 164028 | + /* 1900 */ 1466, 105, 381, 1377, 34, 572, 99, 1336, 557, 314, |
| 164029 | + /* 1910 */ 1186, 530, 272, 274, 379, 210, 1335, 547, 385, 386, |
| 164030 | + /* 1920 */ 275, 573, 1251, 1246, 411, 412, 1518, 165, 178, 1519, |
| 164031 | + /* 1930 */ 1017, 1017, 1019, 1020, 27, 1517, 1516, 1027, 78, 147, |
| 164032 | + /* 1940 */ 166, 220, 221, 109, 109, 836, 304, 167, 446, 212, |
| 164033 | + /* 1950 */ 318, 110, 231, 445, 570, 569, 144, 1090, 1017, 1088, |
| 164034 | + /* 1960 */ 326, 180, 169, 1212, 182, 334, 238, 915, 241, 1104, |
| 164035 | + /* 1970 */ 187, 170, 171, 421, 87, 88, 423, 189, 89, 90, |
| 164036 | + /* 1980 */ 172, 1107, 243, 1103, 244, 158, 18, 245, 345, 247, |
| 164037 | + /* 1990 */ 1017, 1017, 1019, 1020, 27, 261, 1096, 193, 1226, 489, |
| 164038 | + /* 2000 */ 194, 37, 366, 851, 494, 251, 195, 506, 92, 19, |
| 164039 | + /* 2010 */ 498, 358, 20, 503, 881, 361, 94, 894, 305, 159, |
| 164040 | + /* 2020 */ 513, 39, 95, 1174, 160, 1056, 966, 1143, 96, 174, |
| 164041 | + /* 2030 */ 1142, 225, 280, 282, 198, 960, 113, 1164, 1160, 260, |
| 164042 | + /* 2040 */ 21, 22, 23, 1162, 1168, 1167, 1148, 24, 33, 25, |
| 164043 | + /* 2050 */ 202, 542, 26, 100, 1071, 102, 1057, 103, 7, 1055, |
| 164044 | + /* 2060 */ 1059, 1113, 1060, 1112, 266, 267, 28, 40, 390, 1022, |
| 164045 | + /* 2070 */ 863, 112, 29, 564, 1182, 1181, 268, 176, 143, 925, |
| 164046 | + /* 2080 */ 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, |
| 164047 | + /* 2090 */ 1242, 1242, 1242, 1242, 269, 1602, 1242, 1601, |
| 163639 | 164048 | }; |
| 163640 | 164049 | static const YYCODETYPE yy_lookahead[] = { |
| 163641 | 164050 | /* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276, |
| 163642 | 164051 | /* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19, |
| 163643 | 164052 | /* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216, |
| | @@ -163799,57 +164208,57 @@ |
| 163799 | 164208 | /* 1580 */ 23, 90, 25, 121, 106, 107, 19, 216, 217, 216, |
| 163800 | 164209 | /* 1590 */ 217, 100, 114, 131, 116, 117, 118, 106, 107, 121, |
| 163801 | 164210 | /* 1600 */ 216, 217, 216, 217, 193, 114, 117, 116, 117, 118, |
| 163802 | 164211 | /* 1610 */ 133, 193, 121, 193, 193, 138, 139, 193, 23, 193, |
| 163803 | 164212 | /* 1620 */ 25, 23, 23, 25, 25, 7, 8, 216, 217, 193, |
| 163804 | | - /* 1630 */ 193, 153, 154, 155, 156, 157, 216, 217, 59, 162, |
| 164213 | + /* 1630 */ 193, 153, 154, 155, 156, 157, 216, 217, 193, 162, |
| 163805 | 164214 | /* 1640 */ 216, 217, 216, 217, 153, 154, 155, 156, 157, 1, |
| 163806 | | - /* 1650 */ 2, 193, 193, 5, 19, 20, 193, 22, 10, 11, |
| 163807 | | - /* 1660 */ 12, 13, 14, 193, 97, 17, 193, 23, 23, 25, |
| 163808 | | - /* 1670 */ 25, 36, 83, 84, 216, 217, 236, 23, 30, 25, |
| 163809 | | - /* 1680 */ 32, 19, 20, 153, 22, 155, 216, 217, 40, 216, |
| 163810 | | - /* 1690 */ 217, 153, 193, 155, 59, 23, 117, 25, 36, 23, |
| 163811 | | - /* 1700 */ 193, 25, 193, 193, 193, 193, 71, 193, 242, 193, |
| 163812 | | - /* 1710 */ 193, 193, 193, 193, 243, 288, 287, 214, 70, 255, |
| 163813 | | - /* 1720 */ 255, 59, 255, 255, 191, 297, 78, 271, 267, 81, |
| 163814 | | - /* 1730 */ 245, 293, 246, 71, 246, 100, 267, 245, 293, 249, |
| 163815 | | - /* 1740 */ 219, 106, 107, 108, 220, 271, 98, 271, 225, 114, |
| 163816 | | - /* 1750 */ 271, 116, 117, 118, 229, 219, 121, 259, 219, 259, |
| 163817 | | - /* 1760 */ 259, 259, 100, 60, 280, 196, 141, 38, 106, 107, |
| 163818 | | - /* 1770 */ 200, 249, 245, 200, 243, 200, 114, 151, 116, 117, |
| 163819 | | - /* 1780 */ 118, 133, 150, 121, 297, 272, 138, 139, 153, 154, |
| 163820 | | - /* 1790 */ 155, 156, 157, 297, 22, 43, 19, 20, 294, 22, |
| 163821 | | - /* 1800 */ 294, 18, 270, 237, 200, 234, 18, 199, 149, 283, |
| 163822 | | - /* 1810 */ 162, 237, 272, 36, 237, 153, 154, 155, 156, 157, |
| 163823 | | - /* 1820 */ 237, 272, 246, 270, 246, 234, 246, 234, 246, 200, |
| 163824 | | - /* 1830 */ 199, 158, 290, 62, 289, 199, 59, 200, 22, 200, |
| 163825 | | - /* 1840 */ 221, 199, 221, 200, 64, 199, 115, 227, 71, 22, |
| 163826 | | - /* 1850 */ 126, 218, 218, 165, 224, 227, 218, 24, 113, 305, |
| 163827 | | - /* 1860 */ 312, 200, 221, 282, 224, 218, 282, 91, 218, 220, |
| 163828 | | - /* 1870 */ 218, 218, 221, 317, 82, 317, 265, 100, 265, 145, |
| 163829 | | - /* 1880 */ 148, 22, 277, 106, 107, 200, 158, 147, 279, 146, |
| 163830 | | - /* 1890 */ 25, 114, 202, 116, 117, 118, 13, 6, 121, 194, |
| 163831 | | - /* 1900 */ 194, 192, 192, 192, 248, 250, 249, 247, 250, 246, |
| 163832 | | - /* 1910 */ 303, 207, 300, 303, 213, 213, 222, 222, 4, 207, |
| 163833 | | - /* 1920 */ 213, 213, 207, 3, 22, 163, 15, 214, 214, 213, |
| 163834 | | - /* 1930 */ 153, 154, 155, 156, 157, 16, 23, 139, 23, 130, |
| 163835 | | - /* 1940 */ 151, 25, 24, 142, 20, 16, 144, 1, 142, 130, |
| 163836 | | - /* 1950 */ 130, 61, 53, 53, 37, 151, 53, 53, 130, 116, |
| 163837 | | - /* 1960 */ 34, 1, 141, 5, 22, 115, 161, 75, 25, 68, |
| 163838 | | - /* 1970 */ 141, 41, 115, 68, 24, 20, 19, 131, 125, 67, |
| 163839 | | - /* 1980 */ 24, 22, 59, 22, 22, 96, 23, 22, 67, 22, |
| 163840 | | - /* 1990 */ 37, 23, 28, 149, 67, 22, 25, 23, 23, 23, |
| 163841 | | - /* 2000 */ 23, 22, 141, 97, 23, 23, 34, 22, 25, 116, |
| 163842 | | - /* 2010 */ 143, 75, 34, 88, 34, 75, 23, 86, 34, 22, |
| 163843 | | - /* 2020 */ 34, 93, 34, 24, 34, 25, 25, 23, 23, 23, |
| 163844 | | - /* 2030 */ 23, 44, 23, 25, 23, 22, 11, 22, 22, 25, |
| 163845 | | - /* 2040 */ 23, 23, 22, 22, 135, 15, 23, 25, 141, 141, |
| 163846 | | - /* 2050 */ 1, 141, 1, 319, 319, 319, 319, 319, 319, 319, |
| 163847 | | - /* 2060 */ 319, 319, 319, 141, 319, 319, 319, 319, 319, 319, |
| 163848 | | - /* 2070 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 164215 | + /* 1650 */ 2, 193, 193, 5, 19, 20, 59, 22, 10, 11, |
| 164216 | + /* 1660 */ 12, 13, 14, 193, 97, 17, 193, 23, 193, 25, |
| 164217 | + /* 1670 */ 288, 36, 193, 242, 216, 217, 236, 23, 30, 25, |
| 164218 | + /* 1680 */ 32, 19, 20, 23, 22, 25, 216, 217, 40, 216, |
| 164219 | + /* 1690 */ 217, 216, 217, 193, 59, 216, 217, 193, 36, 83, |
| 164220 | + /* 1700 */ 84, 153, 153, 155, 155, 23, 71, 25, 23, 193, |
| 164221 | + /* 1710 */ 25, 193, 193, 193, 117, 193, 193, 193, 70, 193, |
| 164222 | + /* 1720 */ 193, 59, 193, 255, 255, 287, 78, 255, 243, 81, |
| 164223 | + /* 1730 */ 191, 255, 297, 71, 271, 100, 293, 245, 267, 214, |
| 164224 | + /* 1740 */ 246, 106, 107, 108, 246, 271, 98, 245, 293, 114, |
| 164225 | + /* 1750 */ 220, 116, 117, 118, 267, 271, 121, 271, 225, 219, |
| 164226 | + /* 1760 */ 229, 219, 100, 219, 259, 259, 259, 259, 106, 107, |
| 164227 | + /* 1770 */ 249, 196, 60, 280, 141, 243, 114, 249, 116, 117, |
| 164228 | + /* 1780 */ 118, 133, 245, 121, 200, 297, 138, 139, 153, 154, |
| 164229 | + /* 1790 */ 155, 156, 157, 297, 200, 38, 19, 20, 151, 22, |
| 164230 | + /* 1800 */ 200, 150, 140, 294, 294, 22, 272, 43, 234, 18, |
| 164231 | + /* 1810 */ 162, 270, 200, 36, 237, 153, 154, 155, 156, 157, |
| 164232 | + /* 1820 */ 237, 283, 237, 237, 18, 199, 149, 246, 272, 270, |
| 164233 | + /* 1830 */ 272, 200, 158, 246, 246, 234, 59, 234, 246, 199, |
| 164234 | + /* 1840 */ 290, 62, 289, 200, 199, 22, 221, 115, 71, 200, |
| 164235 | + /* 1850 */ 200, 199, 199, 221, 218, 218, 19, 20, 64, 22, |
| 164236 | + /* 1860 */ 218, 227, 22, 224, 126, 224, 165, 221, 24, 305, |
| 164237 | + /* 1870 */ 200, 113, 312, 36, 218, 220, 218, 100, 282, 218, |
| 164238 | + /* 1880 */ 91, 218, 317, 106, 107, 221, 227, 282, 317, 82, |
| 164239 | + /* 1890 */ 148, 114, 265, 116, 117, 118, 59, 145, 121, 22, |
| 164240 | + /* 1900 */ 277, 158, 200, 265, 25, 202, 147, 250, 71, 279, |
| 164241 | + /* 1910 */ 13, 146, 194, 194, 249, 248, 250, 140, 247, 246, |
| 164242 | + /* 1920 */ 6, 192, 192, 192, 303, 303, 213, 207, 300, 213, |
| 164243 | + /* 1930 */ 153, 154, 155, 156, 157, 213, 213, 100, 213, 222, |
| 164244 | + /* 1940 */ 207, 214, 214, 106, 107, 4, 222, 207, 3, 22, |
| 164245 | + /* 1950 */ 163, 114, 15, 116, 117, 118, 16, 23, 121, 23, |
| 164246 | + /* 1960 */ 139, 151, 130, 25, 142, 16, 24, 20, 144, 1, |
| 164247 | + /* 1970 */ 142, 130, 130, 61, 53, 53, 37, 151, 53, 53, |
| 164248 | + /* 1980 */ 130, 116, 34, 1, 141, 5, 22, 115, 161, 141, |
| 164249 | + /* 1990 */ 153, 154, 155, 156, 157, 25, 68, 68, 75, 41, |
| 164250 | + /* 2000 */ 115, 24, 131, 20, 19, 125, 22, 96, 22, 22, |
| 164251 | + /* 2010 */ 67, 23, 22, 67, 59, 24, 22, 28, 67, 23, |
| 164252 | + /* 2020 */ 22, 22, 149, 23, 23, 23, 116, 23, 25, 37, |
| 164253 | + /* 2030 */ 97, 141, 23, 23, 22, 143, 25, 75, 88, 34, |
| 164254 | + /* 2040 */ 34, 34, 34, 86, 75, 93, 23, 34, 22, 34, |
| 164255 | + /* 2050 */ 25, 24, 34, 25, 23, 142, 23, 142, 44, 23, |
| 164256 | + /* 2060 */ 23, 23, 11, 23, 25, 22, 22, 22, 15, 23, |
| 164257 | + /* 2070 */ 23, 22, 22, 25, 1, 1, 141, 25, 23, 135, |
| 163849 | 164258 | /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 163850 | | - /* 2090 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 164259 | + /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 141, 319, 319, |
| 163851 | 164260 | /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 163852 | 164261 | /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 163853 | 164262 | /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 163854 | 164263 | /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 163855 | 164264 | /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| | @@ -163860,77 +164269,82 @@ |
| 163860 | 164269 | /* 2190 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 163861 | 164270 | /* 2200 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 163862 | 164271 | /* 2210 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 163863 | 164272 | /* 2220 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 163864 | 164273 | /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 163865 | | - /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 164274 | + /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 164275 | + /* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 164276 | + /* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 164277 | + /* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 164278 | + /* 2280 */ 319, 319, 319, |
| 163866 | 164279 | }; |
| 163867 | | -#define YY_SHIFT_COUNT (569) |
| 164280 | +#define YY_SHIFT_COUNT (575) |
| 163868 | 164281 | #define YY_SHIFT_MIN (0) |
| 163869 | | -#define YY_SHIFT_MAX (2051) |
| 164282 | +#define YY_SHIFT_MAX (2074) |
| 163870 | 164283 | static const unsigned short int yy_shift_ofst[] = { |
| 163871 | | - /* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1662, |
| 163872 | | - /* 10 */ 1662, 1662, 471, 0, 0, 214, 1093, 1662, 1662, 1662, |
| 163873 | | - /* 20 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, |
| 164284 | + /* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837, |
| 164285 | + /* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837, |
| 164286 | + /* 20 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, |
| 163874 | 164287 | /* 30 */ 271, 271, 1219, 1219, 216, 88, 1, 1, 1, 1, |
| 163875 | 164288 | /* 40 */ 1, 40, 111, 258, 361, 469, 512, 583, 622, 693, |
| 163876 | 164289 | /* 50 */ 732, 803, 842, 913, 1073, 1093, 1093, 1093, 1093, 1093, |
| 163877 | 164290 | /* 60 */ 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, |
| 163878 | 164291 | /* 70 */ 1093, 1093, 1093, 1113, 1093, 1216, 957, 957, 1635, 1662, |
| 163879 | | - /* 80 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, |
| 163880 | | - /* 90 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, |
| 163881 | | - /* 100 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, |
| 163882 | | - /* 110 */ 1662, 1662, 1662, 1662, 1777, 1662, 1662, 1662, 1662, 1662, |
| 163883 | | - /* 120 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 137, 181, |
| 163884 | | - /* 130 */ 181, 181, 181, 181, 94, 430, 66, 65, 112, 366, |
| 163885 | | - /* 140 */ 533, 533, 740, 1261, 533, 533, 79, 79, 533, 412, |
| 163886 | | - /* 150 */ 412, 412, 77, 412, 123, 113, 113, 22, 22, 2064, |
| 163887 | | - /* 160 */ 2064, 328, 328, 328, 239, 468, 468, 468, 468, 1015, |
| 163888 | | - /* 170 */ 1015, 409, 366, 1129, 1186, 533, 533, 533, 533, 533, |
| 164292 | + /* 80 */ 1777, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, |
| 164293 | + /* 90 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, |
| 164294 | + /* 100 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, |
| 164295 | + /* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, |
| 164296 | + /* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, |
| 164297 | + /* 130 */ 137, 181, 181, 181, 181, 181, 181, 181, 94, 430, |
| 164298 | + /* 140 */ 66, 65, 112, 366, 533, 533, 740, 1261, 533, 533, |
| 164299 | + /* 150 */ 79, 79, 533, 412, 412, 412, 77, 412, 123, 113, |
| 164300 | + /* 160 */ 113, 22, 22, 2098, 2098, 328, 328, 328, 239, 468, |
| 164301 | + /* 170 */ 468, 468, 468, 1015, 1015, 409, 366, 1129, 1186, 533, |
| 163889 | 164302 | /* 180 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533, |
| 163890 | | - /* 190 */ 533, 533, 533, 533, 533, 969, 621, 621, 533, 642, |
| 163891 | | - /* 200 */ 788, 788, 1228, 1228, 822, 822, 67, 1274, 2064, 2064, |
| 163892 | | - /* 210 */ 2064, 2064, 2064, 2064, 2064, 1307, 954, 954, 585, 472, |
| 163893 | | - /* 220 */ 640, 387, 695, 538, 541, 700, 533, 533, 533, 533, |
| 163894 | | - /* 230 */ 533, 533, 533, 533, 533, 533, 222, 533, 533, 533, |
| 163895 | | - /* 240 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 1179, |
| 163896 | | - /* 250 */ 1179, 1179, 533, 533, 533, 565, 533, 533, 533, 916, |
| 163897 | | - /* 260 */ 1144, 533, 533, 1288, 533, 533, 533, 533, 533, 533, |
| 163898 | | - /* 270 */ 533, 533, 639, 1330, 209, 1076, 1076, 1076, 1076, 580, |
| 163899 | | - /* 280 */ 209, 209, 1313, 768, 917, 649, 1181, 1316, 405, 1316, |
| 163900 | | - /* 290 */ 1238, 249, 1181, 1181, 249, 1181, 405, 1238, 1369, 464, |
| 163901 | | - /* 300 */ 1259, 1012, 1012, 1012, 1368, 1368, 1368, 1368, 184, 184, |
| 163902 | | - /* 310 */ 1326, 904, 1287, 1480, 1703, 1703, 1625, 1625, 1729, 1729, |
| 163903 | | - /* 320 */ 1625, 1626, 1632, 1772, 1752, 1783, 1783, 1783, 1783, 1625, |
| 163904 | | - /* 330 */ 1788, 1659, 1632, 1632, 1659, 1772, 1752, 1659, 1752, 1659, |
| 163905 | | - /* 340 */ 1625, 1788, 1673, 1771, 1625, 1788, 1816, 1625, 1788, 1625, |
| 163906 | | - /* 350 */ 1788, 1816, 1731, 1731, 1731, 1780, 1827, 1827, 1816, 1731, |
| 163907 | | - /* 360 */ 1724, 1731, 1780, 1731, 1731, 1688, 1833, 1745, 1745, 1816, |
| 163908 | | - /* 370 */ 1625, 1776, 1776, 1792, 1792, 1732, 1734, 1859, 1625, 1728, |
| 163909 | | - /* 380 */ 1732, 1740, 1743, 1659, 1865, 1883, 1883, 1891, 1891, 1891, |
| 163910 | | - /* 390 */ 2064, 2064, 2064, 2064, 2064, 2064, 2064, 2064, 2064, 2064, |
| 163911 | | - /* 400 */ 2064, 2064, 2064, 2064, 2064, 207, 1095, 331, 620, 903, |
| 163912 | | - /* 410 */ 806, 1074, 1483, 1432, 1481, 1322, 1370, 1394, 1515, 1291, |
| 163913 | | - /* 420 */ 1546, 1547, 1557, 1595, 1598, 1599, 1434, 1453, 1618, 1462, |
| 163914 | | - /* 430 */ 1567, 1489, 1644, 1645, 1589, 1654, 1530, 1538, 1672, 1676, |
| 163915 | | - /* 440 */ 1579, 742, 1914, 1920, 1902, 1762, 1911, 1919, 1913, 1915, |
| 163916 | | - /* 450 */ 1798, 1789, 1809, 1916, 1916, 1918, 1801, 1924, 1802, 1929, |
| 163917 | | - /* 460 */ 1946, 1806, 1819, 1916, 1820, 1890, 1917, 1916, 1804, 1899, |
| 163918 | | - /* 470 */ 1900, 1903, 1904, 1828, 1843, 1926, 1821, 1960, 1958, 1942, |
| 163919 | | - /* 480 */ 1850, 1805, 1901, 1943, 1905, 1892, 1930, 1829, 1857, 1950, |
| 163920 | | - /* 490 */ 1955, 1957, 1846, 1853, 1959, 1912, 1961, 1962, 1963, 1965, |
| 163921 | | - /* 500 */ 1921, 1923, 1956, 1889, 1964, 1967, 1927, 1953, 1968, 1844, |
| 163922 | | - /* 510 */ 1973, 1974, 1975, 1976, 1971, 1977, 1979, 1906, 1861, 1981, |
| 163923 | | - /* 520 */ 1982, 1893, 1972, 1985, 1867, 1983, 1978, 1980, 1984, 1986, |
| 163924 | | - /* 530 */ 1925, 1936, 1931, 1987, 1940, 1928, 1988, 1993, 1997, 1999, |
| 163925 | | - /* 540 */ 2000, 2001, 1990, 2004, 1983, 2005, 2006, 2007, 2009, 2008, |
| 163926 | | - /* 550 */ 2011, 2013, 2025, 2015, 2016, 2017, 2018, 2020, 2021, 2014, |
| 163927 | | - /* 560 */ 1909, 1907, 1908, 1910, 1922, 2022, 2023, 2030, 2049, 2051, |
| 164303 | + /* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 969, |
| 164304 | + /* 200 */ 621, 621, 533, 642, 788, 788, 1228, 1228, 822, 822, |
| 164305 | + /* 210 */ 67, 1274, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 1307, |
| 164306 | + /* 220 */ 954, 954, 585, 472, 640, 387, 695, 538, 541, 700, |
| 164307 | + /* 230 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533, |
| 164308 | + /* 240 */ 222, 533, 533, 533, 533, 533, 533, 533, 533, 533, |
| 164309 | + /* 250 */ 533, 533, 533, 1179, 1179, 1179, 533, 533, 533, 565, |
| 164310 | + /* 260 */ 533, 533, 533, 916, 1144, 533, 533, 1288, 533, 533, |
| 164311 | + /* 270 */ 533, 533, 533, 533, 533, 533, 639, 1330, 209, 1076, |
| 164312 | + /* 280 */ 1076, 1076, 1076, 580, 209, 209, 1313, 768, 917, 649, |
| 164313 | + /* 290 */ 1181, 1316, 405, 1316, 1238, 249, 1181, 1181, 249, 1181, |
| 164314 | + /* 300 */ 405, 1238, 1369, 464, 1259, 1012, 1012, 1012, 1368, 1368, |
| 164315 | + /* 310 */ 1368, 1368, 184, 184, 1326, 904, 1287, 1480, 1712, 1712, |
| 164316 | + /* 320 */ 1633, 1633, 1757, 1757, 1633, 1647, 1651, 1783, 1764, 1791, |
| 164317 | + /* 330 */ 1791, 1791, 1791, 1633, 1806, 1677, 1651, 1651, 1677, 1783, |
| 164318 | + /* 340 */ 1764, 1677, 1764, 1677, 1633, 1806, 1674, 1779, 1633, 1806, |
| 164319 | + /* 350 */ 1823, 1633, 1806, 1633, 1806, 1823, 1732, 1732, 1732, 1794, |
| 164320 | + /* 360 */ 1840, 1840, 1823, 1732, 1738, 1732, 1794, 1732, 1732, 1701, |
| 164321 | + /* 370 */ 1844, 1758, 1758, 1823, 1633, 1789, 1789, 1807, 1807, 1742, |
| 164322 | + /* 380 */ 1752, 1877, 1633, 1743, 1742, 1759, 1765, 1677, 1879, 1897, |
| 164323 | + /* 390 */ 1897, 1914, 1914, 1914, 2098, 2098, 2098, 2098, 2098, 2098, |
| 164324 | + /* 400 */ 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 207, |
| 164325 | + /* 410 */ 1095, 331, 620, 903, 806, 1074, 1483, 1432, 1481, 1322, |
| 164326 | + /* 420 */ 1370, 1394, 1515, 1291, 1546, 1547, 1557, 1595, 1598, 1599, |
| 164327 | + /* 430 */ 1434, 1453, 1618, 1462, 1567, 1489, 1644, 1654, 1616, 1660, |
| 164328 | + /* 440 */ 1548, 1549, 1682, 1685, 1597, 742, 1941, 1945, 1927, 1787, |
| 164329 | + /* 450 */ 1937, 1940, 1934, 1936, 1821, 1810, 1832, 1938, 1938, 1942, |
| 164330 | + /* 460 */ 1822, 1947, 1824, 1949, 1968, 1828, 1841, 1938, 1842, 1912, |
| 164331 | + /* 470 */ 1939, 1938, 1826, 1921, 1922, 1925, 1926, 1850, 1865, 1948, |
| 164332 | + /* 480 */ 1843, 1982, 1980, 1964, 1872, 1827, 1928, 1970, 1929, 1923, |
| 164333 | + /* 490 */ 1958, 1848, 1885, 1977, 1983, 1985, 1871, 1880, 1984, 1943, |
| 164334 | + /* 500 */ 1986, 1987, 1988, 1990, 1946, 1955, 1991, 1911, 1989, 1994, |
| 164335 | + /* 510 */ 1951, 1992, 1996, 1873, 1998, 2000, 2001, 2002, 2003, 2004, |
| 164336 | + /* 520 */ 1999, 1933, 1890, 2009, 2010, 1910, 2005, 2012, 1892, 2011, |
| 164337 | + /* 530 */ 2006, 2007, 2008, 2013, 1950, 1962, 1957, 2014, 1969, 1952, |
| 164338 | + /* 540 */ 2015, 2023, 2026, 2027, 2025, 2028, 2018, 1913, 1915, 2031, |
| 164339 | + /* 550 */ 2011, 2033, 2036, 2037, 2038, 2039, 2040, 2043, 2051, 2044, |
| 164340 | + /* 560 */ 2045, 2046, 2047, 2049, 2050, 2048, 1944, 1935, 1953, 1954, |
| 164341 | + /* 570 */ 1956, 2052, 2055, 2053, 2073, 2074, |
| 163928 | 164342 | }; |
| 163929 | | -#define YY_REDUCE_COUNT (404) |
| 164343 | +#define YY_REDUCE_COUNT (408) |
| 163930 | 164344 | #define YY_REDUCE_MIN (-271) |
| 163931 | | -#define YY_REDUCE_MAX (1716) |
| 164345 | +#define YY_REDUCE_MAX (1740) |
| 163932 | 164346 | static const short yy_reduce_ofst[] = { |
| 163933 | 164347 | /* 0 */ -125, 733, 789, 241, 293, -123, -193, -191, -183, -187, |
| 163934 | 164348 | /* 10 */ 166, 238, 133, -207, -199, -267, -176, -6, 204, 489, |
| 163935 | 164349 | /* 20 */ 576, -175, 598, 686, 615, 725, 860, 778, 781, 857, |
| 163936 | 164350 | /* 30 */ 616, 887, 87, 240, -192, 408, 626, 796, 843, 854, |
| | @@ -163940,98 +164354,99 @@ |
| 163940 | 164354 | /* 70 */ -271, -271, -271, -271, -271, -271, -271, -271, 80, 83, |
| 163941 | 164355 | /* 80 */ 313, 886, 888, 996, 1034, 1059, 1081, 1100, 1117, 1152, |
| 163942 | 164356 | /* 90 */ 1155, 1163, 1165, 1167, 1169, 1172, 1180, 1182, 1184, 1198, |
| 163943 | 164357 | /* 100 */ 1200, 1213, 1215, 1225, 1227, 1252, 1254, 1264, 1299, 1303, |
| 163944 | 164358 | /* 110 */ 1308, 1312, 1325, 1328, 1337, 1340, 1343, 1371, 1373, 1384, |
| 163945 | | - /* 120 */ 1386, 1411, 1420, 1424, 1426, 1458, 1470, 1473, -271, -271, |
| 163946 | | - /* 130 */ -271, -271, -271, -271, -271, -271, -271, 138, 459, 396, |
| 163947 | | - /* 140 */ -158, 470, 302, -212, 521, 201, -195, -92, 559, 630, |
| 163948 | | - /* 150 */ 632, 630, -271, 632, 901, 63, 407, -271, -271, -271, |
| 163949 | | - /* 160 */ -271, 161, 161, 161, 251, 335, 847, 960, 980, 537, |
| 163950 | | - /* 170 */ 588, 618, 628, 688, 688, -166, -161, 674, 790, 794, |
| 163951 | | - /* 180 */ 799, 851, 852, -122, 680, -120, 995, 1038, 415, 1051, |
| 163952 | | - /* 190 */ 893, 798, 962, 400, 1086, 779, 923, 924, 263, 1041, |
| 163953 | | - /* 200 */ 979, 990, 1083, 1097, 1031, 1194, 362, 994, 1139, 1005, |
| 163954 | | - /* 210 */ 1037, 1202, 1205, 1195, 1210, -194, 56, 185, -135, 232, |
| 163955 | | - /* 220 */ 522, 560, 601, 617, 669, 683, 711, 856, 908, 941, |
| 163956 | | - /* 230 */ 1048, 1101, 1147, 1257, 1262, 1265, 392, 1292, 1333, 1339, |
| 163957 | | - /* 240 */ 1342, 1346, 1350, 1359, 1374, 1418, 1421, 1436, 1437, 593, |
| 163958 | | - /* 250 */ 755, 770, 997, 1459, 1463, 1209, 1499, 1507, 1509, 1132, |
| 163959 | | - /* 260 */ 1243, 1510, 1511, 1440, 1512, 560, 1514, 1516, 1517, 1518, |
| 163960 | | - /* 270 */ 1519, 1520, 1427, 1429, 1466, 1464, 1465, 1467, 1468, 1209, |
| 163961 | | - /* 280 */ 1466, 1466, 1471, 1503, 1533, 1428, 1456, 1461, 1485, 1469, |
| 163962 | | - /* 290 */ 1438, 1486, 1474, 1476, 1488, 1479, 1492, 1445, 1524, 1525, |
| 163963 | | - /* 300 */ 1523, 1521, 1536, 1539, 1498, 1500, 1501, 1502, 1490, 1522, |
| 163964 | | - /* 310 */ 1484, 1527, 1531, 1569, 1487, 1496, 1570, 1573, 1504, 1506, |
| 163965 | | - /* 320 */ 1575, 1526, 1513, 1532, 1571, 1566, 1574, 1577, 1583, 1604, |
| 163966 | | - /* 330 */ 1608, 1576, 1540, 1549, 1578, 1553, 1591, 1580, 1593, 1582, |
| 163967 | | - /* 340 */ 1629, 1631, 1542, 1545, 1637, 1636, 1619, 1639, 1642, 1643, |
| 163968 | | - /* 350 */ 1646, 1621, 1633, 1634, 1638, 1620, 1630, 1640, 1641, 1647, |
| 163969 | | - /* 360 */ 1649, 1650, 1628, 1652, 1653, 1548, 1554, 1581, 1584, 1651, |
| 163970 | | - /* 370 */ 1661, 1556, 1558, 1611, 1613, 1655, 1657, 1605, 1685, 1609, |
| 163971 | | - /* 380 */ 1658, 1656, 1660, 1663, 1690, 1705, 1706, 1709, 1710, 1711, |
| 163972 | | - /* 390 */ 1607, 1610, 1612, 1704, 1701, 1702, 1707, 1708, 1712, 1694, |
| 163973 | | - /* 400 */ 1695, 1713, 1714, 1716, 1715, |
| 164359 | + /* 120 */ 1386, 1411, 1420, 1424, 1426, 1458, 1470, 1473, 1475, 1479, |
| 164360 | + /* 130 */ -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, |
| 164361 | + /* 140 */ -271, 138, 459, 396, -158, 470, 302, -212, 521, 201, |
| 164362 | + /* 150 */ -195, -92, 559, 630, 632, 630, -271, 632, 901, 63, |
| 164363 | + /* 160 */ 407, -271, -271, -271, -271, 161, 161, 161, 251, 335, |
| 164364 | + /* 170 */ 847, 960, 980, 537, 588, 618, 628, 688, 688, -166, |
| 164365 | + /* 180 */ -161, 674, 790, 794, 799, 851, 852, -122, 680, -120, |
| 164366 | + /* 190 */ 995, 1038, 415, 1051, 893, 798, 962, 400, 1086, 779, |
| 164367 | + /* 200 */ 923, 924, 263, 1041, 979, 990, 1083, 1097, 1031, 1194, |
| 164368 | + /* 210 */ 362, 994, 1139, 1005, 1037, 1202, 1205, 1195, 1210, -194, |
| 164369 | + /* 220 */ 56, 185, -135, 232, 522, 560, 601, 617, 669, 683, |
| 164370 | + /* 230 */ 711, 856, 908, 941, 1048, 1101, 1147, 1257, 1262, 1265, |
| 164371 | + /* 240 */ 392, 1292, 1333, 1339, 1342, 1346, 1350, 1359, 1374, 1418, |
| 164372 | + /* 250 */ 1421, 1436, 1437, 593, 755, 770, 997, 1445, 1459, 1209, |
| 164373 | + /* 260 */ 1500, 1504, 1516, 1132, 1243, 1518, 1519, 1440, 1520, 560, |
| 164374 | + /* 270 */ 1522, 1523, 1524, 1526, 1527, 1529, 1382, 1438, 1431, 1468, |
| 164375 | + /* 280 */ 1469, 1472, 1476, 1209, 1431, 1431, 1485, 1525, 1539, 1435, |
| 164376 | + /* 290 */ 1463, 1471, 1492, 1487, 1443, 1494, 1474, 1484, 1498, 1486, |
| 164377 | + /* 300 */ 1502, 1455, 1530, 1531, 1533, 1540, 1542, 1544, 1505, 1506, |
| 164378 | + /* 310 */ 1507, 1508, 1521, 1528, 1493, 1537, 1532, 1575, 1488, 1496, |
| 164379 | + /* 320 */ 1584, 1594, 1509, 1510, 1600, 1538, 1534, 1541, 1574, 1577, |
| 164380 | + /* 330 */ 1583, 1585, 1586, 1612, 1626, 1581, 1556, 1558, 1587, 1559, |
| 164381 | + /* 340 */ 1601, 1588, 1603, 1592, 1631, 1640, 1550, 1553, 1643, 1645, |
| 164382 | + /* 350 */ 1625, 1649, 1652, 1650, 1653, 1632, 1636, 1637, 1642, 1634, |
| 164383 | + /* 360 */ 1639, 1641, 1646, 1656, 1655, 1658, 1659, 1661, 1663, 1560, |
| 164384 | + /* 370 */ 1564, 1596, 1605, 1664, 1670, 1565, 1571, 1627, 1638, 1657, |
| 164385 | + /* 380 */ 1665, 1623, 1702, 1630, 1666, 1667, 1671, 1673, 1703, 1718, |
| 164386 | + /* 390 */ 1719, 1729, 1730, 1731, 1621, 1622, 1628, 1720, 1713, 1716, |
| 164387 | + /* 400 */ 1722, 1723, 1733, 1717, 1724, 1727, 1728, 1725, 1740, |
| 163974 | 164388 | }; |
| 163975 | 164389 | static const YYACTIONTYPE yy_default[] = { |
| 163976 | | - /* 0 */ 1637, 1637, 1637, 1465, 1232, 1343, 1232, 1232, 1232, 1465, |
| 163977 | | - /* 10 */ 1465, 1465, 1232, 1373, 1373, 1518, 1265, 1232, 1232, 1232, |
| 163978 | | - /* 20 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1464, 1232, 1232, |
| 163979 | | - /* 30 */ 1232, 1232, 1553, 1553, 1232, 1232, 1232, 1232, 1232, 1232, |
| 163980 | | - /* 40 */ 1232, 1232, 1382, 1232, 1389, 1232, 1232, 1232, 1232, 1232, |
| 163981 | | - /* 50 */ 1466, 1467, 1232, 1232, 1232, 1517, 1519, 1482, 1396, 1395, |
| 163982 | | - /* 60 */ 1394, 1393, 1500, 1361, 1387, 1380, 1384, 1460, 1461, 1459, |
| 163983 | | - /* 70 */ 1463, 1467, 1466, 1232, 1383, 1430, 1444, 1429, 1232, 1232, |
| 163984 | | - /* 80 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 163985 | | - /* 90 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 163986 | | - /* 100 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 163987 | | - /* 110 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 163988 | | - /* 120 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1438, 1443, |
| 163989 | | - /* 130 */ 1450, 1442, 1439, 1432, 1431, 1433, 1434, 1232, 1232, 1256, |
| 163990 | | - /* 140 */ 1232, 1232, 1253, 1307, 1232, 1232, 1232, 1232, 1232, 1537, |
| 163991 | | - /* 150 */ 1536, 1232, 1435, 1232, 1265, 1424, 1423, 1447, 1436, 1446, |
| 163992 | | - /* 160 */ 1445, 1525, 1589, 1588, 1483, 1232, 1232, 1232, 1232, 1232, |
| 163993 | | - /* 170 */ 1232, 1553, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 163994 | | - /* 180 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 163995 | | - /* 190 */ 1232, 1232, 1232, 1232, 1232, 1363, 1553, 1553, 1232, 1265, |
| 163996 | | - /* 200 */ 1553, 1553, 1364, 1364, 1261, 1261, 1367, 1232, 1532, 1334, |
| 163997 | | - /* 210 */ 1334, 1334, 1334, 1343, 1334, 1232, 1232, 1232, 1232, 1232, |
| 163998 | | - /* 220 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 163999 | | - /* 230 */ 1522, 1520, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 164000 | | - /* 240 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 164001 | | - /* 250 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1339, |
| 164002 | | - /* 260 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 164003 | | - /* 270 */ 1232, 1582, 1232, 1495, 1321, 1339, 1339, 1339, 1339, 1341, |
| 164004 | | - /* 280 */ 1322, 1320, 1333, 1266, 1239, 1629, 1399, 1388, 1340, 1388, |
| 164005 | | - /* 290 */ 1626, 1386, 1399, 1399, 1386, 1399, 1340, 1626, 1282, 1605, |
| 164006 | | - /* 300 */ 1277, 1373, 1373, 1373, 1363, 1363, 1363, 1363, 1367, 1367, |
| 164007 | | - /* 310 */ 1462, 1340, 1333, 1232, 1629, 1629, 1349, 1349, 1628, 1628, |
| 164008 | | - /* 320 */ 1349, 1483, 1613, 1408, 1310, 1316, 1316, 1316, 1316, 1349, |
| 164009 | | - /* 330 */ 1250, 1386, 1613, 1613, 1386, 1408, 1310, 1386, 1310, 1386, |
| 164010 | | - /* 340 */ 1349, 1250, 1499, 1623, 1349, 1250, 1473, 1349, 1250, 1349, |
| 164011 | | - /* 350 */ 1250, 1473, 1308, 1308, 1308, 1297, 1232, 1232, 1473, 1308, |
| 164012 | | - /* 360 */ 1282, 1308, 1297, 1308, 1308, 1571, 1232, 1477, 1477, 1473, |
| 164013 | | - /* 370 */ 1349, 1563, 1563, 1376, 1376, 1381, 1367, 1468, 1349, 1232, |
| 164014 | | - /* 380 */ 1381, 1379, 1377, 1386, 1300, 1585, 1585, 1581, 1581, 1581, |
| 164015 | | - /* 390 */ 1634, 1634, 1532, 1598, 1265, 1265, 1265, 1265, 1598, 1284, |
| 164016 | | - /* 400 */ 1284, 1266, 1266, 1265, 1598, 1232, 1232, 1232, 1232, 1232, |
| 164017 | | - /* 410 */ 1232, 1593, 1232, 1527, 1484, 1353, 1232, 1232, 1232, 1232, |
| 164018 | | - /* 420 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 164019 | | - /* 430 */ 1538, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 164020 | | - /* 440 */ 1232, 1413, 1232, 1235, 1529, 1232, 1232, 1232, 1232, 1232, |
| 164021 | | - /* 450 */ 1232, 1232, 1232, 1390, 1391, 1354, 1232, 1232, 1232, 1232, |
| 164022 | | - /* 460 */ 1232, 1232, 1232, 1405, 1232, 1232, 1232, 1400, 1232, 1232, |
| 164023 | | - /* 470 */ 1232, 1232, 1232, 1232, 1232, 1232, 1625, 1232, 1232, 1232, |
| 164024 | | - /* 480 */ 1232, 1232, 1232, 1498, 1497, 1232, 1232, 1351, 1232, 1232, |
| 164025 | | - /* 490 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 164026 | | - /* 500 */ 1232, 1280, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 164027 | | - /* 510 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 164028 | | - /* 520 */ 1232, 1232, 1232, 1232, 1232, 1378, 1232, 1232, 1232, 1232, |
| 164029 | | - /* 530 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, |
| 164030 | | - /* 540 */ 1568, 1368, 1232, 1232, 1616, 1232, 1232, 1232, 1232, 1232, |
| 164031 | | - /* 550 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1609, |
| 164032 | | - /* 560 */ 1324, 1415, 1232, 1414, 1418, 1254, 1232, 1244, 1232, 1232, |
| 164390 | + /* 0 */ 1647, 1647, 1647, 1475, 1240, 1351, 1240, 1240, 1240, 1475, |
| 164391 | + /* 10 */ 1475, 1475, 1240, 1381, 1381, 1528, 1273, 1240, 1240, 1240, |
| 164392 | + /* 20 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1474, 1240, 1240, |
| 164393 | + /* 30 */ 1240, 1240, 1563, 1563, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164394 | + /* 40 */ 1240, 1240, 1390, 1240, 1397, 1240, 1240, 1240, 1240, 1240, |
| 164395 | + /* 50 */ 1476, 1477, 1240, 1240, 1240, 1527, 1529, 1492, 1404, 1403, |
| 164396 | + /* 60 */ 1402, 1401, 1510, 1369, 1395, 1388, 1392, 1470, 1471, 1469, |
| 164397 | + /* 70 */ 1473, 1477, 1476, 1240, 1391, 1438, 1454, 1437, 1240, 1240, |
| 164398 | + /* 80 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164399 | + /* 90 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164400 | + /* 100 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164401 | + /* 110 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164402 | + /* 120 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164403 | + /* 130 */ 1446, 1453, 1452, 1451, 1460, 1450, 1447, 1440, 1439, 1441, |
| 164404 | + /* 140 */ 1442, 1240, 1240, 1264, 1240, 1240, 1261, 1315, 1240, 1240, |
| 164405 | + /* 150 */ 1240, 1240, 1240, 1547, 1546, 1240, 1443, 1240, 1273, 1432, |
| 164406 | + /* 160 */ 1431, 1457, 1444, 1456, 1455, 1535, 1599, 1598, 1493, 1240, |
| 164407 | + /* 170 */ 1240, 1240, 1240, 1240, 1240, 1563, 1240, 1240, 1240, 1240, |
| 164408 | + /* 180 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164409 | + /* 190 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1371, |
| 164410 | + /* 200 */ 1563, 1563, 1240, 1273, 1563, 1563, 1372, 1372, 1269, 1269, |
| 164411 | + /* 210 */ 1375, 1240, 1542, 1342, 1342, 1342, 1342, 1351, 1342, 1240, |
| 164412 | + /* 220 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164413 | + /* 230 */ 1240, 1240, 1240, 1240, 1532, 1530, 1240, 1240, 1240, 1240, |
| 164414 | + /* 240 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164415 | + /* 250 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164416 | + /* 260 */ 1240, 1240, 1240, 1347, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164417 | + /* 270 */ 1240, 1240, 1240, 1240, 1240, 1592, 1240, 1505, 1329, 1347, |
| 164418 | + /* 280 */ 1347, 1347, 1347, 1349, 1330, 1328, 1341, 1274, 1247, 1639, |
| 164419 | + /* 290 */ 1407, 1396, 1348, 1396, 1636, 1394, 1407, 1407, 1394, 1407, |
| 164420 | + /* 300 */ 1348, 1636, 1290, 1615, 1285, 1381, 1381, 1381, 1371, 1371, |
| 164421 | + /* 310 */ 1371, 1371, 1375, 1375, 1472, 1348, 1341, 1240, 1639, 1639, |
| 164422 | + /* 320 */ 1357, 1357, 1638, 1638, 1357, 1493, 1623, 1416, 1318, 1324, |
| 164423 | + /* 330 */ 1324, 1324, 1324, 1357, 1258, 1394, 1623, 1623, 1394, 1416, |
| 164424 | + /* 340 */ 1318, 1394, 1318, 1394, 1357, 1258, 1509, 1633, 1357, 1258, |
| 164425 | + /* 350 */ 1483, 1357, 1258, 1357, 1258, 1483, 1316, 1316, 1316, 1305, |
| 164426 | + /* 360 */ 1240, 1240, 1483, 1316, 1290, 1316, 1305, 1316, 1316, 1581, |
| 164427 | + /* 370 */ 1240, 1487, 1487, 1483, 1357, 1573, 1573, 1384, 1384, 1389, |
| 164428 | + /* 380 */ 1375, 1478, 1357, 1240, 1389, 1387, 1385, 1394, 1308, 1595, |
| 164429 | + /* 390 */ 1595, 1591, 1591, 1591, 1644, 1644, 1542, 1608, 1273, 1273, |
| 164430 | + /* 400 */ 1273, 1273, 1608, 1292, 1292, 1274, 1274, 1273, 1608, 1240, |
| 164431 | + /* 410 */ 1240, 1240, 1240, 1240, 1240, 1603, 1240, 1537, 1494, 1361, |
| 164432 | + /* 420 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164433 | + /* 430 */ 1240, 1240, 1240, 1240, 1548, 1240, 1240, 1240, 1240, 1240, |
| 164434 | + /* 440 */ 1240, 1240, 1240, 1240, 1240, 1421, 1240, 1243, 1539, 1240, |
| 164435 | + /* 450 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1398, 1399, 1362, |
| 164436 | + /* 460 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1413, 1240, 1240, |
| 164437 | + /* 470 */ 1240, 1408, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164438 | + /* 480 */ 1635, 1240, 1240, 1240, 1240, 1240, 1240, 1508, 1507, 1240, |
| 164439 | + /* 490 */ 1240, 1359, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164440 | + /* 500 */ 1240, 1240, 1240, 1240, 1240, 1288, 1240, 1240, 1240, 1240, |
| 164441 | + /* 510 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164442 | + /* 520 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1386, |
| 164443 | + /* 530 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164444 | + /* 540 */ 1240, 1240, 1240, 1240, 1578, 1376, 1240, 1240, 1240, 1240, |
| 164445 | + /* 550 */ 1626, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 164446 | + /* 560 */ 1240, 1240, 1240, 1240, 1240, 1619, 1332, 1423, 1240, 1422, |
| 164447 | + /* 570 */ 1426, 1262, 1240, 1252, 1240, 1240, |
| 164033 | 164448 | }; |
| 164034 | 164449 | /********** End of lemon-generated parsing tables *****************************/ |
| 164035 | 164450 | |
| 164036 | 164451 | /* The next table maps tokens (terminal symbols) into fallback tokens. |
| 164037 | 164452 | ** If a construct like the following: |
| | @@ -164855,204 +165270,206 @@ |
| 164855 | 165270 | /* 204 */ "expr ::= expr likeop expr ESCAPE expr", |
| 164856 | 165271 | /* 205 */ "expr ::= expr ISNULL|NOTNULL", |
| 164857 | 165272 | /* 206 */ "expr ::= expr NOT NULL", |
| 164858 | 165273 | /* 207 */ "expr ::= expr IS expr", |
| 164859 | 165274 | /* 208 */ "expr ::= expr IS NOT expr", |
| 164860 | | - /* 209 */ "expr ::= NOT expr", |
| 164861 | | - /* 210 */ "expr ::= BITNOT expr", |
| 164862 | | - /* 211 */ "expr ::= PLUS|MINUS expr", |
| 164863 | | - /* 212 */ "expr ::= expr PTR expr", |
| 164864 | | - /* 213 */ "between_op ::= BETWEEN", |
| 164865 | | - /* 214 */ "between_op ::= NOT BETWEEN", |
| 164866 | | - /* 215 */ "expr ::= expr between_op expr AND expr", |
| 164867 | | - /* 216 */ "in_op ::= IN", |
| 164868 | | - /* 217 */ "in_op ::= NOT IN", |
| 164869 | | - /* 218 */ "expr ::= expr in_op LP exprlist RP", |
| 164870 | | - /* 219 */ "expr ::= LP select RP", |
| 164871 | | - /* 220 */ "expr ::= expr in_op LP select RP", |
| 164872 | | - /* 221 */ "expr ::= expr in_op nm dbnm paren_exprlist", |
| 164873 | | - /* 222 */ "expr ::= EXISTS LP select RP", |
| 164874 | | - /* 223 */ "expr ::= CASE case_operand case_exprlist case_else END", |
| 164875 | | - /* 224 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", |
| 164876 | | - /* 225 */ "case_exprlist ::= WHEN expr THEN expr", |
| 164877 | | - /* 226 */ "case_else ::= ELSE expr", |
| 164878 | | - /* 227 */ "case_else ::=", |
| 164879 | | - /* 228 */ "case_operand ::= expr", |
| 164880 | | - /* 229 */ "case_operand ::=", |
| 164881 | | - /* 230 */ "exprlist ::=", |
| 164882 | | - /* 231 */ "nexprlist ::= nexprlist COMMA expr", |
| 164883 | | - /* 232 */ "nexprlist ::= expr", |
| 164884 | | - /* 233 */ "paren_exprlist ::=", |
| 164885 | | - /* 234 */ "paren_exprlist ::= LP exprlist RP", |
| 164886 | | - /* 235 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", |
| 164887 | | - /* 236 */ "uniqueflag ::= UNIQUE", |
| 164888 | | - /* 237 */ "uniqueflag ::=", |
| 164889 | | - /* 238 */ "eidlist_opt ::=", |
| 164890 | | - /* 239 */ "eidlist_opt ::= LP eidlist RP", |
| 164891 | | - /* 240 */ "eidlist ::= eidlist COMMA nm collate sortorder", |
| 164892 | | - /* 241 */ "eidlist ::= nm collate sortorder", |
| 164893 | | - /* 242 */ "collate ::=", |
| 164894 | | - /* 243 */ "collate ::= COLLATE ID|STRING", |
| 164895 | | - /* 244 */ "cmd ::= DROP INDEX ifexists fullname", |
| 164896 | | - /* 245 */ "cmd ::= VACUUM vinto", |
| 164897 | | - /* 246 */ "cmd ::= VACUUM nm vinto", |
| 164898 | | - /* 247 */ "vinto ::= INTO expr", |
| 164899 | | - /* 248 */ "vinto ::=", |
| 164900 | | - /* 249 */ "cmd ::= PRAGMA nm dbnm", |
| 164901 | | - /* 250 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", |
| 164902 | | - /* 251 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", |
| 164903 | | - /* 252 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", |
| 164904 | | - /* 253 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 164905 | | - /* 254 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 164906 | | - /* 255 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 164907 | | - /* 256 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 164908 | | - /* 257 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 164909 | | - /* 258 */ "trigger_time ::= BEFORE|AFTER", |
| 164910 | | - /* 259 */ "trigger_time ::= INSTEAD OF", |
| 164911 | | - /* 260 */ "trigger_time ::=", |
| 164912 | | - /* 261 */ "trigger_event ::= DELETE|INSERT", |
| 164913 | | - /* 262 */ "trigger_event ::= UPDATE", |
| 164914 | | - /* 263 */ "trigger_event ::= UPDATE OF idlist", |
| 164915 | | - /* 264 */ "when_clause ::=", |
| 164916 | | - /* 265 */ "when_clause ::= WHEN expr", |
| 164917 | | - /* 266 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 164918 | | - /* 267 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 164919 | | - /* 268 */ "trnm ::= nm DOT nm", |
| 164920 | | - /* 269 */ "tridxby ::= INDEXED BY nm", |
| 164921 | | - /* 270 */ "tridxby ::= NOT INDEXED", |
| 164922 | | - /* 271 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", |
| 164923 | | - /* 272 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", |
| 164924 | | - /* 273 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", |
| 164925 | | - /* 274 */ "trigger_cmd ::= scanpt select scanpt", |
| 164926 | | - /* 275 */ "expr ::= RAISE LP IGNORE RP", |
| 164927 | | - /* 276 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 164928 | | - /* 277 */ "raisetype ::= ROLLBACK", |
| 164929 | | - /* 278 */ "raisetype ::= ABORT", |
| 164930 | | - /* 279 */ "raisetype ::= FAIL", |
| 164931 | | - /* 280 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 164932 | | - /* 281 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 164933 | | - /* 282 */ "cmd ::= DETACH database_kw_opt expr", |
| 164934 | | - /* 283 */ "key_opt ::=", |
| 164935 | | - /* 284 */ "key_opt ::= KEY expr", |
| 164936 | | - /* 285 */ "cmd ::= REINDEX", |
| 164937 | | - /* 286 */ "cmd ::= REINDEX nm dbnm", |
| 164938 | | - /* 287 */ "cmd ::= ANALYZE", |
| 164939 | | - /* 288 */ "cmd ::= ANALYZE nm dbnm", |
| 164940 | | - /* 289 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 164941 | | - /* 290 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 164942 | | - /* 291 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", |
| 164943 | | - /* 292 */ "add_column_fullname ::= fullname", |
| 164944 | | - /* 293 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", |
| 164945 | | - /* 294 */ "cmd ::= create_vtab", |
| 164946 | | - /* 295 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 164947 | | - /* 296 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 164948 | | - /* 297 */ "vtabarg ::=", |
| 164949 | | - /* 298 */ "vtabargtoken ::= ANY", |
| 164950 | | - /* 299 */ "vtabargtoken ::= lp anylist RP", |
| 164951 | | - /* 300 */ "lp ::= LP", |
| 164952 | | - /* 301 */ "with ::= WITH wqlist", |
| 164953 | | - /* 302 */ "with ::= WITH RECURSIVE wqlist", |
| 164954 | | - /* 303 */ "wqas ::= AS", |
| 164955 | | - /* 304 */ "wqas ::= AS MATERIALIZED", |
| 164956 | | - /* 305 */ "wqas ::= AS NOT MATERIALIZED", |
| 164957 | | - /* 306 */ "wqitem ::= nm eidlist_opt wqas LP select RP", |
| 164958 | | - /* 307 */ "wqlist ::= wqitem", |
| 164959 | | - /* 308 */ "wqlist ::= wqlist COMMA wqitem", |
| 164960 | | - /* 309 */ "windowdefn_list ::= windowdefn", |
| 164961 | | - /* 310 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", |
| 164962 | | - /* 311 */ "windowdefn ::= nm AS LP window RP", |
| 164963 | | - /* 312 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", |
| 164964 | | - /* 313 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", |
| 164965 | | - /* 314 */ "window ::= ORDER BY sortlist frame_opt", |
| 164966 | | - /* 315 */ "window ::= nm ORDER BY sortlist frame_opt", |
| 164967 | | - /* 316 */ "window ::= frame_opt", |
| 164968 | | - /* 317 */ "window ::= nm frame_opt", |
| 164969 | | - /* 318 */ "frame_opt ::=", |
| 164970 | | - /* 319 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", |
| 164971 | | - /* 320 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", |
| 164972 | | - /* 321 */ "range_or_rows ::= RANGE|ROWS|GROUPS", |
| 164973 | | - /* 322 */ "frame_bound_s ::= frame_bound", |
| 164974 | | - /* 323 */ "frame_bound_s ::= UNBOUNDED PRECEDING", |
| 164975 | | - /* 324 */ "frame_bound_e ::= frame_bound", |
| 164976 | | - /* 325 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", |
| 164977 | | - /* 326 */ "frame_bound ::= expr PRECEDING|FOLLOWING", |
| 164978 | | - /* 327 */ "frame_bound ::= CURRENT ROW", |
| 164979 | | - /* 328 */ "frame_exclude_opt ::=", |
| 164980 | | - /* 329 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", |
| 164981 | | - /* 330 */ "frame_exclude ::= NO OTHERS", |
| 164982 | | - /* 331 */ "frame_exclude ::= CURRENT ROW", |
| 164983 | | - /* 332 */ "frame_exclude ::= GROUP|TIES", |
| 164984 | | - /* 333 */ "window_clause ::= WINDOW windowdefn_list", |
| 164985 | | - /* 334 */ "filter_over ::= filter_clause over_clause", |
| 164986 | | - /* 335 */ "filter_over ::= over_clause", |
| 164987 | | - /* 336 */ "filter_over ::= filter_clause", |
| 164988 | | - /* 337 */ "over_clause ::= OVER LP window RP", |
| 164989 | | - /* 338 */ "over_clause ::= OVER nm", |
| 164990 | | - /* 339 */ "filter_clause ::= FILTER LP WHERE expr RP", |
| 164991 | | - /* 340 */ "input ::= cmdlist", |
| 164992 | | - /* 341 */ "cmdlist ::= cmdlist ecmd", |
| 164993 | | - /* 342 */ "cmdlist ::= ecmd", |
| 164994 | | - /* 343 */ "ecmd ::= SEMI", |
| 164995 | | - /* 344 */ "ecmd ::= cmdx SEMI", |
| 164996 | | - /* 345 */ "ecmd ::= explain cmdx SEMI", |
| 164997 | | - /* 346 */ "trans_opt ::=", |
| 164998 | | - /* 347 */ "trans_opt ::= TRANSACTION", |
| 164999 | | - /* 348 */ "trans_opt ::= TRANSACTION nm", |
| 165000 | | - /* 349 */ "savepoint_opt ::= SAVEPOINT", |
| 165001 | | - /* 350 */ "savepoint_opt ::=", |
| 165002 | | - /* 351 */ "cmd ::= create_table create_table_args", |
| 165003 | | - /* 352 */ "table_option_set ::= table_option", |
| 165004 | | - /* 353 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 165005 | | - /* 354 */ "columnlist ::= columnname carglist", |
| 165006 | | - /* 355 */ "nm ::= ID|INDEXED", |
| 165007 | | - /* 356 */ "nm ::= STRING", |
| 165008 | | - /* 357 */ "nm ::= JOIN_KW", |
| 165009 | | - /* 358 */ "typetoken ::= typename", |
| 165010 | | - /* 359 */ "typename ::= ID|STRING", |
| 165011 | | - /* 360 */ "signed ::= plus_num", |
| 165012 | | - /* 361 */ "signed ::= minus_num", |
| 165013 | | - /* 362 */ "carglist ::= carglist ccons", |
| 165014 | | - /* 363 */ "carglist ::=", |
| 165015 | | - /* 364 */ "ccons ::= NULL onconf", |
| 165016 | | - /* 365 */ "ccons ::= GENERATED ALWAYS AS generated", |
| 165017 | | - /* 366 */ "ccons ::= AS generated", |
| 165018 | | - /* 367 */ "conslist_opt ::= COMMA conslist", |
| 165019 | | - /* 368 */ "conslist ::= conslist tconscomma tcons", |
| 165020 | | - /* 369 */ "conslist ::= tcons", |
| 165021 | | - /* 370 */ "tconscomma ::=", |
| 165022 | | - /* 371 */ "defer_subclause_opt ::= defer_subclause", |
| 165023 | | - /* 372 */ "resolvetype ::= raisetype", |
| 165024 | | - /* 373 */ "selectnowith ::= oneselect", |
| 165025 | | - /* 374 */ "oneselect ::= values", |
| 165026 | | - /* 375 */ "sclp ::= selcollist COMMA", |
| 165027 | | - /* 376 */ "as ::= ID|STRING", |
| 165028 | | - /* 377 */ "indexed_opt ::= indexed_by", |
| 165029 | | - /* 378 */ "returning ::=", |
| 165030 | | - /* 379 */ "expr ::= term", |
| 165031 | | - /* 380 */ "likeop ::= LIKE_KW|MATCH", |
| 165032 | | - /* 381 */ "exprlist ::= nexprlist", |
| 165033 | | - /* 382 */ "nmnum ::= plus_num", |
| 165034 | | - /* 383 */ "nmnum ::= nm", |
| 165035 | | - /* 384 */ "nmnum ::= ON", |
| 165036 | | - /* 385 */ "nmnum ::= DELETE", |
| 165037 | | - /* 386 */ "nmnum ::= DEFAULT", |
| 165038 | | - /* 387 */ "plus_num ::= INTEGER|FLOAT", |
| 165039 | | - /* 388 */ "foreach_clause ::=", |
| 165040 | | - /* 389 */ "foreach_clause ::= FOR EACH ROW", |
| 165041 | | - /* 390 */ "trnm ::= nm", |
| 165042 | | - /* 391 */ "tridxby ::=", |
| 165043 | | - /* 392 */ "database_kw_opt ::= DATABASE", |
| 165044 | | - /* 393 */ "database_kw_opt ::=", |
| 165045 | | - /* 394 */ "kwcolumn_opt ::=", |
| 165046 | | - /* 395 */ "kwcolumn_opt ::= COLUMNKW", |
| 165047 | | - /* 396 */ "vtabarglist ::= vtabarg", |
| 165048 | | - /* 397 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 165049 | | - /* 398 */ "vtabarg ::= vtabarg vtabargtoken", |
| 165050 | | - /* 399 */ "anylist ::=", |
| 165051 | | - /* 400 */ "anylist ::= anylist LP anylist RP", |
| 165052 | | - /* 401 */ "anylist ::= anylist ANY", |
| 165053 | | - /* 402 */ "with ::=", |
| 165275 | + /* 209 */ "expr ::= expr IS NOT DISTINCT FROM expr", |
| 165276 | + /* 210 */ "expr ::= expr IS DISTINCT FROM expr", |
| 165277 | + /* 211 */ "expr ::= NOT expr", |
| 165278 | + /* 212 */ "expr ::= BITNOT expr", |
| 165279 | + /* 213 */ "expr ::= PLUS|MINUS expr", |
| 165280 | + /* 214 */ "expr ::= expr PTR expr", |
| 165281 | + /* 215 */ "between_op ::= BETWEEN", |
| 165282 | + /* 216 */ "between_op ::= NOT BETWEEN", |
| 165283 | + /* 217 */ "expr ::= expr between_op expr AND expr", |
| 165284 | + /* 218 */ "in_op ::= IN", |
| 165285 | + /* 219 */ "in_op ::= NOT IN", |
| 165286 | + /* 220 */ "expr ::= expr in_op LP exprlist RP", |
| 165287 | + /* 221 */ "expr ::= LP select RP", |
| 165288 | + /* 222 */ "expr ::= expr in_op LP select RP", |
| 165289 | + /* 223 */ "expr ::= expr in_op nm dbnm paren_exprlist", |
| 165290 | + /* 224 */ "expr ::= EXISTS LP select RP", |
| 165291 | + /* 225 */ "expr ::= CASE case_operand case_exprlist case_else END", |
| 165292 | + /* 226 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", |
| 165293 | + /* 227 */ "case_exprlist ::= WHEN expr THEN expr", |
| 165294 | + /* 228 */ "case_else ::= ELSE expr", |
| 165295 | + /* 229 */ "case_else ::=", |
| 165296 | + /* 230 */ "case_operand ::= expr", |
| 165297 | + /* 231 */ "case_operand ::=", |
| 165298 | + /* 232 */ "exprlist ::=", |
| 165299 | + /* 233 */ "nexprlist ::= nexprlist COMMA expr", |
| 165300 | + /* 234 */ "nexprlist ::= expr", |
| 165301 | + /* 235 */ "paren_exprlist ::=", |
| 165302 | + /* 236 */ "paren_exprlist ::= LP exprlist RP", |
| 165303 | + /* 237 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", |
| 165304 | + /* 238 */ "uniqueflag ::= UNIQUE", |
| 165305 | + /* 239 */ "uniqueflag ::=", |
| 165306 | + /* 240 */ "eidlist_opt ::=", |
| 165307 | + /* 241 */ "eidlist_opt ::= LP eidlist RP", |
| 165308 | + /* 242 */ "eidlist ::= eidlist COMMA nm collate sortorder", |
| 165309 | + /* 243 */ "eidlist ::= nm collate sortorder", |
| 165310 | + /* 244 */ "collate ::=", |
| 165311 | + /* 245 */ "collate ::= COLLATE ID|STRING", |
| 165312 | + /* 246 */ "cmd ::= DROP INDEX ifexists fullname", |
| 165313 | + /* 247 */ "cmd ::= VACUUM vinto", |
| 165314 | + /* 248 */ "cmd ::= VACUUM nm vinto", |
| 165315 | + /* 249 */ "vinto ::= INTO expr", |
| 165316 | + /* 250 */ "vinto ::=", |
| 165317 | + /* 251 */ "cmd ::= PRAGMA nm dbnm", |
| 165318 | + /* 252 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", |
| 165319 | + /* 253 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", |
| 165320 | + /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", |
| 165321 | + /* 255 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 165322 | + /* 256 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 165323 | + /* 257 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 165324 | + /* 258 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 165325 | + /* 259 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 165326 | + /* 260 */ "trigger_time ::= BEFORE|AFTER", |
| 165327 | + /* 261 */ "trigger_time ::= INSTEAD OF", |
| 165328 | + /* 262 */ "trigger_time ::=", |
| 165329 | + /* 263 */ "trigger_event ::= DELETE|INSERT", |
| 165330 | + /* 264 */ "trigger_event ::= UPDATE", |
| 165331 | + /* 265 */ "trigger_event ::= UPDATE OF idlist", |
| 165332 | + /* 266 */ "when_clause ::=", |
| 165333 | + /* 267 */ "when_clause ::= WHEN expr", |
| 165334 | + /* 268 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 165335 | + /* 269 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 165336 | + /* 270 */ "trnm ::= nm DOT nm", |
| 165337 | + /* 271 */ "tridxby ::= INDEXED BY nm", |
| 165338 | + /* 272 */ "tridxby ::= NOT INDEXED", |
| 165339 | + /* 273 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", |
| 165340 | + /* 274 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", |
| 165341 | + /* 275 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", |
| 165342 | + /* 276 */ "trigger_cmd ::= scanpt select scanpt", |
| 165343 | + /* 277 */ "expr ::= RAISE LP IGNORE RP", |
| 165344 | + /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 165345 | + /* 279 */ "raisetype ::= ROLLBACK", |
| 165346 | + /* 280 */ "raisetype ::= ABORT", |
| 165347 | + /* 281 */ "raisetype ::= FAIL", |
| 165348 | + /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 165349 | + /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 165350 | + /* 284 */ "cmd ::= DETACH database_kw_opt expr", |
| 165351 | + /* 285 */ "key_opt ::=", |
| 165352 | + /* 286 */ "key_opt ::= KEY expr", |
| 165353 | + /* 287 */ "cmd ::= REINDEX", |
| 165354 | + /* 288 */ "cmd ::= REINDEX nm dbnm", |
| 165355 | + /* 289 */ "cmd ::= ANALYZE", |
| 165356 | + /* 290 */ "cmd ::= ANALYZE nm dbnm", |
| 165357 | + /* 291 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 165358 | + /* 292 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 165359 | + /* 293 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", |
| 165360 | + /* 294 */ "add_column_fullname ::= fullname", |
| 165361 | + /* 295 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", |
| 165362 | + /* 296 */ "cmd ::= create_vtab", |
| 165363 | + /* 297 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 165364 | + /* 298 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 165365 | + /* 299 */ "vtabarg ::=", |
| 165366 | + /* 300 */ "vtabargtoken ::= ANY", |
| 165367 | + /* 301 */ "vtabargtoken ::= lp anylist RP", |
| 165368 | + /* 302 */ "lp ::= LP", |
| 165369 | + /* 303 */ "with ::= WITH wqlist", |
| 165370 | + /* 304 */ "with ::= WITH RECURSIVE wqlist", |
| 165371 | + /* 305 */ "wqas ::= AS", |
| 165372 | + /* 306 */ "wqas ::= AS MATERIALIZED", |
| 165373 | + /* 307 */ "wqas ::= AS NOT MATERIALIZED", |
| 165374 | + /* 308 */ "wqitem ::= nm eidlist_opt wqas LP select RP", |
| 165375 | + /* 309 */ "wqlist ::= wqitem", |
| 165376 | + /* 310 */ "wqlist ::= wqlist COMMA wqitem", |
| 165377 | + /* 311 */ "windowdefn_list ::= windowdefn", |
| 165378 | + /* 312 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", |
| 165379 | + /* 313 */ "windowdefn ::= nm AS LP window RP", |
| 165380 | + /* 314 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", |
| 165381 | + /* 315 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", |
| 165382 | + /* 316 */ "window ::= ORDER BY sortlist frame_opt", |
| 165383 | + /* 317 */ "window ::= nm ORDER BY sortlist frame_opt", |
| 165384 | + /* 318 */ "window ::= frame_opt", |
| 165385 | + /* 319 */ "window ::= nm frame_opt", |
| 165386 | + /* 320 */ "frame_opt ::=", |
| 165387 | + /* 321 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", |
| 165388 | + /* 322 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", |
| 165389 | + /* 323 */ "range_or_rows ::= RANGE|ROWS|GROUPS", |
| 165390 | + /* 324 */ "frame_bound_s ::= frame_bound", |
| 165391 | + /* 325 */ "frame_bound_s ::= UNBOUNDED PRECEDING", |
| 165392 | + /* 326 */ "frame_bound_e ::= frame_bound", |
| 165393 | + /* 327 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", |
| 165394 | + /* 328 */ "frame_bound ::= expr PRECEDING|FOLLOWING", |
| 165395 | + /* 329 */ "frame_bound ::= CURRENT ROW", |
| 165396 | + /* 330 */ "frame_exclude_opt ::=", |
| 165397 | + /* 331 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", |
| 165398 | + /* 332 */ "frame_exclude ::= NO OTHERS", |
| 165399 | + /* 333 */ "frame_exclude ::= CURRENT ROW", |
| 165400 | + /* 334 */ "frame_exclude ::= GROUP|TIES", |
| 165401 | + /* 335 */ "window_clause ::= WINDOW windowdefn_list", |
| 165402 | + /* 336 */ "filter_over ::= filter_clause over_clause", |
| 165403 | + /* 337 */ "filter_over ::= over_clause", |
| 165404 | + /* 338 */ "filter_over ::= filter_clause", |
| 165405 | + /* 339 */ "over_clause ::= OVER LP window RP", |
| 165406 | + /* 340 */ "over_clause ::= OVER nm", |
| 165407 | + /* 341 */ "filter_clause ::= FILTER LP WHERE expr RP", |
| 165408 | + /* 342 */ "input ::= cmdlist", |
| 165409 | + /* 343 */ "cmdlist ::= cmdlist ecmd", |
| 165410 | + /* 344 */ "cmdlist ::= ecmd", |
| 165411 | + /* 345 */ "ecmd ::= SEMI", |
| 165412 | + /* 346 */ "ecmd ::= cmdx SEMI", |
| 165413 | + /* 347 */ "ecmd ::= explain cmdx SEMI", |
| 165414 | + /* 348 */ "trans_opt ::=", |
| 165415 | + /* 349 */ "trans_opt ::= TRANSACTION", |
| 165416 | + /* 350 */ "trans_opt ::= TRANSACTION nm", |
| 165417 | + /* 351 */ "savepoint_opt ::= SAVEPOINT", |
| 165418 | + /* 352 */ "savepoint_opt ::=", |
| 165419 | + /* 353 */ "cmd ::= create_table create_table_args", |
| 165420 | + /* 354 */ "table_option_set ::= table_option", |
| 165421 | + /* 355 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 165422 | + /* 356 */ "columnlist ::= columnname carglist", |
| 165423 | + /* 357 */ "nm ::= ID|INDEXED", |
| 165424 | + /* 358 */ "nm ::= STRING", |
| 165425 | + /* 359 */ "nm ::= JOIN_KW", |
| 165426 | + /* 360 */ "typetoken ::= typename", |
| 165427 | + /* 361 */ "typename ::= ID|STRING", |
| 165428 | + /* 362 */ "signed ::= plus_num", |
| 165429 | + /* 363 */ "signed ::= minus_num", |
| 165430 | + /* 364 */ "carglist ::= carglist ccons", |
| 165431 | + /* 365 */ "carglist ::=", |
| 165432 | + /* 366 */ "ccons ::= NULL onconf", |
| 165433 | + /* 367 */ "ccons ::= GENERATED ALWAYS AS generated", |
| 165434 | + /* 368 */ "ccons ::= AS generated", |
| 165435 | + /* 369 */ "conslist_opt ::= COMMA conslist", |
| 165436 | + /* 370 */ "conslist ::= conslist tconscomma tcons", |
| 165437 | + /* 371 */ "conslist ::= tcons", |
| 165438 | + /* 372 */ "tconscomma ::=", |
| 165439 | + /* 373 */ "defer_subclause_opt ::= defer_subclause", |
| 165440 | + /* 374 */ "resolvetype ::= raisetype", |
| 165441 | + /* 375 */ "selectnowith ::= oneselect", |
| 165442 | + /* 376 */ "oneselect ::= values", |
| 165443 | + /* 377 */ "sclp ::= selcollist COMMA", |
| 165444 | + /* 378 */ "as ::= ID|STRING", |
| 165445 | + /* 379 */ "indexed_opt ::= indexed_by", |
| 165446 | + /* 380 */ "returning ::=", |
| 165447 | + /* 381 */ "expr ::= term", |
| 165448 | + /* 382 */ "likeop ::= LIKE_KW|MATCH", |
| 165449 | + /* 383 */ "exprlist ::= nexprlist", |
| 165450 | + /* 384 */ "nmnum ::= plus_num", |
| 165451 | + /* 385 */ "nmnum ::= nm", |
| 165452 | + /* 386 */ "nmnum ::= ON", |
| 165453 | + /* 387 */ "nmnum ::= DELETE", |
| 165454 | + /* 388 */ "nmnum ::= DEFAULT", |
| 165455 | + /* 389 */ "plus_num ::= INTEGER|FLOAT", |
| 165456 | + /* 390 */ "foreach_clause ::=", |
| 165457 | + /* 391 */ "foreach_clause ::= FOR EACH ROW", |
| 165458 | + /* 392 */ "trnm ::= nm", |
| 165459 | + /* 393 */ "tridxby ::=", |
| 165460 | + /* 394 */ "database_kw_opt ::= DATABASE", |
| 165461 | + /* 395 */ "database_kw_opt ::=", |
| 165462 | + /* 396 */ "kwcolumn_opt ::=", |
| 165463 | + /* 397 */ "kwcolumn_opt ::= COLUMNKW", |
| 165464 | + /* 398 */ "vtabarglist ::= vtabarg", |
| 165465 | + /* 399 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 165466 | + /* 400 */ "vtabarg ::= vtabarg vtabargtoken", |
| 165467 | + /* 401 */ "anylist ::=", |
| 165468 | + /* 402 */ "anylist ::= anylist LP anylist RP", |
| 165469 | + /* 403 */ "anylist ::= anylist ANY", |
| 165470 | + /* 404 */ "with ::=", |
| 165054 | 165471 | }; |
| 165055 | 165472 | #endif /* NDEBUG */ |
| 165056 | 165473 | |
| 165057 | 165474 | |
| 165058 | 165475 | #if YYSTACKDEPTH<=0 |
| | @@ -165764,204 +166181,206 @@ |
| 165764 | 166181 | 217, /* (204) expr ::= expr likeop expr ESCAPE expr */ |
| 165765 | 166182 | 217, /* (205) expr ::= expr ISNULL|NOTNULL */ |
| 165766 | 166183 | 217, /* (206) expr ::= expr NOT NULL */ |
| 165767 | 166184 | 217, /* (207) expr ::= expr IS expr */ |
| 165768 | 166185 | 217, /* (208) expr ::= expr IS NOT expr */ |
| 165769 | | - 217, /* (209) expr ::= NOT expr */ |
| 165770 | | - 217, /* (210) expr ::= BITNOT expr */ |
| 165771 | | - 217, /* (211) expr ::= PLUS|MINUS expr */ |
| 165772 | | - 217, /* (212) expr ::= expr PTR expr */ |
| 165773 | | - 275, /* (213) between_op ::= BETWEEN */ |
| 165774 | | - 275, /* (214) between_op ::= NOT BETWEEN */ |
| 165775 | | - 217, /* (215) expr ::= expr between_op expr AND expr */ |
| 165776 | | - 276, /* (216) in_op ::= IN */ |
| 165777 | | - 276, /* (217) in_op ::= NOT IN */ |
| 165778 | | - 217, /* (218) expr ::= expr in_op LP exprlist RP */ |
| 165779 | | - 217, /* (219) expr ::= LP select RP */ |
| 165780 | | - 217, /* (220) expr ::= expr in_op LP select RP */ |
| 165781 | | - 217, /* (221) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 165782 | | - 217, /* (222) expr ::= EXISTS LP select RP */ |
| 165783 | | - 217, /* (223) expr ::= CASE case_operand case_exprlist case_else END */ |
| 165784 | | - 279, /* (224) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 165785 | | - 279, /* (225) case_exprlist ::= WHEN expr THEN expr */ |
| 165786 | | - 280, /* (226) case_else ::= ELSE expr */ |
| 165787 | | - 280, /* (227) case_else ::= */ |
| 165788 | | - 278, /* (228) case_operand ::= expr */ |
| 165789 | | - 278, /* (229) case_operand ::= */ |
| 165790 | | - 261, /* (230) exprlist ::= */ |
| 165791 | | - 253, /* (231) nexprlist ::= nexprlist COMMA expr */ |
| 165792 | | - 253, /* (232) nexprlist ::= expr */ |
| 165793 | | - 277, /* (233) paren_exprlist ::= */ |
| 165794 | | - 277, /* (234) paren_exprlist ::= LP exprlist RP */ |
| 165795 | | - 190, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 165796 | | - 281, /* (236) uniqueflag ::= UNIQUE */ |
| 165797 | | - 281, /* (237) uniqueflag ::= */ |
| 165798 | | - 221, /* (238) eidlist_opt ::= */ |
| 165799 | | - 221, /* (239) eidlist_opt ::= LP eidlist RP */ |
| 165800 | | - 232, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 165801 | | - 232, /* (241) eidlist ::= nm collate sortorder */ |
| 165802 | | - 282, /* (242) collate ::= */ |
| 165803 | | - 282, /* (243) collate ::= COLLATE ID|STRING */ |
| 165804 | | - 190, /* (244) cmd ::= DROP INDEX ifexists fullname */ |
| 165805 | | - 190, /* (245) cmd ::= VACUUM vinto */ |
| 165806 | | - 190, /* (246) cmd ::= VACUUM nm vinto */ |
| 165807 | | - 283, /* (247) vinto ::= INTO expr */ |
| 165808 | | - 283, /* (248) vinto ::= */ |
| 165809 | | - 190, /* (249) cmd ::= PRAGMA nm dbnm */ |
| 165810 | | - 190, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 165811 | | - 190, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 165812 | | - 190, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 165813 | | - 190, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 165814 | | - 211, /* (254) plus_num ::= PLUS INTEGER|FLOAT */ |
| 165815 | | - 212, /* (255) minus_num ::= MINUS INTEGER|FLOAT */ |
| 165816 | | - 190, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 165817 | | - 285, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 165818 | | - 287, /* (258) trigger_time ::= BEFORE|AFTER */ |
| 165819 | | - 287, /* (259) trigger_time ::= INSTEAD OF */ |
| 165820 | | - 287, /* (260) trigger_time ::= */ |
| 165821 | | - 288, /* (261) trigger_event ::= DELETE|INSERT */ |
| 165822 | | - 288, /* (262) trigger_event ::= UPDATE */ |
| 165823 | | - 288, /* (263) trigger_event ::= UPDATE OF idlist */ |
| 165824 | | - 290, /* (264) when_clause ::= */ |
| 165825 | | - 290, /* (265) when_clause ::= WHEN expr */ |
| 165826 | | - 286, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 165827 | | - 286, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 165828 | | - 292, /* (268) trnm ::= nm DOT nm */ |
| 165829 | | - 293, /* (269) tridxby ::= INDEXED BY nm */ |
| 165830 | | - 293, /* (270) tridxby ::= NOT INDEXED */ |
| 165831 | | - 291, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 165832 | | - 291, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 165833 | | - 291, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 165834 | | - 291, /* (274) trigger_cmd ::= scanpt select scanpt */ |
| 165835 | | - 217, /* (275) expr ::= RAISE LP IGNORE RP */ |
| 165836 | | - 217, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 165837 | | - 236, /* (277) raisetype ::= ROLLBACK */ |
| 165838 | | - 236, /* (278) raisetype ::= ABORT */ |
| 165839 | | - 236, /* (279) raisetype ::= FAIL */ |
| 165840 | | - 190, /* (280) cmd ::= DROP TRIGGER ifexists fullname */ |
| 165841 | | - 190, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 165842 | | - 190, /* (282) cmd ::= DETACH database_kw_opt expr */ |
| 165843 | | - 295, /* (283) key_opt ::= */ |
| 165844 | | - 295, /* (284) key_opt ::= KEY expr */ |
| 165845 | | - 190, /* (285) cmd ::= REINDEX */ |
| 165846 | | - 190, /* (286) cmd ::= REINDEX nm dbnm */ |
| 165847 | | - 190, /* (287) cmd ::= ANALYZE */ |
| 165848 | | - 190, /* (288) cmd ::= ANALYZE nm dbnm */ |
| 165849 | | - 190, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 165850 | | - 190, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 165851 | | - 190, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 165852 | | - 296, /* (292) add_column_fullname ::= fullname */ |
| 165853 | | - 190, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 165854 | | - 190, /* (294) cmd ::= create_vtab */ |
| 165855 | | - 190, /* (295) cmd ::= create_vtab LP vtabarglist RP */ |
| 165856 | | - 298, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 165857 | | - 300, /* (297) vtabarg ::= */ |
| 165858 | | - 301, /* (298) vtabargtoken ::= ANY */ |
| 165859 | | - 301, /* (299) vtabargtoken ::= lp anylist RP */ |
| 165860 | | - 302, /* (300) lp ::= LP */ |
| 165861 | | - 266, /* (301) with ::= WITH wqlist */ |
| 165862 | | - 266, /* (302) with ::= WITH RECURSIVE wqlist */ |
| 165863 | | - 305, /* (303) wqas ::= AS */ |
| 165864 | | - 305, /* (304) wqas ::= AS MATERIALIZED */ |
| 165865 | | - 305, /* (305) wqas ::= AS NOT MATERIALIZED */ |
| 165866 | | - 304, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 165867 | | - 241, /* (307) wqlist ::= wqitem */ |
| 165868 | | - 241, /* (308) wqlist ::= wqlist COMMA wqitem */ |
| 165869 | | - 306, /* (309) windowdefn_list ::= windowdefn */ |
| 165870 | | - 306, /* (310) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 165871 | | - 307, /* (311) windowdefn ::= nm AS LP window RP */ |
| 165872 | | - 308, /* (312) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 165873 | | - 308, /* (313) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 165874 | | - 308, /* (314) window ::= ORDER BY sortlist frame_opt */ |
| 165875 | | - 308, /* (315) window ::= nm ORDER BY sortlist frame_opt */ |
| 165876 | | - 308, /* (316) window ::= frame_opt */ |
| 165877 | | - 308, /* (317) window ::= nm frame_opt */ |
| 165878 | | - 309, /* (318) frame_opt ::= */ |
| 165879 | | - 309, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 165880 | | - 309, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 165881 | | - 313, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 165882 | | - 315, /* (322) frame_bound_s ::= frame_bound */ |
| 165883 | | - 315, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 165884 | | - 316, /* (324) frame_bound_e ::= frame_bound */ |
| 165885 | | - 316, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 165886 | | - 314, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 165887 | | - 314, /* (327) frame_bound ::= CURRENT ROW */ |
| 165888 | | - 317, /* (328) frame_exclude_opt ::= */ |
| 165889 | | - 317, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 165890 | | - 318, /* (330) frame_exclude ::= NO OTHERS */ |
| 165891 | | - 318, /* (331) frame_exclude ::= CURRENT ROW */ |
| 165892 | | - 318, /* (332) frame_exclude ::= GROUP|TIES */ |
| 165893 | | - 251, /* (333) window_clause ::= WINDOW windowdefn_list */ |
| 165894 | | - 273, /* (334) filter_over ::= filter_clause over_clause */ |
| 165895 | | - 273, /* (335) filter_over ::= over_clause */ |
| 165896 | | - 273, /* (336) filter_over ::= filter_clause */ |
| 165897 | | - 312, /* (337) over_clause ::= OVER LP window RP */ |
| 165898 | | - 312, /* (338) over_clause ::= OVER nm */ |
| 165899 | | - 311, /* (339) filter_clause ::= FILTER LP WHERE expr RP */ |
| 165900 | | - 185, /* (340) input ::= cmdlist */ |
| 165901 | | - 186, /* (341) cmdlist ::= cmdlist ecmd */ |
| 165902 | | - 186, /* (342) cmdlist ::= ecmd */ |
| 165903 | | - 187, /* (343) ecmd ::= SEMI */ |
| 165904 | | - 187, /* (344) ecmd ::= cmdx SEMI */ |
| 165905 | | - 187, /* (345) ecmd ::= explain cmdx SEMI */ |
| 165906 | | - 192, /* (346) trans_opt ::= */ |
| 165907 | | - 192, /* (347) trans_opt ::= TRANSACTION */ |
| 165908 | | - 192, /* (348) trans_opt ::= TRANSACTION nm */ |
| 165909 | | - 194, /* (349) savepoint_opt ::= SAVEPOINT */ |
| 165910 | | - 194, /* (350) savepoint_opt ::= */ |
| 165911 | | - 190, /* (351) cmd ::= create_table create_table_args */ |
| 165912 | | - 203, /* (352) table_option_set ::= table_option */ |
| 165913 | | - 201, /* (353) columnlist ::= columnlist COMMA columnname carglist */ |
| 165914 | | - 201, /* (354) columnlist ::= columnname carglist */ |
| 165915 | | - 193, /* (355) nm ::= ID|INDEXED */ |
| 165916 | | - 193, /* (356) nm ::= STRING */ |
| 165917 | | - 193, /* (357) nm ::= JOIN_KW */ |
| 165918 | | - 208, /* (358) typetoken ::= typename */ |
| 165919 | | - 209, /* (359) typename ::= ID|STRING */ |
| 165920 | | - 210, /* (360) signed ::= plus_num */ |
| 165921 | | - 210, /* (361) signed ::= minus_num */ |
| 165922 | | - 207, /* (362) carglist ::= carglist ccons */ |
| 165923 | | - 207, /* (363) carglist ::= */ |
| 165924 | | - 215, /* (364) ccons ::= NULL onconf */ |
| 165925 | | - 215, /* (365) ccons ::= GENERATED ALWAYS AS generated */ |
| 165926 | | - 215, /* (366) ccons ::= AS generated */ |
| 165927 | | - 202, /* (367) conslist_opt ::= COMMA conslist */ |
| 165928 | | - 228, /* (368) conslist ::= conslist tconscomma tcons */ |
| 165929 | | - 228, /* (369) conslist ::= tcons */ |
| 165930 | | - 229, /* (370) tconscomma ::= */ |
| 165931 | | - 233, /* (371) defer_subclause_opt ::= defer_subclause */ |
| 165932 | | - 235, /* (372) resolvetype ::= raisetype */ |
| 165933 | | - 239, /* (373) selectnowith ::= oneselect */ |
| 165934 | | - 240, /* (374) oneselect ::= values */ |
| 165935 | | - 254, /* (375) sclp ::= selcollist COMMA */ |
| 165936 | | - 255, /* (376) as ::= ID|STRING */ |
| 165937 | | - 264, /* (377) indexed_opt ::= indexed_by */ |
| 165938 | | - 272, /* (378) returning ::= */ |
| 165939 | | - 217, /* (379) expr ::= term */ |
| 165940 | | - 274, /* (380) likeop ::= LIKE_KW|MATCH */ |
| 165941 | | - 261, /* (381) exprlist ::= nexprlist */ |
| 165942 | | - 284, /* (382) nmnum ::= plus_num */ |
| 165943 | | - 284, /* (383) nmnum ::= nm */ |
| 165944 | | - 284, /* (384) nmnum ::= ON */ |
| 165945 | | - 284, /* (385) nmnum ::= DELETE */ |
| 165946 | | - 284, /* (386) nmnum ::= DEFAULT */ |
| 165947 | | - 211, /* (387) plus_num ::= INTEGER|FLOAT */ |
| 165948 | | - 289, /* (388) foreach_clause ::= */ |
| 165949 | | - 289, /* (389) foreach_clause ::= FOR EACH ROW */ |
| 165950 | | - 292, /* (390) trnm ::= nm */ |
| 165951 | | - 293, /* (391) tridxby ::= */ |
| 165952 | | - 294, /* (392) database_kw_opt ::= DATABASE */ |
| 165953 | | - 294, /* (393) database_kw_opt ::= */ |
| 165954 | | - 297, /* (394) kwcolumn_opt ::= */ |
| 165955 | | - 297, /* (395) kwcolumn_opt ::= COLUMNKW */ |
| 165956 | | - 299, /* (396) vtabarglist ::= vtabarg */ |
| 165957 | | - 299, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 165958 | | - 300, /* (398) vtabarg ::= vtabarg vtabargtoken */ |
| 165959 | | - 303, /* (399) anylist ::= */ |
| 165960 | | - 303, /* (400) anylist ::= anylist LP anylist RP */ |
| 165961 | | - 303, /* (401) anylist ::= anylist ANY */ |
| 165962 | | - 266, /* (402) with ::= */ |
| 166186 | + 217, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */ |
| 166187 | + 217, /* (210) expr ::= expr IS DISTINCT FROM expr */ |
| 166188 | + 217, /* (211) expr ::= NOT expr */ |
| 166189 | + 217, /* (212) expr ::= BITNOT expr */ |
| 166190 | + 217, /* (213) expr ::= PLUS|MINUS expr */ |
| 166191 | + 217, /* (214) expr ::= expr PTR expr */ |
| 166192 | + 275, /* (215) between_op ::= BETWEEN */ |
| 166193 | + 275, /* (216) between_op ::= NOT BETWEEN */ |
| 166194 | + 217, /* (217) expr ::= expr between_op expr AND expr */ |
| 166195 | + 276, /* (218) in_op ::= IN */ |
| 166196 | + 276, /* (219) in_op ::= NOT IN */ |
| 166197 | + 217, /* (220) expr ::= expr in_op LP exprlist RP */ |
| 166198 | + 217, /* (221) expr ::= LP select RP */ |
| 166199 | + 217, /* (222) expr ::= expr in_op LP select RP */ |
| 166200 | + 217, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 166201 | + 217, /* (224) expr ::= EXISTS LP select RP */ |
| 166202 | + 217, /* (225) expr ::= CASE case_operand case_exprlist case_else END */ |
| 166203 | + 279, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 166204 | + 279, /* (227) case_exprlist ::= WHEN expr THEN expr */ |
| 166205 | + 280, /* (228) case_else ::= ELSE expr */ |
| 166206 | + 280, /* (229) case_else ::= */ |
| 166207 | + 278, /* (230) case_operand ::= expr */ |
| 166208 | + 278, /* (231) case_operand ::= */ |
| 166209 | + 261, /* (232) exprlist ::= */ |
| 166210 | + 253, /* (233) nexprlist ::= nexprlist COMMA expr */ |
| 166211 | + 253, /* (234) nexprlist ::= expr */ |
| 166212 | + 277, /* (235) paren_exprlist ::= */ |
| 166213 | + 277, /* (236) paren_exprlist ::= LP exprlist RP */ |
| 166214 | + 190, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 166215 | + 281, /* (238) uniqueflag ::= UNIQUE */ |
| 166216 | + 281, /* (239) uniqueflag ::= */ |
| 166217 | + 221, /* (240) eidlist_opt ::= */ |
| 166218 | + 221, /* (241) eidlist_opt ::= LP eidlist RP */ |
| 166219 | + 232, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 166220 | + 232, /* (243) eidlist ::= nm collate sortorder */ |
| 166221 | + 282, /* (244) collate ::= */ |
| 166222 | + 282, /* (245) collate ::= COLLATE ID|STRING */ |
| 166223 | + 190, /* (246) cmd ::= DROP INDEX ifexists fullname */ |
| 166224 | + 190, /* (247) cmd ::= VACUUM vinto */ |
| 166225 | + 190, /* (248) cmd ::= VACUUM nm vinto */ |
| 166226 | + 283, /* (249) vinto ::= INTO expr */ |
| 166227 | + 283, /* (250) vinto ::= */ |
| 166228 | + 190, /* (251) cmd ::= PRAGMA nm dbnm */ |
| 166229 | + 190, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 166230 | + 190, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 166231 | + 190, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 166232 | + 190, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 166233 | + 211, /* (256) plus_num ::= PLUS INTEGER|FLOAT */ |
| 166234 | + 212, /* (257) minus_num ::= MINUS INTEGER|FLOAT */ |
| 166235 | + 190, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 166236 | + 285, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 166237 | + 287, /* (260) trigger_time ::= BEFORE|AFTER */ |
| 166238 | + 287, /* (261) trigger_time ::= INSTEAD OF */ |
| 166239 | + 287, /* (262) trigger_time ::= */ |
| 166240 | + 288, /* (263) trigger_event ::= DELETE|INSERT */ |
| 166241 | + 288, /* (264) trigger_event ::= UPDATE */ |
| 166242 | + 288, /* (265) trigger_event ::= UPDATE OF idlist */ |
| 166243 | + 290, /* (266) when_clause ::= */ |
| 166244 | + 290, /* (267) when_clause ::= WHEN expr */ |
| 166245 | + 286, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 166246 | + 286, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 166247 | + 292, /* (270) trnm ::= nm DOT nm */ |
| 166248 | + 293, /* (271) tridxby ::= INDEXED BY nm */ |
| 166249 | + 293, /* (272) tridxby ::= NOT INDEXED */ |
| 166250 | + 291, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 166251 | + 291, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 166252 | + 291, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 166253 | + 291, /* (276) trigger_cmd ::= scanpt select scanpt */ |
| 166254 | + 217, /* (277) expr ::= RAISE LP IGNORE RP */ |
| 166255 | + 217, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 166256 | + 236, /* (279) raisetype ::= ROLLBACK */ |
| 166257 | + 236, /* (280) raisetype ::= ABORT */ |
| 166258 | + 236, /* (281) raisetype ::= FAIL */ |
| 166259 | + 190, /* (282) cmd ::= DROP TRIGGER ifexists fullname */ |
| 166260 | + 190, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 166261 | + 190, /* (284) cmd ::= DETACH database_kw_opt expr */ |
| 166262 | + 295, /* (285) key_opt ::= */ |
| 166263 | + 295, /* (286) key_opt ::= KEY expr */ |
| 166264 | + 190, /* (287) cmd ::= REINDEX */ |
| 166265 | + 190, /* (288) cmd ::= REINDEX nm dbnm */ |
| 166266 | + 190, /* (289) cmd ::= ANALYZE */ |
| 166267 | + 190, /* (290) cmd ::= ANALYZE nm dbnm */ |
| 166268 | + 190, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 166269 | + 190, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 166270 | + 190, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 166271 | + 296, /* (294) add_column_fullname ::= fullname */ |
| 166272 | + 190, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 166273 | + 190, /* (296) cmd ::= create_vtab */ |
| 166274 | + 190, /* (297) cmd ::= create_vtab LP vtabarglist RP */ |
| 166275 | + 298, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 166276 | + 300, /* (299) vtabarg ::= */ |
| 166277 | + 301, /* (300) vtabargtoken ::= ANY */ |
| 166278 | + 301, /* (301) vtabargtoken ::= lp anylist RP */ |
| 166279 | + 302, /* (302) lp ::= LP */ |
| 166280 | + 266, /* (303) with ::= WITH wqlist */ |
| 166281 | + 266, /* (304) with ::= WITH RECURSIVE wqlist */ |
| 166282 | + 305, /* (305) wqas ::= AS */ |
| 166283 | + 305, /* (306) wqas ::= AS MATERIALIZED */ |
| 166284 | + 305, /* (307) wqas ::= AS NOT MATERIALIZED */ |
| 166285 | + 304, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 166286 | + 241, /* (309) wqlist ::= wqitem */ |
| 166287 | + 241, /* (310) wqlist ::= wqlist COMMA wqitem */ |
| 166288 | + 306, /* (311) windowdefn_list ::= windowdefn */ |
| 166289 | + 306, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 166290 | + 307, /* (313) windowdefn ::= nm AS LP window RP */ |
| 166291 | + 308, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 166292 | + 308, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 166293 | + 308, /* (316) window ::= ORDER BY sortlist frame_opt */ |
| 166294 | + 308, /* (317) window ::= nm ORDER BY sortlist frame_opt */ |
| 166295 | + 308, /* (318) window ::= frame_opt */ |
| 166296 | + 308, /* (319) window ::= nm frame_opt */ |
| 166297 | + 309, /* (320) frame_opt ::= */ |
| 166298 | + 309, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 166299 | + 309, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 166300 | + 313, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 166301 | + 315, /* (324) frame_bound_s ::= frame_bound */ |
| 166302 | + 315, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 166303 | + 316, /* (326) frame_bound_e ::= frame_bound */ |
| 166304 | + 316, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 166305 | + 314, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 166306 | + 314, /* (329) frame_bound ::= CURRENT ROW */ |
| 166307 | + 317, /* (330) frame_exclude_opt ::= */ |
| 166308 | + 317, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 166309 | + 318, /* (332) frame_exclude ::= NO OTHERS */ |
| 166310 | + 318, /* (333) frame_exclude ::= CURRENT ROW */ |
| 166311 | + 318, /* (334) frame_exclude ::= GROUP|TIES */ |
| 166312 | + 251, /* (335) window_clause ::= WINDOW windowdefn_list */ |
| 166313 | + 273, /* (336) filter_over ::= filter_clause over_clause */ |
| 166314 | + 273, /* (337) filter_over ::= over_clause */ |
| 166315 | + 273, /* (338) filter_over ::= filter_clause */ |
| 166316 | + 312, /* (339) over_clause ::= OVER LP window RP */ |
| 166317 | + 312, /* (340) over_clause ::= OVER nm */ |
| 166318 | + 311, /* (341) filter_clause ::= FILTER LP WHERE expr RP */ |
| 166319 | + 185, /* (342) input ::= cmdlist */ |
| 166320 | + 186, /* (343) cmdlist ::= cmdlist ecmd */ |
| 166321 | + 186, /* (344) cmdlist ::= ecmd */ |
| 166322 | + 187, /* (345) ecmd ::= SEMI */ |
| 166323 | + 187, /* (346) ecmd ::= cmdx SEMI */ |
| 166324 | + 187, /* (347) ecmd ::= explain cmdx SEMI */ |
| 166325 | + 192, /* (348) trans_opt ::= */ |
| 166326 | + 192, /* (349) trans_opt ::= TRANSACTION */ |
| 166327 | + 192, /* (350) trans_opt ::= TRANSACTION nm */ |
| 166328 | + 194, /* (351) savepoint_opt ::= SAVEPOINT */ |
| 166329 | + 194, /* (352) savepoint_opt ::= */ |
| 166330 | + 190, /* (353) cmd ::= create_table create_table_args */ |
| 166331 | + 203, /* (354) table_option_set ::= table_option */ |
| 166332 | + 201, /* (355) columnlist ::= columnlist COMMA columnname carglist */ |
| 166333 | + 201, /* (356) columnlist ::= columnname carglist */ |
| 166334 | + 193, /* (357) nm ::= ID|INDEXED */ |
| 166335 | + 193, /* (358) nm ::= STRING */ |
| 166336 | + 193, /* (359) nm ::= JOIN_KW */ |
| 166337 | + 208, /* (360) typetoken ::= typename */ |
| 166338 | + 209, /* (361) typename ::= ID|STRING */ |
| 166339 | + 210, /* (362) signed ::= plus_num */ |
| 166340 | + 210, /* (363) signed ::= minus_num */ |
| 166341 | + 207, /* (364) carglist ::= carglist ccons */ |
| 166342 | + 207, /* (365) carglist ::= */ |
| 166343 | + 215, /* (366) ccons ::= NULL onconf */ |
| 166344 | + 215, /* (367) ccons ::= GENERATED ALWAYS AS generated */ |
| 166345 | + 215, /* (368) ccons ::= AS generated */ |
| 166346 | + 202, /* (369) conslist_opt ::= COMMA conslist */ |
| 166347 | + 228, /* (370) conslist ::= conslist tconscomma tcons */ |
| 166348 | + 228, /* (371) conslist ::= tcons */ |
| 166349 | + 229, /* (372) tconscomma ::= */ |
| 166350 | + 233, /* (373) defer_subclause_opt ::= defer_subclause */ |
| 166351 | + 235, /* (374) resolvetype ::= raisetype */ |
| 166352 | + 239, /* (375) selectnowith ::= oneselect */ |
| 166353 | + 240, /* (376) oneselect ::= values */ |
| 166354 | + 254, /* (377) sclp ::= selcollist COMMA */ |
| 166355 | + 255, /* (378) as ::= ID|STRING */ |
| 166356 | + 264, /* (379) indexed_opt ::= indexed_by */ |
| 166357 | + 272, /* (380) returning ::= */ |
| 166358 | + 217, /* (381) expr ::= term */ |
| 166359 | + 274, /* (382) likeop ::= LIKE_KW|MATCH */ |
| 166360 | + 261, /* (383) exprlist ::= nexprlist */ |
| 166361 | + 284, /* (384) nmnum ::= plus_num */ |
| 166362 | + 284, /* (385) nmnum ::= nm */ |
| 166363 | + 284, /* (386) nmnum ::= ON */ |
| 166364 | + 284, /* (387) nmnum ::= DELETE */ |
| 166365 | + 284, /* (388) nmnum ::= DEFAULT */ |
| 166366 | + 211, /* (389) plus_num ::= INTEGER|FLOAT */ |
| 166367 | + 289, /* (390) foreach_clause ::= */ |
| 166368 | + 289, /* (391) foreach_clause ::= FOR EACH ROW */ |
| 166369 | + 292, /* (392) trnm ::= nm */ |
| 166370 | + 293, /* (393) tridxby ::= */ |
| 166371 | + 294, /* (394) database_kw_opt ::= DATABASE */ |
| 166372 | + 294, /* (395) database_kw_opt ::= */ |
| 166373 | + 297, /* (396) kwcolumn_opt ::= */ |
| 166374 | + 297, /* (397) kwcolumn_opt ::= COLUMNKW */ |
| 166375 | + 299, /* (398) vtabarglist ::= vtabarg */ |
| 166376 | + 299, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 166377 | + 300, /* (400) vtabarg ::= vtabarg vtabargtoken */ |
| 166378 | + 303, /* (401) anylist ::= */ |
| 166379 | + 303, /* (402) anylist ::= anylist LP anylist RP */ |
| 166380 | + 303, /* (403) anylist ::= anylist ANY */ |
| 166381 | + 266, /* (404) with ::= */ |
| 165963 | 166382 | }; |
| 165964 | 166383 | |
| 165965 | 166384 | /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number |
| 165966 | 166385 | ** of symbols on the right-hand side of that rule. */ |
| 165967 | 166386 | static const signed char yyRuleInfoNRhs[] = { |
| | @@ -166172,204 +166591,206 @@ |
| 166172 | 166591 | -5, /* (204) expr ::= expr likeop expr ESCAPE expr */ |
| 166173 | 166592 | -2, /* (205) expr ::= expr ISNULL|NOTNULL */ |
| 166174 | 166593 | -3, /* (206) expr ::= expr NOT NULL */ |
| 166175 | 166594 | -3, /* (207) expr ::= expr IS expr */ |
| 166176 | 166595 | -4, /* (208) expr ::= expr IS NOT expr */ |
| 166177 | | - -2, /* (209) expr ::= NOT expr */ |
| 166178 | | - -2, /* (210) expr ::= BITNOT expr */ |
| 166179 | | - -2, /* (211) expr ::= PLUS|MINUS expr */ |
| 166180 | | - -3, /* (212) expr ::= expr PTR expr */ |
| 166181 | | - -1, /* (213) between_op ::= BETWEEN */ |
| 166182 | | - -2, /* (214) between_op ::= NOT BETWEEN */ |
| 166183 | | - -5, /* (215) expr ::= expr between_op expr AND expr */ |
| 166184 | | - -1, /* (216) in_op ::= IN */ |
| 166185 | | - -2, /* (217) in_op ::= NOT IN */ |
| 166186 | | - -5, /* (218) expr ::= expr in_op LP exprlist RP */ |
| 166187 | | - -3, /* (219) expr ::= LP select RP */ |
| 166188 | | - -5, /* (220) expr ::= expr in_op LP select RP */ |
| 166189 | | - -5, /* (221) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 166190 | | - -4, /* (222) expr ::= EXISTS LP select RP */ |
| 166191 | | - -5, /* (223) expr ::= CASE case_operand case_exprlist case_else END */ |
| 166192 | | - -5, /* (224) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 166193 | | - -4, /* (225) case_exprlist ::= WHEN expr THEN expr */ |
| 166194 | | - -2, /* (226) case_else ::= ELSE expr */ |
| 166195 | | - 0, /* (227) case_else ::= */ |
| 166196 | | - -1, /* (228) case_operand ::= expr */ |
| 166197 | | - 0, /* (229) case_operand ::= */ |
| 166198 | | - 0, /* (230) exprlist ::= */ |
| 166199 | | - -3, /* (231) nexprlist ::= nexprlist COMMA expr */ |
| 166200 | | - -1, /* (232) nexprlist ::= expr */ |
| 166201 | | - 0, /* (233) paren_exprlist ::= */ |
| 166202 | | - -3, /* (234) paren_exprlist ::= LP exprlist RP */ |
| 166203 | | - -12, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 166204 | | - -1, /* (236) uniqueflag ::= UNIQUE */ |
| 166205 | | - 0, /* (237) uniqueflag ::= */ |
| 166206 | | - 0, /* (238) eidlist_opt ::= */ |
| 166207 | | - -3, /* (239) eidlist_opt ::= LP eidlist RP */ |
| 166208 | | - -5, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 166209 | | - -3, /* (241) eidlist ::= nm collate sortorder */ |
| 166210 | | - 0, /* (242) collate ::= */ |
| 166211 | | - -2, /* (243) collate ::= COLLATE ID|STRING */ |
| 166212 | | - -4, /* (244) cmd ::= DROP INDEX ifexists fullname */ |
| 166213 | | - -2, /* (245) cmd ::= VACUUM vinto */ |
| 166214 | | - -3, /* (246) cmd ::= VACUUM nm vinto */ |
| 166215 | | - -2, /* (247) vinto ::= INTO expr */ |
| 166216 | | - 0, /* (248) vinto ::= */ |
| 166217 | | - -3, /* (249) cmd ::= PRAGMA nm dbnm */ |
| 166218 | | - -5, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 166219 | | - -6, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 166220 | | - -5, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 166221 | | - -6, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 166222 | | - -2, /* (254) plus_num ::= PLUS INTEGER|FLOAT */ |
| 166223 | | - -2, /* (255) minus_num ::= MINUS INTEGER|FLOAT */ |
| 166224 | | - -5, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 166225 | | - -11, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 166226 | | - -1, /* (258) trigger_time ::= BEFORE|AFTER */ |
| 166227 | | - -2, /* (259) trigger_time ::= INSTEAD OF */ |
| 166228 | | - 0, /* (260) trigger_time ::= */ |
| 166229 | | - -1, /* (261) trigger_event ::= DELETE|INSERT */ |
| 166230 | | - -1, /* (262) trigger_event ::= UPDATE */ |
| 166231 | | - -3, /* (263) trigger_event ::= UPDATE OF idlist */ |
| 166232 | | - 0, /* (264) when_clause ::= */ |
| 166233 | | - -2, /* (265) when_clause ::= WHEN expr */ |
| 166234 | | - -3, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 166235 | | - -2, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 166236 | | - -3, /* (268) trnm ::= nm DOT nm */ |
| 166237 | | - -3, /* (269) tridxby ::= INDEXED BY nm */ |
| 166238 | | - -2, /* (270) tridxby ::= NOT INDEXED */ |
| 166239 | | - -9, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 166240 | | - -8, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 166241 | | - -6, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 166242 | | - -3, /* (274) trigger_cmd ::= scanpt select scanpt */ |
| 166243 | | - -4, /* (275) expr ::= RAISE LP IGNORE RP */ |
| 166244 | | - -6, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 166245 | | - -1, /* (277) raisetype ::= ROLLBACK */ |
| 166246 | | - -1, /* (278) raisetype ::= ABORT */ |
| 166247 | | - -1, /* (279) raisetype ::= FAIL */ |
| 166248 | | - -4, /* (280) cmd ::= DROP TRIGGER ifexists fullname */ |
| 166249 | | - -6, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 166250 | | - -3, /* (282) cmd ::= DETACH database_kw_opt expr */ |
| 166251 | | - 0, /* (283) key_opt ::= */ |
| 166252 | | - -2, /* (284) key_opt ::= KEY expr */ |
| 166253 | | - -1, /* (285) cmd ::= REINDEX */ |
| 166254 | | - -3, /* (286) cmd ::= REINDEX nm dbnm */ |
| 166255 | | - -1, /* (287) cmd ::= ANALYZE */ |
| 166256 | | - -3, /* (288) cmd ::= ANALYZE nm dbnm */ |
| 166257 | | - -6, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 166258 | | - -7, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 166259 | | - -6, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 166260 | | - -1, /* (292) add_column_fullname ::= fullname */ |
| 166261 | | - -8, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 166262 | | - -1, /* (294) cmd ::= create_vtab */ |
| 166263 | | - -4, /* (295) cmd ::= create_vtab LP vtabarglist RP */ |
| 166264 | | - -8, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 166265 | | - 0, /* (297) vtabarg ::= */ |
| 166266 | | - -1, /* (298) vtabargtoken ::= ANY */ |
| 166267 | | - -3, /* (299) vtabargtoken ::= lp anylist RP */ |
| 166268 | | - -1, /* (300) lp ::= LP */ |
| 166269 | | - -2, /* (301) with ::= WITH wqlist */ |
| 166270 | | - -3, /* (302) with ::= WITH RECURSIVE wqlist */ |
| 166271 | | - -1, /* (303) wqas ::= AS */ |
| 166272 | | - -2, /* (304) wqas ::= AS MATERIALIZED */ |
| 166273 | | - -3, /* (305) wqas ::= AS NOT MATERIALIZED */ |
| 166274 | | - -6, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 166275 | | - -1, /* (307) wqlist ::= wqitem */ |
| 166276 | | - -3, /* (308) wqlist ::= wqlist COMMA wqitem */ |
| 166277 | | - -1, /* (309) windowdefn_list ::= windowdefn */ |
| 166278 | | - -3, /* (310) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 166279 | | - -5, /* (311) windowdefn ::= nm AS LP window RP */ |
| 166280 | | - -5, /* (312) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 166281 | | - -6, /* (313) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 166282 | | - -4, /* (314) window ::= ORDER BY sortlist frame_opt */ |
| 166283 | | - -5, /* (315) window ::= nm ORDER BY sortlist frame_opt */ |
| 166284 | | - -1, /* (316) window ::= frame_opt */ |
| 166285 | | - -2, /* (317) window ::= nm frame_opt */ |
| 166286 | | - 0, /* (318) frame_opt ::= */ |
| 166287 | | - -3, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 166288 | | - -6, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 166289 | | - -1, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 166290 | | - -1, /* (322) frame_bound_s ::= frame_bound */ |
| 166291 | | - -2, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 166292 | | - -1, /* (324) frame_bound_e ::= frame_bound */ |
| 166293 | | - -2, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 166294 | | - -2, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 166295 | | - -2, /* (327) frame_bound ::= CURRENT ROW */ |
| 166296 | | - 0, /* (328) frame_exclude_opt ::= */ |
| 166297 | | - -2, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 166298 | | - -2, /* (330) frame_exclude ::= NO OTHERS */ |
| 166299 | | - -2, /* (331) frame_exclude ::= CURRENT ROW */ |
| 166300 | | - -1, /* (332) frame_exclude ::= GROUP|TIES */ |
| 166301 | | - -2, /* (333) window_clause ::= WINDOW windowdefn_list */ |
| 166302 | | - -2, /* (334) filter_over ::= filter_clause over_clause */ |
| 166303 | | - -1, /* (335) filter_over ::= over_clause */ |
| 166304 | | - -1, /* (336) filter_over ::= filter_clause */ |
| 166305 | | - -4, /* (337) over_clause ::= OVER LP window RP */ |
| 166306 | | - -2, /* (338) over_clause ::= OVER nm */ |
| 166307 | | - -5, /* (339) filter_clause ::= FILTER LP WHERE expr RP */ |
| 166308 | | - -1, /* (340) input ::= cmdlist */ |
| 166309 | | - -2, /* (341) cmdlist ::= cmdlist ecmd */ |
| 166310 | | - -1, /* (342) cmdlist ::= ecmd */ |
| 166311 | | - -1, /* (343) ecmd ::= SEMI */ |
| 166312 | | - -2, /* (344) ecmd ::= cmdx SEMI */ |
| 166313 | | - -3, /* (345) ecmd ::= explain cmdx SEMI */ |
| 166314 | | - 0, /* (346) trans_opt ::= */ |
| 166315 | | - -1, /* (347) trans_opt ::= TRANSACTION */ |
| 166316 | | - -2, /* (348) trans_opt ::= TRANSACTION nm */ |
| 166317 | | - -1, /* (349) savepoint_opt ::= SAVEPOINT */ |
| 166318 | | - 0, /* (350) savepoint_opt ::= */ |
| 166319 | | - -2, /* (351) cmd ::= create_table create_table_args */ |
| 166320 | | - -1, /* (352) table_option_set ::= table_option */ |
| 166321 | | - -4, /* (353) columnlist ::= columnlist COMMA columnname carglist */ |
| 166322 | | - -2, /* (354) columnlist ::= columnname carglist */ |
| 166323 | | - -1, /* (355) nm ::= ID|INDEXED */ |
| 166324 | | - -1, /* (356) nm ::= STRING */ |
| 166325 | | - -1, /* (357) nm ::= JOIN_KW */ |
| 166326 | | - -1, /* (358) typetoken ::= typename */ |
| 166327 | | - -1, /* (359) typename ::= ID|STRING */ |
| 166328 | | - -1, /* (360) signed ::= plus_num */ |
| 166329 | | - -1, /* (361) signed ::= minus_num */ |
| 166330 | | - -2, /* (362) carglist ::= carglist ccons */ |
| 166331 | | - 0, /* (363) carglist ::= */ |
| 166332 | | - -2, /* (364) ccons ::= NULL onconf */ |
| 166333 | | - -4, /* (365) ccons ::= GENERATED ALWAYS AS generated */ |
| 166334 | | - -2, /* (366) ccons ::= AS generated */ |
| 166335 | | - -2, /* (367) conslist_opt ::= COMMA conslist */ |
| 166336 | | - -3, /* (368) conslist ::= conslist tconscomma tcons */ |
| 166337 | | - -1, /* (369) conslist ::= tcons */ |
| 166338 | | - 0, /* (370) tconscomma ::= */ |
| 166339 | | - -1, /* (371) defer_subclause_opt ::= defer_subclause */ |
| 166340 | | - -1, /* (372) resolvetype ::= raisetype */ |
| 166341 | | - -1, /* (373) selectnowith ::= oneselect */ |
| 166342 | | - -1, /* (374) oneselect ::= values */ |
| 166343 | | - -2, /* (375) sclp ::= selcollist COMMA */ |
| 166344 | | - -1, /* (376) as ::= ID|STRING */ |
| 166345 | | - -1, /* (377) indexed_opt ::= indexed_by */ |
| 166346 | | - 0, /* (378) returning ::= */ |
| 166347 | | - -1, /* (379) expr ::= term */ |
| 166348 | | - -1, /* (380) likeop ::= LIKE_KW|MATCH */ |
| 166349 | | - -1, /* (381) exprlist ::= nexprlist */ |
| 166350 | | - -1, /* (382) nmnum ::= plus_num */ |
| 166351 | | - -1, /* (383) nmnum ::= nm */ |
| 166352 | | - -1, /* (384) nmnum ::= ON */ |
| 166353 | | - -1, /* (385) nmnum ::= DELETE */ |
| 166354 | | - -1, /* (386) nmnum ::= DEFAULT */ |
| 166355 | | - -1, /* (387) plus_num ::= INTEGER|FLOAT */ |
| 166356 | | - 0, /* (388) foreach_clause ::= */ |
| 166357 | | - -3, /* (389) foreach_clause ::= FOR EACH ROW */ |
| 166358 | | - -1, /* (390) trnm ::= nm */ |
| 166359 | | - 0, /* (391) tridxby ::= */ |
| 166360 | | - -1, /* (392) database_kw_opt ::= DATABASE */ |
| 166361 | | - 0, /* (393) database_kw_opt ::= */ |
| 166362 | | - 0, /* (394) kwcolumn_opt ::= */ |
| 166363 | | - -1, /* (395) kwcolumn_opt ::= COLUMNKW */ |
| 166364 | | - -1, /* (396) vtabarglist ::= vtabarg */ |
| 166365 | | - -3, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 166366 | | - -2, /* (398) vtabarg ::= vtabarg vtabargtoken */ |
| 166367 | | - 0, /* (399) anylist ::= */ |
| 166368 | | - -4, /* (400) anylist ::= anylist LP anylist RP */ |
| 166369 | | - -2, /* (401) anylist ::= anylist ANY */ |
| 166370 | | - 0, /* (402) with ::= */ |
| 166596 | + -6, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */ |
| 166597 | + -5, /* (210) expr ::= expr IS DISTINCT FROM expr */ |
| 166598 | + -2, /* (211) expr ::= NOT expr */ |
| 166599 | + -2, /* (212) expr ::= BITNOT expr */ |
| 166600 | + -2, /* (213) expr ::= PLUS|MINUS expr */ |
| 166601 | + -3, /* (214) expr ::= expr PTR expr */ |
| 166602 | + -1, /* (215) between_op ::= BETWEEN */ |
| 166603 | + -2, /* (216) between_op ::= NOT BETWEEN */ |
| 166604 | + -5, /* (217) expr ::= expr between_op expr AND expr */ |
| 166605 | + -1, /* (218) in_op ::= IN */ |
| 166606 | + -2, /* (219) in_op ::= NOT IN */ |
| 166607 | + -5, /* (220) expr ::= expr in_op LP exprlist RP */ |
| 166608 | + -3, /* (221) expr ::= LP select RP */ |
| 166609 | + -5, /* (222) expr ::= expr in_op LP select RP */ |
| 166610 | + -5, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 166611 | + -4, /* (224) expr ::= EXISTS LP select RP */ |
| 166612 | + -5, /* (225) expr ::= CASE case_operand case_exprlist case_else END */ |
| 166613 | + -5, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 166614 | + -4, /* (227) case_exprlist ::= WHEN expr THEN expr */ |
| 166615 | + -2, /* (228) case_else ::= ELSE expr */ |
| 166616 | + 0, /* (229) case_else ::= */ |
| 166617 | + -1, /* (230) case_operand ::= expr */ |
| 166618 | + 0, /* (231) case_operand ::= */ |
| 166619 | + 0, /* (232) exprlist ::= */ |
| 166620 | + -3, /* (233) nexprlist ::= nexprlist COMMA expr */ |
| 166621 | + -1, /* (234) nexprlist ::= expr */ |
| 166622 | + 0, /* (235) paren_exprlist ::= */ |
| 166623 | + -3, /* (236) paren_exprlist ::= LP exprlist RP */ |
| 166624 | + -12, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 166625 | + -1, /* (238) uniqueflag ::= UNIQUE */ |
| 166626 | + 0, /* (239) uniqueflag ::= */ |
| 166627 | + 0, /* (240) eidlist_opt ::= */ |
| 166628 | + -3, /* (241) eidlist_opt ::= LP eidlist RP */ |
| 166629 | + -5, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 166630 | + -3, /* (243) eidlist ::= nm collate sortorder */ |
| 166631 | + 0, /* (244) collate ::= */ |
| 166632 | + -2, /* (245) collate ::= COLLATE ID|STRING */ |
| 166633 | + -4, /* (246) cmd ::= DROP INDEX ifexists fullname */ |
| 166634 | + -2, /* (247) cmd ::= VACUUM vinto */ |
| 166635 | + -3, /* (248) cmd ::= VACUUM nm vinto */ |
| 166636 | + -2, /* (249) vinto ::= INTO expr */ |
| 166637 | + 0, /* (250) vinto ::= */ |
| 166638 | + -3, /* (251) cmd ::= PRAGMA nm dbnm */ |
| 166639 | + -5, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 166640 | + -6, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 166641 | + -5, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 166642 | + -6, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 166643 | + -2, /* (256) plus_num ::= PLUS INTEGER|FLOAT */ |
| 166644 | + -2, /* (257) minus_num ::= MINUS INTEGER|FLOAT */ |
| 166645 | + -5, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 166646 | + -11, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 166647 | + -1, /* (260) trigger_time ::= BEFORE|AFTER */ |
| 166648 | + -2, /* (261) trigger_time ::= INSTEAD OF */ |
| 166649 | + 0, /* (262) trigger_time ::= */ |
| 166650 | + -1, /* (263) trigger_event ::= DELETE|INSERT */ |
| 166651 | + -1, /* (264) trigger_event ::= UPDATE */ |
| 166652 | + -3, /* (265) trigger_event ::= UPDATE OF idlist */ |
| 166653 | + 0, /* (266) when_clause ::= */ |
| 166654 | + -2, /* (267) when_clause ::= WHEN expr */ |
| 166655 | + -3, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 166656 | + -2, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 166657 | + -3, /* (270) trnm ::= nm DOT nm */ |
| 166658 | + -3, /* (271) tridxby ::= INDEXED BY nm */ |
| 166659 | + -2, /* (272) tridxby ::= NOT INDEXED */ |
| 166660 | + -9, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 166661 | + -8, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 166662 | + -6, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 166663 | + -3, /* (276) trigger_cmd ::= scanpt select scanpt */ |
| 166664 | + -4, /* (277) expr ::= RAISE LP IGNORE RP */ |
| 166665 | + -6, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 166666 | + -1, /* (279) raisetype ::= ROLLBACK */ |
| 166667 | + -1, /* (280) raisetype ::= ABORT */ |
| 166668 | + -1, /* (281) raisetype ::= FAIL */ |
| 166669 | + -4, /* (282) cmd ::= DROP TRIGGER ifexists fullname */ |
| 166670 | + -6, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 166671 | + -3, /* (284) cmd ::= DETACH database_kw_opt expr */ |
| 166672 | + 0, /* (285) key_opt ::= */ |
| 166673 | + -2, /* (286) key_opt ::= KEY expr */ |
| 166674 | + -1, /* (287) cmd ::= REINDEX */ |
| 166675 | + -3, /* (288) cmd ::= REINDEX nm dbnm */ |
| 166676 | + -1, /* (289) cmd ::= ANALYZE */ |
| 166677 | + -3, /* (290) cmd ::= ANALYZE nm dbnm */ |
| 166678 | + -6, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 166679 | + -7, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 166680 | + -6, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 166681 | + -1, /* (294) add_column_fullname ::= fullname */ |
| 166682 | + -8, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 166683 | + -1, /* (296) cmd ::= create_vtab */ |
| 166684 | + -4, /* (297) cmd ::= create_vtab LP vtabarglist RP */ |
| 166685 | + -8, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 166686 | + 0, /* (299) vtabarg ::= */ |
| 166687 | + -1, /* (300) vtabargtoken ::= ANY */ |
| 166688 | + -3, /* (301) vtabargtoken ::= lp anylist RP */ |
| 166689 | + -1, /* (302) lp ::= LP */ |
| 166690 | + -2, /* (303) with ::= WITH wqlist */ |
| 166691 | + -3, /* (304) with ::= WITH RECURSIVE wqlist */ |
| 166692 | + -1, /* (305) wqas ::= AS */ |
| 166693 | + -2, /* (306) wqas ::= AS MATERIALIZED */ |
| 166694 | + -3, /* (307) wqas ::= AS NOT MATERIALIZED */ |
| 166695 | + -6, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 166696 | + -1, /* (309) wqlist ::= wqitem */ |
| 166697 | + -3, /* (310) wqlist ::= wqlist COMMA wqitem */ |
| 166698 | + -1, /* (311) windowdefn_list ::= windowdefn */ |
| 166699 | + -3, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 166700 | + -5, /* (313) windowdefn ::= nm AS LP window RP */ |
| 166701 | + -5, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 166702 | + -6, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 166703 | + -4, /* (316) window ::= ORDER BY sortlist frame_opt */ |
| 166704 | + -5, /* (317) window ::= nm ORDER BY sortlist frame_opt */ |
| 166705 | + -1, /* (318) window ::= frame_opt */ |
| 166706 | + -2, /* (319) window ::= nm frame_opt */ |
| 166707 | + 0, /* (320) frame_opt ::= */ |
| 166708 | + -3, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 166709 | + -6, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 166710 | + -1, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 166711 | + -1, /* (324) frame_bound_s ::= frame_bound */ |
| 166712 | + -2, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 166713 | + -1, /* (326) frame_bound_e ::= frame_bound */ |
| 166714 | + -2, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 166715 | + -2, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 166716 | + -2, /* (329) frame_bound ::= CURRENT ROW */ |
| 166717 | + 0, /* (330) frame_exclude_opt ::= */ |
| 166718 | + -2, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 166719 | + -2, /* (332) frame_exclude ::= NO OTHERS */ |
| 166720 | + -2, /* (333) frame_exclude ::= CURRENT ROW */ |
| 166721 | + -1, /* (334) frame_exclude ::= GROUP|TIES */ |
| 166722 | + -2, /* (335) window_clause ::= WINDOW windowdefn_list */ |
| 166723 | + -2, /* (336) filter_over ::= filter_clause over_clause */ |
| 166724 | + -1, /* (337) filter_over ::= over_clause */ |
| 166725 | + -1, /* (338) filter_over ::= filter_clause */ |
| 166726 | + -4, /* (339) over_clause ::= OVER LP window RP */ |
| 166727 | + -2, /* (340) over_clause ::= OVER nm */ |
| 166728 | + -5, /* (341) filter_clause ::= FILTER LP WHERE expr RP */ |
| 166729 | + -1, /* (342) input ::= cmdlist */ |
| 166730 | + -2, /* (343) cmdlist ::= cmdlist ecmd */ |
| 166731 | + -1, /* (344) cmdlist ::= ecmd */ |
| 166732 | + -1, /* (345) ecmd ::= SEMI */ |
| 166733 | + -2, /* (346) ecmd ::= cmdx SEMI */ |
| 166734 | + -3, /* (347) ecmd ::= explain cmdx SEMI */ |
| 166735 | + 0, /* (348) trans_opt ::= */ |
| 166736 | + -1, /* (349) trans_opt ::= TRANSACTION */ |
| 166737 | + -2, /* (350) trans_opt ::= TRANSACTION nm */ |
| 166738 | + -1, /* (351) savepoint_opt ::= SAVEPOINT */ |
| 166739 | + 0, /* (352) savepoint_opt ::= */ |
| 166740 | + -2, /* (353) cmd ::= create_table create_table_args */ |
| 166741 | + -1, /* (354) table_option_set ::= table_option */ |
| 166742 | + -4, /* (355) columnlist ::= columnlist COMMA columnname carglist */ |
| 166743 | + -2, /* (356) columnlist ::= columnname carglist */ |
| 166744 | + -1, /* (357) nm ::= ID|INDEXED */ |
| 166745 | + -1, /* (358) nm ::= STRING */ |
| 166746 | + -1, /* (359) nm ::= JOIN_KW */ |
| 166747 | + -1, /* (360) typetoken ::= typename */ |
| 166748 | + -1, /* (361) typename ::= ID|STRING */ |
| 166749 | + -1, /* (362) signed ::= plus_num */ |
| 166750 | + -1, /* (363) signed ::= minus_num */ |
| 166751 | + -2, /* (364) carglist ::= carglist ccons */ |
| 166752 | + 0, /* (365) carglist ::= */ |
| 166753 | + -2, /* (366) ccons ::= NULL onconf */ |
| 166754 | + -4, /* (367) ccons ::= GENERATED ALWAYS AS generated */ |
| 166755 | + -2, /* (368) ccons ::= AS generated */ |
| 166756 | + -2, /* (369) conslist_opt ::= COMMA conslist */ |
| 166757 | + -3, /* (370) conslist ::= conslist tconscomma tcons */ |
| 166758 | + -1, /* (371) conslist ::= tcons */ |
| 166759 | + 0, /* (372) tconscomma ::= */ |
| 166760 | + -1, /* (373) defer_subclause_opt ::= defer_subclause */ |
| 166761 | + -1, /* (374) resolvetype ::= raisetype */ |
| 166762 | + -1, /* (375) selectnowith ::= oneselect */ |
| 166763 | + -1, /* (376) oneselect ::= values */ |
| 166764 | + -2, /* (377) sclp ::= selcollist COMMA */ |
| 166765 | + -1, /* (378) as ::= ID|STRING */ |
| 166766 | + -1, /* (379) indexed_opt ::= indexed_by */ |
| 166767 | + 0, /* (380) returning ::= */ |
| 166768 | + -1, /* (381) expr ::= term */ |
| 166769 | + -1, /* (382) likeop ::= LIKE_KW|MATCH */ |
| 166770 | + -1, /* (383) exprlist ::= nexprlist */ |
| 166771 | + -1, /* (384) nmnum ::= plus_num */ |
| 166772 | + -1, /* (385) nmnum ::= nm */ |
| 166773 | + -1, /* (386) nmnum ::= ON */ |
| 166774 | + -1, /* (387) nmnum ::= DELETE */ |
| 166775 | + -1, /* (388) nmnum ::= DEFAULT */ |
| 166776 | + -1, /* (389) plus_num ::= INTEGER|FLOAT */ |
| 166777 | + 0, /* (390) foreach_clause ::= */ |
| 166778 | + -3, /* (391) foreach_clause ::= FOR EACH ROW */ |
| 166779 | + -1, /* (392) trnm ::= nm */ |
| 166780 | + 0, /* (393) tridxby ::= */ |
| 166781 | + -1, /* (394) database_kw_opt ::= DATABASE */ |
| 166782 | + 0, /* (395) database_kw_opt ::= */ |
| 166783 | + 0, /* (396) kwcolumn_opt ::= */ |
| 166784 | + -1, /* (397) kwcolumn_opt ::= COLUMNKW */ |
| 166785 | + -1, /* (398) vtabarglist ::= vtabarg */ |
| 166786 | + -3, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 166787 | + -2, /* (400) vtabarg ::= vtabarg vtabargtoken */ |
| 166788 | + 0, /* (401) anylist ::= */ |
| 166789 | + -4, /* (402) anylist ::= anylist LP anylist RP */ |
| 166790 | + -2, /* (403) anylist ::= anylist ANY */ |
| 166791 | + 0, /* (404) with ::= */ |
| 166371 | 166792 | }; |
| 166372 | 166793 | |
| 166373 | 166794 | static void yy_accept(yyParser*); /* Forward Declaration */ |
| 166374 | 166795 | |
| 166375 | 166796 | /* |
| | @@ -166425,11 +166846,11 @@ |
| 166425 | 166846 | {yymsp[1].minor.yy394 = TK_DEFERRED;} |
| 166426 | 166847 | break; |
| 166427 | 166848 | case 5: /* transtype ::= DEFERRED */ |
| 166428 | 166849 | case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); |
| 166429 | 166850 | case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); |
| 166430 | | - case 321: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==321); |
| 166851 | + case 323: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==323); |
| 166431 | 166852 | {yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/} |
| 166432 | 166853 | break; |
| 166433 | 166854 | case 8: /* cmd ::= COMMIT|END trans_opt */ |
| 166434 | 166855 | case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9); |
| 166435 | 166856 | {sqlite3EndTransaction(pParse,yymsp[-1].major);} |
| | @@ -166462,11 +166883,11 @@ |
| 166462 | 166883 | case 47: /* autoinc ::= */ yytestcase(yyruleno==47); |
| 166463 | 166884 | case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62); |
| 166464 | 166885 | case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72); |
| 166465 | 166886 | case 81: /* ifexists ::= */ yytestcase(yyruleno==81); |
| 166466 | 166887 | case 98: /* distinct ::= */ yytestcase(yyruleno==98); |
| 166467 | | - case 242: /* collate ::= */ yytestcase(yyruleno==242); |
| 166888 | + case 244: /* collate ::= */ yytestcase(yyruleno==244); |
| 166468 | 166889 | {yymsp[1].minor.yy394 = 0;} |
| 166469 | 166890 | break; |
| 166470 | 166891 | case 16: /* ifnotexists ::= IF NOT EXISTS */ |
| 166471 | 166892 | {yymsp[-2].minor.yy394 = 1;} |
| 166472 | 166893 | break; |
| | @@ -166646,13 +167067,13 @@ |
| 166646 | 167067 | case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171); |
| 166647 | 167068 | {yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;} |
| 166648 | 167069 | break; |
| 166649 | 167070 | case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 166650 | 167071 | case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80); |
| 166651 | | - case 214: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==214); |
| 166652 | | - case 217: /* in_op ::= NOT IN */ yytestcase(yyruleno==217); |
| 166653 | | - case 243: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==243); |
| 167072 | + case 216: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==216); |
| 167073 | + case 219: /* in_op ::= NOT IN */ yytestcase(yyruleno==219); |
| 167074 | + case 245: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==245); |
| 166654 | 167075 | {yymsp[-1].minor.yy394 = 1;} |
| 166655 | 167076 | break; |
| 166656 | 167077 | case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 166657 | 167078 | {yymsp[-1].minor.yy394 = 0;} |
| 166658 | 167079 | break; |
| | @@ -166798,13 +167219,13 @@ |
| 166798 | 167219 | {yymsp[0].minor.yy394 = SF_All;} |
| 166799 | 167220 | break; |
| 166800 | 167221 | case 99: /* sclp ::= */ |
| 166801 | 167222 | case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132); |
| 166802 | 167223 | case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142); |
| 166803 | | - case 230: /* exprlist ::= */ yytestcase(yyruleno==230); |
| 166804 | | - case 233: /* paren_exprlist ::= */ yytestcase(yyruleno==233); |
| 166805 | | - case 238: /* eidlist_opt ::= */ yytestcase(yyruleno==238); |
| 167224 | + case 232: /* exprlist ::= */ yytestcase(yyruleno==232); |
| 167225 | + case 235: /* paren_exprlist ::= */ yytestcase(yyruleno==235); |
| 167226 | + case 240: /* eidlist_opt ::= */ yytestcase(yyruleno==240); |
| 166806 | 167227 | {yymsp[1].minor.yy322 = 0;} |
| 166807 | 167228 | break; |
| 166808 | 167229 | case 100: /* selcollist ::= sclp scanpt expr scanpt as */ |
| 166809 | 167230 | { |
| 166810 | 167231 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); |
| | @@ -166826,12 +167247,12 @@ |
| 166826 | 167247 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot); |
| 166827 | 167248 | } |
| 166828 | 167249 | break; |
| 166829 | 167250 | case 103: /* as ::= AS nm */ |
| 166830 | 167251 | case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115); |
| 166831 | | - case 254: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==254); |
| 166832 | | - case 255: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==255); |
| 167252 | + case 256: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==256); |
| 167253 | + case 257: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==257); |
| 166833 | 167254 | {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} |
| 166834 | 167255 | break; |
| 166835 | 167256 | case 105: /* from ::= */ |
| 166836 | 167257 | case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108); |
| 166837 | 167258 | {yymsp[1].minor.yy131 = 0;} |
| | @@ -166999,20 +167420,20 @@ |
| 166999 | 167420 | break; |
| 167000 | 167421 | case 144: /* having_opt ::= */ |
| 167001 | 167422 | case 146: /* limit_opt ::= */ yytestcase(yyruleno==146); |
| 167002 | 167423 | case 151: /* where_opt ::= */ yytestcase(yyruleno==151); |
| 167003 | 167424 | case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153); |
| 167004 | | - case 227: /* case_else ::= */ yytestcase(yyruleno==227); |
| 167005 | | - case 229: /* case_operand ::= */ yytestcase(yyruleno==229); |
| 167006 | | - case 248: /* vinto ::= */ yytestcase(yyruleno==248); |
| 167425 | + case 229: /* case_else ::= */ yytestcase(yyruleno==229); |
| 167426 | + case 231: /* case_operand ::= */ yytestcase(yyruleno==231); |
| 167427 | + case 250: /* vinto ::= */ yytestcase(yyruleno==250); |
| 167007 | 167428 | {yymsp[1].minor.yy528 = 0;} |
| 167008 | 167429 | break; |
| 167009 | 167430 | case 145: /* having_opt ::= HAVING expr */ |
| 167010 | 167431 | case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152); |
| 167011 | 167432 | case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154); |
| 167012 | | - case 226: /* case_else ::= ELSE expr */ yytestcase(yyruleno==226); |
| 167013 | | - case 247: /* vinto ::= INTO expr */ yytestcase(yyruleno==247); |
| 167433 | + case 228: /* case_else ::= ELSE expr */ yytestcase(yyruleno==228); |
| 167434 | + case 249: /* vinto ::= INTO expr */ yytestcase(yyruleno==249); |
| 167014 | 167435 | {yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;} |
| 167015 | 167436 | break; |
| 167016 | 167437 | case 147: /* limit_opt ::= LIMIT expr */ |
| 167017 | 167438 | {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);} |
| 167018 | 167439 | break; |
| | @@ -167036,11 +167457,22 @@ |
| 167036 | 167457 | break; |
| 167037 | 167458 | case 157: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ |
| 167038 | 167459 | { |
| 167039 | 167460 | sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy131, &yymsp[-4].minor.yy0); |
| 167040 | 167461 | sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy322,"set list"); |
| 167041 | | - yymsp[-5].minor.yy131 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy131, yymsp[-1].minor.yy131); |
| 167462 | + if( yymsp[-1].minor.yy131 ){ |
| 167463 | + SrcList *pFromClause = yymsp[-1].minor.yy131; |
| 167464 | + if( pFromClause->nSrc>1 ){ |
| 167465 | + Select *pSubquery; |
| 167466 | + Token as; |
| 167467 | + pSubquery = sqlite3SelectNew(pParse,0,pFromClause,0,0,0,0,SF_NestedFrom,0); |
| 167468 | + as.n = 0; |
| 167469 | + as.z = 0; |
| 167470 | + pFromClause = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0); |
| 167471 | + } |
| 167472 | + yymsp[-5].minor.yy131 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy131, pFromClause); |
| 167473 | + } |
| 167042 | 167474 | sqlite3Update(pParse,yymsp[-5].minor.yy131,yymsp[-2].minor.yy322,yymsp[0].minor.yy528,yymsp[-6].minor.yy394,0,0,0); |
| 167043 | 167475 | } |
| 167044 | 167476 | break; |
| 167045 | 167477 | case 158: /* setlist ::= setlist COMMA nm EQ expr */ |
| 167046 | 167478 | { |
| | @@ -167282,33 +167714,45 @@ |
| 167282 | 167714 | { |
| 167283 | 167715 | yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528); |
| 167284 | 167716 | binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL); |
| 167285 | 167717 | } |
| 167286 | 167718 | break; |
| 167287 | | - case 209: /* expr ::= NOT expr */ |
| 167288 | | - case 210: /* expr ::= BITNOT expr */ yytestcase(yyruleno==210); |
| 167719 | + case 209: /* expr ::= expr IS NOT DISTINCT FROM expr */ |
| 167720 | +{ |
| 167721 | + yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528); |
| 167722 | + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL); |
| 167723 | +} |
| 167724 | + break; |
| 167725 | + case 210: /* expr ::= expr IS DISTINCT FROM expr */ |
| 167726 | +{ |
| 167727 | + yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528); |
| 167728 | + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL); |
| 167729 | +} |
| 167730 | + break; |
| 167731 | + case 211: /* expr ::= NOT expr */ |
| 167732 | + case 212: /* expr ::= BITNOT expr */ yytestcase(yyruleno==212); |
| 167289 | 167733 | {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/} |
| 167290 | 167734 | break; |
| 167291 | | - case 211: /* expr ::= PLUS|MINUS expr */ |
| 167735 | + case 213: /* expr ::= PLUS|MINUS expr */ |
| 167292 | 167736 | { |
| 167293 | 167737 | yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0); |
| 167294 | 167738 | /*A-overwrites-B*/ |
| 167295 | 167739 | } |
| 167296 | 167740 | break; |
| 167297 | | - case 212: /* expr ::= expr PTR expr */ |
| 167741 | + case 214: /* expr ::= expr PTR expr */ |
| 167298 | 167742 | { |
| 167299 | 167743 | ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528); |
| 167300 | 167744 | pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528); |
| 167301 | 167745 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); |
| 167302 | 167746 | } |
| 167303 | 167747 | yymsp[-2].minor.yy528 = yylhsminor.yy528; |
| 167304 | 167748 | break; |
| 167305 | | - case 213: /* between_op ::= BETWEEN */ |
| 167306 | | - case 216: /* in_op ::= IN */ yytestcase(yyruleno==216); |
| 167749 | + case 215: /* between_op ::= BETWEEN */ |
| 167750 | + case 218: /* in_op ::= IN */ yytestcase(yyruleno==218); |
| 167307 | 167751 | {yymsp[0].minor.yy394 = 0;} |
| 167308 | 167752 | break; |
| 167309 | | - case 215: /* expr ::= expr between_op expr AND expr */ |
| 167753 | + case 217: /* expr ::= expr between_op expr AND expr */ |
| 167310 | 167754 | { |
| 167311 | 167755 | ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); |
| 167312 | 167756 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528); |
| 167313 | 167757 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0); |
| 167314 | 167758 | if( yymsp[-4].minor.yy528 ){ |
| | @@ -167317,11 +167761,11 @@ |
| 167317 | 167761 | sqlite3ExprListDelete(pParse->db, pList); |
| 167318 | 167762 | } |
| 167319 | 167763 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 167320 | 167764 | } |
| 167321 | 167765 | break; |
| 167322 | | - case 218: /* expr ::= expr in_op LP exprlist RP */ |
| 167766 | + case 220: /* expr ::= expr in_op LP exprlist RP */ |
| 167323 | 167767 | { |
| 167324 | 167768 | if( yymsp[-1].minor.yy322==0 ){ |
| 167325 | 167769 | /* Expressions of the form |
| 167326 | 167770 | ** |
| 167327 | 167771 | ** expr1 IN () |
| | @@ -167329,11 +167773,12 @@ |
| 167329 | 167773 | ** |
| 167330 | 167774 | ** simplify to constants 0 (false) and 1 (true), respectively, |
| 167331 | 167775 | ** regardless of the value of expr1. |
| 167332 | 167776 | */ |
| 167333 | 167777 | sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy528); |
| 167334 | | - yymsp[-4].minor.yy528 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy394 ? "1" : "0"); |
| 167778 | + yymsp[-4].minor.yy528 = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy394 ? "true" : "false"); |
| 167779 | + if( yymsp[-4].minor.yy528 ) sqlite3ExprIdToTrueFalse(yymsp[-4].minor.yy528); |
| 167335 | 167780 | }else{ |
| 167336 | 167781 | Expr *pRHS = yymsp[-1].minor.yy322->a[0].pExpr; |
| 167337 | 167782 | if( yymsp[-1].minor.yy322->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy528->op!=TK_VECTOR ){ |
| 167338 | 167783 | yymsp[-1].minor.yy322->a[0].pExpr = 0; |
| 167339 | 167784 | sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322); |
| | @@ -167357,41 +167802,41 @@ |
| 167357 | 167802 | } |
| 167358 | 167803 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 167359 | 167804 | } |
| 167360 | 167805 | } |
| 167361 | 167806 | break; |
| 167362 | | - case 219: /* expr ::= LP select RP */ |
| 167807 | + case 221: /* expr ::= LP select RP */ |
| 167363 | 167808 | { |
| 167364 | 167809 | yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); |
| 167365 | 167810 | sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47); |
| 167366 | 167811 | } |
| 167367 | 167812 | break; |
| 167368 | | - case 220: /* expr ::= expr in_op LP select RP */ |
| 167813 | + case 222: /* expr ::= expr in_op LP select RP */ |
| 167369 | 167814 | { |
| 167370 | 167815 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); |
| 167371 | 167816 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47); |
| 167372 | 167817 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 167373 | 167818 | } |
| 167374 | 167819 | break; |
| 167375 | | - case 221: /* expr ::= expr in_op nm dbnm paren_exprlist */ |
| 167820 | + case 223: /* expr ::= expr in_op nm dbnm paren_exprlist */ |
| 167376 | 167821 | { |
| 167377 | 167822 | SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); |
| 167378 | 167823 | Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); |
| 167379 | 167824 | if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322); |
| 167380 | 167825 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); |
| 167381 | 167826 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect); |
| 167382 | 167827 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 167383 | 167828 | } |
| 167384 | 167829 | break; |
| 167385 | | - case 222: /* expr ::= EXISTS LP select RP */ |
| 167830 | + case 224: /* expr ::= EXISTS LP select RP */ |
| 167386 | 167831 | { |
| 167387 | 167832 | Expr *p; |
| 167388 | 167833 | p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); |
| 167389 | 167834 | sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47); |
| 167390 | 167835 | } |
| 167391 | 167836 | break; |
| 167392 | | - case 223: /* expr ::= CASE case_operand case_exprlist case_else END */ |
| 167837 | + case 225: /* expr ::= CASE case_operand case_exprlist case_else END */ |
| 167393 | 167838 | { |
| 167394 | 167839 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0); |
| 167395 | 167840 | if( yymsp[-4].minor.yy528 ){ |
| 167396 | 167841 | yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322; |
| 167397 | 167842 | sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528); |
| | @@ -167399,406 +167844,406 @@ |
| 167399 | 167844 | sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322); |
| 167400 | 167845 | sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); |
| 167401 | 167846 | } |
| 167402 | 167847 | } |
| 167403 | 167848 | break; |
| 167404 | | - case 224: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 167849 | + case 226: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 167405 | 167850 | { |
| 167406 | 167851 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); |
| 167407 | 167852 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528); |
| 167408 | 167853 | } |
| 167409 | 167854 | break; |
| 167410 | | - case 225: /* case_exprlist ::= WHEN expr THEN expr */ |
| 167855 | + case 227: /* case_exprlist ::= WHEN expr THEN expr */ |
| 167411 | 167856 | { |
| 167412 | 167857 | yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); |
| 167413 | 167858 | yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528); |
| 167414 | 167859 | } |
| 167415 | 167860 | break; |
| 167416 | | - case 228: /* case_operand ::= expr */ |
| 167861 | + case 230: /* case_operand ::= expr */ |
| 167417 | 167862 | {yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/} |
| 167418 | 167863 | break; |
| 167419 | | - case 231: /* nexprlist ::= nexprlist COMMA expr */ |
| 167864 | + case 233: /* nexprlist ::= nexprlist COMMA expr */ |
| 167420 | 167865 | {yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);} |
| 167421 | 167866 | break; |
| 167422 | | - case 232: /* nexprlist ::= expr */ |
| 167867 | + case 234: /* nexprlist ::= expr */ |
| 167423 | 167868 | {yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/} |
| 167424 | 167869 | break; |
| 167425 | | - case 234: /* paren_exprlist ::= LP exprlist RP */ |
| 167426 | | - case 239: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==239); |
| 167870 | + case 236: /* paren_exprlist ::= LP exprlist RP */ |
| 167871 | + case 241: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==241); |
| 167427 | 167872 | {yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;} |
| 167428 | 167873 | break; |
| 167429 | | - case 235: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 167874 | + case 237: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 167430 | 167875 | { |
| 167431 | 167876 | sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, |
| 167432 | 167877 | sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394, |
| 167433 | 167878 | &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF); |
| 167434 | 167879 | if( IN_RENAME_OBJECT && pParse->pNewIndex ){ |
| 167435 | 167880 | sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); |
| 167436 | 167881 | } |
| 167437 | 167882 | } |
| 167438 | 167883 | break; |
| 167439 | | - case 236: /* uniqueflag ::= UNIQUE */ |
| 167440 | | - case 278: /* raisetype ::= ABORT */ yytestcase(yyruleno==278); |
| 167884 | + case 238: /* uniqueflag ::= UNIQUE */ |
| 167885 | + case 280: /* raisetype ::= ABORT */ yytestcase(yyruleno==280); |
| 167441 | 167886 | {yymsp[0].minor.yy394 = OE_Abort;} |
| 167442 | 167887 | break; |
| 167443 | | - case 237: /* uniqueflag ::= */ |
| 167888 | + case 239: /* uniqueflag ::= */ |
| 167444 | 167889 | {yymsp[1].minor.yy394 = OE_None;} |
| 167445 | 167890 | break; |
| 167446 | | - case 240: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 167891 | + case 242: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 167447 | 167892 | { |
| 167448 | 167893 | yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); |
| 167449 | 167894 | } |
| 167450 | 167895 | break; |
| 167451 | | - case 241: /* eidlist ::= nm collate sortorder */ |
| 167896 | + case 243: /* eidlist ::= nm collate sortorder */ |
| 167452 | 167897 | { |
| 167453 | 167898 | yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/ |
| 167454 | 167899 | } |
| 167455 | 167900 | break; |
| 167456 | | - case 244: /* cmd ::= DROP INDEX ifexists fullname */ |
| 167901 | + case 246: /* cmd ::= DROP INDEX ifexists fullname */ |
| 167457 | 167902 | {sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);} |
| 167458 | 167903 | break; |
| 167459 | | - case 245: /* cmd ::= VACUUM vinto */ |
| 167904 | + case 247: /* cmd ::= VACUUM vinto */ |
| 167460 | 167905 | {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);} |
| 167461 | 167906 | break; |
| 167462 | | - case 246: /* cmd ::= VACUUM nm vinto */ |
| 167907 | + case 248: /* cmd ::= VACUUM nm vinto */ |
| 167463 | 167908 | {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);} |
| 167464 | 167909 | break; |
| 167465 | | - case 249: /* cmd ::= PRAGMA nm dbnm */ |
| 167910 | + case 251: /* cmd ::= PRAGMA nm dbnm */ |
| 167466 | 167911 | {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} |
| 167467 | 167912 | break; |
| 167468 | | - case 250: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 167913 | + case 252: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 167469 | 167914 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} |
| 167470 | 167915 | break; |
| 167471 | | - case 251: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 167916 | + case 253: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 167472 | 167917 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} |
| 167473 | 167918 | break; |
| 167474 | | - case 252: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 167919 | + case 254: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 167475 | 167920 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} |
| 167476 | 167921 | break; |
| 167477 | | - case 253: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 167922 | + case 255: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 167478 | 167923 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} |
| 167479 | 167924 | break; |
| 167480 | | - case 256: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 167925 | + case 258: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 167481 | 167926 | { |
| 167482 | 167927 | Token all; |
| 167483 | 167928 | all.z = yymsp[-3].minor.yy0.z; |
| 167484 | 167929 | all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; |
| 167485 | 167930 | sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all); |
| 167486 | 167931 | } |
| 167487 | 167932 | break; |
| 167488 | | - case 257: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 167933 | + case 259: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 167489 | 167934 | { |
| 167490 | 167935 | sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394); |
| 167491 | 167936 | yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ |
| 167492 | 167937 | } |
| 167493 | 167938 | break; |
| 167494 | | - case 258: /* trigger_time ::= BEFORE|AFTER */ |
| 167939 | + case 260: /* trigger_time ::= BEFORE|AFTER */ |
| 167495 | 167940 | { yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ } |
| 167496 | 167941 | break; |
| 167497 | | - case 259: /* trigger_time ::= INSTEAD OF */ |
| 167942 | + case 261: /* trigger_time ::= INSTEAD OF */ |
| 167498 | 167943 | { yymsp[-1].minor.yy394 = TK_INSTEAD;} |
| 167499 | 167944 | break; |
| 167500 | | - case 260: /* trigger_time ::= */ |
| 167945 | + case 262: /* trigger_time ::= */ |
| 167501 | 167946 | { yymsp[1].minor.yy394 = TK_BEFORE; } |
| 167502 | 167947 | break; |
| 167503 | | - case 261: /* trigger_event ::= DELETE|INSERT */ |
| 167504 | | - case 262: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==262); |
| 167948 | + case 263: /* trigger_event ::= DELETE|INSERT */ |
| 167949 | + case 264: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==264); |
| 167505 | 167950 | {yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;} |
| 167506 | 167951 | break; |
| 167507 | | - case 263: /* trigger_event ::= UPDATE OF idlist */ |
| 167952 | + case 265: /* trigger_event ::= UPDATE OF idlist */ |
| 167508 | 167953 | {yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;} |
| 167509 | 167954 | break; |
| 167510 | | - case 264: /* when_clause ::= */ |
| 167511 | | - case 283: /* key_opt ::= */ yytestcase(yyruleno==283); |
| 167955 | + case 266: /* when_clause ::= */ |
| 167956 | + case 285: /* key_opt ::= */ yytestcase(yyruleno==285); |
| 167512 | 167957 | { yymsp[1].minor.yy528 = 0; } |
| 167513 | 167958 | break; |
| 167514 | | - case 265: /* when_clause ::= WHEN expr */ |
| 167515 | | - case 284: /* key_opt ::= KEY expr */ yytestcase(yyruleno==284); |
| 167959 | + case 267: /* when_clause ::= WHEN expr */ |
| 167960 | + case 286: /* key_opt ::= KEY expr */ yytestcase(yyruleno==286); |
| 167516 | 167961 | { yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; } |
| 167517 | 167962 | break; |
| 167518 | | - case 266: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 167963 | + case 268: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 167519 | 167964 | { |
| 167520 | 167965 | assert( yymsp[-2].minor.yy33!=0 ); |
| 167521 | 167966 | yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33; |
| 167522 | 167967 | yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33; |
| 167523 | 167968 | } |
| 167524 | 167969 | break; |
| 167525 | | - case 267: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 167970 | + case 269: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 167526 | 167971 | { |
| 167527 | 167972 | assert( yymsp[-1].minor.yy33!=0 ); |
| 167528 | 167973 | yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33; |
| 167529 | 167974 | } |
| 167530 | 167975 | break; |
| 167531 | | - case 268: /* trnm ::= nm DOT nm */ |
| 167976 | + case 270: /* trnm ::= nm DOT nm */ |
| 167532 | 167977 | { |
| 167533 | 167978 | yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; |
| 167534 | 167979 | sqlite3ErrorMsg(pParse, |
| 167535 | 167980 | "qualified table names are not allowed on INSERT, UPDATE, and DELETE " |
| 167536 | 167981 | "statements within triggers"); |
| 167537 | 167982 | } |
| 167538 | 167983 | break; |
| 167539 | | - case 269: /* tridxby ::= INDEXED BY nm */ |
| 167984 | + case 271: /* tridxby ::= INDEXED BY nm */ |
| 167540 | 167985 | { |
| 167541 | 167986 | sqlite3ErrorMsg(pParse, |
| 167542 | 167987 | "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " |
| 167543 | 167988 | "within triggers"); |
| 167544 | 167989 | } |
| 167545 | 167990 | break; |
| 167546 | | - case 270: /* tridxby ::= NOT INDEXED */ |
| 167991 | + case 272: /* tridxby ::= NOT INDEXED */ |
| 167547 | 167992 | { |
| 167548 | 167993 | sqlite3ErrorMsg(pParse, |
| 167549 | 167994 | "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " |
| 167550 | 167995 | "within triggers"); |
| 167551 | 167996 | } |
| 167552 | 167997 | break; |
| 167553 | | - case 271: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 167998 | + case 273: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 167554 | 167999 | {yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);} |
| 167555 | 168000 | yymsp[-8].minor.yy33 = yylhsminor.yy33; |
| 167556 | 168001 | break; |
| 167557 | | - case 272: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 168002 | + case 274: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 167558 | 168003 | { |
| 167559 | 168004 | yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ |
| 167560 | 168005 | } |
| 167561 | 168006 | yymsp[-7].minor.yy33 = yylhsminor.yy33; |
| 167562 | 168007 | break; |
| 167563 | | - case 273: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 168008 | + case 275: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 167564 | 168009 | {yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);} |
| 167565 | 168010 | yymsp[-5].minor.yy33 = yylhsminor.yy33; |
| 167566 | 168011 | break; |
| 167567 | | - case 274: /* trigger_cmd ::= scanpt select scanpt */ |
| 168012 | + case 276: /* trigger_cmd ::= scanpt select scanpt */ |
| 167568 | 168013 | {yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/} |
| 167569 | 168014 | yymsp[-2].minor.yy33 = yylhsminor.yy33; |
| 167570 | 168015 | break; |
| 167571 | | - case 275: /* expr ::= RAISE LP IGNORE RP */ |
| 168016 | + case 277: /* expr ::= RAISE LP IGNORE RP */ |
| 167572 | 168017 | { |
| 167573 | 168018 | yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); |
| 167574 | 168019 | if( yymsp[-3].minor.yy528 ){ |
| 167575 | 168020 | yymsp[-3].minor.yy528->affExpr = OE_Ignore; |
| 167576 | 168021 | } |
| 167577 | 168022 | } |
| 167578 | 168023 | break; |
| 167579 | | - case 276: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 168024 | + case 278: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 167580 | 168025 | { |
| 167581 | 168026 | yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); |
| 167582 | 168027 | if( yymsp[-5].minor.yy528 ) { |
| 167583 | 168028 | yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394; |
| 167584 | 168029 | } |
| 167585 | 168030 | } |
| 167586 | 168031 | break; |
| 167587 | | - case 277: /* raisetype ::= ROLLBACK */ |
| 168032 | + case 279: /* raisetype ::= ROLLBACK */ |
| 167588 | 168033 | {yymsp[0].minor.yy394 = OE_Rollback;} |
| 167589 | 168034 | break; |
| 167590 | | - case 279: /* raisetype ::= FAIL */ |
| 168035 | + case 281: /* raisetype ::= FAIL */ |
| 167591 | 168036 | {yymsp[0].minor.yy394 = OE_Fail;} |
| 167592 | 168037 | break; |
| 167593 | | - case 280: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 168038 | + case 282: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 167594 | 168039 | { |
| 167595 | 168040 | sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394); |
| 167596 | 168041 | } |
| 167597 | 168042 | break; |
| 167598 | | - case 281: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 168043 | + case 283: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 167599 | 168044 | { |
| 167600 | 168045 | sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528); |
| 167601 | 168046 | } |
| 167602 | 168047 | break; |
| 167603 | | - case 282: /* cmd ::= DETACH database_kw_opt expr */ |
| 168048 | + case 284: /* cmd ::= DETACH database_kw_opt expr */ |
| 167604 | 168049 | { |
| 167605 | 168050 | sqlite3Detach(pParse, yymsp[0].minor.yy528); |
| 167606 | 168051 | } |
| 167607 | 168052 | break; |
| 167608 | | - case 285: /* cmd ::= REINDEX */ |
| 168053 | + case 287: /* cmd ::= REINDEX */ |
| 167609 | 168054 | {sqlite3Reindex(pParse, 0, 0);} |
| 167610 | 168055 | break; |
| 167611 | | - case 286: /* cmd ::= REINDEX nm dbnm */ |
| 168056 | + case 288: /* cmd ::= REINDEX nm dbnm */ |
| 167612 | 168057 | {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 167613 | 168058 | break; |
| 167614 | | - case 287: /* cmd ::= ANALYZE */ |
| 168059 | + case 289: /* cmd ::= ANALYZE */ |
| 167615 | 168060 | {sqlite3Analyze(pParse, 0, 0);} |
| 167616 | 168061 | break; |
| 167617 | | - case 288: /* cmd ::= ANALYZE nm dbnm */ |
| 168062 | + case 290: /* cmd ::= ANALYZE nm dbnm */ |
| 167618 | 168063 | {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 167619 | 168064 | break; |
| 167620 | | - case 289: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 168065 | + case 291: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 167621 | 168066 | { |
| 167622 | 168067 | sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0); |
| 167623 | 168068 | } |
| 167624 | 168069 | break; |
| 167625 | | - case 290: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 168070 | + case 292: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 167626 | 168071 | { |
| 167627 | 168072 | yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; |
| 167628 | 168073 | sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); |
| 167629 | 168074 | } |
| 167630 | 168075 | break; |
| 167631 | | - case 291: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 168076 | + case 293: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 167632 | 168077 | { |
| 167633 | 168078 | sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0); |
| 167634 | 168079 | } |
| 167635 | 168080 | break; |
| 167636 | | - case 292: /* add_column_fullname ::= fullname */ |
| 168081 | + case 294: /* add_column_fullname ::= fullname */ |
| 167637 | 168082 | { |
| 167638 | 168083 | disableLookaside(pParse); |
| 167639 | 168084 | sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131); |
| 167640 | 168085 | } |
| 167641 | 168086 | break; |
| 167642 | | - case 293: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 168087 | + case 295: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 167643 | 168088 | { |
| 167644 | 168089 | sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); |
| 167645 | 168090 | } |
| 167646 | 168091 | break; |
| 167647 | | - case 294: /* cmd ::= create_vtab */ |
| 168092 | + case 296: /* cmd ::= create_vtab */ |
| 167648 | 168093 | {sqlite3VtabFinishParse(pParse,0);} |
| 167649 | 168094 | break; |
| 167650 | | - case 295: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 168095 | + case 297: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 167651 | 168096 | {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} |
| 167652 | 168097 | break; |
| 167653 | | - case 296: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 168098 | + case 298: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 167654 | 168099 | { |
| 167655 | 168100 | sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394); |
| 167656 | 168101 | } |
| 167657 | 168102 | break; |
| 167658 | | - case 297: /* vtabarg ::= */ |
| 168103 | + case 299: /* vtabarg ::= */ |
| 167659 | 168104 | {sqlite3VtabArgInit(pParse);} |
| 167660 | 168105 | break; |
| 167661 | | - case 298: /* vtabargtoken ::= ANY */ |
| 167662 | | - case 299: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==299); |
| 167663 | | - case 300: /* lp ::= LP */ yytestcase(yyruleno==300); |
| 168106 | + case 300: /* vtabargtoken ::= ANY */ |
| 168107 | + case 301: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==301); |
| 168108 | + case 302: /* lp ::= LP */ yytestcase(yyruleno==302); |
| 167664 | 168109 | {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} |
| 167665 | 168110 | break; |
| 167666 | | - case 301: /* with ::= WITH wqlist */ |
| 167667 | | - case 302: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==302); |
| 168111 | + case 303: /* with ::= WITH wqlist */ |
| 168112 | + case 304: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==304); |
| 167668 | 168113 | { sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); } |
| 167669 | 168114 | break; |
| 167670 | | - case 303: /* wqas ::= AS */ |
| 168115 | + case 305: /* wqas ::= AS */ |
| 167671 | 168116 | {yymsp[0].minor.yy516 = M10d_Any;} |
| 167672 | 168117 | break; |
| 167673 | | - case 304: /* wqas ::= AS MATERIALIZED */ |
| 168118 | + case 306: /* wqas ::= AS MATERIALIZED */ |
| 167674 | 168119 | {yymsp[-1].minor.yy516 = M10d_Yes;} |
| 167675 | 168120 | break; |
| 167676 | | - case 305: /* wqas ::= AS NOT MATERIALIZED */ |
| 168121 | + case 307: /* wqas ::= AS NOT MATERIALIZED */ |
| 167677 | 168122 | {yymsp[-2].minor.yy516 = M10d_No;} |
| 167678 | 168123 | break; |
| 167679 | | - case 306: /* wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 168124 | + case 308: /* wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 167680 | 168125 | { |
| 167681 | 168126 | yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/ |
| 167682 | 168127 | } |
| 167683 | 168128 | break; |
| 167684 | | - case 307: /* wqlist ::= wqitem */ |
| 168129 | + case 309: /* wqlist ::= wqitem */ |
| 167685 | 168130 | { |
| 167686 | 168131 | yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/ |
| 167687 | 168132 | } |
| 167688 | 168133 | break; |
| 167689 | | - case 308: /* wqlist ::= wqlist COMMA wqitem */ |
| 168134 | + case 310: /* wqlist ::= wqlist COMMA wqitem */ |
| 167690 | 168135 | { |
| 167691 | 168136 | yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385); |
| 167692 | 168137 | } |
| 167693 | 168138 | break; |
| 167694 | | - case 309: /* windowdefn_list ::= windowdefn */ |
| 168139 | + case 311: /* windowdefn_list ::= windowdefn */ |
| 167695 | 168140 | { yylhsminor.yy41 = yymsp[0].minor.yy41; } |
| 167696 | 168141 | yymsp[0].minor.yy41 = yylhsminor.yy41; |
| 167697 | 168142 | break; |
| 167698 | | - case 310: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 168143 | + case 312: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 167699 | 168144 | { |
| 167700 | 168145 | assert( yymsp[0].minor.yy41!=0 ); |
| 167701 | 168146 | sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41); |
| 167702 | 168147 | yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41; |
| 167703 | 168148 | yylhsminor.yy41 = yymsp[0].minor.yy41; |
| 167704 | 168149 | } |
| 167705 | 168150 | yymsp[-2].minor.yy41 = yylhsminor.yy41; |
| 167706 | 168151 | break; |
| 167707 | | - case 311: /* windowdefn ::= nm AS LP window RP */ |
| 168152 | + case 313: /* windowdefn ::= nm AS LP window RP */ |
| 167708 | 168153 | { |
| 167709 | 168154 | if( ALWAYS(yymsp[-1].minor.yy41) ){ |
| 167710 | 168155 | yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); |
| 167711 | 168156 | } |
| 167712 | 168157 | yylhsminor.yy41 = yymsp[-1].minor.yy41; |
| 167713 | 168158 | } |
| 167714 | 168159 | yymsp[-4].minor.yy41 = yylhsminor.yy41; |
| 167715 | 168160 | break; |
| 167716 | | - case 312: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 168161 | + case 314: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 167717 | 168162 | { |
| 167718 | 168163 | yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0); |
| 167719 | 168164 | } |
| 167720 | 168165 | break; |
| 167721 | | - case 313: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 168166 | + case 315: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 167722 | 168167 | { |
| 167723 | 168168 | yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0); |
| 167724 | 168169 | } |
| 167725 | 168170 | yymsp[-5].minor.yy41 = yylhsminor.yy41; |
| 167726 | 168171 | break; |
| 167727 | | - case 314: /* window ::= ORDER BY sortlist frame_opt */ |
| 168172 | + case 316: /* window ::= ORDER BY sortlist frame_opt */ |
| 167728 | 168173 | { |
| 167729 | 168174 | yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0); |
| 167730 | 168175 | } |
| 167731 | 168176 | break; |
| 167732 | | - case 315: /* window ::= nm ORDER BY sortlist frame_opt */ |
| 168177 | + case 317: /* window ::= nm ORDER BY sortlist frame_opt */ |
| 167733 | 168178 | { |
| 167734 | 168179 | yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0); |
| 167735 | 168180 | } |
| 167736 | 168181 | yymsp[-4].minor.yy41 = yylhsminor.yy41; |
| 167737 | 168182 | break; |
| 167738 | | - case 316: /* window ::= frame_opt */ |
| 167739 | | - case 335: /* filter_over ::= over_clause */ yytestcase(yyruleno==335); |
| 168183 | + case 318: /* window ::= frame_opt */ |
| 168184 | + case 337: /* filter_over ::= over_clause */ yytestcase(yyruleno==337); |
| 167740 | 168185 | { |
| 167741 | 168186 | yylhsminor.yy41 = yymsp[0].minor.yy41; |
| 167742 | 168187 | } |
| 167743 | 168188 | yymsp[0].minor.yy41 = yylhsminor.yy41; |
| 167744 | 168189 | break; |
| 167745 | | - case 317: /* window ::= nm frame_opt */ |
| 168190 | + case 319: /* window ::= nm frame_opt */ |
| 167746 | 168191 | { |
| 167747 | 168192 | yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0); |
| 167748 | 168193 | } |
| 167749 | 168194 | yymsp[-1].minor.yy41 = yylhsminor.yy41; |
| 167750 | 168195 | break; |
| 167751 | | - case 318: /* frame_opt ::= */ |
| 168196 | + case 320: /* frame_opt ::= */ |
| 167752 | 168197 | { |
| 167753 | 168198 | yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); |
| 167754 | 168199 | } |
| 167755 | 168200 | break; |
| 167756 | | - case 319: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 168201 | + case 321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 167757 | 168202 | { |
| 167758 | 168203 | yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516); |
| 167759 | 168204 | } |
| 167760 | 168205 | yymsp[-2].minor.yy41 = yylhsminor.yy41; |
| 167761 | 168206 | break; |
| 167762 | | - case 320: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 168207 | + case 322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 167763 | 168208 | { |
| 167764 | 168209 | yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516); |
| 167765 | 168210 | } |
| 167766 | 168211 | yymsp[-5].minor.yy41 = yylhsminor.yy41; |
| 167767 | 168212 | break; |
| 167768 | | - case 322: /* frame_bound_s ::= frame_bound */ |
| 167769 | | - case 324: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==324); |
| 168213 | + case 324: /* frame_bound_s ::= frame_bound */ |
| 168214 | + case 326: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==326); |
| 167770 | 168215 | {yylhsminor.yy595 = yymsp[0].minor.yy595;} |
| 167771 | 168216 | yymsp[0].minor.yy595 = yylhsminor.yy595; |
| 167772 | 168217 | break; |
| 167773 | | - case 323: /* frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 167774 | | - case 325: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==325); |
| 167775 | | - case 327: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==327); |
| 168218 | + case 325: /* frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 168219 | + case 327: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==327); |
| 168220 | + case 329: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==329); |
| 167776 | 168221 | {yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;} |
| 167777 | 168222 | yymsp[-1].minor.yy595 = yylhsminor.yy595; |
| 167778 | 168223 | break; |
| 167779 | | - case 326: /* frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 168224 | + case 328: /* frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 167780 | 168225 | {yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;} |
| 167781 | 168226 | yymsp[-1].minor.yy595 = yylhsminor.yy595; |
| 167782 | 168227 | break; |
| 167783 | | - case 328: /* frame_exclude_opt ::= */ |
| 168228 | + case 330: /* frame_exclude_opt ::= */ |
| 167784 | 168229 | {yymsp[1].minor.yy516 = 0;} |
| 167785 | 168230 | break; |
| 167786 | | - case 329: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 168231 | + case 331: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 167787 | 168232 | {yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;} |
| 167788 | 168233 | break; |
| 167789 | | - case 330: /* frame_exclude ::= NO OTHERS */ |
| 167790 | | - case 331: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==331); |
| 168234 | + case 332: /* frame_exclude ::= NO OTHERS */ |
| 168235 | + case 333: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==333); |
| 167791 | 168236 | {yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/} |
| 167792 | 168237 | break; |
| 167793 | | - case 332: /* frame_exclude ::= GROUP|TIES */ |
| 168238 | + case 334: /* frame_exclude ::= GROUP|TIES */ |
| 167794 | 168239 | {yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/} |
| 167795 | 168240 | break; |
| 167796 | | - case 333: /* window_clause ::= WINDOW windowdefn_list */ |
| 168241 | + case 335: /* window_clause ::= WINDOW windowdefn_list */ |
| 167797 | 168242 | { yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; } |
| 167798 | 168243 | break; |
| 167799 | | - case 334: /* filter_over ::= filter_clause over_clause */ |
| 168244 | + case 336: /* filter_over ::= filter_clause over_clause */ |
| 167800 | 168245 | { |
| 167801 | 168246 | if( yymsp[0].minor.yy41 ){ |
| 167802 | 168247 | yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528; |
| 167803 | 168248 | }else{ |
| 167804 | 168249 | sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); |
| | @@ -167805,11 +168250,11 @@ |
| 167805 | 168250 | } |
| 167806 | 168251 | yylhsminor.yy41 = yymsp[0].minor.yy41; |
| 167807 | 168252 | } |
| 167808 | 168253 | yymsp[-1].minor.yy41 = yylhsminor.yy41; |
| 167809 | 168254 | break; |
| 167810 | | - case 336: /* filter_over ::= filter_clause */ |
| 168255 | + case 338: /* filter_over ::= filter_clause */ |
| 167811 | 168256 | { |
| 167812 | 168257 | yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 167813 | 168258 | if( yylhsminor.yy41 ){ |
| 167814 | 168259 | yylhsminor.yy41->eFrmType = TK_FILTER; |
| 167815 | 168260 | yylhsminor.yy41->pFilter = yymsp[0].minor.yy528; |
| | @@ -167817,91 +168262,91 @@ |
| 167817 | 168262 | sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528); |
| 167818 | 168263 | } |
| 167819 | 168264 | } |
| 167820 | 168265 | yymsp[0].minor.yy41 = yylhsminor.yy41; |
| 167821 | 168266 | break; |
| 167822 | | - case 337: /* over_clause ::= OVER LP window RP */ |
| 168267 | + case 339: /* over_clause ::= OVER LP window RP */ |
| 167823 | 168268 | { |
| 167824 | 168269 | yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41; |
| 167825 | 168270 | assert( yymsp[-3].minor.yy41!=0 ); |
| 167826 | 168271 | } |
| 167827 | 168272 | break; |
| 167828 | | - case 338: /* over_clause ::= OVER nm */ |
| 168273 | + case 340: /* over_clause ::= OVER nm */ |
| 167829 | 168274 | { |
| 167830 | 168275 | yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 167831 | 168276 | if( yymsp[-1].minor.yy41 ){ |
| 167832 | 168277 | yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); |
| 167833 | 168278 | } |
| 167834 | 168279 | } |
| 167835 | 168280 | break; |
| 167836 | | - case 339: /* filter_clause ::= FILTER LP WHERE expr RP */ |
| 168281 | + case 341: /* filter_clause ::= FILTER LP WHERE expr RP */ |
| 167837 | 168282 | { yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; } |
| 167838 | 168283 | break; |
| 167839 | 168284 | default: |
| 167840 | | - /* (340) input ::= cmdlist */ yytestcase(yyruleno==340); |
| 167841 | | - /* (341) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==341); |
| 167842 | | - /* (342) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=342); |
| 167843 | | - /* (343) ecmd ::= SEMI */ yytestcase(yyruleno==343); |
| 167844 | | - /* (344) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==344); |
| 167845 | | - /* (345) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=345); |
| 167846 | | - /* (346) trans_opt ::= */ yytestcase(yyruleno==346); |
| 167847 | | - /* (347) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==347); |
| 167848 | | - /* (348) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==348); |
| 167849 | | - /* (349) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==349); |
| 167850 | | - /* (350) savepoint_opt ::= */ yytestcase(yyruleno==350); |
| 167851 | | - /* (351) cmd ::= create_table create_table_args */ yytestcase(yyruleno==351); |
| 167852 | | - /* (352) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=352); |
| 167853 | | - /* (353) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==353); |
| 167854 | | - /* (354) columnlist ::= columnname carglist */ yytestcase(yyruleno==354); |
| 167855 | | - /* (355) nm ::= ID|INDEXED */ yytestcase(yyruleno==355); |
| 167856 | | - /* (356) nm ::= STRING */ yytestcase(yyruleno==356); |
| 167857 | | - /* (357) nm ::= JOIN_KW */ yytestcase(yyruleno==357); |
| 167858 | | - /* (358) typetoken ::= typename */ yytestcase(yyruleno==358); |
| 167859 | | - /* (359) typename ::= ID|STRING */ yytestcase(yyruleno==359); |
| 167860 | | - /* (360) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=360); |
| 167861 | | - /* (361) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=361); |
| 167862 | | - /* (362) carglist ::= carglist ccons */ yytestcase(yyruleno==362); |
| 167863 | | - /* (363) carglist ::= */ yytestcase(yyruleno==363); |
| 167864 | | - /* (364) ccons ::= NULL onconf */ yytestcase(yyruleno==364); |
| 167865 | | - /* (365) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==365); |
| 167866 | | - /* (366) ccons ::= AS generated */ yytestcase(yyruleno==366); |
| 167867 | | - /* (367) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==367); |
| 167868 | | - /* (368) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==368); |
| 167869 | | - /* (369) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=369); |
| 167870 | | - /* (370) tconscomma ::= */ yytestcase(yyruleno==370); |
| 167871 | | - /* (371) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=371); |
| 167872 | | - /* (372) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=372); |
| 167873 | | - /* (373) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=373); |
| 167874 | | - /* (374) oneselect ::= values */ yytestcase(yyruleno==374); |
| 167875 | | - /* (375) sclp ::= selcollist COMMA */ yytestcase(yyruleno==375); |
| 167876 | | - /* (376) as ::= ID|STRING */ yytestcase(yyruleno==376); |
| 167877 | | - /* (377) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=377); |
| 167878 | | - /* (378) returning ::= */ yytestcase(yyruleno==378); |
| 167879 | | - /* (379) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=379); |
| 167880 | | - /* (380) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==380); |
| 167881 | | - /* (381) exprlist ::= nexprlist */ yytestcase(yyruleno==381); |
| 167882 | | - /* (382) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=382); |
| 167883 | | - /* (383) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=383); |
| 167884 | | - /* (384) nmnum ::= ON */ yytestcase(yyruleno==384); |
| 167885 | | - /* (385) nmnum ::= DELETE */ yytestcase(yyruleno==385); |
| 167886 | | - /* (386) nmnum ::= DEFAULT */ yytestcase(yyruleno==386); |
| 167887 | | - /* (387) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==387); |
| 167888 | | - /* (388) foreach_clause ::= */ yytestcase(yyruleno==388); |
| 167889 | | - /* (389) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==389); |
| 167890 | | - /* (390) trnm ::= nm */ yytestcase(yyruleno==390); |
| 167891 | | - /* (391) tridxby ::= */ yytestcase(yyruleno==391); |
| 167892 | | - /* (392) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==392); |
| 167893 | | - /* (393) database_kw_opt ::= */ yytestcase(yyruleno==393); |
| 167894 | | - /* (394) kwcolumn_opt ::= */ yytestcase(yyruleno==394); |
| 167895 | | - /* (395) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==395); |
| 167896 | | - /* (396) vtabarglist ::= vtabarg */ yytestcase(yyruleno==396); |
| 167897 | | - /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==397); |
| 167898 | | - /* (398) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==398); |
| 167899 | | - /* (399) anylist ::= */ yytestcase(yyruleno==399); |
| 167900 | | - /* (400) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==400); |
| 167901 | | - /* (401) anylist ::= anylist ANY */ yytestcase(yyruleno==401); |
| 167902 | | - /* (402) with ::= */ yytestcase(yyruleno==402); |
| 168285 | + /* (342) input ::= cmdlist */ yytestcase(yyruleno==342); |
| 168286 | + /* (343) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==343); |
| 168287 | + /* (344) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=344); |
| 168288 | + /* (345) ecmd ::= SEMI */ yytestcase(yyruleno==345); |
| 168289 | + /* (346) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==346); |
| 168290 | + /* (347) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=347); |
| 168291 | + /* (348) trans_opt ::= */ yytestcase(yyruleno==348); |
| 168292 | + /* (349) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==349); |
| 168293 | + /* (350) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==350); |
| 168294 | + /* (351) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==351); |
| 168295 | + /* (352) savepoint_opt ::= */ yytestcase(yyruleno==352); |
| 168296 | + /* (353) cmd ::= create_table create_table_args */ yytestcase(yyruleno==353); |
| 168297 | + /* (354) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=354); |
| 168298 | + /* (355) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==355); |
| 168299 | + /* (356) columnlist ::= columnname carglist */ yytestcase(yyruleno==356); |
| 168300 | + /* (357) nm ::= ID|INDEXED */ yytestcase(yyruleno==357); |
| 168301 | + /* (358) nm ::= STRING */ yytestcase(yyruleno==358); |
| 168302 | + /* (359) nm ::= JOIN_KW */ yytestcase(yyruleno==359); |
| 168303 | + /* (360) typetoken ::= typename */ yytestcase(yyruleno==360); |
| 168304 | + /* (361) typename ::= ID|STRING */ yytestcase(yyruleno==361); |
| 168305 | + /* (362) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=362); |
| 168306 | + /* (363) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=363); |
| 168307 | + /* (364) carglist ::= carglist ccons */ yytestcase(yyruleno==364); |
| 168308 | + /* (365) carglist ::= */ yytestcase(yyruleno==365); |
| 168309 | + /* (366) ccons ::= NULL onconf */ yytestcase(yyruleno==366); |
| 168310 | + /* (367) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==367); |
| 168311 | + /* (368) ccons ::= AS generated */ yytestcase(yyruleno==368); |
| 168312 | + /* (369) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==369); |
| 168313 | + /* (370) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==370); |
| 168314 | + /* (371) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=371); |
| 168315 | + /* (372) tconscomma ::= */ yytestcase(yyruleno==372); |
| 168316 | + /* (373) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=373); |
| 168317 | + /* (374) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=374); |
| 168318 | + /* (375) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=375); |
| 168319 | + /* (376) oneselect ::= values */ yytestcase(yyruleno==376); |
| 168320 | + /* (377) sclp ::= selcollist COMMA */ yytestcase(yyruleno==377); |
| 168321 | + /* (378) as ::= ID|STRING */ yytestcase(yyruleno==378); |
| 168322 | + /* (379) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=379); |
| 168323 | + /* (380) returning ::= */ yytestcase(yyruleno==380); |
| 168324 | + /* (381) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=381); |
| 168325 | + /* (382) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==382); |
| 168326 | + /* (383) exprlist ::= nexprlist */ yytestcase(yyruleno==383); |
| 168327 | + /* (384) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=384); |
| 168328 | + /* (385) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=385); |
| 168329 | + /* (386) nmnum ::= ON */ yytestcase(yyruleno==386); |
| 168330 | + /* (387) nmnum ::= DELETE */ yytestcase(yyruleno==387); |
| 168331 | + /* (388) nmnum ::= DEFAULT */ yytestcase(yyruleno==388); |
| 168332 | + /* (389) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==389); |
| 168333 | + /* (390) foreach_clause ::= */ yytestcase(yyruleno==390); |
| 168334 | + /* (391) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==391); |
| 168335 | + /* (392) trnm ::= nm */ yytestcase(yyruleno==392); |
| 168336 | + /* (393) tridxby ::= */ yytestcase(yyruleno==393); |
| 168337 | + /* (394) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==394); |
| 168338 | + /* (395) database_kw_opt ::= */ yytestcase(yyruleno==395); |
| 168339 | + /* (396) kwcolumn_opt ::= */ yytestcase(yyruleno==396); |
| 168340 | + /* (397) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==397); |
| 168341 | + /* (398) vtabarglist ::= vtabarg */ yytestcase(yyruleno==398); |
| 168342 | + /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==399); |
| 168343 | + /* (400) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==400); |
| 168344 | + /* (401) anylist ::= */ yytestcase(yyruleno==401); |
| 168345 | + /* (402) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==402); |
| 168346 | + /* (403) anylist ::= anylist ANY */ yytestcase(yyruleno==403); |
| 168347 | + /* (404) with ::= */ yytestcase(yyruleno==404); |
| 167903 | 168348 | break; |
| 167904 | 168349 | /********** End reduce actions ************************************************/ |
| 167905 | 168350 | }; |
| 167906 | 168351 | assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) ); |
| 167907 | 168352 | yygoto = yyRuleInfoLhs[yyruleno]; |
| | @@ -174597,10 +175042,28 @@ |
| 174597 | 175042 | */ |
| 174598 | 175043 | SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){ |
| 174599 | 175044 | int iDb = zDbName ? sqlite3FindDbName(db, zDbName) : 0; |
| 174600 | 175045 | return iDb<0 ? 0 : db->aDb[iDb].pBt; |
| 174601 | 175046 | } |
| 175047 | + |
| 175048 | +/* |
| 175049 | +** Return the name of the N-th database schema. Return NULL if N is out |
| 175050 | +** of range. |
| 175051 | +*/ |
| 175052 | +SQLITE_API const char *sqlite3_db_name(sqlite3 *db, int N){ |
| 175053 | +#ifdef SQLITE_ENABLE_API_ARMOR |
| 175054 | + if( !sqlite3SafetyCheckOk(db) ){ |
| 175055 | + (void)SQLITE_MISUSE_BKPT; |
| 175056 | + return 0; |
| 175057 | + } |
| 175058 | +#endif |
| 175059 | + if( N<0 || N>=db->nDb ){ |
| 175060 | + return 0; |
| 175061 | + }else{ |
| 175062 | + return db->aDb[N].zDbSName; |
| 175063 | + } |
| 175064 | +} |
| 174602 | 175065 | |
| 174603 | 175066 | /* |
| 174604 | 175067 | ** Return the filename of the database associated with a database |
| 174605 | 175068 | ** connection. |
| 174606 | 175069 | */ |
| | @@ -190236,10 +190699,12 @@ |
| 190236 | 190699 | if( rc==SQLITE_OK ){ |
| 190237 | 190700 | if( pNode->key.n ){ |
| 190238 | 190701 | pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nPrefix); |
| 190239 | 190702 | } |
| 190240 | 190703 | pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nSuffix); |
| 190704 | + assert( nPrefix+nSuffix<=nTerm ); |
| 190705 | + assert( nPrefix>=0 ); |
| 190241 | 190706 | memcpy(&pBlk->a[pBlk->n], &zTerm[nPrefix], nSuffix); |
| 190242 | 190707 | pBlk->n += nSuffix; |
| 190243 | 190708 | |
| 190244 | 190709 | memcpy(pNode->key.a, zTerm, nTerm); |
| 190245 | 190710 | pNode->key.n = nTerm; |
| | @@ -190358,10 +190823,11 @@ |
| 190358 | 190823 | NodeWriter *pLeaf; /* Object used to write leaf nodes */ |
| 190359 | 190824 | |
| 190360 | 190825 | pLeaf = &pWriter->aNodeWriter[0]; |
| 190361 | 190826 | nPrefix = fts3PrefixCompress(pLeaf->key.a, pLeaf->key.n, zTerm, nTerm); |
| 190362 | 190827 | nSuffix = nTerm - nPrefix; |
| 190828 | + if(nSuffix<=0 ) return FTS_CORRUPT_VTAB; |
| 190363 | 190829 | |
| 190364 | 190830 | nSpace = sqlite3Fts3VarintLen(nPrefix); |
| 190365 | 190831 | nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix; |
| 190366 | 190832 | nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist; |
| 190367 | 190833 | |
| | @@ -226663,11 +227129,11 @@ |
| 226663 | 227129 | /* State used by the fts5DataXXX() functions. */ |
| 226664 | 227130 | sqlite3_blob *pReader; /* RO incr-blob open on %_data table */ |
| 226665 | 227131 | sqlite3_stmt *pWriter; /* "INSERT ... %_data VALUES(?,?)" */ |
| 226666 | 227132 | sqlite3_stmt *pDeleter; /* "DELETE FROM %_data ... id>=? AND id<=?" */ |
| 226667 | 227133 | sqlite3_stmt *pIdxWriter; /* "INSERT ... %_idx VALUES(?,?,?,?)" */ |
| 226668 | | - sqlite3_stmt *pIdxDeleter; /* "DELETE FROM %_idx WHERE segid=? */ |
| 227134 | + sqlite3_stmt *pIdxDeleter; /* "DELETE FROM %_idx WHERE segid=?" */ |
| 226669 | 227135 | sqlite3_stmt *pIdxSelect; |
| 226670 | 227136 | int nRead; /* Total number of blocks read */ |
| 226671 | 227137 | |
| 226672 | 227138 | sqlite3_stmt *pDataVersion; |
| 226673 | 227139 | i64 iStructVersion; /* data_version when pStruct read */ |
| | @@ -235980,11 +236446,11 @@ |
| 235980 | 236446 | int nArg, /* Number of args */ |
| 235981 | 236447 | sqlite3_value **apUnused /* Function arguments */ |
| 235982 | 236448 | ){ |
| 235983 | 236449 | assert( nArg==0 ); |
| 235984 | 236450 | UNUSED_PARAM2(nArg, apUnused); |
| 235985 | | - sqlite3_result_text(pCtx, "fts5: 2022-04-19 15:56:03 b966d52437f08a6759a83a45cafb0d706a8933a8e55dee38ae78166d1a5b3ba4", -1, SQLITE_TRANSIENT); |
| 236451 | + sqlite3_result_text(pCtx, "fts5: 2022-06-03 14:08:40 d18818afc6021a32989499c26ab38fa442e5a55e662e39bb06e5c0daa9c65e25", -1, SQLITE_TRANSIENT); |
| 235986 | 236452 | } |
| 235987 | 236453 | |
| 235988 | 236454 | /* |
| 235989 | 236455 | ** Return true if zName is the extension on one of the shadow tables used |
| 235990 | 236456 | ** by this module. |
| 235991 | 236457 | |