Whole file
David-Wobrock/sqlvalidator
The author described this change as “Fix #29 -- Handle strings containing others quotes”. It counts as a record because the check below fails on the code as it stood at 870a71a72 and passes on 577459789, with nothing else changed between the two runs.
ProjectDavid-Wobrock/sqlvalidator
Fix saved2021-12-22
Sharing licenceMIT · LICENSE
Change size+4 −1
What the code was meant to do, written into the code itself as a save note
Fix #29 -- Handle strings containing others quotes
The change
| 158 | 158 | ||
| 159 | 159 | ||
| 160 | 160 | def split_tokens(value: str): | |
| 161 | - | for string_token in STRING_SPLIT_TOKENS: | |
| 161 | + | for string_token in sorted( | |
| 162 | + | STRING_SPLIT_TOKENS, | |
| 163 | + | key=lambda token: value.index(token) if token in value else (len(value) + 1), | |
| 164 | + | ): | |
| 162 | 165 | if string_token in value: | |
| 163 | 166 | yield from _split_on_string_token(string_token, value) | |
| 164 | 167 | return |
The check that tells the two apart
fail→pass·tests/integration/test_formatting.py::test_string_containing_quote
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 it870a71a7201f39080f0892d3a2c631d4b3122f38
Broken version dated2021-12-22
Modulesqlvalidator.grammar.tokeniser
Units changedsplit_tokens
Fingerprinta4e0e54c557f1421
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 #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
- 2021-11-14Fix Alias.known_fields for aliased subqueries with specific fields