Skip to content

Commit 99b98ca

Browse files
author
Agaev Huseyn
committed
Fix parser for BigDecimal values
1 parent 216d721 commit 99b98ca

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/parser/mod.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -7277,10 +7277,16 @@ impl<'a> Parser<'a> {
72777277
tok @ Token::Minus | tok @ Token::Plus => {
72787278
let next_token = self.next_token();
72797279
match next_token.token {
7280-
Token::Number(n, l) => Ok(Value::Number(
7281-
Self::parse::<String>(tok.to_string() + &n, location)?,
7282-
l,
7283-
)),
7280+
Token::Number(n, l) => {
7281+
if tok == Token::Minus {
7282+
Ok(Value::Number(
7283+
Self::parse(tok.to_string() + &n, location)?,
7284+
l,
7285+
))
7286+
} else {
7287+
Ok(Value::Number(Self::parse(n, location)?, l))
7288+
}
7289+
}
72847290
_ => self.expected("number", next_token),
72857291
}
72867292
}

tests/sqlparser_common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2838,7 +2838,7 @@ fn parse_signed_value() {
28382838
START WITH + 45";
28392839
one_statement_parses_to(
28402840
sql2,
2841-
"CREATE SEQUENCE name2 AS BIGINT INCREMENT +10 MINVALUE +30 MAXVALUE +5000 START WITH +45",
2841+
"CREATE SEQUENCE name2 AS BIGINT INCREMENT 10 MINVALUE 30 MAXVALUE 5000 START WITH 45",
28422842
);
28432843
}
28442844

0 commit comments

Comments
 (0)