Ensure that TK_SELECT_COLUMN Expr nodes always have their iTable field set to
to the number of columns in the vector. This is not strictly necessary. It just simplifies the state description and make the code easier to reason about. FossilOrigin-Name: 026f08d4cff19a95e0f38f2ef431cacd65c7c77ed92e30d7f2ded84651f47150
This commit is contained in:
parent
105c4b5ced
commit
10f08270e1
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\san\sincorrect\scomment\son\stestcase\smisc1-27.0.\s\sNo\schanges\sto\scode.
|
||||
D 2021-07-05T00:07:39.333
|
||||
C Ensure\sthat\sTK_SELECT_COLUMN\sExpr\snodes\salways\shave\stheir\siTable\sfield\sset\sto\nto\sthe\snumber\sof\scolumns\sin\sthe\svector.\sThis\sis\snot\sstrictly\snecessary.\sIt\njust\ssimplifies\sthe\sstate\sdescription\sand\smake\sthe\scode\seasier\sto\sreason\sabout.
|
||||
D 2021-07-05T01:11:26.068
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -496,7 +496,7 @@ F src/date.c e0632f335952b32401482d099321bbf12716b29d6e72836b53ae49683ebae4bf
|
||||
F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
|
||||
F src/dbstat.c 3aa79fc3aed7ce906e4ea6c10e85d657299e304f6049861fe300053ac57de36c
|
||||
F src/delete.c 62451bba9fe641159e9c0b7d9d2bab1c48d0cff11e16de2d14000603d2af1fcf
|
||||
F src/expr.c d571a83580d0034697a29abbfe95a7750eb8ae7172d6e2c794b1d89ef4ef31dc
|
||||
F src/expr.c 2d40c29e10ed37b1969ddb1616b598c30e318e8694686ab9209cbec31c310613
|
||||
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
|
||||
F src/fkey.c e9063648396c58778f77583a678342fe4a9bc82436bf23c5f9f444f2df0fdaa4
|
||||
F src/func.c c96ac6f7c4f2d684217c4673a80446e1b50e25b5ea79366f333f484622d010a0
|
||||
@ -549,7 +549,7 @@ F src/shell.c.in 699910739eb7296fd47be19db71f6e5d15d0760f4352c62639d4d6cc7bd8d4c
|
||||
F src/sqlite.h.in ecf5aa981da30c33da3e9f353bf3ebf055d3c380c80d6a4f954e58d18ccd6df1
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h e97f4e9b509408fea4c4e9bef5a41608dfac343b4d3c7a990dedde1e19af9510
|
||||
F src/sqliteInt.h fccf952bd572fe52f3bd2928982bd80933308c1118fdde27f667d0de7c77fb30
|
||||
F src/sqliteInt.h 6cfa7b73801657c89155a02e748ba538b8bb12fe6f4e8143c74f055d55e1190d
|
||||
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
|
||||
F src/status.c 4b8bc2a6905163a38b739854a35b826c737333fab5b1f8e03fa7eb9a4799c4c1
|
||||
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
||||
@ -609,7 +609,7 @@ F src/test_window.c cdae419fdcea5bad6dcd9368c685abdad6deb59e9fc8b84b153de513d394
|
||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
|
||||
F src/tokenize.c bae853ad129d1129c063de8630a3e99e306283bc40146f359b1bb91be2c08f1e
|
||||
F src/treeview.c 6c1dbbc1140c4acb2248db19caf43819be6d3ec1d374ec497d2890c442bf7e4c
|
||||
F src/treeview.c f34b02f379a99bdfd24971810765fe0993e6aa2bcd7e3fa5af8a54f353b429fc
|
||||
F src/trigger.c 7d16aa09e63226b6d8b3f0fc60b21cbfa596fc406288b2ebcf4266633d1ba222
|
||||
F src/update.c 56fa0458b1ffc1042629f926443e8ed44203983df3ab2b0db2ba556e6ceed68c
|
||||
F src/upsert.c df8f1727d62b5987c4fd302cd4d7c0c84ae57cd65683c5a34a740dfe24039235
|
||||
@ -634,7 +634,7 @@ F src/walker.c 7342becedf3f8a26f9817f08436bdf8b56ad69af83705f6b9320a0ad3092c2ac
|
||||
F src/where.c 07a4097fe42a01b1f99d2a136598654051f0bdcd6c17cbef7fa285a9cf21e4d2
|
||||
F src/whereInt.h 9248161dd004f625ce5d3841ca9b99fed3fc8d61522cf76340fc5217dbe1375b
|
||||
F src/wherecode.c 9f1f65d11437b25cd0a1497a170514c785f19ce6ad9d3e6fc73719cb5a49012f
|
||||
F src/whereexpr.c 5a9c9f5d2dac4bcdcaae3035034b4667523f731df228e0bb1d4efc669efa9da5
|
||||
F src/whereexpr.c 2bfb1cd24b9b63fc5e32b9b85f2b3f88765bdac2aab51102d94d1fb56ec2917b
|
||||
F src/window.c 559961a731f67a0873744960bdeeb034a5c74cc0a09badb14bc43f74744a2a9d
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
|
||||
@ -1919,7 +1919,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P e87fdb6514b6f6775a5a36ca0ec5c920eeaba9e3b842dffa327e970b27cd036d
|
||||
R 389f03ccb1a382c69b94dc83b230b2b0
|
||||
P 49829ae3229b7c7c7adeaa970a84aebd5157bc93b38fd6d80d86cc03f5fdde6f
|
||||
R 074e3a063f98e309829563ef30773d9b
|
||||
U drh
|
||||
Z 310dc77b27d9638577d1119dcb3f50a7
|
||||
Z 460e3b0de88173af039daa4e60e46cf6
|
||||
|
@ -1 +1 @@
|
||||
49829ae3229b7c7c7adeaa970a84aebd5157bc93b38fd6d80d86cc03f5fdde6f
|
||||
026f08d4cff19a95e0f38f2ef431cacd65c7c77ed92e30d7f2ded84651f47150
|
19
src/expr.c
19
src/expr.c
@ -71,6 +71,8 @@ char sqlite3ExprAffinity(const Expr *pExpr){
|
||||
#endif
|
||||
if( op==TK_SELECT_COLUMN ){
|
||||
assert( pExpr->pLeft->flags&EP_xIsSelect );
|
||||
assert( pExpr->iColumn < pExpr->iTable );
|
||||
assert( pExpr->iTable==pExpr->pLeft->x.pSelect->pEList->nExpr );
|
||||
return sqlite3ExprAffinity(
|
||||
pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr
|
||||
);
|
||||
@ -481,7 +483,8 @@ Expr *sqlite3VectorFieldSubexpr(Expr *pVector, int i){
|
||||
Expr *sqlite3ExprForVectorField(
|
||||
Parse *pParse, /* Parsing context */
|
||||
Expr *pVector, /* The vector. List of expressions or a sub-SELECT */
|
||||
int iField /* Which column of the vector to return */
|
||||
int iField, /* Which column of the vector to return */
|
||||
int nField /* Total number of columns in the vector */
|
||||
){
|
||||
Expr *pRet;
|
||||
if( pVector->op==TK_SELECT ){
|
||||
@ -504,10 +507,10 @@ Expr *sqlite3ExprForVectorField(
|
||||
*/
|
||||
pRet = sqlite3PExpr(pParse, TK_SELECT_COLUMN, 0, 0);
|
||||
if( pRet ){
|
||||
pRet->iTable = nField;
|
||||
pRet->iColumn = iField;
|
||||
pRet->pLeft = pVector;
|
||||
}
|
||||
assert( pRet==0 || pRet->iTable==0 );
|
||||
}else{
|
||||
if( pVector->op==TK_VECTOR ) pVector = pVector->x.pList->a[iField].pExpr;
|
||||
pRet = sqlite3ExprDup(pParse->db, pVector, 0);
|
||||
@ -1781,11 +1784,9 @@ ExprList *sqlite3ExprListAppendVector(
|
||||
}
|
||||
|
||||
for(i=0; i<pColumns->nId; i++){
|
||||
Expr *pSubExpr = sqlite3ExprForVectorField(pParse, pExpr, i);
|
||||
Expr *pSubExpr = sqlite3ExprForVectorField(pParse, pExpr, i, pColumns->nId);
|
||||
assert( pSubExpr!=0 || db->mallocFailed );
|
||||
assert( pSubExpr==0 || pSubExpr->iTable==0 );
|
||||
if( pSubExpr==0 ) continue;
|
||||
pSubExpr->iTable = pColumns->nId;
|
||||
pList = sqlite3ExprListAppend(pParse, pList, pSubExpr);
|
||||
if( pList ){
|
||||
assert( pList->nExpr==iFirst+i+1 );
|
||||
@ -4375,11 +4376,9 @@ expr_code_doover:
|
||||
if( pExpr->pLeft->iTable==0 ){
|
||||
pExpr->pLeft->iTable = sqlite3CodeSubselect(pParse, pExpr->pLeft);
|
||||
}
|
||||
assert( pExpr->iTable==0 || pExpr->pLeft->op==TK_SELECT
|
||||
|| pExpr->pLeft->op==TK_ERROR );
|
||||
if( pExpr->iTable!=0
|
||||
&& pExpr->iTable!=(n = sqlite3ExprVectorSize(pExpr->pLeft))
|
||||
){
|
||||
assert( pExpr->pLeft->op==TK_SELECT || pExpr->pLeft->op==TK_ERROR );
|
||||
n = sqlite3ExprVectorSize(pExpr->pLeft);
|
||||
if( pExpr->iTable!=n ){
|
||||
sqlite3ErrorMsg(pParse, "%d columns assigned %d values",
|
||||
pExpr->iTable, n);
|
||||
}
|
||||
|
@ -5191,7 +5191,7 @@ int sqlite3DbstatRegister(sqlite3*);
|
||||
int sqlite3ExprVectorSize(Expr *pExpr);
|
||||
int sqlite3ExprIsVector(Expr *pExpr);
|
||||
Expr *sqlite3VectorFieldSubexpr(Expr*, int);
|
||||
Expr *sqlite3ExprForVectorField(Parse*,Expr*,int);
|
||||
Expr *sqlite3ExprForVectorField(Parse*,Expr*,int,int);
|
||||
void sqlite3VectorErrorMsg(Parse*, Expr*);
|
||||
|
||||
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
|
||||
|
@ -699,7 +699,8 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){
|
||||
break;
|
||||
}
|
||||
case TK_SELECT_COLUMN: {
|
||||
sqlite3TreeViewLine(pView, "SELECT-COLUMN %d", pExpr->iColumn);
|
||||
sqlite3TreeViewLine(pView, "SELECT-COLUMN %d of [0..%d]",
|
||||
pExpr->iColumn, pExpr->iTable-1);
|
||||
sqlite3TreeViewSelect(pView, pExpr->pLeft->x.pSelect, 0);
|
||||
break;
|
||||
}
|
||||
|
@ -1341,8 +1341,8 @@ static void exprAnalyze(
|
||||
for(i=0; i<nLeft; i++){
|
||||
int idxNew;
|
||||
Expr *pNew;
|
||||
Expr *pLeft = sqlite3ExprForVectorField(pParse, pExpr->pLeft, i);
|
||||
Expr *pRight = sqlite3ExprForVectorField(pParse, pExpr->pRight, i);
|
||||
Expr *pLeft = sqlite3ExprForVectorField(pParse, pExpr->pLeft, i, nLeft);
|
||||
Expr *pRight = sqlite3ExprForVectorField(pParse, pExpr->pRight, i, nLeft);
|
||||
|
||||
pNew = sqlite3PExpr(pParse, pExpr->op, pLeft, pRight);
|
||||
transferJoinMarkings(pNew, pExpr);
|
||||
|
Loading…
Reference in New Issue
Block a user