File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -194,11 +194,15 @@ impl Parser {
194
194
// expression that should parse as the column name "date".
195
195
if let Some ( parsed) = self . maybe_parse ( |parser| match parser. parse_data_type ( ) ? {
196
196
DataType :: Interval => parser. parse_literal_interval ( ) ,
197
- data_type => Ok ( Expr :: Cast {
198
- expr : Box :: new ( Expr :: Value ( Value :: SingleQuotedString (
199
- parser. parse_literal_string ( ) ?,
200
- ) ) ) ,
197
+ // Single-quoted strings are parsed as custom data types, however this not desirable
198
+ // when we are handling input like `"NOT 'a' NOT LIKE 'b'"` because this will produce a
199
+ // TypedString instead of a SingleQuotedString. Further, this leads to issues where the
200
+ // same input will yield a BinaryOperator instead of the correct UnaryOperator. Here we
201
+ // handle that specific case by returning an error.
202
+ DataType :: Custom ( ..) => Err ( ParserError :: ParserError ( "" . to_string ( ) ) ) ,
203
+ data_type => Ok ( Expr :: TypedString {
201
204
data_type,
205
+ value : parser. parse_literal_string ( ) ?,
202
206
} ) ,
203
207
} ) {
204
208
return Ok ( parsed) ;
You can’t perform that action at this time.
0 commit comments