I’m looking for a good SQL autoformatter for PostgreSQL that integrates with VSCODE


I’ve noticed that it’s somehow hard to find a good SQL formatter for PostgreSQL.

Some of the things I’m preferably looking for are:

  • color coding of all postgreSQL keywords
  • a way to easily NOT autoformat on save (e.g. by including a top line with -- no autoformat)
  • configurability of style options

A particular style that I like (but never found a formatter for) is this one (from https://www.sqlstyle.guide/):

SELECT file_hash  -- stored ssdeep hash
  FROM file_system
 WHERE file_name = '.vimrc';

Any suggestions?