Bug #9672 mysql_stmt_attr_set CURSOR_TYPE_READ_ONLY query containing GROUP BY
Submitted: 6 Apr 2005 11:11 Modified: 5 May 2005 15:47
Reporter: Berto van de Kraats Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version: 5.0.4-beta-nightly-20050328 OS:Linux (linux)
Assigned to: Konstantin Osipov CPU Architecture:Any

[6 Apr 2005 11:11] Berto van de Kraats
Description:
mysql crashes if the attached program is run. The program uses a query containing a group by statement. The combination with cursor type CURSOR_TYPE_READ_ONLY  seems to make the program crash.

no more rows found
 mysql_stmt_close(), failed
stmt error=MySQL server has gone away
2006:MySQL server has gone away

at server end following message is generated:

Number of processes running now: 0
050406 12:53:35  mysqld restarted

How to repeat:
compile/run the attached simple c-api program

if the line containing 

mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void *) &type);

is disabled the program runs fine

the program returns the expected result:

A00; 17.0000
B01; 18.0000
C01; 18.0000
D11; 16.5556
D21; 15.5000
E01; 16.0000
E11; 14.2000
E21; 15.0000
no more rows found
[6 Apr 2005 11:12] Berto van de Kraats
bug5.c

Attachment: bug5.c (application/octet-stream, text), 6.38 KiB.

[5 May 2005 15:47] Konstantin Osipov
I can't repeat the bug when using the latest 5.0 from BK.
This bug has been fixed along with the fix for Bug#9520.
Feel free to reopen the bug report if the problem is reproducible in your environment using 
the latest version from bk.

kostja@dragonfly:~> gcc bug5.c -I/home/kostja/work/mysql-5.0-root/include -L/home/kostja/work/mysql-5.0-root/libmysql/.libs -lmysqlclient -lz -lcrypt -lssl
kostja@dragonfly:~> ./a.out 
5.0.6-beta-valgrind-max-debug
A00; 17.0000
B01; 18.0000
C01; 18.0000
D11; 16.5556
D21; 15.5000
E01; 16.0000
E11; 14.2000
E21; 15.0000
no more rows found
kostja@dragonfly:~> ./a.out
5.0.6-beta-valgrind-max-debug
A00; 17.0000
B01; 18.0000
C01; 18.0000
D11; 16.5556
D21; 15.5000
E01; 16.0000
E11; 14.2000
E21; 15.0000
no more rows found
kostja@dragonfly:~> ./a.out
5.0.6-beta-valgrind-max-debug
A00; 17.0000
B01; 18.0000
C01; 18.0000
D11; 16.5556
D21; 15.5000
E01; 16.0000
E11; 14.2000
E21; 15.0000
no more rows found