2010-07-22 13:16:22 +00:00
|
|
|
# 2010 March 25
|
|
|
|
#
|
|
|
|
# The author disclaims copyright to this source code. In place of
|
|
|
|
# a legal notice, here is a blessing:
|
|
|
|
#
|
|
|
|
# May you do good and not evil.
|
|
|
|
# May you find forgiveness for yourself and forgive others.
|
|
|
|
# May you share freely, never taking more than you give.
|
|
|
|
#
|
|
|
|
#***********************************************************************
|
|
|
|
#
|
|
|
|
# This file implements tests to verify that ticket [cbd054fa6b] has been
|
|
|
|
# fixed.
|
|
|
|
#
|
|
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
|
|
source $testdir/tester.tcl
|
|
|
|
|
2011-12-26 19:52:17 +00:00
|
|
|
ifcapable !stat3 {
|
2010-07-22 13:16:22 +00:00
|
|
|
finish_test
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
do_test tkt-cbd05-1.1 {
|
|
|
|
db eval {
|
|
|
|
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT UNIQUE NOT NULL);
|
|
|
|
CREATE INDEX t1_x ON t1(b);
|
|
|
|
INSERT INTO t1 VALUES (NULL, '');
|
|
|
|
INSERT INTO t1 VALUES (NULL, 'A');
|
|
|
|
INSERT INTO t1 VALUES (NULL, 'B');
|
|
|
|
INSERT INTO t1 VALUES (NULL, 'C');
|
|
|
|
INSERT INTO t1 VALUES (NULL, 'D');
|
|
|
|
INSERT INTO t1 VALUES (NULL, 'E');
|
|
|
|
INSERT INTO t1 VALUES (NULL, 'F');
|
|
|
|
INSERT INTO t1 VALUES (NULL, 'G');
|
|
|
|
INSERT INTO t1 VALUES (NULL, 'H');
|
|
|
|
INSERT INTO t1 VALUES (NULL, 'I');
|
|
|
|
SELECT count(*) FROM t1;
|
|
|
|
}
|
|
|
|
} {10}
|
|
|
|
do_test tkt-cbd05-1.2 {
|
|
|
|
db eval {
|
|
|
|
ANALYZE;
|
|
|
|
}
|
|
|
|
} {}
|
|
|
|
do_test tkt-cbd05-1.3 {
|
|
|
|
execsql {
|
|
|
|
SELECT tbl,idx,group_concat(sample,' ')
|
2011-12-26 19:52:17 +00:00
|
|
|
FROM sqlite_stat3
|
2010-07-22 13:16:22 +00:00
|
|
|
WHERE idx = 't1_x'
|
|
|
|
GROUP BY tbl,idx
|
|
|
|
}
|
2013-01-15 22:38:05 +00:00
|
|
|
} {/t1 t1_x .[ ABCDEFGHI]{10}./}
|
2010-07-22 13:16:22 +00:00
|
|
|
|
|
|
|
do_test tkt-cbd05-2.1 {
|
|
|
|
db eval {
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1(a INTEGER PRIMARY KEY, b BLOB UNIQUE NOT NULL);
|
|
|
|
CREATE INDEX t1_x ON t1(b);
|
|
|
|
INSERT INTO t1 VALUES(NULL, X'');
|
|
|
|
INSERT INTO t1 VALUES(NULL, X'41');
|
|
|
|
INSERT INTO t1 VALUES(NULL, X'42');
|
|
|
|
INSERT INTO t1 VALUES(NULL, X'43');
|
|
|
|
INSERT INTO t1 VALUES(NULL, X'44');
|
|
|
|
INSERT INTO t1 VALUES(NULL, X'45');
|
|
|
|
INSERT INTO t1 VALUES(NULL, X'46');
|
|
|
|
INSERT INTO t1 VALUES(NULL, X'47');
|
|
|
|
INSERT INTO t1 VALUES(NULL, X'48');
|
|
|
|
INSERT INTO t1 VALUES(NULL, X'49');
|
|
|
|
SELECT count(*) FROM t1;
|
|
|
|
}
|
|
|
|
} {10}
|
|
|
|
do_test tkt-cbd05-2.2 {
|
|
|
|
db eval {
|
|
|
|
ANALYZE;
|
|
|
|
}
|
|
|
|
} {}
|
|
|
|
do_test tkt-cbd05-2.3 {
|
|
|
|
execsql {
|
|
|
|
SELECT tbl,idx,group_concat(sample,' ')
|
2011-12-26 19:52:17 +00:00
|
|
|
FROM sqlite_stat3
|
2010-07-22 13:16:22 +00:00
|
|
|
WHERE idx = 't1_x'
|
|
|
|
GROUP BY tbl,idx
|
|
|
|
}
|
2013-01-15 22:38:05 +00:00
|
|
|
} {/t1 t1_x .[ ABCDEFGHI]{10}./}
|
2010-07-22 13:16:22 +00:00
|
|
|
|
|
|
|
finish_test
|