Re: jsonb_object() seems to be buggy. jsonb_build_object() is good.

Поиск
Список
Период
Сортировка
От Vik Fearing
Тема Re: jsonb_object() seems to be buggy. jsonb_build_object() is good.
Дата
Msg-id d20e0613-4707-1b0f-2e16-10ed99dd44c9@postgresfriends.org
обсуждение исходный текст
Ответ на jsonb_object() seems to be buggy. jsonb_build_object() is good.  (Bryn Llewellyn <bryn@yugabyte.com>)
Ответы Re: jsonb_object() seems to be buggy. jsonb_build_object() is good.  (Bryn Llewellyn <bryn@yugabyte.com>)
Список pgsql-hackers
On 15/02/2020 03:21, Bryn Llewellyn wrote:
> Now execute this supposed functional equivalent:
> 
> select jsonb_pretty(jsonb_object(
>   '{a, 17, b, "dog", c, true}'::varchar[]
>   ))
> 
> It is meant to be a nice alternative when you want to build an object (rather than an array) because the syntax is
lessverbose.
 
> 
> However, it gets the wrong answer, thus:
> 
>  {              +
>      "a": "17", +
>      "b": "dog",+
>      "c": "true"+
>  }
> 
> Now, the numeric value and the boolean value are double-quoted—in other words, they have been implicitly converted to
JSONprimitive text values.
 

They haven't been implicitly converted, you gave an array of varchars.
How should it know that you don't want texts?

> Do you agree that this is a bug?
No.
-- 
Vik Fearing



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

Предыдущее
От: Bryn Llewellyn
Дата:
Сообщение: jsonb_object() seems to be buggy. jsonb_build_object() is good.
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: [HACKERS] Moving relation extension locks out of heavyweight lock manager