Bug #23848 mysqldump with --skip-opt breaks table - auto_increment attribute

Submitted: 1 Nov 2006 18:11 Modified: 1 Nov 2006 21:01
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:tested on 4.1.21 and 5.0.22 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[1 Nov 2006 18:11] [ name withheld ]
Description:
i belive that mysqldump --skip-opt dumping breaks table definitions:

an example:
# mysql --version
mysql  Ver 14.7 Distrib 4.1.21, for pc-linux-gnu (i686) using readline 4.3

# mysqldump -d db

-- MySQL dump 10.9
--
-- Host: localhost    Database: spletkar
-- ------------------------------------------------------
-- Server version       4.1.21-standard-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!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 */;

--
-- Table structure for table `cms_phpwcms_address`
--

DROP TABLE IF EXISTS `cms_phpwcms_address`;
CREATE TABLE `cms_phpwcms_address` (
  `address_id` int(11) NOT NULL auto_increment,
  `address_key` varchar(255) NOT NULL default '',
  `address_email` varchar(255) NOT NULL default '',
  `address_name` text NOT NULL,
  `address_verified` int(1) NOT NULL default '0',
  `address_tstamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `address_subscription` blob NOT NULL,
  PRIMARY KEY  (`address_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
...

# mysqldump --skip-opt -d db
-- MySQL dump 10.9
--
-- Host: localhost    Database: spletkar
-- ------------------------------------------------------
-- Server version       4.1.21-standard-log
/*!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 */;

--
-- Table structure for table `cms_phpwcms_address`
--

CREATE TABLE `cms_phpwcms_address` (
  `address_id` int(11) NOT NULL,
  `address_key` varchar(255) NOT NULL default '',
  `address_email` varchar(255) NOT NULL default '',
  `address_name` text NOT NULL,
  `address_verified` int(1) NOT NULL default '0',
  `address_tstamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `address_subscription` blob NOT NULL,
  PRIMARY KEY  (`address_id`)
);
...

and almost the same on a different box

# mysql --version
mysql  Ver 14.12 Distrib 5.0.22, for redhat-linux-gnu (i386) using readline 5.0

# mysqldump -d db
...
CREATE TABLE `phpwcms_guestbook` (
  `guestbook_id` int(11) NOT NULL auto_increment,
  `guestbook_cid` int(11) NOT NULL default '0',
...

# mysqldump --skip-opt -d db
...
CREATE TABLE `phpwcms_guestbook` (
  `guestbook_id` int(11) NOT NULL,
  `guestbook_cid` int(11) NOT NULL default '0',
...

How to repeat:
mysqldump --opt -dA | grep -ci 'auto_increment'

mysqldump --skip-opt -dA | grep -ci 'auto_increment'

and see if the numbers match

Suggested fix:
don't use --skip-opt :)
[1 Nov 2006 21:01] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Read carefull at http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html which options includes --opt shorthand
[16 Nov 2009 15:00] Ralf Hauser
see also Bug #22941

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.