Re: Create array of data from JSONB in PG 9.5

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Create array of data from JSONB in PG 9.5
Дата
Msg-id 28530.1573834098@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Create array of data from JSONB in PG 9.5  (Arup Rakshit <ar@zeit.io>)
Список pgsql-general
Arup Rakshit <ar@zeit.io> writes:
> I wrote the below SQL which works and give me what I want, but it doesn’t work in 9.5 version. I wrote this query in
PG10. I want to change it so that I can run it on 9.5 as production using 9.5 version. I need help on this. 

> SELECT DISTINCT
>     ARRAY [jsonb_array_elements(data) ->> 'group', jsonb_array_elements(jsonb_array_elements(data) -> 'properties')
->>'name'] 
> FROM
>     "vessels"
> WHERE
>     "vessels"."deleted_at" IS NULL
>     AND "vessels"."company_id" = '7d105acd-be5a-4225-a2db-b549105e4172';

> When I ran the same query to production I get error:
> ERROR:  set-valued function called in context that cannot accept a set

IIRC, you can't nest calls of set-returning functions before about v10.
One workaround is to put the inner set-returning function call into a
sub-select.

            regards, tom lane



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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Create array of data from JSONB in PG 9.5
Следующее
От: Dave Hughes
Дата:
Сообщение: Authentication: MD5 to SCRAM-SHA-256 error