Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
-
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
Field | Original Value | New Value |
---|---|---|
Description |
This script:
{code:sql} SELECT CAST(-7378697629483820647 AS UNSIGNED); {code} returns {noformat} +----------------------------------------+ | CAST(-7378697629483820647 AS UNSIGNED) | +----------------------------------------+ | 11068046444225730969 | +----------------------------------------+ 1 row in set, 1 warning (0.00 sec) {noformat} with a warning: {noformat} +-------+------+-------------------------------------------------------------------------+ | Level | Code | Message | +-------+------+-------------------------------------------------------------------------+ | Note | 1105 | Cast to unsigned converted negative integer to it's positive complement | +-------+------+-------------------------------------------------------------------------+ {noformat} If I now do the other way around: {code:sql} SELECT CAST(11068046444225730969 AS SIGNED); {code} it returns this result: {noformat} +--------------------------------------+ | CAST(11068046444225730969 AS SIGNED) | +--------------------------------------+ | -7378697629483820647 | +--------------------------------------+ 1 row in set (0.00 sec) {noformat} but no warning is issued. |
This script:
{code:sql} SELECT CAST(-7378697629483820647 AS UNSIGNED); {code} returns {noformat} +----------------------------------------+ | CAST(-7378697629483820647 AS UNSIGNED) | +----------------------------------------+ | 11068046444225730969 | +----------------------------------------+ 1 row in set, 1 warning (0.00 sec) {noformat} with a warning: {noformat} +-------+------+-------------------------------------------------------------------------+ | Level | Code | Message | +-------+------+-------------------------------------------------------------------------+ | Note | 1105 | Cast to unsigned converted negative integer to it's positive complement | +-------+------+-------------------------------------------------------------------------+ {noformat} If I now do the other way around: {code:sql} SELECT CAST(11068046444225730969 AS SIGNED); {code} it returns this result: {noformat} +--------------------------------------+ | CAST(11068046444225730969 AS SIGNED) | +--------------------------------------+ | -7378697629483820647 | +--------------------------------------+ 1 row in set (0.00 sec) {noformat} but no warning is issued. Expect to get a warning {{Cast to signed converted positive integer to it's negative complement}} |
Priority | Major [ 3 ] | Minor [ 4 ] |
Affects Version/s | 10.3 [ 22126 ] | |
Affects Version/s | 10.4 [ 22408 ] |
issue.field.resolutiondate | 2019-04-30 11:52:28.0 | 2019-04-30 11:52:28.005 |
Fix Version/s | 10.3.15 [ 23309 ] | |
Fix Version/s | 10.4.5 [ 23311 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 76275 ] | MariaDB v4 [ 150565 ] |
If I now do the same conversion using COLUMN_CREATE/COLUMN_GET:
SHOW WARNINGS;
it correctly returns the result and the warning:
+-----------------------------------------------------------------+
| COLUMN_GET(COLUMN_CREATE(0, 11068046444225730969), 0 AS SIGNED) |
+-----------------------------------------------------------------+
| -7378697629483820647 |
+-----------------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
+-------+------+------------------------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+------------------------------------------------------------------------------------+
| Note | 1105 | Cast to signed converted positive out-of-range integer to it's negative complement |
+-------+------+------------------------------------------------------------------------------------+