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 @@ -4862,6 +4862,12 @@ impl<'a> Parser<'a> {
4862
4862
None
4863
4863
};
4864
4864
4865
+ let with = if self.peek_keyword(Keyword::WITH) {
4866
+ Some(self.parse_options(Keyword::WITH)?)
4867
+ } else {
4868
+ None
4869
+ };
4870
+
4865
4871
let options = if self.peek_keyword(Keyword::OPTIONS) {
4866
4872
Some(self.parse_options(Keyword::OPTIONS)?)
4867
4873
} else {
@@ -4871,6 +4877,7 @@ impl<'a> Parser<'a> {
4871
4877
Ok(Statement::CreateSchema {
4872
4878
schema_name,
4873
4879
if_not_exists,
4880
+ with,
4874
4881
options,
4875
4882
default_collate_spec,
4876
4883
})
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