-
Notifications
You must be signed in to change notification settings - Fork 679
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
Parse like and ilike clauses as comparisons #525
Conversation
@dbczumar thanks! The change looks good in general. Could you have another look at the test you've added? Travis reports a failure just for this test: https://travis-ci.org/andialbrecht/sqlparse/builds/629594200 |
@andialbrecht Sorry for the delay - I've fixed the test (it required a bit of special casing in the test's validation logic because Comparison tokens do not define a ttype). Let me know how it looks! |
Codecov Report
@@ Coverage Diff @@
## master #525 +/- ##
=======================================
Coverage 96.95% 96.95%
=======================================
Files 21 21
Lines 1543 1543
=======================================
Hits 1496 1496
Misses 47 47
Continue to review full report at Codecov.
|
Looks good, thanks a lot! This kind of "deep inspection" into the queries always requires some extra stuff... :) |
This PR addresses #493 by introducing a regex filter to parse the following tokens as comparison operators, rather than keywords:
LIKE
,ILIKE
,NOT LIKE
, andNOT ILIKE
. These terms are regarded as operators by popular SQL engines (e.g. Postgres, MySQL).@andialbrecht There is a backwards-compatibility consideration here: reclassifying these terms as comparison operators may break preexisting user code that relies on the designation of the terms as keywords. Please let me know what your thoughts are here.