summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorigor@rurik.mysql.com <>2004-02-19 01:09:54 -0800
committerigor@rurik.mysql.com <>2004-02-19 01:09:54 -0800
commitf18e0068ba81c909b28ed4b66ee6d84f7e4ad932 (patch)
treeaa627335f475f099e0d352b39af4e24d6e1ac189 /mysql-test/r
parent09fa16424a9d5e35b1b7abbc912b0bdfc105f15f (diff)
parent1be033f62cc7decdc0867ad44aaebd87b3f74884 (diff)
downloadmariadb-git-f18e0068ba81c909b28ed4b66ee6d84f7e4ad932.tar.gz
Manual merge
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/alter_table.result12
-rw-r--r--mysql-test/r/cast.result39
-rw-r--r--mysql-test/r/ctype_big5.result10
-rw-r--r--mysql-test/r/ctype_collate.result47
-rw-r--r--mysql-test/r/ctype_latin1_de.result2
-rw-r--r--mysql-test/r/ctype_many.result123
-rw-r--r--mysql-test/r/ctype_mb.result2
-rw-r--r--mysql-test/r/ctype_recoding.result6
-rw-r--r--mysql-test/r/ctype_tis620.result113
-rw-r--r--mysql-test/r/ctype_ucs.result185
-rw-r--r--mysql-test/r/ctype_utf8.result107
-rw-r--r--mysql-test/r/date_formats.result2
-rw-r--r--mysql-test/r/derived.result87
-rw-r--r--mysql-test/r/func_like.result30
-rw-r--r--mysql-test/r/func_misc.result11
-rw-r--r--mysql-test/r/func_str.result3
-rw-r--r--mysql-test/r/func_system.result14
-rw-r--r--mysql-test/r/func_test.result6
-rw-r--r--mysql-test/r/have_big5.require2
-rw-r--r--mysql-test/r/have_tis620.require2
-rw-r--r--mysql-test/r/key_cache.result4
-rw-r--r--mysql-test/r/multi_update.result2
-rw-r--r--mysql-test/r/mysqldump.result121
-rw-r--r--mysql-test/r/null.result3
-rw-r--r--mysql-test/r/order_by.result21
-rw-r--r--mysql-test/r/preload.result6
-rw-r--r--mysql-test/r/query_cache.result23
-rw-r--r--mysql-test/r/rpl_until.result2
-rw-r--r--mysql-test/r/show_check.result73
-rw-r--r--mysql-test/r/sp-error.result4
-rw-r--r--mysql-test/r/sp.result21
-rw-r--r--mysql-test/r/sql_mode.result2
-rw-r--r--mysql-test/r/subselect.result34
-rw-r--r--mysql-test/r/subselect_innodb.result37
-rw-r--r--mysql-test/r/symlink.result2
-rw-r--r--mysql-test/r/type_decimal.result123
-rw-r--r--mysql-test/r/update.result2
-rw-r--r--mysql-test/r/user_var.result42
-rw-r--r--mysql-test/r/variables.result2
-rw-r--r--mysql-test/r/warnings.result7
40 files changed, 1028 insertions, 306 deletions
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 7ec12c1b021..ce324dc1fa8 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -412,3 +412,15 @@ t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
DROP TABLE t1;
+CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0',
+ `b` int(11) default NULL,
+ UNIQUE KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 DROP PRIMARY KEY;
+ERROR 42000: Can't DROP 'PRIMARY'. Check that column/key exists
+DROP TABLE t1;
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index acca50b45dd..877a349d188 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -24,6 +24,12 @@ Note 1003 select high_priority ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as
select cast(5 as unsigned) -6.0;
cast(5 as unsigned) -6.0
-1.0
+select cast(NULL as signed), cast(1/0 as signed);
+cast(NULL as signed) cast(1/0 as signed)
+NULL NULL
+select cast(NULL as unsigned), cast(1/0 as unsigned);
+cast(NULL as unsigned) cast(1/0 as unsigned)
+NULL NULL
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A"
0 1
@@ -33,6 +39,24 @@ cast("2001-1-1" as DATE) cast("2001-1-1" as DATETIME)
select cast("1:2:3" as TIME);
cast("1:2:3" as TIME)
01:02:03
+select CONVERT("2004-01-22 21:45:33",DATE);
+CONVERT("2004-01-22 21:45:33",DATE)
+2004-01-22
+select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
+CONVERT(DATE "2004-01-22 21:45:33" USING latin1)
+2004-01-22 21:45:33
+select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
+CONVERT(DATE "2004-01-22 21:45:33",CHAR)
+2004-01-22 21:45:33
+select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
+CONVERT(DATE "2004-01-22 21:45:33",CHAR(4))
+2004
+select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY);
+CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY)
+2004
+select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
+CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY)
+2004
set names binary;
select cast(_latin1'test' as char character set latin2);
cast(_latin1'test' as char character set latin2)
@@ -101,6 +125,21 @@ t1 CREATE TABLE `t1` (
`c5` char(2) character set utf8 NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+create table t1 (a binary(10), b char(10) character set koi8r);
+insert into t1 values (_binary'ÔÅÓÔ',_binary'ÔÅÓÔ');
+select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
+a b cast(a as char character set cp1251) cast(b as binary)
+ÔÅÓÔ ÔÅÓÔ ÔÅÓÔ ÔÅÓÔ
+set names koi8r;
+select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
+a b cast(a as char character set cp1251) cast(b as binary)
+ÔÅÓÔ ÔÅÓÔ æåõæ ÔÅÓÔ
+set names cp1251;
+select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
+a b cast(a as char character set cp1251) cast(b as binary)
+ÔÅÓÔ òåñò ÔÅÓÔ ÔÅÓÔ
+drop table t1;
+set names binary;
select cast("2001-1-1" as date) = "2001-01-01";
cast("2001-1-1" as date) = "2001-01-01"
1
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
new file mode 100644
index 00000000000..44fad0cd96a
--- /dev/null
+++ b/mysql-test/r/ctype_big5.result
@@ -0,0 +1,10 @@
+drop table if exists t1;
+SET NAMES big5;
+CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
+INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
+SELECT * FROM t1 WHERE c LIKE 'aaa%';
+c
+aaa
+aaaa
+aaaaa
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result
index a3e29d24264..add730fe68f 100644
--- a/mysql-test/r/ctype_collate.result
+++ b/mysql-test/r/ctype_collate.result
@@ -541,3 +541,50 @@ s2 CHAR(5) COLLATE latin1_swedish_ci);
SELECT * FROM t1 WHERE s1 = s2;
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
DROP TABLE t1;
+SET NAMES latin1;
+CREATE TABLE t1
+(s1 char(10) COLLATE latin1_german1_ci,
+s2 char(10) COLLATE latin1_swedish_ci,
+KEY(s1),
+KEY(s2));
+INSERT INTO t1 VALUES ('a','a');
+INSERT INTO t1 VALUES ('b','b');
+INSERT INTO t1 VALUES ('c','c');
+INSERT INTO t1 VALUES ('d','d');
+INSERT INTO t1 VALUES ('e','e');
+INSERT INTO t1 VALUES ('f','f');
+INSERT INTO t1 VALUES ('g','g');
+INSERT INTO t1 VALUES ('h','h');
+INSERT INTO t1 VALUES ('i','i');
+INSERT INTO t1 VALUES ('j','j');
+EXPLAIN SELECT * FROM t1 WHERE s1='a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref s1 s1 11 const 1 Using where
+EXPLAIN SELECT * FROM t1 WHERE s2='a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref s2 s2 11 const 1 Using where
+EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref s1 s1 11 const 1 Using where
+EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
+EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range s1 s1 11 NULL 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
+EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range s1 s1 11 NULL 2 Using where
+EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
+EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range s1 s1 11 NULL 1 Using where
+EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result
index 7f150cb0698..c500019042f 100644
--- a/mysql-test/r/ctype_latin1_de.result
+++ b/mysql-test/r/ctype_latin1_de.result
@@ -1,3 +1,5 @@
+set names latin1;
+set @@collation_connection=latin1_german2_ci;
select @@collation_connection;
@@collation_connection
latin1_german2_ci
diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result
index 173d41ecdd1..8bfc6e98226 100644
--- a/mysql-test/r/ctype_many.result
+++ b/mysql-test/r/ctype_many.result
@@ -340,129 +340,6 @@ CYR CAPIT SOFT SIGN ø ø
CYR CAPIT E ü ü
CYR CAPIT YU à à
CYR CAPIT YA ñ ñ
-select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
-CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci') comment
-a LAT SMALL A
-b LAT SMALL B
-c LAT SMALL C
-d LAT SMALL D
-e LAT SMALL E
-f LAT SMALL F
-g LAT SMALL G
-h LAT SMALL H
-i LAT SMALL I
-j LAT SMALL J
-k LAT SMALL K
-l LAT SMALL L
-m LAT SMALL M
-n LAT SMALL N
-o LAT SMALL O
-p LAT SMALL P
-q LAT SMALL Q
-r LAT SMALL R
-s LAT SMALL S
-t LAT SMALL T
-u LAT SMALL U
-v LAT SMALL V
-w LAT SMALL W
-x LAT SMALL X
-y LAT SMALL Y
-z LAT SMALL Z
-A LAT CAPIT A
-B LAT CAPIT B
-C LAT CAPIT C
-D LAT CAPIT D
-E LAT CAPIT E
-F LAT CAPIT F
-G LAT CAPIT G
-H LAT CAPIT H
-I LAT CAPIT I
-J LAT CAPIT J
-K LAT CAPIT K
-L LAT CAPIT L
-M LAT CAPIT M
-N LAT CAPIT N
-O LAT CAPIT O
-P LAT CAPIT P
-Q LAT CAPIT Q
-R LAT CAPIT R
-S LAT CAPIT S
-T LAT CAPIT T
-U LAT CAPIT U
-V LAT CAPIT V
-W LAT CAPIT W
-X LAT CAPIT X
-Y LAT CAPIT Y
-Z LAT CAPIT Z
-â CYR SMALL A
-÷ CYR SMALL BE
-þ CYR SMALL VE
-ú CYR SMALL GE
-ä CYR SMALL DE
-å CYR SMALL IE
-? CYR SMALL IO
-ã CYR SMALL ZHE
-ÿ CYR SMALL ZE
-ê CYR SMALL I
-ì CYR SMALL KA
-í CYR SMALL EL
-î CYR SMALL EM
-ï CYR SMALL EN
-ð CYR SMALL O
-ò CYR SMALL PE
-ô CYR SMALL ER
-õ CYR SMALL ES
-æ CYR SMALL TE
-è CYR SMALL U
-ö CYR SMALL EF
-é CYR SMALL HA
-ç CYR SMALL TSE
-à CYR SMALL CHE
-ù CYR SMALL SHA
-ü CYR SMALL SCHA
-ñ CYR SMALL HARD SIGN
-ý CYR SMALL YERU
-û CYR SMALL SOFT SIGN
-ø CYR SMALL E
-á CYR SMALL YU
-ó CYR SMALL YA
-Â CYR CAPIT A
-× CYR CAPIT BE
-Þ CYR CAPIT VE
-Ú CYR CAPIT GE
-Ä CYR CAPIT DE
-Å CYR CAPIT IE
-? CYR CAPIT IO
-Ã CYR CAPIT ZHE
-ß CYR CAPIT ZE
-Ê CYR CAPIT I
-Ì CYR CAPIT KA
-Í CYR CAPIT EL
-Î CYR CAPIT EM
-Ï CYR CAPIT EN
-Ð CYR CAPIT O
-Ò CYR CAPIT PE
-Ô CYR CAPIT ER
-Õ CYR CAPIT ES
-Æ CYR CAPIT TE
-È CYR CAPIT U
-Ö CYR CAPIT EF
-É CYR CAPIT HA
-Ç CYR CAPIT TSE
-À CYR CAPIT CHE
-Ù CYR CAPIT SHA
-Ü CYR CAPIT SCHA
-Ñ CYR CAPIT HARD SIGN
-Ý CYR CAPIT YERU
-Û CYR CAPIT SOFT SIGN
-Ø CYR CAPIT E
-Á CYR CAPIT YU
-Ó CYR CAPIT YA
-explain extended select CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci'), comment from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 116
-Warnings:
-Note 1003 select high_priority convert(test.t1.koi8_ru_f,_latin1'utf8_general_ci',_latin1'cp1251_general_ci') AS `CONVERT(koi8_ru_f, 'cp1251_general_ci', 'utf8_general_ci')`,test.t1.comment AS `comment` from test.t1
ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL;
UPDATE t1 SET bin_f=koi8_ru_f;
SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
diff --git a/mysql-test/r/ctype_mb.result b/mysql-test/r/ctype_mb.result
index 288033e7530..edccb047c85 100644
--- a/mysql-test/r/ctype_mb.result
+++ b/mysql-test/r/ctype_mb.result
@@ -22,7 +22,7 @@ Warning 1264 Data truncated for column 'c2' at row 1
Warning 1264 Data truncated for column 'c3' at row 1
SELECT * FROM t1;
c1 c2 c3
-aaaabbbbcccc aaaabbbbcccc aaaabbbbcccc
+aaaa aaaa aaaa
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
SHOW CREATE TABLE t1;
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index 571c89ef467..7209c86bb31 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -19,6 +19,12 @@ SELECT HEX(a) FROM t2;
HEX(a)
D0BFD180D0BED0B1D0B0
DROP TABLE t1, t2;
+CREATE TABLE t1 (description text character set cp1250 NOT NULL);
+INSERT INTO t1 (description) VALUES (_latin2'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde');
+SELECT description FROM t1;
+description
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde
+DROP TABLE t1;
CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a;
CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
SHOW CREATE TABLE t1;
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
new file mode 100644
index 00000000000..10164cd07ef
--- /dev/null
+++ b/mysql-test/r/ctype_tis620.result
@@ -0,0 +1,113 @@
+drop table if exists t1;
+SET @pl0= _tis620 0x000102030405060708090A0B0C0D0E0F;
+SET @pl1= _tis620 0x101112131415161718191A1B1C1D1E1F;
+SET @pl2= _tis620 0x202122232425262728292A2B2C2D2E2F;
+SET @pl3= _tis620 0x303132333435363738393A3B3C3D3E3F;
+SET @pl4= _tis620 0x404142434445464748494A4B4C4D4E4F;
+SET @pl5= _tis620 0x505152535455565758595A5B5C5D5E5F;
+SET @pl6= _tis620 0x606162636465666768696A6B6C6D6E6F;
+SET @pl7= _tis620 0x707172737475767778797A7B7C7D7E7F;
+SET @pl8= _tis620 0x808182838485868788898A8B8C8D8E8F;
+SET @pl9= _tis620 0x909192939495969798999A9B9C9D9E9F;
+SET @plA= _tis620 0xA0A1A2A3A4A5A6A7A8A9AAABACADAEAF;
+SET @plB= _tis620 0xB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF;
+SET @plC= _tis620 0xC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF;
+SET @plD= _tis620 0xD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF;
+SET @plE= _tis620 0xE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF;
+SET @plF= _tis620 0xF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF;
+SELECT hex(@u0:=convert(@pl0 using utf8));
+hex(@u0:=convert(@pl0 using utf8))
+000102030405060708090A0B0C0D0E0F
+SELECT hex(@u1:=convert(@pl1 using utf8));
+hex(@u1:=convert(@pl1 using utf8))
+101112131415161718191A1B1C1D1E1F
+SELECT hex(@u2:=convert(@pl2 using utf8));
+hex(@u2:=convert(@pl2 using utf8))
+202122232425262728292A2B2C2D2E2F
+SELECT hex(@u3:=convert(@pl3 using utf8));
+hex(@u3:=convert(@pl3 using utf8))
+303132333435363738393A3B3C3D3E3F
+SELECT hex(@u4:=convert(@pl4 using utf8));
+hex(@u4:=convert(@pl4 using utf8))
+404142434445464748494A4B4C4D4E4F
+SELECT hex(@u5:=convert(@pl5 using utf8));
+hex(@u5:=convert(@pl5 using utf8))
+505152535455565758595A5B5C5D5E5F
+SELECT hex(@u6:=convert(@pl6 using utf8));
+hex(@u6:=convert(@pl6 using utf8))
+606162636465666768696A6B6C6D6E6F
+SELECT hex(@u7:=convert(@pl7 using utf8));
+hex(@u7:=convert(@pl7 using utf8))
+707172737475767778797A7B7C7D7E7F
+SELECT hex(@u8:=convert(@pl8 using utf8));
+hex(@u8:=convert(@pl8 using utf8))
+C280C281C282C283C284C285C286C287C288C289C28AC28BC28CC28DC28EC28F
+SELECT hex(@u9:=convert(@pl9 using utf8));
+hex(@u9:=convert(@pl9 using utf8))
+C290C291C292C293C294C295C296C297C298C299C29AC29BC29CC29DC29EC29F
+SELECT hex(@uA:=convert(@plA using utf8));
+hex(@uA:=convert(@plA using utf8))
+EFBFBDE0B881E0B882E0B883E0B884E0B885E0B886E0B887E0B888E0B889E0B88AE0B88BE0B88CE0B88DE0B88EE0B88F
+SELECT hex(@uB:=convert(@plB using utf8));
+hex(@uB:=convert(@plB using utf8))
+E0B890E0B891E0B892E0B893E0B894E0B895E0B896E0B897E0B898E0B899E0B89AE0B89BE0B89CE0B89DE0B89EE0B89F
+SELECT hex(@uC:=convert(@plC using utf8));
+hex(@uC:=convert(@plC using utf8))
+E0B8A0E0B8A1E0B8A2E0B8A3E0B8A4E0B8A5E0B8A6E0B8A7E0B8A8E0B8A9E0B8AAE0B8ABE0B8ACE0B8ADE0B8AEE0B8AF
+SELECT hex(@uD:=convert(@plD using utf8));
+hex(@uD:=convert(@plD using utf8))
+E0B8B0E0B8B1E0B8B2E0B8B3E0B8B4E0B8B5E0B8B6E0B8B7E0B8B8E0B8B9E0B8BAEFBFBDEFBFBDEFBFBDEFBFBDE0B8BF
+SELECT hex(@uE:=convert(@plE using utf8));
+hex(@uE:=convert(@plE using utf8))
+E0B980E0B981E0B982E0B983E0B984E0B985E0B986E0B987E0B988E0B989E0B98AE0B98BE0B98CE0B98DE0B98EE0B98F
+SELECT hex(@uF:=convert(@plF using utf8));
+hex(@uF:=convert(@plF using utf8))
+E0B990E0B991E0B992E0B993E0B994E0B995E0B996E0B997E0B998E0B999E0B99AE0B99BEFBFBDEFBFBDEFBFBDEFBFBD
+SELECT hex(convert(@u0 USING tis620));
+hex(convert(@u0 USING tis620))
+000102030405060708090A0B0C0D0E0F
+SELECT hex(convert(@u1 USING tis620));
+hex(convert(@u1 USING tis620))
+101112131415161718191A1B1C1D1E1F
+SELECT hex(convert(@u2 USING tis620));
+hex(convert(@u2 USING tis620))
+202122232425262728292A2B2C2D2E2F
+SELECT hex(convert(@u3 USING tis620));
+hex(convert(@u3 USING tis620))
+303132333435363738393A3B3C3D3E3F
+SELECT hex(convert(@u4 USING tis620));
+hex(convert(@u4 USING tis620))
+404142434445464748494A4B4C4D4E4F
+SELECT hex(convert(@u5 USING tis620));
+hex(convert(@u5 USING tis620))
+505152535455565758595A5B5C5D5E5F
+SELECT hex(convert(@u6 USING tis620));
+hex(convert(@u6 USING tis620))
+606162636465666768696A6B6C6D6E6F
+SELECT hex(convert(@u7 USING tis620));
+hex(convert(@u7 USING tis620))
+707172737475767778797A7B7C7D7E7F
+SELECT hex(convert(@u8 USING tis620));
+hex(convert(@u8 USING tis620))
+808182838485868788898A8B8C8D8E8F
+SELECT hex(convert(@u9 USING tis620));
+hex(convert(@u9 USING tis620))
+909192939495969798999A9B9C9D9E9F
+SELECT hex(convert(@uA USING tis620));
+hex(convert(@uA USING tis620))
+FFA1A2A3A4A5A6A7A8A9AAABACADAEAF
+SELECT hex(convert(@uB USING tis620));
+hex(convert(@uB USING tis620))
+B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF
+SELECT hex(convert(@uC USING tis620));
+hex(convert(@uC USING tis620))
+C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF
+SELECT hex(convert(@uD USING tis620));
+hex(convert(@uD USING tis620))
+D0D1D2D3D4D5D6D7D8D9DAFFFFFFFFDF
+SELECT hex(convert(@uE USING tis620));
+hex(convert(@uE USING tis620))
+E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF
+SELECT hex(convert(@uF USING tis620));
+hex(convert(@uF USING tis620))
+F0F1F2F3F4F5F6F7F8F9FAFBFFFFFFFF
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 2f6dc0c23ca..30795aaf106 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -77,6 +77,9 @@ a
test
select * from t1 where a like "%a%";
a
+a
+abc
+abcd
select * from t1 where a like "%abcd%";
a
abcd
@@ -84,6 +87,78 @@ select * from t1 where a like "%abc\d%";
a
abcd
drop table t1;
+select 'AA' like 'AA';
+'AA' like 'AA'
+1
+select 'AA' like 'A%A';
+'AA' like 'A%A'
+1
+select 'AA' like 'A%%A';
+'AA' like 'A%%A'
+1
+select 'AA' like 'AA%';
+'AA' like 'AA%'
+1
+select 'AA' like '%AA%';
+'AA' like '%AA%'
+1
+select 'AA' like '%A';
+'AA' like '%A'
+1
+select 'AA' like '%AA';
+'AA' like '%AA'
+1
+select 'AA' like 'A%A%';
+'AA' like 'A%A%'
+1
+select 'AA' like '_%_%';
+'AA' like '_%_%'
+1
+select 'AA' like '%A%A';
+'AA' like '%A%A'
+1
+select 'AAA'like 'A%A%A';
+'AAA'like 'A%A%A'
+1
+select 'AZ' like 'AZ';
+'AZ' like 'AZ'
+1
+select 'AZ' like 'A%Z';
+'AZ' like 'A%Z'
+1
+select 'AZ' like 'A%%Z';
+'AZ' like 'A%%Z'
+1
+select 'AZ' like 'AZ%';
+'AZ' like 'AZ%'
+1
+select 'AZ' like '%AZ%';
+'AZ' like '%AZ%'
+1
+select 'AZ' like '%Z';
+'AZ' like '%Z'
+1
+select 'AZ' like '%AZ';
+'AZ' like '%AZ'
+1
+select 'AZ' like 'A%Z%';
+'AZ' like 'A%Z%'
+1
+select 'AZ' like '_%_%';
+'AZ' like '_%_%'
+1
+select 'AZ' like '%A%Z';
+'AZ' like '%A%Z'
+1
+select 'AZ' like 'A_';
+'AZ' like 'A_'
+1
+select 'AZ' like '_Z';
+'AZ' like '_Z'
+1
+select 'AMZ'like 'A%M%Z';
+'AMZ'like 'A%M%Z'
+1
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2);
INSERT INTO t1 VALUES ('ÆÙ×Á'),('æÙ×Á'),('Æù×Á'),('ÆÙ÷Á'),('ÆÙ×á'),('æù÷á');
INSERT INTO t1 VALUES ('ÆÙ×ÁÐÒÏÌÄÖ'),('æÙ×ÁÐÒÏÌÄÖ'),('Æù×ÁÐÒÏÌÄÖ'),('ÆÙ÷ÁÐÒÏÌÄÖ');
@@ -173,6 +248,12 @@ SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F';
word
cat
DROP TABLE t1;
+select insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066);
+insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066)
+abc
+select insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066);
+insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066)
+defc
SET NAMES latin1;
CREATE TABLE t1 (
word VARCHAR(64),
@@ -270,3 +351,107 @@ aardvara
aardvark
aardvarz
DROP TABLE t1;
+SELECT HEX(_ucs2 0x0);
+HEX(_ucs2 0x0)
+0000
+SELECT HEX(_ucs2 0x01);
+HEX(_ucs2 0x01)
+0001
+SELECT HEX(_ucs2 0x012);
+HEX(_ucs2 0x012)
+0012
+SELECT HEX(_ucs2 0x0123);
+HEX(_ucs2 0x0123)
+0123
+SELECT HEX(_ucs2 0x01234);
+HEX(_ucs2 0x01234)
+00001234
+SELECT HEX(_ucs2 0x012345);
+HEX(_ucs2 0x012345)
+00012345
+SELECT HEX(_ucs2 0x0123456);
+HEX(_ucs2 0x0123456)
+00123456
+SELECT HEX(_ucs2 0x01234567);
+HEX(_ucs2 0x01234567)
+01234567
+SELECT HEX(_ucs2 0x012345678);
+HEX(_ucs2 0x012345678)
+000012345678
+SELECT HEX(_ucs2 0x0123456789);
+HEX(_ucs2 0x0123456789)
+000123456789
+SELECT HEX(_ucs2 0x0123456789A);
+HEX(_ucs2 0x0123456789A)
+00123456789A
+SELECT HEX(_ucs2 0x0123456789AB);
+HEX(_ucs2 0x0123456789AB)
+0123456789AB
+SELECT HEX(_ucs2 0x0123456789ABC);
+HEX(_ucs2 0x0123456789ABC)
+0000123456789ABC
+SELECT HEX(_ucs2 0x0123456789ABCD);
+HEX(_ucs2 0x0123456789ABCD)
+000123456789ABCD
+SELECT HEX(_ucs2 0x0123456789ABCDE);
+HEX(_ucs2 0x0123456789ABCDE)
+00123456789ABCDE
+SELECT HEX(_ucs2 0x0123456789ABCDEF);
+HEX(_ucs2 0x0123456789ABCDEF)
+0123456789ABCDEF
+SELECT hex(cast(0xAA as char character set ucs2));
+hex(cast(0xAA as char character set ucs2))
+00AA
+SELECT hex(convert(0xAA using ucs2));
+hex(convert(0xAA using ucs2))
+00AA
+CREATE TABLE t1 (a char(10) character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+HEX(a)
+000A
+00AA
+0AAA
+AAAA
+000AAAAA
+DROP TABLE t1;
+CREATE TABLE t1 (a varchar(10) character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+HEX(a)
+000A
+00AA
+0AAA
+AAAA
+000AAAAA
+DROP TABLE t1;
+CREATE TABLE t1 (a text character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+HEX(a)
+000A
+00AA
+0AAA
+AAAA
+000AAAAA
+DROP TABLE t1;
+CREATE TABLE t1 (a mediumtext character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+HEX(a)
+000A
+00AA
+0AAA
+AAAA
+000AAAAA
+DROP TABLE t1;
+CREATE TABLE t1 (a longtext character set ucs2);
+INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
+SELECT HEX(a) FROM t1;
+HEX(a)
+000A
+00AA
+0AAA
+AAAA
+000AAAAA
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 1aef43cd570..8b7178993a7 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -1,3 +1,4 @@
+drop table if exists t1;
set names utf8;
select left(_utf8 0xD0B0D0B1D0B2,1);
left(_utf8 0xD0B0D0B1D0B2,1)
@@ -62,3 +63,109 @@ select 'A' like 'a' collate utf8_bin;
select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
_utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%')
1
+select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
+insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
+this is a test
+select insert("aa",100,1,"b"),insert("aa",1,3,"b");
+insert("aa",100,1,"b") insert("aa",1,3,"b")
+aa b
+create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `date_format("2004-01-19 10:10:10", "%Y-%m-%d")` char(10) binary default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+date_format("2004-01-19 10:10:10", "%Y-%m-%d")
+2004-01-19
+drop table t1;
+set names koi8r;
+create table t1 (s1 char(1) character set utf8);
+insert into t1 values (_koi8r'ÁÂ');
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
+s1 hex(s1) char_length(s1) octet_length(s1)
+Á D0B0 1 2
+drop table t1;
+create table t1 (s1 tinytext character set utf8);
+insert into t1 select repeat('a',300);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ñ',300);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('aÑ',300);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ña',300);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('ÑÑ',300);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161
+D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
+61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F
+D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61
+D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F
+select length(s1),char_length(s1) from t1;
+length(s1) char_length(s1)
+255 255
+254 127
+255 170
+255 170
+254 127
+drop table t1;
+create table t1 (s1 text character set utf8);
+insert into t1 select repeat('a',66000);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ñ',66000);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('aÑ',66000);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('Ña',66000);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+insert into t1 select repeat('ÑÑ',66000);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+select length(s1),char_length(s1) from t1;
+length(s1) char_length(s1)
+65535 65535
+65534 32767
+65535 43690
+65535 43690
+65534 32767
+drop table t1;
+create table t1 (s1 char(10) character set utf8);
+insert into t1 values (0x41FF);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+41
+drop table t1;
+create table t1 (s1 varchar(10) character set utf8);
+insert into t1 values (0x41FF);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+41
+drop table t1;
+create table t1 (s1 text character set utf8);
+insert into t1 values (0x41FF);
+Warnings:
+Warning 1264 Data truncated for column 's1' at row 1
+select hex(s1) from t1;
+hex(s1)
+41
+drop table t1;
+create table t1 (a char(160) character set utf8, primary key(a));
+ERROR HY000: Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the storage engine doesn't support unique sub keys
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index ee4fa074477..165a8d7011c 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -1,6 +1,4 @@
drop table if exists t1;
-Warnings:
-Note 1051 Unknown table 't1'
SHOW GLOBAL VARIABLES LIKE "%_format%";
Variable_name Value
date_format %d.%m.%Y
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index bb268cd1094..049d88c5154 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -59,7 +59,7 @@ explain select * from t1 as x1, (select * from t1) as x2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY x1 ALL NULL NULL NULL NULL 4
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
-2 DERIVED x1 ALL NULL NULL NULL NULL 4
+2 DERIVED t1 ALL NULL NULL NULL NULL 4
drop table if exists t2,t3;
select * from (select 1) as a;
1
@@ -85,6 +85,10 @@ a b
2 b
3 c
3 c
+select * from (select * from t1 union all select * from t1 limit 2) a;
+a b
+1 a
+2 b
explain select * from (select * from t1 union select * from t1) a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
@@ -137,7 +141,7 @@ a t
explain select count(*) from t1 as tt1, (select * from t1) as tt2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
-2 DERIVED tt1 ALL NULL NULL NULL NULL 10000
+2 DERIVED t1 ALL NULL NULL NULL NULL 10000
drop table t1;
SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
(SELECT * FROM (SELECT 1 as a) as a )
@@ -185,13 +189,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY m2 ALL NULL NULL NULL NULL 9
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where
2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
-2 DERIVED m2 index NULL PRIMARY 3 NULL 9 Using index
+2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
explain SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY m2 ALL NULL NULL NULL NULL 9
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where
2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
-2 DERIVED m2 index NULL PRIMARY 3 NULL 9 Using index
+2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
drop table t1,t2;
SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
x
@@ -209,7 +213,7 @@ ERROR 42000: You have an error in your SQL syntax. Check the manual that corres
create table t1 (a int);
insert into t1 values (1),(2),(3);
update (select * from t1) as t1 set a = 5;
-ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use
+ERROR HY000: The target table t1 of the UPDATE is not updatable.
delete from (select * from t1);
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(select * from t1)' at line 1
insert into (select * from t1) values (5);
@@ -225,7 +229,7 @@ explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 THEMAX.E2 1 Using where
-2 DERIVED t1 ALL NULL NULL NULL NULL 2 Using where
+2 DERIVED A ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 2 Using where
drop table t1;
create table t1 (a int);
@@ -245,3 +249,74 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED t1 ALL NULL NULL NULL NULL 2
3 UNION t1 ALL NULL NULL NULL NULL 2
drop table t1;
+CREATE TABLE `t1` (
+`N` int(11) unsigned NOT NULL default '0',
+`M` tinyint(1) default '0',
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
+UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
+select * from t1;
+N M
+1 2
+1 2
+1 2
+2 2
+2 2
+3 0
+UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2;
+ERROR HY000: The target table P2 of the UPDATE is not updatable.
+UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
+ERROR 42S22: Unknown column 'aaaa' in 'field list'
+delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
+select * from t1;
+N M
+3 0
+delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
+ERROR HY000: The target table P2 of the DELETE is not updatable.
+delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
+ERROR 42S22: Unknown column 'aaa' in 'field list'
+drop table t1;
+CREATE TABLE t1 (
+OBJECTID int(11) NOT NULL default '0',
+SORTORDER int(11) NOT NULL auto_increment,
+KEY t1_SortIndex (SORTORDER),
+KEY t1_IdIndex (OBJECTID)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TABLE t2 (
+ID int(11) default NULL,
+PARID int(11) default NULL,
+UNIQUE KEY t2_ID_IDX (ID),
+KEY t2_PARID_IDX (PARID)
+) engine=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t2 VALUES (1000,0),(1001,0),(1002,0),(1003,0),(1008,1),(1009,1),(1010,1),(1011,1),(1016,2);
+CREATE TABLE t3 (
+ID int(11) default NULL,
+DATA decimal(10,2) default NULL,
+UNIQUE KEY t3_ID_IDX (ID)
+) engine=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
+select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP;
+497 ID NULL
+drop table t1, t2, t3;
+CREATE TABLE t1 (name char(1) default NULL, val int(5) default NULL);
+INSERT INTO t1 VALUES ('a',1), ('a',2), ('a',2), ('a',2), ('a',3), ('a',6), ('a',7), ('a',11), ('a',11), ('a',12), ('a',13), ('a',13), ('a',20), ('b',2), ('b',3), ('b',4), ('b',5);
+SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
+name median
+a 7.0000
+b 3.5000
+explain SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
+2 DERIVED x ALL NULL NULL NULL NULL 17 Using temporary; Using filesort
+2 DERIVED y ALL NULL NULL NULL NULL 17 Using where
+drop table t1;
+create table t2 (a int, b int, primary key (a));
+insert into t2 values (1,7),(2,7);
+explain select a from t2 where a>1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
+explain select a from (select a from t2 where a>1) tt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1
+2 DERIVED t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
+drop table t2;
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index cf07ba88477..085e2f2f37e 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -104,3 +104,33 @@ a
ÆÙ×ÁÐÒÏÌÄö
æù÷áðòïìäö
DROP TABLE t1;
+SET NAMES cp1250;
+CREATE TABLE t1 (a varchar(250) NOT NULL) DEFAULT CHARACTER SET=cp1250;
+INSERT INTO t1 VALUES
+('Techni Tapes Sp. z o.o.'),
+('Pojazdy Szynowe PESA Bydgoszcz SA Holding'),
+('AKAPESTER 1 P.P.H.U.'),
+('Pojazdy Szynowe PESA Bydgoszcz S A Holding'),
+('PPUH PESKA-I Maria Struniarska');
+select * from t1 where a like '%PESA%';
+a
+Pojazdy Szynowe PESA Bydgoszcz SA Holding
+Pojazdy Szynowe PESA Bydgoszcz S A Holding
+select * from t1 where a like '%PESA %';
+a
+Pojazdy Szynowe PESA Bydgoszcz SA Holding
+Pojazdy Szynowe PESA Bydgoszcz S A Holding
+select * from t1 where a like '%PES%';
+a
+Techni Tapes Sp. z o.o.
+Pojazdy Szynowe PESA Bydgoszcz SA Holding
+AKAPESTER 1 P.P.H.U.
+Pojazdy Szynowe PESA Bydgoszcz S A Holding
+PPUH PESKA-I Maria Struniarska
+select * from t1 where a like '%PESKA%';
+a
+PPUH PESKA-I Maria Struniarska
+select * from t1 where a like '%ESKA%';
+a
+PPUH PESKA-I Maria Struniarska
+DROP TABLE t1;
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index d51bea020ed..ec5f76409e7 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -6,10 +6,19 @@ inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"))
NULL
select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
inet_aton("255.255.255.255.255") inet_aton("255.255.1.255") inet_aton("0.1.255")
-1099511627775 4294902271 511
+1099511627775 4294902271 65791
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
inet_ntoa(1099511627775) inet_ntoa(4294902271) inet_ntoa(511)
NULL 255.255.1.255 0.0.1.255
+select hex(inet_aton('127'));
+hex(inet_aton('127'))
+7F
+select hex(inet_aton('127.1'));
+hex(inet_aton('127.1'))
+7F000001
+select hex(inet_aton('127.1.1'));
+hex(inet_aton('127.1.1'))
+7F010001
select length(format('nan', 2)) > 0;
length(format('nan', 2)) > 0
1
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index c74feccfb7f..f08ae1b1efd 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -605,3 +605,6 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select high_priority md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,(_latin1'HE' collate _latin1'BINARY') AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
+SELECT lpad(12345, 5, "#");
+lpad(12345, 5, "#")
+12345
diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result
index a0437ca1c56..338902e3f3a 100644
--- a/mysql-test/r/func_system.result
+++ b/mysql-test/r/func_system.result
@@ -51,6 +51,20 @@ t1 CREATE TABLE `t1` (
`version` char(40) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
+charset(charset(_utf8'a')) charset(collation(_utf8'a'))
+utf8 utf8
+select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
+collation(charset(_utf8'a')) collation(collation(_utf8'a'))
+utf8_general_ci utf8_general_ci
+create table t1 select charset(_utf8'a'), collation(_utf8'a');
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `charset(_utf8'a')` char(64) character set utf8 NOT NULL default '',
+ `collation(_utf8'a')` char(64) character set utf8 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
select TRUE,FALSE,NULL;
TRUE FALSE NULL
1 0 NULL
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 6edc4a5485d..95f39fc705e 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -165,3 +165,9 @@ SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1
rank rank rank
2 2 NULL
DROP TABLE t1,t2;
+CREATE TABLE t1 (d varchar(6), k int);
+INSERT INTO t1 VALUES (NULL, 2);
+SELECT GREATEST(d,d) FROM t1 WHERE k=2;
+GREATEST(d,d)
+NULL
+DROP TABLE t1;
diff --git a/mysql-test/r/have_big5.require b/mysql-test/r/have_big5.require
new file mode 100644
index 00000000000..74aacf74b62
--- /dev/null
+++ b/mysql-test/r/have_big5.require
@@ -0,0 +1,2 @@
+Collation Charset Id Default Compiled Sortlen
+big5_chinese_ci big5 1 Yes Yes 1
diff --git a/mysql-test/r/have_tis620.require b/mysql-test/r/have_tis620.require
new file mode 100644
index 00000000000..a1bf93ac491
--- /dev/null
+++ b/mysql-test/r/have_tis620.require
@@ -0,0 +1,2 @@
+Collation Charset Id Default Compiled Sortlen
+tis620_thai_ci tis620 18 Yes Yes 4
diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result
index af3cf956222..b83a226776d 100644
--- a/mysql-test/r/key_cache.result
+++ b/mysql-test/r/key_cache.result
@@ -100,7 +100,7 @@ p i a
4 3 zzzz
update t1 set p=2 where p=1;
update t2 set i=2 where i=1;
-cache index t1 keys (`primary`) in keycache1;
+cache index t1 key (`primary`) in keycache1;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
explain select p from t1;
@@ -177,7 +177,7 @@ yyyy
zzzz
cache index t1 in unknown_key_cache;
ERROR HY000: Unknown key cache 'unknown_key_cache'
-cache index t1 keys (unknown_key) in keycache1;
+cache index t1 key (unknown_key) in keycache1;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache error Key column 'unknown_key' doesn't exist in table
test.t1 assign_to_keycache status Operation failed
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 5979a946b51..be09044f96f 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -244,7 +244,7 @@ select * from t2;
n d
1 30
1 30
-DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n;
+DELETE a, b FROM t1 a,t2 b where a.n=b.n;
select * from t1;
n d
3 2
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 04effdfef7c..0e642f48f3c 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -21,17 +21,22 @@ DROP TABLE t1;
CREATE TABLE t1 (a decimal(240, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
- a decimal(240,20) default NULL
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` decimal(240,20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-/*!40000 ALTER TABLE t1 DISABLE KEYS */;
-LOCK TABLES t1 WRITE;
-INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890.00000000000000000000"),("0987654321098765432109876543210987654321.00000000000000000000");
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ("1234567890123456789012345678901234567890.00000000000000000000"),("0987654321098765432109876543210987654321.00000000000000000000");
UNLOCK TABLES;
-/*!40000 ALTER TABLE t1 ENABLE KEYS */;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@@ -41,17 +46,22 @@ UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES (-9e999999);
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
- a double default NULL
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-/*!40000 ALTER TABLE t1 DISABLE KEYS */;
-LOCK TABLES t1 WRITE;
-INSERT INTO t1 VALUES (RES);
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES (RES);
UNLOCK TABLES;
-/*!40000 ALTER TABLE t1 ENABLE KEYS */;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@@ -105,17 +115,22 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
- a varchar(255) default NULL
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` varchar(255) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=koi8r;
-/*!40000 ALTER TABLE t1 DISABLE KEYS */;
-LOCK TABLES t1 WRITE;
-INSERT INTO t1 VALUES ('абцде');
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('абцде');
UNLOCK TABLES;
-/*!40000 ALTER TABLE t1 ENABLE KEYS */;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
@@ -123,3 +138,67 @@ UNLOCK TABLES;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
DROP TABLE t1;
+CREATE TABLE t1 (a int) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1), (2);
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) default NULL
+) TYPE=MyISAM;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES (1),(2);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) default NULL
+) TYPE=MyISAM;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES (1),(2);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+
+DROP TABLE t1;
+create table ```a` (i int);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
+DROP TABLE IF EXISTS ```a`;
+CREATE TABLE ```a` (
+ `i` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE ```a` DISABLE KEYS */;
+LOCK TABLES ```a` WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE ```a` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+
+drop table ```a`;
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index c4af221e117..aa56bce6453 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -153,3 +153,6 @@ explain select * from t1 where a between 2 and 3 or b is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx idx 4 NULL 2 Using where
drop table t1;
+select cast(NULL as signed);
+cast(NULL as signed)
+NULL
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 4d166a961f3..c1053087603 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -590,3 +590,24 @@ SELECT id FROM t1 WHERE id <11984 AND menu =2 ORDER BY id DESC LIMIT 1 ;
id
11392
drop table t1;
+create table t1(a int, b int, index(b));
+insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2);
+explain select * from t1 where b=1 or b is null order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null b b 5 const 3 Using where; Using filesort
+select * from t1 where b=1 or b is null order by a;
+a b
+1 1
+2 1
+3 NULL
+4 NULL
+explain select * from t1 where b=2 or b is null order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref_or_null b b 5 const 4 Using where; Using filesort
+select * from t1 where b=2 or b is null order by a;
+a b
+3 NULL
+4 NULL
+5 2
+6 2
+drop table t1;
diff --git a/mysql-test/r/preload.result b/mysql-test/r/preload.result
index bd7b828d5b9..f0b99a8d6f1 100644
--- a/mysql-test/r/preload.result
+++ b/mysql-test/r/preload.result
@@ -117,7 +117,7 @@ set session preload_buffer_size=1*1024;
select @@preload_buffer_size;
@@preload_buffer_size
1024
-load index into cache t1, t2 keys (primary,b) ignore leaves;
+load index into cache t1, t2 key (primary,b) ignore leaves;
Table Op Msg_type Msg_text
test.t1 preload_keys status OK
test.t2 preload_keys status OK
@@ -141,7 +141,7 @@ show status like "key_read%";
Variable_name Value
Key_read_requests 0
Key_reads 0
-load index into cache t3, t2 keys (primary,b) ;
+load index into cache t3, t2 key (primary,b) ;
Table Op Msg_type Msg_text
test.t3 preload_keys error Table 'test.t3' doesn't exist
test.t2 preload_keys status OK
@@ -155,7 +155,7 @@ show status like "key_read%";
Variable_name Value
Key_read_requests 0
Key_reads 0
-load index into cache t3 keys (b), t2 keys (c) ;
+load index into cache t3 key (b), t2 key (c) ;
Table Op Msg_type Msg_text
test.t3 preload_keys error Table 'test.t3' doesn't exist
test.t2 preload_keys error Key column 'c' doesn't exist in table
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 60a6fac6458..c1d73f20e34 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -696,17 +696,22 @@ word
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
-load data infile '../../std_data/words.dat' into table t1;
+load data infile 'TEST_DIR/std_data/words.dat' into table t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
+select count(*) from t1;
+count(*)
+70
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
-select * from t1 into outfile "query_caceh.out.file";
+select * from t1 into outfile "query_cache.out.file";
+select * from t1 into outfile "query_cache.out.file";
+ERROR HY000: File 'query_cache.out.file' already exists
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
show status like "Qcache_queries_in_cache";
Variable_name Value
@@ -815,14 +820,22 @@ Qcache_hits 6
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 4
-drop table t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a int(1));
+CREATE DATABASE mysqltest;
+USE mysqltest;
+DROP DATABASE mysqltest;
+SELECT * FROM test.t1;
+a
+USE test;
+DROP TABLE t1;
create table t1 (a int);
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
-Qcache_inserts 8
+Qcache_inserts 9
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 6
@@ -835,7 +848,7 @@ Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
-Qcache_inserts 9
+Qcache_inserts 10
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 7
diff --git a/mysql-test/r/rpl_until.result b/mysql-test/r/rpl_until.result
index 17b505487e9..b6c525e0e9c 100644
--- a/mysql-test/r/rpl_until.result
+++ b/mysql-test/r/rpl_until.result
@@ -31,7 +31,7 @@ n
4
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 439 master-bin.000001 Yes No 0 0 304 866 Master master-bin.000001 304 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 304 # Master master-bin.000001 304 No #
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1;
n
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 8ac880982fb..3fa700ccf26 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -88,20 +88,37 @@ drop table t2;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
name char(20) default 'O''Brien' comment 'O''Brien as default',
-c int not null comment 'int column'
- ) comment = 'it\'s a table' ;
-show create table t1 ;
+c int not null comment 'int column',
+`c-b` int comment 'name with a space',
+`space ` int comment 'name with a space',
+) comment = 'it\'s a table' ;
+show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
- `c` int(11) NOT NULL default '0' COMMENT 'int column'
+ `c` int(11) NOT NULL default '0' COMMENT 'int column',
+ `c-b` int(11) default NULL COMMENT 'name with a space',
+ `space ` int(11) default NULL COMMENT 'name with a space'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
+set sql_quote_show_create=0;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE t1 (
+ test_set set('val1','val2','val3') NOT NULL default '',
+ `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
+ c int(11) NOT NULL default '0' COMMENT 'int column',
+ `c-b` int(11) default NULL COMMENT 'name with a space',
+ `space ` int(11) default NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
+set sql_quote_show_create=1;
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references
name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default
c int(11) NULL 0 select,insert,update,references int column
+c-b int(11) NULL YES NULL select,insert,update,references name with a space
+space int(11) NULL YES NULL select,insert,update,references name with a space
drop table t1;
create table t1 (a int not null, unique aa (a));
show create table t1;
@@ -249,3 +266,51 @@ c decimal(4,3) YES NULL
d double(4,3) YES NULL
f float(4,3) YES NULL
drop table t1;
+SET sql_mode='';
+SET sql_quote_show_create=OFF;
+CREATE TABLE ```ab``cd``` (i INT);
+SHOW CREATE TABLE ```ab``cd```;
+Table Create Table
+`ab`cd` CREATE TABLE ```ab``cd``` (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE ```ab``cd```;
+CREATE TABLE ```ab````cd``` (i INT);
+SHOW CREATE TABLE ```ab````cd```;
+Table Create Table
+`ab``cd` CREATE TABLE ```ab````cd``` (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE ```ab````cd```;
+CREATE TABLE ```a` (i INT);
+SHOW CREATE TABLE ```a`;
+Table Create Table
+`a CREATE TABLE ```a` (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE ```a`;
+SET sql_mode='ANSI_QUOTES';
+CREATE TABLE """a" (i INT);
+SHOW CREATE TABLE """a";
+Table Create Table
+"a CREATE TABLE """a" (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE """a";
+SET sql_mode='';
+SET sql_quote_show_create=OFF;
+CREATE TABLE t1 (i INT);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE t1 (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE `table` (i INT);
+SHOW CREATE TABLE `table`;
+Table Create Table
+table CREATE TABLE `table` (
+ i int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE `table`;
+SET sql_quote_show_create=ON;
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 07835201acb..f965cf90eb4 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -35,7 +35,7 @@ call foo()|
ERROR 42000: PROCEDURE foo does not exist
drop procedure if exists foo|
Warnings:
-Warning 1289 PROCEDURE foo does not exist
+Warning 1292 PROCEDURE foo does not exist
show create procedure foo|
ERROR 42000: PROCEDURE foo does not exist
create procedure foo()
@@ -71,7 +71,7 @@ declare y int;
set x = y;
end|
Warnings:
-Warning 1295 Referring to uninitialized variable y
+Warning 1298 Referring to uninitialized variable y
drop procedure foo|
create procedure foo()
return 42|
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index f77f0787f20..bf515e4b4cd 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -968,6 +968,27 @@ drop procedure bug2267_1|
drop procedure bug2267_2|
drop procedure bug2267_3|
drop procedure bug2267_4|
+create procedure bug2227(x int)
+begin
+declare y float default 2.6;
+declare z char(16) default "zzz";
+select 1.3, x, y, 42, z;
+end|
+call bug2227(9)|
+1.3 x y 42 z
+1.3 9 2.6 42 zzz
+drop procedure bug2227|
+create procedure bug2614()
+begin
+drop table if exists t3;
+create table t3 (id int default '0' not null);
+insert into t3 select 12;
+insert into t3 select * from t3;
+end|
+call bug2614()|
+call bug2614()|
+drop table t3|
+drop procedure bug2614|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned)
diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
index ddc848af1ed..77fe5d06bb0 100644
--- a/mysql-test/r/sql_mode.result
+++ b/mysql-test/r/sql_mode.result
@@ -70,7 +70,7 @@ t1 CREATE TABLE `t1` (
`email` varchar(60) NOT NULL default '',
PRIMARY KEY (`a`),
UNIQUE KEY `email` (`email`)
-) ENGINE=HEAP ROW_FORMAT=DYNAMIC
+) TYPE=HEAP ROW_FORMAT=DYNAMIC
set sql_mode="postgresql,oracle,mssql,db2,maxdb";
select @@sql_mode;
@@sql_mode
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 3a2de4035eb..19722ddaa69 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1577,3 +1577,37 @@ INSERT INTO t2 VALUES (100, 200, 'C');
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
COLC
DROP TABLE t1, t2;
+create table t1 (a int, b decimal(13, 3));
+insert into t1 values (1, 0.123);
+select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
+delete from t1;
+load data infile "subselect.out.file.1" into table t1;
+select * from t1;
+a b
+1 0.123
+drop table t1;
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL auto_increment,
+`id_cns` tinyint(3) unsigned NOT NULL default '0',
+`tipo` enum('','UNO','DUE') NOT NULL default '',
+`anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
+`particolare` mediumint(8) unsigned NOT NULL default '0',
+`generale` mediumint(8) unsigned NOT NULL default '0',
+`bis` tinyint(3) unsigned NOT NULL default '0',
+PRIMARY KEY (`id`),
+UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
+UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
+);
+INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
+CREATE TABLE `t2` (
+`id` tinyint(3) unsigned NOT NULL auto_increment,
+`max_anno_dep` smallint(6) unsigned NOT NULL default '0',
+PRIMARY KEY (`id`)
+);
+INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
+SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
+id max_anno_dep PIPPO
+16 1987 1
+50 1990 0
+51 1990 NULL
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index 6729916f1c8..b2a055fa72c 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -60,6 +60,39 @@ INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
SELECT distinct p1.processor_id, (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) FROM t1 p1;
processor_id (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id)
1 1
-2 1
-3 1
+2 2
+3 3
drop table t1,t2,t3;
+CREATE TABLE t1 (
+id int(11) NOT NULL default '0',
+b int(11) default NULL,
+c char(3) default NULL,
+PRIMARY KEY (id),
+KEY t2i1 (b)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
+CREATE TABLE t2 (
+id int(11) NOT NULL default '0',
+b int(11) default NULL,
+c char(3) default NULL,
+PRIMARY KEY (id),
+KEY t2i (b)
+) ENGINE=innodb DEFAULT CHARSET=latin1;
+INSERT INTO t2 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
+select (select max(id) from t2 where b=1 group by b) as x,b from t1 where b=1;
+x b
+2 1
+drop table t1,t2;
+create table t1 (id int not null, value char(255), primary key(id)) engine=innodb;
+create table t2 (id int not null, value char(255)) engine=innodb;
+insert into t1 values (1,'a'),(2,'b');
+insert into t2 values (1,'z'),(2,'x');
+select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
+id value (select t1.value from t1 where t1.id=t2.id)
+1 z a
+2 x b
+select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
+id value (select t1.value from t1 where t1.id=t2.id)
+1 z a
+2 x b
+drop table t1,t2;
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 4ba0ca0eac4..6dc48a0a77e 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -66,7 +66,7 @@ t9 CREATE TABLE `t9` (
drop database mysqltest;
create table t1 (a int not null) type=myisam;
Warnings:
-Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
+Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index 97d81d77722..fa4cd231129 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -446,39 +446,6 @@ CREATE TABLE t1 (a_dec DECIMAL(-1,1));
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,1))' at line 1
create table t1(a decimal(7,3));
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
-Warnings:
-Warning 1263 Data truncated, out of range for column 'a' at row 27
-Warning 1263 Data truncated, out of range for column 'a' at row 30
-Warning 1263 Data truncated, out of range for column 'a' at row 31
-Warning 1263 Data truncated, out of range for column 'a' at row 32
-Warning 1263 Data truncated, out of range for column 'a' at row 33
-Warning 1263 Data truncated, out of range for column 'a' at row 34
-Warning 1263 Data truncated, out of range for column 'a' at row 35
-Warning 1263 Data truncated, out of range for column 'a' at row 36
-Warning 1263 Data truncated, out of range for column 'a' at row 37
-Warning 1263 Data truncated, out of range for column 'a' at row 38
-Warning 1263 Data truncated, out of range for column 'a' at row 39
-Warning 1263 Data truncated, out of range for column 'a' at row 40
-Warning 1263 Data truncated, out of range for column 'a' at row 41
-Warning 1263 Data truncated, out of range for column 'a' at row 42
-Warning 1263 Data truncated, out of range for column 'a' at row 43
-Warning 1263 Data truncated, out of range for column 'a' at row 44
-Warning 1263 Data truncated, out of range for column 'a' at row 45
-Warning 1263 Data truncated, out of range for column 'a' at row 46
-Warning 1263 Data truncated, out of range for column 'a' at row 47
-Warning 1263 Data truncated, out of range for column 'a' at row 48
-Warning 1263 Data truncated, out of range for column 'a' at row 49
-Warning 1263 Data truncated, out of range for column 'a' at row 50
-Warning 1263 Data truncated, out of range for column 'a' at row 51
-Warning 1263 Data truncated, out of range for column 'a' at row 52
-Warning 1263 Data truncated, out of range for column 'a' at row 53
-Warning 1263 Data truncated, out of range for column 'a' at row 54
-Warning 1263 Data truncated, out of range for column 'a' at row 55
-Warning 1263 Data truncated, out of range for column 'a' at row 56
-Warning 1263 Data truncated, out of range for column 'a' at row 57
-Warning 1263 Data truncated, out of range for column 'a' at row 58
-Warning 1263 Data truncated, out of range for column 'a' at row 59
-Warning 1263 Data truncated, out of range for column 'a' at row 60
select * from t1;
a
1.000
@@ -544,51 +511,6 @@ a
drop table t1;
create table t1(a decimal(7,3) unsigned);
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
-Warnings:
-Warning 1263 Data truncated, out of range for column 'a' at row 3
-Warning 1263 Data truncated, out of range for column 'a' at row 6
-Warning 1263 Data truncated, out of range for column 'a' at row 9
-Warning 1263 Data truncated, out of range for column 'a' at row 12
-Warning 1263 Data truncated, out of range for column 'a' at row 15
-Warning 1263 Data truncated, out of range for column 'a' at row 18
-Warning 1263 Data truncated, out of range for column 'a' at row 21
-Warning 1263 Data truncated, out of range for column 'a' at row 24
-Warning 1263 Data truncated, out of range for column 'a' at row 25
-Warning 1263 Data truncated, out of range for column 'a' at row 26
-Warning 1263 Data truncated, out of range for column 'a' at row 27
-Warning 1263 Data truncated, out of range for column 'a' at row 28
-Warning 1263 Data truncated, out of range for column 'a' at row 29
-Warning 1263 Data truncated, out of range for column 'a' at row 30
-Warning 1263 Data truncated, out of range for column 'a' at row 31
-Warning 1263 Data truncated, out of range for column 'a' at row 32
-Warning 1263 Data truncated, out of range for column 'a' at row 33
-Warning 1263 Data truncated, out of range for column 'a' at row 34
-Warning 1263 Data truncated, out of range for column 'a' at row 35
-Warning 1263 Data truncated, out of range for column 'a' at row 36
-Warning 1263 Data truncated, out of range for column 'a' at row 37
-Warning 1263 Data truncated, out of range for column 'a' at row 38
-Warning 1263 Data truncated, out of range for column 'a' at row 39
-Warning 1263 Data truncated, out of range for column 'a' at row 40
-Warning 1263 Data truncated, out of range for column 'a' at row 41
-Warning 1263 Data truncated, out of range for column 'a' at row 42
-Warning 1263 Data truncated, out of range for column 'a' at row 43
-Warning 1263 Data truncated, out of range for column 'a' at row 44
-Warning 1263 Data truncated, out of range for column 'a' at row 45
-Warning 1263 Data truncated, out of range for column 'a' at row 46
-Warning 1263 Data truncated, out of range for column 'a' at row 47
-Warning 1263 Data truncated, out of range for column 'a' at row 48
-Warning 1263 Data truncated, out of range for column 'a' at row 49
-Warning 1263 Data truncated, out of range for column 'a' at row 50
-Warning 1263 Data truncated, out of range for column 'a' at row 51
-Warning 1263 Data truncated, out of range for column 'a' at row 52
-Warning 1263 Data truncated, out of range for column 'a' at row 53
-Warning 1263 Data truncated, out of range for column 'a' at row 54
-Warning 1263 Data truncated, out of range for column 'a' at row 55
-Warning 1263 Data truncated, out of range for column 'a' at row 56
-Warning 1263 Data truncated, out of range for column 'a' at row 57
-Warning 1263 Data truncated, out of range for column 'a' at row 58
-Warning 1263 Data truncated, out of range for column 'a' at row 59
-Warning 1263 Data truncated, out of range for column 'a' at row 60
select * from t1;
a
1.000
@@ -654,51 +576,6 @@ a
drop table t1;
create table t1(a decimal(7,3) zerofill);
insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
-Warnings:
-Warning 1263 Data truncated, out of range for column 'a' at row 3
-Warning 1263 Data truncated, out of range for column 'a' at row 6
-Warning 1263 Data truncated, out of range for column 'a' at row 9
-Warning 1263 Data truncated, out of range for column 'a' at row 12
-Warning 1263 Data truncated, out of range for column 'a' at row 15
-Warning 1263 Data truncated, out of range for column 'a' at row 18
-Warning 1263 Data truncated, out of range for column 'a' at row 21
-Warning 1263 Data truncated, out of range for column 'a' at row 24
-Warning 1263 Data truncated, out of range for column 'a' at row 25
-Warning 1263 Data truncated, out of range for column 'a' at row 26
-Warning 1263 Data truncated, out of range for column 'a' at row 27
-Warning 1263 Data truncated, out of range for column 'a' at row 28
-Warning 1263 Data truncated, out of range for column 'a' at row 29
-Warning 1263 Data truncated, out of range for column 'a' at row 30
-Warning 1263 Data truncated, out of range for column 'a' at row 31
-Warning 1263 Data truncated, out of range for column 'a' at row 32
-Warning 1263 Data truncated, out of range for column 'a' at row 33
-Warning 1263 Data truncated, out of range for column 'a' at row 34
-Warning 1263 Data truncated, out of range for column 'a' at row 35
-Warning 1263 Data truncated, out of range for column 'a' at row 36
-Warning 1263 Data truncated, out of range for column 'a' at row 37
-Warning 1263 Data truncated, out of range for column 'a' at row 38
-Warning 1263 Data truncated, out of range for column 'a' at row 39
-Warning 1263 Data truncated, out of range for column 'a' at row 40
-Warning 1263 Data truncated, out of range for column 'a' at row 41
-Warning 1263 Data truncated, out of range for column 'a' at row 42
-Warning 1263 Data truncated, out of range for column 'a' at row 43
-Warning 1263 Data truncated, out of range for column 'a' at row 44
-Warning 1263 Data truncated, out of range for column 'a' at row 45
-Warning 1263 Data truncated, out of range for column 'a' at row 46
-Warning 1263 Data truncated, out of range for column 'a' at row 47
-Warning 1263 Data truncated, out of range for column 'a' at row 48
-Warning 1263 Data truncated, out of range for column 'a' at row 49
-Warning 1263 Data truncated, out of range for column 'a' at row 50
-Warning 1263 Data truncated, out of range for column 'a' at row 51
-Warning 1263 Data truncated, out of range for column 'a' at row 52
-Warning 1263 Data truncated, out of range for column 'a' at row 53
-Warning 1263 Data truncated, out of range for column 'a' at row 54
-Warning 1263 Data truncated, out of range for column 'a' at row 55
-Warning 1263 Data truncated, out of range for column 'a' at row 56
-Warning 1263 Data truncated, out of range for column 'a' at row 57
-Warning 1263 Data truncated, out of range for column 'a' at row 58
-Warning 1263 Data truncated, out of range for column 'a' at row 59
-Warning 1263 Data truncated, out of range for column 'a' at row 60
select * from t1;
a
0001.000
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 6a5546200ce..0037fb9ea95 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -158,7 +158,7 @@ insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
('2','2','0',1,7);
-delete from t1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
+delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
select * from t1;
F1 F2 F3 cnt groupid
0 0 0 1 6
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index fcd06a6d8e7..6fccd2bc1a4 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -120,3 +120,45 @@ select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
1 3 2 0
3 6 3 0
drop table t1;
+set @a=_latin2'test';
+select charset(@a),collation(@a),coercibility(@a);
+charset(@a) collation(@a) coercibility(@a)
+latin2 latin2_general_ci 3
+select @a=_latin2'TEST';
+@a=_latin2'TEST'
+1
+select @a=_latin2'TEST' collate latin2_bin;
+@a=_latin2'TEST' collate latin2_bin
+0
+set @a=_latin2'test' collate latin2_general_ci;
+select charset(@a),collation(@a),coercibility(@a);
+charset(@a) collation(@a) coercibility(@a)
+latin2 latin2_general_ci 0
+select @a=_latin2'TEST';
+@a=_latin2'TEST'
+1
+select @a=_latin2'TEST' collate latin2_bin;
+ERROR HY000: Illegal mix of collations (latin2_general_ci,EXPLICIT) and (latin2_bin,EXPLICIT) for operation '='
+select charset(@a:=_latin2'test');
+charset(@a:=_latin2'test')
+latin2
+select collation(@a:=_latin2'test');
+collation(@a:=_latin2'test')
+latin2_general_ci
+select coercibility(@a:=_latin2'test');
+coercibility(@a:=_latin2'test')
+3
+select collation(@a:=_latin2'test' collate latin2_bin);
+collation(@a:=_latin2'test' collate latin2_bin)
+latin2_bin
+select coercibility(@a:=_latin2'test' collate latin2_bin);
+coercibility(@a:=_latin2'test' collate latin2_bin)
+0
+select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
+(@a:=_latin2'test' collate latin2_bin) = _latin2'TEST'
+0
+select charset(@a),collation(@a),coercibility(@a);
+charset(@a) collation(@a) coercibility(@a)
+latin2 latin2_bin 0
+select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
+ERROR HY000: Illegal mix of collations (latin2_bin,EXPLICIT) and (latin2_general_ci,EXPLICIT) for operation '='
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index ee40d0a48fa..5394c3e1e45 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -360,7 +360,7 @@ set sql_log_bin=1;
set sql_log_off=1;
set sql_log_update=1;
Warnings:
-Note 1299 The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored.
+Note 1302 The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored.
set sql_low_priority_updates=1;
set sql_max_join_size=200;
select @@sql_max_join_size,@@max_join_size;
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index 5c7c75bac00..b675d189d30 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -1,7 +1,4 @@
drop table if exists t1, t2;
-Warnings:
-Note 1051 Unknown table 't1'
-Note 1051 Unknown table 't2'
SET SQL_WARNINGS=1;
create table t1 (a int);
insert into t1 values (1);
@@ -128,10 +125,10 @@ Warning 1265 Using storage engine MyISAM for table 't1'
drop table t1;
create table t1 (id int) type=heap;
Warnings:
-Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
+Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
alter table t1 type=myisam;
Warnings:
-Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
+Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
drop table t1;
set table_type=MYISAM;
Warnings: