Commit ed853a7
committed
Fix NOT BETWEEN precedence in expression parsing
Infix NOT operators (NOT BETWEEN, NOT IN, NOT LIKE, NOT ILIKE, NOT REGEXP)
should have COMPARE precedence (5), not NOT_PREC (4). This allows the parser
to correctly parse expressions like `NOT number NOT BETWEEN 4 AND 6` as
`NOT (number NOT BETWEEN 4 AND 6)` instead of `(NOT number) NOT BETWEEN 4 AND 6`.
Updated precedenceForCurrent() to peek at the next token and return COMPARE
precedence when the current token is NOT followed by BETWEEN, IN, LIKE, etc.1 parent 5ac95e3 commit ed853a7
2 files changed
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 1 | + | |
0 commit comments