summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2018-03-15 03:45:28 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2018-03-15 03:45:28 +0200
commit8152c52e1af608da5d288a4e6fc82e2d804e64cd (patch)
tree8ff56cdb8c9766b04b015f0c5c896a202122abb1
parent782fb1e016e0342074ca9938e412a14d20d6f793 (diff)
parent3d5dff6cae5cdefe376583f811c9af109ea08080 (diff)
downloadmariadb-git-8152c52e1af608da5d288a4e6fc82e2d804e64cd.tar.gz
Merge remote-tracking branch '10.0' into 10.1
-rw-r--r--debian/control4
-rw-r--r--mysql-test/r/func_time.result24
-rw-r--r--mysql-test/r/subselect_mat.result15
-rw-r--r--mysql-test/t/func_time.test16
-rw-r--r--mysql-test/t/subselect_mat.test13
-rw-r--r--sql/opt_subselect.cc4
-rw-r--r--sql/sql_time.cc2
7 files changed, 75 insertions, 3 deletions
diff --git a/debian/control b/debian/control
index 9507b0557f9..84fe9e07f88 100644
--- a/debian/control
+++ b/debian/control
@@ -27,8 +27,8 @@ Build-Depends: bison,
libjemalloc-dev (>= 3.0.0~) [linux-any]
Standards-Version: 3.8.2
Homepage: http://mariadb.org/
-Vcs-Git: https://github.com/MariaDB/server.git
Vcs-Browser: https://github.com/MariaDB/server/
+Vcs-Git: https://github.com/MariaDB/server.git
Package: libmariadbclient18
Architecture: any
@@ -450,4 +450,4 @@ Package: mariadb-backup-10.1
Section: database
Architecture: any
Depends: libarchive12 | libarchive13
-Description: Backup tool for MariaDB server \ No newline at end of file
+Description: Backup tool for MariaDB server
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 371dffdd3ae..2180ec2b83c 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -2904,6 +2904,30 @@ NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
#
+# MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime
+#
+CREATE TABLE t1 (i INT, d DATE);
+INSERT INTO t1 VALUES (1, '1970-01-01');
+SELECT MAX(NULLIF(i,1)) FROM t1 ORDER BY DATE_SUB(d,INTERVAL 17300000 HOUR);
+MAX(NULLIF(i,1))
+NULL
+Warnings:
+Warning 1441 Datetime function: datetime field overflow
+DROP TABLE t1;
+CREATE TABLE t1 (i INT, d DATE);
+INSERT INTO t1 VALUES (1, '1970-01-01');
+SELECT CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR)) FROM t1;
+CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR))
+NULL
+Warnings:
+Warning 1441 Datetime function: datetime field overflow
+DROP TABLE t1;
+SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
+CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR))
+NULL
+Warnings:
+Warning 1441 Datetime function: datetime field overflow
+#
# End of 10.0 tests
#
#
diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result
index 934aca92f9f..924317dbcd1 100644
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@ -2757,6 +2757,21 @@ a b sq
4 2 1
drop table t1, t2;
#
+# MDEV-15235: Assertion `length > 0' failed in create_ref_for_key
+#
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f CHAR(1));
+INSERT INTO t2 VALUES ('a'),('b');
+explain
+SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
+SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
+f
+DROP TABLE t1, t2;
+#
# MDEV-9489: Assertion `0' failed in Protocol::end_statement() on
# UNION ALL
#
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index bc553e6f049..38082213004 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1762,6 +1762,22 @@ SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND)
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND);
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND);
+--echo #
+--echo # MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime
+--echo #
+
+CREATE TABLE t1 (i INT, d DATE);
+INSERT INTO t1 VALUES (1, '1970-01-01');
+SELECT MAX(NULLIF(i,1)) FROM t1 ORDER BY DATE_SUB(d,INTERVAL 17300000 HOUR);
+DROP TABLE t1;
+
+CREATE TABLE t1 (i INT, d DATE);
+INSERT INTO t1 VALUES (1, '1970-01-01');
+SELECT CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR)) FROM t1;
+DROP TABLE t1;
+
+SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
+
--echo #
--echo # End of 10.0 tests
diff --git a/mysql-test/t/subselect_mat.test b/mysql-test/t/subselect_mat.test
index 9c7c9683d0b..bf5de741ea0 100644
--- a/mysql-test/t/subselect_mat.test
+++ b/mysql-test/t/subselect_mat.test
@@ -256,6 +256,19 @@ FROM t1;
drop table t1, t2;
--echo #
+--echo # MDEV-15235: Assertion `length > 0' failed in create_ref_for_key
+--echo #
+
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f CHAR(1));
+INSERT INTO t2 VALUES ('a'),('b');
+explain
+SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
+SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
+DROP TABLE t1, t2;
+
+--echo #
--echo # MDEV-9489: Assertion `0' failed in Protocol::end_statement() on
--echo # UNION ALL
--echo #
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index d7371fa7e3f..12ae3286159 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -875,8 +875,10 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs)
Make sure that create_tmp_table will not fail due to too long keys.
See MDEV-7122. This check is performed inside create_tmp_table also and
we must do it so that we know the table has keys created.
+ Make sure that the length of the key for the temp_table is atleast
+ greater than 0.
*/
- if (total_key_length > tmp_table_max_key_length() ||
+ if (!total_key_length || total_key_length > tmp_table_max_key_length() ||
elements > tmp_table_max_key_parts())
DBUG_RETURN(FALSE);
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 2e2c5932c2a..6323538f193 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -959,6 +959,8 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
ltime->day= 0;
return 0;
}
+ else if (ltime->neg)
+ goto invalid_date;
if (int_type != INTERVAL_DAY)
ltime->time_type= MYSQL_TIMESTAMP_DATETIME; // Return full date