Bug #6441 Aggregate UDF in multi-table query crashes MySQL when returning multiple rows
Submitted: 4 Nov 2004 20:30 Modified: 25 Nov 2004 12:20
Reporter: Jon Wagoner Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: User-defined functions ( UDF ) Severity:S1 (Critical)
Version:4.1.7 OS:Linux (Linux)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[4 Nov 2004 20:30] Jon Wagoner
I have a UDF that I've been using in MySQL 4.0.21.  I upgraded our dev server to MySQL 4.1.7, and it now crashes the server.  This only happens on multi-table queries, and only when the query returns more than one row.  To see if it was just my code, I tried the avgcost example UDF, and got the same behavior.

How to repeat:
1. Create test data and load avgcost UDF into Mysql.
2. Execute query
3. Server crashes
[4 Nov 2004 20:32] Jon Wagoner
trace log

Attachment: mysqld.trace.gz (application/x-gzip, text), 26.38 KiB.

[4 Nov 2004 20:33] Jon Wagoner
SQL dump of test data

Attachment: testdata.sql (application/octet-stream, text), 1.86 KiB.

[4 Nov 2004 20:33] Jon Wagoner
Error log

Attachment: mysqld.err (application/octet-stream, text), 1.85 KiB.

[4 Nov 2004 20:33] Jon Wagoner
Resolved backtrace from error log

Attachment: mysqld.resolved (application/octet-stream, text), 612 bytes.

[4 Nov 2004 20:35] Jon Wagoner
The query I used to crash the server is:

SELECT avgcost(test1.field1, test1.field3) FROM test1, test2 WHERE test2.field2 = test1.field2 GROUP BY test1.field2;
[4 Nov 2004 22:02] MySQL Verification Team
Thank you for the bug report I was able to repeat with latest
BK source.
[25 Nov 2004 12:20] Ramil Kalimullin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at

Additional info:

fixed in 4.1.8