bendu commented on code in PR #2899:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2899#discussion_r4592979237
##########
src/parser/mod.rs:
##########
@@ -1927,11 +1942,27 @@ impl<'a> Parser<'a> {
format: None,
})
}
- data_type => Ok(Expr::TypedString(TypedString {
- data_type,
- value: parser.parse_value()?,
- uses_odbc_syntax: false,
- })),
+ data_type => {
+ if parser.in_subscript_bound
Review Comment:
Thanks, this is much simpler. I've removed `in_subscript_bound` and the
cache-key changes and moved the check into typed-string speculation.
I narrowed it slightly to preserve existing DuckDB behavior: `mood[]
'[happy,sad]'` and `mood[2] '[happy,sad]'` are valid DuckDB literals. The check
therefore only applies when the next token is `:` and all square-bracket
dimensions have numeric sizes. Empty brackets cannot be index expressions, so
those remain unambiguous.
The remaining behavior change for `mood[2] :items` is described in my
top-level comment. Both PostgreSQL's grammar and DuckDB reject that form, but
sqlparser previously accepted it. Do you think that compatibility tradeoff is
acceptable for this smaller fix?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]