Bug #4645 mysql server crash by decimal field

Submitted: 20 Jul 2004 11:19 Modified: 20 Jul 2004 13:22
Reporter: Jarek Dylag Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.20 OS:Linux (linux)
Assigned to: CPU Architecture:Any

[20 Jul 2004 11:19] Jarek Dylag
Description:
Mysql server crashes after SELECT query, when the WHERE clause is a decimal field and set index size is less then precision. I've tested it on mysql4.0.16, mysql4.0.18, mysql4.0.20.

How to repeat:
CREATE TABLE `test` (
  `id` int(11) NOT NULL default '0',
  `example` decimal(5,2) NOT NULL default '0.00',
  KEY `example` (`example`(3))
) TYPE=MyISAM;
INSERT INTO `test` VALUES (1, '0.10');
INSERT INTO `test` VALUES (2, '120.00');
SELECT * FROM `test` WHERE example = "1"
[20 Jul 2004 13:22] Aleksey Kishkin
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.20-standard

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

mysql> CREATE TABLE `test` (
    ->   `id` int(11) NOT NULL default '0',
    ->   `example` decimal(5,2) NOT NULL default '0.00',
    ->   KEY `example` (`example`(3))
    -> ) TYPE=MyISAM;
Query OK, 0 rows affected (0.02 sec)

mysql> INSERT INTO `test` VALUES (1, '0.10');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO `test` VALUES (2, '120.00');
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM `test` WHERE example = "1";
Empty set (0.01 sec)
[20 Jul 2004 17:35] Jarek Dylag
sorry, my mistake, 

last query should be:

SELECT * FROM `test` WHERE example = "0";

Full:
CREATE TABLE `test` (
`id` int(11) NOT NULL default '0',
`example` decimal(5,2) NOT NULL default '0.00',
KEY `example` (`example`(3))
) TYPE=MyISAM;
INSERT INTO `test` VALUES (1, '0.10');
INSERT INTO `test` VALUES (2, '120.00');
SELECT * FROM `test` WHERE example = "0"

But query:
SELECT * FROM `test` WHERE example = 0;
don't cause crash.

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

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