pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: arne.sommerfelt@gmail.com
To: pgsql-docs@lists.postgresql.org
Subject: Re: 8.14.5  jsonb subscripting
Date: Tue, 09 Apr 2024 13:16:51 +0200
Message-ID: <e1b66e9d49654e1609107ac89b71c29be7c0014d.camel@cybertec.at> (raw)
In-Reply-To: <171265510066.682.7886492568248508496@wrigleys.postgresql.org>
References: <171265510066.682.7886492568248508496@wrigleys.postgresql.org>

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





view thread (15+ messages)  latest in thread

Message-ID: <e1b66e9d49654e1609107ac89b71c29be7c0014d.camel@cybertec.at>
Permalink:  ../e1b66e9d49654e1609107ac89b71c29be7c0014d.camel@cybertec.at/
Also on:    postgresql.org/message-id/e1b66e9d49654e1609107ac89b71c29be7c0014d.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: laurenz.albe@cybertec.at, arne.sommerfelt@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: 8.14.5  jsonb subscripting
  In-Reply-To: <e1b66e9d49654e1609107ac89b71c29be7c0014d.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox