Commit bd31ac2f authored by unknown's avatar unknown

Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.1

into sinisa.nasamreza.org:/mnt/work/mysql-4.1


sql/item_strfunc.cc:
  Auto merged
parents 38d6c6aa 2d841bda
...@@ -685,3 +685,9 @@ drop table t1; ...@@ -685,3 +685,9 @@ drop table t1;
select left(1234, 3) + 0; select left(1234, 3) + 0;
left(1234, 3) + 0 left(1234, 3) + 0
123 123
create table t1 (a int not null primary key, b varchar(40), c datetime);
insert into t1 (a,b,c) values (1,'Tom',now()),(2,'ball games',now()), (3,'Basil',now()), (4,'Dean',now()),(5,'Ellis',now()), (6,'Serg',now()), (7,'Sergei',now()),(8,'Georg',now()),(9,'Salle',now()),(10,'Sinisa',now());
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
total reg
10 2004-12-10
drop table t1;
...@@ -421,3 +421,11 @@ drop table t1; ...@@ -421,3 +421,11 @@ drop table t1;
# #
select left(1234, 3) + 0; select left(1234, 3) + 0;
#
# Bug #7101: bug with LEFT() when used as a field in GROUP BY aggregation
#
create table t1 (a int not null primary key, b varchar(40), c datetime);
insert into t1 (a,b,c) values (1,'Tom',now()),(2,'ball games',now()), (3,'Basil',now()), (4,'Dean',now()),(5,'Ellis',now()), (6,'Serg',now()), (7,'Sergei',now()),(8,'Georg',now()),(9,'Salle',now()),(10,'Sinisa',now());
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
drop table t1;
...@@ -954,8 +954,9 @@ String *Item_func_left::val_str(String *str) ...@@ -954,8 +954,9 @@ String *Item_func_left::val_str(String *str)
if (res->length() <= (uint) length || if (res->length() <= (uint) length ||
res->length() <= (char_pos= res->charpos(length))) res->length() <= (char_pos= res->charpos(length)))
return res; return res;
str_value.set(*res, 0, char_pos);
return &str_value; tmp_value.set(*res, 0, char_pos);
return &tmp_value;
} }
......
...@@ -162,6 +162,7 @@ class Item_func_ucase :public Item_str_conv ...@@ -162,6 +162,7 @@ class Item_func_ucase :public Item_str_conv
class Item_func_left :public Item_str_func class Item_func_left :public Item_str_func
{ {
String tmp_value;
public: public:
Item_func_left(Item *a,Item *b) :Item_str_func(a,b) {} Item_func_left(Item *a,Item *b) :Item_str_func(a,b) {}
String *val_str(String *); String *val_str(String *);
......
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