Bug #49524 rejecting the maximum value of double when parsing is not enough.

Submitted: 8 Dec 2009 5:15 Modified: 8 Dec 2009 8:23
Reporter: Horst Hunger Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:mysql-next-mr(-alik), 5.0, 5.1 OS:Linux (SUSE 11.1, 2.6.27.37-0.1-default #1 SMP 2009-10-15 14:56:58 +0200 x86_64 x86_64 x86_64 GNU/Linux)
Assigned to: CPU Architecture:Any

[8 Dec 2009 5:15] Horst Hunger
Description:
Rejecting the maximum value of the type double (1.7976931348623157E+308) when parsing the statement doesn't catch expressions, e.g.:

create table t1 (c1 int,c2 double);

mysql> insert into t1 values (234,9999999e30*9999999e30);
Query OK, 1 row affected (0.01 sec)

mysql> select * from t1;
+------------+---------------------+
| c1         | c2                  |
+------------+---------------------+
|        234 | 9.9999980000001e+73 |
+------------+---------------------+
3 rows in set (0.00 sec)

mysql> insert into t1 values (234,9999999e130*9999999e230);
Query OK, 1 row affected (0.00 sec)

mysql> select * from t1;
+------------+---------------------+
| c1         | c2                  |
+------------+---------------------+
|        234 | 9.9999980000001e+73 |
|        234 |                NULL |
+------------+---------------------+
4 rows in set (0.00 sec)

mysql> insert into t1 values (234,9999999e330/9999999e230);
ERROR 1367 (22007): Illegal double '9999999e330' value found during parsing
mysql> insert into t1 values (234,9999999e30/9999999e20);
Query OK, 1 row affected (0.00 sec)

How to repeat:
execute with mysql:

create table t1 (c1 int,c2 double);
insert into t1 values (234,9999999e30*9999999e30);
select * from t1;
insert into t1 values (234,9999999e130*9999999e230);
select * from t1;
insert into t1 values (234,9999999e330/9999999e230);

Suggested fix:
The expression needs to be evaluated and in case the evaluation wouldn't be possible or the result of the expression would not be valid a warning or error should be set. That also valid for update, prepare, execute, select etc.
[8 Dec 2009 7:56] Horst Hunger
For more tests look at WL#5176.
[8 Dec 2009 8:23] Sveta Smirnova
Thank you for the report.

Verified as described.

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

Page generated in 0.039 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.