Bug #9696 | SELECT DISTINCT returns too few rows | ||
---|---|---|---|
Submitted: | 6 Apr 2005 21:38 | Modified: | 20 Apr 2005 1:07 |
Reporter: | Mardy | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1.10 | OS: | Linux (Linux Debian unstable) |
Assigned to: | CPU Architecture: | Any |
[6 Apr 2005 21:38]
Mardy
[6 Apr 2005 22:08]
Mardy
Actually, it looks like Mysql behaviour changed, in respect to handling varchar fields. Now it just considers the fields values up to the lenght specified when the table was created... I don't know if this is a bug or just the correct behaviour; to me, it looks very troublesome when someone is upgrading from an order version (if he uses the varchar fields for more than their length in some SELECT query, they might not work properly).
[13 Apr 2005 22:55]
Jorge del Conde
I was unable to reproduce this bug w/4.1.11 from bk: mysql> SELECT DISTINCT discid FROM videodata WHERE discid LIKE 'str%'; +--------+ | discid | +--------+ | str 1 | | str 2 | | str 3 | +--------+ 3 rows in set (0.00 sec) Can you please provide us with a test-case that successfully reproduces this bug ? Thanks
[14 Apr 2005 22:15]
Mardy
The problem only occurs when upgrading from a previous version. It looks like mysql versions <4.1 allowed storing a string of length m > n in a VARCHAR(n) column. When upgrading, the exceeding characters in these columns are not lost, but the become unusable in queries: you can retrieve them with a SELECT, but just the first n bytes are considered in WHERE clauses. So I guess this is not really a bug: mysql 4.1 is quite coherent, but users upgrading from previous versions should be warned.
[20 Apr 2005 1:07]
MySQL Verification Team
There is information in our Manual about upgrading 4.0 > 4.1: http://dev.mysql.com/doc/mysql/en/upgrading-from-4-0.html