mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-32645 CAST(AS UNSIGNED) fails with --view-protocol
Item_float::neg() did not preserve the "presentation" from "this". So CAST(-1e0 AS UNSIGNED) -- cast from double to unsigned changes its meaning to: CAST(-1 AS UNSIGNED) -- cast signed to undigned Fixing Item_float::neg() to construct the new value for Item_float::presentation as follows: - if the old value starts with minus, then the minus is truncated: '-2e0' -> '2e0' - otherwise, minus sign followed by its old value: '1e0' -> '-1e0'
This commit is contained in:
@@ -768,14 +768,11 @@ INSERT INTO t1 VALUES (-1.0);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#enable after MDEV-32645 is fixed
|
||||
--disable_view_protocol
|
||||
SELECT CAST(-1e0 AS UNSIGNED);
|
||||
CREATE TABLE t1 (a BIGINT UNSIGNED);
|
||||
INSERT INTO t1 VALUES (-1e0);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
--enable_view_protocol
|
||||
|
||||
SELECT CAST(-1e308 AS UNSIGNED);
|
||||
CREATE TABLE t1 (a BIGINT UNSIGNED);
|
||||
|
Reference in New Issue
Block a user