| Index: third_party/sqlite/sqlite-src-3100200/test/indexedby.test
|
| diff --git a/third_party/sqlite/sqlite-src-3080704/test/indexedby.test b/third_party/sqlite/sqlite-src-3100200/test/indexedby.test
|
| similarity index 84%
|
| copy from third_party/sqlite/sqlite-src-3080704/test/indexedby.test
|
| copy to third_party/sqlite/sqlite-src-3100200/test/indexedby.test
|
| index f95c167f6411c0fb5f003ca4d9bc93995ec95c18..83c7a5ccccc4e7e0eadfb30c87321af6e31dd53d 100644
|
| --- a/third_party/sqlite/sqlite-src-3080704/test/indexedby.test
|
| +++ b/third_party/sqlite/sqlite-src-3100200/test/indexedby.test
|
| @@ -1,4 +1,4 @@
|
| -# 2008 October 4
|
| +# 2008-10-04
|
| #
|
| # The author disclaims copyright to this source code. In place of
|
| # a legal notice, here is a blessing:
|
| @@ -9,7 +9,6 @@
|
| #
|
| #***********************************************************************
|
| #
|
| -# $Id: indexedby.test,v 1.5 2009/03/22 20:36:19 drh Exp $
|
|
|
| set testdir [file dirname $argv0]
|
| source $testdir/tester.tcl
|
| @@ -58,20 +57,45 @@ do_execsql_test indexedby-1.4 {
|
| # attached to a table in the FROM clause, but not to a sub-select or
|
| # SQL view. Also test that specifying an index that does not exist or
|
| # is attached to a different table is detected as an error.
|
| +#
|
| +# EVIDENCE-OF: R-07004-11522 -- syntax diagram qualified-table-name
|
| #
|
| +# EVIDENCE-OF: R-58230-57098 The "INDEXED BY index-name" phrase
|
| +# specifies that the named index must be used in order to look up values
|
| +# on the preceding table.
|
| +#
|
| do_test indexedby-2.1 {
|
| execsql { SELECT * FROM t1 NOT INDEXED WHERE a = 'one' AND b = 'two'}
|
| } {}
|
| +do_test indexedby-2.1b {
|
| + execsql { SELECT * FROM main.t1 NOT INDEXED WHERE a = 'one' AND b = 'two'}
|
| +} {}
|
| do_test indexedby-2.2 {
|
| execsql { SELECT * FROM t1 INDEXED BY i1 WHERE a = 'one' AND b = 'two'}
|
| } {}
|
| +do_test indexedby-2.2b {
|
| + execsql { SELECT * FROM main.t1 INDEXED BY i1 WHERE a = 'one' AND b = 'two'}
|
| +} {}
|
| do_test indexedby-2.3 {
|
| execsql { SELECT * FROM t1 INDEXED BY i2 WHERE a = 'one' AND b = 'two'}
|
| } {}
|
| -
|
| +# EVIDENCE-OF: R-44699-55558 The INDEXED BY clause does not give the
|
| +# optimizer hints about which index to use; it gives the optimizer a
|
| +# requirement of which index to use.
|
| +# EVIDENCE-OF: R-15800-25719 If index-name does not exist or cannot be
|
| +# used for the query, then the preparation of the SQL statement fails.
|
| +#
|
| do_test indexedby-2.4 {
|
| catchsql { SELECT * FROM t1 INDEXED BY i3 WHERE a = 'one' AND b = 'two'}
|
| } {1 {no such index: i3}}
|
| +
|
| +# EVIDENCE-OF: R-62112-42456 If the query optimizer is unable to use the
|
| +# index specified by the INDEX BY clause, then the query will fail with
|
| +# an error.
|
| +do_test indexedby-2.4.1 {
|
| + catchsql { SELECT b FROM t1 INDEXED BY i1 WHERE b = 'two' }
|
| +} {1 {no query solution}}
|
| +
|
| do_test indexedby-2.5 {
|
| catchsql { SELECT * FROM t1 INDEXED BY i5 WHERE a = 'one' AND b = 'two'}
|
| } {1 {no such index: i5}}
|
| @@ -82,11 +106,26 @@ do_test indexedby-2.7 {
|
| catchsql { SELECT * FROM v1 INDEXED BY i1 WHERE a = 'one' }
|
| } {1 {no such index: i1}}
|
|
|
| +
|
| # Tests for single table cases.
|
| #
|
| +# EVIDENCE-OF: R-37002-28871 The "NOT INDEXED" clause specifies that no
|
| +# index shall be used when accessing the preceding table, including
|
| +# implied indices create by UNIQUE and PRIMARY KEY constraints. However,
|
| +# the rowid can still be used to look up entries even when "NOT INDEXED"
|
| +# is specified.
|
| +#
|
| do_execsql_test indexedby-3.1 {
|
| + EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a = 'one' AND b = 'two'
|
| +} {/SEARCH TABLE t1 USING INDEX/}
|
| +do_execsql_test indexedby-3.1.1 {
|
| EXPLAIN QUERY PLAN SELECT * FROM t1 NOT INDEXED WHERE a = 'one' AND b = 'two'
|
| } {0 0 0 {SCAN TABLE t1}}
|
| +do_execsql_test indexedby-3.1.2 {
|
| + EXPLAIN QUERY PLAN SELECT * FROM t1 NOT INDEXED WHERE rowid=1
|
| +} {/SEARCH TABLE t1 USING INTEGER PRIMARY KEY .rowid=/}
|
| +
|
| +
|
| do_execsql_test indexedby-3.2 {
|
| EXPLAIN QUERY PLAN
|
| SELECT * FROM t1 INDEXED BY i1 WHERE a = 'one' AND b = 'two'
|
| @@ -184,17 +223,21 @@ 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}}
|
|
|
| +# EVIDENCE-OF: R-40297-14464 The INDEXED BY phrase forces the SQLite
|
| +# query planner to use a particular named index on a DELETE, SELECT, or
|
| +# UPDATE statement.
|
| +#
|
| # Test that "INDEXED BY" can be used in a DELETE statement.
|
| #
|
| do_execsql_test indexedby-7.1 {
|
| EXPLAIN QUERY PLAN DELETE FROM t1 WHERE a = 5
|
| -} {0 0 0 {SEARCH TABLE t1 USING COVERING INDEX i1 (a=?)}}
|
| +} {0 0 0 {SEARCH TABLE t1 USING INDEX i1 (a=?)}}
|
| do_execsql_test indexedby-7.2 {
|
| EXPLAIN QUERY PLAN DELETE FROM t1 NOT INDEXED WHERE a = 5
|
| } {0 0 0 {SCAN TABLE t1}}
|
| do_execsql_test indexedby-7.3 {
|
| EXPLAIN QUERY PLAN DELETE FROM t1 INDEXED BY i1 WHERE a = 5
|
| -} {0 0 0 {SEARCH TABLE t1 USING COVERING INDEX i1 (a=?)}}
|
| +} {0 0 0 {SEARCH TABLE t1 USING INDEX i1 (a=?)}}
|
| do_execsql_test indexedby-7.4 {
|
| EXPLAIN QUERY PLAN DELETE FROM t1 INDEXED BY i1 WHERE a = 5 AND b = 10
|
| } {0 0 0 {SEARCH TABLE t1 USING INDEX i1 (a=?)}}
|
|
|