Whole file
David-Wobrock/sqlvalidator
The author described this change as “Fix ARRAY_AGG function call with only one arg”. It counts as a record because the check below fails on the code as it stood at 3000a4f6d and passes on 7734d5bae, with nothing else changed between the two runs.
ProjectDavid-Wobrock/sqlvalidator
Fix saved2021-02-20
Sharing licenceMIT · LICENSE
Change size+4 −4
What the code was meant to do, written into the code itself as a save note
Fix ARRAY_AGG function call with only one arg
The change
| 531 | 531 | if self.distinct: | |
| 532 | 532 | array_agg_str += "DISTINCT " | |
| 533 | 533 | ||
| 534 | - | array_agg_str += transform(self.args[0]) + " " | |
| 534 | + | array_agg_str += transform(self.args[0]) | |
| 535 | 535 | ||
| 536 | 536 | if self.ignore_nulls: | |
| 537 | - | array_agg_str += "IGNORE NULLS " | |
| 537 | + | array_agg_str += " IGNORE NULLS" | |
| 538 | 538 | elif self.respect_nulls: | |
| 539 | - | array_agg_str += "RESPECT NULLS " | |
| 539 | + | array_agg_str += " RESPECT NULLS" | |
| 540 | 540 | ||
| 541 | 541 | if self.order_bys: | |
| 542 | - | array_agg_str += "ORDER BY{}".format( | |
| 542 | + | array_agg_str += " ORDER BY{}".format( | |
| 543 | 543 | self.order_bys.transform(allow_linebreak=False) | |
| 544 | 544 | ) | |
| 545 | 545 |
The check that tells the two apart
fail→pass·tests/integration/test_formatting.py::test_array_agg
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 it3000a4f6d3ee387e726b56de94ee82b97e2d9abf
Broken version dated2021-02-20
Modulesqlvalidator.grammar.sql
Units changedArrayAggFunctionCall
Fingerprintf2441febab92b890
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