summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani <jani.k.tolonen@gmail.com>2019-04-24 18:09:36 +0300
committerJani <jani.k.tolonen@gmail.com>2019-04-24 18:09:36 +0300
commit6046bc222e9918bd2e1f08569958473f0bd279dc (patch)
tree29309d0a8d38d6e64d4f537848820a8c3ff4ef94
parent6d2cb4366440fc5cfcbb85eac74aa4b47de9f30e (diff)
parent765ae6e82165d1bc4cf6cc9f0d556d66a5e172d1 (diff)
downloadmariadb-git-bb-10.3-jani.tar.gz
Merge branch '10.3' of github.com:MariaDB/server into bb-10.3-janibb-10.3-jani
-rw-r--r--mysql-test/main/ctype_utf8.result68
-rw-r--r--mysql-test/main/ctype_utf8.test75
-rw-r--r--mysql-test/main/func_hybrid_type.result114
-rw-r--r--mysql-test/main/func_hybrid_type.test64
-rw-r--r--mysql-test/main/type_date.result25
-rw-r--r--mysql-test/main/type_date.test14
-rw-r--r--mysql-test/suite/compat/oracle/r/information_schema_parameters.result38
-rw-r--r--mysql-test/suite/compat/oracle/t/information_schema_parameters.test33
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_wait_no_slave.result8
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_wait_no_slave-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_wait_no_slave.test14
-rw-r--r--sql/semisync_master.cc27
-rw-r--r--sql/semisync_master.h7
-rw-r--r--sql/sql_lex.cc20
-rw-r--r--sql/sql_show.cc3
-rw-r--r--sql/sql_type.cc91
-rw-r--r--sql/sql_type.h2
17 files changed, 582 insertions, 22 deletions
diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result
index 9c2fcb84765..6a72f60a437 100644
--- a/mysql-test/main/ctype_utf8.result
+++ b/mysql-test/main/ctype_utf8.result
@@ -11300,5 +11300,73 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
+# MDEV-19239 ERROR 1300 (HY000): Invalid utf8 character string in 10.3.13-MariaDB
+#
+SET NAMES utf8;
+SELECT
+x.消息ID,
+x.消息TITLE,
+x.消息类型,
+x.发送时间,
+x.阅读时间,x.老师ID,
+IF(x.四天内最近一次登录时间='2100-01-01 00:00:00','',x.四天内最近一次登录时间) 四天内最近一次登录时间
+FROM (
+SELECT
+msg.*,
+CASE
+WHEN login.login_time BETWEEN msg.发送时间 AND DATE_ADD(msg.发送时间,INTERVAL 4 DAY)
+THEN login.login_time
+WHEN (login.login_time NOT BETWEEN msg.发送时间 AND DATE_ADD(msg.发送时间,INTERVAL 4 DAY)) AND login.login_time>0
+THEN '2100-01-01 00:00:00' ELSE ''
+ END 四天内最近一次登录时间
+FROM (
+SELECT
+me.id 消息ID,
+me.title 消息TITLE,
+CASE
+WHEN me.type=1
+THEN 'Interview Message'
+ WHEN me.type=2
+THEN 'Orientation Message'
+ WHEN me.type=3
+THEN 'Warning Message'
+ WHEN me.type=4
+THEN 'Fail Message'
+ WHEN me.type=5
+THEN 'FM Message'
+ WHEN me.type=6
+THEN 'Training Message'
+ WHEN me.type=7
+THEN 'TUrgent Message'
+ END 消息类型,
+FROM_UNIXTIME(me.sending_time) 发送时间,
+IF(tar.is_read=1,FROM_UNIXTIME(tar.read_time),'') 阅读时间,
+tar.tid 老师ID
+FROM ebk_message me
+LEFT JOIN ebk_message_target tar
+ON me.id=tar.msg_id
+WHERE
+FROM_UNIXTIME(me.sending_time,'%Y-%m-%d') BETWEEN 'start' AND 'end' AND me.status=1 AND tar.tid>0
+GROUP BY
+tar.tid,
+me.sending_time,me.id) msg
+LEFT JOIN (
+SELECT tid,FROM_UNIXTIME(login_time) login_time
+FROM ebk_teacher_login_log
+WHERE FROM_UNIXTIME(login_time,'%Y-%m-%d') BETWEEN 'start' AND DATE_ADD('end',INTERVAL 4 DAY)
+ORDER BY tid,FROM_UNIXTIME(login_time)) login
+ON
+msg.老师ID=login.tid
+ORDER BY msg.消息ID,msg.发送时间,msg.老师ID,login_time) x
+GROUP BY x.消息ID,x.发送时间,x.老师ID;
+ERROR 42S02: Table 'test.ebk_message' doesn't exist
+SET NAMES utf8;
+CREATE TABLE t1 (x INT);
+INSERT INTO t1 VALUES (1);
+SELECT x AS 5天内最近一次登录时间 FROM t1;
+5天内最近一次登录时间
+1
+DROP TABLE t1;
+#
# End of 10.3 tests
#
diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test
index 6f8657dacb5..ab26b69d765 100644
--- a/mysql-test/main/ctype_utf8.test
+++ b/mysql-test/main/ctype_utf8.test
@@ -2181,5 +2181,80 @@ SET sql_mode=DEFAULT;
--echo #
+--echo # MDEV-19239 ERROR 1300 (HY000): Invalid utf8 character string in 10.3.13-MariaDB
+--echo #
+
+#
+# Test that the following query does not fail on "Invalid utf8 character string"
+#
+
+SET NAMES utf8;
+--error ER_NO_SUCH_TABLE
+SELECT
+ x.消息ID,
+ x.消息TITLE,
+ x.消息类型,
+ x.发送时间,
+ x.阅读时间,x.老师ID,
+ IF(x.四天内最近一次登录时间='2100-01-01 00:00:00','',x.四天内最近一次登录时间) 四天内最近一次登录时间
+FROM (
+ SELECT
+ msg.*,
+ CASE
+ WHEN login.login_time BETWEEN msg.发送时间 AND DATE_ADD(msg.发送时间,INTERVAL 4 DAY)
+ THEN login.login_time
+ WHEN (login.login_time NOT BETWEEN msg.发送时间 AND DATE_ADD(msg.发送时间,INTERVAL 4 DAY)) AND login.login_time>0
+ THEN '2100-01-01 00:00:00' ELSE ''
+ END 四天内最近一次登录时间
+ FROM (
+ SELECT
+ me.id 消息ID,
+ me.title 消息TITLE,
+ CASE
+ WHEN me.type=1
+ THEN 'Interview Message'
+ WHEN me.type=2
+ THEN 'Orientation Message'
+ WHEN me.type=3
+ THEN 'Warning Message'
+ WHEN me.type=4
+ THEN 'Fail Message'
+ WHEN me.type=5
+ THEN 'FM Message'
+ WHEN me.type=6
+ THEN 'Training Message'
+ WHEN me.type=7
+ THEN 'TUrgent Message'
+ END 消息类型,
+ FROM_UNIXTIME(me.sending_time) 发送时间,
+ IF(tar.is_read=1,FROM_UNIXTIME(tar.read_time),'') 阅读时间,
+ tar.tid 老师ID
+ FROM ebk_message me
+ LEFT JOIN ebk_message_target tar
+ ON me.id=tar.msg_id
+ WHERE
+ FROM_UNIXTIME(me.sending_time,'%Y-%m-%d') BETWEEN 'start' AND 'end' AND me.status=1 AND tar.tid>0
+ GROUP BY
+ tar.tid,
+ me.sending_time,me.id) msg
+ LEFT JOIN (
+ SELECT tid,FROM_UNIXTIME(login_time) login_time
+ FROM ebk_teacher_login_log
+ WHERE FROM_UNIXTIME(login_time,'%Y-%m-%d') BETWEEN 'start' AND DATE_ADD('end',INTERVAL 4 DAY)
+ ORDER BY tid,FROM_UNIXTIME(login_time)) login
+ ON
+ msg.老师ID=login.tid
+ ORDER BY msg.消息ID,msg.发送时间,msg.老师ID,login_time) x
+ GROUP BY x.消息ID,x.发送时间,x.老师ID;
+
+
+SET NAMES utf8;
+CREATE TABLE t1 (x INT);
+INSERT INTO t1 VALUES (1);
+SELECT x AS 5天内最近一次登录时间 FROM t1;
+DROP TABLE t1;
+
+
+--echo #
--echo # End of 10.3 tests
--echo #
diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result
index 04c428e745d..109f7a35038 100644
--- a/mysql-test/main/func_hybrid_type.result
+++ b/mysql-test/main/func_hybrid_type.result
@@ -3771,5 +3771,119 @@ t2 CREATE TABLE `t2` (
DROP TABLE t1, t2;
SET sql_mode=DEFAULT;
#
+# MDEV-17325 NULL-ability problems with LEAST() in combination with NO_ZERO_DATE and NO_ZERO_IN_DATE
+#
+SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE';
+SELECT
+LEAST('0000-00-00',DATE'2001-01-01') AS s1,
+LEAST('0001-00-01',DATE'2001-01-01') AS s2,
+LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3,
+LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4,
+LEAST(0,DATE'2001-01-01') AS i1,
+LEAST(20010001,DATE'2001-01-01') AS i2,
+LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3,
+LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def s1 10 10 0 Y 128 0 63
+def s2 10 10 0 Y 128 0 63
+def s3 12 26 0 Y 128 6 63
+def s4 12 26 0 Y 128 6 63
+def i1 10 10 0 Y 128 0 63
+def i2 10 10 0 Y 128 0 63
+def i3 12 19 0 Y 128 0 63
+def i4 12 19 0 Y 128 0 63
+s1 s2 s3 s4 i1 i2 i3 i4
+NULL NULL NULL NULL NULL NULL NULL NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0001-00-01'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
+Warning 1292 Incorrect datetime value: '0001-00-01 00:00:00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '2001-00-01'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
+Warning 1292 Incorrect datetime value: '2001-00-01 00:00:00'
+SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE';
+CREATE TABLE t1 AS SELECT
+LEAST('0000-00-00',DATE'2001-01-01') AS s1,
+LEAST('0001-00-01',DATE'2001-01-01') AS s2,
+LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3,
+LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4,
+LEAST(0,DATE'2001-01-01') AS i1,
+LEAST(20010001,DATE'2001-01-01') AS i2,
+LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3,
+LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4;
+Warnings:
+Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '0001-00-01'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
+Warning 1292 Incorrect datetime value: '0001-00-01 00:00:00'
+Warning 1292 Incorrect datetime value: '0000-00-00'
+Warning 1292 Incorrect datetime value: '2001-00-01'
+Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
+Warning 1292 Incorrect datetime value: '2001-00-01 00:00:00'
+SELECT * FROM t1;
+s1 s2 s3 s4 i1 i2 i3 i4
+NULL NULL NULL NULL NULL NULL NULL NULL
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `s1` date DEFAULT NULL,
+ `s2` date DEFAULT NULL,
+ `s3` datetime(6) DEFAULT NULL,
+ `s4` datetime(6) DEFAULT NULL,
+ `i1` date DEFAULT NULL,
+ `i2` date DEFAULT NULL,
+ `i3` datetime DEFAULT NULL,
+ `i4` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1;
+SELECT * FROM t1;
+c1
+2001-01-01 00:00:00
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` datetime NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET old_mode=ZERO_DATE_TIME_CAST;
+CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1;
+Warnings:
+Warning 1292 Incorrect datetime value: '0000-00-00 10:20:30'
+SELECT * FROM t1;
+c1
+NULL
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET old_mode=DEFAULT;
+SET timestamp=DEFAULT;
+SET sql_mode=DEFAULT;
+SET sql_mode='';
+SELECT LEAST(999,TIME'10:20:30') AS c1;
+c1
+NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '999'
+CREATE TABLE t1 AS SELECT LEAST(999,TIME'10:20:30') AS c1;
+Warnings:
+Warning 1292 Incorrect datetime value: '999'
+SELECT * FROM t1;
+c1
+NULL
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` time DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+#
# End of 10.3 tests
#
diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test
index f754d660140..223ae4b2166 100644
--- a/mysql-test/main/func_hybrid_type.test
+++ b/mysql-test/main/func_hybrid_type.test
@@ -628,6 +628,68 @@ SET sql_mode=DEFAULT;
--echo #
---echo # End of 10.3 tests
+--echo # MDEV-17325 NULL-ability problems with LEAST() in combination with NO_ZERO_DATE and NO_ZERO_IN_DATE
--echo #
+SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE';
+
+--disable_ps_protocol
+--enable_metadata
+SELECT
+ LEAST('0000-00-00',DATE'2001-01-01') AS s1,
+ LEAST('0001-00-01',DATE'2001-01-01') AS s2,
+ LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3,
+ LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4,
+ LEAST(0,DATE'2001-01-01') AS i1,
+ LEAST(20010001,DATE'2001-01-01') AS i2,
+ LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3,
+ LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4;
+--disable_metadata
+--enable_ps_protocol
+
+SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE';
+CREATE TABLE t1 AS SELECT
+ LEAST('0000-00-00',DATE'2001-01-01') AS s1,
+ LEAST('0001-00-01',DATE'2001-01-01') AS s2,
+ LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3,
+ LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4,
+ LEAST(0,DATE'2001-01-01') AS i1,
+ LEAST(20010001,DATE'2001-01-01') AS i2,
+ LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3,
+ LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+
+# A TIME always converts to a non-NULL DATETIME with the new CAST style
+# Expect a NOT NULL column
+CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+# A TIME can convert to a NULL DATETIME with old CAST style
+# Expect a NULL-able column
+SET old_mode=ZERO_DATE_TIME_CAST;
+CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+SET old_mode=DEFAULT;
+SET timestamp=DEFAULT;
+
+SET sql_mode=DEFAULT;
+
+SET sql_mode='';
+SELECT LEAST(999,TIME'10:20:30') AS c1;
+CREATE TABLE t1 AS SELECT LEAST(999,TIME'10:20:30') AS c1;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/main/type_date.result b/mysql-test/main/type_date.result
index e87cd836317..4b5a0ad63a0 100644
--- a/mysql-test/main/type_date.result
+++ b/mysql-test/main/type_date.result
@@ -863,6 +863,31 @@ d COUNT(*)
NULL 2
DROP TABLE t1;
#
+# MDEV-17299 Assertion `maybe_null' failed in make_sortkey
+#
+CREATE TABLE t1 (pk int NOT NULL, d1 date, d2 date NOT NULL);
+INSERT INTO t1 values (1,'2018-06-22','2018-06-22'),(2,'2018-07-11','2018-07-11');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT group_concat(d1/(CASE 'b' WHEN 'j' THEN 'c' END))
+FROM v1 GROUP BY greatest(pk, 0, d2);
+group_concat(d1/(CASE 'b' WHEN 'j' THEN 'c' END))
+NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
+Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 1
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
+Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 2
+CREATE TABLE t2 AS SELECT greatest(pk, 0, d2) AS c1 FROM t1 LIMIT 0;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP VIEW v1;
+DROP TABLE t1;
+#
# End of 10.1 tests
#
#
diff --git a/mysql-test/main/type_date.test b/mysql-test/main/type_date.test
index 8d29a54a26c..befee57183d 100644
--- a/mysql-test/main/type_date.test
+++ b/mysql-test/main/type_date.test
@@ -591,6 +591,20 @@ INSERT INTO t1 VALUES ('1985-05-13'),('1989-12-24');
SELECT d, COUNT(*) FROM t1 GROUP BY d WITH ROLLUP HAVING CASE d WHEN '2017-05-25' THEN 0 ELSE 1 END;
DROP TABLE t1;
+--echo #
+--echo # MDEV-17299 Assertion `maybe_null' failed in make_sortkey
+--echo #
+
+CREATE TABLE t1 (pk int NOT NULL, d1 date, d2 date NOT NULL);
+INSERT INTO t1 values (1,'2018-06-22','2018-06-22'),(2,'2018-07-11','2018-07-11');
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT group_concat(d1/(CASE 'b' WHEN 'j' THEN 'c' END))
+ FROM v1 GROUP BY greatest(pk, 0, d2);
+CREATE TABLE t2 AS SELECT greatest(pk, 0, d2) AS c1 FROM t1 LIMIT 0;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP VIEW v1;
+DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
diff --git a/mysql-test/suite/compat/oracle/r/information_schema_parameters.result b/mysql-test/suite/compat/oracle/r/information_schema_parameters.result
index e1ed53c39de..f7e9bfcafb9 100644
--- a/mysql-test/suite/compat/oracle/r/information_schema_parameters.result
+++ b/mysql-test/suite/compat/oracle/r/information_schema_parameters.result
@@ -814,3 +814,41 @@ DTD_IDENTIFIER ROW
ROUTINE_TYPE FUNCTION
-------- --------
DROP FUNCTION f1;
+#
+# MDEV 18092 Query with the table I_S.PARAMETERS stop working
+# after a package is created
+#
+SET sql_mode=ORACLE;
+CREATE DATABASE db1_mdev18092;
+USE db1_mdev18092;
+CREATE PROCEDURE p1(a INT)
+AS BEGIN
+NULL;
+END;
+$$
+CREATE OR REPLACE PACKAGE employee_tools AS
+FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);
+PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));
+PROCEDURE raiseSalaryStd(eid INT);
+PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));
+END;
+$$
+SELECT *, '---------------' FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_SCHEMA='db1_mdev18092';
+SPECIFIC_CATALOG def
+SPECIFIC_SCHEMA db1_mdev18092
+SPECIFIC_NAME p1
+ORDINAL_POSITION 1
+PARAMETER_MODE IN
+PARAMETER_NAME a
+DATA_TYPE int
+CHARACTER_MAXIMUM_LENGTH NULL
+CHARACTER_OCTET_LENGTH NULL
+NUMERIC_PRECISION 10
+NUMERIC_SCALE 0
+DATETIME_PRECISION NULL
+CHARACTER_SET_NAME NULL
+COLLATION_NAME NULL
+DTD_IDENTIFIER int(11)
+ROUTINE_TYPE PROCEDURE
+--------------- ---------------
+DROP DATABASE db1_mdev18092;
diff --git a/mysql-test/suite/compat/oracle/t/information_schema_parameters.test b/mysql-test/suite/compat/oracle/t/information_schema_parameters.test
index af241661939..c13a59103dd 100644
--- a/mysql-test/suite/compat/oracle/t/information_schema_parameters.test
+++ b/mysql-test/suite/compat/oracle/t/information_schema_parameters.test
@@ -92,3 +92,36 @@ SET sql_mode=ORACLE;
SELECT *, '--------' FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME='f1';
--horizontal_results
DROP FUNCTION f1;
+
+--echo #
+--echo # MDEV 18092 Query with the table I_S.PARAMETERS stop working
+--echo # after a package is created
+--echo #
+
+SET sql_mode=ORACLE;
+
+CREATE DATABASE db1_mdev18092;
+USE db1_mdev18092;
+
+DELIMITER $$;
+
+CREATE PROCEDURE p1(a INT)
+AS BEGIN
+ NULL;
+END;
+$$
+
+CREATE OR REPLACE PACKAGE employee_tools AS
+ FUNCTION getSalary(eid INT) RETURN DECIMAL(10,2);
+ PROCEDURE raiseSalary(eid INT, amount DECIMAL(10,2));
+ PROCEDURE raiseSalaryStd(eid INT);
+ PROCEDURE hire(ename TEXT, esalary DECIMAL(10,2));
+END;
+$$
+DELIMITER ;$$
+
+--vertical_results
+SELECT *, '---------------' FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_SCHEMA='db1_mdev18092';
+--horizontal_results
+
+DROP DATABASE db1_mdev18092;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_wait_no_slave.result b/mysql-test/suite/rpl/r/rpl_semi_sync_wait_no_slave.result
new file mode 100644
index 00000000000..4bf6af2714d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_wait_no_slave.result
@@ -0,0 +1,8 @@
+include/master-slave.inc
+[connection master]
+connection master;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 SET a=1;
+DROP TABLE t1;
+connection slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_wait_no_slave-master.opt b/mysql-test/suite/rpl/t/rpl_semi_sync_wait_no_slave-master.opt
new file mode 100644
index 00000000000..d84ebab5d56
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_wait_no_slave-master.opt
@@ -0,0 +1 @@
+--rpl_semi_sync_master_enabled=0 --rpl_semi_sync_master_wait_no_slave=0
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_wait_no_slave.test b/mysql-test/suite/rpl/t/rpl_semi_sync_wait_no_slave.test
new file mode 100644
index 00000000000..fecd0e25cb2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_wait_no_slave.test
@@ -0,0 +1,14 @@
+# The test verifies master crash of MDEV-18096 when the server starts with
+# rpl_semi_sync_master_enabled = OFF rpl_semi_sync_master_wait_no_slave = OFF
+
+--source include/master-slave.inc
+--source include/have_binlog_format_mixed.inc
+
+--connection master
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 SET a=1;
+DROP TABLE t1;
+
+--sync_slave_with_master
+
+--source include/rpl_end.inc
diff --git a/sql/semisync_master.cc b/sql/semisync_master.cc
index 8a82fd9085c..4e37e3af58d 100644
--- a/sql/semisync_master.cc
+++ b/sql/semisync_master.cc
@@ -228,7 +228,7 @@ bool Active_tranx::is_tranx_end_pos(const char *log_file_name,
DBUG_RETURN(entry != NULL);
}
-int Active_tranx::clear_active_tranx_nodes(const char *log_file_name,
+void Active_tranx::clear_active_tranx_nodes(const char *log_file_name,
my_off_t log_file_pos)
{
Tranx_node *new_front;
@@ -307,7 +307,7 @@ int Active_tranx::clear_active_tranx_nodes(const char *log_file_name,
m_trx_front->log_name, (ulong)m_trx_front->log_pos));
}
- DBUG_RETURN(0);
+ DBUG_VOID_RETURN;
}
@@ -371,20 +371,21 @@ int Repl_semi_sync_master::init_object()
{
result = enable_master();
if (!result)
+ {
result= ack_receiver.start(); /* Start the ACK thread. */
+ /*
+ If rpl_semi_sync_master_wait_no_slave is disabled, let's temporarily
+ switch off semisync to avoid hang if there's none active slave.
+ */
+ if (!rpl_semi_sync_master_wait_no_slave)
+ switch_off();
+ }
}
else
{
result = disable_master();
}
- /*
- If rpl_semi_sync_master_wait_no_slave is disabled, let's temporarily
- switch off semisync to avoid hang if there's none active slave.
- */
- if (!rpl_semi_sync_master_wait_no_slave)
- switch_off();
-
return result;
}
@@ -961,17 +962,15 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name,
* the current sending event catches up with last wait position. If it
* does match, semi-sync will be switched on again.
*/
-int Repl_semi_sync_master::switch_off()
+void Repl_semi_sync_master::switch_off()
{
- int result;
-
DBUG_ENTER("Repl_semi_sync_master::switch_off");
m_state = false;
/* Clear the active transaction list. */
assert(m_active_tranxs != NULL);
- result = m_active_tranxs->clear_active_tranx_nodes(NULL, 0);
+ m_active_tranxs->clear_active_tranx_nodes(NULL, 0);
rpl_semi_sync_master_off_times++;
m_wait_file_name_inited = false;
@@ -979,7 +978,7 @@ int Repl_semi_sync_master::switch_off()
sql_print_information("Semi-sync replication switched OFF.");
cond_broadcast(); /* wake up all waiting threads */
- DBUG_RETURN(result);
+ DBUG_VOID_RETURN;
}
int Repl_semi_sync_master::try_switch_on(int server_id,
diff --git a/sql/semisync_master.h b/sql/semisync_master.h
index 3b05d9e0348..de5e3240802 100644
--- a/sql/semisync_master.h
+++ b/sql/semisync_master.h
@@ -343,11 +343,8 @@ public:
* position.
* If log_file_name is NULL, everything will be cleared: the sorted
* list and the hash table will be reset to empty.
- *
- * Return:
- * 0: success; non-zero: error
*/
- int clear_active_tranx_nodes(const char *log_file_name,
+ void clear_active_tranx_nodes(const char *log_file_name,
my_off_t log_file_pos);
/* Given a position, check to see whether the position is an active
@@ -449,7 +446,7 @@ class Repl_semi_sync_master
}
/* Switch semi-sync off because of timeout in transaction waiting. */
- int switch_off();
+ void switch_off();
/* Switch semi-sync on when slaves catch up. */
int try_switch_on(int server_id,
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index c52005e7683..b5ff060ecc6 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1587,9 +1587,27 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd)
return(FLOAT_NUM);
}
}
+ /*
+ We've found:
+ - A sequence of digits
+ - Followed by 'e' or 'E'
+ - Followed by some byte XX which is not a known mantissa start,
+ and it's known to be a valid identifier part.
+ XX can be either a 8bit identifier character, or a multi-byte head.
+ */
yyUnget();
+ return scan_ident_start(thd, &yylval->ident_cli);
}
- // fall through
+ /*
+ We've found:
+ - A sequence of digits
+ - Followed by some character XX, which is neither 'e' nor 'E',
+ and it's known to be a valid identifier part.
+ XX can be a 8bit identifier character, or a multi-byte head.
+ */
+ yyUnget();
+ return scan_ident_start(thd, &yylval->ident_cli);
+
case MY_LEX_IDENT_START: // We come here after '.'
return scan_ident_start(thd, &yylval->ident_cli);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index d9985406323..3f40384ab72 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -6268,7 +6268,8 @@ bool store_schema_params(THD *thd, TABLE *table, TABLE *proc_table,
sph= Sp_handler::handler_mysql_proc((stored_procedure_type)
proc_table->field[MYSQL_PROC_MYSQL_TYPE]->
val_int());
- if (!sph)
+ if (!sph || sph->type() == TYPE_ENUM_PACKAGE ||
+ sph->type() == TYPE_ENUM_PACKAGE_BODY)
DBUG_RETURN(0);
if (!full_access)
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index 22eebaf6a38..c2c853efa23 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -2933,6 +2933,97 @@ bool Type_handler::
}
+bool Type_handler_temporal_result::
+ Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
+ Item **items, uint nitems) const
+{
+ bool rc= Type_handler::Item_func_min_max_fix_attributes(thd, func,
+ items, nitems);
+ if (rc || func->maybe_null)
+ return rc;
+ /*
+ LEAST/GREATES(non-temporal, temporal) can return NULL.
+ CAST functions Item_{time|datetime|date}_typecast always set maybe_full
+ to true. Here we try to detect nullability more thoroughly.
+ Perhaps CAST functions should also reuse this idea eventually.
+ */
+ const Type_handler *hf= func->type_handler();
+ for (uint i= 0; i < nitems; i++)
+ {
+ /*
+ If items[i] does not need conversion to the current temporal data
+ type, then we trust items[i]->maybe_null, which was already ORred
+ to func->maybe_null in the argument loop in fix_fields().
+ If items[i] requires conversion to the current temporal data type,
+ then conversion can fail and return NULL even for NOT NULL items.
+ */
+ const Type_handler *ha= items[i]->type_handler();
+ if (hf == ha)
+ continue; // No conversion.
+ if (ha->cmp_type() != TIME_RESULT)
+ {
+ func->maybe_null= true; // Conversion from non-temporal is not safe
+ break;
+ }
+ timestamp_type tf= hf->mysql_timestamp_type();
+ timestamp_type ta= ha->mysql_timestamp_type();
+ if (tf == ta ||
+ (tf == MYSQL_TIMESTAMP_DATETIME && ta == MYSQL_TIMESTAMP_DATE))
+ {
+ /*
+ If handlers have the same mysql_timestamp_type(),
+ then conversion is NULL safe. Conversion from DATE to DATETIME
+ is also safe. This branch includes data type pairs:
+ Function return type Argument type Comment
+ -------------------- ------------- -------------
+ TIMESTAMP TIMESTAMP no conversion
+ TIMESTAMP DATETIME not possible
+ TIMESTAMP DATE not possible
+ DATETIME DATETIME no conversion
+ DATETIME TIMESTAMP safe conversion
+ DATETIME DATE safe conversion
+ DATE DATE no conversion
+ TIME TIME no conversion
+
+ Note, a function cannot return TIMESTAMP if it has non-TIMESTAMP
+ arguments (it would return DATETIME in such case).
+ */
+ DBUG_ASSERT(hf->field_type() != MYSQL_TYPE_TIMESTAMP || tf == ta);
+ continue;
+ }
+ /*
+ Here we have the following data type pairs that did not match
+ the condition above:
+
+ Function return type Argument type Comment
+ -------------------- ------------- -------
+ TIMESTAMP TIME Not possible
+ DATETIME TIME depends on OLD_MODE_ZERO_DATE_TIME_CAST
+ DATE TIMESTAMP Not possible
+ DATE DATETIME Not possible
+ DATE TIME Not possible
+ TIME TIMESTAMP Not possible
+ TIME DATETIME Not possible
+ TIME DATE Not possible
+
+ Most pairs are not possible, because the function data type
+ would be DATETIME (according to LEAST/GREATEST aggregation rules).
+ Conversion to DATETIME from TIME is not safe when
+ OLD_MODE_ZERO_DATE_TIME_CAST is set:
+ - negative TIME values cannot be converted to not-NULL DATETIME values
+ - TIME values can produce DATETIME values that do not pass
+ NO_ZERO_DATE and NO_ZERO_IN_DATE tests.
+ */
+ DBUG_ASSERT(hf->field_type() == MYSQL_TYPE_DATETIME);
+ if (!(thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST))
+ continue;
+ func->maybe_null= true;
+ break;
+ }
+ return rc;
+}
+
+
bool Type_handler_real_result::
Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
Item **items, uint nitems) const
diff --git a/sql/sql_type.h b/sql/sql_type.h
index 1ddcef2da61..21e0eb56338 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -2138,6 +2138,8 @@ public:
Item *source_expr, Item *source_const) const;
bool subquery_type_allows_materialization(const Item *inner,
const Item *outer) const;
+ bool Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
+ Item **items, uint nitems) const;
bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const;
bool Item_sum_sum_fix_length_and_dec(Item_sum_sum *) const;
bool Item_sum_avg_fix_length_and_dec(Item_sum_avg *) const;