1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

5.5 merge

This commit is contained in:
Sergei Golubchik
2014-05-09 12:35:11 +02:00
1865 changed files with 98295 additions and 85893 deletions

View File

@ -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;

View File

@ -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),

View File

@ -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));

View File

@ -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),

View File

@ -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
#

View File

@ -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),

View File

@ -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),

View File

@ -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),

View File

@ -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));

View File

@ -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),

View File

@ -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));

View File

@ -13,6 +13,12 @@ a
2
3
4
SELECT * FROM t1;
a
1
2
3
4
DROP TABLE t1;
#
# End of 5.5 tests

View File

@ -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),

View File

@ -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),

View File

@ -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));

View File

@ -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 '',

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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%'

View File

@ -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%'

View File

@ -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;

View File

@ -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%'

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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.
# -----------------------------------------------------------------

View File

@ -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
#
#