Merge the Expr.w.iJoin name change from trunk into the right-join branch.
FossilOrigin-Name: 29927926eb32acd963e2c496ad67d55177615ec4150fd218afaf2f9a730cabec
This commit is contained in:
commit
189c065942
26
manifest
26
manifest
@ -1,5 +1,5 @@
|
||||
C Ensure\sthat\sthe\sJT_LTORJ\sflag\sis\spreserved\swhen\sflattening\sa\ssubquery\sthat\nis\son\sthe\sleft\sside\sof\sa\sRIGHT\sJOIN.
|
||||
D 2022-04-11T10:38:28.801
|
||||
C Merge\sthe\sExpr.w.iJoin\sname\schange\sfrom\strunk\sinto\sthe\sright-join\sbranch.
|
||||
D 2022-04-11T11:48:17.550
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -552,12 +552,12 @@ F src/printf.c 05d8dfd2018bc4fc3ddb8b37eb97ccef7abf985643fa1caebdcf2916ca90fa32
|
||||
F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
|
||||
F src/resolve.c 7110fc3b5a4dec5d11559141c1906c4a125349fb602f541b05db3a3d448d4b95
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c e889b6a0fee9341820adc9a421f6cabb69171360f7750c0ba175e0a6ac0fd537
|
||||
F src/shell.c.in 1a8fbf932ecd582b1a5f66c1e8294f92c30d954616f5c7cc54c9623fcdbb028d
|
||||
F src/select.c 360720df7dbf31977fb265aa49fc9b99599e16de521ac5a7a683c16d26d65acf
|
||||
F src/shell.c.in eb7f10d5e2c47bd014d92ec5db1def21fcc1ed56ffaaa4ee715b6c37c370b47f
|
||||
F src/sqlite.h.in 2a35f62185eb5e7ecc64a2f68442b538ce9be74f80f28a00abc24837edcf1c17
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h f49e28c25bd941e79794db5415fdf7b202deb3bc072ed6f1ed273d578703684e
|
||||
F src/sqliteInt.h f8dc31c997573ac608a52bd98af91f21298d46b392732267aefa84b705be0e5c
|
||||
F src/sqliteInt.h 8a804f402410b06958bf6376daa91f11e2667ebd60e149eb5a371654a71ce448
|
||||
F src/sqliteLimit.h d7323ffea5208c6af2734574bae933ca8ed2ab728083caa117c9738581a31657
|
||||
F src/status.c 4a3da6d77eeb3531cb0dbdf7047772a2a1b99f98c69e90ce009c75fe6328b2c0
|
||||
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
||||
@ -617,7 +617,7 @@ F src/test_window.c cdae419fdcea5bad6dcd9368c685abdad6deb59e9fc8b84b153de513d394
|
||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
|
||||
F src/tokenize.c a38f52058b517929e264094abd0b5fd1e8e145a1aa43bc6f6a72ae5218f96c98
|
||||
F src/treeview.c 7e50db6ae3bf4d2cb2451b72885667160b6670b0d17bc8d59525b0de6aabf036
|
||||
F src/treeview.c e143d3def263f304066e87628eebc7c2921a12245541f09b61d0e45009091474
|
||||
F src/trigger.c 372ada38f667c6823a3db15749eb668338e65c793394e55a37e56a489f2d1b55
|
||||
F src/update.c 2cfaded82ca80ff56afb8c3ae5e88284e0824bfd86119827cc22481959f96f92
|
||||
F src/upsert.c 8789047a8f0a601ea42fa0256d1ba3190c13746b6ba940fe2d25643a7e991937
|
||||
@ -639,10 +639,10 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
|
||||
F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d
|
||||
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
|
||||
F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
|
||||
F src/where.c cfc0926a221884af46cf933c9462e85e391022cb6aa06a65523e7464294b75d0
|
||||
F src/where.c e05c2c85a894d0175983241789344e48ed134f79bb84adda23a6bff53c39cf42
|
||||
F src/whereInt.h ecf0d9fe3e35f2546e660c6389e56aedb6fd2434e31a0449b261ff55ebc6df2d
|
||||
F src/wherecode.c 39532c183ea306ae44b5ab3119b244407b46970b088c59d5751c5724b4b6ec15
|
||||
F src/whereexpr.c ac8985bbd983f34273b1e0d05cd738ff436331674c1b22f4caf6537e1eca4691
|
||||
F src/wherecode.c 808e94b66f1bf052cbb77665ba08625ba93fbb0c343fe0ecafdfdd264bf0c6c9
|
||||
F src/whereexpr.c d79dd55b6ad4d072c16838e9709d7b144c321e463ebd216de224821c06bc1fd3
|
||||
F src/window.c 42a71595263dbd8ef8248218e4fc7d4b5ddccece52146ad48e079342d93f6f8f
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
|
||||
@ -1394,7 +1394,7 @@ F test/shell1.test b224e0793c5f48aa3749e65d8c64b93a30731bd206f2e41e6c5f1bee1bdb1
|
||||
F test/shell2.test 7a3a23a9f57b99453f1679b1fe8072cb30e382a622874c0c4d97695fadb0a787
|
||||
F test/shell3.test a50628ab1d78d90889d9d3f32fb2c084ee15674771e96afe954aaa0accd1de3c
|
||||
F test/shell4.test 8f6c0fce4abed19a8a7f7262517149812a04caa905d01bdc8f5e92573504b759
|
||||
F test/shell5.test 0a9920d81fae28c45cd5dbd1deb809487a23c5f4b422a49f9d31c85f926d4a9c
|
||||
F test/shell5.test 78a7a8516b1e7de560748881424f621321549023d3e5f7ed2e1c56497f64c06c
|
||||
F test/shell6.test 1ceb51b2678c472ba6cf1e5da96679ce8347889fe2c3bf93a0e0fa73f00b00d3
|
||||
F test/shell7.test 115132f66d0463417f408562cc2cf534f6bbc6d83a6d50f0072a9eb171bae97f
|
||||
F test/shell8.test 388471d16e4de767333107e30653983f186232c0e863f4490bb230419e830aae
|
||||
@ -1946,8 +1946,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 21eb44919f38abad30b75181ca8aec38b453b94dba2815caf7e946e07faa40d7
|
||||
R 582e9a3c8a9436aaf5a30603f3b09f3b
|
||||
P ccb61fb1f30e2741b19c1a0cbd2951715224852c86234a3c6a4bbd2e1187634a e8c00442d2daedec079748d13147bf73b0ec3c3cf432bce2cdccb706bdff2853
|
||||
R 0d4dae690860c958443834a66cabd1f6
|
||||
U drh
|
||||
Z 8d7ebe62739250aad2468a2b76ceb82f
|
||||
Z a424a48ba2c370ac2094114fa017cf8b
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
ccb61fb1f30e2741b19c1a0cbd2951715224852c86234a3c6a4bbd2e1187634a
|
||||
29927926eb32acd963e2c496ad67d55177615ec4150fd218afaf2f9a730cabec
|
26
src/select.c
26
src/select.c
@ -397,14 +397,14 @@ static void addWhereTerm(
|
||||
ExprSetProperty(pEq, EP_FromJoin);
|
||||
assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) );
|
||||
ExprSetVVAProperty(pEq, EP_NoReduce);
|
||||
pEq->w.iRightJoinTable = pE2->iTable;
|
||||
pEq->w.iJoin = pE2->iTable;
|
||||
}
|
||||
*ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq);
|
||||
}
|
||||
|
||||
/*
|
||||
** Set the EP_FromJoin property on all terms of the given expression.
|
||||
** And set the Expr.w.iRightJoinTable to iTable for every term in the
|
||||
** And set the Expr.w.iJoin to iTable for every term in the
|
||||
** expression.
|
||||
**
|
||||
** The EP_FromJoin property is used on terms of an expression to tell
|
||||
@ -414,8 +414,8 @@ static void addWhereTerm(
|
||||
** WHERE clause during join processing but we need to remember that they
|
||||
** originated in the ON or USING clause.
|
||||
**
|
||||
** The Expr.w.iRightJoinTable tells the WHERE clause processing that the
|
||||
** expression depends on table w.iRightJoinTable even if that table is not
|
||||
** The Expr.w.iJoin tells the WHERE clause processing that the
|
||||
** expression depends on table w.iJoin even if that table is not
|
||||
** explicitly mentioned in the expression. That information is needed
|
||||
** for cases like this:
|
||||
**
|
||||
@ -433,7 +433,7 @@ void sqlite3SetJoinExpr(Expr *p, int iTable){
|
||||
ExprSetProperty(p, EP_FromJoin);
|
||||
assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) );
|
||||
ExprSetVVAProperty(p, EP_NoReduce);
|
||||
p->w.iRightJoinTable = iTable;
|
||||
p->w.iJoin = iTable;
|
||||
if( p->op==TK_FUNCTION ){
|
||||
assert( ExprUseXList(p) );
|
||||
if( p->x.pList ){
|
||||
@ -449,7 +449,7 @@ void sqlite3SetJoinExpr(Expr *p, int iTable){
|
||||
}
|
||||
|
||||
/* Undo the work of sqlite3SetJoinExpr(). In the expression p, convert every
|
||||
** term that is marked with EP_FromJoin and w.iRightJoinTable==iTable into
|
||||
** term that is marked with EP_FromJoin and w.iJoin==iTable into
|
||||
** an ordinary term that omits the EP_FromJoin mark.
|
||||
**
|
||||
** This happens when a LEFT JOIN is simplified into an ordinary JOIN.
|
||||
@ -457,7 +457,7 @@ void sqlite3SetJoinExpr(Expr *p, int iTable){
|
||||
static void unsetJoinExpr(Expr *p, int iTable){
|
||||
while( p ){
|
||||
if( ExprHasProperty(p, EP_FromJoin)
|
||||
&& (iTable<0 || p->w.iRightJoinTable==iTable) ){
|
||||
&& (iTable<0 || p->w.iJoin==iTable) ){
|
||||
ExprClearProperty(p, EP_FromJoin);
|
||||
}
|
||||
if( p->op==TK_COLUMN && p->iTable==iTable ){
|
||||
@ -3684,9 +3684,9 @@ static Expr *substExpr(
|
||||
){
|
||||
if( pExpr==0 ) return 0;
|
||||
if( ExprHasProperty(pExpr, EP_FromJoin)
|
||||
&& pExpr->w.iRightJoinTable==pSubst->iTable
|
||||
&& pExpr->w.iJoin==pSubst->iTable
|
||||
){
|
||||
pExpr->w.iRightJoinTable = pSubst->iNewTable;
|
||||
pExpr->w.iJoin = pSubst->iNewTable;
|
||||
}
|
||||
if( pExpr->op==TK_COLUMN
|
||||
&& pExpr->iTable==pSubst->iTable
|
||||
@ -3725,7 +3725,7 @@ static Expr *substExpr(
|
||||
ExprSetProperty(pNew, EP_CanBeNull);
|
||||
}
|
||||
if( ExprHasProperty(pExpr,EP_FromJoin) ){
|
||||
sqlite3SetJoinExpr(pNew, pExpr->w.iRightJoinTable);
|
||||
sqlite3SetJoinExpr(pNew, pExpr->w.iJoin);
|
||||
}
|
||||
sqlite3ExprDelete(db, pExpr);
|
||||
pExpr = pNew;
|
||||
@ -3890,7 +3890,7 @@ static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){
|
||||
renumberCursorDoMapping(pWalker, &pExpr->iTable);
|
||||
}
|
||||
if( ExprHasProperty(pExpr, EP_FromJoin) ){
|
||||
renumberCursorDoMapping(pWalker, &pExpr->w.iRightJoinTable);
|
||||
renumberCursorDoMapping(pWalker, &pExpr->w.iJoin);
|
||||
}
|
||||
return WRC_Continue;
|
||||
}
|
||||
@ -4908,12 +4908,12 @@ static int pushDownWhereTerms(
|
||||
}
|
||||
if( isLeftJoin
|
||||
&& (ExprHasProperty(pWhere,EP_FromJoin)==0
|
||||
|| pWhere->w.iRightJoinTable!=iCursor)
|
||||
|| pWhere->w.iJoin!=iCursor)
|
||||
){
|
||||
return 0; /* restriction (4) */
|
||||
}
|
||||
if( ExprHasProperty(pWhere,EP_FromJoin)
|
||||
&& pWhere->w.iRightJoinTable!=iCursor
|
||||
&& pWhere->w.iJoin!=iCursor
|
||||
){
|
||||
return 0; /* restriction (5) */
|
||||
}
|
||||
|
@ -7962,12 +7962,12 @@ SELECT\
|
||||
','||iif((cpos-1)%4>0, ' ', x'0a'||' '))\
|
||||
||')' AS ColsSpec \
|
||||
FROM (\
|
||||
SELECT cpos, printf('\"%w\"',printf('%.*s%s', nlen-chop,name,suff)) AS cname \
|
||||
SELECT cpos, printf('\"%w\"',printf('%!.*s%s', nlen-chop,name,suff)) AS cname \
|
||||
FROM ColNames ORDER BY cpos\
|
||||
)";
|
||||
static const char * const zRenamesDone =
|
||||
"SELECT group_concat("
|
||||
" printf('\"%w\" to \"%w\"',name,printf('%.*s%s', nlen-chop, name, suff)),"
|
||||
" printf('\"%w\" to \"%w\"',name,printf('%!.*s%s', nlen-chop, name, suff)),"
|
||||
" ','||x'0a')"
|
||||
"FROM ColNames WHERE suff<>'' OR chop!=0"
|
||||
;
|
||||
|
@ -2844,7 +2844,7 @@ struct Expr {
|
||||
** TK_SELECT_COLUMN: column of the result vector */
|
||||
i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
|
||||
union {
|
||||
int iRightJoinTable; /* If EP_FromJoin, the right table of the join */
|
||||
int iJoin; /* If EP_FromJoin, the right table of the join */
|
||||
int iOfst; /* else: start of token from start of statement */
|
||||
} w;
|
||||
AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
|
||||
|
@ -423,7 +423,7 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){
|
||||
sqlite3_str_appendf(&x, " fg.af=%x.%c",
|
||||
pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n');
|
||||
if( ExprHasProperty(pExpr, EP_FromJoin) ){
|
||||
sqlite3_str_appendf(&x, " iRJT=%d", pExpr->w.iRightJoinTable);
|
||||
sqlite3_str_appendf(&x, " iJoin=%d", pExpr->w.iJoin);
|
||||
}
|
||||
if( ExprHasProperty(pExpr, EP_FromDDL) ){
|
||||
sqlite3_str_appendf(&x, " DDL");
|
||||
|
@ -3207,7 +3207,7 @@ static int whereUsablePartialIndex(
|
||||
for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
|
||||
Expr *pExpr;
|
||||
pExpr = pTerm->pExpr;
|
||||
if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->w.iRightJoinTable==iTab)
|
||||
if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->w.iJoin==iTab)
|
||||
&& (isLeft==0 || ExprHasProperty(pExpr, EP_FromJoin))
|
||||
&& sqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab)
|
||||
&& (pTerm->wtFlags & TERM_VNULL)==0
|
||||
@ -5214,7 +5214,7 @@ static SQLITE_NOINLINE Bitmask whereOmitNoopJoin(
|
||||
for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){
|
||||
if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
|
||||
if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
|
||||
|| pTerm->pExpr->w.iRightJoinTable!=pItem->iCursor
|
||||
|| pTerm->pExpr->w.iJoin!=pItem->iCursor
|
||||
){
|
||||
break;
|
||||
}
|
||||
|
@ -1064,7 +1064,7 @@ static void codeCursorHint(
|
||||
if( pTabItem->fg.jointype & JT_LEFT ){
|
||||
Expr *pExpr = pTerm->pExpr;
|
||||
if( !ExprHasProperty(pExpr, EP_FromJoin)
|
||||
|| pExpr->w.iRightJoinTable!=pTabItem->iCursor
|
||||
|| pExpr->w.iJoin!=pTabItem->iCursor
|
||||
){
|
||||
sWalker.eCode = 0;
|
||||
sWalker.xExprCallback = codeCursorHintIsOrFunction;
|
||||
|
@ -463,7 +463,7 @@ static int isAuxiliaryVtabOperator(
|
||||
static void transferJoinMarkings(Expr *pDerived, Expr *pBase){
|
||||
if( pDerived ){
|
||||
pDerived->flags |= pBase->flags & EP_FromJoin;
|
||||
pDerived->w.iRightJoinTable = pBase->w.iRightJoinTable;
|
||||
pDerived->w.iJoin = pBase->w.iJoin;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1110,7 +1110,7 @@ static void exprAnalyze(
|
||||
#endif
|
||||
|
||||
if( ExprHasProperty(pExpr, EP_FromJoin) ){
|
||||
Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->w.iRightJoinTable);
|
||||
Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->w.iJoin);
|
||||
prereqAll |= x;
|
||||
extraRight = x-1; /* ON clause terms may not be used with an index
|
||||
** on left table of a LEFT JOIN. Ticket #3015 */
|
||||
@ -1461,7 +1461,7 @@ static void exprAnalyze(
|
||||
0, sqlite3ExprDup(db, pRight, 0));
|
||||
if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){
|
||||
ExprSetProperty(pNewExpr, EP_FromJoin);
|
||||
pNewExpr->w.iRightJoinTable = pExpr->w.iRightJoinTable;
|
||||
pNewExpr->w.iJoin = pExpr->w.iJoin;
|
||||
}
|
||||
idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);
|
||||
testcase( idxNew==0 );
|
||||
|
@ -540,4 +540,34 @@ Columns renamed during .import shell5.csv due to duplicates:
|
||||
"CoW" to "CoW_3",
|
||||
"cOw" to "cOw_4"}}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests for preserving utf-8 that is not also ASCII.
|
||||
#
|
||||
|
||||
do_test shell5-6.1 {
|
||||
set out [open shell5.csv w]
|
||||
fconfigure $out -translation lf
|
||||
puts $out {あい,うえお}
|
||||
puts $out {1,2}
|
||||
close $out
|
||||
forcedelete test.db
|
||||
catchcmd test.db {.import -csv shell5.csv t1
|
||||
.mode line
|
||||
SELECT * FROM t1;}
|
||||
} {0 { あい = 1
|
||||
うえお = 2}}
|
||||
|
||||
do_test shell5-6.2 {
|
||||
set out [open shell5.csv w]
|
||||
fconfigure $out -translation lf
|
||||
puts $out {1,2}
|
||||
puts $out {あい,うえお}
|
||||
close $out
|
||||
forcedelete test.db
|
||||
catchcmd test.db {.import -csv shell5.csv t1
|
||||
.mode line
|
||||
SELECT * FROM t1;}
|
||||
} {0 { 1 = あい
|
||||
2 = うえお}}
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user