[MDEV-681] LP:1002326 - Wrong result with empty table, implicit grouping and non-aggregated column in select Created: 2012-05-21 Updated: 2014-04-11 Resolved: 2014-04-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.3.12 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Timour Katchaounov (Inactive) | Assignee: | Timour Katchaounov (Inactive) |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following test case produces wrong result:
The only difference between the queries are the braces in the FROM clause. This test case was extracted from bug lp:1002079. |
| Comments |
| Comment by Rasmus Johansson (Inactive) [ 2012-05-21 ] |
|
Launchpad bug id: 1002326 |
| Comment by Timour Katchaounov (Inactive) [ 2012-05-21 ] |
|
Re: Wrong result with empty table, HAVING, implicit grouping and non-aggregated column in select |
| Comment by Timour Katchaounov (Inactive) [ 2013-02-28 ] |
|
Analysis: In both cases JOIN::prepare sets table->maybe_null= 1 for all tables because there is mixed implicit grouping (mixes an aggregate with no aggregate). The join order is "t2, t1", because t2 is constant. 1.correct result execution steps Since table->maybe_null == false, this branch returns -1. Having a zero_result_cause results in calling return_zero_rows, which produces the NULL row. 2. Incorrect execution |
| Comment by Elena Stepanova [ 2014-04-11 ] |
|
The bug is 5.3-only (apparently there is a typo in a previous comment about versions). Since it only happens in the old version and is a corner case with a non-deterministic query, I think it's not critical to fix it. Closing. |