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

Bad result for COALESCE(huge_unsigned_number, 1)

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.5.36, 10.0.9
    • 5.5(EOL)
    • None
    • None

    Description

      Run this SQL script:

      SELECT COALESCE(9223372036854775808, 1);
      SHOW WARNINGS;

      The results are:

      +----------------------------------+
      | COALESCE(9223372036854775808, 1) |
      +----------------------------------+
      |              9223372036854775807 |
      +----------------------------------+
      1 row in set, 1 warning (0.00 sec)
       
      +---------+------+-----------------------------------------------------------------------------+
      | Level   | Code | Message                                                                     |
      +---------+------+-----------------------------------------------------------------------------+
      | Warning | 1916 | Got overflow when converting '9223372036854775808' to INT. Value truncated. |
      +---------+------+-----------------------------------------------------------------------------+
      1 row in set (0.00 set

      This is wrong. The expected result is 9223372036854775808 with no warnings.

      Attachments

        Activity

          People

            bar Alexander Barkov
            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.