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 Team, which is subscribed to mysql-5.5 in Ubuntu. 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 -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs