From 027e34e13b8d0baed51e26be8d4ffd86d9b3b041 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 28 Feb 2013 11:46:35 +0100 Subject: a simpler fix for MySQL Bug #12408412: GROUP_CONCAT + ORDER BY + INPUT/OUTPUT SAME USER VARIABLE = CRASH and MySQL Bug#14664077 SEVERE PERFORMANCE DEGRADATION IN SOME CASES WHEN USER VARIABLES ARE USED sql/item_func.cc: don't use anything from Item_func_set_user_var::fix_fields() in Item_func_set_user_var::save_item_result() sql/sql_class.cc: Call suv->save_item_result(item) *before* doing suv->fix_fields(), because the former evaluates the item (and caches its value), while the latter marks the user variable as non-const. The problem is that the item was fix_field'ed when the user variable was const, and it doesn't expect it to change to non-const in the middle of the execution. --- mysql-test/t/user_var.test | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mysql-test/t/user_var.test') diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index efaf8afd91e..6865f3c7f25 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -365,4 +365,12 @@ SELECT (@v:=a) <> (@v:=1) FROM t1; DROP TABLE t1; +# +# Bug #12408412: GROUP_CONCAT + ORDER BY + INPUT/OUTPUT +# SAME USER VARIABLE = CRASH +# +SET @bug12408412=1; +SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412; + --echo End of 5.1 tests + -- cgit v1.2.1