1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Fixed LP bug #776274,

The bug was introduced by the patch that fixed bug 717577.
This commit is contained in:
Igor Babaev
2011-05-03 17:11:45 -07:00
parent 8ac88c88f0
commit aaf9fb0de7
5 changed files with 63 additions and 9 deletions

View File

@@ -5018,3 +5018,16 @@ WHERE t7.f71>0;
f23
DROP TABLE t1,t2,t3,t4,t5,t6,t7;
End of 5.1 tests
#
# BUG#776274: substitution of a single row table
#
CREATE TABLE t1 (a int NOT NULL , b int);
INSERT INTO t1 VALUES (2,2);
SELECT * FROM t1 WHERE a = b;
a b
2 2
EXPLAIN
SELECT * FROM t1 WHERE a = b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
DROP TABLE t1;

View File

@@ -5025,6 +5025,19 @@ WHERE t7.f71>0;
f23
DROP TABLE t1,t2,t3,t4,t5,t6,t7;
End of 5.1 tests
#
# BUG#776274: substitution of a single row table
#
CREATE TABLE t1 (a int NOT NULL , b int);
INSERT INTO t1 VALUES (2,2);
SELECT * FROM t1 WHERE a = b;
a b
2 2
EXPLAIN
SELECT * FROM t1 WHERE a = b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
DROP TABLE t1;
set join_cache_level=default;
show variables like 'join_cache_level';
Variable_name Value

View File

@@ -5018,3 +5018,16 @@ WHERE t7.f71>0;
f23
DROP TABLE t1,t2,t3,t4,t5,t6,t7;
End of 5.1 tests
#
# BUG#776274: substitution of a single row table
#
CREATE TABLE t1 (a int NOT NULL , b int);
INSERT INTO t1 VALUES (2,2);
SELECT * FROM t1 WHERE a = b;
a b
2 2
EXPLAIN
SELECT * FROM t1 WHERE a = b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
DROP TABLE t1;

View File

@@ -4211,3 +4211,17 @@ SELECT t2.f23 FROM
DROP TABLE t1,t2,t3,t4,t5,t6,t7;
--echo End of 5.1 tests
--echo #
--echo # BUG#776274: substitution of a single row table
--echo #
CREATE TABLE t1 (a int NOT NULL , b int);
INSERT INTO t1 VALUES (2,2);
SELECT * FROM t1 WHERE a = b;
EXPLAIN
SELECT * FROM t1 WHERE a = b;
DROP TABLE t1;

View File

@@ -5740,18 +5740,19 @@ void Item_equal::update_const()
List_iterator<Item> it(equal_items);
if (with_const)
it++;
Item *item= it++;
while (item)
Item *item;
while ((item= it++))
{
if (item->const_item())
{
it.remove();
Item *next_item= it++;
add_const(item);
item= next_item;
}
else
item= it++;
if (item == equal_items.head())
with_const= TRUE;
else
{
it.remove();
add_const(item);
}
}
}
}