3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # This file implements tests to verify that ticket [cbd054fa6b] has been
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
19 ifcapable !stat4&&!stat3 {
26 binary scan $blob c* bytes
28 set t [binary format c $b]
29 if {[string is print $t]} {
39 do_test tkt-cbd05-1.1 {
41 CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT UNIQUE NOT NULL);
42 CREATE INDEX t1_x ON t1(b);
43 INSERT INTO t1 VALUES (NULL, '');
44 INSERT INTO t1 VALUES (NULL, 'A');
45 INSERT INTO t1 VALUES (NULL, 'B');
46 INSERT INTO t1 VALUES (NULL, 'C');
47 INSERT INTO t1 VALUES (NULL, 'D');
48 INSERT INTO t1 VALUES (NULL, 'E');
49 INSERT INTO t1 VALUES (NULL, 'F');
50 INSERT INTO t1 VALUES (NULL, 'G');
51 INSERT INTO t1 VALUES (NULL, 'H');
52 INSERT INTO t1 VALUES (NULL, 'I');
53 SELECT count(*) FROM t1;
56 do_test tkt-cbd05-1.2 {
60 PRAGMA writable_schema = 1;
62 SELECT tbl,idx,neq,nlt,ndlt,test_extract(sample,0) AS sample
64 PRAGMA writable_schema = 0;
69 SELECT tbl,idx,neq,nlt,ndlt,sample FROM sqlite_stat3;
73 do_test tkt-cbd05-1.3 {
75 SELECT tbl,idx,group_concat(s(sample),' ')
80 } {t1 t1_x { A B C D E F G H I}}
82 do_test tkt-cbd05-2.1 {
85 CREATE TABLE t1(a INTEGER PRIMARY KEY, b BLOB UNIQUE NOT NULL);
86 CREATE INDEX t1_x ON t1(b);
87 INSERT INTO t1 VALUES(NULL, X'');
88 INSERT INTO t1 VALUES(NULL, X'41');
89 INSERT INTO t1 VALUES(NULL, X'42');
90 INSERT INTO t1 VALUES(NULL, X'43');
91 INSERT INTO t1 VALUES(NULL, X'44');
92 INSERT INTO t1 VALUES(NULL, X'45');
93 INSERT INTO t1 VALUES(NULL, X'46');
94 INSERT INTO t1 VALUES(NULL, X'47');
95 INSERT INTO t1 VALUES(NULL, X'48');
96 INSERT INTO t1 VALUES(NULL, X'49');
97 SELECT count(*) FROM t1;
100 do_test tkt-cbd05-2.2 {
105 do_test tkt-cbd05-2.3 {
107 SELECT tbl,idx,group_concat(s(sample),' ')
112 } {t1 t1_x { A B C D E F G H I}}