Re: json_object returning jsonb reuslt different from returning json, returning text

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: json_object returning jsonb reuslt different from returning json, returning text
Дата
Msg-id 2a30c387-3c59-59a2-cd24-e85b7ab17e80@dunslane.net
обсуждение исходный текст
Ответ на Re: json_object returning jsonb reuslt different from returning json, returning text  (alias <postgres.rocks@gmail.com>)
Ответы Re: json_object returning jsonb reuslt different from returning json, returning text  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
On 2022-04-25 Mo 01:19, alias wrote:
>
> seems it's a bug around value 0.
>
> SELECT JSON_OBJECTAGG(k: v ABSENT ON NULL WITH UNIQUE KEYS RETURNING
> jsonb)
> FROM (VALUES (1, 1), (10, NULL),(4, null), (5, null),(6, null),(2, 2))
> foo(k, v);
> return:
> {"1": 1, "2": 2}
>
> SELECT JSON_OBJECTAGG(k: v ABSENT ON NULL WITH UNIQUE KEYS RETURNING
> jsonb)
> FROM (VALUES (1, 1), (0, NULL),(4, null), (5, null),(6, null),(2, 2))
> foo(k, v);
>
> return
>  {"0": null, "1": 1, "2": 2}


Thanks for the report.

I don't think there's anything special about '0' except that it sorts
first. There appears to be a bug in the uniquefying code where the first
item(s) have nulls. The attached appears to fix it. Please test and see
if you can break it.


cheers


andrew



--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: tweak to a few index tests to hits ambuildempty() routine.
Следующее
От: Bharath Rupireddy
Дата:
Сообщение: An attempt to avoid locally-committed-but-not-replicated-to-standby-transactions in synchronous replication