Skip to content

Commit 3e8155c

Browse files
committed
Merge branch '5.5' into 10.0
2 parents 106664f + 03dabfa commit 3e8155c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+746
-82
lines changed

client/mysqltest.cc

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,11 +1729,11 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename)
17291729
while((len= my_read(fd, (uchar*)&buff,
17301730
sizeof(buff)-1, MYF(0))) > 0)
17311731
{
1732-
char *p= buff, *start= buff;
1733-
while (p < buff+len)
1732+
char *p= buff, *start= buff,*end=buff+len;
1733+
while (p < end)
17341734
{
17351735
/* Convert cr/lf to lf */
1736-
if (*p == '\r' && *(p+1) && *(p+1)== '\n')
1736+
if (*p == '\r' && p+1 < end && *(p+1)== '\n')
17371737
{
17381738
/* Add fake newline instead of cr and output the line */
17391739
*p= '\n';
@@ -3391,16 +3391,32 @@ void do_exec(struct st_command *command)
33913391
ds_result= &ds_sorted;
33923392
}
33933393

3394+
#ifdef _WIN32
3395+
/* Workaround for CRT bug, MDEV-9409 */
3396+
_setmode(fileno(res_file), O_BINARY);
3397+
#endif
3398+
33943399
while (fgets(buf, sizeof(buf), res_file))
33953400
{
3401+
int len = (int)strlen(buf);
3402+
#ifdef _WIN32
3403+
/* Strip '\r' off newlines. */
3404+
if (len > 1 && buf[len-2] == '\r' && buf[len-1] == '\n')
3405+
{
3406+
buf[len-2] = '\n';
3407+
buf[len-1] = 0;
3408+
len--;
3409+
}
3410+
#endif
33963411
if (disable_result_log)
33973412
{
3398-
buf[strlen(buf)-1]=0;
3413+
if (len)
3414+
buf[len-1] = 0;
33993415
DBUG_PRINT("exec_result",("%s", buf));
34003416
}
34013417
else
34023418
{
3403-
replace_dynstr_append(ds_result, buf);
3419+
replace_dynstr_append_mem(ds_result, buf, len);
34043420
}
34053421
}
34063422
error= pclose(res_file);

cmake/install_macros.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ IF(WIN32)
208208
FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool
209209
PATHS "$ENV{ProgramFiles}/Microsoft SDKs/Windows/v7.0A/bin"
210210
"$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86"
211+
"$ENV{ProgramFiles}/Windows Kits/8.1/bin/x86"
211212
)
212213
IF(NOT SIGNTOOL_EXECUTABLE)
213214
MESSAGE(FATAL_ERROR

cmake/os/Windows.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ IF(MSVC)
116116

117117
#TODO: update the code and remove the disabled warnings
118118
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996")
119-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /we4099")
119+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099")
120120

121121
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
122122
# _WIN64 is defined by the compiler itself.

cmake/readline.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,5 +230,6 @@ MACRO (MYSQL_CHECK_READLINE)
230230
SET(CMAKE_REQUIRED_LIBRARIES)
231231
SET(CMAKE_REQUIRED_INCLUDES)
232232
ENDIF(NOT WIN32)
233+
CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H)
233234
ENDMACRO()
234235

configure.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
228228
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
229229
CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
230230
CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H)
231-
CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H)
232231
CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H)
233232
CHECK_INCLUDE_FILES (termbits.h HAVE_TERMBITS_H)
234233
CHECK_INCLUDE_FILES (termios.h HAVE_TERMIOS_H)

mysql-test/r/ctype_utf8.result

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6147,6 +6147,32 @@ SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub;
61476147
len
61486148
131074
61496149
#
6150+
# MDEV-10717 Assertion `!null_value' failed in virtual bool Item::send(Protocol*, String*)
6151+
#
6152+
CREATE TABLE t1 (i INT, KEY(i));
6153+
INSERT INTO t1 VALUES (20081205),(20050327);
6154+
SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1;
6155+
HEX(i) HEX(CHAR(i USING utf8))
6156+
131F197 0131
6157+
1326A35 01326A35
6158+
Warnings:
6159+
Warning 1300 Invalid utf8 character string: 'F197'
6160+
SET sql_mode='STRICT_ALL_TABLES';
6161+
SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1;
6162+
HEX(i) HEX(CHAR(i USING utf8))
6163+
131F197 NULL
6164+
1326A35 01326A35
6165+
Warnings:
6166+
Warning 1300 Invalid utf8 character string: 'F197'
6167+
SELECT CHAR(i USING utf8) FROM t1;
6168+
CHAR(i USING utf8)
6169+
###
6170+
###
6171+
Warnings:
6172+
### 1300 Invalid utf8 character string: 'F197'
6173+
SET sql_mode=DEFAULT;
6174+
DROP TABLE t1;
6175+
#
61506176
# End of 5.5 tests
61516177
#
61526178
#

