mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Fixed LP bug #776295.
If the value of the flag cond_false of an Item_equal object is true then the print method must return the string '0'.
This commit is contained in:
@@ -298,3 +298,18 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
End of 5.1 tests.
|
End of 5.1 tests.
|
||||||
|
#
|
||||||
|
# Bug#776295: EXPLAIN EXTENDED with always false multiple equality
|
||||||
|
# in the WHERE condition of a derived table
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a int) ;
|
||||||
|
CREATE TABLE t2 (a int) ;
|
||||||
|
INSERT INTO t2 VALUES (8);
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM ( SELECT t1.a FROM t1,t2 WHERE t2.a = t1.a ) AS t;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 0.00 const row not found
|
||||||
|
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select NULL AS `a` from (select NULL AS `a` from `test`.`t1` join `test`.`t2` where 0) `t`
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
@@ -1302,7 +1302,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
|
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
|
||||||
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
|
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select '1' AS `f1`,NULL AS `f2`,'3' AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t1` left join `test`.`t2` on(multiple equal(NULL)) where ((coalesce('1',NULL),'3') in ((1,3),(2,2)))
|
Note 1003 select '1' AS `f1`,NULL AS `f2`,'3' AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t1` left join `test`.`t2` on(0) where ((coalesce('1',NULL),'3') in ((1,3),(2,2)))
|
||||||
SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
|
SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
|
||||||
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
|
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
|
||||||
f1 f2 f3 f1 f2
|
f1 f2 f3 f1 f2
|
||||||
|
@@ -1309,7 +1309,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
|
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
|
||||||
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
|
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select '1' AS `f1`,NULL AS `f2`,'3' AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t1` left join `test`.`t2` on(multiple equal(NULL)) where ((coalesce('1',NULL),'3') in ((1,3),(2,2)))
|
Note 1003 select '1' AS `f1`,NULL AS `f2`,'3' AS `f3`,NULL AS `f1`,NULL AS `f2` from `test`.`t1` left join `test`.`t2` on(0) where ((coalesce('1',NULL),'3') in ((1,3),(2,2)))
|
||||||
SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
|
SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
|
||||||
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
|
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
|
||||||
f1 f2 f3 f1 f2
|
f1 f2 f3 f1 f2
|
||||||
|
@@ -265,3 +265,19 @@ DEALLOCATE PREPARE stmt;
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo End of 5.1 tests.
|
--echo End of 5.1 tests.
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#776295: EXPLAIN EXTENDED with always false multiple equality
|
||||||
|
--echo # in the WHERE condition of a derived table
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int) ;
|
||||||
|
|
||||||
|
CREATE TABLE t2 (a int) ;
|
||||||
|
INSERT INTO t2 VALUES (8);
|
||||||
|
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM ( SELECT t1.a FROM t1,t2 WHERE t2.a = t1.a ) AS t;
|
||||||
|
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
|
||||||
|
@@ -5923,6 +5923,11 @@ Item *Item_equal::transform(Item_transformer transformer, uchar *arg)
|
|||||||
|
|
||||||
void Item_equal::print(String *str, enum_query_type query_type)
|
void Item_equal::print(String *str, enum_query_type query_type)
|
||||||
{
|
{
|
||||||
|
if (cond_false)
|
||||||
|
{
|
||||||
|
str->append('0');
|
||||||
|
return;
|
||||||
|
}
|
||||||
str->append(func_name());
|
str->append(func_name());
|
||||||
str->append('(');
|
str->append('(');
|
||||||
List_iterator_fast<Item> it(equal_items);
|
List_iterator_fast<Item> it(equal_items);
|
||||||
|
Reference in New Issue
Block a user