Skip to content

Commit 8936d0e

Browse files
committed
parse with connection clause
1 parent 6b9bee6 commit 8936d0e

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/parser.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,10 @@ impl Parser {
20512051
default.push_node("next_keyword", collate);
20522052
create.push_node("default_collate", default);
20532053
}
2054-
// TODO with connection
2054+
if self.get_token(1)?.is("WITH") && self.get_token(2)?.is("CONNECTION") {
2055+
self.next_token()?; // -> WITH
2056+
create.push_node("with_connection", self.parse_with_connection_clause()?);
2057+
}
20552058
if self.get_token(1)?.is("OPTIONS") {
20562059
self.next_token()?; // OPTIONS
20572060
create.push_node("options", self.parse_keyword_with_grouped_exprs(false)?);

src/parser/tests/tests_ddl.rs

+7
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ what:
7777
Box::new(SuccessTestCase::new(
7878
"\
7979
CREATE EXTERNAL SCHEMA dataset_name
80+
WITH CONNECTION connection_name
8081
",
8182
"\
8283
self: CREATE (CreateSchemaStatement)
@@ -86,6 +87,12 @@ ident:
8687
self: dataset_name (Identifier)
8788
what:
8889
self: SCHEMA (Keyword)
90+
with_connection:
91+
self: WITH (KeywordSequence)
92+
next_keyword:
93+
self: CONNECTION (KeywordWithExpr)
94+
expr:
95+
self: connection_name (Identifier)
8996
",
9097
0,
9198
)),

src/types.rs

+2
Original file line numberDiff line numberDiff line change
@@ -649,10 +649,12 @@ export type CreateRowAccessPolicyStatement = XXXStatement & {
649649
export type CreateSchemaStatement = XXXStatement & {
650650
node_type: "CreateSchemaStatement";
651651
children: {
652+
external?: NodeChild;
652653
what: NodeChild;
653654
if_not_exists?: NodeVecChild;
654655
ident: NodeChild;
655656
default_collate: NodeChild;
657+
with_connection?: NodeChild;
656658
options?: NodeChild;
657659
};
658660
};

0 commit comments

Comments
 (0)