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


Reply via email to