Bug #63457 | MySQL Workbench gives the wrong result when doing a MAX over a BIT field | ||
---|---|---|---|
Submitted: | 28 Nov 2011 16:29 | Modified: | 30 Aug 2012 22:37 |
Reporter: | Sergio Bobillier | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Workbench | Severity: | S3 (Non-critical) |
Version: | 5.2.35 rev 7915 | OS: | Linux (Ubuntu 11.04 x64) |
Assigned to: | CPU Architecture: | Any | |
Tags: | bit, MAX, workbench |
[28 Nov 2011 16:29]
Sergio Bobillier
[28 Nov 2011 16:47]
MySQL Verification Team
Verified on Windows too.
[28 Nov 2011 21:31]
Peter Laursen
Try framing the statememt as "SELECT CAST(MAX(b) AS SIGNED) FROM t;" or "SELECT CAST(MAX(b) AS CHAR) FROM t;" or "SELECT BIN(MAX(b)) FROM t;" or "SELECT MAX(b) + 0 FROM t;". All four return "1" also in WB - right? That is the correct way(s) to write such statement. Understand this docs: http://dev.mysql.com/doc/refman/5.5/en/bit-field-values.html: "Bit values are returned as binary values. To display them in printable form, add 0 or use a conversion function such as BIN()." The returns from WB is weird indeed, but it is actually unclear (to me at least) what type "SELECT MAX(BIT-value);" returns? A BIT-type? A string? An UNSIGNED? Anything else? I suspect that there is a server bug involved here too when using aggregates on BIT. (and BIT in MySQL is hopeless BTW. Better use TINYINT(1) instead) Peter (not a MySQL person)
[29 Nov 2011 9:45]
Peter Laursen
Also see http://bugs.mysql.com/bug.php?id=63470
[13 Dec 2011 15:34]
Armando Lopez Valencia
Verified as reported. Ubuntu 11.04x64 WB 5.2.36 rev 8542
[30 Aug 2012 22:37]
Philip Olson
Fixed as of the upcoming 5.2.43, and here's the changelog entry: MySQL Workbench would yield incorrect results while displaying results from the "MAX" function on a bit field. Thank you for the report.