v.23.10New Feature
Added SQL Query Formatting Functions
Added functionformatQuerywhich returns a formatted version (possibly spanning multiple lines) of a SQL query string. Also added functionformatQuerySingleLinewhich does the same but the returned string will not contain linebreaks. #55239 (Salvatore Mesoraca).
Why it matters
These functions solve the problem of unformatted or inconsistently formatted SQL queries by providing standardized formatting.formatQuery returns a nicely formatted query with line breaks for better readability, while formatQuerySingleLine returns a compact single-line formatted query. This helps users and tools to process, debug, or display queries more effectively.How to use it
Use the functions by passing a SQL query string as an argument to eitherformatQuery for multi-line formatted output or formatQuerySingleLine for a single-line formatted string. For example:SELECT formatQuery('SELECT * FROM table WHERE x=1');
SELECT formatQuerySingleLine('SELECT * FROM table WHERE x=1');