Live data from Hacker News

PgFormatter: A PostgreSQL SQL syntax beautifier

github.com

1–10 of 33 posts

Re: PgFormatter: A PostgreSQL SQL syntax beautifier

#2
Pasting "SELECT 1,2," then clicking [FORMAT MY CODE] on their online demo[1] seems to break something. It renders the site header, but nothing else.

[1] http://sqlformat.darold.net/

Also, a similar tool was recently discussed: https://news.ycombinator.com/item?id=18087514

Re: PgFormatter: A PostgreSQL SQL syntax beautifier

#3
The stark difference between a formatter and a formatter officially blessed by the parent project, is that the former is far more vulnerable to having its output viewed with a jaundiced eye and the formatter being cast away.

I remember trying the one from TFA and NOPE-ing out immediately. Similarly, "sqlfmt" that was on HN recently. If there was an official Postgres formatter, I would probably persevere despite whatever oddities it would inevitably have.

Re: PgFormatter: A PostgreSQL SQL syntax beautifier

#6
post #3

The stark difference between a formatter and a formatter officially blessed by the parent project, is that the former is far more vulnerable to having its output viewed with a jaundiced eye and the formatter being cast away. I remember trying the one from TFA and NOPE-ing out immediately. Similarly, "sqlfmt" that was on HN recently. If there was an official Postgres formatter, I would probably persevere despite whate…

The sqlfmt one pulls in the cockroachdb parser, and that team has a fairly big incentive to be compatible with PG syntax. Nobody is perfect, but it seems set up to stay current/correct.

Re: PgFormatter: A PostgreSQL SQL syntax beautifier

#7
post #6
post #3

The stark difference between a formatter and a formatter officially blessed by the parent project, is that the former is far more vulnerable to having its output viewed with a jaundiced eye and the formatter being cast away. I remember trying the one from TFA and NOPE-ing out immediately. Similarly, "sqlfmt" that was on HN recently. If there was an official Postgres formatter, I would probably persevere despite whate…

The sqlfmt one pulls in the cockroachdb parser, and that team has a fairly big incentive to be compatible with PG syntax. Nobody is perfect, but it seems set up to stay current/correct.

I meant the style choices. But it did also choke on Identity Columns IIRC (https://blog.2ndquadrant.com/postgresql-10-identity-columns/).

Not knocking either project - just pondering adoption.

Re: PgFormatter: A PostgreSQL SQL syntax beautifier

#10
Do we need to use caps for SQL keywords? My understanding is that it served a purpose back in the days of monochrome screens, but modern IDEs colour the keywords so caps are now redundant. Though I don't use caps even without colouring, I find them just a nuisance.
Post reply on HN