Fix a problem handling (a, b) IN (SELECT ...) expressions when there is an index on just one of "a" or "b".
FossilOrigin-Name: 231c72d9f651f3a70d5c8af080f3ff181b89d939
This commit is contained in:
parent
ed24da4b16
commit
83c434e68d
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Enhance\sthe\ssqlite3GetTempRange()\sand\ssqlite3ReleaseTempRange()\sinternal\nroutines\sso\sthat\sthey\suse\ssqlite3GetTempReg()\sand\ssqlite3ReleaseTempReg()\nwhen\snReg==1.
|
||||
D 2016-09-06T14:37:05.419
|
||||
C Fix\sa\sproblem\shandling\s(a,\sb)\sIN\s(SELECT\s...)\sexpressions\swhen\sthere\sis\san\sindex\son\sjust\sone\sof\s"a"\sor\s"b".
|
||||
D 2016-09-06T14:58:15.417
|
||||
F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 5017381e4853b1472e01d5bb926be1268eba429c
|
||||
@ -467,7 +467,7 @@ F src/wal.h 6dd221ed384afdc204bc61e25c23ef7fd5a511f2
|
||||
F src/walker.c 2d2cc7fb0f320f7f415215d7247f3c584141ac09
|
||||
F src/where.c 48d705e5196a0611a7be90698eade455ee238536
|
||||
F src/whereInt.h 14dd243e13b81cbb0a66063d38b70f93a7d6e613
|
||||
F src/wherecode.c 8a9a53cb52dd8a75e07c85e3bc12c1604c735954
|
||||
F src/wherecode.c 7279bb68e2f947ac5fe4c1fc655757b24878d541
|
||||
F src/whereexpr.c c5ec87e234faf62ac2d4e7f7ce18fb1f4bd475ff
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
|
||||
@ -1028,7 +1028,7 @@ F test/rowvalue5.test a440d490c8c0bf606034c09d5c6bbf7840b98f95
|
||||
F test/rowvalue6.test d19b54feb604d5601f8614b15e214e0774c01087
|
||||
F test/rowvalue7.test 5d06ff19d9e6969e574a2e662a531dd0c67801a8
|
||||
F test/rowvalue8.test 5900eddad9e2c3c2e26f1a95f74aafc1232ee5e0
|
||||
F test/rowvalue9.test 749a471f237f3fcfdfbd902f850adff2d9963560
|
||||
F test/rowvalue9.test 480c60654941bebdc2d0caa0104df7ca358cbed2
|
||||
F test/rowvaluefault.test 7b16485e3f2b371f3e3d05455b8ded6d0c090244
|
||||
F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798
|
||||
F test/run-wordcount.sh 891e89c4c2d16e629cd45951d4ed899ad12afc09
|
||||
@ -1522,7 +1522,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 288e934f356ff6276b3e7581ac0f998ca6e93610
|
||||
R 373bd5ec1c7378267f0ce69533be2f50
|
||||
U drh
|
||||
Z c12fde59fd4c6cc2e37d73169853128b
|
||||
P 4071da2f87a2f24a279ac3bced8c794ad374b47c
|
||||
R 57b76f412decde1968bde74dac3d47dc
|
||||
U dan
|
||||
Z 9ca614bd00458fc036a54c6c73063696
|
||||
|
@ -1 +1 @@
|
||||
4071da2f87a2f24a279ac3bced8c794ad374b47c
|
||||
231c72d9f651f3a70d5c8af080f3ff181b89d939
|
@ -463,11 +463,20 @@ static int codeEqualityTerm(
|
||||
}
|
||||
}
|
||||
if( !db->mallocFailed ){
|
||||
Expr *pLeft = pX->pLeft;
|
||||
/* Take care here not to generate a TK_VECTOR containing only a
|
||||
** single value. Since the parser never creates such a vector, some
|
||||
** of the subroutines do not handle this case. */
|
||||
if( pLhs->nExpr==1 ){
|
||||
pX->pLeft = pLhs->a[0].pExpr;
|
||||
}else{
|
||||
pLeft->x.pList = pLhs;
|
||||
}
|
||||
pX->x.pSelect->pEList = pRhs;
|
||||
pX->pLeft->x.pList = pLhs;
|
||||
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap);
|
||||
pX->x.pSelect->pEList = pOrigRhs;
|
||||
pX->pLeft->x.pList = pOrigLhs;
|
||||
pLeft->x.pList = pOrigLhs;
|
||||
pX->pLeft = pLeft;
|
||||
}
|
||||
sqlite3ExprListDelete(pParse->db, pLhs);
|
||||
sqlite3ExprListDelete(pParse->db, pRhs);
|
||||
|
@ -18,6 +18,19 @@ set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set ::testprefix rowvalue9
|
||||
|
||||
# Tests:
|
||||
#
|
||||
# 1.*: Test that affinities are handled correctly by various row-value
|
||||
# operations without indexes.
|
||||
#
|
||||
# 2.*: Test an affinity bug that came up during testing.
|
||||
#
|
||||
# 3.*: Test a row-value version of the bug tested by 2.*.
|
||||
#
|
||||
# 4.*: Test that affinities are handled correctly by various row-value
|
||||
# operations with assorted indexes.
|
||||
#
|
||||
|
||||
do_execsql_test 1.0.1 {
|
||||
CREATE TABLE a1(c, b INTEGER, a TEXT, PRIMARY KEY(a, b));
|
||||
|
||||
@ -206,5 +219,22 @@ foreach {tn idx} {
|
||||
} {2 4}
|
||||
}
|
||||
|
||||
do_execsql_test 5.0 {
|
||||
CREATE TABLE e1(a TEXT, c NUMERIC);
|
||||
CREATE TABLE e2(x BLOB, y BLOB);
|
||||
|
||||
INSERT INTO e1 VALUES(2, 2);
|
||||
|
||||
INSERT INTO e2 VALUES ('2', 2);
|
||||
INSERT INTO e2 VALUES ('2', '2');
|
||||
INSERT INTO e2 VALUES ('2', '2.0');
|
||||
|
||||
CREATE INDEX e1c ON e1(c);
|
||||
}
|
||||
|
||||
do_execsql_test 5.1 {
|
||||
SELECT rowid FROM e1 WHERE (a, c) IN (SELECT x, y FROM e2);
|
||||
} {1}
|
||||
|
||||
finish_test
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user