News for hackers. Stuff that matters.
Re:What I Wish Someone Told Me About Postgres by homebrewer on Tuesday November 12, 2024 @02:10PM (#42118579)
IDEA if you want to use it for other things (or any other JetBrains IDE). Nothing comes close feature-wise.

If you don't:

- https://www.depesz.com/2022/09/21/prettify-sql-queries-from-...

- https://gitlab.com/depesz/pg-sql-prettyprinter

Or https://paste.depesz.com for one-off use.

Re:What I Wish Someone Told Me About Postgres by jillyboel on Tuesday November 12, 2024 @02:41PM (#42118888)
i think the idea sql prettifier is pretty silly sometimes. it really likes indenting stuff to make sure things are aligned, which often results in dozens of whitespaces
Re:What I Wish Someone Told Me About Postgres by homebrewer on Tuesday November 12, 2024 @05:51PM (#42120714)
It makes it easy to distinguish null vs not null columns and other similar things, so I personally don't mind.
Re:What I Wish Someone Told Me About Postgres by jillyboel on Tuesday November 12, 2024 @06:40PM (#42121237)
It's more about queries like (dummy example)

    RETURN CASE
               WHEN a = 1 THEN 1
               ELSE 2
        END;
where it insists on aligning WHEN past CASE. I think it would be perfectly reasonable to indent WHEN and ELSE 4 spaces less, for example. Similar things happen with nested conditions like (a or (b and c)) all getting pushed to the right