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

Method parse_table_function_suffix

src/sql-parser/src/parser.rs:8523–8535  ·  view source on GitHub ↗

Parses the things that can come after the argument list of a table function call. These are - optional WITH ORDINALITY - optional table alias - optional WITH ORDINALITY again! This is allowed just to keep supporting our earlier buggy order where we allowed WITH ORDINALITY only after the table alias. (Postgres and other systems support it only before the table alias.)

(&mut self)

Source from the content-addressed store, hash-verified

8521 /// order where we allowed WITH ORDINALITY only after the table alias. (Postgres and other
8522 /// systems support it only before the table alias.)
8523 fn parse_table_function_suffix(&mut self) -> Result<(bool, Option<TableAlias>), ParserError> {
8524 let with_ordinality_1 = self.parse_keywords(&[WITH, ORDINALITY]);
8525 let alias = self.parse_optional_table_alias()?;
8526 let with_ordinality_2 = self.parse_keywords(&[WITH, ORDINALITY]);
8527 if with_ordinality_1 && with_ordinality_2 {
8528 return parser_err!(
8529 self,
8530 self.peek_prev_pos(),
8531 "WITH ORDINALITY specified twice"
8532 );
8533 }
8534 Ok((with_ordinality_1 || with_ordinality_2, alias))
8535 }
8536
8537 fn parse_named_function(&mut self) -> Result<Function<Raw>, ParserError> {
8538 let name = self.parse_raw_name()?;

Callers 2

parse_rows_fromMethod · 0.80

Calls 2

parse_keywordsMethod · 0.80

Tested by

no test coverage detected