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

Incompatible behavior with MySQL when cast negative number to unsigned

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Trivial
    • Resolution: Not a Bug
    • 11.8.3
    • N/A
    • Data types, Server
    • None
    • Not for Release Notes

    Description

      Run the following cases, where MySQL and MariaDB return different results.

      -- mariadb
      DROP TABLE t1;
      CREATE TABLE t1 (c1 DECIMAL(10,0));
      INSERT INTO t1 VALUES (-1);
      SELECT CAST(c1 AS UNSIGNED) FROM t1; -- {0}
       
      -- mysql
      DROP TABLE t1;
      CREATE TABLE t1 (c1 DECIMAL(10,0));
      INSERT INTO t1 VALUES (-1);
      SELECT CAST(c1 AS UNSIGNED) FROM t1; -- {18446744073709551615}
      

      Attachments

        Activity

          People

            serg Sergei Golubchik
            John Jove John Jove
            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.