xref: /sqlite-3.40.0/test/vtabF.test (revision f10122d5)
1b4256996Sdrh# 2011 Aug 1
2b4256996Sdrh#
3b4256996Sdrh# The author disclaims copyright to this source code.  In place of
4b4256996Sdrh# a legal notice, here is a blessing:
5b4256996Sdrh#
6b4256996Sdrh#    May you do good and not evil.
7b4256996Sdrh#    May you find forgiveness for yourself and forgive others.
8b4256996Sdrh#    May you share freely, never taking more than you give.
9b4256996Sdrh#
10b4256996Sdrh#***********************************************************************
11b4256996Sdrh# This file implements regression tests for SQLite library.
12b4256996Sdrh# This file checks to make sure IS NOT NULL constraints work on
13b4256996Sdrh# virtual tables.
14b4256996Sdrh#
15b4256996Sdrh
16b4256996Sdrhset testdir [file dirname $argv0]
17b4256996Sdrhsource $testdir/tester.tcl
18b4256996Sdrh
19b4256996Sdrhifcapable !vtab||!schema_pragmas { finish_test ; return }
20b4256996Sdrh
21b4256996Sdrh# Register the echo module
22b4256996Sdrhregister_echo_module [sqlite3_connection_pointer db]
23b4256996Sdrh
24*f10122d5Smistachkindo_test vtabF-1.1 {
25b4256996Sdrh  execsql {
26b4256996Sdrh    CREATE TABLE t1(a, b);
27b4256996Sdrh    CREATE INDEX i1 ON t1(a);
28b4256996Sdrh    CREATE INDEX i2 ON t1(b);
29b4256996Sdrh    INSERT INTO t1 VALUES(10,110);
30b4256996Sdrh    INSERT INTO t1 VALUES(11,111);
31b4256996Sdrh    INSERT INTO t1 SELECT a+2, b+2 FROM t1;
32b4256996Sdrh    INSERT INTO t1 SELECT null, b+4 FROM t1;
33b4256996Sdrh    INSERT INTO t1 SELECT null, b+8 FROM t1;
34b4256996Sdrh    INSERT INTO t1 SELECT null, b+16 FROM t1;
35b4256996Sdrh    ANALYZE;
36b4256996Sdrh    CREATE VIRTUAL TABLE tv1 USING echo(t1);
37b4256996Sdrh    SELECT b FROM t1 WHERE a IS NOT NULL;
38b4256996Sdrh  }
39b4256996Sdrh} {110 111 112 113}
40*f10122d5Smistachkindo_test vtabF-1.2 {
41b4256996Sdrh  execsql {SELECT b FROM tv1 WHERE a IS NOT NULL}
42b4256996Sdrh} {110 111 112 113}
43b4256996Sdrh
44b4256996Sdrh
45b4256996Sdrhfinish_test
46