Whole file

David-Wobrock/sqlvalidator

The author described this change as Fix some unnest parsing. It counts as a record because the checks below fail on the code as it stood at 7734d5bae and pass on 65c4b2275, with nothing else changed between the two runs.

Fix saved2021-02-20
Sharing licenceMIT · LICENSE
Change size+10 7

What the code was meant to do, written into the code itself as a save note

Fix some unnest parsing

The change

200200 next_token = next(tokens, None)
201201 else:
202202 if lower(next_token) == "unnest":
203- expression = UnnestParser.parse(tokens)
204- next_token = next(tokens, None)
203+ expression, next_token = UnnestParser.parse(tokens)
205204 else:
206205 argument_tokens, next_token = get_tokens_until_one_of(
207206 tokens,
351350 offset_alias = next(tokens)
352351 else:
353352 offset_alias = next_token
353+ next_token = next(tokens, None)
354354
355- return Unnest(
356- expression,
357- with_offset=with_offset,
358- with_offset_as=with_offset_as,
359- offset_alias=offset_alias,
355+ return (
356+ Unnest(
357+ expression,
358+ with_offset=with_offset,
359+ with_offset_as=with_offset_as,
360+ offset_alias=offset_alias,
361+ ),
362+ next_token,
360363 )
361364
362365

The check that tells the two apart

failpass·tests/integration/test_formatting.py::test_multiple_joins_unnest
failpass·tests/integration/test_formatting.py::test_nested_multiple_joins_unnest

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 it7734d5baef3323c7d0a7c1b93fda7a1210d9915c
Broken version dated2021-02-20
Modulesqlvalidator.grammar.lexer
Units changedFromStatementParser, UnnestParser
Fingerprintc08b0094e70b89cb
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