News:

Yahoo Groups closing on Dec 14th 2019

Main Menu

MySql dump error

Started by pdellera, October 26, 2019, 12:02:59 AM

Previous topic - Next topic

pdellera

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.

  • What  is generated: \' (backslash single quote)
  • What is supported: '' (double single quotes)

Wilson Logan

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

pdellera

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.

dunhackin

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

Wilson Logan

Thanks Del,

I will add your suggested changes to the Work Queue.

Cheers,

Wilson.


SMF spam blocked by CleanTalk