List:Commits« Previous MessageNext Message »
From:Gleb Shchepa Date:September 2 2010 2:23pm
Subject:bzr commit into mysql-5.1-bugteam branch (gshchepa:3498) Bug#55779
View as plain text  
#At file:///mnt/sda7/work/55779-5.1-bugteam/ based on revid:davi.arnaut@stripped

 3498 Gleb Shchepa	2010-09-02
      Bug #55779: select does not work properly in mysql server
                  Version "5.1.42 SUSE MySQL RPM"
      
      When a query was using a DATE or DATETIME value formatted
      using different formatting than "yyyy-mm-dd HH:MM:SS", a
      query with a greater-or-equal '>=' condition matched only
      greater values in an indexed TIMESTAMP column.
      
      The problem was introduced by the fix for the bug 46362
      and partially solved (for DATE and DATETIME columns only)
      by the fix for the bug 47925.
      
      The stored_field_cmp_to_item function has been modified
      to take into account TIMESTAMP columns like we do for
      DATE and DATETIME columns.
     @ mysql-test/r/type_timestamp.result
        Test case for bug #55779.
     @ mysql-test/t/type_timestamp.test
        Test case for bug #55779.
     @ sql/item.cc
        Bug #55779: select does not work properly in mysql server
                    Version "5.1.42 SUSE MySQL RPM"
        
        The stored_field_cmp_to_item function has been modified
        to take into account TIMESTAMP columns like we do for
        DATE and DATETIME.

    modified:
      mysql-test/r/type_timestamp.result
      mysql-test/t/type_timestamp.test
      sql/item.cc
=== modified file 'mysql-test/r/type_timestamp.result'
--- a/mysql-test/r/type_timestamp.result	2010-02-09 10:30:50 +0000
+++ b/mysql-test/r/type_timestamp.result	2010-09-02 14:23:02 +0000
@@ -527,3 +527,24 @@ f1	f2-f3
 5	0
 DROP TABLE t1;
 End of 5.0 tests
+#
+# Bug #55779: select does not work properly in mysql server
+#             Version "5.1.42 SUSE MySQL RPM"
+#
+CREATE TABLE t1 (a TIMESTAMP, KEY (a));
+INSERT INTO t1 VALUES ('2000-01-01 00:00:00'), ('2000-01-01 00:00:00'),
+('2000-01-01 00:00:01'), ('2000-01-01 00:00:01');
+SELECT a FROM t1 WHERE a >=  20000101000000;
+a
+2000-01-01 00:00:00
+2000-01-01 00:00:00
+2000-01-01 00:00:01
+2000-01-01 00:00:01
+SELECT a FROM t1 WHERE a >= '20000101000000';
+a
+2000-01-01 00:00:00
+2000-01-01 00:00:00
+2000-01-01 00:00:01
+2000-01-01 00:00:01
+DROP TABLE t1;
+End of 5.1 tests

=== modified file 'mysql-test/t/type_timestamp.test'
--- a/mysql-test/t/type_timestamp.test	2009-01-31 01:08:41 +0000
+++ b/mysql-test/t/type_timestamp.test	2010-09-02 14:23:02 +0000
@@ -357,3 +357,20 @@ SELECT f1,f2-f3 FROM t1;
 DROP TABLE t1;
 
 --echo End of 5.0 tests
+
+--echo #
+--echo # Bug #55779: select does not work properly in mysql server
+--echo #             Version "5.1.42 SUSE MySQL RPM"
+--echo #
+
+CREATE TABLE t1 (a TIMESTAMP, KEY (a));
+
+INSERT INTO t1 VALUES ('2000-01-01 00:00:00'), ('2000-01-01 00:00:00'),
+                      ('2000-01-01 00:00:01'), ('2000-01-01 00:00:01');
+
+SELECT a FROM t1 WHERE a >=  20000101000000;
+SELECT a FROM t1 WHERE a >= '20000101000000';
+
+DROP TABLE t1;
+
+--echo End of 5.1 tests

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2010-07-20 18:07:36 +0000
+++ b/sql/item.cc	2010-09-02 14:23:02 +0000
@@ -6970,14 +6970,16 @@ int stored_field_cmp_to_item(THD *thd, F
 
     enum_field_types field_type= field->type();
 
-    if (field_type == MYSQL_TYPE_DATE || field_type == MYSQL_TYPE_DATETIME)
+    if (field_type == MYSQL_TYPE_DATE || field_type == MYSQL_TYPE_DATETIME ||
+        field_type == MYSQL_TYPE_TIMESTAMP)
     {
       enum_mysql_timestamp_type type= MYSQL_TIMESTAMP_ERROR;
 
       if (field_type == MYSQL_TYPE_DATE)
         type= MYSQL_TIMESTAMP_DATE;
 
-      if (field_type == MYSQL_TYPE_DATETIME)
+      if (field_type == MYSQL_TYPE_DATETIME ||
+          field_type == MYSQL_TYPE_TIMESTAMP)
         type= MYSQL_TIMESTAMP_DATETIME;
         
       const char *field_name= field->field_name;


Attachment: [text/bzr-bundle] bzr/gshchepa@mysql.com-20100902142302-t49zs8jmjghisvph.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (gshchepa:3498) Bug#55779Gleb Shchepa2 Sep