Skip to content

Query having just "one aggregation with filter" produces no result if aggregation' filter does not match any record #13982

@kmozaid

Description

@kmozaid

select AirlineId, count(*) filter (where OriginStateName = 'xyz') from airlineStats group by AirlineId limit 10 - This query does not produce any result.

select AirlineId, count(*) filter (where OriginStateName = 'xyz'), count(*) from airlineStats group by AirlineId limit 10 - Here added one more aggregation, now it will produce the result, and "aggregation with filter" column will have value as 0 in all rows.

select AirlineId, count(*) filter (where OriginStateName = 'xyz') from airlineStats group by AirlineId limit 10 and select AirlineId, count(*) from airlineStats where OriginStateName = 'xyz' group by AirlineId limit 10 queries are behaving same, although user expect all matching group keys to return with value as 0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions