pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
8.14.5  jsonb subscripting
15+ messages / 6 participants
[nested] [flat]

* 8.14.5  jsonb subscripting
@ 2024-04-09 09:31  PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 15+ messages in thread

From: PG Doc comments form @ 2024-04-09 09:31 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: arne.sommerfelt@gmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/datatype-json.html
Description:

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


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5  jsonb subscripting
@ 2024-04-09 11:16  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 15+ messages in thread

From: Laurenz Albe @ 2024-04-09 11:16 UTC (permalink / raw)
  To: arne.sommerfelt@gmail.com; pgsql-docs@lists.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





^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 13:05  Arne Sommerfelt <arne.sommerfelt@gmail.com>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 2 replies; 15+ messages in thread

From: Arne Sommerfelt @ 2024-04-09 13:05 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-docs@lists.postgresql.org

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.albe@cybertec.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
>

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 13:10  Arne Sommerfelt <arne.sommerfelt@gmail.com>
  parent: Arne Sommerfelt <arne.sommerfelt@gmail.com>
  1 sibling, 0 replies; 15+ messages in thread

From: Arne Sommerfelt @ 2024-04-09 13:10 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-docs@lists.postgresql.org

I checked with SELECT VERSION(); and got:
PostgreSQL 12.17 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 7.3.1
20180712 (Red Hat 7.3.1-12), 64-bit

tir. 9. apr. 2024 kl. 15:05 skrev Arne Sommerfelt <arne.sommerfelt@gmail.com
>:

> 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.albe@cybertec.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
>>
>

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 14:00  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Arne Sommerfelt <arne.sommerfelt@gmail.com>
  1 sibling, 1 reply; 15+ messages in thread

From: Tom Lane @ 2024-04-09 14:00 UTC (permalink / raw)
  To: Arne Sommerfelt <arne.sommerfelt@gmail.com>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org

Arne Sommerfelt <arne.sommerfelt@gmail.com> writes:
> 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.

According to what docs?  Generic subscripting was added in v14.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 14:02  Arne Sommerfelt <arne.sommerfelt@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 15+ messages in thread

From: Arne Sommerfelt @ 2024-04-09 14:02 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org

[image: image.png]

tir. 9. apr. 2024 kl. 16:00 skrev Tom Lane <tgl@sss.pgh.pa.us>:

> Arne Sommerfelt <arne.sommerfelt@gmail.com> writes:
> > 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.
>
> According to what docs?  Generic subscripting was added in v14.
>
>                         regards, tom lane
>

Attachments:

  [image/png] image.png (139.2K, ../../CADSx+e9pzPJooKVbf3D7NZb9KTOGYM71o3u2=0--0BxzrgcX0Q@mail.gmail.com/3-image.png)
  download | view image

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 14:04  Daniel Gustafsson <daniel@yesql.se>
  parent: Arne Sommerfelt <arne.sommerfelt@gmail.com>
  1 sibling, 1 reply; 15+ messages in thread

From: Daniel Gustafsson @ 2024-04-09 14:04 UTC (permalink / raw)
  To: Arne Sommerfelt <arne.sommerfelt@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org

> On 9 Apr 2024, at 16:02, Arne Sommerfelt <arne.sommerfelt@gmail.com> wrote:

> <image.png>

Thats the documentation for v16, not the version you are running.

--
Daniel Gustafsson






^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 14:04  Arne Sommerfelt <arne.sommerfelt@gmail.com>
  parent: Arne Sommerfelt <arne.sommerfelt@gmail.com>
  1 sibling, 1 reply; 15+ messages in thread

From: Arne Sommerfelt @ 2024-04-09 14:04 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org

12 is in the list of supported versions at the top of chapter 8.14. And the
non-working examples is in subsection 8.14.5

tir. 9. apr. 2024 kl. 16:02 skrev Arne Sommerfelt <arne.sommerfelt@gmail.com
>:

> [image: image.png]
>
> tir. 9. apr. 2024 kl. 16:00 skrev Tom Lane <tgl@sss.pgh.pa.us>:
>
>> Arne Sommerfelt <arne.sommerfelt@gmail.com> writes:
>> > 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.
>>
>> According to what docs?  Generic subscripting was added in v14.
>>
>>                         regards, tom lane
>>
>

Attachments:

  [image/png] image.png (139.2K, ../../CADSx+e8NDcvEjsd-9Pz+d2HYnRJ5F5G4RnDmeus1Vv2p-cBhmg@mail.gmail.com/3-image.png)
  download | view image

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 14:06  Daniel Gustafsson <daniel@yesql.se>
  parent: Arne Sommerfelt <arne.sommerfelt@gmail.com>
  0 siblings, 1 reply; 15+ messages in thread

From: Daniel Gustafsson @ 2024-04-09 14:06 UTC (permalink / raw)
  To: Arne Sommerfelt <arne.sommerfelt@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org

> On 9 Apr 2024, at 16:04, Arne Sommerfelt <arne.sommerfelt@gmail.com> wrote:
> 
> 12 is in the list of supported versions at the top of chapter 8.14. And the non-working examples is in subsection 8.14.5

I think you've misunderstood the header of the page.  This is the documentation
you should be reading for your version if Postgres:

	https://www.postgresql.org/docs/12/index.html

--
Daniel Gustafsson






^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 14:07  Arne Sommerfelt <arne.sommerfelt@gmail.com>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 15+ messages in thread

From: Arne Sommerfelt @ 2024-04-09 14:07 UTC (permalink / raw)
  To: daniel@yesql.se; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org

OK, sorry if am making unnecessary noise. Since my version was listed as
supported I assumed the docs was valid for me.

Thanks for your help
cheers
Arne

tir. 9. apr. 2024 kl. 16:04 skrev Daniel Gustafsson <daniel@yesql.se>:

> > On 9 Apr 2024, at 16:02, Arne Sommerfelt <arne.sommerfelt@gmail.com>
> wrote:
>
> > <image.png>
>
> Thats the documentation for v16, not the version you are running.
>
> --
> Daniel Gustafsson
>
>

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 14:09  Arne Sommerfelt <arne.sommerfelt@gmail.com>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 2 replies; 15+ messages in thread

From: Arne Sommerfelt @ 2024-04-09 14:09 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org

Thank you!  When googling it is easy to end up with latest docs,
unfortunately

Arne

tir. 9. apr. 2024 kl. 16:06 skrev Daniel Gustafsson <daniel@yesql.se>:

> > On 9 Apr 2024, at 16:04, Arne Sommerfelt <arne.sommerfelt@gmail.com>
> wrote:
> >
> > 12 is in the list of supported versions at the top of chapter 8.14. And
> the non-working examples is in subsection 8.14.5
>
> I think you've misunderstood the header of the page.  This is the
> documentation
> you should be reading for your version if Postgres:
>
>         https://www.postgresql.org/docs/12/index.html
>
> --
> Daniel Gustafsson
>
>

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 14:09  Daniel Gustafsson <daniel@yesql.se>
  parent: Arne Sommerfelt <arne.sommerfelt@gmail.com>
  0 siblings, 0 replies; 15+ messages in thread

From: Daniel Gustafsson @ 2024-04-09 14:09 UTC (permalink / raw)
  To: Arne Sommerfelt <arne.sommerfelt@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org

> On 9 Apr 2024, at 16:07, Arne Sommerfelt <arne.sommerfelt@gmail.com> wrote:
> 
> OK, sorry if am making unnecessary noise. Since my version was listed as supported I assumed the docs was valid for me.

No worries, we're all here to learn.  The "supported version" means that 12 is
a version which the project still supports with bugfixes.

--
Daniel Gustafsson






^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 14:13  David G. Johnston <david.g.johnston@gmail.com>
  parent: Arne Sommerfelt <arne.sommerfelt@gmail.com>
  1 sibling, 0 replies; 15+ messages in thread

From: David G. Johnston @ 2024-04-09 14:13 UTC (permalink / raw)
  To: Arne Sommerfelt <arne.sommerfelt@gmail.com>; +Cc: Daniel Gustafsson <daniel@yesql.se>; Tom Lane <tgl@sss.pgh.pa.us>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

On Tuesday, April 9, 2024, Arne Sommerfelt <arne.sommerfelt@gmail.com>
wrote:

