8 ms·
I want leading _and_ trailing commas. Frequently I will be working on a query and have something like SELECT a , b , c from foo an
by netcraft 2y ago
I want leading _and_ trailing commas.
Frequently I will be working on a query and have something like
SELECT
a
, b
, c
from foo
and then I want to comment out a column as I am working and exploring the data. But I cant comment out column a without also removing the comma on the next line.
- sunnybeetroot 2y agoWouldn’t just trailing solve your issue? SELECT a, b, c, From Foo
- edoceo 2y agoMoved the problem to column C
- sunnybeetroot 2y agoBut if this change is adopted, then commenting out column C would still compile the query. There isn’t a need for leading?
- netcraft 2y agoin 20 years of writing SQL, preceding commas is so much better IMO. Its so easy to miss a comma at the end of a long expression. preceding commas means you can never forget them. Then if I can have an extra leading comma, I can reorder, comment out or remove, or add a column at any point in the list without having to think about the rest of the projection. Also diffs are cleaner, it only highlights the rows that have changed, not the row above it/below it that had its comma added or removed. This happens a ton when im iterating on a query.
- nightpool 2y agoIt's only easy to miss a comma at the end of a long expression because you need to calculate whether it should be there in the first place. If commas were always required unconditionally, it wouldn't be a problem.
- netcraft 2y agoits still a problem if you forget to write it, and with a trailing comma its often that you forget it because theyre hard to see