mirror of
https://github.com/tursodatabase/libsql.git
synced 2025-03-14 07:48:08 +00:00
Do not allow a partial index scan on the left table of a RIGHT JOIN, because
since the index is partial, some rows will be omitted from the scan, and those rows will subsequently be picked up by the no-match logic in the right-join post-processing loop. [forum:/forumpost/c4676c4956|forum post c4676c4956]. FossilOrigin-Name: 615c0026119f7870c3b6ef9dcb57ce4ecf5acedea3e2b5cfc25aa450eb8f17a0
This commit is contained in:
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Minor\sfix\sto\stest/index9.test\sso\sthat\sit\scan\sbe\sinvoked\swith\sother\nindex\stests\susing\sa\swildcard.
|
||||
D 2022-06-08T12:35:39.641
|
||||
C Do\snot\sallow\sa\spartial\sindex\sscan\son\sthe\sleft\stable\sof\sa\sRIGHT\sJOIN,\sbecause\nsince\sthe\sindex\sis\spartial,\ssome\srows\swill\sbe\somitted\sfrom\sthe\sscan,\sand\nthose\srows\swill\ssubsequently\sbe\spicked\sup\sby\sthe\sno-match\slogic\sin\sthe\nright-join\spost-processing\sloop.\n[forum:/forumpost/c4676c4956|forum\spost\sc4676c4956].
|
||||
D 2022-06-08T12:46:58.728
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -657,7 +657,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
|
||||
F src/wal.c b9df133a705093da8977da5eb202eaadb844839f1c7297c08d33471f5491843d
|
||||
F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a
|
||||
F src/walker.c f890a3298418d7cba3b69b8803594fdc484ea241206a8dfa99db6dd36f8cbb3b
|
||||
F src/where.c d0fcb3ae11f3bd5bb65ad64fec947c89280ebdd399135818292ad0ccd9d34b8e
|
||||
F src/where.c 7da9e0c1275fb3f180beb0d63551ea4d246e028908809bbbcd7f56005872d1bd
|
||||
F src/whereInt.h b48ca529ffe293c18cbfa8326af18a09e39910de66fb3e96ef788c7cbf8ef3a7
|
||||
F src/wherecode.c 0b09abfcb88c61c6a6984a3e065786631ff35495e9bdf865e6b74ab0a1299c5b
|
||||
F src/whereexpr.c 20255cf03e0b765b742301197d165511ff99e95da0d7ee9c8a2ebc1e888dd049
|
||||
@ -1129,7 +1129,7 @@ F test/index2.test f835d5e13ca163bd78c4459ca15fd2e4ed487407
|
||||
F test/index3.test 51685f39345462b84fcf77eb8537af847fdf438cc96b05c45d6aaca4e473ade0
|
||||
F test/index4.test ab92e736d5946840236cd61ac3191f91a7856bf6
|
||||
F test/index5.test 8621491915800ec274609e42e02a97d67e9b13e7
|
||||
F test/index6.test 6e5b6943f6a97a34898e48c4d0d4990caf55c12c00465a43a9c33d2fd9a3a820
|
||||
F test/index6.test b376a648e85aa71c50074382784e6cb0c126ec46e43d1ad15af9a4d234c52e65
|
||||
F test/index7.test b238344318e0b4e42126717f6554f0e7dfd0b39cecad4b736039b43e1e3b6eb3
|
||||
F test/index8.test caa097735c91dbc23d8a402f5e63a2a03c83840ba3928733ed7f9a03f8a912a3
|
||||
F test/index9.test 2ac891806a4136ef3e91280477e23114e67575207dc331e6797fa0ed9379f997
|
||||
@ -1975,8 +1975,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 5a107fd7fa01554d73fefc0611e5797b8c23e782ce0df3aeba7e2f288675b2ce
|
||||
R 2986076e88142714853261bca3b46a60
|
||||
P ccbd6e774903f9202f9311954979f6fcc3b13eba1f3402a549a7aee6ed1d55eb
|
||||
R 9e5b91eaa709a211969f755ac60f2577
|
||||
U drh
|
||||
Z 05db8af407c087478eec7553b71b683c
|
||||
Z 3fabe8df6bd5cac6e030c1017487aca1
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
ccbd6e774903f9202f9311954979f6fcc3b13eba1f3402a549a7aee6ed1d55eb
|
||||
615c0026119f7870c3b6ef9dcb57ce4ecf5acedea3e2b5cfc25aa450eb8f17a0
|
@ -3216,7 +3216,10 @@ static int whereUsablePartialIndex(
|
||||
){
|
||||
int i;
|
||||
WhereTerm *pTerm;
|
||||
Parse *pParse = pWC->pWInfo->pParse;
|
||||
Parse *pParse;
|
||||
|
||||
if( jointype & JT_LTORJ ) return 0;
|
||||
pParse = pWC->pWInfo->pParse;
|
||||
while( pWhere->op==TK_AND ){
|
||||
if( !whereUsablePartialIndex(iTab,jointype,pWC,pWhere->pLeft) ) return 0;
|
||||
pWhere = pWhere->pRight;
|
||||
|
@ -508,4 +508,24 @@ do_execsql_test index6-18.1 {
|
||||
SELECT * FROM t1 WHERE a IS NOT NULL;
|
||||
} {10 10}
|
||||
|
||||
# 2022-06-09
|
||||
# https://sqlite.org/forum/forumpost/c4676c4956
|
||||
# Cannot do a scan of a partial index on the left table of a RIGHT JOIN
|
||||
# since that will cause extra rows to appear in the output during the
|
||||
# right-join no-match loop. The following testcase is verify using
|
||||
# PostgreSQL 14.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test index6-19.1 {
|
||||
CREATE TABLE t1(a INT, b INT);
|
||||
INSERT INTO t1(a) VALUES(2);
|
||||
CREATE TABLE t2(c INT);
|
||||
CREATE INDEX i0 ON t2(c) WHERE c=3;
|
||||
CREATE TABLE t3(d INT);
|
||||
INSERT INTO t3 VALUES(1);
|
||||
}
|
||||
do_execsql_test index6-19.2 {
|
||||
SELECT * FROM t2 RIGHT JOIN t3 ON d<>0 LEFT JOIN t1 ON c=3 WHERE t1.a<>0;
|
||||
} {}
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user