Bug #14886 | false result with a subquery | ||
---|---|---|---|
Submitted: | 11 Nov 2005 20:02 | Modified: | 12 Nov 2005 17:18 |
Reporter: | Oliver Peters | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.0.15 | OS: | Windows (Windows2000) |
Assigned to: | CPU Architecture: | Any |
[11 Nov 2005 20:02]
Oliver Peters
[12 Nov 2005 17:18]
Valeriy Kravchuk
Thank you for a problem report. Everything works just as you described, even on newer 5.0.17-BK, but it is not a bug - this behaviour is documented (you found a reason for the result yourself already). Please, read the manual (http://dev.mysql.com/doc/refman/5.0/en/numeric-type-overview.html): "Warning: You should be aware that when you use subtraction between integer values where one is of type UNSIGNED, the result is unsigned. See Section 12.8, “Cast Functions and Operators”." It one of the rare cases where data type of the result you get from the expression is clearly documented. If you change your column types to signed, you'll get the same results from your queries.