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.
PgFormatter: A PostgreSQL SQL syntax beautifier
21–30 of 33 posts
Re: PgFormatter: A PostgreSQL SQL syntax beautifier
#22I've never heard of a code formatter called a "syntax beautifier" before. The phrase "syntax beautifier" sounds more like a compiler plug-in that actually changes the language syntax to something more beautiful.
Re: PgFormatter: A PostgreSQL SQL syntax beautifier
#23Looks like they might need a formatter to beautify their README too.
Re: PgFormatter: A PostgreSQL SQL syntax beautifier
#24I'll have to see if I can adapt this to my somewhat idiosyncratic syntax: SELECT field, other_field FROM table WHERE some_thing IN ( SELECT id FROM other_table ) AND other_field IS NOT NULL (mostly it's right-aligning keywords, but there are a few other weird tweaks)
SELECT
field,
other_field
FROM
TABLE
WHERE
some_thing IN (
SELECT
id
FROM
other_table)
AND other_field IS NOT NULL
I'd have expected the last line to have one less indentation level...Re: PgFormatter: A PostgreSQL SQL syntax beautifier
#25I'll have to see if I can adapt this to my somewhat idiosyncratic syntax: SELECT field, other_field FROM table WHERE some_thing IN ( SELECT id FROM other_table ) AND other_field IS NOT NULL (mostly it's right-aligning keywords, but there are a few other weird tweaks)
Re: PgFormatter: A PostgreSQL SQL syntax beautifier
#26Pasting "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
#27Re: PgFormatter: A PostgreSQL SQL syntax beautifier
#28I really hope there will be a sql formatter like prettier for javascript, I have tried Intellij's sql formater and mysql workbench's sql formatter, neither has some warts.
Re: PgFormatter: A PostgreSQL SQL syntax beautifier
#29I'll have to see if I can adapt this to my somewhat idiosyncratic syntax: SELECT field, other_field FROM table WHERE some_thing IN ( SELECT id FROM other_table ) AND other_field IS NOT NULL (mostly it's right-aligning keywords, but there are a few other weird tweaks)
Re: PgFormatter: A PostgreSQL SQL syntax beautifier
#30A 100% Perl project in 2018 is a rare sight. (Implementing a SQL formatter in pure SQL is not impossible, but would be quite a tour de force. Just a thought.)