GREATEST() does not always return same signness of argument types.

Bug #873142 reported by Antony T Curtis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
New
Undecided
Unassigned

Bug 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));

Tags: 5.2 5.3 win32 win64
description: updated
summary: - Win32/Win64: GREATEST() does not always return same signness of argument
- types.
+ GREATEST() does not always return same signness of argument types.
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.