mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-03 04:37:21 +00:00
Allow to use ()
as the GROUP BY nothing (#1347)
This commit is contained in:
parent
48ea5640a2
commit
b27abf00e2
2 changed files with 33 additions and 0 deletions
|
@ -1487,6 +1487,11 @@ impl<'a> Parser<'a> {
|
|||
let result = self.parse_comma_separated(|p| p.parse_tuple(true, true))?;
|
||||
self.expect_token(&Token::RParen)?;
|
||||
Ok(Expr::Rollup(result))
|
||||
} else if self.consume_tokens(&[Token::LParen, Token::RParen]) {
|
||||
// PostgreSQL allow to use empty tuple as a group by expression,
|
||||
// e.g. `GROUP BY (), name`. Please refer to GROUP BY Clause section in
|
||||
// [PostgreSQL](https://www.postgresql.org/docs/16/sql-select.html)
|
||||
Ok(Expr::Tuple(vec![]))
|
||||
} else {
|
||||
self.parse_expr()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue