File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -5281,7 +5281,12 @@ impl<'a> Parser<'a> {
5281
5281
let _ = self . consume_token ( & Token :: Eq ) ;
5282
5282
let next_token = self . next_token ( ) ;
5283
5283
match next_token. token {
5284
- Token :: Number ( s, _) => Some ( s. parse :: < u32 > ( ) . expect ( "literal int" ) ) ,
5284
+ Token :: Number ( s, _) => Some ( s. parse :: < u32 > ( ) . map_err ( |e| {
5285
+ ParserError :: ParserError ( format ! (
5286
+ "Could not parse '{s}' as u32: {e}{}" ,
5287
+ next_token. location
5288
+ ) )
5289
+ } ) ?) ,
5285
5290
_ => self . expected ( "literal int" , next_token) ?,
5286
5291
}
5287
5292
} else {
Original file line number Diff line number Diff line change @@ -9991,3 +9991,17 @@ fn parse_select_wildcard_with_except() {
9991
9991
"sql parser error: Expected identifier, found: )"
9992
9992
) ;
9993
9993
}
9994
+
9995
+ #[ test]
9996
+ fn parse_auto_increment_too_large ( ) {
9997
+ let dialect = GenericDialect { } ;
9998
+ let u64_max = u64:: MAX ;
9999
+ let sql = format ! ( "CREATE TABLE foo (bar INT NOT NULL AUTO_INCREMENT) AUTO_INCREMENT=1{u64_max}" ) ;
10000
+
10001
+ let res = Parser :: new ( & dialect)
10002
+ . try_with_sql ( & sql)
10003
+ . expect ( "tokenize to work" )
10004
+ . parse_statements ( ) ;
10005
+
10006
+ assert ! ( res. is_err( ) , "{res:?}" ) ;
10007
+ }
You can’t perform that action at this time.
0 commit comments