Remix.run Logo
3eb7988a1663 4 hours ago

Can someone explain to me why SQL error messages are so bad? I routinely have some monster query where the message is effectively, "Illegal syntax somewhere, dufus".

bawolff 4 hours ago | parent | next [-]

I'd guess people just haven't put much effort into it. Lots of programming language compilers have absolutely terrible error messages. In SQL its usually just one line, so "somewhere" isn't that big a place.

klysm 4 hours ago | parent | prev [-]

This sounds like a proper of the parser, rather than of the language

derriz 4 hours ago | parent | next [-]

A long time ago, I had to write SQL parsers (for 3 of the most popular DBs at the time). It is a surprisingly difficult language to parse and disambiguate - particularly when having to deal with the warts of its variants. Sure it's not quite C++ but it's was easily the most annoying parser work I ever had to do. And in my experience, the trickier it is to parse a particular language, the more difficult it is to provide feedback to users in the form of helpful parse errors.

appplication 4 hours ago | parent | prev [-]

This is true, but the observation is still salient. There does seem to be some correspondence between languages with inherent friction and parsers that aren’t interested in being helpful. E.g. sometimes a user base just collectively decides they’re ok with some level of pain.