Further improvements to codeEqualityTerm() for cases when an IN operator with
a right-hand side subquery is used as a constraint that needs to be processed by the RIGHT JOIN non-matched logic. FossilOrigin-Name: bb2798be3fb5737827eec505db2d4c8cb510d227d98fc26ce748bf2da7e8b382
This commit is contained in:
parent
c64f0e71c1
commit
a25bbaf74a
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Enhance\sthe\sTreeView\sdebugging\soutput\sfor\sExpr\swith\sopcode\sTK_IN\sso\sas\sto\nshow\sthe\sRHS\stable\sand\sthe\ssubroutine\saddress.
|
||||
D 2022-04-30T00:05:37.975
|
||||
C Further\simprovements\sto\scodeEqualityTerm()\sfor\scases\swhen\san\sIN\soperator\swith\na\sright-hand\sside\ssubquery\sis\sused\sas\sa\sconstraint\sthat\sneeds\sto\sbe\sprocessed\nby\sthe\sRIGHT\sJOIN\snon-matched\slogic.
|
||||
D 2022-04-30T00:06:52.768
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -642,7 +642,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
|
||||
F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
|
||||
F src/where.c 43085b3a4ce2e56315fabb0b240a56e76667d9e03c79f287695bcae7b76152d5
|
||||
F src/whereInt.h 4db5a877a9d1f38b5c928c1c84297c07f30b9a3bc1f5f66214cf1a8ef90a0556
|
||||
F src/wherecode.c c55aba3ea3106d40af88faa2b22de52821c48bfdcaa045b05f5c3767bfeaa1e0
|
||||
F src/wherecode.c c7e35e28f1b3f6e95c5dfaa94ce6f7a125db769220bd86c7a52744a1227b2778
|
||||
F src/whereexpr.c 174d4ad5be165c610c907abb779ef4a97974d22b84e1ce7898d2d9f6947249e5
|
||||
F src/window.c 924e04fd6e0e113d4dba18b78d43fcb8e42b8ebffc8fc728da52cf3ab014cf3c
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
@ -1148,7 +1148,7 @@ F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
|
||||
F test/join5.test c4df54e2e204d7f1417bfbdd21ca324b4b07415c647595cc47798eacfddc96d3
|
||||
F test/join6.test f809c025fa253f9e150c0e9afd4cef8813257bceeb6f46e04041228c9403cc2c
|
||||
F test/join7.test 8e72de4b45e5e930d18c305c7efe86015fb2552731e4e03ea226353036b0dab0
|
||||
F test/join8.test 88ea7b26437d3141167895da4287c4f92e484a9a38bfc25c062144092ac1758f
|
||||
F test/join8.test ecb51527fa3dedea1b9e816b1bc5a9effe73894bd3630936716ee5983dd99081
|
||||
F test/join9.test 9056ddd3b0c0f4f9d658f4521038d9a37dc23ead8ca9a505d0b0db2b6a471e05
|
||||
F test/joinA.test 7eab225dc1c1ab258a5e62513a4ed7cabbd3db971d59d5d92f4fb6fa14c12f6a
|
||||
F test/joinB.test 1b2ba3fc8568b49411787fccbf540570c148e9b6a53a30f80691cb6268098ded
|
||||
@ -1951,8 +1951,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 56dd3065469e49320b13af039471b3f0b85e6f7368cfd97b1cdc0cf8fa8e1956
|
||||
R a9c50a69f413cdbca9e2fe9cf049f583
|
||||
P aec1e4cd59ae874b66335e4f87322fbe31fbb752429e68bf41338db316d0a9ed
|
||||
R 3ef32004450fadb98cceaba22af0f147
|
||||
U drh
|
||||
Z 6276b679cc8e2417eedb1432e1dbcb3d
|
||||
Z e12eec7e3b77f2bd28ff448aaa1d497c
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
aec1e4cd59ae874b66335e4f87322fbe31fbb752429e68bf41338db316d0a9ed
|
||||
bb2798be3fb5737827eec505db2d4c8cb510d227d98fc26ce748bf2da7e8b382
|
@ -610,17 +610,25 @@ static int codeEqualityTerm(
|
||||
iTab = 0;
|
||||
if( !ExprUseXSelect(pX) || pX->x.pSelect->pEList->nExpr==1 ){
|
||||
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab);
|
||||
}else if( pTerm->pExpr->iTable==0 ){
|
||||
sqlite3 *db = pParse->db;
|
||||
pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX);
|
||||
|
||||
if( !db->mallocFailed ){
|
||||
aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
|
||||
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab);
|
||||
pTerm->pExpr->iTable = iTab;
|
||||
}else{
|
||||
Expr *pExpr = pTerm->pExpr;
|
||||
if( pExpr->iTable==0 || !ExprHasProperty(pExpr, EP_Subrtn) ){
|
||||
sqlite3 *db = pParse->db;
|
||||
pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX);
|
||||
if( !db->mallocFailed ){
|
||||
aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
|
||||
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap,&iTab);
|
||||
pExpr->iTable = iTab;
|
||||
pExpr->op2 = eType;
|
||||
}
|
||||
sqlite3ExprDelete(db, pX);
|
||||
}else{
|
||||
sqlite3VdbeAddOp2(v, OP_Gosub, pExpr->y.sub.regReturn,
|
||||
pExpr->y.sub.iAddr);
|
||||
iTab = pExpr->iTable;
|
||||
eType = pExpr->op2;
|
||||
}
|
||||
sqlite3ExprDelete(db, pX);
|
||||
pX = pTerm->pExpr;
|
||||
pX = pExpr;
|
||||
}
|
||||
|
||||
if( eType==IN_INDEX_INDEX_DESC ){
|
||||
|
@ -165,5 +165,12 @@ do_execsql_test join8-6000 {
|
||||
SELECT * FROM t1 AS t2 NATURAL RIGHT JOIN t1 AS t3
|
||||
WHERE (a,b) IN (SELECT rowid, b FROM t1);
|
||||
} {1 A aa 2.5}
|
||||
do_execsql_test join8-6010 {
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(a INT PRIMARY KEY, b TEXT, c TEXT, d INT) WITHOUT ROWID;
|
||||
INSERT INTO t1 VALUES(15,'xray','baker',42);
|
||||
SELECT value, t1.* FROM json_each('7') NATURAL RIGHT JOIN t1
|
||||
WHERE (a,b) IN (SELECT a, b FROM t1);
|
||||
} {7 15 xray baker 42}
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user