summaryrefslogtreecommitdiff
path: root/mysql-test/t/user_var.test
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2007-01-09 23:24:56 +0300
committerunknown <evgen@moonbone.local>2007-01-09 23:24:56 +0300
commitf094fe551a833f50fbac7092b069462a00856719 (patch)
tree0ab1a8c7eb8252fde7e8c1e87dda78c7513e2ff4 /mysql-test/t/user_var.test
parent78dff026afa9ff1fbb02f6f2acc1569895f9c371 (diff)
downloadmariadb-git-f094fe551a833f50fbac7092b069462a00856719.tar.gz
Fixed bug#16861: User defined variable can have a wrong value if a tmp table was
used. The Item::save_in_field() function is called from fill_record() to fill the new row with data while execution of the CREATE TABLE ... SELECT statement. Item::save_in_field() calls val_xxx() methods in order to get values. val_xxx() methods do not take into account the result field. Due to this Item_func_set_user_var::val_xxx() methods returns values from the original table, not from the temporary one. The save_in_field() member function is added to the Item_func_set_user_var class. It detects whether the result field should be used and properly updates the value of the user variable. sql/item_func.cc: Bug#16861: User defined variable can have a wrong value if a tmp table was used. Added the save_in_field() member function to the Item_func_set_user_var class. sql/item_func.h: Bug#16861: User defined variable can have a wrong value if a tmp table was used. Added the save_in_field() member function to the Item_func_set_user_var class. mysql-test/r/user_var.result: Extended the test case for bug#18681: User defined variable can have a wrong value if a tmp table was used. mysql-test/t/user_var.test: Extended the test case for bug#18681: User defined variable can have a wrong value if a tmp table was used.
Diffstat (limited to 'mysql-test/t/user_var.test')
-rw-r--r--mysql-test/t/user_var.test5
1 files changed, 4 insertions, 1 deletions
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index 65ca1b2c1b7..70f57fdf283 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -210,7 +210,10 @@ create table t1(f1 int, f2 int);
insert into t1 values (1,2),(2,3),(3,1);
select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
select @var;
-drop table t1;
+create table t2 as select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
+select * from t2;
+select @var;
+drop table t1,t2;
#
# Bug#19024 - SHOW COUNT(*) WARNINGS not return Errors