@@ -9342,12 +9342,37 @@ impl<'a> Parser<'a> {
9342
9342
optional: IsOptional,
9343
9343
allow_empty: bool,
9344
9344
) -> 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
+ {
9345
9370
if self.consume_token(&Token::LParen) {
9346
9371
if allow_empty && self.peek_token().token == Token::RParen {
9347
9372
self.next_token();
9348
9373
Ok(vec![])
9349
9374
} else {
9350
- let cols = self.parse_comma_separated(|p| p.parse_identifier( ))?;
9375
+ let cols = self.parse_comma_separated(|p| f(p ))?;
9351
9376
self.expect_token(&Token::RParen)?;
9352
9377
Ok(cols)
9353
9378
}
@@ -9358,7 +9383,7 @@ impl<'a> Parser<'a> {
9358
9383
}
9359
9384
}
9360
9385
9361
- /// Parse a parenthesized comma-separated list of table alias column definitions.
9386
+ /// Parses a parenthesized comma-separated list of table alias column definitions.
9362
9387
fn parse_table_alias_column_defs(&mut self) -> Result<Vec<TableAliasColumnDef>, ParserError> {
9363
9388
if self.consume_token(&Token::LParen) {
9364
9389
let cols = self.parse_comma_separated(|p| {
@@ -11853,7 +11878,7 @@ impl<'a> Parser<'a> {
11853
11878
let constraint = self.parse_expr()?;
11854
11879
Ok(JoinConstraint::On(constraint))
11855
11880
} 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)?;
11857
11882
Ok(JoinConstraint::Using(columns))
11858
11883
} else {
11859
11884
Ok(JoinConstraint::None)
0 commit comments