mysql-test/r/derived.result

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,3 +950,68 @@ id select_type table type possible_keys key key_len ref rows Extra
950950
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
951951
DROP TABLES t1,t2;
952952
set optimizer_switch=@save_derived_optimizer_switch;
953+
#
954+
# MDEV-10663: Use of Inline table columns in HAVING clause
955+
# throws 1463 Error
956+
#
957+
set @save_sql_mode = @@sql_mode;
958+
set sql_mode='ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
959+
CREATE TABLE `example1463` (
960+
`Customer` varchar(255) NOT NULL,
961+
`DeliveryStatus` varchar(255) NOT NULL,
962+
`OrderSize` int(11) NOT NULL
963+
);
964+
INSERT INTO example1463 VALUES ('Charlie', 'Success', 100);
965+
INSERT INTO example1463 VALUES ('David', 'Success', 110);
966+
INSERT INTO example1463 VALUES ('Charlie', 'Failed', 200);
967+
INSERT INTO example1463 VALUES ('David', 'Success', 100);
968+
INSERT INTO example1463 VALUES ('David', 'Unknown', 100);
969+
INSERT INTO example1463 VALUES ('Edward', 'Success', 150);
970+
INSERT INTO example1463 VALUES ('Edward', 'Pending', 150);
971+
SELECT Customer, Success, SUM(OrderSize)
972+
FROM (SELECT Customer,
973+
CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
974+
OrderSize
975+
FROM example1463) as subQ
976+
GROUP BY Success, Customer
977+
WITH ROLLUP;
978+
Customer Success SUM(OrderSize)
979+
Charlie No 200
980+
David No 100
981+
Edward No 150
982+
NULL No 450
983+
Charlie Yes 100
984+
David Yes 210
985+
Edward Yes 150
986+
NULL Yes 460
987+
NULL NULL 910
988+
SELECT Customer, Success, SUM(OrderSize)
989+
FROM (SELECT Customer,
990+
CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
991+
OrderSize
992+
FROM example1463) as subQ
993+
GROUP BY Success, Customer;
994+
Customer Success SUM(OrderSize)
995+
Charlie No 200
996+
David No 100
997+
Edward No 150
998+
Charlie Yes 100
999+
David Yes 210
1000+
Edward Yes 150
1001+
SELECT Customer, Success, SUM(OrderSize)
1002+
FROM (SELECT Customer,
1003+
CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
1004+
OrderSize
1005+
FROM example1463) as subQ
1006+
GROUP BY Success, Customer
1007+
HAVING Success IS NOT NULL;
1008+
Customer Success SUM(OrderSize)
1009+
Charlie No 200
1010+
David No 100
1011+
Edward No 150
1012+
Charlie Yes 100
1013+
David Yes 210
1014+
Edward Yes 150
1015+
DROP TABLE example1463;
1016+
set sql_mode= @save_sql_mode;
1017+
# end of 5.5

