Bug #11814 CAST crashing mysql server

Submitted: 8 Jul 2005 13:01 Modified: 8 Jul 2005 14:18
Reporter: Disha Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.7-beta-nt OS:Windows (Window 2000)
Assigned to: CPU Architecture:Any

[8 Jul 2005 13:01] Disha
Description:
Using cast function in select crashing server.

How to repeat:
1. delimiter//
2. Execute following statments
	drop table if exists tb01//
	create table tb01 ( f1 tinyint, f2 char(1))//
	insert into tb01 values (1,'a'),(2,null),(3,'c'),(null,'d')//
	SELECT CAST(f1 AS DECIMAL(9,4)) AS tint, f2 from tb01//

Suggested fix:
May be null is not supporting to 'null' value. If you check data inserted you will find 'null' values.
[8 Jul 2005 14:18] MySQL Verification Team
Testing against a Windows server built from BK source, the behavior
reported not happens anymore:

c:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.10-beta-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> delimiter //
mysql> drop table if exists tb01//
Query OK, 0 rows affected, 1 warning (0.16 sec)

mysql>  create table tb01 ( f1 tinyint, f2 char(1))//
Query OK, 0 rows affected (0.25 sec)

mysql>  insert into tb01 values (1,'a'),(2,null),(3,'c'),(null,'d')//
Query OK, 4 rows affected (0.08 sec)
Records: 4  Duplicates: 0  Warnings: 0

mysql>  SELECT CAST(f1 AS DECIMAL(9,4)) AS tint, f2 from tb01//
+--------+------+
| tint   | f2   |
+--------+------+
| 1.0000 | a    |
| 2.0000 | NULL |
| 3.0000 | c    |
|   NULL | d    |
+--------+------+
4 rows in set (0.11 sec)

mysql>
[13 Jul 2005 14:28] Carsten Segieth
Using the 5.0.9-beta-nt binaries the test case "type_newdecimal" crashes when

select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15))

is reached, although the statements listed above runs without problems. 
In the current 5.0.10 version the bug is fixed.

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.