mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-27 01:14:07 +00:00
Support INSERT IGNORE
in MySql
and GenericDialect
(#1004)
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
6739d377bd
commit
86aa1b96be
3 changed files with 50 additions and 1 deletions
|
@ -972,6 +972,47 @@ fn parse_simple_insert() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_ignore_insert() {
|
||||
let sql = r"INSERT IGNORE INTO tasks (title, priority) VALUES ('Test Some Inserts', 1)";
|
||||
|
||||
match mysql_and_generic().verified_stmt(sql) {
|
||||
Statement::Insert {
|
||||
table_name,
|
||||
columns,
|
||||
source,
|
||||
on,
|
||||
ignore,
|
||||
..
|
||||
} => {
|
||||
assert_eq!(ObjectName(vec![Ident::new("tasks")]), table_name);
|
||||
assert_eq!(vec![Ident::new("title"), Ident::new("priority")], columns);
|
||||
assert!(on.is_none());
|
||||
assert!(ignore);
|
||||
assert_eq!(
|
||||
Box::new(Query {
|
||||
with: None,
|
||||
body: Box::new(SetExpr::Values(Values {
|
||||
explicit_row: false,
|
||||
rows: vec![vec![
|
||||
Expr::Value(Value::SingleQuotedString("Test Some Inserts".to_string())),
|
||||
Expr::Value(number("1"))
|
||||
]]
|
||||
})),
|
||||
order_by: vec![],
|
||||
limit: None,
|
||||
limit_by: vec![],
|
||||
offset: None,
|
||||
fetch: None,
|
||||
locks: vec![]
|
||||
}),
|
||||
source
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_empty_row_insert() {
|
||||
let sql = "INSERT INTO tb () VALUES (), ()";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue