Skip to content

Commit

Permalink
Add support for parsing empty dictionary expressions (#1684)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavcloud authored Jan 26, 2025
1 parent cbe59a2 commit 74163b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2854,7 +2854,8 @@ impl<'a> Parser<'a> {
fn parse_duckdb_struct_literal(&mut self) -> Result<Expr, ParserError> {
self.expect_token(&Token::LBrace)?;

let fields = self.parse_comma_separated(Self::parse_duckdb_dictionary_field)?;
let fields =
self.parse_comma_separated0(Self::parse_duckdb_dictionary_field, Token::RBrace)?;

self.expect_token(&Token::RBrace)?;

Expand Down
2 changes: 2 additions & 0 deletions tests/sqlparser_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11291,6 +11291,8 @@ fn test_dictionary_syntax() {
);
}

check("{}", Expr::Dictionary(vec![]));

check(
"{'Alberta': 'Edmonton', 'Manitoba': 'Winnipeg'}",
Expr::Dictionary(vec![
Expand Down

0 comments on commit 74163b1

Please sign in to comment.