Bug #101570 query result truncated
Submitted: 12 Nov 2020 2:22 Modified: 17 Feb 13:43
Reporter: Fengchun Hua Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:8.0.22, 5.7.32 OS:Any
Assigned to: CPU Architecture:Any

[12 Nov 2020 2:22] Fengchun Hua
Description:
distinct(cast(double as char)) may truncate result.

How to repeat:
create table t1 (double_col double);
insert into t1 values(-1.7976931348623157e308);
select * from t1;

+-------------------------+
| double_col              |
+-------------------------+
| -1.7976931348623157e308 |
+-------------------------+
1 row in set (0.00 sec)

select distinct(cast(double_col as char)) from t1;
+----------------------------+
| (cast(double_col as char)) |
+----------------------------+
| -1.7976931348623157e30     |
+----------------------------+
1 row in set (0.00 sec)

result truncate when calling save_in_field
[12 Nov 2020 6:09] MySQL Verification Team
Hello Fengchun Hua,

Thank you for the report and test case.

Thanks,
Umesh
[18 Nov 2020 18:32] Jon Stephens
This is fixed in MySQL 8.0.23 by the fix for BUG#92537.

See same for docs info.

Closed.