Simplify JOIN USING (columns)

...by reusing `parse_column_names` instead of extracting identifiers
out of the `parse_expr_list`s result.
This commit is contained in:
Nickolay Ponomarev 2019-01-30 22:52:10 +03:00
parent 05a70a358a
commit b716ffb937

View file

@ -1201,17 +1201,7 @@ impl Parser {
Ok(JoinConstraint::On(constraint))
} else if self.parse_keyword("USING") {
self.expect_token(&Token::LParen)?;
let attributes = self
.parse_expr_list()?
.into_iter()
.map(|ast_node| match ast_node {
ASTNode::SQLIdentifier(ident) => Ok(ident),
unexpected => {
parser_err!(format!("Expected identifier, found {:?}", unexpected))
}
})
.collect::<Result<Vec<String>, ParserError>>()?;
let attributes = self.parse_column_names()?;
self.expect_token(&Token::RParen)?;
Ok(JoinConstraint::Using(attributes))
} else {