This update adds formatting support for SQL statements that include the ON CONFLICT clause. The formatting rules are as follows:
Formatting Rules
ON CONFLICT :
No line break or indentation; always appears inline
ON CONSTRAINT (if present):
Placed on the same line as ON CONFLICT, immediately following it
DO:
Always starts on a new line
Any query that follows DO (e.g., UPDATE, NOTHING) is indented relative to DO
Option Keywords
EXCLUDE is not a reserved word, so do not add it as a keyword.
https://www.postgresql.org/docs/current/sql-keywords-appendix.html
Example (Formatted Output)
INSERT INTO users
(username
, email)
VALUES ('user'
, '[email protected]')
ON CONFLICT(username) ON constraint
DO UPDATE
SET email = EXCLUDED.email
, created_at = CURRENT_TIMESTAMP