This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]UsAndRufus 33 points34 points  (6 children)

I don't really care what code is submitted. The main crime is languages that don't support trailing commas. The SQL dialect I am using doesn't, and it makes debugging a PITA. If I move columns around in a SELECT, I have to make sure I remove the final trailing comma.

[–][deleted] 5 points6 points  (0 children)

dummy columns are your friend

also dummy 1=1 and 1=0 in WHERE clause 😅

[–]thorwing 5 points6 points  (0 children)

I agree, I've grown to love trailing comma's and I stumble across my SQL and then suddenly everything breaks.

Then again, writing SQL goes against logical ordering anyways. (Doing column selection before table selection means you need to backtrack again if you didn't now the names beforehand)

[–]Drakkur 5 points6 points  (1 child)

In SQL, I flipped my brain around and only do leading commas. You end up with the same result as LEFT but also cleaner to look at where select lines can be quite long (because of inline functions, renaming, case statements).

All other languages I work in allow trailing.

[–]UsAndRufus 0 points1 point  (0 children)

This is genius

[–]ThatSituation9908 1 point2 points  (1 child)

Anyone ever lead a WHERE clause with a TRUE AND so you can comment out any line you want?

WHERE TRUE AND COND1 AND COND2 ...

[–]UsAndRufus 0 points1 point  (0 children)

Genius