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?