4 ms·
I've wondered sometimes if it's possible to quantify what I hate about hacking SQL so much, but it's hard. The language lacks something that I've taken to fuzzi
by shadowgovt 6y ago
I've wondered sometimes if it's possible to quantify what I hate about hacking SQL so much, but it's hard. The language lacks something that I've taken to fuzzily call "localized mutation..." When I have to change someone's existing SQL, it usually involves jumping around in the text buffer a lot (i.e. wrapping an existing statement in parens to use it as a clause in a bigger statement, or having to split a clause that is now complicated enough into a separate WITH clause... These operations involve mutating text that can be dozens of lines separated, and all those mutations need to be coordinated.
It feels like a harder language to refactor than most I use.
- xxs 6y agoIndeed, it's difficult to be isolated and split into smaller blocks (functions/classes/whatever). Effectively it's one massive statement with different clauses and data that's entirely publicly accessible in all aspects, no encapsulation and so on. As a cheap excuse, I have come to think that 'loving' SQL does require a different mindset.
- mywittyname 6y agoI love SQL. I think you're spot on that it takes a different mindset. I treat it like a disposable expression of data, not a program. Essentially, I have data in one form, and I need to translate to this form, what is the logical representation of such a transformation? If the results of an SQL are not as expected, I have no problem rewriting the entire thing rather than doing a "bug fix."
- qsort 6y ago> I've wondered sometimes if it's possible to quantify what I hate about hacking SQL so much, but it's hard. In my experience the "problem" is how detached it is from the underlying computational model. Even more so when you're working with columnar stores, querying Vertica with SELECT FROM WHERE is kind of weird. Probably it's because I don't have a lot of experience with it, but I feel like I have to EXPLAIN every other query, I'm never confident what I said is what I mean.
- Normille 6y agoFor me, any time I have to write any SQL statements it's the totally and utterly unhelpful error messages: >ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your DB server version for the right syntax to use near <insert really long SQL query> ...which, as far as I can see, haven't changed an iota in their total and utter vagueness since I first wrote an SQL query about 20 odd years ago.
- Normille 6y ago> I've wondered sometimes if it's possible to quantify what I hate about hacking SQL so much, but it's hard... For me, any time I have to write any SQL statements it's the totally and utterly unhelpful error messages: >ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your DB server version for the right syntax to use near <insert really long SQL query> ...which, as far as I can see, haven't changed an iota in their total and utter vagueness since I first wrote an SQL query about 20 odd years ago.