@@ -9342,12 +9342,37 @@ impl<'a> Parser<'a> {
93429342 optional: IsOptional,
93439343 allow_empty: bool,
93449344 ) -> Result<Vec<Ident>, ParserError> {
9345+ self.parse_parenthesized_column_list_inner(optional, allow_empty, |p| p.parse_identifier())
9346+ }
9347+
9348+ /// Parses a parenthesized comma-separated list of unqualified, possibly quoted identifiers
9349+ pub fn parse_parenthesized_qualified_column_list(
9350+ &mut self,
9351+ optional: IsOptional,
9352+ allow_empty: bool,
9353+ ) -> Result<Vec<ObjectName>, ParserError> {
9354+ self.parse_parenthesized_column_list_inner(optional, allow_empty, |p| {
9355+ p.parse_object_name(false)
9356+ })
9357+ }
9358+
9359+ /// Parses a parenthesized comma-separated list of columns using
9360+ /// the provided function to parse each element.
9361+ fn parse_parenthesized_column_list_inner<F, T>(
9362+ &mut self,
9363+ optional: IsOptional,
9364+ allow_empty: bool,
9365+ mut f: F,
9366+ ) -> Result<Vec<T>, ParserError>
9367+ where
9368+ F: FnMut(&mut Parser) -> Result<T, ParserError>,
9369+ {
93459370 if self.consume_token(&Token::LParen) {
93469371 if allow_empty && self.peek_token().token == Token::RParen {
93479372 self.next_token();
93489373 Ok(vec![])
93499374 } else {
9350- let cols = self.parse_comma_separated(|p| p.parse_identifier( ))?;
9375+ let cols = self.parse_comma_separated(|p| f(p ))?;
93519376 self.expect_token(&Token::RParen)?;
93529377 Ok(cols)
93539378 }
@@ -9358,7 +9383,7 @@ impl<'a> Parser<'a> {
93589383 }
93599384 }
93609385
9361- /// Parse a parenthesized comma-separated list of table alias column definitions.
9386+ /// Parses a parenthesized comma-separated list of table alias column definitions.
93629387 fn parse_table_alias_column_defs(&mut self) -> Result<Vec<TableAliasColumnDef>, ParserError> {
93639388 if self.consume_token(&Token::LParen) {
93649389 let cols = self.parse_comma_separated(|p| {
@@ -11853,7 +11878,7 @@ impl<'a> Parser<'a> {
1185311878 let constraint = self.parse_expr()?;
1185411879 Ok(JoinConstraint::On(constraint))
1185511880 } else if self.parse_keyword(Keyword::USING) {
11856- let columns = self.parse_parenthesized_column_list (Mandatory, false)?;
11881+ let columns = self.parse_parenthesized_qualified_column_list (Mandatory, false)?;
1185711882 Ok(JoinConstraint::Using(columns))
1185811883 } else {
1185911884 Ok(JoinConstraint::None)
0 commit comments