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

CAST(11068046444225730969 AS SIGNED) does not return a warning

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 10.0, 10.1, 10.2, 10.3, 10.4
    • 10.3.15, 10.4.5
    • OTHER
    • None

    Description

      This script:

      SELECT CAST(-7378697629483820647 AS UNSIGNED);
      

      returns

      +----------------------------------------+
      | CAST(-7378697629483820647 AS UNSIGNED) |
      +----------------------------------------+
      |                   11068046444225730969 |
      +----------------------------------------+
      1 row in set, 1 warning (0.00 sec)
      

      with a warning:

      +-------+------+-------------------------------------------------------------------------+
      | Level | Code | Message                                                                 |
      +-------+------+-------------------------------------------------------------------------+
      | Note  | 1105 | Cast to unsigned converted negative integer to it's positive complement |
      +-------+------+-------------------------------------------------------------------------+
      

      If I now do the other way around:

      SELECT CAST(11068046444225730969 AS SIGNED);
      

      it returns this result:

      +--------------------------------------+
      | CAST(11068046444225730969 AS SIGNED) |
      +--------------------------------------+
      |                 -7378697629483820647 |
      +--------------------------------------+
      1 row in set (0.00 sec)
      

      but no warning is issued.

      Expect to get a warning Cast to signed converted positive integer to it's negative complement

      Attachments

        Activity

          People

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