create table: add clone syntax (#542)

Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
This commit is contained in:
Maciej Obuchowski 2022-07-16 13:17:02 +02:00 committed by GitHub
parent c2ccc80c28
commit 5363d4e399
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 1 deletions

View file

@ -1992,6 +1992,18 @@ fn parse_create_table_with_options() {
}
}
#[test]
fn parse_create_table_clone() {
let sql = "CREATE OR REPLACE TABLE a CLONE a_tmp";
match verified_stmt(sql) {
Statement::CreateTable { name, clone, .. } => {
assert_eq!(ObjectName(vec![Ident::new("a")]), name);
assert_eq!(Some(ObjectName(vec![(Ident::new("a_tmp"))])), clone)
}
_ => unreachable!(),
}
}
#[test]
fn parse_create_table_trailing_comma() {
let sql = "CREATE TABLE foo (bar int,)";