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

Long hex hybrids get cut in DEFAULT expressions

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.1, 10.2, 10.3, 10.4
    • 10.4
    • Data types
    • 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

        Activity

          People

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

            Dates

              Created:
              Updated:

              Git Integration

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