List:Commits« Previous MessageNext Message »
From:<gshchepa Date:February 12 2008 8:17pm
Subject:bk commit into 5.0 tree (gshchepa:1.2602) BUG#33764
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gshchepa.  When gshchepa 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, 2008-02-13 00:16:59+04:00, gshchepa@stripped +3 -0
  Fixed bug#33764: Wrong result with IN(), CONCAT() and implicit
                   type conversion.
  
  Instead of copying of whole character string from a temporary
  buffer, the server copied a short-living pointer to that string
  into a long-living structure. That has been fixed.

  mysql-test/r/select.result@stripped, 2008-02-13 00:13:52+04:00, gshchepa@stripped +6 -0
    Added test case for bug#33764.

  mysql-test/t/select.test@stripped, 2008-02-13 00:13:53+04:00, gshchepa@stripped +11 -0
    Added test case for bug#33764.

  sql/item_cmpfunc.cc@stripped, 2008-02-13 00:13:54+04:00, gshchepa@stripped +4 -1
    Fixed bug#33764.
    Copying of a pointer has been replaced with an optional copying of
    a whole array to a newly allocated memory space in case of a
    functional source item.

diff -Nrup a/mysql-test/r/select.result b/mysql-test/r/select.result
--- a/mysql-test/r/select.result	2007-11-18 00:01:31 +04:00
+++ b/mysql-test/r/select.result	2008-02-13 00:13:52 +04:00
@@ -4328,4 +4328,10 @@ SELECT * FROM t1 WHERE c1 > NULL + 1;
 c1
 DROP TABLE t1;
 
+CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY);
+INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0');
+SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar');
+a
+foo0
+DROP TABLE t1;
 End of 5.0 tests
diff -Nrup a/mysql-test/t/select.test b/mysql-test/t/select.test
--- a/mysql-test/t/select.test	2007-11-18 00:01:30 +04:00
+++ b/mysql-test/t/select.test	2008-02-13 00:13:53 +04:00
@@ -3672,4 +3672,15 @@ DROP TABLE t1;
 
 --echo
 
+###########################################################################
+
+#
+# Bug #33764: Wrong result with IN(), CONCAT() and implicit type conversion
+#
+
+CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY);
+INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0');
+SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar');
+DROP TABLE t1;
+
 --echo End of 5.0 tests
diff -Nrup a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
--- a/sql/item_cmpfunc.cc	2007-12-13 14:49:11 +04:00
+++ b/sql/item_cmpfunc.cc	2008-02-13 00:13:54 +04:00
@@ -2995,7 +2995,10 @@ void in_string::set(uint pos,Item *item)
   {
     if (res->uses_buffer_owned_by(str))
       res->copy();
-    *str= *res;
+    if (item->type() == Item::FUNC_ITEM)
+      str->copy(*res);
+    else
+      *str= *res;
   }
   if (!str->charset())
   {
Thread
bk commit into 5.0 tree (gshchepa:1.2602) BUG#33764gshchepa12 Feb