Bug #11263 mysql crash on count(distinct x) and group by concat() / not bug 11088
Submitted: 11 Jun 2005 20:01 Modified: 25 Jul 2005 10:20
Reporter: Martin Friebe (Gold Quality Contributor) (OCA) Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S1 (Critical)
Version:4.1.12 OS:FreeBSD (freebsd)
Assigned to: CPU Architecture:Any

[11 Jun 2005 20:01] Martin Friebe
I have attached an sqldump of two tables, and a query which crash 4.1.12 with the patch for  bug 11088 applied.

I have tried to reduce it or create a simplier table to produce it, but didn't succeed.

I imported both tables from the mysqldump myself, in order to ensure there was no table corruption. It tried also repair and analyze.

I reduced the values for key_buffer_size, read_buffer_size, sort_buffer_size to reduce the max amount of memory required.

How to repeat:
see attached files, developers only

the racsh appears for some query/data combinations, query in the form of:

select concat(t2.col1, '/', t2.col2), count(distinct t1.col3) from t1 left join t2 on t1colx = t2.colx group by concat(t2.col1, '/', t2.col2);

Suggested fix:
[13 Jun 2005 14:00] Martin Friebe
It might be the same bug as http://bugs.mysql.com/bug.php?id=11167

I have just read the background to the above bug, (as given in the patch info) and found the following.

- If I change the length of the 2 involved varchar to <= 127, it does not crash anymore
- if I put a left( concat(..), 255) around the group criteria, it does not crash.
- if I put a left( concat(..), 256) around the group criteria, it does crash.

I will apply patches for the above bug and report back later.
[13 Jun 2005 15:08] Martin Friebe
I have applied the additional patch, unfortunatly it did not fix the Issue, sorry.
[13 Jun 2005 18:48] Martin Friebe
looks someone has an easier way to produce this:

I verified with my data, and his data.
- group by a function that returns a string >= 256 char
- at  least one row returns NULL fro the group by criteria
- count distinct  is present
[1 Jul 2005 13:23] MySQL Verification Team
Hello Martin,

Sorry for the delay :(

Is it possible for you to test this bug report with 4.1.13?

If no, can you please upload data for testing again? They are not available anymore.

It's better to upload data to our ftp and let us know the file name:
[25 Jul 2005 10:20] Martin Friebe
Thank, I have tested against 4.1.13. The problem does not occur anymore.