Collapse SQL to one line and remove comments, with quote-aware parsing so string literals are never damaged.
Ctrl + Enter to run
Collapsing a query to one line does nothing for database performance — the planner parses it in microseconds and layout is irrelevant to it. The value is entirely in the places a query has to travel as a string.
That covers embedding SQL in a config file or a migration script, passing it through an API with a payload limit, storing it in a metadata column, and logging it where a multi-line statement would interleave with other output and become unreadable.