Whole file
David-Wobrock/sqlvalidator
The author described this change as “Fix variable leaking from one condition to another”. It counts as a record because the check below fails on the code as it stood at f6462b9d0 and passes on f3c23ee79, with nothing else changed between the two runs.
ProjectDavid-Wobrock/sqlvalidator
Fix saved2021-02-14
Sharing licenceMIT · LICENSE
Change size+1 −2
What the code was meant to do, written into the code itself as a save note
Fix variable leaking from one condition to another
The change
| 755 | 755 | return expression, next_token | |
| 756 | 756 | ||
| 757 | 757 | if lower(next_token) in Condition.PREDICATES: | |
| 758 | + | first_token = None | |
| 758 | 759 | symbol = next_token | |
| 759 | 760 | if lower(next_token) == "is": | |
| 760 | 761 | next_next_token = next(tokens) | |
| 761 | - | first_token = None | |
| 762 | 762 | if lower(next_next_token) == "not": | |
| 763 | 763 | symbol = "is not" | |
| 764 | 764 | else: | |
| 765 | 765 | first_token = next_next_token | |
| 766 | 766 | elif lower(next_token) == "not": | |
| 767 | 767 | next_next_token = next(tokens) | |
| 768 | - | first_token = None | |
| 769 | 768 | if lower(next_next_token) == "in": | |
| 770 | 769 | symbol = "not in" | |
| 771 | 770 | else: |
The check that tells the two apart
fail→pass·tests/integration/test_formatting.py::test_count_equal_countif
Check file tests/integration/test_formatting.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itf6462b9d024d29dc68a1804c6e3de1c8f3c286d0
Broken version dated2021-02-06
Modulesqlvalidator.grammar.lexer
Units changedExpressionParser
Fingerprint88bc7d77009be622
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in David-Wobrock/sqlvalidator
- 2022-04-15Fix #38 -- Handle nested case expressions
- 2021-12-22Fix #29 -- Handle strings containing others quotes
- 2021-12-22Fix #35 -- Handle index based access on function call
- 2021-12-22Fix #34 -- Handle parsing a function with a single comma string
- 2021-11-15Fix validating between predicate conditions
- 2021-11-15Fix handling Any return type as invalid WHERE/HAVING condition