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.

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

821821 )
822822 expression = ArithmaticOperator(symbol, left_hand, right_hand)
823823
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+
824832 if is_right_hand or is_chained_columns:
825833 return expression, next_token
826834

The check that tells the two apart

failpass·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