Re: 8.14.5 jsonb subscripting

Поиск
Список
Период
Сортировка
От Arne Sommerfelt
Тема Re: 8.14.5 jsonb subscripting
Дата
Msg-id CADSx+e9U8kqJfujLaF-qD1nh22uLfNnBdJg-mvsxWyWMkO30oA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: 8.14.5 jsonb subscripting  (Arne Sommerfelt <arne.sommerfelt@gmail.com>)
Список pgsql-docs
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

В списке pgsql-docs по дате отправления:

Предыдущее
От: Arne Sommerfelt
Дата:
Сообщение: Re: 8.14.5 jsonb subscripting
Следующее
От: Tom Lane
Дата:
Сообщение: Re: 8.14.5 jsonb subscripting