diff options
author | unknown <evgen@moonbone.local> | 2007-06-03 16:06:55 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2007-06-03 16:06:55 +0400 |
commit | 687191a0783408cb5f2ca44a81d6e6c89f755e17 (patch) | |
tree | 20ca6dbe497dce42cebd5e4623271a320c38c24b | |
parent | 8b0afa63fb2d42bea3f992a57e8ebb883d914bee (diff) | |
parent | e19dcfa91f63a7ff310a11a00ac670a04dfdd1fb (diff) | |
download | mariadb-git-687191a0783408cb5f2ca44a81d6e6c89f755e17.tar.gz |
Merge moonbone.local:/mnt/gentoo64/work/test-5.0-opt-mysql
into moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
mysql-test/r/user_var.result:
Auto merged
mysql-test/t/user_var.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
-rw-r--r-- | mysql-test/r/user_var.result | 25 | ||||
-rw-r--r-- | mysql-test/t/user_var.test | 10 | ||||
-rw-r--r-- | sql/item_func.cc | 4 | ||||
-rw-r--r-- | sql/item_func.h | 4 |
4 files changed, 35 insertions, 8 deletions
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 1f9e1d63cfb..4fbfc2b2ea4 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -317,8 +317,11 @@ SHOW COUNT(*) WARNINGS; SHOW COUNT(*) ERRORS; @@session.error_count 1 -create table t1(f1 int); -insert into t1 values(1),(1),(2),(3),(4),(1),(3),(1); +create table t1(f1 int, f2 varchar(2), f3 float, f4 decimal(2,1)); +insert into t1 values +(1, "a", 1.5, 1.6), (1, "a", 1.5, 1.6), (2, "b", 2.5, 2.6), +(3, "c", 3.5, 3.6), (4, "d", 4.5, 4.6), (1, "a", 1.5, 1.6), +(3, "c", 3.5, 3.6), (1, "a", 1.5, 1.6); select @a:=f1, count(f1) from t1 group by 1 desc; @a:=f1 count(f1) 4 1 @@ -331,4 +334,22 @@ select @a:=f1, count(f1) from t1 group by 1 asc; 2 1 3 2 4 1 +select @a:=f2, count(f2) from t1 group by 1 desc; +@a:=f2 count(f2) +d 1 +c 2 +b 1 +a 4 +select @a:=f3, count(f3) from t1 group by 1 desc; +@a:=f3 count(f3) +4.5 1 +3.5 2 +2.5 1 +1.5 4 +select @a:=f4, count(f4) from t1 group by 1 desc; +@a:=f4 count(f4) +4.6 1 +3.6 2 +2.6 1 +1.6 4 drop table t1; diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 3df949ae669..3a3e8f88f83 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -226,8 +226,14 @@ 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),(3),(4),(1),(3),(1); +create table t1(f1 int, f2 varchar(2), f3 float, f4 decimal(2,1)); +insert into t1 values + (1, "a", 1.5, 1.6), (1, "a", 1.5, 1.6), (2, "b", 2.5, 2.6), + (3, "c", 3.5, 3.6), (4, "d", 4.5, 4.6), (1, "a", 1.5, 1.6), + (3, "c", 3.5, 3.6), (1, "a", 1.5, 1.6); select @a:=f1, count(f1) from t1 group by 1 desc; select @a:=f1, count(f1) from t1 group by 1 asc; +select @a:=f2, count(f2) from t1 group by 1 desc; +select @a:=f3, count(f3) from t1 group by 1 desc; +select @a:=f4, count(f4) from t1 group by 1 desc; drop table t1; diff --git a/sql/item_func.cc b/sql/item_func.cc index b9ee96e6c08..e6c59ae466b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4180,7 +4180,7 @@ my_decimal *Item_func_set_user_var::val_decimal(my_decimal *val) } -double Item_func_set_user_var::val_real_result() +double Item_func_set_user_var::val_result() { DBUG_ASSERT(fixed == 1); check(TRUE); @@ -4196,7 +4196,7 @@ longlong Item_func_set_user_var::val_int_result() return entry->val_int(&null_value); } -String *Item_func_set_user_var::val_str_result(String *str) +String *Item_func_set_user_var::str_result(String *str) { DBUG_ASSERT(fixed == 1); check(TRUE); diff --git a/sql/item_func.h b/sql/item_func.h index 213e4298b39..7bb0ebfb1bf 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1236,9 +1236,9 @@ public: longlong val_int(); String *val_str(String *str); my_decimal *val_decimal(my_decimal *); - double val_real_result(); + double val_result(); longlong val_int_result(); - String *val_str_result(String *str); + String *str_result(String *str); my_decimal *val_decimal_result(my_decimal *); bool update_hash(void *ptr, uint length, enum Item_result type, CHARSET_INFO *cs, Derivation dv, bool unsigned_arg); |