Bug #119937 Result is not correct when using pow function with group by

Submitted: 25 Feb 4:54 Modified: 25 Feb 9:24
Reporter: Gou Xie (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[25 Feb 4:54] Gou Xie
Description:
Hi, 

We met an incorrect result when using pow function with group by. The result seem to be truncated. 

Thanks.

How to repeat:
create table xt1(c1 int);
insert into xt1 (c1) values(84);
select format(pow(c1,84),84) from xt1;

mysql> select format(pow(c1,84),84) from xt1;
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| format(pow(c1,84),84)                                                                                                                                                                                                                                  |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 435,973,436,827,325,500,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.000000000000000000000000000000 |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

mysql> select format(pow(c1,84),84) from xt1 group by c1;
+---------------------------------------------------------------+
| format(pow(c1,84),84)                                         |
+---------------------------------------------------------------+
| 435,973,436,827,325,500,000,000,000,000,000,000,000,000,000,0 |
+---------------------------------------------------------------+
1 row in set (0.00 sec)
[25 Feb 9:24] Roy Lyseng
Thank you for the bug report.
Verified as described.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.