Commit 18d722ff authored by hf@deer.(none)'s avatar hf@deer.(none)

Merging

parents b0491594 dff5b0a7
...@@ -1569,6 +1569,16 @@ INSERT INTO t2 VALUES (100, 200, 'C'); ...@@ -1569,6 +1569,16 @@ INSERT INTO t2 VALUES (100, 200, 'C');
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1); SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
COLC COLC
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
(SELECT a)
1
2
3
4
5
DROP TABLE t1;
create table t1 (a int, b decimal(13, 3)); create table t1 (a int, b decimal(13, 3));
insert into t1 values (1, 0.123); insert into t1 values (1, 0.123);
select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1; select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
......
...@@ -1010,6 +1010,11 @@ INSERT INTO t2 VALUES (100, 200, 'C'); ...@@ -1010,6 +1010,11 @@ INSERT INTO t2 VALUES (100, 200, 'C');
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1); SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
DROP TABLE t1;
# #
# Bug 2198 # Bug 2198
# #
...@@ -1060,3 +1065,4 @@ select sum(a) from (select * from t1) as a; ...@@ -1060,3 +1065,4 @@ select sum(a) from (select * from t1) as a;
select 2 in (select * from t1); select 2 in (select * from t1);
SET SQL_SELECT_LIMIT=default; SET SQL_SELECT_LIMIT=default;
drop table t1; drop table t1;
...@@ -198,6 +198,12 @@ bool Item_subselect::const_item() const ...@@ -198,6 +198,12 @@ bool Item_subselect::const_item() const
return const_item_cache; return const_item_cache;
} }
Item *Item_subselect::get_tmp_table_item(THD *thd)
{
if (!with_sum_func && !const_item())
return new Item_field(result_field);
return copy_or_same(thd);
}
void Item_subselect::update_used_tables() void Item_subselect::update_used_tables()
{ {
......
...@@ -99,6 +99,7 @@ class Item_subselect :public Item_result_field ...@@ -99,6 +99,7 @@ class Item_subselect :public Item_result_field
bool const_item() const; bool const_item() const;
inline table_map get_used_tables_cache() { return used_tables_cache; } inline table_map get_used_tables_cache() { return used_tables_cache; }
inline bool get_const_item_cache() { return const_item_cache; } inline bool get_const_item_cache() { return const_item_cache; }
Item *get_tmp_table_item(THD *thd);
void update_used_tables(); void update_used_tables();
void print(String *str); void print(String *str);
bool change_engine(subselect_engine *eng) bool change_engine(subselect_engine *eng)
......
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