add support for insert into ... select ... returning ... (#1132)

This commit is contained in:
Ophir LOJKINE 2024-02-12 22:44:22 +01:00 committed by GitHub
parent a5ac425f46
commit d59b6638fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View file

@ -225,6 +225,25 @@ fn parse_insert_default_values() {
);
}
#[test]
fn parse_insert_select_returning() {
verified_stmt("INSERT INTO t SELECT 1 RETURNING 2");
let stmt = verified_stmt("INSERT INTO t SELECT x RETURNING x AS y");
match stmt {
Statement::Insert {
returning: Some(ret),
source: Some(_),
..
} => assert_eq!(ret.len(), 1),
_ => unreachable!(),
}
}
#[test]
fn parse_returning_as_column_alias() {
verified_stmt("SELECT 1 AS RETURNING");
}
#[test]
fn parse_insert_sqlite() {
let dialect = SQLiteDialect {};