summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect.test
diff options
context:
space:
mode:
authorHe Zhenxing <hezx@mysql.com>2008-09-06 08:51:17 +0800
committerHe Zhenxing <hezx@mysql.com>2008-09-06 08:51:17 +0800
commit6e86e058230d1bfef0aa590f51987f1b6cb82512 (patch)
tree81eaef221aa476a0279c43f5e5c6df9c91924e44 /mysql-test/t/subselect.test
parente132e26b97ecc969c5f55384ed078a1c18ada2b8 (diff)
parent8eae64aab80eff72eebb9c0c2eef25ce2f5dcb46 (diff)
downloadmariadb-git-6e86e058230d1bfef0aa590f51987f1b6cb82512.tar.gz
Merge 5.1 main -> 5.1-rpl
Diffstat (limited to 'mysql-test/t/subselect.test')
-rw-r--r--mysql-test/t/subselect.test44
1 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index a9a5ef6fdae..5d6ce11edcf 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3312,4 +3312,48 @@ SELECT * FROM t1
WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
DROP TABLE t1,t2;
+#
+# 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;
--echo End of 5.1 tests.