mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-12-23 11:12:51 +00:00
Add support for UPDATE ... LIMIT ... (#1991)
Some checks are pending
license / Release Audit Tool (RAT) (push) Waiting to run
Rust / codestyle (push) Waiting to run
Rust / lint (push) Waiting to run
Rust / benchmark-lint (push) Waiting to run
Rust / compile (push) Waiting to run
Rust / docs (push) Waiting to run
Rust / compile-no-std (push) Waiting to run
Rust / test (beta) (push) Waiting to run
Rust / test (nightly) (push) Waiting to run
Rust / test (stable) (push) Waiting to run
Some checks are pending
license / Release Audit Tool (RAT) (push) Waiting to run
Rust / codestyle (push) Waiting to run
Rust / lint (push) Waiting to run
Rust / benchmark-lint (push) Waiting to run
Rust / compile (push) Waiting to run
Rust / docs (push) Waiting to run
Rust / compile-no-std (push) Waiting to run
Rust / test (beta) (push) Waiting to run
Rust / test (nightly) (push) Waiting to run
Rust / test (stable) (push) Waiting to run
This commit is contained in:
parent
67fca82495
commit
27544f9343
6 changed files with 36 additions and 1 deletions
|
|
@ -485,7 +485,8 @@ fn parse_update_tuple_row_values() {
|
|||
joins: vec![],
|
||||
},
|
||||
from: None,
|
||||
returning: None
|
||||
returning: None,
|
||||
limit: None
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -592,6 +593,23 @@ fn test_regexp_operator() {
|
|||
sqlite().verified_only_select(r#"SELECT count(*) FROM messages WHERE msg_text REGEXP '\d+'"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_update_delete_limit() {
|
||||
match sqlite().verified_stmt("UPDATE foo SET bar = 1 LIMIT 99") {
|
||||
Statement::Update { limit, .. } => {
|
||||
assert_eq!(limit, Some(Expr::value(number("99"))));
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
match sqlite().verified_stmt("DELETE FROM foo LIMIT 99") {
|
||||
Statement::Delete(Delete { limit, .. }) => {
|
||||
assert_eq!(limit, Some(Expr::value(number("99"))));
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn sqlite() -> TestedDialects {
|
||||
TestedDialects::new(vec![Box::new(SQLiteDialect {})])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue