Hacker News new | ask | show | jobs
by JelteF 2821 days ago
Looks really cool, but I have one suggestion. Have you considered using leading commas? It makes big SQL statements much easier to edit and it improves diffs. I normally use trailing commas for my code, but most sql dialects don't support it so I fallback to leading ones there.
3 comments

I believe and direct my team to use leading commas, with fields on individual lines, to facilitate easier copy/paste and also to make it easier to comment out sections of the query.

It does lead to longer queries and poor use of screen real estate, but it is very readable.

Oh god, no. No leading commas, anywhere. Not in javascript, not in SQL. It's like nails on a chalkboard.

Funny because I was reading other people's comments and thinking "wow, that person is VERY opinionated on query formatting" (but now here I am).

> Funny because I was reading other people's comments and thinking "wow, that person is VERY opinionated on query formatting" (but now here I am).

There are opinions, and there are crimes against humanity (although that is a matter of opinion).

For really complex queries it can be totally confusing. At least for me it does. I prefer indentation. I like my SQL blocky.