> Thank you!  When googling it is easy to end up with latest docs,
> unfortunately
>

The 12 is a hyperlink so it is almost just as easy to view the current page
in the prior version.

David J.

^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-09 14:26  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Arne Sommerfelt <arne.sommerfelt@gmail.com>
  1 sibling, 1 reply; 15+ messages in thread

From: Tom Lane @ 2024-04-09 14:26 UTC (permalink / raw)
  To: Arne Sommerfelt <arne.sommerfelt@gmail.com>; +Cc: Daniel Gustafsson <daniel@yesql.se>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org

Arne Sommerfelt <arne.sommerfelt@gmail.com> writes:
> Thank you!  When googling it is easy to end up with latest docs,
> unfortunately

That's actually good news --- it used to be that Google would
tend to steer people to very ancient versions of our docs.
Sounds like the SEO work that we've done is paying off.

However, if you're running a moderately old PG version, you need
to make use of the links at the top of the page to go to the
equivalent page in the older version's docs.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: 8.14.5 jsonb subscripting
@ 2024-04-10 07:31  Arne Sommerfelt <arne.sommerfelt@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 15+ messages in thread

From: Arne Sommerfelt @ 2024-04-10 07:31 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Daniel Gustafsson <daniel@yesql.se>; Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-docs@lists.postgresql.org

Thank you all for super prompt and friendly support.

Best regards
Arne

tir. 9. apr. 2024 kl. 16:26 skrev Tom Lane <tgl@sss.pgh.pa.us>:

> Arne Sommerfelt <arne.sommerfelt@gmail.com> writes:
> > Thank you!  When googling it is easy to end up with latest docs,
> > unfortunately
>
> That's actually good news --- it used to be that Google would
> tend to steer people to very ancient versions of our docs.
> Sounds like the SEO work that we've done is paying off.
>
> However, if you're running a moderately old PG version, you need
> to make use of the links at the top of the page to go to the
> equivalent page in the older version's docs.
>
>                         regards, tom lane
>

^ permalink  raw  reply  [nested|flat] 15+ messages in thread


end of thread, other threads:[~2024-04-10 07:31 UTC | newest]

Thread overview: 15+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 09:31 8.14.5  jsonb subscripting PG Doc comments form <noreply@postgresql.org>
2024-04-09 11:16 ` Laurenz Albe <laurenz.albe@cybertec.at>
2024-04-09 13:05   ` Re: 8.14.5 jsonb subscripting Arne Sommerfelt <arne.sommerfelt@gmail.com>
2024-04-09 13:10     ` Re: 8.14.5 jsonb subscripting Arne Sommerfelt <arne.sommerfelt@gmail.com>
2024-04-09 14:00     ` Re: 8.14.5 jsonb subscripting Tom Lane <tgl@sss.pgh.pa.us>
2024-04-09 14:02       ` Re: 8.14.5 jsonb subscripting Arne Sommerfelt <arne.sommerfelt@gmail.com>
2024-04-09 14:04         ` Re: 8.14.5 jsonb subscripting Daniel Gustafsson <daniel@yesql.se>
2024-04-09 14:07           ` Re: 8.14.5 jsonb subscripting Arne Sommerfelt <arne.sommerfelt@gmail.com>
2024-04-09 14:09             ` Re: 8.14.5 jsonb subscripting Daniel Gustafsson <daniel@yesql.se>
2024-04-09 14:04         ` Re: 8.14.5 jsonb subscripting Arne Sommerfelt <arne.sommerfelt@gmail.com>
2024-04-09 14:06           ` Re: 8.14.5 jsonb subscripting Daniel Gustafsson <daniel@yesql.se>
2024-04-09 14:09             ` Re: 8.14.5 jsonb subscripting Arne Sommerfelt <arne.sommerfelt@gmail.com>
2024-04-09 14:13               ` Re: 8.14.5 jsonb subscripting David G. Johnston <david.g.johnston@gmail.com>
2024-04-09 14:26               ` Re: 8.14.5 jsonb subscripting Tom Lane <tgl@sss.pgh.pa.us>
2024-04-10 07:31                 ` Re: 8.14.5 jsonb subscripting Arne Sommerfelt <arne.sommerfelt@gmail.com>

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