Skip to content

Parse error on MySQL dump #29

Open

Description

@majkrzak

I'm trying to parse MySQL dump, but it results in strange error:

(line 305, column 145166):
unexpected '\\'
expecting "n'", "N'", "b'", "B'", "x'", "X'", "u&'", "U&'", "'", "\"", "`", "--", "/*", digit, ".", "*/", ":", "[", "]", ",", ";", "(", ")", "?", ">=", "<=", "!=", "<>", "+", "-", "^", "*", "/", "%", "~", "&", "<", ">", "=", "|" or end of input

Line 305 is an INSERT statement and column 145166 is \ in Neue\'; c

Activity

  1. JakeWheat commented on Jun 27, 2020

    @JakeWheat
    Owner

    Thanks for the report. Can you try to parse the statement which is on line 305 on its own and see if that gives the same error, and if so, copy the entire statement here?

  2. majkrzak commented on Jun 27, 2020

    @majkrzak
    Author

    20KB line is not he best to deal with, but I find out that following code causes the problem:

    parseStatements mysql "" Nothing  "INSERT INTO tbl (col) VALUES('a\\'sd');INSERT INTO tbl (col) VALUES('a\\'sd');"

    Looks like ' escaping is not handled correctly.

  3. JakeWheat commented on Jun 28, 2020

    @JakeWheat
    Owner

    The following similar code works:

    parseStatements postgres "" Nothing "INSERT INTO tbl (col) VALUES(e'a\\'sd')"

    So almost all the code needed is there, it just needs a bit of tweaking. I think it should also use a new flag in the Dialect type, to say 'accept backslash escaped strings', because this isn't ansi syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions