summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2018-10-29 18:45:19 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2018-10-29 18:45:19 +0200
commit2ee9343c873ad31c2dd0d2175dec2ef3b48ca5ba (patch)
treeaa51c10a594658b3668ff850c8fa7ece175a2692 /mysql-test/t
parent8b92c642981e7b226e0d93b958cc470bb1e6fad0 (diff)
parent893ebb739e24637985892da1555f2e6f1a8ac5b6 (diff)
downloadmariadb-git-mariadb-galera-5.5.62.tar.gz
Merge tag 'mariadb-5.5.62' into 5.5-galeramariadb-galera-5.5.62
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/alter_table.test50
-rw-r--r--mysql-test/t/derived_opt.test38
-rw-r--r--mysql-test/t/func_isnull.test16
-rw-r--r--mysql-test/t/func_time.test53
-rw-r--r--mysql-test/t/grant.test21
-rw-r--r--mysql-test/t/join.test3
-rw-r--r--mysql-test/t/lowercase_fs_off.test10
-rw-r--r--mysql-test/t/sp-security.test19
-rw-r--r--mysql-test/t/sp.test21
-rw-r--r--mysql-test/t/type_float.test29
10 files changed, 258 insertions, 2 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index ee9616e233d..28dfbaa27ec 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1272,3 +1272,53 @@ ALTER COLUMN `consultant_id` DROP DEFAULT,
MODIFY COLUMN `consultant_id` BIGINT;
SHOW CREATE TABLE t1;
DROP TABLE t1;
+
+--echo #
+--echo # BUG#27788685: NO WARNING WHEN TRUNCATING A STRING WITH DATA LOSS
+--echo #
+
+SET GLOBAL max_allowed_packet=17825792;
+
+--connect(con1, localhost, root,,)
+CREATE TABLE t1 (t1_fld1 TEXT);
+CREATE TABLE t2 (t2_fld1 MEDIUMTEXT);
+CREATE TABLE t3 (t3_fld1 LONGTEXT);
+
+INSERT INTO t1 VALUES (REPEAT('a',300));
+INSERT INTO t2 VALUES (REPEAT('b',65680));
+INSERT INTO t3 VALUES (REPEAT('c',16777300));
+
+SELECT LENGTH(t1_fld1) FROM t1;
+SELECT LENGTH(t2_fld1) FROM t2;
+SELECT LENGTH(t3_fld1) FROM t3;
+
+--echo # With strict mode
+SET SQL_MODE='STRICT_ALL_TABLES';
+
+--error ER_DATA_TOO_LONG
+ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
+--error ER_DATA_TOO_LONG
+ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
+--error ER_DATA_TOO_LONG
+ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
+
+--echo # With non-strict mode
+SET SQL_MODE='';
+
+ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT;
+ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT;
+ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT;
+
+SELECT LENGTH(my_t1_fld1) FROM t1;
+SELECT LENGTH(my_t2_fld1) FROM t2;
+SELECT LENGTH(my_t3_fld1) FROM t3;
+
+# Cleanup
+--disconnect con1
+--source include/wait_until_disconnected.inc
+
+--connection default
+DROP TABLE t1, t2, t3;
+
+SET SQL_MODE=default;
+SET GLOBAL max_allowed_packet=default;
diff --git a/mysql-test/t/derived_opt.test b/mysql-test/t/derived_opt.test
index 7f19553e4e5..aab95f69f26 100644
--- a/mysql-test/t/derived_opt.test
+++ b/mysql-test/t/derived_opt.test
@@ -363,5 +363,43 @@ set join_cache_level=@tmp_jcl;
set optimizer_switch=@tmp_os;
drop table t1, t2;
+--echo #
+--echo # Bug mdev-17382: equi-join of derived table with join_cache_level=4
+--echo #
+
+CREATE TABLE t1 (
+ id int NOT NULL,
+ amount decimal DEFAULT NULL,
+PRIMARY KEY (id)
+);
+
+CREATE TABLE t2 (
+ id int NOT NULL,
+ name varchar(50) DEFAULT NULL,
+PRIMARY KEY (id)
+);
+
+INSERT INTO t1 VALUES
+(1, 10.0000), (2, 20.0000), (3, 30.0000), (4, 40.0000),
+(5, NULL), (6, NULL), (7, 70.0000), (8, 80.0000);
+
+INSERT INTO t2 VALUES
+(1,'A'), (2,'B'), (3,'C'), (4,'D'), (5, NULL), (6, NULL),
+(7,'E'), (8,'F'), (9,'G'), (10,'H'), (11, NULL), (12, NULL);
+
+set join_cache_level=4;
+
+EXPLAIN
+SELECT t2.id,t2.name,t.total_amt
+ FROM t2
+ LEFT JOIN
+ (SELECT id, sum(amount) total_amt FROM t1 GROUP BY id) AS t
+ ON t2.id=t.id
+ WHERE t2.id < 3;
+
+set join_cache_level=default;
+
+DROP TABLE t1,t2;
+
# The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch;
diff --git a/mysql-test/t/func_isnull.test b/mysql-test/t/func_isnull.test
index 4c59fa3cbe8..7d1a7e83a1a 100644
--- a/mysql-test/t/func_isnull.test
+++ b/mysql-test/t/func_isnull.test
@@ -83,6 +83,22 @@ SELECT * FROM t2 LEFT JOIN v1 ON t2.d1=v1.d1 WHERE v1.d1 IS NULL;
DROP VIEW v1;
DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-15475: Assertion `!table || (!table->read_set ||
+--echo # bitmap_is_set(table->read_set, field_index))'
+--echo # failed on EXPLAIN EXTENDED with constant table and view
+--echo #
+
+CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM;
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1);
+EXPLAIN EXTENDED SELECT ISNULL(pk) FROM v1;
+EXPLAIN EXTENDED SELECT IFNULL(pk,0) FROM v1;
+# Cleanup
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 8323bd30d2c..4497a4d9668 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1629,6 +1629,59 @@ DO TO_DAYS(SEC_TO_TIME(MAKEDATE('',RAND(~('')))));
SELECT TO_DAYS(SEC_TO_TIME(MAKEDATE(0,RAND(~0))));
SELECT SEC_TO_TIME(MAKEDATE(0,RAND(~0)));
+#
+# MDEV-16810 AddressSanitizer: stack-buffer-overflow in int10_to_str
+#
+SELECT PERIOD_DIFF(2018, AES_ENCRYPT('Rae Bareli', 'Rae Bareli'));
+
+
+--echo #
+--echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result
+--echo #
+
+--vertical_results
+SELECT
+ MAKETIME(1e10,0,0),
+ MAKETIME(-1e10,0,0),
+ MAKETIME(1e50,0,0),
+ MAKETIME(-1e50,0,0),
+ MAKETIME(COALESCE(1e50),0,0),
+ MAKETIME(COALESCE(-1e50),0,0);
+--horizontal_results
+
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES (1e30),(-1e30);
+SELECT MAKETIME(a,0,0) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result
+--echo #
+
+SELECT MAKETIME(900,0,0);
+SELECT MAKETIME(900,0,0.1);
+SELECT MAKETIME(900,0,0.11);
+SELECT MAKETIME(900,0,0.111);
+SELECT MAKETIME(900,0,0.1111);
+SELECT MAKETIME(900,0,0.11111);
+SELECT MAKETIME(900,0,0.111111);
+SELECT MAKETIME(900,0,0.1111111);
+SELECT MAKETIME(900,0,0.11111111);
+SELECT MAKETIME(900,0,0.111111111);
+SELECT MAKETIME(900,0,EXP(1));
+
+SELECT MAKETIME(-900,0,0);
+SELECT MAKETIME(-900,0,0.1);
+SELECT MAKETIME(-900,0,0.11);
+SELECT MAKETIME(-900,0,0.111);
+SELECT MAKETIME(-900,0,0.1111);
+SELECT MAKETIME(-900,0,0.11111);
+SELECT MAKETIME(-900,0,0.111111);
+SELECT MAKETIME(-900,0,0.1111111);
+SELECT MAKETIME(-900,0,0.11111111);
+SELECT MAKETIME(-900,0,0.111111111);
+SELECT MAKETIME(-900,0,EXP(1));
+
--echo #
--echo # End of 5.5 tests
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 5de3328944a..220cc0a248c 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -2244,5 +2244,26 @@ DROP USER foo@'127.0.0.1';
--echo # End of Bug#12766319
+#
+# Bug#27230925: HANDLE_FATAL_SIGNAL (SIG=11) IN SHOW_ROUTINE_GRANTS
+#
+create user foo@localhost;
+create database foodb;
+grant create routine on foodb.* to foo@localhost;
+connect con1,localhost,foo;
+create procedure fooproc() select 'i am fooproc';
+show grants;
+disconnect con1;
+connection default;
+rename table mysql.procs_priv to mysql.procs_priv1;
+error ER_NO_SUCH_TABLE;
+flush privileges;
+show grants for foo@localhost;
+rename table mysql.procs_priv1 to mysql.procs_priv;
+drop user foo@localhost;
+drop procedure fooproc;
+drop database foodb;
+
+
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index feafac57a7e..5a29fe72049 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -1185,12 +1185,13 @@ CREATE TABLE t (f INT);
#
# The following shouldn't fail as the table is now matching the using
#
---error ER_BAD_FIELD_ERROR
CALL p;
DROP TABLE t;
CREATE TABLE t (i INT);
--error ER_BAD_FIELD_ERROR
CALL p;
+--error ER_BAD_FIELD_ERROR
+CALL p;
DROP PROCEDURE p;
DROP TABLE t;
diff --git a/mysql-test/t/lowercase_fs_off.test b/mysql-test/t/lowercase_fs_off.test
index 1be0351f9bc..8729efde02c 100644
--- a/mysql-test/t/lowercase_fs_off.test
+++ b/mysql-test/t/lowercase_fs_off.test
@@ -102,3 +102,13 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME t1;
DROP TABLE t1;
+
+#
+# MDEV-13912 mysql_upgrade: case (in)sensitivity for stored procedures
+#
+create database TEST;
+create procedure TEST.pr() begin end;
+create procedure test.pr() begin end;
+--exec $MYSQL_UPGRADE --force 2>&1
+drop procedure test.pr;
+drop database TEST;
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
index ca4e6b04f13..3769bb3b4bf 100644
--- a/mysql-test/t/sp-security.test
+++ b/mysql-test/t/sp-security.test
@@ -995,7 +995,24 @@ disconnect con2;
DROP USER user2@localhost;
DROP DATABASE db1;
+#
+# Bug#27407480: AUTOMATIC_SP_PRIVILEGES REQUIRES NEED THE INSERT PRIVILEGES FOR MYSQL.USER TABLE
+#
+create user foo@local_ost;
+create user foo@`local\_ost` identified by 'nevermore';
+create database foodb;
+grant create routine on foodb.* to foo@local_ost;
+connect con1,localhost,foo;
+select user(), current_user();
+show grants;
+create procedure fooproc() select 'i am fooproc';
+show grants;
+disconnect con1;
+connection default;
+drop user foo@local_ost;
+drop user foo@`local\_ost`;
+drop procedure fooproc;
+drop database foodb;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 0e42bf3c831..cb93cd31442 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9353,4 +9353,25 @@ where 1=1;
drop function if exists f1;
drop table t1,t2;
+--echo #
+--echo # MDEV-16957: Server crashes in Field_iterator_natural_join::next
+--echo # upon 2nd execution of SP
+--echo #
+
+CREATE TABLE t1 (a INT, b VARCHAR(32));
+CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c);
+--error ER_BAD_FIELD_ERROR
+CALL sp;
+--error ER_BAD_FIELD_ERROR
+CALL sp;
+--error ER_BAD_FIELD_ERROR
+CALL sp;
+alter table t1 add column c int;
+CALL sp;
+
+# Cleanup
+DROP PROCEDURE sp;
+DROP TABLE t1;
+
+
--echo # End of 5.5 test
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index b33c51566a0..fa45b1041d8 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -331,3 +331,32 @@ eval select concat((truncate((-1.7976931348623157E+307),(0x1e))),
--echo #
select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo;
+
+
+--echo #
+--echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result
+--echo #
+
+SELECT LEFT('a',EXP(50));
+SELECT LEFT('a', COALESCE(1e30));
+
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES (1e30);
+SELECT LEFT('a',a), LEFT('a',1e30) FROM t1;
+DROP TABLE t1;
+
+PREPARE stmt FROM 'SELECT LEFT(111,?)';
+SET @a=1e30;
+EXECUTE stmt USING @a;
+DEALLOCATE PREPARE stmt;
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1));
+DROP TABLE t1;
+
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES (1e30),(0);
+SELECT LEFT('a', SUM(a)) FROM t1;
+SELECT LEFT('a', AVG(a)) FROM t1;
+DROP TABLE t1;