Commit baa1f18e authored by unknown's avatar unknown

Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt

into  moonbone.local:/mnt/gentoo64/work/28494-bug-5.0-opt-mysql
parents 03ad7c22 f2fb7e78
...@@ -317,3 +317,10 @@ SHOW COUNT(*) WARNINGS; ...@@ -317,3 +317,10 @@ SHOW COUNT(*) WARNINGS;
SHOW COUNT(*) ERRORS; SHOW COUNT(*) ERRORS;
@@session.error_count @@session.error_count
1 1
create table t1(f1 int);
insert into t1 values(1),(1),(2);
select @a:=f1, count(f1) from t1 group by 1;
@a:=f1 count(f1)
1 2
2 1
drop table t1;
...@@ -222,3 +222,11 @@ drop table t1,t2; ...@@ -222,3 +222,11 @@ drop table t1,t2;
insert into city 'blah'; insert into city 'blah';
SHOW COUNT(*) WARNINGS; SHOW COUNT(*) WARNINGS;
SHOW COUNT(*) ERRORS; SHOW COUNT(*) ERRORS;
#
# Bug#28494: Grouping by Item_func_set_user_var produces incorrect result.
#
create table t1(f1 int);
insert into t1 values(1),(1),(2);
select @a:=f1, count(f1) from t1 group by 1;
drop table t1;
...@@ -4290,9 +4290,11 @@ void Item_func_set_user_var::make_field(Send_field *tmp_field) ...@@ -4290,9 +4290,11 @@ void Item_func_set_user_var::make_field(Send_field *tmp_field)
TRUE Error TRUE Error
*/ */
int Item_func_set_user_var::save_in_field(Field *field, bool no_conversions) int Item_func_set_user_var::save_in_field(Field *field, bool no_conversions,
bool can_use_result_field)
{ {
bool use_result_field= (result_field && result_field != field); bool use_result_field= (!can_use_result_field ? 0 :
(result_field && result_field != field));
int error; int error;
/* Update the value of the user variable */ /* Update the value of the user variable */
......
...@@ -1220,7 +1220,13 @@ class Item_func_set_user_var :public Item_func ...@@ -1220,7 +1220,13 @@ class Item_func_set_user_var :public Item_func
void print(String *str); void print(String *str);
void print_as_stmt(String *str); void print_as_stmt(String *str);
const char *func_name() const { return "set_user_var"; } const char *func_name() const { return "set_user_var"; }
int save_in_field(Field *field, bool no_conversions); int save_in_field(Field *field, bool no_conversions,
bool can_use_result_field);
int save_in_field(Field *field, bool no_conversions)
{
return save_in_field(field, no_conversions, 1);
}
void save_org_in_field(Field *field) { (void)save_in_field(field, 1, 0); }
}; };
......
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