MySQL Assuming unsigned result in subtractions, what's the motive? I just found out that if I try to subtract an unsigned integer from another unsigned, MySQL automatically assumes the result will be unsigned, which in turn generates the error BIGINT UNSIGNED value is out of range whenever the actual result of the operation is negative.

I tried googling the reason for this design decision, but didn't find any explanation.

What are the motives for such a decision? does it make sense to assume an unsigned result when subtracting two unsigned integers?
Catch-22.
I'll use TINYINT to make the numbers easier.  SIGNED range is -128..127; UNSIGNED is 0..255

Your question, as I see it, is "Why not make the result SIGNED?"

Your case is (10) - (12) = (-2), which cannot be represented as UNSIGNED.

A different case is (200) - (1) = (199), which cannot be represented as SIGNED.

Either decision leads to some arguments producing an value that is "out of range".

(I don't know the history of the decision.  Also, I don't know if there is an SQL standard that is involved.)