File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,10 @@ impl Dialect for SQLiteDialect {
8888 ] {
8989 if parser. parse_keyword ( keyword) {
9090 let left = Box :: new ( expr. clone ( ) ) ;
91- let right = Box :: new ( parser. parse_expr ( ) . unwrap ( ) ) ;
91+ let right = Box :: new ( match parser. parse_expr ( ) {
92+ Ok ( expr) => expr,
93+ Err ( e) => return Some ( Err ( e) ) ,
94+ } ) ;
9295 return Some ( Ok ( Expr :: BinaryOp { left, op, right } ) ) ;
9396 }
9497 }
Original file line number Diff line number Diff line change @@ -602,6 +602,10 @@ fn test_regexp_operator() {
602602 }
603603 ) ;
604604 sqlite ( ) . verified_only_select ( r#"SELECT count(*) FROM messages WHERE msg_text REGEXP '\d+'"# ) ;
605+
606+ // Should return an error, not panic
607+ assert ! ( sqlite( ) . parse_sql_statements( "SELECT 1 REGEXP" ) . is_err( ) ) ;
608+ assert ! ( sqlite( ) . parse_sql_statements( "SELECT 1 MATCH" ) . is_err( ) ) ;
605609}
606610
607611#[ test]
You can’t perform that action at this time.
0 commit comments