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

LP:873142 - GREATEST() does not always return same signness of argument types.

    XMLWordPrintable

Details

    • 10.1.8-4

    Description

      Description:
      There is a problem on all platforms; to varying degrees.

      Windows 32bit and Windows 64bit:
      When supplied BIGINT UNSIGNED, the return type is a BIGINT SIGNED,

      Others:
      The return type appears to be valid however for BIGINT values, the comparison is always
      performed as if the values were signed.

      Workaround would be to use IF(x>y,x,y) function instead.

      How to repeat:
      To reproduce this bug, create this simple table.

      DROP TABLE `cma`;
      CREATE TABLE `cma` (
        `a` binary(16) NOT NULL,
        `b` bigint(20) unsigned NOT NULL,
        PRIMARY KEY (`a`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
       
      -- Execute the following statement twice
       
      INSERT INTO cma
      (a, b)
      VALUES ('foobar',13836376518955650385)
      ON DUPLICATE KEY UPDATE
      b=GREATEST(b,VALUES(b));

      Attachments

        Activity

          People

            bar Alexander Barkov
            antonytcurtis Antony T Curtis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.