List:Commits« Previous MessageNext Message »
From:Kristofer Pettersson Date:September 29 2008 11:49am
Subject:bzr commit into mysql-5.0-bugteam branch (kpettersson:2685)
View as plain text  
#At file:///home/thek/Development/cpp/mysqlbzr/mysql-5.0-bugteam/

 2685 Kristofer Pettersson	2008-09-29 [merge]
      Automerge 5.0-5.1.29-rc -> 5.0-bugteam
modified:
  client/mysqldump.c
  mysql-test/r/compare.result
  mysql-test/r/mysqldump.result
  mysql-test/t/compare.test
  sql/item.cc

=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	2008-03-14 13:32:01 +0000
+++ b/client/mysqldump.c	2008-09-11 05:46:43 +0000
@@ -1836,7 +1836,13 @@ static uint get_table_structure(char *ta
               fprintf(sql_file, ",\n  %s %s",
                       quote_name(row[0], name_buff, 0), row[1]);
             }
-            fprintf(sql_file, "\n) */;\n");
+            /*
+              Stand-in tables are always MyISAM tables as the default
+              engine might have a column-limit that's lower than the
+              number of columns in the view, and MyISAM support is
+              guaranteed to be in the server anyway.
+            */
+            fprintf(sql_file, "\n) ENGINE=MyISAM */;\n");
             check_io(sql_file);
           }
         }

=== modified file 'mysql-test/r/compare.result'
--- a/mysql-test/r/compare.result	2008-02-15 13:47:32 +0000
+++ b/mysql-test/r/compare.result	2008-09-18 12:55:36 +0000
@@ -90,4 +90,9 @@ Note	1276	Field or reference 'test.t2.a'
 Note	1276	Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
 Note	1003	select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat(_latin1'0',`test`.`t2`.`a`,_latin1'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
 DROP TABLE t1,t2;
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
+SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
+a
+DROP TABLE t1;
 End of 5.0 tests

=== modified file 'mysql-test/r/mysqldump.result'
--- a/mysql-test/r/mysqldump.result	2008-09-15 19:34:39 +0000
+++ b/mysql-test/r/mysqldump.result	2008-09-29 11:49:46 +0000
@@ -2001,7 +2001,7 @@ DROP TABLE IF EXISTS `v2`;
 /*!50001 DROP VIEW IF EXISTS `v2`*/;
 /*!50001 CREATE TABLE `v2` (
   `a` varchar(30)
-) */;
+) ENGINE=MyISAM */;
 /*!50001 DROP TABLE `v2`*/;
 /*!50001 DROP VIEW IF EXISTS `v2`*/;
 /*!50001 CREATE ALGORITHM=UNDEFINED */
@@ -2083,7 +2083,7 @@ DROP TABLE IF EXISTS `v1`;
 /*!50001 DROP VIEW IF EXISTS `v1`*/;
 /*!50001 CREATE TABLE `v1` (
   `a` int(11)
-) */;
+) ENGINE=MyISAM */;
 /*!50001 DROP TABLE `v1`*/;
 /*!50001 DROP VIEW IF EXISTS `v1`*/;
 /*!50001 CREATE ALGORITHM=UNDEFINED */
@@ -2145,7 +2145,7 @@ DROP TABLE IF EXISTS `v2`;
 /*!50001 DROP VIEW IF EXISTS `v2`*/;
 /*!50001 CREATE TABLE `v2` (
   `a` varchar(30)
-) */;
+) ENGINE=MyISAM */;
 /*!50001 DROP TABLE `v2`*/;
 /*!50001 DROP VIEW IF EXISTS `v2`*/;
 /*!50001 CREATE ALGORITHM=UNDEFINED */
@@ -2249,19 +2249,19 @@ DROP TABLE IF EXISTS `v1`;
   `a` int(11),
   `b` int(11),
   `c` varchar(30)
