[MDEV-20795] CAST(inet6 AS BINARY) returns wrong result Created: 2019-10-10  Updated: 2019-10-14  Resolved: 2019-10-11

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

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-20783 INET6 cannot be converted to BINARY(1... Closed

 Description   

CREATE OR REPLACE TABLE t1 (a INET6);
INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
SELECT CAST(a AS BINARY(16)) FROM t1;
SHOW WARNINGS;

+-----------------------+
| CAST(a AS BINARY(16)) |
+-----------------------+
| 2001:db8::ff00:4      |
+-----------------------+

+---------+------+----------------------------------------------------------------+
| Level   | Code | Message                                                        |
+---------+------+----------------------------------------------------------------+
| Warning | 1292 | Truncated incorrect BINARY(16) value: '2001:db8::ff00:42:8329' |
+---------+------+----------------------------------------------------------------+

Notice: it returned text address representation with a truncation warning.
The expected result is to return binary address representation without warnings.


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