Skip to content

Commit baf00fc

Browse files
committed
Merge remote-tracking branch 'origin/10.11' into 11.0
2 parents 5f6e987 + 725bd56 commit baf00fc

Some content is hidden

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

41 files changed

+1072
-297
lines changed

mysql-test/main/having_cond_pushdown.result

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5986,12 +5986,8 @@ SELECT * FROM t1 GROUP BY i HAVING i IN ( i IS NULL);
59865986
i
59875987
SELECT * FROM t1 GROUP BY i HAVING i IN ( i IS NULL AND 'x' = 0);
59885988
i
5989-
Warnings:
5990-
Warning 1292 Truncated incorrect DECIMAL value: 'x'
59915989
SELECT * FROM t1 GROUP BY i HAVING i='1' IN ( i IS NULL AND 'x' = 0);
59925990
i
5993-
Warnings:
5994-
Warning 1292 Truncated incorrect DECIMAL value: 'x'
59955991
DROP TABLE t1;
59965992
#
59975993
# MDEV-28080: HAVING with NOT EXIST predicate in an equality

mysql-test/main/prepare.result

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,38 @@ drop table t1, t2, t3;
8080
#
8181
# End of 10.4 tests
8282
#
83+
#
84+
# MDEV-9938 Prepared statement return wrong result (missing row)
85+
#
86+
CREATE TABLE t1 (a_id INT AUTO_INCREMENT PRIMARY KEY, a_text VARCHAR(20));
87+
CREATE TABLE t2 (b_id INT AUTO_INCREMENT PRIMARY KEY, b_a_id INT);
88+
INSERT INTO t1 VALUES (NULL, 'word1');
89+
INSERT INTO t2 VALUES (NULL, 1), (NULL, NULL);
90+
PREPARE q FROM 'SELECT * FROM t2
91+
LEFT JOIN t1 ON (t1.a_id = t2.b_a_id)
92+
WHERE ((? IS NULL) OR (t1.a_text = ?))';
93+
SET @var = 'word1';
94+
expect row count 1
95+
EXECUTE q USING @var, @var;
96+
b_id b_a_id a_id a_text
97+
1 1 1 word1
98+
expect row count = 2
99+
EXECUTE q USING @nul, @nul;
100+
b_id b_a_id a_id a_text
101+
1 1 1 word1
102+
2 NULL NULL NULL
103+
PREPARE q2 FROM 'SELECT * FROM t2
104+
LEFT JOIN t1 ON (t1.a_id = t2.b_a_id)
105+
WHERE ((? IS NULL) OR (t1.a_text = ?))';
106+
expect row count 2
107+
SET @var = 'word1';
108+
EXECUTE q2 USING @nul, @nul;
109+
b_id b_a_id a_id a_text
110+
1 1 1 word1
111+
2 NULL NULL NULL
112+
deallocate prepare q;
113+
deallocate prepare q2;
114+
drop table t1,t2;
115+
#
116+
# End of 10.6 tests
117+
#

mysql-test/main/prepare.test

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,39 @@ drop table t1, t2, t3;
6969
--echo #
7070
--echo # End of 10.4 tests
7171
--echo #
72+
73+
--echo #
74+
--echo # MDEV-9938 Prepared statement return wrong result (missing row)
75+
--echo #
76+
77+
CREATE TABLE t1 (a_id INT AUTO_INCREMENT PRIMARY KEY, a_text VARCHAR(20));
78+
CREATE TABLE t2 (b_id INT AUTO_INCREMENT PRIMARY KEY, b_a_id INT);
79+
80+
INSERT INTO t1 VALUES (NULL, 'word1');
81+
INSERT INTO t2 VALUES (NULL, 1), (NULL, NULL);
82+
83+
PREPARE q FROM 'SELECT * FROM t2
84+
LEFT JOIN t1 ON (t1.a_id = t2.b_a_id)
85+
WHERE ((? IS NULL) OR (t1.a_text = ?))';
86+
87+
SET @var = 'word1';
88+
--echo expect row count 1
89+
EXECUTE q USING @var, @var;
90+
--echo expect row count = 2
91+
EXECUTE q USING @nul, @nul;
92+
93+
PREPARE q2 FROM 'SELECT * FROM t2
94+
LEFT JOIN t1 ON (t1.a_id = t2.b_a_id)
95+
WHERE ((? IS NULL) OR (t1.a_text = ?))';
96+
97+
--echo expect row count 2
98+
SET @var = 'word1';
99+
EXECUTE q2 USING @nul, @nul;
100+
101+
deallocate prepare q;
102+
deallocate prepare q2;
103+
drop table t1,t2;
104+
105+
--echo #
106+
--echo # End of 10.6 tests
107+
--echo #

