Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
10.5
-
None
Description
The description of MDEV-274 says
Values are stored as a 16-byte fixed length binary string <...>
Storage engines see INET6 as BINARY(16)
One could derive from that that INET6 can be converted into BINARY(16), but it's not the case:
CREATE OR REPLACE TABLE t1 (a INET6); |
INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329'); |
ALTER TABLE t1 MODIFY a BINARY(16); |
select cast(a as binary(16)) from t1; |
show warnings;
|
MariaDB [test]> ALTER TABLE t1 MODIFY a BINARY(16); |
ERROR 1406 (22001): Data too long for column 'a' at row 1 |
MariaDB [test]> select cast(a as binary(16)) from t1; |
+-----------------------+ |
| cast(a as binary(16)) | |
+-----------------------+ |
| 2001:db8::ff00:4 |
|
+-----------------------+ |
1 row in set, 1 warning (0.000 sec) |
 |
MariaDB [test]> show warnings;
|
+---------+------+----------------------------------------------------------------+ |
| Level | Code | Message | |
+---------+------+----------------------------------------------------------------+ |
| Warning | 1292 | Truncated incorrect BINARY(16) value: '2001:db8::ff00:42:8329' | |
+---------+------+----------------------------------------------------------------+ |
1 row in set (0.000 sec) |
I assume it's expected, but it should probably be clarified in documentation.
Attachments
Issue Links
- relates to
-
MDEV-20784 Testing for MDEV-274 (INET6, data type for IPv6/IPv4 addresses)
- Closed
-
MDEV-20795 CAST(inet6 AS BINARY) returns wrong result
- Closed
-
MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
- Closed
-
MDEV-20781 Document INET6 (MDEV-274)
- Closed