|
When trying to represent the binary string of a user variable the output is 0, but no warning was returned.
How to repeat:
MariaDB [test]> set @a:=b'101';
|
Query OK, 0 rows affected (0,001 sec)
|
|
MariaDB [test]> select hex(@a);
|
+---------+
|
| hex(@a) |
|
+---------+
|
| 05 |
|
+---------+
|
1 row in set (0,001 sec)
|
|
MariaDB [test]> select bin(hex(@a));
|
+--------------+
|
| bin(hex(@a)) |
|
+--------------+
|
| 101 |
|
+--------------+
|
1 row in set (0,001 sec)
|
|
# No warning returned
|
MariaDB [test]> select bin(@a);
|
+---------+
|
| bin(@a) |
|
+---------+
|
| 0 |
|
+---------+
|
1 row in set (0,001 sec)
|
Works as expected with MySQL :
MySQL [(none)]> set @a:=b'101';
|
Query OK, 0 rows affected (0,001 sec)
|
|
MySQL [(none)]> select bin(@a);
|
+---------+
|
| bin(@a) |
|
+---------+
|
| 0 |
|
+---------+
|
1 row in set, 1 warning (0,001 sec)
|
|
MySQL [(none)]> show warnings;
|
+---------+------+-------------------------------------------+
|
| Level | Code | Message |
|
+---------+------+-------------------------------------------+
|
| Warning | 1292 | Truncated incorrect DECIMAL value: '\x05' |
|
+---------+------+-------------------------------------------+
|
1 row in set (0,001 sec)
|
|