Text and writing
Format PostgreSQL SELECT text
Insert line breaks before selected clauses and save SQL/JSON without executing queries.
One SELECT text, 1–20000 characters. Brackets and nested comments up to depth 32; ASCII dollar tags, E strings and positive numbered parameters. An optional final semicolon is supported.
Result
Method:
No SQL syntax check, repair or safety assessment, and no full semantic equivalence claim. Text-only preview; no database connection, execution, network fetches or storage. Other SQL dialects and string modes are outside scope.
Decimal results are approximate. Inputs stay in this browser tab.
Sources
How it works
Add line breaks before selected top-level clause words. Keep original characters, case, whitespace, strings and comments.
Worked example
SELECT name FROM people WHERE id=$1 ORDER BY name;
About this calculation
The tool lays out a single PostgreSQL SELECT text so that it is easier to read. It inserts line breaks before selected clause words at the top level. Everything else stays as you wrote it: characters, case, whitespace, strings and comments. It also recognises brackets and nested comments up to a depth of 32, ASCII dollar tags, E strings and numbered parameters such as $1.
The result is a text-only preview. The tool makes no database connection, does not run the query, and does not check syntax or safety or repair mistakes. There is no claim that the formatted text means exactly the same as the original in every case. It assumes PostgreSQL with standard_conforming_strings=true and follows the lexical rules of PostgreSQL 18; MySQL and other dialects are outside its scope. The text can be 1 to 20000 characters long, a final semicolon is optional, and you can save the result as SQL or JSON.
The worked example is SELECT name FROM people WHERE id=$1 ORDER BY name; which contains a numbered parameter and a final semicolon.
Frequently asked questions
What does the PostgreSQL SELECT formatter do?
It inserts line breaks before selected top-level clause words and keeps your original characters, case, whitespace, strings and comments. You can save the result as SQL or JSON.
What input does it accept?
One SELECT text of 1 to 20000 characters, with brackets and nested comments up to a depth of 32. ASCII dollar tags, E strings, positive numbered parameters and an optional final semicolon are supported. You confirm that your text uses PostgreSQL with standard_conforming_strings=true.
Does it check or run my query?
No. There is no SQL syntax check, repair or safety assessment, and no claim of full semantic equivalence. The tool makes no database connection and executes nothing.
Does it work with MySQL or other SQL dialects?
No. Other SQL dialects and string modes are outside its scope. The formatter is based on the lexical structure of PostgreSQL 18.
Is my SQL sent anywhere?
No. It is a text-only preview with no network fetches or storage, and your input stays in this browser tab.
What kind of query can I try?
The worked example uses SELECT name FROM people WHERE id=$1 ORDER BY name; which includes a numbered parameter ($1) and a final semicolon, both of which are supported.