Commit 24332108 authored by igor@rurik.mysql.com's avatar igor@rurik.mysql.com

join_outer.test, join_outer.result:

  Added test cases for bug #9938.
item.h:
  Fixed bug #9938: missing method not_null_tables for Item_ref.
parent 01fcf04d
...@@ -957,3 +957,21 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -957,3 +957,21 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY,id PRIMARY 14 const,const,const,const 1 Using index 1 SIMPLE t2 const PRIMARY,id PRIMARY 14 const,const,const,const 1 Using index
1 SIMPLE t3 const PRIMARY PRIMARY 3 const,const 1 1 SIMPLE t3 const PRIMARY PRIMARY 3 const,const 1
drop tables t1,t2,t3; drop tables t1,t2,t3;
CREATE TABLE t1 (EMPNUM INT, GRP INT);
INSERT INTO t1 VALUES (0, 10);
INSERT INTO t1 VALUES (2, 30);
CREATE TABLE t2 (EMPNUM INT, NAME CHAR(5));
INSERT INTO t2 VALUES (0, 'KERI');
INSERT INTO t2 VALUES (9, 'BARRY');
CREATE VIEW v1 AS
SELECT COALESCE(t2.EMPNUM,t1.EMPNUM) AS EMPNUM, NAME, GRP
FROM t2 LEFT OUTER JOIN t1 ON t2.EMPNUM=t1.EMPNUM;
SELECT * FROM v1;
EMPNUM NAME GRP
0 KERI 10
9 BARRY NULL
SELECT * FROM v1 WHERE EMPNUM < 10;
EMPNUM NAME GRP
0 KERI 10
9 BARRY NULL
DROP TABLE t1,t2;
...@@ -676,3 +676,26 @@ left join t3 on t1.art = t3.id where t2.id =1 and t2.x = -5 and t2.y =-8 ...@@ -676,3 +676,26 @@ left join t3 on t1.art = t3.id where t2.id =1 and t2.x = -5 and t2.y =-8
and t1.gid =1 and t2.gid =1 and t3.set_id =1; and t1.gid =1 and t2.gid =1 and t3.set_id =1;
drop tables t1,t2,t3; drop tables t1,t2,t3;
#
# Test for bug #9938: invalid conversion from outer join to inner join
# for queries containing indirect reference in WHERE clause
#
CREATE TABLE t1 (EMPNUM INT, GRP INT);
INSERT INTO t1 VALUES (0, 10);
INSERT INTO t1 VALUES (2, 30);
CREATE TABLE t2 (EMPNUM INT, NAME CHAR(5));
INSERT INTO t2 VALUES (0, 'KERI');
INSERT INTO t2 VALUES (9, 'BARRY');
CREATE VIEW v1 AS
SELECT COALESCE(t2.EMPNUM,t1.EMPNUM) AS EMPNUM, NAME, GRP
FROM t2 LEFT OUTER JOIN t1 ON t2.EMPNUM=t1.EMPNUM;
SELECT * FROM v1;
SELECT * FROM v1 WHERE EMPNUM < 10;
DROP TABLE t1,t2;
...@@ -1325,6 +1325,7 @@ public: ...@@ -1325,6 +1325,7 @@ public:
{ {
return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables(); return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables();
} }
table_map not_null_tables() const { return (*ref)->not_null_tables(); }
void set_result_field(Field *field) { result_field= field; } void set_result_field(Field *field) { result_field= field; }
bool is_result_field() { return 1; } bool is_result_field() { return 1; }
void save_in_result_field(bool no_conversions) void save_in_result_field(bool no_conversions)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment