From ac885d5dfbe4c094f693851433516265a57868d6 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 9 Jan 2009 13:50:18 +0200 Subject: Bug #41437: Value stored in 'case' lacks charset, causes segfault When substituting system constant functions with a constant result the server was not expecting that the function may return NULL. Fixed by checking for NULL and returning Item_null (in the relevant collation) if the result of the system constant function was NULL. mysql-test/r/mysql.result: Bug #41437: test case mysql-test/t/mysql.test: Bug #41437: test case. Relies on database() returning NULL if no database is selected. sql/item_strfunc.cc: Bug #41437: Check for NULL result on evaluating the system constant function and return a constant NULL item. --- mysql-test/t/mysql.test | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mysql-test/t/mysql.test') diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 76941af893a..68a01a309d4 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -309,4 +309,9 @@ EOF --exec $MYSQL -c < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql; +# +# Bug #41437: Value stored in 'case' lacks charset, causees segfault +# +--exec $MYSQL -e "select @z:='1',@z=database()" + --echo End of 5.0 tests -- cgit v1.2.1