List:Commits« Previous MessageNext Message »
From:kroki Date:November 16 2006 11:13am
Subject:bk commit into 5.1 tree (kroki:1.2362)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomash. When tomash 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@stripped, 2006-11-16 14:13:03+03:00, kroki@stripped +7 -0
  Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug17047
  into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.1-bug17047
  MERGE: 1.1810.2291.2

  mysql-test/r/func_in.result@stripped, 2006-11-16 14:12:59+03:00, kroki@stripped +1 -0
    Manual merge.  Add "End of <version> tests" marker.
    MERGE: 1.28.1.1

  mysql-test/r/func_str.result@stripped, 2006-11-16 14:12:59+03:00, kroki@stripped +2 -1
    Manual merge.  Add "End of <version> tests" marker.
    MERGE: 1.110.4.1

  mysql-test/t/func_in.test@stripped, 2006-11-16 14:13:00+03:00, kroki@stripped +4 -0
    Manual merge.  Add "End of <version> tests" marker.
    MERGE: 1.22.1.1

  mysql-test/t/func_str.test@stripped, 2006-11-16 14:13:00+03:00, kroki@stripped +5 -1
    Manual merge.  Add "End of <version> tests" marker.
    MERGE: 1.92.2.1

  sql/item_cmpfunc.cc@stripped, 2006-11-16 14:08:06+03:00, kroki@stripped +0 -0
    Auto merged
    MERGE: 1.187.1.37

  sql/item_strfunc.cc@stripped, 2006-11-16 14:08:06+03:00, kroki@stripped +0 -0
    Auto merged
    MERGE: 1.261.15.1

  sql/item_strfunc.h@stripped, 2006-11-16 14:08:06+03:00, kroki@stripped +0 -0
    Auto merged
    MERGE: 1.101.1.17

# 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:	kroki
# Host:	moonlight.intranet
# Root:	/home/tomash/src/mysql_ab/mysql-5.1-bug17047/RESYNC

--- 1.226/sql/item_cmpfunc.cc	2006-11-16 14:13:11 +03:00
+++ 1.227/sql/item_cmpfunc.cc	2006-11-16 14:13:11 +03:00
@@ -2519,7 +2519,6 @@ void Item_func_in::fix_length_and_dec()
       }
     }
   }
-  maybe_null= args[0]->maybe_null;
   max_length= 1;
 }
 

--- 1.296/sql/item_strfunc.cc	2006-11-16 14:13:11 +03:00
+++ 1.297/sql/item_strfunc.cc	2006-11-16 14:13:11 +03:00
@@ -80,6 +80,20 @@ String *Item_str_func::check_well_formed
 }
 
 
+bool Item_str_func::fix_fields(THD *thd, Item **ref)
+{
+  bool res= Item_func::fix_fields(thd, ref);
+  /*
+    In Item_str_func::check_well_formed_result() we may set null_value
+    flag on the same condition as in test() below.
+  */
+  maybe_null= (maybe_null ||
+               test(thd->variables.sql_mode &
+                    (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)));
+  return res;
+}
+
+
 my_decimal *Item_str_func::val_decimal(my_decimal *decimal_value)
 {
   DBUG_ASSERT(fixed == 1);

--- 1.120/sql/item_strfunc.h	2006-11-16 14:13:11 +03:00
+++ 1.121/sql/item_strfunc.h	2006-11-16 14:13:11 +03:00
@@ -37,6 +37,7 @@ public:
   enum Item_result result_type () const { return STRING_RESULT; }
   void left_right_max_length();
   String *check_well_formed_result(String *str);
+  bool fix_fields(THD *thd, Item **ref);
 };
 
 class Item_func_md5 :public Item_str_func
@@ -530,9 +531,8 @@ public:
   { collation.set(cs); }  
   String *val_str(String *);
   void fix_length_and_dec() 
-  { 
-    maybe_null=0;
-    max_length=arg_count * collation.collation->mbmaxlen;
+  {
+    max_length= arg_count * collation.collation->mbmaxlen;
   }
   const char *func_name() const { return "char"; }
 };

--- 1.30/mysql-test/r/func_in.result	2006-11-16 14:13:11 +03:00
+++ 1.31/mysql-test/r/func_in.result	2006-11-16 14:13:11 +03:00
@@ -202,6 +202,14 @@ select count(*) from t1 where id not in 
 count(*)
 1
 drop table t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 SELECT 1 IN (2, NULL);
+SELECT should return NULL.
+SELECT * FROM t1;
+1 IN (2, NULL)
+NULL
+DROP TABLE t1;
+End of 4.1 tests
 CREATE TABLE t1 (a int PRIMARY KEY);
 INSERT INTO t1 VALUES (44), (45), (46);
 SELECT * FROM t1 WHERE a IN (45);
