Whole file
David-Wobrock/sqlvalidator
The author described this change as “Fix wrong positive in SQL parsing”. It counts as a record because the check below fails on the code as it stood at 0a343e0af and passes on 683388a48, with nothing else changed between the two runs.
ProjectDavid-Wobrock/sqlvalidator
Fix saved2020-12-31
Sharing licenceMIT · LICENSE
Change size+5 −1
What the code was meant to do, written into the code itself as a save note
Fix wrong positive in SQL parsing
The change
| 91 | 91 | ||
| 92 | 92 | ||
| 93 | 93 | def is_select_string(token_value: str) -> bool: | |
| 94 | - | return token_value.lower().lstrip(" \n'\"`ufbr").startswith("select") | |
| 94 | + | cleaned_value = token_value.lower().lstrip(" \n'\"`ufbr") | |
| 95 | + | lines = cleaned_value.splitlines() | |
| 96 | + | if not lines: | |
| 97 | + | return False | |
| 98 | + | return lines[0].split(" ", maxsplit=1)[0] == "select" | |
| 95 | 99 | ||
| 96 | 100 | ||
| 97 | 101 | def get_formatted_file_content(file: IO) -> Tuple[int, str]: |
The check that tells the two apart
fail→pass·tests/integration/test_file_formatting.py::test_string_starting_with_selected
Check file tests/integration/test_file_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 it0a343e0afdf388bf0eb9aeab4a4cb3d3c18a8b0f
Broken version dated2020-12-31
Modulesqlvalidator.file_formatter
Units changedis_select_string
Fingerprint04c69dd555fce6f3
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