BUG #18682: Null grouping set with empty table returns a row contains null. - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18682: Null grouping set with empty table returns a row contains null.
Date
Msg-id 18682-1d820e9e8f60c369@postgresql.org
Whole thread Raw
Responses Re: BUG #18682: Null grouping set with empty table returns a row contains null.
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18682
Logged by:          Yue Xingzhi
Email address:      459850212@qq.com
PostgreSQL version: 15.0
Operating system:   CentOS
Description:

The test case is quite simple

create table qt1 (c_bigint bigint,b  bit(1));
SELECT avg(qt1.c_bigint) as c1 FROM qt1 GROUP BY grouping sets(()); --
returns one row
SELECT avg(qt1.c_bigint) as c1 FROM qt1 GROUP BY grouping sets((b)); --
returns no rows

As one would intuitively expect, empty table should return no rows for empty
grouping set. Oracle also returns no rows

Could you please explain the behavior or if it is buggy? Thx


pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Detection of hadware feature => please do not use signal
Next
From: Thomas Munro
Date:
Subject: Re: Detection of hadware feature => please do not use signal