2016-07-01 22:48:43 +03:00
|
|
|
# 2016-07-01
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
#***********************************************************************
|
|
|
|
# Test cases for a crash bug.
|
|
|
|
#
|
|
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
|
|
source $testdir/tester.tcl
|
2017-03-23 20:03:35 +03:00
|
|
|
set testprefix collateB
|
2016-07-01 22:48:43 +03:00
|
|
|
|
|
|
|
do_execsql_test collateB-1.1 {
|
|
|
|
CREATE TABLE t1(a INTEGER PRIMARY KEY);
|
|
|
|
CREATE TABLE t2(b INTEGER PRIMARY KEY, x1 INT COLLATE NOCASE);
|
|
|
|
CREATE TABLE t3(x2 INT);
|
|
|
|
SELECT * FROM t3, t2, t1 WHERE x2=b AND x1=a AND a=1;
|
|
|
|
} {}
|
|
|
|
do_execsql_test collateB-1.2 {
|
|
|
|
INSERT INTO t1(a) VALUES(1),(2),(3);
|
|
|
|
INSERT INTO t2(b,x1) VALUES(11,1),(22,2),(33,3);
|
|
|
|
INSERT INTO t3(x2) VALUES(11),(22),(33);
|
|
|
|
SELECT *,'|' FROM t3, t2, t1 WHERE x2=b AND x1=a AND a=1;
|
|
|
|
} {11 11 1 1 |}
|
|
|
|
do_execsql_test collateB-1.3 {
|
|
|
|
SELECT *,'|' FROM t3, t1, t2 WHERE x2=b AND x1=a AND a=1;
|
|
|
|
} {11 1 11 1 |}
|
|
|
|
do_execsql_test collateB-1.4 {
|
|
|
|
SELECT *,'|' FROM t2, t3, t1 WHERE x2=b AND x1=a AND a=1;
|
|
|
|
} {11 1 11 1 |}
|
|
|
|
do_execsql_test collateB-1.5 {
|
|
|
|
SELECT *,'|' FROM t2, t1, t3 WHERE x2=b AND x1=a AND a=1;
|
|
|
|
} {11 1 1 11 |}
|
|
|
|
do_execsql_test collateB-1.6 {
|
|
|
|
SELECT *,'|' FROM t1, t2, t3 WHERE x2=b AND x1=a AND a=1;
|
|
|
|
} {1 11 1 11 |}
|
|
|
|
do_execsql_test collateB-1.7 {
|
|
|
|
SELECT *,'|' FROM t1, t2, t3 WHERE x2=b AND x1=a AND a=1;
|
|
|
|
} {1 11 1 11 |}
|
|
|
|
do_execsql_test collateB-1.12 {
|
|
|
|
SELECT *,'|' FROM t3, t2, t1 WHERE b=x2 AND a=x1 AND 1=a;
|
|
|
|
} {11 11 1 1 |}
|
|
|
|
do_execsql_test collateB-1.13 {
|
|
|
|
SELECT *,'|' FROM t3, t1, t2 WHERE b=x2 AND a=x1 AND 1=a;
|
|
|
|
} {11 1 11 1 |}
|
|
|
|
do_execsql_test collateB-1.14 {
|
|
|
|
SELECT *,'|' FROM t2, t3, t1 WHERE b=x2 AND a=x1 AND 1=a;
|
|
|
|
} {11 1 11 1 |}
|
|
|
|
do_execsql_test collateB-1.15 {
|
|
|
|
SELECT *,'|' FROM t2, t1, t3 WHERE b=x2 AND a=x1 AND 1=a;
|
|
|
|
} {11 1 1 11 |}
|
|
|
|
do_execsql_test collateB-1.16 {
|
|
|
|
SELECT *,'|' FROM t1, t2, t3 WHERE b=x2 AND a=x1 AND 1=a;
|
|
|
|
} {1 11 1 11 |}
|
|
|
|
do_execsql_test collateB-1.17 {
|
|
|
|
SELECT *,'|' FROM t1, t2, t3 WHERE b=x2 AND a=x1 AND 1=a;
|
|
|
|
} {1 11 1 11 |}
|
|
|
|
|
2017-03-23 20:03:35 +03:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
# Test an assert() failure that was occuring if an index were created
|
|
|
|
# on a column explicitly declared "COLLATE binary".
|
|
|
|
reset_db
|
|
|
|
do_execsql_test 2.1 {
|
|
|
|
CREATE TABLE t4(a COLLATE binary);
|
|
|
|
CREATE INDEX i4 ON t4(a);
|
|
|
|
INSERT INTO t4 VALUES('one'), ('two'), ('three');
|
|
|
|
VACUUM;
|
|
|
|
}
|
|
|
|
|
|
|
|
integrity_check 2.2
|
|
|
|
|
2016-07-01 22:48:43 +03:00
|
|
|
finish_test
|