summaryrefslogtreecommitdiff
path: root/mysql-test/t/user_var.test
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2007-12-07 22:54:47 +0300
committerunknown <evgen@moonbone.local>2007-12-07 22:54:47 +0300
commit0ad7fc58c7e149fe7885d6a3558637f87513047a (patch)
treebd8982e97f8d03f3047d3e63414a037a880aa8ee /mysql-test/t/user_var.test
parentf448c62558cbd74940261e4eb8e67c3347ceb235 (diff)
downloadmariadb-git-0ad7fc58c7e149fe7885d6a3558637f87513047a.tar.gz
Bug#32482: Crash for a query with ORDER BY a user variable.
The Item_func_set_user_var::register_field_in_read_map() did not check that the result_field was null.This caused server crashes for queries that required order by such a field and were executed without using a temporary table. The Item_func_set_user_var::register_field_in_read_map() now checks the result_field to be not null. mysql-test/t/user_var.test: Added a test case for the bug#32482: Crash for a query with ORDER BY a user variable. mysql-test/r/user_var.result: Added a test case for the bug#32482: Crash for a query with ORDER BY a user variable. sql/item_func.cc: Bug#32482: Crash for a query with ORDER BY a user variable. The Item_func_set_user_var::register_field_in_read_map() now checks the result_field to be not null.
Diffstat (limited to 'mysql-test/t/user_var.test')
-rw-r--r--mysql-test/t/user_var.test8
1 files changed, 8 insertions, 0 deletions
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index 3a3e8f88f83..ca02e0b5f2d 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -237,3 +237,11 @@ 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;
+
+#
+# Bug#32482: Crash for a query with ORDER BY a user variable.
+#
+create table t1 (f1 int);
+insert into t1 values (2), (1);
+select @i := f1 as j from t1 order by 1;
+drop table t1;