Implement ON CONFLICT and RETURNING (#666)

* Implement RETURNING on INSERT/UPDATE/DELETE

* Implement INSERT ... ON CONFLICT

* Fix tests

* cargo fmt

* tests: on conflict and returning

Co-authored-by: gamife <gamife9886@gmail.com>
This commit is contained in:
main() 2022-11-11 22:15:31 +01:00 committed by GitHub
parent ae1c69034e
commit 814367a6ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 250 additions and 8 deletions

View file

@ -195,6 +195,7 @@ fn parse_update_with_table_alias() {
assignments,
from: _from,
selection,
returning,
} => {
assert_eq!(
TableWithJoins {
@ -231,6 +232,7 @@ fn parse_update_with_table_alias() {
}),
selection
);
assert_eq!(None, returning);
}
_ => unreachable!(),
}
@ -278,6 +280,7 @@ fn parse_where_delete_statement() {
table_name,
using,
selection,
returning,
} => {
assert_eq!(
TableFactor::Table {
@ -298,6 +301,7 @@ fn parse_where_delete_statement() {
},
selection.unwrap(),
);
assert_eq!(None, returning);
}
_ => unreachable!(),
}
@ -313,6 +317,7 @@ fn parse_where_delete_with_alias_statement() {
table_name,
using,
selection,
returning,
} => {
assert_eq!(
TableFactor::Table {
@ -353,6 +358,7 @@ fn parse_where_delete_with_alias_statement() {
},
selection.unwrap(),
);
assert_eq!(None, returning);
}
_ => unreachable!(),
}