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 {
37253725 /// `<schema name> | AUTHORIZATION <schema authorization identifier> | <schema name> AUTHORIZATION <schema authorization identifier>`
37263726 schema_name : SchemaName ,
37273727 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 > > ,
37283736 /// Schema options.
37293737 ///
37303738 /// ```sql
@@ -5585,6 +5593,7 @@ impl fmt::Display for Statement {
55855593 Statement :: CreateSchema {
55865594 schema_name,
55875595 if_not_exists,
5596+ with,
55885597 options,
55895598 default_collate_spec,
55905599 } => {
@@ -5599,6 +5608,10 @@ impl fmt::Display for Statement {
55995608 write ! ( f, " DEFAULT COLLATE {collate}" ) ?;
56005609 }
56015610
5611+ if let Some ( with) = with {
5612+ write ! ( f, " WITH ({})" , display_comma_separated( with) ) ?;
5613+ }
5614+
56025615 if let Some ( options) = options {
56035616 write ! ( f, " OPTIONS({})" , display_comma_separated( options) ) ?;
56045617 }
Original file line number Diff line number Diff line change @@ -4862,6 +4862,12 @@ impl<'a> Parser<'a> {
48624862 None
48634863 };
48644864
4865+ let with = if self.peek_keyword(Keyword::WITH) {
4866+ Some(self.parse_options(Keyword::WITH)?)
4867+ } else {
4868+ None
4869+ };
4870+
48654871 let options = if self.peek_keyword(Keyword::OPTIONS) {
48664872 Some(self.parse_options(Keyword::OPTIONS)?)
48674873 } else {
@@ -4871,6 +4877,7 @@ impl<'a> Parser<'a> {
48714877 Ok(Statement::CreateSchema {
48724878 schema_name,
48734879 if_not_exists,
4880+ with,
48744881 options,
48754882 default_collate_spec,
48764883 })
Original file line number Diff line number Diff line change @@ -4268,6 +4268,9 @@ fn parse_create_schema() {
42684268 verified_stmt(r#"CREATE SCHEMA IF NOT EXISTS a OPTIONS(key1 = 'value1')"#);
42694269 verified_stmt(r#"CREATE SCHEMA IF NOT EXISTS a OPTIONS()"#);
42704270 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 ()"#);
42714274}
42724275
42734276#[test]
You can’t perform that action at this time.
0 commit comments