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

Bad result for COALESCE(huge_unsigned_number, 1)

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.5.36, 10.0.9
    • Fix Version/s: 10.0, 5.5
    • Component/s: None
    • Labels:
      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.

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

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

                Dates

                • Created:
                  Updated: