3 ms·
I think a lot of these are in the ANSI 2016 spec. I haven't looked at the older specs, maybe they were simpler. Eg here is the `a+1` vs `1+a` thing explained f
by jamii 6y ago
I think a lot of these are in the ANSI 2016 spec. I haven't looked at the older specs, maybe they were simpler.
Eg here is the `a+1` vs `1+a` thing explained for ORDER BY - https://i.imgur.com/bklpjkP.png https://i.imgur.com/bklpjkP.png. Here are the conditions under which ORDER BY can reach inside SELECT to pick columns from the FROM clause - https://i.imgur.com/aoeqDGn.png https://i.imgur.com/aoeqDGn.png.
Chapter 2 of the spec is 1732 pages of that kind of language, so it's hard to be sure that any particular behaviour is not in there somewhere. But I'm fairly sure that all the examples with set-valued functions are postgres-isms.
- csours 6y agoWow, I never would have guessed that ORDER BY stuff was part of the standard. Seems like one of the special corners of SQL. From that brief read of the ANSI Spec it seems like one would need a great deal of time and some advanced mathematics to understand it.
- jamii 6y agoThere isn't really any math involved. It's just a lot of edge cases written out in lots of detail. I think a lot of what makes SQL hard to implement comes down to consistently prioritizing local convenience over global complexity, combined with not being able to break backwards compatibility to simplify the design.