Bug #84149 | select least(bit, bit) and select bit return inconsistent results | ||
---|---|---|---|
Submitted: | 9 Dec 2016 12:29 | Modified: | 9 Jan 2017 20:08 |
Reporter: | 帅 Bang | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.7 | OS: | Linux |
Assigned to: | CPU Architecture: | Any |
[9 Dec 2016 12:29]
帅 Bang
[9 Dec 2016 15:44]
Peter Laursen
5 years ago I wrote this https://blog.webyog.com/a-little-bit-about-bit-again/ "In every respect a BIT behaves as BIGINT UNSIGNED unless it is fetched directly from storage to a client" .. and I think this report is just another example of this. -- Peter -- not a MySQL/Oracle person.
[9 Dec 2016 20:08]
MySQL Verification Team
Thank you for the bug report. Please see the below Manual note about using BIT in numerics context: c:\dbs>c:\dbs\5.7\bin\mysql -uroot --port=3570 -p --prompt="mysql 5.7 > " Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.18 Source distribution PULL: 2016-NOV-20 Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql 5.7 > USE test Database changed mysql 5.7 > drop table t1; Query OK, 0 rows affected (0.16 sec) mysql 5.7 > create table t1(c1 bit(64)); Query OK, 0 rows affected (0.28 sec) mysql 5.7 > insert into t1 values(97),(98),(99); Query OK, 3 rows affected (0.03 sec) Records: 3 Duplicates: 0 Warnings: 0 https://dev.mysql.com/doc/refman/5.7/en/bit-value-literals.html "In numeric contexts, MySQL treats a bit literal like an integer. To ensure numeric treatment of a bit literal, use it in numeric context. Ways to do this include adding 0 or using CAST(... AS UNSIGNED). For example,..." mysql 5.7 > select c1+0 from t1; +------+ | c1+0 | +------+ | 97 | | 98 | | 99 | +------+ 3 rows in set (0.00 sec) mysql 5.7 > select least(c1,c1) from t1; +--------------+ | least(c1,c1) | +--------------+ | 97 | | 98 | | 99 | +--------------+ 3 rows in set (0.00 sec)
[10 Jan 2017 1:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".