List:Internals« Previous MessageNext Message »
From:eugene Date:September 5 2005 7:57pm
Subject:bk commit into 5.0 tree (evgen:1.1909) BUG#12799
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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
  1.1909 05/09/05 23:57:49 evgen@stripped +5 -0
  Fix bug #12799 one result returned when change from summer time causes dup 
  unique key recs
  
  'EST5EDT' is timezone with daylight saving time info. Thus some timestamps
  can't be converted from it to GMT unambiguously. This results in not all
  rows being returned.
  
  This patch disables using of index on timestamp field if current timezone is
  with daylight saving time info.

  mysql-test/t/timezone2.test
    1.10 05/09/05 23:57:27 evgen@stripped +12 -0
    Test case for bug #12799 one result returned when change from summer time causes dup unique key recs.

  mysql-test/r/timezone2.result
    1.13 05/09/05 23:56:54 evgen@stripped +14 -0
    Test case for bug #12799 one result returned when change from summer time causes dup unique key recs.

  sql/tztime.h
    1.13 05/09/05 23:56:15 evgen@stripped +1 -0
     Fix bug #12799 one result returned when change from summer time causes dup unique key recs.

  sql/tztime.cc
    1.26 05/09/05 23:56:02 evgen@stripped +3 -2
    Fix bug #12799 one result returned when change from summer time causes dup unique key recs.

  sql/sql_select.cc
    1.363 05/09/05 23:55:31 evgen@stripped +10 -0
    Fix bug #12799 one result returned when change from summer time causes dup unique key recs.

# 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:	evgen
# Host:	moonbone.local
# Root:	/work/12799-bug-5.0-mysql

--- 1.362/sql/sql_select.cc	2005-08-27 11:09:51 +04:00
+++ 1.363/sql/sql_select.cc	2005-09-05 23:55:31 +04:00
@@ -2683,6 +2683,16 @@
     }
     if (!optimizable)
       return;
+    /*
+      Don't use index on timestamp field if timezone is set with
+      daylight saving time.
+    */
+    if (field->type() == FIELD_TYPE_TIMESTAMP)
+    {
+      Time_zone *tz= field->table->in_use->variables.time_zone;
+      if (tz->have_dst())
+        return;
+    }
     if (!(usable_tables & field->table->map))
     {
       if (!eq_func || (*value)->type() != Item::NULL_ITEM ||

--- 1.12/mysql-test/r/timezone2.result	2005-07-19 03:12:40 +04:00
+++ 1.13/mysql-test/r/timezone2.result	2005-09-05 23:56:54 +04:00
@@ -268,3 +268,17 @@
 convert_tz(NULL, NULL, NULL)
 NULL
 drop table t1;
+create table t1 (f1 timestamp, f2 timestamp, unique key(f1), key(f2));
+set time_zone='UTC';
+insert into t1 values ('2001-10-27 22:00:00','2001-10-27 22:00:00'),
+('2001-10-27 23:00:00','2001-10-27 23:00:00');
+set time_zone='Europe/Moscow';
+select f1 from t1 where f1='2001-10-28 02:00:00';
+f1
+2001-10-28 02:00:00
+2001-10-28 02:00:00
+select f2 from t1 where f2='2001-10-28 02:00:00';
+f2
+2001-10-28 02:00:00
+2001-10-28 02:00:00
+drop table t1;

--- 1.9/mysql-test/t/timezone2.test	2005-07-28 17:12:37 +04:00
+++ 1.10/mysql-test/t/timezone2.test	2005-09-05 23:57:27 +04:00
@@ -221,4 +221,16 @@
 select * from t1;
 drop table t1;
 
+#
+# Bug #12799 one result returned when change from summer time causes dup 
+#            unique key recs
+create table t1 (f1 timestamp, f2 timestamp, unique key(f1), key(f2));
+set time_zone='UTC';
+insert into t1 values ('2001-10-27 22:00:00','2001-10-27 22:00:00'),
+                      ('2001-10-27 23:00:00','2001-10-27 23:00:00');
+set time_zone='Europe/Moscow';
+select f1 from t1 where f1='2001-10-28 02:00:00';
+select f2 from t1 where f2='2001-10-28 02:00:00';
+drop table t1;
+
 # End of 4.1 tests

--- 1.25/sql/tztime.cc	2005-07-31 13:49:47 +04:00
+++ 1.26/sql/tztime.cc	2005-09-05 23:56:02 +04:00
@@ -130,7 +130,7 @@
     there are no transitions at all.
   */
   TRAN_TYPE_INFO *fallback_tti;
-
+  bool have_dst; /* <=>  timezone with  daylight saving */
 } TIME_ZONE_INFO;
 
 
@@ -1147,6 +1147,7 @@
                                     my_bool *in_dst_time_gap) const;
   virtual void gmt_sec_to_TIME(TIME *tmp, my_time_t t) const;
   virtual const String * get_name() const;
+  virtual bool have_dst() { return tz_info->have_dst; }
 private:
   TIME_ZONE_INFO *tz_info;
   const String *tz_name;
@@ -1873,7 +1874,7 @@
 
     ttis[ttid].tt_gmtoff= (long)table->field[2]->val_int();
     ttis[ttid].tt_isdst= (table->field[3]->val_int() > 0);
-
+    tz_info->have_dst|= ttis[ttid].tt_isdst;
 #ifdef ABBR_ARE_USED
     // FIXME should we do something with duplicates here ?
     table->field[4]->val_str(&abbr, &abbr);

--- 1.12/sql/tztime.h	2005-07-31 13:49:47 +04:00
+++ 1.13/sql/tztime.h	2005-09-05 23:56:15 +04:00
@@ -55,6 +55,7 @@
     allocated on MEM_ROOT and should not require destruction.
   */
   virtual ~Time_zone() {};
+  virtual bool have_dst() { return 0; }
 };
 
 extern Time_zone * my_tz_UTC;
Thread
bk commit into 5.0 tree (evgen:1.1909) BUG#12799eugene5 Sep