Re: 8.14.5 jsonb subscripting

From: Arne Sommerfelt <arne(dot)sommerfelt(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: 8.14.5 jsonb subscripting
Date: 2024-04-09 13:05:57
Message-ID: CADSx+e9erxctpqTM=fu_Fc9R-jhSDM4RY8UXVHAGJ5Dt8VD05Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

I am running on AWS RDS - it says engine version 12.17 i thought that was
the postgres version. If so, the [] subscripting should be supported
according to docs.

Arne

tir. 9. apr. 2024 kl. 13:16 skrev Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>:

> 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
>

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Arne Sommerfelt 2024-04-09 13:10:59 Re: 8.14.5 jsonb subscripting
Previous Message Laurenz Albe 2024-04-09 11:16:51 Re: 8.14.5 jsonb subscripting