File tree Expand file tree Collapse file tree 7 files changed +6
-61
lines changed Expand file tree Collapse file tree 7 files changed +6
-61
lines changed Original file line number Diff line number Diff line change @@ -116,11 +116,6 @@ impl Dialect for BigQueryDialect {
116
116
true
117
117
}
118
118
119
- // See https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#:~:text=CREATE%20%5B%20OR%20REPLACE%20%5D%20VIEW%20%5B%20IF%20NOT%20EXISTS%20%5D
120
- fn create_view_if_not_exists_supported ( & self ) -> bool {
121
- true
122
- }
123
-
124
119
fn require_interval_qualifier ( & self ) -> bool {
125
120
true
126
121
}
Original file line number Diff line number Diff line change @@ -88,14 +88,6 @@ impl Dialect for GenericDialect {
88
88
true
89
89
}
90
90
91
- fn create_view_if_not_exists_supported ( & self ) -> bool {
92
- true
93
- }
94
-
95
- fn create_view_name_before_if_not_exists_supported ( & self ) -> bool {
96
- true
97
- }
98
-
99
91
fn support_map_literal_syntax ( & self ) -> bool {
100
92
true
101
93
}
Original file line number Diff line number Diff line change @@ -247,18 +247,6 @@ pub trait Dialect: Debug + Any {
247
247
false
248
248
}
249
249
250
- /// Does the dialect support sql statements such as:
251
- /// CREATE VIEW IF NOT EXISTS view_name AS SELECT * FROM table_name
252
- fn create_view_if_not_exists_supported ( & self ) -> bool {
253
- false
254
- }
255
-
256
- /// Does the dialect support view_name before IF NOT EXISTS in CREATE VIEW:
257
- /// CREATE VIEW IF NOT EXISTS view_name AS SELECT * FROM table_name
258
- fn create_view_name_before_if_not_exists_supported ( & self ) -> bool {
259
- false
260
- }
261
-
262
250
/// Returns true if the dialect supports referencing another named window
263
251
/// within a window clause declaration.
264
252
///
Original file line number Diff line number Diff line change @@ -285,16 +285,6 @@ impl Dialect for SnowflakeDialect {
285
285
true
286
286
}
287
287
288
- // See https://docs.snowflake.com/en/sql-reference/sql/create-view
289
- fn create_view_if_not_exists_supported ( & self ) -> bool {
290
- true
291
- }
292
-
293
- // Snowflake allows table name before if not exists in CREATE VIEW
294
- fn create_view_name_before_if_not_exists_supported ( & self ) -> bool {
295
- true
296
- }
297
-
298
288
fn supports_left_associative_joins_without_parens ( & self ) -> bool {
299
289
false
300
290
}
Original file line number Diff line number Diff line change @@ -57,11 +57,6 @@ impl Dialect for SQLiteDialect {
57
57
true
58
58
}
59
59
60
- // See https://www.sqlite.org/lang_createview.html
61
- fn create_view_if_not_exists_supported ( & self ) -> bool {
62
- true
63
- }
64
-
65
60
fn supports_start_transaction_modifier ( & self ) -> bool {
66
61
true
67
62
}
Original file line number Diff line number Diff line change @@ -5774,18 +5774,13 @@ impl<'a> Parser<'a> {
5774
5774
let mut name_before_not_exists = false;
5775
5775
if self.peek_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]) {
5776
5776
// Possible syntax -> ... IF NOT EXISTS <name>
5777
- if self.dialect.create_view_if_not_exists_supported() {
5778
- if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
5779
- }
5777
+ if_not_exists = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]);
5780
5778
name = self.parse_object_name(allow_unquoted_hyphen)?;
5781
5779
} else {
5782
5780
// Possible syntax -> ... <name> IF NOT EXISTS
5781
+ // Supported by snowflake but is undocumented
5783
5782
name = self.parse_object_name(allow_unquoted_hyphen)?;
5784
- if self
5785
- .dialect
5786
- .create_view_name_before_if_not_exists_supported()
5787
- && self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS])
5788
- {
5783
+ if self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]) {
5789
5784
if_not_exists = true;
5790
5785
name_before_not_exists = true;
5791
5786
}
Original file line number Diff line number Diff line change @@ -16387,18 +16387,8 @@ fn parse_drop_stream() {
16387
16387
16388
16388
#[test]
16389
16389
fn parse_create_view_if_not_exists() {
16390
- let sql = "CREATE VIEW IF NOT EXISTS v AS SELECT 1";
16391
- let dialects = TestedDialects::new(vec![
16392
- Box::new(SnowflakeDialect {}),
16393
- Box::new(GenericDialect {}),
16394
- Box::new(SQLiteDialect {}),
16395
- Box::new(BigQueryDialect {}),
16396
- ]);
16397
- let _ = dialects.verified_stmt(sql);
16390
+ let sql: &'static str = "CREATE VIEW IF NOT EXISTS v AS SELECT 1";
16391
+ let _ = all_dialects().verified_stmt(sql);
16398
16392
let sql = "CREATE VIEW v IF NOT EXISTS AS SELECT 1";
16399
- let dialects = TestedDialects::new(vec![
16400
- Box::new(SnowflakeDialect {}),
16401
- Box::new(GenericDialect {}),
16402
- ]);
16403
- let _ = dialects.verified_stmt(sql);
16393
+ let _ = all_dialects().verified_stmt(sql);
16404
16394
}
You can’t perform that action at this time.
0 commit comments