MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / parse_create_subsource

Method parse_create_subsource

src/sql-parser/src/parser.rs:3076–3107  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

3074 }
3075
3076 fn parse_create_subsource(&mut self) -> Result<Statement<Raw>, ParserError> {
3077 self.expect_keyword(SUBSOURCE)?;
3078 let if_not_exists = self.parse_if_not_exists()?;
3079 let name = self.parse_item_name()?;
3080
3081 let (columns, constraints) = self.parse_columns(Mandatory)?;
3082
3083 let of_source = if self.parse_keyword(OF) {
3084 self.expect_keyword(SOURCE)?;
3085 Some(self.parse_raw_name()?)
3086 } else {
3087 None
3088 };
3089
3090 let with_options = if self.parse_keyword(WITH) {
3091 self.expect_token(&Token::LParen)?;
3092 let options = self.parse_comma_separated(Parser::parse_create_subsource_option)?;
3093 self.expect_token(&Token::RParen)?;
3094 options
3095 } else {
3096 vec![]
3097 };
3098
3099 Ok(Statement::CreateSubsource(CreateSubsourceStatement {
3100 name,
3101 if_not_exists,
3102 columns,
3103 of_source,
3104 constraints,
3105 with_options,
3106 }))
3107 }
3108
3109 fn parse_create_subsource_option(&mut self) -> Result<CreateSubsourceOption<Raw>, ParserError> {
3110 let option = match self

Callers 1

parse_createMethod · 0.80

Calls 8

expect_keywordMethod · 0.80
parse_if_not_existsMethod · 0.80
parse_item_nameMethod · 0.80
parse_columnsMethod · 0.80
parse_keywordMethod · 0.80
parse_raw_nameMethod · 0.80
expect_tokenMethod · 0.80
parse_comma_separatedMethod · 0.80

Tested by

no test coverage detected