File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -3725,6 +3725,14 @@ pub enum Statement {
3725
3725
/// `<schema name> | AUTHORIZATION <schema authorization identifier> | <schema name> AUTHORIZATION <schema authorization identifier>`
3726
3726
schema_name : SchemaName ,
3727
3727
if_not_exists : bool ,
3728
+ /// Schema properties.
3729
+ ///
3730
+ /// ```sql
3731
+ /// CREATE SCHEMA myschema WITH (key1='value1');
3732
+ /// ```
3733
+ ///
3734
+ /// [Trino](https://trino.io/docs/current/sql/create-schema.html)
3735
+ with : Option < Vec < SqlOption > > ,
3728
3736
/// Schema options.
3729
3737
///
3730
3738
/// ```sql
@@ -5585,6 +5593,7 @@ impl fmt::Display for Statement {
5585
5593
Statement :: CreateSchema {
5586
5594
schema_name,
5587
5595
if_not_exists,
5596
+ with,
5588
5597
options,
5589
5598
default_collate_spec,
5590
5599
} => {
@@ -5599,6 +5608,10 @@ impl fmt::Display for Statement {
5599
5608
write ! ( f, " DEFAULT COLLATE {collate}" ) ?;
5600
5609
}
5601
5610
5611
+ if let Some ( with) = with {
5612
+ write ! ( f, " WITH ({})" , display_comma_separated( with) ) ?;
5613
+ }
5614
+
5602
5615
if let Some ( options) = options {
5603
5616
write ! ( f, " OPTIONS({})" , display_comma_separated( options) ) ?;
5604
5617
}
Original file line number Diff line number Diff line change @@ -4866,6 +4866,12 @@ impl<'a> Parser<'a> {
4866
4866
None
4867
4867
};
4868
4868
4869
+ let with = if self.peek_keyword(Keyword::WITH) {
4870
+ Some(self.parse_options(Keyword::WITH)?)
4871
+ } else {
4872
+ None
4873
+ };
4874
+
4869
4875
let options = if self.peek_keyword(Keyword::OPTIONS) {
4870
4876
Some(self.parse_options(Keyword::OPTIONS)?)
4871
4877
} else {
@@ -4875,6 +4881,7 @@ impl<'a> Parser<'a> {
4875
4881
Ok(Statement::CreateSchema {
4876
4882
schema_name,
4877
4883
if_not_exists,
4884
+ with,
4878
4885
options,
4879
4886
default_collate_spec,
4880
4887
})
Original file line number Diff line number Diff line change @@ -4268,6 +4268,9 @@ fn parse_create_schema() {
4268
4268
verified_stmt(r#"CREATE SCHEMA IF NOT EXISTS a OPTIONS(key1 = 'value1')"#);
4269
4269
verified_stmt(r#"CREATE SCHEMA IF NOT EXISTS a OPTIONS()"#);
4270
4270
verified_stmt(r#"CREATE SCHEMA IF NOT EXISTS a DEFAULT COLLATE 'und:ci' OPTIONS()"#);
4271
+ verified_stmt(r#"CREATE SCHEMA a.b.c WITH (key1 = 'value1', key2 = 'value2')"#);
4272
+ verified_stmt(r#"CREATE SCHEMA IF NOT EXISTS a WITH (key1 = 'value1')"#);
4273
+ verified_stmt(r#"CREATE SCHEMA IF NOT EXISTS a WITH ()"#);
4271
4274
}
4272
4275
4273
4276
#[test]
You can’t perform that action at this time.
0 commit comments