From: | Vik Fearing <vik(at)postgresfriends(dot)org> |
---|---|
To: | Bryn Llewellyn <bryn(at)yugabyte(dot)com> |
Cc: | pgsql-hackers list <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: jsonb_object() seems to be buggy. jsonb_build_object() is good. |
Date: | 2020-02-15 03:12:43 |
Message-ID: | b18a78a4-f2be-d783-3e62-6ba487fe0545@postgresfriends.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2020-02-15 03:19:40 | Re: jsonb_object() seems to be buggy. jsonb_build_object() is good. |
Previous Message | Amit Kapila | 2020-02-15 03:08:55 | Re: [HACKERS] Moving relation extension locks out of heavyweight lock manager |