/ Hex Artifact Content
Login

Artifact 1e68906951b846570f29f20102ed91d29e634854ee47454d725f2151ecac0b95:


0000: 23 20 32 30 31 36 2d 30 37 2d 30 31 0a 23 0a 23  # 2016-07-01.#.#
0010: 20 54 68 65 20 61 75 74 68 6f 72 20 64 69 73 63   The author disc
0020: 6c 61 69 6d 73 20 63 6f 70 79 72 69 67 68 74 20  laims copyright 
0030: 74 6f 20 74 68 69 73 20 73 6f 75 72 63 65 20 63  to this source c
0040: 6f 64 65 2e 20 20 49 6e 20 70 6c 61 63 65 20 6f  ode.  In place o
0050: 66 0a 23 20 61 20 6c 65 67 61 6c 20 6e 6f 74 69  f.# a legal noti
0060: 63 65 2c 20 68 65 72 65 20 69 73 20 61 20 62 6c  ce, here is a bl
0070: 65 73 73 69 6e 67 3a 0a 23 0a 23 20 20 20 20 4d  essing:.#.#    M
0080: 61 79 20 79 6f 75 20 64 6f 20 67 6f 6f 64 20 61  ay you do good a
0090: 6e 64 20 6e 6f 74 20 65 76 69 6c 2e 0a 23 20 20  nd not evil..#  
00a0: 20 20 4d 61 79 20 79 6f 75 20 66 69 6e 64 20 66    May you find f
00b0: 6f 72 67 69 76 65 6e 65 73 73 20 66 6f 72 20 79  orgiveness for y
00c0: 6f 75 72 73 65 6c 66 20 61 6e 64 20 66 6f 72 67  ourself and forg
00d0: 69 76 65 20 6f 74 68 65 72 73 2e 0a 23 20 20 20  ive others..#   
00e0: 20 4d 61 79 20 79 6f 75 20 73 68 61 72 65 20 66   May you share f
00f0: 72 65 65 6c 79 2c 20 6e 65 76 65 72 20 74 61 6b  reely, never tak
0100: 69 6e 67 20 6d 6f 72 65 20 74 68 61 6e 20 79 6f  ing more than yo
0110: 75 20 67 69 76 65 2e 0a 23 0a 23 2a 2a 2a 2a 2a  u give..#.#*****
0120: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0130: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0140: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0150: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0160: 2a 2a 0a 23 20 54 65 73 74 20 63 61 73 65 73 20  **.# Test cases 
0170: 66 6f 72 20 61 20 63 72 61 73 68 20 62 75 67 2e  for a crash bug.
0180: 0a 23 0a 0a 73 65 74 20 74 65 73 74 64 69 72 20  .#..set testdir 
0190: 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 24 61  [file dirname $a
01a0: 72 67 76 30 5d 0a 73 6f 75 72 63 65 20 24 74 65  rgv0].source $te
01b0: 73 74 64 69 72 2f 74 65 73 74 65 72 2e 74 63 6c  stdir/tester.tcl
01c0: 0a 73 65 74 20 74 65 73 74 70 72 65 66 69 78 20  .set testprefix 
01d0: 63 6f 6c 6c 61 74 65 42 0a 0a 64 6f 5f 65 78 65  collateB..do_exe
01e0: 63 73 71 6c 5f 74 65 73 74 20 63 6f 6c 6c 61 74  csql_test collat
01f0: 65 42 2d 31 2e 31 20 7b 0a 20 20 43 52 45 41 54  eB-1.1 {.  CREAT
0200: 45 20 54 41 42 4c 45 20 74 31 28 61 20 49 4e 54  E TABLE t1(a INT
0210: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59  EGER PRIMARY KEY
0220: 29 3b 0a 20 20 43 52 45 41 54 45 20 54 41 42 4c  );.  CREATE TABL
0230: 45 20 74 32 28 62 20 49 4e 54 45 47 45 52 20 50  E t2(b INTEGER P
0240: 52 49 4d 41 52 59 20 4b 45 59 2c 20 78 31 20 49  RIMARY KEY, x1 I
0250: 4e 54 20 43 4f 4c 4c 41 54 45 20 4e 4f 43 41 53  NT COLLATE NOCAS
0260: 45 29 3b 0a 20 20 43 52 45 41 54 45 20 54 41 42  E);.  CREATE TAB
0270: 4c 45 20 74 33 28 78 32 20 49 4e 54 29 3b 0a 20  LE t3(x2 INT);. 
0280: 20 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 74   SELECT * FROM t
0290: 33 2c 20 74 32 2c 20 74 31 20 57 48 45 52 45 20  3, t2, t1 WHERE 
02a0: 78 32 3d 62 20 41 4e 44 20 78 31 3d 61 20 41 4e  x2=b AND x1=a AN
02b0: 44 20 61 3d 31 3b 0a 7d 20 7b 7d 0a 64 6f 5f 65  D a=1;.} {}.do_e
02c0: 78 65 63 73 71 6c 5f 74 65 73 74 20 63 6f 6c 6c  xecsql_test coll
02d0: 61 74 65 42 2d 31 2e 32 20 7b 0a 20 20 49 4e 53  ateB-1.2 {.  INS
02e0: 45 52 54 20 49 4e 54 4f 20 74 31 28 61 29 20 56  ERT INTO t1(a) V
02f0: 41 4c 55 45 53 28 31 29 2c 28 32 29 2c 28 33 29  ALUES(1),(2),(3)
0300: 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20  ;.  INSERT INTO 
0310: 74 32 28 62 2c 78 31 29 20 56 41 4c 55 45 53 28  t2(b,x1) VALUES(
0320: 31 31 2c 31 29 2c 28 32 32 2c 32 29 2c 28 33 33  11,1),(22,2),(33
0330: 2c 33 29 3b 0a 20 20 49 4e 53 45 52 54 20 49 4e  ,3);.  INSERT IN
0340: 54 4f 20 74 33 28 78 32 29 20 56 41 4c 55 45 53  TO t3(x2) VALUES
0350: 28 31 31 29 2c 28 32 32 29 2c 28 33 33 29 3b 0a  (11),(22),(33);.
0360: 20 20 53 45 4c 45 43 54 20 2a 2c 27 7c 27 20 46    SELECT *,'|' F
0370: 52 4f 4d 20 74 33 2c 20 74 32 2c 20 74 31 20 57  ROM t3, t2, t1 W
0380: 48 45 52 45 20 78 32 3d 62 20 41 4e 44 20 78 31  HERE x2=b AND x1
0390: 3d 61 20 41 4e 44 20 61 3d 31 3b 0a 7d 20 7b 31  =a AND a=1;.} {1
03a0: 31 20 31 31 20 31 20 31 20 7c 7d 0a 64 6f 5f 65  1 11 1 1 |}.do_e
03b0: 78 65 63 73 71 6c 5f 74 65 73 74 20 63 6f 6c 6c  xecsql_test coll
03c0: 61 74 65 42 2d 31 2e 33 20 7b 0a 20 20 53 45 4c  ateB-1.3 {.  SEL
03d0: 45 43 54 20 2a 2c 27 7c 27 20 46 52 4f 4d 20 74  ECT *,'|' FROM t
03e0: 33 2c 20 74 31 2c 20 74 32 20 57 48 45 52 45 20  3, t1, t2 WHERE 
03f0: 78 32 3d 62 20 41 4e 44 20 78 31 3d 61 20 41 4e  x2=b AND x1=a AN
0400: 44 20 61 3d 31 3b 0a 7d 20 7b 31 31 20 31 20 31  D a=1;.} {11 1 1
0410: 31 20 31 20 7c 7d 0a 64 6f 5f 65 78 65 63 73 71  1 1 |}.do_execsq
0420: 6c 5f 74 65 73 74 20 63 6f 6c 6c 61 74 65 42 2d  l_test collateB-
0430: 31 2e 34 20 7b 0a 20 20 53 45 4c 45 43 54 20 2a  1.4 {.  SELECT *
0440: 2c 27 7c 27 20 46 52 4f 4d 20 74 32 2c 20 74 33  ,'|' FROM t2, t3
0450: 2c 20 74 31 20 57 48 45 52 45 20 78 32 3d 62 20  , t1 WHERE x2=b 
0460: 41 4e 44 20 78 31 3d 61 20 41 4e 44 20 61 3d 31  AND x1=a AND a=1
0470: 3b 0a 7d 20 7b 31 31 20 31 20 31 31 20 31 20 7c  ;.} {11 1 11 1 |
0480: 7d 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73  }.do_execsql_tes
0490: 74 20 63 6f 6c 6c 61 74 65 42 2d 31 2e 35 20 7b  t collateB-1.5 {
04a0: 0a 20 20 53 45 4c 45 43 54 20 2a 2c 27 7c 27 20  .  SELECT *,'|' 
04b0: 46 52 4f 4d 20 74 32 2c 20 74 31 2c 20 74 33 20  FROM t2, t1, t3 
04c0: 57 48 45 52 45 20 78 32 3d 62 20 41 4e 44 20 78  WHERE x2=b AND x
04d0: 31 3d 61 20 41 4e 44 20 61 3d 31 3b 0a 7d 20 7b  1=a AND a=1;.} {
04e0: 31 31 20 31 20 31 20 31 31 20 7c 7d 0a 64 6f 5f  11 1 1 11 |}.do_
04f0: 65 78 65 63 73 71 6c 5f 74 65 73 74 20 63 6f 6c  execsql_test col
0500: 6c 61 74 65 42 2d 31 2e 36 20 7b 0a 20 20 53 45  lateB-1.6 {.  SE
0510: 4c 45 43 54 20 2a 2c 27 7c 27 20 46 52 4f 4d 20  LECT *,'|' FROM 
0520: 74 31 2c 20 74 32 2c 20 74 33 20 57 48 45 52 45  t1, t2, t3 WHERE
0530: 20 78 32 3d 62 20 41 4e 44 20 78 31 3d 61 20 41   x2=b AND x1=a A
0540: 4e 44 20 61 3d 31 3b 0a 7d 20 7b 31 20 31 31 20  ND a=1;.} {1 11 
0550: 31 20 31 31 20 7c 7d 0a 64 6f 5f 65 78 65 63 73  1 11 |}.do_execs
0560: 71 6c 5f 74 65 73 74 20 63 6f 6c 6c 61 74 65 42  ql_test collateB
0570: 2d 31 2e 37 20 7b 0a 20 20 53 45 4c 45 43 54 20  -1.7 {.  SELECT 
0580: 2a 2c 27 7c 27 20 46 52 4f 4d 20 74 31 2c 20 74  *,'|' FROM t1, t
0590: 32 2c 20 74 33 20 57 48 45 52 45 20 78 32 3d 62  2, t3 WHERE x2=b
05a0: 20 41 4e 44 20 78 31 3d 61 20 41 4e 44 20 61 3d   AND x1=a AND a=
05b0: 31 3b 0a 7d 20 7b 31 20 31 31 20 31 20 31 31 20  1;.} {1 11 1 11 
05c0: 7c 7d 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65  |}.do_execsql_te
05d0: 73 74 20 63 6f 6c 6c 61 74 65 42 2d 31 2e 31 32  st collateB-1.12
05e0: 20 7b 0a 20 20 53 45 4c 45 43 54 20 2a 2c 27 7c   {.  SELECT *,'|
05f0: 27 20 46 52 4f 4d 20 74 33 2c 20 74 32 2c 20 74  ' FROM t3, t2, t
0600: 31 20 57 48 45 52 45 20 62 3d 78 32 20 41 4e 44  1 WHERE b=x2 AND
0610: 20 61 3d 78 31 20 41 4e 44 20 31 3d 61 3b 0a 7d   a=x1 AND 1=a;.}
0620: 20 7b 31 31 20 31 31 20 31 20 31 20 7c 7d 0a 64   {11 11 1 1 |}.d
0630: 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 63  o_execsql_test c
0640: 6f 6c 6c 61 74 65 42 2d 31 2e 31 33 20 7b 0a 20  ollateB-1.13 {. 
0650: 20 53 45 4c 45 43 54 20 2a 2c 27 7c 27 20 46 52   SELECT *,'|' FR
0660: 4f 4d 20 74 33 2c 20 74 31 2c 20 74 32 20 57 48  OM t3, t1, t2 WH
0670: 45 52 45 20 62 3d 78 32 20 41 4e 44 20 61 3d 78  ERE b=x2 AND a=x
0680: 31 20 41 4e 44 20 31 3d 61 3b 0a 7d 20 7b 31 31  1 AND 1=a;.} {11
0690: 20 31 20 31 31 20 31 20 7c 7d 0a 64 6f 5f 65 78   1 11 1 |}.do_ex
06a0: 65 63 73 71 6c 5f 74 65 73 74 20 63 6f 6c 6c 61  ecsql_test colla
06b0: 74 65 42 2d 31 2e 31 34 20 7b 0a 20 20 53 45 4c  teB-1.14 {.  SEL
06c0: 45 43 54 20 2a 2c 27 7c 27 20 46 52 4f 4d 20 74  ECT *,'|' FROM t
06d0: 32 2c 20 74 33 2c 20 74 31 20 57 48 45 52 45 20  2, t3, t1 WHERE 
06e0: 62 3d 78 32 20 41 4e 44 20 61 3d 78 31 20 41 4e  b=x2 AND a=x1 AN
06f0: 44 20 31 3d 61 3b 0a 7d 20 7b 31 31 20 31 20 31  D 1=a;.} {11 1 1
0700: 31 20 31 20 7c 7d 0a 64 6f 5f 65 78 65 63 73 71  1 1 |}.do_execsq
0710: 6c 5f 74 65 73 74 20 63 6f 6c 6c 61 74 65 42 2d  l_test collateB-
0720: 31 2e 31 35 20 7b 0a 20 20 53 45 4c 45 43 54 20  1.15 {.  SELECT 
0730: 2a 2c 27 7c 27 20 46 52 4f 4d 20 74 32 2c 20 74  *,'|' FROM t2, t
0740: 31 2c 20 74 33 20 57 48 45 52 45 20 62 3d 78 32  1, t3 WHERE b=x2
0750: 20 41 4e 44 20 61 3d 78 31 20 41 4e 44 20 31 3d   AND a=x1 AND 1=
0760: 61 3b 0a 7d 20 7b 31 31 20 31 20 31 20 31 31 20  a;.} {11 1 1 11 
0770: 7c 7d 0a 64 6f 5f 65 78 65 63 73 71 6c 5f 74 65  |}.do_execsql_te
0780: 73 74 20 63 6f 6c 6c 61 74 65 42 2d 31 2e 31 36  st collateB-1.16
0790: 20 7b 0a 20 20 53 45 4c 45 43 54 20 2a 2c 27 7c   {.  SELECT *,'|
07a0: 27 20 46 52 4f 4d 20 74 31 2c 20 74 32 2c 20 74  ' FROM t1, t2, t
07b0: 33 20 57 48 45 52 45 20 62 3d 78 32 20 41 4e 44  3 WHERE b=x2 AND
07c0: 20 61 3d 78 31 20 41 4e 44 20 31 3d 61 3b 0a 7d   a=x1 AND 1=a;.}
07d0: 20 7b 31 20 31 31 20 31 20 31 31 20 7c 7d 0a 64   {1 11 1 11 |}.d
07e0: 6f 5f 65 78 65 63 73 71 6c 5f 74 65 73 74 20 63  o_execsql_test c
07f0: 6f 6c 6c 61 74 65 42 2d 31 2e 31 37 20 7b 0a 20  ollateB-1.17 {. 
0800: 20 53 45 4c 45 43 54 20 2a 2c 27 7c 27 20 46 52   SELECT *,'|' FR
0810: 4f 4d 20 74 31 2c 20 74 32 2c 20 74 33 20 57 48  OM t1, t2, t3 WH
0820: 45 52 45 20 62 3d 78 32 20 41 4e 44 20 61 3d 78  ERE b=x2 AND a=x
0830: 31 20 41 4e 44 20 31 3d 61 3b 0a 7d 20 7b 31 20  1 AND 1=a;.} {1 
0840: 31 31 20 31 20 31 31 20 7c 7d 0a 0a 23 2d 2d 2d  11 1 11 |}..#---
0850: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0860: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0870: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0890: 2d 2d 2d 2d 2d 2d 0a 23 20 54 65 73 74 20 61 6e  ------.# Test an
08a0: 20 61 73 73 65 72 74 28 29 20 66 61 69 6c 75 72   assert() failur
08b0: 65 20 74 68 61 74 20 77 61 73 20 6f 63 63 75 72  e that was occur
08c0: 69 6e 67 20 69 66 20 61 6e 20 69 6e 64 65 78 20  ing if an index 
08d0: 77 65 72 65 20 63 72 65 61 74 65 64 0a 23 20 6f  were created.# o
08e0: 6e 20 61 20 63 6f 6c 75 6d 6e 20 65 78 70 6c 69  n a column expli
08f0: 63 69 74 6c 79 20 64 65 63 6c 61 72 65 64 20 22  citly declared "
0900: 43 4f 4c 4c 41 54 45 20 62 69 6e 61 72 79 22 2e  COLLATE binary".
0910: 0a 72 65 73 65 74 5f 64 62 0a 64 6f 5f 65 78 65  .reset_db.do_exe
0920: 63 73 71 6c 5f 74 65 73 74 20 32 2e 31 20 7b 0a  csql_test 2.1 {.
0930: 20 20 43 52 45 41 54 45 20 54 41 42 4c 45 20 74    CREATE TABLE t
0940: 34 28 61 20 43 4f 4c 4c 41 54 45 20 62 69 6e 61  4(a COLLATE bina
0950: 72 79 29 3b 0a 20 20 43 52 45 41 54 45 20 49 4e  ry);.  CREATE IN
0960: 44 45 58 20 69 34 20 4f 4e 20 74 34 28 61 29 3b  DEX i4 ON t4(a);
0970: 0a 20 20 49 4e 53 45 52 54 20 49 4e 54 4f 20 74  .  INSERT INTO t
0980: 34 20 56 41 4c 55 45 53 28 27 6f 6e 65 27 29 2c  4 VALUES('one'),
0990: 20 28 27 74 77 6f 27 29 2c 20 28 27 74 68 72 65   ('two'), ('thre
09a0: 65 27 29 3b 0a 20 20 56 41 43 55 55 4d 3b 0a 7d  e');.  VACUUM;.}
09b0: 20 0a 0a 69 6e 74 65 67 72 69 74 79 5f 63 68 65   ..integrity_che
09c0: 63 6b 20 32 2e 32 0a 0a 66 69 6e 69 73 68 5f 74  ck 2.2..finish_t
09d0: 65 73 74 0a                                      est.