List:Commits« Previous MessageNext Message »
From:ramil Date:April 25 2006 9:34am
Subject:bk commit into 4.1 tree (ramil:1.2471) BUG#18501
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of ram. When ram does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2471 06/04/25 14:34:19 ramil@stripped +3 -0
  Fix for bug #18501: Server crashes with monthname().

  sql/item_timefunc.cc
    1.99 06/04/25 14:34:14 ramil@stripped +2 -2
    Fix for bug #18501: Server crashes with monthname().
      - check null_value as well.

  mysql-test/t/func_time.test
    1.33 06/04/25 14:34:13 ramil@stripped +7 -0
    Fix for bug #18501: Server crashes with monthname().
      - test case

  mysql-test/r/func_time.result
    1.38 06/04/25 14:34:13 ramil@stripped +4 -0
    Fix for bug #18501: Server crashes with monthname().
      - test case

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/4.1.b18501

--- 1.98/sql/item_timefunc.cc	2006-04-13 10:55:41 +05:00
+++ 1.99/sql/item_timefunc.cc	2006-04-25 14:34:14 +05:00
@@ -905,9 +905,9 @@ String* Item_func_monthname::val_str(Str
 {
   DBUG_ASSERT(fixed == 1);
   const char *month_name;
-  uint   month=(uint) Item_func_month::val_int();
+  uint   month= (uint) val_int();
 
-  if (!month)					// This is also true for NULL
+  if (null_value || !month)
   {
     null_value=1;
     return (String*) 0;

--- 1.37/mysql-test/r/func_time.result	2005-06-24 14:04:43 +05:00
+++ 1.38/mysql-test/r/func_time.result	2006-04-25 14:34:13 +05:00
@@ -626,3 +626,7 @@ last_day('2005-01-00')
 NULL
 Warnings:
 Warning	1292	Truncated incorrect datetime value: '2005-01-00'
+select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
+monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
+monthname(str_to_date(null, '%m'))	monthname(str_to_date(null, '%m'))	monthname(str_to_date(1, '%m'))	monthname(str_to_date(0, '%m'))
+NULL	NULL	January	NULL

--- 1.32/mysql-test/t/func_time.test	2005-07-28 05:21:42 +05:00
+++ 1.33/mysql-test/t/func_time.test	2006-04-25 14:34:13 +05:00
@@ -315,4 +315,11 @@ select last_day('2005-00-00');
 select last_day('2005-00-01');
 select last_day('2005-01-00');
 
+#
+# Bug #18501: monthname and NULLs
+#
+
+select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
+       monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (ramil:1.2471) BUG#18501ramil25 Apr