apache / apache/datafusion-sqlparser-rs
MySql dialect doesn't handle slash-escaped single quotes
- 主要言語
- Rust
- スター
- 3.5k
- フォーク
- 772
- 平均マージ
- 4日 9時間
- マージ済み PR(30日)
- 17
説明
The following fails to parse:
```rust
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](https://dev.mysql.com/doc/refman/8.0/en/string-literals.html) explicitly mention this as a valid escaping (see Table 9.1).
This is, according to [this doc](https://www.ibm.com/docs/en/informix-servers/12.10?topic=statements-quotation-marks-escape-characters) 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?
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
tokenizer と Parser::parse_sql が使用する MySqlDialect のパスから始め、続いて提示された INSERT の例を再現して、スラッシュでエスケープされた単一引用符がどのようにトークン化されるかを追跡します。完了条件は、この MySQL 入力が、エスケープされた引用符を文字列の終端として扱わずに正常にパースされることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- mysql, rust
- 領域
- databases
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100