5 ms·
To make writing and maintaining sql easier. To make sql diffs better. To make sql more consistent with other languages. Every time this trips me up, it’s hand
by masklinn 2y ago
To make writing and maintaining sql easier. To make sql diffs better. To make sql more consistent with other languages.
Every time this trips me up, it’s hand written SQL, because literally every other language I routinely use supports trailing commas.
The additional complexity during codegen is barely existent. If you’re using an orm or code generator this will be an issue once at most (if and when you write your own).
- VWWHFSfQ 2y ago> To make writing and maintaining sql easier. From my experience there are a lot of programmers that simply don't write SQL at all. They use an ORM or some query building library in their preferred programming language. So they're the ones that don't understand the problem when handwriting SQL, because they simply don't do it. Even the parent comment here is talking about PHP array syntax instead of SQL. I write all of my queries directly in SQL, and I run into the trailing comma issue somewhat frequently. It's a minor annoyance, but I've just been dealing with it forever and accepted it.
- karmakaze 2y agoYou can already do this without changing the SQL language spec. If you really care about the things you say, follow the other comments and make the first element special which is changed much less frequently.
- masklinn 2y agoSo you can’t do it, you can do a different thing which (as I already answered in details elsewhere) still sucks but differently. Great contribution, thanks for nothing.
- trailingcoma 2y agoCurious to see your Postgres PR with this change in it. Is it done yet?
- trailingcoma 2y agoEveryone knows the hardest part about writing SQL is having to get Claude to tell you where the commas should go.