diff options
author | Georgi Kodinov <kgeorge@mysql.com> | 2008-08-27 18:19:22 +0300 |
---|---|---|
committer | Georgi Kodinov <kgeorge@mysql.com> | 2008-08-27 18:19:22 +0300 |
commit | 3468f4b4b34a190b8e0885e852c489f3d56e67dd (patch) | |
tree | 6e21b2c06ce85dc0bbdd8ddc1462ecc4595b1e3b /mysql-test/t/subselect.test | |
parent | 12846f416ea649aaeb13d541db7b40cdf7e70e52 (diff) | |
download | mariadb-git-3468f4b4b34a190b8e0885e852c489f3d56e67dd.tar.gz |
Bug#37548: result value erronously reported being NULL in certain subqueries
When switching to indexed ORDER BY we must be sure to reset the index read
flag if we are switching from a covering index to non-covering.
Diffstat (limited to 'mysql-test/t/subselect.test')
-rw-r--r-- | mysql-test/t/subselect.test | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index ee3a7428d4a..53257f32982 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3273,3 +3273,47 @@ INSERT INTO t1 VALUES ('a'); SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1); DROP TABLE t1; +# +# Bug #37548: result value erronously reported being NULL in certain subqueries +# + +CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY b (b)); + +INSERT INTO t1 VALUES (1,NULL), (9,NULL); + +CREATE TABLE t2 ( + a int, + b int, + c int, + d int, + PRIMARY KEY (a), + UNIQUE KEY b (b,c,d), + KEY b_2 (b), + KEY c (c), + KEY d (d) +); + +INSERT INTO t2 VALUES + (43, 2, 11 ,30), + (44, 2, 12 ,30), + (45, 1, 1 ,10000), + (46, 1, 2 ,10000), + (556,1, 32 ,10000); + +CREATE TABLE t3 ( + a int, + b int, + c int, + PRIMARY KEY (a), + UNIQUE KEY b (b,c), + KEY c (c), + KEY b_2 (b) +); + +INSERT INTO t3 VALUES (1,1,1), (2,32,1); + +explain +SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; +SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a; + +DROP TABLE t1,t2,t3; |