Recently I have come across two queries as:
select jsonb_build_object('a', jsonb_agg(1))
where false;
select jsonb_build_object('a', jsonb_agg(1))
where false
having count(*) > 0;
First retuns {"a": null}, second - nothing, could you please explain me what happens in these 2 queries? I would expect nothing in result for BOTH.