MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:ramil Date:October 19 2007 9:54am
Subject:bk commit into 5.0 tree (ramil:1.2542) BUG#31349
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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@stripped, 2007-10-19 14:54:05+05:00, ramil@stripped +3 -0
  Fix for bug #31349: ERROR 1062 (23000): Duplicate entry '' for key 'group_key'
  
  Problem: lying to the optimizer that a function (Item_func_inet_ntoa)
  cannot return NULL values leads to unexpected results (in the case group
  keys creation/comparison is broken). 
  
  Fix: Item_func_inet_ntoa::maybe_null should be set properly.

  mysql-test/r/func_misc.result@stripped, 2007-10-19 14:54:03+05:00, ramil@stripped +6 -0
    Fix for bug #31349: ERROR 1062 (23000): Duplicate entry '' for key 'group_key'
      - test result.

  mysql-test/t/func_misc.test@stripped, 2007-10-19 14:54:03+05:00, ramil@stripped +8 -0
    Fix for bug #31349: ERROR 1062 (23000): Duplicate entry '' for key 'group_key'
      - test case.

  sql/item_strfunc.h@stripped, 2007-10-19 14:54:03+05:00, ramil@stripped +6 -1
    Fix for bug #31349: ERROR 1062 (23000): Duplicate entry '' for key 'group_key'
      - set Item_func_inet_ntoa::maybe_null flag.

diff -Nrup a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
--- a/mysql-test/r/func_misc.result	2007-03-02 06:20:46 +04:00
+++ b/mysql-test/r/func_misc.result	2007-10-19 14:54:03 +05:00
@@ -185,4 +185,10 @@ ERROR 21000: Operand should contain 1 co
 drop table table_26093;
 drop function func_26093_a;
 drop function func_26093_b;
+create table t1 (a int not null);
+insert into t1 values (-1), (-2);
+select min(a) from t1 group by inet_ntoa(a);
+min(a)
+-2
+drop table t1;
 End of 5.0 tests
diff -Nrup a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
--- a/mysql-test/t/func_misc.test	2007-03-02 06:20:46 +04:00
+++ b/mysql-test/t/func_misc.test	2007-10-19 14:54:03 +05:00
@@ -189,4 +189,12 @@ drop table table_26093;
 drop function func_26093_a;
 drop function func_26093_b;
 
+#
+# Bug #31349: ERROR 1062 (23000): Duplicate entry '' for key 'group_key'
+#
+create table t1 (a int not null);
+insert into t1 values (-1), (-2);
+select min(a) from t1 group by inet_ntoa(a);
+drop table t1;
+
 --echo End of 5.0 tests
diff -Nrup a/sql/item_strfunc.h b/sql/item_strfunc.h
--- a/sql/item_strfunc.h	2007-07-27 18:42:24 +05:00
+++ b/sql/item_strfunc.h	2007-10-19 14:54:03 +05:00
@@ -683,7 +683,12 @@ public:
     }
   String* val_str(String* str);
   const char *func_name() const { return "inet_ntoa"; }
-  void fix_length_and_dec() { decimals = 0; max_length=3*8+7; }
+  void fix_length_and_dec() 
+  { 
+    decimals= 0; 
+    max_length= 3 * 8 + 7; 
+    maybe_null= 1;
+  }
 };
 
 class Item_func_quote :public Item_str_func
Thread
bk commit into 5.0 tree (ramil:1.2542) BUG#31349ramil19 Oct