summaryrefslogtreecommitdiff
path: root/mysql-test/r/user_var.result
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-11-17 11:20:50 +0400
committerunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-11-17 11:20:50 +0400
commit011eb3dffe068db46ea4144eee242a4f2b203cf8 (patch)
tree85660233bc4da342b5795989c55e976743503f24 /mysql-test/r/user_var.result
parentc8450b278d7f049e0afa49624c52e0f61b541126 (diff)
downloadmariadb-git-011eb3dffe068db46ea4144eee242a4f2b203cf8.tar.gz
Fix for bug #32260: User variables in query cause server crash
Problem: there's no guarantee that the user variable item's result_field is assigned when we're adjusting its table read map. Fix: check the result_field before using it. mysql-test/r/user_var.result: Fix for bug #32260: User variables in query cause server crash - test result. mysql-test/t/user_var.test: Fix for bug #32260: User variables in query cause server crash - test case. sql/item_func.cc: Fix for bug #32260: User variables in query cause server crash - using the result_field ensure it is set.
Diffstat (limited to 'mysql-test/r/user_var.result')
-rw-r--r--mysql-test/r/user_var.result11
1 files changed, 11 insertions, 0 deletions
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 6fd7b39f226..431134b03c7 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -353,3 +353,14 @@ select @a:=f4, count(f4) from t1 group by 1 desc;
2.6 1
1.6 4
drop table t1;
+create table t1(a int);
+insert into t1 values(5),(4),(4),(3),(2),(2),(2),(1);
+set @rownum := 0;
+set @rank := 0;
+set @prev_score := NULL;
+select @rownum := @rownum + 1 as row,
+@rank := IF(@prev_score!=a, @rownum, @rank) as rank,
+@prev_score := a as score
+from t1 order by score desc;
+drop table t1;
+End of 5.1 tests