Suppose a column of type unsigned int
. Since 4294967295 is the largest unsigned integer, this query will fail with a overflow error:
update mytable set intcolumn = intcolumn + 1;
How could I achieve that instead of overflowing, 4294967295 + 1
will become 0
(zero) ?
More generally, by adding any integer, I would just like the integer to wrap around zero instead of overflowing.
I just found out that before mysql 5.5.5, integer silently wrapped around. Only 5.5.5 and above throw an error.