summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-12-09 16:33:48 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-09 16:33:48 +0100
commit3e8155c637096da8fd019c42b78746be2bf89944 (patch)
tree7df7880c789de7c32fdd76e862170322afe6117c
parent106664f8e86d694a9898c3e564bb72290f221bd6 (diff)
parent03dabfa84d6bc9a8197c8d9fbe80f2a7f6a5b6ac (diff)
downloadmariadb-git-3e8155c637096da8fd019c42b78746be2bf89944.tar.gz
Merge branch '5.5' into 10.0
-rw-r--r--client/mysqltest.cc26
-rw-r--r--cmake/install_macros.cmake1
-rw-r--r--cmake/os/Windows.cmake2
-rw-r--r--cmake/readline.cmake1
-rw-r--r--configure.cmake1
-rw-r--r--mysql-test/r/ctype_utf8.result26
-rw-r--r--mysql-test/r/derived.result65
-rw-r--r--mysql-test/r/derived_view.result85
-rw-r--r--mysql-test/r/fulltext_charsets.result7
-rw-r--r--mysql-test/r/group_by.result14
-rw-r--r--mysql-test/r/parser.result9
-rw-r--r--mysql-test/r/sp.result39
-rw-r--r--mysql-test/r/subselect.result11
-rw-r--r--mysql-test/r/subselect_no_exists_to_in.result11
-rw-r--r--mysql-test/r/subselect_no_mat.result11
-rw-r--r--mysql-test/r/subselect_no_opts.result11
-rw-r--r--mysql-test/r/subselect_no_scache.result11
-rw-r--r--mysql-test/r/subselect_no_semijoin.result11
-rw-r--r--mysql-test/r/type_decimal.result5
-rw-r--r--mysql-test/suite/binlog/r/binlog_index.result6
-rw-r--r--mysql-test/suite/binlog/t/binlog_index.test6
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_errors.result4
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_errors.test4
-rw-r--r--mysql-test/suite/sys_vars/r/replicate_do_db_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/replicate_do_table_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/replicate_ignore_db_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/replicate_wild_do_table_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/replicate_wild_ignore_table_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_do_db_basic.test3
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_do_table_basic.test3
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test3
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test3
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test3
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test3
-rw-r--r--mysql-test/t/ctype_utf8.test14
-rw-r--r--mysql-test/t/derived.test47
-rw-r--r--mysql-test/t/derived_view.test54
-rw-r--r--mysql-test/t/fulltext_charsets.test10
-rw-r--r--mysql-test/t/group_by.test12
-rw-r--r--mysql-test/t/parser.test10
-rw-r--r--mysql-test/t/sp.test51
-rw-r--r--mysql-test/t/subselect.test13
-rw-r--r--mysql-test/t/type_decimal.test5
-rw-r--r--scripts/mysql_install_db.sh6
-rw-r--r--sql/item.cc74
-rw-r--r--sql/item.h2
-rw-r--r--sql/item_func.cc3
-rw-r--r--sql/item_subselect.cc22
-rw-r--r--sql/log.cc17
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/rpl_filter.cc3
-rw-r--r--sql/sql_derived.cc2
-rw-r--r--sql/sql_lex.cc22
-rw-r--r--sql/sql_table.cc2
-rw-r--r--storage/myisam/ft_boolean_search.c7
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_decimal.result2
-rw-r--r--strings/decimal.c2
-rw-r--r--win/packaging/extra.wxs.in17
-rw-r--r--win/packaging/heidisql.cmake2
-rw-r--r--win/packaging/heidisql.wxi.in14
61 files changed, 746 insertions, 82 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index dede6527d11..ed401b6e4a2 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -1729,11 +1729,11 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename)
while((len= my_read(fd, (uchar*)&buff,
sizeof(buff)-1, MYF(0))) > 0)
{
- char *p= buff, *start= buff;
- while (p < buff+len)
+ char *p= buff, *start= buff,*end=buff+len;
+ while (p < end)
{
/* Convert cr/lf to lf */
- if (*p == '\r' && *(p+1) && *(p+1)== '\n')
+ if (*p == '\r' && p+1 < end && *(p+1)== '\n')
{
/* Add fake newline instead of cr and output the line */
*p= '\n';
@@ -3391,16 +3391,32 @@ void do_exec(struct st_command *command)
ds_result= &ds_sorted;
}
+#ifdef _WIN32
+ /* Workaround for CRT bug, MDEV-9409 */
+ _setmode(fileno(res_file), O_BINARY);
+#endif
+
while (fgets(buf, sizeof(buf), res_file))
{
+ int len = (int)strlen(buf);
+#ifdef _WIN32
+ /* Strip '\r' off newlines. */
+ if (len > 1 && buf[len-2] == '\r' && buf[len-1] == '\n')
+ {
+ buf[len-2] = '\n';
+ buf[len-1] = 0;
+ len--;
+ }
+#endif
if (disable_result_log)
{
- buf[strlen(buf)-1]=0;
+ if (len)
+ buf[len-1] = 0;
DBUG_PRINT("exec_result",("%s", buf));
}
else
{
- replace_dynstr_append(ds_result, buf);
+ replace_dynstr_append_mem(ds_result, buf, len);
}
}
error= pclose(res_file);
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake
index 15e2dc4930b..22a525d7344 100644
--- a/cmake/install_macros.cmake
+++ b/cmake/install_macros.cmake
@@ -208,6 +208,7 @@ IF(WIN32)
FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool
PATHS "$ENV{ProgramFiles}/Microsoft SDKs/Windows/v7.0A/bin"
"$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86"
+ "$ENV{ProgramFiles}/Windows Kits/8.1/bin/x86"
)
IF(NOT SIGNTOOL_EXECUTABLE)
MESSAGE(FATAL_ERROR
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index 1ad7e5c288d..84276115723 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -116,7 +116,7 @@ IF(MSVC)
#TODO: update the code and remove the disabled warnings
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /we4099")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099")
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
# _WIN64 is defined by the compiler itself.
diff --git a/cmake/readline.cmake b/cmake/readline.cmake
index c72f8d0da5c..64e04ef8663 100644
--- a/cmake/readline.cmake
+++ b/cmake/readline.cmake
@@ -230,5 +230,6 @@ MACRO (MYSQL_CHECK_READLINE)
SET(CMAKE_REQUIRED_LIBRARIES)
SET(CMAKE_REQUIRED_INCLUDES)
ENDIF(NOT WIN32)
+ CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H)
ENDMACRO()
diff --git a/configure.cmake b/configure.cmake
index fed27862b86..1dba83ea235 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -228,7 +228,6 @@ CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H)
-CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H)
CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H)
CHECK_INCLUDE_FILES (termbits.h HAVE_TERMBITS_H)
CHECK_INCLUDE_FILES (termios.h HAVE_TERMIOS_H)
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index e5d6caf397b..b98f412e3f1 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -6147,6 +6147,32 @@ SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub;
len
131074
#
+# MDEV-10717 Assertion `!null_value' failed in virtual bool Item::send(Protocol*, String*)
+#
+CREATE TABLE t1 (i INT, KEY(i));
+INSERT INTO t1 VALUES (20081205),(20050327);
+SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1;
+HEX(i) HEX(CHAR(i USING utf8))
+131F197 0131
+1326A35 01326A35
+Warnings:
+Warning 1300 Invalid utf8 character string: 'F197'
+SET sql_mode='STRICT_ALL_TABLES';
+SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1;
+HEX(i) HEX(CHAR(i USING utf8))
+131F197 NULL
+1326A35 01326A35
+Warnings:
+Warning 1300 Invalid utf8 character string: 'F197'
+SELECT CHAR(i USING utf8) FROM t1;
+CHAR(i USING utf8)
+###
+###
+Warnings:
+### 1300 Invalid utf8 character string: 'F197'
+SET sql_mode=DEFAULT;
+DROP TABLE t1;
+#
# End of 5.5 tests
#
#
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 97ba35ed9cd..0b392305bbf 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -950,3 +950,68 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
DROP TABLES t1,t2;
set optimizer_switch=@save_derived_optimizer_switch;
+#
+# MDEV-10663: Use of Inline table columns in HAVING clause
+# throws 1463 Error
+#
+set @save_sql_mode = @@sql_mode;
+set sql_mode='ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
+CREATE TABLE `example1463` (
+`Customer` varchar(255) NOT NULL,
+`DeliveryStatus` varchar(255) NOT NULL,
+`OrderSize` int(11) NOT NULL
+);
+INSERT INTO example1463 VALUES ('Charlie', 'Success', 100);
+INSERT INTO example1463 VALUES ('David', 'Success', 110);
+INSERT INTO example1463 VALUES ('Charlie', 'Failed', 200);
+INSERT INTO example1463 VALUES ('David', 'Success', 100);
+INSERT INTO example1463 VALUES ('David', 'Unknown', 100);
+INSERT INTO example1463 VALUES ('Edward', 'Success', 150);
+INSERT INTO example1463 VALUES ('Edward', 'Pending', 150);
+SELECT Customer, Success, SUM(OrderSize)
+FROM (SELECT Customer,
+CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
+OrderSize
+FROM example1463) as subQ
+GROUP BY Success, Customer
+WITH ROLLUP;
+Customer Success SUM(OrderSize)
+Charlie No 200
+David No 100
+Edward No 150
+NULL No 450
+Charlie Yes 100
+David Yes 210
+Edward Yes 150
+NULL Yes 460
+NULL NULL 910
+SELECT Customer, Success, SUM(OrderSize)
+FROM (SELECT Customer,
+CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
+OrderSize
+FROM example1463) as subQ
+GROUP BY Success, Customer;
+Customer Success SUM(OrderSize)
+Charlie No 200
+David No 100
+Edward No 150
+Charlie Yes 100
+David Yes 210
+Edward Yes 150
+SELECT Customer, Success, SUM(OrderSize)
+FROM (SELECT Customer,
+CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
+OrderSize
+FROM example1463) as subQ
+GROUP BY Success, Customer
+HAVING Success IS NOT NULL;
+Customer Success SUM(OrderSize)
+Charlie No 200
+David No 100
+Edward No 150
+Charlie Yes 100
+David Yes 210
+Edward Yes 150
+DROP TABLE example1463;
+set sql_mode= @save_sql_mode;
+# end of 5.5
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index a3b1e37a403..4ee1a3849f5 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -2506,5 +2506,90 @@ DROP TABLE t1,t2;
#
# end of 5.3 tests
#
+#
+# Bug mdev-11161: The second execution of prepared statement
+# does not use generated key for materialized
+# derived table / view
+# (actually this is a 5.3 bug.)
+#
+create table t1 (
+mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+matintnum CHAR(6) NOT NULL,
+test MEDIUMINT UNSIGNED NULL
+);
+create table t2 (
+mat_id MEDIUMINT UNSIGNED NOT NULL,
+pla_id MEDIUMINT UNSIGNED NOT NULL
+);
+insert into t1 values
+(NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4),
+(NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8),
+(NULL, 'i', 9);
+insert into t2 values
+(1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104),
+(3, 101), (3, 102), (3, 105);
+explain
+SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id
+FROM t1 m2
+INNER JOIN
+(SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum
+FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id
+GROUP BY mp.pla_id) d
+ON d.matintnum=m2.matintnum;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY m2 ALL NULL NULL NULL NULL 9
+1 PRIMARY <derived2> ref key0 key0 7 test.m2.matintnum 2
+2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
+2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
+prepare stmt1 from
+"SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id
+ FROM t1 m2
+ INNER JOIN
+ (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum
+ FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id
+ GROUP BY mp.pla_id) d
+ ON d.matintnum=m2.matintnum";
+flush status;
+execute stmt1;
+pla_id mat_id
+102 1
+101 1
+100 1
+104 2
+103 2
+105 3
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 21
+Handler_read_last 0
+Handler_read_next 6
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 6
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 27
+flush status;
+execute stmt1;
+pla_id mat_id
+102 1
+101 1
+100 1
+104 2
+103 2
+105 3
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 21
+Handler_read_last 0
+Handler_read_next 6
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 6
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 27
+deallocate prepare stmt1;
+drop table t1,t2;
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
diff --git a/mysql-test/r/fulltext_charsets.result b/mysql-test/r/fulltext_charsets.result
new file mode 100644
index 00000000000..39ce02a3fce
--- /dev/null
+++ b/mysql-test/r/fulltext_charsets.result
@@ -0,0 +1,7 @@
+set names utf8mb4;
+create table t1 (a int, b text, fulltext (b)) charset=utf8mb4 collate=utf8mb4_unicode_ci;
+insert t1 values (1000, 'C͓̙̯͔̩ͅͅi̩̘̜̲a̯̲̬̳̜̖̤o͕͓̜͓̺̖̗,̠̬͚ ̺T͇̲h͈̱e ̬̜D̖o̦̖͔̗͖̩̘c̣̼t̝͉̫̮̗o͉̫̭r̙͎̗.͓̪̥');
+select a from t1 where match(b) against ('ciao' in boolean mode);
+a
+1000
+drop table t1;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 38abbfef261..7a105fa6172 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -2518,6 +2518,20 @@ MAX(i) c
7 foo
drop table t1,t2;
#
+# ONLY_FULL_GROUP_BY references
+#
+set @save_sql_mode = @@sql_mode;
+set sql_mode='ONLY_FULL_GROUP_BY';
+create table t1 (a int, b int);
+select a+b as x from t1 group by x having x > 1;
+x
+select a as x from t1 group by x having x > 1;
+x
+select a from t1 group by a having a > 1;
+a
+drop table t1;
+set sql_mode= @save_sql_mode;
+#
# Bug #58782
# Missing rows with SELECT .. WHERE .. IN subquery
# with full GROUP BY and no aggr
diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result
index 7e2593eb9c9..cca754da295 100644
--- a/mysql-test/r/parser.result
+++ b/mysql-test/r/parser.result
@@ -663,3 +663,12 @@ select 1<<!0, 1 << !0;
select 0<!0, 0 < ! 0;
0<!0 0 < ! 0
1 1
+#
+# MDEV-11171 Assertion `m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_append(const char*, const char*)
+#
+CREATE TABLE t1 (id INT);
+CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\' at line 1
+PREPARE stmt FROM 'CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\\';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\' at line 1
+DROP TABLE t1;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 45cd071e732..c059428be16 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -7859,6 +7859,45 @@ v1
6
DROP PROCEDURE p1;
DROP TABLE t1;
+#
+# MDEV-10713: signal 11 error on multi-table update - crash in
+# handler::increment_statistics or in make_select or assertion
+# failure pfs_thread == ((PFS_thread*) pthread_getspecific((THR_PFS)))
+#
+CREATE TABLE `t1` (
+`CLOSE_YN` varchar(10) COLLATE utf8_bin DEFAULT NULL
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
+CREATE TABLE `t2` (
+`ap_close_to` varchar(8) COLLATE utf8_bin DEFAULT NULL
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
+insert t1 values (1);
+CREATE FUNCTION `f1`(`P_DC_CD` VARBINARY(50), `P_SYS_DATE` DATETIME) RETURNS datetime
+DETERMINISTIC
+SQL SECURITY INVOKER
+BEGIN
+DECLARE V_SYS_DATE DATETIME;
+SELECT now() AS LOC_DATE INTO V_SYS_DATE ;
+RETURN v_sys_date ;
+END $$
+update t1 S
+JOIN
+(
+SELECT CASE
+WHEN DATE_FORMAT( f1('F01', NOW()) , '%Y%m%d') <= CLOSE_YMD
+THEN '99991231'
+ ELSE '' END ACCOUNT_APPLY_YYYYMMDD
+FROM (
+select case
+when 'AP'='AP'
+ then ap_close_to
+end AS CLOSE_YMD
+from t2
+) A
+) X
+SET S.CLOSE_YN = ''
+where 1=1;
+drop function if exists f1;
+drop table t1,t2;
# End of 5.5 test
#
# MDEV-7040: Crash in field_conv, memcpy_field_possible, part#2
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index a58d35708fe..30919592ba6 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -7102,6 +7102,17 @@ a
DROP TABLE t1;
SET SESSION big_tables=0;
#
+# MDEV-10776: Server crash on query
+#
+create table t1 (field1 int);
+insert into t1 values (1);
+select round((select 1 from t1 limit 1))
+from t1
+group by round((select 1 from t1 limit 1));
+round((select 1 from t1 limit 1))
+1
+drop table t1;
+#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result
index 8b2d12c50f6..dfcbec1c595 100644
--- a/mysql-test/r/subselect_no_exists_to_in.result
+++ b/mysql-test/r/subselect_no_exists_to_in.result
@@ -7102,6 +7102,17 @@ a
DROP TABLE t1;
SET SESSION big_tables=0;
#
+# MDEV-10776: Server crash on query
+#
+create table t1 (field1 int);
+insert into t1 values (1);
+select round((select 1 from t1 limit 1))
+from t1
+group by round((select 1 from t1 limit 1));
+round((select 1 from t1 limit 1))
+1
+drop table t1;
+#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index 6051a58c3be..02068584287 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -7095,6 +7095,17 @@ a
DROP TABLE t1;
SET SESSION big_tables=0;
#
+# MDEV-10776: Server crash on query
+#
+create table t1 (field1 int);
+insert into t1 values (1);
+select round((select 1 from t1 limit 1))
+from t1
+group by round((select 1 from t1 limit 1));
+round((select 1 from t1 limit 1))
+1
+drop table t1;
+#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 718cf8b6099..33a01c807f6 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -7093,6 +7093,17 @@ a
DROP TABLE t1;
SET SESSION big_tables=0;
#
+# MDEV-10776: Server crash on query
+#
+create table t1 (field1 int);
+insert into t1 values (1);
+select round((select 1 from t1 limit 1))
+from t1
+group by round((select 1 from t1 limit 1));
+round((select 1 from t1 limit 1))
+1
+drop table t1;
+#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index 2b84f569fc5..abd2799769d 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -7108,6 +7108,17 @@ a
DROP TABLE t1;
SET SESSION big_tables=0;
#
+# MDEV-10776: Server crash on query
+#
+create table t1 (field1 int);
+insert into t1 values (1);
+select round((select 1 from t1 limit 1))
+from t1
+group by round((select 1 from t1 limit 1));
+round((select 1 from t1 limit 1))
+1
+drop table t1;
+#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index a2841793f15..b59dcd14285 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -7093,6 +7093,17 @@ a
DROP TABLE t1;
SET SESSION big_tables=0;
#
+# MDEV-10776: Server crash on query
+#
+create table t1 (field1 int);
+insert into t1 values (1);
+select round((select 1 from t1 limit 1))
+from t1
+group by round((select 1 from t1 limit 1));
+round((select 1 from t1 limit 1))
+1
+drop table t1;
+#
# MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
# m_lock_type != 2' failed in handler::ha_index_read_map
#
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index cde8816dee4..7ff74c8270a 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -221,7 +221,6 @@ drop table t1;
create table t1 (a decimal(10,2) unsigned);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings:
-Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1");
Warnings:
@@ -280,7 +279,6 @@ drop table t1;
create table t1 (a decimal(10,2) zerofill);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings:
-Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1");
Warnings:
@@ -1012,6 +1010,9 @@ SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE
COLUMN_NAME DATA_TYPE COLUMN_TYPE
a decimal decimal(10,2)/*old*/
DROP TABLE t1dec102;
+select cast('-0.0' as decimal(5,1)) < 0;
+cast('-0.0' as decimal(5,1)) < 0
+0
#
# End of 5.5 tests
#
diff --git a/mysql-test/suite/binlog/r/binlog_index.result b/mysql-test/suite/binlog/r/binlog_index.result
index 8cdca861737..bb5d9ff74f1 100644
--- a/mysql-test/suite/binlog/r/binlog_index.result
+++ b/mysql-test/suite/binlog/r/binlog_index.result
@@ -1,9 +1,9 @@
call mtr.add_suppression('Attempting backtrace');
-call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.');
-call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file');
+call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to process registered files that would be purged.');
+call mtr.add_suppression('MYSQL_BIN_LOG::open failed to sync the index file');
call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.');
call mtr.add_suppression('Could not open .*');
-call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
+call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
flush tables;
RESET MASTER;
flush logs;
diff --git a/mysql-test/suite/binlog/t/binlog_index.test b/mysql-test/suite/binlog/t/binlog_index.test
index a264549ce17..09e817c0469 100644
--- a/mysql-test/suite/binlog/t/binlog_index.test
+++ b/mysql-test/suite/binlog/t/binlog_index.test
@@ -9,11 +9,11 @@ source include/have_debug.inc;
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
call mtr.add_suppression('Attempting backtrace');
-call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.');
-call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file');
+call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to process registered files that would be purged.');
+call mtr.add_suppression('MYSQL_BIN_LOG::open failed to sync the index file');
call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.');
call mtr.add_suppression('Could not open .*');
-call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
+call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
flush tables;
let $old=`select @@debug`;
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_errors.result b/mysql-test/suite/rpl/r/rpl_binlog_errors.result
index 6234e953cdd..db642f21950 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_errors.result
@@ -169,7 +169,7 @@ count(*)
SET SQL_LOG_BIN=1;
SET GLOBAL debug_dbug="-d,error_unique_log_filename";
###################### TEST #10
-call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file.");
+call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Could not open .*");
RESET MASTER;
SHOW WARNINGS;
@@ -226,7 +226,7 @@ include/rpl_reset.inc
call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*");
call mtr.add_suppression("Error writing file .*");
call mtr.add_suppression("Could not open .*");
-call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file.");
+call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Can't generate a unique log-filename .*");
###################### TEST #13
SET @old_debug=@@global.debug;
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors.test b/mysql-test/suite/rpl/t/rpl_binlog_errors.test
index 9e4a106a5b5..fb3b39fac9d 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_errors.test
@@ -256,7 +256,7 @@ SET GLOBAL debug_dbug="-d,error_unique_log_filename";
### while registering the index file and the binary log
### file or failure to write the rotate event.
-call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file.");
+call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Could not open .*");
RESET MASTER;
@@ -362,7 +362,7 @@ RESET MASTER;
call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*");
call mtr.add_suppression("Error writing file .*");
call mtr.add_suppression("Could not open .*");
-call mtr.add_suppression("MSYQL_BIN_LOG::open failed to sync the index file.");
+call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Can't generate a unique log-filename .*");
-- echo ###################### TEST #13
diff --git a/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result b/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result
index b964d3d14a1..a05b85a9bfd 100644
--- a/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result
+++ b/mysql-test/suite/sys_vars/r/replicate_do_db_basic.result
@@ -33,5 +33,9 @@ SET @@GLOBAL.replicate_do_db="";
SELECT @@GLOBAL.replicate_do_db;
@@GLOBAL.replicate_do_db
+SET @@GLOBAL.replicate_do_db=null;
+SELECT @@GLOBAL.replicate_do_db;
+@@GLOBAL.replicate_do_db
+
# Cleanup.
SET @@GLOBAL.replicate_do_db = @save_replicate_do_db;
diff --git a/mysql-test/suite/sys_vars/r/replicate_do_table_basic.result b/mysql-test/suite/sys_vars/r/replicate_do_table_basic.result
index fac237228ac..e67b1eeca01 100644
--- a/mysql-test/suite/sys_vars/r/replicate_do_table_basic.result
+++ b/mysql-test/suite/sys_vars/r/replicate_do_table_basic.result
@@ -40,5 +40,9 @@ SET @@GLOBAL.replicate_do_table="";
SELECT @@GLOBAL.replicate_do_table;
@@GLOBAL.replicate_do_table
+SET @@GLOBAL.replicate_do_table=null;
+SELECT @@GLOBAL.replicate_do_table;
+@@GLOBAL.replicate_do_table
+
# Cleanup.
SET @@GLOBAL.replicate_do_table = @save_replicate_do_table;
diff --git a/mysql-test/suite/sys_vars/r/replicate_ignore_db_basic.result b/mysql-test/suite/sys_vars/r/replicate_ignore_db_basic.result
index c4d7a37321e..c7ff697b34f 100644
--- a/mysql-test/suite/sys_vars/r/replicate_ignore_db_basic.result
+++ b/mysql-test/suite/sys_vars/r/replicate_ignore_db_basic.result
@@ -33,5 +33,9 @@ SET @@GLOBAL.replicate_ignore_db="";
SELECT @@GLOBAL.replicate_ignore_db;
@@GLOBAL.replicate_ignore_db
+SET @@GLOBAL.replicate_ignore_db=null;
+SELECT @@GLOBAL.replicate_ignore_db;
+@@GLOBAL.replicate_ignore_db
+
# Cleanup.
SET @@GLOBAL.replicate_ignore_db = @save_replicate_ignore_db;
diff --git a/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result b/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result
index bc463d07319..db97ce14c93 100644
--- a/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result
+++ b/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result
@@ -40,5 +40,9 @@ SET @@GLOBAL.replicate_ignore_table="";
SELECT @@GLOBAL.replicate_ignore_table;
@@GLOBAL.replicate_ignore_table
+SET @@GLOBAL.replicate_ignore_table=null;
+SELECT @@GLOBAL.replicate_ignore_table;
+@@GLOBAL.replicate_ignore_table
+
# Cleanup.
SET @@GLOBAL.replicate_ignore_table = @save_replicate_ignore_table;
diff --git a/mysql-test/suite/sys_vars/r/replicate_wild_do_table_basic.result b/mysql-test/suite/sys_vars/r/replicate_wild_do_table_basic.result
index 5647cc964fb..8c55103080f 100644
--- a/mysql-test/suite/sys_vars/r/replicate_wild_do_table_basic.result
+++ b/mysql-test/suite/sys_vars/r/replicate_wild_do_table_basic.result
@@ -40,5 +40,9 @@ SET @@GLOBAL.replicate_wild_do_table="";
SELECT @@GLOBAL.replicate_wild_do_table;
@@GLOBAL.replicate_wild_do_table
+SET @@GLOBAL.replicate_wild_do_table=null;
+SELECT @@GLOBAL.replicate_wild_do_table;
+@@GLOBAL.replicate_wild_do_table
+
# Cleanup.
SET @@GLOBAL.replicate_wild_do_table = @save_replicate_wild_do_table;
diff --git a/mysql-test/suite/sys_vars/r/replicate_wild_ignore_table_basic.result b/mysql-test/suite/sys_vars/r/replicate_wild_ignore_table_basic.result
index c6829b792a4..0f46ce38805 100644
--- a/mysql-test/suite/sys_vars/r/replicate_wild_ignore_table_basic.result
+++ b/mysql-test/suite/sys_vars/r/replicate_wild_ignore_table_basic.result
@@ -40,5 +40,9 @@ SET @@GLOBAL.replicate_wild_ignore_table="";
SELECT @@GLOBAL.replicate_wild_ignore_table;
@@GLOBAL.replicate_wild_ignore_table
+SET @@GLOBAL.replicate_wild_ignore_table=null;
+SELECT @@GLOBAL.replicate_wild_ignore_table;
+@@GLOBAL.replicate_wild_ignore_table
+
# Cleanup.
SET @@GLOBAL.replicate_wild_ignore_table = @save_replicate_wild_ignore_table;
diff --git a/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test b/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test
index ccf50b1d6ab..59d0176add2 100644
--- a/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test
+++ b/mysql-test/suite/sys_vars/t/replicate_do_db_basic.test
@@ -35,5 +35,8 @@ SELECT @@GLOBAL.replicate_do_db;
SET @@GLOBAL.replicate_do_db="";
SELECT @@GLOBAL.replicate_do_db;
+SET @@GLOBAL.replicate_do_db=null;
+SELECT @@GLOBAL.replicate_do_db;
+
--echo # Cleanup.
SET @@GLOBAL.replicate_do_db = @save_replicate_do_db;
diff --git a/mysql-test/suite/sys_vars/t/replicate_do_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_do_table_basic.test
index f3b1585613e..346bdf3b038 100644
--- a/mysql-test/suite/sys_vars/t/replicate_do_table_basic.test
+++ b/mysql-test/suite/sys_vars/t/replicate_do_table_basic.test
@@ -44,5 +44,8 @@ SELECT @@GLOBAL.replicate_do_table;
SET @@GLOBAL.replicate_do_table="";
SELECT @@GLOBAL.replicate_do_table;
+SET @@GLOBAL.replicate_do_table=null;
+SELECT @@GLOBAL.replicate_do_table;
+
--echo # Cleanup.
SET @@GLOBAL.replicate_do_table = @save_replicate_do_table;
diff --git a/mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test b/mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test
index 3a0bc88109a..376397d1635 100644
--- a/mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test
+++ b/mysql-test/suite/sys_vars/t/replicate_ignore_db_basic.test
@@ -35,5 +35,8 @@ SELECT @@GLOBAL.replicate_ignore_db;
SET @@GLOBAL.replicate_ignore_db="";
SELECT @@GLOBAL.replicate_ignore_db;
+SET @@GLOBAL.replicate_ignore_db=null;
+SELECT @@GLOBAL.replicate_ignore_db;
+
--echo # Cleanup.
SET @@GLOBAL.replicate_ignore_db = @save_replicate_ignore_db;
diff --git a/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test
index aebe90732d2..56cf7f17c7f 100644
--- a/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test
+++ b/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test
@@ -44,5 +44,8 @@ SELECT @@GLOBAL.replicate_ignore_table;
SET @@GLOBAL.replicate_ignore_table="";
SELECT @@GLOBAL.replicate_ignore_table;
+SET @@GLOBAL.replicate_ignore_table=null;
+SELECT @@GLOBAL.replicate_ignore_table;
+
--echo # Cleanup.
SET @@GLOBAL.replicate_ignore_table = @save_replicate_ignore_table;
diff --git a/mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test
index b96a62f8dd1..832d3397f89 100644
--- a/mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test
+++ b/mysql-test/suite/sys_vars/t/replicate_wild_do_table_basic.test
@@ -44,5 +44,8 @@ SELECT @@GLOBAL.replicate_wild_do_table;
SET @@GLOBAL.replicate_wild_do_table="";
SELECT @@GLOBAL.replicate_wild_do_table;
+SET @@GLOBAL.replicate_wild_do_table=null;
+SELECT @@GLOBAL.replicate_wild_do_table;
+
--echo # Cleanup.
SET @@GLOBAL.replicate_wild_do_table = @save_replicate_wild_do_table;
diff --git a/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test
index 2900deab4d1..5cb1ff6c820 100644
--- a/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test
+++ b/mysql-test/suite/sys_vars/t/replicate_wild_ignore_table_basic.test
@@ -44,5 +44,8 @@ SELECT @@GLOBAL.replicate_wild_ignore_table;
SET @@GLOBAL.replicate_wild_ignore_table="";
SELECT @@GLOBAL.replicate_wild_ignore_table;
+SET @@GLOBAL.replicate_wild_ignore_table=null;
+SELECT @@GLOBAL.replicate_wild_ignore_table;
+
--echo # Cleanup.
SET @@GLOBAL.replicate_wild_ignore_table = @save_replicate_wild_ignore_table;
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 7c0723ae82e..e56212cd4e8 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1701,6 +1701,20 @@ SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65536) AS data) AS sub;
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub;
--echo #
+--echo # MDEV-10717 Assertion `!null_value' failed in virtual bool Item::send(Protocol*, String*)
+--echo #
+CREATE TABLE t1 (i INT, KEY(i));
+INSERT INTO t1 VALUES (20081205),(20050327);
+SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1;
+SET sql_mode='STRICT_ALL_TABLES';
+SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1;
+# Avoid garbage in the output
+--replace_column 1 ###
+SELECT CHAR(i USING utf8) FROM t1;
+SET sql_mode=DEFAULT;
+DROP TABLE t1;
+
+--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index a7739dcf8a7..b517dfd29d1 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -829,3 +829,50 @@ ORDER BY TOTAL DESC;
DROP TABLES t1,t2;
set optimizer_switch=@save_derived_optimizer_switch;
+
+--echo #
+--echo # MDEV-10663: Use of Inline table columns in HAVING clause
+--echo # throws 1463 Error
+--echo #
+
+set @save_sql_mode = @@sql_mode;
+set sql_mode='ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
+
+CREATE TABLE `example1463` (
+ `Customer` varchar(255) NOT NULL,
+ `DeliveryStatus` varchar(255) NOT NULL,
+ `OrderSize` int(11) NOT NULL
+);
+INSERT INTO example1463 VALUES ('Charlie', 'Success', 100);
+INSERT INTO example1463 VALUES ('David', 'Success', 110);
+INSERT INTO example1463 VALUES ('Charlie', 'Failed', 200);
+INSERT INTO example1463 VALUES ('David', 'Success', 100);
+INSERT INTO example1463 VALUES ('David', 'Unknown', 100);
+INSERT INTO example1463 VALUES ('Edward', 'Success', 150);
+INSERT INTO example1463 VALUES ('Edward', 'Pending', 150);
+
+SELECT Customer, Success, SUM(OrderSize)
+ FROM (SELECT Customer,
+ CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
+ OrderSize
+ FROM example1463) as subQ
+ GROUP BY Success, Customer
+ WITH ROLLUP;
+SELECT Customer, Success, SUM(OrderSize)
+ FROM (SELECT Customer,
+ CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
+ OrderSize
+ FROM example1463) as subQ
+ GROUP BY Success, Customer;
+SELECT Customer, Success, SUM(OrderSize)
+ FROM (SELECT Customer,
+ CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
+ OrderSize
+ FROM example1463) as subQ
+ GROUP BY Success, Customer
+ HAVING Success IS NOT NULL;
+
+DROP TABLE example1463;
+set sql_mode= @save_sql_mode;
+
+--echo # end of 5.5
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index 67899837bb2..d017f847af9 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -1827,6 +1827,60 @@ DROP TABLE t1,t2;
--echo # end of 5.3 tests
--echo #
+--echo #
+--echo # Bug mdev-11161: The second execution of prepared statement
+--echo # does not use generated key for materialized
+--echo # derived table / view
+--echo # (actually this is a 5.3 bug.)
+--echo #
+
+create table t1 (
+ mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ matintnum CHAR(6) NOT NULL,
+ test MEDIUMINT UNSIGNED NULL
+);
+create table t2 (
+ mat_id MEDIUMINT UNSIGNED NOT NULL,
+ pla_id MEDIUMINT UNSIGNED NOT NULL
+);
+insert into t1 values
+ (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4),
+ (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8),
+ (NULL, 'i', 9);
+insert into t2 values
+ (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104),
+ (3, 101), (3, 102), (3, 105);
+
+explain
+ SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id
+ FROM t1 m2
+ INNER JOIN
+ (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum
+ FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id
+ GROUP BY mp.pla_id) d
+ ON d.matintnum=m2.matintnum;
+
+prepare stmt1 from
+"SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id
+ FROM t1 m2
+ INNER JOIN
+ (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum
+ FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id
+ GROUP BY mp.pla_id) d
+ ON d.matintnum=m2.matintnum";
+
+flush status;
+execute stmt1;
+show status like '%Handler_read%';
+
+flush status;
+execute stmt1;
+show status like '%Handler_read%';
+
+deallocate prepare stmt1;
+
+drop table t1,t2;
+
# The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
diff --git a/mysql-test/t/fulltext_charsets.test b/mysql-test/t/fulltext_charsets.test
new file mode 100644
index 00000000000..3ac9791bd1a
--- /dev/null
+++ b/mysql-test/t/fulltext_charsets.test
@@ -0,0 +1,10 @@
+#
+# MDEV-11241 Certain combining marks cause MariaDB to crash when doing Full-Text searches
+#
+set names utf8mb4;
+
+create table t1 (a int, b text, fulltext (b)) charset=utf8mb4 collate=utf8mb4_unicode_ci;
+insert t1 values (1000, 'C͓̙̯͔̩ͅͅi̩̘̜̲a̯̲̬̳̜̖̤o͕͓̜͓̺̖̗,̠̬͚ ̺T͇̲h͈̱e ̬̜D̖o̦̖͔̗͖̩̘c̣̼t̝͉̫̮̗o͉̫̭r̙͎̗.͓̪̥');
+select a from t1 where match(b) against ('ciao' in boolean mode);
+drop table t1;
+
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 4b992faa306..8ea2f923eb1 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1690,6 +1690,18 @@ SELECT MAX(i), c FROM t1
WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c;
drop table t1,t2;
+--echo #
+--echo # ONLY_FULL_GROUP_BY references
+--echo #
+
+set @save_sql_mode = @@sql_mode;
+set sql_mode='ONLY_FULL_GROUP_BY';
+create table t1 (a int, b int);
+select a+b as x from t1 group by x having x > 1;
+select a as x from t1 group by x having x > 1;
+select a from t1 group by a having a > 1;
+drop table t1;
+set sql_mode= @save_sql_mode;
#
# End of MariaDB 5.5 tests
#
diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test
index 496a6829577..3058a70eefc 100644
--- a/mysql-test/t/parser.test
+++ b/mysql-test/t/parser.test
@@ -770,3 +770,13 @@ select 2>!0, 2 > ! 0;
select 0<=!0, 0 <= !0;
select 1<<!0, 1 << !0;
select 0<!0, 0 < ! 0;
+
+--echo #
+--echo # MDEV-11171 Assertion `m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_append(const char*, const char*)
+--echo #
+CREATE TABLE t1 (id INT);
+--error ER_PARSE_ERROR
+CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\;
+--error ER_PARSE_ERROR
+PREPARE stmt FROM 'CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\\';
+DROP TABLE t1;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index c62257049ee..10c95f9a919 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9302,6 +9302,57 @@ CALL p1;
DROP PROCEDURE p1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-10713: signal 11 error on multi-table update - crash in
+--echo # handler::increment_statistics or in make_select or assertion
+--echo # failure pfs_thread == ((PFS_thread*) pthread_getspecific((THR_PFS)))
+--echo #
+
+CREATE TABLE `t1` (
+ `CLOSE_YN` varchar(10) COLLATE utf8_bin DEFAULT NULL
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
+
+
+CREATE TABLE `t2` (
+ `ap_close_to` varchar(8) COLLATE utf8_bin DEFAULT NULL
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
+insert t1 values (1);
+
+
+--delimiter $$
+
+CREATE FUNCTION `f1`(`P_DC_CD` VARBINARY(50), `P_SYS_DATE` DATETIME) RETURNS datetime
+ DETERMINISTIC
+ SQL SECURITY INVOKER
+BEGIN
+ DECLARE V_SYS_DATE DATETIME;
+ SELECT now() AS LOC_DATE INTO V_SYS_DATE ;
+ RETURN v_sys_date ;
+END $$
+
+--delimiter ;
+
+update t1 S
+JOIN
+(
+ SELECT CASE
+ WHEN DATE_FORMAT( f1('F01', NOW()) , '%Y%m%d') <= CLOSE_YMD
+ THEN '99991231'
+ ELSE '' END ACCOUNT_APPLY_YYYYMMDD
+ FROM (
+ select case
+ when 'AP'='AP'
+ then ap_close_to
+ end AS CLOSE_YMD
+ from t2
+ ) A
+) X
+SET S.CLOSE_YN = ''
+where 1=1;
+
+drop function if exists f1;
+drop table t1,t2;
+
--echo # End of 5.5 test
--echo #
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 45c4fe920b7..a9e09bb4e27 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -5977,6 +5977,19 @@ DROP TABLE t1;
SET SESSION big_tables=0;
--echo #
+--echo # MDEV-10776: Server crash on query
+--echo #
+create table t1 (field1 int);
+
+insert into t1 values (1);
+
+select round((select 1 from t1 limit 1))
+from t1
+group by round((select 1 from t1 limit 1));
+
+drop table t1;
+
+--echo #
--echo # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
--echo # m_lock_type != 2' failed in handler::ha_index_read_map
--echo #
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 659e75270ca..834fd0c5327 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -604,6 +604,11 @@ SHOW COLUMNS FROM t1dec102;
SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
DROP TABLE t1dec102;
+#
+# MDEV-10552 equality operation on cast of the value "-0.0" to decimal not working
+#
+select cast('-0.0' as decimal(5,1)) < 0;
+
--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index bdce0857d1e..c0a6675be58 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -513,10 +513,8 @@ then
echo "The latest information about MariaDB is available at http://mariadb.org/."
echo "You can find additional information about the MySQL part at:"
echo "http://dev.mysql.com"
- echo "Support MariaDB development by buying support/new features from MariaDB"
- echo "Corporation Ab. You can contact us about this at sales@mariadb.com."
- echo "Alternatively consider joining our community based development effort:"
- echo "http://mariadb.com/kb/en/contributing-to-the-mariadb-project/"
+ echo "Consider joining MariaDB's strong and vibrant community:"
+ echo "https://mariadb.org/get-involved/"
echo
fi
diff --git a/sql/item.cc b/sql/item.cc
index 21c8b3f701e..ecdb3a94f7f 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4498,8 +4498,6 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
const char *field_name;
ORDER *found_group= NULL;
int found_match_degree= 0;
- Item_ident *cur_field;
- int cur_match_degree= 0;
char name_buff[SAFE_NAME_LEN+1];
if (find_item->type() == Item::FIELD_ITEM ||
@@ -4524,54 +4522,70 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
for (ORDER *cur_group= group_list ; cur_group ; cur_group= cur_group->next)
{
- if ((*(cur_group->item))->real_item()->type() == Item::FIELD_ITEM)
+ int cur_match_degree= 0;
+
+ /* SELECT list element with explicit alias */
+ if ((*(cur_group->item))->name &&
+ !(*(cur_group->item))->is_autogenerated_name &&
+ !my_strcasecmp(system_charset_info,
+ (*(cur_group->item))->name, field_name))
+ {
+ ++cur_match_degree;
+ }
+ /* Reference on the field or view/derived field. */
+ else if ((*(cur_group->item))->type() == Item::FIELD_ITEM ||
+ (*(cur_group->item))->type() == Item::REF_ITEM )
{
- cur_field= (Item_ident*) *cur_group->item;
- cur_match_degree= 0;
-
- DBUG_ASSERT(cur_field->field_name != 0);
+ Item_ident *cur_field= (Item_ident*) *cur_group->item;
+ const char *l_db_name= cur_field->db_name;
+ const char *l_table_name= cur_field->table_name;
+ const char *l_field_name= cur_field->field_name;
+
+ DBUG_ASSERT(l_field_name != 0);
if (!my_strcasecmp(system_charset_info,
- cur_field->field_name, field_name))
+ l_field_name, field_name))
++cur_match_degree;
else
continue;
- if (cur_field->table_name && table_name)
+ if (l_table_name && table_name)
{
/* If field_name is qualified by a table name. */
- if (my_strcasecmp(table_alias_charset, cur_field->table_name, table_name))
+ if (my_strcasecmp(table_alias_charset, l_table_name, table_name))
/* Same field names, different tables. */
return NULL;
++cur_match_degree;
- if (cur_field->db_name && db_name)
+ if (l_db_name && db_name)
{
/* If field_name is also qualified by a database name. */
- if (strcmp(cur_field->db_name, db_name))
+ if (strcmp(l_db_name, db_name))
/* Same field names, different databases. */
return NULL;
++cur_match_degree;
}
}
+ }
+ else
+ continue;
- if (cur_match_degree > found_match_degree)
- {
- found_match_degree= cur_match_degree;
- found_group= cur_group;
- }
- else if (found_group && (cur_match_degree == found_match_degree) &&
- ! (*(found_group->item))->eq(cur_field, 0))
- {
- /*
- If the current resolve candidate matches equally well as the current
- best match, they must reference the same column, otherwise the field
- is ambiguous.
- */
- my_error(ER_NON_UNIQ_ERROR, MYF(0),
- find_item->full_name(), current_thd->where);
- return NULL;
- }
+ if (cur_match_degree > found_match_degree)
+ {
+ found_match_degree= cur_match_degree;
+ found_group= cur_group;
+ }
+ else if (found_group && (cur_match_degree == found_match_degree) &&
+ !(*(found_group->item))->eq((*(cur_group->item)), 0))
+ {
+ /*
+ If the current resolve candidate matches equally well as the current
+ best match, they must reference the same column, otherwise the field
+ is ambiguous.
+ */
+ my_error(ER_NON_UNIQ_ERROR, MYF(0),
+ find_item->full_name(), current_thd->where);
+ return NULL;
}
}
@@ -5675,6 +5689,7 @@ String *Item::check_well_formed_result(String *str, bool send_error)
/* Check whether we got a well-formed string */
CHARSET_INFO *cs= str->charset();
uint wlen= str->well_formed_length();
+ null_value= false;
if (wlen < str->length())
{
THD *thd= current_thd;
@@ -9932,4 +9947,3 @@ const char *dbug_print_item(Item *item)
}
#endif /*DBUG_OFF*/
-
diff --git a/sql/item.h b/sql/item.h
index 64870ca15a8..2f8607d8fad 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -3713,7 +3713,7 @@ public:
if (result_type() == ROW_RESULT)
orig_item->bring_value();
}
- virtual bool is_expensive() { return orig_item->is_expensive(); }
+ bool is_expensive() { return orig_item->is_expensive(); }
bool is_expensive_processor(uchar *arg)
{ return orig_item->is_expensive_processor(arg); }
bool check_vcol_func_processor(uchar *arg)
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 9ee1ba4c7a7..c87d4587f4d 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -6653,7 +6653,8 @@ Item_func_sp::init_result_field(THD *thd)
bool Item_func_sp::is_expensive()
{
- return !(m_sp->m_chistics->detistic);
+ return !m_sp->m_chistics->detistic ||
+ current_thd->locked_tables_mode < LTM_LOCK_TABLES;
}
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index e70922bb5d3..cf09b1801cf 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -222,6 +222,7 @@ bool
Item_subselect::select_transformer(JOIN *join)
{
DBUG_ENTER("Item_subselect::select_transformer");
+ DBUG_ASSERT(thd == join->thd);
DBUG_RETURN(false);
}
@@ -592,7 +593,7 @@ bool Item_subselect::is_expensive()
examined_rows+= cur_join->get_examined_rows();
}
-
+ // here we are sure that subquery is optimized so thd is set
return (examined_rows > thd->variables.expensive_subquery_limit);
}
@@ -656,6 +657,7 @@ bool Item_subselect::exec()
subselect_engine *org_engine= engine;
DBUG_ENTER("Item_subselect::exec");
+ DBUG_ASSERT(fixed);
/*
Do not execute subselect in case of a fatal error
@@ -704,6 +706,7 @@ int Item_in_subselect::optimize(double *out_rows, double *cost)
{
int res;
DBUG_ENTER("Item_in_subselect::optimize");
+ DBUG_ASSERT(fixed);
SELECT_LEX *save_select= thd->lex->current_select;
JOIN *join= unit->first_select()->join;
@@ -818,6 +821,7 @@ bool Item_in_subselect::expr_cache_is_needed(THD *thd)
bool Item_in_subselect::exec()
{
DBUG_ENTER("Item_in_subselect::exec");
+ DBUG_ASSERT(fixed);
/*
Initialize the cache of the left predicate operand. This has to be done as
late as now, because Cached_item directly contains a resolved field (not
@@ -872,6 +876,7 @@ table_map Item_subselect::used_tables() const
bool Item_subselect::const_item() const
{
+ DBUG_ASSERT(thd);
return (thd->lex->context_analysis_only ?
FALSE :
forced_const || const_item_cache);
@@ -1065,10 +1070,11 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
DBUG_ENTER("Item_singlerow_subselect::select_transformer");
if (changed)
DBUG_RETURN(false);
+ DBUG_ASSERT(join->thd == thd);
SELECT_LEX *select_lex= join->select_lex;
Query_arena *arena= thd->stmt_arena;
-
+
if (!select_lex->master_unit()->is_union() &&
!select_lex->table_list.elements &&
select_lex->item_list.elements == 1 &&
@@ -1731,6 +1737,7 @@ Item_in_subselect::single_value_transformer(JOIN *join)
{
SELECT_LEX *select_lex= join->select_lex;
DBUG_ENTER("Item_in_subselect::single_value_transformer");
+ DBUG_ASSERT(thd == join->thd);
/*
Check that the right part of the subselect contains no more than one
@@ -1842,9 +1849,9 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
if (!test_strategy(SUBS_MAXMIN_INJECTED | SUBS_MAXMIN_ENGINE))
DBUG_RETURN(false);
Item **place= optimizer->arguments() + 1;
- THD *thd= join->thd;
SELECT_LEX *select_lex= join->select_lex;
Item *subs;
+ DBUG_ASSERT(thd == join->thd);
/*
*/
@@ -1951,6 +1958,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
bool Item_in_subselect::fix_having(Item *having, SELECT_LEX *select_lex)
{
bool fix_res= 0;
+ DBUG_ASSERT(thd);
if (!having->fixed)
{
select_lex->having_fix_field= 1;
@@ -2013,6 +2021,7 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
Item **having_item)
{
SELECT_LEX *select_lex= join->select_lex;
+ DBUG_ASSERT(thd == join->thd);
/*
The non-transformed HAVING clause of 'join' may be stored in two ways
during JOIN::optimize: this->tmp_having= this->having; this->having= 0;
@@ -2149,6 +2158,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
uint cols_num= left_expr->cols();
DBUG_ENTER("Item_in_subselect::row_value_transformer");
+ DBUG_ASSERT(thd == join->thd);
// psergey: duplicated_subselect_card_check
if (select_lex->item_list.elements != cols_num)
@@ -2260,6 +2270,7 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
!select_lex->table_list.elements);
DBUG_ENTER("Item_in_subselect::create_row_in_to_exists_cond");
+ DBUG_ASSERT(thd == join->thd);
*where_item= NULL;
*having_item= NULL;
@@ -2492,6 +2503,7 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg)
Item *having_item= join_arg->in_to_exists_having;
DBUG_ENTER("Item_in_subselect::inject_in_to_exists_cond");
+ DBUG_ASSERT(thd == join_arg->thd);
if (where_item)
{
@@ -3007,6 +3019,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join)
bool result;
DBUG_ENTER("Item_in_subselect::select_in_like_transformer");
+ DBUG_ASSERT(thd == join->thd);
/*
IN/SOME/ALL/ANY subqueries aren't support LIMIT clause. Without it
@@ -3217,6 +3230,7 @@ bool Item_in_subselect::setup_mat_engine()
subselect_single_select_engine *select_engine;
DBUG_ENTER("Item_in_subselect::setup_mat_engine");
+ DBUG_ASSERT(thd);
/*
The select_engine (that executes transformed IN=>EXISTS subselects) is
@@ -3255,6 +3269,7 @@ bool Item_in_subselect::setup_mat_engine()
bool Item_in_subselect::init_left_expr_cache()
{
JOIN *outer_join;
+ DBUG_ASSERT(thd);
outer_join= unit->outer_select()->join;
/*
@@ -3281,6 +3296,7 @@ bool Item_in_subselect::init_left_expr_cache()
bool Item_in_subselect::init_cond_guards()
{
+ DBUG_ASSERT(thd);
uint cols_num= left_expr->cols();
if (!abort_on_null && left_expr->maybe_null && !pushed_cond_guards)
{
diff --git a/sql/log.cc b/sql/log.cc
index 8813f56bbd8..cd215822d44 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -289,6 +289,9 @@ public:
{
compute_statistics();
truncate(0);
+ if(cache_log.file != -1)
+ my_chsize(cache_log.file, 0, 0, MYF(MY_WME));
+
changes_to_non_trans_temp_table_flag= FALSE;
incident= FALSE;
before_stmt_pos= MY_OFF_T_UNDEF;
@@ -3275,7 +3278,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
if (init_and_set_log_file_name(log_name, new_name, log_type_arg,
io_cache_type_arg))
{
- sql_print_error("MSYQL_BIN_LOG::open failed to generate new file name.");
+ sql_print_error("MYSQL_BIN_LOG::open failed to generate new file name.");
DBUG_RETURN(1);
}
@@ -3302,7 +3305,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
}
});
- sql_print_error("MSYQL_BIN_LOG::open failed to sync the index file.");
+ sql_print_error("MYSQL_BIN_LOG::open failed to sync the index file.");
DBUG_RETURN(1);
}
DBUG_EXECUTE_IF("crash_create_non_critical_before_update_index", DBUG_SUICIDE(););
@@ -4324,14 +4327,14 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
if ((error= sync_purge_index_file()))
{
- sql_print_error("MSYQL_BIN_LOG::purge_logs failed to flush register file.");
+ sql_print_error("MYSQL_BIN_LOG::purge_logs failed to flush register file.");
goto err;
}
/* We know how many files to delete. Update index file. */
if ((error=update_log_index(&log_info, need_update_threads)))
{
- sql_print_error("MSYQL_BIN_LOG::purge_logs failed to update the index file");
+ sql_print_error("MYSQL_BIN_LOG::purge_logs failed to update the index file");
goto err;
}
@@ -4341,7 +4344,7 @@ err:
/* Read each entry from purge_index_file and delete the file. */
if (is_inited_purge_index_file() &&
(error= purge_index_entry(thd, reclaimed_space, FALSE)))
- sql_print_error("MSYQL_BIN_LOG::purge_logs failed to process registered files"
+ sql_print_error("MYSQL_BIN_LOG::purge_logs failed to process registered files"
" that would be purged.");
close_purge_index_file();
@@ -4458,7 +4461,7 @@ int MYSQL_BIN_LOG::purge_index_entry(THD *thd, ulonglong *reclaimed_space,
if ((error=reinit_io_cache(&purge_index_file, READ_CACHE, 0, 0, 0)))
{
- sql_print_error("MSYQL_BIN_LOG::purge_index_entry failed to reinit register file "
+ sql_print_error("MYSQL_BIN_LOG::purge_index_entry failed to reinit register file "
"for read");
goto err;
}
@@ -4473,7 +4476,7 @@ int MYSQL_BIN_LOG::purge_index_entry(THD *thd, ulonglong *reclaimed_space,
if (purge_index_file.error)
{
error= purge_index_file.error;
- sql_print_error("MSYQL_BIN_LOG::purge_index_entry error %d reading from "
+ sql_print_error("MYSQL_BIN_LOG::purge_index_entry error %d reading from "
"register file.", error);
goto err;
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 00d459d5f91..fda4fab9d26 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -5440,6 +5440,12 @@ int mysqld_main(int argc, char **argv)
setbuf(stderr, NULL);
FreeConsole(); // Remove window
}
+
+ if (fileno(stdin) >= 0)
+ {
+ /* Disable CRLF translation (MDEV-9409). */
+ _setmode(fileno(stdin), O_BINARY);
+ }
#endif
/*
diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc
index 28859c2eb85..b992a71e52e 100644
--- a/sql/rpl_filter.cc
+++ b/sql/rpl_filter.cc
@@ -280,6 +280,9 @@ Rpl_filter::parse_filter_rule(const char* spec, Add_filter add)
int status= 0;
char *arg, *ptr, *pstr;
+ if (!spec)
+ return false;
+
if (! (ptr= my_strdup(spec, MYF(MY_WME))))
return true;
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index fdc615d0fae..f2674cb8dab 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -663,6 +663,8 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
unit->derived= derived;
+ derived->fill_me= FALSE;
+
if (!(derived->derived_result= new select_union))
DBUG_RETURN(TRUE); // out of memory
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index db54dd6a8b0..9d5f4cfcb5b 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1101,7 +1101,7 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
state= (enum my_lex_states) state_map[c];
break;
case MY_LEX_ESCAPE:
- if (lip->yyGet() == 'N')
+ if (!lip->eof() && lip->yyGet() == 'N')
{ // Allow \N as shortcut for NULL
yylval->lex_str.str=(char*) "\\N";
yylval->lex_str.length=2;
@@ -3482,12 +3482,28 @@ bool st_select_lex::add_index_hint (THD *thd, char *str, uint length)
bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
{
- for (SELECT_LEX_UNIT *un= first_inner_unit(); un; un= un->next_unit())
+ SELECT_LEX_UNIT *next_unit= NULL;
+ for (SELECT_LEX_UNIT *un= first_inner_unit();
+ un;
+ un= next_unit ? next_unit : un->next_unit())
{
Item_subselect *subquery_predicate= un->item;
-
+ next_unit= NULL;
+
if (subquery_predicate)
{
+ if (!subquery_predicate->fixed)
+ {
+ /*
+ This subquery was excluded as part of some expression so it is
+ invisible from all prepared expression.
+ */
+ next_unit= un->next_unit();
+ un->exclude_level();
+ if (next_unit)
+ continue;
+ break;
+ }
if (subquery_predicate->substype() == Item_subselect::IN_SUBS)
{
Item_in_subselect *in_subs= (Item_in_subselect*) subquery_predicate;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 3b104b55de2..62dff1b5928 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -666,7 +666,7 @@ static bool read_ddl_log_file_entry(uint entry_no)
bool error= FALSE;
File file_id= global_ddl_log.file_id;
uchar *file_entry_buf= (uchar*)global_ddl_log.file_entry_buf;
- uint io_size= global_ddl_log.io_size;
+ size_t io_size= global_ddl_log.io_size;
DBUG_ENTER("read_ddl_log_file_entry");
mysql_mutex_assert_owner(&LOCK_gdl);
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index 766f8411ca1..4145ca75483 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -195,12 +195,7 @@ static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
switch (info->type) {
case FT_TOKEN_WORD:
ftbw= (FTB_WORD *)alloc_root(&ftb_param->ftb->mem_root,
- sizeof(FTB_WORD) +
- (info->trunc ? HA_MAX_KEY_BUFF :
- (word_len + 1) *
- ftb_param->ftb->charset->mbmaxlen +
- HA_FT_WLEN +
- ftb_param->ftb->info->s->rec_reflength));
+ sizeof(FTB_WORD) + HA_MAX_KEY_BUFF);
ftbw->len= word_len + 1;
ftbw->flags= 0;
ftbw->off= 0;
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
index 23f1dd4110f..68e16cf61ed 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
@@ -222,7 +222,6 @@ drop table t1;
create table t1 (a decimal(10,2) unsigned);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings:
-Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1");
Warnings:
@@ -281,7 +280,6 @@ drop table t1;
create table t1 (a decimal(10,2) zerofill);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings:
-Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1");
Warnings:
diff --git a/strings/decimal.c b/strings/decimal.c
index 2353a8aefce..c6898cd099f 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -928,6 +928,8 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed)
error= decimal_shift(to, (int) exponent);
}
}
+ if (to->sign && decimal_is_zero(to))
+ to->sign= 0;
return error;
fatal_error:
diff --git a/win/packaging/extra.wxs.in b/win/packaging/extra.wxs.in
index befe070b404..016f6a8a97f 100644
--- a/win/packaging/extra.wxs.in
+++ b/win/packaging/extra.wxs.in
@@ -463,9 +463,24 @@
<RegistryValue Root='HKLM'
Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
Name='DATADIR' Value='[DATADIR]' Type='string' KeyPath='yes'/>
+ <CreateFolder>
+ <util:PermissionEx User="NetworkService" GenericAll="yes" />
+ </CreateFolder>
+ </Component>
+
+ <Component Id="C.datadir.permissions" Directory="DATADIR">
+ <Condition>
+ <!--
+ Skip setting permissions for LogonUser, if package is installed by
+ service user (e.g LocalSystem)
+ -->
+ <![CDATA[ (UserSID <> "S-1-5-18") AND (UserSID <> "S-1-5-19") AND (UserSID <> "S-1-5-20") ]]>
+ </Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
+ Name='InstalledBy' Value='[USER_DOMAIN]\[LogonUser]' Type='string' KeyPath='yes'/>
<CreateFolder>
<util:PermissionEx User="[LogonUser]" Domain="[USER_DOMAIN]" GenericAll="yes" />
- <util:PermissionEx User="NetworkService" GenericAll="yes" />
</CreateFolder>
</Component>
diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake
index e2636eb4af8..772834e7c7d 100644
--- a/win/packaging/heidisql.cmake
+++ b/win/packaging/heidisql.cmake
@@ -1,4 +1,4 @@
-SET(HEIDISQL_BASE_NAME "HeidiSQL_9.3_Portable")
+SET(HEIDISQL_BASE_NAME "HeidiSQL_9.4_Portable")
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
diff --git a/win/packaging/heidisql.wxi.in b/win/packaging/heidisql.wxi.in
index 4f07a07627c..1d5c4430cd2 100644
--- a/win/packaging/heidisql.wxi.in
+++ b/win/packaging/heidisql.wxi.in
@@ -45,14 +45,20 @@
<Component Id="component.HeidiSQL_ssleay32.dll" Guid="*" Win64="no">
<File Id="heidisql.ssleay32.dll" Name="ssleay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\ssleay32.dll" />
</Component>
- <Component Id="component.HeidiSQL_libintl.dll" Guid="*" Win64="no">
- <File Id="heidisql.libintl.dll" Name="libintl.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libintl.dll" />
+ <Component Id="component.HeidiSQL_libintl_8.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libintl_8.dll" Name="libintl-8.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libintl-8.dll" />
+ </Component>
+ <Component Id="component.HeidiSQL_libiconv_2.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libiconv_2.dll" Name="libiconv-2.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libiconv-2.dll" />
</Component>
<Directory Id="D.HeidiSQL.plugins" Name="plugins">
<Component Id="component.HeidiSQL_dialog.dll" Guid="*" Win64="no">
<File Id="heidisql.dialog.dll" Name="dialog.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\plugins\dialog.dll" />
</Component>
+ <Component Id="component.HeidiSQL_auth_gssapi_client.dll" Guid="*" Win64="no">
+ <File Id="heidisql.auth_gssapi_client.dll" Name="auth_gssapi_client.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\plugins\auth_gssapi_client.dll" />
+ </Component>
</Directory>
<Component Id="component.HeidiSQL_CleanupSettings" Guid="*" Win64="no">
@@ -70,8 +76,10 @@
<ComponentRef Id="component.HeidiSQL_libeay32.dll" />
<ComponentRef Id="component.HeidiSQL_libpq.dll" />
<ComponentRef Id="component.HeidiSQL_ssleay32.dll" />
- <ComponentRef Id="component.HeidiSQL_libintl.dll" />
+ <ComponentRef Id="component.HeidiSQL_libintl_8.dll" />
+ <ComponentRef Id="component.HeidiSQL_libiconv_2.dll" />
<ComponentRef Id="component.HeidiSQL_dialog.dll" />
+ <ComponentRef Id="component.HeidiSQL_auth_gssapi_client.dll" />
<ComponentRef Id="component.HeidiSQL_CleanupSettings"/>
</ComponentGroup>
</Include>