@@ -343,6 +351,7 @@ some_id
 1
 2
 drop table t1;
+End of 5.0 tests
 create table t1(f1 char(1));
 insert into t1 values ('a'),('b'),('1');
 select f1 from t1 where f1 in ('a',1);
@@ -411,3 +420,4 @@ explain select f2 from t2 where f2 in (1
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	index	NULL	t2f2	5	NULL	3	Using where; Using index
 drop table t1, t2;
+End of 5.1 tests

--- 1.23/mysql-test/t/func_in.test	2006-11-16 14:13:11 +03:00
+++ 1.24/mysql-test/t/func_in.test	2006-11-16 14:13:11 +03:00
@@ -109,7 +109,28 @@ select count(*) from t1 where id not in 
 select count(*) from t1 where id not in (1,2);
 drop table t1;
 
-# End of 4.1 tests
+
+#
+# BUG#17047: CHAR() and IN() can return NULL without signaling NULL
+# result
+#
+# The problem was in the IN() function that ignored maybe_null flags
+# of all arguments except the first (the one _before_ the IN
+# keyword, '1' in the test case below).
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 SELECT 1 IN (2, NULL);
+--echo SELECT should return NULL.
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+
+--echo End of 4.1 tests
+
 
 #
 # Bug #11885: WHERE condition with NOT IN (one element)          
@@ -233,6 +254,10 @@ select some_id from t1 where some_id not
 select some_id from t1 where some_id not in(-4,-1,3423534,2342342);
 drop table t1;
 
+
+--echo End of 5.0 tests
+
+
 #
 # Bug#18360: Type aggregation for IN and CASE may lead to a wrong result 
 #
@@ -256,3 +281,6 @@ explain select f2 from t2 where f2 in ('
 select f2 from t2 where f2 in (1,'b');
 explain select f2 from t2 where f2 in (1,'b');
 drop table t1, t2;
+
+
+--echo End of 5.1 tests

--- 1.128/mysql-test/r/func_str.result	2006-11-16 14:13:11 +03:00
+++ 1.129/mysql-test/r/func_str.result	2006-11-16 14:13:11 +03:00
@@ -1148,6 +1148,20 @@ id	select_type	table	type	possible_keys	
 Warnings:
 Note	1003	select `test`.`t1`.`code` AS `code`,`test`.`t2`.`id` AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5))
 DROP TABLE t1,t2;
+SET @orig_sql_mode = @@SQL_MODE;
+SET SQL_MODE=traditional;
+SELECT CHAR(0xff,0x8f USING utf8);
+CHAR(0xff,0x8f USING utf8)
+NULL
+Warnings:
+Error	1300	Invalid utf8 character string: 'FF8F'
+SELECT CHAR(0xff,0x8f USING utf8) IS NULL;
+CHAR(0xff,0x8f USING utf8) IS NULL
+1
+Warnings:
+Error	1300	Invalid utf8 character string: 'FF8F'
+SET SQL_MODE=@orig_sql_mode;
+End of 5.0 tests
 select locate('he','hello',-2);
 locate('he','hello',-2)
 0
@@ -1903,4 +1917,4 @@ Warnings:
 Error	1292	Truncated incorrect DECIMAL value: ''
 Error	1292	Truncated incorrect DECIMAL value: ''
 Warning	1301	Result of lpad() was larger than max_allowed_packet (1048576) - truncated
-End of 5.0 tests
+End of 5.1 tests

--- 1.95/mysql-test/t/func_str.test	2006-11-16 14:13:11 +03:00
+++ 1.96/mysql-test/t/func_str.test	2006-11-16 14:13:11 +03:00
@@ -780,6 +780,23 @@ SELECT * FROM t1 INNER JOIN t2 ON code=i
 
 DROP TABLE t1,t2;
 
+
+#
+# BUG#17047: CHAR() and IN() can return NULL without signaling NULL
+# result
+#
+SET @orig_sql_mode = @@SQL_MODE;
+SET SQL_MODE=traditional;
+
+SELECT CHAR(0xff,0x8f USING utf8);
+SELECT CHAR(0xff,0x8f USING utf8) IS NULL;
+
+SET SQL_MODE=@orig_sql_mode;
+
+
+--echo End of 5.0 tests
+
+
 #
 # Bug #10963
 # 4294967296 18446744073709551616
@@ -969,4 +986,5 @@ select lpad('hello', 1844674407370955161
 select lpad('hello', -18446744073709551617, '1');
 select lpad('hello', 18446744073709551617, '1');
 
---echo End of 5.0 tests
+
+--echo End of 5.1 tests
Thread
bk commit into 5.1 tree (kroki:1.2362)kroki16 Nov