v.24.2Bug Fix
Fix Formatting Issues in SQL Queries and Enhance Validation Checks
Fix inconsistent formatting of queries containing tables namedtable. Fix wrong formatting of queries withUNION ALL,INTERSECT, andEXCEPTwhen their structure wasn't linear. This closes #52349. Fix wrong formatting ofSYSTEMqueries, includingSYSTEM ... DROP FILESYSTEM CACHE,SYSTEM ... REFRESH/START/STOP/CANCEL/TEST VIEW,SYSTEM ENABLE/DISABLE FAILPOINT. Fix formatting of parameterized DDL queries. Fix the formatting of theDESCRIBE FILESYSTEM CACHEquery. Fix incorrect formatting of theSET param_...(a query setting a parameter). Fix incorrect formatting ofCREATE INDEXqueries. Fix inconsistent formatting ofCREATE USERand similar queries. Fix inconsistent formatting ofCREATE SETTINGS PROFILE. Fix incorrect formatting ofALTER ... MODIFY REFRESH. Fix inconsistent formatting of window functions if frame offsets were expressions. Fix inconsistent formatting ofRESPECT NULLSandIGNORE NULLSif they were used after a function that implements an operator (such asplus). Fix idiotic formatting ofSYSTEM SYNC REPLICA ... LIGHTWEIGHT FROM .... Fix inconsistent formatting of invalid queries withGROUP BY GROUPING SETS ... WITH ROLLUP/CUBE/TOTALS. Fix inconsistent formatting ofGRANT CURRENT GRANTS. Fix inconsistent formatting ofCREATE TABLE (... COLLATE). Additionally, I fixed the incorrect formatting ofEXPLAINin subqueries (#60102). Fixed incorrect formatting of lambda functions (#60012). Added a check so there is no way to miss these abominations in the future. #60095 (Alexey Milovidov).