Whole file
David-Wobrock/sqlvalidator
The author described this change as “Fix 'date' column in if (a bit approx solution, but works for now)”. It counts as a record because the check below fails on the code as it stood at e6d2d62dd and passes on 46a6a3be7, with nothing else changed between the two runs.
ProjectDavid-Wobrock/sqlvalidator
Fix saved2021-02-05
Sharing licenceMIT · LICENSE
Change size+2 −2
What the code was meant to do, written into the code itself as a save note
Fix 'date' column in if (a bit approx solution, but works for now)
The change
| 617 | 617 | ) | |
| 618 | 618 | else: | |
| 619 | 619 | argument_tokens = get_tokens_until_closing_parenthesis(tokens) | |
| 620 | - | arguments_can_be_type = ( | |
| 621 | - | "," in argument_tokens or lower(main_token) == "if" | |
| 620 | + | arguments_can_be_type = can_be_type or any( | |
| 621 | + | lower(t) == "timestamp_trunc" for t in argument_tokens | |
| 622 | 622 | ) | |
| 623 | 623 | arguments = ExpressionListParser.parse( | |
| 624 | 624 | iter(argument_tokens), can_be_type=arguments_can_be_type |
The check that tells the two apart
fail→pass·tests/integration/test_formatting.py::test_date_column_in_function_call
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 ite6d2d62ddc952a5ebc1b94038c9d50f6757113c7
Broken version dated2021-02-04
Modulesqlvalidator.grammar.lexer
Units changedExpressionParser
Fingerprint604533d3a76a553b
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