I can confirm that this bug is fixed by upstream in 5.5.36 (latest). I believe it might be http://bugs.mysql.com/bug.php?id=68749
Here's the results of the testcase showing expected output: morgo@Rbook:~/sandboxes/msb_5_5_36$ ./use < ~/Desktop/testdump6.sql.txt count(distinct(testtab.foo)) 111 count(testtab.foo) 111 count(distinct(testtab.foo)) 111 ** Bug watch added: MySQL Bug System #68749 http://bugs.mysql.com/bug.php?id=68749 ** Also affects: mysql-server via http://bugs.mysql.com/bug.php?id=68749 Importance: Unknown Status: Unknown -- You received this bug notification because you are a member of Ubuntu Server/Client Support Team, which is subscribed to MySQL. Matching subscriptions: Ubuntu Server/Client Support Team https://bugs.launchpad.net/bugs/1111611 Title: Mysql distinct count returns wrong value in some circumstances To manage notifications about this bug go to: https://bugs.launchpad.net/mysql-server/+bug/1111611/+subscriptions -- Mailing list: https://launchpad.net/~enterprise-support Post to : [email protected] Unsubscribe : https://launchpad.net/~enterprise-support More help : https://help.launchpad.net/ListHelp

