Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
5.1.67, 5.2.14, 5.3.12, 5.5.36, 10.0.9
-
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
Field | Original Value | New Value |
---|---|---|
Labels | Launchpad |
Priority | Minor [ 4 ] |
Fix Version/s | 10.0.11 [ 15200 ] | |
Affects Version/s | 5.1.67 [ 12100 ] | |
Affects Version/s | 5.2.14 [ 12101 ] | |
Affects Version/s | 5.3.12 [ 12000 ] | |
Affects Version/s | 5.5.36 [ 14600 ] | |
Affects Version/s | 10.0.9 [ 14400 ] | |
Assignee | Alexander Barkov [ bar ] | |
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)); |
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. {code:sql} 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)); {code} |
Labels | Launchpad | Launchpad upstream |
Fix Version/s | 10.0.12 [ 15201 ] | |
Fix Version/s | 10.0.11 [ 15200 ] |
Workflow | defaullt [ 21501 ] | MariaDB v2 [ 44781 ] |
Fix Version/s | 10.0.13 [ 16000 ] | |
Fix Version/s | 10.0.12 [ 15201 ] |
Workflow | MariaDB v2 [ 44781 ] | MariaDB v3 [ 63808 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Fix Version/s | 10.1 [ 16100 ] | |
Fix Version/s | 10.0 [ 16000 ] |
Sprint | 10.1.8-4 [ 16 ] |
Rank | Ranked higher |
Component/s | OTHER [ 10125 ] | |
Fix Version/s | 10.1.8 [ 19605 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 63808 ] | MariaDB v4 [ 145850 ] |
Win32/Win64: GREATEST() does not always return same signness of argument types.
This problem occurs on Windows 32bit and Windows 64bit.
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));
A workaround may be to use CAST(GREATEST(...) AS UNSIGNED) .