From c0f31dc9f3e0a42911beb6655a40601d2fddfe8e Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Thu, 21 Nov 2013 15:19:25 -0800 Subject: Another attempt to fix bug mdev-5103. The earlier pushed fix for the bug was incomplete. It did not remove the main cause of the problem: the function remove_eq_conds() removed always true multiple equalities from any conjunct, but did not adjust the list of them stored in Item_cond_and::cond_equal.current_level. Simplified the test case for the bug and moved it to another test file. The fix triggered changes in EXPLAIN EXTENDED for some queries. --- mysql-test/t/subselect4.test | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'mysql-test/t/subselect4.test') diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index 51247e2c3ea..ad0e135f37e 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -1910,7 +1910,31 @@ WHERE b IS NULL OR a < 'u'; drop table t1,t2; set @@optimizer_switch = @optimizer_switch_MDEV4056; +--echo # +--echo # MDEV-5103: server crashed on singular Item_equal +--echo # + +CREATE TABLE t1 ( + a enum('p','r') NOT NULL DEFAULT 'r', + b int NOT NULL DEFAULT '0', + c char(32) NOT NULL, + d varchar(255) NOT NULL, + PRIMARY KEY (a, b), UNIQUE KEY idx(a, c) +); +INSERT INTO t1 VALUES ('r', 1, 'ad18832202b199728921807033a8a515', '001_cbr643'); + +CREATE TABLE t2 ( + a enum('p','r') NOT NULL DEFAULT 'r', + b int NOT NULL DEFAULT '0', + e datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (a, b, e) +); +INSERT INTO t2 VALUES ('r', 1, '2013-10-05 14:25:30'); + +SELECT * FROM t1 AS t + WHERE a='r' AND (c,b) NOT IN (SELECT c,b FROM t2 WHERE (c,b)=(t.c,t.b)); +DROP TABLE t1, t2; SET optimizer_switch= @@global.optimizer_switch; set @@tmp_table_size= @@global.tmp_table_size; -- cgit v1.2.1