From 3251e4549c7541557546d0550ddfafa1574fe5ce 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/r/user_var.result | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mysql-test/r/user_var.result') diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 374520ff610..21bd3c62e1b 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -456,4 +456,6 @@ SELECT (@v:=a) <> (@v:=1) FROM t1; (@v:=a) <> (@v:=1) 1 DROP TABLE t1; +SET @bug12408412=1; +SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412; End of 5.1 tests -- cgit v1.2.1