Bug #111681 | EXISTS query results in duplicate rows | ||
---|---|---|---|
Submitted: | 6 Jul 2023 13:47 | Modified: | 12 Jul 2023 12:11 |
Reporter: | Xianghai Liu | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0 | OS: | Linux |
Assigned to: | CPU Architecture: | Any | |
Tags: | exists |
[6 Jul 2023 13:47]
Xianghai Liu
[6 Jul 2023 14:17]
MySQL Verification Team
HI Mr. Liu, Thank you for your bug report. However, this is not a bug. There is nothing in the SQL standard that enforces distinct results. Hence, you have to do it explicitly, like: SELECT DISTINCT gigt.* ..................... Not a bug.
[12 Jul 2023 12:11]
MySQL Verification Team
Hi Mr. Liu, We can now confirm that this is a bug. However, it is a bit different from what you reported. The bug lies in the fact that adding filters increases the result set. This is now a verified bug report.
[20 Oct 2023 15:08]
Sean Ross
Any update on this? Experienced today when using NOT EXISTS and EXISTS in the same query. Not sure if it has anything to do with both foreign keys matching exactly the main table key? Our tables were built decades ago so don't follow conventional rules therefore our clients table has the key clientID, I am using NOT EXISTS on a removals table with the foreign key clientID and then checking EXISTS on a policies table which also has a foreign key clientID. All have the table name before the key name however it seems to be causing confusion. By removing either of the NOT EXISTS or EXISTS filter the result set is as expected without duplicates
[23 Oct 2023 10:29]
MySQL Verification Team
Hi Mr. Liu, No, there are no news regarding this bug. Every team in Development has it's own scheduling of bug fixing and those change very frequently. Hence, nobody knows when will this be addressed. Regarding EXISTS and NOT EXISTS we have added that comment to our internal bugs DB.