Bug #2172 MySQL server causes heavy system error and gets closed by Windows
Submitted: 19 Dec 2003 7:07 Modified: 19 Dec 2003 7:34
Reporter: Konstantin Reznichak Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:mysql-3.23.38 OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[19 Dec 2003 7:07] Konstantin Reznichak
Description:
I have discovered the bug (?) in MySQL server version 3.23.38 for Windows (I use local server for tests).
Here is simple query:

SELECT CASE WHEN price>0 THEN SUM(count*price) ELSE '0' END FROM position

This query causes MySQL server to be stopped by Windows.
Does someone know what is wrong?

How to repeat:
1. Create table 'position' (name: varchar(32), price: int, count: int)
2. Execute this query:

SELECT CASE WHEN price>0 THEN SUM(count*price) ELSE '0' END FROM position

... or this query

SELECT IF (price>0, SUM(price*count), '0') FROM position

Both queries will cause MySQL server to be closed by Windows...

Suggested fix:
???
[19 Dec 2003 7:34] MySQL Verification Team
The server 3.23.38 is pretty older. I tested your case with 3.23.58:

C:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 3.23.58-max-debug

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

mysql> Create table position (name varchar(32), price int, count int);
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT CASE WHEN price>0 THEN SUM(count*price) ELSE '0' END FROM position;
+------------------------------------------------------+
| CASE WHEN price>0 THEN SUM(count*price) ELSE '0' END |
+------------------------------------------------------+
|                                                    0 |
+------------------------------------------------------+
1 row in set (0.01 sec)

mysql> SELECT IF (price>0, SUM(price*count), '0') FROM position;
+-------------------------------------+
| IF (price>0, SUM(price*count), '0') |
+-------------------------------------+
| 0                                   |
+-------------------------------------+
1 row in set (0.00 sec)

Please try to upgrade the MySQL server to version 3.23.58