Bug #6814 Views: Crashes if view exists with complex selection
Submitted: 24 Nov 2004 22:46 Modified: 2 Mar 2005 22:26
Reporter: Peter Gulutzan
Status: Closed
Category:Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Bugs System Target Version:

[24 Nov 2004 22:46] Peter Gulutzan
Description:
If a database contains a view definition with certain GROUP BY and HAVING clauses, 
attempts to USE the database will crash the server. 
Since database corruption is possible, I suggest starting the test with a new database. 
 

How to repeat:
<< start mysql client >> 
 
create database db80; 
use db80; 
create function f () returns int return 5; 
create table t (s1 int); 
create table t1 (s1 char,s2 char); 
create view vl as select s2,sum(s1) - count(s2) as vx from t1 group by s2 having sum(s1)
- 
count(s2) < (select f() from t); 
quit; 
 
<< start mysql client again >> 
use db80; 
/* The return is "Database changed" but in fact the server has crashed by now. */
[1 Dec 2004 0:04] Peter Gulutzan
I can cause the same results with a view that contains no grouping, but calls a function.
[13 Feb 2005 20:48] Oleksandr Byelkin
ChangeSet
  1.1822 05/02/13 21:47:00 bell@sanja.is.com.ua +2 -0
  fixed SP processing for mysql_list_fields() command (BUG#6814)
[24 Feb 2005 3:17] Oleksandr Byelkin
Thank you for bugreport!
Bugfix is pushed into 5.0.3 source repository.
[2 Mar 2005 22:26] Paul DuBois
Noted in 5.0.3 changelog.