# 2008 May 26
#
# 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 regression tests for SQLite library.  The
# focus of this file is testing the LIKE and GLOB operators and
# in particular the optimizations that occur to help those operators
# run faster.
#
# $Id: like2.test,v 1.1 2008/05/26 18:33:41 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_test like2-1.1 {
  db eval {
    CREATE TABLE t1(x INT, y COLLATE NOCASE);
    INSERT INTO t1(x,y) VALUES(1,CAST(x'01' AS TEXT));
    INSERT INTO t1(x,y) VALUES(2,CAST(x'02' AS TEXT));
    INSERT INTO t1(x,y) VALUES(3,CAST(x'03' AS TEXT));
    INSERT INTO t1(x,y) VALUES(4,CAST(x'04' AS TEXT));
    INSERT INTO t1(x,y) VALUES(5,CAST(x'05' AS TEXT));
    INSERT INTO t1(x,y) VALUES(6,CAST(x'06' AS TEXT));
    INSERT INTO t1(x,y) VALUES(7,CAST(x'07' AS TEXT));
    INSERT INTO t1(x,y) VALUES(8,CAST(x'08' AS TEXT));
    INSERT INTO t1(x,y) VALUES(9,CAST(x'09' AS TEXT));
    INSERT INTO t1(x,y) VALUES(10,CAST(x'0a' AS TEXT));
    INSERT INTO t1(x,y) VALUES(11,CAST(x'0b' AS TEXT));
    INSERT INTO t1(x,y) VALUES(12,CAST(x'0c' AS TEXT));
    INSERT INTO t1(x,y) VALUES(13,CAST(x'0d' AS TEXT));
    INSERT INTO t1(x,y) VALUES(14,CAST(x'0e' AS TEXT));
    INSERT INTO t1(x,y) VALUES(15,CAST(x'0f' AS TEXT));
    INSERT INTO t1(x,y) VALUES(16,CAST(x'10' AS TEXT));
    INSERT INTO t1(x,y) VALUES(17,CAST(x'11' AS TEXT));
    INSERT INTO t1(x,y) VALUES(18,CAST(x'12' AS TEXT));
    INSERT INTO t1(x,y) VALUES(19,CAST(x'13' AS TEXT));
    INSERT INTO t1(x,y) VALUES(20,CAST(x'14' AS TEXT));
    INSERT INTO t1(x,y) VALUES(21,CAST(x'15' AS TEXT));
    INSERT INTO t1(x,y) VALUES(22,CAST(x'16' AS TEXT));
    INSERT INTO t1(x,y) VALUES(23,CAST(x'17' AS TEXT));
    INSERT INTO t1(x,y) VALUES(24,CAST(x'18' AS TEXT));
    INSERT INTO t1(x,y) VALUES(25,CAST(x'19' AS TEXT));
    INSERT INTO t1(x,y) VALUES(26,CAST(x'1a' AS TEXT));
    INSERT INTO t1(x,y) VALUES(27,CAST(x'1b' AS TEXT));
    INSERT INTO t1(x,y) VALUES(28,CAST(x'1c' AS TEXT));
    INSERT INTO t1(x,y) VALUES(29,CAST(x'1d' AS TEXT));
    INSERT INTO t1(x,y) VALUES(30,CAST(x'1e' AS TEXT));
    INSERT INTO t1(x,y) VALUES(31,CAST(x'1f' AS TEXT));
    INSERT INTO t1(x,y) VALUES(32,' ');
    INSERT INTO t1(x,y) VALUES(33,'!');
    INSERT INTO t1(x,y) VALUES(34,'"');
    INSERT INTO t1(x,y) VALUES(35,'#');
    INSERT INTO t1(x,y) VALUES(36,'$');
    INSERT INTO t1(x,y) VALUES(37,'%');
    INSERT INTO t1(x,y) VALUES(38,'&');
    INSERT INTO t1(x,y) VALUES(39,'''');
    INSERT INTO t1(x,y) VALUES(40,'(');
    INSERT INTO t1(x,y) VALUES(41,')');
    INSERT INTO t1(x,y) VALUES(42,'*');
    INSERT INTO t1(x,y) VALUES(43,'+');
    INSERT INTO t1(x,y) VALUES(44,',');
    INSERT INTO t1(x,y) VALUES(45,'-');
    INSERT INTO t1(x,y) VALUES(46,'.');
    INSERT INTO t1(x,y) VALUES(47,'/');
    INSERT INTO t1(x,y) VALUES(48,'0');
    INSERT INTO t1(x,y) VALUES(49,'1');
    INSERT INTO t1(x,y) VALUES(50,'2');
    INSERT INTO t1(x,y) VALUES(51,'3');
    INSERT INTO t1(x,y) VALUES(52,'4');
    INSERT INTO t1(x,y) VALUES(53,'5');
    INSERT INTO t1(x,y) VALUES(54,'6');
    INSERT INTO t1(x,y) VALUES(55,'7');
    INSERT INTO t1(x,y) VALUES(56,'8');
    INSERT INTO t1(x,y) VALUES(57,'9');
    INSERT INTO t1(x,y) VALUES(58,':');
    INSERT INTO t1(x,y) VALUES(59,';');
    INSERT INTO t1(x,y) VALUES(60,'<');
    INSERT INTO t1(x,y) VALUES(61,'=');
    INSERT INTO t1(x,y) VALUES(62,'>');
    INSERT INTO t1(x,y) VALUES(63,'?');
    INSERT INTO t1(x,y) VALUES(64,'@');
    INSERT INTO t1(x,y) VALUES(65,'A');
    INSERT INTO t1(x,y) VALUES(66,'B');
    INSERT INTO t1(x,y) VALUES(67,'C');
    INSERT INTO t1(x,y) VALUES(68,'D');
    INSERT INTO t1(x,y) VALUES(69,'E');
    INSERT INTO t1(x,y) VALUES(70,'F');
    INSERT INTO t1(x,y) VALUES(71,'G');
    INSERT INTO t1(x,y) VALUES(72,'H');
    INSERT INTO t1(x,y) VALUES(73,'I');
    INSERT INTO t1(x,y) VALUES(74,'J');
    INSERT INTO t1(x,y) VALUES(75,'K');
    INSERT INTO t1(x,y) VALUES(76,'L');
    INSERT INTO t1(x,y) VALUES(77,'M');
    INSERT INTO t1(x,y) VALUES(78,'N');
    INSERT INTO t1(x,y) VALUES(79,'O');
    INSERT INTO t1(x,y) VALUES(80,'P');
    INSERT INTO t1(x,y) VALUES(81,'Q');
    INSERT INTO t1(x,y) VALUES(82,'R');
    INSERT INTO t1(x,y) VALUES(83,'S');
    INSERT INTO t1(x,y) VALUES(84,'T');
    INSERT INTO t1(x,y) VALUES(85,'U');
    INSERT INTO t1(x,y) VALUES(86,'V');
    INSERT INTO t1(x,y) VALUES(87,'W');
    INSERT INTO t1(x,y) VALUES(88,'X');
    INSERT INTO t1(x,y) VALUES(89,'Y');
    INSERT INTO t1(x,y) VALUES(90,'Z');
    INSERT INTO t1(x,y) VALUES(91,'[');
    INSERT INTO t1(x,y) VALUES(92,'\');
    INSERT INTO t1(x,y) VALUES(93,']');
    INSERT INTO t1(x,y) VALUES(94,'^');
    INSERT INTO t1(x,y) VALUES(95,'_');
    INSERT INTO t1(x,y) VALUES(96,'`');
    INSERT INTO t1(x,y) VALUES(97,'a');
    INSERT INTO t1(x,y) VALUES(98,'b');
    INSERT INTO t1(x,y) VALUES(99,'c');
    INSERT INTO t1(x,y) VALUES(100,'d');
    INSERT INTO t1(x,y) VALUES(101,'e');
    INSERT INTO t1(x,y) VALUES(102,'f');
    INSERT INTO t1(x,y) VALUES(103,'g');
    INSERT INTO t1(x,y) VALUES(104,'h');
    INSERT INTO t1(x,y) VALUES(105,'i');
    INSERT INTO t1(x,y) VALUES(106,'j');
    INSERT INTO t1(x,y) VALUES(107,'k');
    INSERT INTO t1(x,y) VALUES(108,'l');
    INSERT INTO t1(x,y) VALUES(109,'m');
    INSERT INTO t1(x,y) VALUES(110,'n');
    INSERT INTO t1(x,y) VALUES(111,'o');
    INSERT INTO t1(x,y) VALUES(112,'p');
    INSERT INTO t1(x,y) VALUES(113,'q');
    INSERT INTO t1(x,y) VALUES(114,'r');
    INSERT INTO t1(x,y) VALUES(115,'s');
    INSERT INTO t1(x,y) VALUES(116,'t');
    INSERT INTO t1(x,y) VALUES(117,'u');
    INSERT INTO t1(x,y) VALUES(118,'v');
    INSERT INTO t1(x,y) VALUES(119,'w');
    INSERT INTO t1(x,y) VALUES(120,'x');
    INSERT INTO t1(x,y) VALUES(121,'y');
    INSERT INTO t1(x,y) VALUES(122,'z');
    INSERT INTO t1(x,y) VALUES(123,'{');
    INSERT INTO t1(x,y) VALUES(124,'|');
    INSERT INTO t1(x,y) VALUES(125,'}');
    INSERT INTO t1(x,y) VALUES(126,'~');
    INSERT INTO t1(x,y) VALUES(127,CAST(x'7f' AS TEXT));
    SELECT count(*) FROM t1;
  }
} {127}
do_test like2-1.2 {
  db eval {
    CREATE TABLE t2(x INT, y COLLATE NOCASE);
    INSERT INTO t2 SELECT * FROM t1;
    CREATE INDEX i2 ON t2(y);
    SELECT count(*) FROM t2;
  }
} {127}
do_test like2-1.3 {
  db eval {
    CREATE TABLE t3(x INT, y COLLATE NOCASE);
    INSERT INTO t3 SELECT x, 'abc' || y || 'xyz' FROM t1;
    CREATE INDEX i3 ON t3(y);
    SELECT count(*) FROM t2;
  }
} {127}
do_test like-2.32.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE ' %'"
} {32}
do_test like-2.32.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE ' %'"
} {32}
do_test like-2.32.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc %'"
} {32}
do_test like-2.33.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '!%'"
} {33}
do_test like-2.33.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '!%'"
} {33}
do_test like-2.33.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc!%'"
} {33}
do_test like-2.34.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '\"%'"
} {34}
do_test like-2.34.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '\"%'"
} {34}
do_test like-2.34.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc\"%'"
} {34}
do_test like-2.35.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '#%'"
} {35}
do_test like-2.35.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '#%'"
} {35}
do_test like-2.35.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc#%'"
} {35}
do_test like-2.36.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '\$%'"
} {36}
do_test like-2.36.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '\$%'"
} {36}
do_test like-2.36.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc\$%'"
} {36}
do_test like-2.38.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '&%'"
} {38}
do_test like-2.38.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '&%'"
} {38}
do_test like-2.38.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc&%'"
} {38}
do_test like-2.39.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '''%'"
} {39}
do_test like-2.39.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '''%'"
} {39}
do_test like-2.39.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc''%'"
} {39}
do_test like-2.40.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '(%'"
} {40}
do_test like-2.40.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '(%'"
} {40}
do_test like-2.40.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc(%'"
} {40}
do_test like-2.41.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE ')%'"
} {41}
do_test like-2.41.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE ')%'"
} {41}
do_test like-2.41.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc)%'"
} {41}
do_test like-2.42.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '*%'"
} {42}
do_test like-2.42.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '*%'"
} {42}
do_test like-2.42.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc*%'"
} {42}
do_test like-2.43.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '+%'"
} {43}
do_test like-2.43.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '+%'"
} {43}
do_test like-2.43.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc+%'"
} {43}
do_test like-2.44.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE ',%'"
} {44}
do_test like-2.44.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE ',%'"
} {44}
do_test like-2.44.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc,%'"
} {44}
do_test like-2.45.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '-%'"
} {45}
do_test like-2.45.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '-%'"
} {45}
do_test like-2.45.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc-%'"
} {45}
do_test like-2.46.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '.%'"
} {46}
do_test like-2.46.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '.%'"
} {46}
do_test like-2.46.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc.%'"
} {46}
do_test like-2.47.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '/%'"
} {47}
do_test like-2.47.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '/%'"
} {47}
do_test like-2.47.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc/%'"
} {47}
do_test like-2.48.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '0%'"
} {48}
do_test like-2.48.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '0%'"
} {48}
do_test like-2.48.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc0%'"
} {48}
do_test like-2.49.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '1%'"
} {49}
do_test like-2.49.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '1%'"
} {49}
do_test like-2.49.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc1%'"
} {49}
do_test like-2.50.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '2%'"
} {50}
do_test like-2.50.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '2%'"
} {50}
do_test like-2.50.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc2%'"
} {50}
do_test like-2.51.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '3%'"
} {51}
do_test like-2.51.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '3%'"
} {51}
do_test like-2.51.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc3%'"
} {51}
do_test like-2.52.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '4%'"
} {52}
do_test like-2.52.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '4%'"
} {52}
do_test like-2.52.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc4%'"
} {52}
do_test like-2.53.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '5%'"
} {53}
do_test like-2.53.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '5%'"
} {53}
do_test like-2.53.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc5%'"
} {53}
do_test like-2.54.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '6%'"
} {54}
do_test like-2.54.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '6%'"
} {54}
do_test like-2.54.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc6%'"
} {54}
do_test like-2.55.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '7%'"
} {55}
do_test like-2.55.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '7%'"
} {55}
do_test like-2.55.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc7%'"
} {55}
do_test like-2.56.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '8%'"
} {56}
do_test like-2.56.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '8%'"
} {56}
do_test like-2.56.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc8%'"
} {56}
do_test like-2.57.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '9%'"
} {57}
do_test like-2.57.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '9%'"
} {57}
do_test like-2.57.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc9%'"
} {57}
do_test like-2.58.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE ':%'"
} {58}
do_test like-2.58.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE ':%'"
} {58}
do_test like-2.58.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc:%'"
} {58}
do_test like-2.59.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE ';%'"
} {59}
do_test like-2.59.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE ';%'"
} {59}
do_test like-2.59.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc;%'"
} {59}
do_test like-2.60.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '<%'"
} {60}
do_test like-2.60.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '<%'"
} {60}
do_test like-2.60.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc<%'"
} {60}
do_test like-2.61.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '=%'"
} {61}
do_test like-2.61.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '=%'"
} {61}
do_test like-2.61.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc=%'"
} {61}
do_test like-2.62.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '>%'"
} {62}
do_test like-2.62.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '>%'"
} {62}
do_test like-2.62.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc>%'"
} {62}
do_test like-2.63.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '?%'"
} {63}
do_test like-2.63.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '?%'"
} {63}
do_test like-2.63.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc?%'"
} {63}
do_test like-2.64.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '@%'"
} {64}
do_test like-2.64.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '@%'"
} {64}
do_test like-2.64.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc@%'"
} {64}
do_test like-2.65.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'A%'"
} {65 97}
do_test like-2.65.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'A%'"
} {65 97}
do_test like-2.65.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcA%'"
} {65 97}
do_test like-2.66.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'B%'"
} {66 98}
do_test like-2.66.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'B%'"
} {66 98}
do_test like-2.66.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcB%'"
} {66 98}
do_test like-2.67.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'C%'"
} {67 99}
do_test like-2.67.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'C%'"
} {67 99}
do_test like-2.67.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcC%'"
} {67 99}
do_test like-2.68.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'D%'"
} {68 100}
do_test like-2.68.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'D%'"
} {68 100}
do_test like-2.68.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcD%'"
} {68 100}
do_test like-2.69.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'E%'"
} {69 101}
do_test like-2.69.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'E%'"
} {69 101}
do_test like-2.69.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcE%'"
} {69 101}
do_test like-2.70.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'F%'"
} {70 102}
do_test like-2.70.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'F%'"
} {70 102}
do_test like-2.70.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcF%'"
} {70 102}
do_test like-2.71.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'G%'"
} {71 103}
do_test like-2.71.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'G%'"
} {71 103}
do_test like-2.71.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcG%'"
} {71 103}
do_test like-2.72.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'H%'"
} {72 104}
do_test like-2.72.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'H%'"
} {72 104}
do_test like-2.72.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcH%'"
} {72 104}
do_test like-2.73.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'I%'"
} {73 105}
do_test like-2.73.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'I%'"
} {73 105}
do_test like-2.73.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcI%'"
} {73 105}
do_test like-2.74.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'J%'"
} {74 106}
do_test like-2.74.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'J%'"
} {74 106}
do_test like-2.74.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcJ%'"
} {74 106}
do_test like-2.75.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'K%'"
} {75 107}
do_test like-2.75.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'K%'"
} {75 107}
do_test like-2.75.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcK%'"
} {75 107}
do_test like-2.76.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'L%'"
} {76 108}
do_test like-2.76.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'L%'"
} {76 108}
do_test like-2.76.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcL%'"
} {76 108}
do_test like-2.77.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'M%'"
} {77 109}
do_test like-2.77.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'M%'"
} {77 109}
do_test like-2.77.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcM%'"
} {77 109}
do_test like-2.78.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'N%'"
} {78 110}
do_test like-2.78.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'N%'"
} {78 110}
do_test like-2.78.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcN%'"
} {78 110}
do_test like-2.79.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'O%'"
} {79 111}
do_test like-2.79.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'O%'"
} {79 111}
do_test like-2.79.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcO%'"
} {79 111}
do_test like-2.80.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'P%'"
} {80 112}
do_test like-2.80.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'P%'"
} {80 112}
do_test like-2.80.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcP%'"
} {80 112}
do_test like-2.81.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'Q%'"
} {81 113}
do_test like-2.81.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'Q%'"
} {81 113}
do_test like-2.81.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcQ%'"
} {81 113}
do_test like-2.82.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'R%'"
} {82 114}
do_test like-2.82.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'R%'"
} {82 114}
do_test like-2.82.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcR%'"
} {82 114}
do_test like-2.83.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'S%'"
} {83 115}
do_test like-2.83.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'S%'"
} {83 115}
do_test like-2.83.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcS%'"
} {83 115}
do_test like-2.84.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'T%'"
} {84 116}
do_test like-2.84.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'T%'"
} {84 116}
do_test like-2.84.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcT%'"
} {84 116}
do_test like-2.85.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'U%'"
} {85 117}
do_test like-2.85.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'U%'"
} {85 117}
do_test like-2.85.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcU%'"
} {85 117}
do_test like-2.86.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'V%'"
} {86 118}
do_test like-2.86.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'V%'"
} {86 118}
do_test like-2.86.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcV%'"
} {86 118}
do_test like-2.87.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'W%'"
} {87 119}
do_test like-2.87.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'W%'"
} {87 119}
do_test like-2.87.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcW%'"
} {87 119}
do_test like-2.88.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'X%'"
} {88 120}
do_test like-2.88.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'X%'"
} {88 120}
do_test like-2.88.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcX%'"
} {88 120}
do_test like-2.89.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'Y%'"
} {89 121}
do_test like-2.89.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'Y%'"
} {89 121}
do_test like-2.89.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcY%'"
} {89 121}
do_test like-2.90.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'Z%'"
} {90 122}
do_test like-2.90.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'Z%'"
} {90 122}
do_test like-2.90.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcZ%'"
} {90 122}
do_test like-2.91.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '\[%'"
} {91}
do_test like-2.91.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '\[%'"
} {91}
do_test like-2.91.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc\[%'"
} {91}
do_test like-2.92.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '\\%'"
} {92}
do_test like-2.92.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '\\%'"
} {92}
do_test like-2.92.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc\\%'"
} {92}
do_test like-2.93.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '\]%'"
} {93}
do_test like-2.93.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '\]%'"
} {93}
do_test like-2.93.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc\]%'"
} {93}
do_test like-2.94.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '^%'"
} {94}
do_test like-2.94.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '^%'"
} {94}
do_test like-2.94.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc^%'"
} {94}
do_test like-2.96.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '`%'"
} {96}
do_test like-2.96.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '`%'"
} {96}
do_test like-2.96.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc`%'"
} {96}
do_test like-2.97.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'a%'"
} {65 97}
do_test like-2.97.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'a%'"
} {65 97}
do_test like-2.97.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abca%'"
} {65 97}
do_test like-2.98.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'b%'"
} {66 98}
do_test like-2.98.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'b%'"
} {66 98}
do_test like-2.98.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcb%'"
} {66 98}
do_test like-2.99.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'c%'"
} {67 99}
do_test like-2.99.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'c%'"
} {67 99}
do_test like-2.99.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcc%'"
} {67 99}
do_test like-2.100.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'd%'"
} {68 100}
do_test like-2.100.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'd%'"
} {68 100}
do_test like-2.100.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcd%'"
} {68 100}
do_test like-2.101.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'e%'"
} {69 101}
do_test like-2.101.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'e%'"
} {69 101}
do_test like-2.101.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abce%'"
} {69 101}
do_test like-2.102.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'f%'"
} {70 102}
do_test like-2.102.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'f%'"
} {70 102}
do_test like-2.102.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcf%'"
} {70 102}
do_test like-2.103.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'g%'"
} {71 103}
do_test like-2.103.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'g%'"
} {71 103}
do_test like-2.103.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcg%'"
} {71 103}
do_test like-2.104.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'h%'"
} {72 104}
do_test like-2.104.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'h%'"
} {72 104}
do_test like-2.104.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abch%'"
} {72 104}
do_test like-2.105.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'i%'"
} {73 105}
do_test like-2.105.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'i%'"
} {73 105}
do_test like-2.105.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abci%'"
} {73 105}
do_test like-2.106.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'j%'"
} {74 106}
do_test like-2.106.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'j%'"
} {74 106}
do_test like-2.106.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcj%'"
} {74 106}
do_test like-2.107.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'k%'"
} {75 107}
do_test like-2.107.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'k%'"
} {75 107}
do_test like-2.107.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abck%'"
} {75 107}
do_test like-2.108.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'l%'"
} {76 108}
do_test like-2.108.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'l%'"
} {76 108}
do_test like-2.108.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcl%'"
} {76 108}
do_test like-2.109.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'm%'"
} {77 109}
do_test like-2.109.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'm%'"
} {77 109}
do_test like-2.109.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcm%'"
} {77 109}
do_test like-2.110.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'n%'"
} {78 110}
do_test like-2.110.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'n%'"
} {78 110}
do_test like-2.110.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcn%'"
} {78 110}
do_test like-2.111.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'o%'"
} {79 111}
do_test like-2.111.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'o%'"
} {79 111}
do_test like-2.111.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abco%'"
} {79 111}
do_test like-2.112.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'p%'"
} {80 112}
do_test like-2.112.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'p%'"
} {80 112}
do_test like-2.112.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcp%'"
} {80 112}
do_test like-2.113.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'q%'"
} {81 113}
do_test like-2.113.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'q%'"
} {81 113}
do_test like-2.113.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcq%'"
} {81 113}
do_test like-2.114.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'r%'"
} {82 114}
do_test like-2.114.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'r%'"
} {82 114}
do_test like-2.114.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcr%'"
} {82 114}
do_test like-2.115.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 's%'"
} {83 115}
do_test like-2.115.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 's%'"
} {83 115}
do_test like-2.115.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcs%'"
} {83 115}
do_test like-2.116.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 't%'"
} {84 116}
do_test like-2.116.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 't%'"
} {84 116}
do_test like-2.116.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abct%'"
} {84 116}
do_test like-2.117.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'u%'"
} {85 117}
do_test like-2.117.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'u%'"
} {85 117}
do_test like-2.117.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcu%'"
} {85 117}
do_test like-2.118.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'v%'"
} {86 118}
do_test like-2.118.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'v%'"
} {86 118}
do_test like-2.118.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcv%'"
} {86 118}
do_test like-2.119.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'w%'"
} {87 119}
do_test like-2.119.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'w%'"
} {87 119}
do_test like-2.119.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcw%'"
} {87 119}
do_test like-2.120.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'x%'"
} {88 120}
do_test like-2.120.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'x%'"
} {88 120}
do_test like-2.120.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcx%'"
} {88 120}
do_test like-2.121.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'y%'"
} {89 121}
do_test like-2.121.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'y%'"
} {89 121}
do_test like-2.121.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcy%'"
} {89 121}
do_test like-2.122.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE 'z%'"
} {90 122}
do_test like-2.122.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE 'z%'"
} {90 122}
do_test like-2.122.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abcz%'"
} {90 122}
do_test like-2.123.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '\173%'"
} {123}
do_test like-2.123.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '\173%'"
} {123}
do_test like-2.123.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc\173%'"
} {123}
do_test like-2.124.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '|%'"
} {124}
do_test like-2.124.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '|%'"
} {124}
do_test like-2.124.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc|%'"
} {124}
do_test like-2.125.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '\175%'"
} {125}
do_test like-2.125.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '\175%'"
} {125}
do_test like-2.125.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc\175%'"
} {125}
do_test like-2.126.1 {
  db eval "SELECT x FROM t1 WHERE y LIKE '~%'"
} {126}
do_test like-2.126.2 {
  db eval "SELECT x FROM t2 WHERE y LIKE '~%'"
} {126}
do_test like-2.126.3 {
  db eval "SELECT x FROM t3 WHERE y LIKE 'abc~%'"
} {126}


do_test like-3.1 {
  db eval "SELECT '\u01C0' LIKE '%\x80'"
} {0}
do_test like-3.2 {
  db eval "SELECT '\u0080' LIKE '%\x80'"
} {1}


finish_test
