PG Offline

PG Offline => Bug Report => Topic started by: pdellera on October 26, 2019, 12:02:59 AM

Title: MySql dump error
Post by: pdellera on October 26, 2019, 12:02:59 AM
In pgo 4.0.897, the dump for MySql uses a syntax for escaping single quotes (aka apostrophes aka ') that is not supported by MySql Workbench 8.0 CE.
Title: Re: MySql dump error
Post by: Wilson Logan on October 26, 2019, 03:15:27 PM
The MySQl reference manual says that it should be \'

https://dev.mysql.com/doc/refman/8.0/en/string-literals.html#character-escape-sequences


Escape Sequence   Character Represented by Sequence
\0   An ASCII NUL (X'00') character
\'   A single quote (') character
\"   A double quote (") character
\b   A backspace character
\n   A newline (linefeed) character
\r   A carriage return character
\t   A tab character
\Z   ASCII 26 (Control+Z); see note following the table
\\   A backslash (\) character
\%   A % character; see note following the table
\_   A _ character; see note following the table
Title: Re: MySql dump error
Post by: pdellera on October 28, 2019, 10:01:30 AM
Hmm, that wasn't my experience. When I executed the original dumped commands, I got errors on every occurrence of \'. After searching and replacing with '' (double quotes), the dump was imported without error.

Perhaps it's a configuration thing. If so, sorry to trouble you.
Title: Re: MySql dump error
Post by: dunhackin on November 05, 2019, 04:08:37 PM
I've just come across the same thing. What I've been able to establish is this; for single quotes (apostrophes) contained within a single quoted string:

1) \' is the MySQL way to do it
2) In my exports, it looks like the single quote has been replaced as \\' rather than \'
3) '' (replacing the single quote with two single quotes, not a double quote) is the ANSI SQL standard way to do it, which is also supported by MySQL

For my files I did a quick search & replace and used the two single quotes - imported nicely. Incidentally, the same problem exists in the SQLite dump and you can use the same fix, two single quotes

Hope that's helpful to all?

Del
Title: Re: MySql dump error
Post by: Wilson Logan on November 06, 2019, 11:14:49 AM
Thanks Del,

I will add your suggested changes to the Work Queue.

Cheers,

Wilson.