MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:bar Date:July 7 2006 12:06pm
Subject:bk commit into 5.0 tree (bar:1.2215) BUG#11728
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of bar. When bar 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.2215 06/07/07 17:06:30 bar@stripped +3 -0
  func_str.result, func_str.test:
    Adding test case.
  item_strfunc.cc:
    bug#11728 string function LEFT, strange undocumented behaviour
    Fixing LEFT and RIGHT return NULL if the second
    argument is NULL.

  mysql-test/r/func_str.result
    1.116 06/07/07 17:05:34 bar@stripped +3 -0
    Adding test case.

  mysql-test/t/func_str.test
    1.90 06/07/07 17:05:30 bar@stripped +5 -0
    Adding test case.

  sql/item_strfunc.cc
    1.273 06/07/07 17:04:31 bar@stripped +2 -2
    bug#11728 string function LEFT, strange undocumented behaviour
    Fixing LEFT and RIGHT return NULL if the second
    argument is NULL.

# 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:	bar
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/bar/mysql-5.0-kt

--- 1.272/sql/item_strfunc.cc	2006-06-30 12:26:32 +05:00
+++ 1.273/sql/item_strfunc.cc	2006-07-07 17:04:31 +05:00
@@ -1038,7 +1038,7 @@ String *Item_func_left::val_str(String *
   long length  =(long) args[1]->val_int();
   uint char_pos;
 
-  if ((null_value=args[0]->null_value))
+  if ((null_value=(args[0]->null_value || args[1]->null_value)))
     return 0;
   if (length <= 0)
     return &my_empty_string;
@@ -1078,7 +1078,7 @@ String *Item_func_right::val_str(String 
   String *res  =args[0]->val_str(str);
   long length  =(long) args[1]->val_int();
 
-  if ((null_value=args[0]->null_value))
+  if ((null_value=(args[0]->null_value || args[1]->null_value)))
     return 0; /* purecov: inspected */
   if (length <= 0)
     return &my_empty_string; /* purecov: inspected */

--- 1.115/mysql-test/r/func_str.result	2006-06-21 08:49:27 +05:00
+++ 1.116/mysql-test/r/func_str.result	2006-07-07 17:05:34 +05:00
@@ -33,6 +33,9 @@ instr('hello','HE')	instr('hello',binary
 select position(binary 'll' in 'hello'),position('a' in binary 'hello');
 position(binary 'll' in 'hello')	position('a' in binary 'hello')
 3	0
+select left('hello',null), right('hello',null);
+left('hello',null)	right('hello',null)
+NULL	NULL
 select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
 left('hello',2)	right('hello',2)	substring('hello',2,2)	mid('hello',1,5)
 he	lo	el	hello

--- 1.89/mysql-test/t/func_str.test	2006-06-21 08:49:27 +05:00
+++ 1.90/mysql-test/t/func_str.test	2006-07-07 17:05:30 +05:00
@@ -19,6 +19,11 @@ select hex(char(256));
 select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
 select instr('hello','HE'), instr('hello',binary 'HE'), instr(binary 'hello','HE'); 
 select position(binary 'll' in 'hello'),position('a' in binary 'hello');
+#
+# Bug#11728 string function LEFT,
+# strange undocumented behaviour, strict mode
+#
+select left('hello',null), right('hello',null);
 select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
 select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ;
 select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1);
Thread
bk commit into 5.0 tree (bar:1.2215) BUG#11728bar7 Jul