json_agg produces nonstandard json

From: Jordan Deitch <jwdeitch(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: json_agg produces nonstandard json
Date: 2017-05-04 17:31:07
Message-ID: CAK1UM_YDJOXEyZu4c3whMV1AekOL-KekXyhY_3WVw7odsyxPcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

I apologize in advanced if this has been previously discussed;

A json(b)_agg() will produce the following result when no results are
passed in:

"[null]"

per:

select jsonb_agg((select 1 where false));

I believe, generally speaking, '[]' would be the more appropriate output.

Would postgres welcome a patch to handle the empty case of json(b)_agg?

Thanks!

---
Jordan Deitch

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-05-04 17:33:39 Re: CTE inlining
Previous Message Andrew Dunstan 2017-05-04 17:20:20 Re: CTE inlining