[MDEV-2532] LP:883976 - exists with DISTINCT & ORDER BY returns incorrect result Created: 2011-10-30  Updated: 2015-02-02  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Oleksandr Byelkin Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug883976.xml    

 Description   

CREATE TABLE t1(pk INT PRIMARY KEY, a INT, INDEX idx(a));
INSERT INTO t1 VALUES (1, 10), (3, 30), (2, 20);
CREATE TABLE t2(pk INT PRIMARY KEY, a INT, b INT, INDEX idxa(a));
INSERT INTO t2 VALUES (2, 20, 700), (1, 10, 200), (4, 10, 100);
SELECT * FROM t1
WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);

returns 3 rows but should return only one. Without DISTINCT or ORDER BY result is correct.

repeatable in 5.1 (actually incorrect result present in test suite results)



 Comments   
Comment by Igor Babaev [ 2011-12-29 ]

Re: exists with DISTINCT & ORDER BY returns incorrect result
This is a duplicate of the bug #906322.

Comment by Elena Stepanova [ 2012-04-27 ]

Re: exists with DISTINCT & ORDER BY returns incorrect result
Fix for the bug #906322 was released in 5.2.11

Comment by Rasmus Johansson (Inactive) [ 2012-04-27 ]

Launchpad bug id: 883976

Generated at Thu Feb 08 06:42:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.