Handle CREATE [TEMPORARY|TEMP] VIEW [IF NOT EXISTS] (#993)

This commit is contained in:
Gabriel Villalonga Simon 2023-10-05 20:32:43 +01:00 committed by GitHub
parent 02f3d78a92
commit 5263da68cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 106 additions and 4 deletions

View file

@ -61,6 +61,37 @@ fn parse_create_virtual_table() {
sqlite_and_generic().verified_stmt(sql);
}
#[test]
fn parse_create_view_temporary_if_not_exists() {
let sql = "CREATE TEMPORARY VIEW IF NOT EXISTS myschema.myview AS SELECT foo FROM bar";
match sqlite_and_generic().verified_stmt(sql) {
Statement::CreateView {
name,
columns,
query,
or_replace,
materialized,
with_options,
cluster_by,
with_no_schema_binding: late_binding,
if_not_exists,
temporary,
} => {
assert_eq!("myschema.myview", name.to_string());
assert_eq!(Vec::<Ident>::new(), columns);
assert_eq!("SELECT foo FROM bar", query.to_string());
assert!(!materialized);
assert!(!or_replace);
assert_eq!(with_options, vec![]);
assert_eq!(cluster_by, vec![]);
assert!(!late_binding);
assert!(if_not_exists);
assert!(temporary);
}
_ => unreachable!(),
}
}
#[test]
fn double_equality_operator() {
// Sqlite supports this operator: https://www.sqlite.org/lang_expr.html#binaryops