Bug #20382 mysqldump --result-file should not create half-empty file on errors
Submitted: 11 Jun 2006 19:35 Modified: 24 Jul 2006 18:38
Reporter: Christian Hammers (Silver Quality Contributor) (SCA) Email Updates:
Status: Closed
Category:Server: Docs Severity:S3 (Non-critical)
Version:all OS:Any (all)
Assigned to: Paul DuBois Target Version:
Triage: D4 (Minor)

[11 Jun 2006 19:35] Christian Hammers
Description:
As reported as Debian bug #372313 by Robert Sander:

If "mysqldump --result-file" is asked to dump a non-existant table, the output file
consists only 
of the typical mysqldump header with no data. It would be nicer if the result file (which
possibly contains the last valid dump of the table) would not be touched at all before the
existence of the table has been checked.

How to repeat:
mysqldump --result-file=x sometablename

Suggested fix:
First the check then the action :)
[13 Jun 2006 10:13] Valeriy Kravchuk
Thank you for a problem report. Verified just as described with 5.0.23-BK on Linux:

openxs@suse:~/dbs/5.0> bin/mysqldump -uroot test sometablename
-- MySQL dump 10.10
--
-- Host: localhost    Database: test
-- ------------------------------------------------------
-- Server version       5.0.23

/*!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 */;
/*!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 */;
mysqldump: Couldn't find table: "sometablename"

I think, it is a bug/documentation request. This results is not clearly documented at
http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html.
[24 Jul 2006 18:38] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The
updated documentation will appear on our website shortly, and will be included in the
next release of the relevant products.