Avoid assertion faults in queries using indices with redundant columns.
Ticket [3dbdcdb14e7f41]. FossilOrigin-Name: 946e06cd2a2cc209b0786b7e9d28c0746320d646
This commit is contained in:
parent
6908343c65
commit
be837bddad
26
manifest
26
manifest
@ -1,5 +1,8 @@
|
||||
C Zero\sthe\s"immediate\sFK\sconstraint\scounter"\sassociated\swith\sa\sstatement\sobject\swhen\ssqlite3_reset()\sis\scalled.\sFix\sfor\s[c39ff61c43].
|
||||
D 2010-04-29T22:57:56
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA1
|
||||
|
||||
C Avoid\sassertion\sfaults\sin\squeries\susing\sindices\swith\sredundant\scolumns.\nTicket\s[3dbdcdb14e7f41].
|
||||
D 2010-04-30T21:03:24
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -222,7 +225,7 @@ F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
|
||||
F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
|
||||
F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
|
||||
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
||||
F src/where.c faadd9c2bf08868e5135192b44e0d753e363a885
|
||||
F src/where.c 75fee9e255b62f773fcadd1d1f25b6f63ac7a356
|
||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
|
||||
F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
|
||||
@ -756,7 +759,7 @@ F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
|
||||
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
|
||||
F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
|
||||
F test/where.test de337a3fe0a459ec7c93db16a519657a90552330
|
||||
F test/where2.test 45eacc126aabb37959a387aa83e59ce1f1f03820
|
||||
F test/where2.test 43d4becaf5a5df854e6c21d624a1cb84c6904554
|
||||
F test/where3.test aa44a9b29e8c9f3d7bb94a3bb3a95b31627d520d
|
||||
F test/where4.test e9b9e2f2f98f00379e6031db6a6fca29bae782a2
|
||||
F test/where5.test fdf66f96d29a064b63eb543e28da4dfdccd81ad2
|
||||
@ -798,7 +801,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P ca9d86baf70f210d331ce93102177c8005c494cb
|
||||
R a059ba0054bf8b8b3e167094c8be4a0d
|
||||
U dan
|
||||
Z cbcb2b19feabf4740bc2edb9662818e3
|
||||
P f660be615a0c1f4641782a83744533f5d3119218
|
||||
R 037eba7c61c44ed46ed186528ab88ba6
|
||||
U drh
|
||||
Z f87382a5b2e28a51f3f0db30682d2137
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.6 (GNU/Linux)
|
||||
|
||||
iD8DBQFL20WioxKgR168RlERAlxiAJ4w8aexa2GTqhDb3cG3AfHpTGYYtACeMOWV
|
||||
+0spJvIkBg57uJ7hlauNec4=
|
||||
=n48A
|
||||
-----END PGP SIGNATURE-----
|
||||
|
@ -1 +1 @@
|
||||
f660be615a0c1f4641782a83744533f5d3119218
|
||||
946e06cd2a2cc209b0786b7e9d28c0746320d646
|
@ -2897,7 +2897,7 @@ static void bestIndex(
|
||||
*/
|
||||
static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
|
||||
if( pTerm
|
||||
&& ALWAYS((pTerm->wtFlags & TERM_CODED)==0)
|
||||
&& (pTerm->wtFlags & TERM_CODED)==0
|
||||
&& (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))
|
||||
){
|
||||
pTerm->wtFlags |= TERM_CODED;
|
||||
@ -3095,7 +3095,9 @@ static int codeAllEqualityTerms(
|
||||
int k = pIdx->aiColumn[j];
|
||||
pTerm = findTerm(pWC, iCur, k, notReady, pLevel->plan.wsFlags, pIdx);
|
||||
if( NEVER(pTerm==0) ) break;
|
||||
assert( (pTerm->wtFlags & TERM_CODED)==0 );
|
||||
/* The following true for indices with redundant columns.
|
||||
** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */
|
||||
testcase( (pTerm->wtFlags & TERM_CODED)!=0 );
|
||||
r1 = codeEqualityTerm(pParse, pTerm, pLevel, regBase+j);
|
||||
if( r1!=regBase+j ){
|
||||
if( nReg==1 ){
|
||||
|
@ -620,4 +620,35 @@ ifcapable or_opt&&tclvar {
|
||||
}
|
||||
}
|
||||
|
||||
# Indices with redundant columns
|
||||
#
|
||||
do_test where2-11.1 {
|
||||
execsql {
|
||||
CREATE TABLE t11(a,b,c,d);
|
||||
CREATE INDEX i11aba ON t11(a,b,a,c); -- column A occurs twice.
|
||||
INSERT INTO t11 VALUES(1,2,3,4);
|
||||
INSERT INTO t11 VALUES(5,6,7,8);
|
||||
INSERT INTO t11 VALUES(1,2,9,10);
|
||||
INSERT INTO t11 VALUES(5,11,12,13);
|
||||
SELECT c FROM t11 WHERE a=1 AND b=2 ORDER BY c;
|
||||
}
|
||||
} {3 9}
|
||||
do_test where2-11.2 {
|
||||
execsql {
|
||||
CREATE INDEX i11cccccccc ON t11(c,c,c,c,c,c,c,c); -- repeated column
|
||||
SELECT d FROM t11 WHERE c=9;
|
||||
}
|
||||
} {10}
|
||||
do_test where2-11.3 {
|
||||
execsql {
|
||||
SELECT d FROM t11 WHERE c IN (1,2,3,4,5);
|
||||
}
|
||||
} {4}
|
||||
do_test where2-11.4 {
|
||||
execsql {
|
||||
SELECT d FROM t11 WHERE c=7 OR (a=1 AND b=2) ORDER BY d;
|
||||
}
|
||||
} {4 8 10}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user