[MDEV-5719] Wrong result with GROUP BY and LEFT OUTER JOIN Created: 2014-02-24 Updated: 2015-01-27 Resolved: 2015-01-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.0.8 |
| Fix Version/s: | 10.0.16 |
| Type: | Bug | Priority: | Major |
| Reporter: | Pavel Ivanov | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 12 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
Here's the mysql session log:
As you see the first query returns NULLs instead of real values which |
| Comments |
| Comment by Sergei Petrunia [ 2014-02-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Investigation details have been posted here: | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-02-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
if I roll back the change we've got with merge from mysql-5.6, then the testcase provided in this bug passes, and the 'main' testsuite passes, too.
| |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-02-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Related patches in MySQL:
^ this one doesn't have a testcase
^ this one has three testcases. | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-02-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
I'm trying testcases from MySQL bug on mariadb-10.0 + the above patch. Bug#11760517: passes, the result is same as in mysql-5.6 Bug#13422961: MySQL has:
MariaDB 10.0 + patch has:
As for 13430588, MariaDB and MySQL produce the same result, but is it really
The join didn't produce a single row. Is it correct that output has i=1 ? | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-03-04 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
In MySQL 5.6, they've changed it to produce a non-NULL value intentionally: | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2014-05-17 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Another test case from https://mariadb.com/kb/en/select-with-group-by-behavior-in-55-vs-100/ :
| |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by alex stacey [ 2014-05-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Hello Can anyone tell me under which conditions this bug happens? From the first test-case, I thought it can happen on any 2 tables joined with a LEFT JOIN with >1 join conditions and GROUP BY, but it seems from the last test case above that it doesn't need >1 join conditions. I have found that there are lots of ways the query can be slightly changed which will un-trigger the bug and return correct values but I still don't understand the conditions that the bug happen under. We are running this version of MariaDB in a production environment and it would be great to know what to look for to see if this is affecting us. Thanks | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Aaron [ 2014-11-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, Can anyone provide information about which release the bug fix for this will be in? Or at least a status update? Cheers | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-11-26 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Aaron, Thanks for your patience in waiting for this reply. Unfortunately, no work has been done so far. This bug is scheduled for the next 10.0 release (10.0.16) but I cannot promise at the moment. | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Cameron Dale [ 2014-12-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
It seems this was fixed in version 5.6.13 of MySQL. Doesn't that mean the work needed to include it in Maria DB is minimal? | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nirbhay Choubey (Inactive) [ 2015-01-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
http://lists.askmonty.org/pipermail/commits/2015-January/007324.html | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nirbhay Choubey (Inactive) [ 2015-01-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Updated the test case to create INNODB tables (instead of default MyISAM) : | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2015-01-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Explanations about why the fix above actually fixes the problem: | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2015-01-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Pushed the fix into 10.0 tree. Will close this MDEV when we know which version it is released in. | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Nirbhay Choubey (Inactive) [ 2015-01-27 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
Fix released in 10.0.16. |