You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@max-sixty is my understanding correct that in #868 you're adding a "catch all" custom operator and intend to capture the (built-in) regex syntax in MySQL that way?
If so, why not add a regex operator and then for the MySQL/sqlite dialects parse it as a binary op?
Activity
alamb commentedon May 2, 2023
👋 How about https://docs.rs/sqlparser/0.33.0/sqlparser/ast/enum.Expr.html#variant.BinaryOp ?
max-sixty commentedon May 2, 2023
Thanks for the swift response @alamb
The only one there which is custom is
PGCustomBinaryOperator. The official docs of that don't allow for words (i.e.REGEXP):...though maybe
sqlparser-rsdon't enforce that and we can squeeze it in?alamb commentedon May 2, 2023
Since sqlparser-rs parses many different dialects I don't think there is any reason to limit sqlparser to posgres's limitations
I think https://github.com/sqlparser-rs/sqlparser-rs#syntax-vs-semantics may be relevant here
max-sixty commentedon May 4, 2023
OK — I had thought that allowed characters might be syntax rather than semantics, but very happy to take it!
Thanks @alamb , I'll close
max-sixty commentedon May 7, 2023
Sorry, actually I spoke too soon — that seems to write
OPERATORwhen writing it out.This would be the diff I need — happy to put a PR in — but:
SELECT 'a' REGEXP '^[a-d]';withREGEXPas the operator... (but fine for my narrow purpose)Thanks!
feat: Add custom operator
ankrgyl commentedon May 9, 2023
@max-sixty is my understanding correct that in #868 you're adding a "catch all" custom operator and intend to capture the (built-in) regex syntax in MySQL that way?
If so, why not add a regex operator and then for the MySQL/sqlite dialects parse it as a binary op?
eitsupi commentedon May 9, 2023
Given something like MySQL's
DIVoperator, I am wondering if merging #868 makes sense.https://dev.mysql.com/doc/refman/8.0/en/arithmetic-functions.html
max-sixty commentedon May 10, 2023
Initial effort at #874 !
feat: Add custom operator (#868)
Merge Upstream (apache#6)
LucaCappelletti94 commentedon Sep 22, 2026
Closing as solved by #1017