@@ -7960,52 +7960,64 @@ fn parse_create_view_with_options() {
79607960#[test]
79617961fn parse_create_view_with_columns() {
79627962 let sql = "CREATE VIEW v (has, cols) AS SELECT 1, 2";
7963- // TODO: why does this fail for ClickHouseDialect? (#1449)
7964- // match all_dialects().verified_stmt(sql) {
7965- match all_dialects_except(|d| d.is::<ClickHouseDialect>()).verified_stmt(sql) {
7966- Statement::CreateView {
7967- or_alter,
7968- name,
7969- columns,
7970- or_replace,
7971- options,
7972- query,
7973- materialized,
7974- cluster_by,
7975- comment,
7976- with_no_schema_binding: late_binding,
7977- if_not_exists,
7978- temporary,
7979- to,
7980- params,
7981- } => {
7982- assert_eq!(or_alter, false);
7983- assert_eq!("v", name.to_string());
7984- assert_eq!(
7963+ fn assert_stmt_as_expected(stmt: Statement, options_comma_separated: bool) {
7964+ match stmt {
7965+ Statement::CreateView {
7966+ or_alter,
7967+ name,
79857968 columns,
7986- vec![Ident::new("has"), Ident::new("cols"),]
7987- .into_iter()
7988- .map(|name| ViewColumnDef {
7989- name,
7990- data_type: None,
7991- options: None
7992- })
7993- .collect::<Vec<_>>()
7994- );
7995- assert_eq!(options, CreateTableOptions::None);
7996- assert_eq!("SELECT 1, 2", query.to_string());
7997- assert!(!materialized);
7998- assert!(!or_replace);
7999- assert_eq!(cluster_by, vec![]);
8000- assert!(comment.is_none());
8001- assert!(!late_binding);
8002- assert!(!if_not_exists);
8003- assert!(!temporary);
8004- assert!(to.is_none());
8005- assert!(params.is_none());
7969+ or_replace,
7970+ options,
7971+ query,
7972+ materialized,
7973+ cluster_by,
7974+ comment,
7975+ with_no_schema_binding: late_binding,
7976+ if_not_exists,
7977+ temporary,
7978+ to,
7979+ params,
7980+ } => {
7981+ assert_eq!(or_alter, false);
7982+ assert_eq!("v", name.to_string());
7983+ assert_eq!(
7984+ columns,
7985+ vec![Ident::new("has"), Ident::new("cols"),]
7986+ .into_iter()
7987+ .map(|name| ViewColumnDef {
7988+ name,
7989+ data_type: None,
7990+ options: None,
7991+ options_comma_separated,
7992+ })
7993+ .collect::<Vec<_>>()
7994+ );
7995+ assert_eq!(options, CreateTableOptions::None);
7996+ assert_eq!("SELECT 1, 2", query.to_string());
7997+ assert!(!materialized);
7998+ assert!(!or_replace);
7999+ assert_eq!(cluster_by, vec![]);
8000+ assert!(comment.is_none());
8001+ assert!(!late_binding);
8002+ assert!(!if_not_exists);
8003+ assert!(!temporary);
8004+ assert!(to.is_none());
8005+ assert!(params.is_none());
8006+ }
8007+ _ => unreachable!(),
80068008 }
8007- _ => unreachable!(),
80088009 }
8010+ // TODO: why does this fail for ClickHouseDialect? (#1449)
8011+ // match all_dialects().verified_stmt(sql) {
8012+ assert_stmt_as_expected(
8013+ all_dialects_where(|d| !d.is::<ClickHouseDialect>() && !d.is::<SnowflakeDialect>())
8014+ .verified_stmt(sql),
8015+ true,
8016+ );
8017+ assert_stmt_as_expected(
8018+ all_dialects_where(|d| d.is::<SnowflakeDialect>()).verified_stmt(sql),
8019+ false,
8020+ );
80098021}
80108022
80118023#[test]
0 commit comments