Bug #5104 Views with DISTINCT and LIMIT return incorrect result

Submitted: 19 Aug 2004 9:47 Modified: 27 Aug 2004 8:32
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2 OS:
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[19 Aug 2004 9:47] Georg Richter
Description:
VIEW with DISTINCT and LIMIT returns wrong results.

How to repeat:
[09:42] root@test> create table t1 (a int);
Query OK, 0 rows affected (0.05 sec)

5.0.2-alpha-debug-log
[09:43] root@test> insert into t1 values (1),(1),(2),(2),(3),(3);
Query OK, 6 rows affected (0.00 sec)
Records: 6  Duplicates: 0  Warnings: 0

5.0.2-alpha-debug-log
[09:43] root@test> create view v1 as select a from t1;
Query OK, 0 rows affected (0.00 sec)

5.0.2-alpha-debug-log
[09:43] root@test> select distinct a from v1;
+------+
| a    |
+------+
|    1 |
|    2 |
|    3 |
+------+
3 rows in set (0.00 sec)

5.0.2-alpha-debug-log
[09:43] root@test> select distinct a from v1 limit 2;
+------+
| a    |
+------+
|    2 |
|    2 |
+------+
2 rows in set (0.00 sec)
[21 Aug 2004 3:12] MySQL Verification Team
Verified against server from BK source 3 days older.
[26 Aug 2004 12:12] Oleksandr Byelkin
ChangeSet 
  1.1733 04/08/26 13:11:06 bell@sanja.is.com.ua +4 -0 
  fix of Item_ref with result_field (BUG#5104)
[27 Aug 2004 8:32] Oleksandr Byelkin
Thank you for bugreport. bugfix is pushed into our source repository.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.