[MDEV-2478] LP:715738 - Wrong result with implicit grouping and empty result set Created: 2011-02-09 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: | Trivial |
| Reporter: | Philip Stoev (Inactive) | Assignee: | Timour Katchaounov (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
When executing the following query with materialization, it returns a row, even though the WHERE clause must be false because the subquery in the NOT IN predicate returns ( NULL , NULL ) , which should make the NOT IN predicate FALSE. It seems this is only observed with queries that violate the ONLY_FULL_GROUP_BY SQL mode. Test case: SET SESSION optimizer_switch = 'in_to_exists=off,materialization=on,semijoin=off'; CREATE TABLE t2 ( f1 int(11), f3 int(11), PRIMARY KEY (f1)) ; CREATE TABLE t3 ( f4 date, f11 varchar(1)) ; SELECT f4 FROM t3 explain: ---
---
--- |
| Comments |
| Comment by Timour Katchaounov (Inactive) [ 2011-02-15 ] |
|
Re: Wrong result with materialization=on in maria-5.3 maria-5.3-mwl89 SELECT f4 FROM t3 WHERE ( 2 , 7 ) NOT IN ( SELECT f1 , MIN( f3 ) FROM t2);
|
| Comment by Timour Katchaounov (Inactive) [ 2011-02-15 ] |
|
Re: Wrong result with materialization=on in maria-5.3 maria-5.3-mwl89 |
| Comment by Timour Katchaounov (Inactive) [ 2011-03-03 ] |
|
Re: Wrong result with materialization=on in maria-5.3 maria-5.3-mwl89 While this query correctly returns NULL: |
| Comment by Timour Katchaounov (Inactive) [ 2011-03-04 ] |
|
Re: Wrong result with materialization=on in maria-5.3 maria-5.3-mwl89 In 5.3 the result is wrong both for in-to-exists and materialization.
The strategy works fine in 5.3-mwl89 because there
Solution: The fix is to check if a table has 0 rows in |
| Comment by Timour Katchaounov (Inactive) [ 2011-03-22 ] |
|
Re: Wrong result with implicit grouping and empty result set |
| Comment by Rasmus Johansson (Inactive) [ 2011-12-13 ] |
|
Launchpad bug id: 715738 |