LucaCappelletti94 opened a new issue, #2159: URL: https://github.com/apache/datafusion-sqlparser-rs/issues/2159
Hi, At this time, the [`COLLATE` expr value](https://docs.rs/sqlparser/latest/sqlparser/ast/enum.Expr.html#variant.Collate) is treated as a [`ObjectName` type](https://docs.rs/sqlparser/latest/sqlparser/ast/struct.ObjectName.html). This is reasonable as `COLLATE` can be define arbitrarily, and can therefore have any value the user may desire. That being said, like for [`IndexType`](https://docs.rs/sqlparser/latest/sqlparser/ast/enum.IndexType.html), which may be any user-defined index, there are some `COLLATE` values which are much more frequent than user-defined ones, such as `BINARY`, `NOCASE`, `C` etc... I believe that introducing an `CollateType` with the most common variants plus a `Custom(ObjectName)` variant could facilitate explicit handling of the common `COLLATE` cases for software using the AST. In my own specific use case, I am currently finding myself writing a match over a string version of the `COLLATE` and I think such an enum would improve the quality of the code. Best, Luca -- 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]
