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

Converting INET6 to CHAR(39) produces garbage without a warning

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.5
    • Fix Version/s: 10.5.0
    • Component/s: Data types
    • Labels:
      None

      Description

      CAST from INET6 to CHAR(39) works fine, so one could expect that ALTER TABLE works too. It does, without a warning, but resulting contents looks like garbage:

      CREATE OR REPLACE TABLE t1 (a INET6);
      INSERT INTO t1 VALUES ('2001:db8::ff00:42:8329');
      SELECT CAST(a AS CHAR(39)) FROM t1;
      ALTER TABLE t1 MODIFY a CHAR(39);
      SELECT * FROM t1;
      

      MariaDB [test]> SELECT CAST(a AS CHAR(39)) FROM t1;
      +------------------------+
      | CAST(a AS CHAR(39))    |
      +------------------------+
      | 2001:db8::ff00:42:8329 |
      +------------------------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> ALTER TABLE t1 MODIFY a CHAR(39);
      Query OK, 1 row affected (0.843 sec)               
      Records: 1  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> SELECT * FROM t1;
      +---------------------+
      | a                   |
      +---------------------+
      ¸      ÿ  Bƒ)    |
      +---------------------+
      1 row in set (0.001 sec)
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: