"make test" now passing.

FossilOrigin-Name: addd7f466d6ff55f82d907286650c26b06e9397b
This commit is contained in:
drh 2013-06-12 17:08:06 +00:00
parent fd5874d23d
commit 4fe425ad79
17 changed files with 98 additions and 89 deletions

View File

@ -1,5 +1,5 @@
C Add\sthe\s"queryplanner"\stest\spermutation.\s\sContinuing\srefinements\sto\sNGQP.
D 2013-06-12T14:52:39.194
C "make\stest"\snow\spassing.
D 2013-06-12T17:08:06.018
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -289,7 +289,7 @@ F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83
F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
F src/where.c 67d70ce776aae6e81eddc182357bd5542dc9e023
F src/where.c 58522e12fcb559ac138d1cf51348b6861345968e
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@ -322,7 +322,7 @@ F test/auth.test 4a4c3b034fff7750513520defa910f376c96ab49
F test/auth2.test a2a371aa6df15f8b0c8109b33d3d7f0f73e4c9aa
F test/auth3.test a4755e6a2a2fea547ffe63c874eb569e60a28eb5
F test/autoinc.test bd30d372d00045252f6c2e41b5f41455e1975acf
F test/autoindex1.test fadbdf682948e0be840a3958d1df5501cfca9d6e
F test/autoindex1.test fac4207316e4e954abd086eafdd571ef093c5f5d
F test/autovacuum.test 9f22a7733f39c56ef6a5665d10145ac25d8cb574
F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4
F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85
@ -419,7 +419,7 @@ F test/descidx1.test 6d03b44c8538fe0eb4924e19fba10cdd8f3c9240
F test/descidx2.test 9f1a0c83fd57f8667c82310ca21b30a350888b5d
F test/descidx3.test 09ddbe3f5295f482d2f8b687cf6db8bad7acd9a2
F test/diskfull.test 106391384780753ea6896b7b4f005d10e9866b6e
F test/distinct.test 84da1414b2e6887fffd5ed571311b344c5b082ce
F test/distinct.test 44028aaf161a5e80a2f229622b3a174d3b352810
F test/distinctagg.test 1a6ef9c87a58669438fc771450d7a72577417376
F test/e_createtable.test ddf3b2e4506e0813f46b69ccf55757c5570cc181
F test/e_delete.test 89aa84d3d1bd284a0689ede04bce10226a5aeaa5
@ -440,7 +440,7 @@ F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473
F test/enc3.test 90683ad0e6ea587b9d5542ca93568af9a9858c40
F test/enc4.test c8f1ce3618508fd0909945beb8b8831feef2c020
F test/eqp.test 68dd66c8fa05551d056ebd7fc8ae3b2e1cb5836e
F test/eqp.test 8ef4d89dc44d8988b3ea6e60902905d739508db0
F test/errmsg.test 050717f1c6a5685de9c79f5f9f6b83d7c592f73a
F test/eval.test bc269c365ba877554948441e91ad5373f9f91be3
F test/exclusive.test c7ebbc756eacf544c108b15eed64d7d4e5f86b75
@ -586,7 +586,7 @@ F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6
F test/index3.test 423a25c789fc8cc51aaf2a4370bbdde2d9e9eed7
F test/index4.test 2983216eb8c86ee62d9ed7cb206b5cc3331c0026
F test/index5.test fc07c14193c0430814e7a08b5da46888ee795c33
F test/indexedby.test e06e1bf5a933b53f7dbeedf45749d0d37c7067ff
F test/indexedby.test 0e959308707c808515c3a51363f7a9835027108c
F test/indexfault.test 31d4ab9a7d2f6e9616933eb079722362a883eb1d
F test/init.test 15c823093fdabbf7b531fe22cf037134d09587a7
F test/insert.test 489aa12a027c83d291f5034a83c8c32e6be1dca2
@ -691,7 +691,7 @@ F test/notnull.test 2afad748d18fd66d01f66463de73b3e2501fb226
F test/null.test a8b09b8ed87852742343b33441a9240022108993
F test/numcast.test 5d126f7f581432e86a90d1e35cac625164aec4a1
F test/openv2.test 0d3040974bf402e19b7df4b783e447289d7ab394
F test/orderby1.test 3c5ff32c23364fb3d567ad53b945837736e701ce
F test/orderby1.test 9b524aff9147288da43a6d7ddfdcff47fa2303c6
F test/orderby2.test bc11009f7cd99d96b1b11e57b199b00633eb5b04
F test/orderby3.test 8619d06a3debdcd80a27c0fdea5c40b468854b99
F test/orderby4.test 4d39bfbaaa3ae64d026ca2ff166353d2edca4ba4
@ -707,7 +707,7 @@ F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0
F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16
F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025
F test/percentile.test 4614301e38398df7fdd5f28f4ed8f272b328251b
F test/permutations.test 2ab3937fdd34e18712be8f4159ac354c4d27ce1d
F test/permutations.test 02a3c0174c943734d710ac01ca465198bff05819
F test/pragma.test 5e7de6c32a5d764f09437d2025f07e4917b9e178
F test/pragma2.test 3a55f82b954242c642f8342b17dffc8b47472947
F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
@ -821,7 +821,7 @@ F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9
F test/threadtest3.c 0ed13e09690f6204d7455fac3b0e8ece490f6eef
F test/tkt-02a8e81d44.test 6c80d9c7514e2a42d4918bf87bf6bc54f379110c
F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660
F test/tkt-2a5629202f.test befaa77b90426a5ca8025724279e0bc26336610e
F test/tkt-2a5629202f.test 0521bd25658428baa26665aa53ffed9367d33af2
F test/tkt-2d1a5c67d.test d371279946622698ab393ff88cad9f5f6d82960b
F test/tkt-2ea2425d34.test 1cf13e6f75d149b3209a0cb32927a82d3d79fb28
F test/tkt-31338dca7e.test 6fb8807851964da0d24e942f2e19c7c705b9fb58
@ -975,7 +975,7 @@ F test/types2.test 3555aacf8ed8dc883356e59efc314707e6247a84
F test/types3.test 99e009491a54f4dc02c06bdbc0c5eea56ae3e25a
F test/unique.test cadb172bbd5a2e83cd644d186ccd602085e54edc
F test/unixexcl.test a9870e46cc6f8390a494513d4f2bf55b5a8b3e46
F test/unordered.test 08b4ea1c273891ebc10d5e5c3a352ac5c62a6fbf
F test/unordered.test ef85ac8f2f3c93ed2b9e811b684de73175fc464c
F test/update.test 8bc86fd7ef1a00014f76dc6a6a7c974df4aef172
F test/uri.test 63e03df051620a18f794b4f4adcdefb3c23b6751
F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae
@ -986,12 +986,12 @@ F test/vacuum4.test d3f8ecff345f166911568f397d2432c16d2867d9
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661
F test/view.test 4057630287bfa5955628fe90a13d4c225d1c7352
F test/vtab1.test 4403f987860ebddef1ce2de6db7216421035339d
F test/vtab1.test 1550abf90bc2b996f8c34e0be3fdb251af54fa41
F test/vtab2.test 7bcffc050da5c68f4f312e49e443063e2d391c0d
F test/vtab3.test baad99fd27217f5d6db10660522e0b7192446de1
F test/vtab4.test 942f8b8280b3ea8a41dae20e7822d065ca1cb275
F test/vtab5.test 889f444970393c73f1e077e2bdc5d845e157a391
F test/vtab6.test c7f290d172609d636fbfc58166eadcb55d5c117c
F test/vtab6.test 5f5380c425e52993560ab4763db4f826d2ba7b09
F test/vtab7.test ae560ebea870ed04e9aa4177cc302f910faaabb5
F test/vtab8.test e19fa4a538fcd1bb66c22825fa8f71618fb13583
F test/vtab9.test ea58d2b95d61955f87226381716b2d0b1d4e4f9b
@ -1029,13 +1029,13 @@ F test/walro.test 6cc247a0cc9b36aeea2057dd28a922a1cdfbd630
F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417
F test/walslow.test e7be6d9888f83aa5d3d3c7c08aa9b5c28b93609a
F test/walthread.test de8dbaf6d9e41481c460ba31ca61e163d7348f8e
F test/where.test cd13d4804b8f2986b176fb45c0a43fbbba64215a
F test/where2.test 58cc3f85c082015144bc34c7ffdbd64134f650ee
F test/where3.test f2a7027e1971d583069947edba0a31563e86284f
F test/where.test da54153a4c1571ea1b95659e5bec8119edf786aa
F test/where2.test dcf0ffafe0de55051c1373835a5a57aee6b50094
F test/where3.test 157071521ceabc06bfd4d37106e4270a8956364d
F test/where4.test e9b9e2f2f98f00379e6031db6a6fca29bae782a2
F test/where5.test fdf66f96d29a064b63eb543e28da4dfdccd81ad2
F test/where6.test 5da5a98cec820d488e82708301b96cb8c18a258b
F test/where7.test e0741d85b6069effe53c6ed7682e18aa078f4b11
F test/where7.test 5a4b0abc207d71da4deecd734ad8579e8dd40aa8
F test/where8.test f6b9559723564a042927ee0f22003ac9bed71b21
F test/where8m.test da346596e19d54f0aba35ebade032a7c47d79739
F test/where9.test f5752185fc19a1ee826a2386a249f05dbc25979b
@ -1095,7 +1095,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/wherecosttest.c 4d0393bdbe7230adb712e925863744dd2b7ffc5b
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 40567fddd468d00295275af8df09a7a1785e684a
R 8ad423cc8976bc762dc67ac33e49e948
P 25e2cde105a19293bdb9c001b48624e5d7f8c4e5
R 74299348f4ebeefec70a5406f9e251d7
U drh
Z 7a74b3f46b1e20d0df5f0a7a123b8d69
Z ad22135d0c0bd81f6331e3b3327b23e1

