The minifier first formats the statement, uppercasing keywords, then collapses whitespace that is not inside a string, a quoted identifier, a dollar-quote or a comment. select 'a b' from tab where id = 1 becomes SELECT 'a b' FROM tab WHERE id = 1. The three spaces between a and b are still there. The spaces around FROM are single spaces.
That order matters. Comments and quotes are detected on the formatted text, so a comment does not get glued into the next keyword, and a string does not lose its padding. Dialect is the same list as the formatter: sql, postgresql, mysql, sqlite, transactsql, bigquery. Pick the dialect whose quoting matches the statement, or a dollar-quoted body can be mistaken for ordinary text.
This is not a query planner. One line is easier to drop into a log or a curl body. The formatter is where you read the statement. Neither page talks to a database.
Dialect sql. select 'a b' from tab where id = 1
SELECT 'a b' FROM tab WHERE id = 1
The spaces inside the quotes are the whole test. Minifying by deleting every run of spaces would change the value.
Strings are copied through. Only whitespace outside strings, identifiers, dollar quotes and comments is collapsed.
No. It uppercases them, same as the formatter, and then pulls the statement onto one line.
Comments are preserved as part of the protected text. They are not stripped. The CSS minifier is the tool that drops comments; this one does not.
The one you will run. Dollar quotes and bracketed identifiers are easy to damage if the dialect’s quoting rules do not match the text.