diff options
author | unknown <evgen@sunlight.local> | 2006-08-22 17:37:41 +0400 |
---|---|---|
committer | unknown <evgen@sunlight.local> | 2006-08-22 17:37:41 +0400 |
commit | c623e54fb8a939eb877770d875ce184fec543d37 (patch) | |
tree | c314e2e59971f43503941c43503c52cd6a91e4a1 /mysql-test/r/user_var.result | |
parent | 6071b686b179d1fcc96cd6ccce940d62bd509c70 (diff) | |
download | mariadb-git-c623e54fb8a939eb877770d875ce184fec543d37.tar.gz |
Fixed bug#16861: User defined variable can have a wrong value if a tmp table was
used.
Sorting by RAND() uses a temporary table in order to get a correct results.
User defined variable was set during filling the temporary table and later
on it is substituted for its value from the temporary table. Due to this
it contains the last value stored in the temporary table.
Now if the result_field is set for the Item_func_set_user_var object it
updates variable from the result_field value when being sent to a client.
The Item_func_set_user_var::check() now accepts a use_result_field
parameter. Depending on its value the result_field or the args[0] is used
to get current value.
mysql-test/r/user_var.result:
Added a test case for bug#16861: User defined variable can have a wrong value if a tmp table was used.
mysql-test/t/user_var.test:
Added a test case for bug#16861: User defined variable can have a wrong value if a tmp table was used.
sql/item_func.cc:
Fixed bug#16861: User defined variable can have a wrong value if a tmp table was used.
Now if the result_field is set for the Item_func_set_user_var object it
updates variable from the result_field value when being sent to a client.
The Item_func_set_user_var::check() now accepts a use_result_field
parameter. Depending on its value the result_field or the args[0] is used
to get current value.
sql/item_func.h:
Fixed bug#16861: User defined variable can have a wrong value if a tmp table was used.
Added a new SUSERVAR_FUNC function type.
Updated the Item_func_set_user_var::check() function declaration.
Added the Item_func_set_user_var::send() member function.
sql/set_var.cc:
Fixed bug#16861: User defined variable can have a wrong value if a tmp table was used.
Modified to use updated Item_func_set_user_var::check() function.
sql/sql_class.cc:
Fixed bug#16861: User defined variable can have a wrong value if a tmp table was used.
Modified to use updated Item_func_set_user_var::check() function.
sql/sql_select.cc:
Fixed bug#16861: User defined variable can have a wrong value if a tmp table was used.
Now an Item_func_set_user_var object isn't substituted for an Item_field object after filling a temporary table.
Diffstat (limited to 'mysql-test/r/user_var.result')
-rw-r--r-- | mysql-test/r/user_var.result | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 3a197cd2a47..1664a907c99 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -292,3 +292,12 @@ SELECT @a; @a 18446744071710965857 drop table bigfailure; +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; +@var:=f2 +3 +select @var; +@var +3 +drop table t1; |