[MDEV-7029] AVG() without group by on non matching row returns NULL Created: 2014-11-05 Updated: 2014-11-08 Resolved: 2014-11-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | None |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | jocelyn fournier | Assignee: | Sergei Golubchik |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Hi, I wonder if it's a bug or a feature, but I find this behaviour quite disturbing. e.g. :
However, if a GROUP BY is added, no rows are returned :
Empty set (0.00 sec) Thanks and regards, |
| Comments |
| Comment by Sergei Golubchik [ 2014-11-08 ] | |||||||
|
Quoting the standard (ISO/IEC 9075-2:2003, 4.15 Data analysis operations):
That explains that NULL is correct. Even more:
But if you add GROUP BY you should get one row per group, as there are no groups you get no rows. |