summaryrefslogtreecommitdiff
path: root/mysql-test/r/user_var.result
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2007-01-09 23:24:56 +0300
committerevgen@moonbone.local <>2007-01-09 23:24:56 +0300
commite098f736e1adc97aa2d4a5ed5bf07c5c94d15399 (patch)
tree0ab1a8c7eb8252fde7e8c1e87dda78c7513e2ff4 /mysql-test/r/user_var.result
parentac48c8bae1159e8a24a7695e86f19d9f9a89d796 (diff)
downloadmariadb-git-e098f736e1adc97aa2d4a5ed5bf07c5c94d15399.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.
Diffstat (limited to 'mysql-test/r/user_var.result')
-rw-r--r--mysql-test/r/user_var.result9
1 files changed, 8 insertions, 1 deletions
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 90954fc1ede..753c982155c 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -301,7 +301,14 @@ select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
select @var;
@var
3
-drop table t1;
+create table t2 as select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
+select * from t2;
+@var:=f2
+3
+select @var;
+@var
+3
+drop table t1,t2;
insert into city 'blah';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''blah'' at line 1
SHOW COUNT(*) WARNINGS;