Bug #55805 force option is not working properly

Submitted: 6 Aug 2010 15:33 Modified: 9 Aug 2010 16:44
Reporter: Jafo C Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.0.77 OS:Linux
Assigned to: CPU Architecture:Any
Tags: force, restore

[6 Aug 2010 15:33] Jafo C
Description:
When using the -f or --force option while importing data from a file, execution stops with an error message instead of continuing as stated in the documentation.

See the force option:

http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html  

"Continue even if an SQL error occurs."

Forum discussion here:

http://forums.mysql.com/read.php?20,379534,379675

How to repeat:
try this import into a database named test:

mysql -f test < test.sql

Add these contents to test.sql before you run the import (the error is on purpose):

SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `test`
-- ----------------------------
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
  `id` int(11) NOT NULL auto_increment,
  `test` text,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of test
-- ----------------------------
INSERT INTO `test` VALUES ('1', 'test 1');
INSERT INTO `test` VALUES ('2', 'test '2');
INSERT INTO `test` VALUES ('3', 'test 3');
[7 Aug 2010 11:07] Sveta Smirnova
Thank you for the report.

In my case execution stops at last statement

INSERT INTO `test` VALUES ('2', 'test '2');
INSERT INTO `test` VALUES ('3', 'test 3');

Why do you think it should continue?
[7 Aug 2010 23:58] Jafo C
In my execution, the last line executed is:

INSERT INTO `test` VALUES ('2', 'test '2');

That is where it throws an error and stops.
[9 Aug 2010 16:38] Sveta Smirnova
Thank you for the feedback.

As you have extra ' in the line INSERT INTO `test` VALUES ('2', 'test '2'); this is not last query. Therefore this is not a bug.
[9 Aug 2010 16:44] Jafo C
Why does it matter if it is the last query or not?  It only "continues on errors" if it is the last query and continuing would not matter anyway?

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

Page generated in 0.088 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.