Bug #58491 --compact removes --tz-utc in mysqldump
Submitted: 25 Nov 2010 12:59 Modified: 27 Nov 2010 11:34
Reporter: Daniel Fiske Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:5.1.52, 5.0, 5.1, 5.6.1 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: mysqldump, tz-utc
Triage: Needs Triage: D3 (Medium) / R6 (Needs Assessment) / E6 (Needs Assessment)

[25 Nov 2010 12:59] Daniel Fiske
Description:
Due to --compact implying --skip-comments, --tz-utc is rendered disabled.

How to repeat:
execute

mysqldump --compact --tz-utc |grep -i "time_zone"

vs

mysqldump --tz-utc |grep -i "time_zone"

Suggested fix:
Unknown....considering that --skip-tz-utc can essentially "break" backup/restore or script based synchronisation and that --tz-utc is default (suggesting it is important) it seems there should be some fix that forces --tz-utc output even in compact mode.

It could be "fixed" by documenting it, however I believe this behaviour is unintentional and not the intended behaviour.
[25 Nov 2010 13:15] Daniel Fiske
Sorry, --compact's inclusion of --skip-comments has nothing to do with it.

Seems the output from

--compact 

is not equivalent to 

--skip-add-drop-table --skip-add-locks --skip-comments --skip-disable-keys --skip-set-charset 

as suggested by the documentation.

http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_compact

--compact seems to drop the following lines.

/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
[27 Nov 2010 11:34] Sveta Smirnova
Thank you for the report.

Verified as described.