pgFormatter vs prettier-plugin-sql-cst
pgFormatter
github.comprettier-plugin-sql-cst
github.comSide by side
| Figure | pgFormatter | prettier-plugin-sql-cst |
|---|---|---|
| Price from | Free | — |
| Free plan | Yes | — |
| Free trial | — | — |
| Open source | — | — |
| Web | Yes | Yes |
| Linux | Yes | — |
| API | Yes | — |
| Self-hosted | Yes | — |
| Plans published | 1 | 0 |
| Spec score · SQL Linters and Formatters | 8.2 (#6) | 6.9 (#25) |
| Installation | The README documents installation from a GitHub source tarball using Perl Makefile.PL, make, and make install. | The README gives npm, pnpm, and yarn commands for installing the plugin with Prettier as a development dependency. |
| Purpose | pgFormatter beautifies PostgreSQL SQL queries and PL/pgSQL code, and supports keywords from several SQL standards as well as PostgreSQL-specific keywords. | It is a Prettier plugin for formatting SQL that uses sql-parser-cst and Prettier’s formatting algorithm. |
Plans
In their own words
pgFormatter
pgFormatter is free software for formatting PostgreSQL SQL queries and PL/pgSQL code. It supports SQL-92, SQL-99, SQL-2003, SQL-2008, SQL-2011 and PostgreSQL syntax, and the project says it also works with other databases. You can run it as a console program or CGI application that returns text or HTML; a CGI request with an application/json Accept header can return JSON. Formatting controls cover keyword, function, identifier and type case, indentation, query wrapping and comma placement. The --anonymize option hides query literals before formatting. The project documents source installation with Perl Makefile.PL, make and make install, Docker use, Vim and (Neo)Vim integration, Atom and Visual Studio Code links, and a pre-commit hook for SQL files. An online demo limits queries to ten thousand characters. It is distributed under the PostgreSQL Licence at free.
prettier-plugin-sql-cst
prettier-plugin-sql-cst has no write-up on Specifiction yet; its figures are above.