From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | tomas(at)tuxteam(dot)de |
Cc: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: jsonb: unwrapping text |
Date: | 2021-10-27 23:18:20 |
Message-ID: | CAKFQuwaqLrA3Bfk9QOUSBb5Xu_VFJ=j-1ZvP9xmgcf0an0sdyA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Oct 27, 2021 at 11:58 AM <tomas(at)tuxteam(dot)de> wrote:
>
> I've found out that one can treat a string singleton as if it
> were an array:
>
> foo=# select '"foo"'::jsonb ->> 0;
> ?column?
> ----------
> foo
> (1 row)
>
> which conveniently returns the right type. My question: can I rely
> on that, or am I missing a much more obvious option?
>
>
Not sure if this exact behavior is trustworthy - but you are on the right
path. Place the value into either a json array or json object and then use
the text versions of the accessor methods to get the json value to pass
through the decoding routine.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2021-10-28 01:58:31 | Re: WAL File Recovery on Standby Server Stops Before End of WAL Files |
Previous Message | Louise Grandjonc | 2021-10-27 22:44:04 | Re: Segmentation fault in volatile c function |