mysql-test/main/ps.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4092,9 +4092,16 @@ DROP TABLE t1, t2;
40924092
#
40934093
CREATE TABLE t1 (a INT);
40944094
PREPARE stmt FROM "SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1";
4095+
execute stmt;
4096+
1
4097+
SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
4098+
1
4099+
insert into t1 values(1),(2);
4100+
execute stmt;
40954101
ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 + 1'
40964102
SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
40974103
ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 + 1'
4104+
deallocate prepare stmt;
40984105
drop table t1;
40994106
# End of 5.3 tests
41004107
#

mysql-test/main/ps.test

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3632,12 +3632,16 @@ DROP TABLE t1, t2;
36323632
--echo # with out of range in GROUP BY
36333633
--echo #
36343634
CREATE TABLE t1 (a INT);
3635-
3636-
--error ER_DATA_OUT_OF_RANGE
36373635
PREPARE stmt FROM "SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1";
3636+
execute stmt;
3637+
SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
3638+
insert into t1 values(1),(2);
3639+
--error ER_DATA_OUT_OF_RANGE
3640+
execute stmt;
36383641
--error ER_DATA_OUT_OF_RANGE
36393642
SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
36403643

3644+
deallocate prepare stmt;
36413645
drop table t1;
36423646

36433647
--echo # End of 5.3 tests

mysql-test/main/range.result

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,8 +1637,6 @@ NULL
16371637
Warnings:
16381638
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
16391639
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
1640-
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
1641-
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
16421640
SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20';
16431641
str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'
16441642
1

mysql-test/main/range_mrr_icp.result

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,8 +1640,6 @@ NULL
16401640
Warnings:
16411641
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
16421642
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
1643-
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
1644-
Warning 1411 Incorrect datetime value: '2007-20-00' for function str_to_date
16451643
SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20';
16461644
str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'
16471645
1

mysql-test/main/show_analyze.result

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,3 +440,42 @@ ANALYZE
440440
}
441441
}
442442
DROP TABLE t1;
443+
#
444+
# MDEV-31432 tmp_table field accessed after free
445+
# testing for the above (MDEV-28201) caused use after free error
446+
#
447+
create table t1 (x int) engine=myisam;
448+
insert into t1 values(1);
449+
set @tmp=@@optimizer_trace;
450+
set @@optimizer_trace=1;
451+
SELECT
452+
1 IN
453+
((
454+
SELECT
455+
1 IN (SELECT 1 AS x0
456+
FROM
457+
(
458+
SELECT *
459+
FROM (SELECT 1 AS x) AS x5
460+
GROUP BY x,x
461+
HAVING
462+
x IN (
463+
SELECT *
464+
FROM t1 AS x1
465+
WHERE
466+
x IN (SELECT 1 AS x
467+
FROM t1 AS x3
468+
GROUP BY x
469+
HAVING
470+
x IN (SELECT 0 FROM t1 AS x4)
471+
)
472+
)
473+
) AS x6
474+
)
475+
FROM
476+
t1
477+
)) as VAL;
478+
VAL
479+
0
480+
set optimizer_trace=@tmp;
481+
drop table t1;

mysql-test/main/show_analyze.test

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,44 @@ ANALYZE format=json
364364
SELECT 1 FROM t1 GROUP BY convert_tz('1969-12-31 22:00:00',a,'+10:00');
365365
DROP TABLE t1;
366366

367+
--echo #
368+
--echo # MDEV-31432 tmp_table field accessed after free
369+
--echo # testing for the above (MDEV-28201) caused use after free error
370+
--echo #
371+
create table t1 (x int) engine=myisam;
372+
insert into t1 values(1);
373+
set @tmp=@@optimizer_trace;
374+
set @@optimizer_trace=1;
375+
# Different warning text is produced in regular and --ps-protocol runs:
376+
--disable_warnings
377+
SELECT
378+
1 IN
379+
((
380+
SELECT
381+
1 IN (SELECT 1 AS x0
382+
FROM
383+
(
384+
SELECT *
385+
FROM (SELECT 1 AS x) AS x5
386+
GROUP BY x,x
387+
HAVING
388+
x IN (
389+
SELECT *
390+
FROM t1 AS x1
391+
WHERE
392+
x IN (SELECT 1 AS x
393+
FROM t1 AS x3
394+
GROUP BY x
395+
HAVING
396+
x IN (SELECT 0 FROM t1 AS x4)
397+
)
398+
)
399+
) AS x6
400+
)
401+
FROM
402+
t1
403+
)) as VAL;
404+
--enable_warnings
405+
set optimizer_trace=@tmp;
406+
drop table t1;
407+

mysql-test/main/subselect_exists2in.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
338338
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
339339
Warnings:
340340
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
341-
Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
341+
Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in ( <materialize> (/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), <primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
342342
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
343343
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
344344
1
@@ -352,7 +352,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
352352
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
353353
Warnings:
354354
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
355-
Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
355+
Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in ( <materialize> (/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), <primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
356356
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
357357
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
358358
1

0 commit comments

Comments
 (0)