aharpervc commented on code in PR #1810:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1810#discussion_r2067492348
##########
src/dialect/mssql.rs:
##########
@@ -215,6 +218,78 @@ impl MsSqlDialect {
}))
}
+ /// Parse a SQL CREATE statement
+ fn parse_create(&self, parser: &mut Parser) -> Option<Result<Statement,
ParserError>> {
+ let original_index = parser.index();
+
+ if !parser.parse_keyword(Keyword::CREATE) {
+ parser.set_index(original_index);
Review Comment:
I've added a commit to the branch for this approach.
I'm not sure it's strictly better because it seems more difficult to extend
if/when additional `CREATE` things are moved into dialects, if this is a
general pattern. Perhaps you can clear up what I'm concerned about here -- with
maybe_parse if parsing fails inside the dialect, it'll rewind the parser &
report None up the chain. Then, parsing will continue as if it was common code.
However that might not be what we prefer -- if we're already into
parse_create_trigger and get a parsing error, we actually do want it to fail
right there rather than rewinding. In the former approach that seemed clear.
With this approach it seems like the dialect specific parser failure will get
ignored (and you will probably get another parser error from the general code
instead).
Thoughts?
--
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]