diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-05-09 12:35:11 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-05-09 12:35:11 +0200 |
commit | d3e2e1243bb0dae95ce35b0380dd4f8f476b254d (patch) | |
tree | 8779ad6b2059f181770cc07e2437925d7d5d5d04 /mysql-test/r | |
parent | 229dad1f9b12f8e9f64b6a605bdf8e31c339d018 (diff) | |
parent | 124428a9e28e59f98b25d8ee07b57d264f63cbe4 (diff) | |
download | mariadb-git-d3e2e1243bb0dae95ce35b0380dd4f8f476b254d.tar.gz |
5.5 merge
Diffstat (limited to 'mysql-test/r')
33 files changed, 663 insertions, 3 deletions
diff --git a/mysql-test/r/alter_table_trans.result b/mysql-test/r/alter_table_trans.result index a2547708ada..eaae2039d4c 100644 --- a/mysql-test/r/alter_table_trans.result +++ b/mysql-test/r/alter_table_trans.result @@ -16,3 +16,11 @@ insert t1 values (repeat('3', 8193),3,1,1); ALTER TABLE t1 ADD PRIMARY KEY (col4(10)) , ADD UNIQUE KEY uidx (col3); ERROR 23000: Duplicate entry '1' for key 'uidx' DROP TABLE t1; +CREATE TABLE t1 (a INT) ENGINE = InnoDB; +INSERT INTO t1 VALUES (2); +ALTER TABLE t1 ADD PRIMARY KEY (a); +ALTER TABLE t1 DROP PRIMARY KEY; +INSERT INTO t1 VALUES (2); +ALTER TABLE t1 ADD PRIMARY KEY (a); +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +DROP TABLE t1; diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result index bff5b5a250e..48bc1dab3a7 100644 --- a/mysql-test/r/ctype_big5.result +++ b/mysql-test/r/ctype_big5.result @@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +big5_chinese_ci .wwwmysqlcom set names utf8; create table t1 ( name varchar(10), diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index 3dfcaf18120..550c47ccdaa 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -2886,6 +2886,23 @@ f1() 00:00:01 DROP FUNCTION f1; DROP TABLE t1; +# +# MDEV-5702 Incorrect results are returned with NULLIF() +# +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04'); +SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1; +d CAST(d AS CHAR) bad good +1999-11-11 1999-11-11 1999-11-11 1999-11-11 +2014-02-04 2014-02-04 2014-02-04 2014-02-04 +CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d` date DEFAULT NULL, + `bad` varbinary(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; SET NAMES latin1; SET sql_mode=''; CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result index cb2122020b2..063cec289ab 100644 --- a/mysql-test/r/ctype_cp1250_ch.result +++ b/mysql-test/r/ctype_cp1250_ch.result @@ -75,6 +75,15 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +cp1250_general_ci .wwwmysqlcom set names utf8; create table t1 ( name varchar(10), @@ -168,6 +177,15 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +cp1250_czech_cs .wwwmysqlcom set names utf8; create table t1 ( name varchar(10), diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 7030a77b6b2..f7952a18f58 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -3278,6 +3278,23 @@ f1() 00:00:01 DROP FUNCTION f1; DROP TABLE t1; +# +# MDEV-5702 Incorrect results are returned with NULLIF() +# +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04'); +SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1; +d CAST(d AS CHAR) bad good +1999-11-11 1999-11-11 1999-11-11 1999-11-11 +2014-02-04 2014-02-04 2014-02-04 2014-02-04 +CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d` date DEFAULT NULL, + `bad` varchar(10) CHARACTER SET cp1251 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; SET NAMES latin1; SET sql_mode=''; CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); @@ -3303,5 +3320,15 @@ SELECT COALESCE(IF(test1=1, NULL, 1), test2) FROM t1; COALESCE(IF(test1=1, NULL, 1), test2) DROP TABLE t1; # +# MDEV-5459 Illegal mix of collations for datetime +# +SET NAMES cp1251; +CREATE TABLE t1 (dt DATETIME); +INSERT INTO t1 VALUES ('2014-01-02 10:20:30'); +SELECT date(dt) FROM t1 WHERE (CASE WHEN 1 THEN date(dt) ELSE null END >= '2013-12-01 00:00:00'); +date(dt) +2014-01-02 +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_euckr.result b/mysql-test/r/ctype_euckr.result index 92553aa4de6..dcb68cfe60b 100644 --- a/mysql-test/r/ctype_euckr.result +++ b/mysql-test/r/ctype_euckr.result @@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +euckr_korean_ci .wwwmysqlcom set names utf8; create table t1 ( name varchar(10), diff --git a/mysql-test/r/ctype_gb2312.result b/mysql-test/r/ctype_gb2312.result index af220466b9b..1ab177e72c7 100644 --- a/mysql-test/r/ctype_gb2312.result +++ b/mysql-test/r/ctype_gb2312.result @@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +gb2312_chinese_ci .wwwmysqlcom set names utf8; create table t1 ( name varchar(10), diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result index f4d0136a34f..fd4941f9146 100644 --- a/mysql-test/r/ctype_gbk.result +++ b/mysql-test/r/ctype_gbk.result @@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +gbk_chinese_ci .wwwmysqlcom set names utf8; create table t1 ( name varchar(10), diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index d21570fb05f..8beb60c368b 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -308,6 +308,108 @@ select 'a' regexp 'A' collate latin1_general_cs; select 'a' regexp 'A' collate latin1_bin; 'a' regexp 'A' collate latin1_bin 0 +SET @test_character_set= 'latin1'; +SET @test_collation= 'latin1_swedish_ci'; +SET @safe_character_set_server= @@character_set_server; +SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; +SET character_set_server= @test_character_set; +SET collation_server= @test_collation; +CREATE DATABASE d1; +USE d1; +CREATE TABLE t1 (c CHAR(10), KEY(c)); +SHOW FULL COLUMNS FROM t1; +Field Type Collation Null Key Default Extra Privileges Comment +c char(10) latin1_swedish_ci YES MUL NULL +INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa'); +SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%'; +want3results +aaa +aaaa +aaaaa +DROP TABLE t1; +CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2))); +SHOW FULL COLUMNS FROM t1; +Field Type Collation Null Key Default Extra Privileges Comment +c1 varchar(15) latin1_swedish_ci YES MUL NULL +INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab'); +SELECT c1 as want3results from t1 where c1 like 'l%'; +want3results +location +loberge +lotre +SELECT c1 as want3results from t1 where c1 like 'lo%'; +want3results +location +loberge +lotre +SELECT c1 as want1result from t1 where c1 like 'loc%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'loca%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locat%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locati%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locatio%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'location%'; +want1result +location +DROP TABLE t1; +create table t1 (a set('a') not null); +insert into t1 values (),(); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +select cast(a as char(1)) from t1; +cast(a as char(1)) + + +select a sounds like a from t1; +a sounds like a +1 +1 +select 1 from t1 order by cast(a as char(1)); +1 +1 +1 +drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +latin1_swedish_ci .wwwmysqlcom +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; +DROP DATABASE d1; +USE test; +SET character_set_server= @safe_character_set_server; +SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; SET collation_connection='latin1_swedish_ci'; create table t1 select repeat('a',4000) a; delete from t1; @@ -3460,6 +3562,23 @@ f1() 00:00:01 DROP FUNCTION f1; DROP TABLE t1; +# +# MDEV-5702 Incorrect results are returned with NULLIF() +# +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04'); +SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1; +d CAST(d AS CHAR) bad good +1999-11-11 1999-11-11 1999-11-11 1999-11-11 +2014-02-04 2014-02-04 2014-02-04 2014-02-04 +CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d` date DEFAULT NULL, + `bad` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; SET NAMES latin1; SET sql_mode=''; CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result index c14ad3e0db3..c947689ef81 100644 --- a/mysql-test/r/ctype_uca.result +++ b/mysql-test/r/ctype_uca.result @@ -5841,6 +5841,15 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +utf8_swedish_ci .wwwmysqlcom set names utf8; create table t1 ( name varchar(10), diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index e36f783196e..492c9877917 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -71,6 +71,15 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +ucs2_general_ci .wwwmysqlcom set names utf8; create table t1 ( name varchar(10), @@ -4460,6 +4469,23 @@ f1() 00:00:01 DROP FUNCTION f1; DROP TABLE t1; +# +# MDEV-5702 Incorrect results are returned with NULLIF() +# +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04'); +SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1; +d CAST(d AS CHAR) bad good +1999-11-11 1999-11-11 1999-11-11 1999-11-11 +2014-02-04 2014-02-04 2014-02-04 2014-02-04 +CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d` date DEFAULT NULL, + `bad` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; SET NAMES latin1; SET sql_mode=''; CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); diff --git a/mysql-test/r/ctype_ucs2_query_cache.result b/mysql-test/r/ctype_ucs2_query_cache.result index c5f1ef5918d..6f26bed02da 100644 --- a/mysql-test/r/ctype_ucs2_query_cache.result +++ b/mysql-test/r/ctype_ucs2_query_cache.result @@ -13,6 +13,12 @@ a 2 3 4 +SELECT * FROM t1; +a +1 +2 +3 +4 DROP TABLE t1; # # End of 5.5 tests diff --git a/mysql-test/r/ctype_utf16_uca.result b/mysql-test/r/ctype_utf16_uca.result index a59d3dc07ff..e3ba73a9047 100644 --- a/mysql-test/r/ctype_utf16_uca.result +++ b/mysql-test/r/ctype_utf16_uca.result @@ -2826,6 +2826,15 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +utf16_swedish_ci .wwwmysqlcom set names utf8; create table t1 ( name varchar(10), diff --git a/mysql-test/r/ctype_utf32_uca.result b/mysql-test/r/ctype_utf32_uca.result index b77283f1ddb..d2032d401df 100644 --- a/mysql-test/r/ctype_utf32_uca.result +++ b/mysql-test/r/ctype_utf32_uca.result @@ -2826,6 +2826,15 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +utf32_swedish_ci .wwwmysqlcom set names utf8; create table t1 ( name varchar(10), diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index b16d98a7a19..a8aa4595ab4 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -5337,6 +5337,23 @@ f1() 00:00:01 DROP FUNCTION f1; DROP TABLE t1; +# +# MDEV-5702 Incorrect results are returned with NULLIF() +# +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04'); +SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1; +d CAST(d AS CHAR) bad good +1999-11-11 1999-11-11 1999-11-11 1999-11-11 +2014-02-04 2014-02-04 2014-02-04 2014-02-04 +CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d` date DEFAULT NULL, + `bad` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; SET NAMES latin1; SET sql_mode=''; CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index e6abd44c267..43f77629014 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -699,6 +699,51 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t1; End of 5.1 tests +# +# Start of 5.5 tests +# +# +# MDEV-6146 Can't mix (latin1_swedish_ci,NUMERIC) and (utf8_unicode_ci,IMPLICIT) for MATCH +# +SET NAMES utf8; +CREATE TABLE t1 +( +txt text COLLATE utf8_unicode_ci NOT NULL, +uid int(11) NOT NULL, +id2 int(11) NOT NULL, +KEY uid (uid), +KEY id2 (id2) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO t1 VALUES ('txt1',1234,5678); +SELECT * FROM t1 WHERE MATCH (id2, uid, txt) AGAINST ('txt1' IN BOOLEAN MODE); +txt uid id2 +txt1 1234 5678 +SELECT * FROM t1 WHERE MATCH (id2, uid, txt) AGAINST ('1234' IN BOOLEAN MODE); +txt uid id2 +txt1 1234 5678 +SELECT * FROM t1 WHERE MATCH (id2, uid, txt) AGAINST ('5678' IN BOOLEAN MODE); +txt uid id2 +txt1 1234 5678 +DROP TABLE t1; +CREATE TABLE t1 ( +txt1 text COLLATE utf8_unicode_ci NOT NULL, +txt2 text COLLATE latin1_swedish_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO t1 VALUES ('nnn1 x1 y1 ööö1','mmm1 ùùù1'); +INSERT INTO t1 VALUES ('nnn2 x2 y2 ööö2','mmm2 ùùù2'); +INSERT INTO t1 VALUES ('nnn3 x3 y3 ööö3','mmm3 ùùù3'); +INSERT INTO t1 VALUES ('nnn4 x4 y4 ööö4','mmm4 ùùù4'); +INSERT INTO t1 VALUES ('nnn5 x5 y5 ööö5','mmm5 '); +SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ööö1' IN BOOLEAN MODE); +txt1 txt2 +nnn1 x1 y1 ööö1 mmm1 ùùù1 +SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ùùù2' IN BOOLEAN MODE); +txt1 txt2 +nnn2 x2 y2 ööö2 mmm2 ùùù2 +DROP TABLE t1; +# +# End of 5.5 tests +# CREATE TABLE t1 ( id int(11) auto_increment, title varchar(100) default '', diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index c9d7b6636c4..2f820dfc0a9 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -119,7 +119,7 @@ substring_index('aaaaaaaaa1','aaa',-3) aaaaaa1 select substring_index('aaaaaaaaa1','aaa',-4); substring_index('aaaaaaaaa1','aaa',-4) - +aaaaaaaaa1 select substring_index('the king of thethe hill','the',-2); substring_index('the king of thethe hill','the',-2) the hill @@ -2659,6 +2659,35 @@ NULL NULL 8 drop table t1; End of 5.1 tests +# +# Start of 5.3 tests +# +# +# Bug#11829861: SUBSTRING_INDEX() RESULTS IN MISSING CHARACTERS WHEN USED +# INSIDE LOWER() +# +SET @user_at_host = 'root@mytinyhost-PC.local'; +SELECT LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1)); +LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1)) +mytinyhost-pc.local +# End of test BUG#11829861 +# +# Bug#42404: SUBSTRING_INDEX() RESULTS ARE INCONSISTENT +# +CREATE TABLE t (i INT NOT NULL, c CHAR(255) NOT NULL); +INSERT INTO t VALUES (0,'.www.mysql.com'),(1,'.wwwmysqlcom'); +SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t WHERE i = 1; +i SUBSTRING_INDEX(c, '.', -2) +1 .wwwmysqlcom +SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t; +i SUBSTRING_INDEX(c, '.', -2) +0 mysql.com +1 .wwwmysqlcom +DROP TABLE t; +# End of test BUG#42404 +# +# End of 5.3 tests +# Start of 5.4 tests SELECT format(12345678901234567890.123, 3); format(12345678901234567890.123, 3) diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 9b86ccd264e..643849f36ed 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -2474,6 +2474,15 @@ v 2v,2v NULL 1c,2v,2v DROP TABLE t1,t2; # +# MDEV-6129: Server crashes during UNION with ORDER BY field IS NULL +# +SET sql_mode='ONLY_FULL_GROUP_BY'; +SELECT 1 AS test UNION SELECT 2 AS test ORDER BY test IS NULL ASC; +test +1 +2 +SET sql_mode=''; +# # Bug #58782 # Missing rows with SELECT .. WHERE .. IN subquery # with full GROUP BY and no aggr diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index 1f09ba6cef5..99cc5d484bd 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -638,6 +638,35 @@ set optimizer_switch=@save_optimizer_switch; drop table t1,t2,t3; End of 5.2 tests # +# Bug mdev-6116: an equality in the conjunction of HAVING +# and IN subquery in WHERE +# (The bug is caused by the same problem as bug mdev-5927) +# +CREATE TABLE t1 (f_key varchar(1), f_nokey varchar(1), INDEX(f_key)); +INSERT INTO t1 VALUES ('v','v'),('s','s'); +CREATE TABLE t2 (f_int int, f_key varchar(1), INDEX(f_key)); +INSERT INTO t2 VALUES +(4,'j'),(6,'v'),(3,'c'),(5,'m'),(3,'d'),(2,'d'),(2,'y'), +(9,'t'),(3,'d'),(8,'s'),(1,'r'),(8,'m'),(8,'b'),(5,'x'); +SELECT t2.f_int FROM t1 INNER JOIN t2 ON (t2.f_key = t1.f_nokey) +WHERE t1.f_nokey IN ( +SELECT t1.f_key FROM t1, t2 WHERE t1.f_key = t2.f_key +) HAVING t2.f_int >= 0 AND t2.f_int != 0; +f_int +6 +8 +DROP TABLE t1,t2; +# +# Bug mdev-5927: an equality in the conjunction of HAVING +# and an equality in WHERE +# +CREATE TABLE t1 (pk int PRIMARY KEY, f int NOT NULL, INDEX(f)); +INSERT INTO t1 VALUES (1,0), (2,8); +SELECT * FROM t1 WHERE f = 2 HAVING ( pk IN ( SELECT 9 ) AND f != 0 ); +pk f +DROP TABLE t1; +End of 5.3 tests +# # Bug mdev-5160: two-way join with HAVING over the second table # CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 7fa9620f0e6..f701e7fa085 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -794,6 +794,35 @@ SELECT * FROM t2; col_int_key pk_1 pk_2 col_int 1 7 11 4 DROP TABLE t1,t2; +# +# MDEV-6139: UPDATE w/ join against MRG_MyISAM table with read-only +# sub-table fails +# MDEV-6193: Problems with multi-table updates that JOIN against +# read-only table +# +CREATE TABLE t1 ( +id int(10) unsigned, +a int(11) +) ENGINE=MyISAM; +CREATE TABLE t3 ( +id int(10) unsigned, +b int(11) +) ENGINE=MyISAM; +CREATE TABLE t2 ( +id int(10) unsigned, +b int(11) +) ENGINE=MRG_MyISAM UNION=(t3); +FLUSH TABLES; +update t1 join t2 using (id) set t1.a=t2.b; +create view v2 as select * from t2; +update t1 join v2 using (id) set t1.a=0; +create view v1 as select * from t3; +update t1 join v1 using (id) set t1.a=0; +update t1 join INFORMATION_SCHEMA.CHARACTER_SETS on (id=MAXLEN) set t1.a=0; +create view v3 as select t2.id, t3.b from t2 join t3 using(id); +update t1 join v3 using (id) set t1.a=0; +drop view v1, v2, v3; +drop table t2, t3, t1; end of 5.5 tests # Bug mdev-5970 diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 9dedbd1d133..4b0b3faf629 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -5286,3 +5286,7 @@ drop table t1, t2; # # End of 5.1 tests # +Usage: mysqldump [OPTIONS] database [tables] +OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...] +OR mysqldump [OPTIONS] --all-databases [OPTIONS] +For more options, use mysqldump --help diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index e81eea6e887..5b0fbbcbe87 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -618,3 +618,28 @@ DROP TABLE t1, t2, t3; # # End of 5.1 tests # +# +# Bug#17075846 : unquoted file names for variable values are +# accepted but parsed incorrectly +# +SET default_storage_engine=a.myisam; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = .a.MyISAM; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = a.b.MyISAM; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = `a`.MyISAM; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +SET default_storage_engine = `a`.`MyISAM`; +ERROR 42000: Incorrect argument type to variable 'default_storage_engine' +set default_storage_engine = "a.MYISAM"; +ERROR 42000: Unknown storage engine 'a.MYISAM' +set default_storage_engine = 'a.MYISAM'; +ERROR 42000: Unknown storage engine 'a.MYISAM' +set default_storage_engine = `a.MYISAM`; +ERROR 42000: Unknown storage engine 'a.MYISAM' +CREATE TABLE t1 (s VARCHAR(100)); +CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW +SET default_storage_engine = NEW.INNODB; +ERROR 42S22: Unknown column 'INNODB' in 'NEW' +DROP TABLE t1; diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result index 54693eaee56..630f0141d18 100644 --- a/mysql-test/r/plugin.result +++ b/mysql-test/r/plugin.result @@ -42,16 +42,21 @@ SELECT * FROM t1; a set global example_ulong_var=500; set global example_enum_var= e1; +set session example_int_var= -1; show status like 'example%'; Variable_name Value -Example_func_example enum_var is 0, ulong_var is 500, double_var is 8.500000, really +Example_func_example enum_var is 0, ulong_var is 500, int_var is -1, double_var is 8.500000, really show variables like 'example%'; Variable_name Value example_double_thdvar 8.500000 example_double_var 8.500000 example_enum_var e1 +example_int_var -1 example_ulong_var 500 example_varopt_default 5 +select @@session.example_int_var; +@@session.example_int_var +-1 UNINSTALL SONAME 'ha_example'; Warnings: Warning 1620 Plugin is busy and will be uninstalled on shutdown diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 4cc3cd4a85f..c1c35e0e3ec 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -7007,3 +7007,11 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; +# +# MDEV-5991: crash in Item_field::used_tables +# +create table t1 (c int); +select exists(select 1 from t1 group by `c` in (select `c` from t1)); +exists(select 1 from t1 group by `c` in (select `c` from t1)) +0 +drop table t1; diff --git a/mysql-test/r/subselect_exists_to_in.result b/mysql-test/r/subselect_exists_to_in.result index e4577cf9b52..641cfc29e84 100644 --- a/mysql-test/r/subselect_exists_to_in.result +++ b/mysql-test/r/subselect_exists_to_in.result @@ -7015,6 +7015,14 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; +# +# MDEV-5991: crash in Item_field::used_tables +# +create table t1 (c int); +select exists(select 1 from t1 group by `c` in (select `c` from t1)); +exists(select 1 from t1 group by `c` in (select `c` from t1)) +0 +drop table t1; set optimizer_switch=default; select @@optimizer_switch like '%exists_to_in=on%'; @@optimizer_switch like '%exists_to_in=on%' diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index a1ad1558f31..d59f6f3524d 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -7004,6 +7004,14 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; +# +# MDEV-5991: crash in Item_field::used_tables +# +create table t1 (c int); +select exists(select 1 from t1 group by `c` in (select `c` from t1)); +exists(select 1 from t1 group by `c` in (select `c` from t1)) +0 +drop table t1; set optimizer_switch=default; select @@optimizer_switch like '%materialization=on%'; @@optimizer_switch like '%materialization=on%' diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index 28a72a52daa..df18343c6d6 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -7002,4 +7002,12 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; +# +# MDEV-5991: crash in Item_field::used_tables +# +create table t1 (c int); +select exists(select 1 from t1 group by `c` in (select `c` from t1)); +exists(select 1 from t1 group by `c` in (select `c` from t1)) +0 +drop table t1; set @optimizer_switch_for_subselect_test=null; diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index ea11c39ab65..e36994e0534 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -7013,6 +7013,14 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; +# +# MDEV-5991: crash in Item_field::used_tables +# +create table t1 (c int); +select exists(select 1 from t1 group by `c` in (select `c` from t1)); +exists(select 1 from t1 group by `c` in (select `c` from t1)) +0 +drop table t1; set optimizer_switch=default; select @@optimizer_switch like '%subquery_cache=on%'; @@optimizer_switch like '%subquery_cache=on%' diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index 8cf6e6f7d9f..69922a5fe5f 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -7002,5 +7002,13 @@ id select_type table type possible_keys key key_len ref rows Extra 2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index DROP TABLE t1,t2; +# +# MDEV-5991: crash in Item_field::used_tables +# +create table t1 (c int); +select exists(select 1 from t1 group by `c` in (select `c` from t1)); +exists(select 1 from t1 group by `c` in (select `c` from t1)) +0 +drop table t1; set @optimizer_switch_for_subselect_test=null; set @join_cache_level_for_subselect_test=NULL; diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index e23c8640dfc..398f7b83bc9 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -347,6 +347,50 @@ Warnings: Warning 1292 Incorrect datetime value: '0' Warning 1292 Incorrect datetime value: '0' Warning 1292 Incorrect datetime value: '0' +# +# MDEV-5041 Inserting a TIME with hour>24 into a DATETIME column produces a wrong value +# +SELECT CAST(TIME('-800:20:30') AS DATE); +CAST(TIME('-800:20:30') AS DATE) +2013-07-16 +SELECT CAST(TIME('800:20:30') AS DATE); +CAST(TIME('800:20:30') AS DATE) +2013-09-21 +SELECT CAST(TIME('33 08:20:30') AS DATE); +CAST(TIME('33 08:20:30') AS DATE) +2013-09-21 +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES (TIME('800:20:30')); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +INSERT INTO t1 VALUES (TIME('33 08:20:30')); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +SET SQL_MODE=NO_ZERO_IN_DATE; +INSERT INTO t1 VALUES (TIME('48:20:30')); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +SET SQL_MODE=DEFAULT; +SELECT * FROM t1; +a +2013-09-21 +2013-09-21 +2013-08-21 +DROP TABLE t1; +CREATE PROCEDURE test5041() +BEGIN +DECLARE t TIME; +DECLARE d DATE; +SET t= TIME('800:00:00'); +SET d= t; +SELECT d; +END;| +call test5041(); +d +2013-09-21 +Warnings: +Note 1265 Data truncated for column 'd' at row 1 +drop procedure test5041; SET @@timestamp=DEFAULT; # # End of 5.3 tests diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index c508bc310e1..5e5b37f480a 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -684,6 +684,44 @@ CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+ NULL Warnings: Warning 1292 Incorrect datetime value: '2022-00-00 00:00:00' +# +# MDEV-5041 Inserting a TIME with hour>24 into a DATETIME column produces a wrong value +# +SET @@timestamp=UNIX_TIMESTAMP('2013-08-19 20:30:00'); +SELECT CAST(TIME('-800:20:30') AS DATETIME); +CAST(TIME('-800:20:30') AS DATETIME) +2013-07-16 15:39:30 +SELECT CAST(TIME('800:20:30') AS DATETIME); +CAST(TIME('800:20:30') AS DATETIME) +2013-09-21 08:20:30 +SELECT CAST(TIME('33 08:20:30') AS DATETIME); +CAST(TIME('33 08:20:30') AS DATETIME) +2013-09-21 08:20:30 +CREATE TABLE t1 (a DATETIME); +INSERT INTO t1 VALUES (TIME('800:20:30')); +INSERT INTO t1 VALUES (TIME('33 08:20:30')); +SET SQL_MODE=NO_ZERO_IN_DATE; +INSERT INTO t1 VALUES (TIME('48:20:30')); +SET SQL_MODE=DEFAULT; +SELECT * FROM t1; +a +2013-09-21 08:20:30 +2013-09-21 08:20:30 +2013-08-21 00:20:30 +DROP TABLE t1; +CREATE PROCEDURE test5041() +BEGIN +DECLARE t TIME; +DECLARE dt DATETIME; +SET t= TIME('800:20:30'); +SET dt= t; +SELECT dt; +END;| +call test5041(); +dt +2013-09-21 08:20:30 +drop procedure test5041; +SET @@timestamp=DEFAULT; End of 5.3 tests # # Start of 5.5 tests diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index a382cb86869..1ea30658561 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -846,6 +846,24 @@ Warnings: Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them drop view v1; drop table t1; +create table t1 (a varchar(20)); +create view v1 as select a from t1; +alter table t1 change a aa int; +select * from v1; +ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +show table status; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL +v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +Warnings: +Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +drop view v1; +drop table t1; create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1; show create view v1; View Create View character_set_client collation_connection @@ -5016,6 +5034,24 @@ id test 1 0 drop view v1; drop table t1; +# +# MDEV-5981: name resolution issues with views and multi-update +# in ps-protocol +# +create table t1 (id1 int primary key, val1 varchar(20)); +insert into t1 values (1, 'test1'); +create table t2 (id2 int primary key, val2 varchar(20)); +insert into t2 values (1, 'test2'); +create algorithm=merge view v1 as select id1 as id1v1, val1 as val1v1 from t1; +create algorithm=merge view v2 as +select t2.id2 as id2v2, t2.val2 as val2v2 +from t2, v1 +where t2.id2 = v1.id1v1; +prepare stmt1 from "update v2 set val2v2 = 'test19' where 1 = id2v2"; +execute stmt1; +deallocate prepare stmt1; +drop view v1,v2; +drop table t1,t2; # ----------------------------------------------------------------- # -- End of 5.3 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 05c0db6e3cf..24b95f0e204 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -132,7 +132,7 @@ xb1 xc1 SELECT extractValue(@xml,'/a//@x[2]'); extractValue(@xml,'/a//@x[2]') xb2 xc2 -SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</c></b></a>'; +SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</b></c></a>'; SELECT extractValue(@xml,'//b[1]'); extractValue(@xml,'//b[1]') b1 c1b1 c2b1 @@ -1134,6 +1134,24 @@ Warnings: Warning 1525 Incorrect XML value: 'parse error at line 1 pos 11: STRING unexpected (ident or '/' wanted)' End of 5.1 tests # +# Start of 5.3 tests +# +# +# MDEV-5338 XML parser accepts malformed data +# +SELECT ExtractValue('<a>xxx</c>','/a/b'); +ExtractValue('<a>xxx</c>','/a/b') +NULL +Warnings: +Warning 1525 Incorrect XML value: 'parse error at line 1 pos 10: '</c>' unexpected ('</a>' wanted)' +SELECT ExtractValue('<a><b>xxx</c></a>','/a/b'); +ExtractValue('<a><b>xxx</c></a>','/a/b') +NULL +Warnings: +Warning 1525 Incorrect XML value: 'parse error at line 1 pos 13: '</c>' unexpected ('</b>' wanted)' +# +# End of 5.3 tests +# # Start of 5.5 tests # # |