File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 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> {
52815281 let _ = self . consume_token ( & Token :: Eq ) ;
52825282 let next_token = self . next_token ( ) ;
52835283 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+ } ) ?) ,
52855290 _ => self . expected ( "literal int" , next_token) ?,
52865291 }
52875292 } else {
Original file line number Diff line number Diff line change @@ -9991,3 +9991,17 @@ fn parse_select_wildcard_with_except() {
99919991 "sql parser error: Expected identifier, found: )"
99929992 ) ;
99939993}
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