Bug #4328 mysqldump should put newlines between insert records

Submitted: 29 Jun 2004 18:13 Modified: 29 Jun 2004 18:40
Reporter: Matt Carter Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:mysqldump Ver 10.7 Distrib 4.1.2-alpha OS:Windows (Windows 2000)
Assigned to: Dean Ellis CPU Architecture:Any

[29 Jun 2004 18:13] Matt Carter
Description:
4.1.2a appears to have changed the format of the mysqldump export file slightly.  Now, records to be inserted into a single table are all run together on a single line.  This makes it difficult to view the data and difficult to view changes using a standard line-oriented difference viewer like "diff".

I believe the purpose of making mysqldump's output text, as opposed to raw data, is to make the file human-readable.  Putting all the data for a table onto a single line seems to go against that goal.

How to repeat:
Create a table with multiple records.
From the command line, run "mysqldump", specifying the database and table name.  Capture stdout to a file.
Note that the "INSERT INTO" statement in that file has all of its records (in the "VALUES" clause) on a single very long line.

Suggested fix:
Add a newline at the beginning of each record to be inserted.  (The SQL parser for the "INSERT INTO" statement has no problem parsing a SQL statement containing newlines.)
[29 Jun 2004 18:40] Dean Ellis
4.1 enables the --opt option by default, which enables --extended-insert, which is what you are seeing.  You can get the old behavior with --skip-extended-insert or --skip-opt.
[2 Oct 2007 13:45] Alex W
The request here is different. I want to use extended inserts for performance reasons, but I also want to be able to read the result of mysqldump myself (and have a readable diff of .sql files in the source control system).
[2 May 2011 23:03] Tim Riker
Would a patch for this be accepted? Some command line option like --extended-inserts-multiline or similar?

should just add to this change this:

row_length= 2 + extended_row.length;

adding 1 more for *nix platforms. May need to add 2 more for crlf on windows. And then here:

fputc(',',md_result_file);

becomes:

fputs(",\n", md_result_file);

again, when the option is set.
[2 May 2011 23:35] Tim Riker
can we re-open this as a feature request?
[30 May 2012 15:08] Jamie Jackson
Started an enhancement request: http://bugs.mysql.com/bug.php?id=65465

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

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