File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -6320,21 +6320,24 @@ impl<'a> Parser<'a> {
6320
6320
}
6321
6321
6322
6322
fn check_on_update_expr_is_valid ( expr : & Expr ) -> Result < ( ) , ParserError > {
6323
- let valid_object_names : [ ObjectName ; 4 ] = [
6324
- ObjectName ( vec ! [ " CURRENT_TIMESTAMP" . into ( ) ] ) ,
6325
- ObjectName ( vec ! [ " LOCALTIME" . into ( ) ] ) ,
6326
- ObjectName ( vec ! [ " LOCALTIMESTAMP" . into ( ) ] ) ,
6327
- ObjectName ( vec ! [ "NOW" . into ( ) ] ) ,
6323
+ const VALID_FN_NAMES : [ & str ; 4 ] = [
6324
+ keywords :: CURRENT_TIMESTAMP ,
6325
+ keywords :: LOCALTIME ,
6326
+ keywords :: LOCALTIMESTAMP ,
6327
+ "NOW" ,
6328
6328
] ;
6329
6329
6330
6330
if let Expr :: Function ( f) = expr {
6331
- if valid_object_names. contains ( & f. name ) {
6332
- return Ok ( ( ) ) ;
6331
+ if let Some ( fn_name_ident) = f. name . 0 . first ( ) {
6332
+ if VALID_FN_NAMES . contains ( fn_name_ident. value . as_str ( ) ) {
6333
+ return Ok ( ( ) ) ;
6334
+ }
6333
6335
}
6334
6336
}
6337
+
6335
6338
Err ( ParserError :: ParserError ( format ! (
6336
6339
"Expected one of '{}' after ON UPDATE in column definition" ,
6337
- valid_object_names . map( |x| x. to_string( ) ) . join( "', '" )
6340
+ VALID_FN_NAMES . map( |x| x. to_string( ) ) . join( "', '" )
6338
6341
) ) )
6339
6342
}
6340
6343
}
You can’t perform that action at this time.
0 commit comments