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

Long hex hybrids get cut in DEFAULT expressions

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.1, 10.2, 10.3, 10.4
    • Fix Version/s: 10.4
    • Component/s: Data types
    • Labels:
      None

      Description

      CREATE OR REPLACE TABLE t1 (a VARBINARY(32) DEFAULT CAST(0x00112233445566778899AABBCCDDEEFF AS BINARY));
      SHOW CREATE TABLE t1;
      

      +-------+------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                             |
      +-------+------------------------------------------------------------------------------------------------------------------------------------------+
      | t1    | CREATE TABLE `t1` (
        `a` varbinary(32) DEFAULT (cast(0x8899aabbccddeeff as char charset binary))
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+------------------------------------------------------------------------------------------------------------------------------------------+
      

      Notice, the hex hybrid constant in the DEFAULT clause was cut from 16 bytes to 8 bytes.

      If I use a hex string constat (instead of hex hybrid constant), it works as expected:

      CREATE OR REPLACE TABLE t1 (a VARBINARY(32) DEFAULT CAST(X'00112233445566778899AABBCCDDEEFF' AS BINARY));
      SHOW CREATE TABLE t1;
      

      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                                              |
      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
      | t1    | CREATE TABLE `t1` (
        `a` varbinary(32) DEFAULT (cast(X'00112233445566778899aabbccddeeff' as char charset binary))
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: