summaryrefslogtreecommitdiff
path: root/mysql-test/r/explain.result
diff options
context:
space:
mode:
authorEvgeny Potemkin <epotemkin@mysql.com>2008-11-05 18:40:23 +0300
committerEvgeny Potemkin <epotemkin@mysql.com>2008-11-05 18:40:23 +0300
commit3c49cb0795fae5c43d00a499b1d4f71365bb9ba9 (patch)
treea52cac0068f7fecdc739e890dc0bc688ece7ae3c /mysql-test/r/explain.result
parentc8ee385d89338cca73dd069c7c03074d171cc8f4 (diff)
downloadmariadb-git-3c49cb0795fae5c43d00a499b1d4f71365bb9ba9.tar.gz
Bug#37870: Usage of uninitialized value caused failed assertion.
The convert_constant_item function converts a constant to integer using field for condition like 'field = a_constant'. In some cases the convert_constant_item is called for a subquery when outer select is already being executed, so convert_constant_item saves field's value to prevent its corruption. For EXPLAIN and at the prepare phase field's value isn't initialized yet, thus when convert_constant_item tries to restore saved value it fails assertion. Now the convert_constant_item doesn't save/restore field's value if it's haven't been read yet. Outer constant values are always saved. mysql-test/r/explain.result: Added a test case for the bug#37870. mysql-test/t/explain.test: Added a test case for the bug#37870. sql/item_cmpfunc.cc: Bug#37870: Usage of uninitialized value caused failed assertion. Now the convert_constant_item doesn't save/restore field's value if it's haven't been read yet. Outer constant values are always saved.
Diffstat (limited to 'mysql-test/r/explain.result')
-rw-r--r--mysql-test/r/explain.result16
1 files changed, 14 insertions, 2 deletions
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index ee3a4ba3387..3de741b5efb 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -158,15 +158,27 @@ DROP TABLE t1,t2;
#
# Bug#37870: Usage of uninitialized value caused failed assertion.
#
-create table t1 (dt datetime not null);
+create table t1 (dt datetime not null, t time not null);
create table t2 (dt datetime not null);
-insert into t1 values ('2001-01-01 1:1:1'), ('2001-01-01 1:1:1');
+insert into t1 values ('2001-01-01 1:1:1', '1:1:1'),
+('2001-01-01 1:1:1', '1:1:1');
insert into t2 values ('2001-01-01 1:1:1'), ('2001-01-01 1:1:1');
flush tables;
EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY OUTR ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY INNR ALL NULL NULL NULL NULL 2 Using where
+flush tables;
SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL );
dt
+flush tables;
+EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY OUTR ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY INNR ALL NULL NULL NULL NULL 2 Using where
+flush tables;
+SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
+dt
+2001-01-01 01:01:01
+2001-01-01 01:01:01
drop tables t1, t2;