Skip to content

MySql dialect doesn't handle slash-escaped single quotes #362

Open
@WesleyAC

Description

@WesleyAC

The following fails to parse:

fn main() {
    println!("{:?}",
        sqlparser::parser::Parser::parse_sql(
            &sqlparser::dialect::MySqlDialect {},
            r#"INSERT INTO `example` (`col`) VALUES ('foo \'bar\' baz');"#
        )
    );
}

Instead returning:

Err(ParserError("Expected ), found: bar"))

But I believe it shouldn't — mysqldump generates SQL that is escaped like this, and the docs explicitly mention this as a valid escaping (see Table 9.1).

This is, according to this doc a difference between ANSI SQL and MySQL, but unfortunately this needs to be fixed in the tokenizer, which AFAICT the dialect system doesn't have a way to hook into?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions