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

DOUBLE columns do not accept large hex hybrids

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5
    • 10.5
    • Data types
    • None

    Description

      DOUBLE columns accept hex hybrids only in the range 0x0000000000000000..x7FFFFFFFFFFFFFFF without problems:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DOUBLE);
      INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
      SELECT * FROM t1;
      

      +----------------------+
      | a                    |
      +----------------------+
      | 9.223372036854776e18 |
      +----------------------+
      

      Looks good so far.

      Now let's try a larger value:

      INSERT INTO t1 VALUES (0x8000000000000000);
      

      ERROR 1264 (22003): Out of range value for column 'a' at row 1
      

      Looks wrong. There should not be an error.
      The same problem happens with all values in the range 0x8000000000000000..0xFFFFFFFFFFFFFFFF.

      Note, an explicit CAST correctly handles these values:

      SELECT
        CAST(0x8000000000000000 AS DOUBLE), 
        CAST(0xFFFFFFFFFFFFFFFF AS DOUBLE);
      

      +------------------------------------+------------------------------------+
      | CAST(0x8000000000000000 AS DOUBLE) | CAST(0xFFFFFFFFFFFFFFFF AS DOUBLE) |
      +------------------------------------+------------------------------------+
      |               9.223372036854776e18 |              1.8446744073709552e19 |
      +------------------------------------+------------------------------------+
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.