Merge branch '5.5' into 10.0

This commit is contained in:
Sergei Golubchik 2016-12-09 16:33:48 +01:00
commit 3e8155c637
61 changed files with 746 additions and 82 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1700,6 +1700,20 @@ SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65535) AS data) AS sub;
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 #

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5976,6 +5976,19 @@ SELECT * FROM t1 WHERE a IN(SELECT MIN(a) FROM t1);
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

View File

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

View File

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

View File

@ -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_field= (Item_ident*) *cur_group->item;
cur_match_degree= 0;
DBUG_ASSERT(cur_field->field_name != 0);
++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 )
{
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*/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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