Bug #3585 Distinct appears to return complete random garbage on win32, mysql 4.0.18-nt
Submitted: 28 Apr 2004 11:54 Modified: 28 May 2004 14:11
Reporter: Ken Wright Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.18-nt OS:Windows (windows XP Pro)
Assigned to: CPU Architecture:Any

[28 Apr 2004 11:54] Ken Wright
Description:

Example select statement:

mysql> select distinct UserID, Password from Users;
+---------+----------------------------------------------------+
| UserID  | Password                                           |
+---------+----------------------------------------------------+
| 7628110 | core Testing (1)                               Mar |
| 7628110 | core Testing (admin)                           Tes |
| 7628110 | core Testing (admin)                           Tes |
| 7628110 | core Testing (1)                               Mar |
| 7628110 | core Testing (admin)                               |
| 7562580 | t Pub                                              |
|       1 | Test Pub                                           |
|       2 | Marie Claire                                       |
|       1 |                                                    |
|       2 |                                                    |
|       1 | test                                               |
|       1 | test                098f6bcd4621d373cade4e832627b4 |
|       1 | 098f6bcd4621d373cade4e832627b4f6                   |
+---------+----------------------------------------------------+
13 rows in set (0.00 sec)

Same statement without distinct keyword:

mysql> select UserID, Password from Users;
+--------+----------------------------------+
| UserID | Password                         |
+--------+----------------------------------+
|      1 | 098f6bcd4621d373cade4e832627b4f6 |
|      2 | 098f6bcd4621d373cade4e832627b4f6 |
+--------+----------------------------------+
2 rows in set (0.00 sec)

There are only two records in the Users table. Distinct appears to return a garbled mess, even with random ascii characters in the result set.

How to repeat:

Simply use the 'distinct' keyword in your select clause!

Suggested fix:

Don't use windows!
[28 Apr 2004 14:11] Sergei Golubchik
could you provide a complete test case ?
Starting from create table ..., then insert..., and select distinct at the end.
Something we can use as "mysql <test_case.sql" to repeat the bug
[14 Feb 2005 22:54] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".