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

Поиск
Список
Период
Сортировка
От alias
Тема Re: json_object returning jsonb reuslt different from returning json, returning text
Дата
Msg-id CAJA4AWTJWt06LA5CAxuFb39X5KmD8fF0JeC1Qrb_jXuR8Lvcyg@mail.gmail.com
обсуждение исходный текст
Ответ на 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

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}



On Mon, Apr 25, 2022 at 10:41 AM alias <postgres.rocks@gmail.com> wrote:
select json_objectagg(
k:v absent on null with unique keys returning text )
from (
values(1,1),(0, null),(3, null),(2,2),(4,null)
) foo(k, v);
return 

    json_objectagg
----------------------
 { "1" : 1, "2" : 2 }
--------------------
select json_objectagg(k:v absent on null with unique keys)
from (
values(1,1),(0, null),(3, null),(2,2),(4,null)
) foo(k, v);
return

json_objectagg ---------------------- { "1" : 1, "2" : 2 }

But
select json_objectagg(
k:v absent on null with unique keys returning jsonb )
from (
values(1,1),(0, null),(3, null),(2,2),(4,null)
) foo(k, v);
return
json_objectagg ----------------------------- {"0": null, "1": 1, "2": 2}

the last query "returning jsonb" should be   { "1" : 1, "2" : 2 } ?

version:
PostgreSQL 15devel (Ubuntu 15~~devel~20220407.0430-1~713.git79b716c.pgdg20.04+1) on x86_64-pc-linux-gnu,
compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit

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

Предыдущее
От: alias
Дата:
Сообщение: json_object returning jsonb reuslt different from returning json, returning text
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL