[MDEV-22269] Mariadb lacks GROUPING() function Created: 2020-04-17  Updated: 2023-11-13

Status: Open
Project: MariaDB Server
Component/s: Data Manipulation - Subquery
Fix Version/s: None

Type: Task Priority: Major
Reporter: Philip orleans Assignee: Unassigned
Resolution: Unresolved Votes: 6
Labels: compat80

Issue Links:
Duplicate
is duplicated by MDEV-32789 Add GROUPING function Closed
PartOf
is part of MDEV-28906 MySQL 8.0 desired compatibility Open

 Description   

MySQL 8 already allows this:
Using GROUPING() to substitute labels for the super-aggregate NULL values makes the result easier to interpret:
SELECT
IF(GROUPING(name) = 1, 'All items', name) AS name,
IF(GROUPING(size) = 1, 'All sizes', size) AS size,
SUM(quantity) AS quantity
FROM t1
GROUP BY name, size WITH ROLLUP;

This is an old feature of MsSQL. Over the years I have filed a few times a request so MariaDB fixes this problem because we cannot return nulls in the grouping cells, we need to add a meaningful label. Please stop procrastinating and listen to the business people. We cannot work efficiently as it is.
https://dev.mysql.com/doc/refman/8.0/en/group-by-modifiers.html



 Comments   
Comment by Yitzchak [ 2021-08-03 ]

Is there a label for things mysql 8 has that mariadb does not? I see Compatibility, but that seems to have a lot of other stuff in it.

Comment by Philip orleans [ 2021-08-03 ]

I was referring to MySQL 8 and MSSQL, both offer his feature.

Comment by Mark [ 2023-05-14 ]

PostgreSQL and Oracle also include this.

I presume this is an oversight and that MariaDB is just waiting for the right moment to announce that it’s ready to go.

I’ve noticed a few things now where MariaDB has slipped behind MySQL.

Comment by Philip orleans [ 2023-05-15 ]

I hope so too.

Generated at Thu Feb 08 09:13:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.