mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-16 04:54:59 +00:00
Fix escaping of trailing quote in quoted identifiers (#505)
* Generalize EscapeSingleQuoteString to arbitrary quote character * Fix escaping of trailing quote in quoted identifiers * Add new tests instead of modifying existing tests
This commit is contained in:
parent
cc2559c097
commit
d19c6c323c
4 changed files with 56 additions and 18 deletions
|
@ -325,6 +325,40 @@ fn parse_quote_identifiers_2() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_quote_identifiers_3() {
|
||||
let sql = "SELECT ```quoted identifier```";
|
||||
assert_eq!(
|
||||
mysql().verified_stmt(sql),
|
||||
Statement::Query(Box::new(Query {
|
||||
with: None,
|
||||
body: SetExpr::Select(Box::new(Select {
|
||||
distinct: false,
|
||||
top: None,
|
||||
projection: vec![SelectItem::UnnamedExpr(Expr::Identifier(Ident {
|
||||
value: "`quoted identifier`".into(),
|
||||
quote_style: Some('`'),
|
||||
}))],
|
||||
into: None,
|
||||
from: vec![],
|
||||
lateral_views: vec![],
|
||||
selection: None,
|
||||
group_by: vec![],
|
||||
cluster_by: vec![],
|
||||
distribute_by: vec![],
|
||||
sort_by: vec![],
|
||||
having: None,
|
||||
qualify: None
|
||||
})),
|
||||
order_by: vec![],
|
||||
limit: None,
|
||||
offset: None,
|
||||
fetch: None,
|
||||
lock: None,
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_unterminated_escape() {
|
||||
let sql = r#"SELECT 'I\'m not fine\'"#;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue