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
b18a78a4-f2be-d783-3e62-6ba487fe0545@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. Vik Fearing <vik@postgresfriends.org>
Re: 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. Vik Fearing <vik@postgresfriends.org>
Re: jsonb_object() seems to be buggy. jsonb_build_object() is good. "David G. Johnston" <david.g.johnston@gmail.com>
Re: jsonb_object() seems to be buggy. jsonb_build_object() is good. "David G. Johnston" <david.g.johnston@gmail.com>
Re: 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. Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: 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. Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: 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. Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Re: jsonb_object() seems to be buggy. jsonb_build_object() is good. Bryn Llewellyn <bryn@yugabyte.com>
On 15/02/2020 04:07, Bryn Llewellyn wrote:
> This:
> 
> select jsonb_pretty(jsonb_build_object(
>  'a'::varchar, 1.7::numeric,
>  'b'::varchar, 'dog'::varchar,
>  'c'::varchar, true::boolean
>  ))
> 
> allows me to express what I want. That’s a good thing. Are you saying that this:
> 
> select jsonb_pretty(jsonb_object(
>  '{a, 17, b, "dog", c, true}'::varchar[]
>  ))
> 
> simply lacks that power of expression and that every item in the array is assumed to be intended to end up as a JSON text primitive value? In other words, do the double quotes around "dog" have no effect?

That is correct.

> That would be a bad thing—and it would limit the usefulness of the jsonb_object() function.

Use the long form if you need to mix datatypes.
-- 
Vik Fearing


В списке pgsql-hackers по дате отправления
От: Amit Kapila
Дата:
От: David G. Johnston
Дата:
FAQ