Author Topic: MySql dump error  (Read 234 times)

pdellera

  • Newbie
  • *
  • Posts: 4
MySql dump error
« on: October 25, 2019, 04:02:59 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 2790
    • Email
Re: MySql dump error
« Reply #1 on: October 26, 2019, 07:15:27 AM »
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

  • Newbie
  • *
  • Posts: 4
Re: MySql dump error
« Reply #2 on: October 28, 2019, 03: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.

dunhackin

  • Newbie
  • *
  • Posts: 1
Re: MySql dump error
« Reply #3 on: November 05, 2019, 09:08:37 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 2790
    • Email
Re: MySql dump error
« Reply #4 on: November 06, 2019, 04:14:49 AM »
Thanks Del,

I will add your suggested changes to the Work Queue.

Cheers,

Wilson.


 

SMF spam blocked by CleanTalk