-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add REGEXP infix operator for MySQL #874
Conversation
Looks like your code doesn't compile with no-std? https://github.com/sqlparser-rs/sqlparser-rs/actions/runs/4928867591/jobs/8807772910?pr=874
Adding a keyword should work (they are not automatically reserved) |
I think I can solve that one; but https://github.com/sqlparser-rs/sqlparser-rs/actions/runs/4928867591/jobs/8807773893?pr=874#step:5:504 needs some crate-specific guidance... |
It looks like the new test you wrote is failing, and it reproduces locally with:
Can you be more specific about what kind of guidance you need? |
I'm fine reproducing the test. But I'm not sure what the best test for this is — is it Any thoughts why the test is failing? It looks like it's expecting the expression to finish after |
OK, one reason is that it never gets to diff --git a/src/dialect/mysql.rs b/src/dialect/mysql.rs
index 9e82702..62d2624 100644
--- a/src/dialect/mysql.rs
+++ b/src/dialect/mysql.rs
@@ -49,6 +49,7 @@ fn parse_infix(
_expr: &crate::ast::Expr,
_precedence: u8,
) -> Option<Result<crate::ast::Expr, crate::parser::ParserError>> {
+ panic!();
// Parse REGEXP as an operator
if _parser.parse_keyword(Keyword::REGEXP) {
Some(Ok(Expr::BinaryOp {
...so this would benefit from some guidance from someone who knows this — thank you |
Have you verified that the change works outside of the test? |
I'm not particularly familiar with this code, but it looks like you need to set a precedence in |
Perfect, thanks! This is working on my end now; let's see whether CI passes |
Pull Request Test Coverage Report for Build 4932692393
💛 - Coveralls |
I feel like #868 is a better (simpler) approach -- given that do we still want to try and push this one forward? |
I'm totally fine with #868! Tbh I was doing this to be a good citizen, as we're such heavy users of sqlparser-rs, rather than needing it per-se. I could understand wanting either approach — you might want to actually parse the |
Thank you for the kind works and the sense of civic responsibility ❤️ |
I believe #868 has superseded this PR |
Would replace #868
But couple of issues:
REGEXP
be a keyword? If not, what would we parse?