Re: 8.14.5 jsonb subscripting - Mailing list pgsql-docs

From Laurenz Albe
Subject Re: 8.14.5 jsonb subscripting
Date
Msg-id e1b66e9d49654e1609107ac89b71c29be7c0014d.camel@cybertec.at
Whole thread Raw
In response to 8.14.5 jsonb subscripting  (PG Doc comments form <noreply@postgresql.org>)
Responses Re: 8.14.5 jsonb subscripting
List pgsql-docs
On Tue, 2024-04-09 at 09:31 +0000, PG Doc comments form wrote:
> Page: https://www.postgresql.org/docs/16/datatype-json.html
>
> Using subscripts with square brackets is not supported, one must use -> or
> #> operators
> The given examples result in error:
>
> SELECT ('{"a": 1}'::jsonb)['a'];
>
> -- Extract nested object value by key path
> SELECT ('{"a": {"b": {"c": 1}}}'::jsonb)['a']['b']['c'];
>
> -- Extract array element by index
> SELECT ('[1, "2", null]'::jsonb)[1];

You must be using an old PostgreSQL version where that is not yet supported.

Yours,
Laurenz Albe



pgsql-docs by date:

Previous
From: PG Doc comments form
Date:
Subject: 8.14.5 jsonb subscripting
Next
From: Arne Sommerfelt
Date:
Subject: Re: 8.14.5 jsonb subscripting