Bug #26013 Unsigned numbers behavior
Submitted: 1 Feb 2007 15:39 Modified: 2 Feb 2007 9:57
Reporter: Stien simon Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.22 OS:Linux (linux fedora core 6)
Assigned to: CPU Architecture:Any
Tags: UNSIGNED

[1 Feb 2007 15:39] Stien simon
Description:

Problem with unsigned numbers with MyIsam tables , when the value of an unsigned number goes in the negative , mysql reset the number to 255 instead of 0.

How to repeat:
type : TinyINT  with unsigned attribute

exemple : 

table test (id,value)

value=50

query : mysql_query("update test set value=value-60");

should produce : value = 0 ( like mysql 4.0 behavior )

with mysql 5 , produce : value = 255

Suggested fix:
Just reproduce the behavior of mysql 4.0 , if a number <0 , the number stay at 0 or NULL value or default value.
[2 Feb 2007 9:57] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Read about CAST(negative_value AS UNSIGNED) at http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html