1883486baSdrh# 2016-07-01 2883486baSdrh# 3883486baSdrh# The author disclaims copyright to this source code. In place of 4883486baSdrh# a legal notice, here is a blessing: 5883486baSdrh# 6883486baSdrh# May you do good and not evil. 7883486baSdrh# May you find forgiveness for yourself and forgive others. 8883486baSdrh# May you share freely, never taking more than you give. 9883486baSdrh# 10883486baSdrh#*********************************************************************** 11883486baSdrh# Test cases for a crash bug. 12883486baSdrh# 13883486baSdrh 14883486baSdrhset testdir [file dirname $argv0] 15883486baSdrhsource $testdir/tester.tcl 16*a77edc69Sdanset testprefix collateB 17883486baSdrh 18883486baSdrhdo_execsql_test collateB-1.1 { 19883486baSdrh CREATE TABLE t1(a INTEGER PRIMARY KEY); 20883486baSdrh CREATE TABLE t2(b INTEGER PRIMARY KEY, x1 INT COLLATE NOCASE); 21883486baSdrh CREATE TABLE t3(x2 INT); 22883486baSdrh SELECT * FROM t3, t2, t1 WHERE x2=b AND x1=a AND a=1; 23883486baSdrh} {} 24883486baSdrhdo_execsql_test collateB-1.2 { 25883486baSdrh INSERT INTO t1(a) VALUES(1),(2),(3); 26883486baSdrh INSERT INTO t2(b,x1) VALUES(11,1),(22,2),(33,3); 27883486baSdrh INSERT INTO t3(x2) VALUES(11),(22),(33); 28883486baSdrh SELECT *,'|' FROM t3, t2, t1 WHERE x2=b AND x1=a AND a=1; 29883486baSdrh} {11 11 1 1 |} 30883486baSdrhdo_execsql_test collateB-1.3 { 31883486baSdrh SELECT *,'|' FROM t3, t1, t2 WHERE x2=b AND x1=a AND a=1; 32883486baSdrh} {11 1 11 1 |} 33883486baSdrhdo_execsql_test collateB-1.4 { 34883486baSdrh SELECT *,'|' FROM t2, t3, t1 WHERE x2=b AND x1=a AND a=1; 35883486baSdrh} {11 1 11 1 |} 36883486baSdrhdo_execsql_test collateB-1.5 { 37883486baSdrh SELECT *,'|' FROM t2, t1, t3 WHERE x2=b AND x1=a AND a=1; 38883486baSdrh} {11 1 1 11 |} 39883486baSdrhdo_execsql_test collateB-1.6 { 40883486baSdrh SELECT *,'|' FROM t1, t2, t3 WHERE x2=b AND x1=a AND a=1; 41883486baSdrh} {1 11 1 11 |} 42883486baSdrhdo_execsql_test collateB-1.7 { 43883486baSdrh SELECT *,'|' FROM t1, t2, t3 WHERE x2=b AND x1=a AND a=1; 44883486baSdrh} {1 11 1 11 |} 45883486baSdrhdo_execsql_test collateB-1.12 { 46883486baSdrh SELECT *,'|' FROM t3, t2, t1 WHERE b=x2 AND a=x1 AND 1=a; 47883486baSdrh} {11 11 1 1 |} 48883486baSdrhdo_execsql_test collateB-1.13 { 49883486baSdrh SELECT *,'|' FROM t3, t1, t2 WHERE b=x2 AND a=x1 AND 1=a; 50883486baSdrh} {11 1 11 1 |} 51883486baSdrhdo_execsql_test collateB-1.14 { 52883486baSdrh SELECT *,'|' FROM t2, t3, t1 WHERE b=x2 AND a=x1 AND 1=a; 53883486baSdrh} {11 1 11 1 |} 54883486baSdrhdo_execsql_test collateB-1.15 { 55883486baSdrh SELECT *,'|' FROM t2, t1, t3 WHERE b=x2 AND a=x1 AND 1=a; 56883486baSdrh} {11 1 1 11 |} 57883486baSdrhdo_execsql_test collateB-1.16 { 58883486baSdrh SELECT *,'|' FROM t1, t2, t3 WHERE b=x2 AND a=x1 AND 1=a; 59883486baSdrh} {1 11 1 11 |} 60883486baSdrhdo_execsql_test collateB-1.17 { 61883486baSdrh SELECT *,'|' FROM t1, t2, t3 WHERE b=x2 AND a=x1 AND 1=a; 62883486baSdrh} {1 11 1 11 |} 63883486baSdrh 64*a77edc69Sdan#------------------------------------------------------------------------- 65*a77edc69Sdan# Test an assert() failure that was occuring if an index were created 66*a77edc69Sdan# on a column explicitly declared "COLLATE binary". 67*a77edc69Sdanreset_db 68*a77edc69Sdando_execsql_test 2.1 { 69*a77edc69Sdan CREATE TABLE t4(a COLLATE binary); 70*a77edc69Sdan CREATE INDEX i4 ON t4(a); 71*a77edc69Sdan INSERT INTO t4 VALUES('one'), ('two'), ('three'); 72*a77edc69Sdan VACUUM; 73*a77edc69Sdan} 74*a77edc69Sdan 75*a77edc69Sdanintegrity_check 2.2 76*a77edc69Sdan 77883486baSdrhfinish_test 78