Re: [HACKERS] json_agg produces nonstandard json

2017-05-04 Thread Tom Lane
Jordan Deitch writes: > However, I don't see consistency between the results of these two > statements: > select jsonb_agg((select 1 where false)); > select sum((select 1 where false)); Well, SUM() is defined to ignore null input values, which is not too surprising as it couldn't do anything ver

Re: [HACKERS] json_agg produces nonstandard json

2017-05-04 Thread Jordan Deitch
Thank you for responding! Good points. However, I don't see consistency between the results of these two statements: select jsonb_agg((select 1 where false)); select sum((select 1 where false)); Therefore another option I would like to suggest is returning the same null value-types for the sum(

Re: [HACKERS] json_agg produces nonstandard json

2017-05-04 Thread Tom Lane
Jordan Deitch writes: > A json(b)_agg() will produce the following result when no results are > passed in: > "[null]" > per: > select jsonb_agg((select 1 where false)); Looks fine to me. > I believe, generally speaking, '[]' would be the more appropriate output. Why? What you gave it was one n

[HACKERS] json_agg produces nonstandard json

2017-05-04 Thread Jordan Deitch
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 postg