Commit 8b01230e authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

fix of Item_ref with result_field (BUG#5104)

parent a5f063e0
......@@ -1116,3 +1116,21 @@ c1 c2
7 almost real Beer
drop view v1;
drop table t1;
create table t1 (a int);
insert into t1 values (1),(1),(2),(2),(3),(3);
create view v1 as select a from t1;
select distinct a from v1;
a
1
2
3
select distinct a from v1 limit 2;
a
1
2
select distinct a from t1 limit 2;
a
1
2
drop view v1;
drop table t1;
......@@ -1066,3 +1066,15 @@ CREATE VIEW v1 AS SELECT * from t1 WHERE match (c2) against ('Beer');
select * from v1;
drop view v1;
drop table t1;
#
# distinct in temporary table with a VIEW
#
create table t1 (a int);
insert into t1 values (1),(1),(2),(2),(3),(3);
create view v1 as select a from t1;
select distinct a from v1;
select distinct a from v1 limit 2;
select distinct a from t1 limit 2;
drop view v1;
drop table t1;
......@@ -2156,6 +2156,14 @@ void Item_ref::print(String *str)
}
bool Item_ref::send(Protocol *prot, String *tmp)
{
if (result_field)
return prot->store(result_field);
return (*ref)->send(prot, tmp);
}
void Item_ref_null_helper::print(String *str)
{
str->append("<ref_null_helper>(", 18);
......
......@@ -964,7 +964,7 @@ class Item_ref :public Item_ident
{
return (null_value=(*ref)->get_date_result(ltime,fuzzydate));
}
bool send(Protocol *prot, String *tmp){ return (*ref)->send(prot, tmp); }
bool send(Protocol *prot, String *tmp);
void make_field(Send_field *field) { (*ref)->make_field(field); }
bool fix_fields(THD *, struct st_table_list *, Item **);
int save_in_field(Field *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