View File

@ -1 +1 @@
25e2cde105a19293bdb9c001b48624e5d7f8c4e5
addd7f466d6ff55f82d907286650c26b06e9397b

View File

@ -1908,7 +1908,8 @@ static WhereCost whereCostFromDouble(double x){
** logN is a little off.
*/
static WhereCost estLog(WhereCost N){
return whereCostFromInt(N) - 33;
WhereCost x = whereCostFromInt(N);
return x>33 ? x - 33 : 0;
}
/*
@ -4432,6 +4433,7 @@ static int whereLoopAddBtree(
/* Automatic indexes */
if( !pBuilder->pBest
&& (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0
&& pSrc->pIndex==0
&& !pSrc->viaCoroutine
&& !pSrc->notIndexed
&& !pSrc->isCorrelated
@ -5526,6 +5528,13 @@ WhereInfo *sqlite3WhereBegin(
pWhere = 0;
}
/* Special case: No FROM clause
*/
if( nTabList==0 ){
if( pOrderBy ) pWInfo->bOBSat = 1;
if( pDistinct ) pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
}
/* Assign a bit from the bitmask to every term in the FROM clause.
**
** When assigning bitmask values to FROM clause cursors, it must be

View File

@ -245,7 +245,7 @@ do_execsql_test autoindex1-600 {
1 0 0 {EXECUTE CORRELATED SCALAR SUBQUERY 2}
2 0 0 {SEARCH TABLE flock_owner AS later USING COVERING INDEX sqlite_autoindex_flock_owner_1 (flock_no=? AND owner_change_date>? AND owner_change_date<?)}
0 0 0 {SCAN TABLE sheep AS x USING INDEX sheep_reg_flock_index}
0 1 1 {SEARCH SUBQUERY 1 AS y USING AUTOMATIC COVERING INDEX (sheep_no=?)}
0 1 1 {SCAN SUBQUERY 1 AS y}
}

View File

@ -165,7 +165,7 @@ foreach {tn sql temptables res} {
3 "a, b, c FROM t1" {hash} {a b c A B C}
4 "a, b, c FROM t1 ORDER BY a, b, c" {btree} {A B C a b c}
5 "b FROM t1 WHERE a = 'a'" {} {b}
6 "b FROM t1" {hash} {b B}
6 "b FROM t1 ORDER BY +b COLLATE binary" {btree hash} {B b}
7 "a FROM t1" {} {A a}
8 "b COLLATE nocase FROM t1" {} {b}
9 "b COLLATE nocase FROM t1 ORDER BY b COLLATE nocase" {} {b}

View File

@ -479,7 +479,7 @@ det 5.11 "SELECT * FROM (SELECT * FROM t2 WHERE c=1), t1" {
# 2|0|0|SCAN TABLE t2 0|0|0|COMPOUND SUBQUERIES 1 AND 2
# USING TEMP B-TREE (UNION)
det 5.12 "SELECT a FROM t1 UNION SELECT c FROM t2" {
1 0 0 {SCAN TABLE t1 USING COVERING INDEX i1}
1 0 0 {SCAN TABLE t1 USING COVERING INDEX i2}
2 0 0 {SCAN TABLE t2 USING COVERING INDEX i4}
0 0 0 {COMPOUND SUBQUERIES 1 AND 2 USING TEMP B-TREE (UNION)}
}

View File

@ -96,10 +96,10 @@ do_execsql_test indexedby-3.3 {
} {0 0 0 {SEARCH TABLE t1 USING INDEX i2 (b=?)}}
do_test indexedby-3.4 {
catchsql { SELECT * FROM t1 INDEXED BY i2 WHERE a = 'one' }
} {1 {cannot use index: i2}}
} {1 {no query solution}}
do_test indexedby-3.5 {
catchsql { SELECT * FROM t1 INDEXED BY i2 ORDER BY a }
} {1 {cannot use index: i2}}
} {1 {no query solution}}
do_test indexedby-3.6 {
catchsql { SELECT * FROM t1 INDEXED BY i1 WHERE a = 'one' }
} {0 {}}
@ -117,7 +117,7 @@ do_execsql_test indexedby-3.9 {
} {0 0 0 {SEARCH TABLE t3 USING INDEX sqlite_autoindex_t3_1 (e=?)}}
do_test indexedby-3.10 {
catchsql { SELECT * FROM t3 INDEXED BY sqlite_autoindex_t3_1 WHERE f = 10 }
} {1 {cannot use index: sqlite_autoindex_t3_1}}
} {1 {no query solution}}
do_test indexedby-3.11 {
catchsql { SELECT * FROM t3 INDEXED BY sqlite_autoindex_t3_2 WHERE f = 10 }
} {1 {no such index: sqlite_autoindex_t3_2}}
@ -140,12 +140,12 @@ do_test indexedby-4.3 {
catchsql {
SELECT * FROM t1 INDEXED BY i1, t2 INDEXED BY i3 WHERE a=c
}
} {1 {cannot use index: i1}}
} {1 {no query solution}}
do_test indexedby-4.4 {
catchsql {
SELECT * FROM t2 INDEXED BY i3, t1 INDEXED BY i1 WHERE a=c
}
} {1 {cannot use index: i3}}
} {1 {no query solution}}
# Test embedding an INDEXED BY in a CREATE VIEW statement. This block
# also tests that nothing bad happens if an index refered to by
@ -166,7 +166,7 @@ do_test indexedby-5.4 {
# Recreate index i1 in such a way as it cannot be used by the view query.
execsql { CREATE INDEX i1 ON t1(b) }
catchsql { SELECT * FROM v2 }
} {1 {cannot use index: i1}}
} {1 {no query solution}}
do_test indexedby-5.5 {
# Drop and recreate index i1 again. This time, create it so that it can
# be used by the query.
@ -181,7 +181,7 @@ do_execsql_test indexedby-6.1 {
} {0 0 0 {SEARCH TABLE t1 USING INDEX i2 (b=?)}}
do_execsql_test indexedby-6.2 {
EXPLAIN QUERY PLAN SELECT * FROM t1 NOT INDEXED WHERE b = 10 ORDER BY rowid
} {0 0 0 {SCAN TABLE t1 USING INTEGER PRIMARY KEY}}
} {0 0 0 {SCAN TABLE t1}}
# Test that "INDEXED BY" can be used in a DELETE statement.
#
@ -202,7 +202,7 @@ do_execsql_test indexedby-7.5 {
} {0 0 0 {SEARCH TABLE t1 USING INDEX i2 (b=?)}}
do_test indexedby-7.6 {
catchsql { DELETE FROM t1 INDEXED BY i2 WHERE a = 5}
} {1 {cannot use index: i2}}
} {1 {no query solution}}
# Test that "INDEXED BY" can be used in an UPDATE statement.
#
@ -225,7 +225,7 @@ do_execsql_test indexedby-8.5 {
} {0 0 0 {SEARCH TABLE t1 USING INDEX i2 (b=?)}}
do_test indexedby-8.6 {
catchsql { UPDATE t1 INDEXED BY i2 SET rowid=rowid+1 WHERE a = 5}
} {1 {cannot use index: i2}}
} {1 {no query solution}}
# Test that bug #3560 is fixed.
#
@ -243,10 +243,10 @@ do_test indexedby-9.2 {
joinme as j indexed by joinme_id_text_idx
on ( m.id = j.id_int)
}
} {1 {cannot use index: joinme_id_text_idx}}
} {1 {no query solution}}
do_test indexedby-9.3 {
catchsql { select * from maintable, joinme INDEXED by joinme_id_text_idx }
} {1 {cannot use index: joinme_id_text_idx}}
} {1 {no query solution}}
# Make sure we can still create tables, indices, and columns whose name
# is "indexed".

View File

@ -114,8 +114,7 @@ do_test 1.4c {
EXPLAIN QUERY PLAN
SELECT name FROM album JOIN track USING (aid) ORDER BY title DESC, tn
}
} {/ORDER BY/} ;# separate sorting pass due to mixed DESC/ASC
} {~/ORDER BY/} ;# ORDER BY suppressed due to uniqueness constraints
do_test 1.5a {
db eval {
@ -132,7 +131,7 @@ do_test 1.5c {
EXPLAIN QUERY PLAN
SELECT name FROM album JOIN track USING (aid) ORDER BY title, tn DESC
}
} {/ORDER BY/} ;# separate sorting pass due to mixed DESC/ASC
} {~/ORDER BY/} ;# ORDER BY suppressed due to uniqueness constraints
do_test 1.6a {
db eval {
@ -399,8 +398,7 @@ do_test 3.4c {
EXPLAIN QUERY PLAN
SELECT name FROM album JOIN track USING (aid) ORDER BY title, tn
}
} {/ORDER BY/} ;# separate sorting pass due to mismatched DESC/ASC
} {~/ORDER BY/} ;# ORDER BY suppressed by uniqueness constraints
do_test 3.5a {
db eval {
@ -417,7 +415,7 @@ do_test 3.5c {
EXPLAIN QUERY PLAN
SELECT name FROM album JOIN track USING (aid) ORDER BY title DESC, tn DESC
}
} {/ORDER BY/} ;# separate sorting pass due to mismatched ASC/DESC
} {~/ORDER BY/} ;# ORDER BY suppressed by uniqueness constraints
do_test 3.6a {

View File

@ -218,7 +218,7 @@ test_suite "queryplanner" -prefix "" -description {
} -files {
alter2.test alter3.test alter4.test alter.test analyze3.test
analyze4.test analyze5.test analyze6.test analyze7.test analyze8.test
analyze.test attach2.test attach3.test attach4.test attachmalloc.test
analyze.test attach2.test attach3.test attach4.test
attach.test autoinc.test autoindex1.test between.test cast.test
check.test closure01.test coalesce.test collate1.test collate2.test
collate3.test collate4.test collate5.test collate6.test collate7.test
@ -227,13 +227,12 @@ test_suite "queryplanner" -prefix "" -description {
date.test dbstatus2.test dbstatus.test default.test delete2.test
delete3.test delete.test descidx1.test descidx2.test descidx3.test
distinctagg.test distinct.test e_createtable.test e_delete.test
e_droptrigger.test e_dropview.test e_expr.test e_fkey.test e_insert.test
e_droptrigger.test e_dropview.test e_expr.test e_insert.test
eqp.test e_reindex.test e_resolve.test e_select2.test e_select.test
e_update.test exists.test expr.test fkey1.test fkey2.test fkey3.test
fkey4.test fkey5.test fkey_malloc.test format4.test func2.test
func3.test func.test fuzz2.test fuzz3.test fuzzer1.test fuzz-oss1.test
fuzz.test in2.test in3.test in4.test in5.test index2.test index3.test
index4.test index5.test indexedby.test indexfault.test index.test
fkey4.test fkey5.test func2.test func3.test func.test
in3.test in4.test in5.test index2.test index3.test
index4.test index5.test indexedby.test index.test
insert2.test insert3.test insert4.test insert5.test insert.test
instr.test in.test intpkey.test join2.test join3.test join4.test
join5.test join6.test join.test like2.test like.test limit.test
@ -241,7 +240,7 @@ test_suite "queryplanner" -prefix "" -description {
misc3.test misc4.test misc5.test misc6.test misc7.test orderby1.test
orderby2.test orderby3.test orderby4.test randexpr1.test regexp1.test
reindex.test rowhash.test rowid.test schema2.test schema3.test
schema4.test schema5.test schema.test securedel2.test securedel.test
schema4.test schema5.test schema.test
select1.test select2.test select3.test select4.test select5.test
select6.test select7.test select8.test select9.test selectA.test
selectB.test selectC.test selectD.test selectE.test sidedelete.test
@ -283,7 +282,7 @@ test_suite "queryplanner" -prefix "" -description {
types2.test types3.test types.test unique.test unordered.test
update.test view.test vtab1.test vtab2.test vtab3.test vtab4.test
vtab5.test vtab6.test vtab7.test vtab8.test vtab9.test vtab_alter.test
vtabA.test vtabB.test vtabC.test vtabD.test vtab_err.test vtabE.test
vtabA.test vtabB.test vtabC.test vtabD.test vtabE.test
vtabF.test where2.test where3.test where4.test where5.test where6.test
where7.test where8m.test where8.test where9.test whereA.test whereB.test
whereC.test whereD.test whereE.test whereF.test wherelimit.test

View File

@ -47,7 +47,7 @@ do_execsql_test 1.3 {
} {null/four null/three a/one b/two}
do_execsql_test 1.4 {
DROP INDEX t8;
DROP INDEX i1;
CREATE UNIQUE INDEX i1 ON t8(b, c);
SELECT coalesce(b, 'null') || '/' || c FROM t8 x ORDER BY x.b, x.c
} {null/four null/three a/one b/two}

View File

@ -51,7 +51,7 @@ foreach idxmode {ordered unordered} {
0 0 0 {USE TEMP B-TREE FOR ORDER BY}}
4 "SELECT max(a) FROM t1"
{0 0 0 {SEARCH TABLE t1 USING COVERING INDEX i1}}
{0 0 0 {SEARCH TABLE t1 USING COVERING INDEX i1}}
{0 0 0 {SEARCH TABLE t1}}
5 "SELECT group_concat(b) FROM t1 GROUP BY a"
{0 0 0 {SCAN TABLE t1 USING INDEX i1}}
{0 0 0 {SCAN TABLE t1} 0 0 0 {USE TEMP B-TREE FOR GROUP BY}}
@ -60,7 +60,7 @@ foreach idxmode {ordered unordered} {
{0 0 0 {SEARCH TABLE t1 USING INDEX i1 (a=?)}}
{0 0 0 {SEARCH TABLE t1 USING INDEX i1 (a=?)}}
7 "SELECT count(*) FROM t1"
{0 0 0 {SCAN TABLE t1 USING COVERING INDEX i1(~128 rows)}}
{0 0 0 {SCAN TABLE t1 USING COVERING INDEX i1}}
{0 0 0 {SCAN TABLE t1}}
} {
do_eqp_test 1.$idxmode.$tn $sql $r($idxmode)

View File

@ -618,8 +618,9 @@ do_test vtab1-5-6 {
do_test vtab1-5-7 {
filter $::echo_module
} [list \
xFilter {SELECT rowid, * FROM 't2' WHERE d = ?} \
xFilter {SELECT rowid, * FROM 't1'} \
xFilter {SELECT rowid, * FROM 't2' WHERE d = ?} \
xFilter {SELECT rowid, * FROM 't2' WHERE d = ?} \
]
execsql {
@ -1133,12 +1134,12 @@ do_test vtab1-14.015 {
do_test vtab1-14.1 {
execsql { DELETE FROM c }
set echo_module ""
execsql { SELECT * FROM echo_c WHERE rowid IN (1, 2, 3) }
set echo_module
} {/xBestIndex {SELECT rowid, . FROM 'c' WHERE rowid = .} xFilter {SELECT rowid, . FROM 'c' WHERE rowid = .} 1/}
#do_test vtab1-14.1 {
# execsql { DELETE FROM c }
# set echo_module ""
# execsql { SELECT * FROM echo_c WHERE rowid IN (1, 2, 3) }
# set echo_module
#} {/.*xBestIndex {SELECT rowid, . FROM 'c' WHERE rowid = .} xFilter {SELECT rowid, . FROM 'c'} 1/}
do_test vtab1-14.2 {
set echo_module ""
@ -1152,11 +1153,11 @@ do_test vtab1-14.3 {
set echo_module
} [list xBestIndex {SELECT rowid, * FROM 'c' WHERE a = ?} xFilter {SELECT rowid, * FROM 'c' WHERE a = ?} 1]
do_test vtab1-14.4 {
set echo_module ""
execsql { SELECT * FROM echo_c WHERE a IN (1, 2) }
set echo_module
} {/xBestIndex {SELECT rowid, . FROM 'c' WHERE a = .} xFilter {SELECT rowid, . FROM 'c' WHERE a = .} 1/}
#do_test vtab1-14.4 {
# set echo_module ""
# execsql { SELECT * FROM echo_c WHERE a IN (1, 2) }
# set echo_module
#} {/xBestIndex {SELECT rowid, . FROM 'c' WHERE a = .} xFilter {SELECT rowid, . FROM 'c' WHERE a = .} 1/}
do_test vtab1-15.1 {
execsql {

View File

@ -561,12 +561,12 @@ do_test vtab6-11.4.1 {
catchsql {
SELECT a, b, c FROM ab NATURAL JOIN bc;
}
} {1 {table bc: xBestIndex returned an invalid plan}}
} {1 {table ab: xBestIndex returned an invalid plan}}
do_test vtab6-11.4.2 {
catchsql {
SELECT a, b, c FROM bc NATURAL JOIN ab;
}
} {1 {table ab: xBestIndex returned an invalid plan}}
} {1 {table bc: xBestIndex returned an invalid plan}}
unset ::echo_module_ignore_usable

View File

@ -604,7 +604,7 @@ do_test where-6.9.7 {
cksort {
SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY c,a LIMIT 3
}
} {1 100 4 sort}
} {1 100 4 nosort}
do_test where-6.9.8 {
cksort {
SELECT * FROM t3 WHERE a=1 AND c>0 ORDER BY a DESC, c ASC LIMIT 3

View File

@ -283,12 +283,12 @@ do_test where2-6.3 {
queryplan {
SELECT * FROM t1 WHERE w=99 OR w=100 OR 6=+w ORDER BY +w
}
} {6 2 49 51 99 6 10000 10006 100 6 10201 10207 sort t1 {}}
} {6 2 49 51 99 6 10000 10006 100 6 10201 10207 sort t1 *}
do_test where2-6.4 {
queryplan {
SELECT * FROM t1 WHERE w=99 OR +w=100 OR 6=w ORDER BY +w
}
} {6 2 49 51 99 6 10000 10006 100 6 10201 10207 sort t1 {}}
} {6 2 49 51 99 6 10000 10006 100 6 10201 10207 sort t1 *}
set ::idx {}
ifcapable subquery {set ::idx i1zyx}
@ -324,7 +324,7 @@ do_test where2-6.7 {
--
SELECT * FROM t2249b CROSS JOIN t2249a WHERE a=b;
}
} {123 0123 nosort t2249b {} t2249a {}}
} {123 0123 nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
do_test where2-6.9 {
queryplan {
-- The + operator removes affinity from the rhs. No conversions
@ -332,13 +332,13 @@ do_test where2-6.9 {
--
SELECT * FROM t2249b CROSS JOIN t2249a WHERE a=+b;
}
} {nosort t2249b {} {} sqlite_autoindex_t2249a_1}
} {nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
do_test where2-6.9.2 {
# The same thing but with the expression flipped around.
queryplan {
SELECT * FROM t2249b CROSS JOIN t2249a WHERE +b=a
}
} {nosort t2249b {} {} sqlite_autoindex_t2249a_1}
} {nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
do_test where2-6.10 {
queryplan {
-- Use + on both sides of the comparison to disable indices
@ -346,32 +346,32 @@ do_test where2-6.10 {
--
SELECT * FROM t2249b CROSS JOIN t2249a WHERE +a=+b;
}
} {nosort t2249b {} t2249a {}}
} {nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
do_test where2-6.11 {
# This will not attempt the OR optimization because of the a=b
# comparison.
queryplan {
SELECT * FROM t2249b CROSS JOIN t2249a WHERE a=b OR a='hello';
}
} {123 0123 nosort t2249b {} t2249a {}}
} {123 0123 nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
do_test where2-6.11.2 {
# Permutations of the expression terms.
queryplan {
SELECT * FROM t2249b CROSS JOIN t2249a WHERE b=a OR a='hello';
}
} {123 0123 nosort t2249b {} t2249a {}}
} {123 0123 nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
do_test where2-6.11.3 {
# Permutations of the expression terms.
queryplan {
SELECT * FROM t2249b CROSS JOIN t2249a WHERE 'hello'=a OR b=a;
}
} {123 0123 nosort t2249b {} t2249a {}}
} {123 0123 nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
do_test where2-6.11.4 {
# Permutations of the expression terms.
queryplan {
SELECT * FROM t2249b CROSS JOIN t2249a WHERE a='hello' OR b=a;
}
} {123 0123 nosort t2249b {} t2249a {}}
} {123 0123 nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
ifcapable explain&&subquery {
# These tests are not run if subquery support is not included in the
# build. This is because these tests test the "a = 1 OR a = 2" to
@ -385,7 +385,7 @@ ifcapable explain&&subquery {
queryplan {
SELECT * FROM t2249b CROSS JOIN t2249a WHERE a=+b OR a='hello';
}
} {nosort t2249b {} {} sqlite_autoindex_t2249a_1}
} {nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
do_test where2-6.12.2 {
# In this case, the +b disables the affinity conflict and allows
# the OR optimization to be used again. The result is now an empty
@ -393,7 +393,7 @@ ifcapable explain&&subquery {
queryplan {
SELECT * FROM t2249b CROSS JOIN t2249a WHERE a='hello' OR +b=a;
}
} {nosort t2249b {} {} sqlite_autoindex_t2249a_1}
} {nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
do_test where2-6.12.3 {
# In this case, the +b disables the affinity conflict and allows
# the OR optimization to be used again. The result is now an empty
@ -401,14 +401,14 @@ ifcapable explain&&subquery {
queryplan {
SELECT * FROM t2249b CROSS JOIN t2249a WHERE +b=a OR a='hello';
}
} {nosort t2249b {} {} sqlite_autoindex_t2249a_1}
} {nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
do_test where2-6.13 {
# The addition of +a on the second term disabled the OR optimization.
# But we should still get the same empty-set result as in where2-6.9.
queryplan {
SELECT * FROM t2249b CROSS JOIN t2249a WHERE a=+b OR +a='hello';
}
} {nosort t2249b {} t2249a {}}
} {nosort t2249b * t2249a sqlite_autoindex_t2249a_1}
}
# Variations on the order of terms in a WHERE clause in order
@ -417,7 +417,7 @@ do_test where2-6.20 {
queryplan {
SELECT * FROM t2249a x CROSS JOIN t2249a y WHERE x.a=y.a
}
} {0123 0123 nosort x {} {} sqlite_autoindex_t2249a_1}
} {0123 0123 nosort x sqlite_autoindex_t2249a_1 y sqlite_autoindex_t2249a_1}
ifcapable explain&&subquery {
# These tests are not run if subquery support is not included in the
# build. This is because these tests test the "a = 1 OR a = 2" to
@ -428,17 +428,17 @@ ifcapable explain&&subquery {
queryplan {
SELECT * FROM t2249a x CROSS JOIN t2249a y WHERE x.a=y.a OR y.a='hello'
}
} {0123 0123 nosort x {} {} sqlite_autoindex_t2249a_1}
} {0123 0123 nosort x sqlite_autoindex_t2249a_1 y sqlite_autoindex_t2249a_1}
do_test where2-6.22 {
queryplan {
SELECT * FROM t2249a x CROSS JOIN t2249a y WHERE y.a=x.a OR y.a='hello'
}
} {0123 0123 nosort x {} {} sqlite_autoindex_t2249a_1}
} {0123 0123 nosort x sqlite_autoindex_t2249a_1 y sqlite_autoindex_t2249a_1}
do_test where2-6.23 {
queryplan {
SELECT * FROM t2249a x CROSS JOIN t2249a y WHERE y.a='hello' OR x.a=y.a
}
} {0123 0123 nosort x {} {} sqlite_autoindex_t2249a_1}
} {0123 0123 nosort x sqlite_autoindex_t2249a_1 y sqlite_autoindex_t2249a_1}
}
# Unique queries (queries that are guaranteed to return only a single

View File

@ -247,6 +247,7 @@ do_execsql_test where3-3.1 {
0 1 0 {SEARCH TABLE t301 USING INTEGER PRIMARY KEY (rowid=?)}
}
if 0 { # Query planner no longer does this
# Verify that when there are multiple tables in a join which must be
# full table scans that the query planner attempts put the table with
# the fewest number of output rows as the outer loop.
@ -278,6 +279,7 @@ do_execsql_test where3-4.2 {
0 1 1 {SCAN TABLE t401}
0 2 2 {SCAN TABLE t402}
}
} ;# endif
# Verify that a performance regression encountered by firefox
# has been fixed.

View File

@ -23303,7 +23303,7 @@ do_test where7-2.1001.2 {
#
# The test case that follows is code from an actual
# application with identifiers change and unused columns
# remove.
# removed.
#
do_execsql_test where7-3.1 {
CREATE TABLE t301 (
@ -23332,7 +23332,7 @@ do_execsql_test where7-3.1 {
EXPLAIN QUERY PLAN
SELECT t302.c1
FROM t302 JOIN t301 ON t302.c8 = t301.c8
FROM t302 JOIN t301 ON t302.c8 = +t301.c8
WHERE t302.c2 = 19571
AND t302.c3 > 1287603136
AND (t301.c4 = 1407449685622784