@@ -11297,117 +11297,17 @@ impl<'a> Parser<'a> {
1129711297 alias,
1129811298 });
1129911299 }
11300- Keyword::JOIN => {
11301- let relation = self.parse_table_factor()?;
11302- let constraint = self.parse_join_constraint(false)?;
11303- if matches!(constraint, JoinConstraint::None) {
11304- return Err(ParserError::ParserError(
11305- "JOIN in pipe syntax requires ON or USING clause".to_string(),
11306- ));
11307- }
11308- let join_operator = JoinOperator::Join(constraint);
11309- pipe_operators.push(PipeOperator::Join(Join {
11310- relation,
11311- global: false,
11312- join_operator,
11313- }))
11314- }
11315- Keyword::INNER => {
11316- self.expect_keyword(Keyword::JOIN)?;
11317- let relation = self.parse_table_factor()?;
11318- let constraint = self.parse_join_constraint(false)?;
11319- if matches!(constraint, JoinConstraint::None) {
11320- return Err(ParserError::ParserError(
11321- "INNER JOIN in pipe syntax requires ON or USING clause".to_string(),
11322- ));
11323- }
11324- let join_operator = JoinOperator::Inner(constraint);
11325- pipe_operators.push(PipeOperator::Join(Join {
11326- relation,
11327- global: false,
11328- join_operator,
11329- }))
11330- }
11331- Keyword::LEFT => {
11332- let outer = self.parse_keyword(Keyword::OUTER);
11333- self.expect_keyword(Keyword::JOIN)?;
11334- let relation = self.parse_table_factor()?;
11335- let constraint = self.parse_join_constraint(false)?;
11336- if matches!(constraint, JoinConstraint::None) {
11337- let join_type = if outer {
11338- "LEFT OUTER JOIN"
11339- } else {
11340- "LEFT JOIN"
11341- };
11342- return Err(ParserError::ParserError(format!(
11343- "{} in pipe syntax requires ON or USING clause",
11344- join_type
11345- )));
11346- }
11347- let join_operator = if outer {
11348- JoinOperator::LeftOuter(constraint)
11349- } else {
11350- JoinOperator::Left(constraint)
11351- };
11352- pipe_operators.push(PipeOperator::Join(Join {
11353- relation,
11354- global: false,
11355- join_operator,
11356- }))
11357- }
11358- Keyword::RIGHT => {
11359- let outer = self.parse_keyword(Keyword::OUTER);
11360- self.expect_keyword(Keyword::JOIN)?;
11361- let relation = self.parse_table_factor()?;
11362- let constraint = self.parse_join_constraint(false)?;
11363- if matches!(constraint, JoinConstraint::None) {
11364- let join_type = if outer {
11365- "RIGHT OUTER JOIN"
11366- } else {
11367- "RIGHT JOIN"
11368- };
11369- return Err(ParserError::ParserError(format!(
11370- "{} in pipe syntax requires ON or USING clause",
11371- join_type
11372- )));
11373- }
11374- let join_operator = if outer {
11375- JoinOperator::RightOuter(constraint)
11376- } else {
11377- JoinOperator::Right(constraint)
11378- };
11379- pipe_operators.push(PipeOperator::Join(Join {
11380- relation,
11381- global: false,
11382- join_operator,
11383- }))
11384- }
11385- Keyword::FULL => {
11386- let _outer = self.parse_keyword(Keyword::OUTER);
11387- self.expect_keyword(Keyword::JOIN)?;
11388- let relation = self.parse_table_factor()?;
11389- let constraint = self.parse_join_constraint(false)?;
11390- if matches!(constraint, JoinConstraint::None) {
11391- return Err(ParserError::ParserError(
11392- "FULL JOIN in pipe syntax requires ON or USING clause".to_string(),
11393- ));
11394- }
11395- let join_operator = JoinOperator::FullOuter(constraint);
11396- pipe_operators.push(PipeOperator::Join(Join {
11397- relation,
11398- global: false,
11399- join_operator,
11400- }))
11401- }
11402- Keyword::CROSS => {
11403- self.expect_keyword(Keyword::JOIN)?;
11404- let relation = self.parse_table_factor()?;
11405- let join_operator = JoinOperator::CrossJoin;
11406- pipe_operators.push(PipeOperator::Join(Join {
11407- relation,
11408- global: false,
11409- join_operator,
11410- }))
11300+ Keyword::JOIN
11301+ | Keyword::INNER
11302+ | Keyword::LEFT
11303+ | Keyword::RIGHT
11304+ | Keyword::FULL
11305+ | Keyword::CROSS => {
11306+ self.prev_token();
11307+ let mut joins = self.parse_joins()?;
11308+ // Take first
11309+ let join = joins.swap_remove(0);
11310+ pipe_operators.push(PipeOperator::Join(join))
1141111311 }
1141211312 unhandled => {
1141311313 return Err(ParserError::ParserError(format!(
0 commit comments