Support CREATE MATERIALIZED VIEW

This commit is contained in:
Nikhil Benesch 2019-03-06 17:19:40 -05:00
parent 52e0f55b6f
commit 23a0fc79f5
No known key found for this signature in database
GPG key ID: F7386C5DEADABA7F
4 changed files with 26 additions and 5 deletions

View file

@ -901,9 +901,23 @@ fn parse_scalar_subqueries() {
fn parse_create_view() {
let sql = "CREATE VIEW myschema.myview AS SELECT foo FROM bar";
match verified_stmt(sql) {
SQLStatement::SQLCreateView { name, query } => {
SQLStatement::SQLCreateView { name, query, materialized } => {
assert_eq!("myschema.myview", name.to_string());
assert_eq!("SELECT foo FROM bar", query.to_string());
assert!(!materialized);
}
_ => assert!(false),
}
}
#[test]
fn parse_create_materialized_view() {
let sql = "CREATE MATERIALIZED VIEW myschema.myview AS SELECT foo FROM bar";
match verified_stmt(sql) {
SQLStatement::SQLCreateView { name, query, materialized } => {
assert_eq!("myschema.myview", name.to_string());
assert_eq!("SELECT foo FROM bar", query.to_string());
assert!(materialized);
}
_ => assert!(false),
}