-) */;
+) ENGINE=MyISAM */;
 DROP TABLE IF EXISTS `v2`;
 /*!50001 DROP VIEW IF EXISTS `v2`*/;
 /*!50001 CREATE TABLE `v2` (
   `a` int(11)
-) */;
+) ENGINE=MyISAM */;
 DROP TABLE IF EXISTS `v3`;
 /*!50001 DROP VIEW IF EXISTS `v3`*/;
 /*!50001 CREATE TABLE `v3` (
   `a` int(11),
   `b` int(11),
   `c` varchar(30)
-) */;
+) ENGINE=MyISAM */;
 /*!50001 DROP TABLE `v1`*/;
 /*!50001 DROP VIEW IF EXISTS `v1`*/;
 /*!50001 CREATE ALGORITHM=UNDEFINED */
@@ -2865,21 +2865,21 @@ DROP TABLE IF EXISTS `v0`;
   `a` int(11),
   `b` varchar(32),
   `c` varchar(32)
-) */;
+) ENGINE=MyISAM */;
 DROP TABLE IF EXISTS `v1`;
 /*!50001 DROP VIEW IF EXISTS `v1`*/;
 /*!50001 CREATE TABLE `v1` (
   `a` int(11),
   `b` varchar(32),
   `c` varchar(32)
-) */;
+) ENGINE=MyISAM */;
 DROP TABLE IF EXISTS `v2`;
 /*!50001 DROP VIEW IF EXISTS `v2`*/;
 /*!50001 CREATE TABLE `v2` (
   `a` int(11),
   `b` varchar(32),
   `c` varchar(32)
-) */;
+) ENGINE=MyISAM */;
 
 USE `test`;
 /*!50001 DROP TABLE `v0`*/;
@@ -3203,7 +3203,7 @@ DROP TABLE IF EXISTS `v1`;
 /*!50001 DROP VIEW IF EXISTS `v1`*/;
 /*!50001 CREATE TABLE `v1` (
   `id` int(11)
-) */;
+) ENGINE=MyISAM */;
 
 USE `mysqldump_test_db`;
 /*!50001 DROP TABLE `v1`*/;
@@ -3251,7 +3251,7 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/
 USE `mysqldump_views`;
 /*!50001 CREATE TABLE `nasishnasifu` (
   `id` bigint(20) unsigned
-) */;
+) ENGINE=MyISAM */;
 
 USE `mysqldump_tables`;
 

=== modified file 'mysql-test/t/compare.test'
--- a/mysql-test/t/compare.test	2008-02-15 13:47:32 +0000
+++ b/mysql-test/t/compare.test	2008-09-18 12:55:36 +0000
@@ -76,4 +76,13 @@ FROM t2 ORDER BY a;
 
 DROP TABLE t1,t2;
 
+#
+# Bug #39353: Multiple conditions on timestamp column crashes server
+#
+
+CREATE TABLE t1 (a TIMESTAMP); 
+INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
+SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
+DROP TABLE t1;
+
 --echo End of 5.0 tests

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2008-09-03 07:59:48 +0000
+++ b/sql/item.cc	2008-09-18 12:55:36 +0000
@@ -4220,7 +4220,12 @@ Item *Item_field::equal_fields_propagato
     item= this;
   else if (field && (field->flags & ZEROFILL_FLAG) && IS_NUM(field->type()))
   {
-    if (item && cmp_context != INT_RESULT)
+    /*
+      We don't need to zero-fill timestamp columns here because they will be 
+      first converted to a string (in date/time format) and compared as such if
+      compared with another string.
+    */
+    if (item && field->type() != FIELD_TYPE_TIMESTAMP && cmp_context != INT_RESULT)
       convert_zerofill_number_to_string(&item, (Field_num *)field);
     else
       item= this;

Thread
bzr commit into mysql-5.0-bugteam branch (kpettersson:2685) Kristofer Pettersson29 Sep