What do you use to format SQL in PostgreSQL dialect?

This page summarizes the projects mentioned and recommended in the original post on /r/PostgreSQL

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • pgFormatter

    A PostgreSQL SQL syntax beautifier that can work as a console program or as a CGI. On-line demo site at http://sqlformat.darold.net/

  • I have found this https://github.com/darold/pgFormatter, but I am not sure if there is something else that I haven't discovered yet.

  • sqlfmt

    SQL formatter with width-aware output

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • sqlfmt

    Discontinued SQL Formatter (by jackc)

  • sqlf

  • I’m sort of persnickety about using right-aligned keywords and commas first in select and group by lists, etc. I also consider all-caps keywords to be a relic of the times before automated syntax highlighting in editors, and prefer all lowercase most of the time. Not finding anything that satisfied all my preferences (sorta understandable, really) I rolled my own little script using the Python sqlparse library: https://gitlab.com/tym27/sqlf

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts