From: Date: October 10 2005 8:25pm Subject: bk commit into 5.0 tree (patg:1.2023) BUG#13052 List-Archive: http://lists.mysql.com/internals/30872 X-Bug: 13052 Message-Id: <20051010182553.34F1E915835@radha.local> Below is the list of changes that have just been committed into a local 5.0 repository of patg. When patg 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.2023 05/10/10 20:25:13 patg@stripped +4 -0 BUG #13052 Added --tz-utc option to mysqldump for being able to dump between servers with different time zones mysql-test/t/mysqldump.test 1.69 05/10/10 20:24:42 patg@stripped +14 -0 BUG #13052 New tests for bug 13052 to make sure date types reload correctly with time zone set to UTC mysql-test/r/mysqldump.result 1.74 05/10/10 20:24:42 patg@stripped +13 -0 BUG #13052 New test results to test time zone issues client/mysqldump.c 1.204 05/10/10 20:24:41 patg@stripped +22 -1 BUG #13052 Added opt_tz_utc/--tz-utc to put "SET TIME_ZONE=UTC" at the top of the dump to allow problem-free dumping between servers with different time zone settings. client/client_priv.h 1.43 05/10/10 20:24:40 patg@stripped +1 -1 BUG #13052 Added OPT_TZ_UTC # 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: patg # Host: radha.local # Root: /Users/patg/mysql-build/mysql-5.0.clean --- 1.203/client/mysqldump.c 2005-09-27 18:40:42 +02:00 +++ 1.204/client/mysqldump.c 2005-10-10 20:24:41 +02:00 @@ -92,7 +92,7 @@ opt_single_transaction=0, opt_comments= 0, opt_compact= 0, opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0, opt_complete_insert= 0, opt_drop_database= 0, - opt_dump_triggers= 0, opt_routines=0; + opt_dump_triggers= 0, opt_routines=0, opt_tz_utc=0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static MYSQL mysql_connection,*sock=0; static my_bool insert_pat_inited=0; @@ -385,6 +385,9 @@ {"triggers", OPT_TRIGGERS, "Dump triggers for each dumped table", (gptr*) &opt_dump_triggers, (gptr*) &opt_dump_triggers, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"tz-utc", OPT_TZ_UTC, + "SET TIME_ZONE='UTC' at top of dump to allow dumping of date types between servers with different time zones.", + (gptr*) &opt_tz_utc, (gptr*) &opt_tz_utc, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DONT_ALLOW_USER_CHANGE {"user", 'u', "User for login if not current user.", (gptr*) ¤t_user, (gptr*) ¤t_user, 0, GET_STR, REQUIRED_ARG, @@ -509,6 +512,10 @@ "\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;" "\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;" "\n/*!40101 SET NAMES %s */;\n",default_charset); + + if (opt_tz_utc) + fprintf(sql_file, "\n/*!40103 SET TIME_ZONE='UTC' */;\n"); + if (!path) { fprintf(md_result_file,"\ @@ -901,6 +908,20 @@ mysql_close(sock); safe_exit(EX_MYSQLERR); return 1; + } + /* + set time_zone to UTC to allow dumping date types between servers with + different time zone settings + */ + if (opt_tz_utc) + { + my_snprintf(buff, sizeof(buff), "/*!40103 SET TIME_ZONE='UTC' */"); + if (mysql_query_with_error_report(sock, 0, buff)) + { + mysql_close(sock); + safe_exit(EX_MYSQLERR); + return 1; + } } return 0; } /* dbConnect */ --- 1.42/client/client_priv.h 2005-08-26 14:56:46 +02:00 +++ 1.43/client/client_priv.h 2005-10-10 20:24:40 +02:00 @@ -51,5 +51,5 @@ #endif OPT_TRIGGERS, OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, - OPT_AUTO_CLOSE + OPT_TZ_UTC, OPT_AUTO_CLOSE }; --- 1.73/mysql-test/r/mysqldump.result 2005-09-30 09:40:22 +02:00 +++ 1.74/mysql-test/r/mysqldump.result 2005-10-10 20:24:42 +02:00 @@ -2123,3 +2123,16 @@ DROP PROCEDURE bug9056_proc1; DROP PROCEDURE bug9056_proc2; drop table t1; +drop table if exists t1; +set global time_zone='Europe/Moscow'; +create table t1 (`date` timestamp, unique key dates(`date`)); +set time_zone='UTC'; +insert into t1 values ('2003-10-26 08:00:00'),('2003-10-26 09:00:00'); +select * from t1; +date +2003-10-26 08:00:00 +2003-10-26 09:00:00 +select * from t1; +date +2003-10-26 08:00:00 +2003-10-26 09:00:00 --- 1.68/mysql-test/t/mysqldump.test 2005-09-30 22:37:50 +02:00 +++ 1.69/mysql-test/t/mysqldump.test 2005-10-10 20:24:42 +02:00 @@ -907,3 +907,17 @@ DROP PROCEDURE bug9056_proc2; drop table t1; +# bug 130528 +--disable_warnings +drop table if exists t1; +--enable_warnings +set global time_zone='Europe/Moscow'; +create table t1 (`date` timestamp, unique key dates(`date`)); +set time_zone='UTC'; +insert into t1 values ('2003-10-26 08:00:00'),('2003-10-26 09:00:00'); +select * from t1; +--exec $MYSQL_DUMP --tz-utc --skip-comments --databases test > var/tmp/bug130528.sql +# test to see that all the tables reload properly +--exec $MYSQL test < var/tmp/bug130528.sql +# check to see if the dates are what they should be +select * from t1;