mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed LP bug #707555.
The bug was in the code of the patch fixing bug 698882. With improper casting the method store_key_field::change_source_field was called for the elements of the array TABLE_REF::key_copy that were either of a different type or not allocated at all. This caused crashes in some queries.
This commit is contained in:
@ -4977,4 +4977,44 @@ a1 b1 a2 b2 a3 b3
|
||||
2 xx 2 yy 2 zzz
|
||||
SET SESSION optimizer_switch=DEFAULT;
|
||||
DROP TABLE t1,t2,t3;
|
||||
#
|
||||
# Bug #707555: crash with equality substitution in ref
|
||||
#
|
||||
CREATE TABLE t1 (f11 int, f12 int, PRIMARY KEY (f11), KEY (f12)) ;
|
||||
INSERT INTO t1 VALUES (1,NULL), (8,NULL);
|
||||
CREATE TABLE t2 (f21 int, f22 int, f23 int, KEY (f22)) ;
|
||||
INSERT INTO t2 VALUES (1,NULL,3), (2,7,8);
|
||||
CREATE TABLE t3 (f31 int, f32 int(11), PRIMARY KEY (f31), KEY (f32)) ;
|
||||
INSERT INTO t3 VALUES (1,494862336);
|
||||
CREATE TABLE t4 (f41 int, f42 int, PRIMARY KEY (f41), KEY (f42)) ;
|
||||
INSERT INTO t4 VALUES (1,NULL), (8,NULL);
|
||||
CREATE TABLE t5 (f51 int, PRIMARY KEY (f51)) ;
|
||||
INSERT IGNORE INTO t5 VALUES (100);
|
||||
CREATE TABLE t6 (f61 int, f62 int, KEY (f61)) ;
|
||||
INSERT INTO t6 VALUES (NULL,1), (3,10);
|
||||
CREATE TABLE t7 (f71 int, f72 int, KEY (f72)) ;
|
||||
INSERT INTO t7 VALUES (1,NULL), (2,7);
|
||||
EXPLAIN
|
||||
SELECT t2.f23 FROM
|
||||
(t1 LEFT JOIN (t2 JOIN t3 ON t2.f22=t3.f32) ON t1.f11=t3.f31)
|
||||
LEFT JOIN
|
||||
(((t4 JOIN t5 ON t4.f42=t5.f51) LEFT JOIN t6 ON t6.f62>0) JOIN t7 ON t6.f61>0)
|
||||
ON t3.f31 = t6.f61
|
||||
WHERE t7.f71>0;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 system PRIMARY,f32 NULL NULL NULL 1
|
||||
1 SIMPLE t5 system PRIMARY NULL NULL NULL 1
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
1 SIMPLE t2 ref f22 f22 5 const 1
|
||||
1 SIMPLE t6 ref f61 f61 5 const 1 Using where
|
||||
1 SIMPLE t4 ref f42 f42 5 const 1 Using index
|
||||
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
SELECT t2.f23 FROM
|
||||
(t1 LEFT JOIN (t2 JOIN t3 ON t2.f22=t3.f32) ON t1.f11=t3.f31)
|
||||
LEFT JOIN
|
||||
(((t4 JOIN t5 ON t4.f42=t5.f51) LEFT JOIN t6 ON t6.f62>0) JOIN t7 ON t6.f61>0)
|
||||
ON t3.f31 = t6.f61
|
||||
WHERE t7.f71>0;
|
||||
f23
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6,t7;
|
||||
End of 5.1 tests
|
||||
|
Reference in New Issue
Block a user