Re: [BUGS] BUG #14849: jsonb_build_object doesn't like VARIADIC callsvery much

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [BUGS] BUG #14849: jsonb_build_object doesn't like VARIADIC callsvery much
Дата
Msg-id CAB7nPqTsuq=rnM8PQGxNS3Gh=JQQp4RmdPxGLGXSV648X4yfhA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [BUGS] BUG #14849: jsonb_build_object doesn't like VARIADIC callsvery much  (Dmitry Dolgov <9erthalion6@gmail.com>)
Ответы Re: [BUGS] BUG #14849: jsonb_build_object doesn't like VARIADIC callsvery much
Список pgsql-bugs
On Fri, Oct 13, 2017 at 10:56 PM, Dmitry Dolgov <9erthalion6@gmail.com> wrote:
>> On 13 October 2017 at 15:48, Michael Paquier <michael.paquier@gmail.com>
>> wrote:
>>
>> it is perfectly valid to have something like json_build_array('2', NULL)
>> or
>> json_build_object('1', NULL), because there can be NULL values in JSON
>> strings. What we just need to be careful here is to check if the array
>> is NULL or not in a variadic call, and just return NULL in this case.
>
> Oh, indeed, I agree.

Okay. Attached is an updated patch fixing what you have reported. Now
things behave as I would expect the way they should:
=# select json_build_array(variadic NULL::text[]);
 json_build_array
------------------
 null
(1 row)
=# select json_build_array(variadic '{}'::text[]);
 json_build_array
------------------
 []
(1 row)
=# select json_build_object(variadic '{}'::text[]);
 json_build_object
-------------------
 {}
(1 row)
=# select json_build_object(variadic NULL::text[]);
 json_build_object
-------------------
 null
(1 row)

Thanks Dmitry for the review.
-- 
Michael

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: GDR!
Дата:
Сообщение: Re: [BUGS] BUG #14851: Systemd kills long-running recovery
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] Combination of ordered-set aggregate function terminates JDBC connection on PostgreSQL 9.6.5