[MDEV-14116] INET6_NTOA output is set as null to varchar(39) variable Created: 2017-10-24  Updated: 2017-11-08  Resolved: 2017-11-07

Status: Closed
Project: MariaDB Server
Component/s: Data types, Stored routines
Affects Version/s: 10.0, 10.1, 10.1.25, 10.0.32, 10.2.7, 10.2
Fix Version/s: 10.0.34, 10.1.29, 10.2.11, 10.3.3

Type: Bug Priority: Major
Reporter: Vijay Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: datatype
Environment:

Centos 7


Sprint: 10.2.11

 Description   

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;



 Comments   
Comment by Elena Stepanova [ 2017-10-30 ]

Thanks for the report.
MTR-friendly test case:

--delimiter $$
CREATE PROCEDURE pr()
BEGIN
  DECLARE ip_full_addr varchar(39) DEFAULT "";
  SELECT INET6_NTOA(UNHEX('20000000000000000000000000000000')) into ip_full_addr;
  SELECT ip_full_addr;
END$$
--delimiter ;
 
CALL pr();
 
# Cleanup
DROP PROCEDURE pr;

Expected result

ip_full_addr
2000::

Actual result

ip_full_addr
NULL

The behavior changed with this commit in 10.0 branch and up:

commit 3a37afec293e36e51b83a9bd338ad5f74e7f63c0
Author: Alexander Barkov <bar@mariadb.org>
Date:   Mon Jun 19 12:45:32 2017 +0400
 
    MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery

Comment by Alexander Barkov [ 2017-11-07 ]

"commit 3a37afec293e36e51b83a9bd338ad5f74e7f63c0" did not introduce the bug. It only revealed the bug.

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