summaryrefslogtreecommitdiff
path: root/mysql-test/r/join_nested.result
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2005-08-05 16:43:35 -0700
committerunknown <igor@rurik.mysql.com>2005-08-05 16:43:35 -0700
commit4811f7bd1e71d57a2308c2bfbe45540ed829ebc9 (patch)
tree1e460e028d8cf42ffc76edcbd86bb247490ef83d /mysql-test/r/join_nested.result
parente13fa8ebbb095970b9a5a206001eeb06273567de (diff)
downloadmariadb-git-4811f7bd1e71d57a2308c2bfbe45540ed829ebc9.tar.gz
mysql_priv.h:
Fixed bug #12154: a query returned: Column <name> cannot be null. The problem was due to a bug in the function setup_table_map: the flag maybe_null was set up incorrectly for inner tables of nested outer joins. join_nested.result, join_nested.test: Added a test case for bug #12154. mysql-test/t/join_nested.test: Added a test case for bug #12154. mysql-test/r/join_nested.result: Added a test case for bug #12154. sql/mysql_priv.h: Fixed bug #12154: a query returned: Column <name> cannot be null. The problem was due to a bug in the function setup_table_map: the flag maybe_null was set up incorrectly for inner tables of nested outer joins.
Diffstat (limited to 'mysql-test/r/join_nested.result')
-rw-r--r--mysql-test/r/join_nested.result55
1 files changed, 55 insertions, 0 deletions
diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result
index 27edac1b30b..1fd7e6f4390 100644
--- a/mysql-test/r/join_nested.result
+++ b/mysql-test/r/join_nested.result
@@ -1343,3 +1343,58 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 0
1 SIMPLE t3 ALL NULL NULL NULL NULL 0
DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (goods int(12) NOT NULL, price varchar(128) NOT NULL);
+INSERT INTO t1 VALUES (23, 2340), (26, 9900);
+CREATE TABLE t2 (goods int(12), name varchar(50), shop char(2));
+INSERT INTO t2 VALUES (23, 'as300', 'fr'), (26, 'as600', 'fr');
+create table t3 (groupid int(12) NOT NULL, goodsid int(12) NOT NULL);
+INSERT INTO t3 VALUES (3,23), (6,26);
+CREATE TABLE t4 (groupid int(12));
+INSERT INTO t4 VALUES (1), (2), (3), (4), (5), (6);
+SELECT * FROM
+(SELECT DISTINCT gl.groupid, gp.price
+FROM t4 gl
+LEFT JOIN
+(t3 g INNER JOIN t2 p ON g.goodsid = p.goods
+INNER JOIN t1 gp ON p.goods = gp.goods)
+ON gl.groupid = g.groupid and p.shop = 'fr') t;
+groupid price
+1 NULL
+2 NULL
+3 2340
+4 NULL
+5 NULL
+6 9900
+CREATE VIEW v1 AS
+SELECT g.groupid groupid, p.goods goods,
+p.name name, p.shop shop,
+gp.price price
+FROM t3 g INNER JOIN t2 p ON g.goodsid = p.goods
+INNER JOIN t1 gp on p.goods = gp.goods;
+CREATE VIEW v2 AS
+SELECT DISTINCT g.groupid, fr.price
+FROM t4 g
+LEFT JOIN
+v1 fr on g.groupid = fr.groupid and fr.shop = 'fr';
+SELECT * FROM v2;
+groupid price
+1 NULL
+2 NULL
+3 2340
+4 NULL
+5 NULL
+6 9900
+SELECT * FROM
+(SELECT DISTINCT g.groupid, fr.price
+FROM t4 g
+LEFT JOIN
+v1 fr on g.groupid = fr.groupid and fr.shop = 'fr') t;
+groupid price
+1 NULL
+2 NULL
+3 2340
+4 NULL
+5 NULL
+6 9900
+DROP VIEW v1,v2;
+DROP TABLE t1,t2,t3,t4;