mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-19 05:30:19 +00:00
Fix parsing of COLLATE after parentheses in expressions (#507)
This commit is contained in:
parent
901f5b974f
commit
0fa812bd2b
2 changed files with 20 additions and 10 deletions
|
@ -525,17 +525,18 @@ impl<'a> Parser<'a> {
|
|||
};
|
||||
self.expect_token(&Token::RParen)?;
|
||||
if !self.consume_token(&Token::Period) {
|
||||
return Ok(expr);
|
||||
Ok(expr)
|
||||
} else {
|
||||
let tok = self.next_token();
|
||||
let key = match tok {
|
||||
Token::Word(word) => word.to_ident(),
|
||||
_ => return parser_err!(format!("Expected identifier, found: {}", tok)),
|
||||
};
|
||||
Ok(Expr::CompositeAccess {
|
||||
expr: Box::new(expr),
|
||||
key,
|
||||
})
|
||||
}
|
||||
let tok = self.next_token();
|
||||
let key = match tok {
|
||||
Token::Word(word) => word.to_ident(),
|
||||
_ => return parser_err!(format!("Expected identifier, found: {}", tok)),
|
||||
};
|
||||
Ok(Expr::CompositeAccess {
|
||||
expr: Box::new(expr),
|
||||
key,
|
||||
})
|
||||
}
|
||||
Token::Placeholder(_) => {
|
||||
self.prev_token();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue