Whole file
David-Wobrock/sqlvalidator
The author described this change as “Fix #35 -- Handle index based access on function call”. It counts as a record because the check below fails on the code as it stood at d7e8b6c46 and passes on 8fcc1dfc8, with nothing else changed between the two runs.
ProjectDavid-Wobrock/sqlvalidator
Fix saved2021-12-22
Sharing licenceMIT · LICENSE
Change size+8 −0
What the code was meant to do, written into the code itself as a save note
Fix #35 -- Handle index based access on function call
The change
| 821 | 821 | ) | |
| 822 | 822 | expression = ArithmaticOperator(symbol, left_hand, right_hand) | |
| 823 | 823 | ||
| 824 | + | if next_token == "[": | |
| 825 | + | argument_tokens, next_token = get_tokens_until_one_of( | |
| 826 | + | tokens, stop_words=["]"] | |
| 827 | + | ) | |
| 828 | + | arguments = ExpressionListParser.parse(iter(argument_tokens)) | |
| 829 | + | expression = Index(expression, arguments) | |
| 830 | + | next_token = next(tokens, None) | |
| 831 | + | ||
| 824 | 832 | if is_right_hand or is_chained_columns: | |
| 825 | 833 | return expression, next_token | |
| 826 | 834 |
The check that tells the two apart
fail→pass·tests/integration/test_formatting.py::test_function_with_index_access
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 itd7e8b6c460e69b77c0ee097613b93e6444f5c0b6
Broken version dated2021-12-22
Modulesqlvalidator.grammar.lexer
Units changedExpressionParser
Fingerprint7dd9122c05e344ac
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 #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