Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-14116

INET6_NTOA output is set as null to varchar(39) variable

Details

    • 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;
      

      Attachments

        Activity

          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
          

          elenst Elena Stepanova added a comment - 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

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

          bar Alexander Barkov added a comment - "commit 3a37afec293e36e51b83a9bd338ad5f74e7f63c0" did not introduce the bug. It only revealed the bug.

          People

            bar Alexander Barkov
            vijay Vijay
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.