github.com/jdgcs/sqlite3@v1.12.1-0.20210908114423-bc5f96e4dd51/testdata/tcl/without_rowid7.test (about) 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 14 set testdir [file dirname $argv0] 15 source $testdir/tester.tcl 16 set testprefix without_rowid7 17 18 proc do_execsql_test_if_vtab {tn sql {res {}}} { 19 ifcapable vtab { uplevel [list do_execsql_test $tn $sql $res] } 20 } 21 22 do_execsql_test 1.0 { 23 CREATE TABLE t1(a, b COLLATE nocase, PRIMARY KEY(a, a, b)) WITHOUT ROWID; 24 } 25 26 do_catchsql_test 1.1 { 27 INSERT INTO t1 VALUES(1, 'one'), (1, 'ONE'); 28 } {1 {UNIQUE constraint failed: t1.a, t1.b}} 29 30 31 do_execsql_test 2.0 { 32 CREATE TABLE t2(a, b, PRIMARY KEY(a COLLATE nocase, a)) WITHOUT ROWID; 33 } 34 35 do_execsql_test 2.1 { 36 INSERT INTO t2 VALUES(1, 'one'); 37 SELECT b FROM t2; 38 } {one} 39 40 do_execsql_test 2.2a { 41 PRAGMA index_info(t2); 42 } {0 0 a 1 0 a} 43 do_execsql_test_if_vtab 2.2b { 44 SELECT *, '|' FROM pragma_index_info('t2'); 45 } {0 0 a | 1 0 a |} 46 do_execsql_test 2.3a { 47 PRAGMA index_xinfo(t2); 48 } {0 0 a 0 nocase 1 1 0 a 0 BINARY 1 2 1 b 0 BINARY 0} 49 do_execsql_test_if_vtab 2.3b { 50 SELECT *, '|' FROM pragma_index_xinfo('t2'); 51 } {0 0 a 0 nocase 1 | 1 0 a 0 BINARY 1 | 2 1 b 0 BINARY 0 |} 52 53 do_execsql_test 2.4 { 54 CREATE TABLE t3(a, b, PRIMARY KEY(a COLLATE nocase, a)); 55 PRAGMA index_info(t3); 56 } {} 57 58 59 60 finish_test