[MDEV-21765] Possibly inconsistent behavior of BIT_xx functions with INET6 field Created: 2020-02-18  Updated: 2020-06-09  Resolved: 2020-06-09

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.5
Fix Version/s: 10.5.4

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-274 The data type for IPv6/IPv4 addresses... Closed
relates to MDEV-20784 Testing for MDEV-274 (INET6, data typ... Closed

 Description   

10.5 41fe972d

MariaDB [test]> create table t1 (a inet6);
Query OK, 0 rows affected (0.120 sec)
 
MariaDB [test]> insert into t1 values ('f::');
Query OK, 1 row affected (0.020 sec)
 
MariaDB [test]> select bit_or(a) from t1;
+-----------+
| bit_or(a) |
+-----------+
|         0 |
+-----------+
1 row in set (0.000 sec)

So, the value is apparently truncated or converted, but there are no warnings or errors.
With BINARY(16) a warning is produced:

MariaDB [test]> create table t2 (b binary(16));
Query OK, 0 rows affected (0.118 sec)
 
MariaDB [test]> insert into t2 values ('f::');
Query OK, 1 row affected (0.015 sec)
 
MariaDB [test]> select bit_or(b) from t2;
+-----------+
| bit_or(b) |
+-----------+
|         0 |
+-----------+
1 row in set, 1 warning (0.000 sec)
 
MariaDB [test]> show warnings;
+---------+------+----------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                      |
+---------+------+----------------------------------------------------------------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'f::\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
+---------+------+----------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)


Generated at Thu Feb 08 09:09:37 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.