INET6_NTOA output is set as null to varchar(39) variable The following code snippet was working for me in version 10.2.6. But I saw issues in version 10.2.9, where the variable "ip_full_addr" is returning null instead of expected value 2000::

DECLARE ip_full_addr varchar(39) DEFAULT "";
SELECT INET6_NTOA(UNHEX('20000000000000000000000000000000')) into ip_full_addr;
SELECT ip_full_addr;


Does anyone have any clue on why this is happening?
This looks like a genuine bug. I get the expected result in MySQL 5.7.20 (see below), but it returns null in MariaDB 10.2.10. The issue should be reported in the MariaDB Jira.

mysql&gt; DELIMITER ;;
mysql&gt; CREATE PROCEDURE p() CONTAINS SQL BEGIN DECLARE ip_full_addr varchar(39) DEFAULT ""; SELECT INET6_NTOA(UNHEX('20000000000000000000000000000000')) into ip_full_addr; SELECT ip_full_addr; END;;
Query OK, 0 rows affected (0.00 sec)

mysql&gt; DELIMITER ;
mysql&gt; call p();
+--------------+
| ip_full_addr |
+--------------+
| 2000::       |
+--------------+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.00 sec)