xref: /sqlite-3.40.0/test/without_rowid7.test (revision dac7e69d)
1# 2019 July 17
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
6#    May you do good and not evil.
7#    May you find forgiveness for yourself and forgive others.
8#    May you share freely, never taking more than you give.
9#
10#*************************************************************************
11# This file implements regression tests for SQLite library.
12#
13
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
16set testprefix without_rowid7
17
18do_execsql_test 1.0 {
19  CREATE TABLE t1(a, b COLLATE nocase, PRIMARY KEY(a, a, b)) WITHOUT ROWID;
20}
21
22do_catchsql_test 1.1 {
23  INSERT INTO t1 VALUES(1, 'one'), (1, 'ONE');
24} {1 {UNIQUE constraint failed: t1.a, t1.b}}
25
26
27do_execsql_test 2.0 {
28  CREATE TABLE t2(a, b, PRIMARY KEY(a COLLATE nocase, a)) WITHOUT ROWID;
29}
30
31do_execsql_test 2.1 {
32  INSERT INTO t2 VALUES(1, 'one');
33  SELECT b FROM t2;
34} {one}
35
36do_execsql_test 2.2a {
37  PRAGMA index_info(t2);
38} {0 0 a 1 0 a}
39do_execsql_test 2.2b {
40  SELECT *, '|' FROM pragma_index_info('t2');
41} {0 0 a | 1 0 a |}
42do_execsql_test 2.3a {
43  PRAGMA index_xinfo(t2);
44} {0 0 a 0 nocase 1 1 0 a 0 BINARY 1 2 1 b 0 BINARY 0}
45do_execsql_test 2.3b {
46  SELECT *, '|' FROM pragma_index_xinfo('t2');
47} {0 0 a 0 nocase 1 | 1 0 a 0 BINARY 1 | 2 1 b 0 BINARY 0 |}
48
49do_execsql_test 2.4 {
50  CREATE TABLE t3(a, b, PRIMARY KEY(a COLLATE nocase, a));
51  PRAGMA index_info(t3);
52} {}
53
54
55
56finish_test
57