[MDEV-3772] LP:702345 - Empty query with SUM and HAVING, no GROUP BY returns NULL instead of empty result. Created: 2011-01-13 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: | Timour Katchaounov (Inactive) | Assignee: | Timour Katchaounov (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following test case (for LP BUG#609121) extracted from subselect_mat.test: create table t1 (c1 int); SELECT SUM(c1) c1_sum FROM t1 WHERE c1 IN (SELECT c2 FROM t2) HAVING c1_sum; incorrectly produces a NULL instead of an empty result. |
| Comments |
| Comment by Timour Katchaounov (Inactive) [ 2011-01-14 ] |
|
Re: Empty query with SUM and HAVING, no GROUP BY returns NULL instead of empty result. |
| Comment by Timour Katchaounov (Inactive) [ 2011-01-17 ] |
|
Re: Empty query with SUM and HAVING, no GROUP BY returns NULL instead of empty result. tmp_having= having; having= 0; At the same time, this query detects an empty result set, and calls if (having && having->val_int() == 0) However having has been already set to NULL, so return_zero_rows Solution: |
| Comment by Rasmus Johansson (Inactive) [ 2011-01-17 ] |
|
Launchpad bug id: 702345 |