v.25.5Improvement
Fix the inconsistent
Fix the inconsistent formatting of certain queries with the EXCEPT operator. If the left-hand side of the EXCEPT operator ends with*, the formatted query loses parentheses and is then parsed as a*with theEXCEPTmodifier. These queries are found by the fuzzer and are unlikely to be found in practice. This closes #79950. #79952 (Alexey Milovidov).
Why it matters
This change addresses a rare parsing problem discovered by fuzz testing where the query formatter would remove necessary parentheses around the left-hand side expression ending with before the EXCEPT operator. Without the parentheses, the query is misinterpreted as a with an EXCEPT modifier, potentially causing errors. The fix ensures that formatted queries maintain correct syntax and parsing reliability.How to use it
This fix is applied automatically in the ClickHouse query formatter when formatting queries containing theEXCEPT operator and left-hand side expressions ending with *. Users do not need to enable or configure anything manually.