mysql-test/r/derived_view.result

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,5 +2506,90 @@ DROP TABLE t1,t2;
25062506
#
25072507
# end of 5.3 tests
25082508
#
2509+
#
2510+
# Bug mdev-11161: The second execution of prepared statement
2511+
# does not use generated key for materialized
2512+
# derived table / view
2513+
# (actually this is a 5.3 bug.)
2514+
#
2515+
create table t1 (
2516+
mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
2517+
matintnum CHAR(6) NOT NULL,
2518+
test MEDIUMINT UNSIGNED NULL
2519+
);
2520+
create table t2 (
2521+
mat_id MEDIUMINT UNSIGNED NOT NULL,
2522+
pla_id MEDIUMINT UNSIGNED NOT NULL
2523+
);
2524+
insert into t1 values
2525+
(NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4),
2526+
(NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8),
2527+
(NULL, 'i', 9);
2528+
insert into t2 values
2529+
(1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104),
2530+
(3, 101), (3, 102), (3, 105);
2531+
explain
2532+
SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id
2533+
FROM t1 m2
2534+
INNER JOIN
2535+
(SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum
2536+
FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id
2537+
GROUP BY mp.pla_id) d
2538+
ON d.matintnum=m2.matintnum;
2539+
id select_type table type possible_keys key key_len ref rows Extra
2540+
1 PRIMARY m2 ALL NULL NULL NULL NULL 9
2541+
1 PRIMARY <derived2> ref key0 key0 7 test.m2.matintnum 2
2542+
2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
2543+
2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
2544+
prepare stmt1 from
2545+
"SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id
2546+
FROM t1 m2
2547+
INNER JOIN
2548+
(SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum
2549+
FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id
2550+
GROUP BY mp.pla_id) d
2551+
ON d.matintnum=m2.matintnum";
2552+
flush status;
2553+
execute stmt1;
2554+
pla_id mat_id
2555+
102 1
2556+
101 1
2557+
100 1
2558+
104 2
2559+
103 2
2560+
105 3
2561+
show status like '%Handler_read%';
2562+
Variable_name Value
2563+
Handler_read_first 0
2564+
Handler_read_key 21
2565+
Handler_read_last 0
2566+
Handler_read_next 6
2567+
Handler_read_prev 0
2568+
Handler_read_retry 0
2569+
Handler_read_rnd 6
2570+
Handler_read_rnd_deleted 0
2571+
Handler_read_rnd_next 27
2572+
flush status;
2573+
execute stmt1;
2574+
pla_id mat_id
2575+
102 1
2576+
101 1
2577+
100 1
2578+
104 2
2579+
103 2
2580+
105 3
2581+
show status like '%Handler_read%';
2582+
Variable_name Value
2583+
Handler_read_first 0
2584+
Handler_read_key 21
2585+
Handler_read_last 0
2586+
Handler_read_next 6
2587+
Handler_read_prev 0
2588+
Handler_read_retry 0
2589+
Handler_read_rnd 6
2590+
Handler_read_rnd_deleted 0
2591+
Handler_read_rnd_next 27
2592+
deallocate prepare stmt1;
2593+
drop table t1,t2;
25092594
set optimizer_switch=@exit_optimizer_switch;
25102595
set join_cache_level=@exit_join_cache_level;

mysql-test/r/fulltext_charsets.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set names utf8mb4;
2+
create table t1 (a int, b text, fulltext (b)) charset=utf8mb4 collate=utf8mb4_unicode_ci;
3+
insert t1 values (1000, 'C͓̙̯͔̩ͅͅi̩̘̜̲a̯̲̬̳̜̖̤o͕͓̜͓̺̖̗,̠̬͚ ̺T͇̲h͈̱e ̬̜D̖o̦̖͔̗͖̩̘c̣̼t̝͉̫̮̗o͉̫̭r̙͎̗.͓̪̥');
4+
select a from t1 where match(b) against ('ciao' in boolean mode);
5+
a
6+
1000
7+
drop table t1;

mysql-test/r/group_by.result

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,6 +2518,20 @@ MAX(i) c
25182518
7 foo
25192519
drop table t1,t2;
25202520
#
2521+
# ONLY_FULL_GROUP_BY references
2522+
#
2523+
set @save_sql_mode = @@sql_mode;
2524+
set sql_mode='ONLY_FULL_GROUP_BY';
2525+
create table t1 (a int, b int);
2526+
select a+b as x from t1 group by x having x > 1;
2527+
x
2528+
select a as x from t1 group by x having x > 1;
2529+
x
2530+
select a from t1 group by a having a > 1;
2531+
a
2532+
drop table t1;
2533+
set sql_mode= @save_sql_mode;
2534+
#
25212535
# Bug #58782
25222536
# Missing rows with SELECT .. WHERE .. IN subquery
25232537
# with full GROUP BY and no aggr

0 commit comments

Comments
 (0)