xref: /sqlite-3.40.0/test/index6.test (revision 1fe0537e)
1*1fe0537eSdrh# 2013-07-31
2*1fe0537eSdrh#
3*1fe0537eSdrh# The author disclaims copyright to this source code.  In place of
4*1fe0537eSdrh# a legal notice, here is a blessing:
5*1fe0537eSdrh#
6*1fe0537eSdrh#    May you do good and not evil.
7*1fe0537eSdrh#    May you find forgiveness for yourself and forgive others.
8*1fe0537eSdrh#    May you share freely, never taking more than you give.
9*1fe0537eSdrh#
10*1fe0537eSdrh#***********************************************************************
11*1fe0537eSdrh#
12*1fe0537eSdrh# Test cases for partial indices
13*1fe0537eSdrh#
14*1fe0537eSdrh
15*1fe0537eSdrh
16*1fe0537eSdrhset testdir [file dirname $argv0]
17*1fe0537eSdrhsource $testdir/tester.tcl
18*1fe0537eSdrh
19*1fe0537eSdrhload_static_extension db wholenumber;
20*1fe0537eSdrhdo_test index6-1.1 {
21*1fe0537eSdrh  execsql {
22*1fe0537eSdrh    CREATE TABLE t1(a,b);
23*1fe0537eSdrh    CREATE INDEX t1a ON t1(a) WHERE a IS NOT NULL;
24*1fe0537eSdrh    CREATE INDEX t1b ON t1(b) WHERE b>10;
25*1fe0537eSdrh    CREATE VIRTUAL TABLE nums USING wholenumber;
26*1fe0537eSdrh    INSERT INTO t1(a,b)
27*1fe0537eSdrh       SELECT CASE WHEN value%3!=0 THEN value END, value
28*1fe0537eSdrh         FROM nums WHERE value<=20;
29*1fe0537eSdrh    SELECT count(a), count(b) FROM t1;
30*1fe0537eSdrh  }
31*1fe0537eSdrh} {14 20}
32*1fe0537eSdrh
33*1fe0537eSdrhfinish_test
34